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_PromptSelectFile(_cX81, _cTM, _cCB1){G_HAL.F_VerifyDependencies("C_SimpleValue");C_PromptSelectFile.baseConstructor.call(this, _cTM, _cCB1);this._c0D();this._cY81=_cX81;this._cZD1=[];this._cBT1();this._cGI1();};C_PromptSelectFile.F_Extends(C_PromptControl);C_PromptSelectFile.prototype.F_Detach=function(){while(this._cZD1.length>0){this._cZD1.pop()._cQP1();}if(this._cNK){document.body.removeChild(this._cNK);this._cNK=undefined;}};C_PromptSelectFile.prototype._c0D=function(){C_PromptSelectFile.superClass._c0D.call(this);this._cT7=this._cWM.getAttribute("baseModelSearchPath")||"";};C_PromptSelectFile.prototype._cBT1=function(){var _cX81=this._cY81;_cX81.innerHTML ='<form action="" enctype="multipart/form-data" accept-charset="UTF-8" method="post">' +'<div HAL_ids="IDS_LBL_IMPORT_FILE" style="padding-bottom: 4px"></div>' +'<div style="padding: 1px">' +'<input style="border: 1px solid red" class="clsSelectFileInput" type="file" id="inFileName" name="pdsContent" size="98" accept="*.csv;*.xml;*.xls" HAL_idsAriaLabel="IDS_LBL_IMPORT_FILE"/>' +'</div>'+'<input type="hidden" id="inSpec" name="inSpec"/>' +'</form>';this._cKE=_cX81.getElementsByClassName("clsSelectFileInput")[0];this._cKK(this._cKE, "change", this._c8H);};C_PromptSelectFile.prototype._cKK=function(_cBR1,_cHI1,_cZ81){var _c4S1=_cZ81.bind(this);_cBR1.addEventListener(_cHI1, _c4S1);this._cZD1.push({_cQP1: function(){_cBR1.removeEventListener(_cHI1, _c4S1);}});};C_PromptSelectFile.prototype._c8H=function(evt){var _cTO1=this._cGI1();if(_cTO1===true){var _c1E1=this._cKE.value, _cL9="";var _cRT=_c1E1.split("."), _cJT1=_cRT.length-1;if((_cRT[_cJT1]==="xml")||(_cRT[_cJT1]==="XML")){_cL9="XML";}else if((_cRT[_cJT1]==="xls")||(_cRT[_cJT1]==="XLS")){_cL9="Excel2003";}else if((_cRT[_cJT1]==="xlsx")||(_cRT[_cJT1]==="XLSX")){_cL9="Excel2003";}else if ((_cRT[_cJT1]==="csv") ||(_cRT[_cJT1]==="CSV")) {_cL9="CSV";}else {_cL9="CSV";}var _c8S1=this._cY81.firstChild;var _cEM1='<input><dataSet type="' + _cL9 + '">';_cEM1 += "<name>" + this._c881.F_XMLEncode() + "</name>";_cEM1 += "<sourcePath>" + _c1E1.F_XMLEncode() + "</sourcePath></dataSet>";_cEM1 += "<baseModelSearchPath>" + this._cT7.F_XMLEncode() + "</baseModelSearchPath>";_c8S1.inSpec.value=_cEM1+"</input>";this._cSY(_c8S1);_c8S1.action=G_CCHL.M_sGatewayURL+'/metadataUIService?pid=pdm_process&c=processPersonalData';_c8S1.submit();}};C_PromptSelectFile.prototype._cGI1=function(){var _cGN1=this._cKE.value;var _cTO1=true;if(this._cWC1){if(this._c231){_cTO1=this._c231(this.F_GetValues());}else{_cTO1=(_cGN1&&_cGN1.length>0)?true:false;}}if(_cTO1){if(!this._cUJ){this._cKE.parentNode.style.padding="1px";this._cKE.style.border="none";}this._c9B=true;if(this._cDB1&&this._cDB1.F_PromptControl_OnOverallValidState){this._cDB1.F_PromptControl_OnOverallValidState(this);}}else{if(!this._cUJ){this._cKE.parentNode.style.padding="0px";this._cKE.style.border="1px solid #D64427";}this._c9B=false;if(this._cDB1&&this._cDB1.F_PromptControl_OnOverallInvalidState){this._cDB1.F_PromptControl_OnOverallInvalidState(this);}}if(this._cDB1&&this._cDB1.F_PromptControl_OnValueChange){this._cDB1.F_PromptControl_OnValueChange(this);}return _cTO1;};C_PromptSelectFile.prototype.F_GetParameterValues=function(){return new C_SimpleValue(false, this._cKE.value);};C_PromptSelectFile.prototype._cTY=function(){var _c2E1='IFrame'+Math.floor(Math.random()*11111);this._cNK=document.createElement('DIV');this._cNK.innerHTML='<iframe style="display:none" src="about:blank" content="text/html" id="'+_c2E1+'" name="'+_c2E1+'" title="' + G_ResManager.F_GetString( "IDS_FRAME_FILE_UPLOAD_TITLE" ) + '"></iframe>';document.body.appendChild(this._cNK);this._cKK(this._cNK.firstChild, "load", this._cMO);return _c2E1;};C_PromptSelectFile.prototype._cSY=function(_c8S1){var _c2E1=this._cTY();_c8S1.setAttribute('target', _c2E1);return true;};C_PromptSelectFile.prototype._cMO=function(_c2E1){};C_PromptSelectFile.prototype.F_ClearParameterValues=function(){this._cKE.value="";this._cGI1();};C_PromptSelectFile.prototype.F_AddValues=function(_cRL1){if(!_cRL1||_cRL1.length<1){this.F_ClearValues();}else{this._cKE.value=_cRL1[0]["use"]||"";this._cGI1();}};
|