first commit
This commit is contained in:
1766
eachPageModule/Question_.js
Normal file
1766
eachPageModule/Question_.js
Normal file
File diff suppressed because it is too large
Load Diff
82
eachPageModule/bundle.js
Normal file
82
eachPageModule/bundle.js
Normal file
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* 일괄 등록
|
||||
* bundle 함수 정의
|
||||
*
|
||||
*/
|
||||
|
||||
window.kon = window.kon || {}
|
||||
|
||||
kon.bundle = (function () {
|
||||
|
||||
function make_bundle_frame(){
|
||||
var param = setparam("s","BUNDLEVARIABLE",{"PKEY":code});
|
||||
|
||||
var bundle_variable, bundle_code
|
||||
if(!bundle_variable) bundle_variable = ajax_returnData(ajaxUrl, param);
|
||||
|
||||
param = setparam("s","BUNDLECODE",{"PKEY":code});
|
||||
if(!bundle_code) bundle_code = ajax_returnData(ajaxUrl, param);
|
||||
|
||||
var div = createnode("div","",{"class":"col-2"});
|
||||
var div2 = createnode("div","이 공간에 붙여넣기 해주세요.",{"class":"col-10 p-2 shadow-sm bordered bg-light", "id":"bundle_logic" ,"style":"overflow-y:scroll;max-height: 860px;border: 1px solid #b5b5b5;"});
|
||||
$(div2).prop("contentEditable",true);
|
||||
var table = createnode("TABLE","",{"class":gstyle.stable.sm + " shadow-sm"});
|
||||
|
||||
/* 1 row */
|
||||
var td = [createnode("TD","패턴 설정",{"colspan":"2"})];
|
||||
var tr = createnode("TR",td);
|
||||
table.appendChild(tr);
|
||||
|
||||
|
||||
/* 2 row */
|
||||
td = [createnode("TD","변수"),createnode("TD",[createnode("INPUT","",{"type":"text", "class":"border-primary" , "id":"b_variable"})] )];
|
||||
tr = createnode("TR",td);
|
||||
table.appendChild(tr);
|
||||
|
||||
/* 3 row */
|
||||
td = [createnode("TD","보기"),createnode("TD",[createnode("INPUT","",{"type":"text" , "class":"border-primary" ,"id":"b_code"})] )];
|
||||
tr = createnode("TR",td);
|
||||
table.appendChild(tr);
|
||||
|
||||
/* 4 row */
|
||||
td = [createnode("TD","삭제")];
|
||||
var del_td = createnode("TD",[createnode("INPUT","",{"type":"text", "class":"border-danger" , "id":"b_delete"})] );
|
||||
var del_btn = createnode("BUTTON","삭제",{"id":"bundle_delete_btn","class":"btn btn-sm btn-outline-danger d-block mt-1 w-100"});
|
||||
del_td.appendChild(del_btn);
|
||||
td.push(del_td);
|
||||
tr = createnode("TR",td);
|
||||
table.appendChild(tr);
|
||||
|
||||
|
||||
/* 5 row */
|
||||
td = [createnode("TD",[createnode("BUTTON","구조 최적화",{"class":gstyle.btn.primary,"id":"optimize_question" })],{"colspan":"2"})];
|
||||
tr = createnode("TR",td);
|
||||
table.appendChild(tr);
|
||||
|
||||
/* 6 row */
|
||||
td = [createnode("TD",[createnode("DIV","설문 구조",{"class":"p-1 m-1 text-primary text-center"}),createnode("DIV","",{"class":"m-1 p-1 border rounded text-left","id":"question_legend"}) ],{"colspan":"2","style":"color:red"})];
|
||||
tr = createnode("TR",td);
|
||||
table.appendChild(tr);
|
||||
|
||||
|
||||
/* 7 row */
|
||||
td = [createnode("TD",[createnode("BUTTON","설문 생성",{"class":gstyle.btn.primary,"id":"create_question" })],{"colspan":"2"})];
|
||||
tr = createnode("TR",td);
|
||||
table.appendChild(tr);
|
||||
|
||||
/* 8 row */
|
||||
td = [createnode("TD",[form_inline_input("checkbox","reset_checkbox","문항 전체 초기화")],{"colspan":"2","style":"color:red"})];
|
||||
tr = createnode("TR",td);
|
||||
table.appendChild(tr);
|
||||
|
||||
div.appendChild(table);
|
||||
|
||||
$("#mcontent").append(div).append(div2);
|
||||
$(table).addClass("position-sticky").css("top","50px")
|
||||
}
|
||||
|
||||
var module = {
|
||||
make_bundle_frame:make_bundle_frame
|
||||
}
|
||||
return module
|
||||
})();
|
||||
89
eachPageModule/capi.js
Normal file
89
eachPageModule/capi.js
Normal file
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* logic 함수 정의
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
window.kon = window.kon || {}
|
||||
|
||||
|
||||
kon.capi = (function () {
|
||||
var ajaxUrl = "/include/ajax_crud.asp";
|
||||
var target = ""
|
||||
var selected_myun = []
|
||||
var myun_list = []
|
||||
var page_list = [];
|
||||
var page_cnt = 10;
|
||||
var filter_list = [];
|
||||
var upload_list = []
|
||||
var project_list = []
|
||||
var prj_target = ""
|
||||
|
||||
/* 리스트 가져오기 */
|
||||
function get_list() {
|
||||
var param = setparam("s", "MYUN");
|
||||
kon.capi.myun_list = ajax_returnData(ajaxUrl, param);
|
||||
|
||||
}
|
||||
|
||||
/* 면접원 배정 프레임 */
|
||||
function make_myun_assign_frame(){
|
||||
$("#main_box").html("")
|
||||
/* 박스 선언 */
|
||||
var prj_box = createnode("div","",{"id":"prj_box" ,"class":"p-1 border rounded m-1 ","style":"height:600px;width:30%;overflow-y:auto"});
|
||||
var prj_assign_box = createnode("div","",{"id":"assign_box" ,"class":"p-1 border rounded m-1 bg-light ","style":"height:600px;width:30%;overflow-y:auto"});
|
||||
var myun_box = createnode("div","",{"id":"myun_box" ,"class":"p-1 border rounded m-1 ","style":"height:600px;width:30%;overflow-y:auto"});
|
||||
|
||||
/* 박스 상단 */
|
||||
$(prj_box).append("<p class='text-left m-1'><i class='fa fa-list' aria-hidden='true'></i> 프로젝트 목록</p>")
|
||||
$(prj_assign_box).append("<p id='assign_title' class='text-left m-1' style='cursor:default;border-bottom:2px solid #2196f3'>프로젝트를 선택해주세요</p>")
|
||||
$(myun_box).append("<div class='text-left m-1'><i class='fa fa-user' aria-hidden='true'></i> 면접원 목록</p>")
|
||||
$(myun_box).append("<div class='text-left text-primary'><small>* 면접원 성함으로 검색</small></div><div><div contenteditable class='m-1 border bg-light' id='myun-search' /> </div>")
|
||||
|
||||
|
||||
/* 프로젝트 삽입 */
|
||||
var prj_btn_list = kon.capi.project_list.map(function(v){
|
||||
return createnode("div", v["title"], {"title":v["PKEY"],"data-id":v["PKEY"] ,"class": "m-1 p-1 border text-left div_btn prj_list" })
|
||||
})
|
||||
prj_box.appendM(prj_btn_list)
|
||||
|
||||
/* 면접원 삽입 */
|
||||
var myun_btn_list = kon.capi.myun_list.map(function(v){
|
||||
var label = createnode("label",v["USERNAME"] + "-" + v["USERPHONE"],{"for":v["USERID"],"class":"w-100 m-0 h-100"});
|
||||
var chkbox = createnode("input","",{"type":"checkbox","id":v["USERID"],"value":v["USERID"],"class":"myun_input"});
|
||||
label.appendChild(chkbox);
|
||||
$(chkbox).prop("disabled",true);
|
||||
return createnode("div", [label] , {"data-id":v["USERID"] ,"class": "m-1 p-1 border text-left div_btn","style":"cursor:default","data-username":v["USERNAME"] });
|
||||
})
|
||||
|
||||
myun_box.appendM(myun_btn_list)
|
||||
|
||||
/* 메인 프레임에 삽입 */
|
||||
$("#main_box").append(prj_box)
|
||||
$("#main_box").append(prj_assign_box)
|
||||
$("#main_box").append(myun_box)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
var module = {
|
||||
/* function */
|
||||
get_list: get_list,
|
||||
make_myun_assign_frame:make_myun_assign_frame,
|
||||
/* variable */
|
||||
ajaxUrl: ajaxUrl,
|
||||
myun_list: myun_list,
|
||||
target:target,
|
||||
selected_myun: selected_myun,
|
||||
filter_list: filter_list,
|
||||
page_cnt:page_cnt,
|
||||
upload_list:upload_list,
|
||||
project_list:project_list,
|
||||
prj_target:prj_target
|
||||
}
|
||||
|
||||
return module
|
||||
}
|
||||
)();
|
||||
143
eachPageModule/gang.js
Normal file
143
eachPageModule/gang.js
Normal file
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
* logic 함수 정의
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
window.kon = window.kon || {}
|
||||
|
||||
|
||||
kon.gang = (function () {
|
||||
var ajaxUrl = "./include/ajax_crud.asp";
|
||||
var headkey = "";
|
||||
var list = [];
|
||||
var selected = {
|
||||
|
||||
};
|
||||
var filter_list = [];
|
||||
|
||||
/* 리스트 가져오기 */
|
||||
function get_list(code) {
|
||||
var param = setparam("s", "ATTENDEE", { "PKEY": code });
|
||||
kon.gang.list = ajax_returnData(ajaxUrl, param);
|
||||
}
|
||||
|
||||
/* 한 TR의 정보를 참석자 정보에 맞게 변경 */
|
||||
function make_row_to_gang_json(targetx) {
|
||||
var info = {
|
||||
"ID": "",
|
||||
"PW": "",
|
||||
"INFO_JSON": {}
|
||||
}
|
||||
|
||||
$(targetx).closest("TR").find("td:gt(1)").each(function (i, target) {
|
||||
$target = $(target);
|
||||
var text = $target.find("input").val();
|
||||
var col_name = $target.attr("data-column");
|
||||
if (col_name === "ID") {
|
||||
info["ID"] = text;
|
||||
} else if (col_name === "PW") {
|
||||
info["PW"] = text;
|
||||
} else {
|
||||
info["INFO_JSON"][col_name] = text;
|
||||
}
|
||||
});
|
||||
return info
|
||||
}
|
||||
|
||||
/* 양식 다운로드 */
|
||||
function fn_attendee_frame_down(code) {
|
||||
var data = kon.gang.list;
|
||||
var xls_json = []; /* 아웃풋용 데이터 세팅 */
|
||||
|
||||
data.forEach(function (item, i) {
|
||||
var info = JSON.parse(item["USER_INFO_JSON"])
|
||||
xls_json.push(info)
|
||||
|
||||
})
|
||||
exportExcel(xls_json, "참석자_리스트_" + code + "(" + new Date().format("yyyy-MM-dd hh:mm:ss") + ")")
|
||||
}
|
||||
|
||||
/* 전체 리스트 삭제 */
|
||||
function fn_attendee_list_delete(code) {
|
||||
var param = setparam("d", "ATTENDEE_ALL", { "PKEY": code });
|
||||
var fn_ajax = function () {
|
||||
alert("전체 리스트가 삭제되었습니다.");
|
||||
window.location.reload()
|
||||
}
|
||||
ajax_call(ajaxUrl, param, fn_ajax);
|
||||
|
||||
}
|
||||
|
||||
/* 리스트 테이블 화 */
|
||||
function fn_attendee_list_to_tbody(list) {
|
||||
var main_tr = list.map(function (item, i) {
|
||||
var td = []
|
||||
var delete_btn = createnode("BUTTON", "삭제", { "class": "btn btn-sm btn-outline-danger delete_btn", "data-id": item.USER_ID, "data-pw": item.USER_PW });
|
||||
var check_able = createnode("input", "", { "type": "checkbox", "class": "chkable" });
|
||||
td.push(createnode("TD", [delete_btn]));
|
||||
td.push(createnode("TD", [check_able]));
|
||||
|
||||
var id = createnode("TD", item.USER_ID, { "class": "align-middle", "data-column": "ID" });
|
||||
var pw = createnode("TD", item.USER_PW, { "class": "align-middle", "data-column": "PW" });
|
||||
|
||||
td.push(id);
|
||||
td.push(pw);
|
||||
|
||||
var info = JSON.parse(item.USER_INFO_JSON);
|
||||
|
||||
Object.keys(info).forEach(function (key) {
|
||||
var td_item = createnode("TD", info[key], { "class": "align-middle", "data-column": key });
|
||||
td.push(td_item);
|
||||
});
|
||||
|
||||
return createnode("TR", td);
|
||||
})
|
||||
|
||||
var tbody = createnode("TBODY", "");
|
||||
tbody.appendM(main_tr)
|
||||
return tbody
|
||||
}
|
||||
|
||||
/* 필터 옵션을 이용하여 필터링된 리스트 선언 */
|
||||
function filter_list_set() {
|
||||
kon.gang.filter_list = kon.gang.list.gmap(function (item) {
|
||||
var info = JSON.parse(item["USER_INFO_JSON"])
|
||||
var boolean = true;
|
||||
Object.keys(kon.gang.selected).some(function (key) {
|
||||
/* 조건에 하나라도 부합되지 않을 경우 */
|
||||
if (kon.gang.selected[key].indexOf(info[key]) === -1) {
|
||||
boolean = false;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
|
||||
if (boolean)
|
||||
return item;
|
||||
else
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
var module = {
|
||||
/* function */
|
||||
get_list: get_list,
|
||||
make_row_to_gang_json: make_row_to_gang_json,
|
||||
fn_attendee_frame_down: fn_attendee_frame_down,
|
||||
fn_attendee_list_delete: fn_attendee_list_delete,
|
||||
fn_attendee_list_to_tbody: fn_attendee_list_to_tbody,
|
||||
filter_list_set: filter_list_set,
|
||||
/* variable */
|
||||
ajaxUrl: ajaxUrl,
|
||||
headkey: headkey,
|
||||
list: list,
|
||||
selected: selected,
|
||||
filter_list: filter_list
|
||||
}
|
||||
|
||||
return module
|
||||
}
|
||||
)();
|
||||
249
eachPageModule/kondata.js
Normal file
249
eachPageModule/kondata.js
Normal file
@@ -0,0 +1,249 @@
|
||||
/*
|
||||
* data 함수 정의
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
window.kon = window.kon || {}
|
||||
kon.data = (function () {
|
||||
var ajaxUrl = "./include/ajax_crud.asp";
|
||||
var list = ""
|
||||
var code = "";
|
||||
var idkey = "";
|
||||
var idkey_dialog = "";
|
||||
var userdata = "";
|
||||
var pagedate = "";
|
||||
var page_list = "";
|
||||
var status_code = {
|
||||
"1": "진행중·중단",
|
||||
"10": "완료",
|
||||
"98": "쿼터아웃",
|
||||
"99": "대상자 아님"
|
||||
}
|
||||
|
||||
var get_list = function () {
|
||||
var param = setparam("s", "COMPLETE_IDKEY", { "PKEY": kon.data.code })
|
||||
kon.data.list = ajax_returnData(kon.data.ajaxUrl, param);
|
||||
if (kon.data.list.length > 0) {
|
||||
$("#idkey_dialog").remove();
|
||||
var dialog = createnode("div", "", { "id": "idkey_dialog", "title": "ID 관리창" });
|
||||
|
||||
var table = createnode("table", "", { "class": "table table-sm table-bordered" });
|
||||
var tr = []
|
||||
tr.push(createnode("TR", ""));
|
||||
var td1 = createnode("TD", "");
|
||||
var td2 = createnode("TD", "");
|
||||
var search_input = createnode("INPUT", "", { "TYPE": "TEXT", "class": "form-control", "name": "search_input", "autocomplete": "off" });
|
||||
var search_btn = createnode("BUTTON", "검색", { "TYPE": "BUTTON", "class": "btn btn-sm btn-primary", "name": "serach_btn", "style": "width:50px" });
|
||||
td1.appendChild(search_input);
|
||||
td2.appendChild(search_btn);
|
||||
tr[0].appendM([td1, td2]);
|
||||
|
||||
/*
|
||||
tr.push(createnode("TR", ""));
|
||||
td1 = createnode("TD", "");
|
||||
td2 = createnode("TD", "");
|
||||
var select1 = createnode("SELECT", "", { "class": "form-control", "name": "filter_target" });
|
||||
var select2 = createnode("SELECT", "", { "class": "form-control", "name": "filter_value" });
|
||||
td1.appendChild(select1);
|
||||
td2.appendChild(select2);
|
||||
tr[1].appendM([td1]);
|
||||
*/
|
||||
|
||||
table.appendM(tr)
|
||||
dialog.appendChild(table)
|
||||
dialog.appendChild(createnode("label", "ID 목록"))
|
||||
var idkey_list_box = createnode("div", "", { "class": "d-flex flex-column border p-1", "id": "idkey_list_box" })
|
||||
dialog.appendChild(idkey_list_box)
|
||||
kon.data.idkey_dialog = dialog
|
||||
$("#subbox_body").append(kon.data.idkey_dialog)
|
||||
$("#idkey_dialog").dialog({
|
||||
position: {
|
||||
my: "right top",
|
||||
at: "right top",
|
||||
of: "#subbox_body",
|
||||
},
|
||||
height: 640,
|
||||
width: 300,
|
||||
resizable: false
|
||||
}).dialogExtend({
|
||||
"minimizable": true,
|
||||
"collapsable": true,
|
||||
"dblclick": "collapse"
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/* 수정 클릭 시 프레임 생성 */
|
||||
var make_frame = function () {
|
||||
|
||||
var left_qlist = createnode("div", "", { "class": "d-flex flex-column m-1 border w-25 p-1", "id": "qlist_box", "style": "min-height:900px;position:relative" });
|
||||
|
||||
var error_filter = createnode("label", "검증 에러만", { "class": "text-danger p-1 m-1 border bg-white" });
|
||||
var error_filter_input = createnode("input", "", { "type": "checkbox" });
|
||||
error_filter.appendChild(error_filter_input);
|
||||
var left_header_top = createnode("div", "", { "class": "p-1 m-1 border-bottom d-flex align-items-center bg-light", "style": "position:sticky;top:0px" });
|
||||
var qlist_search = createnode("input", "", { "class": "form-control m-1 form-control-sm w-50 d-inline-block", "placeholder": "문번 검색", "name": "qlist_filter" });
|
||||
var logic_chk = createnode("button", "로직 검사", { "type": "button", "name": "logic_chk", "class": "btn btn-sm btn-primary m-1" });
|
||||
|
||||
|
||||
left_header_top.appendM([qlist_search, logic_chk, error_filter]);
|
||||
left_qlist.appendChild(left_header_top)
|
||||
make_page_list_frame(left_qlist)
|
||||
|
||||
var right_box = createnode("div", "", { "class": "flex-fill p-1 m-1 border d-flex flex-column" });
|
||||
getById("subbox_body").innerHTML = ""
|
||||
var save_btn = createnode("button", "페이지 데이터 저장", { "class": "btn btn-sm btn-outline-success save-btn mr-1" });
|
||||
var delete_btn = createnode("button", "페이지 데이터 삭제", { "class": "btn btn-sm btn-outline-dark delete-btn" });
|
||||
var top_head = createnode("div", [save_btn, delete_btn], { "class": "p-1 m-1 border-bottom " });
|
||||
var bottom_box = createnode("div", "", { "class": "h-100 bg-light" });
|
||||
var iframe = createnode("iframe", "", { "class": "border bg-white shadow-sm w-100 h-100", "id": "data_modify_frame" })
|
||||
|
||||
bottom_box.appendChild(iframe);
|
||||
right_box.appendM([top_head, bottom_box]);
|
||||
|
||||
|
||||
getById("subbox_body").appendM([left_qlist, right_box])
|
||||
|
||||
$(function () {
|
||||
$("#data_modify_frame").on("load", function (e) {
|
||||
var frameTarget = e.target;
|
||||
setTimeout(function () {
|
||||
/*
|
||||
kon이 js로 Document를 그리기 때문에 load이후로 그려지면.
|
||||
값을 정확히 못가져오는 경우가 발생.
|
||||
셋타임 아웃 설정하면 Event Queue 에 들어감.
|
||||
Event Queue에 들어가면 Call Stack이 비어있어야 실행시킴.
|
||||
*/
|
||||
var $content = $(frameTarget.contentDocument);
|
||||
var framewindow = frameTarget.contentWindow;
|
||||
var variable = framewindow.kon.group.variable; // 그룹 variable
|
||||
var qroot = !variable ? $content.find("input[name=PAGENAME]").val() : variable.slice(-1)[0]
|
||||
$content.find("#next").remove();
|
||||
kon.data.pagedate = kon.data.userdata[qroot];
|
||||
|
||||
for (var key in kon.data.pagedate) {
|
||||
var $target = $content.find("[name=" + key + "]:eq(0)");
|
||||
if ($target.length === 1) {
|
||||
if ($target.prop("tagName") === "INPUT") {
|
||||
switch ($target.attr("type")) {
|
||||
case "hidden":
|
||||
$content.find("input[id^=" + key.split("_")[0] + "][value=" + kon.data.pagedate[key] + "]").trigger("click");
|
||||
break;
|
||||
case "checkbox":
|
||||
$content.find("input[name=" + key + "][value=" + kon.data.pagedate[key] + "]").trigger("click")
|
||||
break;
|
||||
case "radio":
|
||||
$content.find("input[name=" + key + "][value=" + kon.data.pagedate[key] + "]").trigger("click")
|
||||
break;
|
||||
case "text":
|
||||
if (key.indexOf("AT") > -1) {
|
||||
$content.find("input[name=" + key + "]").closest("TD").find("input[type=checkbox]").trigger("click");
|
||||
}
|
||||
$content.find("input[name=" + key + "]").prop("disabled", false).val(kon.data.pagedate[key])
|
||||
break;
|
||||
case "number":
|
||||
$content.find("input[name=" + key + "]").prop("disabled", false).val(kon.data.pagedate[key])
|
||||
break;
|
||||
|
||||
}
|
||||
} else if ($target.prop("tagName") === "SELECT") {
|
||||
$content.find("SELECT[name=" + key + "]").val(kon.data.pagedate[key]).trigger("change")
|
||||
} else {
|
||||
$content.find("textarea[name=" + key + "]").prop("disabled", false).val(kon.data.pagedate[key])
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}, 10) /* setTimeout */
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
/* idkey의 페이지 리스트 생성 */
|
||||
var make_page_list_frame = function (element) {
|
||||
$(element).find(".qitem-box, .qitem-group").remove();
|
||||
var page_list = array_filter_to_group(kon.data.page_list, "qroot");
|
||||
var qtype = {
|
||||
"single": "단수문항",
|
||||
"multi": "복수문항",
|
||||
"attr": "속성문항",
|
||||
"scale": "척도문항",
|
||||
"open": "자유문항",
|
||||
"description": "안내문",
|
||||
"rank": "순위문항",
|
||||
"com": "복합문항"
|
||||
}
|
||||
Object.keys(page_list).forEach(function (key) {
|
||||
var target = page_list[key];
|
||||
if (target.length === 1) {
|
||||
target = target[0];
|
||||
var qitem = createnode("div", "", { "class": "qitem-box border rounded m-1 p-1", "data-variable": target["variable"], "data-qroot": target["QID"], "data-qid": target["QID"], "data-value": target["qroot"], "style": "font-size:.7rem !important" });
|
||||
var qitem_title = createnode("div", "[" + qtype[target["qtype"]] + "]" + target["variable"], { "class": "border-bottom font-weight-bold qitem-title" })
|
||||
if (target["access_flag"] !== "n") $(qitem).addClass("visited")
|
||||
$(qitem).append(qitem_title)
|
||||
$(qitem).append(target["title"]);
|
||||
element.appendChild(qitem)
|
||||
} else {
|
||||
var qgroup_box = createnode("div", "", { "class": "p-1 border-success border qitem-group" });
|
||||
$(qgroup_box).append("<span class='text-success'>그룹문항</span>")
|
||||
var qlist = target.map(function (item) {
|
||||
var qitem = createnode("div", "", { "class": "qitem-box border m-1 rounded p-1", "data-variable": item["variable"], "data-qroot": target[0]["QID"], "data-qid": item["QID"], "data-value": item["qroot"], "style": "font-size:.7rem !important" });
|
||||
var qitem_title = createnode("div", "[" + qtype[item["qtype"]] + "]" + item["variable"], { "class": "border-bottom font-weight-bold qitem-title" })
|
||||
if (item["access_flag"] !== "n") $(qitem).addClass("visited")
|
||||
$(qitem).append(qitem_title)
|
||||
$(qitem).append(item["title"]);
|
||||
return qitem
|
||||
})
|
||||
qgroup_box.appendM(qlist);
|
||||
element.appendChild(qgroup_box);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/* id 관리창에 id 박스 생성 */
|
||||
var make_list = function (list) {
|
||||
$("#idkey_list_box").html("");
|
||||
var list_box = getById("idkey_list_box")
|
||||
list_box.innerHTML = ""
|
||||
var id_list_box = list.map(function (item) {
|
||||
var div = createnode("div", "", { "class": "d-flex flex-row align-items-center idkey-list-item" });
|
||||
var left_div = createnode("div", "", { "style": "width:70%!important" });
|
||||
left_div.innerHTML = "<div class='text-primary h-100 bg-light border p-1 m-1' style='font-size:.8rem'>" + item.IDKEY + "<br>[" + (status_code[item.status] || "삭제") + "]<br>" + item.end_time + "</div> ";
|
||||
var right_div = createnode("div", "", { "class": "m-1 p-1 h-100 d-flex flex-column", "style": "width:30%!important" });
|
||||
var function_btn = []
|
||||
function_btn[0] = createnode("span", "수정", { "data-type": "modify", "idkey": item.IDKEY, "pkey": kon.data.code, "class": "data-btn border btn-outline-primary text-center w-100 p-1", "style": "font-size:.7rem;cursor:pointer" })/* 수정 */
|
||||
function_btn[1] = createnode("span", "삭제", { "data-type": "delete", "idkey": item.IDKEY, "pkey": kon.data.code, "class": "data-btn border btn-outline-danger text-center w-100 p-1", "style": "font-size:.7rem;cursor:pointer" })/* 완료 */
|
||||
function_btn[2] = item.status == "10"
|
||||
? createnode("span", "완료 해제", { "data-type": "complete-cancel", "idkey": item.IDKEY, "pkey": kon.data.code, "class": "data-btn border btn-outline-warning text-center w-100 p-1", "style": "font-size:.7rem;cursor:pointer" })
|
||||
: createnode("span", "완료", { "data-type": "complete", "idkey": item.IDKEY, "pkey": kon.data.code, "class": "data-btn border btn-outline-success text-center w-100 p-1", "style": "font-size:.7rem;cursor:pointer" })
|
||||
right_div.appendM(function_btn);
|
||||
div.appendM([left_div, right_div]);
|
||||
return div;
|
||||
})
|
||||
list_box.appendM(id_list_box);
|
||||
}
|
||||
|
||||
var module = {
|
||||
/* function */
|
||||
get_list: get_list,
|
||||
make_frame: make_frame,
|
||||
make_list: make_list,
|
||||
make_page_list_frame: make_page_list_frame,
|
||||
/* variable */
|
||||
ajaxUrl: ajaxUrl,
|
||||
page_list: page_list,
|
||||
code: code,
|
||||
list: list,
|
||||
idkey_dialog: idkey_dialog,
|
||||
idkey: idkey,
|
||||
userdata: userdata,
|
||||
pagedate: pagedate
|
||||
}
|
||||
|
||||
return module
|
||||
}
|
||||
)();
|
||||
240
eachPageModule/logic.js
Normal file
240
eachPageModule/logic.js
Normal file
@@ -0,0 +1,240 @@
|
||||
/*
|
||||
* logic 함수 정의
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
window.kon = window.kon || {}
|
||||
|
||||
kon.logic = (function () {
|
||||
var datalist = "";
|
||||
function fn_make_logic_frame(){
|
||||
var param = setparam("s","QUESTIONLIST",{"PKEY":code});
|
||||
questionlist = ajax_returnData(ajaxUrl, param);
|
||||
|
||||
param = setparam("s","STRUCTURE",{"PKEY":code});
|
||||
if(!kon.logic.datalist){
|
||||
kon.logic.datalist = ajax_returnData(ajaxUrl,param);
|
||||
Object.keys(kon.logic.datalist).forEach(function(v,i){
|
||||
kon.logic.datalist[v] = JSON.parse(kon.logic.datalist[v]);
|
||||
})
|
||||
}
|
||||
|
||||
var div = createnode("div","",{"class":"col-2","style":"overflow-y:scroll;max-height:840px","id":"logic_left_menu"});
|
||||
var div2 = createnode("div","",{"class":"col-10", "id":"selectionlogic" ,"style":"overflow-y:scroll;max-height:840px"});
|
||||
var table = createnode("TABLE","",{"class":"text-center table table-sm table-bordered"});
|
||||
var listid = ID();
|
||||
var b = createnode("b","문항 검색")
|
||||
var input = createnode("input","",{"type":"text","list":listid,"id":"logic_list" ,"style":"width:120px;","class":"ml-1","autocomplete":"off"});
|
||||
var dlist = questionlist.map(function(ele){return createnode("option", ele.QID + "[" + ele.variable + "]" ,{"value":ele.QID})});
|
||||
var datalist = createnode("datalist",dlist,{"id":listid});
|
||||
|
||||
$("#mtop")
|
||||
.append(b)
|
||||
.append(input)
|
||||
.append(datalist)
|
||||
|
||||
|
||||
questionlist.forEach(function(ele){
|
||||
var tr = createnode("TR","");
|
||||
tr.appendChild(createnode("TD",ele.QID + "[" + ele.variable + "]",{"class":"p-2 logicitem","style":"vertical-align:middle", "data-item" : ele.QID}));
|
||||
table.appendChild(tr);
|
||||
})
|
||||
|
||||
div.appendChild(table);
|
||||
$("#mcontent").append(div).append(div2);
|
||||
|
||||
}
|
||||
|
||||
function fn_make_logic_selection(QID){
|
||||
|
||||
var div_top = createnode("DIV","")
|
||||
var btnlist = [{"text":"사전 로직추가","type":"before"},{"text":"사후 로직추가","type":"after"},{"text":"취소"},{"text":"저장"},{"text":"삭제"}]
|
||||
div_top.appendChild(createnode("label",QID));
|
||||
btnlist.forEach(function(ele){
|
||||
var btn = ""
|
||||
if(ele.text === "삭제")
|
||||
btn = createnode("BUTTON",ele.text,{"class":gstyle.btn.danger + " logicdelete","data-id":QID});
|
||||
else if(ele.text === "저장")
|
||||
btn = createnode("BUTTON",ele.text,{"class":gstyle.btn.success + " logicsave","data-id":QID});
|
||||
else if(ele.text === "취소")
|
||||
btn = createnode("BUTTON",ele.text,{"class":gstyle.btn.warning + " logiccancel","data-id":QID});
|
||||
else
|
||||
btn = createnode("BUTTON",ele.text,{"class":gstyle.btn.primary + " logicadd","data-type":ele.type,"data-id":QID});
|
||||
|
||||
div_top.appendChild(btn);
|
||||
})
|
||||
|
||||
var div = createnode("DIV","",{"id":"box"+QID,"class":"shadow-sm p-2"})
|
||||
|
||||
var list = fn_logic_select(QID);
|
||||
|
||||
div.appendChild(div_top)
|
||||
|
||||
if(list) {
|
||||
Object.keys(list).forEach(function(key){
|
||||
var type = key === "p" ? "before" : "after"
|
||||
var a = list[key].map(function(logic){
|
||||
var qdiv = fn_make_logic_item_add(QID,type);
|
||||
var td = $(qdiv).find(".logictr td");
|
||||
logic.condition.forEach(function(wh){
|
||||
var where = wh.cd || ""
|
||||
var value = wh.va + wh.op + wh.co;
|
||||
if(where !== "") {
|
||||
var targetinput = make_logic_searchtd(where);
|
||||
$(targetinput).prepend("<div>"+where+"</div");
|
||||
$(targetinput).find("input:text:first").val(value);
|
||||
$(td).append( targetinput );
|
||||
} else {
|
||||
$(td).find("input:text:first").val(value);
|
||||
}
|
||||
})
|
||||
$(qdiv).find("input:text:last").val(logic.nextpage)
|
||||
return qdiv
|
||||
})
|
||||
div.appendM(a);
|
||||
})
|
||||
}
|
||||
$("#selectionlogic").append(div);
|
||||
}
|
||||
|
||||
function fn_logic_select(qid){
|
||||
var param = setparam("s","LOGIC",{"QID":qid,"PKEY":code})
|
||||
return ajax_returnData(ajaxUrl,param);
|
||||
}
|
||||
|
||||
|
||||
function fn_make_logic_item_add(qid,type){
|
||||
var name = ""
|
||||
var cls = ""
|
||||
|
||||
if(type === "before") {
|
||||
name = "사전로직"
|
||||
cls = "p-1 bg-white"
|
||||
} else {
|
||||
name = "사후로직"
|
||||
cls = "p-1 bg-light"
|
||||
}
|
||||
|
||||
var table = createnode("TABLE","",{"class":"text-center table table-sm table-bordered"})
|
||||
var div = createnode("DIV","",{"class":"m-1","style":"display:inline-block;width:17%;min-width:250px;vertical-align:top"})
|
||||
type === "before" ? div.classList.add("beforebox") : div.classList.add("afterbox");
|
||||
|
||||
var tr = Array(3).fill("TR").map(function(ele){return createnode(ele,"")})
|
||||
var td = Array(2).fill("TD").map(function(ele){return createnode(ele,"")})
|
||||
var button = Array(1).fill("BUTTON").map(function(ele){return createnode(ele,"")})
|
||||
|
||||
var listid = ID();
|
||||
var input = createnode("input","",{"type":"text","list":listid,"style":"width:120px;"});
|
||||
var dlist = questionlist.map(function(ele){return createnode("option", ele.QID + "[" + ele.variable + "]" ,{"value":ele.QID})});
|
||||
var datalist = createnode("datalist",dlist,{"id":listid});
|
||||
|
||||
var searchtd = createnode("TD","",{"colspan":"2"})
|
||||
$(button[0]).attr("class","alldelete "+gstyle.btn.danger).text("삭제");
|
||||
td[0].appendM(button);
|
||||
td[0].setAttribute("style","vertical-align:bottom !important;")
|
||||
setAttributes(td[1],{"class":cls,"style":"vertical-align:bottom !important;"})
|
||||
|
||||
$(td[1]).html("<div>"+name+"</div>");
|
||||
$(td[1]).append(createnode("BUTTON","and",{"id":"btnand","class":gstyle.btn.success}))
|
||||
$(td[1]).append(createnode("BUTTON","or",{"id":"btnor","class":gstyle.btn.primary }))
|
||||
|
||||
tr[0].appendM(td);
|
||||
searchtd.appendChild(make_logic_searchtd())
|
||||
|
||||
tr[1].appendChild(searchtd);
|
||||
tr[1].setAttribute("class","logictr");
|
||||
|
||||
["END","SCREEN"].forEach(function(text){
|
||||
datalist.insertAdjacentElement("afterbegin",createnode("option",text,{"value":text}));
|
||||
});
|
||||
|
||||
tr[2].appendChild(createnode("TD",[input,datalist],{"colspan":"2","class":"nextpage"},"분기 문항"))
|
||||
table.appendM(tr);
|
||||
div.appendChild(table)
|
||||
$("#box"+qid).append(div);
|
||||
return div
|
||||
}
|
||||
|
||||
function make_logic_searchtd(wh){
|
||||
var listid = ID();
|
||||
var input = createnode("input","",{"type":"text","list":listid,"style":"width:120px;"});
|
||||
var dlist = questionlist.map(function(ele){return createnode("option", ele.QID + "[" + ele.variable + "]" ,{"value":ele.QID})});
|
||||
var datalist = createnode("datalist",dlist,{"id":listid});
|
||||
|
||||
var where = wh || ""
|
||||
var div = createnode("div","",{"class":"m-1 text-left"})
|
||||
input.setAttribute("data-condition",where);
|
||||
div.appendM([input,datalist])
|
||||
|
||||
if(where) {
|
||||
var btn = createnode("Button","삭제",{"class":"eachdelete "+gstyle.btn.danger,"tabindex":"-1"});
|
||||
div.appendChild(btn);
|
||||
}
|
||||
|
||||
searchableinput(input,kon.logic.datalist);
|
||||
return div
|
||||
}
|
||||
|
||||
function logic_element_to_json(target){
|
||||
var jsonObj = {"p":[],"n":[]} ;
|
||||
var pattern = /[=<>!]/g;
|
||||
var bools = true;
|
||||
target.each(function(_id,ele){
|
||||
var target;
|
||||
if($(ele).hasClass("beforebox"))
|
||||
target = jsonObj.p;
|
||||
else
|
||||
target = jsonObj.n;
|
||||
|
||||
var lgt = Object.keys(target).length;
|
||||
target[lgt] = {"condition":[],"nextpage":""};
|
||||
|
||||
$(ele).find(".logictr input[type=text]").each(function(_id,input){
|
||||
var text = input.value || "";
|
||||
var regarr = regex_match(pattern,text) || [];
|
||||
|
||||
if(regarr.length===0){
|
||||
$(input).focus();
|
||||
bools = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
var operator = regarr.map(function(e){return e.value}).join("")
|
||||
var targetVariable = text.slice(0,regarr[0].index)
|
||||
var targetvalue = text.slice(regarr[regarr.length-1].index+1,text.length)
|
||||
var condition = input.getAttribute("data-condition") || "";
|
||||
|
||||
var obj = {
|
||||
"va":targetVariable,// 변수 타겟
|
||||
"op":operator,// 조건 구분
|
||||
"co":targetvalue// 조건 값
|
||||
}
|
||||
if(condition!=="") obj["cd"] = condition; // 조건 and, or 연결
|
||||
|
||||
target[lgt].condition.push(obj);
|
||||
})
|
||||
|
||||
target[lgt].nextpage = $(ele).find(".nextpage input:text").val() || ""
|
||||
|
||||
if(target[lgt].nextpage === "")
|
||||
bools = false;
|
||||
|
||||
return bools;
|
||||
|
||||
});
|
||||
|
||||
return !bools || jsonObj;
|
||||
}
|
||||
|
||||
var module = {
|
||||
fn_make_logic_frame:fn_make_logic_frame,
|
||||
fn_make_logic_selection:fn_make_logic_selection,
|
||||
fn_make_logic_item_add:fn_make_logic_item_add,
|
||||
make_logic_searchtd:make_logic_searchtd,
|
||||
logic_element_to_json:logic_element_to_json,
|
||||
datalist:datalist
|
||||
}
|
||||
return module
|
||||
})();
|
||||
128
eachPageModule/qadmin.js
Normal file
128
eachPageModule/qadmin.js
Normal file
@@ -0,0 +1,128 @@
|
||||
/*
|
||||
* qadmin 함수 정의
|
||||
*/
|
||||
|
||||
window.kon = window.kon || {}
|
||||
|
||||
kon.qadmin = (function () {
|
||||
|
||||
function fn_make_qadmin_frame(){
|
||||
var param = setparam("s","QUESTIONLIST",{"PKEY":code});
|
||||
questionlist = ajax_returnData(ajaxUrl, param);
|
||||
|
||||
param = setparam("s","STRUCTURE",{"PKEY":code});
|
||||
|
||||
var div = createnode("div","",{"class":"col-2","style":"overflow-y:scroll;max-height:840px"})
|
||||
var div2 = createnode("div","",{"class":"col-10", "id":"select_qadmin" ,"style":"overflow-y:scroll;max-height:840px"})
|
||||
var table = createnode("TABLE","",{"class":"text-center table table-sm table-striped table-bordered"});
|
||||
var listid = ID();
|
||||
var input = createnode("input","",{"type":"text","list":listid,"id":"qadmin_list" ,"style":"width:120px;","class":"ml-1","autocomplete":"off"});
|
||||
var dlist = questionlist.map(function(ele){return createnode("option", ele.QID + "[" + ele.variable + "]" ,{"value":ele.QID})});
|
||||
var datalist = createnode("datalist",dlist,{"id":listid});
|
||||
|
||||
var rota = createnode("input","",{"type":"radio","name":"qadmin_type","value":"rota"});
|
||||
var rotalable = createnode("label","로테이션",{"class":"ml-2 text-left"})
|
||||
rotalable.appendChild(rota);
|
||||
var group = createnode("input","",{"type":"radio","name":"qadmin_type","value":"qgroup"});
|
||||
var grouplabel = createnode("label","그룹",{"class":"ml-2 text-left"})
|
||||
grouplabel.appendChild(group);
|
||||
var copy = createnode("input","",{"type":"radio","name":"qadmin_type","value":"copy"});
|
||||
var copylabel = createnode("label","복사",{"class":"ml-2 text-left"});
|
||||
copylabel.appendChild(copy);
|
||||
|
||||
$("#mtop")
|
||||
.append(input)
|
||||
.append(datalist)
|
||||
.append(rotalable)
|
||||
.append(grouplabel)
|
||||
.append(copylabel)
|
||||
|
||||
|
||||
questionlist.forEach(function(ele){
|
||||
var tr = createnode("TR","");
|
||||
var checkbox = createnode("input","",{"type":"checkbox","name":ele.QID,"class":"qadmin_item ml-1","data-id":ele.QID , "data-variable":ele.variable });
|
||||
$(checkbox).prop("disabled",true);
|
||||
var label = createnode("label",ele.QID + "[" + ele.variable + "]");
|
||||
var td = createnode("TD","");
|
||||
label.appendChild(checkbox);
|
||||
td.appendChild(label);
|
||||
tr.appendChild(td);
|
||||
table.appendChild(tr);
|
||||
});
|
||||
|
||||
div.appendChild(table);
|
||||
$("#mcontent").append(div).append(div2);
|
||||
|
||||
}
|
||||
|
||||
function fn_make_qadmin_selection(type){
|
||||
$("input:checkbox").prop("checked",false);
|
||||
if(type !== "copy") {
|
||||
var div_top = createnode("DIV","");
|
||||
var addbtn = createnode("BUTTON","추가",{"class": gstyle.btn.primary + " add_qlist "});
|
||||
var savebtn = createnode("BUTTON","저장",{"class": gstyle.btn.success + " save_qlist "});
|
||||
|
||||
div_top.appendM([addbtn,savebtn]);
|
||||
var a = array_filter_to_group(questionlist,type);
|
||||
|
||||
var keys = Object.keys(a).filter(function(v){ if(v !== "undefined" && v !== "") return true});
|
||||
|
||||
if(keys.length > 0){
|
||||
$("#select_qadmin")
|
||||
.html("")
|
||||
.append(div_top)
|
||||
.append(qbox);
|
||||
keys.forEach(function(key){
|
||||
var qbox = createnode("DIV","",{"class":"w-100 m-1 p-1 shadow-sm border rounded text-danger"});
|
||||
var label = createnode("SPAN","- "+key+" -",{"class":"m-1"});
|
||||
var closeicon = createnode("BUTTON","삭제",{"class": gstyle.btn.danger + " qadmin_delete" })
|
||||
qbox.appendChild(label);
|
||||
qbox.appendChild(closeicon);
|
||||
var qlistbox = createnode("DIV","",{"class":"w-100 p-2 text-left shadow-sm border rounded text-secondary select_qlist","data-order":key});
|
||||
a[key].forEach(function(v,i){
|
||||
var item = createnode("DIV","",{"class":"qadmin-selected-item d-inline-block text-center border-primary m-1 p-2 border rounded shadow-sm","data-id":v.QID,"data-variable":v.variable});
|
||||
var span = createnode("span","",{"class":"text-primary"});
|
||||
span.innerHTML = v.QID + "<br>[" + v.variable + "]";
|
||||
item.appendChild(span);
|
||||
qlistbox.appendChild(item);
|
||||
$("input[type=checkbox][data-id="+v.QID+"]").prop("checked",true);
|
||||
})
|
||||
qbox.appendChild(qlistbox);
|
||||
$("#select_qadmin").append(qbox)
|
||||
})
|
||||
} else {
|
||||
var label = createnode("SPAN","- 1 -",{"class":"m-1"});
|
||||
var closeicon = createnode("BUTTON","삭제",{"class": gstyle.btn.danger + " qadmin_delete" })
|
||||
var qbox = createnode("DIV","",{"class":"w-100 m-1 p-1 shadow-sm border rounded text-danger"});
|
||||
qbox.appendChild(label);
|
||||
qbox.appendChild(closeicon);
|
||||
var qlistbox = createnode("DIV","변수를 선택해주세요.",{"class":"w-100 p-2 text-left shadow-sm border rounded text-secondary select_qlist qlist_selection","data-order":"1"});
|
||||
qbox.appendChild(qlistbox);
|
||||
$("#select_qadmin")
|
||||
.html("")
|
||||
.append(div_top)
|
||||
.append(qbox);
|
||||
}
|
||||
} else {
|
||||
var div_top = createnode("DIV","");
|
||||
var addbtn = createnode("BUTTON","저장",{"class": gstyle.btn.primary,"id":"qadmin_copy_save"});
|
||||
var multiplelabel = createnode("label","배수 설정",{"class":"m-2 bg-light p-2 shadow-sm"})
|
||||
var setmultiple = createnode("INPUT","",{"type": "number","class":"form-control d-inline-block w-100 ","value":"1","name":"multiple_value" });
|
||||
multiplelabel.appendChild(setmultiple)
|
||||
div_top.appendM([addbtn,multiplelabel]);
|
||||
|
||||
var qlistbox = createnode("DIV","변수를 선택해주세요.",{"class":"w-100 p-2 text-left shadow-sm border rounded text-secondary select_qlist qlist_selection"});
|
||||
|
||||
$("#select_qadmin")
|
||||
.html("")
|
||||
.append(div_top)
|
||||
.append(qlistbox)
|
||||
}
|
||||
}
|
||||
|
||||
var module = {
|
||||
fn_make_qadmin_frame:fn_make_qadmin_frame,
|
||||
fn_make_qadmin_selection:fn_make_qadmin_selection
|
||||
}
|
||||
return module
|
||||
})();
|
||||
261
eachPageModule/qoption.js
Normal file
261
eachPageModule/qoption.js
Normal file
@@ -0,0 +1,261 @@
|
||||
/*
|
||||
* logic 함수 정의
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
window.kon = window.kon || {}
|
||||
|
||||
kon.qop = (function () {
|
||||
var qjson = ""
|
||||
var grouplist;
|
||||
var qlist = ""
|
||||
function fn_make_option_frame() {
|
||||
|
||||
var param = setparam("s", "QUESTIONLIST", { "PKEY": code });
|
||||
questionlist = ajax_returnData(ajaxUrl, param);
|
||||
param = setparam("s", "GROUPLIST", { "PKEY": code });
|
||||
kon.qop.grouplist = ajax_returnData(ajaxUrl, param);
|
||||
|
||||
var div = createnode("div", "", { "class": "col-2", "style": "overflow-y:scroll;max-height:840px","id":"left_qoption_list" })
|
||||
var div2 = createnode("div", "", { "class": "col-10 d-flex ", "id": "selectionoption", "style": "height:100%" })
|
||||
|
||||
var table = createnode("TABLE", "", { "class": "text-center table table-sm table-bordered", "id": "list_table" });
|
||||
|
||||
|
||||
var btn_reset = createnode("BUTTON", "선택 초기화", { "class": gstyle.btn.success + " p-1", "id": "option_refresh" })
|
||||
var btn_choose = createnode("BUTTON", "선택 완료", { "class": gstyle.btn.primary + " p-1", "id": "option_search" })
|
||||
|
||||
var listid = ID();
|
||||
var b = createnode("b","문항 검색")
|
||||
var input = createnode("input","",{"type":"text","list":listid,"id":"qoption_list" ,"style":"width:120px;","class":"ml-1","autocomplete":"off"});
|
||||
var dlist = questionlist.map(function(ele){return createnode("option", ele.QID + "[" + ele.variable + "]" ,{"value":ele.QID})});
|
||||
var datalist = createnode("datalist",dlist,{"id":listid});
|
||||
|
||||
|
||||
$("#mtop")
|
||||
.append(btn_reset)
|
||||
.append(btn_choose)
|
||||
.append(b)
|
||||
.append(input)
|
||||
.append(datalist)
|
||||
|
||||
$.getJSON("./store/question_type.json", function (qjson) {
|
||||
kon.qop.qjson = (qjson);
|
||||
})
|
||||
|
||||
div.appendChild(table);
|
||||
$("#mcontent")
|
||||
.append(div)
|
||||
.append(div2);
|
||||
fn_make_option_list();
|
||||
}
|
||||
|
||||
function fn_make_option_list() {
|
||||
|
||||
var group_list = array_filter_to_group(questionlist, "qgroup");
|
||||
var list = "";
|
||||
var table = document.getElementById("list_table");
|
||||
$(table).find("TR").remove();
|
||||
|
||||
list = array_filter_to_group(questionlist, "qtype");
|
||||
|
||||
Object.keys(kon.qop.grouplist).forEach(function (key, i) {
|
||||
var qidlist = group_list[key].map(function (v) { return v.QID }).join(",");
|
||||
if (!i) {
|
||||
var tr = createnode("TR", "");
|
||||
tr.appendChild(
|
||||
createnode("TD",
|
||||
"GROUP"
|
||||
, { "class": "p-2 bg-light question_item", "style": "vertical-align:middle" }
|
||||
)
|
||||
);
|
||||
table.appendChild(tr);
|
||||
}
|
||||
var tr = createnode("TR", "");
|
||||
tr.appendChild(
|
||||
createnode("TD",
|
||||
[form_inline_input("checkbox", key + "group_item", " GROUP [" + key + "]", { "name": "group" + key, "data-item": key, "class": "group_item", "data-stype": kon.qop.grouplist[key].stype, "data-qlist": qidlist })]
|
||||
, { "class": "p-2 question_item", "style": "vertical-align:middle" }
|
||||
)
|
||||
);
|
||||
table.appendChild(tr);
|
||||
table.appendChild(tr);
|
||||
|
||||
})
|
||||
|
||||
Object.keys(list).sort(function (a, b) { return a > b ? 1 : -1 }).forEach(function (key) {
|
||||
var tr = createnode("TR", "");
|
||||
tr.appendChild(
|
||||
createnode("TD",
|
||||
[form_inline_input("radio", key + "_radio", key, { "name": "qtype", "value": key })]
|
||||
, { "class": "p-2 bg-light question_item", "style": "vertical-align:middle" }
|
||||
)
|
||||
);
|
||||
table.appendChild(tr);
|
||||
list[key].forEach(function (ele) {
|
||||
var tr = createnode("TR", "");
|
||||
tr.appendChild(
|
||||
createnode("TD",
|
||||
[form_inline_input("checkbox", ele.QID + "_item", ele.QID + " [" + ele.variable + "]", { "name": ele.QID, "data-item": ele.QID, "data-type": key })]
|
||||
, { "class": "p-2 question_item", "style": "vertical-align:middle" }
|
||||
)
|
||||
);
|
||||
table.appendChild(tr);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function selected_list() {
|
||||
$("#selectionoption").html("");
|
||||
list = Array.from($("input:checkbox:checked:not(.group_item)").map(function (id, ele) { return "'" + ele.getAttribute("name") + "'" })).join(",");
|
||||
kon.qop.qlist = createnode("DIV", "", { "class": "w-25 d-inline-flex flex-column p-1 border m-1", "style":"max-height:840px", "id": "question_list" });
|
||||
|
||||
var qlist = kon.qop.qlist
|
||||
var targetdiv = createnode("DIV", "", { "class": "w-75 d-inline-flex flex-column m-1 border p-1", "style":"max-height:840px", "id": "question_body" });
|
||||
var title = createnode("SPAN", "선택 문항 목록", { "class": "border border-dark rounded text-center shadow-sm h-2 m-1 p-1" });
|
||||
var savebtn = createnode("SPAN", "저 장", { "class": "border border-success text-success rounded text-center shadow-sm h-2 m-1 p-1", "id": "save_option" });
|
||||
qlist.appendChild(title);
|
||||
qlist.appendChild(savebtn);
|
||||
$("#selectionoption").append(qlist);
|
||||
$("#selectionoption").append(targetdiv);
|
||||
|
||||
if (!list) return false;
|
||||
var param = setparam("s", "OPTIONSELECTED", { "PKEY": code, "list": list });
|
||||
optionlist = ajax_returnData(ajaxUrl, param);
|
||||
optionlist = array_filter_to_group(optionlist, "qtype");
|
||||
|
||||
var json = kon.qop.qjson;
|
||||
|
||||
Object.keys(optionlist).forEach(function (key) {
|
||||
var design = json[key];
|
||||
|
||||
var option = Object.keys(design).map(function (key2, id) {
|
||||
if (typeof (design[key2]) === "string") {
|
||||
return createnode("OPTION", key2 + "-" + design[key2], { "value": key2 });
|
||||
} else {
|
||||
return createnode("OPTION", key2 + "-" + design[key2].explain, { "value": key2 });
|
||||
}
|
||||
});
|
||||
|
||||
var item = createnode("div", "", { "class": "p-1 mb-1 border border-warning rounded shadow-sm" });
|
||||
var vtext = createnode("span", key, { "class": "text-dark h-2" });
|
||||
item.appendChild(vtext);
|
||||
|
||||
var vselect = createnode("SELECT", "", { "class": "form-control float-right d-inline-block mt-1 mb-1 itemgroup", "data-type": key });
|
||||
vselect.appendChild(createnode("OPTION", "선택", { "value": "" }));
|
||||
vselect.appendM(option);
|
||||
|
||||
item.appendChild(vselect);
|
||||
qlist.appendChild(item);
|
||||
|
||||
optionlist[key].forEach(function (ele) {
|
||||
var option = Object.keys(design).map(function (key2, id) {
|
||||
if (typeof (design[key2]) === "string") {
|
||||
return createnode("OPTION", key2 + "-" + design[key2], { "value": key2 });
|
||||
} else {
|
||||
var attr = {}
|
||||
attr["value"] = key2;
|
||||
if(Array.isArray(design[key2].option)){
|
||||
attr["data-multiple"] = "1"
|
||||
design[key2].option.forEach(function(item,index){
|
||||
attr["data-option-"+index] = item.name
|
||||
attr["data-explain-"+index] = item.explain
|
||||
attr["data-value-"+index] = ele.opt[item.name] || "";
|
||||
})
|
||||
} else {
|
||||
attr["data-multiple"] = "0"
|
||||
attr["data-option"] = design[key2].option.name;
|
||||
attr["data-explain"] = design[key2].option.explain;
|
||||
attr["data-value"] = ele.opt[design[key2].option.name] || ""
|
||||
}
|
||||
return createnode("OPTION", key2 + "-" + design[key2].explain, attr);
|
||||
}
|
||||
});
|
||||
var item = createnode("div", "", { "class": "qitem p-1 mb-1 border border-primary rounded shadow-sm", "data-qid": ele.QID, "data-variable": ele.variable });
|
||||
var vtext = createnode("span", ele.variable, { "class": "text-primary" });
|
||||
var vtext2 = createnode("span", ele.explain, { "class": "text-success ml-2" });
|
||||
|
||||
item.appendChild(vtext);
|
||||
item.appendChild(vtext2);
|
||||
var vselect = createnode("SELECT", "", { "class": "form-control float-right mt-1 mb-1 d-inline-block ", "data-type": key });
|
||||
vselect.appendChild(createnode("OPTION", "선택", { "value": "" }));
|
||||
vselect.appendM(option);
|
||||
$(vselect).val(ele.stype);
|
||||
item.appendChild(vselect);
|
||||
qlist.appendChild(item);
|
||||
fn_change_optionselect(vselect);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
function selected_list_group() {
|
||||
var group_item = $(".group_item:checked")
|
||||
group_item = Array.from($(".group_item:checked").map(function (id, ele) { return "'" + ele.getAttribute("data-item") + "'" })).join(",");
|
||||
if (!group_item) return false;
|
||||
var qlist = kon.qop.qlist
|
||||
var json = kon.qop.qjson;
|
||||
var design = json["group"];
|
||||
|
||||
var param = setparam("s", "OPTIONSELECTED_GROUP", { "PKEY": code, "list": group_item });
|
||||
optionlist = ajax_returnData(ajaxUrl, param);
|
||||
|
||||
var option = Object.keys(design).map(function (key2, id) {
|
||||
if (typeof (design[key2]) === "string") {
|
||||
return createnode("OPTION", key2 + "-" + design[key2], { "value": key2 });
|
||||
} else {
|
||||
return createnode("OPTION", key2 + "-" + design[key2].explain, { "value": key2 });
|
||||
}
|
||||
});
|
||||
|
||||
var item = createnode("div", "", { "class": "p-1 mb-1 border border-warning rounded shadow-sm" });
|
||||
var vtext = createnode("span", "group" , { "class": "text-dark h-2" });
|
||||
item.appendChild(vtext);
|
||||
|
||||
var vselect = createnode("SELECT", "", { "class": "form-control float-right d-inline-block mt-1 mb-1 itemgroup", "data-type": "group" });
|
||||
vselect.appendChild(createnode("OPTION", "선택", { "value": "" }));
|
||||
vselect.appendM(option);
|
||||
|
||||
item.appendChild(vselect);
|
||||
qlist.appendChild(item);
|
||||
optionlist.forEach(function (ele) {
|
||||
|
||||
var option = Object.keys(design).map(function (key2, id) {
|
||||
if (typeof (design[key2]) === "string") {
|
||||
return createnode("OPTION", key2 + "-" + design[key2], { "value": key2 });
|
||||
} else {
|
||||
var attr = {}
|
||||
attr["value"] = key2;
|
||||
attr["data-option"] = design[key2].option.name;
|
||||
attr["data-explain"] = design[key2].option.explain;
|
||||
attr["data-value"] = ele.opt[design[key2].option.name] || ""
|
||||
return createnode("OPTION", key2 + "-" + design[key2].explain, attr);
|
||||
}
|
||||
});
|
||||
|
||||
var item = createnode("div", "", { "class": "qitem_group p-1 mb-1 border border-primary rounded shadow-sm", "data-qid": ele.key, "data-variable": ele.key });
|
||||
var vtext = createnode("span", ele.key , { "class": "text-primary" });
|
||||
var vtext2 = createnode("span", "그룹 - " + ele.key, { "class": "text-success ml-2" });
|
||||
item.appendChild(vtext);
|
||||
item.appendChild(vtext2);
|
||||
var vselect = createnode("SELECT", "", { "class": "form-control float-right mt-1 mb-1 d-inline-block ", "data-type": "group" });
|
||||
vselect.appendChild(createnode("OPTION", "선택", { "value": "" }));
|
||||
vselect.appendM(option);
|
||||
$(vselect).val(ele.type);
|
||||
item.appendChild(vselect);
|
||||
qlist.appendChild(item);
|
||||
fn_change_optionselect(vselect);
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
var module = {
|
||||
fn_make_option_frame: fn_make_option_frame,
|
||||
fn_make_option_list: fn_make_option_list,
|
||||
selected_list: selected_list,
|
||||
selected_list_group: selected_list_group
|
||||
}
|
||||
|
||||
return module
|
||||
})();
|
||||
470
eachPageModule/qprogress.js
Normal file
470
eachPageModule/qprogress.js
Normal file
@@ -0,0 +1,470 @@
|
||||
/*
|
||||
* qprogress 함수 정의
|
||||
*/
|
||||
|
||||
window.kon = window.kon || {}
|
||||
|
||||
kon.qprogress = (function () {
|
||||
var structure_list
|
||||
var userid
|
||||
var progress_type = ""
|
||||
var codemirror = {
|
||||
target : "",
|
||||
text : "",
|
||||
sc : "", // start_index
|
||||
ec : "", // end_index
|
||||
qid : ""
|
||||
}
|
||||
var now_page = ""
|
||||
var prev_page = ""
|
||||
|
||||
function fn_make_qprogress_frame() {
|
||||
var param = setparam("s","QUESTIONLIST",{"PKEY":code});
|
||||
|
||||
questionlist = ajax_returnData(ajaxUrl, param);
|
||||
param = setparam("s","STRUCTURE",{"PKEY":code});
|
||||
structure_list = ajax_returnData(ajaxUrl,param);
|
||||
$("#question_dialog").remove();
|
||||
$("#data_dialog").remove();
|
||||
|
||||
$("#mcontent").append(make_question_diagram()) //question diagram 추가
|
||||
|
||||
$("#mcontent").append(make_data_diagram()) //data diagram 추가
|
||||
|
||||
if(kon.qprogress.progress_type === "admin") {
|
||||
if(!kon.qprogress.codemirror.target)
|
||||
kon.qprogress.codemirror.target = make_code_mirror() // codemirror 생성
|
||||
}
|
||||
|
||||
|
||||
var survey_div = createnode("DIV","",{"style":"height:880px", "class":"offset-2 col-xl-8 border rounded shadow-sm position-relative"});
|
||||
var qlistbtn = createnode("div","문항 목록",{"class":"p-1 m-1 border-bottom border-right rounded d-inline-block shadow-sm iframe-btn","data-type":"question"});
|
||||
var dlistbtn = createnode("div","데이터 목록",{"class":"p-1 m-1 border-bottom border-right rounded d-inline-block shadow-sm iframe-btn","data-type":"data"});
|
||||
var slistbtn = createnode("div","랜덤 ID 생성",{"class":"p-1 m-1 border-bottom border-right rounded d-inline-block shadow-sm iframe-btn","data-type":"makeid"});
|
||||
var directly_box = createnode("DIV","",{"class":"p-1 m-1 border rounded d-inline-block"});
|
||||
var directly_input = createnode("INPUT","",{"type":"text","class":"m-1 form-control form-control-sm d-inline-block w-50","placeholder":"ID 입력","name":"direct_id"});
|
||||
var directly_btn = createnode("BUTTON","ID 변경",{"class":"m-1 btn btn-sm btn-outline-primary","name":"direct_btn"});
|
||||
directly_box.appendM([directly_input,directly_btn]);
|
||||
var list_id_div = createnode("div","ID",{"class":"p-1 m-1 bg-white border rounded float-right text-primary","id":"qprocess-id"});
|
||||
survey_div.appendM([qlistbtn,dlistbtn,slistbtn,list_id_div, directly_box]);
|
||||
|
||||
var iframe_top = createnode("div","",{"class":"p-1 bg-white"})
|
||||
|
||||
var type_desktop = createnode("small","데스크 탑",{ "class":"m-1 p-1 border border-secondary qprogress-view-type","data-type":"desktop"});
|
||||
var type_mobile_width = createnode("small","모바일 세로",{"class":"m-1 p-1 border border-secondary qprogress-view-type","data-type":"mobile-height"});
|
||||
var type_mobile_height = createnode("small","모바일 가로",{"class":"m-1 p-1 border border-secondary qprogress-view-type","data-type":"mobile-width"});
|
||||
var listid = ID();
|
||||
var input = createnode("input","",{"type":"text","list":listid,"id":"qprogress_list" ,"style":"width:120px;","class":"ml-1","placeholder":"변수명 입력","autocomplete":"off"});
|
||||
var dlist = questionlist.map(function(ele){return createnode("option", ele.QID + "[" + ele.variable + "]" ,{"value":ele.QID})});
|
||||
var datalist = createnode("datalist",dlist,{"id":listid});
|
||||
var search_div = createnode("DIV",[input,datalist],{"class":"p-2 d-inline-block"});
|
||||
var auto_chk_label = createnode("label","응답값 자동 입력[랜덤]",{"for":"auto_chk","class":"p-1 border rounded bg-white"});
|
||||
var small_label = createnode("small","순위ㆍ오픈 문항 제외, 복수 문항 체크 안될 경우 있음",{"class":"text-danger d-block"});
|
||||
var auto_chk = createnode("input","",{"type":"checkbox","id":"auto_chk"});
|
||||
auto_chk_label.appendM([auto_chk,small_label]);
|
||||
iframe_top.appendM([type_desktop,type_mobile_height,type_mobile_width,search_div, auto_chk_label]);
|
||||
survey_div.appendChild(iframe_top)
|
||||
|
||||
var iframediv = createnode("div","",{"style":"height:calc(100% - 110px)","class":"bg-light text-center w-100 align-middle"});
|
||||
var iframe = createnode("iframe","",{"class":"border-0 shadow-sm bg-white shadow-lg","style":"height:calc(100% - 15px);width:100%","id":"iframe_question"})
|
||||
var this_url = window.location.href;
|
||||
var slash_index = this_url.indexOf("/",10);
|
||||
this_url = this_url.slice(0,slash_index)+"/project/"+code+"/index.asp?ST=TEST"
|
||||
iframe.setAttribute("src",this_url);
|
||||
iframediv.appendChild(iframe);
|
||||
survey_div.appendChild(iframediv)
|
||||
|
||||
$("#mcontent").append(survey_div);
|
||||
|
||||
$(function () {
|
||||
$("#question_dialog").dialog({
|
||||
position: {
|
||||
my: "left top",
|
||||
at: "left top",
|
||||
of: "#mframe",
|
||||
},
|
||||
height: 640,
|
||||
width: 300
|
||||
}).dialogExtend({
|
||||
"minimizable": true,
|
||||
"collapsable": true,
|
||||
"dblclick": "collapse"
|
||||
});
|
||||
|
||||
$("#data_dialog").dialog({
|
||||
position: {
|
||||
my: "right top",
|
||||
at: "right top",
|
||||
of: "#mframe",
|
||||
},
|
||||
height: 640,
|
||||
width: 300
|
||||
}).dialogExtend({
|
||||
"minimizable": true,
|
||||
"collapsable": true,
|
||||
"dblclick": "collapse"
|
||||
});
|
||||
$("#data_dialog").addClass("bg-light")
|
||||
|
||||
$("#iframe_question").on("load", function (e) {
|
||||
var frameTarget = e.target;
|
||||
setTimeout(function () {
|
||||
/*
|
||||
kon이 js로 Document를 그리기 때문에 load이후로 그려지면.
|
||||
값을 정확히 못가져오는 경우가 발생.
|
||||
셋타임 아웃 설정하면 Event Queue 에 들어감.
|
||||
Event Queue에 들어가면 Call Stack이 비어있어야 실행시킴.
|
||||
*/
|
||||
var $content = $(frameTarget.contentDocument);
|
||||
var framewindow = frameTarget.contentWindow;
|
||||
var userdata = framewindow.kon.survey.userdata;
|
||||
var variable = framewindow.kon.group.variable; // 그룹 variable
|
||||
var pagename
|
||||
|
||||
|
||||
if(!variable) {
|
||||
pagename = $content.find("input[name=PAGENAME]").val();
|
||||
} else {
|
||||
pagename = variable[0]
|
||||
}
|
||||
|
||||
if(kon.qprogress.now_page !== undefined) {
|
||||
kon.qprogress.prev_page = kon.qprogress.now_page
|
||||
}
|
||||
|
||||
if(["INDEX","END","SCREEN","QUOTA","CLOSE","PREV"].indexOf(pagename) === -1) kon.qprogress.now_page = !variable ? pagename : variable.join(",");
|
||||
|
||||
if(kon.qprogress.prev_page !== undefined) {
|
||||
kon.qprogress.prev_page.split(",").forEach(function(qid){
|
||||
var prev_data = framewindow.kon.survey.getValue(qid,"mn");
|
||||
prev_data = prev_data.gmap(function(item){
|
||||
var value = Object.keys(item).map(function(key){return item[key] !== "" ? key : ""}).join("");
|
||||
|
||||
return value === "" ? false : value
|
||||
})
|
||||
var $target = $(".qprogress-data-item[data-qid="+qid+"]");
|
||||
|
||||
if(prev_data.length > 0){
|
||||
var tooltip_label_html = prev_data.map(function(key){
|
||||
return "<small class='text-primary d-block' style='word-break : nowrap;'>" + key + " : " + framewindow.kon.survey.getResValue(key) + "</small>"
|
||||
}).join("")
|
||||
|
||||
if( $target.attr("data-exist") === "true" ) {
|
||||
$target.tooltip("destroy")
|
||||
}
|
||||
|
||||
$target
|
||||
.attr({"title":tooltip_label_html,"data-exist":"true"})
|
||||
.tooltip({
|
||||
position : { my : "left+5 top-5", at : "right" ,of : ".variable-box[data-qid="+qid+"]"},
|
||||
content : function() { return $(this).prop("title")}
|
||||
})
|
||||
|
||||
} else {
|
||||
if( $target.attr("data-exist") === "true" ) {
|
||||
$target
|
||||
.attr({"data-exist":"false","title":""})
|
||||
.tooltip("destroy")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
kon.qprogress.userid = $content.find("input[name=IDKEY]").val();
|
||||
$content.find("input[name=RESTYPE]").val("TEST")
|
||||
$("#qprocess-id").text(kon.qprogress.userid)
|
||||
if (["INDEX","END","SCREEN","QUOTA","CLOSE","PREV"].indexOf(pagename) === -1) {
|
||||
/* 문항 목록 */
|
||||
var a = $("#question_dialog").find(".variable-box[data-qid=" + pagename + "]");
|
||||
$(".preved-variable-box").removeClass("preved-variable-box")
|
||||
$(".selected-variable-box").removeClass("selected-variable-box").addClass("preved-variable-box");
|
||||
a.addClass("selected-variable-box");
|
||||
var scrollto = a.position().top + $("#question_dialog").scrollTop() - 10
|
||||
$("#question_dialog").animate({
|
||||
"scrollTop": scrollto
|
||||
})
|
||||
$("#prev-data-box").remove()
|
||||
/* 문항 목록 */
|
||||
|
||||
/* 데이터 목록 */
|
||||
$("#data-box").attr("id", "prev-data-box").find(".usercheck_value").removeClass("usercheck_value")
|
||||
|
||||
var qinfo_box = createnode("div", "", { "class": "bg-white border rounded p-1 mb-1 shadow-sm", "id": "data-box", "data-qid": pagename })
|
||||
var qinfo_label = createnode("small", pagename, { "class": "text-primary border-bottom d-block" })
|
||||
qinfo_box.appendChild(qinfo_label);
|
||||
var variable_input
|
||||
if(!variable) {
|
||||
variable_input = $content.find("[name^=" + pagename + "], [name^=T" + pagename + "]").get();
|
||||
} else {
|
||||
var group_variable_input = variable.map(function(pagename){
|
||||
return "[name^=" + pagename + "], [name^=T" + pagename + "]"
|
||||
}).join(", ")
|
||||
variable_input = $content.find(group_variable_input).get();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
var vgroup = array_filter_to_group(variable_input, "name");
|
||||
|
||||
var auto_option = document.getElementById("auto_chk").checked;
|
||||
Object.keys(vgroup).forEach(function (key) {
|
||||
var qvariable_group = createnode("div", "", { "class": "m-1 border d-inline-block rounded question-list-box", "data-vid": key, "data-vtype": vgroup[key][0].type });
|
||||
var qvariable_group_label = createnode("small", key, { "class": "text-danger border-bottom d-block p-1" });
|
||||
qvariable_group.appendChild(qvariable_group_label);
|
||||
var qvariable_group_item_group = createnode("div", "", { "class": "p-1 question-data" });
|
||||
var type = "";
|
||||
var vgroupboolean = true;
|
||||
var group_type = vgroup[key][0].type;
|
||||
if ( group_type === "radio" || group_type === "checkbox") {
|
||||
vgroup[key].forEach(function (ele, id) {
|
||||
if (id) {
|
||||
if (type !== ele.type)
|
||||
vgroupboolean = false;
|
||||
}
|
||||
var variable_item = createnode("div", ele.value, { "class": "border m-1 p-1 variable-value d-inline-block", "data-value": ele.value });
|
||||
qvariable_group_item_group.appendChild(variable_item);
|
||||
type = ele.type;
|
||||
})
|
||||
if(auto_option) {
|
||||
if(group_type === "radio"){
|
||||
shuffle(vgroup[key]);
|
||||
$(vgroup[key][0]).trigger("click");
|
||||
} else {
|
||||
var bools = Math.floor(Math.random()*2);
|
||||
if(bools) /* false면 click */
|
||||
$(vgroup[key][0]).trigger("click");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!vgroupboolean)
|
||||
qvariable_group_label.innerText = qvariable_group_label.innerText + " [ERROR] "
|
||||
|
||||
qvariable_group.appendChild(qvariable_group_item_group)
|
||||
qinfo_box.appendChild(qvariable_group)
|
||||
})
|
||||
|
||||
$("#data_dialog").prepend(qinfo_box);
|
||||
|
||||
$("#data-box").find(".question-list-box").each(function (id, ele) {
|
||||
var vid = ele.getAttribute("data-vid");
|
||||
var vtype = ele.getAttribute("data-vtype");
|
||||
if (userdata[vid]) {
|
||||
if (vtype === "radio") {
|
||||
$(ele).find("[data-value=" + userdata[vid] + "]").addClass("usercheck_value");
|
||||
} else if (vtype === "checkbox") {
|
||||
$(ele).find(".variable-value").addClass("usercheck_value");
|
||||
} else {
|
||||
$(ele).find(".question-data").text(userdata[vid]);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
$("#prev-data-box").find(".question-list-box").each(function (id, ele) {
|
||||
var vid = ele.getAttribute("data-vid");
|
||||
var vtype = ele.getAttribute("data-vtype");
|
||||
|
||||
if (userdata[vid]) {
|
||||
if (vtype === "radio") {
|
||||
$(ele).find("[data-value=" + userdata[vid] + "]").addClass("usercheck_value");
|
||||
} else if (vtype === "checkbox") {
|
||||
$(ele).find(".variable-value").addClass("usercheck_value");
|
||||
} else {
|
||||
$(ele).find(".question-data").text(userdata[vid]);
|
||||
}
|
||||
}
|
||||
})
|
||||
/* 데이터 목록 */
|
||||
|
||||
}
|
||||
}, 10) /* setTimeout */
|
||||
})
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function make_data_diagram(){
|
||||
var dialog = createnode("div","",{"id":"data_dialog","title":"데이터 목록"});
|
||||
return dialog
|
||||
}
|
||||
|
||||
function make_code_mirror(){
|
||||
var codemirror = document.getElementById("for_codemirror")
|
||||
var myCoedMirror = CodeMirror.fromTextArea(codemirror);
|
||||
return myCoedMirror
|
||||
}
|
||||
|
||||
function fn_save_code_mirror(qid){
|
||||
var codemirror = kon.qprogress.codemirror
|
||||
var t = codemirror.target.getValue();
|
||||
if(qid === "INDEX"){
|
||||
var iStIdx = codemirror.text.findIndex(function(o){ return o.trim() == "if(qid === \"INDEX\"){"; });
|
||||
var iEdIdx = codemirror.text.findIndex(function(o){ return o.trim() == "}// INDEX"; });
|
||||
if(iStIdx > -1){
|
||||
codemirror.text.splice(iStIdx+1,(iEdIdx-1) - iStIdx, t);
|
||||
}else{
|
||||
t = "if(qid === \"INDEX\"){\n" + t + "\n}// INDEX"
|
||||
var switchIdx = codemirror.text.findIndex(function(o){ return o.trim() == "switch(qid){"; });
|
||||
codemirror.text.splice(switchIdx,0,t);
|
||||
}
|
||||
}else if(qid === "ALL"){
|
||||
var aStIdx = codemirror.text.findIndex(function(o){ return o.trim() == "if(qid === \"ALL\"){"; });
|
||||
var aEdIdx = codemirror.text.findIndex(function(o){ return o.trim() == "}// ALL"; });
|
||||
if(aStIdx > -1){
|
||||
codemirror.text.splice(aStIdx+1,(aEdIdx-1) - aStIdx, t);
|
||||
}else{
|
||||
t = "if(qid === \"ALL\"){\n" + t + "\n}// ALL"
|
||||
codemirror.text.splice(1,0,t);
|
||||
}
|
||||
}else if(qid === "END"){
|
||||
var iStIdx = codemirror.text.findIndex(function(o){ return o.trim() == "if(qid === \"END\"){"; });
|
||||
var iEdIdx = codemirror.text.findIndex(function(o){ return o.trim() == "}// END"; });
|
||||
if(iStIdx > -1){
|
||||
codemirror.text.splice(iStIdx+1,(iEdIdx-1) - iStIdx, t);
|
||||
}else{
|
||||
t = "if(qid === \"END\"){\n" + t + "\n}// END"
|
||||
var switchIdx = codemirror.text.findIndex(function(o){ return o.trim() == "switch(qid){"; });
|
||||
codemirror.text.splice(switchIdx,0,t);
|
||||
}
|
||||
}else{
|
||||
if(codemirror.sc > -1) {
|
||||
codemirror.text.splice(codemirror.sc+1,(codemirror.ec-1) - codemirror.sc, t);
|
||||
} else {
|
||||
t = "case \""+qid+"\" :\n" + t + "\n break;//"+qid
|
||||
var switchIdx = codemirror.text.findIndex(function(o){ return o.trim() == "switch(qid){"; });
|
||||
codemirror.text.splice(switchIdx+1,0,t);
|
||||
}
|
||||
}
|
||||
var text = codemirror.text.join("\n");
|
||||
codemirror.target.setValue("")
|
||||
ajax_call("./include/ajax_func.asp",{"COMMAND":"WRITEHARDTEXT","PKEY":code,"TEXT":text},"저장했습니다.");
|
||||
$("#codemirror_modal").css("display","none")
|
||||
}
|
||||
|
||||
function make_question_diagram(){
|
||||
var dialog = createnode("div","",{"id":"question_dialog","title":"문항 목록"});
|
||||
var group_div = ""
|
||||
var prev_group = ""
|
||||
/* INDEX 버튼 추가 */
|
||||
var index_box = createnode("div","",{"class":"m-1 rounded shadow-sm align-content-center d-flex flex-column"});
|
||||
var variable_index = createnode("div","",{"class":"w-100 p-1 bg-light border variable-box","data-qid":"INDEX","style":"cursor:pointer"})
|
||||
var small_index = createnode("small","[ INDEX ]",{"class":"text-primary"});
|
||||
var button_box = createnode("div","",{"class":"w-100 p-1 bg-white border d-flex flex-row"})
|
||||
var indexhard = createnode("div","코딩",{"style":"font-size:12px;","class":"w-25 border rounded text-center qprogress-hard-item","data-qid":"INDEX"})
|
||||
button_box.appendChild(indexhard);
|
||||
var marginFill = createnode("div","",{"class":"d-flex flex-fill"})
|
||||
button_box.appendChild(marginFill);
|
||||
var allhard = createnode("div","전체문항코딩",{"style":"font-size:12px;","class":"w-50 border rounded text-center qprogress-hard-item","data-qid":"ALL"})
|
||||
button_box.appendChild(allhard);
|
||||
|
||||
variable_index.appendChild(small_index)
|
||||
index_box.appendM([variable_index,button_box]);
|
||||
dialog.appendChild(index_box)
|
||||
|
||||
questionlist.forEach(function(ele){
|
||||
var dialog_item_box = createnode("div","",{"class":"m-1 rounded shadow-sm align-content-center d-flex flex-column"});
|
||||
var variable_box = createnode("div","",{"class":"w-100 p-1 bg-light border variable-box","data-qid":ele.QID})
|
||||
var button_box = createnode("div","",{"class":"w-100 p-1 bg-white border d-flex flex-row"})
|
||||
var small = createnode("small",ele.QID + "[" + ele.variable + "]",{"class":"text-primary"});
|
||||
$(variable_box)
|
||||
.attr({"title":ele.title,"data-exist":"true"})
|
||||
.tooltip({
|
||||
position : { my : "left+5 top-5", at : "right" ,of : ".variable-box[data-qid="+ele.QID+"]"},
|
||||
content : function() { return "<small>" + $(this).prop("title") + "</small>" }
|
||||
})
|
||||
|
||||
variable_box.appendChild(small)
|
||||
|
||||
if(ele.explain) {
|
||||
var explain = createnode("div",ele.explain,{
|
||||
"data-toggle":"tooltip",
|
||||
"data-placement":"bottom",
|
||||
"title":ele.explain,
|
||||
"style":"overflow: hidden;font-size: 12px;white-space: nowrap;text-overflow: ellipsis;cursor: default;"
|
||||
});
|
||||
variable_box.appendChild(explain)
|
||||
}
|
||||
|
||||
|
||||
if(kon.qprogress.progress_type === "admin") {
|
||||
var hard = createnode("div","코딩",{"style":"font-size:12px;","class":"w-25 border rounded text-center qprogress-hard-item","data-qid":ele.QID})
|
||||
button_box.appendChild(hard);
|
||||
|
||||
var change = createnode("div","변경",{"style":"font-size:12px;","class":"ml-1 w-25 border rounded text-center qprogress-change-item","data-code":ele.QID})
|
||||
button_box.appendChild(change);
|
||||
|
||||
var data = createnode("div", "데이터", { "style": "font-size:12px;cursor:default", "class": "ml-1 w-25 border rounded text-center qprogress-data-item", "data-qid": ele.QID})
|
||||
|
||||
button_box.appendChild(data);
|
||||
}
|
||||
|
||||
var move = createnode("div","이동",{"style":"font-size:12px;","class":"ml-1 w-25 border rounded text-center qprogress-item","data-qid":ele.QID})
|
||||
button_box.appendChild(move);
|
||||
|
||||
|
||||
dialog_item_box.appendM([variable_box,button_box]);
|
||||
|
||||
|
||||
if(ele.qgroup) {
|
||||
if(prev_group === ele.qgroup) {
|
||||
group_div.appendChild(dialog_item_box)
|
||||
} else {
|
||||
if(prev_group) {
|
||||
dialog.appendChild(group_div)
|
||||
group_div = ""
|
||||
}
|
||||
prev_group = ele.qgroup
|
||||
group_div = createnode("div",[createnode("small","GROUP["+ele.qgroup+"]")],{"class":"p-1 border border-success rounded"});
|
||||
group_div.appendChild(dialog_item_box)
|
||||
}
|
||||
} else {
|
||||
if(prev_group) {
|
||||
dialog.appendChild(group_div)
|
||||
group_div = ""
|
||||
dialog.appendChild(dialog_item_box)
|
||||
prev_group = ""
|
||||
} else {
|
||||
dialog.appendChild(dialog_item_box)
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
if(group_div)
|
||||
dialog.appendChild(group_div)
|
||||
|
||||
/* END 버튼 추가 */
|
||||
var END_box = createnode("div","",{"class":"m-1 rounded shadow-sm align-content-center d-flex flex-column"});
|
||||
var variable_index = createnode("div","",{"class":"w-100 p-1 bg-light border variable-box","data-qid":"END"})
|
||||
var small_index = createnode("small","[ END ]",{"class":"text-primary"});
|
||||
var button_box = createnode("div","",{"class":"w-100 p-1 bg-white border d-flex flex-row"})
|
||||
var ENDhard = createnode("div","코딩",{"style":"font-size:12px;","class":"w-25 mr-1 border rounded text-center qprogress-hard-item","data-qid":"END"})
|
||||
button_box.appendChild(ENDhard);
|
||||
|
||||
button_box.appendChild(createnode("div","END",{"style":"font-size:12px;","class":"w-auto px-1 border rounded text-center qprogress-item","data-qid":"END","data-etype":"END"}));
|
||||
button_box.appendChild(createnode("div","SCR",{"style":"font-size:12px;","class":"w-auto px-1 border rounded text-center qprogress-item","data-qid":"END","data-etype":"SCREEN"}));
|
||||
button_box.appendChild(createnode("div","QTO",{"style":"font-size:12px;","class":"w-auto px-1 border rounded text-center qprogress-item","data-qid":"END","data-etype":"QUOTA"}));
|
||||
button_box.appendChild(createnode("div","CLO",{"style":"font-size:12px;","class":"w-auto px-1 border rounded text-center qprogress-item","data-qid":"END","data-etype":"CLOSE"}));
|
||||
button_box.appendChild(createnode("div","PRV",{"style":"font-size:12px;","class":"w-auto px-1 border rounded text-center qprogress-item","data-qid":"END","data-etype":"PREV"}));
|
||||
|
||||
variable_index.appendChild(small_index)
|
||||
END_box.appendM([variable_index,button_box]);
|
||||
dialog.appendChild(END_box)
|
||||
|
||||
return dialog
|
||||
}
|
||||
|
||||
var module = {
|
||||
fn_make_qprogress_frame:fn_make_qprogress_frame,
|
||||
fn_save_code_mirror:fn_save_code_mirror,
|
||||
structure_list:structure_list,
|
||||
userid:userid,
|
||||
codemirror:codemirror,
|
||||
progress_type:progress_type
|
||||
|
||||
}
|
||||
return module
|
||||
|
||||
})();
|
||||
1432
eachPageModule/sv.js
Normal file
1432
eachPageModule/sv.js
Normal file
File diff suppressed because it is too large
Load Diff
1368
eachPageModule/sv.js_bak
Normal file
1368
eachPageModule/sv.js_bak
Normal file
File diff suppressed because it is too large
Load Diff
20
eachPageModule/upload.js
Normal file
20
eachPageModule/upload.js
Normal file
@@ -0,0 +1,20 @@
|
||||
window.kon = window.kon || {}
|
||||
|
||||
kon.upload = (function () {
|
||||
var EXCEL_LIST = ""
|
||||
function make_upload_form() {
|
||||
rightdiv.innerHTML = "";
|
||||
var top_div = createnode("div","",{"class":"p-1 m-1 border rounded shadow-sm border-secondary"})
|
||||
var language = createnode("button","번역 업로드",{"class":gstyle.btn.dark + " m-1","id":"upload_language"});
|
||||
var image = createnode("button","이미지 업로드",{"class":gstyle.btn.dark + " m-1","id":"upload_img"});
|
||||
var list = createnode("button","참석자 업로드",{"class":gstyle.btn.dark + " m-1","id":"upload_attendee"});
|
||||
top_div.appendM([language,image,list])
|
||||
rightdiv.appendChild(top_div)
|
||||
}
|
||||
|
||||
var module = {
|
||||
EXCEL_LIST:EXCEL_LIST,
|
||||
make_upload_form: make_upload_form
|
||||
}
|
||||
return module
|
||||
})();
|
||||
Reference in New Issue
Block a user