\ No newline at end of file
diff --git a/admin-dev/themes/default/template/controllers/products/helpers/tree/tree_toolbar_search.tpl b/admin-dev/themes/default/template/controllers/products/helpers/tree/tree_toolbar_search.tpl
new file mode 100644
index 000000000..19c8426da
--- /dev/null
+++ b/admin-dev/themes/default/template/controllers/products/helpers/tree/tree_toolbar_search.tpl
@@ -0,0 +1,25 @@
+{*
+* 2007-2013 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-2013 PrestaShop SA
+* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
+* International Registered Trademark & Property of PrestaShop SA
+*}
+
\ No newline at end of file
diff --git a/admin-dev/themes/default/template/helpers/tree/tree.tpl b/admin-dev/themes/default/template/helpers/tree/tree.tpl
index 9b0cbc1b2..dab29780d 100644
--- a/admin-dev/themes/default/template/helpers/tree/tree.tpl
+++ b/admin-dev/themes/default/template/helpers/tree/tree.tpl
@@ -23,8 +23,8 @@
* International Registered Trademark & Property of PrestaShop SA
*}
\ No newline at end of file
diff --git a/admin-dev/themes/default/template/helpers/tree/tree_toolbar_search.tpl b/admin-dev/themes/default/template/helpers/tree/tree_toolbar_search.tpl
new file mode 100644
index 000000000..71624c5aa
--- /dev/null
+++ b/admin-dev/themes/default/template/helpers/tree/tree_toolbar_search.tpl
@@ -0,0 +1,25 @@
+{*
+* 2007-2013 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-2013 PrestaShop SA
+* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
+* International Registered Trademark & Property of PrestaShop SA
+*}
+
\ No newline at end of file
diff --git a/classes/helper/HelperITreeToolbarButton.php b/classes/helper/HelperITreeToolbarButton.php
index e98ced91b..2f875093e 100644
--- a/classes/helper/HelperITreeToolbarButton.php
+++ b/classes/helper/HelperITreeToolbarButton.php
@@ -29,6 +29,10 @@ interface HelperITreeToolbarButtonCore
public function __toString();
public function setAction($value);
public function getAction();
+ public function setAttributes($value);
+ public function getAttributes();
+ public function setClass($value);
+ public function getClass();
public function setContext($value);
public function getContext();
public function setLabel($value);
@@ -37,5 +41,6 @@ interface HelperITreeToolbarButtonCore
public function getTemplate();
public function setTemplateDirectory($value);
public function getTemplateDirectory();
+ public function addAttribute($name, $value);
public function render();
}
\ No newline at end of file
diff --git a/classes/helper/HelperTreeToolbarButton.php b/classes/helper/HelperTreeToolbarButton.php
index 972f42c60..0c14ebd0f 100644
--- a/classes/helper/HelperTreeToolbarButton.php
+++ b/classes/helper/HelperTreeToolbarButton.php
@@ -29,15 +29,18 @@ abstract class HelperTreeToolbarButtonCore
const DEFAULT_TEMPLATE_DIRECTORY = 'helpers/tree';
private $_action;
+ private $_attributes;
+ private $_class;
private $_context;
private $_label;
protected $_template;
protected $_template_directory;
- public function __construct($label, $action = null)
+ public function __construct($label, $action = null, $class = null)
{
$this->setLabel($label);
$this->setAction($action);
+ $this->setClass($class);
}
public function __toString()
@@ -56,6 +59,34 @@ abstract class HelperTreeToolbarButtonCore
return $this->_action;
}
+ public function setAttributes($value)
+ {
+ if (!is_array($value) && !$value instanceof Traversable)
+ throw new PrestaShopException('Data value must be an traversable array');
+
+ $this->_attributes = $value;
+ return $this;
+ }
+
+ public function getAttributes()
+ {
+ if (!isset($this->_attributes))
+ $this->_attributes = array();
+
+ return $this->_attributes;
+ }
+
+ public function setClass($value)
+ {
+ $this->_class = $value;
+ return $this;
+ }
+
+ public function getClass()
+ {
+ return $this->_class;
+ }
+
public function setContext($value)
{
$this->_context = $value;
@@ -108,12 +139,21 @@ abstract class HelperTreeToolbarButtonCore
return $this->_template_directory;
}
+ public function addAttribute($name, $value)
+ {
+ if (!isset($this->_attributes))
+ $this->_attributes = array();
+
+ $this->_attributes[$name] = $value;
+ return $this;
+ }
+
public function render()
{
return $this->getContext()->smarty->createTemplate(
$this->getTemplateDirectory().$this->getTemplate(),
$this->getContext()->smarty
- );
+ )->assign($this->getAttributes());
}
private function _normalizeDirectory($directory)
diff --git a/classes/helper/HelperTreeToolbarLink.php b/classes/helper/HelperTreeToolbarLink.php
index 0af277e2c..2e6c7d5c3 100644
--- a/classes/helper/HelperTreeToolbarLink.php
+++ b/classes/helper/HelperTreeToolbarLink.php
@@ -70,6 +70,7 @@ class HelperTreeToolbarLinkCore extends HelperTreeToolbarButtonCore implements
'link' => $this->getLink(),
'action' => $this->getAction(),
'label' => $this->getLabel(),
+ 'class' => $this->getClass(),
'icon_class' => $this->getIconClass()
));
return $template->fetch();
diff --git a/classes/helper/HelperTreeToolbarSearch.php b/classes/helper/HelperTreeToolbarSearch.php
new file mode 100644
index 000000000..c7e707885
--- /dev/null
+++ b/classes/helper/HelperTreeToolbarSearch.php
@@ -0,0 +1,58 @@
+
+* @copyright 2007-2013 PrestaShop SA
+* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
+* International Registered Trademark & Property of PrestaShop SA
+*/
+
+class HelperTreeToolbarSearchCore extends HelperTreeToolbarButtonCore implements
+ HelperITreeToolbarButtonCore
+{
+ protected $_template = 'tree_toolbar_search.tpl';
+
+ public function __construct($label, $action = null, $class = null)
+ {
+ parent::__construct($label, $action, $class);
+
+ $admin_webpath = str_ireplace(_PS_ROOT_DIR_, '', _PS_ADMIN_DIR_);
+ $admin_webpath = preg_replace('/^'.preg_quote(DIRECTORY_SEPARATOR, '/').'/', '', $admin_webpath);
+ $bo_theme = ((Validate::isLoadedObject($this->getContext()->employee)
+ && $this->getContext()->employee->bo_theme) ? $this->getContext()->employee->bo_theme : 'default');
+
+ if (!file_exists(_PS_BO_ALL_THEMES_DIR_.$bo_theme.DIRECTORY_SEPARATOR
+ .'template'))
+ $bo_theme = 'default';
+ $this->getContext()->controller->addJs(__PS_BASE_URI__.$admin_webpath
+ .'/themes/'.$bo_theme.'/js/vendor/typeahead.min.js');
+ }
+
+ public function render()
+ {
+ $template = parent::render();
+ $template->assign(array(
+ 'action' => $this->getAction(),
+ 'label' => $this->getLabel(),
+ 'class' => $this->getClass()
+ ));
+ return $template->fetch();
+ }
+}
\ No newline at end of file