From edb2da2600a95ee0aa2c68abc8940bc8c0b71687 Mon Sep 17 00:00:00 2001 From: lLefevre Date: Mon, 7 Nov 2011 09:12:51 +0000 Subject: [PATCH] // fix update view.tpl in AdminManufacturersController git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9915 b9a71923-0436-4b27-9f14-aed3839534dd --- .../template/manufacturers/form_addresses.tpl | 38 ----- .../list_action_edit_adresses.tpl | 27 ---- .../themes/template/manufacturers/view.tpl | 149 +++++++++--------- classes/AdminController.php | 10 +- .../admin/AdminManufacturersController.php | 79 ++++++---- 5 files changed, 127 insertions(+), 176 deletions(-) delete mode 100644 admin-dev/themes/template/manufacturers/form_addresses.tpl delete mode 100644 admin-dev/themes/template/manufacturers/list_action_edit_adresses.tpl diff --git a/admin-dev/themes/template/manufacturers/form_addresses.tpl b/admin-dev/themes/template/manufacturers/form_addresses.tpl deleted file mode 100644 index 0cf6c8493..000000000 --- a/admin-dev/themes/template/manufacturers/form_addresses.tpl +++ /dev/null @@ -1,38 +0,0 @@ -{* -* 2007-2011 PrestaShop -* -* NOTICE OF LICENSE -* -* This source file is subject to the Academic Free License (AFL 3.0) -* that is bundled with this package in the file LICENSE.txt. -* It is also available through the world-wide-web at this URL: -* http://opensource.org/licenses/afl-3.0.php -* If you did not receive a copy of the license and are unable to -* obtain it through the world-wide-web, please send an email -* to license@prestashop.com so we can send you a copy immediately. -* -* DISCLAIMER -* -* Do not edit or add to this file if you wish to upgrade PrestaShop to newer -* versions in the future. If you wish to customize PrestaShop for your -* needs please refer to http://www.prestashop.com for more information. -* -* @author PrestaShop SA -* @copyright 2007-2011 PrestaShop SA -* @version Release: $Revision: 8971 $ -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*} - -{if $firstCall} -{extends file="helper/form/form.tpl"} -{block name=script} -$(document).ready(function(){ - if ($(".datepicker").length > 0) - $(".datepicker").datepicker({ - prevText: '', - nextText: '', - dateFormat: 'yy-mm-dd' - }); -}); -{/block} diff --git a/admin-dev/themes/template/manufacturers/list_action_edit_adresses.tpl b/admin-dev/themes/template/manufacturers/list_action_edit_adresses.tpl deleted file mode 100644 index ca6ee9ac6..000000000 --- a/admin-dev/themes/template/manufacturers/list_action_edit_adresses.tpl +++ /dev/null @@ -1,27 +0,0 @@ -{* -* 2007-2011 PrestaShop -* -* NOTICE OF LICENSE -* -* This source file is subject to the Academic Free License (AFL 3.0) -* that is bundled with this package in the file LICENSE.txt. -* It is also available through the world-wide-web at this URL: -* http://opensource.org/licenses/afl-3.0.php -* If you did not receive a copy of the license and are unable to -* obtain it through the world-wide-web, please send an email -* to license@prestashop.com so we can send you a copy immediately. -* -* DISCLAIMER -* -* Do not edit or add to this file if you wish to upgrade PrestaShop to newer -* versions in the future. If you wish to customize PrestaShop for your -* needs please refer to http://www.prestashop.com for more information. -* -* @author PrestaShop SA -* @copyright 2007-2011 PrestaShop SA -* @version Release: $Revision: 9197 $ -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*} - -{$action} \ No newline at end of file diff --git a/admin-dev/themes/template/manufacturers/view.tpl b/admin-dev/themes/template/manufacturers/view.tpl index 37317c62e..4434ab7ec 100644 --- a/admin-dev/themes/template/manufacturers/view.tpl +++ b/admin-dev/themes/template/manufacturers/view.tpl @@ -24,82 +24,85 @@ * International Registered Trademark & Property of PrestaShop SA *} -

{$manufacturer->name}

+{extends file="helper/view/view.tpl"} -

{l s='Total addresses:'} {count($addresses)}

-
+{block name="override_tpl"} -{if !count($addresses)} - {l s='No address for this manufacturer'} -{else} - {foreach $addresses AS $addresse} - - - - - - - -
{$addresse.firstname} {$addresse.lastname}
-
- {$addresse.address1}
- {if $addresse.address2}{$addresse.address2}
{/if} - {$addresse.postcode} {$addresse.city}
- {if $addresse.state}{$addresse.state}
{/if} - {$addresse.country}
-
-
- {if $addresse.phone}{$addresse.phone}
{/if} - {if $addresse.phone_mobile}{$addresse.phone_mobile}
{/if} -
- {if $addresse.other}

{$addresse.other}
{/if} -

- {/foreach} -{/if} -

- -

{l s='Total products:'} {count($products)}

-{foreach $products AS $product} +

{$manufacturer->name}

+ +

{l s='Total addresses:'} {count($addresses)}


- {if !$product->hasAttributes()} -
- {l s='Edit'} - {l s='Delete'} -
- - - - {if !empty($product->reference)}{/if} - {if !empty($product->ean13)}{/if} - {if !empty($product->upc)}{/if} - {if $stock_management}{/if} - -
{$product->name}{l s='Ref:'} {$product->reference}{l s='EAN13:'} {$product->ean13}{l s='UPC:'} {$product->upc}{l s='Qty:'} {$product->quantity}
+ + {if !count($addresses)} + {l s='No address for this manufacturer'} {else} -
- {l s='Edit'} - {l s='Delete'} -
-

{$product->name}

- - - - - - - {if $stock_management}{/if} - - {foreach $product->combinaison AS $id_product_attribute => $product_attribute} - - - - - - {if $stock_management}{/if} + {foreach $addresses AS $addresse} +
{l s='Attribute name'}{l s='Reference'}{l s='EAN13'}{l s='UPC'}{l s='Quantity'}
{$product_attribute.attributes}{$product_attribute.reference}{$product_attribute.ean13}{$product_attribute.upc}{$product_attribute.quantity}
+ + - {/foreach} -
{$addresse.firstname} {$addresse.lastname}
+ + +
+ {$addresse.address1}
+ {if $addresse.address2}{$addresse.address2}
{/if} + {$addresse.postcode} {$addresse.city}
+ {if $addresse.state}{$addresse.state}
{/if} + {$addresse.country}
+
+
+ {if $addresse.phone}{$addresse.phone}
{/if} + {if $addresse.phone_mobile}{$addresse.phone_mobile}
{/if} +
+ {if $addresse.other}

{$addresse.other}
{/if} + + +
+ {/foreach} {/if} -{/foreach} -

- {l s='Back to manufacturer list'}
+

+ +

{l s='Total products:'} {count($products)}

+ {foreach $products AS $product} +
+ {if !$product->hasAttributes()} +
+ {l s='Edit'} + {l s='Delete'} +
+ + + + {if !empty($product->reference)}{/if} + {if !empty($product->ean13)}{/if} + {if !empty($product->upc)}{/if} + {if $stock_management}{/if} + +
{$product->name}{l s='Ref:'} {$product->reference}{l s='EAN13:'} {$product->ean13}{l s='UPC:'} {$product->upc}{l s='Qty:'} {$product->quantity}
+ {else} +
+ {l s='Edit'} + {l s='Delete'} +
+

{$product->name}

