// Licensed Materials - Property of IBM // // IBM Cognos Products: pps // // (C) Copyright IBM Corp. 2005, 2017 // // US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. function adminPropertySheetManager(uniqueID, resManager, adminCommands, container, titleContainer, ppesAdminEventHandler) { //private members var m_oAdminCommands = adminCommands; var m_oContainer = container; var m_sUniqueID = uniqueID; var m_oResManager = resManager; var m_oTitleContainer = titleContainer; var m_oEventHandler = ppesAdminEventHandler; var m_aPropertySheets = new Array(); var m_oTabControl = null; var m_oObjectPropertyTree = null; var m_oParentsPropertyTree = null; var m_sCurrentObject = null; var m_sParentObject = null; var m_sNewObject = null; var m_sNewParentObject = null; var m_sPDFPaginationDefaultValue = ""; var m_thisInstance = this; var m_aDOMObjectToUnlink = new Array(); var m_aPropertyNames = null; //Structures to keep track of property info var m_aPropValueInfo = null; var m_bChangesNotSaved = false; var m_CurrentObjName = null; //structure to store property value information function propValueInfo(name, type, subType, value, parentValue, specialized, xmlNode) { this.name = name; this.value = value; this.parentValue = parentValue; this.type = type; this.subType = subType; this.specialized = specialized; this.xmlNode = xmlNode; this.isDefault = function() { //Matches parent's value if (this.type == "int") { return (parseInt(this.value) == parseInt(this.parentValue)); } else { return (this.value == this.parentValue); } } } //Handlers for specialized Property dialogs function colorPickerHandler( v_oPropertySheet, v_sName, v_oDialogListener ) { this.m_oPropertySheet = v_oPropertySheet; this.m_sName = v_sName; this.m_oDialogListener = v_oDialogListener; //Create the dialog D_Color.F_Show(null, false, this.m_oPropertySheet.F_GetPropertyValue(v_sName), null, this , false, false); this.F_Dialog_OnCommit = function( v_oDialog ) { this.m_oDialogListener.F_PropertySheet_OnPropertyChange( this.m_oPropertySheet, this.m_sName, v_oDialog.F_GetColor()); } } function titleDialogHandler( v_oPropertySheet, v_sName, v_oDialogListener ) { this.m_oPropertySheet = v_oPropertySheet; this.m_sName = v_sName; this.m_oDialogListener = v_oDialogListener; //Create the dialog D_ppesAdminTitleDialog.F_Show(null, G_ResManager.F_GetString("IDS_PPESADMIN_DLGMAKETITLEFRAMETITLE") , this, this.m_oPropertySheet.F_GetPropertyValue(v_sName)); this.F_Dialog_OnCommit = function( v_oDialog ) { this.m_oDialogListener.F_PropertySheet_OnPropertyChange( this.m_oPropertySheet, this.m_sName, v_oDialog.F_GetTitle()); } } function pdfPaginationDialogHandler( v_oPropertySheet, v_sName, v_oDialogListener, v_sCurrentValue, v_sDefaultValue ) { this.m_oPropertySheet = v_oPropertySheet; this.m_sName = v_sName; this.m_oDialogListener = v_oDialogListener; //Create the dialog D_ppesAdminPDFPaginationDialog.F_Show(null, G_ResManager.F_GetString("IDS_PPESADMIN_DLGPDFPAGINATIONTITLE"), this, v_sCurrentValue, v_sDefaultValue ); this.F_Dialog_OnCommit = function( v_oDialog ) { this.m_oDialogListener.F_PropertySheet_OnPropertyChange( this.m_oPropertySheet, this.m_sName, v_oDialog.F_GetValue() ); } } //*** constructor *** { //Build up the neccessary DOM directly into the provided container //But keep it hidden intially getPDFDefaultValueString(); var outerDIV = document.createElement("DIV"); outerDIV.style.display = "none"; if (!G_BrowserInfo.M_bIsIE) { var spacer = document.createElement("IMG"); spacer.style.visibility = "hidden"; spacer.style.height = "5px"; outerDIV.appendChild(spacer); } var tabTable = document.createElement("TABLE"); tabTable.id = m_sUniqueID + "propertyTabs"; var tableBody = document.createElement("TBODY"); var row = document.createElement("TR"); var cell = document.createElement("TD"); cell.appendChild(document.createTextNode(G_ResManager.F_GetString("IDS_PPESADMIN_DLGPROPERTIESCUBESETTINGSTAB"))); row.appendChild(cell); cell = document.createElement("TD"); cell.appendChild(document.createTextNode(G_ResManager.F_GetString("IDS_PPESADMIN_DLGPROPERTIESREPORTSETTINGSTAB"))); row.appendChild(cell); tableBody.appendChild(row); tabTable.appendChild(tableBody); outerDIV.appendChild(tabTable); var panelsDIV = document.createElement("DIV"); panelsDIV.id = m_sUniqueID + "propertyTabs_Panels"; panelsDIV.style.width = "100%"; var panel = document.createElement("DIV"); panel.id = m_sUniqueID + "propertyTabs_Panel0"; var cubePropSheetDIV = document.createElement("DIV"); addPanelPropertysheet(panel, cubePropSheetDIV); addTabResetLinks(panel,"PWQ"); panelsDIV.appendChild(panel); panel = document.createElement("DIV"); panel.id = m_sUniqueID + "propertyTabs_Panel1"; var reportPropSheetDIV = document.createElement("DIV"); addPanelPropertysheet(panel, reportPropSheetDIV); addTabResetLinks(panel,"PWR"); panelsDIV.appendChild(panel); outerDIV.appendChild(panelsDIV); m_oContainer.appendChild(outerDIV); m_oTabControl = new C_Tab(m_sUniqueID + "propertyTabs"); //Now that the basic TAB HTML is created, create and intialize the property sheets. m_aPropertySheets["PWQ"] = new C_PropertySheet( cubePropSheetDIV, m_oResManager.F_GetResource( "ppesAdminPropertySheetPWQ" ) ,this, cubePropSheetDIV, "clsPropertiesPaneInputBlocker"); m_aPropertySheets["PWR"] = new C_PropertySheet( reportPropSheetDIV, m_oResManager.F_GetResource( "ppesAdminPropertySheetPWR" ) ,this, reportPropSheetDIV, "clsPropertiesPaneInputBlocker"); addTabButtons(outerDIV); } //destructor this.F_Detach = function() { //break circular references between DOM and javascript m_aPropertySheets["PWQ"].F_Detach(); m_aPropertySheets["PWR"].F_Detach(); for (var i = 0; i < m_aDOMObjectToUnlink.length; i++) { m_aDOMObjectToUnlink[i].pAdminPropSheetManager = null; } m_oTabControl.F_Detach(); D_Color.F_Detach(); D_ppesAdminTitleDialog.F_Detach(); D_ppesAdminPDFPaginationDialog.F_Detach(); } function addPanelPropertysheet(container, propSheetDiv) { var panelContentsDIV = document.createElement("DIV"); panelContentsDIV.className = "ppesAdminPanelContentsContainer"; var panelContentsTableHintDIV = document.createElement("DIV"); panelContentsTableHintDIV.className = "ppesAdminPropertiesHintContainer"; panelContentsTableHintDIV.appendChild(document.createTextNode(G_ResManager.F_GetString("IDS_PPESADMIN_SETTINGS_HINT"))); panelContentsDIV.appendChild(panelContentsTableHintDIV); var panelContentsTableHeader = document.createElement("DIV"); panelContentsTableHeader.className = "ppesAdminPropertiesHeader"; panelContentsTableHeader.appendChild(document.createTextNode(G_ResManager.F_GetString("IDS_PPESADMIN_SETTINGS_PROPERTIES"))); panelContentsDIV.appendChild(panelContentsTableHeader); propSheetDiv.className = "ppesAdminPropertiesContainer"; panelContentsDIV.appendChild(propSheetDiv); container.appendChild(panelContentsDIV); } function addTabResetLinks(container, idPrefix) { var serverPropLinksDiv = document.createElement("DIV"); serverPropLinksDiv.className = "ppesAdminPropertiesLinksContainer"; var link = document.createElement("SPAN"); link.className = "ppesAdminPropertiesLink"; link.id = m_sUniqueID + idPrefix + "rsLink"; link.appendChild(document.createTextNode(G_ResManager.F_GetString("IDS_PPESADMIN_BUTTONRESET"))); link.pAdminPropSheetManager = m_thisInstance; //link the DOM object to this class to access the event handlers m_aDOMObjectToUnlink[m_aDOMObjectToUnlink.length] = link; link.onclick = function () { this.pAdminPropSheetManager.F_HandleResetSelectedProperty(); }; serverPropLinksDiv.appendChild(link); link = document.createElement("SPAN"); link.className = "ppesAdminPropertiesLink"; link.id = m_sUniqueID + idPrefix + "rsaLink"; link.appendChild(document.createTextNode(G_ResManager.F_GetString("IDS_PPESADMIN_BUTTONRESETALL"))); link.pAdminPropSheetManager = m_thisInstance; //link the DOM object to this class to access the event handlers m_aDOMObjectToUnlink[m_aDOMObjectToUnlink.length] = link; link.onclick = function () { this.pAdminPropSheetManager.F_HandleResetAllProperties(); }; serverPropLinksDiv.appendChild(link); link = document.createElement("SPAN"); link.className = "ppesAdminPropertiesLinkSeperator"; serverPropLinksDiv.appendChild(link); link = document.createElement("SPAN"); link.className = "ppesAdminPropertiesLink"; link.id = m_sUniqueID + idPrefix + "rsdLink"; link.appendChild(document.createTextNode(G_ResManager.F_GetString("IDS_PPESADMIN_BUTTONFORCEDOWN"))); link.pAdminPropSheetManager = m_thisInstance; //link the DOM object to this class to access the event handlers m_aDOMObjectToUnlink[m_aDOMObjectToUnlink.length] = link; link.onclick = function () { this.pAdminPropSheetManager.F_HandleResetAllDescendents(); }; serverPropLinksDiv.appendChild(link); container.appendChild(serverPropLinksDiv); } function addTabButtons(container) { var serverPropButtonsDiv = document.createElement("DIV"); serverPropButtonsDiv.className = "ppesAdminPropertiesButtonsContainer"; button = document.createElement("BUTTON"); button.className = "clsDlgButton"; button.appendChild(document.createTextNode(G_ResManager.F_GetString("IDS_PPESADMIN_BUTTON_SAVE"))); button.pAdminPropSheetManager = m_thisInstance; //link the DOM object to this class to access the event handlers m_aDOMObjectToUnlink[m_aDOMObjectToUnlink.length] = button; button.onclick = function () { this.pAdminPropSheetManager.F_HandleApply(); }; serverPropButtonsDiv.appendChild(button); button = document.createElement("BUTTON"); button.className = "clsDlgButton"; button.appendChild(document.createTextNode(G_ResManager.F_GetString("IDS_PPESADMIN_BUTTON_RELOAD"))); button.pAdminPropSheetManager = m_thisInstance; //link the DOM object to this class to access the event handlers m_aDOMObjectToUnlink[m_aDOMObjectToUnlink.length] = button; button.onclick = function () { this.pAdminPropSheetManager.F_HandleReload(); }; serverPropButtonsDiv.appendChild(button); container.appendChild(serverPropButtonsDiv); } function isCurrentSelectionALeaf() { if (m_oObjectPropertyTree) { var objectClass = m_oObjectPropertyTree.getString("objectClass"); return (objectClass == "powerPlay8Report") } else return false; } function isCurrentSelectionTheRoot() { return (m_oObjectPropertyTree && (m_oParentsPropertyTree == null)); } function updateResetAllDescendentsEnabling() { if (isCurrentSelectionALeaf()) { //disable the reset all descendents call document.getElementById(m_sUniqueID + "PWQrsdLink").className = "ppesAdminPropertiesLinkDisabled"; document.getElementById(m_sUniqueID + "PWRrsdLink").className = "ppesAdminPropertiesLinkDisabled"; } else { //enable the reset all descendents call document.getElementById(m_sUniqueID + "PWQrsdLink").className = "ppesAdminPropertiesLink"; document.getElementById(m_sUniqueID + "PWRrsdLink").className = "ppesAdminPropertiesLink"; } if (isCurrentSelectionTheRoot()) { //disable the reset and reset all calls document.getElementById(m_sUniqueID + "PWQrsLink").className = "ppesAdminPropertiesLinkDisabled"; document.getElementById(m_sUniqueID + "PWRrsLink").className = "ppesAdminPropertiesLinkDisabled"; document.getElementById(m_sUniqueID + "PWQrsaLink").className = "ppesAdminPropertiesLinkDisabled"; document.getElementById(m_sUniqueID + "PWRrsaLink").className = "ppesAdminPropertiesLinkDisabled"; } else { //enable the reset and reset all calls document.getElementById(m_sUniqueID + "PWQrsLink").className = "ppesAdminPropertiesLink"; document.getElementById(m_sUniqueID + "PWRrsLink").className = "ppesAdminPropertiesLink"; document.getElementById(m_sUniqueID + "PWQrsaLink").className = "ppesAdminPropertiesLink"; document.getElementById(m_sUniqueID + "PWRrsaLink").className = "ppesAdminPropertiesLink"; } } this.hideView = function() { m_oContainer.firstChild.style.display = "none"; } this.loadObjectProperties = function(obj,parentObj) { //obtain the properties of the object m_sCurrentObject = obj; m_sParentObject = parentObj; m_oContainer.firstChild.style.display = "none"; m_oEventHandler.F_ShowProgressDialog(document.getElementById(m_sUniqueID + "ppesAdminTable"),G_ResManager.F_GetString("IDS_PPESADMIN_WORKING")); m_oAdminCommands.GetObjProperties(obj,handleGotObjectProperties); m_bChangesNotSaved = false; } var loadObjectProperties = this.loadObjectProperties; this.displayObjectProperties = function(obj,parentObj,cancelFunc) { //First we check if the current property sheet has been saved. if (m_bChangesNotSaved) { m_sNewObject = obj; m_sParentObject = parentObj; //Prompt the user to see if they would like to save their changes D_MsgBox.F_Show(null,G_ResManager.F_GetString("IDS_PPESADMIN_SAVE_PROMPT",m_CurrentObjName,m_CurrentObjName),G_ResManager.F_GetString("IDS_HAL_APP_TITLE"),null,D_MsgBox.K_iYesNoCancel,this.saveAndloadNewObjectProperties,cancelFunc,this.loadNewObjectProperties); } else { this.loadObjectProperties(obj,parentObj); } }; this.loadNewObjectProperties = function() { loadObjectProperties(m_sNewObject,m_sParentObject); } var loadNewObjectProperties = this.loadNewObjectProperties; this.saveAndloadNewObjectProperties = function() { F_HandleApply(loadNewObjectProperties); } this.handleGotObjectProperties = function(objPropTree) { if (objPropTree.getNode("error")){ handleErrorMsg(objPropTree, m_oEventHandler); return; } m_oObjectPropertyTree = objPropTree; m_CurrentObjName = m_oObjectPropertyTree.getString("Name"); if (m_sParentObject != "" && m_sParentObject != null) { m_oEventHandler.F_ShowProgressDialog(document.getElementById(m_sUniqueID + "ppesAdminTable"),G_ResManager.F_GetString("IDS_PPESADMIN_WORKING")); m_oAdminCommands.GetObjProperties(m_sParentObject,handleGotAllObjectProperties); } else { handleGotAllObjectProperties(null); } }; //local references, to allow access from callbacks var handleGotObjectProperties = this.handleGotObjectProperties; this.handleGotAllObjectProperties = function(parentsPropTree) { if (parentsPropTree && parentsPropTree.getNode("error")) { handleErrorMsg(parentsPropTree, m_oEventHandler); return; } while (m_oTitleContainer.childNodes.length) { m_oTitleContainer.removeChild(m_oTitleContainer.childNodes[m_oTitleContainer.childNodes.length - 1]); } m_oTitleContainer.appendChild(document.createTextNode(G_ResManager.F_GetString("IDS_PPESADMIN_EDIT_THE_SETTINGS",m_CurrentObjName))); m_oParentsPropertyTree = parentsPropTree; var bFoundFirstVisible = false; //clear out the values arrays m_aPropertyNames = new Array(); m_aPropValueInfo = new Array(); var objectClass = m_oObjectPropertyTree.getString("objectClass"); if (objectClass == "content" || objectClass == "package" || objectClass == "folder") { m_oTabControl.F_SetTabDisplay(0,true); if (!bFoundFirstVisible) m_oTabControl.F_SetActiveTab(0); bFoundFirstVisible = true; if (m_oObjectPropertyTree.getNode("PWQ")) { m_aPropertySheets["PWQ"].F_SetUpdate(false); m_aPropertySheets["PWQ"].F_Clear(); //Clear the property sheet //Get this controls XML specification var propSheetXML = m_aPropertySheets["PWQ"].F_GetPropertySheetNode(); addPropSheetGroups(m_aPropertySheets["PWQ"],propSheetXML.selectSingleNode("properties")); m_aPropertySheets["PWQ"].F_EndAllPropertyGroups(); m_aPropertySheets["PWQ"].F_SetUpdate(true); } } else { m_oTabControl.F_SetTabDisplay(0,false); } if (true) { //All items have a report property tab m_oTabControl.F_SetTabDisplay(1,true); if (!bFoundFirstVisible) m_oTabControl.F_SetActiveTab(1); bFoundFirstVisible = true; if (m_oObjectPropertyTree.getNode("PWR")) { m_aPropertySheets["PWR"].F_SetUpdate(false); m_aPropertySheets["PWR"].F_Clear(); //Clear the property sheet //Get this controls XML specification var propSheetXML = m_aPropertySheets["PWR"].F_GetPropertySheetNode(); addPropSheetGroups(m_aPropertySheets["PWR"],propSheetXML.selectSingleNode("properties")); m_aPropertySheets["PWR"].F_EndAllPropertyGroups(); m_aPropertySheets["PWR"].F_SetUpdate(true); } } else { m_oTabControl.F_SetTabDisplay(1,false); } updateResetAllDescendentsEnabling(); m_oEventHandler.F_HideProgressDialog(); m_oContainer.firstChild.style.display = ""; }; //local references, to allow access from callbacks var handleGotAllObjectProperties = this.handleGotAllObjectProperties; this.hideObjectProperties = function() { m_oContainer.firstChild.style.display = "none"; } //private methods //Property Sheet population methods function addPropSheetGroups(propSheet, xmlProperties) { if (!xmlProperties) return; for (var i = 0; i < xmlProperties.childNodes.length; i++) { addPropSheetGroup(propSheet, xmlProperties.childNodes[i]); } } function addPropSheetGroup(propSheet, xmlGroup) { if (!xmlGroup || xmlGroup.nodeName != "group") return; var attNodeChild = m_oObjectPropertyTree.getNode(xmlGroup.getAttribute("name")); if (attNodeChild) { propSheet.F_StartPropertyGroup( xmlGroup.getAttribute("name") ); addPropSheetNodeList(propSheet, xmlGroup); propSheet.F_EndPropertyGroup(); } } function addPropSheetNodeList(propSheet, xmlGroup) { for (var i = 0; i < xmlGroup.childNodes.length; i++) { if (xmlGroup.childNodes[i].nodeName == "property") { //Ensure that the node exists in the objects attribute tree before proceeding var attNamePath = xmlGroup.childNodes[i].getAttribute("name"); var attNodeChild = m_oObjectPropertyTree.getNode(attNamePath); if (attNodeChild && (attNodeChild.type != "folder") ) { //Create a value record for this item var attValue = attNodeChild.value; var attParentsValue = null; if (m_oParentsPropertyTree) { var attParentNode = m_oParentsPropertyTree.getNode(attNamePath); if (attParentNode) attParentsValue = attParentNode.value; } m_aPropertyNames[m_aPropertyNames.length] = attNamePath; m_aPropValueInfo[attNamePath] = new propValueInfo(attNamePath, attNodeChild.type, attNodeChild.subType, attValue, attParentsValue, attNodeChild.specialized, xmlGroup.childNodes[i]); var bIsBold = (attNodeChild.specialized || attParentsValue == null || attParentsValue != attNodeChild.value); setPropertySheetValue( propSheet, attNamePath , m_aPropValueInfo[attNamePath].value, bIsBold ); } //} else if (xmlGroup.childNodes[i].nodeName == "group") { // var newAttNode = attNode.getChild(xmlGroup.childNodes[i].getAttribute("name")); // if (newAttNode) { // addPropSheetGroup(propSheet, rootNode, newAttNode, xmlGroup.childNodes[i]); // } } } } function getPDFDefaultValueString() { // Initialize the defaults var v_nDefaults = G_ResManager.F_GetResource( 'ppesAdminPDFPaginationDefaults' ); for (var i = 0; i < v_nDefaults.childNodes.length; i++) { if (v_nDefaults.childNodes[i].nodeName == "dialogValue") { m_sPDFPaginationDefaultValue += v_nDefaults.childNodes[i].getAttribute("name"); m_sPDFPaginationDefaultValue += "="; m_sPDFPaginationDefaultValue += v_nDefaults.childNodes[i].getAttribute("value"); m_sPDFPaginationDefaultValue += ";"; } } } function isPDFControl( v_oPropInfo ) { return (v_oPropInfo.type == "string" && v_oPropInfo.subType == "MB"); } function getPDFDisplayValue( v_sValue ) { if (v_sValue == "" || v_sValue == m_sPDFPaginationDefaultValue) return G_ResManager.F_GetString("IDS_PPESADMIN_DLGPDFPAGINATIONDEFAULT"); else return G_ResManager.F_GetString("IDS_PPESADMIN_DLGPDFPAGINATIONCUSTOM"); } //Because the HAL control does not allow us to set the bold ourselves, //we can fake it by using it's own non default mechanism. function setPropertySheetValue( v_oPropertySheet, v_sName , v_sValue, v_bBold ) { var oPropInfo = m_aPropValueInfo[v_sName]; var sDisplayValue = ""; if (isPDFControl(oPropInfo)) { sDisplayValue = getPDFDisplayValue(v_sValue); } else { sDisplayValue = ("" + v_sValue);//must pass a string } if (v_bBold) { //set to emtpy, so it will only be non-bold when the value is empty oPropInfo.xmlNode.setAttribute("defaultValue",""); } else { //set it to the value so it will never be bold oPropInfo.xmlNode.setAttribute("defaultValue",sDisplayValue); } v_oPropertySheet.F_ShowProperty(v_sName,sDisplayValue);//must pass a string } //Custom Event Handlers this.F_HandleResetSelectedProperty = function() { if (!isCurrentSelectionTheRoot()) { //Get the Property sheet that the user is curently viewing. var propSheet = null; switch(m_oTabControl.F_GetActiveTab()) { case 0: propSheet = m_aPropertySheets["PWQ"]; break; case 1: propSheet = m_aPropertySheets["PWR"]; break; } var activeProperty = propSheet.F_GetActiveProperty(); if (activeProperty && m_aPropValueInfo[activeProperty]) { //Change the value to the default setPropertySheetValue( propSheet, activeProperty , m_aPropValueInfo[activeProperty].parentValue, false ); m_aPropValueInfo[activeProperty].value = m_aPropValueInfo[activeProperty].parentValue; m_aPropValueInfo[activeProperty].specialized = false; //We reset it, it is no longer specialized m_bChangesNotSaved = true; } else { D_MsgBox.F_Show(m_oContainer, G_ResManager.F_GetString("IDS_PPESADMIN_MAKE_SELECTION"), G_ResManager.F_GetString("IDS_HAL_APP_TITLE"), D_MsgBox.K_iOK); } } } this.F_HandleResetAllProperties = function() { if (!isCurrentSelectionTheRoot()) { //Get the Property sheet that the user is curently viewing. var propSheet = null; switch(m_oTabControl.F_GetActiveTab()) { case 0: propSheet = m_aPropertySheets["PWQ"]; break; case 1: propSheet = m_aPropertySheets["PWR"]; break; } for (var i = 0; i < m_aPropertyNames.length; i++) { var propInfo = m_aPropValueInfo[m_aPropertyNames[i]]; if (propSheet.F_IsPropertyDisplayed(propInfo.name)) { setPropertySheetValue( propSheet, propInfo.name , propInfo.parentValue, false ); propInfo.value = propInfo.parentValue; propInfo.specialized = false; //We reset it, it is no longer specialized } } m_bChangesNotSaved = true; } } this.handleGetResetDescendentsResult = function(result) { if (result.getString(ADM_COM_ERROR_NODE,false)) { handleErrorMsg(result, m_oEventHandler); return; } else { if (D_ppesAdminProgress.F_IsActiveDialog()) D_ppesAdminProgress.F_Hide(); D_MsgBox.F_Show(m_oContainer, G_ResManager.F_GetString("IDS_PPESADMIN_SUCCESSFULLYRESETDESCENDANTS"),G_ResManager.F_GetString("IDS_HAL_APP_TITLE"), null,D_MsgBox.K_iOK); } } var handleGetResetDescendentsResult = this.handleGetResetDescendentsResult; this.handleResetAllDescendents = function() { if (!isCurrentSelectionALeaf()) { m_oEventHandler.F_ShowProgressDialog(m_oContainer,G_ResManager.F_GetString("IDS_PPESADMIN_WORKING")); m_oAdminCommands.resetDescendants(m_sCurrentObject,handleGetResetDescendentsResult); } } this.F_HandleResetAllDescendents = function() { if (!isCurrentSelectionALeaf()) { D_MsgBox.F_Show(m_oContainer,G_ResManager.F_GetString("IDS_PPESADMIN_DLGFORCEDOWNSELECTED"),G_ResManager.F_GetString("IDS_HAL_APP_TITLE"),D_MsgBox.K_iWarning,D_MsgBox.K_iOKCancel,this.handleResetAllDescendents); } } this.handleApplyResult = function(result) { if (result.getString(ADM_COM_ERROR_NODE,false)) { handleErrorMsg(result, m_oEventHandler); return; } else { m_oEventHandler.F_HideProgressDialog(); D_MsgBox.F_Show(m_oContainer, G_ResManager.F_GetString("IDS_PPESADMIN_SUCCESSFULLYAPPLIEDPROPERTIES"), G_ResManager.F_GetString("IDS_HAL_APP_TITLE"),D_MsgBox.K_iOK); m_bChangesNotSaved = false; } } var handleApplyResult = this.handleApplyResult; this.F_HandleApply = function(returnFunc) { //Here we build up an attribute tree containing only the non-default values from the 3 property sheets. //just tag the attribute tree that came in with specialized nodes. for (var i = 0; i < m_aPropertyNames.length; i++) { var propInfo = m_aPropValueInfo[m_aPropertyNames[i]]; if (!propInfo.isDefault() || propInfo.specialized) { var attNode = m_oObjectPropertyTree.getNode(propInfo.name); attNode.value = propInfo.value; attNode.specialized = true; } else { var attNode = m_oObjectPropertyTree.getNode(propInfo.name); attNode.value = propInfo.parentValue; attNode.specialized = false; } } var specAttTree = m_oObjectPropertyTree.getSpecializedTreeCopy(); m_oEventHandler.F_ShowProgressDialog(m_oContainer,G_ResManager.F_GetString("IDS_PPESADMIN_WORKING")); var sObjClass = m_oObjectPropertyTree.getString("objectClass"); if (returnFunc) { m_oAdminCommands.SetObjProperties(m_sCurrentObject,sObjClass,specAttTree,returnFunc); } else { m_oAdminCommands.SetObjProperties(m_sCurrentObject,sObjClass,specAttTree,handleApplyResult); } } var F_HandleApply = this.F_HandleApply; this.F_HandleReload = function() { this.displayObjectProperties(m_sCurrentObject,m_sParentObject); } //HAL property sheet event handlers this.F_PropertySheet_OnPropertyChange = function( v_oPropertySheet, v_sName, v_sValue ) { //set the property value into the values store m_aPropValueInfo[v_sName].value = v_sValue; m_aPropValueInfo[v_sName].specialized = true; //We changed it, it has to be specialized. setPropertySheetValue( v_oPropertySheet, v_sName , v_sValue, true ); m_bChangesNotSaved = true; } this.F_PropertySheet_GetPropertyListView = function( v_oPropertySheet, v_sName ) { return m_oResManager.F_GetResource( v_sName ); } this.F_PropertySheet_OnShowDropDown = function( v_oPropertySheet, v_sName, v_sValue, v_nListView, td ) { v_oPropertySheet.F_ShowListView( v_sName, v_sValue, v_nListView); }; this.F_PropertySheet_OnPropertyAction = function( v_oPropertySheet, v_sName ) { if (v_oPropertySheet.F_GetPropertyAttribute(v_sName, "type") == "colorAction") { new colorPickerHandler( v_oPropertySheet, v_sName, this ); } else if (v_oPropertySheet.F_GetPropertyAttribute(v_sName, "type") == "action") { //Get the editor type from the attribute tree var subType = m_oObjectPropertyTree.getNode(v_sName).subType; switch (subType) { case "MT": new titleDialogHandler( v_oPropertySheet, v_sName, this ); break; case "MB": new pdfPaginationDialogHandler( v_oPropertySheet, v_sName, this, m_aPropValueInfo[v_sName].value, m_sPDFPaginationDefaultValue ); break; } } }; function handleErrorMsg( objPropTree, m_oEventHandler ) { var errorMessage = ""; switch (objPropTree.getString("error")) { case "NodeNotFoundException thrown": errorMessage = G_ResManager.F_GetString("IDS_PPESADMIN_ERR_NODE_NOT_FOUND_EXCEPTION"); break; case "FailedToCommunicateWithCM": errorMessage = G_ResManager.F_GetString("IDS_PPESADMIN_ERR_FAILED_TO_COMM_WITH_CM"); break; case "PassportExpired": location.href = location.pathname + "?b_action=cogadmin"; break; default: errorMessage = objPropTree.getString("error"); break; } // hide progress dialog m_oEventHandler.F_HideProgressDialog(); if (errorMessage != "") // show error message & refresh PPAdmin tool on "OK". D_MsgBox.F_Show(null,errorMessage,G_ResManager.F_GetString("IDS_HAL_APP_TITLE"),D_MsgBox.K_iError, 1, function(){ m_bChangesNotSaved = false; //prevents the "Changes Not Saved" dialog from popping up m_oEventHandler.m_admPropManager.hideView(); m_oEventHandler.mAdminTreeHandler.F_ClearTree(m_oEventHandler.m_oPPESAdminTree); m_oEventHandler.F_InitializeTree(); }); } };