diff --git a/modules/editor/components/poll_maker/tpl/popup.html b/modules/editor/components/poll_maker/tpl/popup.html index 517e4a8a9..2c4832351 100644 --- a/modules/editor/components/poll_maker/tpl/popup.html +++ b/modules/editor/components/poll_maker/tpl/popup.html @@ -38,7 +38,6 @@ $(function(){ }); })(jQuery); -
@@ -46,7 +45,7 @@ $(function(){
diff --git a/widgets/pollWidget/skins/default/css/poll.css b/widgets/pollWidget/skins/default/css/poll.css index 2cc79457d..9c95d8e38 100644 --- a/widgets/pollWidget/skins/default/css/poll.css +++ b/widgets/pollWidget/skins/default/css/poll.css @@ -1,6 +1,6 @@ .rx_poll_default_wrap{max-width:100%;} -.pollWidget{padding:5px;} -.rx_poll_default{border-radius: 10px;border:1px solid #e0e0e0;overflow:auto; background-color:#ffffff; color:#000000; font-size:12px; font-family:"Open Sans","나눔바른고딕",NanumBarunGothic,"맑은 고딕","Malgun Gothic","돋움",Dotum,"애플 SD 산돌고딕 Neo","Apple SD Gothic Neo",AppleGothic,Helvetica,sans-serif;} +.rx_poll_default_wrap .pollWidget{padding:5px;} +.rx_poll_default{border-radius: 10px;border:1px solid #e0e0e0;overflow:auto; background-color:#ffffff; color:#000000; font-size:12px; font-family:"Open Sans","나눔바른고딕",NanumBarunGothic,"맑은 고딕","Malgun Gothic","애플 SD 산돌고딕 Neo","Apple SD Gothic Neo","돋움",Dotum,AppleGothic,Helvetica,sans-serif;} .rx_poll_default .rx_poll_header{padding:13px 15px 10px;overflow:auto;background: #000;background: linear-gradient(-180deg, #212121, #424242);color:#e0e0e0;} .rx_poll_default .rx_poll_h_strong{color:#FFFFFF;font-weight:bold} .rx_poll_default .rx_poll_content{padding: 15px;} diff --git a/widgets/pollWidget/skins/default/images/back_bar.png b/widgets/pollWidget/skins/default/images/back_bar.png deleted file mode 100644 index 8ef71686d..000000000 Binary files a/widgets/pollWidget/skins/default/images/back_bar.png and /dev/null differ diff --git a/widgets/pollWidget/skins/default/images/blank.gif b/widgets/pollWidget/skins/default/images/blank.gif deleted file mode 100644 index 35d42e808..000000000 Binary files a/widgets/pollWidget/skins/default/images/blank.gif and /dev/null differ diff --git a/widgets/pollWidget/skins/default/images/color_bar.png b/widgets/pollWidget/skins/default/images/color_bar.png deleted file mode 100644 index 2afe557c0..000000000 Binary files a/widgets/pollWidget/skins/default/images/color_bar.png and /dev/null differ diff --git a/widgets/pollWidget/skins/default/images/lb.png b/widgets/pollWidget/skins/default/images/lb.png deleted file mode 100644 index 0cc989c98..000000000 Binary files a/widgets/pollWidget/skins/default/images/lb.png and /dev/null differ diff --git a/widgets/pollWidget/skins/default/images/lh.png b/widgets/pollWidget/skins/default/images/lh.png deleted file mode 100644 index a12dca5dc..000000000 Binary files a/widgets/pollWidget/skins/default/images/lh.png and /dev/null differ diff --git a/widgets/pollWidget/skins/default/images/pipe.png b/widgets/pollWidget/skins/default/images/pipe.png deleted file mode 100644 index d560aa240..000000000 Binary files a/widgets/pollWidget/skins/default/images/pipe.png and /dev/null differ diff --git a/widgets/pollWidget/skins/default/images/rb.png b/widgets/pollWidget/skins/default/images/rb.png deleted file mode 100644 index d74208c12..000000000 Binary files a/widgets/pollWidget/skins/default/images/rb.png and /dev/null differ diff --git a/widgets/pollWidget/skins/default/images/rh.png b/widgets/pollWidget/skins/default/images/rh.png deleted file mode 100644 index 4e4924628..000000000 Binary files a/widgets/pollWidget/skins/default/images/rh.png and /dev/null differ diff --git a/widgets/pollWidget/skins/default/images/rlb.png b/widgets/pollWidget/skins/default/images/rlb.png deleted file mode 100644 index 95144eb49..000000000 Binary files a/widgets/pollWidget/skins/default/images/rlb.png and /dev/null differ diff --git a/widgets/pollWidget/skins/default/images/rrb.png b/widgets/pollWidget/skins/default/images/rrb.png deleted file mode 100644 index 791f763e5..000000000 Binary files a/widgets/pollWidget/skins/default/images/rrb.png and /dev/null differ diff --git a/widgets/pollWidget/skins/default/images/top_bg.png b/widgets/pollWidget/skins/default/images/top_bg.png deleted file mode 100644 index 00bfe3d56..000000000 Binary files a/widgets/pollWidget/skins/default/images/top_bg.png and /dev/null differ diff --git a/widgets/pollWidget/skins/default/images/top_title_bg.png b/widgets/pollWidget/skins/default/images/top_title_bg.png deleted file mode 100644 index 900ebbb22..000000000 Binary files a/widgets/pollWidget/skins/default/images/top_title_bg.png and /dev/null differ diff --git a/widgets/pollWidget/skins/default/pollview.html b/widgets/pollWidget/skins/default/pollview.html index 56323de13..bfc92ab41 100644 --- a/widgets/pollWidget/skins/default/pollview.html +++ b/widgets/pollWidget/skins/default/pollview.html @@ -50,7 +50,7 @@
{{/each}} -
+

{$XE_VALIDATOR_MESSAGE}

@@ -60,7 +60,7 @@ - +
@@ -115,7 +115,7 @@ {{/if}} -
+

{$XE_VALIDATOR_MESSAGE}

diff --git a/widgets/pollWidget/skins/simple/css/poll.css b/widgets/pollWidget/skins/simple/css/poll.css index 6e4241ff1..fd899645a 100644 --- a/widgets/pollWidget/skins/simple/css/poll.css +++ b/widgets/pollWidget/skins/simple/css/poll.css @@ -1,30 +1,30 @@ -.simple_poll { table-layout:fixed; padding:0; margin:0; border:none;} +.rx_poll_smpl_wrap{max-width:100%;} +.rx_poll_smpl_wrap .pollWidget{padding:5px;} +.rx_poll_smpl{box-shadow: 0 0 2px rgba(0, 0, 0, 0.25);overflow:auto; background-color:#ffffff; color:#000000; font-size:12px; font-family:"Open Sans","나눔바른고딕",NanumBarunGothic,"맑은 고딕","Malgun Gothic","애플 SD 산돌고딕 Neo","Apple SD Gothic Neo","돋움",Dotum,AppleGothic,Helvetica,sans-serif;} +.rx_poll_smpl .rx_poll_header{padding:13px 15px 10px;overflow:auto;border-bottom:2px solid #bdbdbd;} +.rx_poll_smpl .rx_poll_h_strong{font-weight:bold} +.rx_poll_smpl .rx_poll_content{padding: 15px;} +.rx_poll_smpl .rx_poll_content .title{border-bottom:2px solid #bdbdbd;font-weight:bold;padding:7px;margin-bottom:10px} +.rx_poll_smpl .rx_poll_content .rx_poll_smpl_item,.rx_poll_smpl .rx_poll_content .poll_vote .checkcount,.rx_poll_smpl .rx_poll_content .poll_vote .poll_item label{padding: 10px 5px;} +.rx_poll_smpl .rx_poll_content .rx_poll_smpl_item .item_text strong{display:inline-block; padding-right:10px; margin-right:10px;border-right:2px solid #e0e0e0;} +.rx_poll_smpl .rx_poll_content .rx_poll_smpl_item>div.item_bar{height:22px;position:relative;margin:6px 0px;background-color:#eeeeee;} +.rx_poll_smpl .rx_poll_content .rx_poll_smpl_item>div.item_bar div.item_bar{position:absolute;top:0px;left:0;background-color:#66bb6a;} +.rx_poll_smpl .rx_poll_content .rx_poll_smpl_item div.item_bar .item_bar_text{position:absolute;top:0px;right:3px;} +.rx_poll_smpl div.poll_button{border-top:1px solid #bdbdbd;padding:10px 15px;width:auto;text-align:center} +.rx_poll_smpl .rx_poll_content .poll_vote{margin:5px 0px 10px;} +.rx_poll_smpl .rx_poll_content .poll_vote .poll_item, .rx_poll_smpl .rx_poll_content .poll_vote .poll_item_add{position:relative;border-bottom:1px solid #e0e0e0;} +.rx_poll_smpl .rx_poll_content .poll_vote .poll_item label{display:block;width:auto;} +.rx_poll_smpl .rx_poll_content .poll_vote .poll_item .poll_item_delete{position:absolute;right:0;top:7px;} -.simple_poll td { padding:0; margin:0; } -.simple_poll td.title { text-align:right; } - -.simple_poll td .itemDiv { border-top:1px solid #BBBBBB; margin-top:3px; padding:3px 0 3px 0; } -.simple_poll td .title { color:#000000; font-weight:bold; letter-spacing:-1px;} -.simple_poll td .checkcount { color:#AAAAAA; } - -.simple_poll td .item { color:#636363; margin:5px 0 5px 0; } -.simple_poll td .item input { margin:0; padding:0; } -.simple_poll td .item label { letter-spacing:-1px; } - -.simple_poll td .resultItem { color:#636363; margin:6px 0 0 10px; letter-spacing:-1px;} - -.simple_poll td .barBox { margin-left:10px; } -.simple_poll td .barBox .bar { margin:3px 0;} -.simple_poll td .barBox .status {color:#AAAAAA; } - -.simple_poll td.stopDate { color:#AAAAAA; border-top:1px solid #BBBBBB; padding-top:3px;} -.simple_poll td.stopDate a { color:#AAAAAA; text-decoration:none; } - -.simple_poll td.poll_button { text-align:left; padding-top:3px;} -.simple_poll td.poll_button .poll_button { border:1px solid #EEEEEE; background-color:#AAAAAA; color:#FFFFFF; font-weight:bold; padding:1px 3px 1px 3px; height:20px; } - - -.simple_poll td.b { background-color:#F6F6F5; height:7px; } -.simple_poll td.b img { width:100%; height:6px; border-bottom:1px solid #E5E5E5; } -.simple_poll td.bb { height:7px; } -.simple_poll td.bb img { width:100%; height:6px; border-bottom:1px solid #E5E5E5; } +.rx_poll_smpl .rx_poll_content .poll_vote .poll_item_add input[type="text"]{ + width:100%; + box-sizing: border-box; + line-height: 25px; + font-size: 14px; + margin: 0; + padding: 8px 50px 8px 5px; + outline: none; + border: none; + border-bottom:1px solid #e0e0e0; +} +.rx_poll_smpl .rx_poll_content .poll_vote .poll_item_add input[type="button"]{position:absolute;right:0;top:7px;} \ No newline at end of file diff --git a/widgets/pollWidget/skins/simple/images/color_bar.png b/widgets/pollWidget/skins/simple/images/color_bar.png deleted file mode 100644 index 2afe557c0..000000000 Binary files a/widgets/pollWidget/skins/simple/images/color_bar.png and /dev/null differ diff --git a/widgets/pollWidget/skins/simple/js/poll.js b/widgets/pollWidget/skins/simple/js/poll.js index 74c5856c9..72dc02977 100644 --- a/widgets/pollWidget/skins/simple/js/poll.js +++ b/widgets/pollWidget/skins/simple/js/poll.js @@ -1,404 +1,334 @@ -function initTemplete(type) +function initRxSmplTemplete(type, poll_srl) { - switch(type) - { - case 'poll': - if(typeof window.template == 'undefined') - { - var source = jQuery("#entry-template").html(); - window.template = Handlebars.compile(source); - } - break; - case 'result': - if(typeof window.template_result == 'undefined') - { - var source = jQuery("#entry-template-result").html(); - window.template_result = Handlebars.compile(source); - } - break; - case 'members': - if(typeof window.template_member == 'undefined') - { - var source = jQuery("#entry-template-members").html(); - window.template_member = Handlebars.compile(source); - } - break; - } + switch(type) + { + case 'poll': + if (typeof window.poll_smpl_template == 'undefined') + { + var source = jQuery("#smpl-template-" + poll_srl).html(); + window.poll_smpl_template = Handlebars.compile(source); + } + break; + case 'result': + if (typeof window.poll_smpl_template_result == 'undefined') + { + var source = jQuery("#smpl-template-result-" + poll_srl).html(); + window.poll_smpl_template_result = Handlebars.compile(source); + } + break; + case 'members': + if (typeof window.poll_smpl_template_member == 'undefined') + { + var source = jQuery("#smpl-template-members-" + poll_srl).html(); + window.poll_smpl_template_member = Handlebars.compile(source); + } + break; + } } /* 설문 참여 함수 */ -function doPoll(fo_obj) { +function doRxSmplPoll(fo_obj) { + var checkcount = new Array(); + var item = new Array(); - var checkcount = new Array(); - var item = new Array(); + for(var i=0; i < fo_obj.length; i++) { + var obj = fo_obj[i]; + if (obj.nodeName != 'INPUT') { + continue; + } - for(var i=0;i -1) { + var t = name.split('_'); + var poll_srl_index = parseInt(t[1], 10); + checkcount[poll_srl_index] = obj.value; + item[poll_srl_index] = new Array(); - var name = obj.name; - if(name.indexOf('checkcount')>-1) { - var t = name.split('_'); - var poll_srl_index = parseInt(t[1],10); - checkcount[poll_srl_index] = obj.value; - item[poll_srl_index] = new Array(); + } else if (name.indexOf('item_') > -1) { + var t = name.split('_'); + var poll_srl = parseInt(t[1], 10); + var poll_srl_index = parseInt(t[2], 10); + if (obj.checked == true) { + item[poll_srl_index][item[poll_srl_index].length] = obj.value; + } + } + } - } else if(name.indexOf('item_')>-1) { - var t = name.split('_'); - var poll_srl = parseInt(t[1],10); - var poll_srl_index = parseInt(t[2],10); - if(obj.checked == true) item[poll_srl_index][item[poll_srl_index].length] = obj.value; - } - } + var poll_srl_indexes = ""; + for(var poll_srl_index in checkcount) { + if(!checkcount.hasOwnProperty(poll_srl_index)) { + continue; + } + var count = checkcount[poll_srl_index]; + var items = item[poll_srl_index]; + if(items.length < 1 || count < items.length) { + alert(poll_alert_lang); + return false; + } - var poll_srl_indexes = ""; - for(var poll_srl_index in checkcount) { - if(!checkcount.hasOwnProperty(poll_srl_index)) continue; - var count = checkcount[poll_srl_index]; - var items = item[poll_srl_index]; - if(items.length < 1 || count < items.length) { - alert(poll_alert_lang); - return false; - } + poll_srl_indexes += items.join(',')+','; + } + fo_obj.poll_srl_indexes.value = poll_srl_indexes; - poll_srl_indexes += items.join(',')+','; - } - fo_obj.poll_srl_indexes.value = poll_srl_indexes; + jQuery.exec_json("poll.procPoll", {"poll_srl":poll_srl,"poll_srl_indexes":poll_srl_indexes}, function(data){ + if (data.error != 0) { + alert(data.message); + } + else { + loadRxSmplPollResult(poll_srl); + jQuery("#poll_" + poll_srl + "_gotoresult_button").css({ + display: "none" + }); - jQuery.exec_json("poll.procPoll", {"poll_srl":poll_srl,"poll_srl_indexes":poll_srl_indexes}, function(data){ - if(data.error!=0) alert(data.message); - else - { - loadPollResult(poll_srl); - jQuery("#poll_" + poll_srl + "_gotoresult_button").css({ - display: "none" - }); + jQuery("#poll_" + poll_srl + "_result_nobutton").css({ + display: "block" + }); - jQuery("#poll_" + poll_srl + "_result_nobutton").css({ - display: "table-row" - }); - - jQuery("#poll_" + poll_srl + "_result_yesbutton").css({ - display: "none" - }); - } - }); - return false; + jQuery("#poll_" + poll_srl + "_result_yesbutton").css({ + display: "none" + }); + } + }); + return false; } /* 항목 추가 함수 */ -function addItem(poll_srl,poll_srl_indexes) { - jQuery.exec_json("poll.procPollInsertItem", {"srl":poll_srl,"index_srl":poll_srl_indexes,"title":jQuery("#new_item_" + poll_srl_indexes).val()}, function(data){ - if(data.error!=0) alert(data.message); - else - { - jQuery("#poll_" + poll_srl + "_result_button").css({ - display: "none" - }); +function addRxSmplItem(poll_srl, poll_srl_indexes) { + jQuery.exec_json("poll.procPollInsertItem", {"srl":poll_srl, "index_srl":poll_srl_indexes, "title":jQuery("#new_item_" + poll_srl_indexes).val()}, function(data){ + if (data.error!=0) { + alert(data.message); + } + else { + jQuery("#poll_" + poll_srl + "_result_button").css({ + display: "none" + }); - jQuery("#poll_" + poll_srl + "_result_nobutton").css({ - display: "table-row" - }); + jQuery("#poll_" + poll_srl + "_result_nobutton").css({ + display: "block" + }); - jQuery("#poll_" + poll_srl + "_result_yesbutton").css({ - display: "none" - }); + jQuery("#poll_" + poll_srl + "_result_yesbutton").css({ + display: "none" + }); - loadPoll(poll_srl); - } - }); - return false; + loadRxSmplPoll(poll_srl); + } + }); + return false; } /* 항목 삭제 함수 */ -function deleteItem(poll_srl,poll_srl_indexes,poll_item_srl) { - jQuery.exec_json("poll.procPollDeleteItem", {"srl":poll_srl,"index_srl":poll_srl_indexes,"item_srl":poll_item_srl}, function(data){ - if(data.error!=0) alert(data.message); - else - { - jQuery("#poll_" + poll_srl + "_result_button").css({ - display: "none" - }); +function deleteRxSmplItem(poll_srl, poll_srl_indexes, poll_item_srl) { + jQuery.exec_json("poll.procPollDeleteItem", {"srl":poll_srl, "index_srl":poll_srl_indexes, "item_srl":poll_item_srl}, function(data){ + if (data.error!=0) { + alert(data.message); + } + else { + jQuery("#poll_" + poll_srl + "_result_button").css({ + display: "none" + }); - jQuery("#poll_" + poll_srl + "_result_nobutton").css({ - display: "table-row" - }); + jQuery("#poll_" + poll_srl + "_result_nobutton").css({ + display: "block" + }); - jQuery("#poll_" + poll_srl + "_result_yesbutton").css({ - display: "none" - }); + jQuery("#poll_" + poll_srl + "_result_yesbutton").css({ + display: "none" + }); - loadPoll(poll_srl); - } - }); - return false; + loadRxSmplPoll(poll_srl); + } + }); + return false; } -function loadPoll(poll_srl,data) +function loadRxSmplPoll(poll_srl, data) { - if(typeof data == 'undefined') - { - jQuery.exec_json("poll.getPollinfo", {"poll_srl":poll_srl}, function(data){ - loadPoll(parseInt(data.poll.poll_srl),data); - }); - } - else - { - jQuery("#stop_date_"+poll_srl).html(data.poll.stop_date); + if (typeof data == 'undefined') { + jQuery.exec_json("poll.getPollinfo", {"poll_srl":poll_srl}, function(data){ + loadRxSmplPoll(parseInt(data.poll.poll_srl), data); + }); + } + else { + jQuery("#stop_date_"+poll_srl).html(data.poll.stop_date); - initTemplete('poll'); - var template = window.template; - var context = Object; - var additem = data.caniadditem; - context.questions = {}; - for (var i in data.poll.poll) { - var poll = data.poll.poll[i]; - context.questions[i] = {}; - context.questions[i].poll_index_srl = poll.poll_index_srl; - context.questions[i].checkcount = poll.checkcount; - context.questions[i].title = poll.title; - context.questions[i].items = poll.item; - context.questions[i].poll_srl = poll_srl; - context.questions[i].isMultipleChoice = (poll.checkcount>1); - context.questions[i].additem = additem; - } - var html = template(context); + initRxSmplTemplete('poll', poll_srl); + var template = window.poll_smpl_template; + var context = Object; + var additem = data.caniadditem; + context.questions = {}; + for (var i in data.poll.poll) { + var poll = data.poll.poll[i]; + context.questions[i] = {}; + context.questions[i].poll_index_srl = poll.poll_index_srl; + context.questions[i].checkcount = poll.checkcount; + context.questions[i].title = poll.title; + context.questions[i].items = poll.item; + context.questions[i].poll_srl = poll_srl; + context.questions[i].isMultipleChoice = (poll.checkcount > 1); + context.questions[i].additem = additem; + } + var html = template(context); - jQuery("#poll_content_" + poll_srl).html(html); + jQuery("#poll_content_" + poll_srl).html(html); - jQuery("#poll_" + poll_srl).css({ - display: "block" - }); - jQuery("#poll_" + poll_srl + '_result').css({ - display: "none" - }); - } + jQuery("#poll_" + poll_srl).css({ + display: "block" + }); + jQuery("#poll_" + poll_srl + '_result').css({ + display: "none" + }); + } } -function showPollMemberNext(poll_srl,poll_item_srl) +function showRxSmplPollMemberNext(poll_srl, poll_item_srl) { - if(typeof window.cur_page == 'undefined') - { - window.cur_page = 1; - } + if (typeof window.cur_page == 'undefined') { + window.cur_page = 1; + } - window.cur_page++; + window.cur_page++; - jQuery.exec_json("poll.getPollitemInfo", {"poll_srl":poll_srl,"poll_item":poll_item_srl,"page":window.cur_page}, function(data){ - initTemplete('members'); - var template = window.template_member; - var context = Object; + jQuery.exec_json("poll.getPollitemInfo", {"poll_srl":poll_srl, "poll_item":poll_item_srl, "page":window.cur_page}, function(data){ + initRxSmplTemplete('members', poll_srl); + var template = window.poll_smpl_template_member; + var context = Object; - context.poll_srl = poll_srl; - context.poll_item_srl = poll_item_srl; - context.page = window.cur_page; - context.isPage = ((data.page.total_count>5) && (window.cur_page 5) && (window.cur_page < data.page.total_page)); - context.members = {}; + context.members = {}; - for (var i in data.item.member) { - var member = data.item.member[i]; + for (var i in data.item.member) { + var member = data.item.member[i]; - context.members[i] = {}; - context.members[i].profile_image = member.profile_image; - context.members[i].member_srl = member.member_srl; - context.members[i].nick_name = member.nick_name; - context.members[i].isImage = (member.profile_image != ''); - context.members[i].dummy_profile = data.dummy_profile; - } - var html = template(context); + context.members[i] = {}; + context.members[i].profile_image = member.profile_image; + context.members[i].member_srl = member.member_srl; + context.members[i].nick_name = member.nick_name; + context.members[i].isImage = (member.profile_image != ''); + context.members[i].dummy_profile = data.dummy_profile; + } + var html = template(context); - jQuery("#btn_load_more_" + poll_item_srl).replaceWith(html); - }); - - return false; -} - -function showPollMember(poll_srl,poll_item_srl) -{ - window.cur_page = 1; - - jQuery.exec_json("poll.getPollitemInfo", {"poll_srl":poll_srl,"poll_item":poll_item_srl,"page":window.cur_page}, function(data){ - initTemplete('members'); - var template = window.template_member; - var context = Object; - var title = poll_member_lang; - title = title.replace("%s",data.item.title); - var html = '
' + title + '
    '; - context.poll_srl = poll_srl; - context.poll_item_srl = poll_item_srl; - context.page = window.cur_page; - context.isPage = ((data.page.total_count>5) && (window.cur_page
'; - - jQuery("#poll_content_" + poll_srl + "_result").html(html); - - jQuery("#poll_" + poll_srl + "_gotoresult_button").css({ - display: "table-row" - }); - - jQuery("#poll_" + poll_srl + "_result_nobutton").css({ - display: "none" - }); - - jQuery("#poll_" + poll_srl + "_result_yesbutton").css({ - display: "table-row" - }); - }); - - return false; -} - -function loadPollResult(poll_srl,data) -{ - if(typeof data == 'undefined') - { - jQuery.exec_json("poll.getPollinfo", {"poll_srl":poll_srl}, function(data){ - loadPollResult(parseInt(data.poll.poll_srl),data); - }); - } - else - { - jQuery("#stop_date_result_" + poll_srl).html(data.poll.stop_date); - jQuery("#poll_count_result_" + poll_srl).html(data.poll.poll_count); - - initTemplete('result'); - var template = window.template_result; - var context = Object; - var showMembers = (data.poll.poll_type==1 || data.poll.poll_type==3); - context.questions = {}; - for (var i in data.poll.poll) { - var poll = data.poll.poll[i]; - context.questions[i] = {}; - context.questions[i].poll_index_srl = poll.poll_index_srl; - context.questions[i].checkcount = poll.checkcount; - context.questions[i].title = poll.title; - context.questions[i].poll_count = poll.poll_count; - context.questions[i].showMembers = showMembers; - context.questions[i].items = poll.item; - var count = 0; - for (var j in poll.item) { - var item = poll.item[j]; - count++; - if(poll.poll_count>0) - { - context.questions[i].items[j].per = Math.round((item.poll_count / poll.poll_count)*100); - context.questions[i].items[j].isVote = true; - } - else - { - context.questions[i].items[j].per = 0; - context.questions[i].items[j].isVote = false; - } - context.questions[i].items[j].number = count; - } - context.questions[i].items = poll.item; - context.questions[i].poll_srl = poll_srl; - context.questions[i].isMultipleChoice = (poll.checkcount>1); - } - var html = template(context); - - jQuery("#poll_content_" + poll_srl + "_result").html(html); - jQuery("#poll_" + poll_srl).css({ - display: "none" - }); - jQuery("#poll_" + poll_srl + '_result').css({ - display: "block" - }); - } -} - -jQuery(function($){ - /* View poll result */ - $('._poll_result').click(function(){ - var cls = $(this).attr('class'), srl, skin; - - try{ - srl = cls.match(/\b_srl_(\d+)\b/)[1]; - }catch(e){ }; - - if(!srl) return false; - - jQuery("#poll_" + srl + "_result_button").css({ - display: "table-row" - }); - - jQuery("#poll_" + srl + "_result_nobutton").css({ - display: "none" - }); - - jQuery("#poll_" + srl + "_result_yesbutton").css({ - display: "table-row" - }); - - loadPollResult(srl); - - return false; + jQuery("#btn_load_more_" + poll_item_srl).replaceWith(html); }); - /* goto poll result */ - $('._gotoresult_screen').click(function(){ - var cls = $(this).attr('class'), srl, skin; + return false; +} - try{ - srl = cls.match(/\b_srl_(\d+)\b/)[1]; - }catch(e){ }; +function showRxSmplPollMember(poll_srl, poll_item_srl) +{ + window.cur_page = 1; - if(!srl) return false; + jQuery.exec_json("poll.getPollitemInfo", {"poll_srl":poll_srl, "poll_item":poll_item_srl, "page":window.cur_page}, function(data){ + initRxSmplTemplete('members', poll_srl); + var template = window.poll_smpl_template_member; + var context = Object; + var title = poll_member_lang; + title = title.replace("%s", data.item.title); + var html = '
' + title + '
    '; + context.poll_srl = poll_srl; + context.poll_item_srl = poll_item_srl; + context.page = window.cur_page; + context.isPage = ((data.page.total_count > 5) && (window.cur_page < data.page.total_count)); - jQuery("#poll_" + srl + "_gotoresult_button").css({ - display: "none" - }); + context.members = {}; - jQuery("#poll_" + srl + "_result_nobutton").css({ - display: "table-row" - }); + for (var i in data.item.member) { + var member = data.item.member[i]; - jQuery("#poll_" + srl + "_result_yesbutton").css({ - display: "none" - }); + context.members[i] = {}; + context.members[i].profile_image = member.profile_image; + context.members[i].member_srl = member.member_srl; + context.members[i].nick_name = member.nick_name; + context.members[i].isImage = (member.profile_image != ''); + context.members[i].dummy_profile = data.dummy_profile; + } + html = html + template(context) + '
'; - loadPollResult(srl); + jQuery("#poll_content_" + poll_srl + "_result").html(html); - return false; - }); + jQuery("#poll_" + poll_srl + '_result_button').css({ + display: "none" + }); + jQuery("#poll_" + poll_srl + '_gotoresult_button').css({ + display: "block" + }); + }); - /* View poll screen */ - $('._poll_screen').click(function(){ - var cls = $(this).attr('class'), srl, skin; + return false; +} - try{ - srl = cls.match(/\b_srl_(\d+)\b/)[1]; - }catch(e){ }; +function loadRxSmplPollResult(poll_srl, data) +{ + if (typeof data == 'undefined') { + jQuery.exec_json("poll.getPollinfo", {"poll_srl":poll_srl}, function(data){ + loadRxSmplPollResult(parseInt(data.poll.poll_srl), data); + }); + } + else { + jQuery("#stop_date_result_" + poll_srl).html(data.poll.stop_date); + jQuery("#poll_count_result_" + poll_srl).html(data.poll.poll_count); - if(!srl) return false; + initRxSmplTemplete('result', poll_srl); + var template = window.poll_smpl_template_result; + var context = Object; + var showMembers = (data.poll.poll_type==1 || data.poll.poll_type==3); + context.questions = {}; + for (var i in data.poll.poll) { + var poll = data.poll.poll[i]; + context.questions[i] = {}; + context.questions[i].poll_index_srl = poll.poll_index_srl; + context.questions[i].checkcount = poll.checkcount; + context.questions[i].title = poll.title; + context.questions[i].poll_count = poll.poll_count; + context.questions[i].showMembers = showMembers; + context.questions[i].items = poll.item; + var count = 0; + for (var j in poll.item) { + var item = poll.item[j]; + count++; + if (poll.poll_count > 0) { + context.questions[i].items[j].per = Math.round((item.poll_count / poll.poll_count)*100); + context.questions[i].items[j].isVote = true; + } + else { + context.questions[i].items[j].per = 0; + context.questions[i].items[j].isVote = false; + } + context.questions[i].items[j].number = count; + } + context.questions[i].items = poll.item; + context.questions[i].poll_srl = poll_srl; + context.questions[i].isMultipleChoice = (poll.checkcount > 1); + } + var html = template(context); - jQuery("#poll_" + srl + "_result_button").css({ - display: "none" - }); + jQuery("#poll_content_" + poll_srl + "_result").html(html); + jQuery("#poll_" + poll_srl).css({ + display: "none" + }); + jQuery("#poll_" + poll_srl + '_result').css({ + display: "block" + }); - jQuery("#poll_" + srl + "_result_nobutton").css({ - display: "table-row" - }); + // do not display back to result button, because, this is that page. + jQuery("#poll_" + poll_srl + '_gotoresult_button').css({ + display: "none" + }); - jQuery("#poll_" + srl + "_result_yesbutton").css({ - display: "none" - }); - - loadPoll(srl); - - return false; - }); -}); + // Check if the user have voted or not. If xe (he or she) have done, do not display back to the poll button + if (data.poll.is_polled == 0) { + jQuery("#poll_" + poll_srl + '_result_button').css({ + display: "block" + }); + } + else { + jQuery("#poll_" + poll_srl + '_result_button').css({ + display: "none" + }); + } + } +} \ No newline at end of file diff --git a/widgets/pollWidget/skins/simple/pollview.html b/widgets/pollWidget/skins/simple/pollview.html index ce577ce84..c03cdd819 100644 --- a/widgets/pollWidget/skins/simple/pollview.html +++ b/widgets/pollWidget/skins/simple/pollview.html @@ -3,113 +3,107 @@ var poll_alert_lang = "{$lang->msg_check_poll_item}"; var poll_checkcount_lang = "{$lang->poll_checkcount}"; var poll_member_lang = "{$lang->poll_item_members}"; - jQuery(document).ready(function(){ - var data = {json_encode($poll_data)}; - if(data.poll.is_polled==0) loadPoll({$poll_srl},data); - else - { - loadPollResult({$poll_srl},data); - jQuery("#poll_{$poll_srl}_result_button").css({ - display: "none" - }); - - jQuery("#poll_{$poll_srl}_result_nobutton").css({ - display: "table-row" - }); - - jQuery("#poll_{$poll_srl}_result_yesbutton").css({ - display: "none" - }); - } + jQuery(document).ready(function() { + var data = {json_encode($poll_data)}; + if (data.poll.is_polled == 0) { + loadRxSmplPoll({$poll_srl},data); + } + else { + loadRxSmplPollResult({$poll_srl},data); + } }); -
+