From f6fb8d2463cc5703112aee4b052eaac01a50960b Mon Sep 17 00:00:00 2001 From: devjin Date: Thu, 8 Sep 2011 02:37:56 +0000 Subject: [PATCH] fixed opage view git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9105 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- modules/page/m.skins/default/mobile.html | 12 +++++ modules/page/page.admin.controller.php | 8 +-- modules/page/page.class.php | 1 + modules/page/page.mobile.php | 64 +++++++++++++++++++++--- modules/page/page.view.php | 16 +++--- modules/page/ruleset/insertPage.xml | 3 ++ modules/page/ruleset/updatePage.xml | 3 ++ modules/page/tpl/mobile.html | 2 +- modules/page/tpl/page_info.html | 4 +- modules/page/tpl/page_insert.html | 4 +- 10 files changed, 94 insertions(+), 23 deletions(-) create mode 100644 modules/page/m.skins/default/mobile.html diff --git a/modules/page/m.skins/default/mobile.html b/modules/page/m.skins/default/mobile.html new file mode 100644 index 000000000..92940b223 --- /dev/null +++ b/modules/page/m.skins/default/mobile.html @@ -0,0 +1,12 @@ +
제목 : {$oDocument->getTitle()}
+
내용 : {$oDocument->getContent()}
+
태그 : {implode(',', $oDocument->get('tag_list'))}
+ + +
+ + {$lang->cmd_setup} + + {$lang->cmd_page_modify} +
+ diff --git a/modules/page/page.admin.controller.php b/modules/page/page.admin.controller.php index 79ab9d0a1..8f5d3e28f 100644 --- a/modules/page/page.admin.controller.php +++ b/modules/page/page.admin.controller.php @@ -48,14 +48,14 @@ case 'WIDGET' : { unset($args->skin); unset($args->mskin); - unset($args->opage_path); - unset($args->opage_mpath); + unset($args->path); + unset($args->mpath); break; } case 'ARTICLE' : { unset($args->page_caching_interval); - unset($args->opage_path); - unset($args->opage_mpath); + unset($args->path); + unset($args->mpath); break; } case 'OUTSIDE' : { diff --git a/modules/page/page.class.php b/modules/page/page.class.php index 6d458b009..7f4ffb74a 100644 --- a/modules/page/page.class.php +++ b/modules/page/page.class.php @@ -44,6 +44,7 @@ $in_out = executeQuery('page.insertPageType', $args); } $output = executeQuery('page.updateAllOpage'); + if(!$output->toBool()) return $output; } // old page module instance update diff --git a/modules/page/page.mobile.php b/modules/page/page.mobile.php index bb5a79c09..f1e374b35 100644 --- a/modules/page/page.mobile.php +++ b/modules/page/page.mobile.php @@ -1,12 +1,43 @@ setTemplatePath($this->module_path.'tpl'); + + switch($this->module_info->page_type) + { + case 'WIDGET' : { + $this->cache_file = sprintf("%sfiles/cache/page/%d.%s.cache.php", _XE_PATH_, $this->module_info->module_srl, Context::getLangType()); + $this->interval = (int)($this->module_info->page_caching_interval); + break; + } + case 'OUTSIDE' : { + $this->cache_file = sprintf("./files/cache/opage/%d.cache.php", $this->module_info->module_srl); + $this->interval = (int)($this->module_info->page_caching_interval); + $this->path = $this->module_info->mpath; + break; + } + } } function dispPageIndex() { + // Variables used in the template Context:: set() + if($this->module_srl) Context::set('module_srl',$this->module_srl); + + $page_type_name = strtolower($this->module_info->page_type); + $method = '_get' . ucfirst($page_type_name) . 'Content'; + if (method_exists($this, $method)) $page_content = $this->{$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('mobile'); + } + function _getWidgetContent(){ // Arrange a widget ryeolro if($this->module_info->mcontent) { @@ -28,18 +59,39 @@ class pageMobile extends ModuleObject { if(file_exists($cache_file)) FileHandler::removeFile($cache_file); $page_content = $this->module_info->mcontent; } - Context::set('content', $page_content); } else { preg_match_all('!(]*)(widget=)([^\>]*?)(\>)!is', $this->module_info->content, $matches); - $content = ''; + $page_content = ''; for($i=0,$c=count($matches[0]);$i<$c;$i++) { - $content .= preg_replace('/ style\=\"([^\"]+)\" /i',' style="overflow:hidden;clear:both;margin:0 0 20px 0; _margin-right:10px;" ',$matches[0][$i])."\n\n"; + $page_content .= preg_replace('/ style\=\"([^\"]+)\" /i',' style="overflow:hidden;clear:both;margin:0 0 20px 0; _margin-right:10px;" ',$matches[0][$i])."\n\n"; } - Context::set('content', $content); } - $this->setTemplateFile('mobile'); + return $page_content; + } + + function _getArticleContent(){ + $oDocumentModel = &getModel('document'); + $oDocument = $oDocumentModel->getDocument(0, true); + + if ($this->module_info->document_srl){ + $document_srl = $this->module_info->document_srl; + $oDocument->setDocument($document_srl); + Context::set('document_srl', $document_srl); + } + Context::set('oDocument', $oDocument); + $this->setTemplatePath(sprintf($this->module_path.'m.skins/%s', $this->module_info->skin)); + } + + function _getOutsideContent(){ + // check if it is http or internal file + if($this->path) { + if(preg_match("/^([a-z]+):\/\//i",$this->path)) $content = $this->getHtmlPage($this->path, $this->interval, $this->cache_file); + else $content = $this->executeFile($this->path, $this->interval, $this->cache_file); + } + + return $content; } } diff --git a/modules/page/page.view.php b/modules/page/page.view.php index 6a01300a6..e8a9fc9e9 100644 --- a/modules/page/page.view.php +++ b/modules/page/page.view.php @@ -12,7 +12,7 @@ var $page_count = 10; var $cache_file; var $interval; - var $opage_path; + var $path; /** * @brief Initialization @@ -31,7 +31,7 @@ case 'OUTSIDE' : { $this->cache_file = sprintf("./files/cache/opage/%d.cache.php", $this->module_info->module_srl); $this->interval = (int)($this->module_info->page_caching_interval); - $this->opage_path = $this->module_info->opage_path; + $this->path = $this->module_info->path; break; } } @@ -90,9 +90,9 @@ function _getOutsideContent(){ // check if it is http or internal file - if($this->opage_path) { - if(preg_match("/^([a-z]+):\/\//i",$this->opage_path)) $content = $this->getHtmlPage($this->opage_path, $this->interval, $this->cache_file); - else $content = $this->executeFile($this->opage_path, $this->interval, $this->cache_file); + if($this->path) { + if(preg_match("/^([a-z]+):\/\//i",$this->path)) $content = $this->getHtmlPage($this->path, $this->interval, $this->cache_file); + else $content = $this->executeFile($this->path, $this->interval, $this->cache_file); } return $content; @@ -153,7 +153,7 @@ $content = ob_get_clean(); // Replace relative path to the absolute path $path_info = pathinfo($path); - $this->opage_path = str_replace('\\', '/', realpath($path_info['dirname'])).'/'; + $this->path = str_replace('\\', '/', realpath($path_info['dirname'])).'/'; $content = preg_replace_callback('/(target=|src=|href=|url\()("|\')?([^"\'\)]+)("|\'\))?/is',array($this,'_replacePath'),$content); $content = preg_replace_callback('/(
-{$content} +{$page_content}
diff --git a/modules/page/tpl/page_info.html b/modules/page/tpl/page_info.html index d40a608c7..86c82b628 100644 --- a/modules/page/tpl/page_info.html +++ b/modules/page/tpl/page_info.html @@ -86,14 +86,14 @@
{$lang->opage_path}
- +

{$lang->about_opage_path}{realpath("./")}

{$lang->opage_mobile_path}
- +

{$lang->about_opage_mobile_path}{realpath("./")}

diff --git a/modules/page/tpl/page_insert.html b/modules/page/tpl/page_insert.html index ea046d51d..7e7877b11 100644 --- a/modules/page/tpl/page_insert.html +++ b/modules/page/tpl/page_insert.html @@ -122,14 +122,14 @@
{$lang->opage_path}
- +

{$lang->about_opage_path}{realpath("./")}

{$lang->opage_mobile_path}
- +

{$lang->about_opage_mobile_path}{realpath("./")}