/* *+------------------------------------------------------------------------+ *| Licensed Materials - Property of IBM *| BI and PM: prmt *| (C) Copyright IBM Corp. 2002, 2011 *| *| US Government Users Restricted Rights - Use, duplication or *| disclosure restricted by GSA ADP Schedule Contract with IBM Corp. *| *+------------------------------------------------------------------------+ */ //////////////////////////////////////////////////////////////////// // selectInterval HTML generation functions //////////////////////////////////////////////////////////////////// // Function to create interval prompt control // sPromptId: The id of the prompt control (String) // sFormName: Name of form control to submit selections to the server (String) // sParameterName: Name of control element to be submitted to report server (String) // sSubmitType: 'default' will submit as a standard form (String) // 'XML' will convert the submission to XML and submit // sDefaultValue: Default value for prompt control. If prompt control is a range, this represents the start value of the range. (String) // iInitialState: Range controls only. Controls whether to check radio buttons (Integer) // RANGE_NO_VALUE will select lowest to highest // RANGE_START_VALUE will select from a particular value to highest // RANGE_END_VALUE will select from lowest to a particular value // RANGE_BOUND_VALUE will select a range // RANGE_EQUAL_VALUE will select a single value // bRequired: If the control is a required field. (Boolean) // bHideAdornments: Hide icons (e.g. star icon for required controls) (Boolean) // bShowSeconds: Show seconds field (Boolean) // bShowMilliseconds: Show milliseconds field (Boolean) // bSuppressExtraPromptNames: Force report server to handle multiple prompt controls as a single entity (Boolean) // e.g. treat datetime control as a single date time, as opposed to treating date and time independntly // bMulti: If control can accomodate more than one value. (Boolean) // bRange: If control is a range. (Boolean) // bAllowNegative: true/false, some intervals cannot be negative. Default is false. // sEndValue: Optional. Only used for range controls. The end value of the range. (String) function genSelectIntervalHTML(sPromptId, sFormName, sParameterName, sSubmitType, sDefaultValue, iInitialState, bRequired, bHideAdornments, bShowSeconds, bShowMilliseconds, bSuppressExtraPromptNames, bMulti, bRange, bAllowNegative, sEndValue, sStyle) { var oProperties = sPromptId; if (arguments.length > 1 || typeof oProperties != K_PRMT_sOBJECT) { oProperties = { id: sPromptId, formName: sFormName, parameterName: sParameterName, submitType: sSubmitType, defaultValue: sDefaultValue, initialState: iInitialState, required: bRequired, hideAdornments: bHideAdornments, showSeconds: bShowSeconds, showMilliseconds: bShowMilliseconds, suppressExtraPromptNames: bSuppressExtraPromptNames, multi: bMulti, range: bRange, allowNegative: bAllowNegative, endValue: sEndValue, style: sStyle }; } if (!oProperties.allowNegative) { oProperties.allowNegative = false; } if (oProperties.multi) { if (!oProperties.range) { genSelectIntervalMultipleHTML(oProperties); } else { genSelectIntervalRangeMultipleHTML(oProperties); } } else { if (oProperties.range) { genSelectIntervalRangeHTML(oProperties); } else { genSelectIntervalSingleHTML(oProperties); } } } function genSelectIntervalSingleHTML(s_PromptId, s_FormName, s_ParameterName, s_SubmitType, s_DefaultValue, b_Required, b_HideAdornments, b_ShowSeconds, b_ShowMilliseconds, b_SuppressExtraPromptNames, b_AllowNegative, s_Style) { var oProperties = s_PromptId; if (arguments.length > 1 || typeof oProperties != K_PRMT_sOBJECT) { oProperties = { id: s_PromptId, formName: s_FormName, parameterName: s_ParameterName, submitType: s_SubmitType, defaultValue: s_DefaultValue, required: b_Required, hideAdornments: b_HideAdornments, showSeconds: b_ShowSeconds, showMilliseconds: b_ShowMilliseconds, suppressExtraPromptNames: b_SuppressExtraPromptNames, allowNegative: b_AllowNegative, style: s_style }; } var sPromptId = oProperties.id; if (!verifyPromptId(sPromptId)) { return; } //skin folder var sSkin = (typeof getPromptSkin != K_PRMT_sUNDEFINED ? getPromptSkin() : K_PRMT_sDEFAULTSKIN); var sFormName = oProperties.formName; if (!sFormName) { sFormName = "forms[0]"; } var oIntervalSeconds = null; if (oProperties.showSeconds || oProperties.showMilliseconds) { oIntervalSeconds = "document.forms['" + sFormName + "'].elements['intervalSeconds" + sPromptId + "']"; } var oIntervalMilliseconds = null; if (oProperties.showMilliseconds) { oIntervalMilliseconds = "document.forms['" + sFormName + "'].elements['intervalMilliseconds" + sPromptId + "']"; } var oErrorImg = "document." + sFormName + ".imgTest" + sPromptId; if (oProperties.hideAdornments) { oErrorImg = null; } var formElementName = "p_" + oProperties.parameterName; if (oProperties.submitType == K_PRMT_sXML) { formElementName = "_oLstChoices" + sPromptId; } var submitElementName = "p_" + oProperties.parameterName; var HTMLOut = genHiddenInputHTML(sFormName, jsEncodeStr(formElementName), K_PRMT_sEMPTY); if (oProperties.submitType == K_PRMT_sXML) { HTMLOut += genHiddenInputHTML(sFormName, jsEncodeStr(submitElementName), K_PRMT_sEMPTY); } HTMLOut += "
" + ""; if (oProperties.hideAdornments) { HTMLOut += ""; } else { HTMLOut += "" + "" + ""; if (oProperties.showSeconds || oProperties.showMilliseconds) { HTMLOut += ""; } if (oProperties.showMilliseconds) { HTMLOut += ""; } HTMLOut += "" + "" + "" + ""; if (oProperties.showSeconds || oProperties.showMilliseconds) { HTMLOut += ""; } if (oProperties.showMilliseconds) { HTMLOut += ""; } HTMLOut += "
"; } HTMLOut += "" + PMT_SIC_DAYS + "" + PMT_SIC_HOURS + "" + PMT_SIC_MINUTES + "" + PMT_SIC_SECONDS + "" + PMT_SIC_MILLISECONDS + "
"; if (!oProperties.hideAdornments) { HTMLOut += ""; if (oProperties.required) { HTMLOut += "" + "" + ""; } HTMLOut += "" + "" + "" + "
"; } HTMLOut += "
" + "" + "" + "" + "" + "" + "
"; renderPromptControlHTML("selectInterval" + sPromptId, HTMLOut); var sCVObj = getCVInstance(oProperties); var JSOut = "this.intervalControl" + sPromptId + " = new CIntervalPicker(document.forms['" + sFormName + "'].elements['" + submitElementName + "'], document.forms['" + sFormName + "'].elements['" + formElementName + "'], document.forms['" + sFormName + "'].elements['intervalDays" + sPromptId + "'], document.forms['" + sFormName + "'].elements['intervalHours" + sPromptId + "'], document.forms['" + sFormName + "'].elements['intervalMinutes" + sPromptId + "'], " + oIntervalSeconds + ", " + oIntervalMilliseconds + ", " + oErrorImg + ", 'intervalControl" + sPromptId + "', '" + oProperties.defaultValue + "', " + oProperties.required + ", '" + oProperties.submitType + "', " + oProperties.showSeconds + ", " + oProperties.showMilliseconds + ", " + oProperties.allowNegative + ", '" + getCVId(oProperties) + "');" + sCVObj + "preProcessControlArray = " + sCVObj + "preProcessControlArray.concat('intervalControl" + sPromptId + "');"; executePromptControlJS(JSOut); } function genSelectIntervalMultipleHTML(s_PromptId, s_FormName, s_ParameterName, s_SubmitType, s_DefaultValue, b_Required, b_HideAdornments, b_ShowSeconds, b_ShowMilliseconds, b_SuppressExtraPromptNames, b_AllowNegative, s_Style) { var oProperties = s_PromptId; if (arguments.length > 1 || typeof oProperties != K_PRMT_sOBJECT) { oProperties = { id: s_PromptId, formName: s_FormName, parameterName: s_ParameterName, submitType: s_SubmitType, defaultValue: s_DefaultValue, required: b_Required, hideAdornments: b_HideAdornments, showSeconds: b_ShowSeconds, showMilliseconds: b_ShowMilliseconds, suppressExtraPromptNames: b_SuppressExtraPromptNames, style: s_Style, allowNegative: b_AllowNegative }; } var sPromptId = oProperties.id; if (!verifyPromptId(sPromptId)) { return; } //skin folder var sSkin = (typeof getPromptSkin != K_PRMT_sUNDEFINED ? getPromptSkin() : K_PRMT_sDEFAULTSKIN); var sFormName = oProperties.formName; if (!sFormName) { sFormName = "forms[0]"; } var formElementName = "p_" + oProperties.parameterName; if (oProperties.submitType == K_PRMT_sXML) { formElementName = "oLstChoices" + sPromptId; } var submitElementName = "p_" + oProperties.parameterName; var HTMLOut = K_PRMT_sEMPTY; if (oProperties.submitType == K_PRMT_sXML) { HTMLOut += genHiddenInputHTML(sFormName, jsEncodeStr(submitElementName), K_PRMT_sEMPTY); } HTMLOut += "
" + "" + // Interval Single prompt control "" + "" + "
" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "
" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "
"; if (!oProperties.hideAdornments && oProperties.required) { HTMLOut += ""; } HTMLOut += PMT_UIM_CHOICES + "
" + "" + "
" + "
" + "
" + "" + PMT_UIM_SELECTALL + "" + " " + "" + PMT_UIM_DESELECTALL + "" + "
" + "
"; renderPromptControlHTML("selectInterval" + sPromptId, HTMLOut); var sCVObj = getCVInstance(oProperties); var JSOut = "genSelectIntervalSingleHTML(" + generatePromptProperties(oProperties, { id: "Single" + sPromptId, formName: sFormName, parameterName: "I_" + oProperties.parameterName, defaultValue: K_PRMT_sEMPTY, required: false, style: cssParser(oProperties.style, "background,font,text,color"), suppressExtraPromptNames: true}) + ");" + "genInsertButtonHTML('" + sPromptId + "', 'multipleIntervalPicker" + sPromptId + ".insert()', 'insertButton" + sPromptId + "');" + "genRemoveButtonHTML('" + sPromptId + "', 'multipleIntervalPicker" + sPromptId + ".remove()', 'removeButton" + sPromptId + "');" + "this.multipleIntervalPicker" + sPromptId + " = new CMultipleIntervalPicker(intervalControlSingle" + sPromptId + ", document.forms['" + sFormName + "'].elements['" + formElementName + "'], document.forms['" + sFormName + "'].elements['" + submitElementName + "'], " + oProperties.required + ", '" + oProperties.submitType + "', document.getElementById('multipleFeedback" + sPromptId + "'), document.sizer" + sPromptId + ", document.getElementById('insertButton" + sPromptId + "'), document.getElementById('removeButton" + sPromptId + "'), '" + getCVId(oProperties) + "');" + sCVObj + "preProcessControlArray = " + sCVObj + "preProcessControlArray.concat('multipleIntervalPicker" + sPromptId + "');" + sCVObj + "multipleObserverArray = " + sCVObj + "multipleObserverArray.concat('multipleIntervalPicker" + sPromptId + "');"; executePromptControlJS(JSOut); } function genSelectIntervalRangeHTML(s_PromptId, s_FormName, s_ParameterName, s_SubmitType, s_DefaultValue, i_InitialState, b_Required, b_HideAdornments, b_ShowSeconds, b_ShowMilliseconds, b_SuppressExtraPromptNames, s_EndValue, b_AllowNegative, s_Style) { var oProperties = s_PromptId; if (arguments.length > 1 || typeof oProperties != K_PRMT_sOBJECT) { oProperties = { id: s_PromptId, formName: s_FormName, parameterName: s_ParameterName, submitType: s_SubmitType, defaultValue: s_DefaultValue, initialState: i_InitialState, required: b_Required, hideAdornments: b_HideAdornments, showSeconds: b_ShowSeconds, showMilliseconds: b_ShowMilliseconds, suppressExtraPromptNames: b_SuppressExtraPromptNames, endValue: s_EndValue, style: s_Style, allowNegative: b_AllowNegative }; } var sPromptId = oProperties.id; if (!verifyPromptId(sPromptId)) { return; } //skin folder var sSkin = (typeof getPromptSkin != K_PRMT_sUNDEFINED ? getPromptSkin() : K_PRMT_sDEFAULTSKIN); var sFormName = oProperties.formName; if (!sFormName) { sFormName = "forms[0]"; } var formElementName = "p_" + oProperties.parameterName; if (oProperties.submitType == K_PRMT_sXML) { formElementName = "_oLstChoices" + sPromptId; } var submitElementName = "p_" + oProperties.parameterName; var HTMLOut = K_PRMT_sEMPTY; if (oProperties.submitType == K_PRMT_sXML) { HTMLOut += genHiddenInputHTML(sFormName, jsEncodeStr(submitElementName), K_PRMT_sEMPTY); } HTMLOut += "
" + "" + "" + "" + "" + "" + "" + "" + ""; if (!oProperties.required) { HTMLOut += "" + "" + "" + ""; } HTMLOut += "" + "" + "" + "" + "" + "" + "" + "" + "" + ""; if (!oProperties.required) { HTMLOut += "" + "" + "" + ""; } HTMLOut += "
" + PMT_RNG_FROM + "
 " + "" + ""; if (!oProperties.required) { HTMLOut += ""; } // Interval Single prompt control for start range HTMLOut += "" + "" + "
