// Get the App configuration data
appConfigStruct = application.npsStory.appConfig;
configType = "story";
// Set the UI theme from the Configuration Element
uiTheme = 'redmond';
if ( structKeyExists(appConfigStruct,"uiTheme") AND LEN(TRIM(appConfigStruct['uiTheme'])) )
uiTheme = appConfigStruct['uiTheme'];
commentsStatus = application.npsStory.getCommentsConfigStatus();
// Set the Edit Form Page defaults
editFormPageID = 0;
editFormPageURL = '';
// Get the editFormPageID from the Configuration Element
if ( StructKeyExists(appConfigStruct,configType) AND StructKeyExists(appConfigStruct[configType],"editorPageID") AND IsNumeric(appConfigStruct[configType]['editorPageID']) )
editFormPageID = appConfigStruct[configType]['editorPageID'];
// Set the editFormPageURL from the editFormPageID
editFormPageURL = application.npsStory.csData.getCSPageURL(editFormPageID);
//if ( StructKeyExists(appConfigStruct,"addEditStoryFormPage") AND LEN(TRIM(appConfigStruct['addEditStoryFormPage'])) )
//editFormPageURL = appConfigStruct['addEditStoryFormPage'];
// Set the parent CE Name
parentCEName = application.npsStory.getStoryCEName();
commentsCEName = application.npsStory.getStoryCommentsCEName();
// load header for jQuery UI
application.npsStory.scripts.loadJQuery();
application.npsStory.scripts.loadJQueryUI(themeName=uiTheme);
application.npsStory.scripts.loadADFLightbox();
application.npsStory.scripts.loadJQueryJSON();
application.npsStory.scripts.loadCFJS();
// Set the FormID for the Story element
storyFormID = application.npsStory.getStoryFormID();
// Get the Fields that are set to be required
storyReqFields = application.npsStory.storyService.getFormRequiredFieldsStruct();
//storyReqFields = application.npsStory.storyService.requiredFieldsStruct(storyFormID);
storyReqFieldsList = StructKeyList(storyReqFields);
//application.ADF.utils.dodump(storyReqFields,"storyReqFields",0);
//application.ADF.utils.dodump(storyReqFieldsList,"storyReqFieldsList",0);
// set the story DataPageID to 0 for a new record
storyDPID = 0;
storyArray = ArrayNew(1);
storyWIP = 0;
storyActive = 0;
// set the storyDPID to edit an existing record via the URL param request.params.gsid
if ( NOT StructKeyExists(request.params,"gsid") )
request.params.gsid = 0;
if ( NOT StructKeyExists(request.params,"uuid") )
request.params.uuid = 0;
if ( NOT StructKeyExists(request.params,"debugmode") )
request.params.debugmode = 0;
//application.ADF.utils.doDump(request.params.gsid,"request.params.gsid",1);
//application.ADF.utils.doDump(request.params.uuid,"request.params.uuid",1);
//application.ADF.utils.doDump(request.params.debugmode,"request.params.debugmode",1);
if ( LEN(TRIM(request.params.gsid)) AND request.params.gsid NEQ 0 ) {
storyArray = application.npsStory.storyDAO.getStoryVerisonsByGlobalStoryID(globalStoryID=request.params.gsid,version="max");
}
else if ( LEN(TRIM(request.params.uuid)) AND request.params.uuid NEQ 0 ) {
storyArray = application.npsStory.storyDAO.getStory(uniqueID=request.params.uuid);
}
//application.ADF.utils.doDump(storyArray,"storyArray",0);
if ( ArrayLen(storyArray) ) {
if ( StructKeyExists(storyArray[1],"pageid") )
storyDPID = storyArray[1].pageid;
if ( StructKeyExists(storyArray[1],"values") ) {
storyData = storyArray[1].values;
if ( StructKeyExists(storyData, application.npsStory.appConfig.story.fieldNames.globalStoryID) )
request.params.gsid = storyData[application.npsStory.appConfig.story.fieldNames.globalStoryID];
if ( StructKeyExists(storyData, application.npsStory.appConfig.story.fieldNames.wip) )
storyWIP = storyData[application.npsStory.appConfig.story.fieldNames.wip];
if ( StructKeyExists(storyData, application.npsStory.appConfig.story.fieldNames.active) )
storyActive = storyData[application.npsStory.appConfig.story.fieldNames.active];
}
}
// Store this globally for loading the repeater forms
request.params.globalSectionControlID = 1000;