appConfig = StructNew();
uiTheme = "";
appName = "ptProfile";
defaultProfileRole = "general";
if ( StructKeyExists(application,appName) )
{
appConfig = application[appName].getAppConfig();
defaultProfileRole = application[appName].getDefaultProfileRole();
// Set the UI theme from the Configuration Element
if ( StructKeyExists(appConfig,"JQUERY_UI_THEME") AND LEN(TRIM(appConfig.JQUERY_UI_THEME)) )
uiTheme = appConfig.JQUERY_UI_THEME;
}
// Check for Local Button Rendering Overrides
if ( !StructKeyExists(request,"adfDSmodule") )
request.adfDSmodule = StructNew();
if ( !StructKeyExists(request.adfDSmodule,"renderEditBtn") OR !IsBoolean(request.adfDSmodule.renderEditBtn) )
request.adfDSmodule.renderEditBtn = true;
if ( !StructKeyExists(request.adfDSmodule,"renderDeleteBtn") OR !IsBoolean(request.adfDSmodule.renderDeleteBtn) )
request.adfDSmodule.renderDeleteBtn = true;
if ( !StructKeyExists(request.adfDSmodule,"useJQueryUI") OR !IsBoolean(request.adfDSmodule.useJQueryUI) )
request.adfDSmodule.useJQueryUI = true;
// Bootstrap and FontAwesome: set to False by default
if ( !StructKeyExists(request.adfDSmodule,"useBootstrap") OR !IsBoolean(request.adfDSmodule.useBootstrap) )
request.adfDSmodule.useBootstrap = false;
if ( !StructKeyExists(request.adfDSmodule,"useFontAwesome") OR !IsBoolean(request.adfDSmodule.useFontAwesome) )
request.adfDSmodule.useFontAwesome = false;
if ( !StructKeyExists(request.adfDSmodule,"buttonStyle") OR LEN(TRIM(request.adfDSmodule.buttonStyle)) EQ 0 )
request.adfDSmodule.buttonStyle = "";
if ( !StructKeyExists(request.adfDSmodule,"buttonSize") OR LEN(TRIM(request.adfDSmodule.buttonSize)) EQ 0 )
request.adfDSmodule.buttonSize = "";
if ( request.adfDSmodule.useBootstrap )
{
if ( LEN(TRIM(request.adfDSmodule.buttonStyle)) EQ 0 )
request.adfDSmodule.buttonStyle = "btn-primary";
if ( LEN(TRIM(request.adfDSmodule.buttonSize)) EQ 0 )
request.adfDSmodule.buttonSize = "btn-xs";
}
if ( request.adfDSmodule.useFontAwesome )
{
if ( LEN(TRIM(request.adfDSmodule.buttonStyle)) EQ 0 )
request.adfDSmodule.buttonStyle = "fa-square";
if ( LEN(TRIM(request.adfDSmodule.buttonSize)) EQ 0 )
request.adfDSmodule.buttonSize = "fa-1x";
}
formID = edata.MetadataForm;
//formID = application.ptProfile.CEData.getFormIDFromPageID(Request.DatasheetRow.pageid);
//Path to open the ligthbox to
ajaxPath = application.ADF.lightboxProxy;
// Set the SortColumn and SortValue
sortColumn = "lastname";
sortValue = request.DataSheetRow[sortColumn][Request.DataSheetRow.CurrentRow];
profileObj = "";
profilePageURL = "";
profileRoles = "";
mouseoverJS = "";
mouseoutJS = "";
profileDataSheetModHeaderCSS = "";
profileDataSheetModFooterJS = "";
//Bean to preform add/edit
EditBean = "profileForms";
EditMethod = "profileAddEdit";
EditLBaction = "refreshparent"; //"norefresh";
EditLinkTitle = "Edit Profile";
addEditUrlParameters = "";
editIcon = "ui-icon-pencil"; // Default jQueryUI
//Bean to preform deletion
DeleteBean = "profileForms";
DeleteMethod = "renderDeleteForm";
DeleteLinkTitle = "Delete Profile";
deleteUrlParameters = "";
deleteIcon = "ui-icon-trash"; // Default jQueryUI
previewLinkTitle = "View Profile";
previewRoleDefault = defaultProfileRole;
previewIcon = "ui-icon-newwin";
previewAlertIcon = "ui-icon-alert";
if ( request.adfDSmodule.useBootstrap )
{
editIcon = "glyphicon-pencil";
deleteIcon = "glyphicon-trash";
previewIcon = "glyphicon-new-window";
previewAlertIcon = "glyphicon-alert";
}
else if ( request.adfDSmodule.useFontAwesome )
{
editIcon = "fa-pencil";
deleteIcon = "fa-trash-o";
previewIcon = "fa-external-link";
previewAlertIcon = "fa-exclamation-triangle";
}
addEditLink = "#ajaxPath#?bean=#EditBean#&method=#EditMethod#&appName=#appName#&formid=#formID#&dataPageId=#Request.DatasheetRow.pageid#&lbAction=#EditLBaction#&title=#EditLinkTitle##addEditUrlParameters#";
deleteLink = "#ajaxPath#?bean=#DeleteBean#&method=#DeleteMethod#&appName=#appName#&formid=#formID#&dataPageid=#Request.DatasheetRow.pageid#&title=#DeleteLinkTitle##deleteUrlParameters#";
previewLink = "";
// Get the element record for the profile
profileData = application.ptProfile.profileDAO.getProfileData(fieldName="uniqueid",fieldVal=request.datasheet.currentColumnValue);
//profileData = application.ptProfile.cedata.getCEData("Profile", "uniqueid", request.datasheet.currentColumnValue);
if ( ArrayLen(profileData) )
{
// Create the project object
profileObj = server.ADF.objectFactory.getBean("profile").initProfile(profileData[1].values.userid);
profileRoles = profileObj.getRoles();
if ( StructKeyExists(profileRoles,previewRoleDefault) AND profileRoles[previewRoleDefault].permission )
previewLink = profileRoles[previewRoleDefault].pageURL;
else
previewLink = "";
}
// Check if an profile page exists, if not update the Title and the Icon
if ( LEN(TRIM(previewLink)) EQ 0 )
{
previewLinkTitle = "No Profile Page";
previewIcon = previewAlertIcon;
}
/* if ( LEN(previewLink) )
{
profileViewLink = "";
profileViewLink = profileViewLink & "";
profileViewLink = profileViewLink & "";
}
else
{
profileViewLink = "";
} */
if ( request.adfDSmodule.useJQueryUI )
{
mouseoverJS = "jQuery(this).addClass('ui-state-hover')";
mouseoutJS = "jQuery(this).removeClass('ui-state-hover')";
}
// Load the script headers
application.ptProfile.scripts.loadJQuery();
application.ptProfile.scripts.loadADFLightbox();
// Load Icon Library Script (if not already loaded)
if ( request.adfDSmodule.useBootstrap )
application.ptProfile.scripts.loadBootstrap();
if ( request.adfDSmodule.useFontAwesome )
application.ptProfile.scripts.loadFontAwesome();
if ( request.adfDSmodule.useJQueryUI )
application.ptProfile.scripts.loadJQueryUI();
// Load the inline CSS as a CSS Resource
application.ptProfile.scripts.addHeaderCSS(profileDataSheetModHeaderCSS, "TERTIARY"); // PRIMARY, SECONDARY, TERTIARY
// Load the inline JS as a JS Resource
if ( eparam.permitClientSideSort )
application.ptProfile.scripts.addFooterJS(profileDataSheetModFooterJS, "TERTIARY"); // PRIMARY, SECONDARY, TERTIARY
|