// AdminTab compatibility: Dispatcher for BO now search tabs in database, not on the disk. AdminTabs now uses the new BO theme.
This commit is contained in:
+15
-13
@@ -49,13 +49,20 @@ function bindDatepicker($id, $time)
|
||||
});';
|
||||
}
|
||||
|
||||
// id can be a identifier or an array of identifiers
|
||||
/**
|
||||
* Deprecated since 1.5
|
||||
* Use Controller::addJqueryUi('ui.datepicker') instead
|
||||
*
|
||||
* @param int|array $id id can be a identifier or an array of identifiers
|
||||
* @param unknown_type $time
|
||||
*/
|
||||
function includeDatepicker($id, $time = false)
|
||||
{
|
||||
Tools::displayAsDeprecated();
|
||||
echo '<script type="text/javascript" src="'.__PS_BASE_URI__.'js/jquery/jquery-ui-1.8.10.custom.min.js"></script>';
|
||||
$iso = Db::getInstance()->getValue('SELECT iso_code FROM '._DB_PREFIX_.'lang WHERE `id_lang` = '.(int)Context::getContext()->language->id);
|
||||
if ($iso != 'en')
|
||||
echo '<script type="text/javascript" src="'.__PS_BASE_URI__.'js/jquery/datepicker/ui/i18n/ui.datepicker-'.$iso.'.js"></script>';
|
||||
echo '<script type="text/javascript" src="'.__PS_BASE_URI__.'js/jquery/ui/i18n/jquery.ui.datepicker-'.$iso.'.js"></script>';
|
||||
echo '<script type="text/javascript">';
|
||||
if (is_array($id))
|
||||
foreach ($id as $id2)
|
||||
@@ -233,16 +240,12 @@ function translate($string)
|
||||
*/
|
||||
function checkingTab($tab)
|
||||
{
|
||||
static $controllers;
|
||||
|
||||
if (is_null($controllers))
|
||||
$controllers = Dispatcher::getControllers(_PS_ADMIN_DIR_.'/tabs/');
|
||||
|
||||
$tab = trim($tab);
|
||||
|
||||
$tab_lowercase = strtolower($tab);
|
||||
if (!Validate::isTabName($tab))
|
||||
return false;
|
||||
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('SELECT id_tab, module FROM `'._DB_PREFIX_.'tab` WHERE class_name = \''.pSQL($tab).'\'');
|
||||
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('SELECT id_tab, module, class_name FROM `'._DB_PREFIX_.'tab` WHERE class_name = \''.pSQL($tab).'\'');
|
||||
if (!$row['id_tab'])
|
||||
{
|
||||
if (isset(AdminTab::$tabParenting[$tab]))
|
||||
@@ -250,10 +253,8 @@ function checkingTab($tab)
|
||||
echo sprintf(Tools::displayError('Tab %s cannot be found.'),$tab);
|
||||
return false;
|
||||
}
|
||||
if ($row['module'] AND file_exists(_PS_MODULE_DIR_.'/'.$row['module'].'/'.$controllers[$tab_lowercase].'.php'))
|
||||
include_once(_PS_MODULE_DIR_.'/'.$row['module'].'/'.$controllers[$tab_lowercase].'.php');
|
||||
elseif (file_exists(_PS_ADMIN_DIR_.'/tabs/'.$controllers[$tab_lowercase].'.php'))
|
||||
include_once(_PS_ADMIN_DIR_.'/tabs/'.$controllers[$tab_lowercase].'.php');
|
||||
|
||||
// Class file is included in Dispatcher::dispatch() function
|
||||
if (!class_exists($tab, false) OR !$row['id_tab'])
|
||||
{
|
||||
echo sprintf(Tools::displayError('Tab file %s cannot be found.'),$tab);
|
||||
@@ -434,7 +435,7 @@ function generateShopList()
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function runAdminTab($ajaxMode = false)
|
||||
function runAdminTab($tab, $ajaxMode = false)
|
||||
{
|
||||
$ajaxMode = (bool)$ajaxMode;
|
||||
|
||||
@@ -449,6 +450,7 @@ function runAdminTab($ajaxMode = false)
|
||||
// $tab = $_REQUEST['tab'];
|
||||
if ($adminObj = checkingTab($tab))
|
||||
{
|
||||
$noTabLink = $adminObj->noTabLink;
|
||||
// init is different for new tabs (AdminController) and old tabs (AdminTab)
|
||||
if ($adminObj instanceof AdminController)
|
||||
{
|
||||
|
||||
+34
-31
@@ -183,7 +183,8 @@ echo ' var html = "";
|
||||
<body '.((!empty(Context::getContext()->employee->bo_color)) ? 'style="background:'.Tools::htmlentitiesUTF8(Context::getContext()->employee->bo_color).'"' : '').'>
|
||||
<div id="top_container">
|
||||
<div id="container">
|
||||
<div id="header_infos"><span>
|
||||
<div id="header">
|
||||
<div id="header_infos">
|
||||
<a id="header_shopname" href="index.php"><span>'.Configuration::get('PS_SHOP_NAME').'</span></a><div id="notifs_icon_wrapper">';
|
||||
if (Configuration::get('PS_SHOW_NEW_ORDERS') == 1)
|
||||
{
|
||||
@@ -219,12 +220,14 @@ echo ' var html = "";
|
||||
</div>';
|
||||
}
|
||||
echo '</div><span id="employee_links">
|
||||
<a href="index.php?controller=AdminEmployees&id_employee='.(int)Context::getContext()->employee->id.'&updateemployee&token='.Tools::getAdminTokenLite('AdminEmployees').'" class="employee" alt="">'.translate('My preferences').'</a>
|
||||
<span class="separator"></span>
|
||||
<span class="employee_name">
|
||||
'.Tools::substr(Context::getContext()->employee->firstname, 0, 1).'. '.htmlentities(Context::getContext()->employee->lastname, ENT_COMPAT, 'UTF-8').'
|
||||
[ <a href="index.php?logout" id="header_logout"><span>'.translate('logout').'</span></a> ]';
|
||||
</span><span class="separator"></span><a href="index.php?logout" id="header_logout"><span>'.translate('logout').'</span></a><span class="separator"></span>';
|
||||
if (Context::getContext()->shop->getBaseURL())
|
||||
echo '- <a href="'.Context::getContext()->shop->getBaseURL().'" id="header_foaccess" target="_blank" title="'.translate('View my shop').'"><span>'.translate('View my shop').'</span></a>';
|
||||
echo ' - <a href="index.php?controller=AdminEmployees&id_employee='.(int)Context::getContext()->employee->id.'&updateemployee&token='.Tools::getAdminTokenLite('AdminEmployees').'" style="font-size: 10px;"><img src="../img/admin/employee.gif" alt="" /> '.translate('My preferences').'</a>
|
||||
</span></div>
|
||||
echo '<a href="'.Context::getContext()->shop->getBaseURL().'" id="header_foaccess" target="_blank" title="'.translate('View my shop').'"><span>'.translate('View my shop').'</span></a>';
|
||||
echo '</span>
|
||||
<div id="header_search">
|
||||
<form method="post" action="index.php?controller=AdminSearch&token='.Tools::getAdminTokenLite('AdminSearch').'">
|
||||
<input type="text" name="bo_query" id="bo_query"
|
||||
@@ -271,15 +274,15 @@ echo ' </select>
|
||||
if (Shop::isFeatureActive())
|
||||
echo '<div id="header_shoplist">'.translate('Select your shop:').' '.generateShopList().'</div>';
|
||||
|
||||
echo '<div class="flatclear"> </div>';
|
||||
echo '</div>';
|
||||
echo Hook::exec('backOfficeTop');
|
||||
echo '<ul id="menu">';
|
||||
|
||||
if (empty($tab))
|
||||
echo '<div class="mainsubtablist" style="display:none"></div>';
|
||||
// This is made to display the subtab list
|
||||
$controllers = Dispatcher::getControllers(_PS_ADMIN_DIR_.'/tabs/');
|
||||
$id_current_tab = (int)Tab::getIdFromClassName($controllers[$tab]);
|
||||
$id_current_tab = (int)Tab::getIdFromClassName($tab);
|
||||
|
||||
$myCurrentTab = new Tab($id_current_tab);
|
||||
$tabs = Tab::getTabs(Context::getContext()->language->id, 0);
|
||||
$echoLis = '';
|
||||
@@ -292,42 +295,42 @@ foreach ($tabs AS $t)
|
||||
if (trim($t['module']) != '')
|
||||
$img = _MODULE_DIR_.$t['module'].'/'.$t['class_name'].'.gif';
|
||||
$current = ((strtolower($t['class_name']) == $tab) OR ($myCurrentTab->id_parent == $t['id_tab']));
|
||||
echo '<li class="submenu_size '.($current ? 'active' : '').'" id="maintab'.$t['id_tab'].'">
|
||||
<a href="index.php?controller='.$t['class_name'].'&token='.Tools::getAdminToken($t['class_name'].(int)($t['id_tab']).(int)Context::getContext()->employee->id).'">
|
||||
|
||||
echo '<li class="submenu_size '.($current ? 'active' : '').' maintab" id="maintab'.$t['id_tab'].'">
|
||||
<span class="title">
|
||||
<img src="'.$img.'" alt="" /> '.$t['name'].'
|
||||
</a>
|
||||
</li>';
|
||||
$echoLi = '';
|
||||
</span>
|
||||
<ul class="submenu">';
|
||||
$subTabs = Tab::getTabs(Context::getContext()->language->id, (int)$t['id_tab']);
|
||||
|
||||
// @todo need a better way than using noTabLink property, keeping the fact to avoid db modification
|
||||
if (!in_array($t['class_name'], $noTabLink))
|
||||
array_unshift($subTabs, $t);
|
||||
|
||||
foreach ($subTabs AS $t2)
|
||||
if (checkTabRights($t2['id_tab']) === true)
|
||||
$echoLi .= '<li><a href="index.php?controller='.$t2['class_name'].'&token='.Tools::getAdminTokenLite($t2['class_name']).'">'.$t2['name'].'</a></li>';
|
||||
echo '<li><a href="index.php?controller='.$t2['class_name'].'&token='.Tools::getAdminTokenLite($t2['class_name']).'">'.$t2['name'].'</a></li>';
|
||||
|
||||
echo '</ul></li>';
|
||||
$echoLi = '';
|
||||
foreach ($subTabs AS $t2)
|
||||
if (checkTabRights($t2['id_tab']) === true)
|
||||
$echoLi .= '<li class="subitem"><a href="index.php?controller='.$t2['class_name'].'&token='.Tools::getAdminTokenLite($t2['class_name']).'">'.$t2['name'].'</a></li>';
|
||||
|
||||
if ($current)
|
||||
$mainsubtablist = $echoLi;
|
||||
$echoLis .= '<div id="tab'.(int)($t['id_tab']).'_subtabs" style="display:none">'.$echoLi.'</div>';
|
||||
}
|
||||
echo ' </ul>'.$echoLis;
|
||||
if (Context::getContext()->employee->bo_uimode == 'hover')
|
||||
echo ' <script type="text/javascript">
|
||||
$("#menu li").hoverIntent({over:hoverTabs,timeout:100,out:outTabs});
|
||||
function outTabs(){}
|
||||
function hoverTabs() {
|
||||
var content = $("#tab"+parseInt(this.id.substr(7, 3))+"_subtabs").html();
|
||||
$("#submenu").html(content);
|
||||
if (content.length == 0)
|
||||
$("#submenu").removeClass("withLeftBorder");
|
||||
else
|
||||
$("#submenu").addClass("withLeftBorder");
|
||||
$("#menu li").removeClass("active");
|
||||
$(this).addClass("active");
|
||||
}
|
||||
</script>';
|
||||
echo ' <ul id="submenu" '.(strlen($mainsubtablist) ? 'class="withLeftBorder clearfix"' : '').'>'.$mainsubtablist.'</ul>
|
||||
<div id="main">
|
||||
|
||||
echo '
|
||||
</div>
|
||||
<div id="main">
|
||||
<div id="content">'
|
||||
.(file_exists(_PS_ADMIN_DIR_.'/../install') ? '<div style="background-color: #FFEBCC;border: 1px solid #F90;line-height: 20px;margin: 0px 0px 10px;padding: 10px 20px;">'
|
||||
.translate('For security reasons, you must also:').' '.
|
||||
translate('delete the /install folder').
|
||||
'</div>' : '').'
|
||||
';
|
||||
if(defined('_PS_MODE_DEV_') && _PS_MODE_DEV_)
|
||||
echo '<div class="warn">This tab is an AdminTab</div>';
|
||||
|
||||
+2
-2
@@ -38,7 +38,7 @@ if (!isset($_REQUEST['controller']) && isset($_REQUEST['tab']))
|
||||
$_REQUEST['controller'] = strtolower($_REQUEST['tab']);
|
||||
|
||||
// Prepare and trigger admin dispatcher
|
||||
Dispatcher::getInstance()->setDefaultController('adminhome');
|
||||
Dispatcher::getInstance()->setControllerNotFound('adminnotfound');
|
||||
Dispatcher::getInstance()->setDefaultController('AdminHome');
|
||||
Dispatcher::getInstance()->setControllerNotFound('AdminNotFound');
|
||||
Dispatcher::getInstance()->setControllerDirectories(array(_PS_ADMIN_DIR_.'/tabs/', _PS_ADMIN_CONTROLLER_DIR_));
|
||||
Dispatcher::getInstance()->dispatch();
|
||||
|
||||
+2
-7
@@ -39,14 +39,9 @@ if (isset($_GET['logout']))
|
||||
if (!isset($context->employee) || !$context->employee->isLoggedBack())
|
||||
Tools::redirectAdmin('login.php?redirect='.$_SERVER['REQUEST_URI']);
|
||||
|
||||
|
||||
// Set current index
|
||||
//$currentIndex = $_SERVER['SCRIPT_NAME'].(($tab = Tools::getValue('tab')) ? '?tab='.$tab : '');
|
||||
//if (empty($tab))
|
||||
//{
|
||||
$currentIndex = $_SERVER['SCRIPT_NAME'].(($controller = Tools::getValue('controller')) ? '?controller='.$controller: '');
|
||||
$tab = $controller;
|
||||
//}
|
||||
$currentIndex = $_SERVER['SCRIPT_NAME'].(($controller = Tools::getValue('controller')) ? '?controller='.$controller: '');
|
||||
|
||||
if ($back = Tools::getValue('back'))
|
||||
$currentIndex .= '&back='.urlencode($back);
|
||||
AdminTab::$currentIndex = $currentIndex;
|
||||
|
||||
@@ -239,79 +239,45 @@ $(document).ready(function()
|
||||
</select>
|
||||
</div>
|
||||
|
||||
{if $multi_shop}
|
||||
<div id="header_shoplist"><span>{l s='Select your shop:'}</span>{$shop_list}</div>
|
||||
{/if}
|
||||
{$HOOK_TOP}
|
||||
</div>
|
||||
<ul id="menu">
|
||||
{if !$tab}
|
||||
<div class="mainsubtablist" style="display:none">
|
||||
</div>
|
||||
{/if}
|
||||
{foreach $tabs AS $t}
|
||||
<li class="submenu_size maintab {if $t.current}active{/if}" id="maintab{$t.id_tab}">
|
||||
<span class="title">
|
||||
<img src="{$t.img}" alt="" />{$t.name}
|
||||
</span>
|
||||
<ul class="submenu">
|
||||
{foreach from=$t.sub_tabs item=t2}
|
||||
<li><a href="{$t2.href}">{$t2.name}</a></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{foreach $tabs AS $t}
|
||||
<div id="tab{$t.id_tab}_subtabs" style="display:none">
|
||||
{foreach $t.sub_tabs AS $t2}
|
||||
<li class="subitem" ><a href="{$t2.href}">{$t2.name}</a></li>
|
||||
{/foreach}
|
||||
<div class="flatclear"> </div>
|
||||
</div>
|
||||
{if $multi_shop}
|
||||
<div id="header_shoplist"><span>{l s='Select your shop:'}</span>{$shop_list}</div>
|
||||
{/if}
|
||||
{$HOOK_TOP}
|
||||
</div>
|
||||
<ul id="menu">
|
||||
{if !$tab}
|
||||
<div class="mainsubtablist" style="display:none">
|
||||
</div>
|
||||
{/if}
|
||||
{foreach $tabs AS $t}
|
||||
<li class="submenu_size maintab {if $t.current}active{/if}" id="maintab{$t.id_tab}">
|
||||
<span class="title">
|
||||
<img src="{$t.img}" alt="" />{$t.name}
|
||||
</span>
|
||||
<ul class="submenu">
|
||||
{foreach from=$t.sub_tabs item=t2}
|
||||
<li><a href="{$t2.href}">{$t2.name}</a></li>
|
||||
{/foreach}
|
||||
{* @todo : handle bo_uimode == hover / not hover ?
|
||||
{if $employee->bo_uimode == 'hover'}
|
||||
<script type="text/javascript">
|
||||
$("#menu li").hoverIntent( { over:hoverTabs,timeout:100,out:outTabs } );
|
||||
function outTabs(){}
|
||||
function hoverTabs() {
|
||||
var content = $("#tab"+parseInt(this.id.substr(7, 3))+"_subtabs").html();
|
||||
$("#submenu").html(content);
|
||||
if (content.length == 0)
|
||||
$("#submenu").removeClass("withLeftBorder");
|
||||
else
|
||||
$("#submenu").addClass("withLeftBorder");
|
||||
$("#menu li").removeClass("active");
|
||||
$(this).addClass("active");
|
||||
}
|
||||
</script>
|
||||
{/if}
|
||||
<ul id="submenu" {if isset($mainsubtab)}class="withLeftBorder clearfix"{/if}>
|
||||
{if isset($mainsubtab)}
|
||||
{foreach $mainsubtab.sub_tabs AS $t}
|
||||
<li>
|
||||
<a href="{$t.href}">{$t.name}</a></li>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</ul>
|
||||
*}
|
||||
</div> {* end header *}
|
||||
</ul>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div> {* end header *}
|
||||
{/if}
|
||||
<div id="main">
|
||||
<div id="content">
|
||||
{if $install_dir_exists}
|
||||
<div style="background-color: #FFEBCC;border: 1px solid #F90;line-height: 20px;margin: 0px 0px 10px;padding: 10px 20px;">
|
||||
{l s='For security reasons, you must also:'} {l s='delete the /install folder'}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{if $is_multishop && $shop_context != 'all'}
|
||||
<div class="multishop_info">
|
||||
{if $shop_context == 'group'}
|
||||
{l s='You are configuring your store for group shop '}<b>{$shop_name}</b>
|
||||
{elseif $shop_context == 'shop'}
|
||||
{l s='You are configuring your store for shop '}<b>{$shop_name}</b>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
<div id="main">
|
||||
<div id="content">
|
||||
{if $install_dir_exists}
|
||||
<div style="background-color: #FFEBCC;border: 1px solid #F90;line-height: 20px;margin: 0px 0px 10px;padding: 10px 20px;">
|
||||
{l s='For security reasons, you must also:'} {l s='delete the /install folder'}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{if $is_multishop && $shop_context != 'all'}
|
||||
<div class="multishop_info">
|
||||
{if $shop_context == 'group'}
|
||||
{l s='You are configuring your store for group shop '}<b>{$shop_name}</b>
|
||||
{elseif $shop_context == 'shop'}
|
||||
{l s='You are configuring your store for shop '}<b>{$shop_name}</b>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
{include file='header.tpl'}
|
||||
{if isset($conf)}
|
||||
<div class="conf">
|
||||
<img src="../img/admin/ok2.png" alt="" />{$conf}
|
||||
{$conf}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
<span style="float:right">
|
||||
<a id="hideError" href="#"><img alt="X" src="../img/admin/close.png" /></a>
|
||||
</span>
|
||||
<img src="../img/admin/error2.png" />
|
||||
{if count($errors) == 1}
|
||||
{$errors[0]}
|
||||
{else}
|
||||
@@ -71,7 +70,6 @@
|
||||
<span style="float:right">
|
||||
<a id="hideWarn" href=""><img alt="X" src="../img/admin/close.png" /></a>
|
||||
</span>
|
||||
<img src="../img/admin/warn2.png" />
|
||||
{if count($warnings) > 1}
|
||||
{l s='There are'} {count($warnings)} {l s='warnings'}
|
||||
{else}
|
||||
|
||||
Reference in New Issue
Block a user