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_PromptSelectWithSearch(_cX81, _cTM, _cCB1){G_HAL.F_VerifyDependencies("C_PromptControl");G_HAL.F_VerifyDependencies("C_SimpleValue");G_HAL.F_VerifyDependencies("C_SelectWithSearch");C_PromptSelectWithSearch.baseConstructor.call(this, _cTM, _cCB1);this._c0D();this._cY81=_cX81;this._cBT1();this._cTT([]);};C_PromptSelectWithSearch.F_Extends(C_PromptControl);C_PromptSelectWithSearch.prototype._c0D=function(){C_PromptSelectWithSearch.superClass._c0D.call(this);this._cZY=parseInt(this._cWM.getAttribute("rowsPerPage"))||5000;this._c9E1=this._cWM.getAttribute("refQuery")||"";this._cUT=this._cWM.getAttribute("columnName")||"";this._cBS1=this._cWM.getAttribute("roid")||"";this._cTI1=(this._cWM.getAttribute("dataType")==="memberUniqueName")?true:false;this._cYN1=(this._cUT.length>0)?true:false; };C_PromptSelectWithSearch.prototype.F_Detach=function(){this._cTK=undefined;this._cOE.F_Detach();};C_PromptSelectWithSearch.prototype._cBT1=function(){var _cX81=this._cY81;_cX81.innerHTML ='<div class="clsPromptSelectWithSearch" style="display: flex; flex-direction: row; width: 213px; height: 320px">' +((this._cWC1===true&&this._cUJ===false)?'<div class="clsAdormentArea"></div>':'') +'<div class="clsControlArea" style="flex: 1"></div>' +'</div>';this._c0Z=_cX81.getElementsByClassName("clsControlArea")[0];if(this._cWC1===true&&this._cUJ===false){this._cVT=_cX81.getElementsByClassName("clsAdormentArea")[0];this._cVT.style["padding-top"] = "13px";this._cU5(this._cVT);}this._cOE=new C_SelectWithSearch(this._c0Z, this._cWM,(this._cYN1?{requestData: this._cV31.bind(this)}:undefined));this._cOE.F_Draw();this._cOE.F_Subscribe("/OnValueChange", this._cTT.bind(this));this._cUK=this._c0Z.getElementsByClassName("clsListViewHolder")[0].parentNode;};C_PromptSelectWithSearch.prototype._cV31=function(_c691,_cAE1){this._cTK=_cAE1;this._cBE1(_c691); };C_PromptSelectWithSearch.prototype.F_GetParameterValues=function(){var _cHY, _c6U1, _cCL1=[];var _cCS1=this._cDS1, _cES1;if(_cCS1){for(_c6U1=0; _c6U1<_cCS1.length; _c6U1++){_cES1=_cCS1[_c6U1];_cHY=new C_SimpleValue(false, _cES1["value"], C_SimpleValue._cUR1, undefined);_cHY._cYR=_cES1["label"];_cCL1.push(_cHY);}}return _cCL1;};C_PromptSelectWithSearch.prototype._cGI1=function(_cCS1){if(this._cWC1===true){if(this._c231){this._c9B=this._c231(this.F_GetValues());}else{if(_cCS1.length===0){this._c9B=false;}else{this._c9B=true;}}}else{this._c9B=true;}if(this._c9B){if(this._cDB1&&this._cDB1.F_PromptControl_OnOverallValidState){this._cDB1.F_PromptControl_OnOverallValidState(this);}}else{if(this._cDB1&&this._cDB1.F_PromptControl_OnOverallInvalidState){this._cDB1.F_PromptControl_OnOverallInvalidState(this);}}if(this._cUJ!==true){this._cUK.parentNode.className=(this._c9B===true)?"":"clsInvalid";}};C_PromptSelectWithSearch.prototype._cTT=function(_cCS1){this._cDS1=_cCS1;if(this._cDB1&&this._cDB1.F_PromptControl_OnValueChange){this._cDB1.F_PromptControl_OnValueChange(this);}this._cGI1(_cCS1);};C_PromptSelectWithSearch.prototype._cBE1=function(_c691){var _cLM1=G_ReportSpec.F_GetReportNode();var _cDN=_cLM1.cloneNode(true);if(this._cBS1){var _cUI1=_cDN.selectSingleNode("layouts/layout//" + this._cWM.nodeName + "[@iid='" + this._cBS1 + "']/useItem");if(_cUI1){this._cUT=_cUI1.getAttribute("refDataItem");}}var _c791=U_Report.F_GetXML(_cDN);var _c891=G_ReportSpec.F_GetStoreID();var _c9M=G_ReportSpec.F_GetReportNode().getAttribute("expressionLocale");var _cAM=_c9M;var _cFG1=new C_RestRequest({ F_Request_OnComplete:function(_cFG1){ this.F_Request_OnComplete(_cFG1); }.bind(this)},"POST", "v1/reports/runselectsearchreport" ,G_JSON.stringify({ reportspec:_c791, storeid:_c891, "rowsPerPage":this._cZY, "refQuery":this._c9E1, "dataItemName":this._cUT, "caption":this._cTI1,"searchFor":_c691, "option":this._cOE.F_GetOptionValue(),"caseInsensitive":this._cOE.F_IsCaseInsensitive(),"productLocale":_c9M, "contentLocale":_cAM }));D_Progress.F_SendRequest(_cFG1, null, G_ResManager.F_GetString("IDS_CCHL_SENDING_SEARCH_REQUEST"));};C_PromptSelectWithSearch.prototype.F_Request_OnComplete=function(_cFG1){var _cMM1=[];var _cPN1=_cFG1.F_GetError();if(_cPN1){F_ShowError(_cPN1);return _cMM1;}var _cCE1=_cFG1.F_GetResponseData();var _cVK=null;if(_cCE1&&_cCE1.data.length>0&&_cCE1.data[0].searchResult){if(_cCE1.data[0].searchResult.length>0){if(_cCE1.data[0].searchResult[0].generatedPromptParameters){var _cNM1=_cCE1.data[0].searchResult[0].generatedPromptParameters;F_MsgBox(G_ResManager.F_GetString("IDS_MSG_PROMPTED_VALUES", _cNM1));return _cMM1;} else {_cMM1=_cCE1.data[0].searchResult;}}}if(this._cTK){this._cTK({"options": _cMM1});} };C_PromptSelectWithSearch.prototype.F_ClearParameterValues=function(){while(this._cDS1.length>0){this._cDS1.pop();}this._cOE.F_ClearSelections();};C_PromptSelectWithSearch.prototype.F_AddValues=function(_cRL1){if(!_cRL1||_cRL1.length<1){this.F_ClearParameterValues();}else{this._cOE.F_AddSelectedValues(_cRL1);}};
|