[*] BO : #PSFV-94 - added AdminModulesPositionsController

This commit is contained in:
tDidierjean
2011-11-14 11:04:15 +00:00
parent a45cd52f13
commit 4d59ba5fcc
5 changed files with 607 additions and 513 deletions
-508
View File
@@ -1,508 +0,0 @@
<?php
/*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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/osl-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 <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision: 7466 $
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
class AdminModulesPositions extends AdminTab
{
private $displayKey = 0;
public function postProcess()
{
// Getting key value for display
if (Tools::getValue('show_modules') AND strval(Tools::getValue('show_modules')) != 'all')
$this->displayKey = (int)(Tools::getValue('show_modules'));
// Change position in hook
if (array_key_exists('changePosition', $_GET))
{
if ($this->tabAccess['edit'] === '1')
{
$id_module = (int)(Tools::getValue('id_module'));
$id_hook = (int)(Tools::getValue('id_hook'));
$module = Module::getInstanceById($id_module);
if (Validate::isLoadedObject($module))
{
$module->updatePosition($id_hook, (int)(Tools::getValue('direction')));
Tools::redirectAdmin(self::$currentIndex.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token);
}
else
$this->_errors[] = Tools::displayError('module cannot be loaded');
}
else
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
}
// Add new module in hook
elseif (Tools::isSubmit('submitAddToHook'))
{
if ($this->tabAccess['add'] === '1')
{
// Getting vars...
$id_module = (int)(Tools::getValue('id_module'));
$module = Module::getInstanceById($id_module);
$id_hook = (int)(Tools::getValue('id_hook'));
$hook = new Hook($id_hook);
if (!$id_module OR !Validate::isLoadedObject($module))
$this->_errors[] = Tools::displayError('module cannot be loaded');
elseif (!$id_hook OR !Validate::isLoadedObject($hook))
$this->_errors[] = Tools::displayError('Hook cannot be loaded.');
elseif (Hook::getModulesFromHook($id_hook, $id_module))
$this->_errors[] = Tools::displayError('This module is already transplanted to this hook.');
elseif (!$module->isHookableOn($hook->name))
$this->_errors[] = Tools::displayError('This module can\'t be transplanted to this hook.');
// Adding vars...
else
{
if (!$module->registerHook($hook->name, Context::getContext()->shop->getListOfID()))
$this->_errors[] = Tools::displayError('An error occurred while transplanting module to hook.');
else
{
$exceptions = Tools::getValue('exceptions');
$exceptions = (isset($exceptions[0])) ? $exceptions[0] : array();
$exceptions = explode(',', str_replace(' ', '', $exceptions));
foreach ($exceptions AS $except)
if (!Validate::isFileName($except))
$this->_errors[] = Tools::displayError('No valid value for field exceptions');
if (!$this->_errors && !$module->registerExceptions($id_hook, $exceptions, Context::getContext()->shop->getListOfID()))
$this->_errors[] = Tools::displayError('An error occurred while transplanting module to hook.');
}
if (!$this->_errors)
Tools::redirectAdmin(self::$currentIndex.'&conf=16'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token);
}
}
else
$this->_errors[] = Tools::displayError('You do not have permission to add here.');
}
// Edit module from hook
elseif (Tools::isSubmit('submitEditGraft'))
{
if ($this->tabAccess['add'] === '1')
{
// Getting vars...
$id_module = (int)(Tools::getValue('id_module'));
$module = Module::getInstanceById($id_module);
$id_hook = (int)(Tools::getValue('id_hook'));
$hook = new Hook($id_hook);
if (!$id_module OR !Validate::isLoadedObject($module))
$this->_errors[] = Tools::displayError('module cannot be loaded');
elseif (!$id_hook OR !Validate::isLoadedObject($hook))
$this->_errors[] = Tools::displayError('Hook cannot be loaded.');
else
{
$exceptions = Tools::getValue('exceptions');
if (is_array($exceptions))
{
foreach ($exceptions as $id => $exception)
{
$exception = explode(',', str_replace(' ', '', $exception));
// Check files name
foreach ($exception AS $except)
if (!Validate::isFileName($except))
$this->_errors[] = Tools::displayError('No valid value for field exceptions');
$exceptions[$id] = $exception;
}
// Add files exceptions
if (!$module->editExceptions($id_hook, $exceptions))
$this->_errors[] = Tools::displayError('An error occurred while transplanting module to hook.');
if (!$this->_errors)
Tools::redirectAdmin(self::$currentIndex.'&conf=16'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token);
}
else
{
$exceptions = explode(',', str_replace(' ', '', $exceptions));
// Check files name
foreach ($exceptions AS $except)
if (!Validate::isFileName($except))
$this->_errors[] = Tools::displayError('No valid value for field exceptions');
// Add files exceptions
if (!$module->editExceptions($id_hook, $exceptions, Context::getContext()->shop->getListOfID()))
$this->_errors[] = Tools::displayError('An error occurred while transplanting module to hook.');
else
Tools::redirectAdmin(self::$currentIndex.'&conf=16'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token);
}
}
}
else
$this->_errors[] = Tools::displayError('You do not have permission to add here.');
}
// Delete module from hook
elseif (array_key_exists('deleteGraft', $_GET))
{
if ($this->tabAccess['delete'] === '1')
{
$id_module = (int)(Tools::getValue('id_module'));
$module = Module::getInstanceById($id_module);
$id_hook = (int)(Tools::getValue('id_hook'));
$hook = new Hook($id_hook);
if (!Validate::isLoadedObject($module))
$this->_errors[] = Tools::displayError('module cannot be loaded');
elseif (!$id_hook OR !Validate::isLoadedObject($hook))
$this->_errors[] = Tools::displayError('Hook cannot be loaded.');
else
{
if (!$module->unregisterHook($id_hook, Context::getContext()->shop->getListOfID()) OR !$module->unregisterExceptions($id_hook, Context::getContext()->shop->getListOfID()))
$this->_errors[] = Tools::displayError('An error occurred while deleting module from hook.');
else
Tools::redirectAdmin(self::$currentIndex.'&conf=17'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token);
}
}
else
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
}
elseif (Tools::isSubmit('unhookform'))
{
if (!($unhooks = Tools::getValue('unhooks')) OR !is_array($unhooks))
$this->_errors[] = Tools::displayError('Select a module to unhook.');
else
{
foreach ($unhooks as $unhook)
{
$explode = explode('_', $unhook);
$id_hook = $explode[0];
$id_module = $explode[1];
$module = Module::getInstanceById((int)($id_module));
$hook = new Hook((int)($id_hook));
if (!Validate::isLoadedObject($module))
$this->_errors[] = Tools::displayError('module cannot be loaded');
elseif (!$id_hook OR !Validate::isLoadedObject($hook))
$this->_errors[] = Tools::displayError('Hook cannot be loaded.');
else
{
if (!$module->unregisterHook((int)($id_hook)) OR !$module->unregisterExceptions((int)($id_hook)))
$this->_errors[] = Tools::displayError('An error occurred while deleting module from hook.');
}
}
if (!sizeof($this->_errors))
Tools::redirectAdmin(self::$currentIndex.'&conf=17'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token);
}
}
}
public function display()
{
if (array_key_exists('addToHook', $_GET) OR array_key_exists('editGraft', $_GET) OR (Tools::isSubmit('submitAddToHook') AND $this->_errors))
$this->displayForm();
else
$this->displayList();
}
public function displayList()
{
$admin_dir = dirname($_SERVER['PHP_SELF']);
$admin_dir = substr($admin_dir, strrpos($admin_dir,'/') + 1);
echo '
<script type="text/javascript" src="../js/jquery/jquery.tablednd_0_5.js"></script>
<script type="text/javascript">
var token = \''.$this->token.'\';
var come_from = \'AdminModulesPositions\';
</script>
<script type="text/javascript" src="../js/admin-dnd.js"></script>
';
echo '<a href="'.self::$currentIndex.'&addToHook'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token.'"><img src="../img/admin/add.gif" border="0" /> <b>'.$this->l('Transplant a module').'</b></a><br /><br />';
// Print select list
echo '
<form>
'.$this->l('Show').' :
<select id="show_modules" onChange="autoUrl(\'show_modules\', \''.self::$currentIndex.'&token='.$this->token.'&show_modules=\')">
<option value="all">'.$this->l('All modules').'&nbsp;</option>
<option>---------------</option>';
$modules = Module::getModulesInstalled();
foreach ($modules AS $module)
if ($tmpInstance = Module::getInstanceById((int)($module['id_module'])))
$cm[$tmpInstance->displayName] = $tmpInstance;
ksort($cm);
foreach ($cm AS $module)
echo '
<option value="'.(int)($module->id).'" '.($this->displayKey == $module->id ? 'selected="selected" ' : '').'>'.$module->displayName.'</option>';
echo '
</select>
<br /><br />
<input type="checkbox" id="hook_position" onclick="autoUrlNoList(\'hook_position\', \''.self::$currentIndex.'&token='.$this->token.'&show_modules='.(int)(Tools::getValue('show_modules')).'&hook_position=\')" '.(Tools::getValue('hook_position') ? 'checked="checked" ' : '').' />&nbsp;<label class="t" for="hook_position">'.$this->l('Display non-positionable hook').'</label>
</form>
<fieldset style="width:250px;float:right"><legend>'.$this->l('Live edit').'</legend>';
if (Shop::isFeatureActive() && $this->context->shop->getContextType() != Shop::CONTEXT_SHOP)
echo '<p>'.$this->l('You have to select a shop to use live edit').'</p>';
else
echo '<p>'.$this->l('By clicking here you will be redirected to the front office of your shop to move and delete modules directly.').'</p>
<br>
<a href="'.$this->context->link->getPageLink('index', false, null, 'live_edit&ad='.$admin_dir.'&liveToken='.sha1($admin_dir._COOKIE_KEY_).((Shop::isFeatureActive()) ? '&id_shop='.Context::getContext()->shop->getID() : '')).'" target="_blank" class="button">'.$this->l('Run LiveEdit').'</a>';
echo '</fieldset>';
// Print hook list
echo '<form method="post" action="'.self::$currentIndex.'&token='.$this->token.'">';
$irow = 0;
$hooks = Hook::getHooks(!(int)(Tools::getValue('hook_position')));
echo '<div id="unhook_button_position_top"><input class="button floatr" type="submit" name="unhookform" value="'.$this->l('Unhook the selection').'"/></div>';
$canMove = (Shop::isFeatureActive() && $this->context->shop->getContextType() != Shop::CONTEXT_SHOP) ? false : true;
if (!$canMove)
echo '<br /><div><b>'.$this->l('If you want to order / move following data, please go in shop context (select a shop in shop list)').'</b></div>';
foreach ($hooks AS $hook)
{
$modules = Hook::getModulesFromHook($hook['id_hook'], $this->displayKey);
$nbModules = count($modules);
echo '
<a name="'.$hook['name'].'"/>
<table cellpadding="0" cellspacing="0" class="table width3 space'.($nbModules >= 2? ' tableDnD' : '' ).'" id="'.$hook['id_hook'].'">
<tr class="nodrag nodrop"><th colspan="4">'.$hook['title'].' - <span style="color: red">'.$nbModules.'</span> '.(($nbModules > 1) ? $this->l('modules') : $this->l('module'));
if ($nbModules && $canMove)
echo '<input type="checkbox" id="Ghook'.$hook['id_hook'].'" class="floatr" style="margin-right: 2px;" onclick="hookCheckboxes('.$hook['id_hook'].', 0, this)"/>';
if (!empty($hook['description']))
echo '&nbsp;<span style="font-size:0.8em; font-weight: normal">['.$hook['description'].']</span>';
echo ' <sub style="color:grey;"><i>('.$this->l('Technical name: ').$hook['name'].')</i></sub></th></tr>';
// Print modules list
if ($nbModules)
{
$instances = array();
foreach ($modules AS $module)
if ($tmpInstance = Module::getInstanceById((int)($module['id_module'])))
$instances[] = $tmpInstance;
foreach ($instances AS $position => $instance)
{
$position = $position + 1;
echo '
<tr id="'.$hook['id_hook'].'_'.$instance->id.'"'.($irow++ % 2 ? ' class="alt_row"' : '').' style="height: 42px;">';
if (!$this->displayKey)
{
echo '
<td class="positions" width="40">'.(int)($position).'</td>
<td'.(($canMove && $nbModules >= 2) ? ' class="dragHandle"' : '').' id="td_'.$hook['id_hook'].'_'.$instance->id.'" width="40">
'.(($canMove) ? '<a'.($position == 1 ? ' style="display: none;"' : '' ).' href="'.self::$currentIndex.'&id_module='.$instance->id.'&id_hook='.$hook['id_hook'].'&direction=0&token='.$this->token.'&changePosition='.rand().'#'.$hook['name'].'"><img src="../img/admin/up.gif" alt="'.$this->l('Up').'" title="'.$this->l('Up').'" /></a><br />
<a '.($position == count($instances) ? ' style="display: none;"' : '').'href="'.self::$currentIndex.'&id_module='.$instance->id.'&id_hook='.$hook['id_hook'].'&direction=1&token='.$this->token.'&changePosition='.rand().'#'.$hook['name'].'"><img src="../img/admin/down.gif" alt="'.$this->l('Down').'" title="'.$this->l('Down').'" /></a>' : '').'
</td>
<td style="padding-left: 10px;"><label class="lab_modules_positions" for="mod'.$hook['id_hook'].'_'.$instance->id.'">
';
}
else
echo '<td style="padding-left: 10px;" colspan="3"><label class="lab_modules_positions" for="'.$hook['id_hook'].'_'.$instance->id.'">';
echo '
<img src="../modules/'.$instance->name.'/logo.gif" alt="'.stripslashes($instance->name).'" /> <strong>'.stripslashes($instance->displayName).'</strong>
'.($instance->version ? ' v'.((int)($instance->version) == $instance->version? sprintf('%.1f', $instance->version) : (float)($instance->version)) : '').'<br />'.$instance->description.'
</label></td>
<td width="60">';
echo '
<a href="'.self::$currentIndex.'&id_module='.$instance->id.'&id_hook='.$hook['id_hook'].'&editGraft'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token.'"><img src="../img/admin/edit.gif" border="0" alt="'.$this->l('Edit').'" title="'.$this->l('Edit').'" /></a>
<a href="'.self::$currentIndex.'&id_module='.$instance->id.'&id_hook='.$hook['id_hook'].'&deleteGraft'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token.'"><img src="../img/admin/delete.gif" border="0" alt="'.$this->l('Delete').'" title="'.$this->l('Delete').'" /></a>
<input type="checkbox" id="mod'.$hook['id_hook'].'_'.$instance->id.'" class="hook'.$hook['id_hook'].'" onclick="hookCheckboxes('.$hook['id_hook'].', 1, this)" name="unhooks[]" value="'.$hook['id_hook'].'_'.$instance->id.'"/>';
echo '
</td>
</tr>';
}
} else
echo '<tr><td colspan="4">'.$this->l('No module for this hook').'</td></tr>';
echo '</table>';
}
echo '<div id="unhook_button_position_bottom"><input class="button floatr" type="submit" name="unhookform" value="'.$this->l('Unhook the selection').'"/></div></form>';
}
public function displayForm($isMainTab = true)
{
parent::displayForm();
$id_module = (int)(Tools::getValue('id_module'));
$id_hook = (int)(Tools::getValue('id_hook'));
if (Tools::isSubmit('editGraft'))
{
// Check auth for this page
if (!$id_module || !$id_hook)
Tools::redirectAdmin(self::$currentIndex . '&token='.$this->token);
$sql = 'SELECT id_module
FROM '._DB_PREFIX_.'hook_module
WHERE id_module = '.$id_module.'
AND id_hook = '.$id_hook.'
AND id_shop IN('.implode(', ', Context::getContext()->shop->getListOfID()).')';
if (!Db::getInstance()->getValue($sql))
Tools::redirectAdmin(self::$currentIndex . '&token='.$this->token);
$slModule = Module::getInstanceById($id_module);
$exceptsList = $slModule->getExceptions($id_hook, true);
$exceptsDiff = false;
$excepts = '';
if ($exceptsList)
{
$first = current($exceptsList);
foreach ($exceptsList as $k => $v)
if (array_diff($v, $first) || array_diff($first, $v))
$exceptsDiff = true;
if (!$exceptsDiff)
$excepts = implode(', ', $first);
}
}
else
{
$exceptsDiff = false;
$exceptsList = Tools::getValue('exceptions', array(array()));
}
$modules = Module::getModulesInstalled(0);
$instances = array();
foreach ($modules AS $module)
if ($tmpInstance = Module::getInstanceById($module['id_module']))
$instances[$tmpInstance->displayName] = $tmpInstance;
ksort($instances);
$modules = $instances;
$hooks = Hook::getHooks(0);
echo '
<form action="'.self::$currentIndex.'&token='.$this->token.'" method="post">';
if ($this->displayKey)
echo '<input type="hidden" name="show_modules" value="'.$this->displayKey.'" />';
echo '<fieldset style="width:700px"><legend><img src="../img/t/AdminModulesPositions.gif" />'.$this->l('Transplant a module').'</legend>
<label>'.$this->l('Module').' :</label>
<div class="margin-form">
<select name="id_module"'.(Tools::isSubmit('editGraft') ? ' disabled="disabled"' : '').'>';
foreach ($modules AS $module)
echo '
<option value="'.$module->id.'" '.(($id_module == $module->id || (!$id_module && Tools::getValue('show_modules') == $module->id)) ? 'selected="selected" ' : '').'>'.stripslashes($module->displayName).'</option>';
echo '
</select><sup> *</sup>
</div>
<label>'.$this->l('Hook into').' :</label>
<div class="margin-form">
<select name="id_hook"'.(Tools::isSubmit('editGraft') ? ' disabled="disabled"' : '').'>';
foreach ($hooks AS $hook)
echo '
<option value="'.$hook['id_hook'].'" '.($id_hook == $hook['id_hook'] ? 'selected="selected" ' : '').'>'.$hook['title'].'</option>';
echo '
</select><sup> *</sup>
</div>';
echo <<<EOF
<script type="text/javascript">
//<![CDATA
function position_exception_add(shopID)
{
var listValue = $('#em_list_'+shopID).val();
var inputValue = $('#em_text_'+shopID).val();
var r = new RegExp('(^|,) *'+listValue+' *(,|$)');
if (!r.test(inputValue))
$('#em_text_'+shopID).val(inputValue + ((inputValue.trim()) ? ', ' : '') + listValue);
}
function position_exception_remove(shopID)
{
var listValue = $('#em_list_'+shopID).val();
var inputValue = $('#em_text_'+shopID).val();
var r = new RegExp('(^|,) *'+listValue+' *(,|$)');
if (r.test(inputValue))
{
var rep = '';
if (new RegExp(', *'+listValue+' *,').test(inputValue))
$('#em_text_'+shopID).val(inputValue.replace(r, ','));
else if (new RegExp(listValue+' *,').test(inputValue))
$('#em_text_'+shopID).val(inputValue.replace(r, ''));
else
$('#em_text_'+shopID).val(inputValue.replace(r, ''));
}
}
//]]>
</script>
EOF;
// Manage exceptions
if (!$exceptsDiff)
{
echo '<label>'.$this->l('Exceptions').' :</label>
<div class="margin-form">';
$this->displayModuleExceptionList(array_shift($exceptsList), 0);
echo $this->l('Please specify those files for which you do not want the module to be displayed').'.<br />
'.$this->l('Please type each filename separated by a comma').'.
<br /><br />
</div>';
}
else
{
echo '<label>'.$this->l('Exceptions').' :</label>
<div class="margin-form">';
foreach ($exceptsList as $shopID => $fileList)
$this->displayModuleExceptionList($fileList, $shopID);
echo $this->l('Please specify those files for which you do not want the module to be displayed').'.<br />
'.$this->l('Please type each filename separated by a comma').'.
<br /><br />
</div>';
}
echo '<div class="margin-form">
';
if (Tools::isSubmit('editGraft'))
{
echo '
<input type="hidden" name="id_module" value="'.$id_module.'" />
<input type="hidden" name="id_hook" value="'.$id_hook.'" />';
}
echo '
<input type="submit" value="'.$this->l('Save').'" name="'.(Tools::isSubmit('editGraft') ? 'submitEditGraft' : 'submitAddToHook').'" class="button" />
</div>
<div class="small"><sup>*</sup> '.$this->l('Required field').'</div>
</fieldset>
</form>';
}
public function displayModuleExceptionList($fileList, $shopID)
{
if (!is_array($fileList))
$fileList = ($fileList) ? array($fileList) : array();
echo '<input type="text" name="exceptions['.$shopID.']" size="40" value="' . implode(', ', $fileList) . '" id="em_text_'.$shopID.'">';
if ($shopID)
echo ' ('.Shop::getInstance($shopID)->name.')';
echo '<br /><select id="em_list_'.$shopID.'">';
// @todo do something better with controllers
$controllers = Dispatcher::getControllers(_PS_FRONT_CONTROLLER_DIR_);
ksort($controllers);
foreach ($controllers as $k => $v)
{
echo '<option value="'.$k.'">'.$k.'</option>';
}
echo '</select> <input type="button" class="button" value="'.$this->l('Add').'" onclick="position_exception_add('.$shopID.')" />
<input type="button" class="button" value="'.$this->l('Remove').'" onclick="position_exception_remove('.$shopID.')" /><br /><br />';
}
}
@@ -0,0 +1,113 @@
{*
* 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 <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<div class="toolbarBox">
{if $show_toolbar}
{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>
{/if}
</div>
<form action="{$url_submit}" id={$table}_form method="post">
{if $display_key}
<input type="hidden" name="show_modules" value="{$display_key}" />
{/if}
<fieldset>
<legend><img src="../img/t/AdminModulesPositions.gif" />{l s='Transplant a module'}</legend>
<label>{l s='Module'} :</label>
<div class="margin-form">
<select name="id_module" {if $edit_graft} disabled="disabled"{/if}>
{foreach $modules as $module}
<option value="{$module->id}" {if $id_module == $module->id || (!$id_module && $show_modules == $module->id)}selected="selected"{/if}>{$module->displayName|stripslashes}</option>
{/foreach}
</select><sup> *</sup>
</div>
<label>{l s='Hook into'} :</label>
<div class="margin-form">
<select name="id_hook" {if $edit_graft} disabled="disabled"{/if}>
{foreach $hooks as $hook}
<option value="{$hook['id_hook']}" {if $id_hook == $hook['id_hook']} selected="selected"{/if}>{$hook['title']}</option>
{/foreach}
</select><sup> *</sup>
</div>
<script type="text/javascript">
//<![CDATA
function position_exception_add(shopID)
{
var listValue = $('#em_list_'+shopID).val();
var inputValue = $('#em_text_'+shopID).val();
var r = new RegExp('(^|,) *'+listValue+' *(,|$)');
if (!r.test(inputValue))
$('#em_text_'+shopID).val(inputValue + ((inputValue.trim()) ? ', ' : '') + listValue);
}
function position_exception_remove(shopID)
{
var listValue = $('#em_list_'+shopID).val();
var inputValue = $('#em_text_'+shopID).val();
var r = new RegExp('(^|,) *'+listValue+' *(,|$)');
if (r.test(inputValue))
{
var rep = '';
if (new RegExp(', *'+listValue+' *,').test(inputValue))
$('#em_text_'+shopID).val(inputValue.replace(r, ','));
else if (new RegExp(listValue+' *,').test(inputValue))
$('#em_text_'+shopID).val(inputValue.replace(r, ''));
else
$('#em_text_'+shopID).val(inputValue.replace(r, ''));
}
}
//]]>
</script>
<label>{l s='Exceptions'} :</label>
<div class="margin-form">
{if !$except_diff}
{$exception_list}
{else}
{foreach $exception_list_diff as $value}
{$value}
{/foreach}
{/if}
{l s='Please specify those files for which you do not want the module to be displayed'}.<br />
{l s='Please type each filename separated by a comma'}.
<br /><br />
</div>
<div class="margin-form">
{if $edit_graft}
<input type="hidden" name="id_module" value="{$id_module}" />
<input type="hidden" name="id_hook" value="{$id_hook}" />
{/if}
<input type="submit" value="{l s='Save'}" name="{if $edit_graft}submitEditGraft{else}submitAddToHook{/if}" id="{$table}_form_submit_btn" class="button" />
</div>
<div class="small"><sup>*</sup> {l s='Required field'}</div>
</fieldset>
</form>
@@ -0,0 +1,115 @@
{*
* 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 <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<script type="text/javascript">
var token = '{$token}';
var come_from = 'AdminModulesPositions';
</script>
<script type="text/javascript" src="../js/admin-dnd.js"></script>
<a href="{$url_transplant}"><img src="../img/admin/add.gif" border="0" /> <b>{l s='Transplant a module'}</b></a><br /><br />
<form>
{l s='Show'} :
<select id="show_modules" onChange="autoUrl('show_modules', '{$url_show_modules}')">
<option value="all">{l s='All modules'}&nbsp;</option>
<option>---------------</option>
{foreach $modules as $module}
<option value="{$module->id|intval}" {if $display_key == $module->id}selected="selected"{/if}>{$module->displayName}</option>
{/foreach}
</select>
<br /><br />
<input type="checkbox" id="hook_position" onclick="autoUrlNoList('hook_position', '{$url_show_invisible}')" {if $hook_position}checked="checked"{/if} />&nbsp;
<label class="t" for="hook_position">{l s='Display non-positionable hook'}</label>
</form>
<fieldset style="width:250px;float:right"><legend>{l s='Live edit'}</legend>
{if $live_edit}
<p>{l s='You have to select a shop to use live edit'}</p>
{else}
<p>{l s='By clicking here you will be redirected to the front office of your shop to move and delete modules directly.'}</p>
<br>
<a href="{$url_live_edit}" target="_blank" class="button">{l s='Run LiveEdit'}</a>
{/if}
</fieldset>
<form method="post" action="{$url_submit}">
<div id="unhook_button_position_top">
<input class="button floatr" type="submit" name="unhookform" value="{l s='Unhook the selection'}"/></div>
{if !$can_move}
<br /><div><b>{l s='If you want to order / move following data, please go in shop context (select a shop in shop list)'}</b></div>
{/if}
{foreach $hooks as $hook}
<a name="{$hook['name']}"/>
<table cellpadding="0" cellspacing="0" class="table width3 space {if $hook['module_count'] >= 2} tableDnD{/if}" id="{$hook['id_hook']}">
<tr class="nodrag nodrop"><th colspan="4">{$hook['title']} - <span style="color: red">{$hook['module_count']}</span> {if $hook['module_count'] > 1}{l s='modules'}{else}{l s='module'}{/if}
{if $hook['module_count'] && $can_move}
<input type="checkbox" id="Ghook{$hook['id_hook']}" class="floatr" style="margin-right: 2px;" onclick="hookCheckboxes({$hook['id_hook']}, 0, this)"/>
{/if}
{if !empty($hook['description'])}
&nbsp;<span style="font-size:0.8em; font-weight: normal">[{$hook['description']}]</span>
{/if}
<sub style="color:grey;"><i>({l s='Technical name: '}{$hook['name']})</i></sub></th></tr>
{if $hook['module_count']}
{foreach $hook['modules'] as $position => $module}
<tr id="{$hook['id_hook']}_{$module['instance']->id}" {cycle values='class="alt_row",'} style="height: 42px;">
{if !$display_key}
<td class="positions" width="40">{$module@iteration}</td>
<td {if $can_move && $hook['module_count'] >= 2} class="dragHandle"{/if} id="td_{$hook['id_hook']}_{$module['instance']->id}" width="40">
{if $can_move}
<a {if {$module@iteration} == 1} style="display: none;"{/if} href="{$current}&id_module={$module['instance']->id}&id_hook={$hook['id_hook']}&direction=0&token={$token}&changePosition#{$hook['name']}">
<img src="../img/admin/up.gif" alt="{l s='Up'}" title="{l s='Up'}" />
</a><br />
<a {if {$module@iteration} == count($hook['modules'])} style="display: none;"{/if} href="{$current}&id_module={$module['instance']->id}&id_hook={$hook['id_hook']}&direction=1&token={$token}&changePosition#{$hook['name']}">
<img src="../img/admin/down.gif" alt="{l s='Down'}" title="{l s='Down'}" />
</a>
{/if}
</td>
<td style="padding-left: 10px;"><label class="lab_modules_positions" for="mod{$hook['id_hook']}_{$module['instance']->id}">
{else}
<td style="padding-left: 10px;" colspan="3"><label class="lab_modules_positions" for="mod{$hook['id_hook']}_{$module['instance']->id}">
{/if}
<img src="../modules/{$module['instance']->name}/logo.gif" alt="{$module['instance']->name|stripslashes}" /> <strong>{$module['instance']->displayName|stripslashes}</strong>
{if $module['instance']->version} v{if $module['instance']->version|intval == $module['instance']->version}{sprintf('%.1f', $module['instance']->version)}{else}{$module['instance']->version|floatval}{/if}{/if}<br />{$module['instance']->description}
</label></td>
<td width="60">
<a href="{$current}&id_module={$module['instance']->id}&id_hook={$hook['id_hook']}&editGraft{if $display_key}&show_modules={$display_key}{/if}&token={$token}">
<img src="../img/admin/edit.gif" border="0" alt="{l s='Edit'}" title="{l s='Edit'}" />
</a>
<a href="{$current}&id_module={$module['instance']->id}&id_hook={$hook['id_hook']}&deleteGraft{if $display_key}&show_modules={$display_key}{/if}&token={$token}">
<img src="../img/admin/delete.gif" border="0" alt="{l s='Delete'}" title="{l s='Delete'}" />
</a>
<input type="checkbox" id="mod{$hook['id_hook']}_{$module['instance']->id}" class="hook{$hook['id_hook']}" onclick="hookCheckboxes({$hook['id_hook']}, 1, this)" name="unhooks[]" value="{$hook['id_hook']}_{$module['instance']->id}"/>
</td>
</tr>
{/foreach}
{else}
<tr><td colspan="4">{l s='No module for this hook'}</td></tr>
{/if}
</table>
{/foreach}
<div id="unhook_button_position_bottom"><input class="button floatr" type="submit" name="unhookform" value="{l s='Unhook the selection'}"/></div></form>
+5 -5
View File
@@ -367,8 +367,8 @@ class AdminControllerCore extends Controller
$token = Tools::getValue('token') ? Tools::getValue('token') : $this->token;
// Sub included tab postProcessing
$this->includeSubTab('postProcess', array('status', 'submitAdd1', 'submitDel', 'delete', 'submitFilter', 'submitReset'));
$this->includeSubTab('postProcess', array('status', 'submitAdd1', 'submitDel', 'delete', 'submitFilter', 'submitReset'));
if (!empty($this->action) && method_exists($this, 'process'.ucfirst(Tools::toCamelCase($this->action))))
$this->{'process'.Tools::toCamelCase($this->action)}($token);
else if (method_exists($this, $this->action))
@@ -856,7 +856,7 @@ class AdminControllerCore extends Controller
'href' => '#',
'desc' => $this->l('Save')
);
//no break
case 'view':
// Default cancel button - like old back link
if (!isset($this->no_back) || $this->no_back == false)
@@ -870,9 +870,9 @@ class AdminControllerCore extends Controller
'desc' => $this->l('Cancel')
);
}
break;
break;
case 'options':
break;
break;
default: // list
$this->toolbar_btn['new'] = array(
'href' => self::$currentIndex.'&amp;add'.$this->table.'&amp;token='.$this->token,
@@ -0,0 +1,374 @@
<?php
/*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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/osl-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 <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision: 7466 $
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
class AdminModulesPositionsControllerCore extends AdminController
{
private $displayKey = 0;
public function postProcess()
{
// Getting key value for display
if (Tools::getValue('show_modules') AND strval(Tools::getValue('show_modules')) != 'all')
$this->displayKey = (int)(Tools::getValue('show_modules'));
// Change position in hook
if (array_key_exists('changePosition', $_GET))
{
if ($this->tabAccess['edit'] === '1')
{
$id_module = (int)(Tools::getValue('id_module'));
$id_hook = (int)(Tools::getValue('id_hook'));
$module = Module::getInstanceById($id_module);
if (Validate::isLoadedObject($module))
{
$module->updatePosition($id_hook, (int)(Tools::getValue('direction')));
Tools::redirectAdmin(self::$currentIndex.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token);
}
else
$this->_errors[] = Tools::displayError('module cannot be loaded');
}
else
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
}
// Add new module in hook
elseif (Tools::isSubmit('submitAddToHook'))
{
if ($this->tabAccess['add'] === '1')
{
// Getting vars...
$id_module = (int)(Tools::getValue('id_module'));
$module = Module::getInstanceById($id_module);
$id_hook = (int)(Tools::getValue('id_hook'));
$hook = new Hook($id_hook);
if (!$id_module OR !Validate::isLoadedObject($module))
$this->_errors[] = Tools::displayError('module cannot be loaded');
elseif (!$id_hook OR !Validate::isLoadedObject($hook))
$this->_errors[] = Tools::displayError('Hook cannot be loaded.');
elseif (Hook::getModulesFromHook($id_hook, $id_module))
$this->_errors[] = Tools::displayError('This module is already transplanted to this hook.');
elseif (!$module->isHookableOn($hook->name))
$this->_errors[] = Tools::displayError('This module can\'t be transplanted to this hook.');
// Adding vars...
else
{
if (!$module->registerHook($hook->name, Context::getContext()->shop->getListOfID()))
$this->_errors[] = Tools::displayError('An error occurred while transplanting module to hook.');
else
{
$exceptions = Tools::getValue('exceptions');
$exceptions = (isset($exceptions[0])) ? $exceptions[0] : array();
$exceptions = explode(',', str_replace(' ', '', $exceptions));
foreach ($exceptions AS $except)
if (!Validate::isFileName($except))
$this->_errors[] = Tools::displayError('No valid value for field exceptions');
if (!$this->_errors && !$module->registerExceptions($id_hook, $exceptions, Context::getContext()->shop->getListOfID()))
$this->_errors[] = Tools::displayError('An error occurred while transplanting module to hook.');
}
if (!$this->_errors)
Tools::redirectAdmin(self::$currentIndex.'&conf=16'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token);
}
}
else
$this->_errors[] = Tools::displayError('You do not have permission to add here.');
}
// Edit module from hook
elseif (Tools::isSubmit('submitEditGraft'))
{
if ($this->tabAccess['add'] === '1')
{
// Getting vars...
$id_module = (int)(Tools::getValue('id_module'));
$module = Module::getInstanceById($id_module);
$id_hook = (int)(Tools::getValue('id_hook'));
$hook = new Hook($id_hook);
if (!$id_module OR !Validate::isLoadedObject($module))
$this->_errors[] = Tools::displayError('module cannot be loaded');
elseif (!$id_hook OR !Validate::isLoadedObject($hook))
$this->_errors[] = Tools::displayError('Hook cannot be loaded.');
else
{
$exceptions = Tools::getValue('exceptions');
if (is_array($exceptions))
{
foreach ($exceptions as $id => $exception)
{
$exception = explode(',', str_replace(' ', '', $exception));
// Check files name
foreach ($exception AS $except)
if (!Validate::isFileName($except))
$this->_errors[] = Tools::displayError('No valid value for field exceptions');
$exceptions[$id] = $exception;
}
// Add files exceptions
if (!$module->editExceptions($id_hook, $exceptions))
$this->_errors[] = Tools::displayError('An error occurred while transplanting module to hook.');
if (!$this->_errors)
Tools::redirectAdmin(self::$currentIndex.'&conf=16'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token);
}
else
{
$exceptions = explode(',', str_replace(' ', '', $exceptions));
// Check files name
foreach ($exceptions AS $except)
if (!Validate::isFileName($except))
$this->_errors[] = Tools::displayError('No valid value for field exceptions');
// Add files exceptions
if (!$module->editExceptions($id_hook, $exceptions, Context::getContext()->shop->getListOfID()))
$this->_errors[] = Tools::displayError('An error occurred while transplanting module to hook.');
else
Tools::redirectAdmin(self::$currentIndex.'&conf=16'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token);
}
}
}
else
$this->_errors[] = Tools::displayError('You do not have permission to add here.');
}
// Delete module from hook
elseif (array_key_exists('deleteGraft', $_GET))
{
if ($this->tabAccess['delete'] === '1')
{
$id_module = (int)(Tools::getValue('id_module'));
$module = Module::getInstanceById($id_module);
$id_hook = (int)(Tools::getValue('id_hook'));
$hook = new Hook($id_hook);
if (!Validate::isLoadedObject($module))
$this->_errors[] = Tools::displayError('module cannot be loaded');
elseif (!$id_hook OR !Validate::isLoadedObject($hook))
$this->_errors[] = Tools::displayError('Hook cannot be loaded.');
else
{
if (!$module->unregisterHook($id_hook, Context::getContext()->shop->getListOfID()) OR !$module->unregisterExceptions($id_hook, Context::getContext()->shop->getListOfID()))
$this->_errors[] = Tools::displayError('An error occurred while deleting module from hook.');
else
Tools::redirectAdmin(self::$currentIndex.'&conf=17'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token);
}
}
else
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
}
elseif (Tools::isSubmit('unhookform'))
{
if (!($unhooks = Tools::getValue('unhooks')) OR !is_array($unhooks))
$this->_errors[] = Tools::displayError('Select a module to unhook.');
else
{
foreach ($unhooks as $unhook)
{
$explode = explode('_', $unhook);
$id_hook = $explode[0];
$id_module = $explode[1];
$module = Module::getInstanceById((int)($id_module));
$hook = new Hook((int)($id_hook));
if (!Validate::isLoadedObject($module))
$this->_errors[] = Tools::displayError('module cannot be loaded');
elseif (!$id_hook OR !Validate::isLoadedObject($hook))
$this->_errors[] = Tools::displayError('Hook cannot be loaded.');
else
{
if (!$module->unregisterHook((int)($id_hook)) OR !$module->unregisterExceptions((int)($id_hook)))
$this->_errors[] = Tools::displayError('An error occurred while deleting module from hook.');
}
}
if (!sizeof($this->_errors))
Tools::redirectAdmin(self::$currentIndex.'&conf=17'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token);
}
}
}
public function initContent()
{
if (array_key_exists('addToHook', $_GET) OR array_key_exists('editGraft', $_GET) OR (Tools::isSubmit('submitAddToHook') AND $this->_errors))
{
$this->display = 'edit';
$this->content .= $this->initForm();
}
else
$this->content .= $this->initMain();
$this->context->smarty->assign(array('content' => $this->content));
}
public function initMain()
{
$admin_dir = basename(_PS_ADMIN_DIR_);
$modules = Module::getModulesInstalled();
$assoc_modules_id = array();
foreach ($modules as $module)
if ($tmpInstance = Module::getInstanceById((int)$module['id_module']))
{
// We want to be able to sort modules by display name
$module_instances[$tmpInstance->displayName] = $tmpInstance;
// But we also want to associate hooks to modules using the modules IDs
$assoc_modules_id[(int)$module['id_module']] = $tmpInstance->displayName;
}
ksort($module_instances);
$hooks = Hook::getHooks(!(int)(Tools::getValue('hook_position')));
foreach ($hooks as $key => $hook)
{
// Get all modules for this hook or only the filtered module
$hooks[$key]['modules'] = Hook::getModulesFromHook($hook['id_hook'], $this->displayKey);
$hooks[$key]['module_count'] = count($hooks[$key]['modules']);
// If modules were found, link to the previously created Module instances
if (is_array($hooks[$key]['modules']) && !empty($hooks[$key]['modules']))
foreach($hooks[$key]['modules'] as $module_key => $module)
$hooks[$key]['modules'][$module_key]['instance'] = $module_instances[$assoc_modules_id[$module['id_module']]];
}
$this->addJqueryPlugin("tablednd");
$this->context->smarty->assign(array(
'url_transplant' => self::$currentIndex.'&addToHook'.($this->displayKey ? '&show_modules='.$this->displayKey : '').'&token='.$this->token,
'token' => $this->token,
'url_show_modules' => self::$currentIndex.'&token='.$this->token.'&show_modules=',
'modules' => $module_instances,
'url_show_invisible' => self::$currentIndex.'&token='.$this->token.'&show_modules='.(int)(Tools::getValue('show_modules')).'&hook_position=',
'hook_position' => Tools::getValue('hook_position'),
'live_edit' => Shop::isFeatureActive() && $this->context->shop->getContextType() != Shop::CONTEXT_SHOP,
'url_live_edit' => $this->context->link->getPageLink('index', false, null, 'live_edit&ad='.$admin_dir.'&liveToken='.sha1($admin_dir._COOKIE_KEY_).((Shop::isFeatureActive()) ? '&id_shop='.Context::getContext()->shop->getID() : '')),
'display_key' => $this->displayKey,
'hooks' => $hooks,
'url_submit' => self::$currentIndex.'&token='.$this->token,
'can_move' => (Shop::isFeatureActive() && $this->context->shop->getContextType() != Shop::CONTEXT_SHOP) ? false : true,
));
return $this->context->smarty->fetch('modules_positions/list_modules.tpl');
}
public function initForm()
{
// toolbar (save, cancel, new, ..)
$this->initToolbar();
$id_module = (int)(Tools::getValue('id_module'));
$id_hook = (int)(Tools::getValue('id_hook'));
if (Tools::isSubmit('editGraft'))
{
// Check auth for this page
if (!$id_module || !$id_hook)
Tools::redirectAdmin(self::$currentIndex . '&token='.$this->token);
$sql = 'SELECT id_module
FROM '._DB_PREFIX_.'hook_module
WHERE id_module = '.$id_module.'
AND id_hook = '.$id_hook.'
AND id_shop IN('.implode(', ', Context::getContext()->shop->getListOfID()).')';
if (!Db::getInstance()->getValue($sql))
Tools::redirectAdmin(self::$currentIndex . '&token='.$this->token);
$slModule = Module::getInstanceById($id_module);
$exceptsList = $slModule->getExceptions($id_hook, true);
$exceptsDiff = false;
$excepts = '';
if ($exceptsList)
{
$first = current($exceptsList);
foreach ($exceptsList as $k => $v)
if (array_diff($v, $first) || array_diff($first, $v))
$exceptsDiff = true;
if (!$exceptsDiff)
$excepts = implode(', ', $first);
}
}
else
{
$exceptsDiff = false;
$exceptsList = Tools::getValue('exceptions', array(array()));
}
$modules = Module::getModulesInstalled(0);
$instances = array();
foreach ($modules AS $module)
if ($tmpInstance = Module::getInstanceById($module['id_module']))
$instances[$tmpInstance->displayName] = $tmpInstance;
ksort($instances);
$modules = $instances;
$hooks = Hook::getHooks(0);
$exception_list_diff = array();
foreach ($exceptsList as $shopID => $fileList)
$exception_list_diff[] = $this->displayModuleExceptionList($fileList, $shopID);
$tpl = $this->context->smarty->createTemplate('modules_positions/form.tpl');
$tpl->assign(array(
'url_submit' => self::$currentIndex.'&token='.$this->token,
'edit_graft' => Tools::isSubmit('editGraft'),
'id_module' => (int)Tools::getValue('id_module'),
'id_hook' => (int)Tools::getValue('id_hook'),
'show_modules' => Tools::getValue('show_modules'),
'hooks' => $hooks,
'exception_list' => $this->displayModuleExceptionList(array_shift($exceptsList), 0),
'exception_list_diff' => $exception_list_diff,
'except_diff' => isset($exceptsDiff) ? $exceptsDiff : null,
'display_key' => $this->displayKey,
'modules' => $modules,
'show_toolbar' => true,
'toolbar_btn' => $this->toolbar_btn,
'table' => 'hook_module',
));
return $tpl->fetch();
}
public function displayModuleExceptionList($fileList, $shopID)
{
if (!is_array($fileList))
$fileList = ($fileList) ? array($fileList) : array();
$content = '<input type="text" name="exceptions['.$shopID.']" size="40" value="' . implode(', ', $fileList) . '" id="em_text_'.$shopID.'">';
if ($shopID)
$content .= ' ('.Shop::getInstance($shopID)->name.')';
$content .= '<br /><select id="em_list_'.$shopID.'">';
// @todo do something better with controllers
$controllers = Dispatcher::getControllers(_PS_FRONT_CONTROLLER_DIR_);
ksort($controllers);
foreach ($controllers as $k => $v)
{
$content .= '<option value="'.$k.'">'.$k.'</option>';
}
$content .= '</select> <input type="button" class="button" value="'.$this->l('Add').'" onclick="position_exception_add('.$shopID.')" />
<input type="button" class="button" value="'.$this->l('Remove').'" onclick="position_exception_remove('.$shopID.')" /><br /><br />';
return $content;
}
}