changed make admin menu logic, added reset admin menu function

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9071 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
flyskyko 2011-09-07 02:19:04 +00:00
parent e4d9b43320
commit 986053ac4d
6 changed files with 40 additions and 20 deletions

View file

@ -17,6 +17,19 @@
if($logged_info->is_admin!='Y') return $this->stop("msg_is_not_administrator");
}
function procAdminMenuReset(){
$menuSrl = Context::get('menu_srl');
if (!$menuSrl) return $this->stop('msg_invalid_request');
$oMenuAdminController = &getAdminController('menu');
$output = $oMenuAdminController->deleteMenu($menuSrl);
if (!$output->toBool()) return $output;
FileHandler::removeDir('./files/cache/menu/admin_lang/');
$this->setRedirectUrl(Context::get('error_return_url'));
}
/**
* @brief Regenerate all cache files
* @return none

View file

@ -302,7 +302,7 @@
function getAdminMenuLang()
{
$currentLang = Context::getLangType();
$cacheFile = sprintf('./files/cache/menu/adminMenu.%s.lang.php', $currentLang);
$cacheFile = sprintf('./files/cache/menu/admin_lang/adminMenu.%s.lang.php', $currentLang);
// Update if no cache file exists or it is older than xml file
if(!is_readable($cacheFile))

View file

@ -8,12 +8,27 @@
class adminAdminView extends admin {
var $layout_list;
var $xeMenuTitle;
/**
* @brief Initilization
* @return none
**/
function init() {
// admin menu check
$this->xeMenuTitle = '__XE_ADMIN__';
$oMenuAdminModel = &getAdminModel('menu');
$output = $oMenuAdminModel->getMenuByTitle($this->xeMenuTitle);
if(!$output->menu_srl)
{
parent::_createXeAdminMenu();
}
else if(!is_readable($output->php_file))
{
$oMenuAdminController = &getAdminController('menu');
$oMenuAdminController->makeXmlFile($output->menu_srl);
}
// forbit access if the user is not an administrator
$oMemberModel = &getModel('member');
@ -60,7 +75,6 @@
if(is_readable($menu_info->php_file))
include $menu_info->php_file;
else {
header('location:'.getNotEncodedUrl('', 'module', 'admin'));
return;
}

View file

@ -6,8 +6,6 @@
**/
class admin extends ModuleObject {
var $xeMenuTitle;
/**
* @brief install admin module
* @return new Object
@ -20,15 +18,6 @@
* @brief if update is necessary it returns true
**/
function checkUpdate() {
$this->xeMenuTitle = '__XE_ADMIN__';
$oMenuAdminModel = &getAdminModel('menu');
$output = $oMenuAdminModel->getMenuByTitle($this->xeMenuTitle);
if(!$output->menu_srl)
{
$this->_createXeAdminMenu();
}
return false;
}

View file

@ -16,6 +16,7 @@
<action name="procAdminEnviromentGatheringAgreement" type="controller" standalone="true" />
<action name="procAdminUpdateConfig" type="controller" standalone="true" />
<action name="procAdminDeleteLogo" type="controller" standalone="true" />
<action name="procAdminMenuReset" type="controller" />
<action name="getAdminFTPList" type="model" standalone="true" />
<action name="getSiteAllList" type="model" standalone="true" />

View file

@ -47,7 +47,10 @@
</ul>
</li>
</ul>
<p class="btnArea"><span class="btn small"><button value="procMenuAdminArrangeItem" name="act" type="submit">{$lang->cmd_save}</button></span></p>
<p class="btnArea">
<span class="btn small" style="float: left;"><button value="procAdminMenuReset" name="act" type="submit">{$lang->cmd_reset}</button></span>
<span class="btn small"><button value="procMenuAdminArrangeItem" name="act" type="submit">{$lang->cmd_save}</button></span>
</p>
</div>
</fieldset>
</form>