CumulusUtils Runtime Library: Difference between revisions

From Cumulus Wiki
Jump to navigationJump to search
m
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Introduction ==
== Introduction ==
''CumulusUtils.js'' is the javascript runtime library providing the modular user with functionality otherwise available only in the website. It provides e.g. timing, realtime values, clocks and report loading. It is intended for users who are using CumulusUtils in a [[Modules|modular fashion]]. The available globals and functions are described below.
''CumulusUtils.js'' is the javascript runtime library providing the modular user with functionality otherwise available only in the website. It provides e.g. timing, realtime values, clocks and report loading. It is intended for users who are using CumulusUtils in a [[Modules|modular fashion]] and are willing and able to use javascript. The available globals and functions are described below.


The library can be found in the utils directory (on the CumulusMX machine) and is transferred after generation to the lib directory on the server.
The library can be found in the utils directory (on the CumulusMX machine) and is transferred after generation to the lib directory on the server.
Line 18: Line 18:


The library is intended to be used when CUtils is used in a modular fashion. Any other use is not supported. When using modules which require javascript to function properly (e.g. the Graphs modules) cumulusutils.js must be included in the users webpage using the following HTML code:
The library is intended to be used when CUtils is used in a modular fashion. Any other use is not supported. When using modules which require javascript to function properly (e.g. the Graphs modules) cumulusutils.js must be included in the users webpage using the following HTML code:
  <script defer src='lib/cumulusutils.js'></script>
  <script src='lib/cumulusutils.js'></script>
 
And following the note above:
<script src='https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js'></script>
 
And for using the sun and moon discs:
<script src='https://cdnjs.cloudflare.com/ajax/libs/d3/5.15.1/d3.min.js'></script>"
<script src='lib/suncalc.js'></script>


== Globals ==
== Globals ==
Line 40: Line 47:
  ''$(function () {<arguments>} )''
  ''$(function () {<arguments>} )''


At load time this function is called automatically and initialises the library by calling the following functions:
At load time this function is called automatically - so it is h ere just for information, no user call is required - and initialises the library by calling the following functions:
#''loadRealtimeTxt'' => initializes the loading of ''realtime.txt'' and distributes the values over the dashboard
#''loadRealtimeTxt'' => initializes the loading of ''realtime.txt'' and distributes the values over the dashboard
#''RT_timer = setInterval(loadRealtimeTxt, 30 * 1000);'' => Initialize the interval timer for reading realtime.txt (see below)
#''RT_timer = setInterval(loadRealtimeTxt, 30 * 1000);'' => Initialize the interval timer for reading realtime.txt (see below)
Line 47: Line 54:
#''CreateSun'' and ''CreateMoon'' => Creates the sun and  moon disc
#''CreateSun'' and ''CreateMoon'' => Creates the sun and  moon disc
#''MinuteFunctions'' => initializes the minute function which takes care of the chart refreshes and the moving of the sun disc hand.
#''MinuteFunctions'' => initializes the minute function which takes care of the chart refreshes and the moving of the sun disc hand.
#''HourFunctions'' => initialisez the hour functions which takes care of the moondisc updates
#''HourFunctions'' => initializes the hour functions which takes care of the moondisc updates
#''LoadUtilsReport'' => It calls the initial report to load
#''LoadUtilsReport'' => It calls the initial report to load


Line 67: Line 74:
  ''DoGaugeSettings();''
  ''DoGaugeSettings();''


This applies the gauges settings from ''cumulusutils.ini'' which requires the CUtils specific ''gauges.js''
This applies the gauges settings from ''cumulusutils.ini'' which requires the CUtils specific ''gauges.js''.<br>
 
Gauges which use the CMX gauges library are untouched.
Gauges which use the CMX gauges library are untouched.


Line 90: Line 98:
  ''LoadUtilsReport(string, bool);'' => Loads the intended report in the DIV with ID ''CUReportView''
  ''LoadUtilsReport(string, bool);'' => Loads the intended report in the DIV with ID ''CUReportView''


Argument 1: The name of the report to load into DIV with ID: ''CUReportView''
Argument 1: The name of the report to load into DIV with ID: ''CUReportView''<br>
Argument 2: Boolean (true/false) indicating the report will be refreshed after <interval> amount of minutes. Normally used for charts.


In principle any text can be loaded in the DIV with ID ''CUReportView'' but for proper formatting it requires HTML. It can contain any javascript if that is contained in <SCRIPT></SCRIPT tags.
Argument 2: Boolean (true/false) indicating the report will be refreshed after ''<interval>'' amount of minutes. Normally true for charts.
 
In principle any text can be loaded in the DIV with ID ''CUReportView'' but for proper formatting it requires HTML. <br>
It can contain any javascript if that is contained in <SCRIPT></SCRIPT> tags.


=== CreateSun / CreateMoon ===
=== CreateSun / CreateMoon ===
Line 101: Line 111:
  ''CreateMoon();''
  ''CreateMoon();''


These functions create the sun and the moon discs in the DIVs with the IDs ''d3SunDisc'' and ''d3MoonDisc'' respectively.
These functions create the sun and the moon discs in the DIVs with the IDs ''d3SunDisc'' and ''d3MoonDisc'' respectively.<br>
 
These functions require the ''d3 library'' to  be loaded.
These functions require the ''d3 library'' to  be loaded.




[[Category:CumulusUtils]]
[[Category:CumulusUtils]]

Navigation menu