[Rt-commit] r5298 - in rt/branches/3.5-TESTING: .

jesse at bestpractical.com jesse at bestpractical.com
Fri May 26 00:11:29 EDT 2006


Author: jesse
Date: Fri May 26 00:11:28 2006
New Revision: 5298

Modified:
   rt/branches/3.5-TESTING/   (props changed)
   rt/branches/3.5-TESTING/html/REST/1.0/search/ticket

Log:
 r9831 at jesse-vincents-computer-2:  jesse | 2006-05-25 23:20:36 -0400
 * Added custom summary "ticket lists" using the commandline (combining -f and -s) lists.
 * Fixed a couple small bugs


Modified: rt/branches/3.5-TESTING/html/REST/1.0/search/ticket
==============================================================================
--- rt/branches/3.5-TESTING/html/REST/1.0/search/ticket	(original)
+++ rt/branches/3.5-TESTING/html/REST/1.0/search/ticket	Fri May 26 00:11:28 2006
@@ -60,7 +60,7 @@
 my $field  = '[a-zA-Z][a-zA-Z0-9_-]*';
 my (%fields, @fields);
 if ($fields) {
-    $format = "l";
+    $format ||= "l";
     unless ($fields =~ /^(?:$field,)*$field$/) {
         $status = "400 Bad Request";
         $output = "Invalid field specification: $fields";
@@ -115,15 +115,29 @@
 while (my $ticket = $tickets->Next) {
     $n++;
 
+	my $id = $ticket->Id;
     if ($format eq "i") {
-        $output .= "ticket/" . $ticket->Id . "\n";
+        $output .= "ticket/" . $id . "\n";
     }
     elsif ($format eq "s") {
-        $output .= $ticket->Id . ": ". $ticket->Subject . "\n";
+	if ($fields) {
+        	my $result = $m->comp("/REST/1.0/Forms/ticket/default", id => $id, format => $format, fields => \%fields);
+		my ($notes, $order, $key_values, $errors) = @$result;
+		# If it's the first time through, add our header
+		if ($n == 1) {
+			$output .= join("\t",@$order)."\n";
+		}
+		# Cut off the annoying ticket/ before the id;
+		$key_values->{'id'} = $id;
+		$output .= join("\t", map {$key_values->{$_}} @$order)."\n";
+	
+
+	} else {	
+        	$output .= $ticket->Id . "\t". $ticket->Subject . "\n";
+	}
     }
     else {
-	my $id = $ticket->Id;
-        my $d = $m->comp("$RT::WebPath/REST/1.0/Forms/ticket/default", id => $id, format => $format, fields => \%fields);
+        my $d = $m->comp("/REST/1.0/Forms/ticket/default", id => $id, format => $format, fields => \%fields);
         my ($c, $o, $k, $e) = @$d;
 	push @output, [ $c, $o, $k ];
     }
@@ -138,4 +152,5 @@
 $m->out("RT/". $RT::VERSION . " " . $status ."\n\n");
 
 $m->out($output );
+return();
 </%INIT>


More information about the Rt-commit mailing list