mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-09 03:32:00 +09:00
issue 2366, Delete a module when delete menu
git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@11229 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
99e7e392ef
commit
3fe93908c5
3 changed files with 88 additions and 8 deletions
|
|
@ -103,6 +103,53 @@
|
|||
* @return Object
|
||||
*/
|
||||
function deleteMenu($menu_srl) {
|
||||
$oDB = DB::getInstance();
|
||||
$oDB->begin();
|
||||
|
||||
$args->menu_srl = $menu_srl;
|
||||
|
||||
// Delete modules
|
||||
$output = executeQueryArray('menu.getMenuItems', $args);
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
|
||||
$oModuleController = getController('module');
|
||||
$oModuleModel = getModel('module');
|
||||
|
||||
foreach($output->data as $itemInfo)
|
||||
{
|
||||
if($itemInfo->is_shortcut != 'Y' && !preg_match('/^http/i',$itemInfo->url))
|
||||
{
|
||||
$moduleInfo = $oModuleModel->getModuleInfoByMid($itemInfo->url, $menuInfo->site_srl);
|
||||
if($moduleInfo->module_srl)
|
||||
{
|
||||
$output = $oModuleController->deleteModule($moduleInfo->module_srl);
|
||||
if(!$output->toBool())
|
||||
{
|
||||
$oDB->rollback();
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Delete menu items
|
||||
$output = executeQuery("menu.deleteMenuItems", $args);
|
||||
if(!$output->toBool())
|
||||
{
|
||||
$oDB->rollback();
|
||||
return $output;
|
||||
}
|
||||
// Delete the menu
|
||||
$output = executeQuery("menu.deleteMenu", $args);
|
||||
if(!$output->toBool())
|
||||
{
|
||||
$oDB->rollback();
|
||||
return $output;
|
||||
}
|
||||
|
||||
// Delete cache files
|
||||
$cache_list = FileHandler::readDir("./files/cache/menu","",false,true);
|
||||
if(count($cache_list)) {
|
||||
|
|
@ -115,13 +162,7 @@
|
|||
$image_path = sprintf('./files/attach/menu_button/%s', $menu_srl);
|
||||
FileHandler::removeDir($image_path);
|
||||
|
||||
$args->menu_srl = $menu_srl;
|
||||
// Delete menu items
|
||||
$output = executeQuery("menu.deleteMenuItems", $args);
|
||||
if(!$output->toBool()) return $output;
|
||||
// Delete the menu
|
||||
$output = executeQuery("menu.deleteMenu", $args);
|
||||
if(!$output->toBool()) return $output;
|
||||
$oDB->commit();
|
||||
|
||||
return new Object(0,'success_deleted');
|
||||
}
|
||||
|
|
@ -305,9 +346,17 @@
|
|||
$output = executeQuery('menu.getChildMenuCount', $args);
|
||||
if(!$output->toBool()) return $output;
|
||||
if($output->data->count>0) return new Object(-1, 'msg_cannot_delete_for_child');
|
||||
|
||||
$oDB = DB::getInstance();
|
||||
$oDB->begin();
|
||||
|
||||
// Remove from the DB
|
||||
$output = executeQuery("menu.deleteMenuItem", $args);
|
||||
if(!$output->toBool()) return $output;
|
||||
if(!$output->toBool())
|
||||
{
|
||||
$oDB->rollback();
|
||||
return $output;
|
||||
}
|
||||
// Update the xml file and get its location
|
||||
$xml_file = $this->makeXmlFile($args->menu_srl);
|
||||
// Delete all of image buttons
|
||||
|
|
@ -315,6 +364,26 @@
|
|||
if($item_info->hover_btn) FileHandler::removeFile($item_info->hover_btn);
|
||||
if($item_info->active_btn) FileHandler::removeFile($item_info->active_btn);
|
||||
|
||||
// Delete module
|
||||
if($item_info->is_shortcut != 'Y' && !preg_match('/^http/i',$item_info->url))
|
||||
{
|
||||
$oModuleController = getController('module');
|
||||
$oModuleModel = getModel('module');
|
||||
|
||||
$moduleInfo = $oModuleModel->getModuleInfoByMid($item_info->url, $menu_info->site_srl);
|
||||
if($moduleInfo->module_srl)
|
||||
{
|
||||
$output = $oModuleController->deleteModule($moduleInfo->module_srl);
|
||||
if(!$output->toBool())
|
||||
{
|
||||
$oDB->rollback();
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$oDB->commit();
|
||||
|
||||
$this->add('xml_file', $xml_file);
|
||||
$this->add('menu_title', $menu_title);
|
||||
$this->add('menu_item_srl', $parent_srl);
|
||||
|
|
|
|||
|
|
@ -30,6 +30,11 @@
|
|||
|
||||
// 2012. 02. 01 title index check
|
||||
if(!$oDB->isIndexExists("menu", "idx_title")) return true;
|
||||
|
||||
if(!$oDB->isColumnExists('menu_item', 'is_shortcut'))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -49,6 +54,11 @@
|
|||
$oDB->addIndex('menu', 'idx_title', array('title'));
|
||||
}
|
||||
|
||||
if(!$oDB->isColumnExists('menu_item', 'is_shortcut'))
|
||||
{
|
||||
$oDB->addColumn('menu_item', 'is_shortcut', 'char', 1, 'N');
|
||||
}
|
||||
|
||||
return new Object(0, 'success_updated');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
<column name="menu_srl" type="number" size="12" notnull="notnull" index="idx_menu_srl" />
|
||||
<column name="name" type="text" />
|
||||
<column name="url" type="varchar" size="250" />
|
||||
<column name="is_shortcut" type="char" size="1" default="N" />
|
||||
<column name="open_window" type="char" size="1" default="N" />
|
||||
<column name="expand" type="char" size="1" default="N" />
|
||||
<column name="normal_btn" type="varchar" size="255" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue