CSZ001.xjs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <Script type="xscript4.0"><![CDATA[var condesNode = "ds_codes";
  3. var indent = 20;
  4. var tabWidth = 780;
  5. var qeustGap = 15;
  6. // div 안쪽에 있는 components의 부모를 포함한 전체 경로를 리턴한다 (예- div01.div02.comp01)
  7. function fGetComponentsFullIdToSting(prnt, id) {
  8. var result = "";
  9. var tempParent = prnt;
  10. while(tempParent != "[object Form]") {
  11. var separator = (result == "") ? "" : ".";
  12. result = tempParent.name + separator + result;
  13. tempParent = tempParent.parent;
  14. }
  15. result = result + "." + id;
  16. return result;
  17. }
  18. function fSetRef(prnt, ref, id, oCheckBox) {
  19. var refs = ref.split("/");
  20. // checkboxlist 는 bind가 안되므로 이렇게 값을 입력 해놓고 나중에 처리함
  21. if(!utlf_isNull(oCheckBox)) {
  22. oCheckBox.bindDsNm = refs[0];
  23. oCheckBox.bindColNm = refs[1];
  24. } else {
  25. var sCompFullId = fGetComponentsFullIdToSting(prnt, id);
  26. var objBindItem = new BindItem();
  27. objBindItem.init("item_" + id, sCompFullId, "value", refs[0], refs[1]);
  28. this.addChild("item_" + id, objBindItem);
  29. objBindItem.bind();
  30. }
  31. }
  32. // 라디오나 콤보에 사용하는 innerdataset을 바로 전에 만들어 놓은 중간데이터를 가지고 생성
  33. function makeNodeSet(parentNode, codes) {
  34. var sDs = dsf_createDs(parentNode, [{col:"label", type:"string", size:256}, {col:"value", type:"string", size:256}]);
  35. var oDs = this.objects[sDs];
  36. oDs.enableevent = false;
  37. for(var i = 0; i < codes.length; i++) {
  38. var nRow = oDs.addRow();
  39. oDs.setColumn(nRow, "label", (i + 1) + ") " + codes[i].label);
  40. oDs.setColumn(nRow, "value", codes[i].value);
  41. }
  42. oDs.enableevent = true;
  43. }
  44. // 라디오나 콤보에 innerdataset 및 컬럼 연결
  45. function makeItemset(control, nodeSetXPath) {
  46. if(control == "cp_checkboxList") {
  47. var sProp="col=" + control.col + ",row=" + control.row + ",cellspacing=4,vcellspacing=0,itemWidth=-1,itemHeight=20,overflow='visible'";
  48. control.setInitComp(sProp, this.objects[nodeSetXPath], "value", "label", "fn_checkbox_Event");
  49. } else {
  50. control.codecolumn = "value";
  51. control.datacolumn = "label";
  52. control.innerdataset = nodeSetXPath;
  53. }
  54. }
  55. // 체크박스에서 체크 또는 해제시 데이터셋에 값 입력 하는 부분
  56. function fn_checkbox_Event() {
  57. var sCompFullId = fGetComponentsFullIdToSting(objForm.parent, objForm.name);
  58. var oCheckbox = eval(sCompFullId);
  59. var checkedData = oCheckbox.getData();
  60. var oDs = this.objects[oCheckbox.bindDsNm];
  61. oDs.enableevent = false;
  62. oDs.setColumn(0, oCheckbox.bindColNm, checkedData.join([',']));
  63. oDs.enableevent = true;
  64. }
  65. // 라디오나 콤보에서 사용하는 innerdataset을 만들기 전 중간 데이터 생성
  66. function retriveNodeSet(ctrlInfos) {
  67. var nodeSet = new Array();
  68. for (var i = 0; i < ctrlInfos.length; i++) {
  69. nodeSet[i] = {"label":ctrlInfos[i].qestitemanswcnts , "value":ctrlInfos[i].answseqno};
  70. }
  71. return nodeSet;
  72. }
  73. // 라디오 버튼 생성
  74. function makeRadio(prnt, id, ref, parentNode, nodeSet, cols, left, top, width, height) {
  75. if(utlf_isNull(id)) {
  76. alert("id는 필수 입니다.");
  77. return;
  78. }
  79. if(utlf_isNull(ref)) {
  80. alert(" ref 는 필수 입니다.");
  81. return;
  82. }
  83. // nodeSet 생성
  84. var nodeSetXPath = parentNode + ("_radioNodeSet" + id);
  85. var length = 0;
  86. if(!utlf_isNull(nodeSet) && nodeSet.length > 0) {
  87. makeNodeSet(nodeSetXPath, nodeSet);
  88. length = nodeSet.length;
  89. }
  90. if(utlf_isNull(left)) {
  91. left = 0;
  92. }
  93. if(utlf_isNull(top)) {
  94. top = 0;
  95. }
  96. // 컬럼수
  97. if(utlf_isNull(cols)) {
  98. cols = 1;
  99. }
  100. // 넓이
  101. if(utlf_isNull(width)) {
  102. //width = 300; //
  103. width = prnt.position.width - left; // 항상 부모 크기까지 꽉 차도록 width 설정
  104. }
  105. //width = width * cols;
  106. // 행수 기본 1
  107. var tmpRows = 1;
  108. if(length > 0) {
  109. tmpRows = Math.floor((length / cols)) + ( (length % cols) == 0 ? 0 : 1);
  110. }
  111. // 높이
  112. if(utlf_isNull(height)) {
  113. height = 20;
  114. }
  115. height = ((height * tmpRows) - (2 * (tmpRows - 1)));
  116. var objRadio = new Radio(id, left, top, left + width, top + height);
  117. prnt.addChild(id, objRadio);
  118. objRadio.show();
  119. // 행이 하나 뿐일 때는 -1 값 적용하여 아이템간 간격 최적화
  120. if(tmpRows < 2) {
  121. tmpRows = -1;
  122. cols = -1;
  123. }
  124. objRadio.columncount = cols;
  125. objRadio.index = -1;
  126. objRadio.rowcount = tmpRows;
  127. objRadio.style.textpadding = "0 16 0 5";
  128. makeItemset(objRadio, nodeSetXPath);
  129. fSetRef(prnt, ref, id);
  130. return objRadio;
  131. }
  132. // 라디오 버튼 생성
  133. function makeRadioSingleItem(prnt, id, ref, parentNode, item, cols, left, top, width, height) {
  134. if(utlf_isNull(id)) {
  135. alert("id는 필수 입니다.");
  136. return;
  137. }
  138. if(utlf_isNull(ref)) {
  139. alert(" ref 는 필수 입니다.");
  140. return;
  141. }
  142. if(utlf_isNull(left)) {
  143. left = 0;
  144. }
  145. if(utlf_isNull(top)) {
  146. top = 0;
  147. }
  148. // 컬럼수
  149. if(utlf_isNull(cols)) {
  150. cols = 1;
  151. }
  152. // 넓이
  153. if(utlf_isNull(width)) {
  154. width = 300;
  155. }
  156. // 행수 기본 1
  157. var tmpRows = 1;
  158. // 높이
  159. if(utlf_isNull(height)) {
  160. height = 32;
  161. }
  162. height = ((height * tmpRows) - (2 * (tmpRows - 1)));
  163. var objRadio = new Radio(id, left, top, left + width, top + height);
  164. prnt.addChild(id, objRadio);
  165. objRadio.show();
  166. objRadio.columncount = cols;
  167. objRadio.index = -1;
  168. objRadio.rowcount = tmpRows;
  169. objRadio.style.textpadding = "0 16 0 5";
  170. var nodeSetXPath = dsf_createDsRow("ds_" + id, [{col:"value", type:"string", size:256, val:item.value}
  171. , {col:"label", type:"string", size:256, val:item.label}]);
  172. makeItemset(objRadio, nodeSetXPath);
  173. fSetRef(prnt, ref, id);
  174. return objRadio;
  175. }
  176. //10점척도 Radio
  177. function makeRadioSingleItem10(prnt, id, ref, parentNode, item, cols, left, top, width, height) {
  178. if(utlf_isNull(id)) {
  179. alert("id는 필수 입니다.");
  180. return;
  181. }
  182. if(utlf_isNull(ref)) {
  183. alert(" ref 는 필수 입니다.");
  184. return;
  185. }
  186. if(utlf_isNull(left)) {
  187. left = 0;
  188. }
  189. if(utlf_isNull(top)) {
  190. top = 0;
  191. }
  192. // 컬럼수
  193. if(utlf_isNull(cols)) {
  194. cols = 1;
  195. }
  196. // 넓이
  197. if(utlf_isNull(width)) {
  198. width = 30;
  199. }
  200. // 행수 기본 1
  201. var tmpRows = 1;
  202. // 높이
  203. if(utlf_isNull(height)) {
  204. height = 32;
  205. }
  206. height = ((height * tmpRows) - (2 * (tmpRows - 1)));
  207. var objRadio = new Radio(id, left, top, left + width, top + height);
  208. prnt.addChild(id, objRadio);
  209. objRadio.show();
  210. objRadio.columncount = cols;
  211. objRadio.index = -1;
  212. objRadio.rowcount = tmpRows;
  213. objRadio.style.textpadding = "0 16 0 5";
  214. var nodeSetXPath = dsf_createDsRow("ds_" + id, [{col:"value", type:"string", size:256, val:item.value}
  215. , {col:"label", type:"string", size:256, val:item.label}]);
  216. makeItemset(objRadio, nodeSetXPath);
  217. fSetRef(prnt, ref, id);
  218. return objRadio;
  219. }
  220. // 체크 박스 생성
  221. function makeCheckbox(prnt, id, ref, parentNode, nodeSet, cols, left, top, width, height) {
  222. if(utlf_isNull(id)) {
  223. alert("id는 필수 입니다.");
  224. return;
  225. }
  226. if(utlf_isNull(ref)) {
  227. alert(" ref 는 필수 입니다.");
  228. return;
  229. }
  230. // ndoeSet 생성
  231. var nodeSetXPath = parentNode +("_checkBoxNodeSet" + id);
  232. var length = 0;
  233. if(!utlf_isNull(nodeSet) && nodeSet.length > 0 ) {
  234. makeNodeSet(nodeSetXPath, nodeSet);
  235. length = nodeSet.length;
  236. } // end if
  237. if(utlf_isNull(left)) {
  238. left = 0;
  239. }
  240. if(utlf_isNull(top)) {
  241. top = 0;
  242. }
  243. // 컬럼수
  244. if(utlf_isNull(cols)) {
  245. cols = 1;
  246. }
  247. // 넓이
  248. var tmWidth = 300;
  249. if(utlf_isNull(width)) {
  250. //width = 300;
  251. width = prnt.position.width - left; // 항상 부모 크기까지 꽉 차도록 width 설정
  252. }
  253. // 행수 기본 1
  254. var tmpRows = 1;
  255. if(length > 0) {
  256. tmpRows = Math.floor((length / cols)) + ( (length % cols) == 0 ? 0 : 1);
  257. }
  258. // 높이
  259. if(utlf_isNull(height)) {
  260. height = 20;
  261. } // end if
  262. height = ((height * tmpRows) - (2 * (tmpRows - 1)));
  263. // 기본 스타일
  264. var objCheckbox = new cp_checkboxList(id, left, top, left + width, top + height);
  265. prnt.addChild(id, objCheckbox);
  266. objCheckbox.show();
  267. objCheckbox.col = cols;
  268. objCheckbox.row = tmpRows;
  269. makeItemset(objCheckbox, nodeSetXPath);
  270. fSetRef(prnt, ref, id, objCheckbox);
  271. return objCheckbox;
  272. }
  273. // Input 생성
  274. function makeInput(prnt, id, ref, left, top, width, height) {
  275. if(utlf_isNull(id)) {
  276. alert("id는 필수 입니다.");
  277. return;
  278. }
  279. if(utlf_isNull(ref)) {
  280. alert(" ref 는 필수 입니다.");
  281. return;
  282. }
  283. if(utlf_isNull(left)) {
  284. left = 0;
  285. }
  286. if(utlf_isNull(top)) {
  287. top = 0;
  288. }
  289. // 넓이
  290. var tmWidth = 400;
  291. if(utlf_isNull(width)) {
  292. width = 400;
  293. }
  294. // 높이
  295. if(utlf_isNull(height)) {
  296. height = 20;
  297. } // end if
  298. var objEdit = new Edit(id, left, top, left + width, top + height);
  299. prnt.addChild(id, objEdit);
  300. objEdit.show();
  301. objEdit.autoselect = true;
  302. objEdit.imemode = "hangul";
  303. fSetRef(prnt, ref, id);
  304. return objEdit;
  305. }
  306. // Textarea 생성
  307. function makeTextarea(prnt, id, ref, left, top, width, height) {
  308. if(utlf_isNull(id)) {
  309. alert("id는 필수 입니다.");
  310. return;
  311. }
  312. if(utlf_isNull(ref)) {
  313. alert(" ref 는 필수 입니다.");
  314. return;
  315. }
  316. if(utlf_isNull(left)) {
  317. left = 0;
  318. }
  319. if(utlf_isNull(top)) {
  320. top = 0;
  321. }
  322. // 넓이
  323. var tmWidth = 600;
  324. if(utlf_isNull(width)) {
  325. width = 600;
  326. }
  327. // 높이
  328. var tmpHeight = 60;
  329. if(utlf_isNull(height)) {
  330. height = 60;
  331. }
  332. var objTextArea = new TextArea(id, left, top, left + width, top + height);
  333. prnt.addChild(id, objTextArea);
  334. objTextArea.show();
  335. objTextArea.autoselect = true;
  336. objTextArea.imemode = "hangul";
  337. fSetRef(prnt, ref, id);
  338. return objTextArea;
  339. }
  340. // 출력 필요한 넓이 구하기
  341. var korCharWidth = 13; // 한글 자평
  342. var engCharWidth = 7; // 영어 자평
  343. var spaceCharWidth = 4; // 공백 자평
  344. function getNeedWidth(value) {
  345. var needWidth = 0;
  346. for (var i = 0; i < value.length; i++) {
  347. if(value.charCodeAt(i) > 255) {
  348. needWidth += korCharWidth;
  349. } else if(value.charCodeAt(i) == 32) {
  350. needWidth += spaceCharWidth;
  351. } else {
  352. needWidth += engCharWidth;
  353. } // end if
  354. } // end for
  355. return needWidth;
  356. }
  357. // Output 생성
  358. function makeOutput(prnt, value, objName, left, top, width, height) {
  359. if(utlf_isNull(value)) value = "";
  360. if(utlf_isNull(left)) left = 0;
  361. if(utlf_isNull(top)) top = 0;
  362. if(utlf_isNull(width)) width = tabWidth;
  363. if(utlf_isNull(height)) height = 18;
  364. // 문자열 맨끝에 &#10; 붙는것에 대한 예외처리
  365. value = value.replace(String.fromCharCode(10), "");
  366. var needWidth = getNeedWidth(value);
  367. var rows = Math.floor(needWidth / width);
  368. if(rows < 1) rows = 1;
  369. height = height + (14 * rows);
  370. var objStatic = new Static(objName, left, top, left + width, top + height);
  371. prnt.addChild(objName, objStatic);
  372. objStatic.show();
  373. objStatic.wordwrap = "word";
  374. objStatic.linespace = 3;
  375. objStatic.text = value;
  376. return objStatic;
  377. }
  378. // Button 생성
  379. function makeButton(prnt, pos, value, left, top, width, height) {
  380. if(utlf_isNull(left)) {
  381. left = 0;
  382. }
  383. if(utlf_isNull(top)) {
  384. top = 0;
  385. }
  386. var needWidth = getNeedWidth(value) + 16; // 좌우 공백과 초기 이미지
  387. // 넓이
  388. width = needWidth;
  389. // 높이
  390. if(utlf_isNull(height)) {
  391. height = 20;
  392. } // end if
  393. if(pos > 0) {
  394. var button = prnt.components["Button_tab_" + (pos - 1)];
  395. left = button.position.right;
  396. }
  397. var objButton = new Button("Button_tab_" + pos, left, top, left + width, top + height);
  398. objButton.class = "btn_sw";
  399. prnt.addChild("Button_tab_" + pos, objButton);
  400. objButton.show();
  401. objButton.text = value;
  402. return objButton;
  403. }
  404. var nodeColumnNames = new Array("qpaprseqno", "qestitemgrupseqno", "qestseqno", "qpaprsortseq", "itemkindcd",
  405. "qestanswno", "qestmltlanswno", "divpnt", "descinptcnts", "descinptaddcnts",
  406. "qestrspsyn", "norpaddyn");
  407. // 데이타를 저장할 데이터셋 및 컬럼 생성
  408. function makeDataNode(ref, ctrlInfos) {
  409. var ctrlInfo = ctrlInfos[ctrlInfos.length - 1];
  410. var rowRef = ref + "_row" + ctrlInfo.qpaprsortseq;
  411. var sDs = dsf_createDs(rowRef);
  412. var oDs = this.objects[sDs];
  413. for(var i = 0; i < nodeColumnNames.length; i ++) {
  414. var colName = nodeColumnNames[i];
  415. if (colName == "qestanswno" || colName == "qestmltlanswno" || colName == "divpnt"){
  416. dsf_makeValue(oDs, colName, "string", "");
  417. } else {
  418. dsf_makeValue(oDs, colName, "string", ctrlInfo[colName]);
  419. }
  420. }
  421. return rowRef;
  422. }
  423. // 각 문항 마다 Div를 만들어서 그 안에 실제 문제를 생성
  424. function makeGroup(prnt, id, left, top, width, height) {
  425. if(utlf_isNull(left)) left = 0;
  426. if(utlf_isNull(top)) top = 0;
  427. if(utlf_isNull(width)) width = tabWidth;//width = 0;
  428. if(utlf_isNull(height)) height = 0;
  429. var objDivName = "Div" + id;
  430. var objDiv = new Div(objDivName, left, top, left + width, top + height);
  431. prnt.addChild(objDivName, objDiv);
  432. objDiv.show();
  433. return objDiv;
  434. }
  435. // Case 생성
  436. function makeCase(prnt, id, btnText) {
  437. var tabIndex = prnt.insertTabpage(id, 0, "", btnText);
  438. return prnt.components[tabIndex];
  439. }
  440. // 단일 선택
  441. function makeSingleSelect(prnt, ctrlInfos, ref, left, top) {
  442. // 문항을 묶을 Div
  443. var group = makeGroup(prnt, ctrlInfos[0].qpaprsortseq, left, top);
  444. var qestcnts = ctrlInfos[0].qpaprsortseq + ". " + ctrlInfos[0].qestcnts;
  445. var objName = "stt_qestcnts_" + ctrlInfos[0].qpaprsortseq;
  446. var output = makeOutput(group, qestcnts, objName, 0, 0, tabWidth);
  447. var inTop = output.position.height;
  448. var nodeSet = retriveNodeSet(ctrlInfos);
  449. var qestseqno = ctrlInfos[0].qestseqno; //
  450. var qestitemanswchoicolcnt = ctrlInfos[0].qestitemanswchoicolcnt; // clos 수
  451. var descinptyn = ctrlInfos[ctrlInfos.length - 1].descinptyn; // 서술 입력 필드 여부
  452. var rowRef = makeDataNode(ref, ctrlInfos);
  453. var radio = makeRadio(group, "rdo" + qestseqno, rowRef + "/qestanswno", condesNode, nodeSet, qestitemanswchoicolcnt, indent, inTop);
  454. inTop = inTop + radio.position.height;
  455. group.position.height = inTop + qeustGap;
  456. return group;
  457. }
  458. // 다중 선택
  459. function makeMultiSelect(prnt, ctrlInfos, ref, left, top) {
  460. var group = makeGroup(prnt, ctrlInfos[0].qpaprsortseq, left, top);
  461. var qestcnts = ctrlInfos[0].qpaprsortseq + ". " + ctrlInfos[0].qestcnts;
  462. var objName = "stt_qestcnts_" + ctrlInfos[0].qpaprsortseq;
  463. var output = makeOutput(group, qestcnts, objName, 0, 0, tabWidth);
  464. var inTop = output.position.height;
  465. var nodeSet = retriveNodeSet(ctrlInfos);
  466. var qestseqno = ctrlInfos[0].qestseqno;
  467. var qestitemanswchoicolcnt = ctrlInfos[0].qestitemanswchoicolcnt;
  468. var rowRef = makeDataNode(ref, ctrlInfos);
  469. var checkbox = makeCheckbox(group, "ch" + qestseqno, rowRef + "/qestmltlanswno", condesNode, nodeSet, qestitemanswchoicolcnt, indent, inTop);
  470. inTop = inTop + checkbox.position.height;
  471. var descinptyn = ctrlInfos[ctrlInfos.length - 1].descinptyn;
  472. if(descinptyn == "Y") {
  473. // var input = makeInput(group, "ip" + qestseqno, rowRef + "/descinptcnts", indent, inTop);
  474. // inTop = inTop + parseInt(input.attribute("height") ,10) ;
  475. }
  476. group.position.height = inTop + qeustGap;
  477. return group;
  478. }
  479. // 단답형
  480. function makeShortAnswer(prnt, ctrlInfos, ref, left, top) {
  481. var group = makeGroup(prnt, ctrlInfos[0].qpaprsortseq, left, top);
  482. var qestcnts = ctrlInfos[0].qpaprsortseq + ". " + ctrlInfos[0].qestcnts;
  483. var objName = "stt_qestcnts_" + ctrlInfos[0].qpaprsortseq;
  484. var output = makeOutput(group, qestcnts, objName, 0, 0, tabWidth);
  485. var inTop = output.position.height;
  486. var nodeSet = retriveNodeSet(ctrlInfos);
  487. var qestseqno = ctrlInfos[0].qestseqno;
  488. var qestitemanswcnts = ctrlInfos[0].answseqno + ") " + ctrlInfos[0].qestitemanswcnts;
  489. var addinptyn = ctrlInfos[0].addinptyn;
  490. var answaddcnts = ctrlInfos[0].answaddcnts;
  491. var width;
  492. var left = indent;
  493. if(qestitemanswcnts.length > 0) {
  494. width = qestitemanswcnts.length * 18;
  495. var objName = "stt_qestcnts_" + ctrlInfos[0].qpaprsortseq + "_" + ctrlInfos[0].answseqno;
  496. var output = makeOutput(group, qestitemanswcnts, objName, left, inTop, width);
  497. left = left + width;
  498. width = 100;
  499. }
  500. var rowRef = makeDataNode(ref, ctrlInfos);
  501. var input = makeInput(group, "ip" + qestseqno, rowRef + "/descinptcnts", left, inTop + 5, width);
  502. if(addinptyn == "Y") {
  503. left = input.position.right + 30;
  504. if(answaddcnts.length > 0) {
  505. width = answaddcnts.length * 18;
  506. objName = "stt_qestcnts_" + ctrlInfos[0].qpaprsortseq + "_" + ctrlInfos[0].answseqno + "_2";
  507. var output = makeOutput(group, answaddcnts, objName, left, inTop, width);
  508. left = left + width;
  509. }
  510. width = 100;
  511. var appInput = makeInput(group, "ipapp" + qestseqno, rowRef + "/descinptaddcnts", left, inTop + 5, width);
  512. }
  513. inTop = input.position.bottom;
  514. group.position.height = inTop + qeustGap;
  515. return group;
  516. }
  517. // 서술 입력
  518. function makeDescriptiveAnswer(prnt, ctrlInfos, ref, left, top) {
  519. var group = makeGroup(prnt, ctrlInfos[0].qpaprsortseq, left, top);
  520. var qestcnts = ctrlInfos[0].qpaprsortseq + ". " + ctrlInfos[0].qestcnts;
  521. var objName = "stt_qestcnts_" + ctrlInfos[0].qpaprsortseq;
  522. var output = makeOutput(group, qestcnts, objName, 0, 0, tabWidth);
  523. var inTop = output.position.height;
  524. var nodeSet = retriveNodeSet(ctrlInfos);
  525. var qestseqno = ctrlInfos[0].qestseqno;
  526. var rowRef = makeDataNode(ref, ctrlInfos);
  527. var textarea = makeTextarea(group, "ta" + qestseqno, rowRef + "/descinptcnts", indent, inTop);
  528. inTop = inTop + textarea.position.height;
  529. group.position.height = inTop + qeustGap;
  530. return group;
  531. }
  532. var cellWidth = 80; // 척도 컬럼 width
  533. // 척도 선택
  534. function makeMeasure(prnt, ctrlInfos, ref, left, top, isPrintTitle) {
  535. var group = makeGroup(prnt, ctrlInfos[0].qpaprsortseq, left, top);
  536. var nodeSet = retriveNodeSet(ctrlInfos);
  537. var rowIndex = ctrlInfos.length - 1;
  538. var qestcnts = ctrlInfos[rowIndex].qpaprsortseq + ". " + ctrlInfos[rowIndex].qestcnts;
  539. var qestseqno = ctrlInfos[rowIndex].qestseqno;
  540. var itemkindcd = ctrlInfos[rowIndex].itemkindcd;
  541. var qestitemanswchoicolcnt = ctrlInfos[rowIndex].qestitemanswchoicolcnt; // cols 수
  542. var norpaddyn = ctrlInfos[rowIndex].norpaddyn; // 무응답여부
  543. var width = tabWidth - (cellWidth * ctrlInfos.length);
  544. var inTop = 0;
  545. var inLeft = width;
  546. // 타이틀 출력
  547. if(isPrintTitle) {
  548. var headCells = new Array();
  549. var objName = "stt_qestcnts_" + ctrlInfos[0].qpaprsortseq + "_header";
  550. var titleOutput = makeOutput(group, "질문", objName, 0, inTop, width);
  551. headCells[0] = titleOutput;
  552. var maxHeadHeight = titleOutput.position.height;
  553. for (var i = 0; i < ctrlInfos.length; i++) {
  554. objName = "stt_qestcnts_" + ctrlInfos[i].qpaprsortseq + "_" + ctrlInfos[i].answseqno;
  555. titleOutput = makeOutput(group, nodeSet[i].label, objName, inLeft, inTop, cellWidth);
  556. headCells[i + 1] = titleOutput;
  557. var headHeight = titleOutput.position.height;
  558. maxHeadHeight = maxHeadHeight > headHeight ? maxHeadHeight: headHeight;
  559. inLeft += cellWidth;
  560. } // end for
  561. for (var i = 0; i < headCells.length; i++) {
  562. headCells[i].position.height = maxHeadHeight;
  563. headCells[i].style.border = "1 solid #000000";
  564. headCells[i].style.background = "#cce8ff";
  565. headCells[i].style.align = "center middle";
  566. } // end for
  567. inTop = inTop + maxHeadHeight;
  568. } // end if
  569. // 텍스트 출력
  570. var objName = "stt_qestcnts_" + ctrlInfos[0].qpaprsortseq;
  571. var output = makeOutput(group, qestcnts, objName, 0, inTop, width);
  572. output.style.border = "1 solid #000000";
  573. var inHeight = output.position.height;
  574. var rowRef = makeDataNode(ref, ctrlInfos);
  575. var colRef = rowRef + "/qestanswno";
  576. inLeft = width;
  577. var cellGroup;
  578. var radio;
  579. for (var i = 0; i < ctrlInfos.length; i++) {
  580. var answseqno = ctrlInfos[i].answseqno;
  581. var cellGroupId = ctrlInfos[i].qpaprsortseq + "_" + ctrlInfos[i].answseqno;
  582. cellGroup = makeGroup(group, cellGroupId, inLeft, inTop, cellWidth, inHeight);
  583. cellGroup.style.border = "1 solid #000000";
  584. radio = makeRadioSingleItem(cellGroup, "rd" + qestseqno + answseqno, colRef, condesNode, {label: "", value:nodeSet[i].value}, qestitemanswchoicolcnt, 0, inHeight / 2 - 18, cellWidth);
  585. radio.style.buttonalign = "center middle";
  586. inLeft += cellWidth;
  587. } // end for
  588. inTop = output.position.bottom;
  589. group.position.height = inTop;
  590. return group;
  591. }
  592. var cell10Width = 30; // 척도 컬럼 width
  593. // 10점 척도 선택
  594. function make10Measure(prnt, ctrlInfos, ref, left, top, isPrintTitle) {
  595. var group = makeGroup(prnt, ctrlInfos[0].qpaprsortseq, left, top);
  596. var nodeSet = retriveNodeSet(ctrlInfos);
  597. var rowIndex = ctrlInfos.length - 1;
  598. var qestcnts = ctrlInfos[rowIndex].qpaprsortseq + ". " + ctrlInfos[rowIndex].qestcnts;
  599. var qestseqno = ctrlInfos[rowIndex].qestseqno;
  600. var itemkindcd = ctrlInfos[rowIndex].itemkindcd;
  601. var qestitemanswchoicolcnt = ctrlInfos[rowIndex].qestitemanswchoicolcnt; // cols 수
  602. var norpaddyn = ctrlInfos[rowIndex].norpaddyn; // 무응답여부
  603. var width = tabWidth - (cell10Width * ctrlInfos.length);
  604. var inTop = 0;
  605. var inLeft = width;
  606. // 타이틀 출력
  607. if(isPrintTitle) {
  608. var headCells = new Array();
  609. var objName = "stt_qestcnts_" + ctrlInfos[0].qpaprsortseq + "_header";
  610. var titleOutput = makeOutput(group, "질문", objName, 0, inTop, width);
  611. headCells[0] = titleOutput;
  612. var maxHeadHeight = titleOutput.position.height;
  613. for (var i = 0; i < ctrlInfos.length; i++) {
  614. objName = "stt_qestcnts_" + ctrlInfos[i].qpaprsortseq + "_" + ctrlInfos[i].answseqno;
  615. titleOutput = makeOutput(group, nodeSet[i].label, objName, inLeft, inTop, cell10Width);
  616. headCells[i + 1] = titleOutput;
  617. var headHeight = titleOutput.position.height;
  618. maxHeadHeight = maxHeadHeight > headHeight ? maxHeadHeight: headHeight;
  619. inLeft += cell10Width;
  620. } // end for
  621. for (var i = 0; i < headCells.length; i++) {
  622. headCells[i].position.height = maxHeadHeight;
  623. headCells[i].style.border = "1 solid #000000";
  624. headCells[i].style.background = "#cce8ff";
  625. headCells[i].style.align = "center middle";
  626. } // end for
  627. inTop = inTop + maxHeadHeight;
  628. } // end if
  629. // 텍스트 출력
  630. var objName = "stt_qestcnts_" + ctrlInfos[0].qpaprsortseq;
  631. var output = makeOutput(group, qestcnts, objName, 0, inTop, width);
  632. output.style.border = "1 solid #000000";
  633. var inHeight = output.position.height;
  634. var rowRef = makeDataNode(ref, ctrlInfos);
  635. var colRef = rowRef + "/qestanswno";
  636. inLeft = width;
  637. var cellGroup;
  638. var radio;
  639. for (var i = 0; i < ctrlInfos.length; i++) {
  640. var answseqno = ctrlInfos[i].answseqno;
  641. var cellGroupId = ctrlInfos[i].qpaprsortseq + "_" + ctrlInfos[i].answseqno;
  642. cellGroup = makeGroup(group, cellGroupId, inLeft, inTop, cell10Width, inHeight);
  643. cellGroup.style.border = "1 solid #000000";
  644. radio = makeRadioSingleItem10(cellGroup, "rd" + qestseqno + answseqno, colRef, condesNode, {label: "", value:nodeSet[i].value}, qestitemanswchoicolcnt, 0, inHeight / 2 - 16, cell10Width);
  645. radio.style.buttonalign = "center middle";
  646. inLeft += cell10Width;
  647. } // end for
  648. inTop = output.position.bottom;
  649. group.position.height = inTop;
  650. return group;
  651. }
  652. // 설문 생성
  653. function createPoll(prnt, ctrlInfos, ref, left, top, isContinuous) {
  654. if(ctrlInfos.length < 1) {
  655. alert("설문이 없습니다");
  656. return;
  657. }
  658. var poll;
  659. var itemkindcd = ctrlInfos[0].itemkindcd;
  660. //trace("itemkindcd : " + itemkindcd + ", " + ctrlInfos);
  661. switch(itemkindcd) {
  662. case "1":
  663. poll = makeSingleSelect(prnt, ctrlInfos, ref, left, top);
  664. break;
  665. case "2":
  666. poll = makeMultiSelect(prnt, ctrlInfos, ref, left, top);
  667. break;
  668. // case "3":
  669. // poll = makePriority(prnt, ctrlInfos, ref, left, top);
  670. // break;
  671. case "4":
  672. poll = makeShortAnswer(prnt, ctrlInfos, ref, left, top);
  673. break;
  674. case "5":
  675. poll = makeDescriptiveAnswer(prnt, ctrlInfos, ref, left, top);
  676. break;
  677. case "6":
  678. case "7":
  679. case "8":
  680. poll = makeMeasure(prnt, ctrlInfos, ref, left, top, isContinuous);
  681. break;
  682. case "10":
  683. poll = make10Measure(prnt, ctrlInfos, ref, left, top, isContinuous);
  684. break;
  685. }
  686. return poll;
  687. }
  688. function isIdentical(arPreDatas, arDatas) {
  689. var identical = false;
  690. if (!utlf_isNull(arPreDatas)) {
  691. if(arPreDatas.length == arDatas.length) {
  692. for(var i = 0; i < arPreDatas.length; i ++) {
  693. if(arPreDatas[i].qestitemanswcnts == arDatas[i].qestitemanswcnts) {
  694. identical = true;
  695. } else {
  696. identical = false;
  697. break;
  698. }
  699. } // end for
  700. } else {
  701. identical = false;
  702. }
  703. } else {
  704. identical = false;
  705. } // end if
  706. return identical;
  707. }]]></Script>