From e4d55fc4d137aa84275799b6e3665da187d49275 Mon Sep 17 00:00:00 2001 From: zero Date: Thu, 11 Oct 2007 01:33:03 +0000 Subject: [PATCH] =?UTF-8?q?#174=20=EC=84=A4=EB=AC=B8=EC=A1=B0=EC=82=AC=20?= =?UTF-8?q?=EA=B2=B0=EA=B3=BC=20=EB=B3=B4=EA=B8=B0=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://xe-core.googlecode.com/svn/sandbox@2733 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- modules/poll/conf/module.xml | 1 + modules/poll/lang/en.lang.php | 1 + modules/poll/lang/es.lang.php | 1 + modules/poll/lang/jp.lang.php | 1 + modules/poll/lang/ko.lang.php | 1 + modules/poll/lang/zh-CN.lang.php | 1 + modules/poll/poll.controller.php | 13 ++++++++ modules/poll/poll.model.php | 45 +++++++++++++++++++++++++++ modules/poll/skins/default/form.html | 7 ++++- modules/poll/skins/default/js/poll.js | 11 ++++++- 10 files changed, 80 insertions(+), 2 deletions(-) diff --git a/modules/poll/conf/module.xml b/modules/poll/conf/module.xml index 38ffc0de3..683c8f603 100644 --- a/modules/poll/conf/module.xml +++ b/modules/poll/conf/module.xml @@ -11,6 +11,7 @@ + diff --git a/modules/poll/lang/en.lang.php b/modules/poll/lang/en.lang.php index 4ed199b3c..3e4d13a26 100644 --- a/modules/poll/lang/en.lang.php +++ b/modules/poll/lang/en.lang.php @@ -13,6 +13,7 @@ $lang->cmd_poll_list = 'View poll list'; $lang->cmd_delete_checked_poll = 'Delete selected poll'; $lang->cmd_apply_poll = 'Apply poll'; + $lang->cmd_view_result = 'Preview result'; $lang->cmd_delete_checked_poll = 'Delete selected poll'; $lang->success_poll = 'Thank you for joining the poll.'; diff --git a/modules/poll/lang/es.lang.php b/modules/poll/lang/es.lang.php index 92a082ef6..e640e76ff 100644 --- a/modules/poll/lang/es.lang.php +++ b/modules/poll/lang/es.lang.php @@ -13,6 +13,7 @@ $lang->cmd_poll_list = 'Ver la lista de la encuesta'; $lang->cmd_delete_checked_poll = 'Eliminar la encuesta seleccionada'; $lang->cmd_apply_poll = 'Aplicar la encuesta'; + $lang->cmd_view_result = 'Preview result'; $lang->cmd_delete_checked_poll = 'Eliminar la encuesta seleccionada'; $lang->success_poll = 'Gracias por participar en la encuesta.'; diff --git a/modules/poll/lang/jp.lang.php b/modules/poll/lang/jp.lang.php index a4c4aa0d9..cf5798b21 100644 --- a/modules/poll/lang/jp.lang.php +++ b/modules/poll/lang/jp.lang.php @@ -13,6 +13,7 @@ $lang->cmd_poll_list = 'アンケートのリスト表示'; $lang->cmd_delete_checked_poll = '選択項目削除'; $lang->cmd_apply_poll = 'アンケート調査へ参加する'; + $lang->cmd_view_result = 'Preview result'; $lang->cmd_delete_checked_poll = '選択アンケート削除'; $lang->success_poll = 'アンケート調査へのご応募ありがとうございます。'; diff --git a/modules/poll/lang/ko.lang.php b/modules/poll/lang/ko.lang.php index f39c3f6c4..fd579635c 100644 --- a/modules/poll/lang/ko.lang.php +++ b/modules/poll/lang/ko.lang.php @@ -13,6 +13,7 @@ $lang->cmd_poll_list = '설문조사 목록 보기'; $lang->cmd_delete_checked_poll = '선택항목 삭제'; $lang->cmd_apply_poll = '설문 참여'; + $lang->cmd_view_result = '결과 보기'; $lang->cmd_delete_checked_poll = '선택 설문 삭제'; $lang->success_poll = '설문에 응하여 주셔서 감사합니다'; diff --git a/modules/poll/lang/zh-CN.lang.php b/modules/poll/lang/zh-CN.lang.php index eb99a2826..ae2bc1319 100644 --- a/modules/poll/lang/zh-CN.lang.php +++ b/modules/poll/lang/zh-CN.lang.php @@ -13,6 +13,7 @@ $lang->cmd_poll_list = '查看目录'; $lang->cmd_delete_checked_poll = '删除所选项目'; $lang->cmd_apply_poll = '参与投票'; + $lang->cmd_view_result = 'Preview result'; $lang->cmd_delete_checked_poll = '删除所选'; $lang->success_poll = '感谢您参与投票。'; diff --git a/modules/poll/poll.controller.php b/modules/poll/poll.controller.php index 0ae6f62a6..204d0d539 100644 --- a/modules/poll/poll.controller.php +++ b/modules/poll/poll.controller.php @@ -190,5 +190,18 @@ $this->add('tpl',$tpl); $this->setMessage('success_poll'); } + + /** + * @brief 결과 미리 보기 + **/ + function procPollViewResult() { + $poll_srl = Context::get('poll_srl'); + + $oPollModel = &getModel('poll'); + $tpl = $oPollModel->getPollResultHtml($poll_srl); + + $this->add('poll_srl', $poll_srl); + $this->add('tpl',$tpl); + } } ?> diff --git a/modules/poll/poll.model.php b/modules/poll/poll.model.php index 582f9f465..0f137e9ab 100644 --- a/modules/poll/poll.model.php +++ b/modules/poll/poll.model.php @@ -84,6 +84,51 @@ return $oTemplate->compile($tpl_path, $tpl_file); } + /** + * @brief 결과 html을 return + **/ + function getPollResultHtml($poll_srl) { + $args->poll_srl = $poll_srl; + + // 해당 설문조사에 대한 내용을 조사 + $output = executeQuery('poll.getPoll', $args); + if(!$output->data) return ''; + + $poll->style = $style; + $poll->poll_count = (int)$output->data->poll_count; + $poll->stop_date = $output->data->stop_date; + + $output = executeQuery('poll.getPollTitle', $args); + if(!$output->data) return; + if(!is_array($output->data)) $output->data = array($output->data); + foreach($output->data as $key => $val) { + $poll->poll[$val->poll_index_srl]->title = $val->title; + $poll->poll[$val->poll_index_srl]->checkcount = $val->checkcount; + $poll->poll[$val->poll_index_srl]->poll_count = $val->poll_count; + } + + $output = executeQuery('poll.getPollItem', $args); + foreach($output->data as $key => $val) { + $poll->poll[$val->poll_index_srl]->item[] = $val; + } + + $poll->poll_srl = $poll_srl; + + $tpl_file = "result"; + + Context::set('poll',$poll); + + // 기본 설정의 스킨, 컬러셋 설정 + $oModuleModel = &getModel('module'); + $poll_config = $oModuleModel->getModuleConfig('poll'); + if(!$poll_config->skin) $poll_config->skin = 'default'; + Context::set('poll_config', $poll_config); + $tpl_path = sprintf("%sskins/%s/", $this->module_path, $poll_config->skin); + + $oTemplate = &TemplateHandler::getInstance(); + return $oTemplate->compile($tpl_path, $tpl_file); + } + /** * @brief 선택된 설문조사 - 스킨의 컬러셋을 return **/ diff --git a/modules/poll/skins/default/form.html b/modules/poll/skins/default/form.html index 4cdc7e7bf..afdd700ce 100644 --- a/modules/poll/skins/default/form.html +++ b/modules/poll/skins/default/form.html @@ -64,7 +64,12 @@ blank -
+ +
+ + +
+ lb diff --git a/modules/poll/skins/default/js/poll.js b/modules/poll/skins/default/js/poll.js index 0e4d35904..5bfc05e45 100644 --- a/modules/poll/skins/default/js/poll.js +++ b/modules/poll/skins/default/js/poll.js @@ -42,10 +42,19 @@ function doPoll(fo_obj) { /* 설문 조사후 내용을 바꿀 함수 */ function completePoll(ret_obj) { - alert(ret_obj['message']); var poll_srl = ret_obj['poll_srl']; var tpl = ret_obj['tpl']; var width = xWidth("poll_"+poll_srl); xInnerHtml("poll_"+poll_srl, tpl); xWidth("poll_"+poll_srl, width); } + +/* 설문 미리 보기 */ +function doPollViewResult(poll_srl) { + var params = new Array(); + params['poll_srl'] = poll_srl; + + var response_tags = new Array('error','message','poll_srl', 'tpl'); + + exec_xml('poll','procPollViewResult', params, completePoll, response_tags); +}