From 651a1a3100544356d9fd89646b82170b7734b2ec Mon Sep 17 00:00:00 2001 From: Byrne Date: Tue, 10 Nov 2009 22:06:47 -0800 Subject: [PATCH] Made it so the plugin whose settings were saved will be the plugin currently selected when the user is returned to the edit plugin settings screen. This is necessary because the default behavior is simply to auto-select whatever happens to be the first plugin in the list. --- lib/MT/CMS/Plugin.pm | 5 ++++- tmpl/cms/include/plugins_content_nav.tmpl | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/MT/CMS/Plugin.pm b/lib/MT/CMS/Plugin.pm index d3df09e3f..ad32dc676 100644 --- a/lib/MT/CMS/Plugin.pm +++ b/lib/MT/CMS/Plugin.pm @@ -35,6 +35,7 @@ sub cfg_plugins { $param{reset} = 1 if $app->param('reset'); $param{saved} = 1 if $app->param('saved'); $param{mod_perl} = 1 if $ENV{MOD_PERL}; + $param{plugin} = $app->param('plugin'); $param{screen_id} = "list-plugins"; $param{screen_class} = "plugin-settings"; build_plugin_table( $app, param => \%param, scope => $q->param('blog_id') ? 'blog:'.$q->param('blog_id') : 'system' ); @@ -73,6 +74,7 @@ sub save_config { } $app->add_return_arg( saved => 1 ); + $app->add_return_arg( plugin => $profile->{object}->id ); $app->call_return; } @@ -285,7 +287,8 @@ sub build_plugin_table { plugin_config_link => $plugin->config_link(), plugin_config_html => $config_html, plugin_settings_id => $settings->id, - plugin_id => $id, + plugin_id => $plugin->id, + plugin_num => $id, plugin_compat_errors => $registry->{compat_errors}, }; my $block_tags = $plugin->registry('tags', 'block'); diff --git a/tmpl/cms/include/plugins_content_nav.tmpl b/tmpl/cms/include/plugins_content_nav.tmpl index 67b172cff..859fd4001 100644 --- a/tmpl/cms/include/plugins_content_nav.tmpl +++ b/tmpl/cms/include/plugins_content_nav.tmpl @@ -10,15 +10,19 @@ $(document).ready( function() { $(this).parent().addClass('active'); $('#' + newactive).show(); }); + + $('#content-nav ul li a[title="plugin-<$mt:var name="plugin"$>"]').trigger('click'); + if (a && $('#content-nav ul li a[title="'+a[1]+'"]')) { $('#content-nav ul li a[title="'+a[1]+'"]').trigger('click'); } else { $('#content-nav ul li:first-child').find('a').trigger('click'); } + });