[Rt-commit] r4269 - in RT-View-Directory: . html/Callbacks/RT-View-Directory/Search/Results.html html/View-Directory html/View-Directory/Elements html/View-Directory/Search html/View-Directory/Search/Ticket html/View-Directory/Search/Ticket/Attachment html/View-Directory/Ticket html/View-Tree lib/RT/View

jesse at bestpractical.com jesse at bestpractical.com
Thu Dec 8 02:01:57 EST 2005


Author: jesse
Date: Thu Dec  8 02:01:57 2005
New Revision: 4269

Added:
   RT-View-Directory/html/View-Directory/
   RT-View-Directory/html/View-Directory/Elements/
   RT-View-Directory/html/View-Directory/Elements/ListAttachments
   RT-View-Directory/html/View-Directory/Search/
   RT-View-Directory/html/View-Directory/Search/Ticket/
   RT-View-Directory/html/View-Directory/Search/Ticket/Attachment/
   RT-View-Directory/html/View-Directory/Search/Ticket/Attachment/dhandler
   RT-View-Directory/html/View-Directory/Search/Ticket/dhandler
   RT-View-Directory/html/View-Directory/Search/dhandler
   RT-View-Directory/html/View-Directory/Ticket/
   RT-View-Directory/html/View-Directory/Ticket/.dhandler.swp   (contents, props changed)
   RT-View-Directory/html/View-Directory/Ticket/File
   RT-View-Directory/html/View-Directory/Ticket/dhandler
   RT-View-Directory/html/View-Directory/dhandler
   RT-View-Directory/lib/RT/View/Directory.pm
Removed:
   RT-View-Directory/html/View-Tree/
   RT-View-Directory/lib/RT/View/Tree.pm
Modified:
   RT-View-Directory/   (props changed)
   RT-View-Directory/html/Callbacks/RT-View-Directory/Search/Results.html/SearchActions
Log:
 r19838 at truegrounds:  jesse | 2005-12-08 02:01:13 -0500
  * checkpoint again 


Modified: RT-View-Directory/html/Callbacks/RT-View-Directory/Search/Results.html/SearchActions
==============================================================================
--- RT-View-Directory/html/Callbacks/RT-View-Directory/Search/Results.html/SearchActions	(original)
+++ RT-View-Directory/html/Callbacks/RT-View-Directory/Search/Results.html/SearchActions	Thu Dec  8 02:01:57 2005
@@ -1,5 +1,5 @@
 <%args>
 $QueryString => undef
 </%args>
-<a href="<%$RT::WebPath%>/Search/Tree.html<%$QueryString%>"><&|/l&>Directory tree</&></a>
+<a href="<%$RT::WebPath%>/View-Directory/<%$QueryString%>"><&|/l&>Directory tree</&></a>
 

Added: RT-View-Directory/html/View-Directory/Elements/ListAttachments
==============================================================================
--- (empty file)
+++ RT-View-Directory/html/View-Directory/Elements/ListAttachments	Thu Dec  8 02:01:57 2005
@@ -0,0 +1,83 @@
+<%args>
+$OrderBy => 'id'
+$Order => 'asc'
+$Ticket => undef
+$Filename => undef
+</%args>
+<%init>
+my $Ticket = RT::Ticket->new( $session{'CurrentUser'} );
+$Ticket->Load($Ticket);
+
+
+#A default implementation here loops through all transactions and pulls out all their attachments.
+# We end up doing an end-run around that to get a bit more performance
+
+# We force the cache of ticket transactions to get populated up front. otherwise, the
+# code that looks at attachments will look at each one in turn.
+my $attachments = RT::Attachments->new( $session{'CurrentUser'} );
+
+$attachments->Columns(
+    qw( Id Filename ContentType Headers Subject 
+        Parent ContentEncoding ContentType TransactionId Created)
+);
+
+my $transactions = $attachments->NewAlias('Transactions');
+$attachments->Join(
+    ALIAS1 => 'main',
+    FIELD1 => 'TransactionId',
+    ALIAS2 => $transactions,
+    FIELD2 => 'id'
+);
+
+my $Tickets = $attachments->NewAlias('Tickets');
+
+$attachments->Join(
+    ALIAS1 => $transactions,
+    FIELD1 => 'ObjectId',
+    ALIAS2 => $Tickets,
+    FIELD2 => 'id'
+);
+
+$attachments->Limit( ALIAS => $transactions, FIELD => 'ObjectType', VALUE => 'RT::Ticket');
+$attachments->Limit( ALIAS => $Tickets, FIELD => 'EffectiveId', VALUE => $Ticket->id());
+
+$attachments->Limit( FIELD => 'Filename', VALUE => $Filename) if ($Filename);
+
+my %documents;
+while ( my $attach = $attachments->Next() ) {
+    next unless ( $attach->Filename() );
+    unshift( @{ $documents{ $attach->Filename } }, $attach );
+}
+</%init>
+
+<& /Elements/Header, title => loc("Ticket [_1]: [_2]", $Ticket->id, $Ticket->Subject) &>
+% foreach my $key (keys %documents) {
+
+<table>
+<tr>
+<th>Filename</th>
+<th>Created</th>
+<th>Creator</th>
+<th>Size</th>
+</tr>
+% foreach my $rev (@{$documents{$key}}) {
+
+<%PERL>
+my $size = $rev->ContentLength;
+
+if ($size) {
+    if ($size > 1024) { $size = int($size/102.4)/10 . "k"; }
+    else { $size = $size ."b"; }
+}
+</%PERL>
+
+<tr>
+<td><a href="<%$Ticket->id%>/File/<%$key%>"><%$key%></a></td>
+<td><a href="<%$RT::WebPath%>/Ticket/Attachment/<%$rev->TransactionId%>/<%$rev->Id%>/<%$rev->Filename | u%>"><%$rev->CreatedAsString%></a></td>
+<td><%$rev->CreatorObj->Name%></td>
+<td><%$size%></td>
+</td>
+
+% }
+% }
+</table>