" + "" + "
" + "
" + "" + "" + "" + "" + PMT_RNG_LOWEST_INTERVAL + "
 
" + PMT_RNG_TO + "
 " + "" + ""; if (!oProperties.required) { HTMLOut += ""; } // IntervalSingle prompt control for end range HTMLOut += "" + "" + "
" + "" + "
" + "
" + "" + "" + PMT_RNG_HIGHEST_INTERVAL + "
" + "
"; renderPromptControlHTML("selectInterval" + sPromptId, HTMLOut); var JSOut = "genSelectIntervalSingleHTML(" + generatePromptProperties(oProperties, { id: "range_from" + sPromptId, formName: sFormName, parameterName: "range_from" + oProperties.parameterName, style: cssParser(oProperties.style, 'background,color,text,font'), suppressExtraPromptNames: true}) + ");" + "genSelectIntervalSingleHTML(" + generatePromptProperties(oProperties, { id: "range_to" + sPromptId, parameterName: "range_to" + oProperties.parameterName, style: cssParser(oProperties.style, 'background,color,text,font'), defaultValue: oProperties.endValue, suppressExtraPromptNames: true}) + ");"; if (oProperties.required) { JSOut += "this.range" + sPromptId + " = new CRange(document.forms['" + sFormName + "'].elements['" + submitElementName + "'], null, intervalControlrange_from" + sPromptId + ", null, null, intervalControlrange_to" + sPromptId + ", null, 'interval', true, '" + oProperties.submitType + "', null, '" + getCVId(oProperties) + "');"; } else { JSOut += "this.range" + sPromptId + " = new CRange(document.forms['" + sFormName + "'].elements['" + submitElementName + "'], document.forms['" + sFormName + "'].elements['fromValue" + sPromptId + "'][0], intervalControlrange_from" + sPromptId + ", null, document.forms['" + sFormName + "'].elements['toValue" + sPromptId + "'][0], intervalControlrange_to" + sPromptId + ", null, 'interval', false, '" + oProperties.submitType + "', " + oProperties.initialState + ", '" + getCVId(oProperties) + "');"; } var sCVObj = getCVInstance(oProperties); JSOut += sCVObj + "preProcessControlArray = " + sCVObj + "preProcessControlArray.concat('range" + sPromptId + "');" + sCVObj + "rangeObserverArray = " + sCVObj + "rangeObserverArray.concat('range" + sPromptId + "');"; executePromptControlJS(JSOut); } function genSelectIntervalRangeMultipleHTML(s_PromptId, s_FormName, s_ParameterName, s_SubmitType, s_DefaultValue, i_InitialState, b_Required, b_HideAdornments, b_ShowSeconds, b_ShowMilliseconds, b_SuppressExtraPromptNames, s_EndValue, b_AllowNegative, s_Style) { var oProperties = s_PromptId; if (arguments.length > 1 || typeof oProperties != K_PRMT_sOBJECT) { oProperties = { id: s_PromptId, formName: s_FormName, parameterName: s_ParameterName, submitType: s_SubmitType, defaultValue: s_DefaultValue, initialState: i_InitialState, required: b_Required, hideAdornments: b_HideAdornments, showSeconds: b_ShowSeconds, showMilliseconds: b_ShowMilliseconds, suppressExtraPromptNames: b_SuppressExtraPromptNames, endValue: s_EndValue, style: s_Style, allowNegative: b_AllowNegative }; } var sPromptId = oProperties.id; if (!verifyPromptId(sPromptId)) { return; } //skin folder var sSkin = (typeof getPromptSkin != K_PRMT_sUNDEFINED ? getPromptSkin() : K_PRMT_sDEFAULTSKIN); var sFormName = oProperties.formName; if (!sFormName) { sFormName = "forms[0]"; } var formElementName = "p_" + oProperties.parameterName; if (oProperties.submitType == K_PRMT_sXML) { formElementName = "_oLstChoices" + sPromptId; } var submitElementName = "p_" + oProperties.parameterName; var HTMLOut = K_PRMT_sEMPTY; if (oProperties.submitType == K_PRMT_sXML) { HTMLOut += genHiddenInputHTML(sFormName, jsEncodeStr(submitElementName), K_PRMT_sEMPTY); } HTMLOut += "
" + "" + // Interval Range prompt control "" + "" + "" + "" + "
" + "" + "" + "" + "" + "
" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "
" + "
" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "
"; if (oProperties.required) { HTMLOut += ""; } HTMLOut += PMT_UIM_CHOICES + "
" + "" + "
" + "" + PMT_UIM_SELECTALL + "" + " " + "" + PMT_UIM_DESELECTALL + "" + "
" + "
"; renderPromptControlHTML("selectInterval" + sPromptId, HTMLOut); var sCVObj = getCVInstance(oProperties); var JSOut = "genSelectIntervalRangeHTML(" + generatePromptProperties(oProperties, { id: "range_" + sPromptId, formName: sFormName, parameterName: "r_" + oProperties.parameterName, style: cssParser(oProperties.style, "font,text,background,color"), suppressExtraPromptNames: true}) + ");" + "genInsertButtonHTML('" + sPromptId + "', 'multipleRange" + sPromptId + ".insertChoiceList()', 'insertButton" + sPromptId + "');" + "genRemoveButtonHTML('" + sPromptId + "', 'multipleRange" + sPromptId + ".removeChoiceList()', 'removeButton" + sPromptId + "');" + "this.multipleRange" + sPromptId + " = new CMultipleRange(rangerange_" + sPromptId + ", document.forms['" + sFormName + "'].elements['_oLstChoices" + sPromptId + "'], document.forms['" + sFormName + "'].elements['" + submitElementName + "'], " + oProperties.required + ", '" + oProperties.submitType + "', document.getElementById('multipleRangeFeedback" + sPromptId + "'), document.sizer" + sPromptId + ", '" + sPromptId + "', document.getElementById('insertButton" + sPromptId + "'), document.getElementById('removeButton" + sPromptId + "'), '" + getCVId(oProperties) + "');" + sCVObj + "preProcessControlArray = " + sCVObj + "preProcessControlArray.concat('multipleRange" + sPromptId + "');" + sCVObj + "multipleObserverArray = " + sCVObj + "multipleObserverArray.concat('multipleRange" + sPromptId + "');" + "multipleRange" + sPromptId + ".initChoiceList();"; executePromptControlJS(JSOut); }