[*] BO : Added an override capability for the admin templates
This commit is contained in:
@@ -245,7 +245,7 @@ class DispatcherCore
|
|||||||
{
|
{
|
||||||
// Dispatch front office controller
|
// Dispatch front office controller
|
||||||
case self::FC_FRONT :
|
case self::FC_FRONT :
|
||||||
$controllers = Dispatcher::getControllers(_PS_FRONT_CONTROLLER_DIR_);
|
$controllers = Dispatcher::getControllers(_PS_FRONT_CONTROLLER_DIR_, _PS_OVERRIDE_DIR_.'controllers/front/');
|
||||||
|
|
||||||
$controllers['index'] = 'IndexController';
|
$controllers['index'] = 'IndexController';
|
||||||
if (isset($controllers['auth']))
|
if (isset($controllers['auth']))
|
||||||
|
|||||||
@@ -269,7 +269,10 @@ class AdminControllerCore extends Controller
|
|||||||
$this->multishop_context = Shop::CONTEXT_ALL | Shop::CONTEXT_GROUP | Shop::CONTEXT_SHOP;
|
$this->multishop_context = Shop::CONTEXT_ALL | Shop::CONTEXT_GROUP | Shop::CONTEXT_SHOP;
|
||||||
|
|
||||||
$this->bo_theme = ((Validate::isLoadedObject($this->context->employee) && $this->context->employee->bo_theme) ? $this->context->employee->bo_theme : 'default');
|
$this->bo_theme = ((Validate::isLoadedObject($this->context->employee) && $this->context->employee->bo_theme) ? $this->context->employee->bo_theme : 'default');
|
||||||
$this->context->smarty->setTemplateDir(_PS_BO_ALL_THEMES_DIR_.$this->bo_theme.'/template');
|
$this->context->smarty->setTemplateDir(array(
|
||||||
|
_PS_BO_ALL_THEMES_DIR_.$this->bo_theme.DIRECTORY_SEPARATOR.'template',
|
||||||
|
_PS_OVERRIDE_DIR_.'controllers'.DIRECTORY_SEPARATOR.'admin'.DIRECTORY_SEPARATOR.'templates'
|
||||||
|
));
|
||||||
|
|
||||||
$this->id = Tab::getIdFromClassName($this->controller_name);
|
$this->id = Tab::getIdFromClassName($this->controller_name);
|
||||||
$this->token = Tools::getAdminToken($this->controller_name.(int)$this->id.(int)$this->context->employee->id);
|
$this->token = Tools::getAdminToken($this->controller_name.(int)$this->id.(int)$this->context->employee->id);
|
||||||
@@ -1099,14 +1102,14 @@ class AdminControllerCore extends Controller
|
|||||||
|
|
||||||
// Check if action template has been override
|
// Check if action template has been override
|
||||||
|
|
||||||
// new smarty : template_dir is an array.
|
foreach ($this->context->smarty->getTemplateDir() as $template_dir)
|
||||||
// @todo : add override path to the smarty config, and checking all array item
|
if (file_exists($template_dir.DIRECTORY_SEPARATOR.$tpl_action) && $this->display != 'view' && $this->display != 'options')
|
||||||
if (file_exists($this->context->smarty->getTemplateDir(0).'/'.$tpl_action) && $this->display != 'view' && $this->display != 'options')
|
{
|
||||||
{
|
if (method_exists($this, $this->display.Tools::toCamelCase($this->className)))
|
||||||
if (method_exists($this, $this->display.Tools::toCamelCase($this->className)))
|
$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));
|
||||||
$this->context->smarty->assign('content', $this->context->smarty->fetch($tpl_action));
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->ajax)
|
if (!$this->ajax)
|
||||||
{
|
{
|
||||||
@@ -1448,7 +1451,8 @@ class AdminControllerCore extends Controller
|
|||||||
$helper = new HelperView($this);
|
$helper = new HelperView($this);
|
||||||
$this->setHelperDisplay($helper);
|
$this->setHelperDisplay($helper);
|
||||||
$helper->tpl_vars = $this->tpl_view_vars;
|
$helper->tpl_vars = $this->tpl_view_vars;
|
||||||
!is_null($this->base_tpl_view) ? $helper->base_tpl = $this->base_tpl_view : '';
|
if (!is_null($this->base_tpl_view))
|
||||||
|
$helper->base_tpl = $this->base_tpl_view;
|
||||||
$view = $helper->generateView();
|
$view = $helper->generateView();
|
||||||
|
|
||||||
return $view;
|
return $view;
|
||||||
@@ -2630,10 +2634,13 @@ class AdminControllerCore extends Controller
|
|||||||
{
|
{
|
||||||
// Use override tpl if it exists
|
// Use override tpl if it exists
|
||||||
// If view access is denied, we want to use the default template that will be used to display an error
|
// If view access is denied, we want to use the default template that will be used to display an error
|
||||||
if ($this->viewAccess()
|
if ($this->viewAccess() && $this->override_folder)
|
||||||
&& $this->override_folder
|
{
|
||||||
&& file_exists($this->context->smarty->getTemplateDir(0).'controllers/'.$this->override_folder.$tpl_name))
|
if (file_exists($this->context->smarty->getTemplateDir(0).'controllers'.DIRECTORY_SEPARATOR.$this->override_folder.$tpl_name))
|
||||||
return $this->context->smarty->createTemplate('controllers/'.$this->override_folder.$tpl_name, $this->context->smarty);
|
return $this->context->smarty->createTemplate('controllers'.DIRECTORY_SEPARATOR.$this->override_folder.$tpl_name, $this->context->smarty);
|
||||||
|
if (file_exists($this->context->smarty->getTemplateDir(1).DIRECTORY_SEPARATOR.$this->override_folder.$tpl_name))
|
||||||
|
return $this->context->smarty->createTemplate($this->override_folder.$tpl_name, $this->context->smarty);
|
||||||
|
}
|
||||||
|
|
||||||
return $this->context->smarty->createTemplate($this->context->smarty->getTemplateDir(0).$tpl_name, $this->context->smarty);
|
return $this->context->smarty->createTemplate($this->context->smarty->getTemplateDir(0).$tpl_name, $this->context->smarty);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,7 +86,12 @@ class HelperCore
|
|||||||
else if ($this->module)
|
else if ($this->module)
|
||||||
$override_tpl_path = _PS_MODULE_DIR_.$this->module->name.'/views/templates/admin/_configure/'.$this->override_folder.$this->base_folder.$tpl_name;
|
$override_tpl_path = _PS_MODULE_DIR_.$this->module->name.'/views/templates/admin/_configure/'.$this->override_folder.$this->base_folder.$tpl_name;
|
||||||
else
|
else
|
||||||
$override_tpl_path = $this->context->smarty->getTemplateDir(0).'controllers/'.$this->override_folder.$this->base_folder.$tpl_name;
|
{
|
||||||
|
if (file_exists($this->context->smarty->getTemplateDir(0).DIRECTORY_SEPARATOR.'controllers'.DIRECTORY_SEPARATOR.$this->override_folder.$this->base_folder.$tpl_name))
|
||||||
|
$override_tpl_path = $this->context->smarty->getTemplateDir(0).'controllers'.DIRECTORY_SEPARATOR.$this->override_folder.$this->base_folder.$tpl_name;
|
||||||
|
elseif (file_exists($this->context->smarty->getTemplateDir(1).DIRECTORY_SEPARATOR.$this->override_folder.$this->base_folder.$tpl_name))
|
||||||
|
$override_tpl_path = $this->context->smarty->getTemplateDir(1).DIRECTORY_SEPARATOR.$this->override_folder.$this->base_folder.$tpl_name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if ($this->module)
|
else if ($this->module)
|
||||||
$override_tpl_path = _PS_MODULE_DIR_.$this->module->name.'/views/templates/admin/_configure/'.$this->base_folder.$tpl_name;
|
$override_tpl_path = _PS_MODULE_DIR_.$this->module->name.'/views/templates/admin/_configure/'.$this->base_folder.$tpl_name;
|
||||||
|
|||||||
@@ -2368,7 +2368,7 @@ INDEX (`id_specific_price_rule_condition_group`)
|
|||||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `PREFIX_risk` (
|
CREATE TABLE IF NOT EXISTS `PREFIX_risk` (
|
||||||
`id_risk` int(11) NOT NULL AUTO_INCREMENT,
|
`id_risk` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
`percent` tinyint(3) NOT NULL,
|
`percent` tinyint(3) NOT NULL,
|
||||||
`color` varchar(32) NULL,
|
`color` varchar(32) NULL,
|
||||||
PRIMARY KEY (`id_risk`)
|
PRIMARY KEY (`id_risk`)
|
||||||
|
|||||||
Reference in New Issue
Block a user