Added: RT-View-Directory/html/View-Directory/Search/Ticket/Attachment/dhandler
==============================================================================

Added: RT-View-Directory/html/View-Directory/Search/Ticket/dhandler
==============================================================================

Added: RT-View-Directory/html/View-Directory/Search/dhandler
==============================================================================
--- (empty file)
+++ RT-View-Directory/html/View-Directory/Search/dhandler	Thu Dec  8 02:01:57 2005
@@ -0,0 +1,4 @@
+<%args>
+</%args>
+<%init>
+</%init>

Added: RT-View-Directory/html/View-Directory/Ticket/.dhandler.swp
==============================================================================
Binary file. No diff available.

Added: RT-View-Directory/html/View-Directory/Ticket/File
==============================================================================
--- (empty file)
+++ RT-View-Directory/html/View-Directory/Ticket/File	Thu Dec  8 02:01:57 2005
@@ -0,0 +1,6 @@
+<%init>
+use YAML;
+die YAML::Dump(\%ARGS);
+</%init>
+
+WOO

Added: RT-View-Directory/html/View-Directory/Ticket/dhandler
==============================================================================
--- (empty file)
+++ RT-View-Directory/html/View-Directory/Ticket/dhandler	Thu Dec  8 02:01:57 2005
@@ -0,0 +1,16 @@
+<%init>
+my $id = $m->dhandler_arg;
+if ($id =~ '^(\d+)/File/(.*?)$') {
+    $m->comp('File', id => $1, filename => $2);
+    return();
+}
+my $ticket = RT::Ticket->new( $session{'CurrentUser'} );
+$ticket->Load($id);
+
+</%init>
+
+<& /Elements/Header, title => loc("Ticket [_1]: [_2]", $ticket->id, $ticket->Subject) &>
+<& ../Elements/ListAttachments,  Ticket => $ticket&>
+
+
+

Added: RT-View-Directory/html/View-Directory/dhandler
==============================================================================
--- (empty file)
+++ RT-View-Directory/html/View-Directory/dhandler	Thu Dec  8 02:01:57 2005
@@ -0,0 +1,21 @@
+<%args>
+$Query => undef
+$Order => undef
+$OrderBy => undef 
+</%args>
+<%init>
+my $tix = RT::Tickets->new($session{'CurrentUser'});
+$tix->FromSQL($Query);
+$tix->OrderBy( FIELD => $OrderBy, ORDER => $Order);
+</%init>
+<& /Elements/Header, title => 'Tickets'&>
+<& /Elements/Tabs &>
+<table>
+% while (my $ticket = $tix->Next) {
+<tr>
+<td><a href="Ticket/<%$ticket->id%>"><%$ticket->id%>: <%$ticket->Subject%></a></td>
+<td><%$ticket->CreatedObj->AsString%></td>
+<td><%$ticket->DueObj->AsString%></td>
+</tr>
+% }
+</table>

Added: RT-View-Directory/lib/RT/View/Directory.pm
==============================================================================
--- (empty file)
+++ RT-View-Directory/lib/RT/View/Directory.pm	Thu Dec  8 02:01:57 2005
@@ -0,0 +1,6 @@
+
+package RT::View::Tree;
+
+our $VERSION = '1.4';
+
+1;


More information about the Rt-commit mailing list