mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-14 00:39:57 +09:00
issue 2658 if include home menu, can not delete the menu
git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@12135 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
d9859ab0d4
commit
951292f607
1 changed files with 38 additions and 12 deletions
|
|
@ -582,11 +582,12 @@
|
|||
// List variables
|
||||
$args = Context::gets('menu_item_srl');
|
||||
|
||||
$oModuleModel = &getModel('module');
|
||||
$oMenuAdminModel = &getAdminModel('menu');
|
||||
|
||||
// Get original information
|
||||
$item_info = $oMenuAdminModel->getMenuItemInfo($args->menu_item_srl);
|
||||
$args->menu_srl = $item_info->menu_srl;
|
||||
$itemInfo = $oMenuAdminModel->getMenuItemInfo($args->menu_item_srl);
|
||||
$args->menu_srl = $itemInfo->menu_srl;
|
||||
|
||||
// Get information of the menu
|
||||
$menuInfo = $oMenuAdminModel->getMenu($args->menu_srl);
|
||||
|
|
@ -594,12 +595,12 @@
|
|||
|
||||
// check admin menu delete
|
||||
$oAdmin = &getClass('admin');
|
||||
if($menu_title == $oAdmin->getAdminMenuName() && $item_info->parent_srl == 0)
|
||||
if($menu_title == $oAdmin->getAdminMenuName() && $itemInfo->parent_srl == 0)
|
||||
{
|
||||
return $this->stop('msg_cannot_delete_for_admin_topmenu');
|
||||
}
|
||||
|
||||
if($item_info->parent_srl) $parent_srl = $item_info->parent_srl;
|
||||
if($itemInfo->parent_srl) $parent_srl = $itemInfo->parent_srl;
|
||||
|
||||
// get menu properies with child menu
|
||||
$phpFile = sprintf("./files/cache/menu/%s.php", $args->menu_srl);
|
||||
|
|
@ -615,6 +616,15 @@
|
|||
}
|
||||
}
|
||||
|
||||
// check start menu in originMenu
|
||||
$siteInfo = $oModuleModel->getSiteInfo($menuInfo->site_srl);
|
||||
$isStartmenuInclude = false;
|
||||
$this->_checkStartMenuInOriginMenu($originMenu, $siteInfo->mid, $isStartmenuInclude);
|
||||
if($isStartmenuInclude)
|
||||
{
|
||||
return new Object(-1, 'msg_cannot_delete_homemenu');
|
||||
}
|
||||
|
||||
$oDB = DB::getInstance();
|
||||
$oDB->begin();
|
||||
|
||||
|
|
@ -634,6 +644,22 @@
|
|||
$this->setRedirectUrl($returnUrl);
|
||||
}
|
||||
|
||||
private function _checkStartMenuInOriginMenu($originMenu, $startMid, &$isStartmenuInclude)
|
||||
{
|
||||
if($originMenu['url'] == $startMid)
|
||||
{
|
||||
$isStartmenuInclude = true;
|
||||
}
|
||||
|
||||
if(!$isStartmenuInclude && is_array($originMenu['list']))
|
||||
{
|
||||
foreach($originMenu['list'] AS $key=>$value)
|
||||
{
|
||||
$this->_checkStartMenuInOriginMenu($value, $startMid, $isStartmenuInclude);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function _deleteMenuItem(&$oDB, &$menuInfo, $node)
|
||||
{
|
||||
// Remove from the DB
|
||||
|
|
@ -657,7 +683,7 @@
|
|||
if($node['is_shortcut'] != 'Y' && !preg_match('/^http/i',$node['url']))
|
||||
{
|
||||
$oModuleController = getController('module');
|
||||
$oModuleModel = getModel('module');
|
||||
$oModuleModel = &getModel('module');
|
||||
|
||||
$moduleInfo = $oModuleModel->getModuleInfoByMid($node['url'], $menuInfo->site_srl);
|
||||
if($moduleInfo->module_srl)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue