123456 |
- // Licensed Materials - Property of IBM
- // IBM Cognos Products: hal
- // (C) Copyright IBM Corp. 2003, 2017.
- // US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- define('hal/C_GlassPropertySheet',function(){function C_GlassPropertySheet(_hDJ, _hAS, _hLN1, _hGN, _hEJ){U_DOM.F_LoadStyleSheet('../css/content_apps.css');this._hZA1=_hDJ;this._hFJ=false;this._hBS=[];this._hHN=[];this._hEG={};this._h2V1={'dropDownList':'DropDown','dropDown':'DropDown','text':'SingleLineValue','info':'SingleLineValue','boolean':'CheckBox','action':'SingleLineLinks','colorAction':'SingleLineLinks'};this._h0B1=!_hDJ;if(!this._h0B1){G_HAL.F_VerifyDependencies("C_ListView");}this._hKE2=document;this._hXN1=_hLN1;this._hIN="";this._hCS={};this._hJN={};this._hGJ={};this._hDS=_hAS;this._h4Y=parseInt(this._hDS.getAttribute("indentLength"));this._hK1=this._hDS.getAttribute("highlightNonDefaultValues");this._h91();this.Groups=[];this._hFG={};this._hHJ={};this._h6B={};this._hES={};this._hS3={};this._hG02={};this._h1B1={};this._h162={};this._hZ8={};this._hP92={};this._hFS(U_XML.F_AppendNodeListToArray([], this._hDS.selectNodes("properties/group")));this.Objects={};this._h2B1(U_XML.F_AppendNodeListToArray([], this._hDS.selectNodes("objects/object")));if(!this._h0B1){this._hTD(_hGN, _hEJ);}};C_GlassPropertySheet.K_iNotValid=1;C_GlassPropertySheet.K_iLessThanMin=2;C_GlassPropertySheet.K_iGreaterThanMax=3;C_GlassPropertySheet.prototype.F_Detach=function(){if(!this._h0B1){this.F_ClearGlassSheet();this._hZA1.innerHTML="";}};C_GlassPropertySheet.prototype.F_OnAddNewGroupProperties=function(_hZH1,_h3B1){this._hFS(_hZH1);this._h2B1(_h3B1);};C_GlassPropertySheet.prototype.F_OnDeleteGroupProperties=function(_hKN,_hIJ){this._hJJ(_hKN);this._h5Y(_hIJ);};C_GlassPropertySheet.prototype.F_GetPropertySheetNode=function(){return this._hDS;};C_GlassPropertySheet.prototype._h91=function(){this._h09=( this._hDS.getAttribute( "showGroupSmallIcons" )=="true" );this._h19=( this._hDS.getAttribute( "showLabelSmallIcons" )=="true" );};C_GlassPropertySheet.prototype._hJJ=function(_hH02){var _hLN={};var _h6Y=_hH02.length;for(var _h262=0;_h262<_h6Y;_h262++){var _h362=_hH02[_h262];var _h0I1=_h362.getAttribute("name");_hLN[_h0I1]=true;delete this._hG02[_h0I1];delete this._h1B1[_h0I1];delete this._hHJ[_h0I1];}var _h77=[];for(var i=0; i<this.Groups.length; i++){if(_hLN[this.Groups[i].Name]){_h77.push(i);for(var _hQ92=0; _hQ92<this.Groups[i].Properties.length; _hQ92++){var _h7Y=this.Groups[i].Properties[_hQ92];delete this._hP92[_h7Y];delete this._h162[_h7Y];delete this._hG02[_h7Y];delete this._h1B1[_h7Y];delete this._h6B[_h7Y];delete this._hZ8[_h7Y];for(var _hTC2=0; this._hES[_h7Y]&&_hTC2<this._hES[_h7Y].length; _hTC2++){var _hUC2=this._hES[_h7Y];delete this._h6B[_hUC2];}delete this._hES[_h7Y];}}}for(var i=_h77.length-1; i>=0; i--){this.Groups.splice(_h77[i], 1);}};C_GlassPropertySheet.prototype._hFS=function(_hH02){var _h6Y=_hH02.length;for(var _h262=0;_h262<_h6Y;_h262++){var _h362=_hH02[ _h262 ];var _h462={};_h462.Name=_h362.getAttribute("name");G_Debug.F_Assert(this._hG02[_h462.Name]===undefined);this._hGS(_h362, this._hHJ, _h462.Name);this._hG02[_h462.Name]=this._hHS(_h362);this._h1B1[_h462.Name]=_h362.getAttribute("smallIcon");_h462.Properties=[];this.Groups.push(_h462);var _hL41=_h362.selectNodes("property");var _hGG=_hL41.length;for(var _hQ92=0;_hQ92<_hGG;_hQ92++){var _h3P1=_hL41.item(_hQ92);var _h7Y=_h3P1.getAttribute("name");var _hR92=_h3P1.getAttribute("type");G_Debug.F_Assert(this._hP92[_h7Y]===undefined);this._hP92[_h7Y]=_hR92;switch(_hR92){case "dropDownList":case "dropDown":case null:if(_h3P1.selectSingleNode("listView")!=null){this._hZ8[_h7Y]=true;if(!_h3P1.getAttribute("isFinite")){_h3P1.setAttribute( "isFinite", "true" );}}}if(!_hR92&&(this._hZ8[_h7Y]||_h3P1.getAttribute("listView"))){_hR92="dropDownList";}this._h162[_h7Y]=_hR92;this._hG02[_h7Y]=this._hHS(_h3P1);this._h1B1[_h7Y]=_h3P1.getAttribute("smallIcon");_h462.Properties.push(_h7Y);this._hGS(_h3P1, this._h6B, _h7Y);var _hMN=_h3P1.selectNodes("property");var _h29=_hMN.length;if(_h29>0){this._hES[_h7Y]=[];}for(var _h3V1=0;_h3V1<_h29;_h3V1++){var _hM41=_hMN.item(_h3V1);var _hN41=_hM41.getAttribute("name");this._hES[_h7Y].push(_hN41);this._hGS(_hM41, this._h6B, _hN41);}}}};C_GlassPropertySheet.prototype._hHS=function(n){var _h4P1=n.getAttribute("idsLabel");if(_h4P1){return G_ResManager.F_GetOptionalString(_h4P1);}return n.getAttribute("label");};C_GlassPropertySheet.prototype._hGS=function(n,_h4B1,_h492){_h4B1[_h492]={};var o=_h4B1[_h492];var nl=n.attributes;var _hBZ1=nl.length;for(var i=0;i<_hBZ1;i++){var _hL92=nl.item(i);o[_hL92.name]=_hL92.value;}};C_GlassPropertySheet.prototype._h2B1=function(_h4V1){var _hBZ1=_h4V1.length;for(var i=0;i<_hBZ1;i++){var o={};var _hI02=_h4V1[ i ];var _h5B1=_hI02.getAttribute("name");this._hGS(_hI02, this._hFG, _h5B1);this._hS3[_h5B1]={};this._h5V1(_h5B1, _hI02, o);G_Debug.F_Assert(this.Objects[_h5B1]===undefined);this.Objects[_h5B1]=o;}};C_GlassPropertySheet.prototype._h5Y=function(_h4V1){var _hBZ1=_h4V1.length;for(var i=0;i<_hBZ1;i++){var _hI02=_h4V1[ i ];var _h5B1=_hI02.getAttribute("name");delete this._hFG[_h5B1];delete this._hS3[_h5B1];delete this.Objects[_h5B1];}};C_GlassPropertySheet.prototype._h5V1=function(_h5B1,n,_h6B1){var nl=n.selectNodes( "propertyRef | namedSetRef" );var _hBZ1=nl.length;for(var i=0;i<_hBZ1;i++){var _hVC2=nl.item(i);var _hWC2=_hVC2.getAttribute("ref");switch(_hVC2.nodeName){case "propertyRef":_h6B1[_hWC2]=true;if(this._hES[_hWC2]){var _hMN=_hVC2.selectNodes("propertyRef");var _h29=_hMN.length;if(_h29>0){this._hS3[_h5B1][_hWC2]={};for(var _h3V1=0;_h3V1<_h29;_h3V1++){var _hN41=_hMN.item(_h3V1).getAttribute("ref");this._hS3[_h5B1][_hWC2][_hN41]=true;}}else{this._hS3[_h5B1][_hWC2]=this._hES[_hWC2].F_CreateDictionary();}}break;case "namedSetRef":var _h5P1=this._hDS.selectSingleNode( "namedSets/namedSet[@name='" + _hWC2 + "']" );this._h5V1(_h5B1, _h5P1, _h6B1);break;}}};C_GlassPropertySheet.prototype.F_GetObjectNamesThatSupportProperty=function(_h7Y,_hKJ){var a=[];for(var _h5B1 in this.Objects){if(_hKJ){if(this.F_ObjectSupportsSubProperty(_h5B1, _h7Y, _hKJ)){a.push(_h5B1);}}else{if(this.F_ObjectSupportsProperty(_h5B1, _h7Y)){a.push(_h5B1);}}}return a;};C_GlassPropertySheet.prototype.F_ObjectSupportsProperty=function(_h5B1,_h7Y){var o=this.Objects[_h5B1];return Boolean(o&&o[_h7Y]);};C_GlassPropertySheet.prototype.F_ObjectSupportsSubProperty=function(_h5B1,_h7Y,_hKJ){return Boolean(this._hS3[_h5B1][_h7Y][_hKJ]);};C_GlassPropertySheet.prototype.F_GetSubPropertiesNames=function(_h492){return this._hES[_h492];};C_GlassPropertySheet.prototype.F_GetGroupAttribute=function(_h0I1,_hIS){var o=this._hHJ[_h0I1];if(o){return o[_hIS];}};C_GlassPropertySheet.prototype.F_GetPropertyAttribute=function(_h7Y,_hIS){var o=this._h6B[_h7Y];if(o){return o[_hIS];}};C_GlassPropertySheet.prototype.F_GetObjectAttribute=function(_h5B1,_hIS){var o=this._hFG[_h5B1];if(o){return o[_hIS];}};C_GlassPropertySheet.prototype.F_ActivateProperty=function(_h492){if(this.F_IsPropertyDisplayed(_h492)){this._hLJ(_h492);}};C_GlassPropertySheet.prototype._hLJ=function(_h492){if(this._hIN!=_h492){this._hUD();this._hIN=_h492;var _hR92=this._h162[_h492];if(this._hXN1.F_PropertySheet_OnPropertyActivated){this._hXN1.F_PropertySheet_OnPropertyActivated(this, this._hIN);}}};C_GlassPropertySheet.prototype._hUD=function(){if(this._hIN){var _hR92=this._h162[this._hIN];if(this._hXN1.F_PropertySheet_OnPropertyDeactivated){this._hXN1.F_PropertySheet_OnPropertyDeactivated(this, this._hIN);}this._hIN="";}};C_GlassPropertySheet.prototype.F_IsPropertyDisplayed=function(_h492){return !isNaN(this._hCS[_h492]);};C_GlassPropertySheet.prototype.F_IsMultiSelectProperty=function(_h492){return(this.F_GetPropertyAttribute( _h492, "isMultiSelect" )=="true" );};C_GlassPropertySheet.prototype.F_GetActiveProperty=function(){return this._hIN;};C_GlassPropertySheet.prototype.F_GetLabel=function(_h492){return this._hG02[_h492];};C_GlassPropertySheet.prototype.F_SetUpdate=function(b){this._hJ02=b;if(!b){this.F_ClearGlassSheet();}};C_GlassPropertySheet.prototype.F_GetUpdate=function(){return this._hJ02;};C_GlassPropertySheet.prototype.F_GetPropertyValue=function(_h492){return this._hJN[_h492];};C_GlassPropertySheet.prototype._h7B=function(_h492,_h552,_h6P1){if(this._hP92[_h492]=="boolean"){var _h7O1=G_ResManager.F_GetResource("HAL_BOOLEAN_LISTVIEW");if(_h7O1){return _h7O1;}var d=G_ResManager.F_GetResourcesDoc();_h7O1=d.documentElement.appendChild(d.createElement("listView"));_h7O1.setAttribute( "id", "HAL_BOOLEAN_LISTVIEW" );var _h1I1=_h7O1.appendChild(d.createElement("listItems"));var _hBO1=_h1I1.appendChild(d.createElement("listItem"));_hBO1.setAttribute( "value", "false" );_hBO1.setAttribute( "idsLabel", "IDS_HAL_PROPVAL_FALSE" );var _hBO1=_h1I1.appendChild(d.createElement("listItem"));_hBO1.setAttribute( "value", "true" );_hBO1.setAttribute( "idsLabel", "IDS_HAL_PROPVAL_TRUE" );return G_ResManager.F_GetResource("HAL_BOOLEAN_LISTVIEW");}if(!this._hZ8[_h492]){var _h7B1=this.F_GetPropertyAttribute(_h492, "listView");return this._hXN1.F_PropertySheet_GetPropertyListView(this, _h7B1?_h7B1:_h492, _h492, _h552, _h6P1);}var _h7O1=this._hDS.selectSingleNode( "properties/group/property[@name=" + _h492.F_ToXPathString() + "]/listView" );return _h7O1?_h7O1.cloneNode(true):null;};C_GlassPropertySheet.prototype._hTD=function(_hGN,_hEJ){this._h3N=_hGN.appendChild(document.createElement("DIV"));this._h3N.className="clsBlocker" + ( _hEJ?( " " + _hEJ ):"" );this._h3N[G_BrowserInfo.M_bIsPointerEnabled?"onpointerdown":"onmousedown"]=C_GlassPropertySheet._hVD;this._h3N.style.visibility="hidden";this._h3N._h87='idEventBlocker';};C_GlassPropertySheet.prototype._h7P1=function(){this._h3N.style.visibility="";};C_GlassPropertySheet._hVD=function(e){e.stopPropagation();var _hJS=document.getElementById(this._h87).h_oPropertySheet;var _hLN1=_hJS._hXN1;if(_hLN1.F_PropertySheet_OnInputBlockerMouseDown){_hLN1.F_PropertySheet_OnInputBlockerMouseDown(_hJS);}if(!G_BrowserInfo.M_bIsIE){window.getSelection().focusNode.blur();}e.target.style.visibility="hidden";};C_GlassPropertySheet.prototype._hK02=function(){this._h3N.style.visibility="hidden";};C_GlassPropertySheet.prototype.F_OnKeyDown=function(e){switch(e.keyCode){case U_DOM.K_iKeyTab:U_DOM.F_CancelEvent(e);break;case U_DOM.K_iKeyDelete:if(!this._hO41&&this._hIN){this._hXN1.F_PropertySheet_OnPropertyDelete(this, this._hIN);}break;}};C_GlassPropertySheet.prototype.F_OnKeyPress=function(e){switch(e.keyCode){case U_DOM.K_iKeyEnter:G_Debug.F_Print("_hIN:"+this._hIN);if(this._hIN){switch(this._h162[this._hIN ]){case "text":case "dropDown":this._hUD();break;default:}}break;case U_DOM.K_iKeyEscape:this._hUD();break;}};C_GlassPropertySheet.prototype._hP41=function(_hS92,_h552){var _h8P1=this.F_GetPropertyAttribute(_hS92, "dataType");if ( this._hXN1.F_PropertySheet_OnPropertyFailedValidation&&_h8P1&&!((_h552==="" )&&this.F_GetPropertyAttribute( _hS92, "defaultDelete" ) ) ){var _hXC2=this.F_GetPropertyAttribute(_hS92, "min");var _hYC2=this.F_GetPropertyAttribute(_hS92, "max");switch(_h8P1){case "integer":if(!_h552.match(/^-?\d+$/)){this._hXN1.F_PropertySheet_OnPropertyFailedValidation(this, C_GlassPropertySheet.K_iNotValid, _hS92, _h552, parseInt(_hXC2), parseInt(_hYC2));return;}if(this._h8B(_hS92, _h552, parseInt(_h552, 10), parseInt(_hXC2), parseInt(_hYC2))){this._hXN1.F_PropertySheet_OnPropertyChange(this, _hS92, _h552);}return;case "float":var _h562=String.F_ParseFloat(_h552);if(this._h8B(_hS92, _h552, _h562, parseFloat(_hXC2), parseFloat(_hYC2))){this._hXN1.F_PropertySheet_OnPropertyChange(this, _hS92, String(_h562));}return;case "decimal":var _h6V1=new C_Decimal(_h552);var _h562=_h6V1.F_ToFloat();if(this._h8B(_hS92, _h552, _h562, parseFloat(_hXC2), parseFloat(_hYC2))){this._hXN1.F_PropertySheet_OnPropertyChange(this, _hS92, _h6V1.F_ToString());}return;}}this._hXN1.F_PropertySheet_OnPropertyChange(this, _hS92, _h552);};C_GlassPropertySheet.prototype._h8B=function(_hS92,_h552,_h662,_hZC2,_h0D2){if(isNaN(_h662)){this._hXN1.F_PropertySheet_OnPropertyFailedValidation(this, C_GlassPropertySheet.K_iNotValid, _hS92, _h552, _hZC2, _h0D2);return false;}if(!isNaN(_hZC2)&&(_h662<_hZC2)){this._hXN1.F_PropertySheet_OnPropertyFailedValidation(this, C_GlassPropertySheet.K_iLessThanMin, _hS92, _h552, _hZC2, _h0D2);return false;}if(!isNaN(_h0D2)&&(_h662>_h0D2)){this._hXN1.F_PropertySheet_OnPropertyFailedValidation(this, C_GlassPropertySheet.K_iGreaterThanMax, _hS92, _h552, _hZC2, _h0D2);return false;}return true;};C_GlassPropertySheet.prototype.F_ShowProperty=function(_h492,_h552){switch(this._h162[_h492]){case "info":case "text":this.F_AddTextProperty(_h492, _h552);break;case "boolean":this.F_AddBooleanProperty(_h492,(typeof _h552=="boolean" )?( _h552?"true":"false" ):_h552);break;case "dropDownList":case "dropDown":this.F_AddDropDownProperty(_h492, _h552);break;case "action":case "colorAction":this.F_AddActionProperty(_h492, _h552);break;default:G_Debug.F_Print("C_GlassPropertySheet.prototype.F_ShowProperty -- NO SUCH PROPERTY TYPE.");break;}};C_GlassPropertySheet.prototype.F_StartPropertyGroup=function(_h0I1){if(this._hJ02){return;}if(this.F_GetGroupAttribute( _h0I1, "hide" )=="true" ){return;}if(this._hEG){this._hEG={};}this._hEG={'type':'CollapsibleSection','id': _h0I1 + '_group','name':_h0I1,'label':this.F_GetLabel(_h0I1)};};C_GlassPropertySheet.prototype.F_EndPropertyGroup=function(){if(this._hJ02){return;}if(this._hBS.length){var _hMJ=this.F_GetGroupProperties();this._hEG.items=_hMJ;this._hHN.push(this._hEG);}};C_GlassPropertySheet.prototype.F_EndAllPropertyGroups=function(){if(this._hJ02){return;}if(!this._hJ02){ this._hNJ();}};C_GlassPropertySheet.prototype._hNJ=function(){window.parent.require(['bi/content_apps/common/ui/properties/PropertyUIControl'],function(PropertyUIControl){var options={'el': this._hZA1,'items': this.F_GetItems()};if(this._hWD){this._hWD.remove();}this._hWD=new PropertyUIControl(options);this._hWD.render();}.bind(this));};C_GlassPropertySheet.prototype.F_ClearGlassSheet=function(){this._hJN={};this._hIN="";if(this._hBS.length){this._hBS.length=0;}if(this._hHN.length){this._hHN.length=0;}if(this._hEG){this._hEG={};}if(this._hWD){this._hWD.onClose();this._hWD.remove();}};C_GlassPropertySheet.prototype.F_AddProperty=function(_h492,_h552){var _h052=this.F_GetLabel(_h492);var _hR92=this._h162[_h492];var _h2I1=this._h2V1[_hR92];var _h9P1=_h552?false:true;var _h3I1={'type': 'Separator'};var _hKS={'type': _h2I1,'name': _h492,'label': _h052};switch(_hR92){case 'info':_hKS.editable=false;_hKS.value=_h552;break;case 'text':_hKS.editable=true;_hKS.value=_h552;_hKS.onChange=function(){G_Debug.F_Print("TEXT CHANGE");};break;case 'boolean':_hKS.checked=false;_hKS.onChange=function(){G_Debug.F_Print("BOOLEAN CHANGE");};break;case 'dropDown':case 'dropDownList':_hKS.responsive=false;_hKS.options=_h552;_hKS.disabled=_h9P1;_hKS.onChange=function(_hAP1,_h4I1){setTimeout(this._hXN1.F_PropertySheet_OnPropertyChange.bind(this._hXN1, this, _hAP1, _h4I1), 0);}.bind(this);break;case 'action':case 'colorAction':_hKS.items=[{"align":"left","items": [{"type":"text","value": _h052}]},{"align":"right","items": [{"type":"text","value": _h552},{"type":"icon","svgIcon": 'common-menuoverflow',"clickCallback": function(){ this._hXN1.F_PropertySheet_OnPropertyAction(this, _h492, null, false); }.bind(this)}]}];break;default:G_Debug.F_Print("C_GlassPropertySheet.prototype.F_AddProperty -- NO SUCH PROPERTY TYPE");break;}this._hBS.push(_hKS);this._hBS.push(_h3I1);};C_GlassPropertySheet.prototype.F_AddTextProperty=function(_h492,_h552){this.F_AddProperty(_h492, _h552);};C_GlassPropertySheet.prototype.F_AddBooleanProperty=function(_h492,_h552){var _h5I1=G_ResManager.F_GetString((_h552=="true" )?"IDS_HAL_PROPVAL_TRUE":"IDS_HAL_PROPVAL_FALSE" );this.F_AddProperty(_h492, _h5I1);};C_GlassPropertySheet.prototype.F_AddDropDownProperty=function(_h492,_h552){var _h7O1=this._h7B(_h492, _h552);if(_h7O1){ var _hOJ=( this.F_GetPropertyAttribute( _h492, "ignoreValueCase" )=="true" );var _h8B1=U_XML.F_SelectNodes(_h7O1, ".//", ["listItem"]);if(_h8B1){var _h6I1=[];var _hLS=[];_h6I1=U_XML.F_AppendNodeListToArray(_h6I1, _h8B1);_h6I1.forEach(function(v,i){var _hMS=U_XML.F_GetSpecifiedAttributeValue(v, 'idsLabel');var _hNS=U_XML.F_GetSpecifiedAttributeValue(v, 'value');if(_hNS==null){_hNS=C_ListView.F_GetListItemLabel(v);}var _hNN={'label':G_ResManager.F_GetString(_hMS),'value':_hNS,'selected':false};_hLS.push(_hNN);});}}this.F_AddProperty(_h492, _hLS);};C_GlassPropertySheet.prototype.F_AddActionProperty=function(_h492,_h552){this.F_AddProperty(_h492, _h552);};C_GlassPropertySheet.prototype.F_GetGroupProperties=function(){var _hOS=[];if(this._hBS.length){_hOS=_hOS.concat(this._hBS);this._hBS.length=0;}return _hOS;};C_GlassPropertySheet.prototype.F_GetItems=function(){var _hON=[];if(this._hHN.length){_hON=_hON.concat(this._hHN);this._hHN.length=0;}return _hON;};return C_GlassPropertySheet;});
|