Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

//fixed bug when install module from specific tab

  • Loading branch information...
commit 70bc9b7f6e1f56ed4c42ddc539db519a9c4e6a5b 1 parent 6b4738c
@vAugagneur vAugagneur authored
View
1  admin-dev/themes/default/template/controllers/modules/tab_module_line.tpl
@@ -68,7 +68,6 @@
<div class="clear">&nbsp;</div>
<a href="#" class="button action_tab_module" data-option="select_{$module->name}" class="button">Valider</a>
{else}
-
<a href="{$module->options.install_url}" class="button">{l s='Install'}</a>
{/if}
</td>
View
18 admin-dev/themes/default/template/controllers/modules/tab_modules_list.tpl
@@ -27,21 +27,7 @@
{if isset($tab_modules_list) && !empty($tab_modules_list)}
<script type="text/javascript">
$(document).ready(function() {
- $('.action_tab_module').each( function (){
- $(this).click(function () {
- option = $('#'+$(this).data('option')+' :selected');
- if ($(option).data('onclick') != '')
- {
- var f = eval("(function(){ "+$(option).data('onclick')+"})");
- if (f.call())
- window.location.href = $(option).data('href');
- }
- else
- window.location.href = $(option).data('href');
- return false;
- });
- });
-
+
$('#nav_tabs_modules_installed').click(function () { showInstalledModules() });
$('#nav_tabs_modules_not_installed').click(function () { showNotInstalledModules() });
@@ -50,6 +36,8 @@
{else}
showNotInstalledModules();
{/if}
+
+ bindTabModuleListAction();
});
function showInstalledModules(element)
View
22 classes/controller/AdminController.php
@@ -2876,9 +2876,11 @@ public function fillModuleData(&$module, $output_type = 'link', $back = null)
if (file_exists('../modules/'.$module->name.'/logo.png'))
$module->logo = 'logo.png';
$module->optionsHtml = $this->displayModuleOptions($module, $output_type);
- $module->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);
- $module->options['update_url'] = self::$currentIndex.'&update='.urlencode($module->name).'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name.'&anchor=anchor'.ucfirst($module->name);
- $module->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);
+ $link_admin_modules = $this->context->link->getAdminLink('AdminModules', true);
+
+ $module->options['install_url'] = $link_admin_modules.'&install='.urlencode($module->name).'&tab_module='.$module->tab.'&module_name='.$module->name.'&anchor=anchor'.ucfirst($module->name);
+ $module->options['update_url'] = $link_admin_modules.'&update='.urlencode($module->name).'&tab_module='.$module->tab.'&module_name='.$module->name.'&anchor=anchor'.ucfirst($module->name);
+ $module->options['uninstall_url'] = $link_admin_modules.'&uninstall='.urlencode($module->name).'&tab_module='.$module->tab.'&module_name='.$module->name.'&anchor=anchor'.ucfirst($module->name);
$module->options['uninstall_onclick'] = ((!$module->onclick_option) ?
((empty($module->confirmUninstall)) ? '' : 'return confirm(\''.addslashes($module->confirmUninstall).'\');') :
@@ -2916,31 +2918,31 @@ public function displayModuleOptions($module, $output_type = 'link', $back = nul
$this->translationsTab['Uninstall'] = $this->l('Uninstall');
$this->translationsTab['This action will permanently remove the module from the server. Are you sure you want to do this?'] = $this->l('This action will permanently remove the module from the server. Are you sure you want to do this?');
}
-
+ $link_admin_modules = $this->context->link->getAdminLink('AdminModules', true);
$modules_options = array(
'configure-module' => array(
- 'href' => self::$currentIndex.'&configure='.urlencode($module->name).'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.urlencode($module->name),
+ 'href' => $link_admin_modules.'&configure='.urlencode($module->name).'&tab_module='.$module->tab.'&module_name='.urlencode($module->name),
'onclick' => $module->onclick_option && isset($module->onclick_option_content['configure']) ? $module->onclick_option_content['configure'] : '',
'title' => '',
'text' => $this->translationsTab['Configure'],
'cond' => $module->id && isset($module->is_configurable) && $module->is_configurable,
),
'desactive-module' => array(
- 'href' => self::$currentIndex.'&token='.$this->token.'&module_name='.urlencode($module->name).'&'.($module->active ? 'enable=0' : 'enable=1').'&tab_module='.$module->tab,
+ 'href' => $link_admin_modules.'&module_name='.urlencode($module->name).'&'.($module->active ? 'enable=0' : 'enable=1').'&tab_module='.$module->tab,
'onclick' => $module->active && $module->onclick_option && isset($module->onclick_option_content['desactive']) ? $module->onclick_option_content['desactive'] : '' ,
'title' => Shop::isFeatureActive() ? htmlspecialchars($module->active ? $this->translationsTab['Disable this module'] : $this->translationsTab['Enable this module for all shops']) : '',
'text' => $module->active ? $this->translationsTab['Disable'] : $this->translationsTab['Enable'],
'cond' => $module->id,
),
'reset-module' => array(
- 'href' => self::$currentIndex.'&token='.$this->token.'&module_name='.urlencode($module->name).'&reset&tab_module='.$module->tab,
+ 'href' => $link_admin_modules.'&module_name='.urlencode($module->name).'&reset&tab_module='.$module->tab,
'onclick' => $module->onclick_option && isset($module->onclick_option_content['reset']) ? $module->onclick_option_content['reset'] : '',
'title' => '',
'text' => $this->translationsTab['Reset'],
'cond' => $module->id && $module->active,
),
'delete-module' => array(
- 'href' => self::$currentIndex.'&delete='.urlencode($module->name).'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.urlencode($module->name),
+ 'href' => $link_admin_modules.'&delete='.urlencode($module->name).'&tab_module='.$module->tab.'&module_name='.urlencode($module->name),
'onclick' => $module->onclick_option && isset($module->onclick_option_content['delete']) ? $module->onclick_option_content['delete'] : 'return confirm(\''.$this->translationsTab['This action will permanently remove the module from the server. Are you sure you want to do this?'].'\');',
'title' => '',
'text' => $this->translationsTab['Delete'],
@@ -2964,9 +2966,9 @@ public function displayModuleOptions($module, $output_type = 'link', $back = nul
if ($output_type == 'select')
{
if (!$module->id)
- $return = '<option data-onclick="" data-href="'.self::$currentIndex.'&install='.urlencode($module->name).'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name.'&anchor=anchor'.ucfirst($module->name).(!is_null($back) ? '&back='.urlencode($back) : '').'" >'.$this->translationsTab['Install'].'</option>'.$return;
+ $return = '<option data-onclick="" data-href="'.$link_admin_modules.'&install='.urlencode($module->name).'&tab_module='.$module->tab.'&module_name='.$module->name.'&anchor=anchor'.ucfirst($module->name).(!is_null($back) ? '&back='.urlencode($back) : '').'" >'.$this->translationsTab['Install'].'</option>'.$return;
else
- $return .= '<option data-onclick="" data-href="'.self::$currentIndex.'&uninstall='.urlencode($module->name).'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name.'&anchor=anchor'.ucfirst($module->name).(!is_null($back) ? '&back='.urlencode($back) : '').'" >'.$this->translationsTab['Uninstall'].'</option>';
+ $return .= '<option data-onclick="" data-href="'.$link_admin_modules.'&uninstall='.urlencode($module->name).'&tab_module='.$module->tab.'&module_name='.$module->name.'&anchor=anchor'.ucfirst($module->name).(!is_null($back) ? '&back='.urlencode($back) : '').'" >'.$this->translationsTab['Uninstall'].'</option>';
$return = '<select id="select_'.$module->name.'">'.$return.'</select>';
}
View
23 js/admin.js
@@ -810,8 +810,31 @@ $(document).ready(function()
$(this).slideUp('fast');
clearTimeout(ajax_running_timeout);
});
+
+ bindTabModuleListAction();
+
});
+
+function bindTabModuleListAction()
+{
+ $('.action_tab_module').each( function (){
+ $(this).click(function () {
+ option = $('#'+$(this).data('option')+' :selected');
+ if ($(option).data('onclick') != '')
+ {
+
+ var f = eval("(function(){ "+$(option).data('onclick')+"})");
+ if (f.call())
+ window.location.href = $(option).data('href');
+ }
+ else
+ window.location.href = $(option).data('href');
+ return false;
+ });
+ });
+}
+
// Delete all tags HTML
function stripHTML(oldString)
{
Please sign in to comment.
Something went wrong with that request. Please try again.