diff --git a/classes/module/ModuleHandler.class.php b/classes/module/ModuleHandler.class.php
index dae61ea82..3d1db46a2 100644
--- a/classes/module/ModuleHandler.class.php
+++ b/classes/module/ModuleHandler.class.php
@@ -59,17 +59,20 @@
// ModuleModel 객체 생성
$oModuleModel = &getModel('module');
- // document_srl이 있으면 document_srl로 모듈과 모듈 정보를 구함
- if($this->document_srl) $module_info = $oModuleModel->getModuleInfoByDocumentSrl($this->document_srl);
+ // 특별히 module이 지정되지 않았을 시에 모듈을 찾기 위해 시도
+ if(!$this->module) {
- // 아직 모듈을 못 찾았고 $mid값이 있으면 $mid로 모듈을 구함
- if(!$module_info && $this->mid) $module_info = $oModuleModel->getModuleInfoByMid($this->mid);
+ // document_srl이 있으면 document_srl로 모듈과 모듈 정보를 구함
+ if($this->document_srl) $module_info = $oModuleModel->getModuleInfoByDocumentSrl($this->document_srl);
- // 역시 모듈을 못 찾았고 $module이 없다면 기본 모듈을 찾아봄
- if(!$module_info && !$this->module) $module_info = $oModuleModel->getModuleInfoByMid();
+ // 아직 모듈을 못 찾았고 $mid값이 있으면 $mid로 모듈을 구함
+ if(!$module_info && $this->mid) $module_info = $oModuleModel->getModuleInfoByMid($this->mid);
- // 모듈 정보가 찾아졌을 경우 모듈 정보에서 기본 변수들을 구함
- // 모듈 정보에서 module 이름을 구해움
+ // 역시 모듈을 못 찾았고 $module이 없다면 기본 모듈을 찾아봄
+ if(!$module_info && !$this->module) $module_info = $oModuleModel->getModuleInfoByMid();
+ }
+
+ // 모듈 정보가 찾아졌을 경우 모듈 정보에서 기본 변수들을 구함, 모듈 정보에서 module 이름을 구해움
if($module_info) {
$this->module = $module_info->module;
$this->mid = $module_info->mid;
diff --git a/common/js/xml_handler.js b/common/js/xml_handler.js
index a82e19728..60a3c1d99 100644
--- a/common/js/xml_handler.js
+++ b/common/js/xml_handler.js
@@ -15,6 +15,7 @@ function exec_xml(module, act, params, callback_func, response_tags, callback_fu
oXml.addParam("module", module);
oXml.addParam("act", act);
+ if(typeof(response_tags)=="undefined") response_tags = new Array();
response_tags[response_tags.length] = "redirect_url";
var waiting_obj = document.getElementById("waitingforserverresponse");
diff --git a/modules/board/board.controller.php b/modules/board/board.controller.php
index fc4577a25..4edc5edf4 100644
--- a/modules/board/board.controller.php
+++ b/modules/board/board.controller.php
@@ -259,7 +259,7 @@
// file class의 controller 객체 생성
$oFileController = &getController('file');
- $output = $oFileController->deleteFile($file_srl, $this->grant->manager);
+ if($file_srl) $output = $oFileController->deleteFile($file_srl, $this->grant->manager);
// 첨부파일의 목록을 java script로 출력
$oFileController->printUploadedFileList($document_srl);
diff --git a/modules/pagemaker/conf/module.xml b/modules/pagemaker/conf/module.xml
index 13ddab985..c00cf6abe 100644
--- a/modules/pagemaker/conf/module.xml
+++ b/modules/pagemaker/conf/module.xml
@@ -4,5 +4,9 @@
+
+
+
+
diff --git a/modules/pagemaker/pagemaker.class.php b/modules/pagemaker/pagemaker.class.php
index c161ad462..ef319f7b8 100644
--- a/modules/pagemaker/pagemaker.class.php
+++ b/modules/pagemaker/pagemaker.class.php
@@ -49,5 +49,38 @@
return new Object();
}
+ /**
+ * @brief 관리자에서 요청될때 초기화 할 것들을 정리
+ **/
+ function initAdmin() {
+
+ // pagemaker 모듈로 등록된 module_srl을 구함
+ $oPagemakerModel = &getModel('pagemaker');
+ $this->module_srl = $oPagemakerModel->getModuleSrl();
+
+
+ // 카테고리를 사용하는지 확인후 사용시 카테고리 목록을 구해와서 Context에 세팅
+ /*
+ if($this->module_info->use_category=='Y') {
+ $oDocumentModel = &getModel('document');
+ $this->category_list = $oDocumentModel->getCategoryList($this->module_srl);
+ Context::set('category_list', $this->category_list);
+ }
+ */
+
+ // 에디터 세팅
+ $editor = "default";
+ Context::set('editor', $editor);
+ $editor_path = sprintf("./editor/%s/", $editor);
+ Context::set('editor_path', $editor_path);
+ Context::loadLang($editor_path);
+
+ // 템플릿에서 사용할 변수를 Context::set()
+ if($this->module_srl) Context::set('module_srl',$this->module_srl);
+
+ // 업로드 권한 부여
+ $this->grant->fileupload = true;
+ }
+
}
?>
diff --git a/modules/pagemaker/pagemaker.controller.php b/modules/pagemaker/pagemaker.controller.php
index 6ca009c3f..772b05cc4 100644
--- a/modules/pagemaker/pagemaker.controller.php
+++ b/modules/pagemaker/pagemaker.controller.php
@@ -11,7 +11,109 @@
* @brief 초기화
**/
function init() {
+ $this->initAdmin();
}
+ /**
+ * @brief 문서 입력
+ **/
+ function procInsertDocument() {
+
+ // 글작성시 필요한 변수를 세팅
+ $obj = Context::getRequestVars();
+ $obj->module_srl = $this->module_srl;
+
+ // document module의 model 객체 생성
+ $oDocumentModel = &getModel('document');
+
+ // document module의 controller 객체 생성
+ $oDocumentController = &getController('document');
+
+ // 이미 존재하는 글인지 체크
+ $document = $oDocumentModel->getDocument($obj->document_srl, $this->grant->manager);
+
+ // 이미 존재하는 경우 수정
+ if($document->document_srl == $obj->document_srl) {
+ $output = $oDocumentController->updateDocument($document, $obj);
+ $msg_code = 'success_updated';
+
+ // 그렇지 않으면 신규 등록
+ } else {
+ $output = $oDocumentController->insertDocument($obj);
+ $msg_code = 'success_registed';
+ $obj->document_srl = $output->get('document_srl');
+ }
+ if(!$output->toBool()) return $output;
+
+ // 트랙백 발송
+ $trackback_url = Context::get('trackback_url');
+ $trackback_charset = Context::get('trackback_charset');
+ if($trackback_url) {
+ $oTrackbackController = &getController('trackback');
+ $oTrackbackController->sendTrackback($obj, $trackback_url, $trackback_charset);
+ }
+
+ $this->add('document_srl', $output->get('document_srl'));
+ $this->add('page', $output->get('page'));
+ $this->setMessage($msg_code);
+ }
+
+ /**
+ * @brief 문서 삭제
+ **/
+ function procDeleteDocument() {
+ // 문서 번호 확인
+ $document_srl = Context::get('document_srl');
+ if(!$document_srl) return $this->doError('msg_invalid_document');
+
+ // document module model 객체 생성
+ $oDocumentController = &getController('document');
+
+ // 삭제 시도
+ $output = $oDocumentController->deleteDocument($document_srl, true);
+ if(!$output->toBool()) return $output;
+
+ $this->add('page', $output->get('page'));
+ $this->setMessage('success_deleted');
+ }
+
+ /**
+ * @brief 첨부파일 업로드
+ **/
+ function procUploadFile() {
+ // 업로드 권한이 없거나 정보가 없을시 종료
+ if(!Context::isUploaded()) exit();
+
+ // 기본적으로 필요한 변수인 document_srl, module_srl을 설정
+ $document_srl = Context::get('document_srl');
+ $module_srl = $this->module_srl;
+
+ // file class의 controller 객체 생성
+ $oFileController = &getController('file');
+ $output = $oFileController->insertFile($module_srl, $document_srl);
+
+ // 첨부파일의 목록을 java script로 출력
+ $oFileController->printUploadedFileList($document_srl);
+ }
+
+ /**
+ * @brief 첨부파일 삭제
+ * 에디터에서 개별 파일 삭제시 사용
+ **/
+ function procDeleteFile() {
+ // 기본적으로 필요한 변수인 document_srl, module_srl을 설정
+ $document_srl = Context::get('document_srl');
+ $module_srl = $this->module_srl;
+ $file_srl = Context::get('file_srl');
+
+ // file class의 controller 객체 생성
+ $oFileController = &getController('file');
+ if($file_srl) $output = $oFileController->deleteFile($file_srl, true);
+
+ // 첨부파일의 목록을 java script로 출력
+ $oFileController->printUploadedFileList($document_srl);
+ }
+
+
}
?>
diff --git a/modules/pagemaker/pagemaker.view.php b/modules/pagemaker/pagemaker.view.php
index 7d8f4df10..6cf82c28e 100644
--- a/modules/pagemaker/pagemaker.view.php
+++ b/modules/pagemaker/pagemaker.view.php
@@ -15,39 +15,10 @@
* @brief 초기화
**/
function init() {
- // pagemaker 모듈로 등록된 module_srl을 구함
- $oPagemakerModel = &getModel('pagemaker');
- $this->module_srl = $oPagemakerModel->getModuleSrl();
-
// template path 지정
$this->setTemplatePath($this->module_path.'tpl.admin');
}
- /**
- * @brief 관리자에서 요청될때 초기화 할 것들을 정리
- **/
- function initAdmin() {
-
- // 카테고리를 사용하는지 확인후 사용시 카테고리 목록을 구해와서 Context에 세팅
- /*
- if($this->module_info->use_category=='Y') {
- $oDocumentModel = &getModel('document');
- $this->category_list = $oDocumentModel->getCategoryList($this->module_srl);
- Context::set('category_list', $this->category_list);
- }
- */
-
- // 에디터 세팅
- $editor = "default";
- Context::set('editor', $editor);
- $editor_path = sprintf("./editor/%s/", $editor);
- Context::set('editor_path', $editor_path);
- Context::loadLang($editor_path);
-
- // 템플릿에서 사용할 변수를 Context::set()
- if($this->module_srl) Context::set('module_srl',$this->module_srl);
- }
-
/**
* @brief 목록 출력
**/
diff --git a/modules/pagemaker/tpl.admin/filter/insert.xml b/modules/pagemaker/tpl.admin/filter/insert.xml
new file mode 100644
index 000000000..a39c26e38
--- /dev/null
+++ b/modules/pagemaker/tpl.admin/filter/insert.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
diff --git a/modules/pagemaker/tpl.admin/js/admin.js b/modules/pagemaker/tpl.admin/js/admin.js
new file mode 100644
index 000000000..f8f8ba9e3
--- /dev/null
+++ b/modules/pagemaker/tpl.admin/js/admin.js
@@ -0,0 +1,23 @@
+/* 글쓰기 작성후 */
+function completeDocumentInserted(ret_obj) {
+ var error = ret_obj['error'];
+ var message = ret_obj['message'];
+ var page = ret_obj['page'];
+ var document_srl = ret_obj['document_srl'];
+ var url = "./?module=admin&mo=pagemaker&act=dispWrite&document_srl="+document_srl;
+ if(page) url += "&page="+page;
+ location.href = url;
+}
+
+/* 글 삭제 */
+function completeDeleteDocument(ret_obj) {
+ var error = ret_obj['error'];
+ var message = ret_obj['message'];
+ var page = ret_obj['page'];
+
+ alert(message);
+
+ var url = "./?module=admin&mo=pagemaker&act=dispWrite&document_srl="+document_srl;
+ if(page) url += "&page="+page;
+ location.href = url;
+}
diff --git a/modules/pagemaker/tpl.admin/list.html b/modules/pagemaker/tpl.admin/list.html
index 8d2a958a3..dc35f013c 100644
--- a/modules/pagemaker/tpl.admin/list.html
+++ b/modules/pagemaker/tpl.admin/list.html
@@ -31,7 +31,7 @@
{$category_list[$val->category_srl]->title} |
- {$val->title}
+ {$val->title}
|
{zdate($val->regdate,"Y-m-d")} |
diff --git a/modules/pagemaker/tpl.admin/write_form.html b/modules/pagemaker/tpl.admin/write_form.html
index 0dd16983c..146c4945c 100644
--- a/modules/pagemaker/tpl.admin/write_form.html
+++ b/modules/pagemaker/tpl.admin/write_form.html
@@ -1,4 +1,9 @@
+
+
+