mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-14 00:39:57 +09:00
issue 2667 create home menu cache file and save
git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@12152 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
35b35d24d3
commit
8417509874
8 changed files with 113 additions and 196 deletions
|
|
@ -118,11 +118,34 @@
|
|||
|
||||
function procInstallAdminUpdateIndexModule()
|
||||
{
|
||||
if(!Context::get('index_module_srl')) return new Object(-1, 'msg_invalid_request');
|
||||
if(!Context::get('index_module_srl') || !Context::get('menu_item_srl'))
|
||||
{
|
||||
return new Object(-1, 'msg_invalid_request');
|
||||
}
|
||||
|
||||
$site_args->site_srl = 0;
|
||||
$site_args->index_module_srl = Context::get('index_module_srl');
|
||||
$oModuleController = &getController('module');
|
||||
$oModuleController->updateSite($site_args);
|
||||
|
||||
// get menu item info
|
||||
$menuItemSrl = Context::get('menu_item_srl');
|
||||
$oMenuAdminModel = &getAdminModel('menu');
|
||||
$output = $oMenuAdminModel->getMenuItemInfo($menuItemSrl);
|
||||
|
||||
// update homeSitemap.php cache file
|
||||
$oMenuAdminController = &getAdminController('menu');
|
||||
$homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile();
|
||||
if(file_exists($homeMenuCacheFile))
|
||||
{
|
||||
@include($homeMenuCacheFile);
|
||||
}
|
||||
|
||||
if(!$homeMenuSrl || $homeMenuSrl != $output->menu_srl)
|
||||
{
|
||||
$oMenuAdminController->makeHomemenuCacheFile($output->menu_srl);
|
||||
}
|
||||
|
||||
$this->setMessage('success_updated');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -122,6 +122,10 @@
|
|||
<value xml:lang="tr"><![CDATA[İndirme Listesi]]></value>
|
||||
<value xml:lang="vi"><![CDATA[Danh sách Download]]></value>
|
||||
</item>
|
||||
<item name="sitemap_with_homemenu">
|
||||
<value xml:lang="ko"><![CDATA[시작메뉴가 있는 사이트맵]]></value>
|
||||
<value xml:lang="en"><![CDATA[Sitemap with Home menu]]></value>
|
||||
</item>
|
||||
<item name="layout_preview_content">
|
||||
<value xml:lang="ko"><![CDATA[내용이 출력되는 부분입니다.]]></value>
|
||||
<value xml:lang="en"><![CDATA[The content gets displayed here.]]></value>
|
||||
|
|
|
|||
|
|
@ -19,6 +19,23 @@ class layoutAdminModel extends layout {
|
|||
* @return void
|
||||
*/
|
||||
public function getLayoutAdminSetInfoView()
|
||||
{
|
||||
$this->setLayoutAdminSetInfoView();
|
||||
|
||||
Context::set('is_sitemap', '1');
|
||||
$script = '<script src="./modules/layout/tpl/js/layout_modify.js"></script>';
|
||||
$oTemplate = &TemplateHandler::getInstance();
|
||||
$html = $oTemplate->compile($this->module_path.'tpl/', 'layout_info_view');
|
||||
|
||||
$this->add('html', $script.$html);
|
||||
|
||||
if($isReturn)
|
||||
{
|
||||
return $this->get('html');
|
||||
}
|
||||
}
|
||||
|
||||
public function setLayoutAdminSetInfoView()
|
||||
{
|
||||
$layout_srl = Context::get('layout_srl');
|
||||
|
||||
|
|
@ -57,12 +74,6 @@ class layoutAdminModel extends layout {
|
|||
}
|
||||
}
|
||||
Context::set('selected_layout', $layout_info);
|
||||
|
||||
$script = '<script src="./modules/layout/tpl/js/layout_modify.js"></script>';
|
||||
$oTemplate = &TemplateHandler::getInstance();
|
||||
$html = $oTemplate->compile($this->module_path.'tpl/', 'layout_info_view');
|
||||
|
||||
$this->add('html', $script.$html);
|
||||
}
|
||||
|
||||
public function getLayoutAdminSetHTMLCSS()
|
||||
|
|
|
|||
|
|
@ -204,38 +204,15 @@
|
|||
* @return void
|
||||
**/
|
||||
function dispLayoutAdminModify() {
|
||||
// Set the layout after getting layout information
|
||||
$layout_srl = Context::get('layout_srl');
|
||||
$oLayoutAdminModel = &getAdminModel('layout');
|
||||
$oLayoutAdminModel->setLayoutAdminSetInfoView();
|
||||
|
||||
// Get layout information
|
||||
$oLayoutModel = &getModel('layout');
|
||||
$layout_info = $oLayoutModel->getLayout($layout_srl);
|
||||
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');
|
||||
|
||||
// Error appears if there is no layout information is registered
|
||||
if(!$layout_info) return $this->stop('msg_invalid_request');
|
||||
|
||||
// If faceoff, no need to display the path
|
||||
if($layout_info->type == 'faceoff') unset($layout_info->path);
|
||||
|
||||
// Get a 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..');
|
||||
|
||||
$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)
|
||||
{
|
||||
if (isset($layout_info->{$var_name}->description))
|
||||
$layout_info->{$var_name}->description = nl2br(trim($val->description));
|
||||
}
|
||||
Context::set('selected_layout', $layout_info);
|
||||
Context::set('content', $content);
|
||||
|
||||
$this->setTemplateFile('layout_modify');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<form id="config_form" ruleset="updateLayout" action="./" enctype="multipart/form-data" method="post">
|
||||
<input type="hidden" name="module" value="layout" />
|
||||
<input type="hidden" name="act" value="procLayoutAdminUpdate" />
|
||||
<input type="hidden" name="is_sitemap" value="1" />
|
||||
<input type="hidden" name="is_sitemap" value="{$is_sitemap}" />
|
||||
<input type="hidden" name="layout_srl" value="{$layout_srl}" />
|
||||
<input type="hidden" name="layout" value="{$selected_layout->layout}" />
|
||||
<input type="hidden" name="_layout_type" value="{$selected_layout->layout_type}" />
|
||||
|
|
@ -126,6 +126,7 @@
|
|||
<div class="x_controls">
|
||||
<select name="{$menu_name}" id="{$menu_name}" style="width:220px">
|
||||
<option value="0">{$lang->cmd_select}</option>
|
||||
<option selected="selected"|cond="!$menu_info->menu_srl||$menu_info->menu_srl == -1" value="-1">{$lang->sitemap_with_homemenu}</option>
|
||||
<option loop="$menu_list => $key, $val" value="{$val->menu_srl}" selected="selected"|cond="$val->menu_srl == $menu_info->menu_srl">{$val->title}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,158 +1,3 @@
|
|||
<include target="header.html" />
|
||||
<load target="js/layout_modify.js" />
|
||||
<section class="section">
|
||||
<h1 cond="$act == 'dispLayoutAdminModify'">
|
||||
{$selected_layout->layout_title}
|
||||
<a cond="$layout" class="x_btn" href="{getUrl('', 'module', 'admin', 'act', 'dispLayoutAdminInstanceList', 'layout', $selected_layout->layout)}" title="{$lang->cmd_list}" style="padding:3px 6px"><i class="x_icon-arrow-left"></i></a>
|
||||
<a cond="!$layout" class="x_btn" href="{getUrl('', 'module', 'admin', 'act', 'dispLayoutAdminAllInstanceList')}" title="{$lang->cmd_list}" style="padding:3px 6px"><i class="x_icon-arrow-left"></i></a>
|
||||
</h1>
|
||||
<form id="config_form" ruleset="updateLayout"|cond="$act == 'dispLayoutAdminModify'" action="./" enctype="multipart/form-data" method="post">
|
||||
<input type="hidden" name="module" value="layout" />
|
||||
<input type="hidden" name="act" value="procLayoutAdminUpdate"|cond="$act == 'dispLayoutAdminModify'" />
|
||||
<input type="hidden" name="layout_srl" value="{$layout_srl}" />
|
||||
<input type="hidden" name="layout" value="{$selected_layout->layout}" />
|
||||
<input type="hidden" name="_layout_type" value="{$selected_layout->layout_type}" />
|
||||
<input type="hidden" name="success_return_url" value="{getUrl('act', 'dispLayoutAdminInstanceList')}" />
|
||||
<!--// For submit config. Do not delete this division. -->
|
||||
<div></div>
|
||||
</form>
|
||||
<div id="layout_config" class="x_form-horizontal">
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label">{$lang->layout}</label>
|
||||
<div class="x_controls">
|
||||
{$selected_layout->title} ver {$selected_layout->version} ({$selected_layout->layout})
|
||||
</div>
|
||||
</div>
|
||||
<div cond="$selected_layout->path" class="x_control-group">
|
||||
<label class="x_control-label">{$lang->path}</label>
|
||||
<div class="x_controls">
|
||||
{$selected_layout->path}
|
||||
</div>
|
||||
</div>
|
||||
<div cond="$selected_layout->description" class="x_control-group">
|
||||
<label class="x_control-label">{$lang->description}</label>
|
||||
<div class="x_controls">
|
||||
{$selected_layout->description}
|
||||
</div>
|
||||
</div>
|
||||
<div cond="$selected_layout->author->homepage" class="x_control-group">
|
||||
<label class="x_control-label">{$lang->author}</label>
|
||||
<div class="x_controls">
|
||||
<a href="{$selected_layout->author->homepage}" target="_blank">{$selected_layout->author->name}</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="title">{$lang->title} <em>*</em></label>
|
||||
<div class="x_controls">
|
||||
<input type="text" id="title" name="title" value="{$selected_layout->layout_title}" />
|
||||
<span class="x_help-block">{$lang->about_title}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="header_script">{$lang->header_script}</label>
|
||||
<div class="x_controls">
|
||||
<textarea name="header_script" id="header_script" rows="8" cols="42">{$selected_layout->header_script}</textarea>
|
||||
<span class="x_help-block">{$lang->about_header_script}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<block cond="$act == 'dispLayoutAdminModify'" loop="$selected_layout->extra_var => $name, $var">
|
||||
<block cond="$group != $var->group">
|
||||
<h2>{$var->group}</h2>
|
||||
{@$group = $var->group}
|
||||
</block>
|
||||
{@$not_first = true}
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="{$name}">{$var->title}</label>
|
||||
<div class="x_controls">
|
||||
<div cond="$var->type == 'text'">
|
||||
<input type="text" name="{$name}" id="{$name}" class="lang_code" value="<!--@if(strpos($var->value, "$user_lang->") !== false)-->{htmlspecialchars($var->value)}<!--@else-->{$var->value}<!--@end-->" />
|
||||
</div>
|
||||
|
||||
<div cond="$var->type == 'textarea'">
|
||||
{@$use_multilang_textarea = true}
|
||||
<textarea name="{$name}" rows="8" cols="42" class="lang_code"><!--@if(strpos($var->value, "$user_lang->") !== false)-->{htmlspecialchars($var->value)}<!--@else-->{$var->value}<!--@end--></textarea>
|
||||
</div>
|
||||
|
||||
<block cond="$var->type == 'image'">
|
||||
<input type="hidden" name="{$name}" id="file_{$name}" value="{$var->value}" />
|
||||
<div id="preview_{$name}" class="x_thumbnail" style="<!--@if(!$var->value)-->display:none;<!--@end-->max-width:250px;margin-bottom:20px;">
|
||||
<img src="../../../{$var->value}"|cond="$var->value" alt="" style="max-width:250px;" />
|
||||
<div class="x_caption">
|
||||
<input class="x_btn x_btn-danger x_btn-mini" type="button" value="{$lang->cmd_delete}" onclick="deleteImage('{$name}')" />
|
||||
</div>
|
||||
</div>
|
||||
<form action="./" enctype="multipart/form-data" method="post" target="hiddenIframe" class="imageUpload">
|
||||
<input type="hidden" name="module" value="layout" />
|
||||
<input type="hidden" name="act" value="procLayoutAdminConfigImageUpload" />
|
||||
<input type="hidden" name="layout_srl" value="{$layout_srl}" />
|
||||
<input type="hidden" name="name" value="{$name}" />
|
||||
<p>
|
||||
<input type="file" name="img" id="file_select_{$name}" value="" />
|
||||
<input class="x_btn x_btn-mini x_btn-primary" type="submit" value="{$lang->cmd_submit}" />
|
||||
</p>
|
||||
</form>
|
||||
</block>
|
||||
|
||||
<select cond="$var->type == 'select'" name="{$name}" id="{$name}" style="width:220px;">
|
||||
<option loop="$var->options => $key, $val" value="{$key}" selected="selected"|cond="$key == $var->value">{$val->val}</option>
|
||||
</select>
|
||||
|
||||
<block cond="$var->type == 'checkbox'">
|
||||
<block loop="$var->options => $key, $val">
|
||||
<label class="x_inline"><input type="checkbox" name="{$name}[]" value="{$key}" checked="checked"|cond="@in_array($key, $var->value)" /> {$val->val}</label>
|
||||
</block>
|
||||
</block>
|
||||
|
||||
<block cond="$var->type == 'radio'">
|
||||
<div class="x_thumbnails">
|
||||
<block loop="$var->options => $key, $val">
|
||||
<div class="x_span2 <!--@if($val->thumbnail)-->x_thumbnail<!--@end-->">
|
||||
<img src="../../../{$val->thumbnail}" cond="$val->thumbnail" alt="{$val->val}" />
|
||||
<div class="x_caption">
|
||||
<label><input type="radio" name="{$name}" value="{$key}" checked="checked"|cond="$key == $var->value" /> {$val->val}</label>
|
||||
</div>
|
||||
</div>
|
||||
</block>
|
||||
</div>
|
||||
</block>
|
||||
<span class="x_help-block">{$var->description}</span>
|
||||
</div>
|
||||
</div>
|
||||
</block>
|
||||
|
||||
<div cond="$selected_layout->menu" loop="$selected_layout->menu => $menu_name, $menu_info" class="x_control-group">
|
||||
<label class="x_control-label" for="{$menu_name}">{$menu_info->title}({$menu_name})</label>
|
||||
<div class="x_controls">
|
||||
<select name="{$menu_name}" id="{$menu_name}" style="width:220px">
|
||||
<option value="0">{$lang->cmd_select}</option>
|
||||
<option loop="$menu_list => $key, $val" value="{$val->menu_srl}" selected="selected"|cond="$val->menu_srl == $menu_info->menu_srl">{$val->title}</option>
|
||||
</select>
|
||||
<a class="x_btn" href="{getUrl('module','admin','act','dispMenuAdminSiteMap')}">{$lang->cmd_management}</a>
|
||||
</div>
|
||||
</div>
|
||||
<div cond="$selected_layout->menu" class="x_control-group">
|
||||
<label class="x_control-label">{$lang->not_apply_menu}</label>
|
||||
<div class="x_controls">
|
||||
<label class="x_inline"><input type="checkbox" name="apply_layout" id="apply_layout" value="Y" /> {$lang->about_not_apply_menu}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div cond="$selected_layout->menu && $selected_layout->layout_type == 'M'" class="x_control-group">
|
||||
<label class="x_control-label">{$lang->apply_mobile_view}</label>
|
||||
<div class="x_controls">
|
||||
<label class="x_inline"><input type="checkbox" name="apply_mobile_view" id="apply_mobile_layout" value="Y" /> {$lang->about_apply_mobile_view}</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="x_clearfix btnArea">
|
||||
<span class="x_btn-group x_pull-left">
|
||||
<a cond="$layout" class="x_btn" href="{getUrl('', 'module', 'admin', 'act', 'dispLayoutAdminInstanceList', 'layout', $selected_layout->layout)}">{$lang->cmd_list}</a>
|
||||
<a cond="!$layout" class="x_btn" href="{getUrl('', 'module', 'admin', 'act', 'dispLayoutAdminAllInstanceList')}">{$lang->cmd_list}</a>
|
||||
</span>
|
||||
<span class="x_btn-group x_pull-right">
|
||||
<input class="x_btn x_btn-primary" type="submit" value="{$lang->cmd_insert}"|cond="$act == 'dispLayoutAdminInsert'" value="{$lang->cmd_save}"|cond="$act == 'dispLayoutAdminModify'" onclick="doSubmitConfig()"/>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<iframe name="hiddenIframe" src="about:blank" width="1000px" height="1000px" frameborder="0" style="position:absolute;top:-9999px;left:-9999px"></iframe>
|
||||
{$content}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,16 @@
|
|||
* @var array
|
||||
*/
|
||||
var $insertedMenuItemSrlList = array();
|
||||
/**
|
||||
* home module's mid
|
||||
* @var string
|
||||
*/
|
||||
private $homeModuleMid = NULL;
|
||||
/**
|
||||
* home menu cache file
|
||||
* @var string
|
||||
*/
|
||||
private $homeMenuCacheFile = './files/cache/menu/homeSitemap.php';
|
||||
|
||||
/**
|
||||
* Initialization
|
||||
|
|
@ -41,6 +51,7 @@
|
|||
function init()
|
||||
{
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
//$this->homeMenuCacheFile = sprintf('./files/cache/menu/homeSitemap.php');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -778,6 +789,18 @@
|
|||
$parent_srl = 0;
|
||||
}
|
||||
|
||||
if(!$this->homeModuleMid)
|
||||
{
|
||||
$oModuleModel = &getModel('module');
|
||||
$oMenuAdminController = &getAdminController('menu');
|
||||
$columnList = array('modules.mid',);
|
||||
$output = $oModuleModel->getSiteInfo(0, $columnList);
|
||||
if($output->mid)
|
||||
{
|
||||
$this->homeModuleMid = $output->mid;
|
||||
}
|
||||
}
|
||||
|
||||
$this->moveMenuItem($menu_srl, $parent_srl, $source_srl, $target_srl, $mode, $originMenu['is_shortcut'], $originMenu['url']);
|
||||
if(count($originMenu['list']) > 0)
|
||||
{
|
||||
|
|
@ -1133,6 +1156,19 @@
|
|||
$oModuleController = &getController('module');
|
||||
$output = $oModuleController->updateModule($moduleInfo);
|
||||
}
|
||||
|
||||
// change home menu cache file
|
||||
if($url == $this->homeModuleMid)
|
||||
{
|
||||
if(file_exists($this->homeMenuCacheFile))
|
||||
{
|
||||
@include($this->homeMenuCacheFile);
|
||||
}
|
||||
if(!$homeMenuSrl || $homeMenuSrl != $menu_srl)
|
||||
{
|
||||
$this->makeHomemenuCacheFile($menu_srl);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Add a child
|
||||
} elseif($mode == 'insert') {
|
||||
|
|
@ -1829,5 +1865,18 @@
|
|||
$ext = $tmp_arr[count($tmp_arr)-1];
|
||||
return sprintf('%s%d.%s.%s', $path, $menuItemSrl, 'menu_'.$mode.'_btn', $ext);
|
||||
}
|
||||
|
||||
public function makeHomemenuCacheFile($menuSrl)
|
||||
{
|
||||
$cacheBuff .= sprintf('<?php if(!defined("__ZBXE__")) exit();');
|
||||
$cacheBuff .= sprintf('$homeMenuSrl = %d;', $menuSrl);
|
||||
|
||||
FileHandler::writeFile($this->homeMenuCacheFile, $cacheBuff);
|
||||
}
|
||||
|
||||
public function getHomeMenuCacheFile()
|
||||
{
|
||||
return $this->homeMenuCacheFile;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -354,6 +354,7 @@
|
|||
$menuSrl = Context::get('menu_srl');
|
||||
|
||||
$oModuleModel = &getModel('module');
|
||||
$oMenuAdminController = &getAdminController('menu');
|
||||
$columnList = array('modules.mid', 'modules.browser_title', 'sites.index_module_srl');
|
||||
$start_module = $oModuleModel->getSiteInfo(0, $columnList);
|
||||
|
||||
|
|
@ -364,6 +365,10 @@
|
|||
$output = $this->getMenu($menuSrl);
|
||||
$php_file = sprintf('./files/cache/menu/%s.php',$output->menu_srl);
|
||||
if(file_exists($php_file)) @include($php_file);
|
||||
else
|
||||
{
|
||||
$oMenuAdminController->makeXmlFile($menuSrl);
|
||||
}
|
||||
|
||||
if(count($menu->list)>0)
|
||||
{
|
||||
|
|
@ -376,7 +381,6 @@
|
|||
// menu recreate
|
||||
if($isMenuFixed)
|
||||
{
|
||||
$oMenuAdminController = &getAdminController('menu');
|
||||
$oMenuAdminController->makeXmlFile($menuSrl);
|
||||
}
|
||||
|
||||
|
|
@ -400,6 +404,10 @@
|
|||
unset($menuItems);
|
||||
$value->php_file = sprintf('./files/cache/menu/%s.php',$value->menu_srl);
|
||||
if(file_exists($value->php_file)) @include($value->php_file);
|
||||
else
|
||||
{
|
||||
$oMenuAdminController->makeXmlFile($value->menu_srl);
|
||||
}
|
||||
|
||||
$isMenuFixed = false;
|
||||
if(count($menu->list)>0)
|
||||
|
|
@ -413,7 +421,6 @@
|
|||
// menu recreate
|
||||
if($isMenuFixed)
|
||||
{
|
||||
$oMenuAdminController = &getAdminController('menu');
|
||||
$oMenuAdminController->makeXmlFile($value->menu_srl);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue