// fix displaying subtabs link,
// fix adminHome links git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8892 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -53,54 +53,52 @@ $(document).ready(function() {
|
||||
|
||||
<div id="column_right">
|
||||
{$tips_optimization}
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$.ajax({
|
||||
url: "ajax-tab.php",
|
||||
type: "POST",
|
||||
data:{
|
||||
token: "{$token}",
|
||||
ajax: "1",
|
||||
controller : "AdminHome",
|
||||
action: "getAdminHomeElement"
|
||||
},
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
|
||||
if (json.screencast != 'NOK')
|
||||
$('#adminpresentation').fadeIn('slow');
|
||||
else
|
||||
$('#adminpresentation').fadeOut('slow');
|
||||
|
||||
$('#partner_preactivation').fadeOut('slow', function() {
|
||||
if (json.partner_preactivation != 'NOK')
|
||||
$('#partner_preactivation').html(json.partner_preactivation);
|
||||
else
|
||||
$('#partner_preactivation').html('');
|
||||
$('#partner_preactivation').fadeIn('slow');
|
||||
});
|
||||
|
||||
$('#discover_prestashop').fadeOut('slow', function() {
|
||||
if (json.discover_prestashop != 'NOK')
|
||||
$('#discover_prestashop').html(json.discover_prestashop);
|
||||
else
|
||||
$('#discover_prestashop').html('');
|
||||
$('#discover_prestashop').fadeIn('slow');
|
||||
});
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown)
|
||||
{
|
||||
$('#adminpresentation').fadeOut('slow');
|
||||
$('#partner_preactivation').fadeOut('slow');
|
||||
$('#discover_prestashop').fadeOut('slow');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<div id="partner_preactivation">
|
||||
<p class="center"><img src="../img/loader.gif" alt="" />{l s='Loading...'}</p>
|
||||
<div id="partner_preactivation"><p class="center"><img src="../img/loader.gif" alt="" />{l s='Loading...'}</p></div>
|
||||
<div id="discover_prestashop"><p class="center"><img src="../img/loader.gif" alt="" />{l s='Loading...'}</p></div>
|
||||
</div>
|
||||
{$discover_prestashop}
|
||||
<div class="clear"></div>
|
||||
{$HOOK_BACKOFFICEHOME}
|
||||
</div>
|
||||
<div class="clear"> </div>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$.ajax({
|
||||
url: "ajax-tab.php",
|
||||
type: "POST",
|
||||
data:{
|
||||
token: "{$token}",
|
||||
ajax: "1",
|
||||
controller : "AdminHome",
|
||||
action: "getAdminHomeElement"
|
||||
},
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
|
||||
if (json.screencast != 'NOK')
|
||||
$('#adminpresentation').fadeIn('slow');
|
||||
else
|
||||
$('#adminpresentation').fadeOut('slow');
|
||||
|
||||
$('#partner_preactivation').fadeOut('slow', function() {
|
||||
if (json.partner_preactivation != 'NOK')
|
||||
$('#partner_preactivation').html(json.partner_preactivation);
|
||||
else
|
||||
$('#partner_preactivation').html('');
|
||||
$('#partner_preactivation').fadeIn('slow');
|
||||
});
|
||||
|
||||
$('#discover_prestashop').fadeOut('slow', function() {
|
||||
if (json.discover_prestashop != 'NOK')
|
||||
$('#discover_prestashop').html(json.discover_prestashop);
|
||||
else
|
||||
$('#discover_prestashop').html('');
|
||||
$('#discover_prestashop').fadeIn('slow');
|
||||
});
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown)
|
||||
{
|
||||
$('#adminpresentation').fadeOut('slow');
|
||||
$('#partner_preactivation').fadeOut('slow');
|
||||
$('#discover_prestashop').fadeOut('slow');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -255,7 +255,7 @@
|
||||
{/foreach}
|
||||
</div>
|
||||
{/if}
|
||||
{if $is_multishop}
|
||||
{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>
|
||||
|
||||
+20
-18
@@ -84,6 +84,18 @@ class AdminControllerCore extends Controller
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
// retro-compatibility : className for admin without controller
|
||||
// This can be overriden in controllers (like for AdminCategories or AdminProducts
|
||||
$controller = get_class($this);
|
||||
// @todo : move this in class AdminCategoriesController and AdminProductsController
|
||||
if ($controller == 'AdminCategoriesController' && $controller == 'AdminProductsController')
|
||||
$controller = 'AdminCatalogController';
|
||||
|
||||
// temporary fix for Token retrocompatibility
|
||||
// This has to be done when url is built instead of here)
|
||||
if(strpos($controller,'Controller'))
|
||||
$controller = substr($controller,0,-10);
|
||||
|
||||
parent::__construct();
|
||||
// if this->template is empty,
|
||||
// generate the filename from the classname, without "Controller" suffix
|
||||
@@ -95,6 +107,9 @@ class AdminControllerCore extends Controller
|
||||
$this->template = $tpl_name;
|
||||
}
|
||||
|
||||
$this->id = Tab::getIdFromClassName($controller);
|
||||
$this->token = Tools::getAdminToken($controller.(int)$this->id.(int)$this->context->employee->id);
|
||||
|
||||
$this->_conf = array(
|
||||
1 => $this->l('Deletion successful'), 2 => $this->l('Selection successfully deleted'),
|
||||
3 => $this->l('Creation successful'), 4 => $this->l('Update successful'),
|
||||
@@ -112,21 +127,8 @@ class AdminControllerCore extends Controller
|
||||
);
|
||||
if (!$this->identifier) $this->identifier = 'id_'.$this->table;
|
||||
if (!$this->_defaultOrderBy) $this->_defaultOrderBy = $this->identifier;
|
||||
$className = get_class($this);
|
||||
// temporary fix for Token retrocompatibility
|
||||
// This has to be done when url is built instead of here)
|
||||
if(strpos($className,'Controller'))
|
||||
$className = substr($className,0,-10);
|
||||
|
||||
if ($className == 'AdminCategories' OR $className == 'AdminProducts')
|
||||
$className = 'AdminCatalog';
|
||||
|
||||
$this->className = $className;
|
||||
$this->id = Tab::getIdFromClassName($className);
|
||||
$this->token = Tools::getAdminToken($className.(int)$this->id.(int)$this->context->employee->id);
|
||||
|
||||
// Fix for AdminHome
|
||||
if ($className == 'AdminHome')
|
||||
if ($controller == 'AdminHome')
|
||||
$_POST['token'] = $this->token;
|
||||
|
||||
if (!Shop::isMultiShopActivated())
|
||||
@@ -676,17 +678,17 @@ class AdminControllerCore extends Controller
|
||||
if (trim($tab['module']) != '')
|
||||
$img = _MODULE_DIR_.$tab['module'].'/'.$tab['class_name'].'.gif';
|
||||
|
||||
$tabs[$index]['current'] = ($tab['class_name'] == $this->className) || (Tab::getCurrentParentId() == $tab['id_tab']);
|
||||
// tab[class_name] does not contains the "Controller" suffix
|
||||
$tabs[$index]['current'] = ($tab['class_name'].'Controller' == get_class($this)) || (Tab::getCurrentParentId() == $tab['id_tab']);
|
||||
$tabs[$index]['img'] = $img;
|
||||
$tabs[$index]['token'] = Tools::getAdminToken($tab['class_name'].(int)($tab['id_tab']).(int)$this->context->employee->id);
|
||||
|
||||
$sub_tabs = Tab::getTabs($this->context->language->id, $tab['id_tab']);
|
||||
foreach ($sub_tabs AS $index2 => $sub_tab)
|
||||
{
|
||||
// class_name is the name of the class controller
|
||||
if (Tab::checkTabRights($sub_tab) === true)
|
||||
{
|
||||
$sub_tabs[$index2]['token'] = Tools::getAdminTokenLite($sub_tab['class_name']);
|
||||
}
|
||||
$sub_tabs[$index2]['href'] = $this->context->link->getAdminLink($sub_tab['class_name']);
|
||||
else
|
||||
unset($sub_tabs[$index2]);
|
||||
}
|
||||
|
||||
@@ -171,25 +171,25 @@ class AdminHomeControllerCore extends AdminController
|
||||
private function getQuickLinks()
|
||||
{
|
||||
$quick_links['first'] = array(
|
||||
'href' => 'index.php?controller=AdminCatalog&addcategory&token='.Tools::getAdminTokenLite('AdminCatalog'),
|
||||
'href' => $this->context->link->getAdminLink('AdminCatalog').'&addcategory',
|
||||
'title' => $this->l('New category'),
|
||||
'description' => $this->l('Create a new category and organize your products.'),
|
||||
);
|
||||
|
||||
$quick_links['second'] = array(
|
||||
'href' => 'index.php?controller=AdminCatalog&addproduct&token='.Tools::getAdminTokenLite('AdminCatalog'),
|
||||
'href' => $this->context->link->getAdminLink('AdminCatalog').'&addproduct',
|
||||
'title' => $this->l('New product'),
|
||||
'description' => $this->l('Fill up your catalog with new articles and attributes.'),
|
||||
);
|
||||
|
||||
$quick_links['third'] = array(
|
||||
'href' => 'index.php?controller=AdminStats&addproduct&token='.Tools::getAdminTokenLite('AdminStats'),
|
||||
'href' => $this->context->link->getAdminLink('AdminStats'),
|
||||
'title' => $this->l('Statistics'),
|
||||
'description' => $this->l('Manage your activity with a thorough analysis of your e-shop.'),
|
||||
);
|
||||
|
||||
$quick_links['fourth'] = array(
|
||||
'href' => 'index.php?controller=AdminEmployee&addproduct&token='.Tools::getAdminTokenLite('AdminEmployee'),
|
||||
'href' => $this->context->link->getAdminLink('AdminEmployees').'&addemployee',
|
||||
'title' => $this->l('New employee'),
|
||||
'description' => $this->l('Add a new employee account and discharge a part of your duties of shop owner.'),
|
||||
);
|
||||
@@ -493,7 +493,7 @@ class AdminHomeControllerCore extends AdminController
|
||||
return ''; // NOK
|
||||
}
|
||||
}
|
||||
public function display()
|
||||
public function initContent()
|
||||
{
|
||||
$smarty = $this->context->smarty;
|
||||
$smarty->assign('token',$this->token);
|
||||
@@ -515,29 +515,16 @@ class AdminHomeControllerCore extends AdminController
|
||||
$smarty->assign('upgrade', $upgrade);
|
||||
|
||||
$smarty->assign('show_screencast', $this->context->employee->show_screencast);
|
||||
|
||||
$smarty->assign('quick_links', $this->getQuickLinks());
|
||||
|
||||
$smarty->assign('monthly_statistics', $this->getMonthlyStatistics());
|
||||
|
||||
$smarty->assign('customers_service', $this->getCustomersService());
|
||||
|
||||
$smarty->assign('stats_sales', $this->getStatsSales());
|
||||
|
||||
$smarty->assign('last_orders',$this->getLastOrders());
|
||||
|
||||
$smarty->assign('tips_optimization', $this->_displayOptimizationTips());
|
||||
|
||||
$discover_prestashop = '<div id="discover_prestashop">
|
||||
<p class="center"><img src="../img/loader.gif" alt="" /> '.$this->l('Loading...').'</p>
|
||||
</div>
|
||||
</div>';
|
||||
$smarty->assign('discover_prestashop', $discover_prestashop);
|
||||
|
||||
$HOOK_BACKOFFICEHOME = Module::hookExec('backOfficeHome');
|
||||
$smarty->assign('HOOK_BACKOFFICEHOME', $HOOK_BACKOFFICEHOME);
|
||||
|
||||
parent::display();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user