Skip to content

Commit

Permalink
Made it so the plugin whose settings were saved will be the plugin cu…
Browse files Browse the repository at this point in the history
…rrently 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.
  • Loading branch information
byrnereese committed Nov 11, 2009
1 parent 96c9c4d commit 651a1a3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion lib/MT/CMS/Plugin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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' );
Expand Down Expand Up @@ -73,6 +74,7 @@ sub save_config {
}

$app->add_return_arg( saved => 1 );
$app->add_return_arg( plugin => $profile->{object}->id );
$app->call_return;
}

Expand Down Expand Up @@ -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');
Expand Down
6 changes: 5 additions & 1 deletion tmpl/cms/include/plugins_content_nav.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,19 @@ $(document).ready( function() {
$(this).parent().addClass('active');
$('#' + newactive).show();
});
<mt:if name="plugin">
$('#content-nav ul li a[title="plugin-<$mt:var name="plugin"$>"]').trigger('click');
<mt:else>
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');
}
</mt:if>
});
</script>
<ul>
<mt:loop name="plugin_loop">
<li><a href="javascript:void(0)" title="plugin-<$mt:var name="plugin_id" dirify="1"$>"><b><$mt:var name="plugin_name"$></b></a></li>
<li<mt:if name="plugin" eq="$plugin_id"> class="active"</mt:if>><a href="javascript:void(0)" title="plugin-<$mt:var name="plugin_id" dirify="1"$>"><b><$mt:var name="plugin_name"$></b></a></li>
</mt:loop>
</ul>

0 comments on commit 651a1a3

Please sign in to comment.