mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-15 09:19:57 +09:00
merge from 1.5.3 (~r10943)
git-svn-id: http://xe-core.googlecode.com/svn/trunk@10951 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
7aa4798373
commit
54e3a72065
334 changed files with 13011 additions and 5561 deletions
|
|
@ -1,25 +1,45 @@
|
|||
<?php
|
||||
/**
|
||||
* @class menuAdminController
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief admin controller class of the menu module
|
||||
**/
|
||||
|
||||
/**
|
||||
* menuAdminController class
|
||||
* admin controller class of the menu module
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /modules/menu
|
||||
* @version 0.1
|
||||
*/
|
||||
class menuAdminController extends menu {
|
||||
/**
|
||||
* menu number
|
||||
* @var int
|
||||
*/
|
||||
var $menuSrl = null;
|
||||
/**
|
||||
* item key list
|
||||
* @var array
|
||||
*/
|
||||
var $itemKeyList = array();
|
||||
/**
|
||||
* map
|
||||
* @var array
|
||||
*/
|
||||
var $map = array();
|
||||
/**
|
||||
* checked
|
||||
* @var array
|
||||
*/
|
||||
var $checked = array();
|
||||
|
||||
/**
|
||||
* @brief Initialization
|
||||
**/
|
||||
/**
|
||||
* Initialization
|
||||
* @return void
|
||||
*/
|
||||
function init() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Add a menu
|
||||
**/
|
||||
/**
|
||||
* Add a menu
|
||||
* @return void|object
|
||||
*/
|
||||
function procMenuAdminInsert() {
|
||||
// List variables
|
||||
$site_module_info = Context::get('site_module_info');
|
||||
|
|
@ -34,16 +54,14 @@
|
|||
$this->add('menu_srl', $args->menu_srl);
|
||||
$this->setMessage('success_registed');
|
||||
|
||||
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispMenuAdminContent');
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
return;
|
||||
}
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispMenuAdminContent');
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Change the menu title
|
||||
**/
|
||||
/**
|
||||
* Change the menu title
|
||||
* @return void|object
|
||||
*/
|
||||
function procMenuAdminUpdate() {
|
||||
// List variables
|
||||
$args->title = Context::get('title');
|
||||
|
|
@ -53,17 +71,15 @@
|
|||
if(!$output->toBool()) return $output;
|
||||
|
||||
$this->setMessage('success_registed');
|
||||
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispMenuAdminManagement', 'menu_srl', $args->menu_srl);
|
||||
header('location:'.$returnUrl);
|
||||
return;
|
||||
}
|
||||
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispMenuAdminManagement', 'menu_srl', $args->menu_srl);
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Delete menu
|
||||
* Delete menu_item and xml cache files
|
||||
**/
|
||||
/**
|
||||
* Delete menu process method
|
||||
* @return void|Object
|
||||
*/
|
||||
function procMenuAdminDelete() {
|
||||
$menu_srl = Context::get('menu_srl');
|
||||
|
||||
|
|
@ -76,13 +92,16 @@
|
|||
$this->deleteMenu($menu_srl);
|
||||
|
||||
$this->setMessage('success_deleted', 'info');
|
||||
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispMenuAdminSiteMap');
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
return;
|
||||
}
|
||||
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispMenuAdminSiteMap');
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete menu
|
||||
* Delete menu_item and xml cache files
|
||||
* @return Object
|
||||
*/
|
||||
function deleteMenu($menu_srl) {
|
||||
// Delete cache files
|
||||
$cache_list = FileHandler::readDir("./files/cache/menu","",false,true);
|
||||
|
|
@ -107,12 +126,14 @@
|
|||
return new Object(0,'success_deleted');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Add an item to the menu
|
||||
**/
|
||||
/**
|
||||
* Add an item to the menu
|
||||
* @return void
|
||||
*/
|
||||
function procMenuAdminInsertItem() {
|
||||
// List variables to insert
|
||||
$source_args = Context::getRequestVars();
|
||||
|
||||
unset($source_args->module);
|
||||
unset($source_args->act);
|
||||
if($source_args->menu_open_window!="Y") $source_args->menu_open_window = "N";
|
||||
|
|
@ -148,12 +169,16 @@
|
|||
$args->group_srls = $source_args->group_srls;
|
||||
|
||||
// if cType is CREATE, create module
|
||||
if($source_args->cType == 'CREATE')
|
||||
if($source_args->cType == 'CREATE' || $source_args->cType == 'SELECT')
|
||||
{
|
||||
$site_module_info = Context::get('site_module_info');
|
||||
$cmArgs->site_srl = (int)$site_module_info->site_srl;
|
||||
$cmArgs->mid = $source_args->create_menu_url;
|
||||
$cmArgs->browser_title = $args->name;
|
||||
$cmArgs->menu_srl = $source_args->menu_srl;
|
||||
if($source_args->layout_srl)
|
||||
{
|
||||
$cmArgs->layout_srl = $source_args->layout_srl;
|
||||
}
|
||||
|
||||
switch ($source_args->module_type){
|
||||
case 'WIDGET' :
|
||||
|
|
@ -167,9 +192,26 @@
|
|||
unset($cmArgs->page_type);
|
||||
}
|
||||
|
||||
$cmArgs->menu_srl = $source_args->menu_srl;
|
||||
$oModuleController = &getController('module');
|
||||
$output = $oModuleController->insertModule($cmArgs);
|
||||
if($source_args->cType == 'CREATE')
|
||||
{
|
||||
$cmArgs->mid = $source_args->create_menu_url;
|
||||
$output = $oModuleController->insertModule($cmArgs);
|
||||
}
|
||||
else
|
||||
{
|
||||
$oModuleModel = &getModel('module');
|
||||
$module_info = $oModuleModel->getModuleInfoByModuleSrl($source_args->module_srl);
|
||||
if($cmArgs->layout_srl)
|
||||
{
|
||||
$module_info->layout_srl = $cmArgs->layout_srl;
|
||||
}
|
||||
$cmArgs = $module_info;
|
||||
|
||||
$cmArgs->mid = $source_args->select_menu_url;
|
||||
$cmArgs->module_srl = $source_args->module_srl;
|
||||
$output = $oModuleController->updateModule($cmArgs);
|
||||
}
|
||||
if(!$output->toBool()) return new Object(-1, $output->message);
|
||||
}
|
||||
|
||||
|
|
@ -226,16 +268,15 @@
|
|||
$this->add('parent_srl', $args->parent_srl);
|
||||
|
||||
$this->setMessage($message, 'info');
|
||||
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispMenuAdminSiteMap', 'menu_srl', $args->menu_srl);
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
return;
|
||||
}
|
||||
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispMenuAdminSiteMap', 'menu_srl', $args->menu_srl);
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Delete menu item(menu of the menu)
|
||||
**/
|
||||
/**
|
||||
* Delete menu item(menu of the menu)
|
||||
* @return void|Object
|
||||
*/
|
||||
function procMenuAdminDeleteItem() {
|
||||
// List variables
|
||||
$args = Context::gets('menu_srl','menu_item_srl');
|
||||
|
|
@ -271,16 +312,14 @@
|
|||
$this->add('menu_item_srl', $parent_srl);
|
||||
$this->setMessage('success_deleted');
|
||||
|
||||
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispMenuAdminManagement', 'menu_srl', $args->menu_srl);
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
return;
|
||||
}
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispMenuAdminManagement', 'menu_srl', $args->menu_srl);
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Move menu items
|
||||
**/
|
||||
/**
|
||||
* Move menu items
|
||||
* @return void
|
||||
*/
|
||||
function procMenuAdminMoveItem() {
|
||||
$menu_srl = Context::get('menu_srl');
|
||||
$mode = Context::get('mode');
|
||||
|
|
@ -292,9 +331,10 @@
|
|||
$this->moveMenuItem($menu_srl,$parent_srl,$source_srl,$target_srl,$mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Arrange menu items
|
||||
**/
|
||||
/**
|
||||
* Arrange menu items
|
||||
* @return void|object
|
||||
*/
|
||||
function procMenuAdminArrangeItem()
|
||||
{
|
||||
$this->menuSrl = Context::get('menu_srl');
|
||||
|
|
@ -349,13 +389,18 @@
|
|||
}
|
||||
|
||||
$this->setMessage('success_updated', 'info');
|
||||
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispMenuAdminManagement', 'menu_srl', $args->menu_srl);
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
return;
|
||||
}
|
||||
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispMenuAdminManagement', 'menu_srl', $args->menu_srl);
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set parent number to child
|
||||
* @param int $parent_srl
|
||||
* @param int $child_index
|
||||
* @param object $target
|
||||
* @return void
|
||||
*/
|
||||
function _setParent($parent_srl, $child_index, &$target)
|
||||
{
|
||||
$child_srl = $this->itemKeyList[$child_index];
|
||||
|
|
@ -372,6 +417,11 @@
|
|||
//return $target;
|
||||
}
|
||||
|
||||
/**
|
||||
* move item with sub directory(recursive)
|
||||
* @param object $result
|
||||
* @return void
|
||||
*/
|
||||
function _recursiveMoveMenuItem($result)
|
||||
{
|
||||
$i = 0;
|
||||
|
|
@ -386,6 +436,15 @@
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* move menu item
|
||||
* @param int $menu_srl
|
||||
* @param int $parent_srl
|
||||
* @param int $source_srl
|
||||
* @param int $target_srl
|
||||
* @param string $mode 'move' or 'insert'
|
||||
* @return void
|
||||
*/
|
||||
function moveMenuItem($menu_srl,$parent_srl,$source_srl,$target_srl,$mode){
|
||||
// Get the original menus
|
||||
$oMenuAdminModel = &getAdminModel('menu');
|
||||
|
|
@ -428,12 +487,13 @@
|
|||
return $xml_file;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Update xml file
|
||||
* XML file is not often generated after setting menus on the admin page\n
|
||||
* For this occasional cases, manually update was implemented. \n
|
||||
* It looks unnecessary at this moment however no need to eliminate the feature. Just leave it.
|
||||
**/
|
||||
/**
|
||||
* Update xml file
|
||||
* XML file is not often generated after setting menus on the admin page\n
|
||||
* For this occasional cases, manually update was implemented. \n
|
||||
* It looks unnecessary at this moment however no need to eliminate the feature. Just leave it.
|
||||
* @return void
|
||||
*/
|
||||
function procMenuAdminMakeXmlFile() {
|
||||
// Check input value
|
||||
$menu_srl = Context::get('menu_srl');
|
||||
|
|
@ -448,9 +508,10 @@
|
|||
$this->add('xml_file',$xml_file);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Register a menu image button
|
||||
**/
|
||||
/**
|
||||
* Register a menu image button
|
||||
* @return void
|
||||
*/
|
||||
function procMenuAdminUploadButton() {
|
||||
$menu_srl = Context::get('menu_srl');
|
||||
$menu_item_srl = Context::get('menu_item_srl');
|
||||
|
|
@ -478,9 +539,10 @@
|
|||
$this->setTemplateFile('menu_file_uploaded');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Remove the menu image button
|
||||
**/
|
||||
/**
|
||||
* Remove the menu image button
|
||||
* @return void
|
||||
*/
|
||||
function procMenuAdminDeleteButton() {
|
||||
$menu_srl = Context::get('menu_srl');
|
||||
$menu_item_srl = Context::get('menu_item_srl');
|
||||
|
|
@ -491,9 +553,10 @@
|
|||
$this->add('target', $target);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get all act list for admin menu
|
||||
**/
|
||||
/**
|
||||
* Get all act list for admin menu
|
||||
* @return void
|
||||
*/
|
||||
function procMenuAdminAllActList() {
|
||||
$oModuleModel = &getModel('module');
|
||||
$installed_module_list = $oModuleModel->getModulesXmlInfo();
|
||||
|
|
@ -511,9 +574,10 @@
|
|||
$this->add('menuList', $menuList);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get all act list for admin menu
|
||||
**/
|
||||
/**
|
||||
* Get all act list for admin menu
|
||||
* @return void|object
|
||||
*/
|
||||
function procMenuAdminInsertItemForAdminMenu()
|
||||
{
|
||||
$requestArgs = Context::getRequestVars();
|
||||
|
|
@ -571,16 +635,15 @@
|
|||
// Update the xml file and get its location
|
||||
$xml_file = $this->makeXmlFile($args->menu_srl);
|
||||
|
||||
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminSetup');
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
return;
|
||||
}
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminSetup');
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Generate XML file for menu and return its location
|
||||
**/
|
||||
/**
|
||||
* Generate XML file for menu and return its location
|
||||
* @param int $menu_srl
|
||||
* @return string
|
||||
*/
|
||||
function makeXmlFile($menu_srl) {
|
||||
// Return if there is no information when creating the xml file
|
||||
if(!$menu_srl) return;
|
||||
|
|
@ -686,11 +749,16 @@
|
|||
return $xml_file;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Create xml data recursively looping for array nodes by referencing to parent_srl
|
||||
* menu xml file uses a tag named "node" and this XML configures menus on admin page.
|
||||
* (Implement tree menu by reading the xml file in tree_menu.js)
|
||||
**/
|
||||
/**
|
||||
* Create xml data recursively looping for array nodes by referencing to parent_srl
|
||||
* menu xml file uses a tag named "node" and this XML configures menus on admin page.
|
||||
* (Implement tree menu by reading the xml file in tree_menu.js)
|
||||
* @param array $source_node
|
||||
* @param array $tree
|
||||
* @param int $site_srl
|
||||
* @param string $domain
|
||||
* @return string
|
||||
*/
|
||||
function getXmlTree($source_node, $tree, $site_srl, $domain) {
|
||||
if(!$source_node) return;
|
||||
|
||||
|
|
@ -765,12 +833,17 @@
|
|||
return $buff;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return php code converted from nodes in an array
|
||||
* Although xml data can be used for tpl, menu to menu, it needs to use javascript separately
|
||||
* By creating cache file in php and then you can get menu information without DB
|
||||
* This cache includes in ModuleHandler::displayContent() and then Context::set()
|
||||
**/
|
||||
/**
|
||||
* Return php code converted from nodes in an array
|
||||
* Although xml data can be used for tpl, menu to menu, it needs to use javascript separately
|
||||
* By creating cache file in php and then you can get menu information without DB
|
||||
* This cache includes in ModuleHandler::displayContent() and then Context::set()
|
||||
* @param array $source_node
|
||||
* @param array $tree
|
||||
* @param int $site_srl
|
||||
* @param string $domain
|
||||
* @return array
|
||||
*/
|
||||
function getPhpCacheCode($source_node, $tree, $site_srl, $domain) {
|
||||
$output = array("buff"=>"", "url_list"=>array());
|
||||
if(!$source_node) return $output;
|
||||
|
|
@ -806,6 +879,12 @@
|
|||
$normal_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->normal_btn);
|
||||
$hover_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->hover_btn);
|
||||
$active_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->active_btn);
|
||||
|
||||
foreach($child_output['url_list'] as $key =>$val)
|
||||
{
|
||||
$child_output['url_list'][$key] = addslashes($val);
|
||||
}
|
||||
|
||||
$selected = '"'.implode('","',$child_output['url_list']).'"';
|
||||
$child_buff = $child_output['buff'];
|
||||
$expand = $node->expand;
|
||||
|
|
@ -867,10 +946,12 @@
|
|||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Mapping menu and layout
|
||||
* When setting menu on the layout, map the default layout
|
||||
**/
|
||||
/**
|
||||
* Mapping menu and layout
|
||||
* When setting menu on the layout, map the default layout
|
||||
* @param int $layout_srl
|
||||
* @param array $menu_srl_list
|
||||
*/
|
||||
function updateMenuLayout($layout_srl, $menu_srl_list) {
|
||||
if(!count($menu_srl_list)) return;
|
||||
// Delete the value of menu_srls
|
||||
|
|
@ -887,9 +968,11 @@
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Register a menu image button
|
||||
**/
|
||||
/**
|
||||
* Register a menu image button
|
||||
* @param object $args
|
||||
* @return array
|
||||
*/
|
||||
function _uploadButton($args)
|
||||
{
|
||||
// path setting
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue