issue 2303 add a mobile content in type of ARTICLE page.

git-svn-id: http://xe-core.googlecode.com/svn/branches/luminous@11126 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
devjin 2012-08-30 09:27:19 +00:00
parent 6cfdca4604
commit cdbdef7adc
14 changed files with 189 additions and 83 deletions

View file

@ -160,6 +160,16 @@
{
$extra_vars->document_srl = array_pop($document_srls);
}
if($extra_vars->mdocument_srl)
{
$copyOutput = $oDocumentAdminController->copyDocumentModule(array($extra_vars->mdocument_srl), $module_srl, $module_info->category_srl);
$copiedSrls = $copyOutput->get('copied_srls');
if($copiedSrls && count($copiedSrls) > 0)
{
$extra_vars->mdocument_srl = array_pop($copiedSrls);
}
}
}
// Grant module permissions

View file

@ -1,11 +1,2 @@
<div class="title">{$lang->title} : {$oDocument->getTitle()}</div>
<div class="content">{$lang->content} : {$oDocument->getContent()}</div>
<div class="tag">{$lang->tag} : <block cond="is_array($oDocument->get('tag_list'))">{implode(',', $oDocument->get('tag_list'))}</block></div>
<!--@if($grant->manager)-->
<div class="tRight 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-->
<h1 cond="$module_info->display_mobile_title != 'hide'">{$oDocument->getTitle()}</h1>
{$oDocument->getContent($module_info->display_popupmenu != 'hide')}

View file

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<skin version="0.2">
<title xml:lang="ko">Default Mobile Page Skin</title>
<title xml:lang="en">Default Mobile Page Skin</title>
<description xml:lang="ko">
문서형 페이지의 기본 스킨입니다.
</description>
<version>0.2</version>
<date>2012-08-30</date>
<author email_address="developers@xpressengine.com" link="http://xpressengine.com/">
<name xml:lang="ko">NHN</name>
<name xml:lang="jp">NHN</name>
<name xml:lang="zh-CN">NHN</name>
<name xml:lang="en">NHN</name>
<name xml:lang="vi">NHN</name>
<name xml:lang="es">NHN</name>
<name xml:lang="zh-TW">NHN</name>
<name xml:lang="tr">NHN</name>
</author>
<extra_vars>
<var name="display_mobile_title" type="radio" default="show">
<title xml:lang="ko">제목표시</title>
<title xml:lang="en">Display title</title>
<description xml:lang="ko">
문서의 제목을 표시 할지 결정합니다.
</description>
<options value="show">
<title xml:lang="ko">출력</title>
<title xml:lang="en">Show</title>
</options>
<options value="hide">
<title xml:lang="ko">출력하지 않음</title>
<title xml:lang="en">Hide</title>
</options>
</var>
</extra_vars>
</skin>

View file

