From bb28baec6848edbfd99d3c2fbe72c1c90fa2be6c Mon Sep 17 00:00:00 2001 From: fSerny Date: Mon, 19 Dec 2011 17:31:33 +0000 Subject: [PATCH] [-] BO : Bulk action management repaired git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11386 b9a71923-0436-4b27-9f14-aed3839534dd --- admin-dev/themes/template/modules/js.tpl | 85 +++++++++++++------- admin-dev/themes/template/modules/list.tpl | 10 +-- admin-dev/themes/template/modules/page.tpl | 6 ++ controllers/admin/AdminModulesController.php | 2 +- 4 files changed, 66 insertions(+), 37 deletions(-) diff --git a/admin-dev/themes/template/modules/js.tpl b/admin-dev/themes/template/modules/js.tpl index 275871823..fb5738d33 100644 --- a/admin-dev/themes/template/modules/js.tpl +++ b/admin-dev/themes/template/modules/js.tpl @@ -36,14 +36,13 @@ var ajaxCurrentIndex = '{$ajaxCurrentIndex}'; var by = '{l s='by'}'; var errorLogin = '{l s='Could not login to Addons'}'; - - {if isset($smarty.get.anchor)} - $('document').ready( function() { - $.scrollTo('#{$smarty.get.anchor|htmlentities|replace:'(':''|replace:')':''|replace:'{':''|replace:'}':''}', 1200, {literal}{offset: -100}{/literal}); - }); - {/if} + {if isset($smarty.get.anchor)}var anchor = '{$smarty.get.anchor|htmlentities|replace:'(':''|replace:')':''|replace:'{':''|replace:'}':''}';{else}var anchor = '';{/if} + + + {literal} + function getPrestaStore(){if(getE("prestastore").style.display!='block')return;$.post(dirNameCurrentIndex+"/ajax.php",{page:"prestastore"},function(a){getE("prestastore-content").innerHTML=a;})} function truncate_author(author){return ((author.length > 20) ? author.substring(0, 20)+"..." : author);} function modules_management(action) @@ -65,7 +64,19 @@ } document.location.href=currentIndex+'&token='+token+'&'+action+'='+module_list.substring(1, module_list.length); } + + $('document').ready( function() { + + + + // ScrollTo + if (anchor != '') + $.scrollTo('#'+anchor, 1200, {offset: -100}); + + + + // AutoComplete Search $('input[name="filtername"]').autocomplete(moduleList, { minChars: 0, width: 310, @@ -84,13 +95,30 @@ $('input[name="filtername"]').result(function(event, data, formatted) { $('#filternameForm').submit(); }); - }); + + + + // Method to check / uncheck all modules checkbox + $('#checkme').click(function() + { + if ($(this).attr("rel") == 'false') + { + $(this).attr("checked", "checked"); + $(this).attr("rel", "true"); + $("input[name=modules]").attr("checked", "checked"); + } + else + { + $(this).attr("checked", ""); + $(this).attr("rel", "false"); + $("input[name=modules]").attr("checked", ""); + } + }); - // Method to reload filter in ajax - $(document).ready(function(){ + // Method to reload filter in ajax $('.categoryModuleFilterLink').click(function() { $('.categoryModuleFilterLink').css('background-color', 'white'); @@ -125,25 +153,22 @@ catch(e){} return false; }); - }); - - // Method to get modules_list.xml from prestashop.com and default_country_modules_list.xml from addons.prestashop.com - $(document).ready(function(){ - try - { - resAjax = $.ajax({ - type:"POST", - url : ajaxCurrentIndex, - async: true, - data : { - ajaxMode : "1", - ajax : "1", - token : token, - controller : "AdminModules", - action : "refreshModuleList" + // Method to get modules_list.xml from prestashop.com and default_country_modules_list.xml from addons.prestashop.com + try + { + resAjax = $.ajax({ + type:"POST", + url : ajaxCurrentIndex, + async: true, + data : { + ajaxMode : "1", + ajax : "1", + token : token, + controller : "AdminModules", + action : "refreshModuleList" }, success : function(res,textStatus,jqXHR) { @@ -155,12 +180,11 @@ } }); } - catch(e){} - }); + catch(e) { } - // Method to log on PrestaShop Addons WebServices - $(document).ready(function(){ + + // Method to log on PrestaShop Addons WebServices $('#addons_login_button').click(function() { var username_addons = $("#username_addons").val(); @@ -204,6 +228,9 @@ catch(e){} return false; }); + + + }); {/literal} diff --git a/admin-dev/themes/template/modules/list.tpl b/admin-dev/themes/template/modules/list.tpl index f50bbde20..e83ed0217 100644 --- a/admin-dev/themes/template/modules/list.tpl +++ b/admin-dev/themes/template/modules/list.tpl @@ -33,11 +33,7 @@ -
- +
{l s='Module name'} @@ -46,7 +42,7 @@ {foreach from=$modules item=module} - + confirmUninstall) OR empty($module->confirmUninstall)}rel="false"{else}rel="{$module->confirmUninstall|addslashes}"{/if} class="noborder">
@@ -74,7 +70,7 @@
- {if isset($module->id) && $module->id gt 0}{l s='Uninstall'}{else}{l s='Install'}{/if} + id) && $module->id gt 0 && !empty($module->options.uninstall_onclick)}onclick="{$module->options.uninstall_onclick}"{/if} href="{if isset($module->id) && $module->id gt 0}{$module->options.uninstall_url}{else}{$module->options.install_url}{/if}" class="button installed">{if isset($module->id) && $module->id gt 0}{l s='Uninstall'}{else}{l s='Install'}{/if} {/foreach} diff --git a/admin-dev/themes/template/modules/page.tpl b/admin-dev/themes/template/modules/page.tpl index a772f7253..0c49185d6 100644 --- a/admin-dev/themes/template/modules/page.tpl +++ b/admin-dev/themes/template/modules/page.tpl @@ -48,6 +48,12 @@
{include file='modules/list.tpl'} + {if count($modules)} +
+ + +
+ {/if}
diff --git a/controllers/admin/AdminModulesController.php b/controllers/admin/AdminModulesController.php index 222cac584..3d7add1eb 100644 --- a/controllers/admin/AdminModulesController.php +++ b/controllers/admin/AdminModulesController.php @@ -817,7 +817,7 @@ class AdminModulesControllerCore extends AdminController $modules[$km]->categoryName = (isset($this->list_modules_categories[$module->tab]['name']) ? $this->list_modules_categories[$module->tab]['name'] : $this->list_modules_categories['others']['name']); $modules[$km]->options['install_url'] = self::$currentIndex.'&install='.urlencode($module->name).'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name.'&anchor=anchor'.ucfirst($module->name); $modules[$km]->options['uninstall_url'] = self::$currentIndex.'&uninstall='.urlencode($module->name).'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name.'&anchor=anchor'.ucfirst($module->name); - $modules[$km]->options['uninstall_onclick'] = ((!method_exists($module, 'onclickOption')) ? ((empty($module->confirmUninstall)) ? '' : 'if(confirm(\''.addslashes($module->confirmUninstall).'\')) ').'document.location.href=\''.$modules[$km]->options['uninstall_url'].'\'' : $module->onclickOption('uninstall', $modules[$km]->options['uninstall_url'])); + $modules[$km]->options['uninstall_onclick'] = ((!method_exists($module, 'onclickOption')) ? ((empty($module->confirmUninstall)) ? '' : 'return confirm(\''.addslashes($module->confirmUninstall).'\');') : $module->onclickOption('uninstall', $modules[$km]->options['uninstall_url'])); if (Tools::getValue('module_name') == $module->name && (int)Tools::getValue('conf') > 0) $modules[$km]->message = $this->_conf[(int)Tools::getValue('conf')];