diff --git a/classes/module/ModuleHandler.class.php b/classes/module/ModuleHandler.class.php index a8f7fc333..7562e6bf1 100644 --- a/classes/module/ModuleHandler.class.php +++ b/classes/module/ModuleHandler.class.php @@ -248,9 +248,11 @@ **/ // 상위 클래스명 구함 - $high_class_file = sprintf('%s%s.class.php', $class_path, $module); - if(!file_exists($high_class_file)) return NULL; - require_once($high_class_file); + if(!class_exists($module)) { + $high_class_file = sprintf('%s%s.class.php', $class_path, $module); + if(!file_exists($high_class_file)) return NULL; + require_once($high_class_file); + } // 객체의 이름을 구함 switch($type) { diff --git a/index.php b/index.php index a5b9b0b14..3e6605d98 100644 --- a/index.php +++ b/index.php @@ -1,5 +1,4 @@ init(); $oModule = &$oModuleHandler->procModule(); $oModuleHandler->displayContent($oModule); -debugPrint(ob_get_contents()); -ob_end_flush(); ?> diff --git a/modules/editor/components/poll/lang/ko.lang.php b/modules/editor/components/poll/lang/ko.lang.php index e5044ef45..e5256f391 100644 --- a/modules/editor/components/poll/lang/ko.lang.php +++ b/modules/editor/components/poll/lang/ko.lang.php @@ -13,6 +13,4 @@ $lang->cmd_add_poll = "설문 추가"; $lang->cmd_del_poll = "설문 제거"; $lang->cmd_add_item = "항목 추가"; - - $lang->cmd_null_item = "설문조사로 등록할 값이 없습니다.\n다시 설정해주세요"; ?> diff --git a/modules/editor/components/poll/poll.class.php b/modules/editor/components/poll/poll.class.php index 4d1b6585f..e8ed772c4 100644 --- a/modules/editor/components/poll/poll.class.php +++ b/modules/editor/components/poll/poll.class.php @@ -19,49 +19,6 @@ $this->component_path = $component_path; } - /** - * @brief 팝업창에서 설문 작성 완료후 저장을 누를때 - **/ - function insertPoll() { - Context::loadLang($this->component_path.'lang'); - $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); - - $vars = Context::getRequestVars(); - foreach($vars as $key => $val) { - if(strpos($key,'tidx')) continue; - if(!eregi("^(title|checkcount|item)_", $key)) continue; - if(!trim($val)) continue; - - $tmp_arr = explode('_',$key); - - $poll_index = $tmp_arr[1]; - - if($tmp_arr[0]=='title') $tmp_args[$poll_index]->title = $val; - else if($tmp_arr[0]=='checkcount') $tmp_args[$poll_index]->checkcount = $val; - else if($tmp_arr[0]=='item') $tmp_args[$poll_index]->item[] = $val; - } - - foreach($tmp_args as $key => $val) { - if(!$val->checkcount) $val->checkcount = 1; - if($val->title && count($val->item)) $args->poll[] = $val; - } - - if(!count($args->poll)) return new Object(-1, 'cmd_null_item'); - - $args->stop_date = $stop_date; - - // poll module을 이용해서 DB 에 입력 - $oPollController = &getController('poll'); - $output = $oPollController->insertPolls($args); - if(!$output->toBool()) return $output; - - $this->add('poll_srl', $output->get('poll_srl')); - } - /** * @brief popup window요청시 popup window에 출력할 내용을 추가하면 된다 **/ diff --git a/modules/editor/components/poll/tpl/filter/insert_poll.xml b/modules/editor/components/poll/tpl/filter/insert_poll.xml index 640efe4fa..55d3413e3 100644 --- a/modules/editor/components/poll/tpl/filter/insert_poll.xml +++ b/modules/editor/components/poll/tpl/filter/insert_poll.xml @@ -1,4 +1,4 @@ - +
diff --git a/modules/editor/components/poll/tpl/popup.js b/modules/editor/components/poll/tpl/popup.js index 794976991..cb9b3f76e 100644 --- a/modules/editor/components/poll/tpl/popup.js +++ b/modules/editor/components/poll/tpl/popup.js @@ -27,7 +27,9 @@ function completeInsertPoll(ret_obj) { var poll_srl = ret_obj["poll_srl"]; if(!poll_srl) return null; - var text = ""; + var text = ""; + + alert(ret_obj['message']); var iframe_obj = opener.editorGetIFrame(opener.editorPrevSrl) opener.editorReplaceHTML(iframe_obj, text); diff --git a/modules/editor/editor.class.php b/modules/editor/editor.class.php index 4c4e4a4a0..282d3d356 100644 --- a/modules/editor/editor.class.php +++ b/modules/editor/editor.class.php @@ -28,6 +28,7 @@ $oEditorController->insertComponent('url_link',true); $oEditorController->insertComponent('image_link',true); $oEditorController->insertComponent('multimedia_link',true); + $oEditorController->insertComponent('poll',true); $oEditorController->insertComponent('image_gallery',true); $oEditorController->insertComponent('quotation',true); $oEditorController->insertComponent('table_maker',true); diff --git a/modules/poll/conf/module.xml b/modules/poll/conf/module.xml index daa2be166..a015bc5c9 100644 --- a/modules/poll/conf/module.xml +++ b/modules/poll/conf/module.xml @@ -3,5 +3,6 @@ + diff --git a/modules/poll/lang/ko.lang.php b/modules/poll/lang/ko.lang.php index a66c3786f..05e778945 100644 --- a/modules/poll/lang/ko.lang.php +++ b/modules/poll/lang/ko.lang.php @@ -9,4 +9,6 @@ $lang->msg_cart_is_null = '삭제할 글을 선택해주세요'; $lang->msg_checked_poll_is_deleted = '%d개의 설문조사가 삭제되었습니다'; + + $lang->cmd_null_item = "설문조사로 등록할 값이 없습니다.\n다시 설정해주세요"; ?> diff --git a/modules/poll/poll.controller.php b/modules/poll/poll.controller.php index 5c52ffbaf..a6adc6753 100644 --- a/modules/poll/poll.controller.php +++ b/modules/poll/poll.controller.php @@ -14,18 +14,105 @@ } /** - * @brief 설문 추가 + * @brief 팝업창에서 설문 작성 완료후 저장을 누를때 설문 등록 **/ - function insertPools($args) { + function procInsert() { + $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); + + $vars = Context::getRequestVars(); + foreach($vars as $key => $val) { + if(strpos($key,'tidx')) continue; + if(!eregi("^(title|checkcount|item)_", $key)) continue; + if(!trim($val)) continue; + + $tmp_arr = explode('_',$key); + + $poll_index = $tmp_arr[1]; + + if($tmp_arr[0]=='title') $tmp_args[$poll_index]->title = $val; + else if($tmp_arr[0]=='checkcount') $tmp_args[$poll_index]->checkcount = $val; + else if($tmp_arr[0]=='item') $tmp_args[$poll_index]->item[] = $val; + } + + foreach($tmp_args as $key => $val) { + if(!$val->checkcount) $val->checkcount = 1; + if($val->title && count($val->item)) $args->poll[] = $val; + } + + if(!count($args->poll)) return new Object(-1, 'cmd_null_item'); + + $args->stop_date = $stop_date; + + // 변수 설정 + $poll_srl = getNextSequence(); + debugPrint($args); + + $logged_info = Context::get('logged_info'); + $member_srl = $logged_info->member_srl?$logged_info->member_srl:0; + + $oDB = &DB::getInstance(); + $oDB->begin(); // 설문의 등록 - - // 개별 설문 등록 + unset($poll_args); + $poll_args->poll_srl = $poll_srl; + $poll_args->member_srl = $member_srl; + $poll_args->list_order = $poll_srl*-1; + $poll_args->stop_date = $args->stop_date; + $poll_args->poll_count = 0; + $output = executeQuery('poll.insertPoll', $poll_args); + if(!$output->toBool()) { + $oDB->rollback(); + return $output; + } + + // 개별 설문 등록 + foreach($args->poll as $key => $val) { + unset($poll_args); + $poll_args->poll_srl = $poll_srl; + $poll_args->poll_index_srl = $key; + $poll_args->title = $val->title; + $poll_args->checkcount = $val->checkcount; + $poll_args->poll_count = 0; + $output = executeQuery('poll.insertPollTitle', $poll_args); + if(!$output->toBool()) { + $oDB->rollback(); + return $output; + } + + // 개별 설문의 항목 추가 + foreach($val->item as $k => $v) { + unset($poll_args); + $poll_args->poll_srl = $poll_srl; + $poll_args->poll_index_srl = $key; + $poll_args->title = $v; + $poll_args->poll_count = 0; + $output = executeQuery('poll.insertPollItem', $poll_args); + if(!$output->toBool()) { + $oDB->rollback(); + return $output; + } + } + } - // 개별 설문의 아이템 등록 - // 작성자의 정보를 로그로 남김 + $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); + $this->setMessage('success_registed'); } } diff --git a/modules/poll/queries/insertPoll.xml b/modules/poll/queries/insertPoll.xml index 67e1b3525..f545628d3 100644 --- a/modules/poll/queries/insertPoll.xml +++ b/modules/poll/queries/insertPoll.xml @@ -7,6 +7,7 @@ + diff --git a/modules/poll/queries/insertPollItem.xml b/modules/poll/queries/insertPollItem.xml index b6c6f83bd..ee8093bc7 100644 --- a/modules/poll/queries/insertPollItem.xml +++ b/modules/poll/queries/insertPollItem.xml @@ -5,6 +5,7 @@ + diff --git a/modules/poll/queries/insertPollTitle.xml b/modules/poll/queries/insertPollTitle.xml index f76020da1..16fb19324 100644 --- a/modules/poll/queries/insertPollTitle.xml +++ b/modules/poll/queries/insertPollTitle.xml @@ -6,5 +6,7 @@ + + diff --git a/modules/poll/schemas/poll_item.xml b/modules/poll/schemas/poll_item.xml index 2fa6439cd..e1c9247cd 100644 --- a/modules/poll/schemas/poll_item.xml +++ b/modules/poll/schemas/poll_item.xml @@ -1,5 +1,5 @@ - + diff --git a/modules/poll/schemas/poll_log.xml b/modules/poll/schemas/poll_log.xml index fc0814830..1cea74d8f 100644 --- a/modules/poll/schemas/poll_log.xml +++ b/modules/poll/schemas/poll_log.xml @@ -1,5 +1,5 @@
- + diff --git a/modules/poll/schemas/poll_title.xml b/modules/poll/schemas/poll_title.xml index 7dbb11034..b7052dc43 100644 --- a/modules/poll/schemas/poll_title.xml +++ b/modules/poll/schemas/poll_title.xml @@ -1,6 +1,7 @@
- - + + +