Created
March 11, 2009 05:05
-
-
Save jayallen/77323 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From e77e3af7da69fd0c54597358ff37a5e85c39e020 Mon Sep 17 00:00:00 2001 | |
From: Jay Allen <[email protected]> | |
Date: Sun, 28 Dec 2008 17:11:49 -0800 | |
Subject: [PATCH] Fixing case 79288 No feedback from template clone event. http://bugs.movabletype.org/?79288 | |
--- | |
lib/MT/CMS/Template.pm | 13 +++++++++++-- | |
tmpl/cms/edit_template.tmpl | 8 ++++++++ | |
2 files changed, 19 insertions(+), 2 deletions(-) | |
diff --git a/lib/MT/CMS/Template.pm b/lib/MT/CMS/Template.pm | |
index c3a550b..b66aa33 100644 | |
--- a/lib/MT/CMS/Template.pm | |
+++ b/lib/MT/CMS/Template.pm | |
@@ -2052,6 +2052,11 @@ sub clone_templates { | |
|| $perms->can_administer_blog ) ); | |
my @id = $app->param('id'); | |
+ | |
+ # Divergence from mtos in this method relate to | |
+ # http://bugs.movabletype.org/?79288 | |
+ my $last_clone_id = (@id > 1) ? undef : 0; | |
+ | |
require MT::Template; | |
foreach my $tmpl_id (@id) { | |
my $tmpl = MT::Template->load($tmpl_id); | |
@@ -2073,10 +2078,14 @@ sub clone_templates { | |
} | |
$new_tmpl->name($new_name); | |
- $new_tmpl->save; | |
+ $new_tmpl->save | |
+ or return $app->errtrans('Could not clone template: [_1]', | |
+ $new_tmpl->errmsg); | |
+ defined $last_clone_id and $last_clone_id = $new_tmpl->id; | |
} | |
- $app->add_return_arg( 'saved_copied' => 1 ); | |
+ $app->add_return_arg( 'saved_copied' => 1, | |
+ ($last_clone_id ? (clone_id => $last_clone_id) : ())); | |
$app->call_return; | |
} | |
diff --git a/tmpl/cms/edit_template.tmpl b/tmpl/cms/edit_template.tmpl | |
index 196a216..f604c54 100644 | |
--- a/tmpl/cms/edit_template.tmpl | |
+++ b/tmpl/cms/edit_template.tmpl | |
@@ -87,6 +87,14 @@ | |
<__trans phrase="Your [_1] has been published." params="<mt:var name="name" escape="html">"> | |
</mtapp:statusmsg> | |
</mt:if> | |
+ <mt:Ignore>See http://bugs.movabletype.org/?79288</mt:Ignore> | |
+ <mt:if name="saved_copied"> | |
+ <mtapp:statusmsg | |
+ id="saved-copied" | |
+ class="success"> | |
+ <__trans phrase="This template has been cloned ([_1])." params="<mt:var name="request.clone_id">"> | |
+ </mtapp:statusmsg> | |
+ </mt:if> | |
</mt:setvarblock> | |
<mt:setvarblock name="related_content"> | |
<mtapp:widget | |
-- | |
1.6.1+GitX |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment