377 lines
14 KiB
Plaintext
377 lines
14 KiB
Plaintext
<!--#include Virtual="/include/Header.asp" -->
|
|
<%
|
|
Dim PRJCODE : PRJCODE = request("PRJCODE")
|
|
Dim PAGENAME : PAGENAME = request("QID")
|
|
%>
|
|
<style>
|
|
html,
|
|
body {
|
|
height: 100%;
|
|
background-color: #f8f8f8e3;
|
|
}
|
|
|
|
form>.container-fluid,
|
|
body>form {
|
|
height: 100%;
|
|
}
|
|
|
|
|
|
|
|
.rptext {
|
|
margin-left: 5px;
|
|
padding: 2px;
|
|
background-color: rgba(255, 255, 0, 0.5);
|
|
}
|
|
|
|
@media all and (min-width: 960px) {
|
|
|
|
table td,
|
|
table th {
|
|
font-size: 15px !important;
|
|
}
|
|
}
|
|
|
|
.scale_label {
|
|
word-break: keep-all;
|
|
}
|
|
|
|
.col-xl-9 {
|
|
max-width: 1000px !important;
|
|
}
|
|
|
|
#qmain-box {
|
|
overflow-y: auto;
|
|
}
|
|
|
|
#qmain-box::-webkit-scrollbar {
|
|
width: 6px
|
|
}
|
|
|
|
#qmain-box::-webkit-scrollbar-thumb {
|
|
background-color: rgb(179, 179, 179);
|
|
border-radius: 15px;
|
|
background-clip: padding-box;
|
|
border: 1px solid transparent;
|
|
}
|
|
</style>
|
|
|
|
<!-- 그리는 js -->
|
|
<script src="/module/Qmodule/attr.js"></script>
|
|
<script src="/module/Qmodule/single.js"></script>
|
|
<script src="/module/Qmodule/com.js"></script>
|
|
<script src="/module/Qmodule/open.js"></script>
|
|
<script src="/module/Qmodule/multi.js"></script>
|
|
<script src="/module/Qmodule/rank.js"></script>
|
|
<script src="/module/Qmodule/scale.js"></script>
|
|
<script src="/module/Qmodule/group.js"></script>
|
|
<script src="/module/Qmodule/description.js"></script>
|
|
<script src="/module/survey.js?dt=<%=date_time() %>"></script>
|
|
<script src="/store/store_.js"></script>
|
|
|
|
<!-- 문항 생성 및 문항 내부 로직 모듈화 -->
|
|
<script src="/module/CreateQuestion.js"></script>
|
|
<script>
|
|
function resSurvey(winWidth){
|
|
if(winWidth > 992){
|
|
$("#btn-box").removeClass("position-fixed d-inline-flex");
|
|
if($("#btn-box").children().length == 1){
|
|
$("#btn-box").children().removeClass("w-100 p-2");
|
|
}
|
|
$("#btn-box").children().addClass("w-auto h-auto");
|
|
}else{
|
|
$("#btn-box").addClass("position-fixed d-inline-flex");
|
|
if($("#btn-box").children().length == 1){
|
|
$("#btn-box").children().addClass("w-100 p-2");
|
|
}
|
|
$("#btn-box").children().removeClass("w-auto h-auto");
|
|
}
|
|
}
|
|
$(function(){
|
|
$(window).resize(function(){
|
|
resSurvey($(window).width());
|
|
});
|
|
resSurvey($(window).width());
|
|
$(document).on("click", ".list-group-item-action input", function(){
|
|
$(".list-group-item-action").each(function(){
|
|
if($(this).find("input:checked").length > 0){
|
|
$(this).addClass("cusInput-active");
|
|
}else{
|
|
$(this).removeClass("cusInput-active");
|
|
}
|
|
})
|
|
});
|
|
$(document).on("click", ".scaleBtn", function(e){
|
|
$(this).find("input[type=radio]").prop("checked", true);
|
|
$(".scaleBtn").each(function(){
|
|
if($(this).find("input:checked").length > 0){
|
|
$(this).addClass("cusInput-active");
|
|
}else{
|
|
$(this).removeClass("cusInput-active");
|
|
}
|
|
})
|
|
e.stopPropagation();
|
|
});
|
|
$(document).on("click", ".singleBtn", function(e){
|
|
$(this).find("input[type=radio]").prop("checked", true);
|
|
$(".singleBtn").each(function(){
|
|
if($(this).find("input:checked").length > 0){
|
|
$(this).parent().addClass("cusInput-active");
|
|
}else{
|
|
$(this).parent().removeClass("cusInput-active");
|
|
}
|
|
});
|
|
e.stopPropagation();
|
|
});
|
|
$(document).on("click", "tr[id^='row_']", function(e){
|
|
if($(this).children(".singleBtn").length > 0){
|
|
$(this).children(".singleBtn").click();
|
|
}
|
|
e.stopPropagation();
|
|
});
|
|
});
|
|
</script>
|
|
<body>
|
|
<form name="survey" action="Question.asp" method="POST" onsubmit="return false">
|
|
<div class="container-fluid">
|
|
<div class="row justify-content-center h-100">
|
|
<div class="col-sm-12 col-md-12 col-lg-10 col-xl-9 pt-1 pb-1 shadow-sm bg-white h-100" id="qmain-box">
|
|
<div class="col-sm-12 col-md-12 col-lg-10 col-xl-9 p-1 bg-light text-dark border rounded">
|
|
<div class="m-2 p-1 border rounded bg-white child-question" id="question_body" >
|
|
</div>
|
|
<input name="PAGENAME" type="hidden" value="<%=PAGENAME%>"/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</body>
|
|
<script src="/project/<%=PRJCODE%>/js/hard_func.js?dt=<%=date_time() %>"></script>
|
|
<script>
|
|
var src = "/module/Qmodule/"
|
|
var ajaxurl = "/project/<%=PRJCODE%>/include/ajax.asp"
|
|
var qinfo
|
|
var qx
|
|
var jx
|
|
var g
|
|
var defaultdesign = {
|
|
"single": "SM1",
|
|
"multi": "MM1",
|
|
"com": "CM1",
|
|
"scale": "SCM1",
|
|
"rank": "RM1",
|
|
"open": "OM1",
|
|
"attr": "AM1"
|
|
}
|
|
var defaultjs = {
|
|
"single": "SJ1",
|
|
"multi": "MJ1",
|
|
"com": "CJ1",
|
|
"scale": "SCJ1",
|
|
"rank": "RJ1",
|
|
"open": "OJ1",
|
|
"attr": "AJ1"
|
|
}
|
|
var page_logic = "";
|
|
var match_language = ""
|
|
|
|
var logic_to_text = function(logic, vqid) {
|
|
var html_txt = ""
|
|
var item_to_text = function(item){
|
|
var rtxt = item.condition.map(function(ele){
|
|
var qid = ele.va.split("_")
|
|
return (ele. cd ? ele.cd : "") + " " + (vqid[qid[0]] + (qid.length > 1 ? "_"+qid.slice(1).join("_") : "" )) + " " + ele.op + " " + ele.co
|
|
})
|
|
rtxt = rtxt.join(" ") + " ☞ " + vqid[item.nextpage];
|
|
return rtxt;
|
|
}
|
|
if(!logic){
|
|
return ""
|
|
} else {
|
|
logic = JSON.parse(logic);
|
|
var p = logic["p"].length;
|
|
var n = logic["n"].length;
|
|
if(p) {
|
|
var ptext = "진입 로직 : "
|
|
logic["p"].forEach(function(item, i){
|
|
if(i) ptext += " // "
|
|
ptext += item_to_text(item);
|
|
});
|
|
html_txt += "<div class='prev_logic' style='font-weight:bold'>"+ ptext + "</div>"
|
|
}
|
|
|
|
if(n) {
|
|
var ntext = " 사후 로직 : "
|
|
logic["n"].forEach(function(item, i){
|
|
if(i) ntext += " // "
|
|
ntext += item_to_text(item);
|
|
});
|
|
|
|
html_txt += "<div class='after_logic' style='font-weight:bold'>"+ ntext + "</div>"
|
|
}
|
|
}
|
|
return html_txt
|
|
}
|
|
|
|
const replaceImgSrc = () => {
|
|
const fromPrefix = "image/";
|
|
const fromPrefix2 = "./image/";
|
|
const toPrefix = "/project/<%=PRJCODE%>/image/";
|
|
|
|
document.querySelectorAll('img[src]').forEach(img => {
|
|
const src = img.getAttribute('src') || "";
|
|
if (src.startsWith(fromPrefix2)) {
|
|
img.setAttribute('src', toPrefix + src.slice(fromPrefix2.length));
|
|
}
|
|
else if (src.startsWith(fromPrefix)) {
|
|
img.setAttribute('src', toPrefix + src.slice(fromPrefix.length));
|
|
}
|
|
});
|
|
}
|
|
|
|
const setUserData = () => {
|
|
const pageName = $("input[name=PAGENAME]").val();
|
|
const subData = parent.userData[pageName];
|
|
|
|
if(subData){
|
|
Object.keys(subData).forEach(function (key) {
|
|
var qData = subData[key];
|
|
var $content = $("form");
|
|
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=" + qData + "]").trigger("click");
|
|
break;
|
|
case "checkbox":
|
|
$content.find("input[name=" + key + "][value=" + qData + "]").trigger("click")
|
|
break;
|
|
case "radio":
|
|
$content.find("input[name=" + key + "][value=" + qData + "]").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(qData)
|
|
break;
|
|
case "number":
|
|
$content.find("input[name=" + key + "]").prop("disabled", false).val(qData)
|
|
break;
|
|
|
|
}
|
|
} else if ($target.prop("tagName") === "SELECT") {
|
|
$content.find("SELECT[name=" + key + "]").val(qData).trigger("change")
|
|
} else {
|
|
$content.find("textarea[name=" + key + "]").prop("disabled", false).val(qData)
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
$("document").ready(function () {
|
|
kon.survey.PKEY = "<%=PRJCODE%>"
|
|
|
|
$.when(
|
|
$.getJSON("/project/<%=PRJCODE%>/include/var_qid.json"), /* 문항 ID - 문번 */
|
|
$.getJSON("/store/hard_language.json"), /* Alert 창 */
|
|
ajax_returnData(ajaxurl, { "COMMAND": "QINFO", "CODE": "<%=PRJCODE%>", "QCODE": "<%=PAGENAME%>","IDKEY":""}) /* 문항 정보 */
|
|
).done(function (variable_qid, language_pack, qinfo) {
|
|
qinfo = qinfo[0] /* 문항 정보 */
|
|
language_pack = language_pack[0] /* 언어 팩 */
|
|
variable_qid = variable_qid[0] /* 문항명과 QID 매칭 */
|
|
var new_vqid = {
|
|
"END" : "설문 완료",
|
|
"SCREEN" : "대상자 아님",
|
|
"QUOTA" : "할당 초과",
|
|
}
|
|
Object.keys(variable_qid).forEach(function(key){
|
|
new_vqid[variable_qid[key]] = key
|
|
})
|
|
|
|
var group_flag = false;
|
|
var browername = isBrowerCheck();
|
|
|
|
kon.survey.global_flag = $("input[name=GLOBALSURVEY]").val();
|
|
kon.survey.global_variable = $("input[name=GLOBALVARIABLE]").val();
|
|
|
|
|
|
if (qinfo.qx.qgroup) group_flag = true;
|
|
if (!group_flag) { /* 그룹 문항이 아닌 경우 */
|
|
qx = qinfo["qx"]; // 문항 정보
|
|
jx = qinfo["jx"] || false; // 로직
|
|
$("#question_body").append(logic_to_text(jx, new_vqid))
|
|
|
|
/* 페이지에 타이틀, 안내문, 페이지 이름, 데이터, 데이터 그룹 포함시킴 */
|
|
kon.qmake.setTitle(qx.title)
|
|
kon.qmake.setDescription(qx.description)
|
|
kon.qmake.setPageName("<%=PAGENAME%>")
|
|
kon.qmake.setData(qx.dataset);
|
|
kon.qmake.setGroup(qx.datagroup[qx.qtype] || "");
|
|
|
|
/* 디자인 타입 세팅 */
|
|
var a = kon.qmake[qx.qtype]();
|
|
var designtype = qx.stype || defaultdesign[qx.qtype];
|
|
qx.option.oflag = ""
|
|
a[designtype](qx.option || "-");
|
|
} else {
|
|
/* 그룹 문항 */
|
|
var qgroup = qinfo.qx.qgroup;
|
|
g = kon.qmake["group"]();
|
|
var order = ""
|
|
var setg = {
|
|
"title": [],
|
|
"description": [],
|
|
"datagroup": [],
|
|
"dataset": [],
|
|
"variable": [],
|
|
"qtype": [],
|
|
"stype": [],
|
|
"option": []
|
|
}
|
|
|
|
qinfo = ajax_returnData(ajaxurl, { "COMMAND": "GROUP", "CODE": "<%=PRJCODE%>", "GROUP": qgroup });
|
|
jx = qinfo.var[0].jx /* 그룹문항 로직 - 첫번째가 기준 */
|
|
|
|
$("#question_body").append(logic_to_text(jx, new_vqid))
|
|
var varlist = qinfo.var.map(function (v) { return "'" + v.QID + "'" }).join(",");
|
|
|
|
kon.survey.translation_info(varlist, kon.survey.tv[kon.survey.global_variable], qinfo, true)
|
|
qinfo.var.forEach(function (e, id) {
|
|
if (regex_test(global.pattern.datalabel, e.qx.title) || regex_test(global.pattern.datalabel, e.qx.description))
|
|
kon.survey.replace_responed_label(e.qx, variable_qid);
|
|
setg["title"].push(e.qx.title)
|
|
setg["description"].push(e.qx.description)
|
|
setg["datagroup"].push(e.qx.datagroup.attr)
|
|
setg["dataset"].push(e.qx.dataset)
|
|
setg["variable"].push(e.QID)
|
|
setg["qtype"].push(e.qx.qtype);
|
|
setg["stype"].push(e.qx.stype);
|
|
e.qx.option.oflag = ""
|
|
setg["option"].push(e.qx.option);
|
|
if (id === qinfo.var.length - 1) {
|
|
$("input[name=PAGENAME]").val(e.QID);
|
|
order = e.Qorder;
|
|
}
|
|
})
|
|
|
|
g.setVariable(setg["variable"])
|
|
g.setData(setg["dataset"])
|
|
g.setDatagroup(setg["datagroup"])
|
|
g.setQtype(setg["qtype"])
|
|
g.setStype(setg["stype"]);
|
|
g.setTitle(setg["title"])
|
|
g.setDescription(setg["description"])
|
|
g.setOption(setg["option"])
|
|
g[qinfo.stype](qinfo.option || "");
|
|
}
|
|
efunc("<%=PAGENAME%>");
|
|
replaceImgSrc();
|
|
setUserData();
|
|
|
|
$("a[aria-expanded=false]").click();
|
|
}) /* when.done */
|
|
}); /* document.ready */
|
|
</script> |