mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-02 08:42:15 +09:00
issue 2662 member, layout
git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@12251 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
aba8de04be
commit
cec308eef1
15 changed files with 8864 additions and 8331 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -3,10 +3,9 @@
|
|||
* @class layoutAdminView
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* admin view class of the layout module
|
||||
**/
|
||||
|
||||
class layoutAdminModel extends layout {
|
||||
|
||||
*/
|
||||
class layoutAdminModel extends layout
|
||||
{
|
||||
/**
|
||||
* init
|
||||
*/
|
||||
|
|
@ -61,14 +60,14 @@ class layoutAdminModel extends layout {
|
|||
$layout_info = $security->encodeHTML('.', 'author..', 'extra_var..');
|
||||
|
||||
$layout_info->description = nl2br(trim($layout_info->description));
|
||||
if (!is_object($layout_info->extra_var))
|
||||
if(!is_object($layout_info->extra_var))
|
||||
{
|
||||
$layout_info->extra_var = new StdClass();
|
||||
}
|
||||
|
||||
foreach($layout_info->extra_var as $var_name => $val)
|
||||
{
|
||||
if (isset($layout_info->{$var_name}->description))
|
||||
if(isset($layout_info->{$var_name}->description))
|
||||
{
|
||||
$layout_info->{$var_name}->description = nl2br(trim($val->description));
|
||||
}
|
||||
|
|
@ -84,7 +83,7 @@ class layoutAdminModel extends layout {
|
|||
$oLayoutModel = &getModel('layout');
|
||||
$layout_info = $oLayoutModel->getLayout($layout_srl);
|
||||
// Error appears if there is no layout information is registered
|
||||
if(!$layout_info)
|
||||
if(!$layout_info)
|
||||
{
|
||||
return $this->dispLayoutAdminInstalledList();
|
||||
}
|
||||
|
|
@ -92,7 +91,7 @@ class layoutAdminModel extends layout {
|
|||
// Get Layout Code
|
||||
$oLayoutModel = &getModel('layout');
|
||||
$layout_file = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl);
|
||||
|
||||
|
||||
if(!file_exists($layout_file))
|
||||
{
|
||||
// If faceoff
|
||||
|
|
@ -127,16 +126,15 @@ class layoutAdminModel extends layout {
|
|||
$widget_list = $oWidgetModel->getDownloadedWidgetList();
|
||||
Context::set('widget_list', $widget_list);
|
||||
|
||||
|
||||
$security = new Security($layout_info);
|
||||
$layout_info = $security->encodeHTML('.', '.author..');
|
||||
Context::set('selected_layout', $layout_info);
|
||||
|
||||
|
||||
//Security
|
||||
$security = new Security();
|
||||
$security->encodeHTML('layout_list..');
|
||||
$security->encodeHTML('layout_list..author..');
|
||||
|
||||
$security->encodeHTML('layout_list..');
|
||||
$security->encodeHTML('layout_list..author..');
|
||||
|
||||
$security = new Security();
|
||||
$security->encodeHTML('layout_code_css', 'layout_code', 'widget_list..title');
|
||||
|
||||
|
|
@ -171,7 +169,9 @@ class layoutAdminModel extends layout {
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
return $designInfo->{$target};
|
||||
}
|
||||
}
|
||||
/* End of file layout.admin.model.php */
|
||||
/* Location: ./modules/layout/layout.admin.model.php */
|
||||
|
|
|
|||
|
|
@ -1,396 +1,417 @@
|
|||
<?php
|
||||
/**
|
||||
* @class layoutAdminView
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* admin view class of the layout module
|
||||
**/
|
||||
/**
|
||||
* @class layoutAdminView
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* admin view class of the layout module
|
||||
*/
|
||||
class layoutAdminView extends layout
|
||||
{
|
||||
/**
|
||||
* Initialization
|
||||
* @return void
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
}
|
||||
|
||||
class layoutAdminView extends layout {
|
||||
/**
|
||||
* Display a installed layout list
|
||||
* @return void
|
||||
*/
|
||||
function dispLayoutAdminInstalledList()
|
||||
{
|
||||
$type = Context::get('type');
|
||||
$type = ($type != 'M') ? 'P' : 'M';
|
||||
|
||||
/**
|
||||
* Initialization
|
||||
* @return void
|
||||
**/
|
||||
function init() {
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a installed layout list
|
||||
* @return void
|
||||
**/
|
||||
function dispLayoutAdminInstalledList() {
|
||||
$type = Context::get('type');
|
||||
$type = ($type != 'M') ? 'P' : 'M';
|
||||
|
||||
// Set a layout list
|
||||
$oLayoutModel = &getModel('layout');
|
||||
$layout_list = $oLayoutModel->getDownloadedLayoutList($type, true);
|
||||
if(!is_array($layout_list))
|
||||
{
|
||||
$layout_list = array();
|
||||
}
|
||||
|
||||
if($type == 'P')
|
||||
{
|
||||
// get Theme layout
|
||||
$oAdminModel = &getAdminModel('admin');
|
||||
$themeList = $oAdminModel->getThemeList();
|
||||
$themeLayoutList = array();
|
||||
foreach($themeList as $themeInfo){
|
||||
if(strpos($themeInfo->layout_info->name, '.') === false) continue;
|
||||
$themeLayoutList[] = $oLayoutModel->getLayoutInfo($themeInfo->layout_info->name, null, 'P');
|
||||
}
|
||||
$layout_list = array_merge($layout_list, $themeLayoutList);
|
||||
$layout_list[] = $oLayoutModel->getLayoutInfo('faceoff', null, 'P');
|
||||
}
|
||||
|
||||
$pcLayoutCount = $oLayoutModel->getInstalledLayoutCount('P');
|
||||
$mobileLayoutCount = $oLayoutModel->getInstalledLayoutCount('M');
|
||||
Context::set('pcLayoutCount', $pcLayoutCount);
|
||||
Context::set('mobileLayoutCount', $mobileLayoutCount);
|
||||
$this->setTemplateFile('installed_layout_list');
|
||||
|
||||
$security = new Security($layout_list);
|
||||
$layout_list = $security->encodeHTML('..', '..author..');
|
||||
|
||||
//Security
|
||||
$security = new Security();
|
||||
$security->encodeHTML('layout_list..layout','layout_list..title');
|
||||
|
||||
foreach($layout_list as $no => $layout_info)
|
||||
{
|
||||
$layout_list[$no]->description = nl2br(trim($layout_info->description));
|
||||
}
|
||||
Context::set('layout_list', $layout_list);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display list of pc layout all instance
|
||||
* @return void|Object (void : success, Object : fail)
|
||||
*/
|
||||
function dispLayoutAdminAllInstanceList()
|
||||
// Set a layout list
|
||||
$oLayoutModel = &getModel('layout');
|
||||
$layout_list = $oLayoutModel->getDownloadedLayoutList($type, true);
|
||||
if(!is_array($layout_list))
|
||||
{
|
||||
$type = Context::get('type');
|
||||
|
||||
if (!in_array($type, array('P', 'M'))) $type = 'P';
|
||||
|
||||
$oLayoutModel = &getModel('layout');
|
||||
|
||||
$pcLayoutCount = $oLayoutModel->getInstalledLayoutCount('P');
|
||||
$mobileLayoutCount = $oLayoutModel->getInstalledLayoutCount('M');
|
||||
Context::set('pcLayoutCount', $pcLayoutCount);
|
||||
Context::set('mobileLayoutCount', $mobileLayoutCount);
|
||||
|
||||
$columnList = array('layout_srl', 'layout', 'module_srl', 'title', 'regdate');
|
||||
$_layout_list = $oLayoutModel->getLayoutInstanceList(0, $type, null, $columnList);
|
||||
|
||||
$layout_list = array();
|
||||
foreach($_layout_list as $item)
|
||||
}
|
||||
|
||||
if($type == 'P')
|
||||
{
|
||||
// get Theme layout
|
||||
$oAdminModel = &getAdminModel('admin');
|
||||
$themeList = $oAdminModel->getThemeList();
|
||||
$themeLayoutList = array();
|
||||
foreach($themeList as $themeInfo)
|
||||
{
|
||||
if(!$layout_list[$item->layout])
|
||||
if(strpos($themeInfo->layout_info->name, '.') === false) continue;
|
||||
$themeLayoutList[] = $oLayoutModel->getLayoutInfo($themeInfo->layout_info->name, null, 'P');
|
||||
}
|
||||
$layout_list = array_merge($layout_list, $themeLayoutList);
|
||||
$layout_list[] = $oLayoutModel->getLayoutInfo('faceoff', null, 'P');
|
||||
}
|
||||
|
||||
$pcLayoutCount = $oLayoutModel->getInstalledLayoutCount('P');
|
||||
$mobileLayoutCount = $oLayoutModel->getInstalledLayoutCount('M');
|
||||
Context::set('pcLayoutCount', $pcLayoutCount);
|
||||
Context::set('mobileLayoutCount', $mobileLayoutCount);
|
||||
$this->setTemplateFile('installed_layout_list');
|
||||
|
||||
$security = new Security($layout_list);
|
||||
$layout_list = $security->encodeHTML('..', '..author..');
|
||||
|
||||
//Security
|
||||
$security = new Security();
|
||||
$security->encodeHTML('layout_list..layout','layout_list..title');
|
||||
|
||||
foreach($layout_list as $no => $layout_info)
|
||||
{
|
||||
$layout_list[$no]->description = nl2br(trim($layout_info->description));
|
||||
}
|
||||
Context::set('layout_list', $layout_list);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display list of pc layout all instance
|
||||
* @return void|Object (void : success, Object : fail)
|
||||
*/
|
||||
function dispLayoutAdminAllInstanceList()
|
||||
{
|
||||
$type = Context::get('type');
|
||||
|
||||
if(!in_array($type, array('P', 'M'))) $type = 'P';
|
||||
|
||||
$oLayoutModel = &getModel('layout');
|
||||
|
||||
$pcLayoutCount = $oLayoutModel->getInstalledLayoutCount('P');
|
||||
$mobileLayoutCount = $oLayoutModel->getInstalledLayoutCount('M');
|
||||
Context::set('pcLayoutCount', $pcLayoutCount);
|
||||
Context::set('mobileLayoutCount', $mobileLayoutCount);
|
||||
|
||||
$columnList = array('layout_srl', 'layout', 'module_srl', 'title', 'regdate');
|
||||
$_layout_list = $oLayoutModel->getLayoutInstanceList(0, $type, null, $columnList);
|
||||
|
||||
$layout_list = array();
|
||||
foreach($_layout_list as $item)
|
||||
{
|
||||
if(!$layout_list[$item->layout])
|
||||
{
|
||||
$layout_list[$item->layout] = array();
|
||||
$layout_info = $oLayoutModel->getLayoutInfo($item->layout, null, $type);
|
||||
if ($layout_info)
|
||||
{
|
||||
$layout_list[$item->layout] = array();
|
||||
$layout_info = $oLayoutModel->getLayoutInfo($item->layout, null, $type);
|
||||
if ($layout_info)
|
||||
{
|
||||
$layout_list[$item->layout]['title'] = $layout_info->title;
|
||||
}
|
||||
$layout_list[$item->layout]['title'] = $layout_info->title;
|
||||
}
|
||||
|
||||
$layout_list[$item->layout][] = $item;
|
||||
}
|
||||
|
||||
usort($layout_list, array($this, 'sortLayoutInstance'));
|
||||
|
||||
Context::set('layout_list', $layout_list);
|
||||
|
||||
$this->setTemplateFile('layout_all_instance_list');
|
||||
|
||||
$security = new Security();
|
||||
$security->encodeHTML('layout_list..');
|
||||
$layout_list[$item->layout][] = $item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort layout instance by layout name, instance name
|
||||
*/
|
||||
function sortLayoutInstance($a, $b)
|
||||
usort($layout_list, array($this, 'sortLayoutInstance'));
|
||||
|
||||
Context::set('layout_list', $layout_list);
|
||||
|
||||
$this->setTemplateFile('layout_all_instance_list');
|
||||
|
||||
$security = new Security();
|
||||
$security->encodeHTML('layout_list..');
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort layout instance by layout name, instance name
|
||||
*/
|
||||
function sortLayoutInstance($a, $b)
|
||||
{
|
||||
$aTitle = strtolower($a['title']);
|
||||
$bTitle = strtolower($b['title']);
|
||||
|
||||
if($aTitle == $bTitle)
|
||||
{
|
||||
$aTitle = strtolower($a['title']);
|
||||
$bTitle = strtolower($b['title']);
|
||||
|
||||
if($aTitle == $bTitle)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ($aTitle < $bTitle) ? -1 : 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display list of pc layout instance
|
||||
* @return void|Object (void : success, Object : fail)
|
||||
*/
|
||||
function dispLayoutAdminInstanceList()
|
||||
return ($aTitle < $bTitle) ? -1 : 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display list of pc layout instance
|
||||
* @return void|Object (void : success, Object : fail)
|
||||
*/
|
||||
function dispLayoutAdminInstanceList()
|
||||
{
|
||||
$type = Context::get('type');
|
||||
$layout = Context::get('layout');
|
||||
|
||||
if(!in_array($type, array('P', 'M'))) $type = 'P';
|
||||
if(!$layout) return $this->stop('msg_invalid_request');
|
||||
|
||||
$oLayoutModel = &getModel('layout');
|
||||
$layout_info = $oLayoutModel->getLayoutInfo($layout, null, $type);
|
||||
if(!$layout_info) return $this->stop('msg_invalid_request');
|
||||
|
||||
Context::set('layout_info', $layout_info);
|
||||
|
||||
$columnList = array('layout_srl', 'layout', 'module_srl', 'title', 'regdate');
|
||||
$layout_list = $oLayoutModel->getLayoutInstanceList(0, $type, $layout, $columnList);
|
||||
Context::set('layout_list', $layout_list);
|
||||
|
||||
$this->setTemplateFile('layout_instance_list');
|
||||
|
||||
$security = new Security();
|
||||
$security->encodeHTML('layout_list..');
|
||||
}
|
||||
|
||||
/**
|
||||
* Layout setting page
|
||||
* Once select a layout with empty value in the DB, then adjust values
|
||||
* @return void|Object (void : success, Object : fail)
|
||||
*/
|
||||
function dispLayoutAdminInsert()
|
||||
{
|
||||
$oModel = &getModel('layout');
|
||||
$type = Context::get('type');
|
||||
if(!in_array($type, array('P', 'M'))) $type = 'P';
|
||||
|
||||
//Security
|
||||
$security = new Security();
|
||||
$security->encodeHTML('layout_list..layout','layout_list..title');
|
||||
|
||||
// Get layout info
|
||||
$layout = Context::get('layout');
|
||||
if($layout == 'faceoff') return $this->stop('not supported');
|
||||
|
||||
$layout_info = $oModel->getLayoutInfo($layout, null, $type);
|
||||
if(!$layout_info) return $this->stop('msg_invalid_request');
|
||||
|
||||
// get Menu list
|
||||
$oMenuAdminModel = &getAdminModel('menu');
|
||||
$menu_list = $oMenuAdminModel->getMenus();
|
||||
Context::set('menu_list', $menu_list);
|
||||
|
||||
$security = new Security();
|
||||
$security->encodeHTML('menu_list..');
|
||||
|
||||
$security = new Security($layout_info);
|
||||
$layout_info = $security->encodeHTML('.', 'author..', 'extra_var..', 'extra_var....');
|
||||
|
||||
$layout_info->description = nl2br(trim($layout_info->description));
|
||||
if(!is_object($layout_info->extra_var)) $layout_info->extra_var = new StdClass();
|
||||
foreach($layout_info->extra_var as $var_name => $val)
|
||||
{
|
||||
$type = Context::get('type');
|
||||
$layout = Context::get('layout');
|
||||
|
||||
if (!in_array($type, array('P', 'M'))) $type = 'P';
|
||||
if (!$layout) return $this->stop('msg_invalid_request');
|
||||
|
||||
$oLayoutModel = &getModel('layout');
|
||||
$layout_info = $oLayoutModel->getLayoutInfo($layout, null, $type);
|
||||
if (!$layout_info) return $this->stop('msg_invalid_request');
|
||||
|
||||
Context::set('layout_info', $layout_info);
|
||||
|
||||
$columnList = array('layout_srl', 'layout', 'module_srl', 'title', 'regdate');
|
||||
$layout_list = $oLayoutModel->getLayoutInstanceList(0, $type, $layout, $columnList);
|
||||
Context::set('layout_list', $layout_list);
|
||||
|
||||
$this->setTemplateFile('layout_instance_list');
|
||||
|
||||
$security = new Security();
|
||||
$security->encodeHTML('layout_list..');
|
||||
if(isset($layout_info->{$var_name}->description))
|
||||
$layout_info->{$var_name}->description = nl2br(trim($val->description));
|
||||
}
|
||||
Context::set('selected_layout', $layout_info);
|
||||
|
||||
/**
|
||||
* Layout setting page
|
||||
* Once select a layout with empty value in the DB, then adjust values
|
||||
* @return void|Object (void : success, Object : fail)
|
||||
**/
|
||||
function dispLayoutAdminInsert() {
|
||||
$oModel = &getModel('layout');
|
||||
$type = Context::get('type');
|
||||
if (!in_array($type, array('P', 'M'))) $type = 'P';
|
||||
|
||||
//Security
|
||||
$security = new Security();
|
||||
$security->encodeHTML('layout_list..layout','layout_list..title');
|
||||
$this->setTemplateFile('layout_modify');
|
||||
}
|
||||
|
||||
// Get layout info
|
||||
$layout = Context::get('layout');
|
||||
if ($layout == 'faceoff') return $this->stop('not supported');
|
||||
/**
|
||||
* Insert Layout details
|
||||
* @return void
|
||||
*/
|
||||
function dispLayoutAdminModify()
|
||||
{
|
||||
$oLayoutAdminModel = &getAdminModel('layout');
|
||||
$oLayoutAdminModel->setLayoutAdminSetInfoView();
|
||||
|
||||
$layout_info = $oModel->getLayoutInfo($layout, null, $type);
|
||||
if (!$layout_info) return $this->stop('msg_invalid_request');
|
||||
Context::set('is_sitemap', '0');
|
||||
$script = '<script src="./modules/layout/tpl/js/layout_modify.js"></script>';
|
||||
$oTemplate = &TemplateHandler::getInstance();
|
||||
$content = $oTemplate->compile($this->module_path.'tpl/', 'layout_info_view');
|
||||
|
||||
// get Menu list
|
||||
$oMenuAdminModel = &getAdminModel('menu');
|
||||
$menu_list = $oMenuAdminModel->getMenus();
|
||||
Context::set('menu_list', $menu_list);
|
||||
Context::set('content', $content);
|
||||
|
||||
$security = new Security();
|
||||
$security->encodeHTML('menu_list..');
|
||||
$this->setTemplateFile('layout_modify');
|
||||
}
|
||||
|
||||
$security = new Security($layout_info);
|
||||
$layout_info = $security->encodeHTML('.', 'author..', 'extra_var..', 'extra_var....');
|
||||
/**
|
||||
* Edit layout codes
|
||||
* @return void
|
||||
*/
|
||||
function dispLayoutAdminEdit()
|
||||
{
|
||||
// Set the layout with its information
|
||||
$layout_srl = Context::get('layout_srl');
|
||||
// Get layout information
|
||||
$oLayoutModel = &getModel('layout');
|
||||
$layout_info = $oLayoutModel->getLayout($layout_srl);
|
||||
// Error appears if there is no layout information is registered
|
||||
if(!$layout_info) return $this->dispLayoutAdminInstalledList();
|
||||
|
||||
$layout_info->description = nl2br(trim($layout_info->description));
|
||||
if (!is_object($layout_info->extra_var)) $layout_info->extra_var = new StdClass();
|
||||
foreach($layout_info->extra_var as $var_name => $val)
|
||||
// Get Layout Code
|
||||
$oLayoutModel = &getModel('layout');
|
||||
$layout_file = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl);
|
||||
if(!file_exists($layout_file))
|
||||
{
|
||||
// If faceoff
|
||||
if($oLayoutModel->useDefaultLayout($layout_info->layout_srl))
|
||||
{
|
||||
if (isset($layout_info->{$var_name}->description))
|
||||
$layout_info->{$var_name}->description = nl2br(trim($val->description));
|
||||
$layout_file = $oLayoutModel->getDefaultLayoutHtml($layout_info->layout);
|
||||
}
|
||||
else
|
||||
{
|
||||
$layout_file = sprintf('%s%s', $layout_info->path, 'layout.html');
|
||||
}
|
||||
Context::set('selected_layout', $layout_info);
|
||||
|
||||
$this->setTemplateFile('layout_modify');
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert Layout details
|
||||
* @return void
|
||||
**/
|
||||
function dispLayoutAdminModify() {
|
||||
$oLayoutAdminModel = &getAdminModel('layout');
|
||||
$oLayoutAdminModel->setLayoutAdminSetInfoView();
|
||||
$layout_css_file = $oLayoutModel->getUserLayoutCss($layout_info->layout_srl);
|
||||
if(file_exists($layout_css_file))
|
||||
{
|
||||
$layout_code_css = FileHandler::readFile($layout_css_file);
|
||||
Context::set('layout_code_css', $layout_code_css);
|
||||
}
|
||||
|
||||
Context::set('is_sitemap', '0');
|
||||
$script = '<script src="./modules/layout/tpl/js/layout_modify.js"></script>';
|
||||
$oTemplate = &TemplateHandler::getInstance();
|
||||
$content = $oTemplate->compile($this->module_path.'tpl/', 'layout_info_view');
|
||||
$layout_code = FileHandler::readFile($layout_file);
|
||||
Context::set('layout_code', $layout_code);
|
||||
|
||||
Context::set('content', $content);
|
||||
// set User Images
|
||||
$layout_image_list = $oLayoutModel->getUserLayoutImageList($layout_info->layout_srl);
|
||||
Context::set('layout_image_list', $layout_image_list);
|
||||
|
||||
$this->setTemplateFile('layout_modify');
|
||||
}
|
||||
$layout_image_path = $oLayoutModel->getUserLayoutImagePath($layout_info->layout_srl);
|
||||
Context::set('layout_image_path', $layout_image_path);
|
||||
// Set widget list
|
||||
$oWidgetModel = &getModel('widget');
|
||||
$widget_list = $oWidgetModel->getDownloadedWidgetList();
|
||||
Context::set('widget_list', $widget_list);
|
||||
|
||||
/**
|
||||
* Edit layout codes
|
||||
* @return void
|
||||
**/
|
||||
function dispLayoutAdminEdit() {
|
||||
// Set the layout with its information
|
||||
$layout_srl = Context::get('layout_srl');
|
||||
// Get layout information
|
||||
$oLayoutModel = &getModel('layout');
|
||||
$layout_info = $oLayoutModel->getLayout($layout_srl);
|
||||
// Error appears if there is no layout information is registered
|
||||
if(!$layout_info) return $this->dispLayoutAdminInstalledList();
|
||||
$this->setTemplateFile('layout_edit');
|
||||
|
||||
// Get Layout Code
|
||||
$oLayoutModel = &getModel('layout');
|
||||
$layout_file = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl);
|
||||
if(!file_exists($layout_file)){
|
||||
// If faceoff
|
||||
if($oLayoutModel->useDefaultLayout($layout_info->layout_srl)){
|
||||
$layout_file = $oLayoutModel->getDefaultLayoutHtml($layout_info->layout);
|
||||
}else{
|
||||
$layout_file = sprintf('%s%s', $layout_info->path, 'layout.html');
|
||||
}
|
||||
}
|
||||
$security = new Security($layout_info);
|
||||
$layout_info = $security->encodeHTML('.', '.author..');
|
||||
Context::set('selected_layout', $layout_info);
|
||||
|
||||
$layout_css_file = $oLayoutModel->getUserLayoutCss($layout_info->layout_srl);
|
||||
if(file_exists($layout_css_file)){
|
||||
$layout_code_css = FileHandler::readFile($layout_css_file);
|
||||
Context::set('layout_code_css', $layout_code_css);
|
||||
}
|
||||
//Security
|
||||
$security = new Security();
|
||||
$security->encodeHTML('layout_list..');
|
||||
$security->encodeHTML('layout_list..author..');
|
||||
|
||||
$layout_code = FileHandler::readFile($layout_file);
|
||||
Context::set('layout_code', $layout_code);
|
||||
$security = new Security();
|
||||
$security->encodeHTML('layout_code_css', 'layout_code', 'widget_list..title');
|
||||
}
|
||||
|
||||
// set User Images
|
||||
$layout_image_list = $oLayoutModel->getUserLayoutImageList($layout_info->layout_srl);
|
||||
Context::set('layout_image_list', $layout_image_list);
|
||||
/**
|
||||
* Preview a layout
|
||||
* @return void|Object (void : success, Object : fail)
|
||||
*/
|
||||
function dispLayoutAdminPreview()
|
||||
{
|
||||
$layout_srl = Context::get('layout_srl');
|
||||
$code = Context::get('code');
|
||||
$code_css = Context::get('code_css');
|
||||
if(!$layout_srl || !$code) return new Object(-1, 'msg_invalid_request');
|
||||
// Get the layout information
|
||||
$oLayoutModel = &getModel('layout');
|
||||
$layout_info = $oLayoutModel->getLayout($layout_srl);
|
||||
if(!$layout_info) return new Object(-1, 'msg_invalid_request');
|
||||
// Separately handle the layout if its type is faceoff
|
||||
if($layout_info && $layout_info->type == 'faceoff') $oLayoutModel->doActivateFaceOff($layout_info);
|
||||
// Apply CSS directly
|
||||
Context::addHtmlHeader("<style type=\"text/css\" charset=\"UTF-8\">".$code_css."</style>");
|
||||
// Set names and values of extra_vars to $layout_info
|
||||
if($layout_info->extra_var_count)
|
||||
{
|
||||
foreach($layout_info->extra_var as $var_id => $val)
|
||||
{
|
||||
$layout_info->{$var_id} = $val->value;
|
||||
}
|
||||
}
|
||||
// menu in layout information becomes an argument for Context:: set
|
||||
if($layout_info->menu_count)
|
||||
{
|
||||
foreach($layout_info->menu as $menu_id => $menu)
|
||||
{
|
||||
if(file_exists($menu->php_file)) @include($menu->php_file);
|
||||
Context::set($menu_id, $menu);
|
||||
}
|
||||
}
|
||||
|
||||
$layout_image_path = $oLayoutModel->getUserLayoutImagePath($layout_info->layout_srl);
|
||||
Context::set('layout_image_path', $layout_image_path);
|
||||
// Set widget list
|
||||
$oWidgetModel = &getModel('widget');
|
||||
$widget_list = $oWidgetModel->getDownloadedWidgetList();
|
||||
Context::set('widget_list', $widget_list);
|
||||
Context::set('layout_info', $layout_info);
|
||||
Context::set('content', Context::getLang('layout_preview_content'));
|
||||
// Temporary save the codes
|
||||
$edited_layout_file = sprintf('./files/cache/layout/tmp.tpl');
|
||||
FileHandler::writeFile($edited_layout_file, $code);
|
||||
|
||||
$this->setTemplateFile('layout_edit');
|
||||
// Compile
|
||||
$oTemplate = &TemplateHandler::getInstance();
|
||||
|
||||
$security = new Security($layout_info);
|
||||
$layout_info = $security->encodeHTML('.', '.author..');
|
||||
Context::set('selected_layout', $layout_info);
|
||||
|
||||
//Security
|
||||
$security = new Security();
|
||||
$security->encodeHTML('layout_list..');
|
||||
$security->encodeHTML('layout_list..author..');
|
||||
|
||||
$security = new Security();
|
||||
$security->encodeHTML('layout_code_css', 'layout_code', 'widget_list..title');
|
||||
}
|
||||
$layout_path = $layout_info->path;
|
||||
$layout_file = 'layout';
|
||||
|
||||
/**
|
||||
* Preview a layout
|
||||
* @return void|Object (void : success, Object : fail)
|
||||
**/
|
||||
function dispLayoutAdminPreview() {
|
||||
$layout_srl = Context::get('layout_srl');
|
||||
$code = Context::get('code');
|
||||
$code_css = Context::get('code_css');
|
||||
if(!$layout_srl || !$code) return new Object(-1, 'msg_invalid_request');
|
||||
// Get the layout information
|
||||
$oLayoutModel = &getModel('layout');
|
||||
$layout_info = $oLayoutModel->getLayout($layout_srl);
|
||||
if(!$layout_info) return new Object(-1, 'msg_invalid_request');
|
||||
// Separately handle the layout if its type is faceoff
|
||||
if($layout_info && $layout_info->type == 'faceoff') $oLayoutModel->doActivateFaceOff($layout_info);
|
||||
// Apply CSS directly
|
||||
Context::addHtmlHeader("<style type=\"text/css\" charset=\"UTF-8\">".$code_css."</style>");
|
||||
// Set names and values of extra_vars to $layout_info
|
||||
if($layout_info->extra_var_count) {
|
||||
foreach($layout_info->extra_var as $var_id => $val) {
|
||||
$layout_info->{$var_id} = $val->value;
|
||||
}
|
||||
}
|
||||
// menu in layout information becomes an argument for Context:: set
|
||||
if($layout_info->menu_count) {
|
||||
foreach($layout_info->menu as $menu_id => $menu) {
|
||||
if(file_exists($menu->php_file)) @include($menu->php_file);
|
||||
Context::set($menu_id, $menu);
|
||||
}
|
||||
}
|
||||
$layout_tpl = $oTemplate->compile($layout_path, $layout_file, $edited_layout_file);
|
||||
Context::set('layout','none');
|
||||
// Convert widgets and others
|
||||
$oContext = &Context::getInstance();
|
||||
Context::set('layout_tpl', $layout_tpl);
|
||||
// Delete Temporary Files
|
||||
FileHandler::removeFile($edited_layout_file);
|
||||
$this->setTemplateFile('layout_preview');
|
||||
|
||||
Context::set('layout_info', $layout_info);
|
||||
Context::set('content', Context::getLang('layout_preview_content'));
|
||||
// Temporary save the codes
|
||||
$edited_layout_file = sprintf('./files/cache/layout/tmp.tpl');
|
||||
FileHandler::writeFile($edited_layout_file, $code);
|
||||
}
|
||||
|
||||
// Compile
|
||||
$oTemplate = &TemplateHandler::getInstance();
|
||||
/**
|
||||
* Modify admin layout of faceoff
|
||||
* @deprecated
|
||||
* @return void
|
||||
*/
|
||||
function dispLayoutAdminLayoutModify()
|
||||
{
|
||||
// Get layout_srl
|
||||
$current_module_info = Context::get('current_module_info');
|
||||
$layout_srl = $current_module_info->layout_srl;
|
||||
// Remove the remaining tmp files because of temporarily saving
|
||||
// This part needs to be modified
|
||||
$delete_tmp = Context::get('delete_tmp');
|
||||
if($delete_tmp =='Y')
|
||||
{
|
||||
$oLayoutAdminController = &getAdminController('layout');
|
||||
$oLayoutAdminController->deleteUserLayoutTempFile($layout_srl);
|
||||
}
|
||||
|
||||
$layout_path = $layout_info->path;
|
||||
$layout_file = 'layout';
|
||||
$oLayoutModel = &getModel('layout');
|
||||
// layout file is used as a temp.
|
||||
$oLayoutModel->setUseUserLayoutTemp();
|
||||
// Apply CSS in inline style
|
||||
$faceoffcss = $oLayoutModel->_getUserLayoutFaceOffCss($current_module_info->layout_srl);
|
||||
|
||||
$layout_tpl = $oTemplate->compile($layout_path, $layout_file, $edited_layout_file);
|
||||
Context::set('layout','none');
|
||||
// Convert widgets and others
|
||||
$oContext = &Context::getInstance();
|
||||
Context::set('layout_tpl', $layout_tpl);
|
||||
// Delete Temporary Files
|
||||
FileHandler::removeFile($edited_layout_file);
|
||||
$this->setTemplateFile('layout_preview');
|
||||
$css = FileHandler::readFile($faceoffcss);
|
||||
$match = null;
|
||||
preg_match_all('/([^\{]+)\{([^\}]*)\}/is',$css,$match);
|
||||
for($i=0,$c=count($match[1]);$i<$c;$i++)
|
||||
{
|
||||
$name = trim($match[1][$i]);
|
||||
$css = trim($match[2][$i]);
|
||||
if(!$css) continue;
|
||||
$css = str_replace('./images/',Context::getRequestUri().$oLayoutModel->getUserLayoutImagePath($layout_srl),$css);
|
||||
$style[] .= sprintf('"%s":"%s"',$name,$css);
|
||||
}
|
||||
|
||||
}
|
||||
if(count($style))
|
||||
{
|
||||
$script = '<script type="text/javascript"> var faceOffStyle = {'.implode(',',$style).'}; </script>';
|
||||
Context::addHtmlHeader($script);
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify admin layout of faceoff
|
||||
* @deprecated
|
||||
* @return void
|
||||
**/
|
||||
function dispLayoutAdminLayoutModify(){
|
||||
// Get layout_srl
|
||||
$current_module_info = Context::get('current_module_info');
|
||||
$layout_srl = $current_module_info->layout_srl;
|
||||
// Remove the remaining tmp files because of temporarily saving
|
||||
// This part needs to be modified
|
||||
$delete_tmp = Context::get('delete_tmp');
|
||||
if($delete_tmp =='Y'){
|
||||
$oLayoutAdminController = &getAdminController('layout');
|
||||
$oLayoutAdminController->deleteUserLayoutTempFile($layout_srl);
|
||||
}
|
||||
$oTemplate = &TemplateHandler::getInstance();
|
||||
Context::set('content', $oTemplate->compile($this->module_path.'tpl','about_faceoff'));
|
||||
// Change widget codes in Javascript mode
|
||||
$oWidgetController = &getController('widget');
|
||||
$oWidgetController->setWidgetCodeInJavascriptMode();
|
||||
// Set a template file
|
||||
$this->setTemplateFile('faceoff_layout_edit');
|
||||
}
|
||||
|
||||
$oLayoutModel = &getModel('layout');
|
||||
// layout file is used as a temp.
|
||||
$oLayoutModel->setUseUserLayoutTemp();
|
||||
// Apply CSS in inline style
|
||||
$faceoffcss = $oLayoutModel->_getUserLayoutFaceOffCss($current_module_info->layout_srl);
|
||||
/**
|
||||
* Copy layout instance
|
||||
* @return void
|
||||
*/
|
||||
function dispLayoutAdminCopyLayout()
|
||||
{
|
||||
$layoutSrl = Context::get('layout_srl');
|
||||
|
||||
$css = FileHandler::readFile($faceoffcss);
|
||||
$match = null;
|
||||
preg_match_all('/([^\{]+)\{([^\}]*)\}/is',$css,$match);
|
||||
for($i=0,$c=count($match[1]);$i<$c;$i++) {
|
||||
$name = trim($match[1][$i]);
|
||||
$css = trim($match[2][$i]);
|
||||
if(!$css) continue;
|
||||
$css = str_replace('./images/',Context::getRequestUri().$oLayoutModel->getUserLayoutImagePath($layout_srl),$css);
|
||||
$style[] .= sprintf('"%s":"%s"',$name,$css);
|
||||
}
|
||||
$oLayoutModel = &getModel('layout');
|
||||
$layout = $oLayoutModel->getLayout($layoutSrl);
|
||||
|
||||
if(count($style)) {
|
||||
$script = '<script type="text/javascript"> var faceOffStyle = {'.implode(',',$style).'}; </script>';
|
||||
Context::addHtmlHeader($script);
|
||||
}
|
||||
|
||||
$oTemplate = &TemplateHandler::getInstance();
|
||||
Context::set('content', $oTemplate->compile($this->module_path.'tpl','about_faceoff'));
|
||||
// Change widget codes in Javascript mode
|
||||
$oWidgetController = &getController('widget');
|
||||
$oWidgetController->setWidgetCodeInJavascriptMode();
|
||||
// Set a template file
|
||||
$this->setTemplateFile('faceoff_layout_edit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy layout instance
|
||||
* @return void
|
||||
*/
|
||||
function dispLayoutAdminCopyLayout(){
|
||||
$layoutSrl = Context::get('layout_srl');
|
||||
|
||||
$oLayoutModel = &getModel('layout');
|
||||
$layout = $oLayoutModel->getLayout($layoutSrl);
|
||||
|
||||
Context::set('layout', $layout);
|
||||
$this->setTemplateFile('copy_layout');
|
||||
}
|
||||
}
|
||||
?>
|
||||
Context::set('layout', $layout);
|
||||
$this->setTemplateFile('copy_layout');
|
||||
}
|
||||
}
|
||||
/* End of file layout.admin.view.php */
|
||||
/* Location: ./modules/layout/layout.admin.view.php */
|
||||
|
|
|
|||
|
|
@ -1,113 +1,121 @@
|
|||
<?php
|
||||
/**
|
||||
* @class layout
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* high class of the layout module
|
||||
**/
|
||||
/**
|
||||
* @class layout
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* high class of the layout module
|
||||
*/
|
||||
class layout extends ModuleObject
|
||||
{
|
||||
/**
|
||||
* Implement if additional tasks are necessary when installing
|
||||
* @return Object
|
||||
*/
|
||||
function moduleInstall()
|
||||
{
|
||||
// Create a directory to be used in the layout
|
||||
FileHandler::makeDir('./files/cache/layout');
|
||||
|
||||
class layout extends ModuleObject {
|
||||
return new Object();
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement if additional tasks are necessary when installing
|
||||
* @return Object
|
||||
**/
|
||||
function moduleInstall() {
|
||||
// Create a directory to be used in the layout
|
||||
FileHandler::makeDir('./files/cache/layout');
|
||||
/**
|
||||
* a method to check if successfully installed
|
||||
* @return boolean
|
||||
*/
|
||||
function checkUpdate()
|
||||
{
|
||||
$oDB = &DB::getInstance();
|
||||
// 2009. 02. 11 Add site_srl to layout table
|
||||
if(!$oDB->isColumnExists('layouts', 'site_srl')) return true;
|
||||
// 2009. 02. 26 Move the previous layout for faceoff
|
||||
$files = FileHandler::readDir('./files/cache/layout');
|
||||
for($i=0,$c=count($files);$i<$c;$i++)
|
||||
{
|
||||
$filename = $files[$i];
|
||||
if(preg_match('/([0-9]+)\.html/i',$filename)) return true;
|
||||
}
|
||||
|
||||
return new Object();
|
||||
}
|
||||
if(!$oDB->isColumnExists('layouts', 'layout_type')) return true;
|
||||
|
||||
/**
|
||||
* a method to check if successfully installed
|
||||
* @return boolean
|
||||
**/
|
||||
function checkUpdate() {
|
||||
$oDB = &DB::getInstance();
|
||||
// 2009. 02. 11 Add site_srl to layout table
|
||||
if(!$oDB->isColumnExists('layouts', 'site_srl')) return true;
|
||||
// 2009. 02. 26 Move the previous layout for faceoff
|
||||
$files = FileHandler::readDir('./files/cache/layout');
|
||||
for($i=0,$c=count($files);$i<$c;$i++) {
|
||||
$filename = $files[$i];
|
||||
if(preg_match('/([0-9]+)\.html/i',$filename)) return true;
|
||||
}
|
||||
|
||||
if(!$oDB->isColumnExists('layouts', 'layout_type')) return true;
|
||||
|
||||
$args->layout = '.';
|
||||
$output = executeQueryArray('layout.getLayoutDotList', $args);
|
||||
if($output->data && count($output->data) > 0)
|
||||
$args->layout = '.';
|
||||
$output = executeQueryArray('layout.getLayoutDotList', $args);
|
||||
if($output->data && count($output->data) > 0)
|
||||
{
|
||||
foreach($output->data as $layout)
|
||||
{
|
||||
foreach($output->data as $layout)
|
||||
$layout_path = explode('.', $layout->layout);
|
||||
if(count($layout_path) != 2) continue;
|
||||
if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/layouts/%s', $layout_path[0], $layout_path[1]))) return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute update
|
||||
* @return Object
|
||||
*/
|
||||
function moduleUpdate()
|
||||
{
|
||||
$oDB = &DB::getInstance();
|
||||
// 2009. 02. 11 Add site_srl to menu table
|
||||
if(!$oDB->isColumnExists('layouts', 'site_srl'))
|
||||
{
|
||||
$oDB->addColumn('layouts','site_srl','number',11,0,true);
|
||||
}
|
||||
// 2009. 02. 26 Move the previous layout for faceoff
|
||||
$oLayoutModel = &getModel('layout');
|
||||
$files = FileHandler::readDir('./files/cache/layout');
|
||||
for($i=0,$c=count($files);$i<$c;$i++)
|
||||
{
|
||||
$filename = $files[$i];
|
||||
if(!preg_match('/([0-9]+)\.html/i',$filename,$match)) continue;
|
||||
$layout_srl = $match[1];
|
||||
if(!$layout_srl) continue;
|
||||
$path = $oLayoutModel->getUserLayoutPath($layout_srl);
|
||||
if(!is_dir($path)) FileHandler::makeDir($path);
|
||||
FileHandler::copyFile('./files/cache/layout/'.$filename, $path.'layout.html');
|
||||
@unlink('./files/cache/layout/'.$filename);
|
||||
}
|
||||
|
||||
if(!$oDB->isColumnExists('layouts', 'layout_type'))
|
||||
{
|
||||
$oDB->addColumn('layouts','layout_type','char',1,'P',true);
|
||||
}
|
||||
|
||||
$args->layout = '.';
|
||||
$output = executeQueryArray('layout.getLayoutDotList', $args);
|
||||
if($output->data && count($output->data) > 0)
|
||||
{
|
||||
foreach($output->data as $layout)
|
||||
{
|
||||
$layout_path = explode('.', $layout->layout);
|
||||
if(count($layout_path) != 2) continue;
|
||||
if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/layouts/%s', $layout_path[0], $layout_path[1])))
|
||||
{
|
||||
$layout_path = explode('.', $layout->layout);
|
||||
if(count($layout_path) != 2) continue;
|
||||
if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/layouts/%s', $layout_path[0], $layout_path[1]))) return true;
|
||||
$args->layout = implode('|@|', $layout_path);
|
||||
$args->layout_srl = $layout->layout_srl;
|
||||
$output = executeQuery('layout.updateLayout', $args);
|
||||
}
|
||||
}
|
||||
}
|
||||
return new Object(0, 'success_updated');
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute update
|
||||
* @return Object
|
||||
**/
|
||||
function moduleUpdate() {
|
||||
$oDB = &DB::getInstance();
|
||||
// 2009. 02. 11 Add site_srl to menu table
|
||||
if(!$oDB->isColumnExists('layouts', 'site_srl')) {
|
||||
$oDB->addColumn('layouts','site_srl','number',11,0,true);
|
||||
}
|
||||
// 2009. 02. 26 Move the previous layout for faceoff
|
||||
$oLayoutModel = &getModel('layout');
|
||||
$files = FileHandler::readDir('./files/cache/layout');
|
||||
for($i=0,$c=count($files);$i<$c;$i++) {
|
||||
$filename = $files[$i];
|
||||
if(!preg_match('/([0-9]+)\.html/i',$filename,$match)) continue;
|
||||
$layout_srl = $match[1];
|
||||
if(!$layout_srl) continue;
|
||||
$path = $oLayoutModel->getUserLayoutPath($layout_srl);
|
||||
if(!is_dir($path)) FileHandler::makeDir($path);
|
||||
FileHandler::copyFile('./files/cache/layout/'.$filename, $path.'layout.html');
|
||||
@unlink('./files/cache/layout/'.$filename);
|
||||
}
|
||||
|
||||
if(!$oDB->isColumnExists('layouts', 'layout_type')) {
|
||||
$oDB->addColumn('layouts','layout_type','char',1,'P',true);
|
||||
}
|
||||
|
||||
$args->layout = '.';
|
||||
$output = executeQueryArray('layout.getLayoutDotList', $args);
|
||||
if($output->data && count($output->data) > 0)
|
||||
{
|
||||
foreach($output->data as $layout)
|
||||
{
|
||||
$layout_path = explode('.', $layout->layout);
|
||||
if(count($layout_path) != 2) continue;
|
||||
if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/layouts/%s', $layout_path[0], $layout_path[1])))
|
||||
{
|
||||
$args->layout = implode('|@|', $layout_path);
|
||||
$args->layout_srl = $layout->layout_srl;
|
||||
$output = executeQuery('layout.updateLayout', $args);
|
||||
}
|
||||
}
|
||||
}
|
||||
return new Object(0, 'success_updated');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Re-generate the cache file
|
||||
* @return void
|
||||
**/
|
||||
function recompileCache() {
|
||||
$path = './files/cache/layout';
|
||||
if(!is_dir($path)) {
|
||||
FileHandler::makeDir($path);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
/**
|
||||
* Re-generate the cache file
|
||||
* @return void
|
||||
*/
|
||||
function recompileCache()
|
||||
{
|
||||
$path = './files/cache/layout';
|
||||
if(!is_dir($path))
|
||||
{
|
||||
FileHandler::makeDir($path);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* End of file layout.class.php */
|
||||
/* Location: ./modules/layout/layout.class.php */
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,265 +1,271 @@
|
|||
<?php
|
||||
/**
|
||||
* @class layoutView
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* admin view class of the layout module
|
||||
**/
|
||||
/**
|
||||
* @class layoutView
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* admin view class of the layout module
|
||||
*/
|
||||
class layoutView extends layout
|
||||
{
|
||||
/**
|
||||
* Initialization
|
||||
* @return void
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
}
|
||||
|
||||
class layoutView extends layout {
|
||||
/**
|
||||
* Pop-up layout details(conf/info.xml)
|
||||
* @return void
|
||||
*/
|
||||
function dispLayoutInfo()
|
||||
{
|
||||
// Get the layout information
|
||||
$oLayoutModel = &getModel('layout');
|
||||
$layout_info = $oLayoutModel->getLayoutInfo(Context::get('selected_layout'));
|
||||
if(!$layout_info) exit();
|
||||
Context::set('layout_info', $layout_info);
|
||||
// Set the layout to be pop-up
|
||||
$this->setLayoutFile('popup_layout');
|
||||
// Set a template file
|
||||
$this->setTemplateFile('layout_detail_info');
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialization
|
||||
* @return void
|
||||
**/
|
||||
function init() {
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* Pop-up layout details(conf/info.xml)
|
||||
* @return void
|
||||
**/
|
||||
function dispLayoutInfo() {
|
||||
// Get the layout information
|
||||
$oLayoutModel = &getModel('layout');
|
||||
$layout_info = $oLayoutModel->getLayoutInfo(Context::get('selected_layout'));
|
||||
if(!$layout_info) exit();
|
||||
Context::set('layout_info', $layout_info);
|
||||
// Set the layout to be pop-up
|
||||
$this->setLayoutFile('popup_layout');
|
||||
// Set a template file
|
||||
$this->setTemplateFile('layout_detail_info');
|
||||
}
|
||||
|
||||
/**
|
||||
* Preview a layout with module.
|
||||
*
|
||||
* @return Object
|
||||
**/
|
||||
public function dispLayoutPreviewWithModule()
|
||||
/**
|
||||
* Preview a layout with module.
|
||||
*
|
||||
* @return Object
|
||||
*/
|
||||
public function dispLayoutPreviewWithModule()
|
||||
{
|
||||
// admin check
|
||||
// this act is admin view but in normal view because do not load admin css/js files
|
||||
$logged_info = Context::get('logged_info');
|
||||
if($logged_info->is_admin != 'Y')
|
||||
{
|
||||
// admin check
|
||||
// this act is admin view but in normal view because do not load admin css/js files
|
||||
$logged_info = Context::get('logged_info');
|
||||
if($logged_info->is_admin != 'Y')
|
||||
return $this->stop('msg_invalid_request');
|
||||
}
|
||||
|
||||
$layoutSrl = Context::get('layout_srl');
|
||||
$layoutVars = Context::get('layout_vars');
|
||||
$layoutVars = json_decode($layoutVars);
|
||||
|
||||
$moduleSrl = Context::get('target_module_srl');
|
||||
$module = Context::get('module_name');
|
||||
$mid = Context::get('target_mid');
|
||||
$skin = Context::get('skin');
|
||||
$skinVars = Context::get('skin_vars');
|
||||
$skinVars = json_decode($skinVars);
|
||||
|
||||
$skinType = Context::get('skin_type');
|
||||
$type = ($skinType == 'M') ? 'mobile' : 'view';
|
||||
|
||||
if($module == 'ARTICLE')
|
||||
{
|
||||
$module = 'page';
|
||||
$page_type = 'ARTICLE';
|
||||
$document_srl = 0;
|
||||
}
|
||||
|
||||
if($module)
|
||||
{
|
||||
$oModuleModel = getModel('module');
|
||||
$xml_info = $oModuleModel->getModuleActionXml($module);
|
||||
//create content
|
||||
if(!$mid && !$moduleSrl)
|
||||
{
|
||||
return $this->stop('msg_invalid_request');
|
||||
}
|
||||
|
||||
$layoutSrl = Context::get('layout_srl');
|
||||
$layoutVars = Context::get('layout_vars');
|
||||
$layoutVars = json_decode($layoutVars);
|
||||
|
||||
$moduleSrl = Context::get('target_module_srl');
|
||||
$module = Context::get('module_name');
|
||||
$mid = Context::get('target_mid');
|
||||
$skin = Context::get('skin');
|
||||
$skinVars = Context::get('skin_vars');
|
||||
$skinVars = json_decode($skinVars);
|
||||
|
||||
$skinType = Context::get('skin_type');
|
||||
$type = ($skinType == 'M') ? 'mobile' : 'view';
|
||||
|
||||
if($module == 'ARTICLE')
|
||||
{
|
||||
$module = 'page';
|
||||
$page_type = 'ARTICLE';
|
||||
$document_srl = 0;
|
||||
}
|
||||
|
||||
if($module)
|
||||
{
|
||||
$oModuleModel = getModel('module');
|
||||
$xml_info = $oModuleModel->getModuleActionXml($module);
|
||||
//create content
|
||||
if(!$mid && !$moduleSrl)
|
||||
if($skin && !$module)
|
||||
{
|
||||
if($skin && !$module)
|
||||
{
|
||||
return $this->stop(-1, 'msg_invalid_request');
|
||||
}
|
||||
|
||||
$oModule = ModuleHandler::getModuleInstance($module, $type);
|
||||
$oModule->setAct($xml_info->default_index_act);
|
||||
$module_info->module = $module;
|
||||
$module_info->module_type = $type;
|
||||
$module_info->page_type = $page_type;
|
||||
$module_info->document_srl= $document_srl;
|
||||
$oModule->setModuleInfo($this->module_info, $xml_info);
|
||||
$oModule->proc();
|
||||
}
|
||||
else
|
||||
{
|
||||
$oModuleHandler = new ModuleHandler($module, '', $mid, '', $moduleSrl);
|
||||
$oModuleHandler->act = '';
|
||||
$oModuleHandler->init();
|
||||
$oModule = $oModuleHandler->procModule();
|
||||
return $this->stop(-1, 'msg_invalid_request');
|
||||
}
|
||||
|
||||
if($oModule->toBool())
|
||||
{
|
||||
if($skin)
|
||||
{
|
||||
$skinDir = ($skinType == 'M') ? 'm.skins' : 'skins';
|
||||
$template_path = sprintf("%s%s/%s/",$oModule->module_path, $skinDir, $skin);
|
||||
$oModule->setTemplatePath($template_path);
|
||||
$oModule = ModuleHandler::getModuleInstance($module, $type);
|
||||
$oModule->setAct($xml_info->default_index_act);
|
||||
$module_info->module = $module;
|
||||
$module_info->module_type = $type;
|
||||
$module_info->page_type = $page_type;
|
||||
$module_info->document_srl= $document_srl;
|
||||
$oModule->setModuleInfo($this->module_info, $xml_info);
|
||||
$oModule->proc();
|
||||
}
|
||||
else
|
||||
{
|
||||
$oModuleHandler = new ModuleHandler($module, '', $mid, '', $moduleSrl);
|
||||
$oModuleHandler->act = '';
|
||||
$oModuleHandler->init();
|
||||
$oModule = $oModuleHandler->procModule();
|
||||
}
|
||||
|
||||
if(is_array($skinVars))
|
||||
if($oModule->toBool())
|
||||
{
|
||||
if($skin)
|
||||
{
|
||||
$skinDir = ($skinType == 'M') ? 'm.skins' : 'skins';
|
||||
$template_path = sprintf("%s%s/%s/",$oModule->module_path, $skinDir, $skin);
|
||||
$oModule->setTemplatePath($template_path);
|
||||
|
||||
if(is_array($skinVars))
|
||||
{
|
||||
foreach($skinVars as $key => $val)
|
||||
{
|
||||
foreach($skinVars as $key => $val)
|
||||
{
|
||||
$oModule->module_info->{$key} = $val;
|
||||
}
|
||||
$oModule->module_info->{$key} = $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
require_once("./classes/display/HTMLDisplayHandler.php");
|
||||
$handler = new HTMLDisplayHandler();
|
||||
$output = $handler->toDoc($oModule);
|
||||
Context::set('content', $output);
|
||||
}
|
||||
else
|
||||
{
|
||||
Context::set('content', Context::getLang('not_support_layout_preview'));
|
||||
}
|
||||
require_once("./classes/display/HTMLDisplayHandler.php");
|
||||
$handler = new HTMLDisplayHandler();
|
||||
$output = $handler->toDoc($oModule);
|
||||
Context::set('content', $output);
|
||||
}
|
||||
else
|
||||
{
|
||||
Context::set('content', Context::getLang('layout_preview_content'));
|
||||
Context::set('content', Context::getLang('not_support_layout_preview'));
|
||||
}
|
||||
|
||||
if($layoutSrl)
|
||||
{
|
||||
if($layoutSrl == -1)
|
||||
{
|
||||
$site_srl = ($oModule) ? $oModule->module_info->site_srl : 0;
|
||||
$designInfoFile = sprintf(_XE_PATH_.'/files/site_design/design_%s.php', $site_srl);
|
||||
@include($designInfoFile);
|
||||
$layoutSrl = $designInfo->layout_srl;
|
||||
}
|
||||
|
||||
$oLayoutModel = getModel('layout');
|
||||
$layoutInfo = $oLayoutModel->getLayout($layoutSrl);
|
||||
|
||||
if(!$layoutInfo)
|
||||
{
|
||||
return new Object(-1, 'msg_invalid_request');
|
||||
}
|
||||
|
||||
// Set names and values of extra_vars to $layout_info
|
||||
if($layoutInfo->extra_var_count)
|
||||
{
|
||||
foreach($layoutInfo->extra_var as $var_id => $val)
|
||||
{
|
||||
$layoutInfo->{$var_id} = $val->value;
|
||||
}
|
||||
}
|
||||
|
||||
if($layoutVars)
|
||||
{
|
||||
foreach($layoutVars as $key => $val)
|
||||
{
|
||||
$layoutInfo->{$key} = $val;
|
||||
}
|
||||
}
|
||||
|
||||
// menu in layout information becomes an argument for Context:: set
|
||||
if($layoutInfo->menu_count)
|
||||
{
|
||||
foreach($layoutInfo->menu as $menu_id => $menu)
|
||||
{
|
||||
if(file_exists($menu->php_file)) @include($menu->php_file);
|
||||
Context::set($menu_id, $menu);
|
||||
}
|
||||
}
|
||||
|
||||
Context::set('layout_info', $layoutInfo);
|
||||
}
|
||||
|
||||
// Compile
|
||||
$oTemplate = &TemplateHandler::getInstance();
|
||||
Context::clearHtmlHeader();
|
||||
if($layoutSrl)
|
||||
{
|
||||
$layout_path = $layoutInfo->path;
|
||||
$layout_file = 'layout';
|
||||
$oModuleModel = getModel('module');
|
||||
$part_config= $oModuleModel->getModulePartConfig('layout',$layoutSrl);
|
||||
Context::addHtmlHeader($part_config->header_script);
|
||||
}
|
||||
else
|
||||
{
|
||||
$layout_path = './common/tpl';
|
||||
$layout_file = 'default_layout';
|
||||
}
|
||||
$layout_tpl = $oTemplate->compile($layout_path, $layout_file);
|
||||
Context::set('layout','none');
|
||||
|
||||
// Convert widgets and others
|
||||
$oContext = &Context::getInstance();
|
||||
Context::set('layout_tpl', $layout_tpl);
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('layout_preview');
|
||||
}
|
||||
/**
|
||||
* Preview a layout
|
||||
* @return void|Object (void : success, Object : fail)
|
||||
**/
|
||||
function dispLayoutPreview()
|
||||
else
|
||||
{
|
||||
// admin check
|
||||
// this act is admin view but in normal view because do not load admin css/js files
|
||||
$logged_info = Context::get('logged_info');
|
||||
if ($logged_info->is_admin != 'Y') return $this->stop('msg_invalid_request');
|
||||
Context::set('content', Context::getLang('layout_preview_content'));
|
||||
}
|
||||
|
||||
$layout_srl = Context::get('layout_srl');
|
||||
$code = Context::get('code');
|
||||
if($layoutSrl)
|
||||
{
|
||||
if($layoutSrl == -1)
|
||||
{
|
||||
$site_srl = ($oModule) ? $oModule->module_info->site_srl : 0;
|
||||
$designInfoFile = sprintf(_XE_PATH_.'/files/site_design/design_%s.php', $site_srl);
|
||||
@include($designInfoFile);
|
||||
$layoutSrl = $designInfo->layout_srl;
|
||||
}
|
||||
|
||||
$code_css = Context::get('code_css');
|
||||
if(!$layout_srl || !$code) return new Object(-1, 'msg_invalid_request');
|
||||
// Get the layout information
|
||||
$oLayoutModel = &getModel('layout');
|
||||
$layout_info = $oLayoutModel->getLayout($layout_srl);
|
||||
if(!$layout_info) return new Object(-1, 'msg_invalid_request');
|
||||
// Separately handle the layout if its type is faceoff
|
||||
if($layout_info && $layout_info->type == 'faceoff') $oLayoutModel->doActivateFaceOff($layout_info);
|
||||
// Apply CSS directly
|
||||
Context::addHtmlHeader("<style type=\"text/css\" charset=\"UTF-8\">".$code_css."</style>");
|
||||
// Set names and values of extra_vars to $layout_info
|
||||
if($layout_info->extra_var_count) {
|
||||
foreach($layout_info->extra_var as $var_id => $val) {
|
||||
$layout_info->{$var_id} = $val->value;
|
||||
}
|
||||
}
|
||||
// menu in layout information becomes an argument for Context:: set
|
||||
if($layout_info->menu_count) {
|
||||
foreach($layout_info->menu as $menu_id => $menu) {
|
||||
if(file_exists($menu->php_file)) @include($menu->php_file);
|
||||
Context::set($menu_id, $menu);
|
||||
}
|
||||
}
|
||||
$oLayoutModel = getModel('layout');
|
||||
$layoutInfo = $oLayoutModel->getLayout($layoutSrl);
|
||||
|
||||
Context::set('layout_info', $layout_info);
|
||||
Context::set('content', Context::getLang('layout_preview_content'));
|
||||
// Temporary save the codes
|
||||
$edited_layout_file = sprintf('./files/cache/layout/tmp.tpl');
|
||||
FileHandler::writeFile($edited_layout_file, $code);
|
||||
if(!$layoutInfo)
|
||||
{
|
||||
return new Object(-1, 'msg_invalid_request');
|
||||
}
|
||||
|
||||
// Compile
|
||||
$oTemplate = &TemplateHandler::getInstance();
|
||||
// Set names and values of extra_vars to $layout_info
|
||||
if($layoutInfo->extra_var_count)
|
||||
{
|
||||
foreach($layoutInfo->extra_var as $var_id => $val)
|
||||
{
|
||||
$layoutInfo->{$var_id} = $val->value;
|
||||
}
|
||||
}
|
||||
|
||||
$layout_path = $layout_info->path;
|
||||
$layout_file = 'layout';
|
||||
if($layoutVars)
|
||||
{
|
||||
foreach($layoutVars as $key => $val)
|
||||
{
|
||||
$layoutInfo->{$key} = $val;
|
||||
}
|
||||
}
|
||||
|
||||
$layout_tpl = $oTemplate->compile($layout_path, $layout_file, $edited_layout_file);
|
||||
Context::set('layout','none');
|
||||
// Convert widgets and others
|
||||
$oContext = &Context::getInstance();
|
||||
Context::set('layout_tpl', $layout_tpl);
|
||||
// Delete Temporary Files
|
||||
FileHandler::removeFile($edited_layout_file);
|
||||
$this->setTemplateFile('layout_preview');
|
||||
}
|
||||
// menu in layout information becomes an argument for Context:: set
|
||||
if($layoutInfo->menu_count)
|
||||
{
|
||||
foreach($layoutInfo->menu as $menu_id => $menu)
|
||||
{
|
||||
if(file_exists($menu->php_file)) @include($menu->php_file);
|
||||
Context::set($menu_id, $menu);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
Context::set('layout_info', $layoutInfo);
|
||||
}
|
||||
|
||||
// Compile
|
||||
$oTemplate = &TemplateHandler::getInstance();
|
||||
Context::clearHtmlHeader();
|
||||
if($layoutSrl)
|
||||
{
|
||||
$layout_path = $layoutInfo->path;
|
||||
$layout_file = 'layout';
|
||||
$oModuleModel = getModel('module');
|
||||
$part_config= $oModuleModel->getModulePartConfig('layout',$layoutSrl);
|
||||
Context::addHtmlHeader($part_config->header_script);
|
||||
}
|
||||
else
|
||||
{
|
||||
$layout_path = './common/tpl';
|
||||
$layout_file = 'default_layout';
|
||||
}
|
||||
$layout_tpl = $oTemplate->compile($layout_path, $layout_file);
|
||||
Context::set('layout','none');
|
||||
|
||||
// Convert widgets and others
|
||||
$oContext = &Context::getInstance();
|
||||
Context::set('layout_tpl', $layout_tpl);
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('layout_preview');
|
||||
}
|
||||
/**
|
||||
* Preview a layout
|
||||
* @return void|Object (void : success, Object : fail)
|
||||
*/
|
||||
function dispLayoutPreview()
|
||||
{
|
||||
// admin check
|
||||
// this act is admin view but in normal view because do not load admin css/js files
|
||||
$logged_info = Context::get('logged_info');
|
||||
if($logged_info->is_admin != 'Y') return $this->stop('msg_invalid_request');
|
||||
|
||||
$layout_srl = Context::get('layout_srl');
|
||||
$code = Context::get('code');
|
||||
|
||||
$code_css = Context::get('code_css');
|
||||
if(!$layout_srl || !$code) return new Object(-1, 'msg_invalid_request');
|
||||
// Get the layout information
|
||||
$oLayoutModel = &getModel('layout');
|
||||
$layout_info = $oLayoutModel->getLayout($layout_srl);
|
||||
if(!$layout_info) return new Object(-1, 'msg_invalid_request');
|
||||
// Separately handle the layout if its type is faceoff
|
||||
if($layout_info && $layout_info->type == 'faceoff') $oLayoutModel->doActivateFaceOff($layout_info);
|
||||
// Apply CSS directly
|
||||
Context::addHtmlHeader("<style type=\"text/css\" charset=\"UTF-8\">".$code_css."</style>");
|
||||
// Set names and values of extra_vars to $layout_info
|
||||
if($layout_info->extra_var_count)
|
||||
{
|
||||
foreach($layout_info->extra_var as $var_id => $val)
|
||||
{
|
||||
$layout_info->{$var_id} = $val->value;
|
||||
}
|
||||
}
|
||||
// menu in layout information becomes an argument for Context:: set
|
||||
if($layout_info->menu_count)
|
||||
{
|
||||
foreach($layout_info->menu as $menu_id => $menu)
|
||||
{
|
||||
if(file_exists($menu->php_file)) @include($menu->php_file);
|
||||
Context::set($menu_id, $menu);
|
||||
}
|
||||
}
|
||||
|
||||
Context::set('layout_info', $layout_info);
|
||||
Context::set('content', Context::getLang('layout_preview_content'));
|
||||
// Temporary save the codes
|
||||
$edited_layout_file = sprintf('./files/cache/layout/tmp.tpl');
|
||||
FileHandler::writeFile($edited_layout_file, $code);
|
||||
|
||||
// Compile
|
||||
$oTemplate = &TemplateHandler::getInstance();
|
||||
|
||||
$layout_path = $layout_info->path;
|
||||
$layout_file = 'layout';
|
||||
|
||||
$layout_tpl = $oTemplate->compile($layout_path, $layout_file, $edited_layout_file);
|
||||
Context::set('layout','none');
|
||||
// Convert widgets and others
|
||||
$oContext = &Context::getInstance();
|
||||
Context::set('layout_tpl', $layout_tpl);
|
||||
// Delete Temporary Files
|
||||
FileHandler::removeFile($edited_layout_file);
|
||||
$this->setTemplateFile('layout_preview');
|
||||
}
|
||||
|
||||
}
|
||||
/* End of file layout.view.php */
|
||||
/* Location: ./modules/layout/layout.view.php */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue