git-svn-id: http://xe-core.googlecode.com/svn/trunk@1000 201d5d3c-b55e-5fd7-737f-ddc643e51545

This commit is contained in:
zero 2007-04-06 05:29:24 +00:00
parent 78d85654a1
commit 8ab46aa600
16 changed files with 115 additions and 63 deletions

View file

@ -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) {

View file

@ -1,5 +1,4 @@
<?php
ob_start();
/**
* @file index.php
* @author zero (zero@zeroboard.com)
@ -48,6 +47,4 @@ ob_start();
$oModuleHandler->init();
$oModule = &$oModuleHandler->procModule();
$oModuleHandler->displayContent($oModule);
debugPrint(ob_get_contents());
ob_end_flush();
?>

View file

@ -13,6 +13,4 @@
$lang->cmd_add_poll = "설문 추가";
$lang->cmd_del_poll = "설문 제거";
$lang->cmd_add_item = "항목 추가";
$lang->cmd_null_item = "설문조사로 등록할 값이 없습니다.\n다시 설정해주세요";
?>

View file

@ -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에 출력할 내용을 추가하면 된다
**/

View file

@ -1,4 +1,4 @@
<filter name="insert_poll" module="editor" act="procEditorCall" confirm_msg_code="confirm_submit">
<filter name="insert_poll" module="poll" act="procInsert" confirm_msg_code="confirm_submit">
<form />
<parameter />
<response callback_func="completeInsertPoll">

View file

@ -27,7 +27,9 @@ function completeInsertPoll(ret_obj) {
var poll_srl = ret_obj["poll_srl"];
if(!poll_srl) return null;
var text = "<img src=\"./common/tpl/images/blank.gif\" poll_srl=\""+poll_srl+"\" editor_component=\"poll\" class=\"editor_component_output\" style=\"width:100%;\" />";
var text = "<img src=\"./common/tpl/images/blank.gif\" poll_srl=\""+poll_srl+"\" editor_component=\"poll\" class=\"editor_component_output\" style=\"width:400px;height:300px;\" />";
alert(ret_obj['message']);
var iframe_obj = opener.editorGetIFrame(opener.editorPrevSrl)
opener.editorReplaceHTML(iframe_obj, text);

View file

@ -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);

View file

@ -3,5 +3,6 @@
<grants />
<actions>
<action name="dispPollAdminList" type="view" admin_index="true" standalone="true" />
<action name="procInsert" type="controller" standalone="true" />
</actions>
</module>

View file

@ -9,4 +9,6 @@
$lang->msg_cart_is_null = '삭제할 글을 선택해주세요';
$lang->msg_checked_poll_is_deleted = '%d개의 설문조사가 삭제되었습니다';
$lang->cmd_null_item = "설문조사로 등록할 값이 없습니다.\n다시 설정해주세요";
?>

View file

@ -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');
}
}

View file

@ -7,6 +7,7 @@
<column name="stop_date" var="stop_date" />
<column name="member_srl" var="member_srl" />
<column name="ipaddress" var="ipaddress" default="ipaddress()" />
<column name="poll_count" var="poll_count" default="0" />
<column name="regdate" var="regdate" default="curdate()" />
<column name="list_order" var="list_order" default="0" />
</columns>

View file

@ -5,6 +5,7 @@
<columns>
<column name="poll_srl" var="poll_srl" filter="number" notnull="notnull" />
<column name="poll_index_srl" var="poll_index_srl" filter="number" notnull="notnull" />
<column name="poll_count" var="poll_count" default="0" />
<column name="title" var="title" notnull="notnull" />
</columns>
</query>

View file

@ -6,5 +6,7 @@
<column name="poll_srl" var="poll_srl" filter="number" notnull="notnull" />
<column name="poll_index_srl" var="poll_index_srl" filter="number" notnull="notnull" />
<column name="title" var="title" notnull="notnull" />
<column name="poll_count" var="poll_count" default="0" />
<column name="checkcount" var="checkcount" notnull="notnull" default="1" />
</columns>
</query>

View file

@ -1,5 +1,5 @@
<table name="poll_item">
<column name="poll_srl" type="number" size="11" notnull="notnull" primary_key="primary_key" />
<column name="poll_srl" type="number" size="11" notnull="notnull" index="index_poll_srl" />
<column name="poll_index_srl" type="number" size="11" notnull="notnull" index="idx_poll_index_srl" />
<column name="title" type="varchar" size="250" notnull="notnull" />
<column name="poll_count" type="number" size="11" notnull="notnull" />

View file

@ -1,5 +1,5 @@
<table name="poll_log">
<column name="poll_srl" type="number" size="11" notnull="notnull" primary_key="primary_key" />
<column name="poll_srl" type="number" size="11" notnull="notnull" index="idx_poll_srl" />
<column name="member_srl" type="number" size="11" notnull="notnull" index="idx_member_srl" />
<column name="ipaddress" type="varchar" size="128" notnull="notnull" index="idx_ipaddress" />
<column name="regdate" type="date" index="idx_regdate" />

View file

@ -1,6 +1,7 @@
<table name="poll_title">
<column name="poll_srl" type="number" size="11" notnull="notnull" primary_key="primary_key" />
<column name="poll_index_srl" type="number" size="11" notnull="notnull" index="idx_poll_index_srl" />
<column name="poll_srl" type="number" size="11" notnull="notnull" index="idx_poll_srl" />
<column name="poll_index_srl" type="number" size="11" notnull="notnull" primary_key="primary_key" />
<column name="title" type="varchar" size="250" notnull="notnull" />
<column name="checkcount" type="number" size="11" notnull="notnull" default="1" />
<column name="poll_count" type="number" size="11" notnull="notnull" />
</table>