/** f * @fileoverview 프로젝트 utility 공통함수 */ if (!JsNamespace.exist("LGE.Util")) { /** * @namespace * @name LGE.Util * @author * @memberof! */ JsNamespace.declare("LGE.Util", { /** * this formFile object 선언 변수 * @private * @type string * @memberOf LGE.Util */ ffobj : undefined, /** * _msgFormSize * @private * @memberOf private */ _msgFormSize : { width : "400", height : "210", middle :{ width : "400", height : "280" }, max :{ width : "600", height : "280" } }, /** * 객체 초기 onload 생성 * @param {obj} Form obj * @type * @example * @memberOf LGE.Util */ init : function(formObj) { this.ffobj = formObj; }, /** * Message Popup(Alert, Confirm, Error) 공통 폼 사이즈 설정. * @param {string} Size Type(max, min, middle) * @type * @example * @memberOf LGE.Util */ setOpenMsg : function(sSizeType) { var strWidth, strHeight; if (Eco.isEmpty(sSizeType)) { sSizeType = "min"; } switch(sSizeType) { case "max": strWidth = this._msgFormSize.max.width; strHeight = this._msgFormSize.max.height; break; case "middle": strWidth = this._msgFormSize.middle.width; strHeight = this._msgFormSize.middle.height; break; default: strWidth = LGE.Util._msgFormSize.width; strHeight = LGE.Util._msgFormSize.height; break; } return {width: strWidth, height: strHeight}; }, /** * 부모에 존재하는 함수명 검색하여 호출 * @param {string} function명 * @return {string} 공백으로 치환값 * @example * LGE.Util.searchParentFunc("fn_func").call(this, arg1...); * @memberOf LGE.Util */ searchParentFunc : function(fnName) { if(Eco.isEmpty(fnName)) { return; } var idx = 1, i = 0; var parentStr = ""; var pThis = "this.ffobj."; var isFind = false; while(idx < 5) { if(Eco.isFunction(eval(pThis + parentStr + fnName)) == true) { isFind= true; break; } else { parentStr = "parent." + parentStr; idx++; } } if(isFind) { isFind = eval(pThis + parentStr + fnName); } else { isFind = null; } return isFind; }, /** * 호스트 정보 리턴 * @param * @return {string} host정보 * @example * var isHost = Ex.isGetHost() //output : LOCAL OR DEV OR OP * @memberOf LGE.Util */ isGetHost : function() { if(Eco.isEmpty(application.gv_op)) { return "LOCAL"; } if(application.gv_op.indexOf("LOCAL") != -1) { return "LOCAL"; } else if(application.gv_op.indexOf("DEV") != -1) { return "DEV"; } else if(application.gv_op.indexOf("QA") != -1) { return "QA"; } else { return "OP"; } }, /** * 메인 폼인지 팝업인지 구분 * @param {object} Form Object * @return Popup 여부(P 팝업 M 메인) * @example * var isHost = LGE.Util.isForm() //output : p 팝업 M 메인 * @memberOf LGE.Util */ isForm : function(obj) { if(Eco.isEmpty(obj)) { obj = this.ffobj; } if(Eco.isEmpty(obj.opener)) { return "M"; } else { return "P"; } }, /** * 디버그 메세지 출력 * @param {string} 메세지 * @return debug message * @example * LGE.Util.isDebug("Debug Mode On"); * @memberOf LGE.Util */ isDebug : function(sMsg) { if(application.gv_debug == "Y") { //Ex.Logger.debug({message: "debug message !!!" + sMsg, elapsed: true, stack:true}); } }, /** * 해당 데이터셋명으로 검색하여 데이터셋이 없으면 데이터셋을 생성 * @param {string} 데이터셋명 * @return {string} dataset * @example * @memberOf LGE.Util */ isCheckDs : function(sDsNm, oForm) { if(Eco.isEmpty(oForm)) { oForm = this.ffobj; } var oDs = Eco.XComp.lookup(oForm, sDsNm); if (Eco.isEmpty(oDs)) { oDs = new Dataset; oDs.name = sDsNm; oForm.addChild(sDsNm, oDs); } else { oDs.clearData(); } return oDs; }, /** * 해당 데이터셋명으로 검색하여 데이터셋 찾아서 리턴. * @param {string} 데이터셋명 * @return {string} dataset(없으면 -1을 반환) * @example * @memberOf LGE.Util */ getDataset : function(sDsNm) { return Eco.XComp.query(this.ffobj, "typeOf == 'Dataset' && prop[name] == '"+sDsNm+"'")[0]; }, /** * = 을 배열로 분리 처리 * @param {string} objString (inds=inds) * @param {number} 0 : 배열 첫번째값 1: 배열 두번째값 * @return {string} return 된 배열값 * @example * @memberOf LGE.Util */ splitDsName : function(objString, type) { var objReturn = new Array(); if(Eco.isEmpty(objString)) { return objReturn; } var strDsMapping = objString.split(" "); //mapping string var objArr; //dataset name array for (var i=0; i 0) { return true; } if(objDs.findRowExpr("(this.getRowType(rowidx)==Dataset.ROWTYPE_UPDATE)||(this.getRowType(rowidx)==Dataset.ROWTYPE_INSERT)") > -1) { return true; } return false; }, /** * dataSet의 Row가 변경되었는지 여부를 리턴 * @param {object} objDs(DataSet) * @param {number} 체크할 Row index * @return {boolen} true = 변경 된 데이터가 존재 , false = 변경 된 데이터가 없음 * @example * @memberOf LGE.Util */ isUpdatedRow : function (objDs, nRow) { if (objDs.updatecontrol == true) { if (objDs.getRowType(nRow) == 2 || objDs.getRowType(nRow) == 4) { return true; } return false; } else { for (var i = 0; objDs.getColCount(); i++) { if (this.gfn_IsUpdateColumn(objDs, nRow, i) == true) { return true; } } } return false; }, /** * dataSet의 Row 에서 해당 칼럼이 변경되었는지 여부를 리턴. * @param {object} objDs(DataSet) * @param {number} 체크할 Row index * @param {string} 체크할 컬럼값 * @return {boolen} true = 변경 된 데이터가 존재 , false = 변경 된 데이터가 없음 * @example * @memberOf LGE.Util */ isUpdateColumn : function (objDs, nRow, Column) { if (objDs.getRowType(nRow) == 2) { if (Eco.isEmpty(objDs.getColumn(nRow, Column))) { return false; } } else { if (objDs.getColumn(nRow, Column) == objDs.getOrgColumn(nRow, Column)) { return false; } } return true; }, /** * Dataset의 모든 행을(혹은 변경된 행만) 함수의 인자로 넘겨주고 함수 호출 * @param {object} objDs(DataSet) * @param {string} 호출할 함수 * Function(oDs, nRowIdx)으로 선언해야 함. * false를 리턴하면 반복문 skip. * @param {boolen} 변경된 데이터만 호출할지 여부 * @return {string} Skip 해당 RowNum or 반복한 총 횟수 * @example * @memberOf LGE.Util */ allRowDataCall : function (dsObj, callFncObj, bModifiedOnly) { var retVal; for (var i=0,j=0; i= 0) { // android return "ANDROID"; } else if ( osVersion.indexOf("IOS") >= 0 ) { return "IOS"; } else if ( osVersion.indexOf("WINDOWS") >= 0 ) { return "WINDOWS"; } else { return "ETC"; } } }); }