if ( StructKeyExists(attributes,"appBeanName") AND LEN(TRIM(attributes.appBeanName)) AND StructKeyExists(attributes,"appParamsVarName") AND LEN(TRIM(attributes.appParamsVarName)) ) {
attributes = application.ADF.utils.appOverrideCSParams(
csParams=attributes,
appName=attributes.appBeanName,
appParamsVarName=attributes.appParamsVarName,
paramsExceptionList="appBeanName,appParamsVarName"
);
}
application.ADF.scripts.loadJQuery();
if ( StructKeyExists(attributes,"themeName") AND LEN(TRIM(attributes.themeName)) )
application.ADF.scripts.loadJQueryUI(themeName=attributes.themeName);
else
application.ADF.scripts.loadJQueryUI();
// Load jquery cookie to remember the last tab visited
application.ADF.scripts.loadJQueryCookie();
application.ADF.scripts.loadADFLightbox();
// Bean Name for the Add Button
beanName = "Forms_1_1";
// Check to see if the attribute 'formBeanName' was passed in.
// This will override the bean to open for the form
if ( StructKeyExists(attributes,"formBeanName")
AND LEN(TRIM(attributes.formBeanName)) )
beanName = attributes.formBeanName;
// Set the 'Add Button' display defaults
displayAddButtonDefault = true; // Display the 'Add Button'
secureAddButtons = true; // Only show 'Add Button' if user is logged in
// Set the flag for the locking a secured 'Add Button'
enableAddButton = true;
// Create the struct for the 'Add Button' status
displayAddBtnOptions = StructNew();
displayAddButtonList = "";
// Set the Add Button Defualt Text
addButtonTextDefault = "Add New {{elementName}}";
customAddButtonTextList = "";
// Check to see if the attribute 'showAddButtons' was passed in with a list of display option values
// - attributes.showAddButtons=false takes presidence over enableAddButton=true
if ( StructKeyExists(attributes,"showAddButtons") AND LEN(TRIM(attributes.showAddButtons)) )
{
// Set the default if only one showAddButton option is passed in use it as the default for all
if ( ListLen(attributes.showAddButtons) EQ 1 AND IsBoolean(attributes.showAddButtons) )
displayAddButtonDefault = attributes.showAddButtons;
else
displayAddButtonList = attributes.showAddButtons;
}
// Build structure with CEName as the key and the 'Add Button' display option as the value
for ( a=1;a LTE ListLen(attributes.elementName);a=a+1 ){
ce = TRIM(ListGetAt(attributes.elementName,a));
// Build a structure Key (without spaces) based on the CEName
// to be used to store the Add Button display options for each element passed in
elmt = REREPLACE(ce,"[\s]","","all");
abtn = displayAddButtonDefault;
// set the display value for each 'Add Button' for each element tab
if ( a LTE ListLen(displayAddButtonList) )
abtn = ListGetAt(displayAddButtonList,a);
// Set the elementName key of the struct with the status value
if ( IsBoolean(abtn) )
displayAddBtnOptions[elmt] = abtn;
else
displayAddBtnOptions[elmt] = displayAddButtonDefault;
}
// Check to see if the attribute 'useAddButtonSecurity' was passed in
if ( StructKeyExists(attributes,"useAddButtonSecurity") AND IsBoolean(attributes.useAddButtonSecurity) )
secureAddButtons = attributes.useAddButtonSecurity;
// Security Check for 'Add Button'
// - enableAddButton=false takes presidence over attributes.showAddButtons=true
if ( secureAddButtons AND (LEN(request.user.userid) EQ 0 OR request.user.userid EQ "anonymous") )
enableAddButton = false;
// Check to see if the attribute 'customAddButtonText' was passed in with a list of display values
if ( StructKeyExists(attributes,"customAddButtonText") AND LEN(TRIM(attributes.showAddButtons)) )
customAddButtonTextList = attributes.customAddButtonText;
// Check the list of elements to see if need the tabs.
// Set flag to render tabs or not
// Set the class name for the surrounding div based on if
// we are rendering tabs or not.
if ( ListLen(attributes.elementName) GT 1 ) {
renderTabFormat = true;
divClass = "tabs";
}
else {
renderTabFormat = false;
divClass = "no-tabs";
}
ceName = TRIM(ListGetAt(attributes.elementName,i));
// Build an 'elementName' based on the CEName without spaces
// for the datasheet "ct-render-named-element.cfm" call
custel = REREPLACE(ceName,"[\s]","","all");
customControlName = "customManagementFor#custel#";
#application.ADF.UI.buildAddEditLink(linkTitle=addBtnText,
formName=ceName,
dataPageID=0,
refreshparent=true,
formBean=beanName,
formMethod="renderAddEditForm",
lbTitle=addBtnText,
linkClass="ui-button ui-state-default ui-corner-all")#
Please LOGIN to add new records.
Please add the parameter of 'elementName=My Element Name'. At least one Custom Element name is required for this administration custom script.