/** * @fileoverview comm GSFS Biz 공통 library관련 기본함수. */ if ( !JsNamespace.exist("LGE.Biz") ) { /** * @namespace * @name LGE.Biz * @author * @memberof! */ JsNamespace.declare("LGE.Biz", { _service: null, _commonCodeColName : "commonCode", _commonDescColName : "commonCodeDesc", _commonClassColName : "commonClassCode", getHostName : function() { if(Eco.isEmpty(this._service)) { this._service = application.services["host"]; } return this._service.url; }, /** * Common Code에서 해당 Class의 Code Data를 복사한다. * @param {object} Dataset Object * @param {object} Dataset Object * @param {String} Common Class Code * @param {object} Combo Object * @param {String} First Row Type(A:ALL, S:SELECT, E:EMPTY) * @return N/A * @example * $(LGE.Biz.copyCommonCode(this.dsCmnCd, this.dsCN10, "CN10", this.cmbCN10, "A")); * @memberOf LGE.Biz */ copyCommonCode : function(dsSrc, dsTgt, sClsCd, objCombo, sFisrtRowTp) { var oDsSrc = Eco.isString(dsSrc) ? LGE.Util.getDataset(dsSrc) : dsSrc; var oDsTgt = Eco.isString(dsTgt) ? LGE.Util.getDataset(dsTgt) : dsTgt; LGE.Util.dsFilter(oDsSrc, oDsTgt, this._commonClassColName+"=='"+sClsCd+"'"); objCombo.set_codecolumn(this._commonCodeColName); objCombo.set_datacolumn(this._commonDescColName); objCombo.set_innerdataset(oDsTgt.name); this.setFirstRowCombo(objCombo, sFisrtRowTp); }, /** * Common Code에서 해당 Class의 Code Data를 복사한다. * @param {object} Dataset Object * @param {object} Dataset Object * @param {String} Common Class Code * @param {String} First Row Type(A:ALL, S:SELECT, E:EMPTY) * @return N/A * @example * $(LGE.Biz.copyCommonCode(this.dsCmnCd, this.dsCN10, "CN10", this.cmbCN10, "A")); * @memberOf LGE.Biz */ copyCommonCodeDs : function(dsSrc, dsTgt, sClsCd, sFisrtRowTp) { var oDsSrc = Eco.isString(dsSrc) ? LGE.Util.getDataset(dsSrc) : dsSrc; var oDsTgt = Eco.isString(dsTgt) ? LGE.Util.getDataset(dsTgt) : dsTgt; LGE.Util.dsFilter(oDsSrc, oDsTgt, this._commonClassColName+"=='"+sClsCd+"'"); this.setFirstRowCombo(dsTgt, sFisrtRowTp); }, /** * Combo의 First Row를 설정한다. * @param {object} Combo Object / Dataset Object * @param {String} First Row Type(A:ALL, S:SELECT, E:Empty) * @return N/A * @example * $(LGE.Biz.setFirstRowCombo(this.cmbCN10, "A")); * @memberOf LGE.Biz */ setFirstRowCombo : function(obj, sFisrtRowTp, sDescColName) { var sName = ""; if(Eco.isEmpty(sFisrtRowTp)) { return; //sFisrtRowTp = ""; } if(Eco.isEmpty(sDescColName)) { sDescColName = this._commonDescColName; } switch(sFisrtRowTp){ case "A": sName = "ALL"; break; case "S": sName = "SELECT"; break; case "E": sName = ""; break; } if(obj == "[object Combo]") { objDs = LGE.Util.getDataset(obj.innerdataset); if(objDs.insertRow(0) > -1) { var nColCnt = objDs.getColCount(); var oColInfo = null; for(var i=0; i -1) { var nColCnt = obj.getColCount(); var oColInfo = null; for(var i=0; i", "/n"); //var sContent = String(LGE.Util.getLookupData(application.gds_message, "MESSAGE_CODE", sCode, "MESSAGE_CONTENT")); //2016.12.06 : gds_message 구조가 변경되어 다음 스크립트로 변경 var arrMsgCd = sCode.split(","); var sContent = ""; if (arrMsgCd.length == 1) { sContent = String(LGE.Util.getLookupData(application.gds_message, "MSG_GRP", "UIMSG", "MSG", "MSG_CD", sCode)); } else { sContent = String(LGE.Util.getLookupData(application.gds_message, "MSG_GRP", arrMsgCd[0], "MSG", "MSG_CD", arrMsgCd[1])); } sContent = nexacro.replaceAll(sContent, "\\n", "/n"); sContent = nexacro.replaceAll(sContent, "\n", "/n"); sContent = nexacro.replaceAll(sContent, "
", "/n"); //if(Eco.isEmpty(sContent)) { // sContent = String(LGE.Util.getLookupData(application.gds_TransDefault, "translationCode", sCode, "translationContent")); //} if(Eco.isEmpty(sContent)) { sCode = nexacro.replaceAll(sCode, "/n", String.fromCharCode(10)+String.fromCharCode(13)); return sCode; } //대체된 개행문자를 원래 문자로 환원 sContent = nexacro.replaceAll(sContent, "/n", String.fromCharCode(10)+String.fromCharCode(13)); if(!Eco.isEmpty(sArg)) { //2016.12.09 : LG전자 NewBEST에서 {순번} 형식으로 되어 있어 스크립트를 수정함 var reqExp = /\{[0-9]\}/; //MSG에서 치환할 항목을 정규식으로 처리 var aArg = String(sArg).split(","); for(var i=0; i -1) { return true; } else { return false; } }, /** * Option에서 하나의 Attribute 값을 리턴. * @param {String} Attribute Type Code * @param {String} 리턴할 Attribute 컬럼명(null이면 "attribute1") * @return {String} Attribute의 값 * @example * $(LGE.Biz.getAttribute("sdpTargetDomainUrlInfo", "attribute1")); * @memberOf LGE.Biz */ getAttribute : function(sTypeCd, sAttrCol) { if(Eco.isEmpty(sTypeCd)) { return ""; } if(Eco.isEmpty(sAttrCol)) { sAttrCol = "attribute1"; } var sRtn = LGE.Util.getLookupData(application.gds_Option, "attributeTypeCode", sTypeCd, sAttrCol); return sRtn; }, /** * Option을 Object 형태로 리턴. * @param {String} Attribute Type Code * @return {Object} Option을 Object * @example * $(LGE.Biz.getOption("sdpTargetDomainUrlInfo")); * @memberOf LGE.Biz */ getOption : function(sTypeCd) { if(Eco.isEmpty(sTypeCd)) { return ""; } var iFindRow = application.gds_Option.findRow("attributeTypeCode", sTypeCd); var oRtn = null; if(iFindRow > -1) { oRtn = { attributeTypeCode : application.gds_Option.getColumn(iFindRow, "attributeTypeCode"), attribute1 : application.gds_Option.getColumn(iFindRow, "attribute1"), reference1Text : application.gds_Option.getColumn(iFindRow, "reference1Text"), attribute2 : application.gds_Option.getColumn(iFindRow, "attribute2"), reference2Text : application.gds_Option.getColumn(iFindRow, "reference2Text"), attribute3 : application.gds_Option.getColumn(iFindRow, "attribute3"), reference3Text : application.gds_Option.getColumn(iFindRow, "reference3Text"), attribute4 : application.gds_Option.getColumn(iFindRow, "attribute4"), reference4Text : application.gds_Option.getColumn(iFindRow, "reference4Text"), attribute5 : application.gds_Option.getColumn(iFindRow, "attribute5"), reference5Text : application.gds_Option.getColumn(iFindRow, "reference5Text") }; } return oRtn; }, /** * Dataset의 정보로 Grid Format를 생성. * @param {Object} Dataset Object * @param {String} Head에 표시할 Data가 들어있는 Column 명 * @param {String} Bind Dataset의 Column 명 * @param {String} Grid Format Id(Default: "default") * @param {Boolean} Check Box를 사용할 지 여부 * @param {Boolean} Row Number를 보여줄 지 여부 * @return {String} Grid Format * @example * $(LGE.Biz.makeGridFormat(this.dsTest, "headColumn", "bindColumn", "default", true, true)); * @memberOf LGE.Biz */ makeGridFormat : function (dsSrc, sHeadColNm, sBindColNm, sFormatId, bShowChk, bShowNo) { if(dsSrc == null || dsSrc.rowcount == 0) { return ""; } if(Eco.isEmpty(sHeadColNm)) { sHeadColNm = "displayName"; } if(Eco.isEmpty(sBindColNm)) { sBindColNm = "columnName"; } if(Eco.isEmpty(sFormatId)) { sFormatId = "default"; } if(Eco.isEmpty(bShowChk)) { bShowChk = true; } if(Eco.isEmpty(bShowNo)) { bShowNo = true; } var sFormats = ""; var sColumns = ""; var sRows = ""; var sBandHead = ""; var sBandBody = ""; var nCol = 0; sRows += '\n'; sRows += '\n'; if(bShowChk) { sColumns += '\n'; sBandHead += '\n'; sBandBody += '\n'; nCol++; } if(bShowNo) { sColumns += '\n'; sBandHead += '\n'; sBandBody += '\n'; nCol++; } for(var iRow=0; iRow\n'; sBandBody += '\n'; nCol++; } sFormats += '\n'; sFormats += '\n'; sFormats += '\n'; sFormats += sColumns; sFormats += '\n'; sFormats += '\n'; sFormats += sRows; sFormats += '\n'; sFormats += '\n'; sFormats += sBandHead; sFormats += '\n'; sFormats += '\n'; sFormats += sBandBody; sFormats += '\n'; sFormats += '\n'; sFormats += '\n'; return sFormats; }, /** * Source Dataset의 정보로 Target Dataset 구조 생성 * @param {Object} Dataset Object * @param {Object} Dataset Object * @param {String} Dataset의 Column 명 * @param {String} Column Length의 Column 명 * @param {Boolean} Check Box Column 생성 여부 * @return N/A * @example * $(LGE.Biz.makeDataset(this.dsSrc, this.dsTgt, "bindColumn", "lengthColumn", true)); * @memberOf LGE.Biz */ makeDataset : function (dsSrc, dsTgt, sColNm, sLengthColNm, bShowChk) { if(dsSrc == null || dsSrc.rowcount == 0) { return ""; } if(Eco.isEmpty(sColNm)) { sColNm = "columnName"; } if(Eco.isEmpty(sLengthColNm)) { sLengthColNm = "columnLength"; } if(Eco.isEmpty(bShowChk)) { bShowChk = true; } dsTgt.clear(); if(bShowChk) { dsTgt.addColumn("chk", "string", 1); } for(var i=0; i 0) { sMask += "."; for(var i=0; i 0) { return true; } else { return false; } }, /** * 그리드에 속한 컬럼의 속성 값 변경하기 위한 함수 * @param {Object} grid * @param {String} 변경할 컬럼명 * @param {String} 변경할 속성명 * @param {String} 변경할 속성값 * @return N/A * @example * LGE.Biz.setGridAttr(this.divWork.tabMain.tabBasicSetup.grLanguage, "languageCode", "edittype", "combo"); * LGE.Biz.setGridAttr(this.divWork.tabMain.tabBasicSetup.grLanguage, "languageCode", "displaytype", "combo"); * @memberOf LGE.Biz */ setGridAttr : function(oGrid, colName, attrName, attrValue){ var nCellCnt = oGrid.getCellCount("body"); for(var inx=0; inx