[Rt-commit] rt branch, 4.2/showemail-updates, created. rt-4.2.1-26-gcab50c4

Jim Brandt jbrandt at bestpractical.com
Tue Nov 26 15:34:43 EST 2013


The branch, 4.2/showemail-updates has been created
        at  cab50c42cbef2be3bc088a9e9e909bc2e2aa0d0a (commit)

- Log -----------------------------------------------------------------
commit 6ac231913e275c381f963492b3dab3b5a861cee1
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Fri Nov 22 14:19:43 2013 -0500

    Update title to describe what page is

diff --git a/share/html/Ticket/ShowEmailRecord.html b/share/html/Ticket/ShowEmailRecord.html
index 2d4be7d..47b05cf 100644
--- a/share/html/Ticket/ShowEmailRecord.html
+++ b/share/html/Ticket/ShowEmailRecord.html
@@ -101,8 +101,12 @@ unless ($AttachmentObj->TransactionId() == $Transaction ) {
     Abort(loc("Attachment '[_1]' could not be loaded", $Attachment));
 }
 
+my $title = loc("Email Source for Ticket [_1], Attachment [_2]",
+    $AttachmentObj->TransactionObj->ObjectId,
+    $AttachmentObj->Id);
+
 </%INIT>
-<& /Elements/Header, ShowBar => 0 &>
+<& /Elements/Header, ShowBar => 0, Title => $title &>
 % $show->( $AttachmentObj );
 </body>
 </html>

commit cab50c42cbef2be3bc088a9e9e909bc2e2aa0d0a
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Fri Nov 22 15:11:53 2013 -0500

    Check rights on show email page
    
    Check transaction rights for show email and show an error
    message for insufficient rights. Manually create the error
    message because the error page displayed by Abort shows the
    full header and tabs, which covers the message. Since the show
    email page has an uncommon layout, better to display the simple
    error in place than heavily modify the Error template to handle
    it.
    
    Also update other error conditions to use the in-place error
    display rather than Abort.
    
    Resolves issues ticket: 27379

diff --git a/share/html/Ticket/ShowEmailRecord.html b/share/html/Ticket/ShowEmailRecord.html
index 47b05cf..f2e27b2 100644
--- a/share/html/Ticket/ShowEmailRecord.html
+++ b/share/html/Ticket/ShowEmailRecord.html
@@ -92,22 +92,40 @@ $show = sub {
     $m->out('</div>');
 };
 
+# Set error for error message below. Abort doesn't display well
+# because ShowEmailRecord doesn't use the standard RT menus
+# and headers.
+
+my ($title, $error);
+
 my $AttachmentObj = RT::Attachment->new($session{'CurrentUser'});
-$AttachmentObj->Load($Attachment) || Abort(loc("Attachment '[_1]' could not be loaded", $Attachment));
-unless ( $AttachmentObj->id ) {
-    Abort(loc("Attachment '[_1]' could not be loaded", $Attachment));
+$AttachmentObj->Load($Attachment);
+
+if ( not $AttachmentObj->id
+    or not $AttachmentObj->TransactionId() == $Transaction ) {
+    $title = loc("Error loading attachment");
+    $error = loc("Attachment '[_1]' could not be loaded", $Attachment);
 }
-unless ($AttachmentObj->TransactionId() == $Transaction ) {
-    Abort(loc("Attachment '[_1]' could not be loaded", $Attachment));
+elsif ( not $AttachmentObj->TransactionObj->CurrentUserCanSee("Transaction")){
+    $title = loc("Permission Denied");
+    $error = loc("Permission Denied");
+}
+else{
+    $title = loc("Email Source for Ticket [_1], Attachment [_2]",
+        $AttachmentObj->TransactionObj->ObjectId,
+        $AttachmentObj->Id);
 }
-
-my $title = loc("Email Source for Ticket [_1], Attachment [_2]",
-    $AttachmentObj->TransactionObj->ObjectId,
-    $AttachmentObj->Id);
 
 </%INIT>
 <& /Elements/Header, ShowBar => 0, Title => $title &>
-% $show->( $AttachmentObj );
+% if ( $error ){
+<div id="body"><div class="error">
+<% $error %>
+</div></div>
+% }
+% else{
+%    $show->( $AttachmentObj );
+% }
 </body>
 </html>
 % $m->abort;

-----------------------------------------------------------------------


More information about the rt-commit mailing list