123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443 |
- function addComboItem( comboID, label, value, position ) {
- var comboObj = document.allElement.item(comboID);
-
- var comboItemNodeSet = comboObj.choices.itemset.attribute["nodeset"];
- var comboLabelRef = comboObj.choices.itemset.label.attribute["ref"];
- var comboValueRef = comboObj.choices.itemset.value.attribute["ref"];
- var nodeNn = instance1.selectSingleNode(comboItemNodeSet);
- if (nodeNn == null) {
- model.makeNode(comboItemNodeSet);
- model.makeNode(comboItemNodeSet+"/"+comboLabelRef);
- model.makeNode(comboItemNodeSet+"/"+comboValueRef);
- position = "init";
- }
-
- var itemNode = instance1.createNode("element", instance1.selectSingleNode(comboItemNodeSet).nodeName, "");
- var labelNode = instance1.createNode("element", comboLabelRef, "");
- var valueNode = instance1.createNode("element", comboValueRef, "");
- if( label == null || label == "" ) label = "- �� ü -";
- labelNode.setValue(label);
- itemNode.appendChild(labelNode);
- if( value == null || value == "" ) value = "";
- valueNode.setValue(value);
- itemNode.appendChild(valueNode);
- if( position == null || position == "" )
- position = "above";
- var destNode = instance1.selectSingleNode(comboItemNodeSet);
- var pDestNode = destNode.parentNode;
- if( position == "above" ) {
- pDestNode.insertBefore(itemNode, destNode);
- } else if ( position == "init" ) {
- pDestNode.insertBefore(itemNode, destNode);
- pDestNode.removeChild(destNode);
- }
- else {
- pDestNode.appendChild(itemNode);
- }
- comboObj.refresh();
- }
- function addComboItemAll( comboIDs, label ) {
- var comboIDArray = comboIDs.split("|");
- if(label == null || label == "" )
- label = "- �� ü -";
- for( var i = 0; i < comboIDArray.length; i++ )
- addComboItem( comboIDArray[i], label, "");
- }
- function fileDownload( filePath, encode ) {
- if( encode == null )
- encode = true;
- if( encode )
- filePath = encodeURI(filePath);
- if(!body.isChild("_tmp_browserObj_forDown")) {
- document.body.createChild("xforms:browser", "id:_tmp_browserObj_forDown; visibility:hidden");
- }
- _tmp_browserObj_forDown.navigate(filePath);
- }
- function checkFileSize( uploadObj ) {
- var fileCnt = uploadObj.getFileCount();
- var lastIndex = fileCnt - 1;
- var fileSize = uploadObj.getFileSize(lastIndex);
- var maxSize = uploadObj.attribute["filesize"];
-
- if ( fileSize <= maxSize )
- return true;
- else
- return false;
- }
- function checkFormUpdate() {
- return gvFormUpdateYN;
- }
- function checkKeyColumn( gridID ) {
- var rowsArray = getUpdateRows( gridID, "insert" );
- var colsArray = getKeyCols( gridID, "_key" );
- var gridObj = document.controls.item(gridID);
- var i, j;
- for( i = 0; i < rowsArray.length; i++ ) {
- for( j = 0; j < colsArray.length; j++ ) {
-
- if( gridObj.valueMatrix(rowsArray[i], colsArray[j]) == "" ) {
- messageBox(gridObj.valueMatrix(gridObj.fixedRows - 1, colsArray[j]) + "��(��)", "I003");
- gridObj.setRow(rowsArray[i]);
- gridObj.setCol(colsArray[j]);
- gridObj.editCell();
- return false;
- }
- }
- }
- return true;
- }
- function checkRequiredColumn( gridID ) {
- var rowsArray = getUpdateRows( gridID, "insert" );
- rowsArray = getUpdateRows( gridID, "update", rowsArray );
- var colsArray = getKeyCols( gridID, "_required" );
- var gridObj = document.controls.item(gridID);
- var i, j;
- for( i = 0; i < rowsArray.length; i++ ) {
- for( j = 0; j < colsArray.length; j++ ) {
-
- if( gridObj.valueMatrix(rowsArray[i], colsArray[j]) == "" ) {
- messageBox(gridObj.valueMatrix(gridObj.fixedRows - 1, colsArray[j]) + "��(��)", "I003");
- gridObj.setRow(rowsArray[i]);
- gridObj.setCol(colsArray[j]);
- gridObj.editCell();
- return false;
- }
- }
- }
- return true;
- }
- function getUpdateRows( gridID, status, rowsArray ) {
- var gridObj = document.controls.item(gridID);
- var sCol = gridObj.attribute["colsep"];
- var sRow = gridObj.attribute["rowsep"];
- var gridStatus = gridObj.getUpdateData(status);
- var rowStatusArray = gridStatus.split(sRow);
- var rowStatusCnt = rowStatusArray.length;
- var rowsArrayLen = 0;
- if( rowsArray == null ) {
- rowsArray = new Array();
- }
- else {
- rowsArrayLen = rowsArray.length;
- }
- for( var i = 0; i < rowStatusCnt - 2; i++ ) {
- rowsArray[i + rowsArrayLen] = rowStatusArray[i + 1].split(sCol)[1];
- }
- return rowsArray;
- }
- function getKeyCols( gridID, atttibutezName ) {
- var gridObj = document.controls.item(gridID);
- var gridCols = gridObj.cols;
- var rColsArray = new Array();
- var i, j = 0;
- for( i = 0; i < gridCols; i++) {
- if( gridObj.colAttribute(i, atttibutezName) == "true" ) {
- rColsArray[j++] = i;
- }
- }
- return rColsArray;
- }
- function copyNodeListType(strDest, strSrc, mode, destModel, srcModel) {
- if( typeof(destModel) == "object" || typeof(destModel) == "undefined" ) {
- if( destModel == null ) {
- destModel = model;
- }
- }
- else {
- if( destModel == "" ) {
- destModel = model;
- }
- }
- var destNode = destModel.instance1.selectSingleNode(strDest);
- if( destNode == null )
- return;
- var destChildNodeList = destNode.childNodes;
- if( typeof(srcModel) == "object" || typeof(srcModel) == "undefined" ) {
- if( srcModel == null ) {
- srcModel = model;
- }
- }
- else {
- if( srcModel == "" ) {
- srcModel = model;
- }
- }
- var srcNodeList = srcModel.instance1.selectNodes(strSrc);
- var srcNode;
- if( srcNodeList.length == 0 )
- return;
-
- if( mode != "before" ) {
- if( mode == "replace" || mode == null ) {
- removeChildren(strDest, destModel)
- }
- while( srcNode = srcNodeList.nextNode() ) {
-
- model.duplicate(destNode, srcNode);
- }
- }
-
- else {
-
- for( var i = srcNodeList.length - 1; i >= 0; i-- ) {
- destNode = destModel.instance1.selectSingleNode(strDest);
- srcNode = srcNodeList.item(i);
- model.duplicate(destNode, srcNode, "*[1]");
- }
- }
- }
- function copyNodesetType(strDest, strSrc, mode, destModel, srcModel) {
- if( typeof(destModel) == "object" || typeof(destModel) == "undefined" ) {
- if( destModel == null ) {
- destModel = model;
- }
- }
- else {
- if( destModel == "" ) {
- destModel = model;
- }
- }
- if( typeof(srcModel) == "object" || typeof(srcModel) == "undefined" ) {
- if( srcModel == null ) {
- srcModel = model;
- }
- }
- else {
- if( srcModel == "" ) {
- srcModel = model;
- }
- }
- var destNodeList = destModel.instance1.selectNodes(strDest);
- if( destNodeList == null || destNodeList.length == 0 ) {
- return;
- }
- var pDestNode = destNodeList(0).parentNode;
- var destLastNodesetName = destNodeList(0).nodeName;
- var srcNodeList = srcModel.instance1.selectNodes(strSrc);
- if( srcNodeList == null || srcNodeList.length == 0 )
- return;
- if( mode != "before" ) {
- if( mode == "replace" || mode == null ) {
- destModel.removeNodeset(strDest);
- }
- var srcNode;
- var tmpSrcNode;
- while( srcNode = srcNodeList.nextNode() ) {
- tmpSrcNode = srcNode.cloneNode(true);
- tmpSrcNode.nodeName = destLastNodesetName;
-
- model.duplicate(pDestNode, tmpSrcNode);
- }
- }
- else {
-
- var tmpSrcNode;
- for( var i = srcNodeList.length - 1; i >= 0; i-- ) {
- pDestNode = destModel.instance1.selectSingleNode(strDest).parentNode;
- tmpSrcNode = srcNodeList.item(i).cloneNode(true);
- tmpSrcNode.nodeName = destLastNodesetName;
- model.duplicate(pDestNode, tmpSrcNode, "*[1]");
- }
- }
- }
- function copyNodeType(strDest, strSrc, mode, destModel, srcModel) {
- if( typeof(destModel) == "object" || typeof(destModel) == "undefined" ) {
- if( destModel == null ) {
- destModel = model;
- }
- }
- else {
- if( destModel == "" ) {
- destModel = model;
- }
- }
- var destNode = destModel.instance1.selectSingleNode(strDest);
- if( destNode == null )
- return;
- var destChildNodeList = destNode.childNodes;
- if( typeof(srcModel) == "object" || typeof(srcModel) == "undefined" ) {
- if( srcModel == null ) {
- srcModel = model;
- }
- }
- else {
- if( srcModel == "" ) {
- srcModel = model;
- }
- }
- var srcNode = srcModel.instance1.selectSingleNode(strSrc);
- if( srcNode == null )
- return;
- var cSrcNode = srcNode.cloneNode(true);
- var cSrcChildNodeList = cSrcNode.childNodes;
- var cSrcChildNode;
- if( cSrcChildNodeList.length == 0 )
- return;
-
- if( mode != "before" ) {
- if( mode == "replace" || mode == null ) {
- removeChildren(strDest, destModel)
- }
- while( cSrcChildNode = cSrcChildNodeList.nextNode() ) {
-
- model.duplicate(destNode, cSrcChildNode);
- }
- }
-
- else {
-
- for( var i = cSrcChildNodeList.length - 1; i >= 0; i-- ) {
- destNode = destModel.instance1.selectSingleNode(strDest);
- cSrcChildNode = cSrcChildNodeList.item(i);
- model.duplicate(destNode, cSrcChildNode, "*[1]");
- }
- }
- }
- function copyNodeWithPostfix(strDest, strSrc, postfix, destModel, srcModel) {
- removeChildren(strDest, destModel);
- var modelObj;
- if( srcModel == null ) {
- modelObj = model;
- }
- else
- modelObj = srcModel;
- var srcNode = modelObj.instance1.selectSingleNode(strSrc);
- var cSrcNode = srcNode.cloneNode(true);
- var cSrcChildNodeList = cSrcNode.childNodes;
- var cSrcChildNode;
- var destNode;
- if( destModel == null )
- destNode = instance1.selectSingleNode(strDest);
- else
- destNode = destModel.instance1.selectSingleNode(strDest);
- while( cSrcChildNode = cSrcChildNodeList.nextNode() ) {
- cSrcChildNode.nodeName = cSrcChildNode.nodeName + postfix;
-
- model.duplicate(destNode, cSrcChildNode);
- }
- }
- function setCSVToNode(destRef, CSV, nodeSetName) {
- var sColSep = "��";
- var sRowSep = "��";
-
- var nodeNameArray = CSV.split(sRowSep)[0].split(sColSep);
-
- var nodeNameArrayCnt = nodeNameArray.length;
-
- if( nodeSetName == null || nodeSetName == "")
- nodeSetName = "list";
-
- var tmpDestNode = instance1.createElement(nodeSetName);
- var tmpDestChildNode;
- var i, j;
- for( i = 0; i < nodeNameArrayCnt; i++ ) {
-
- tmpDestChildNode = instance1.createElement(nodeNameArray[i]);
-
- model.duplicate(tmpDestNode, tmpDestChildNode);
- }
-
- var CSVArray = CSV.split(sRowSep);
-
- var CSVArrayCnt = CSVArray.length - 1;
-
- var srcNode = instance1.selectSingleNode(destRef);
- var nodeValueArray;
-
- for( i = 1; i < CSVArrayCnt; i++ ) {
-
- nodeValueArray = CSVArray[i];
- for ( j = 0; j < nodeNameArrayCnt; j++ ) {
-
- tmpDestNode.childNodes.item(j).text = nodeValueArray.split(sColSep)[j];
- }
- model.duplicate(srcNode, tmpDestNode);
- }
- }
- function deleteSelectedRows(grd,markonly) {
- var rowIdx;
- if (grd.selectedRows > 0) {
- var selectedRows = Array(grd.selectedRows);
- for(i=0;i<grd.selectedRows;i++) {
- selectedRows[i] = grd.selectedRow(i);
- }
- if (markonly != null && markonly == true) {
- for(i=selectedRows.length-1;i>=0;i--) {
- rowIdx = selectedRows[i];
- if(grd.rowstatus(rowIdx) == 1 ) {
- grd.deleterow(rowIdx,false);
- } else {
- grd.addStatus(rowIdx,"delete");
- }
- }
- } else {
- for(i=selectedRows.length-1;i>=0;i--) {
- rowIdx = selectedRows[i];
- grd.deleterow(rowIdx,false);
- }
- }
- }
- }
- function getGridUpdateData(gridObj, statusType) {
- var updataData = gridObj.getUpdateData(statusType);
- var rowsep = gridObj.attribute["rowsep"];
- var split = updataData.split(rowsep);
- if(split.length > 2){
- return updataData;
- }
- else
- return "";
- }
- function getImageSize(fileName) {
- var newCtrObj = null;
- if(document.controls.item("_image_forSize") == null) {
- newCtrObj = body.createChild("xforms:img", "id:_image_forSize; src:" + fileName + "; left:0px; top:0px; width:1px; height:1px;");
- newCtrObj.setVisible(false);
- }
- else{
-
- newCtrObj = document.controls.item("_image_forSize");
- newCtrObj.setSrc(fileName);
- }
- newCtrObj.setAttribute("width", null);
- newCtrObj.setAttribute("height", null);
- newCtrObj.setVisible(false);
- var imgW = newCtrObj.attribute["width"].replace("px", "");
- var imgH = newCtrObj.attribute["height"].replace("px", "");
- body.removeChild("_image_forSize");
- return imgW + "^" + imgH;
- }
- function getNodeListCSV(nodeList) {
- if( nodeList.length == 0 )
- return;
- var sColSep = "��";
- var sRowSep = "��";
- var rCSV = "";
- var childNodeList = nodeList.item(0).childNodes;
- var childNodeCnt = childNodeList.length;
- if( childNodeCnt == 0 )
- return;
- var i, j;
- for( i = 0; i < childNodeCnt - 1; i++) {
- rCSV += childNodeList.item(i).nodeName + sColSep;
- }
- rCSV += childNodeList.item(i).nodeName + sRowSep;
- var node;
- while( node = nodeList.nextNode() ) {
- childNodeList = node.childNodes;
- for( i = 0; i < childNodeCnt - 1; i++) {
- rCSV += childNodeList.item(i).text + sColSep;
- }
- rCSV += childNodeList.item(i).text + sRowSep;
- }
- return rCSV;
- }
- function getNodesetCount( nodeSet ) {
- var xPathFunction = "count(" + nodeSet + ")";
- return model.getXPathValue(xPathFunction);
- }
- function isDataCell() {
- var gridObj = m_event.ptarget.parent;
- if( gridObj.isCell(m_event.target) && gridObj.row >= gridObj.fixedRows && gridObj.col >= gridObj.fixedCols) {
- return true;
- }
- else
- return false;
- }
- function isRequiredControls() {
- var controlCnt = isRequiredControls.arguments.length;
- var controlID, captionID;
- var controlObj, captionObj;
- for(var i=0; i<controlCnt ;i++) {
- controlID = isRequiredControls.arguments[i];
- controlObj = document.controls.item(controlID);
- if(controlObj != null) {
- if(controlObj.value == "") {
- captionID = controlID.replace(controlID.substr(0, 3), "cap");
- captionObj = document.controls.item(captionID);
- if(captionObj != null) {
- var captionLabel = captionObj.label;
- if(captionLabel.indexOf(":") == captionLabel.length - 1) {
- captionLabel = captionLabel.substr(0, captionLabel.length - 1);
- }
- messageBox(captionLabel, "I003");
- }
- else
- messageBox("", "I003");
- model.setFocus(controlID);
- return false;
- }
- }
- }
- return true;
- }
- function isRequiredGroup(groupID){
- var groupObj = document.controls.item(groupID);
- var childID, captionID;
- var childObj, captionObj;
- for(var i=0; i<groupObj.children.length; i++) {
- childObj = groupObj.children.item(i)
- if(childObj.elementName == "xforms:input" || childObj.elementName == "xforms:secret" || childObj.elementName == "xforms:textarea" || childObj.elementName == "xforms:select" || childObj.elementName == "xforms:select1") {
- if(childObj.attribute["_required"] == "true") {
- if(childObj.value == "") {
- childID = childObj.attribute["id"];
- captionID = childID.replace(childID.substr(0, 3), "cap");
- captionObj = document.controls.item(captionID);
- if(captionObj != null) {
- var captionLabel = captionObj.label;
- if(captionLabel.indexOf(":") == captionLabel.length - 1) {
- captionLabel = captionLabel.substr(0, captionLabel.length - 1);
- }
- messageBox(captionLabel, "I003");
- }
- else
- messageBox("", "I003");
- model.setFocus(childID);
- return false;
- }
- }
- }
- }
- return true;
- }
- function isXPathTextNull(xPath) {
- var node = instance1.selectSingleNode(xPath);
- if( node != null ) {
- if( node.text == "" ) {
- return true;
- }
- else
- return false;
- }
- else
- return false;
- }
- function inputEnterKey( controlID, dispatchEvent, mask ) {
- if(m_event.keyCode == "13") {
-
- setInputNodeCurText(mask);
- var controlObj = document.controls.item(controlID);
- controlObj.dispatch(dispatchEvent);
- }
- }
- function openImageFileDialog(maxBytes) {
- var file = window.fileDialog("open","","false","","","All Files (*.*)|*.*|JPEG Files(*.jpg)|*.jpg|GIF Files(*.gif)|*.gif|BMP Files(*.bmp)|*.bmp");
- if (file != "" && maxBytes != null) {
- var fso = new ActiveXObject("Scripting.FileSystemObject");
- var f = fso.GetFile(file);
- if (f.size > maxBytes) {
- messageBox("���� ũ�Ⱑ �ִ�ġ("+(maxBytes/1024)+"K)��","E003");
- return "";
- }
- }
- return file;
- }
- function removeChildren( destNodePath, destModel ) {
- var modelObj;
- if( destModel == null ) {
- modelObj = model;
- }
- else
- modelObj = destModel;
- var node = modelObj.instance1.selectSingleNode(destNodePath);
- var childNodeList = node.childNodes;
- var childNode;
- while( childNode = childNodeList.nextNode() ) {
- node.removeChild( childNode );
- }
- }
- String.prototype.removeMask = removeMask;
- function removeMask( mask ) {
- var tmp_this = this;
- while( tmp_this.indexOf(mask) > -1 ) {
- tmp_this = tmp_this.replace(mask, "");
- }
- return tmp_this;
- }
- function setFormUpdate() {
- gvFormUpdateYN = true;
- }
- function setImageRefInstance(xpath) {
- var node = instance1.selectSingleNode(xpath);
- if( node == null )
- return;
- node.setattribute("type","xsd:base64Binary");
- }
- function setInputNodeCurText( mask ) {
- var inputID = m_event.target;
- var inputObj = document.controls.item(inputID);
- var inputRef = inputObj.attribute["ref"];
- if( mask == null )
- model.setValue(inputRef, inputObj.m_heControl.value);
- else
- model.setValue(inputRef, inputObj.m_heControl.value.removeMask(mask));
- inputObj.refresh();
- setFormUpdate();
- }
- function setCellStyle( gridID , styleFlag , data , colRef , control ) {
- var style = new Array("#fcd2c1" , "#ffe79d" , "#f3e1bf" , "#7BE6B7" , "#b9e5fb" , "#f7a08b" , "#fec34d" , "#dec6a4" , "#c8e67b" , "#43c8f5", "#99cf16", "#e5f3c2" );
- var styleFlags = styleFlag.split("^");
- var datas = data.split("^");
- if( control == null || control == "" )
- control = "equal";
- var controls = control.split("^");
- gridObj = document.allElement.item(gridID);
- gridObj.backcoloralternate = "transparent";
- for( var j = 0 ; j < datas.length ; j++ ) {
- var dataValue = datas[j];
- var styleValue = style[styleFlags[j]];
- for( var i = gridObj.fixedRows ; i < gridObj.Rows ; i++ ) {
- if(controls[j] == null)
- controls[j] = "equal";
- switch( controls[j] ) {
- case "small":
- if( gridObj.valueMatrix(i , gridObj.colRef(colRef)) < dataValue ) {
- gridObj.setCellStyle("background-color", i, gridObj.colRef(colRef), styleValue);
- }
- break;
- case "smallThen":
- if( gridObj.valueMatrix(i , gridObj.colRef(colRef)) <= dataValue ) {
- gridObj.setCellStyle("background-color", i, gridObj.colRef(colRef), styleValue);
- }
- break;
- case "bigger":
- if( gridObj.valueMatrix(i , gridObj.colRef(colRef)) > dataValue ) {
- gridObj.setCellStyle("background-color", i, gridObj.colRef(colRef), styleValue);
- }
- break;
- case "biggerThen":
- if( gridObj.valueMatrix(i , gridObj.colRef(colRef)) >= dataValue ) {
- gridObj.setCellStyle("background-color", i, gridObj.colRef(colRef), styleValue);
- }
- break;
- case "notEqual":
- if( gridObj.valueMatrix(i , gridObj.colRef(colRef)) != dataValue ) {
- gridObj.setCellStyle("background-color", i, gridObj.colRef(colRef), styleValue);
- }
- break;
- case "equal":
- if( gridObj.valueMatrix(i , gridObj.colRef(colRef)) == dataValue ) {
- gridObj.setCellStyle("background-color", i, gridObj.colRef(colRef), styleValue);
- }
- break;
- }
- }
- }
- }
- function setRowStyle( gridID , styleFlag , data , colRef , control ) {
- var style = new Array("#fcd2c1" , "#ffe79d" , "#f3e1bf" , "#7BE6B7" , "#b9e5fb" , "#f7a08b" , "#fec34d" , "#dec6a4" , "#c8e67b" , "#43c8f5", "#99cf16", "#e5f3c2" ,"#fd97b7", "#99ccff", "#ffff99", "#ccffcc");
- var styleFlags = styleFlag.split("^");
- var datas = data.split("^");
- if( control == null || control == "" )
- control = "equal";
- var controls = control.split("^");
- gridObj = document.allElement.item(gridID);
- gridObj.backcoloralternate = "transparent";
- for( var j = 0 ; j < datas.length ; j++ ) {
- var dataValue = datas[j];
- var styleValue = style[styleFlags[j]];
- for( var i = gridObj.fixedRows ; i < gridObj.Rows ; i++ ) {
- if(controls[j] == null)
- controls[j] = "equal";
- switch( controls[j] ) {
- case "small":
- if( gridObj.valueMatrix(i , gridObj.colRef(colRef)) < dataValue ) {
- gridObj.rowstyle( i , "data" , "background-color" ) = styleValue;
- }
- break;
- case "smallThen":
- if( gridObj.valueMatrix(i , gridObj.colRef(colRef)) <= dataValue ) {
- gridObj.rowstyle( i , "data" , "background-color" ) = styleValue;
- }
- break;
- case "bigger":
- if( gridObj.valueMatrix(i , gridObj.colRef(colRef)) > dataValue ) {
- gridObj.rowstyle( i , "data" , "background-color" ) = styleValue;
- }
- break;
- case "biggerThen":
- if( gridObj.valueMatrix(i , gridObj.colRef(colRef)) >= dataValue ) {
- gridObj.rowstyle( i , "data" , "background-color" ) = styleValue;
- }
- break;
- case "notEqual":
- if( gridObj.valueMatrix(i , gridObj.colRef(colRef)) != dataValue ) {
- gridObj.rowstyle( i , "data" , "background-color" ) = styleValue;
- }
- break;
- case "equal":
- if( gridObj.valueMatrix(i , gridObj.colRef(colRef)) == dataValue ) {
- gridObj.rowstyle( i , "data" , "background-color" ) = styleValue;
- }
- break;
- }
- }
- }
- }
- function initGridStyle(gridID){
- gridObj = document.allElement.item(gridID);
- gridObj.rebuildStyle();
- gridObj.backcoloralternate = "#f4f4f4";
- }
- function setTree( gridObj, levelcol, targetcol, collapsed, outlinebar ) {
-
-
-
- for(var i = gridObj.fixedRows; i < gridObj.rows; i++)
- {
-
- try {
- gridObj.outlinelevel(i)=gridObj.valuematrix(i, levelcol);
- } catch(e) {
-
- }
- }
-
- gridObj.outlinecol=targetcol;
- if (outlinebar == "" || outlinebar == null) {
- gridObj.outlinebar = 2;
- } else {
- gridObj.outlinebar=outlinebar;
- }
- gridObj.treecolor="#948777"
-
- if(collapsed != null) {
- setCollapsed(gridObj, collapsed);
- }
- }
- function setCollapsed( gridObj, collapsed ) {
- for(var i = gridObj.fixedrows; i <gridObj.rows; i++)
- {
- gridObj.iscollapsed(i)=collapsed;
- }
- }
-
-
-
-
- function sortNodeList( nodeset, trgRef, mode ) {
- var nodesetCnt = model.getXPathValue("count(" + nodeset + ")");
- if( nodesetCnt == 0 )
- return;
- var tmpValue_01, tmpValue_02;
- var tmpIndex;
- var i, j;
- for( i = 1; i <= nodesetCnt; i++ ) {
- tmpIndex = i;
- for( j = i + 1; j <= nodesetCnt; j++ ) {
- tmpValue_01 = model.getValue(nodeset + "[" + i + "]/" + trgRef);
- tmpValue_02 = model.getValue(nodeset + "[" + j + "]/" + trgRef);
- switch(mode) {
- case "desc":
- if( tmpValue_01 < tmpValue_02 ) {
- tmpIndex = j;
- }
- break;
- default :
- if( tmpValue_01 > tmpValue_02 ) {
- tmpIndex = j;
- }
- break;
- }
- if( i != tmpIndex ) {
- model.duplicate(instance1.selectSingleNode(nodeset).parentNode, nodeset + "[" + tmpIndex + "]", "*[" + i + "]");
- model.removenode(nodeset + "[" + ( tmpIndex + 1 ) + "]");
- tmpIndex = i;
- }
- }
- }
- }
- var gvFormUpdateYN = false;
- function onaftersort() {
- var gridObj = document.controls.item(m_event.target);
- var gridSelMode = gridObj.selectionMode;
- var smallistNum, tempNum;
- var i;
- if( gridSelMode != "free" && gridSelMode != "bycol" ) {
-
- gridObj.topRow = gridObj.selectedRow(0);
-
-
- }
- else {
-
- if(gridObj.selectedCells.length > 0) {
- gridObj.topRow = gridObj.selectedCells.item(0).row;
- }
-
-
-
-
-
-
-
-
- }
-
- }
- function onkeypress(){
- var ctrlObj = m_event.ptarget;
-
- var pGridObj = ctrlObj.parent;
- if(pGridObj.elementName == "xforms:multilinegrid" || pGridObj.elementName == "xforms:row")
- return;
- if(ctrlObj.elementName == "xforms:input") {
- input_onkeypress(ctrlObj);
- }
-
- else if(ctrlObj.elementName == "xforms:col") {
-
- if(pGridObj.colAttribute(pGridObj.col, "type") == "input" || pGridObj.colAttribute(pGridObj.col, "type") == "inputbutton")
- grid_onkeypress(m_event.ptarget);
- }
- else if(ctrlObj.elementName == "xforms:gridinput") {
- grid_onkeypress(m_event.ptarget);
- }
-
-
-
-
- }
- function grid_onkeypress(ctrlObj) {
- var pObj = ctrlObj.parent;
- var charType = pObj.colAttribute (pObj.col, "_chartype");
- if( charType == "upper") {
- if(m_event.keyCode >= 97 && m_event.keyCode <= 122) {
- m_event.keyCode = m_event.keyCode - 32;
- }
- }
- else if( charType == "lower" ) {
- if(m_event.keyCode >= 65 && m_event.keyCode <= 90) {
- m_event.keyCode = m_event.keyCode + 32;
- }
- }
- var inputMode = pObj.colAttribute (pObj.col, "_inputmode");
- if( inputMode == "koreanOnly" ) {
-
- var pattern = new RegExp('[a-zA-Z]', 'i');
- if (pattern.exec(String.fromCharCode(m_event.keyCode)) != null){
- m_event.preventDefault();
- }
- }
- }
- function input_onkeypress(ctrlObj) {
- if( ctrlObj.attribute["_chartype"] == "upper") {
- if(m_event.keyCode >= 97 && m_event.keyCode <= 122) {
- m_event.keyCode = m_event.keyCode - 32;
- }
- }
- else if( ctrlObj.attribute["_chartype"] == "lower" ) {
- if(m_event.keyCode >= 65 && m_event.keyCode <= 90) {
- m_event.keyCode = m_event.keyCode + 32;
- }
- }
- if( ctrlObj.attribute["_inputmode"] == "koreanOnly" ) {
-
- var pattern = new RegExp('[a-zA-Z]', 'i');
- if (pattern.exec(String.fromCharCode(m_event.keyCode)) != null){
- m_event.preventDefault();
- }
- }
- }
- function grid_oncopy(type) {
- if (type == null || type == "") type = "value";
- var trgObj = document.allElement.item(m_event.target);
- if( trgObj.elementName == "xforms:datagrid" )
- gridObj = trgObj;
- else
- return;
- var cellValue;
- var rClipBoardValue = "";
- var gridSelMode = gridObj.selectionMode;
-
-
- if( gridSelMode == "free" ) {
- if( gridObj.selectedCells.length == 0 )
- return;
- var firstCell = getFirstCell(gridObj.selectedCells);
- var lastCell = getLastCell(gridObj.selectedCells);
- var i, j;
- if (type == "value") {
- for( i = firstCell.row; i <= lastCell.row; i++ ) {
- for ( j = firstCell.col; j <= lastCell.col; j++ ) {
- cellValue = gridObj.valueMatrix(i, j);
- if( cellValue.indexOf("\n") != -1 )
- cellValue = '"' + cellValue + '"';
- rClipBoardValue += cellValue;
- if( j != lastCell.col )
- rClipBoardValue += "\t";
- }
- rClipBoardValue += "\r\n";
- }
- } else if (type == "label") {
- for( i = firstCell.row; i <= lastCell.row; i++ ) {
- for ( j = firstCell.col; j <= lastCell.col; j++ ) {
- cellValue = gridObj.labelMatrix(i, j);
- if( cellValue.indexOf("\n") != -1 )
- cellValue = '"' + cellValue + '"';
- rClipBoardValue += cellValue;
- if( j != lastCell.col )
- rClipBoardValue += "\t";
- }
- rClipBoardValue += "\r\n";
- }
- }
- var setClipBoardFlag = true;
-
- var cntRClip = 0;
- var cntRRow = rClipBoardValue.split("\r\n").length;
- var cntRCol = rClipBoardValue.split("\r\n")[0].split("\t").length;
- if( gridObj.selectedCells.length != ( cntRRow - 1 ) * cntRCol ) {
- setClipBoardFlag = false;
- }
-
- for( i = 0; i < gridObj.selectedCells.length; i++ ) {
- if( firstCell.row > gridObj.selectedCells.item(i).row || lastCell.row < gridObj.selectedCells.item(i).row ) {
- setClipBoardFlag = false;
- break;
- }
- if( firstCell.col > gridObj.selectedCells.item(i).col || lastCell.col < gridObj.selectedCells.item(i).col ) {
- setClipBoardFlag = false;
- break;
- }
- }
- if( !setClipBoardFlag ) {
- messageBox("���� ���� ����������", "E001");
- return;
- }
- }
-
- else if( gridSelMode == "bycol" ) {
- if( gridObj.selectedCells.length == 0 )
- return;
- var firstCell = getFirstCell(gridObj.selectedCells);
- var lastCell = getLastCell(gridObj.selectedCells);
- var i, j;
- if (type == "value") {
- for( i = gridObj.fixedRows; i < gridObj.rows; i++ ) {
- for ( j = firstCell.col; j <= lastCell.col; j++ ) {
- cellValue = gridObj.valueMatrix(i, j);
- if( cellValue.indexOf("\n") != -1 )
- cellValue = '"' + cellValue + '"';
- rClipBoardValue += cellValue;
- if( j != lastCell.col )
- rClipBoardValue += "\t";
- }
- rClipBoardValue += "\r\n";
- }
- } else if (type == "label") {
- for( i = gridObj.fixedRows; i < gridObj.rows; i++ ) {
- for ( j = firstCell.col; j <= lastCell.col; j++ ) {
- cellValue = gridObj.labelMatrix(i, j);
- if( cellValue.indexOf("\n") != -1 )
- cellValue = '"' + cellValue + '"';
- rClipBoardValue += cellValue;
- if( j != lastCell.col )
- rClipBoardValue += "\t";
- }
- rClipBoardValue += "\r\n";
- }
- }
- }
-
- else {
- var gridCols = gridObj.Cols;
- var selRow;
- var i, j;
- if (type == "value") {
- for( i = 0; i < gridObj.selectedRows; i++ ) {
- selRow = gridObj.selectedRow(i);
- for ( j = gridObj.fixedCols; j < gridCols; j++ ) {
- cellValue = gridObj.valueMatrix(selRow, j);
- if( cellValue.indexOf("\n") != -1 )
- cellValue = '"' + cellValue + '"';
- rClipBoardValue += cellValue;
- if( j != gridCols - 1 )
- rClipBoardValue += "\t";
- }
- rClipBoardValue += "\r\n";
- }
- } else if (type == "label") {
- for( i = 0; i < gridObj.selectedRows; i++ ) {
- selRow = gridObj.selectedRow(i);
- for ( j = gridObj.fixedCols; j < gridCols; j++ ) {
- cellValue = gridObj.labelMatrix(selRow, j);
- if( cellValue.indexOf("\n") != -1 )
- cellValue = '"' + cellValue + '"';
- rClipBoardValue += cellValue;
- if( j != gridCols - 1 )
- rClipBoardValue += "\t";
- }
- rClipBoardValue += "\r\n";
- }
- }
- }
- if( rClipBoardValue != "" )
- window.setClipBoardData(rClipBoardValue);
- }
- function getFirstCell( cellCollection ) {
- var cntCell = cellCollection.length;
- if( cntCell == 0 )
- return null;
- var curCell = null;
- var tmpCell = cellCollection.item(0);
- for( var i = 0; i < cntCell; i++ ) {
- curCell = cellCollection.item(i);
- if( curCell.row <= tmpCell.row ) {
- if( curCell.col <= tmpCell.col ) {
- tmpCell = curCell;
- }
- }
- }
- return tmpCell;
- }
- function getLastCell( cellCollection ) {
- var cntCell = cellCollection.length;
- if( cntCell == 0 )
- return null;
- var curCell = null;
- var tmpCell = cellCollection.item(0);
- for( var i = 0; i < cntCell; i++ ) {
- curCell = cellCollection.item(i);
- if( curCell.row >= tmpCell.row ) {
- if( curCell.col >= tmpCell.col ) {
- tmpCell = curCell;
- }
- }
- }
- return tmpCell;
- }
- function initPopupMenu() {
- window.setPopupMenu(false);
- }
- function setPopupMenu(ctrlID, onmenuEvent, itemNodeset, label, value) {
- if(m_event.button == 3) {
- if( itemNodeset == null )
- itemNodeset = "/root/hidden/popupmenu/item";
- if( label == null )
- itemNodeset = "name";
- if( value == null )
- value = "func";
- var ctrlObj = document.controls.item(ctrlID);
- if( ctrlObj.elementName == "xforms:datagrid" ) {
- if( ctrlObj.isCell(m_event.target) && ctrlObj.mouseRow >= ctrlObj.fixedrows ){
- window.showPopupMenu(true);
- window.setPopupMenu(true, itemNodeset, label, value, onmenuEvent);
- }else{
- initPopupMenu();
- }
- }else if( ctrlObj.elementName == "xforms:treeview" ) {
- if( ctrlObj.isCell(m_event.target) ){
- window.showPopupMenu(true);
- window.setPopupMenu(true, itemNodeset, label, value, onmenuEvent);
- }else{
- initPopupMenu();
- }
- }else {
- window.showPopupMenu(true);
- window.setPopupMenu(true, itemNodeset, label, value, onmenuEvent);
- }
- }
- }
- function onstartedit(){
- var ctrlObj = m_event.ptarget;
- if(ctrlObj.elementName == "xforms:datagrid") {
- grid_onstartedit(ctrlObj);
- }
- }
- function grid_onstartedit(ctrlObj)
- {
-
- var colIndex = ctrlObj.col;
- var _keyValue = ctrlObj.colAttribute(colIndex, "_key");
- if(_keyValue == "true")
- {
- if( ctrlObj.rowStatus( ctrlObj.row ) != 3 && ctrlObj.rowStatus( ctrlObj.row ) != 1)
- {
- m_event.preventDefault();
- return;
- }
- }
- }
- function xforms_submit_done() {
- if( document.allElement.item(m_event.currentTarget).elementName == "xforms:model" ) {
- m_event.stopPropagation();
- return;
- }
- gvFormUpdateYN = false;
- }
- function xforms_value_changed() {
- if( m_event.currentTarget == "document") {
- m_event.stopPropagation();
- return;
- }
-
- setFormUpdate();
- }
|