+ + + + + + + {if $stock_management}{/if} + + {foreach $product->combinaison AS $id_product_attribute => $product_attribute} + + + + + + {if $stock_management}{/if} + + {/foreach} +
{l s='Attribute name'}{l s='Reference'}{l s='EAN13'}{l s='UPC'}{l s='Quantity'}
{$product_attribute.attributes}{$product_attribute.reference}{$product_attribute.ean13}{$product_attribute.upc}{$product_attribute.quantity}
+ {/if} + {/foreach} +{/block} diff --git a/classes/AdminController.php b/classes/AdminController.php index 670628479..caeb0cf0c 100644 --- a/classes/AdminController.php +++ b/classes/AdminController.php @@ -1008,17 +1008,17 @@ class AdminControllerCore extends Controller // Template override $tpl = $this->tpl_folder.'content.tpl'; - //$tpl_action = $this->tpl_folder.$this->display.'.tpl'; + $tpl_action = $this->tpl_folder.$this->display.'.tpl'; // Check if action template has been override // new smarty : template_dir is an array. // @todo : add override path to the smarty config, and checking all array item - /*if (file_exists($this->context->smarty->template_dir[0].'/'.$tpl_action)) + if (file_exists($this->context->smarty->template_dir[0].'/'.$tpl_action) && $this->display != 'view') { if (method_exists($this, $this->display.Tools::toCamelCase($this->className))) $this->{$this->display.Tools::toCamelCase($this->className)}(); $this->context->smarty->assign('content', $this->context->smarty->fetch($tpl_action)); - }*/ + } // Check if content template has been override if (file_exists($this->context->smarty->template_dir[0].'/'.$tpl)) @@ -1253,14 +1253,14 @@ class AdminControllerCore extends Controller return; $this->content .= $this->initForm(); } - elseif ($this->display == 'view') + else if ($this->display == 'view') { // Some controllers use the view action without an object if ($this->className) $this->loadObject(true); $this->content .= $this->initView(); } - elseif (!$this->ajax) + else if (!$this->ajax) { $this->content .= $this->initList(); $this->content .= $this->initOptions(); diff --git a/controllers/admin/AdminManufacturersController.php b/controllers/admin/AdminManufacturersController.php index 2db72f1f3..d5d2a0027 100644 --- a/controllers/admin/AdminManufacturersController.php +++ b/controllers/admin/AdminManufacturersController.php @@ -109,14 +109,11 @@ class AdminManufacturersControllerCore extends AdminController $this->context->smarty->assign('title_list', $this->l('List of manufacturers:')); - $this->initToolbar(); $this->content .= parent::initList(); } public function initListManufacturerAddresses() { - - $this->toolbar_title = $this->l('Addresses'); // reset actions and query vars $this->actions = array(); @@ -207,7 +204,6 @@ class AdminManufacturersControllerCore extends AdminController $this->initListManufacturerAddresses(); } - /** * Display editaddresses action link * @param string $token the token to add to the link @@ -226,7 +222,7 @@ class AdminManufacturersControllerCore extends AdminController 'action' => self::$cache_lang['editaddresses'], )); - return $this->context->smarty->fetch('manufacturers/list_action_edit_adresses.tpl'); + return $this->context->smarty->fetch('helper/list/list_action_edit.tpl'); } public function initForm() @@ -523,6 +519,16 @@ class AdminManufacturersControllerCore extends AdminController 'alias' => 'manufacturer' ); + $this->toolbar_btn = array( + 'save' => array( + 'href' => '#', + 'desc' => $this->l('Save') + ), + 'cancel' => array( + 'href' => self::$currentIndex.'&token='.$this->token, + 'desc' => $this->l('Cancel') + ) + ); $this->getlanguages(); $helper = new HelperForm(); $helper->currentIndex = self::$currentIndex; @@ -530,12 +536,12 @@ class AdminManufacturersControllerCore extends AdminController $helper->table = $this->table; $helper->identifier = $this->identifier; $helper->id = $address->id; + $helper->toolbar_fix = true; $helper->languages = $this->_languages; $helper->default_form_language = $this->default_form_language; $helper->allow_employee_form_lang = $this->allow_employee_form_lang; $helper->fields_value = $this->getFieldsValue($address); $helper->toolbar_btn = $this->toolbar_btn; - // $helper->tpl = 'manufacturers/form_addresses.tpl'; $this->content .= $helper->generateForm($this->fields_form); } @@ -580,11 +586,44 @@ class AdminManufacturersControllerCore extends AdminController } } - $this->context->smarty->assign(array( + $this->tpl_view_vars = array( 'manufacturer' => $manufacturer, 'addresses' => $addresses, 'products' => $products, 'stock_management' => Configuration::get('PS_STOCK_MANAGEMENT'), + ); + + return parent::initView(); + } + + public function initContent() + { + // toolbar (save, cancel, new, ..) + $this->initToolbar(); + if ($this->display == 'editaddresses' || $this->display == 'addaddress') + $this->content .= $this->initFormAddress(); + else if ($this->display == 'edit' || $this->display == 'add') + { + if (!$this->loadObject(true)) + return; + $this->content .= $this->initForm(); + } + else if ($this->display == 'view') + { + // Some controllers use the view action without an object + if ($this->className) + $this->loadObject(true); + $this->content .= $this->initView(); + } + else if (!$this->ajax) + { + $this->content .= $this->initList(); + $this->content .= $this->initOptions(); + } + + $this->context->smarty->assign(array( + 'content' => $this->content, + 'url_post' => self::$currentIndex.'&token='.$this->token, )); } @@ -620,32 +659,6 @@ class AdminManufacturersControllerCore extends AdminController } } - public function initContent() - { - if ($this->display == 'edit' || $this->display == 'add') - { - if (!($this->object = $this->loadObject(true))) - return; - $this->content .= $this->initForm(); - } - else if ($this->display == 'editaddresses' || $this->display == 'addaddress') - $this->content .= $this->initFormAddress(); - else if ($this->display == 'view') - $this->content .= $this->initView(); - else - { - $this->content .= $this->initList(); - $this->content .= $this->initOptions(); - } - - $this->context->smarty->assign(array( - 'table' => $this->table, - 'current' => self::$currentIndex, - 'token' => $this->token, - 'content' => $this->content - )); - } - public function postProcess() { if (Tools::getValue('submitAddaddress') || Tools::isSubmit('deleteaddress'))