CumulusUtils Runtime Library: Difference between revisions

From Cumulus Wiki
Jump to navigationJump to search
m
no edit summary
mNo edit summary
Line 27: Line 27:


== Functions ==
== Functions ==
All functions are initialised including the timers and output will be displayed in the users website if a specific DIV with an id is used e.g.
All functions are initialised including the timers and output will be displayed in the users website if a DIV with a specific id is used e.g.
  <pre><div id='#d3SunDisc'></div></pre>
  <pre><div id='#d3SunDisc'></div></pre>
will display the Sun disc and update it over the day.
will display the Sun disc and update it over the day.


The DIV id's will be shown under the specific caption, all functions below can be called by the user. If the specific DIV IDs does not exist in the website, that should not break the calling sequence.
The DIV id's will be shown under the specific caption, all functions below can be called by the user. If the specific DIV IDs does not exist in the website, that should not be a problem.


=== Init function ===
==== Init function ====
$(function () {}


At load this function is executed and initialises the library by calling the following functions:
Call:
''$(function () {<arguments>} )''
 
At load time this function is called automatically 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
#Initialize the timer interval for reading realtime.txt
#''RT_timer = setInterval(loadRealtimeTxt, 30 * 1000);'' => Initialize the interval timer for reading realtime.txt (see below)
#''DoGaugeSettings'' => initializes the settings for the gauges as defined within CUtils. Note that Cutils uses its own gauges library and css file.
#''DoGaugeSettings'' => initializes the settings for the gauges as defined within CUtils. Note that Cutils uses its own gauges library and css file.
#''worldClockZone'' => Initializes the clocks
#''worldClockZone'' => Initializes the clocks
Line 46: Line 48:
#''LoadUtilsReport'' => It calls the initial report to load
#''LoadUtilsReport'' => It calls the initial report to load


=== loadRealtime.txt ===
==== loadRealtime.txt ====
 
Call:
No user call


This function is called automatically by the runtime system at the interval defined by the user in CMX (''Menu=>Internet Settings=>Interval Configuration=>Real time Interval Settings'').  
This function is called automatically by the runtime system at the interval defined by the user in CMX (''Menu=>Internet Settings=>Interval Configuration=>Real time Interval Settings'').  


The values are distributed to the DIVs with the (self-explaining) IDs:  
The values are distributed to the DIVs with the (self-explaining) IDs:  
  ''ajxCurTemp, ajxTempChange, ajxTempChangeIndicator, ajxTempMax, ajxTempMin, ajxCurPression, ajxBarChange, [...]''
  ''ajxCurTemp, ajxTempChange, ajxTempChangeIndicator, ajxTempMax, ajxTempMin, ajxCurPression, ajxBarChange, [...]'' etcetera... check the code.
 
The values get the configured change colour which is reset after 3 seconds.
The values get the configured change colour which is reset after 3 seconds.


=== DoGaugesSettings ===
=== DoGaugesSettings ===


This applies the gauges settings from ''cumulusutils.ini'' which requires the CUtils specific gauges.js
Call:
''DoGaugeSettings();''
 
This applies the gauges settings from ''cumulusutils.ini'' which requires the CUtils specific ''gauges.js''
Gauges which use the CMX gauges library are untouched.
Gauges which use the CMX gauges library are untouched.
=== worldClock ===
Call:
''worldClock(zone)''
Argument:
zone := The timezone difference from UTC
Returns:
string containing the time for the zone in the argument in format "hh:mm:ss"
The three clocks of CUtils are set by a summary function ''worldClockZone(zone)'' using the DIV IDs : ''CUClocktimeutc'', ''CUClocktimetz'' and ''CUClocktimeBrowser''
=== LoadUtilsReport ===
Call:
''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 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.


=== CreateSun / CreateMoon ===
=== CreateSun / CreateMoon ===
Call:
''CreateSun();''
''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.
These functions require the ''d3 library'' to  be loaded.
These functions require the ''d3 library'' to  be loaded.

Navigation menu