var condesNode = "/root/codes"; var indent = 20; var tabWidth = 780; // node set »ý¼º function makeNodeSet(parentNode, codes) { for(var i = 0; i < codes.length; i++) { var itemNode = parentNode + "/item[" + (i + 1) + "]"; model.makeValue(itemNode + "/label", codes[i].value + ") " + codes[i].label); model.makeValue(itemNode + "/value", codes[i].value); } } // end function // item set »ý¼º function makeItemset(control, nodeSetXPath) { var choices = control.createChild("xforms:choices", ""); var itemset = choices.createChild("xforms:itemset", "nodeset:" + nodeSetXPath + "/item"); itemset.createChild("xforms:label", "ref:label"); itemset.createChild("xforms:value", "ref:value "); } // node set data ÃßÃâ function retriveNodeSet(ctrlInfos) { var nodeSet = new Array(); for (var i = 0; i < ctrlInfos.length; i++) { nodeSet[i] = {"label":ctrlInfos[i].qestitemanswcnts , "value":ctrlInfos[i].answseqno}; } return nodeSet; } // ¶óµð¿À ¹öư »ý¼º function makeRadio(prnt, id, ref, parentNode, nodeSet, cols, left, top, width, height) { var attributes = ""; // alert("id = " + id +"\n ref = " + ref +"\n rows = " + cols +"\n left = " + left + "\n top = " + top +"\n width = " + width +"\n height = " + height); if(id != undefined && id != "" ) { attributes = attributes + "id:" + id + "; "; } else { alert("id´Â Çʼö ÀÔ´Ï´Ù."); return; } if(ref != undefined && ref != "" ) { attributes = attributes + "ref:" + ref + "; "; } else { alert(" ref ´Â Çʼö ÀÔ´Ï´Ù."); return; } // ndoeSet »ý¼º var nodeSetXPath = parentNode +("/radioNodeSet" + id); var length = 0; if(nodeSet != undefined && nodeSet != "" && nodeSet.length > 1 ) { makeNodeSet(nodeSetXPath, nodeSet); length = nodeSet.length; } if(left != undefined && left != "" ) { attributes = attributes + "left:" + left + "; "; } else { attributes = attributes + "left:0; "; } if(top != undefined && top != "" ) { attributes = attributes + "top:" + top + "; "; } else { attributes = attributes + "top:0; "; } // Ä÷³¼ö var tmpCols = 1; if(cols != undefined && cols != "" && cols != 0) { tmpCols = cols; } // ³ÐÀÌ var tmWidth = 300; if(width != undefined && width != "" ) { tmWidth = width; } attributes = attributes + "cols:" + tmpCols + "; "; attributes = attributes + "width:" + (tmWidth * tmpCols) + "; "; // Çà¼ö ±âº» 1 var tmpRows = 1; if(length > 0) { tmpRows = Math.floor((length / tmpCols)) + ( (length % tmpCols) == 0 ? 0 : 1); } // ³ôÀÌ var tmpHeight = 20; if(height != undefined && height != "" ) { tmpHeight = height; } attributes = attributes + "rows:" + tmpRows + "; "; attributes = attributes + "height:" + ((tmpHeight * tmpRows) - ( 2 * (tmpRows - 1))) + "; "; // ±âº» ½ºÅ¸ÀÏ // attributes = attributes + " border-style:solid; "; attributes = attributes + "appearance:full; overflow:visible; border-style:none; "; var radio = prnt.createChild("xforms:select1", attributes); makeItemset(radio, nodeSetXPath); // radio.refresh(); return radio; } // ¶óµð¿À ¹öư »ý¼º function makeRadioSingleItem(prnt, id, ref, parentNode, item, cols, left, top, width, height) { var attributes = ""; // alert("id = " + id +"\n ref = " + ref +"\n rows = " + cols +"\n left = " + left + "\n top = " + top +"\n width = " + width +"\n height = " + height); if(id != undefined && id != "" ) { attributes = attributes + "id:" + id + "; "; } else { alert("id´Â Çʼö ÀÔ´Ï´Ù."); return; } if(ref != undefined && ref != "" ) { attributes = attributes + "ref:" + ref + "; "; } else { alert(" ref ´Â Çʼö ÀÔ´Ï´Ù."); return; } if(left != undefined && left != "" ) { attributes = attributes + "left:" + left + "; "; } else { attributes = attributes + "left:0; "; } if(top != undefined && top != "" ) { attributes = attributes + "top:" + top + "; "; } else { attributes = attributes + "top:0; "; } // Ä÷³¼ö var tmpCols = 1; if(cols != undefined && cols != "" && cols != 0) { tmpCols = cols; } // ³ÐÀÌ var tmWidth = 300; if(width != undefined && width != "" ) { tmWidth = width; } attributes = attributes + "cols:" + tmpCols + "; "; attributes = attributes + "width:" + (tmWidth * tmpCols) + "; "; // Çà¼ö ±âº» 1 var tmpRows = 1; // ³ôÀÌ var tmpHeight = 32; if(height != undefined && height != "" ) { tmpHeight = height; } attributes = attributes + "rows:" + tmpRows + "; "; attributes = attributes + "height:" + ((tmpHeight * tmpRows) - ( 2 * (tmpRows - 1))) + "; "; // ±âº» ½ºÅ¸ÀÏ // attributes = attributes + " border-style:solid; "; attributes = attributes + "appearance:full; overflow:visible; border-style:none; "; var radio = prnt.createChild("xforms:select1", attributes); var choices = radio.createChild("xforms:choices", ""); var Itemset = choices.createChild("xforms:item", ""); Itemset.createChild("xforms:label", "text:" + item.label); Itemset.createChild("xforms:value", "text:" + item.value); radio.refresh(); return radio; } //10Á¡Ã´µµ Radio function makeRadioSingleItem10(prnt, id, ref, parentNode, item, cols, left, top, width, height) { var attributes = ""; // alert("id = " + id +"\n ref = " + ref +"\n rows = " + cols +"\n left = " + left + "\n top = " + top +"\n width = " + width +"\n height = " + height); if(id != undefined && id != "" ) { attributes = attributes + "id:" + id + "; "; } else { alert("id´Â Çʼö ÀÔ´Ï´Ù."); return; } if(ref != undefined && ref != "" ) { attributes = attributes + "ref:" + ref + "; "; } else { alert(" ref ´Â Çʼö ÀÔ´Ï´Ù."); return; } if(left != undefined && left != "" ) { attributes = attributes + "left:" + left + "; "; } else { attributes = attributes + "left:0; "; } if(top != undefined && top != "" ) { attributes = attributes + "top:" + top + "; "; } else { attributes = attributes + "top:0; "; } // Ä÷³¼ö var tmpCols = 1; if(cols != undefined && cols != "" && cols != 0) { tmpCols = cols; } // ³ÐÀÌ var tmWidth = 30; if(width != undefined && width != "" ) { tmWidth = width; } attributes = attributes + "cols:" + tmpCols + "; "; attributes = attributes + "width:" + (tmWidth * tmpCols) + "; "; // Çà¼ö ±âº» 1 var tmpRows = 1; // ³ôÀÌ var tmpHeight = 32; if(height != undefined && height != "" ) { tmpHeight = height; } attributes = attributes + "rows:" + tmpRows + "; "; attributes = attributes + "height:" + ((tmpHeight * tmpRows) - ( 2 * (tmpRows - 1))) + "; "; // ±âº» ½ºÅ¸ÀÏ // attributes = attributes + " border-style:solid; "; attributes = attributes + "appearance:full; overflow:visible; border-style:none; "; var radio = prnt.createChild("xforms:select1", attributes); var choices = radio.createChild("xforms:choices", ""); var Itemset = choices.createChild("xforms:item", ""); Itemset.createChild("xforms:label", "text:" + item.label); Itemset.createChild("xforms:value", "text:" + item.value); radio.refresh(); return radio; } // üũ ¹Ú½º »ý¼º function makeCheckbox(prnt, id, ref, parentNode, nodeSet, cols, left, top, width, height) { var attributes = ""; // alert("id = " + id +"\n ref = " + ref +"\n rows = " + rows + "\n cols = " + cols +"\n left = " + left + "\n top = " + top +"\n width = " + width +"\n height = " + height); if(id != undefined && id != "" ) { attributes = attributes + "id:" + id + "; "; } else { alert("id´Â Çʼö ÀÔ´Ï´Ù."); return; } if(ref != undefined && ref != "" ) { attributes = attributes + "ref:" + ref + "; "; } else { alert(" ref ´Â Çʼö ÀÔ´Ï´Ù."); return; } // ndoeSet »ý¼º var nodeSetXPath = parentNode +("/checkBoxNodeSet" + id); var length = 0; if(nodeSet != undefined && nodeSet != "" && nodeSet.length > 0 ) { makeNodeSet(nodeSetXPath, nodeSet); length = nodeSet.length; } // end if if(left != undefined && left != "" ) { attributes = attributes + "left:" + left + "; "; } else { attributes = attributes + "left:0; "; } if(top != undefined && top != "" ) { attributes = attributes + "top:" + top + "; "; } else { attributes = attributes + "top:0; "; } // Ä÷³¼ö var tmpCols = 1; if(cols != undefined && cols != "" && cols != 0) { tmpCols = cols; } // ³ÐÀÌ var tmWidth = 300; if(width != undefined && width != "" ) { tmWidth = width; } attributes = attributes + "cols:" + tmpCols + "; "; attributes = attributes + "width:" + (tmWidth * tmpCols) + "; "; // Çà¼ö ±âº» 1 var tmpRows = 1; if(length > 0) { tmpRows = Math.floor((length / tmpCols)) + ( (length % tmpCols) == 0 ? 0 : 1); } // ³ôÀÌ var tmpHeight = 20; if(height != undefined && height != "" ) { tmpHeight = height; } // end if attributes = attributes + "rows:" + tmpRows + "; "; attributes = attributes + "height:" + ((tmpHeight * tmpRows) - (2 * (tmpRows - 1))) + "; "; // ±âº» ½ºÅ¸ÀÏ // attributes = attributes + " border-style:solid; "; attributes = attributes + "appearance:full; sep:,; overflow:visible; border-style:none; "; var checkbox = prnt.createChild("xforms:select", attributes); makeItemset(checkbox, nodeSetXPath); //checkbox.refresh(); return checkbox; } // ÄÞº¸¹Ú½º »ý¼º function makeCombo(prnt, id, ref, parentNode, nodeSet, cols, left, top, width, height) { var attributes = ""; // alert("id = " + id +"\n ref = " + ref +"\n rows = " + rows + "\n cols = " + cols +"\n left = " + left + "\n top = " + top +"\n width = " + width +"\n height = " + height); if(id != undefined && id != "" ) { attributes = attributes + "id:" + id + "; "; } else { alert("id´Â Çʼö ÀÔ´Ï´Ù."); return; } if(ref != undefined && ref != "" ) { attributes = attributes + "ref:" + ref + "; "; } else { alert(" ref ´Â Çʼö ÀÔ´Ï´Ù."); return; } if(left != undefined && left != "" ) { attributes = attributes + "left:" + left + "; "; } else { attributes = attributes + "left:0; "; } if(top != undefined && top != "" ) { attributes = attributes + "top:" + top + "; "; } else { attributes = attributes + "top:0; "; } // Ä÷³¼ö var tmpCols = 1; if(cols != undefined && cols != "" && cols != 0) { tmpCols = cols; } // ³ÐÀÌ var tmWidth = 100; if(width != undefined && width != "" ) { tmWidth = width; } attributes = attributes + "cols:" + tmpCols + "; "; attributes = attributes + "width:" + (tmWidth * tmpCols) + "; "; // ³ôÀÌ var tmpHeight = 20; if(height != undefined && height != "" ) { tmpHeight = height; } attributes = attributes + "height:" + tmpHeight + "; "; // ±âº» ½ºÅ¸ÀÏ attributes = attributes + "appearance:minimal; "; // ndoeSet »ý¼º var nodeSetXPath = parentNode +("/comboNodeSet" + id); if(nodeSet != undefined && nodeSet != "" && nodeSet.length > 0 ) { makeNodeSet(nodeSetXPath, nodeSet); } var combo = prnt.createChild("xforms:select1", attributes); makeItemset(combo, nodeSetXPath); //combo.refresh(); return combo; } // Input »ý¼º function makeInput(prnt, id, ref, left, top, width, height) { var attributes = ""; // alert("id = " + id +"\n ref = " + ref +"\n left = " + left + "\n top = " + top +"\n width = " + width +"\n height = " + height); if(id != undefined && id != "" ) { attributes = attributes + "id:" + id + "; "; } else { alert("id´Â Çʼö ÀÔ´Ï´Ù."); return; } if(ref != undefined && ref != "" ) { attributes = attributes + "ref:" + ref + "; "; } else { alert(" ref ´Â Çʼö ÀÔ´Ï´Ù."); return; } if(left != undefined && left != "" ) { attributes = attributes + "left:" + left + "; "; } else { attributes = attributes + "left:0; "; } if(top != undefined && top != "" ) { attributes = attributes + "top:" + top + "; "; } else { attributes = attributes + "top:0; "; } // ³ÐÀÌ var tmWidth = 400; if(width != undefined && width != "" ) { tmWidth = width; } attributes = attributes + "width:" + tmWidth + "; "; // ³ôÀÌ var tmpHeight = 20; if(height != undefined && height != "" ) { tmpHeight = height; } // end if attributes = attributes + "height:" + tmpHeight + "; "; var input = prnt.createChild("xforms:input", attributes); //input.refresh(); return input; } // Textarea »ý¼º function makeTextarea(prnt, id, ref, left, top, width, height) { var attributes = ""; // alert("id = " + id +"\n ref = " + ref +"\n left = " + left + "\n top = " + top +"\n width = " + width +"\n height = " + height); if(id != undefined && id != "" ) { attributes = attributes + "id:" + id + "; "; } else { alert("id´Â Çʼö ÀÔ´Ï´Ù."); return; } if(ref != undefined && ref != "" ) { attributes = attributes + "ref:" + ref + "; "; } else { alert(" ref ´Â Çʼö ÀÔ´Ï´Ù."); return; } if(left != undefined && left != "" ) { attributes = attributes + "left:" + left + "; "; } else { attributes = attributes + "left:0; "; } if(top != undefined && top != "" ) { attributes = attributes + "top:" + top + "; "; } else { attributes = attributes + "top:0; "; } // ³ÐÀÌ var tmWidth = 600; if(width != undefined && width != "" ) { tmWidth = width; } attributes = attributes + "width:" + tmWidth + "; "; // ³ôÀÌ var tmpHeight = 60; if(height != undefined && height != "" ) { tmpHeight = height; } // end if attributes = attributes + "height:" + tmpHeight + "; "; attributes = attributes + "scroll:auto; "; var textarea = prnt.createChild("xforms:textarea", attributes); //textarea.refresh(); return textarea; } // Ãâ·Â ÇÊ¿äÇÑ ³ÐÀÌ ±¸Çϱâ var korCharWidth = 13; // ÇÑ±Û ÀÚÆò var engCharWidth = 7; // ¿µ¾î ÀÚÆò var spaceCharWidth = 4; // °ø¹é ÀÚÆò function getNeedWidth(value) { var needWidth = 0; for (var i = 0; i < value.length; i++) { if(value.charCodeAt(i) > 255) { needWidth += korCharWidth; } else if(value.charCodeAt(i) == 32) { needWidth += spaceCharWidth; } else { needWidth += engCharWidth; } // end if } // end for return needWidth; } // Output »ý¼º function makeOutput(prnt, value, left, top, width, height) { var attributes = ""; // alert("id = " + id +"\n ref = " + ref +"\n left = " + left + "\n top = " + top +"\n width = " + width +"\n height = " + height); if(left != undefined && left != "" ) { attributes = attributes + "left:" + left + "; "; } else { attributes = attributes + "left:0; "; } if(top != undefined && top != "" ) { attributes = attributes + "top:" + top + "; "; } else { attributes = attributes + "top:0; "; } // ³ÐÀÌ var tmWidth = tabWidth; if(width != undefined && width != "" ) { tmWidth = width; } attributes = attributes + "width:" + tmWidth + "; "; attributes = attributes + "word-wrap:word; "; var needWidth = getNeedWidth(value); var rows = Math.floor(needWidth / tmWidth); //var rows = Math.ceil(needWidth / tmWidth); //alert(value + "\n" + rows + "\n" + needWidth); // ³ôÀÌ var tmpHeight = 20; if(height != undefined && height != "" ) { tmpHeight = height; } // end if //attributes = attributes + "height:" + (20 + (14 * rows)) + "; "; attributes = attributes + "height:" + (tmpHeight + (14 * rows)) + "; "; attributes = attributes + "class:output_free; "; //³ôÀÌ Á¶Á¤ÀÌ ¾ÈµÇ¾î¼­ var output = prnt.createChild("xforms:output", attributes); output.value = value; //output.refresh(); return output; } // Button »ý¼º function makeButton(prnt, value, left, top, width, height) { var attributes = ""; // alert("id = " + id +"\n ref = " + ref +"\n left = " + left + "\n top = " + top +"\n width = " + width +"\n height = " + height); if(left != undefined && left != "" ) { attributes = attributes + "left:" + left + "; "; } else { attributes = attributes + "left:0; "; } if(top != undefined && top != "" ) { attributes = attributes + "top:" + top + "; "; } else { attributes = attributes + "top:0; "; } var needWidth = getNeedWidth(value) + 16; // ÁÂ¿ì °ø¹é°ú Ãʱâ À̹ÌÁö // ³ÐÀÌ var tmWidth = 100; if(width != undefined && width != "" ) { tmWidth = width; } // attributes = attributes + "width:" + tmWidth + "; "; // attributes = attributes + "word-wrap:word; "; attributes = attributes + "width:" + needWidth + "; "; // alert(value + "\n" + rows + "\n" + needWidth); // ³ôÀÌ var tmpHeight = 20; if(height != undefined && height != "" ) { tmpHeight = height; } // end if //var rows = Math.floor(needWidth / tmWidth); //attributes = attributes + "height:" + (20 + (14 * rows)) + "; "; attributes = attributes + "height:" + tmpHeight + "; "; attributes = attributes + "class:btn_sw; "; var button = prnt.createChild("xforms:button", attributes); button.value = value; //button.refresh(); return button; } var nodeColumnNames = new Array("qpaprseqno", "qestitemgrupseqno", "qestseqno", "qpaprsortseq", "itemkindcd", "qestanswno", "qestmltlanswno", "divpnt", "descinptcnts", "descinptaddcnts", "qestrspsyn", "norpaddyn"); // µ¥ÀÌŸ¸¦ ÀúÀåÇÒ ³ëµå »ý¼º function makeDataNode(ref, ctrlInfos) { var ctrlInfo = ctrlInfos[ctrlInfos.length - 1]; var rowRef = ref + "/row" + ctrlInfo.qpaprsortseq; //ctrlInfo.qestseqno; model.makeNode(rowRef); for(var i = 0; i < nodeColumnNames.length; i ++) { var colName = nodeColumnNames[i]; var colRef = rowRef + "/" + colName; if (colName == "qestanswno"){ model.makeValue(colRef, ""); } else if (colName == "qestmltlanswno"){ model.makeValue(colRef, ""); } else if (colName == "divpnt"){ model.makeValue(colRef, ""); } else { model.makeValue(colRef, ctrlInfo[colName]); } } return rowRef; } // group »ý¼º function makeGroup(prnt, left, top, width, height) { var attributes = ""; if(left != undefined && left != "" ) { attributes = attributes + "left:" + left + "; "; } else { attributes = attributes + "left:0; "; } if(top != undefined && top != "" ) { attributes = attributes + "top:" + top + "; "; } else { attributes = attributes + "top:0; "; } if(width != undefined && width != "" ) { attributes = attributes + "width:" + width + "; "; } if(height != undefined && height != "" ) { attributes = attributes + "height:" + height + "; "; } var group = prnt.createChild("xforms:group", attributes); return group } // Case »ý¼º function makeCase(prnt, id, left, top, width, height) { var attributes = ""; if(id != undefined && id != "" ) { attributes = attributes + "id:" + id + "; "; } else { alert("id´Â Çʼö ÀÔ´Ï´Ù."); return; } if(left != undefined && left != "" ) { attributes = attributes + "left:" + left + "; "; } else { attributes = attributes + "left:0; "; } if(top != undefined && top != "" ) { attributes = attributes + "top:" + top + "; "; } else { attributes = attributes + "top:0; "; } if(width != undefined && width != "" ) { attributes = attributes + "width:" + width + "; "; } if(height != undefined && height != "" ) { attributes = attributes + "height:" + height + "; "; } var switchCase = prnt.createChild("xforms:case", attributes); return switchCase } // ´ÜÀÏ ¼±Åà function makeSingleSelect(prnt, ctrlInfos, ref, left, top) { var group = makeGroup(prnt, left, top); var qestcnts = ctrlInfos[0].qpaprsortseq + ". " + ctrlInfos[0].qestcnts; var output = makeOutput(group, qestcnts, 0, 0, tabWidth); var inTop = parseInt(output.attribute("height") ,10) ; var nodeSet = retriveNodeSet(ctrlInfos); var qestseqno = ctrlInfos[0].qestseqno; // var qestitemanswchoicolcnt = ctrlInfos[0].qestitemanswchoicolcnt; // clos ¼ö var descinptyn = ctrlInfos[ctrlInfos.length - 1].descinptyn; // ¼­¼ú ÀÔ·Â ÇÊµå ¿©ºÎ var rowRef = makeDataNode(ref, ctrlInfos); var radio = makeRadio(group, "rd" + qestseqno, rowRef + "/qestanswno", condesNode, nodeSet, qestitemanswchoicolcnt, indent, inTop); inTop = inTop + parseInt(radio.attribute("height") ,10) ; if(descinptyn == "Y") { colRef = rowRef + "/"; model.makeNode(colRef); var input = makeInput(group, "ip" + qestseqno, rowRef + "/descinptcnts", indent, inTop); inTop = inTop + parseInt(input.attribute("height") ,10) ; } group.attribute("height") = inTop; group.attribute("width") = tabWidth; return group; } // ´ÙÁß ¼±Åà function makeMultiSelect(prnt, ctrlInfos, ref, left, top) { var group = makeGroup(prnt, left, top); var qestcnts = ctrlInfos[0].qpaprsortseq + ". " + ctrlInfos[0].qestcnts; var output = makeOutput(group, qestcnts, 0, 0, tabWidth); var inTop = parseInt(output.attribute("height") ,10) ; var nodeSet = retriveNodeSet(ctrlInfos); var qestseqno = ctrlInfos[0].qestseqno; var qestitemanswchoicolcnt = ctrlInfos[0].qestitemanswchoicolcnt; var rowRef = makeDataNode(ref, ctrlInfos); var checkbox = makeCheckbox(group, "ch" + qestseqno, rowRef + "/qestmltlanswno", condesNode, nodeSet, qestitemanswchoicolcnt, indent, inTop); inTop = inTop + parseInt(checkbox.attribute("height") ,10) ; var descinptyn = ctrlInfos[ctrlInfos.length - 1].descinptyn; if(descinptyn == "Y") { var input = makeInput(group, "ip" + qestseqno, rowRef + "/descinptcnts", indent, inTop); inTop = inTop + parseInt(input.attribute("height") ,10) ; } group.attribute("height") = inTop; group.attribute("width") = tabWidth; return group; } // ´Ü´äÇü function makeShortAnswer(prnt, ctrlInfos, ref, left, top) { var group = makeGroup(prnt, left, top); var qestcnts = ctrlInfos[0].qpaprsortseq + ". " + ctrlInfos[0].qestcnts; var output = makeOutput(group, qestcnts, 0, 0, tabWidth); var inTop = parseInt(output.attribute("height") ,10) ; var nodeSet = retriveNodeSet(ctrlInfos); var qestseqno = ctrlInfos[0].qestseqno; var qestitemanswcnts = ctrlInfos[0].answseqno + ") " + ctrlInfos[0].qestitemanswcnts; var addinptyn = ctrlInfos[0].addinptyn; var answaddcnts = ctrlInfos[0].answaddcnts; var width; var left = indent; if(qestitemanswcnts.length > 0) { width = qestitemanswcnts.length * 18; var output = makeOutput(group, qestitemanswcnts, left, inTop, width); left = left + width; width = 100; } // end if var rowRef = makeDataNode(ref, ctrlInfos); var input = makeInput(group, "ip" + qestseqno, rowRef + "/descinptcnts", left, inTop, width); if(addinptyn == "Y") { left += 110; if(answaddcnts.length > 0) { width = answaddcnts.length * 18; var output = makeOutput(group, answaddcnts, left, inTop, width); left = left + width; } // end if width = 100; var appInput = makeInput(group, "ipapp" + qestseqno, rowRef + "/descinptaddcnts", left, inTop, width); } // if //inTop = inTop + parseInt(input.attribute("height"), 10); inTop = inTop + 32; group.attribute("height") = inTop; group.attribute("width") = tabWidth; return group; } // ¼­¼ú ÀÔ·Â function makeDescriptiveAnswer(prnt, ctrlInfos, ref, left, top) { var group = makeGroup(prnt, left, top); var qestcnts = ctrlInfos[0].qpaprsortseq + ". " + ctrlInfos[0].qestcnts; var output = makeOutput(group, qestcnts, 0, 0, tabWidth); var inTop = parseInt(output.attribute("height") ,10) ; var nodeSet = retriveNodeSet(ctrlInfos); var qestseqno = ctrlInfos[0].qestseqno; var rowRef = makeDataNode(ref, ctrlInfos); var textarea = makeTextarea(group, "ta" + qestseqno, rowRef + "/descinptcnts", indent, inTop); inTop = inTop + parseInt(textarea.attribute("height") ,10) ; group.attribute("height") = inTop; group.attribute("width") = tabWidth; return group; } // ¼øÀ§ ÀÔ·Â function makePriority(prnt, ctrlInfos, ref, left, top) { var group = makeGroup(prnt, left, top); var qestcnts = ctrlInfos[0].qpaprsortseq + ". " + ctrlInfos[0].qestcnts; var output = makeOutput(group, qestcnts, 0, 0, tabWidth); var inTop = parseInt(output.attribute("height") ,10) ; var qestseqno = ctrlInfos[0].qestseqno; // var qestitemanswchoicolcnt = ctrlInfos[0].qestitemanswchoicolcnt; // cols ¼ö var descinptyn = ctrlInfos[ctrlInfos.length - 1].descinptyn; // ¼­¼ú ÀÔ·Â ÇÊµå ¿©ºÎ var rowRef = makeDataNode(ref, ctrlInfos); // ¹®Ç× °¹¼ö ¼³Á¤ model.makeValue(rowRef + "/qestmltlanswno_count", ctrlInfos.length); var colRef = ""; for (var i = 0; i < ctrlInfos.length; i++) { var answseqno = ctrlInfos[i].answseqno; var nodeSet = new Array(); for (var j = 0; j < ctrlInfos.length; j++) { nodeSet[j] = {"label":ctrlInfos[j].answseqno, "value":answseqno + ":" + ctrlInfos[j].answseqno}; } // end for // ¹®Ç׺° °ª ÀúÀå node »ý¼º //var colRef = rowRef + "/qestmltlanswno" + i; colRef = rowRef +"/qestmltlanswno" + i; model.makeNode(colRef); var combo = makeCombo(group, "cb" + qestseqno + answseqno, colRef, condesNode, nodeSet, qestitemanswchoicolcnt, indent, inTop, 50); //var output = makeOutput(group, ctrlInfos[i].answseqno + ") " + ctrlInfos[i].qestitemanswcnts, indent + parseInt(combo.attribute("width") ,10) + 10, inTop, 300); var output = makeOutput(group, ctrlInfos[i].qestitemanswcnts, indent + parseInt(combo.attribute("width") ,10) + 10, inTop, 300); //inTop = inTop + parseInt(combo.attribute("height") ,10) ; inTop = inTop + 32 ; } // end for //model.makeNode(colRef); group.attribute("height") = inTop; group.attribute("width") = tabWidth; return group; } var cellWidth = 80; // ôµµ Ä÷³ width // ôµµ ¼±Åà function makeMeasure(prnt, ctrlInfos, ref, left, top, isPrintTitle) { var group = makeGroup(prnt, left, top); var nodeSet = retriveNodeSet(ctrlInfos); var rowIndex = ctrlInfos.length - 1; var qestcnts = ctrlInfos[rowIndex].qpaprsortseq + ". " + ctrlInfos[rowIndex].qestcnts; var qestseqno = ctrlInfos[rowIndex].qestseqno; var itemkindcd = ctrlInfos[rowIndex].itemkindcd; var qestitemanswchoicolcnt = ctrlInfos[rowIndex].qestitemanswchoicolcnt; // cols ¼ö var norpaddyn = ctrlInfos[rowIndex].norpaddyn; // ¹«ÀÀ´ä¿©ºÎ var width = tabWidth - (cellWidth * ctrlInfos.length); var inTop = 0; var inLeft = width; // ŸÀÌÆ² Ãâ·Â if(isPrintTitle) { var headCells = new Array(); var titleOutput = makeOutput(group, "Áú¹®", 0, inTop, width); headCells[0] = titleOutput; var maxHeadHeight = parseInt(titleOutput.attribute("height"), 10); for (var i = 0; i < ctrlInfos.length; i++) { titleOutput = makeOutput(group, nodeSet[i].label, inLeft, inTop, cellWidth); headCells[i + 1] = titleOutput; var headHeight = parseInt(titleOutput.attribute("height"), 10); maxHeadHeight = maxHeadHeight > headHeight ? maxHeadHeight: headHeight; inLeft += cellWidth; } // end for for (var i = 0; i < headCells.length; i++) { headCells[i].attribute("height") = maxHeadHeight; headCells[i].attribute("border-style") = "solid"; headCells[i].attribute("background-color") = "#cce8ff"; //"#00ccff"; headCells[i].attribute("text-align") = "center"; headCells[i].attribute("vertical-align") = "middle"; } // end for inTop = inTop + maxHeadHeight; } // end if // ÅØ½ºÆ® Ãâ·Â var output = makeOutput(group, qestcnts, 0, inTop, width); output.attribute("border-style") = "solid"; var inHeight = parseInt(output.attribute("height"), 10); var rowRef = makeDataNode(ref, ctrlInfos); var colRef = rowRef + "/qestanswno"; inLeft = width; var cellGroup; var radio; for (var i = 0; i < ctrlInfos.length; i++) { var answseqno = ctrlInfos[i].answseqno; cellGroup = makeGroup(group, inLeft, inTop, cellWidth, inHeight); cellGroup.attribute("border-style") = "solid"; radio = makeRadioSingleItem(cellGroup, "rd" + qestseqno + answseqno, colRef, condesNode, {label: "", value:nodeSet[i].value}, qestitemanswchoicolcnt, cellWidth / 2 - 10, inHeight / 2 - 10, cellWidth); inLeft += cellWidth; } // end for inTop = inTop + parseInt(cellGroup.attribute("height"), 10); group.attribute("height") = inTop; group.attribute("width") = tabWidth; return group; } var cell10Width = 30; // ôµµ Ä÷³ width // 10Á¡ ôµµ ¼±Åà function make10Measure(prnt, ctrlInfos, ref, left, top, isPrintTitle) { var group = makeGroup(prnt, left, top); var nodeSet = retriveNodeSet(ctrlInfos); var rowIndex = ctrlInfos.length - 1; var qestcnts = ctrlInfos[rowIndex].qpaprsortseq + ". " + ctrlInfos[rowIndex].qestcnts; var qestseqno = ctrlInfos[rowIndex].qestseqno; var itemkindcd = ctrlInfos[rowIndex].itemkindcd; var qestitemanswchoicolcnt = ctrlInfos[rowIndex].qestitemanswchoicolcnt; // cols ¼ö var norpaddyn = ctrlInfos[rowIndex].norpaddyn; // ¹«ÀÀ´ä¿©ºÎ var width = tabWidth - (cell10Width * ctrlInfos.length); var inTop = 0; var inLeft = width; // ŸÀÌÆ² Ãâ·Â if(isPrintTitle) { var headCells = new Array(); var titleOutput = makeOutput(group, "Áú¹®", 0, inTop, width); headCells[0] = titleOutput; var maxHeadHeight = parseInt(titleOutput.attribute("height"), 10); for (var i = 0; i < ctrlInfos.length; i++) { titleOutput = makeOutput(group, nodeSet[i].label, inLeft, inTop, cell10Width); headCells[i + 1] = titleOutput; var headHeight = parseInt(titleOutput.attribute("height"), 10); maxHeadHeight = maxHeadHeight > headHeight ? maxHeadHeight: headHeight; inLeft += cell10Width; } // end for for (var i = 0; i < headCells.length; i++) { headCells[i].attribute("height") = maxHeadHeight; headCells[i].attribute("border-style") = "solid"; headCells[i].attribute("background-color") = "#cce8ff"; //"#00ccff"; headCells[i].attribute("text-align") = "center"; headCells[i].attribute("vertical-align") = "middle"; } // end for inTop = inTop + maxHeadHeight; } // end if // ÅØ½ºÆ® Ãâ·Â var output = makeOutput(group, qestcnts, 0, inTop, width); output.attribute("border-style") = "solid"; var inHeight = parseInt(output.attribute("height"), 10); var rowRef = makeDataNode(ref, ctrlInfos); var colRef = rowRef + "/qestanswno"; inLeft = width; var cellGroup; var radio; for (var i = 0; i < ctrlInfos.length; i++) { var answseqno = ctrlInfos[i].answseqno; cellGroup = makeGroup(group, inLeft, inTop, cell10Width, inHeight); cellGroup.attribute("border-style") = "solid"; radio = makeRadioSingleItem10(cellGroup, "rd" + qestseqno + answseqno, colRef, condesNode, {label: "", value:nodeSet[i].value}, qestitemanswchoicolcnt, 5, inHeight / 2 - 10, cell10Width); inLeft += cell10Width; } // end for inTop = inTop + parseInt(cellGroup.attribute("height"), 10); group.attribute("height") = inTop; group.attribute("width") = tabWidth; return group; } // ¼³¹® »ý¼º function createPoll(prnt, ctrlInfos, ref, left, top, isContinuous) { if(ctrlInfos.length < 1) { alert("¼³¹®ÀÌ ¾ø½À´Ï´Ù"); return; } // end if var poll; var itemkindcd = ctrlInfos[0].itemkindcd; switch(itemkindcd) { case "1": poll = makeSingleSelect(prnt, ctrlInfos, ref, left, top); break; case "2": poll = makeMultiSelect(prnt, ctrlInfos, ref, left, top); break; case "3": poll = makePriority(prnt, ctrlInfos, ref, left, top); break; case "4": poll = makeShortAnswer(prnt, ctrlInfos, ref, left, top); break; case "5": poll = makeDescriptiveAnswer(prnt, ctrlInfos, ref, left, top); break; case "6": case "7": case "8": poll = makeMeasure(prnt, ctrlInfos, ref, left, top, isContinuous); break; case "10": poll = make10Measure(prnt, ctrlInfos, ref, left, top, isContinuous); break; } // end switch return poll; }; function isIdentical(arPreDatas, arDatas) { var identical = false; if (arPreDatas != undefined && arPreDatas != null) { if(arPreDatas.length == arDatas.length) { for(var i = 0; i < arPreDatas.length; i ++) { if(arPreDatas[i].qestitemanswcnts == arDatas[i].qestitemanswcnts) { identical = true; } else { identical = false; break; } } // end for } else { identical = false; } } else { identical = false; } // end if return identical; }