[Rt-commit] r4494 - in rtir/branches/1.9-EXPERIMENTAL: html/RTIR

ruz at bestpractical.com ruz at bestpractical.com
Fri Feb 3 18:43:30 EST 2006


Author: ruz
Date: Fri Feb  3 18:43:30 2006
New Revision: 4494

Modified:
   rtir/branches/1.9-EXPERIMENTAL/   (props changed)
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Display.html

Log:
 r625 at cubic-pc:  cubic | 2006-02-04 01:36:23 +0300
 * jump to RT if ticket is not from RTIR
 * jump to "/RTIR/<type>/Display.html" if component exists,
   for example '/RTIR/Incident/Display.html'


Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Display.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Display.html	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Display.html	Fri Feb  3 18:43:30 2006
@@ -172,24 +172,26 @@
 &> 
 
 <%INIT>
-my ($Type, $name);
+my ($name);
 my $Ticket = new RT::Ticket( $session{'CurrentUser'} );
-my $QueueObj = new RT::Queue( $session{'CurrentUser'} );
 
+my $QueueObj;
 unless ( $id eq 'new' ) {
     $Ticket = LoadTicket( $id );
     unless ($Ticket->CurrentUserHasRight('ShowTicket')) {
         Abort("No permission to view ticket");
     }
-    $QueueObj->Load($Ticket->QueueObj->Name) || Abort(loc("Queue could not be loaded."));
+    $QueueObj = $Ticket->QueueObj;
 } else {
+    $QueueObj = new RT::Queue( $session{'CurrentUser'} );
     $QueueObj->Load($Queue) || Abort(loc("Queue could not be loaded."));
 }
 
-# Incidents have their own Create.html
-if (($QueueObj->Name || '') eq 'Incidents') {
-    $m->comp("/RTIR/Incident/Display.html", %ARGS);
-    $m->abort;
+my ($Type) = $m->comp('Elements/Type', Queue => $QueueObj->Name);
+return $m->comp( '/Ticket/Display.html', %ARGS ) unless $Type;
+
+if ( $m->comp_exists("/RTIR/$Type/Display.html") ) {
+    return $m->comp("/RTIR/$Type/Display.html", %ARGS);
 }
 
 if ( $id eq 'new' ) {
@@ -240,8 +242,6 @@
 # update id argument in the case we took merged or created new
 $ARGS{'id'} = $id = $Ticket->Id;
 
-($Type) = $m->comp('Elements/Type', Ticket => $Ticket->Id);
-
 if ($Type eq 'Report') {
     $name = "Incident Report";
 } else {


More information about the Rt-commit mailing list