diff --git a/admin-dev/themes/default/template/controllers/modules/js.tpl b/admin-dev/themes/default/template/controllers/modules/js.tpl index b0bc45df2..d920b668b 100644 --- a/admin-dev/themes/default/template/controllers/modules/js.tpl +++ b/admin-dev/themes/default/template/controllers/modules/js.tpl @@ -321,6 +321,46 @@ catch(e){} return false; }); + + $('.toggle_favorite').live('click', function(event) + { + var el = $(this); + var value_pref = el.data('value'); + var module_pref = el.data('module'); + var action_pref = 'f'; + try + { + resAjax = $.ajax({ + type:"POST", + url : ajaxCurrentIndex, + async: true, + data : { + ajax : "1", + token : token, + controller : "AdminModules", + action : "saveFavoritePreferences", + action_pref : action_pref, + module_pref : module_pref, + value_pref : value_pref + }, + success : function(data) + { + // res.status = cache or refresh + if (data == 'OK') + { + el.parent('div').find('.toggle_favorite').toggle(); + } + + }, + error: function(res,textStatus,jqXHR) + { + //jAlert("TECHNICAL ERROR"+res); + } + }); + } + catch(e){} + return false; + }); }); {/literal} diff --git a/admin-dev/themes/default/template/controllers/modules/list.tpl b/admin-dev/themes/default/template/controllers/modules/list.tpl index ff01f4620..aaee81658 100644 --- a/admin-dev/themes/default/template/controllers/modules/list.tpl +++ b/admin-dev/themes/default/template/controllers/modules/list.tpl @@ -79,7 +79,18 @@

{if isset($module->description) && $module->description ne ''}{l s='Description'} : {$module->description}{else} {/if}

{if isset($module->message)}
{$module->message}
{/if}
- {if !isset($module->not_on_disk)}{$module->optionsHtml}{else} {/if} + {if !isset($module->not_on_disk)} + {$module->optionsHtml} + {if isset($module->preferences) && $module->preferences['favorite'] == 1} + {l s='Remove from Favorites'} + + {else} + + {l s='Mark as Favorite'} + {/if} + {else} +   + {/if}
diff --git a/classes/Tools.php b/classes/Tools.php index ca10a4785..08705746b 100644 --- a/classes/Tools.php +++ b/classes/Tools.php @@ -2347,16 +2347,16 @@ exit; $addons_url = 'api.addons.prestashop.com'; $postData = ''; $postDataArray = array( - 'version' => _PS_VERSION_, - 'iso_lang' => strtolower(Context::getContext()->language->iso_code), - 'iso_code' => strtolower(Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'))), - 'shop_url' => urlencode(Tools::getShopDomain()), - 'mail' => urlencode(Configuration::get('PS_SHOP_EMAIL')) + 'version' => isset($params['version']) ? $params['version'] : _PS_VERSION_, + 'iso_lang' => Tools::strtolower(isset($params['iso_lang']) ? $params['iso_lang'] : Context::getContext()->language->iso_code), + 'iso_code' => Tools::strtolower(isset($params['iso_country']) ? $params['iso_country'] : Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'))), + 'shop_url' => urlencode(isset($params['shop_url']) ? $params['shop_url'] : Tools::getShopDomain()), + 'mail' => urlencode(isset($params['email']) ? $params['email'] : Configuration::get('email')) ); foreach ($postDataArray as $postDataKey => $postDataValue) $postData .= '&'.$postDataKey.'='.$postDataValue; $postData = ltrim($postData, '&'); - + // Config for each request if ($request == 'native') { diff --git a/install-dev/controllers/http/process.php b/install-dev/controllers/http/process.php index 047a84370..f9d98996f 100644 --- a/install-dev/controllers/http/process.php +++ b/install-dev/controllers/http/process.php @@ -331,8 +331,6 @@ class InstallControllerHttpProcess extends InstallControllerHttp */ public function display() { - $this->initializeContext(); - // The installer SHOULD take less than 32M, but may take up to 35/36M sometimes. So 42M is a good value :) $low_memory = Tools::getMemoryLimit() < Tools::getOctets('42M'); @@ -361,8 +359,15 @@ class InstallControllerHttpProcess extends InstallControllerHttp $this->process_steps[] = $install_modules; $install_modules = array('key' => 'installModulesAddons', 'lang' => $this->l('Install modules Addons')); + + $params = array('iso_lang' => $this->language->getLanguageIso(), + 'iso_country' => $this->session->shop_country, + 'email' => $this->session->admin_email, + 'shop_url' => Tools::getHttpHost(), + 'version' => _PS_INSTALL_VERSION_); + if ($low_memory) - foreach ($this->model_install->getAddonsModulesList() as $module) + foreach ($this->model_install->getAddonsModulesList($params) as $module) $install_modules['subtasks'][] = array('module' => (string)$module['name'], 'id_module' => (string)$module['id_module']); $this->process_steps[] = $install_modules; diff --git a/install-dev/models/install.php b/install-dev/models/install.php index 2780f23de..ca62908fc 100644 --- a/install-dev/models/install.php +++ b/install-dev/models/install.php @@ -587,10 +587,10 @@ class InstallModelInstall extends InstallAbstractModel return $modules; } - public function getAddonsModulesList() + public function getAddonsModulesList($params = array()) { $addons_modules = array(); - $content = Tools::addonsRequest('install-modules'); + $content = Tools::addonsRequest('install-modules', $params); $xml = @simplexml_load_string($content, null, LIBXML_NOCDATA); if ($xml !== false and isset($xml->module))