// #PSFV-94 - fixed bug related to new breadcrumb system

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9881 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
mMarinetti
2011-11-04 10:59:10 +00:00
parent a1c8dec437
commit 845d741024
8 changed files with 51 additions and 47 deletions
-13
View File
@@ -306,19 +306,6 @@ $(document).ready(function()
</div> </div>
{/if} {/if}
{* We should display breadcrumb only if needed *}
{if count($tabs_breadcrumb)>1}
<div class="path_bar">
<div id="help-button" class="floatr" style="display: none; font-family: Verdana; font-size: 10px; margin-right: 4px; margin-top: 4px;"></div>
<a href="?token={$home_token}">{l s='Back Office'}</a>
{foreach $tabs_breadcrumb AS $item}
<img src="../img/admin/separator_breadcrum.png" style="margin-right:5px" alt="&gt;" />
{if isset($item.token)}<a href="?controller={$item.class_name}&token={$item.token}">{/if}
{$item.name}
{if isset($item.token)}</a>{/if}
{/foreach}
</div>
{/if}
{if $is_multishop && $shop_context != 'all'} {if $is_multishop && $shop_context != 'all'}
<div class="multishop_info"> <div class="multishop_info">
{if $shop_context == 'group'} {if $shop_context == 'group'}
@@ -56,17 +56,20 @@
}); });
</script> </script>
{if $show_toolbar}
<div class="pageTitle">
<h3>{block name=pageTitle}
<span id="current_obj" style="font-weight: normal;">{$page_title|default:'&nbsp;'}</span>
{/block}</h3>
</div>
{include file="toolbar.tpl" toolbar_btn=$toolbar_btn}
{/if}
{/if}{* End if simple_header *} {/if}{* End if simple_header *}
{if $show_toolbar}
<div class="toolbarBox">
{include file="toolbar.tpl" toolbar_btn=$toolbar_btn}
<div class="pageTitle">
<h3>{block name=pageTitle}
<span id="current_obj" style="font-weight: normal;">{$title|default:'&nbsp;'}</span>
{/block}</h3>
</div>
</div>
{/if}
{block name="leadin"}{/block}
<a name="{$table}">&nbsp;</a> <a name="{$table}">&nbsp;</a>
<form method="post" action="{$action}" class="form"> <form method="post" action="{$action}" class="form">
-7
View File
@@ -24,7 +24,6 @@
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*} *}
<div class="toolbarBox">
{block name=toolbarBox} {block name=toolbarBox}
<ul class="cc_button"> <ul class="cc_button">
{foreach from=$toolbar_btn item=btn key=k} {foreach from=$toolbar_btn item=btn key=k}
@@ -36,11 +35,6 @@
</li> </li>
{/foreach} {/foreach}
</ul> </ul>
<div class="pageTitle">
<h3>{block name=pageTitle}
<span id="current_obj" style="font-weight: normal;">{$title|default:'&nbsp;'}</span>
{/block}</h3>
</div>
<script language="javascript"> <script language="javascript">
$(function() { $(function() {
//get reference on save link //get reference on save link
@@ -70,4 +64,3 @@
}); });
</script> </script>
{/block} {/block}
</div>
+24 -14
View File
@@ -262,6 +262,27 @@ class AdminControllerCore extends Controller
$this->context->currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); $this->context->currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
} }
/**
* set default toolbar_title to admin breadcrumb
*
* @return void
*/
public function initToolbarTitle()
{
// Breadcrumbs
$tabs= array();
$tabs= Tab::recursiveTab($this->id, $tabs);
$tabs= array_reverse($tabs);
$bread = '';
// note : this should use a tpl file
foreach ($tabs AS $key => $item)
$bread .= '<span class="breadcrumb item-'.$key.' ">'.$item['name'].'</span> : ';
$bread = rtrim($bread, ': ');
$this->toolbar_title = $bread;
}
/** /**
* Check rights to view the current tab * Check rights to view the current tab
* *
@@ -1014,18 +1035,6 @@ class AdminControllerCore extends Controller
else else
unset($tabs[$index]); unset($tabs[$index]);
} }
// Breadcrumbs
$home_token = Tools::getAdminToken('AdminHome'.intval(Tab::getIdFromClassName('AdminHome')).(int)$this->context->employee->id);
$tabs_breadcrumb = array();
$tabs_breadcrumb = Tab::recursiveTab($this->id, $tabs_breadcrumb);
$tabs_breadcrumb = array_reverse($tabs_breadcrumb);
foreach ($tabs_breadcrumb as $key => $item)
{
$tabs_count = count($tabs_breadcrumb) - 1;
for ($i = 0; $i < $tabs_count; $i++)
$tabs_breadcrumb[$key]['token'] = Tools::getAdminToken($item['class_name'].intval($item['id_tab']).(int)$this->context->employee->id);
}
/* Hooks are volontary out the initialize array (need those variables already assigned) */ /* Hooks are volontary out the initialize array (need those variables already assigned) */
$bo_color = empty($this->context->employee->bo_color) ? '#FFFFFF' : $this->context->employee->bo_color; $bo_color = empty($this->context->employee->bo_color) ? '#FFFFFF' : $this->context->employee->bo_color;
@@ -1066,8 +1075,6 @@ class AdminControllerCore extends Controller
'current_parent_id' => (int)Tab::getCurrentParentId(), 'current_parent_id' => (int)Tab::getCurrentParentId(),
'tabs' => $tabs, 'tabs' => $tabs,
'install_dir_exists' => file_exists(_PS_ADMIN_DIR_.'/../install'), 'install_dir_exists' => file_exists(_PS_ADMIN_DIR_.'/../install'),
'home_token' => $home_token,
'tabs_breadcrumb' => $tabs_breadcrumb,
'is_multishop' => $is_multishop, 'is_multishop' => $is_multishop,
'pic_dir' => _THEME_PROD_PIC_DIR_ 'pic_dir' => _THEME_PROD_PIC_DIR_
)); ));
@@ -1185,6 +1192,7 @@ class AdminControllerCore extends Controller
$this->actions[] = $action; $this->actions[] = $action;
} }
$helper->tpl_vars = $this->tpl_list_vars;
$this->setHelperListDisplay($helper); $this->setHelperListDisplay($helper);
return $helper->generateList($this->_list, $this->fieldsDisplay); return $helper->generateList($this->_list, $this->fieldsDisplay);
} }
@@ -1204,6 +1212,8 @@ class AdminControllerCore extends Controller
*/ */
public function setHelperListDisplay(Helper $helper) public function setHelperListDisplay(Helper $helper)
{ {
if (empty($this->toolbar_title))
$this->initToolbarTitle();
// @todo : move that in Helper // @todo : move that in Helper
$helper->actions = $this->actions; $helper->actions = $this->actions;
$helper->simple_header = $this->list_simple_header; $helper->simple_header = $this->list_simple_header;
+9
View File
@@ -344,6 +344,7 @@ class HelperListCore extends Helper
'has_actions' => !empty($this->actions), 'has_actions' => !empty($this->actions),
'has_bulk_actions' => !empty($this->bulk_actions), 'has_bulk_actions' => !empty($this->bulk_actions),
'list_skip_actions' => $this->list_skip_actions, 'list_skip_actions' => $this->list_skip_actions,
'tpl_vars' => $this->tpl_vars
)); ));
return $this->content_tpl->fetch(); return $this->content_tpl->fetch();
} }
@@ -593,6 +594,10 @@ class HelperListCore extends Helper
'name' => isset($name) ? $name : null, 'name' => isset($name) ? $name : null,
'name_id' => isset($name_id) ? $name_id : null, 'name_id' => isset($name_id) ? $name_id : null,
'show_toolbar' => $this->show_toolbar, 'show_toolbar' => $this->show_toolbar,
'back' => Tools::getValue('back'),
'no_back' => $this->no_back,
'tpl_vars' => $this->tpl_vars,
)); ));
return $this->header_tpl->fetch(); return $this->header_tpl->fetch();
@@ -609,6 +614,10 @@ class HelperListCore extends Helper
'current' => $this->currentIndex, 'current' => $this->currentIndex,
'simple_header' => $this->simple_header, 'simple_header' => $this->simple_header,
'bulk_actions' => $this->bulk_actions, 'bulk_actions' => $this->bulk_actions,
'back' => Tools::getValue('back'),
'no_back' => $this->no_back,
'tpl_vars' =>$this->tpl_vars
)); ));
return $this->footer_tpl->fetch(); return $this->footer_tpl->fetch();
} }
@@ -103,8 +103,9 @@ class AdminCategoriesControllerCore extends AdminController
$categories_tree = $this->_category->getParentsCategories($this->context->language->id); $categories_tree = $this->_category->getParentsCategories($this->context->language->id);
asort($categories_tree); asort($categories_tree);
$this->context->smarty->assign('categories_name', stripslashes($this->_category->getName())); $categories_name = stripslashes($this->_category->getName());
$this->context->smarty->assign('categories_tree', $categories_tree); $this->tpl_list_vars['categories_tree'] = $categories_tree;
$this->tpl_list_vars['categories_name'] = $categories_name;
return parent::initList(); return parent::initList();
} }
@@ -129,7 +130,7 @@ class AdminCategoriesControllerCore extends AdminController
public function initToolbar() public function initToolbar()
{ {
$this->toolbar_title = stripslashes($this->_category->getName()); // $this->toolbar_title = stripslashes($this->_category->getName());
if (empty($this->display)) if (empty($this->display))
$this->toolbar_btn['new'] = array( $this->toolbar_btn['new'] = array(
'href' => self::$currentIndex.'&amp;add'.$this->table.'&amp;token='.$this->token, 'href' => self::$currentIndex.'&amp;add'.$this->table.'&amp;token='.$this->token,
@@ -88,7 +88,6 @@ class AdminManufacturersControllerCore extends AdminController
public function initListManufacturer() public function initListManufacturer()
{ {
$this->toolbar_title = $this->l('List of manufacturers:');
$this->addRowAction('view'); $this->addRowAction('view');
$this->addRowAction('edit'); $this->addRowAction('edit');
$this->addRowAction('delete'); $this->addRowAction('delete');
@@ -113,7 +112,7 @@ class AdminManufacturersControllerCore extends AdminController
{ {
$this->toolbar_title = $this->l('Manufacturers addresses:'); $this->toolbar_title = $this->l('Addresses');
// reset actions and query vars // reset actions and query vars
$this->actions = array(); $this->actions = array();
unset($this->fieldsDisplay, $this->_select, $this->_join, $this->_group, $this->_filterHaving, $this->_filter); unset($this->fieldsDisplay, $this->_select, $this->_join, $this->_group, $this->_filterHaving, $this->_filter);
@@ -201,6 +201,7 @@ class AdminSearchControllerCore extends AdminController
protected function initProductList() protected function initProductList()
{ {
$this->show_toolbar = false;
$this->fieldsDisplay['products'] = (array( $this->fieldsDisplay['products'] = (array(
'id_product' => array('title' => $this->l('ID')), 'id_product' => array('title' => $this->l('ID')),
'manufacturer_name' => array('title' => $this->l('Manufacturer'), 'align' => 'center'), 'manufacturer_name' => array('title' => $this->l('Manufacturer'), 'align' => 'center'),
@@ -245,6 +246,7 @@ class AdminSearchControllerCore extends AdminController
$this->initProductList(); $this->initProductList();
$helper->identifier = 'id_product'; $helper->identifier = 'id_product';
$helper->actions = array('edit', 'view'); $helper->actions = array('edit', 'view');
$helper->show_toolbar = false;
if ($this->_list['products']) if ($this->_list['products'])
$view = $helper->generateList($this->_list['products'], $this->fieldsDisplay['products']); $view = $helper->generateList($this->_list['products'], $this->fieldsDisplay['products']);
$this->context->smarty->assign('products', $view); $this->context->smarty->assign('products', $view);