// the param structure which will hold all of the fields from the props dialog
var params = setDefaultParameters(argumentCollection=arguments);
var readOnly = (arguments.displayMode == "readonly");
// Get the Now() dateTimeStamp formated for CommonSpot
var csDateTimeStamp = application.ptCalendar.date.csDateFormat(Now(),Now());
var cftApprovalTrackCheckboxJS = '';
var tempFieldsType = "hidden"; //default: 'hidden' option: 'text'
var cftDebug = false; // default: false, for debugging set to TRUE
if ( cftDebug )
tempFieldsType = "text";
// Check the default value
if ( len(arguments.value) LTE 0 )
{
arguments.value = params.uncheckedVal; //'no'
// If defaulted to checked
if ( params.defaultVal EQ "yes" )
arguments.value = params.checkedVal; //'yes'
else if ( params.defaultVal EQ "denied" AND len(params.deniedVal) )
arguments.value = params.deniedVal; //'denied'
}
application.ptCalendar.scripts.addFooterJS(cftApprovalTrackCheckboxJS,"TERTIARY");
// done this way to avoid whitespace and/or a non-clickable area between checkbox and text
labelStart = "";
deniedLabelEnd = "#params.deniedLabel#";
Stored: DateTime: UserID:
private struct function setDefaultParameters(required string fieldName, required string fieldDomID, required string value)
{
var params = Duplicate(arguments.parameters);
if ( NOT StructKeyExists(params, "fldClass") )
params.fldClass = "";
else
params.fldClass = trim(params.fldClass);
if ( NOT StructKeyExists(params, "fldName") )
params.fldName = arguments.fieldName;
else if ( len(trim(params.fldName)) EQ 0 )
params.fldName = ReplaceNoCase(params.fieldName,'fic_','');
// Set the value that is stored when the checkbox is checked
if ( NOT StructKeyExists(params, "checkedVal") )
params.checkedVal = "yes";
// Set the value that is stored when the checkbox is checked
if ( NOT StructKeyExists(params, "uncheckedVal") )
params.uncheckedVal = "no";
// FieldID used to capture the Approval dateTime stamp
if( not structKeyExists(params, "fldDateTime") )
params.fldDateTime = "";
else
params.fldDateTime = trim(params.fldDateTime);
// FieldID used to capture the Approver userID
if( not structKeyExists(params, "fldUserID") )
params.fldUserID = "";
else
params.fldUserID = trim(params.fldUserID);
// FieldID of the Denial Reason Text Area field
if( not structKeyExists(params, "fldDenialMsg") )
params.fldDenialMsg = "";
else
params.fldDenialMsg = trim(params.fldDenialMsg);
// FieldID of the Denial Value Text Area field
if( not structKeyExists(params, "deniedVal") )
params.deniedVal = "";
else
params.deniedVal = trim(params.deniedVal);
// FieldID of the Denial Checkbox Label
if( not structKeyExists(params, "deniedLabel") OR len(trim(params.deniedLabel)) EQ 0 )
params.deniedLabel = "Denied";
else
params.deniedLabel = trim(params.deniedLabel);
// FieldID of the Approved Checkbox Value
if( not structKeyExists(params, "approvedLabel") )
params.approvedLabel = "";
else
params.approvedLabel = trim(params.approvedLabel);
// Set the DEFAULT Approved Label if a Denied Label has been set but no Approved Label
if ( len(params.deniedVal) AND len(params.deniedLabel) AND len(params.approvedLabel) EQ 0 )
params.approvedLabel = "Approved";
// Set the field ID from the field name
params.fldID = trim(params.fldName);
return params;
}
public string function getResourceDependencies()
{
return listAppend(super.getResourceDependencies(), "jQuery,jQueryCheckboxes,ADFcsFormUtilities");
}
public string function loadResourceDependencies()
{
application.ptCalendar.scripts.loadJQuery();
application.ptCalendar.scripts.loadJQueryCheckboxes();
application.ptCalendar.scripts.loadResources("ADFcsFormUtilities");
}