diff --git a/modules/page/page.admin.controller.php b/modules/page/page.admin.controller.php
index f8f5c65cc..c564b1f44 100644
--- a/modules/page/page.admin.controller.php
+++ b/modules/page/page.admin.controller.php
@@ -1,332 +1,350 @@
module = 'page';
+ $args->mid = $args->page_name; //because if mid is empty in context, set start page mid
+ $args->path = (!$args->path) ? '' : $args->path;
+ $args->mpath = (!$args->mpath) ? '' : $args->mpath;
+ unset($args->page_name);
- /**
- * @brief Initialization
- **/
- function init() {
- }
-
- /**
- * @brief Add a Page
- **/
- function procPageAdminInsert() {
- // Create model/controller object of the module module
- $oModuleController = &getController('module');
- $oModuleModel = &getModel('module');
- // Set board module
- $args = Context::getRequestVars();
- $args->module = 'page';
- $args->mid = $args->page_name; //because if mid is empty in context, set start page mid
- $args->path = (!$args->path) ? '' : $args->path;
- $args->mpath = (!$args->mpath) ? '' : $args->mpath;
- unset($args->page_name);
-
- if($args->use_mobile != 'Y') $args->use_mobile = '';
- // Check if an original module exists by using module_srl
- if($args->module_srl) {
- $columnList = array('module_srl');
- $module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl, $columnList);
- if($module_info->module_srl != $args->module_srl) {
- unset($args->module_srl);
- }
- else
- {
- foreach($args as $key=>$val)
- {
- $module_info->{$key} = $val;
- }
- $args = $module_info;
- }
- }
-
- switch ($args->page_type){
- case 'WIDGET' : {
- unset($args->skin);
- unset($args->mskin);
- unset($args->path);
- unset($args->mpath);
- break;
- }
- case 'ARTICLE' : {
- unset($args->page_caching_interval);
- unset($args->path);
- unset($args->mpath);
- break;
- }
- case 'OUTSIDE' : {
- unset($args->skin);
- unset($args->mskin);
- break;
- }
- }
- // Insert/update depending on module_srl
- if(!$args->module_srl) {
- $output = $oModuleController->insertModule($args);
- $msg_code = 'success_registed';
- } else {
- $output = $oModuleController->updateModule($args);
- $msg_code = 'success_updated';
- }
-
- if(!$output->toBool()) return $output;
-
- $this->add("page", Context::get('page'));
- $this->add('module_srl',$output->get('module_srl'));
- $this->setMessage($msg_code);
-
- $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'module_srl', $output->get('module_srl'), 'act', 'dispPageAdminInfo');
- $this->setRedirectUrl($returnUrl);
- }
-
- /**
- * @brief Page Modify
- **/
- function procPageAdminUpdate()
+ if($args->use_mobile != 'Y') $args->use_mobile = '';
+ // Check if an original module exists by using module_srl
+ if($args->module_srl)
{
- $this->procPageAdminInsert();
- }
-
- function putDocumentsInPageToArray($target, &$array)
- {
- if(!$target) return;
- preg_match_all('!]+)!is', $target, $matches);
- $pattern = '!document_srl="(\d+)"!';
- foreach($matches[1] as $match)
+ $columnList = array('module_srl');
+ $module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl, $columnList);
+ if($module_info->module_srl != $args->module_srl)
{
- $match2 = null;
- preg_match($pattern, $match, $match2);
- if(count($match2))
+ unset($args->module_srl);
+ }
+ else
+ {
+ foreach($args as $key=>$val)
{
- $array[(int)$match2[1]] = 1;
+ $module_info->{$key} = $val;
}
+ $args = $module_info;
}
}
- /**
- * @brief Save page edits
- **/
- function procPageAdminInsertContent() {
- $module_srl = Context::get('module_srl');
- $content = Context::get('content');
- if(!$module_srl) return new Object(-1,'msg_invalid_request');
- $mcontent = Context::get('mcontent');
- $type = Context::get('type');
- // Guhaeom won information page
- $oModuleModel = &getModel('module');
- $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
- if($type == "mobile") {
- if(!$mcontent) $mcontent = '';
- $module_info->mcontent = $mcontent;
- }
- else {
- if(!isset($content)) $content ='';
- $module_info->content = $content;
- }
-
- $document_srls = array();
- $this->putDocumentsInPageToArray($module_info->content, $document_srls);
- $this->putDocumentsInPageToArray($module_info->mcontent, $document_srls);
-
- $oDocumentModel = &getModel('document');
- $oDocumentController = &getController('document');
- $obj->module_srl = $module_srl;
- $obj->list_count = 99999999;
- $output = $oDocumentModel->getDocumentList($obj);
- if(count($output->data)) {
- foreach($output->data as $document)
- {
- if($document_srls[$document->document_srl]) continue;
- $oDocumentController->deleteDocument($document->document_srl, true);
- }
- }
- // Creates an object of the controller module module
- $oModuleController = &getController('module');
- // Save
- $output = $oModuleController->updateModule($module_info);
- if(!$output->toBool()) return $output;
- // On the page, change the validity status of the attached file
- $oFileController = &getController('file');
- $oFileController->setFilesValid($module_info->module_srl);
- // Create cache file
- //$this->procPageAdminRemoveWidgetCache();
-
- $this->add("module_srl", $module_info->module_srl);
- $this->add("page", Context::get('page'));
- $this->add("mid", $module_info->mid);
- $this->setMessage($msg_code);
- }
-
- /**
- * @brief Delete page
- **/
- function procPageAdminDelete() {
- $module_srl = Context::get('module_srl');
- // Get an original
- $oModuleController = &getController('module');
- $output = $oModuleController->deleteModule($module_srl);
- if(!$output->toBool()) return $output;
-
- $this->add('module','page');
- $this->add('page',Context::get('page'));
- $this->setMessage('success_deleted');
-
- $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'module_srl', $output->get('module_srl'), 'act', 'dispPageAdminInfo');
- $this->setRedirectUrl($returnUrl);
- }
-
- /**
- * @brief Additional pages of basic information
- **/
- function procPageAdminInsertConfig() {
- // Get the basic information
- $args = Context::getRequestVars();
- // Insert by creating the module Controller object
- $oModuleController = &getController('module');
- $output = $oModuleController->insertModuleConfig('page',$args);
- return $output;
- }
-
- /**
- * @brief Upload attachments
- **/
- function procUploadFile() {
- // Basic variables setting
- $upload_target_srl = Context::get('upload_target_srl');
- $module_srl = Context::get('module_srl');
- // Create the controller object file class
- $oFileController = &getController('file');
- $output = $oFileController->insertFile($module_srl, $upload_target_srl);
- // Attachment to the output of the list, java script
- $oFileController->printUploadedFileList($upload_target_srl);
- }
-
- /**
- * @brief Delete the attachment
- * Delete individual files in the editor using
- **/
- function procDeleteFile() {
- // Basic variable setting(upload_target_srl and module_srl set)
- $upload_target_srl = Context::get('upload_target_srl');
- $module_srl = Context::get('module_srl');
- $file_srl = Context::get('file_srl');
- // Create the controller object file class
- $oFileController = &getController('file');
- if($file_srl) $output = $oFileController->deleteFile($file_srl, $this->grant->manager);
- // Attachment to the output of the list, java script
- $oFileController->printUploadedFileList($upload_target_srl);
- }
-
- /**
- * @brief Clear widget cache files of the specified page
- **/
- function procPageAdminRemoveWidgetCache() {
- $module_srl = Context::get('module_srl');
-
- $oModuleModel = &getModel('module');
- $columnList = array('module_srl', 'content');
- $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
-
- $content = $module_info->content;
- // widget controller re-run of the cache files
- $oWidgetController = &getController('widget');
- $oWidgetController->recompileWidget($content);
-
- if($module_info->page_type == 'WIDGET')
- {
- $cache_file = sprintf("%sfiles/cache/page/%d.%s.%s.cache.php", _XE_PATH_, $module_info->module_srl, Context::getLangType(), Context::getSslStatus());
- $mcacheFile = sprintf("%sfiles/cache/page/%d.%s.%s.m.cache.php", _XE_PATH_, $module_info->module_srl, Context::getLangType(), Context::getSslStatus());
- }
- else if($module_info->page_type == 'OUTSIDE')
- {
- $cache_file = sprintf("%sfiles/cache/opage/%d.cache.php", _XE_PATH_, $module_info->module_srl);
-
- if($module_info->mpath)
- {
- $mcacheFile = sprintf("%sfiles/cache/opage/%d.m.cache.php", _XE_PATH_, $module_info->module_srl);
- }
- }
- if(file_exists($cache_file)) FileHandler::removeFile($cache_file);
- if(file_exists($mcacheFile)) FileHandler::removeFile($mcacheFile);
- }
-
- function procPageAdminArticleDocumentInsert()
+ switch ($args->page_type)
{
- $logged_info = Context::get('logged_info');
-
- $oModuleModel = &getModel('module');
- $grant = $oModuleModel->getGrant($this->module_info, $logged_info);
-
- if (!$grant->manager)
- {
- return new Object(-1, 'msg_not_permitted');
- }
-
- $obj = Context::getRequestVars();
- $obj->module_srl = $this->module_info->module_srl;
- $obj->is_notice = 'N';
-
- settype($obj->title, "string");
- if($obj->title == '') $obj->title = cut_str(strip_tags($obj->content),20,'...');
- //그래도 없으면 Untitled
- if($obj->title == '') $obj->title = 'Untitled';
-
- // document module의 model 객체 생성
- $oDocumentModel = &getModel('document');
-
- // document module의 controller 객체 생성
- $oDocumentController = &getController('document');
-
- // 이미 존재하는 글인지 체크
- $oDocument = $oDocumentModel->getDocument($obj->document_srl, true);
-
- $bAnonymous = false;
-
- // 이미 존재하는 경우 수정
- if($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl)
- {
- $output = $oDocumentController->updateDocument($oDocument, $obj);
- $msg_code = 'success_updated';
- // 그렇지 않으면 신규 등록
- }
- else
- {
- if($obj->ismobile == 'Y')
+ case 'WIDGET' :
{
- $target = 'mdocument_srl';
+ unset($args->skin);
+ unset($args->mskin);
+ unset($args->path);
+ unset($args->mpath);
+ break;
}
- else
+ case 'ARTICLE' :
{
- $target = 'document_srl';
+ unset($args->page_caching_interval);
+ unset($args->path);
+ unset($args->mpath);
+ break;
}
-
- $output = $oDocumentController->insertDocument($obj, $bAnonymous);
- $msg_code = 'success_registed';
- $document_srl = $output->get('document_srl');
-
- $oModuleController = &getController('module');
- $this->module_info->{$target} = $document_srl;
- $oModuleController->updateModule($this->module_info);
- }
-
- // 오류 발생시 멈춤
- if(!$output->toBool()) return $output;
-
- // 결과를 리턴
- $this->add('mid', Context::get('mid'));
- $this->add('document_srl', $output->get('document_srl'));
- $this->add('is_mobile', $obj->ismobile);
-
- // 성공 메세지 등록
- $this->setMessage($msg_code);
+ case 'OUTSIDE' :
+ {
+ unset($args->skin);
+ unset($args->mskin);
+ break;
+ }
+ }
+ // Insert/update depending on module_srl
+ if(!$args->module_srl)
+ {
+ $output = $oModuleController->insertModule($args);
+ $msg_code = 'success_registed';
+ }
+ else
+ {
+ $output = $oModuleController->updateModule($args);
+ $msg_code = 'success_updated';
}
+ if(!$output->toBool()) return $output;
- }
-?>
+ $this->add("page", Context::get('page'));
+ $this->add('module_srl',$output->get('module_srl'));
+ $this->setMessage($msg_code);
+
+ $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'module_srl', $output->get('module_srl'), 'act', 'dispPageAdminInfo');
+ $this->setRedirectUrl($returnUrl);
+ }
+
+ /**
+ * @brief Page Modify
+ */
+ function procPageAdminUpdate()
+ {
+ $this->procPageAdminInsert();
+ }
+
+ function putDocumentsInPageToArray($target, &$array)
+ {
+ if(!$target) return;
+ preg_match_all('!
]+)!is', $target, $matches);
+ $pattern = '!document_srl="(\d+)"!';
+ foreach($matches[1] as $match)
+ {
+ $match2 = null;
+ preg_match($pattern, $match, $match2);
+ if(count($match2))
+ {
+ $array[(int)$match2[1]] = 1;
+ }
+ }
+ }
+
+ /**
+ * @brief Save page edits
+ */
+ function procPageAdminInsertContent()
+ {
+ $module_srl = Context::get('module_srl');
+ $content = Context::get('content');
+ if(!$module_srl) return new Object(-1,'msg_invalid_request');
+ $mcontent = Context::get('mcontent');
+ $type = Context::get('type');
+ // Guhaeom won information page
+ $oModuleModel = &getModel('module');
+ $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
+ if($type == "mobile")
+ {
+ if(!$mcontent) $mcontent = '';
+ $module_info->mcontent = $mcontent;
+ }
+ else
+ {
+ if(!isset($content)) $content ='';
+ $module_info->content = $content;
+ }
+
+ $document_srls = array();
+ $this->putDocumentsInPageToArray($module_info->content, $document_srls);
+ $this->putDocumentsInPageToArray($module_info->mcontent, $document_srls);
+
+ $oDocumentModel = &getModel('document');
+ $oDocumentController = &getController('document');
+ $obj->module_srl = $module_srl;
+ $obj->list_count = 99999999;
+ $output = $oDocumentModel->getDocumentList($obj);
+ if(count($output->data))
+ {
+ foreach($output->data as $document)
+ {
+ if($document_srls[$document->document_srl]) continue;
+ $oDocumentController->deleteDocument($document->document_srl, true);
+ }
+ }
+ // Creates an object of the controller module module
+ $oModuleController = &getController('module');
+ // Save
+ $output = $oModuleController->updateModule($module_info);
+ if(!$output->toBool()) return $output;
+ // On the page, change the validity status of the attached file
+ $oFileController = &getController('file');
+ $oFileController->setFilesValid($module_info->module_srl);
+ // Create cache file
+ //$this->procPageAdminRemoveWidgetCache();
+
+ $this->add("module_srl", $module_info->module_srl);
+ $this->add("page", Context::get('page'));
+ $this->add("mid", $module_info->mid);
+ $this->setMessage($msg_code);
+ }
+
+ /**
+ * @brief Delete page
+ */
+ function procPageAdminDelete()
+ {
+ $module_srl = Context::get('module_srl');
+ // Get an original
+ $oModuleController = &getController('module');
+ $output = $oModuleController->deleteModule($module_srl);
+ if(!$output->toBool()) return $output;
+
+ $this->add('module','page');
+ $this->add('page',Context::get('page'));
+ $this->setMessage('success_deleted');
+
+ $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'module_srl', $output->get('module_srl'), 'act', 'dispPageAdminInfo');
+ $this->setRedirectUrl($returnUrl);
+ }
+
+ /**
+ * @brief Additional pages of basic information
+ */
+ function procPageAdminInsertConfig()
+ {
+ // Get the basic information
+ $args = Context::getRequestVars();
+ // Insert by creating the module Controller object
+ $oModuleController = &getController('module');
+ $output = $oModuleController->insertModuleConfig('page',$args);
+ return $output;
+ }
+
+ /**
+ * @brief Upload attachments
+ */
+ function procUploadFile()
+ {
+ // Basic variables setting
+ $upload_target_srl = Context::get('upload_target_srl');
+ $module_srl = Context::get('module_srl');
+ // Create the controller object file class
+ $oFileController = &getController('file');
+ $output = $oFileController->insertFile($module_srl, $upload_target_srl);
+ // Attachment to the output of the list, java script
+ $oFileController->printUploadedFileList($upload_target_srl);
+ }
+
+ /**
+ * @brief Delete the attachment
+ * Delete individual files in the editor using
+ */
+ function procDeleteFile()
+ {
+ // Basic variable setting(upload_target_srl and module_srl set)
+ $upload_target_srl = Context::get('upload_target_srl');
+ $module_srl = Context::get('module_srl');
+ $file_srl = Context::get('file_srl');
+ // Create the controller object file class
+ $oFileController = &getController('file');
+ if($file_srl) $output = $oFileController->deleteFile($file_srl, $this->grant->manager);
+ // Attachment to the output of the list, java script
+ $oFileController->printUploadedFileList($upload_target_srl);
+ }
+
+ /**
+ * @brief Clear widget cache files of the specified page
+ */
+ function procPageAdminRemoveWidgetCache()
+ {
+ $module_srl = Context::get('module_srl');
+
+ $oModuleModel = &getModel('module');
+ $columnList = array('module_srl', 'content');
+ $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
+
+ $content = $module_info->content;
+ // widget controller re-run of the cache files
+ $oWidgetController = &getController('widget');
+ $oWidgetController->recompileWidget($content);
+
+ if($module_info->page_type == 'WIDGET')
+ {
+ $cache_file = sprintf("%sfiles/cache/page/%d.%s.%s.cache.php", _XE_PATH_, $module_info->module_srl, Context::getLangType(), Context::getSslStatus());
+ $mcacheFile = sprintf("%sfiles/cache/page/%d.%s.%s.m.cache.php", _XE_PATH_, $module_info->module_srl, Context::getLangType(), Context::getSslStatus());
+ }
+ else if($module_info->page_type == 'OUTSIDE')
+ {
+ $cache_file = sprintf("%sfiles/cache/opage/%d.cache.php", _XE_PATH_, $module_info->module_srl);
+
+ if($module_info->mpath)
+ {
+ $mcacheFile = sprintf("%sfiles/cache/opage/%d.m.cache.php", _XE_PATH_, $module_info->module_srl);
+ }
+ }
+ if(file_exists($cache_file)) FileHandler::removeFile($cache_file);
+ if(file_exists($mcacheFile)) FileHandler::removeFile($mcacheFile);
+ }
+
+ function procPageAdminArticleDocumentInsert()
+ {
+ $logged_info = Context::get('logged_info');
+
+ $oModuleModel = &getModel('module');
+ $grant = $oModuleModel->getGrant($this->module_info, $logged_info);
+
+ if (!$grant->manager)
+ {
+ return new Object(-1, 'msg_not_permitted');
+ }
+
+ $obj = Context::getRequestVars();
+ $obj->module_srl = $this->module_info->module_srl;
+ $obj->is_notice = 'N';
+
+ settype($obj->title, "string");
+ if($obj->title == '') $obj->title = cut_str(strip_tags($obj->content),20,'...');
+ //그래도 없으면 Untitled
+ if($obj->title == '') $obj->title = 'Untitled';
+
+ // document module의 model 객체 생성
+ $oDocumentModel = &getModel('document');
+
+ // document module의 controller 객체 생성
+ $oDocumentController = &getController('document');
+
+ // 이미 존재하는 글인지 체크
+ $oDocument = $oDocumentModel->getDocument($obj->document_srl, true);
+
+ $bAnonymous = false;
+
+ // 이미 존재하는 경우 수정
+ if($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl)
+ {
+ $output = $oDocumentController->updateDocument($oDocument, $obj);
+ $msg_code = 'success_updated';
+ // 그렇지 않으면 신규 등록
+ }
+ else
+ {
+ if($obj->ismobile == 'Y')
+ {
+ $target = 'mdocument_srl';
+ }
+ else
+ {
+ $target = 'document_srl';
+ }
+
+ $output = $oDocumentController->insertDocument($obj, $bAnonymous);
+ $msg_code = 'success_registed';
+ $document_srl = $output->get('document_srl');
+
+ $oModuleController = &getController('module');
+ $this->module_info->{$target} = $document_srl;
+ $oModuleController->updateModule($this->module_info);
+ }
+
+ // 오류 발생시 멈춤
+ if(!$output->toBool()) return $output;
+
+ // 결과를 리턴
+ $this->add('mid', Context::get('mid'));
+ $this->add('document_srl', $output->get('document_srl'));
+ $this->add('is_mobile', $obj->ismobile);
+
+ // 성공 메세지 등록
+ $this->setMessage($msg_code);
+ }
+}
+/* End of file page.admin.controller.php */
+/* Location: ./modules/page/page.admin.controller.php */
diff --git a/modules/page/page.admin.view.php b/modules/page/page.admin.view.php
index 7bb56d636..79f78c708 100644
--- a/modules/page/page.admin.view.php
+++ b/modules/page/page.admin.view.php
@@ -1,372 +1,386 @@
getModuleInfoByModuleSrl($module_srl);
- if(!$module_info) {
- Context::set('module_srl','');
- $this->act = 'list';
- } else {
- ModuleModel::syncModuleToSite($module_info);
- $this->module_info = $module_info;
- Context::set('module_info',$module_info);
- }
- }
- // Get a list of module categories
- $module_category = $oModuleModel->getModuleCategories();
- Context::set('module_category', $module_category);
- //Security
- $security = new Security();
- $security->encodeHTML('module_category..title');
-
- // Get a template path (page in the administrative template tpl putting together)
- $this->setTemplatePath($this->module_path.'tpl');
-
- }
-
- /**
- * @brief Manage a list of pages showing
- **/
- function dispPageAdminContent() {
- $args->sort_index = "module_srl";
- $args->page = Context::get('page');
- $args->list_count = 40;
- $args->page_count = 10;
- $args->s_module_category_srl = Context::get('module_category_srl');
-
- $search_target_list = array('s_mid','s_browser_title');
- $search_target = Context::get('search_target');
- $search_keyword = Context::get('search_keyword');
- if(in_array($search_target,$search_target_list) && $search_keyword) $args->{$search_target} = $search_keyword;
-
- $output = executeQuery('page.getPageList', $args);
- $oModuleModel = &getModel('module');
- $page_list = $oModuleModel->addModuleExtraVars($output->data);
- moduleModel::syncModuleToSite($page_list);
-
- // To write to a template context:: set
- Context::set('total_count', $output->total_count);
- Context::set('total_page', $output->total_page);
- Context::set('page', $output->page);
- Context::set('page_list', $output->data);
- Context::set('page_navigation', $output->page_navigation);
- //Security
- $security = new Security();
- $security->encodeHTML('page_list..browser_title');
- $security->encodeHTML('page_list..mid');
- $security->encodeHTML('module_info.');
-
- // Set a template file
- $this->setTemplateFile('index');
- }
-
- /**
- * @brief Information output of the selected page
- **/
- function dispPageAdminInfo() {
- // Get module_srl by GET parameter
- $module_srl = Context::get('module_srl');
- $module_info = Context::get('module_info');
- // If you do not value module_srl just showing the index page
- if(!$module_srl) return $this->dispPageAdminContent();
- // If the layout is destined to add layout information haejum (layout_title, layout)
- if($module_info->layout_srl) {
- $oLayoutModel = &getModel('layout');
- $layout_info = $oLayoutModel->getLayout($module_info->layout_srl);
- $module_info->layout = $layout_info->layout;
- $module_info->layout_title = $layout_info->layout_title;
- }
- // Get a layout list
- $oLayoutModel = &getModel('layout');
- $layout_list = $oLayoutModel->getLayoutList();
- Context::set('layout_list', $layout_list);
-
- $mobile_layout_list = $oLayoutModel->getLayoutList(0,"M");
- Context::set('mlayout_list', $mobile_layout_list);
- // Set a template file
-
- if ($this->module_info->page_type == 'ARTICLE'){
- $oModuleModel = &getModel('module');
- $skin_list = $oModuleModel->getSkins($this->module_path);
- Context::set('skin_list',$skin_list);
-
- $mskin_list = $oModuleModel->getSkins($this->module_path, "m.skins");
- Context::set('mskin_list', $mskin_list);
+ /**
+ * @brief Initialization
+ */
+ function init()
+ {
+ // Pre-check if module_srl exists. Set module_info if exists
+ $module_srl = Context::get('module_srl');
+ // Create module model object
+ $oModuleModel = &getModel('module');
+ // module_srl two come over to save the module, putting the information in advance
+ if($module_srl)
+ {
+ $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
+ if(!$module_info)
+ {
+ Context::set('module_srl','');
+ $this->act = 'list';
}
+ else
+ {
+ ModuleModel::syncModuleToSite($module_info);
+ $this->module_info = $module_info;
+ Context::set('module_info',$module_info);
+ }
+ }
+ // Get a list of module categories
+ $module_category = $oModuleModel->getModuleCategories();
+ Context::set('module_category', $module_category);
+ //Security
+ $security = new Security();
+ $security->encodeHTML('module_category..title');
- //Security
- $security = new Security();
- $security->encodeHTML('layout_list..layout');
- $security->encodeHTML('layout_list..title');
- $security->encodeHTML('mlayout_list..layout');
- $security->encodeHTML('mlayout_list..title');
- $security->encodeHTML('module_info.');
+ // Get a template path (page in the administrative template tpl putting together)
+ $this->setTemplatePath($this->module_path.'tpl');
+ }
- $this->setTemplateFile('page_info');
- }
+ /**
+ * @brief Manage a list of pages showing
+ */
+ function dispPageAdminContent()
+ {
+ $args->sort_index = "module_srl";
+ $args->page = Context::get('page');
+ $args->list_count = 40;
+ $args->page_count = 10;
+ $args->s_module_category_srl = Context::get('module_category_srl');
- /**
- * @brief Additional settings page showing
- * For additional settings in a service module in order to establish links with other modules peyijiim
- **/
- function dispPageAdminPageAdditionSetup() {
- // call by reference content from other modules to come take a year in advance for putting the variable declaration
- $content = '';
+ $search_target_list = array('s_mid','s_browser_title');
+ $search_target = Context::get('search_target');
+ $search_keyword = Context::get('search_keyword');
+ if(in_array($search_target,$search_target_list) && $search_keyword) $args->{$search_target} = $search_keyword;
- $oEditorView = &getView('editor');
- $oEditorView->triggerDispEditorAdditionSetup($content);
- Context::set('setup_content', $content);
- // Set a template file
- $this->setTemplateFile('addition_setup');
+ $output = executeQuery('page.getPageList', $args);
+ $oModuleModel = &getModel('module');
+ $page_list = $oModuleModel->addModuleExtraVars($output->data);
+ moduleModel::syncModuleToSite($page_list);
- $security = new Security();
- $security->encodeHTML('module_info.');
- }
+ // To write to a template context:: set
+ Context::set('total_count', $output->total_count);
+ Context::set('total_page', $output->total_page);
+ Context::set('page', $output->page);
+ Context::set('page_list', $output->data);
+ Context::set('page_navigation', $output->page_navigation);
+ //Security
+ $security = new Security();
+ $security->encodeHTML('page_list..browser_title');
+ $security->encodeHTML('page_list..mid');
+ $security->encodeHTML('module_info.');
- /**
- * @brief Add Page Form Output
- **/
- function dispPageAdminInsert() {
- // Get module_srl by GET parameter
- $module_srl = Context::get('module_srl');
- // Get and set module information if module_srl exists
- if($module_srl) {
- $oModuleModel = &getModel('module');
- $columnList = array('module_srl', 'mid', 'module_category_srl', 'browser_title', 'layout_srl', 'use_mobile', 'mlayout_srl');
- $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
- if($module_info->module_srl == $module_srl) Context::set('module_info',$module_info);
- else {
- unset($module_info);
- unset($module_srl);
- }
- }
- // Get a layout list
- $oLayoutModel = &getModel('layout');
- $layout_list = $oLayoutModel->getLayoutList();
- Context::set('layout_list', $layout_list);
+ // Set a template file
+ $this->setTemplateFile('index');
+ }
- $mobile_layout_list = $oLayoutModel->getLayoutList(0,"M");
- Context::set('mlayout_list', $mobile_layout_list);
+ /**
+ * @brief Information output of the selected page
+ */
+ function dispPageAdminInfo()
+ {
+ // Get module_srl by GET parameter
+ $module_srl = Context::get('module_srl');
+ $module_info = Context::get('module_info');
+ // If you do not value module_srl just showing the index page
+ if(!$module_srl) return $this->dispPageAdminContent();
+ // If the layout is destined to add layout information haejum (layout_title, layout)
+ if($module_info->layout_srl)
+ {
+ $oLayoutModel = &getModel('layout');
+ $layout_info = $oLayoutModel->getLayout($module_info->layout_srl);
+ $module_info->layout = $layout_info->layout;
+ $module_info->layout_title = $layout_info->layout_title;
+ }
+ // Get a layout list
+ $oLayoutModel = &getModel('layout');
+ $layout_list = $oLayoutModel->getLayoutList();
+ Context::set('layout_list', $layout_list);
- $oModuleModel = &getModel('module');
- $skin_list = $oModuleModel->getSkins($this->module_path);
- Context::set('skin_list',$skin_list);
+ $mobile_layout_list = $oLayoutModel->getLayoutList(0,"M");
+ Context::set('mlayout_list', $mobile_layout_list);
+ // Set a template file
+
+ if($this->module_info->page_type == 'ARTICLE')
+ {
+ $oModuleModel = &getModel('module');
+ $skin_list = $oModuleModel->getSkins($this->module_path);
+ Context::set('skin_list',$skin_list);
$mskin_list = $oModuleModel->getSkins($this->module_path, "m.skins");
Context::set('mskin_list', $mskin_list);
+ }
- //Security
- $security = new Security();
- $security->encodeHTML('layout_list..layout');
- $security->encodeHTML('layout_list..title');
- $security->encodeHTML('mlayout_list..layout');
- $security->encodeHTML('mlayout_list..title');
+ //Security
+ $security = new Security();
+ $security->encodeHTML('layout_list..layout');
+ $security->encodeHTML('layout_list..title');
+ $security->encodeHTML('mlayout_list..layout');
+ $security->encodeHTML('mlayout_list..title');
+ $security->encodeHTML('module_info.');
- // Set a template file
- $this->setTemplateFile('page_insert');
- }
+ $this->setTemplateFile('page_info');
+ }
- function dispPageAdminMobileContent()
+ /**
+ * @brief Additional settings page showing
+ * For additional settings in a service module in order to establish links with other modules peyijiim
+ */
+ function dispPageAdminPageAdditionSetup()
+ {
+ // call by reference content from other modules to come take a year in advance for putting the variable declaration
+ $content = '';
+
+ $oEditorView = &getView('editor');
+ $oEditorView->triggerDispEditorAdditionSetup($content);
+ Context::set('setup_content', $content);
+ // Set a template file
+ $this->setTemplateFile('addition_setup');
+
+ $security = new Security();
+ $security->encodeHTML('module_info.');
+ }
+
+ /**
+ * @brief Add Page Form Output
+ */
+ function dispPageAdminInsert()
+ {
+ // Get module_srl by GET parameter
+ $module_srl = Context::get('module_srl');
+ // Get and set module information if module_srl exists
+ if($module_srl)
{
- if($this->module_info->page_type == 'OUTSIDE')
- {
- return $this->stop(-1, 'msg_invalid_request');
- }
-
- if($this->module_srl)
- {
- Context::set('module_srl',$this->module_srl);
- }
-
- $oPageMobile = &getMobile('page');
- $oPageMobile->module_info = $this->module_info;
- $page_type_name = strtolower($this->module_info->page_type);
- $method = '_get' . ucfirst($page_type_name) . 'Content';
- if (method_exists($oPageMobile, $method))
- {
- $page_content = $oPageMobile->{$method}();
- }
+ $oModuleModel = &getModel('module');
+ $columnList = array('module_srl', 'mid', 'module_category_srl', 'browser_title', 'layout_srl', 'use_mobile', 'mlayout_srl');
+ $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
+ if($module_info->module_srl == $module_srl) Context::set('module_info',$module_info);
else
{
- return new Object(-1, sprintf('%s method is not exists', $method));
- }
-
- Context::set('module_info', $this->module_info);
- Context::set('page_content', $page_content);
-
- $this->setTemplateFile('mcontent');
- }
-
- function dispPageAdminMobileContentModify()
- {
- Context::set('module_info', $this->module_info);
-
- if ($this->module_info->page_type == 'WIDGET')
- {
- $this->_setWidgetTypeContentModify(true);
- }
- else if ($this->module_info->page_type == 'ARTICLE')
- {
- $this->_setArticleTypeContentModify(true);
+ unset($module_info);
+ unset($module_srl);
}
}
+ // Get a layout list
+ $oLayoutModel = &getModel('layout');
+ $layout_list = $oLayoutModel->getLayoutList();
+ Context::set('layout_list', $layout_list);
- /**
- * @brief Edit Page Content
- **/
- function dispPageAdminContentModify() {
- // Set the module information
- Context::set('module_info', $this->module_info);
+ $mobile_layout_list = $oLayoutModel->getLayoutList(0,"M");
+ Context::set('mlayout_list', $mobile_layout_list);
- if ($this->module_info->page_type == 'WIDGET')
- {
- $this->_setWidgetTypeContentModify();
- }
- else if ($this->module_info->page_type == 'ARTICLE')
- {
- $this->_setArticleTypeContentModify();
- }
- }
+ $oModuleModel = &getModel('module');
+ $skin_list = $oModuleModel->getSkins($this->module_path);
+ Context::set('skin_list',$skin_list);
+ $mskin_list = $oModuleModel->getSkins($this->module_path, "m.skins");
+ Context::set('mskin_list', $mskin_list);
- function _setWidgetTypeContentModify($isMobile = false)
+ //Security
+ $security = new Security();
+ $security->encodeHTML('layout_list..layout');
+ $security->encodeHTML('layout_list..title');
+ $security->encodeHTML('mlayout_list..layout');
+ $security->encodeHTML('mlayout_list..title');
+
+ // Set a template file
+ $this->setTemplateFile('page_insert');
+ }
+
+ function dispPageAdminMobileContent()
+ {
+ if($this->module_info->page_type == 'OUTSIDE')
{
- // Setting contents
- if($isMobile)
- {
- $content = Context::get('mcontent');
- if(!$content) $content = $this->module_info->mcontent;
- $templateFile = 'page_mobile_content_modify';
- }
- else
- {
- $content = Context::get('content');
- if(!$content) $content = $this->module_info->content;
- $templateFile = 'page_content_modify';
- }
-
- Context::set('content', $content);
- // Convert them to teach the widget
- $oWidgetController = &getController('widget');
- $content = $oWidgetController->transWidgetCode($content, true, !$isMobile);
- // $content = str_replace('$', '$', $content);
- Context::set('page_content', $content);
- // Set widget list
- $oWidgetModel = &getModel('widget');
- $widget_list = $oWidgetModel->getDownloadedWidgetList();
- Context::set('widget_list', $widget_list);
-
- //Security
- $security = new Security();
- $security->encodeHTML('widget_list..title','module_info.mid');
-
- // Set a template file
- $this->setTemplateFile($templateFile);
- }
-
- function _setArticleTypeContentModify($isMobile = false)
- {
- $oDocumentModel = &getModel('document');
- $oDocument = $oDocumentModel->getDocument(0, true);
-
- if($isMobile)
- {
- Context::set('isMobile', 'Y');
- $target = 'mdocument_srl';
- }
- else
- {
- Context::set('isMobile', 'N');
- $target = 'document_srl';
- }
-
- if ($this->module_info->{$target})
- {
- $document_srl = $this->module_info->{$target};
- $oDocument->setDocument($document_srl);
- Context::set('document_srl', $document_srl);
- }
-
- Context::addJsFilter($this->module_path.'tpl/filter', 'insert_article.xml');
- Context::set('oDocument', $oDocument);
- Context::set('mid', $this->module_info->mid);
- $this->setTemplateFile('article_content_modify');
+ return $this->stop(-1, 'msg_invalid_request');
}
- /**
- * @brief Delete page output
- **/
- function dispPageAdminDelete() {
- $module_srl = Context::get('module_srl');
- if(!$module_srl) return $this->dispContent();
-
- $oModuleModel = &getModel('module');
- $columnList = array('module_srl', 'module', 'mid');
- $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
- Context::set('module_info',$module_info);
- // Set a template file
- $this->setTemplateFile('page_delete');
-
- $security = new Security();
- $security->encodeHTML('module_info.');
- }
-
- /**
- * @brief Rights Listing
- **/
- function dispPageAdminGrantInfo() {
- // Common module settings page, call rights
- $oModuleAdminModel = &getAdminModel('module');
- $grant_content = $oModuleAdminModel->getModuleGrantHTML($this->module_info->module_srl, $this->xml_info->grant);
- Context::set('grant_content', $grant_content);
-
- $this->setTemplateFile('grant_list');
-
- $security = new Security();
- $security->encodeHTML('module_info.');
- }
-
- /**
- * Display skin setting page
- */
- function dispPageAdminSkinInfo()
+ if($this->module_srl)
{
- $oModuleAdminModel = &getAdminModel('module');
- $skin_content = $oModuleAdminModel->getModuleSkinHTML($this->module_info->module_srl);
- Context::set('skin_content', $skin_content);
-
- $this->setTemplateFile('skin_info');
+ Context::set('module_srl',$this->module_srl);
}
- /**
- * Display mobile skin setting page
- */
- function dispPageAdminMobileSkinInfo()
+ $oPageMobile = &getMobile('page');
+ $oPageMobile->module_info = $this->module_info;
+ $page_type_name = strtolower($this->module_info->page_type);
+ $method = '_get' . ucfirst($page_type_name) . 'Content';
+ if(method_exists($oPageMobile, $method))
{
- $oModuleAdminModel = &getAdminModel('module');
- $skin_content = $oModuleAdminModel->getModuleMobileSkinHTML($this->module_info->module_srl);
- Context::set('skin_content', $skin_content);
-
- $this->setTemplateFile('skin_info');
+ $page_content = $oPageMobile->{$method}();
}
- }
-?>
+ else
+ {
+ return new Object(-1, sprintf('%s method is not exists', $method));
+ }
+
+ Context::set('module_info', $this->module_info);
+ Context::set('page_content', $page_content);
+
+ $this->setTemplateFile('mcontent');
+ }
+
+ function dispPageAdminMobileContentModify()
+ {
+ Context::set('module_info', $this->module_info);
+
+ if ($this->module_info->page_type == 'WIDGET')
+ {
+ $this->_setWidgetTypeContentModify(true);
+ }
+ else if ($this->module_info->page_type == 'ARTICLE')
+ {
+ $this->_setArticleTypeContentModify(true);
+ }
+ }
+
+ /**
+ * @brief Edit Page Content
+ */
+ function dispPageAdminContentModify()
+ {
+ // Set the module information
+ Context::set('module_info', $this->module_info);
+
+ if ($this->module_info->page_type == 'WIDGET')
+ {
+ $this->_setWidgetTypeContentModify();
+ }
+ else if ($this->module_info->page_type == 'ARTICLE')
+ {
+ $this->_setArticleTypeContentModify();
+ }
+ }
+
+ function _setWidgetTypeContentModify($isMobile = false)
+ {
+ // Setting contents
+ if($isMobile)
+ {
+ $content = Context::get('mcontent');
+ if(!$content) $content = $this->module_info->mcontent;
+ $templateFile = 'page_mobile_content_modify';
+ }
+ else
+ {
+ $content = Context::get('content');
+ if(!$content) $content = $this->module_info->content;
+ $templateFile = 'page_content_modify';
+ }
+
+ Context::set('content', $content);
+ // Convert them to teach the widget
+ $oWidgetController = &getController('widget');
+ $content = $oWidgetController->transWidgetCode($content, true, !$isMobile);
+ // $content = str_replace('$', '$', $content);
+ Context::set('page_content', $content);
+ // Set widget list
+ $oWidgetModel = &getModel('widget');
+ $widget_list = $oWidgetModel->getDownloadedWidgetList();
+ Context::set('widget_list', $widget_list);
+
+ //Security
+ $security = new Security();
+ $security->encodeHTML('widget_list..title','module_info.mid');
+
+ // Set a template file
+ $this->setTemplateFile($templateFile);
+ }
+
+ function _setArticleTypeContentModify($isMobile = false)
+ {
+ $oDocumentModel = &getModel('document');
+ $oDocument = $oDocumentModel->getDocument(0, true);
+
+ if($isMobile)
+ {
+ Context::set('isMobile', 'Y');
+ $target = 'mdocument_srl';
+ }
+ else
+ {
+ Context::set('isMobile', 'N');
+ $target = 'document_srl';
+ }
+
+ if($this->module_info->{$target})
+ {
+ $document_srl = $this->module_info->{$target};
+ $oDocument->setDocument($document_srl);
+ Context::set('document_srl', $document_srl);
+ }
+
+ Context::addJsFilter($this->module_path.'tpl/filter', 'insert_article.xml');
+ Context::set('oDocument', $oDocument);
+ Context::set('mid', $this->module_info->mid);
+ $this->setTemplateFile('article_content_modify');
+ }
+
+ /**
+ * @brief Delete page output
+ */
+ function dispPageAdminDelete()
+ {
+ $module_srl = Context::get('module_srl');
+ if(!$module_srl) return $this->dispContent();
+
+ $oModuleModel = &getModel('module');
+ $columnList = array('module_srl', 'module', 'mid');
+ $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
+ Context::set('module_info',$module_info);
+ // Set a template file
+ $this->setTemplateFile('page_delete');
+
+ $security = new Security();
+ $security->encodeHTML('module_info.');
+ }
+
+ /**
+ * @brief Rights Listing
+ */
+ function dispPageAdminGrantInfo()
+ {
+ // Common module settings page, call rights
+ $oModuleAdminModel = &getAdminModel('module');
+ $grant_content = $oModuleAdminModel->getModuleGrantHTML($this->module_info->module_srl, $this->xml_info->grant);
+ Context::set('grant_content', $grant_content);
+
+ $this->setTemplateFile('grant_list');
+
+ $security = new Security();
+ $security->encodeHTML('module_info.');
+ }
+
+ /**
+ * Display skin setting page
+ */
+ function dispPageAdminSkinInfo()
+ {
+ $oModuleAdminModel = &getAdminModel('module');
+ $skin_content = $oModuleAdminModel->getModuleSkinHTML($this->module_info->module_srl);
+ Context::set('skin_content', $skin_content);
+
+ $this->setTemplateFile('skin_info');
+ }
+
+ /**
+ * Display mobile skin setting page
+ */
+ function dispPageAdminMobileSkinInfo()
+ {
+ $oModuleAdminModel = &getAdminModel('module');
+ $skin_content = $oModuleAdminModel->getModuleMobileSkinHTML($this->module_info->module_srl);
+ Context::set('skin_content', $skin_content);
+
+ $this->setTemplateFile('skin_info');
+ }
+}
+/* End of file page.admin.view.php */
+/* Location: ./modules/page/page.admin.view.php */
diff --git a/modules/page/page.api.php b/modules/page/page.api.php
index 01c622ef4..0a543d9a2 100644
--- a/modules/page/page.api.php
+++ b/modules/page/page.api.php
@@ -1,25 +1,26 @@
triggerWidgetCompile($page_content);
+ Context::setResponseMethod($requestMethod);
- /**
- * @brief Page information
- **/
- function dispPageIndex(&$oModule) {
- $page_content = Context::get('page_content');
- $oWidgetController = &getController('widget');
-
- $requestMethod = Context::getRequestMethod();
- Context::setResponseMethod('HTML');
- $oWidgetController->triggerWidgetCompile($page_content);
- Context::setResponseMethod($requestMethod);
-
- $oModule->add('page_content',$page_content);
- }
- }
-?>
+ $oModule->add('page_content',$page_content);
+ }
+}
+/* End of file page.api.php */
+/* Location: ./modules/page/page.api.php */
diff --git a/modules/page/page.class.php b/modules/page/page.class.php
index 7f4ffb74a..3f41fedc7 100644
--- a/modules/page/page.class.php
+++ b/modules/page/page.class.php
@@ -1,78 +1,87 @@
toBool() && $output->data) return true;
- return new Object();
- }
+ $output = executeQuery('page.pageTypeNullCheck');
+ if($output->toBool() && $output->data) return true;
- /**
- * @brief a method to check if successfully installed
- **/
- function checkUpdate() {
- $output = executeQuery('page.pageTypeOpageCheck');
- if ($output->toBool() && $output->data) return true;
+ return false;
+ }
- $output = executeQuery('page.pageTypeNullCheck');
- if ($output->toBool() && $output->data) return true;
-
- return false;
- }
-
- /**
- * @brief Execute update
- **/
- function moduleUpdate() {
- // opage module instance update
- $output = executeQueryArray('page.pageTypeOpageCheck');
- if ($output->toBool() && count($output->data) > 0){
- foreach($output->data as $val){
- $args->module_srl = $val->module_srl;
- $args->name = 'page_type';
- $args->value= 'OUTSIDE';
- $in_out = executeQuery('page.insertPageType', $args);
- }
- $output = executeQuery('page.updateAllOpage');
- if(!$output->toBool()) return $output;
+ /**
+ * @brief Execute update
+ */
+ function moduleUpdate()
+ {
+ // opage module instance update
+ $output = executeQueryArray('page.pageTypeOpageCheck');
+ if($output->toBool() && count($output->data) > 0)
+ {
+ foreach($output->data as $val)
+ {
+ $args->module_srl = $val->module_srl;
+ $args->name = 'page_type';
+ $args->value= 'OUTSIDE';
+ $in_out = executeQuery('page.insertPageType', $args);
}
+ $output = executeQuery('page.updateAllOpage');
+ if(!$output->toBool()) return $output;
+ }
- // old page module instance update
- $output = executeQueryArray('page.pageTypeNullCheck');
- $skin_update_srls = array();
- if ($output->toBool() && $output->data){
- foreach($output->data as $val){
- $args->module_srl = $val->module_srl;
- $args->name = 'page_type';
- $args->value= 'WIDGET';
- $in_out = executeQuery('page.insertPageType', $args);
+ // old page module instance update
+ $output = executeQueryArray('page.pageTypeNullCheck');
+ $skin_update_srls = array();
+ if($output->toBool() && $output->data)
+ {
+ foreach($output->data as $val)
+ {
+ $args->module_srl = $val->module_srl;
+ $args->name = 'page_type';
+ $args->value= 'WIDGET';
+ $in_out = executeQuery('page.insertPageType', $args);
- $skin_update_srls[] = $val->module_srl;
- }
+ $skin_update_srls[] = $val->module_srl;
}
-
- if (count($skin_update_srls)>0){
- $skin_args->module_srls = implode(',',$skin_update_srls);
- $skin_args->is_skin_fix = "Y";
- $ouput = executeQuery('page.updateSkinFix', $skin_args);
- }
- return new Object(0,'success_updated');
- }
+ }
- /**
- * @brief Re-generate the cache file
- **/
- function recompileCache() {
- }
- }
-?>
+ if(count($skin_update_srls)>0)
+ {
+ $skin_args->module_srls = implode(',',$skin_update_srls);
+ $skin_args->is_skin_fix = "Y";
+ $ouput = executeQuery('page.updateSkinFix', $skin_args);
+ }
+ return new Object(0,'success_updated');
+ }
+
+ /**
+ * @brief Re-generate the cache file
+ */
+ function recompileCache()
+ {
+ }
+}
+/* End of file page.class.php */
+/* Location: ./modules/page/page.class.php */
diff --git a/modules/page/page.controller.php b/modules/page/page.controller.php
index 88b889481..1191c49e1 100644
--- a/modules/page/page.controller.php
+++ b/modules/page/page.controller.php
@@ -1,102 +1,114 @@
]*)>(.*?)<\/title>!is', $content, $buff);
+ return trim($buff[2]);
+ }
- /**
- * @brief Initialization
- **/
- function init() { }
+ /**
+ * @brief Extract header script
+ */
+ function getHeadScript($content)
+ {
+ // remove the title tag
+ $content = preg_replace('!