123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116 |
- 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;
- }
|