diff --git a/modules/editor/components/poll_maker/poll_maker.class.php b/modules/editor/components/poll_maker/poll_maker.class.php index dda44c901..f4e9d5336 100644 --- a/modules/editor/components/poll_maker/poll_maker.class.php +++ b/modules/editor/components/poll_maker/poll_maker.class.php @@ -23,6 +23,11 @@ * @brief popup window요청시 popup window에 출력할 내용을 추가하면 된다 **/ function getPopupContent() { + // 설문조사 스킨을 구함 + $oModuleModel = &getModel('module'); + $skin_list = $oModuleModel->getSkins("./modules/poll/"); + Context::set('skin_list', $skin_list); + // 템플릿을 미리 컴파일해서 컴파일된 소스를 return $tpl_path = $this->component_path.'tpl'; $tpl_file = 'popup.html'; @@ -39,6 +44,8 @@ **/ function transHTML($xml_obj) { $poll_srl = $xml_obj->attrs->poll_srl; + $skin = $xml_obj->attrs->skin; + if(!$skin) $skin = 'default'; preg_match('/width([^[:digit:]]+)([0-9]+)/i',$xml_obj->attrs->style,$matches); $width = $matches[2]; @@ -47,7 +54,7 @@ // poll model 객체 생성해서 html 얻어와서 return $oPollModel = &getModel('poll'); - return $oPollModel->getPollHtml($poll_srl, $style); + return $oPollModel->getPollHtml($poll_srl, $style, $skin); } } ?> diff --git a/modules/editor/components/poll_maker/tpl/popup.css b/modules/editor/components/poll_maker/tpl/popup.css index a85f967ec..43eb2c09a 100644 --- a/modules/editor/components/poll_maker/tpl/popup.css +++ b/modules/editor/components/poll_maker/tpl/popup.css @@ -1,8 +1,19 @@ @charset "utf-8"; @import url(../../../../../modules/admin/tpl/css/admin.css); -.pollButton { clear:both; margin:.5em 0 0 0; height:20px; } -.pollButton label { vertical-align:middle; color:#888888; } +.display_date { cursor:pointer; width:80px; float:left; border:1px solid; border-color:#a6a6a6 #d8d8d8 #d8d8d8 #a6a6a6; height:1em; padding:3px; font-family:tahoma; } + +.adminTable { margin-bottom:0 !important; } + +.pollButton { clear:both; overflow:hidden; border:1px solid #E3E3E2; border-top:none; background-color:#FAF8F4; padding:4px; } +.pollButton .fl { padding:5px 0 0 10px; color:#AAAAAA; } +.pollButton .fl label { vertical-align:middle; color:#888888; } +.pollButton .fr { padding:5px 10px 0 0; color:#AAAAAA; } +.pollButton .fr a { color:#444444; text-decoration:none; font-weight:bold;} +.pollButton .fr a.delPoll { color:red; font-weight:normal;} li { list-style:none; margin-right:5px; float:left; color:#666666} li a { text-decoration:none; color:#666666;} + +#popFooter .fl { margin-left:10px; } +#popFooter .fr { margin-right:10px; } diff --git a/modules/editor/components/poll_maker/tpl/popup.html b/modules/editor/components/poll_maker/tpl/popup.html index d14b4f66c..4aa1b9675 100644 --- a/modules/editor/components/poll_maker/tpl/popup.html +++ b/modules/editor/components/poll_maker/tpl/popup.html @@ -3,6 +3,18 @@ + + + + + + + + + + + + @@ -16,6 +28,7 @@ +
@@ -25,30 +38,20 @@ {$lang->poll_stop_date} - +
{date("Y-m-d",time()+60*60*24*30)}
+ + + + + {$lang->skin} + + @@ -76,25 +79,29 @@
- - - +
+ + +
+ +
-
- - {$lang->cmd_close} - {$lang->about_component} +
+ +
diff --git a/modules/editor/components/poll_maker/tpl/popup.js b/modules/editor/components/poll_maker/tpl/popup.js index 8e3618100..80981a6bc 100644 --- a/modules/editor/components/poll_maker/tpl/popup.js +++ b/modules/editor/components/poll_maker/tpl/popup.js @@ -33,10 +33,13 @@ function setPoll() { function completeInsertPoll(ret_obj) { if(typeof(opener)=="undefined") return null; + var fo_obj = xGetElementById('fo_component'); + var skin = fo_obj.skin.options[fo_obj.skin.selectedIndex].value; + var poll_srl = ret_obj["poll_srl"]; if(!poll_srl) return null; - var text = ""; + var text = ""; alert(ret_obj['message']); @@ -79,7 +82,7 @@ function doPollAdd() { * 항목 삭제 **/ function doPollDelete(obj) { - var pobj = obj.parentNode.parentNode.parentNode.parentNode; + var pobj = obj.parentNode.parentNode.parentNode; var tmp_arr = pobj.id.split('_'); var index = tmp_arr[1]; if(index==1) return; @@ -103,7 +106,7 @@ function doPollDelete(obj) { * 새 항목 추가 **/ function doPollAddItem(obj) { - var tbl = xPrevSib(obj.parentNode.parentNode.parentNode); + var tbl = xPrevSib(obj.parentNode.parentNode); var tbody = tbl.lastChild; var tmp = tbody.firstChild; var source = null; diff --git a/modules/poll/poll.controller.php b/modules/poll/poll.controller.php index 3e75d95c1..9a4e049a4 100644 --- a/modules/poll/poll.controller.php +++ b/modules/poll/poll.controller.php @@ -24,12 +24,8 @@ $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; if(!$upload_target_srl) $upload_target_srl = getNextSequence(); - $stop_year = Context::get('stop_year'); - $stop_month = Context::get('stop_month'); - $stop_day = Context::get('stop_day'); - - $stop_date = sprintf('%04d%02d%02d235959', $stop_year, $stop_month, $stop_day); - if($stop_date < date("YmdHis")) $stop_date = date("YmdHis", time()+60*60*24*365); + $stop_date = Context::get('stop_date'); + if($stop_date < date("Ymd")) $stop_date = date("YmdHis", time()+60*60*24*365); $vars = Context::getRequestVars(); foreach($vars as $key => $val) { @@ -111,17 +107,6 @@ } } - // 작성자의 정보를 로그로 남김 - /* - $log_args->poll_srl = $poll_srl; - $log_args->member_srl = $member_srl; - $output = executeQuery('poll.insertPollLog', $log_args); - if(!$output->toBool()) { - $oDB->rollback(); - return $output; - } - */ - $oDB->commit(); $this->add('poll_srl', $poll_srl); @@ -198,9 +183,11 @@ **/ function procPollViewResult() { $poll_srl = Context::get('poll_srl'); + $skin = Context::get('skin'); + if(!$skin || !is_dir('./modules/poll/skins/'.$skin)) $skin = 'default'; $oPollModel = &getModel('poll'); - $tpl = $oPollModel->getPollResultHtml($poll_srl); + $tpl = $oPollModel->getPollResultHtml($poll_srl, $skin); $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 0f137e9ab..a5c07f0b3 100644 --- a/modules/poll/poll.model.php +++ b/modules/poll/poll.model.php @@ -17,7 +17,6 @@ * @brief 이미 설문 조사를 하였는지 검사하는 함수 **/ function isPolled($poll_srl) { - $args->poll_srl = $poll_srl; if(Context::get('is_logged')) { @@ -35,7 +34,7 @@ * @brief 설문조사의 html데이터를 return * 설문조사에 응하였는지에 대한 체크를 한 후 결과를 return **/ - function getPollHtml($poll_srl, $style = '') { + function getPollHtml($poll_srl, $style = '', $skin = 'default') { $args->poll_srl = $poll_srl; @@ -64,7 +63,7 @@ $poll->poll_srl = $poll_srl; // 종료일이 지났으면 무조건 결과만 - if($poll->stop_date > date("YmdHis")) { + if($poll->stop_date > date("Ymd")) { if($this->isPolled($poll_srl)) $tpl_file = "result"; else $tpl_file = "form"; } else { @@ -72,13 +71,10 @@ } Context::set('poll',$poll); + Context::set('skin',$skin); // 기본 설정의 스킨, 컬러셋 설정 - $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); + $tpl_path = sprintf("%sskins/%s/", $this->module_path, $skin); $oTemplate = &TemplateHandler::getInstance(); return $oTemplate->compile($tpl_path, $tpl_file); @@ -87,7 +83,7 @@ /** * @brief 결과 html을 return **/ - function getPollResultHtml($poll_srl) { + function getPollResultHtml($poll_srl, $skin = 'default') { $args->poll_srl = $poll_srl; // 해당 설문조사에 대한 내용을 조사 @@ -119,11 +115,7 @@ 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); + $tpl_path = sprintf("%sskins/%s/", $this->module_path, $skin); $oTemplate = &TemplateHandler::getInstance(); return $oTemplate->compile($tpl_path, $tpl_file); diff --git a/modules/poll/skins/default/form.html b/modules/poll/skins/default/form.html index afdd700ce..aa9ee465d 100644 --- a/modules/poll/skins/default/form.html +++ b/modules/poll/skins/default/form.html @@ -11,6 +11,7 @@
+ @@ -23,7 +24,7 @@ @@ -66,7 +67,7 @@ diff --git a/modules/poll/skins/default/js/poll.js b/modules/poll/skins/default/js/poll.js index 14e0bb3e7..5c359e814 100644 --- a/modules/poll/skins/default/js/poll.js +++ b/modules/poll/skins/default/js/poll.js @@ -51,10 +51,13 @@ function completePoll(ret_obj) { } /* 설문 미리 보기 */ -function doPollViewResult(poll_srl) { +function doPollViewResult(poll_srl, skin) { var params = new Array(); params['poll_srl'] = poll_srl; + if(typeof(skin)=='undefined') skin = 'default'; + params['skin'] = skin; + var response_tags = new Array('error','message','poll_srl', 'tpl'); exec_xml('poll','procPollViewResult', params, completePoll, response_tags); diff --git a/modules/poll/skins/simple/css/.poll.css.swp b/modules/poll/skins/simple/css/.poll.css.swp new file mode 100644 index 000000000..ec18e38c6 Binary files /dev/null and b/modules/poll/skins/simple/css/.poll.css.swp differ diff --git a/modules/poll/skins/simple/css/poll.css b/modules/poll/skins/simple/css/poll.css new file mode 100644 index 000000000..c4a94464b --- /dev/null +++ b/modules/poll/skins/simple/css/poll.css @@ -0,0 +1,26 @@ +.simple_poll { table-layout:fixed; width:100%; padding:0; border:none;} + +.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; } +.simple_poll td .checkcount { color:#AAAAAA; } +.simple_poll td .item { color:#636363; margin:3px 0 0 10px; } +.simple_poll td .item input { margin:0; padding:0; } + +.simple_poll td .barBox { margin-left:10px; position:relative; height:20px; } +.simple_poll td .barBox .bar { margin-right:100px; margin-top:7px; } +.simple_poll td .barBox .status { position:absolute; right:0; top:0; } + +.simple_poll td.stopDate { text-align:right; 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; border-top:1px solid #BBBBBB; 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; } diff --git a/modules/poll/skins/simple/filter/poll.xml b/modules/poll/skins/simple/filter/poll.xml new file mode 100644 index 000000000..2639e3195 --- /dev/null +++ b/modules/poll/skins/simple/filter/poll.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/modules/poll/skins/simple/form.html b/modules/poll/skins/simple/form.html new file mode 100644 index 000000000..6ebd8f874 --- /dev/null +++ b/modules/poll/skins/simple/form.html @@ -0,0 +1,61 @@ + + + + + + +
+ + + + + + +
- {$lang->poll_stop_date} : {zdate($poll->stop_date, "Y-m-d")} {zdate($poll->stop_date, "H:i")} + {$lang->poll_stop_date} : {zdate($poll->stop_date, "Y-m-d")}
- +
+ + + + + + + + +
+ {@ $_key = 0} + +
0)-->class="itemDiv"> + + +
{$val->title}
+ + +
({$lang->poll_checkcount} : {$val->checkcount})
+ + + + {@$_idx = $poll->poll_srl.'_'.$poll_srl_index.'_'.$item_srl} + +
+ + + + + + +
+
+ + + {@ $_key++} + +
+ + + ~{zdate($poll->stop_date, "Y-m-d")} ({$lang->cmd_view_result}) +
+ +
+ +
diff --git a/modules/poll/skins/simple/images/color_bar.png b/modules/poll/skins/simple/images/color_bar.png new file mode 100755 index 000000000..2afe557c0 Binary files /dev/null and b/modules/poll/skins/simple/images/color_bar.png differ diff --git a/modules/poll/skins/simple/js/poll.js b/modules/poll/skins/simple/js/poll.js new file mode 100644 index 000000000..5c359e814 --- /dev/null +++ b/modules/poll/skins/simple/js/poll.js @@ -0,0 +1,64 @@ +/* 설문 참여 함수 */ +function doPoll(fo_obj) { + + var checkcount = new Array(); + var item = new Array(); + + 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(); + + } 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; + } + + poll_srl_indexes += items.join(',')+','; + } + fo_obj.poll_srl_indexes.value = poll_srl_indexes; + + procFilter(fo_obj, poll); + return false; +} + +/* 설문 조사후 내용을 바꿀 함수 */ +function completePoll(ret_obj) { + 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, skin) { + var params = new Array(); + params['poll_srl'] = poll_srl; + + if(typeof(skin)=='undefined') skin = 'default'; + params['skin'] = skin; + + var response_tags = new Array('error','message','poll_srl', 'tpl'); + + exec_xml('poll','procPollViewResult', params, completePoll, response_tags); +} diff --git a/modules/poll/skins/simple/result.html b/modules/poll/skins/simple/result.html new file mode 100644 index 000000000..8d1d18bbf --- /dev/null +++ b/modules/poll/skins/simple/result.html @@ -0,0 +1,36 @@ + + +
+ + + + + +
+ {@ $_key = 0} + +
0)-->class="itemDiv"> + +
{$val->title} ({$val->poll_count})
+ + + {@$per = (int)(( $item->poll_count / $val->poll_count)*100) } + {@$per = 1; } + +
+ {$item->title} +
+ +
+
bar
+
{$item->poll_count} ({$per}%)
+
+
+ + +
+ {@ $_key++} + +
+ +
diff --git a/modules/poll/skins/simple/skin.xml b/modules/poll/skins/simple/skin.xml new file mode 100644 index 000000000..bab3143bc --- /dev/null +++ b/modules/poll/skins/simple/skin.xml @@ -0,0 +1,16 @@ + + + 설문조사 간단한 스킨 + + 제로 + 설문조사 간단한 스킨 + + + + 기본 + 默认 + デフォルト + Default + + +