first commit
This commit is contained in:
466
survey_to_pdf/style.css
Normal file
466
survey_to_pdf/style.css
Normal file
@@ -0,0 +1,466 @@
|
||||
.imgHighQ{
|
||||
image-rendering: -webkit-optimize-contrast;
|
||||
transform: translateZ(0);
|
||||
backface-visibility: hidden;
|
||||
}
|
||||
|
||||
html,
|
||||
body,
|
||||
.container-fluid,
|
||||
form {
|
||||
height: 100%;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.rptext {
|
||||
/* 2025-09-02 권민서 자동 치환되는 변수 style 중 앞에 띄어쓰기 기능 주석 처리 */
|
||||
/* 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;
|
||||
}
|
||||
|
||||
#start, #next, #prev, #r_kiwi_btn{
|
||||
border-radius:3px !important;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.col-xl-9 {
|
||||
max-width: 1000px !important;
|
||||
}
|
||||
|
||||
#qmain-box {
|
||||
overflow-y: auto;
|
||||
background-color: #F7F7F7;
|
||||
}
|
||||
|
||||
#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;
|
||||
}
|
||||
#logo-box{
|
||||
box-shadow: 0 4px 6px rgba(0,0,0,.15);
|
||||
}
|
||||
|
||||
#logo-box > img{
|
||||
height:35px;
|
||||
}
|
||||
|
||||
#project-name h4{
|
||||
color:#1cae81;
|
||||
font-size:18px !important;
|
||||
}
|
||||
#kiwi_progress{
|
||||
height: 7px;
|
||||
}
|
||||
#prj-title{
|
||||
word-break:keep-all;
|
||||
font-size:15px !important;
|
||||
color:#444;
|
||||
padding-top:12px !important;
|
||||
padding-bottom:12px !important;
|
||||
border-radius: 3px;
|
||||
}
|
||||
.progDiv{
|
||||
background-color:#E8E8E8;
|
||||
border-radius:4px;
|
||||
height: 4px;
|
||||
}
|
||||
.progDiv.progAct{
|
||||
background-color:#1cae81;
|
||||
}
|
||||
.progDiv:not(first-child){
|
||||
margin-left:2px;
|
||||
}
|
||||
#qtitle{
|
||||
color:#99D4CE;
|
||||
border-color:#99D4CE !important;
|
||||
font-size:14px !important;
|
||||
border-radius: 20px;
|
||||
}
|
||||
#btn-box{
|
||||
bottom:0;
|
||||
z-index: 100;
|
||||
}
|
||||
#start, #next, #prev, #r_kiwi_btn{
|
||||
font-size:14px;
|
||||
color:#e8e8e8;
|
||||
background-color:#1cae81;
|
||||
border-radius: initial;
|
||||
height: 56px;
|
||||
}
|
||||
|
||||
i{
|
||||
font-family: "fontawesome" !important;
|
||||
}
|
||||
|
||||
.question-title{
|
||||
font-size:16px;
|
||||
color:#1c1c1c;
|
||||
}
|
||||
|
||||
.lds-dual-ring.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(0,0,0,.1);
|
||||
z-index: 999;
|
||||
opacity: 1;
|
||||
transition: all 0.5s;
|
||||
}
|
||||
|
||||
/*Spinner Styles*/
|
||||
.lds-dual-ring {
|
||||
/* display: inline-block;
|
||||
width: 80px;
|
||||
height: 80px; */
|
||||
}
|
||||
.lds-dual-ring:after {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
|
||||
content: " ";
|
||||
display: block;
|
||||
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
|
||||
margin: -25px 0 0 -25px;
|
||||
|
||||
/* margin: 50% auto;
|
||||
border-radius: 50%;
|
||||
border: 6px solid #fff;
|
||||
border-color: #fff transparent #fff transparent; */
|
||||
|
||||
background-color: transparent;
|
||||
background-image:url('/img/kiwi_loading.png');
|
||||
background-size: 50px;
|
||||
background-repeat:no-repeat;
|
||||
background-position:center;
|
||||
object-fit: fill;
|
||||
opacity: 1;
|
||||
filter: alpha(opacity=100);
|
||||
|
||||
animation: lds-dual-ring 1.2s linear infinite;
|
||||
}
|
||||
@keyframes lds-dual-ring {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.list-group-item{
|
||||
margin-bottom: 8px;
|
||||
padding: 6px 15px;
|
||||
border-radius: 3px !important;
|
||||
border: none;
|
||||
}
|
||||
.list-group-item-action{
|
||||
border-radius: 3px !important;
|
||||
}
|
||||
|
||||
.custom-control {
|
||||
display: inline-block;
|
||||
padding-left: 26px;
|
||||
position: relative;
|
||||
min-height: 20px;
|
||||
margin: 9px 33px 9px 0;
|
||||
}
|
||||
|
||||
.custom-control input {
|
||||
opacity: 0;
|
||||
position: absolute;
|
||||
left: -99999px;
|
||||
font-size: 0;
|
||||
}
|
||||
|
||||
.custom-control b, .custom-control span {
|
||||
color: #444;
|
||||
font-size: 15px;
|
||||
vertical-align: text-top;
|
||||
}
|
||||
|
||||
.custom-control i {
|
||||
display: block;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
-webkit-transform: translateY(-50%);
|
||||
-moz-transform: translateY(-50%);
|
||||
-ms-transform: translateY(-50%);
|
||||
-o-transform: translateY(-50%);
|
||||
border: 1px solid #7d7d7d;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.custom-control i.centerIcon{
|
||||
position: absolute;
|
||||
display: inline-block;
|
||||
left: auto;
|
||||
}
|
||||
.custom-control i.centerIcon+span{
|
||||
margin-left:18px;
|
||||
}
|
||||
.custom-control-radio input:checked ~ i::before {
|
||||
content: '';
|
||||
display: block;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
background: #1cae81;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
margin: -4px 0 0 -4px;
|
||||
}
|
||||
|
||||
.custom-control input:checked ~ i {
|
||||
background-color: #fff;
|
||||
border-color: #1cae81;
|
||||
}
|
||||
|
||||
.custom-control-checkbox-square input:checked ~ i {
|
||||
background: #1cae81 url(/img/icon-ckck-light.svg) no-repeat center;
|
||||
|
||||
}
|
||||
.custom-control-checkbox-square i {
|
||||
border-radius: 0;
|
||||
}
|
||||
.cusInput-active{
|
||||
border:1px solid #1cae81;
|
||||
}
|
||||
.list-group-item+.list-group-item.cusInput-active{
|
||||
border-top-width: 1px;
|
||||
}
|
||||
|
||||
.form-control:focus{
|
||||
border-color: #1cae81;
|
||||
box-shadow:none;
|
||||
}
|
||||
|
||||
input:-webkit-autofill, input:focus:-webkit-autofill {
|
||||
-webkit-box-shadow: 0 0 0 100px #fff inset;
|
||||
}
|
||||
|
||||
.custom-control input:disabled:not(:checked) ~ i{
|
||||
background-color: #f0f0f0;
|
||||
border-color: #ccc;
|
||||
}
|
||||
.custom-control-checkbox-square input:disabled:checked ~ i{
|
||||
background-color: #9bdbc8;
|
||||
border-color: #9bdbc8;
|
||||
}
|
||||
.custom-control-radio input:disabled:checked ~ i{
|
||||
border-color: #ccc;
|
||||
}
|
||||
.custom-control-radio input:disabled:checked ~ i::before{
|
||||
background-color: #9bdbc8;
|
||||
}
|
||||
|
||||
|
||||
.sEndStr{
|
||||
font-size:20px;
|
||||
color:#1c1c1c;
|
||||
font-weight: 600;
|
||||
}
|
||||
.sEndSubStr{
|
||||
font-size:16px;
|
||||
color:#7d7d7d;
|
||||
}
|
||||
.scaleTb {
|
||||
border: none;
|
||||
border-collapse: separate;
|
||||
border-spacing: 5px;
|
||||
}
|
||||
.scaleTb td{
|
||||
border: none;
|
||||
margin: 5px;
|
||||
height: 24px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.scaleBtn {
|
||||
cursor:pointer;
|
||||
display:table-cell;
|
||||
position:relative;
|
||||
}
|
||||
|
||||
.scaleBtn.cusInput-active{
|
||||
border:1px solid #1cae81;
|
||||
color:#1cae81;
|
||||
}
|
||||
|
||||
.scaleBtn i.centerIcon{
|
||||
margin-right: auto;
|
||||
margin-bottom: -7px;
|
||||
left:calc(50% - 7px);
|
||||
}
|
||||
|
||||
.singleTb {
|
||||
border: none;
|
||||
border-collapse: separate;
|
||||
border-spacing: 0 8px;
|
||||
}
|
||||
.singleTb td, .singleTb th{
|
||||
border: none;
|
||||
margin: 5px;
|
||||
min-width: 30px;
|
||||
font-size: 15px;
|
||||
}
|
||||
.singleTb tr[id^=row_]{
|
||||
cursor:pointer;
|
||||
}
|
||||
.singleTb tr > td:first-child, .singleTb tr > th:first-child{
|
||||
border-radius: 3px 0 0 3px;
|
||||
}
|
||||
.singleTb tr > td:last-child, .singleTb tr > th:last-child{
|
||||
border-radius: 0 3px 3px 0;
|
||||
}
|
||||
|
||||
.singleBtn {
|
||||
cursor:pointer;
|
||||
display:table-cell;
|
||||
position:relative;
|
||||
}
|
||||
.singleBtn i.centerIcon{
|
||||
margin-right: auto;
|
||||
right:7px;
|
||||
margin-bottom: -7px;
|
||||
}
|
||||
|
||||
tr.cusInput-active > td:first-child{
|
||||
border-left:1px solid #1cae81;
|
||||
}
|
||||
tr.cusInput-active > td:last-child{
|
||||
border-right:1px solid #1cae81;
|
||||
}
|
||||
tr.cusInput-active > td{
|
||||
border-top:1px solid #1cae81;
|
||||
border-bottom:1px solid #1cae81;
|
||||
}
|
||||
|
||||
div[id^=attr_label_]{
|
||||
background-color: #e8e8e8;
|
||||
color: #7d7d7d;
|
||||
font-weight: 400;
|
||||
font-size: 14px;
|
||||
min-height: 26px;
|
||||
padding: 8px;
|
||||
margin-bottom: 12px;
|
||||
border-radius: 3px;
|
||||
text-align: center !important;
|
||||
}
|
||||
|
||||
a[id^=attr_][aria-expanded=true] > div[id^=attr_label_]{
|
||||
background-color: #ffffff;
|
||||
color: #444;
|
||||
font-weight: 800;
|
||||
border: #aaaaaa 1px solid;
|
||||
text-align: center !important;
|
||||
}
|
||||
|
||||
div[id^=attr_label_]:before {
|
||||
border: solid #7d7d7d;
|
||||
border-width: 0 1px 1px 0;
|
||||
display: block;
|
||||
padding: 4px;
|
||||
content: '';
|
||||
float:right;
|
||||
-webkit-transform: rotate(45deg);
|
||||
-moz-transform: rotate(45deg);
|
||||
transform: rotate(45deg);
|
||||
transition: all 0.5s;
|
||||
margin-top: 4px;
|
||||
margin-right: 3px;
|
||||
}
|
||||
a[id^=attr_][aria-expanded=true] > div[id^=attr_label_]:before {
|
||||
-webkit-transform: rotate(225deg);
|
||||
-moz-transform: rotate(225deg);
|
||||
transform: rotate(225deg);
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
a[id^=attr_]:hover{
|
||||
text-decoration:none;
|
||||
}
|
||||
|
||||
div[id^=qus_] .custom-control span {
|
||||
font-size:14px;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
div[id^=qus_] .list-group-item {
|
||||
margin-bottom: 5px;
|
||||
padding: 3px 15px;
|
||||
}
|
||||
|
||||
|
||||
@media all and (min-width: 960px) {
|
||||
div[id^=qus_] td{
|
||||
font-size:14px !important;
|
||||
}
|
||||
}
|
||||
|
||||
div:not(.container-fluid)[id$='_BOX'] > .container-fluid[id$=_box]:hover{
|
||||
border:1px solid #1cae81 !important;
|
||||
}
|
||||
|
||||
.delete-btn{
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
.custom-control-checkbox-square input.rankCheckbox[data-rank]:checked ~ i{
|
||||
background: none;
|
||||
background-color: #1cae81;
|
||||
}
|
||||
.custom-control-checkbox-square input.rankCheckbox[data-rank]:checked ~ i::before{
|
||||
/*20260313 박준성 랭크 숫자 가변 적용*/
|
||||
content: attr(data-rank);
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
/*20260313 박준성 랭크 숫자 가변 적용*/
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
font-family: "Spoqa Han Sans Neo", sans-serif !important;
|
||||
color: #fff;
|
||||
font-style: normal;
|
||||
line-height: 1;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/*20260313 박준성 랭크 숫자 가변 적용*/
|
||||
|
||||
.cusInput-disabled{
|
||||
background-color: #e8e8e8 !important;
|
||||
color: #a7a7a7;
|
||||
}
|
||||
377
survey_to_pdf/survey_layout.asp
Normal file
377
survey_to_pdf/survey_layout.asp
Normal file
@@ -0,0 +1,377 @@
|
||||
<!--#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>
|
||||
294
survey_to_pdf/survey_layout_total.asp
Normal file
294
survey_to_pdf/survey_layout_total.asp
Normal file
@@ -0,0 +1,294 @@
|
||||
<!--#include Virtual="/Lib/Config.asp" -->
|
||||
<%
|
||||
Dim PRJCODE : PRJCODE = request("PRJCODE")
|
||||
Dim SID : SID = request("SID")
|
||||
Dim FILENAME : FILENAME = PRJCODE
|
||||
|
||||
IF SID <> "" THEN
|
||||
FILENAME = FILENAME & "_" & SID
|
||||
END IF
|
||||
|
||||
Dim HEIGHT : HEIGHT = 1320
|
||||
|
||||
Dim SQL : SQL = ""
|
||||
Dim Rcset : Set Rcset = Server.CreateObject("ADODB.Recordset")
|
||||
Call DBConnect2()
|
||||
SQL = " select QID,Qorder from QUESTION where Qorder in ( " &vbcrlf
|
||||
SQL = SQL & " select ISNULL(qx,Qorder) " &vbcrlf
|
||||
SQL = SQL & " from QUESTION as Qu " &vbcrlf
|
||||
SQL = SQL & " OUTER APPLY ( " &vbcrlf
|
||||
SQL = SQL & " select min(B.Qorder) as qx from [QUESTION] B where " &vbcrlf
|
||||
SQL = SQL & " PKEY = '"& PRJCODE &"' and " &vbcrlf
|
||||
SQL = SQL & " JSON_VALUE(QUESTIONJSON,'$.qgroup') = JSON_VALUE(Qu.QUESTIONJSON,'$.qgroup') and " &vbcrlf
|
||||
SQL = SQL & " JSON_VALUE(QUESTIONJSON,'$.qgroup') <> '' " &vbcrlf
|
||||
SQL = SQL & " group by JSON_VALUE(QUESTIONJSON,'$.qgroup') " &vbcrlf
|
||||
SQL = SQL & " ) RC " &vbcrlf
|
||||
SQL = SQL & " WHERE PKEY = '"& PRJCODE &"' " &vbcrlf
|
||||
SQL = SQL & " ) and PKEY = '"& PRJCODE &"' order by cast(Qorder as int) " &vbcrlf
|
||||
Rcset.Open SQL, DBConn, 3,1,1
|
||||
|
||||
SQL = "SELECT JSON_VALUE([PROJECTJSON], '$.must.title') AS PRJ_TITLE FROM [PROJECT] WHERE PKEY = '" & PRJCODE & "'"
|
||||
Dim Rcset2 : Set Rcset2 = Server.CreateObject("ADODB.Recordset")
|
||||
Rcset2.Open SQL, DBConn, 3,1,1
|
||||
|
||||
Dim PRJNAME : PRJNAME = Rcset2("PRJ_TITLE")
|
||||
|
||||
%>
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta http-equiv="Page-Enter" content="revealtrans(Duration=1,Transition=12)" />
|
||||
<meta name="viewport" content="width=device-width">
|
||||
|
||||
<title> KiwiSurvey</title>
|
||||
<link rel="shortcut icon" type="image/x-icon" href="../../img/favicon-16x16.png" />
|
||||
|
||||
<script src="/js/jquery-1.10.2.min.js"></script>
|
||||
|
||||
<link href="/bootstrap-4.4.1/css/bootstrap.min.css" rel="stylesheet" />
|
||||
<script src="/bootstrap-4.4.1/js/bootstrap.min.js"></script>
|
||||
|
||||
<!-- js 기능 모듈화 -->
|
||||
<script src="/js/kfunc.js"></script>
|
||||
<script src="/js/knode.js"></script>
|
||||
<script src="/js/polyfill.js"></script>
|
||||
<script src="/js/bluebird.min.js"></script>
|
||||
<script src="/module/survey.js"></script>
|
||||
<script src="/store/store_.js"></script>
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.3.1/jspdf.umd.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.3.2/html2canvas.min.js"></script>
|
||||
|
||||
<link href="/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
|
||||
<link href='//spoqa.github.io/spoqa-han-sans/css/SpoqaHanSansNeo.css' rel='stylesheet' type='text/css'>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<style>
|
||||
table td,
|
||||
table th {
|
||||
font-size: 15px !important;
|
||||
}
|
||||
|
||||
.scale_label {
|
||||
word-break: keep-all;
|
||||
}
|
||||
|
||||
.col-xl-9 {
|
||||
max-width: 1000px !important;
|
||||
}
|
||||
|
||||
.main_body {
|
||||
height: <%=HEIGHT%>px;
|
||||
}
|
||||
|
||||
#wrapper { position: fixed; inset: 0; height: 100dvh; }
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="wrapper" class="w-100 bg-white d-flex justify-content-center flex-column align-items-center" style="z-index: 100;">
|
||||
<span id="wrapperSpan"></span>
|
||||
<div id="surveyprogress" style="width:350px">
|
||||
<div class="progress m-2">
|
||||
<div id="surveyprogressbar" class="progress-bar progress-bar-striped progress-bar-animated"
|
||||
role="progressbar" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"> </div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-sm-12 col-md-12 col-lg-10 col-xl-9 text-center">
|
||||
<div id="project-name" class="d-flex align-items-center justify-content-center" style="height:70px;">
|
||||
<h3 class="m-0"><%=PRJNAME%></h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<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 bg-white h-100" id="qmain-box">
|
||||
<div class="col-sm-12 col-md-12 col-lg-10 col-xl-9">
|
||||
<div class="mb-2 border rounded bg-white main_body" >
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<iframe id="layout" class='d-none'></iframe>
|
||||
</body>
|
||||
<script>
|
||||
function waitImagesLoaded(rootEl) {
|
||||
const imgs = Array.from(rootEl.querySelectorAll("img"));
|
||||
return Promise.all(
|
||||
imgs.map(img => {
|
||||
if (img.complete) return Promise.resolve();
|
||||
return new Promise(res => {
|
||||
img.onload = res;
|
||||
img.onerror = res;
|
||||
});
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
async function exportSurveyPdf() {
|
||||
$("#wrapperSpan").html("설문을 pdf로 변환하고 있습니다...<br/>파일명 : <%=FILENAME%>.pdf");
|
||||
$("#surveyprogressbar").css("width", "0%");
|
||||
$("#surveyprogressbar").html("변환중");
|
||||
|
||||
const pdf = new jspdf.jsPDF({ unit:"mm", format:"a4", orientation:"p", compress:true });
|
||||
const root = document.getElementById("qmain-box");
|
||||
const pages = Array.from(root.querySelectorAll(".main_body"));
|
||||
const pageW = pdf.internal.pageSize.getWidth();
|
||||
const pageH = pdf.internal.pageSize.getHeight();
|
||||
|
||||
let titleImg = null;
|
||||
let titleH = 0;
|
||||
const titleEl = document.getElementById("project-name");
|
||||
if (titleEl) {
|
||||
const titleCanvas = await html2canvas(titleEl, {
|
||||
scale: 1.2,
|
||||
backgroundColor: "#ffffff",
|
||||
useCORS: true,
|
||||
logging: false,
|
||||
});
|
||||
titleImg = titleCanvas.toDataURL("image/jpeg", 0.9);
|
||||
titleH = (titleCanvas.height * pageW) / titleCanvas.width; // mm 환산
|
||||
}
|
||||
|
||||
for (let i = 0; i < pages.length; i++) {
|
||||
await waitImagesLoaded(pages[i]);
|
||||
|
||||
const canvas = await html2canvas(pages[i], {
|
||||
scale: 1.2,
|
||||
useCORS: true,
|
||||
backgroundColor: "#ffffff",
|
||||
logging: false,
|
||||
removeContainer: true,
|
||||
});
|
||||
|
||||
const imgData = canvas.toDataURL("image/jpeg", 0.82);
|
||||
|
||||
if (i > 0) pdf.addPage();
|
||||
|
||||
let yStart = 0;
|
||||
if (i === 0 && titleImg) {
|
||||
pdf.addImage(titleImg, "JPEG", 0, 0, pageW, titleH, undefined, "FAST");
|
||||
yStart = titleH + 2; // 제목 아래 여백
|
||||
}
|
||||
|
||||
// 페이지 이미지를 남은 공간에 맞춰 넣기
|
||||
const availH = pageH - yStart;
|
||||
let imgW = pageW;
|
||||
let imgH = (canvas.height * imgW) / canvas.width;
|
||||
|
||||
if (imgH > availH) {
|
||||
imgH = availH;
|
||||
imgW = (canvas.width * imgH) / canvas.height;
|
||||
}
|
||||
|
||||
const x = (pageW - imgW) / 2;
|
||||
pdf.addImage(imgData, "JPEG", x, yStart, imgW, imgH, undefined, "FAST");
|
||||
|
||||
$("#surveyprogressbar").css("width", Math.ceil(((i + 1) / pages.length) * 100) + "%");
|
||||
await new Promise(r => setTimeout(r, 0));
|
||||
}
|
||||
|
||||
pdf.save(`<%=FILENAME%>.pdf`);
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
const heightLimit = <%=HEIGHT%>;
|
||||
var qcnt = 0
|
||||
var qid_list = [ <% while NOT Rcset.eof %> "<%=Rcset("QID")%>", <% Rcset.moveNext : wend %>]
|
||||
var qid_length = qid_list.length;
|
||||
var link = "/survey_to_pdf/survey_layout.asp?PRJCODE=<%=PRJCODE%>&QID="
|
||||
var now_url = "<%=request.servervariables("HTTP_url")%>"
|
||||
var bootstrap_css = ""
|
||||
var page_height = 0
|
||||
var userData = {}
|
||||
|
||||
if(qid_length === 0){
|
||||
alert("문항 먼저 등록해주세요.")
|
||||
window.close();
|
||||
}
|
||||
|
||||
$("#wrapperSpan").html("설문을 구현하고 있습니다...");
|
||||
$("#surveyprogressbar").html("구현중");
|
||||
|
||||
if("<%=SID%>" !== ""){
|
||||
const dataAjaxUrl = "/include/ajax_crud.asp"
|
||||
param = setparam("s", "USER_DATA_ONE", { "PKEY": "<%=PRJCODE%>", "IDKEY": "<%=SID%>" });
|
||||
userData = ajax_returnData(dataAjaxUrl, param)
|
||||
}
|
||||
|
||||
$("#layout").on("load", function (e) {
|
||||
$("#surveyprogressbar").css("width",qcnt == 0 ? "0%" : Math.ceil((qcnt / qid_length) * 100) + "%" )
|
||||
if (qcnt === qid_length) {
|
||||
$("button[id^=refresh]").remove();
|
||||
$("input").attr("readonly","readonly");
|
||||
$("input").on("click", () => {return false})
|
||||
|
||||
exportSurveyPdf()
|
||||
.catch((e) => {
|
||||
alert("PDF 생성 중 오류가 발생했습니다.")
|
||||
console.log(e)
|
||||
})
|
||||
.finally(() => {
|
||||
$("html, body").scrollTop(0);
|
||||
$("#wrapper").remove();
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
var frameTarget = e.target;
|
||||
setTimeout(function () {
|
||||
var $content = $(frameTarget.contentDocument);
|
||||
var $target = $content.find("#question_body");
|
||||
|
||||
$(".main_body:last").append($target);
|
||||
var this_height = $("#qmain-box").find(".child-question:eq("+qcnt+")").outerHeight(true);
|
||||
page_height += this_height;
|
||||
|
||||
if(page_height > heightLimit) {
|
||||
var main_body = createnode("div","",{"class":"mb-2 border rounded bg-white main_body"})
|
||||
var scale = 0.9;
|
||||
|
||||
$(main_body).append($target);
|
||||
$(".main_body:last").after(main_body);
|
||||
|
||||
if(this_height > heightLimit) {
|
||||
$(main_body).css("height", this_height +"px")
|
||||
}
|
||||
|
||||
page_height = this_height
|
||||
}
|
||||
|
||||
qcnt++
|
||||
if(qid_list[qcnt]){
|
||||
$("#layout").attr("src", link + qid_list[qcnt])
|
||||
} else {
|
||||
$("#layout").attr("src", "")
|
||||
}
|
||||
}, 10)
|
||||
})
|
||||
|
||||
|
||||
if (window.location.href.indexOf(now_url) > -1) {
|
||||
$.when($.get("/bootstrap-4.4.1/css/bootstrap.min.css"))
|
||||
.done(function(response) {
|
||||
bootstrap_css = response
|
||||
// 시작 !
|
||||
$("#layout").attr("src", link + qid_list[qcnt])
|
||||
});
|
||||
|
||||
} else {
|
||||
$("#layout").remove();
|
||||
}
|
||||
|
||||
</script>
|
||||
Reference in New Issue
Block a user