Skip to content

Commit

Permalink
[#256 state:resolved] Bundled the BatchTmplOptions plugin (http://git…
Browse files Browse the repository at this point in the history
…hub.com/endevver/mt-plugin-batchtmploptions) which allows you set publishing modes for multiple templates and archive mappings at once from the template listing screen.
  • Loading branch information
Mike authored and jayallen committed Sep 28, 2010
1 parent fb0d55a commit 868062c
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 1 deletion.
31 changes: 30 additions & 1 deletion lib/MT/App/CMS.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand Down
26 changes: 26 additions & 0 deletions lib/MT/CMS/Template.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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) = @_;
Expand Down

0 comments on commit 868062c

Please sign in to comment.