123456 |
- // Licensed Materials - Property of IBM
- // IBM Cognos Products: cchl
- // (C) Copyright IBM Corp. 2003, 2016.
- // US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- function C_PromptTree(_cBB, _cW31, _cCB1, _c9O){G_HAL.F_VerifyDependencies("G_ResManager");G_HAL.F_VerifyDependencies("C_TreeView");G_HAL.F_VerifyDependencies("C_SimpleValue");G_HAL.F_VerifyDependencies("C_PromptControl");this.F_ConstructBaseClass(_cW31, _cCB1);this._cNH1=[];this._cCB=_cBB;this._c8O=_c9O;this._c0D();this._cV7();if(_cW31.nodeName==="treeView"){_cW31.setAttribute("showCheckboxes", this._cHX?"true":"false");}else {this._cWT(_cW31);}this._cBT1();this.F_UpdateControlStyle(this._c991, "min-width: 200px; width: 300px; min-height: 200px; height: 400px");this._cGI1();}C_PromptTree.F_Extends(C_PromptControl);C_PromptTree.prototype.F_Detach=function(){if(this._c2B1&&this._c2B1.F_Detach){this._c2B1.F_Detach();}while(this._cNH1.length>0){var _cJL1=this._cNH1.pop();_cJL1.remove();}};C_PromptTree.prototype._cPE=function(_cWB1,_c4B1){var _cZO=this._cUN;if(_cZO&&_cZO[_cWB1]===true){_c4B1.setAttribute((this._cHX===true?"checked":"selected"), "true");delete _cZO[_cWB1];}};C_PromptTree.prototype._cWT=function(_cW31){var _cDE1='<treeView id="PromptTree_' + _cW31.getAttribute("id") + '" multiSelect="false"></treeView>';this._cEO1=U_XML.F_LoadString(undefined, _cDE1);var _c5B1=this._cEO1.documentElement;_c5B1.setAttribute("showCheckboxes", this._cHX?"true":"false");var _cII1=_cW31.selectNodes("selectOptions/selectTreeOption");if(_cII1&&_cII1.length>0){var _c6U1, _c6M1, _c4B1, _cWB1;for(_c6U1=0; _c6U1<_cII1.length; _c6U1++){_c6M1=_cII1[_c6U1];_c4B1=_c5B1.appendChild(_c5B1.ownerDocument.createElement("treeNode"));_cWB1=_c6M1.getAttribute("useValue");_c4B1.setAttribute("label", _c6M1.getAttribute("displayValue"));_c4B1.setAttribute("value", _cWB1);_c4B1.setAttribute("tooltip", _cWB1);_c4B1.setAttribute("idsExtraAriaLabel", "IDS_CCHL_AC_TYPE_MEMBER");_c4B1.setAttribute("expandable", "true");this._cPE(_cWB1, _c4B1);}}};C_PromptTree.prototype._c0D=function(){C_PromptTree.superClass._c0D.call(this);this._cZY=this._cWM.getAttribute("rowsPerPage")||5000;this._c9E1=this._cWM.getAttribute("refQuery")||"";if(this._cHX===true){this._cNO=G_ResManager.F_GetString("IDS_CCHL_PRMT_SELECTALL");this._c9H=G_ResManager.F_GetString("IDS_CCHL_PRMT_DESELECTALL");}};C_PromptTree.prototype._cBT1=function(){var _cXT=this._cCB.insertRow(0).insertCell(0);_cXT.innerHTML ='<div class="clsPromptTree" style="display: flex; flex-direction: row">' +'<div class="clsAdormentArea" style="padding: 0 2px 0 2px"><div></div><div></div></div>' +'<div style="flex: 1 0 auto; display: flex; flex-direction: column">' +'<div style="flex: 1 0 auto; position: relative">' +'<div class="clsTreeView" style="position: absolute; top: 0; right: 0; bottom: 0; left: 0"></div>' +'</div>'+'<div class="clsMultiSelectArea clsDialogText" style="text-align: right; padding: 5px 5px 0 0">' +'<a class="clsHyperlink" href="#"></a>' +'</div>'+'</div>'+'</div>';this._c991=_cXT.firstChild; this._cX31=this._c991.getElementsByClassName("clsTreeView")[0];this._c1Z=this._c991.getElementsByClassName("clsAdormentArea")[0];this._cLB=this._c991.getElementsByClassName("clsMultiSelectArea")[0];if(this._cUJ===false){if(this._cWC1===true){this._cU5(this._c1Z.firstChild);}}else {this._c1Z.style.display="none";}this._c2B1=new C_TreeView(this._cX31,(this._cEO1?this._cEO1.documentElement:this._cWM), this);var _c4S1;if(this._cHX===true){var _cA91=this._cLB.firstChild;_cA91.innerHTML=this._c9H;_c4S1=this._cKT.bind(this);_cA91.addEventListener("click", _c4S1);this._cNH1.push({remove: function(){_cA91.removeEventListener("click", _c4S1);}});_cA91.addEventListener("keydown", _c4S1);this._cNH1.push({remove: function(){_cA91.removeEventListener("keydown", _c4S1);}});}else {this._cLB.style.display="none";}};C_PromptTree.prototype._cWK=function(_cGX){this._c2B1.F_ClearSelections(true);if(_cGX){var _cVP1=this._c2B1.F_GetCheckedNodes(), _cBR1;for(var _c6U1=0; _c6U1<_cVP1.length; _c6U1++){_cBR1=_cVP1[_c6U1];_cBR1.setAttribute("checked", "false");this._c2B1._cB91(this._c2B1._c9V1.getElementById(_cBR1.getAttribute("htmlId")), _cBR1);}}this._cTT();};C_PromptTree.prototype._cKT=function(event){event.stopPropagation();if(event.type==="click"||(event.type==="keydown"&&event.keyCode===U_DOM.K_iKeyEnter)){this._cWK(true);}};C_PromptTree.prototype._cBE1=function(){var _cVP1=(this._cHX===true)?this._c2B1.F_GetCheckedNodes():this._c2B1.F_GetSelectedNodes(), _cRL1=[];for(var _c6U1=0; _c6U1<_cVP1.length; _c6U1++){_cRL1.push(C_TreeView.F_GetTreeNodeLabel(_cVP1[_c6U1]));}return _cRL1;};C_PromptTree.prototype.F_TreeView_OnPopulateChildren=function(_c6B1,_c4B1){if(this._cEO1){this._cPC1=_c4B1;return this._c0B(_c4B1.getAttribute("value"));}return false;};C_PromptTree.prototype.F_Request_OnComplete=function(_cFG1){var _cDL1=_cFG1.F_GetMembersResponse();this._cQ5(_cDL1);};C_PromptTree.prototype._c0B=function(_cRT1){var _c221=G_Model, _cXN1=false;if(_c221){var _cDL1=_c221.F_GetMembers(_cRT1, this._cZY);if(_cDL1){this._cQ5(_cDL1);}else {this._cLH1=new C_MembersRequest(_c221, this, _cRT1, this._cZY);this._cLH1.F_Send();_cXN1=true;}}return _cXN1;};C_PromptTree.prototype._cQ5=function(_cDL1){if(_cDL1){var _cY31=this._cPC1||this._c2B1.F_GetTreeViewNode();var _cCU1, _c4B1, _cWI1=_cDL1.selectNodes("member");var _cAV1=_cY31.ownerDocument, _cWB1;for(var _c6U1=0; _c6U1<_cWI1.length; _c6U1++){_cCU1=_cWI1.item(_c6U1);_c4B1=_cY31.appendChild(_cAV1.createElement("treeNode"));_cWB1=_cCU1.getAttribute("_path");_c4B1.setAttribute("label", _cCU1.getAttribute("memberCaption"));_c4B1.setAttribute("value", _cWB1);_c4B1.setAttribute("tooltip", _cCU1.getAttribute("memberUniqueName"));_c4B1.setAttribute("idsExtraAriaLabel", "IDS_CCHL_AC_TYPE_MEMBER");_c4B1.setAttribute("expandable", (_cCU1.getAttribute("hasChildren")==="false")?"false":"true");this._cPE(_cWB1, _c4B1);}this._c2B1.F_EndAsyncLoad(true);}else {this._c2B1.F_EndAsyncLoad(false);}};C_PromptTree.prototype.F_GetParameterValues=function(){var _cVP1=(this._cHX===true)?this._c2B1.F_GetCheckedNodes():this._c2B1.F_GetSelectedNodes(), _cRL1=[];var _cFS1, _cHY;for(var _c6U1=0; _c6U1<_cVP1.length; _c6U1++){_cFS1=_cVP1[_c6U1];_cHY=new C_SimpleValue(false, null, C_SimpleValue._cUR1, undefined);_cHY.F_SetUseValue(_cFS1.getAttribute("value"), C_ParameterValue._cUC1);_cHY._cYR=_cFS1.getAttribute("label");_cRL1.push(_cHY);}var _cDU1, _cZO=this._cUN||{};for(_cDU1 in _cZO){if(_cZO.hasOwnProperty(_cDU1)){_cHY=new C_SimpleValue(false, null, C_SimpleValue._cUR1, undefined);_cHY.F_SetUseValue(_cDU1, C_ParameterValue._cUC1);_cRL1.push(_cHY);}}return _cRL1;};C_PromptTree.prototype._cGI1=function(){if(this._cWC1===true){var _cVP1=(this._cHX===true)?this._c2B1.F_GetCheckedNodes():this._c2B1.F_GetSelectedNodes();if(this._c231){this._c9B=this._c231(this.F_GetValues());}else{if(_cVP1.length>0||this._cDH()===true){this._c9B=true;}else{this._c9B=false;}}}else{this._c9B=true;}if(this._c9B){this._cX31.style.border="";if(this._cDB1&&this._cDB1.F_PromptControl_OnOverallValidState){this._cDB1.F_PromptControl_OnOverallValidState(this);}}else{this._cX31.style.border="1px solid #D64427";if(this._cDB1&&this._cDB1.F_PromptControl_OnOverallInvalidState){this._cDB1.F_PromptControl_OnOverallInvalidState(this);}}};C_PromptTree.prototype._cTT=function(_c6B1,_c4B1,_c1V){this._cGI1();if(this._cDB1&&this._cDB1.F_PromptControl_OnValueChange){this._cDB1.F_PromptControl_OnValueChange(this);}};C_PromptTree.prototype.F_TreeView_OnNodeClick=function(_c6B1,_c4B1,_c1V){if(this._cHX!==true){this._cTT(_c6B1, _c4B1, _c1V);if(this._cUN){this._cUN=null;}}};C_PromptTree.prototype.F_TreeView_OnNodeCheck=function(_c6B1,_c4B1){setTimeout(this._cTT.bind(this), 100, _c6B1, _c4B1);return true;};C_PromptTree.prototype._cDH=function(){var _cDU1, _cZO=this._cUN||{};for(_cDU1 in _cZO){if(_cZO.hasOwnProperty(_cDU1)){return true;}}return false;};C_PromptTree.prototype._cV7=function(){var _cGO=this._cWM.selectNodes("selectChoices/selectOption");if(_cGO&&_cGO.length>0){var _c6U1, _c6M1, _cZO=this._cUN={};for(_c6U1=0; _c6U1<_cGO.length; _c6U1++){_c6M1=_cGO[_c6U1];_cZO[_c6M1.getAttribute("useValue")]=true;}}};C_PromptTree.prototype.F_ClearParameterValues=function(){this._cWK(this._cHX);};C_PromptTree.prototype.F_AddValues=function(_cRL1){if(!_cRL1||_cRL1.length<1){this.F_ClearParameterValues();}else{var _c6U1, _cYO1, _c4B1;var _c5B1=this._c2B1.F_GetTreeViewNode();var _c0S1, length;if(this._cHX){_c0S1="checked";length=_cRL1.length;}else{_c0S1="selected";length=1;this._cWK(false);}for(_c6U1=0; _c6U1<length; _c6U1++){_cYO1=_cRL1[_c6U1];_c4B1=_c5B1.selectSingleNode(".//treeNode[@value='" + _cYO1["use"] + "']");if(_c4B1){if(_c4B1.getAttribute(_c0S1)!="true"){_c4B1.setAttribute(_c0S1, "true");this._c2B1._cB91(this._c2B1._c9V1.getElementById(_c4B1.getAttribute("htmlId")), _c4B1);}}else{if(!this._cUN){this._cUN={};}this._cUN[_cYO1["use"]]=true;}}this._cTT();}};
|