// 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:
mMarinetti
2011-09-29 16:02:26 +00:00
parent 117583a0d0
commit e8ff5b025f
4 changed files with 73 additions and 86 deletions
+47 -49
View File
@@ -53,54 +53,52 @@ $(document).ready(function() {
<div id="column_right"> <div id="column_right">
{$tips_optimization} {$tips_optimization}
<script type="text/javascript"> <div id="partner_preactivation"><p class="center"><img src="../img/loader.gif" alt="" />{l s='Loading...'}</p></div>
$(document).ready(function() { <div id="discover_prestashop"><p class="center"><img src="../img/loader.gif" alt="" />{l s='Loading...'}</p></div>
$.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> </div>
{$discover_prestashop}
<div class="clear"></div>
{$HOOK_BACKOFFICEHOME} {$HOOK_BACKOFFICEHOME}
</div> <div class="clear">&nbsp;</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>
+1 -1
View File
@@ -255,7 +255,7 @@
{/foreach} {/foreach}
</div> </div>
{/if} {/if}
{if $is_multishop} {if $is_multishop && $shop_context != 'all'}
<div class="multishop_info"> <div class="multishop_info">
{if $shop_context == 'group'} {if $shop_context == 'group'}
{l s='You are configuring your store for group shop '}<b>{$shop_name}</b> {l s='You are configuring your store for group shop '}<b>{$shop_name}</b>
+20 -18
View File
@@ -84,6 +84,18 @@ class AdminControllerCore extends Controller
public function __construct() 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(); parent::__construct();
// if this->template is empty, // if this->template is empty,
// generate the filename from the classname, without "Controller" suffix // generate the filename from the classname, without "Controller" suffix
@@ -95,6 +107,9 @@ class AdminControllerCore extends Controller
$this->template = $tpl_name; $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( $this->_conf = array(
1 => $this->l('Deletion successful'), 2 => $this->l('Selection successfully deleted'), 1 => $this->l('Deletion successful'), 2 => $this->l('Selection successfully deleted'),
3 => $this->l('Creation successful'), 4 => $this->l('Update successful'), 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->identifier) $this->identifier = 'id_'.$this->table;
if (!$this->_defaultOrderBy) $this->_defaultOrderBy = $this->identifier; 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 // Fix for AdminHome
if ($className == 'AdminHome') if ($controller == 'AdminHome')
$_POST['token'] = $this->token; $_POST['token'] = $this->token;
if (!Shop::isMultiShopActivated()) if (!Shop::isMultiShopActivated())
@@ -676,17 +678,17 @@ class AdminControllerCore extends Controller
if (trim($tab['module']) != '') if (trim($tab['module']) != '')
$img = _MODULE_DIR_.$tab['module'].'/'.$tab['class_name'].'.gif'; $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]['img'] = $img;
$tabs[$index]['token'] = Tools::getAdminToken($tab['class_name'].(int)($tab['id_tab']).(int)$this->context->employee->id); $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']); $sub_tabs = Tab::getTabs($this->context->language->id, $tab['id_tab']);
foreach ($sub_tabs AS $index2 => $sub_tab) foreach ($sub_tabs AS $index2 => $sub_tab)
{ {
// class_name is the name of the class controller
if (Tab::checkTabRights($sub_tab) === true) if (Tab::checkTabRights($sub_tab) === true)
{ $sub_tabs[$index2]['href'] = $this->context->link->getAdminLink($sub_tab['class_name']);
$sub_tabs[$index2]['token'] = Tools::getAdminTokenLite($sub_tab['class_name']);
}
else else
unset($sub_tabs[$index2]); unset($sub_tabs[$index2]);
} }
+5 -18
View File
@@ -171,25 +171,25 @@ class AdminHomeControllerCore extends AdminController
private function getQuickLinks() private function getQuickLinks()
{ {
$quick_links['first'] = array( $quick_links['first'] = array(
'href' => 'index.php?controller=AdminCatalog&amp;addcategory&amp;token='.Tools::getAdminTokenLite('AdminCatalog'), 'href' => $this->context->link->getAdminLink('AdminCatalog').'&amp;addcategory',
'title' => $this->l('New category'), 'title' => $this->l('New category'),
'description' => $this->l('Create a new category and organize your products.'), 'description' => $this->l('Create a new category and organize your products.'),
); );
$quick_links['second'] = array( $quick_links['second'] = array(
'href' => 'index.php?controller=AdminCatalog&amp;addproduct&amp;token='.Tools::getAdminTokenLite('AdminCatalog'), 'href' => $this->context->link->getAdminLink('AdminCatalog').'&amp;addproduct',
'title' => $this->l('New product'), 'title' => $this->l('New product'),
'description' => $this->l('Fill up your catalog with new articles and attributes.'), 'description' => $this->l('Fill up your catalog with new articles and attributes.'),
); );
$quick_links['third'] = array( $quick_links['third'] = array(
'href' => 'index.php?controller=AdminStats&amp;addproduct&amp;token='.Tools::getAdminTokenLite('AdminStats'), 'href' => $this->context->link->getAdminLink('AdminStats'),
'title' => $this->l('Statistics'), 'title' => $this->l('Statistics'),
'description' => $this->l('Manage your activity with a thorough analysis of your e-shop.'), 'description' => $this->l('Manage your activity with a thorough analysis of your e-shop.'),
); );
$quick_links['fourth'] = array( $quick_links['fourth'] = array(
'href' => 'index.php?controller=AdminEmployee&amp;addproduct&amp;token='.Tools::getAdminTokenLite('AdminEmployee'), 'href' => $this->context->link->getAdminLink('AdminEmployees').'&amp;addemployee',
'title' => $this->l('New employee'), 'title' => $this->l('New employee'),
'description' => $this->l('Add a new employee account and discharge a part of your duties of shop owner.'), '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 return ''; // NOK
} }
} }
public function display() public function initContent()
{ {
$smarty = $this->context->smarty; $smarty = $this->context->smarty;
$smarty->assign('token',$this->token); $smarty->assign('token',$this->token);
@@ -515,29 +515,16 @@ class AdminHomeControllerCore extends AdminController
$smarty->assign('upgrade', $upgrade); $smarty->assign('upgrade', $upgrade);
$smarty->assign('show_screencast', $this->context->employee->show_screencast); $smarty->assign('show_screencast', $this->context->employee->show_screencast);
$smarty->assign('quick_links', $this->getQuickLinks()); $smarty->assign('quick_links', $this->getQuickLinks());
$smarty->assign('monthly_statistics', $this->getMonthlyStatistics()); $smarty->assign('monthly_statistics', $this->getMonthlyStatistics());
$smarty->assign('customers_service', $this->getCustomersService()); $smarty->assign('customers_service', $this->getCustomersService());
$smarty->assign('stats_sales', $this->getStatsSales()); $smarty->assign('stats_sales', $this->getStatsSales());
$smarty->assign('last_orders',$this->getLastOrders()); $smarty->assign('last_orders',$this->getLastOrders());
$smarty->assign('tips_optimization', $this->_displayOptimizationTips()); $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'); $HOOK_BACKOFFICEHOME = Module::hookExec('backOfficeHome');
$smarty->assign('HOOK_BACKOFFICEHOME', $HOOK_BACKOFFICEHOME); $smarty->assign('HOOK_BACKOFFICEHOME', $HOOK_BACKOFFICEHOME);
parent::display();
} }
} }