diff --git a/lib/MT/App/CMS.pm b/lib/MT/App/CMS.pm index 70b90810b..e2d8c63ef 100644 --- a/lib/MT/App/CMS.pm +++ b/lib/MT/App/CMS.pm @@ -647,7 +647,36 @@ sub core_list_actions { permission => 'edit_templates', order => 100, }, - + publish_manual => { + label => 'Publish Manually', + order => 105, + code => 'MT::CMS::Template::itemset_man', + condition => sub { defined $app->blog; } + }, + publish_static => { + label => 'Publish Statically', + order => 106, + code => 'MT::CMS::Template::itemset_stc', + condition => sub { defined $app->blog; } + }, + publish_pubqueue => { + label => 'Publish via Publish Queue', + order => 107, + code => 'MT::CMS::Template::itemset_vpq', + condition => sub { defined $app->blog; } + }, + publish_dynamic => { + label => 'Publish Dynamically', + order => 108, + code => 'MT::CMS::Template::itemset_dyn', + condition => sub { defined $app->blog; } + }, + publish_disable => { + label => 'Disable Publishing', + order => 109, + code => 'MT::CMS::Template::itemset_dis', + condition => sub { defined $app->blog; } + }, # Now a button! # publish_index_templates => { # label => "Publish Template(s)", diff --git a/lib/MT/CMS/Template.pm b/lib/MT/CMS/Template.pm index 3cb0dbc78..54098feb1 100644 --- a/lib/MT/CMS/Template.pm +++ b/lib/MT/CMS/Template.pm @@ -8,6 +8,32 @@ package MT::CMS::Template; use strict; + +###This is put here to accommodate bug fix 256 which is +###a merge with Byrne Reese's Batch Template Options plugin +use MT::PublishOption; + +sub itemset_handler { + my ($app,$type) = @_; + $app->validate_magic or return; + require MT::Template; + my @tmpls = $app->param('id'); + for my $tmpl_id (@tmpls) { + my $tmpl = MT::Template->load($tmpl_id) or next; + $tmpl->build_type($type); + $tmpl->save(); + } + $app->add_return_arg( pub_changed => 1 ); + $app->call_return; +} + +sub itemset_vpq { return itemset_handler(@_, MT::PublishOption::ASYNC()); } +sub itemset_stc { return itemset_handler(@_, MT::PublishOption::ONDEMAND()); } +sub itemset_dyn { return itemset_handler(@_, MT::PublishOption::DYNAMIC()); } +sub itemset_dis { return itemset_handler(@_, MT::PublishOption::DISABLED()); } +sub itemset_man { return itemset_handler(@_, MT::PublishOption::MANUALLY()); } + + sub edit { my $cb = shift; my ($app, $id, $obj, $param) = @_;