fixed opage view

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9105 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
devjin 2011-09-08 02:37:56 +00:00
parent d287c4ee11
commit f6fb8d2463
10 changed files with 94 additions and 23 deletions

View file

@ -0,0 +1,12 @@
<div class="title">제목 : {$oDocument->getTitle()}</div>
<div class="content">내용 : {$oDocument->getContent()}</div>
<div class="tag">태그 : {implode(',', $oDocument->get('tag_list'))}</div>
<!--@if($grant->manager)-->
<!--%import("./js/page_admin.js")-->
<div class="tRight gap1 clear">
<!--@if($logged_info->is_admin=='Y')-->
<a href="{getUrl('act','dispPageAdminInfo','module_srl',$module_info->module_srl)}" class="button green"><span>{$lang->cmd_setup}</span></a>
<!--@end-->
<a href="{getUrl('act','dispPageAdminContentModify','document_srl','')}" class="button red"><span>{$lang->cmd_page_modify}</span></a>
</div>
<!--@end-->

View file

@ -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' : {

View file

@ -44,6 +44,7 @@
$in_out = executeQuery('page.insertPageType', $args);
}
$output = executeQuery('page.updateAllOpage');
if(!$output->toBool()) return $output;
}
// old page module instance update

View file

@ -1,12 +1,43 @@
<?php
class pageMobile extends ModuleObject {
require_once(_XE_PATH_.'modules/page/page.view.php');
class pageMobile extends pageView {
function init() {
// Get a template path (page in the administrative template tpl putting together)
$this->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('!(<img)([^\>]*)(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;
}
}

View file

@ -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('/(<!--%import\()(\")([^"]+)(\")/is',array($this,'_replacePath'),$content);
@ -185,12 +185,12 @@
return $matches[0];
// In case of .. , get a path
} elseif(preg_match('/^\.\./i',$val)) {
$p = Context::pathToUrl($this->opage_path);
$p = Context::pathToUrl($this->path);
return sprintf("%s%s%s%s",$matches[1],$matches[2],$p.$val,$matches[4]);
}
if(substr($val,0,2)=='./') $val = substr($val,2);
$p = Context::pathToUrl($this->opage_path);
$p = Context::pathToUrl($this->path);
$path = sprintf("%s%s%s%s",$matches[1],$matches[2],$p.$val,$matches[4]);
return $path;

View file

@ -6,5 +6,8 @@
<field name="page_type" required="true" rule="alpha" />
<field name="page_name" required="true" length=":40" rule="alpha_number" />
<field name="browser_title" required="true" length=":250" />
<field name="path">
<if test="$page_type == 'OUTSIDE'" attr="required" value="true" />
</field>
</fields>
</ruleset>

View file

@ -5,5 +5,8 @@
<fields>
<field name="page_name" required="true" length=":40" rule="alpha_number" />
<field name="browser_title" required="true" length=":250" />
<field name="path">
<if test="$page_type == 'OUTSIDE'" attr="required" value="true" />
</field>
</fields>
</ruleset>

View file

@ -1,4 +1,4 @@
<!--%import("css/mpage.css")-->
<div class="bd">
{$content}
{$page_content}
</div>

View file

@ -86,14 +86,14 @@
<tr class="row2">
<th scope="row"><div>{$lang->opage_path}</div></th>
<td colspan="3">
<input type="text" name="opage_path" value="{htmlspecialchars($module_info->opage_path)}" class="inputTypeText w400" />
<input type="text" name="path" value="{htmlspecialchars($module_info->path)}" class="inputTypeText w400" />
<p>{$lang->about_opage_path}<b>{realpath("./")}</b></p>
</td>
</tr>
<tr class="row">
<th scope="row"><div>{$lang->opage_mobile_path}</div></th>
<td colspan="3">
<input type="text" name="opage_mpath" value="{htmlspecialchars($module_info->opage_mpath)}" class="inputTypeText w400" />
<input type="text" name="mpath" value="{htmlspecialchars($module_info->mpath)}" class="inputTypeText w400" />
<p>{$lang->about_opage_mobile_path}<b>{realpath("./")}</b></p>
</td>
</tr>

View file

@ -122,14 +122,14 @@
<tr class="row2 optionnalData outsideType">
<th scope="row"><div>{$lang->opage_path}</div></th>
<td colspan="3">
<input type="text" name="opage_path" value="{htmlspecialchars($module_info->path)}" class="inputTypeText w400" />
<input type="text" name="path" value="{htmlspecialchars($module_info->path)}" class="inputTypeText w400" />
<p>{$lang->about_opage_path}<b>{realpath("./")}</b></p>
</td>
</tr>
<tr class="row optionnalData outsideType">
<th scope="row"><div>{$lang->opage_mobile_path}</div></th>
<td colspan="3">
<input type="text" name="opage_mpath" value="{htmlspecialchars($module_info->mpath)}" class="inputTypeText w400" />
<input type="text" name="mpath" value="{htmlspecialchars($module_info->mpath)}" class="inputTypeText w400" />
<p>{$lang->about_opage_mobile_path}<b>{realpath("./")}</b></p>
</td>
</tr>