<make id="sharedActions" type="div" level="0" dims="-50,-50,20,20" class="" refObj="sysbootstrap" autoAlign="" replace="">
<style>
{ "display" : "none" }
</style>
<function name="convertDate" event="" params="date,mask,isMillisec,utc">
<![CDATA[
/* CLIFTON: Converts a date string from the database to new format.
Params: (date and mask are required)
date = string as date from database in format 'YYYYMMDDHHMMSS'
HHMMSS parts are optional but when provided, at least
HHMM should be included.
Alternatively, you can submit result from pgCurrentTime().
mask = string mask to use for new date format.
Uses same mask methods as pgDateFormat()
isMillisec = (optional) boolean true | false (default)
Indicates whether [date] is in milliseconds format
as a result of calling pgCurrentTime()
utc = boolean true | false (default)
(uses UTC/GMT time when converting date)
***/
if (!date || !mask) return '';
utc = typeof utc == 'boolean' ? utc : false;
isMillisec = typeof isMillisec == 'boolean' ? isMillisec : false; //Ensure type default
if (!isMillisec) {
date = date.toString();
var m = date.match(/^\d{4}|\d{2}/g);
if (date.length > 3) {
m = m.slice(0, 3).join('-') + ' ' + m.slice(3).join(':');
} else {
m = m.join('-');
}
}
return tbfunction_pgDateFormat(m, mask, utc);
]]>
</function>
<function name="myUser" event="user" params="e">
<![CDATA[
/* CLIFTON: You can even make a user event on the sharedAction object.
To access the [value] parameter of the shared action:
var value = e.data OR use e.value
This example simply checks if the [value] submitted is a number
and returns true or false.
***/
return pgIsNumber( e.data );
]]>
</function>
<function name="myLoad" event="load" params="e">
<![CDATA[
/* CLIFTON: Set a global variable/property which we can call from anywhere.
***/
this.myGlobal = "Some value"; //Set as property of the sharedActions object
myUsername = "Clifton"; /Top level global accessible anywhere (not always be preferred as its not too secure.)
]]>
</function>
</make>
var args = [ tbfunction_pgCurrentTime(), "longDate" ];
var myDate = tbfunction_pgTBObjSet( "sharedActions", "convertDate", args );
//To retrieve a previous set global that is set as a property of the sharedActions object:
var myGlobal = gTBo( "sharedActions", "objRef" ).myGlobal;
OR
var myGlobal = tbfunction_userProperty( "sharedActions", "myGlobal", "", "get");
on load background
XMLHttpRequest( "GET", "../xml/sharedActions.xml", "", "nouser"); discard return value
<make id="sharedActions" type="div" level="0" dims="-50,-50,20,20" class="" refObj="sysbootstrap" autoAlign="" replace="">
<style>
{ "display" : "none" }
</style>
<function name="myUser" event="user" params="e">
<![CDATA[
/* CLIFTON: You can even make a user event on the sharedAction object.
To access the [value] parameter of the shared action:
var value = e.data OR use e.value
***/
alert (e.data);
]]>
</function>
<function name="myLoad" event="load" params="e">
<![CDATA[
/* CLIFTON: Set a global variable/property which we can call from anywhere.
***/
this.myGlobal = "Some value"; //Set as property of the sharedActions object!!
//myUsername = "Clifton"; Top level global accessible anywhere (not always be preferred as its not too secure.)!!
]]>
</function>
</make>
<make id="sharedActions" type="div" level="0" dims="-50,-50,20,20" class="" refObj="sysbootstrap" autoAlign="" replace="">
<style>
{ "display" : "none" }
</style>
<function name="myUser" event="user" params="e">
<![CDATA[
/* CLIFTON: You can even make a user event on the sharedAction object.
To access the [value] parameter of the shared action:
var value = e.data OR use e.value
***/
alert (e.data);
]]>
</function>
<function name="myCustom1" event="" params="p1,p2,p3">
<![CDATA[
/* CLIFTON: Make sure to leave event="" or the function will bound to an event.
Params:
p1 to ... pX are values of any type that can be sent to the function
You can name them any way you want, but they must be named according JavaScript conventions.
***/
if ( p1 == "Clifton" ) {
//Do something based on this condition
}
//Other code ...
]]>
</function>
</make>
var args = [ "Clifton", [ 1, 2, 3 ], { a : "candy", b: "popcorn" } ];
tbfunction_pgTBObjSet( "sharedActions", "myCustom1", args );
Users browsing this forum: No registered users and 3 guests