@ -289,19 +289,30 @@
$bAnonymous = false;
// 이미 존재하는 경우 수정
if($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl) {
if($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl)
{
$output = $oDocumentController->updateDocument($oDocument, $obj);
$msg_code = 'success_updated';
// 그렇지 않으면 신규 등록
} else {
}
else
{
if($obj->ismobile == 'Y')
{
$target = 'mdocument_srl';
}
else
{
$target = 'document_srl';
}
$output = $oDocumentController->insertDocument($obj, $bAnonymous);
$msg_code = 'success_registed';
$obj->document_srl = $output->get('document_srl');
$document_srl = $output->get('document_srl');
$oModuleController = &getController('module');
$this->module_info->document_srl = $obj->document_srl;
$this->module_info->{$target} = $document_srl;
$oModuleController->updateModule($this->module_info);
}
// 오류 발생시 멈춤
@ -310,6 +321,7 @@
// 결과를 리턴
$this->add('mid', Context::get('mid'));
$this->add('document_srl', $output->get('document_srl'));
$this->add('is_mobile', $obj->ismobile);
// 성공 메세지 등록
$this->setMessage($msg_code);

View file

@ -186,27 +186,30 @@
$this->setTemplateFile('page_insert');
}
function dispPageAdminMobileContent() {
if($this->module_srl) Context::set('module_srl',$this->module_srl);
// Specifying the cache file
$cache_file = sprintf("%sfiles/cache/page/%d.%s.%s.m.cache.php", _XE_PATH_, $this->module_info->module_srl, Context::getLangType(), Context::getSslStatus());
$interval = (int)($this->module_info->page_caching_interval);
if($interval>0) {
if(!file_exists($cache_file)) $mtime = 0;
else $mtime = filemtime($cache_file);
function dispPageAdminMobileContent()
{
if($this->module_info->page_type == 'OUTSIDE')
{
return $this->stop(-1, 'msg_invalid_request');
}
if($mtime + $interval*60 > time()) {
$page_content = FileHandler::readFile($cache_file);
} else {
$oWidgetController = &getController('widget');
$page_content = $oWidgetController->transWidgetCode($this->module_info->mcontent);
FileHandler::writeFile($cache_file, $page_content);
}
} else {
if(file_exists($cache_file)) FileHandler::removeFile($cache_file);
$page_content = $this->module_info->mcontent;
}
$page_content = preg_replace('@<\!--#Meta:@', '<!--Meta:', $page_content);
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}();
}
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);
@ -214,27 +217,18 @@
$this->setTemplateFile('mcontent');
}
function dispPageAdminMobileContentModify() {
function dispPageAdminMobileContentModify()
{
Context::set('module_info', $this->module_info);
// Setting contents
$content = Context::get('mcontent');
if(!$content) $content = $this->module_info->mcontent;
Context::set('content', $content);
// Convert them to teach the widget
$oWidgetController = &getController('widget');
$content = $oWidgetController->transWidgetCode($content, true);
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('page_mobile_content_modify');
if ($this->module_info->page_type == 'WIDGET')
{
$this->_setWidgetTypeContentModify(true);
}
else if ($this->module_info->page_type == 'ARTICLE')
{
$this->_setArticleTypeContentModify(true);
}
}
/**
@ -244,18 +238,37 @@
// 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();
if ($this->module_info->page_type == 'WIDGET')
{
$this->_setWidgetTypeContentModify();
}
else if ($this->module_info->page_type == 'ARTICLE')
{
$this->_setArticleTypeContentModify();
}
}
function _setWidgetTypeContentModify() {
function _setWidgetTypeContentModify($isMobile = false)
{
// Setting contents
$content = Context::get('content');
if(!$content) $content = $this->module_info->content;
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, true);
$content = $oWidgetController->transWidgetCode($content, true, !$isMobile);
// $content = str_replace('$', '&#36;', $content);
Context::set('page_content', $content);
// Set widget list
@ -268,18 +281,32 @@
$security->encodeHTML('widget_list..title','module_info.mid');
// Set a template file
$this->setTemplateFile('page_content_modify');
$this->setTemplateFile($templateFile);
}
function _setArticleTypeContentModify() {
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->document_srl){
$document_srl = $this->module_info->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);

View file

@ -89,17 +89,33 @@ class pageMobile extends pageView {
return $page_content;
}
function _getArticleContent(){
function _getArticleContent()
{
$oTemplate = &TemplateHandler::getInstance();
$oDocumentModel = &getModel('document');
$oDocument = $oDocumentModel->getDocument(0, true);
if ($this->module_info->document_srl){
$document_srl = $this->module_info->document_srl;
if ($this->module_info->mdocument_srl)
{
$document_srl = $this->module_info->mdocument_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->mskin));
if ($this->module_info->mskin)
{
$templatePath = (sprintf($this->module_path.'m.skins/%s', $this->module_info->skin));
}
else
{
$templatePath = ($this->module_path.'m.skins/default');
}
$page_content = $oTemplate->compile($templatePath, 'mobile');
return $page_content;
}
function _getOutsideContent(){

View file

@ -76,6 +76,8 @@
}
function _getArticleContent(){
$oTemplate = &TemplateHandler::getInstance();
$oDocumentModel = &getModel('document');
$oDocument = $oDocumentModel->getDocument(0, true);
@ -86,13 +88,18 @@
}
Context::set('oDocument', $oDocument);
Context::set('module_info', $this->module_info);
if ($this->module_info->skin)
$this->setTemplatePath(sprintf($this->module_path.'skins/%s', $this->module_info->skin));
{
$templatePath = (sprintf($this->module_path.'skins/%s', $this->module_info->skin));
}
else
$this->setTemplatePath($this->module_path.'skins/default');
{
$templatePath = ($this->module_path.'skins/default');
}
$page_content = $oTemplate->compile($templatePath, 'content');
return $page_content;
}
function _getOutsideContent(){

View file

@ -1,9 +1,2 @@
<h1 cond="$module_info->display_title != 'hide'">{$oDocument->getTitle()}</h1>
{$oDocument->getContent($module_info->display_popupmenu != 'hide')}
<block cond="$grant->manager">
<load target="../../tpl/js/page_admin.js" />
<div class="btnArea">
<span class="btn"><a cond="$logged_info->is_admin=='Y'" href="{getUrl('act','dispPageAdminInfo','module_srl',$module_info->module_srl)}">{$lang->cmd_setup}...</a></span>
<span class="btn"><a href="{getUrl('act','dispPageAdminContentModify','document_srl','')}">{$lang->cmd_page_modify}...</a></span>
</div>
</block>

View file

@ -0,0 +1,5 @@
<div class="btnArea">
<span class="btn"><a cond="$logged_info->is_admin=='Y'" href="{getUrl('act','dispPageAdminInfo','module_srl',$module_info->module_srl)}">{$lang->cmd_setup}...</a></span>
<span class="btn"><a href="{getUrl('act','dispPageAdminContentModify','document_srl','')}">{$lang->cmd_page_modify}...</a></span>
<span class="btn"><a href="{getUrl('act','dispPageAdminContentModify','document_srl','')}">{$lang->cmd_page_modify}...</a></span>
</div>

View file

@ -3,6 +3,7 @@
<input type="hidden" name="mid" value="{$mid}" />
<input type="hidden" name="content" value="{$oDocument->getContentText()}" />
<input type="hidden" name="document_srl" value="{$document_srl}" />
<input type="hidden" name="isMobile" value="{$isMobile}" />
<div class="form" style="margin-right:10px">
<input type="text" name="title" value="{htmlspecialchars($oDocument->getTitleText())}" title="{$lang->title}" style="width:100%" />
</div>

View file

@ -9,7 +9,7 @@
<!--@if($module_info->page_type != 'OUTSIDE')-->
<span class="btn"><a href="{getUrl('act','dispPageAdminContentModify','document_srl','')}">{$lang->cmd_page_modify}...</a></span>
<!--@end-->
<!--@if($module_info->use_mobile =="Y" && $module_info->page_type == 'WIDGET')-->
<!--@if($module_info->use_mobile =="Y" && $module_info->page_type != 'OUTSIDE')-->
<span class="btn"><a href="{getUrl('act','dispPageAdminMobileContent','module_srl',$module_info->module_srl)}">Mobile</a></span>
<!--@end-->
</div>

View file

@ -9,5 +9,6 @@
<tag name="mid" />
<tag name="document_srl" />
<tag name="category_srl" />
<tag name="is_mobile" />
</response>
</filter>

View file

@ -30,10 +30,15 @@ function completeArticleDocumentInserted(ret_obj){
var message = ret_obj['message'];
var mid = ret_obj['mid'];
var is_mobile = ret_obj['is_mobile'];
alert(message);
var url = '';
if(is_mobile == 'Y')
url = current_url.setQuery('act', 'dispPageAdminMobileContent').setQuery('mid', mid);
else
url = current_url.setQuery('act', 'dispPageIndex').setQuery('mid', mid);

View file

@ -99,7 +99,7 @@
<p>{$lang->about_page_caching_interval}</p>
</td>
</tr>
<tr>
<tr class="optionnalData articleType">
<th scope="row">{$lang->skin}</th>
<td class="text">
<select name="skin">