[Rt-commit] [svn] r798 - in rt: . branches/rt-3.3/html/Admin/Elements branches/rt-3.3/html/Admin/Global branches/rt-3.3/html/Elements branches/rt-3.3/html/REST/2.0 branches/rt-3.3/html/REST/2.0/Elements branches/rt-3.3/html/REST/2.0/NoAuth branches/rt-3.3/html/REST/2.0/Search

autrijus at pallas.eruditorum.org autrijus at pallas.eruditorum.org
Sat May 1 14:49:18 EDT 2004


Author: autrijus
Date: Sat May  1 14:49:18 2004
New Revision: 798

Added:
   rt/branches/rt-3.3/html/REST/2.0/Elements/
   rt/branches/rt-3.3/html/REST/2.0/Elements/Link
Modified:
   rt/   (props changed)
   rt/branches/rt-3.3/html/Admin/Elements/Header
   rt/branches/rt-3.3/html/Admin/Global/Templates.html
   rt/branches/rt-3.3/html/Elements/Header
   rt/branches/rt-3.3/html/Elements/TicketList
   rt/branches/rt-3.3/html/REST/2.0/NoAuth/feed.css
   rt/branches/rt-3.3/html/REST/2.0/Search/index
   rt/branches/rt-3.3/html/REST/2.0/autohandler
Log:
 ----------------------------------------------------------------------
 r4357 at not:  autrijus | 2004-05-01T18:47:10.055533Z
 
 * Various CSS tricks.
 ----------------------------------------------------------------------
 r4358 at not:  autrijus | 2004-05-01T18:47:49.553353Z
 
 * Fixed an off-by-one error in ticket listing.
 ----------------------------------------------------------------------
 r4359 at not:  autrijus | 2004-05-01T18:48:06.789268Z
 
 * support for Atom autodiscovery.
 ----------------------------------------------------------------------


Modified: rt/branches/rt-3.3/html/Admin/Elements/Header
==============================================================================
--- rt/branches/rt-3.3/html/Admin/Elements/Header	(original)
+++ rt/branches/rt-3.3/html/Admin/Elements/Header	Sat May  1 14:49:18 2004
@@ -21,7 +21,7 @@
 %# 
 %# 
 %# END LICENSE BLOCK
-<& /Elements/Header, Title => $Title &>
+<& /Elements/Header, %ARGS &>
 
 <%ARGS>
 $Title => undef

Modified: rt/branches/rt-3.3/html/Admin/Global/Templates.html
==============================================================================
--- rt/branches/rt-3.3/html/Admin/Global/Templates.html	(original)
+++ rt/branches/rt-3.3/html/Admin/Global/Templates.html	Sat May  1 14:49:18 2004
@@ -21,7 +21,7 @@
 %# 
 %# 
 %# END LICENSE BLOCK
-<& /Admin/Elements/Header, Title => $title &>
+<& /Admin/Elements/Header, Title => $title, FeedURI => 'templates' &>
 <& /Admin/Elements/SystemTabs, 
     current_tab => 'Admin/Global/Templates.html', 
     current_subtab => 'Admin/Global/Templates.html', 

Modified: rt/branches/rt-3.3/html/Elements/Header
==============================================================================
--- rt/branches/rt-3.3/html/Elements/Header	(original)
+++ rt/branches/rt-3.3/html/Elements/Header	Sat May  1 14:49:18 2004
@@ -31,6 +31,11 @@
 
 <link rel="shortcut icon" href="<%$RT::WebImagesURL%>/favicon.png" type="image/png">
 <link rel="stylesheet" href="<%$RT::WebPath%>/NoAuth/webrt.css" type="text/css">
+<link rel="" href="<%$RT::WebImagesURL%>/favicon.png" type="image/png">
+% foreach my $service (qw( Feed Post Edit )) {
+%     my $uri = $ARGS{$service."URI"} or next;
+<link rel="service.<% lc($service) %>" type="application/x.atom+xml" href="<% $RT::WebPath %>/REST/2.0/<% $uri %>" title="Atom <% $service %>" />
+% }
 <script>
 function hideshow(num) {
     idstring = "element-" + num;

Modified: rt/branches/rt-3.3/html/Elements/TicketList
==============================================================================
--- rt/branches/rt-3.3/html/Elements/TicketList	(original)
+++ rt/branches/rt-3.3/html/Elements/TicketList	Sat May  1 14:49:18 2004
@@ -40,7 +40,7 @@
 </TABLE>
 % if ($ShowNavigation) {
 <hr>
-<&|/l, $Page, int($TotalFound/$Rows)+1&>Page [_1] of [_2]</&>
+<&|/l, $Page, int(($TotalFound-1)/$Rows)+1&>Page [_1] of [_2]</&>
 
 <%perl>
 my $prev =  $m->comp('/Elements/QueryString', Query => $Query,

Added: rt/branches/rt-3.3/html/REST/2.0/Elements/Link
==============================================================================
--- (empty file)
+++ rt/branches/rt-3.3/html/REST/2.0/Elements/Link	Sat May  1 14:49:18 2004
@@ -0,0 +1,9 @@
+%# Make a HTML link and an Atom link
+<html:link class="html" rel="<% $Relation %>" type="<% $Type %>" href="<% $URI %>" title="<% $Title %>" />
+<link rel="<% $Relation %>" type="<% $Type %>" href="<% $URI %>" title="<% $Title %>" />
+<%ARGS>
+$Relation => "alternate"
+$Type => "application/x.atom+xml"
+$URI => "#"
+$Title => ""
+</%ARGS>

Modified: rt/branches/rt-3.3/html/REST/2.0/NoAuth/feed.css
==============================================================================
--- rt/branches/rt-3.3/html/REST/2.0/NoAuth/feed.css	(original)
+++ rt/branches/rt-3.3/html/REST/2.0/NoAuth/feed.css	Sat May  1 14:49:18 2004
@@ -1,5 +1,6 @@
 feed {
   display:block;
+  text-align:center;
   font-family:verdana, sans-serif;
   margin:2%;
 }
@@ -17,30 +18,37 @@
   font-size:150%;
   color:#000000;
   display:block;
+  text-align:left;
   font-weight:bold;
 }
 
-tagline {
+tagline, author {
+  text-align:left;
   display:block;
   font-size:90%;
 }
 
-link {
-  font-size:90%;
+feed>link.html:before {
+    content: attr(title)
 }
 
-id {
-  display:none;
+feed>link.html[rel!="alternate"] {
+  padding: 3pt;
+  border:solid 1px #dddddd;
+  font-size: 90%;
 }
 
-modified {
-  display:none;
+feed>link.html[rel="alternate"] {
+  display: block;
+  text-align: left;
 }
 
-generator {
-  font-size:90%;
-  display:none;
-  margin:0px 0px 30px 0px;
+link.html[rel="alternate"]:before {
+  content: "HTML";
+  background-color: #003366;
+  color: #c9c9ff;
+  padding: 1px 5px 1px 5px;
+  font-size: xx-small;
 }
 
 entry title {
@@ -48,14 +56,30 @@
   font-weight:bold;
   color:#003366;
   display:block;
-  padding:15px 1% 0px 3%;
-  margin:10px 0px 0px 0px;
+  padding:5px 0px 0px 0px;
+  margin:0px 0px 0px 0px;
   border-top:solid 1px #dddddd;
   background:#eeeeee;
 }
 
+id {
+  display:none;
+}
+
+modified {
+  display:none;
+}
+
+generator {
+  font-size:90%;
+  display:none;
+  margin:0px 0px 30px 0px;
+}
+
+
 entry modified {
   display:inline;
+  font-style: italic;
 }
 
 created {
@@ -78,9 +102,8 @@
 
 
 entry {
+  text-align:left;
   border-top:dotted 1px #999999;
-  margin:30px 0px 5px 0px;
-  padding:5px;
   display:block;
   background:#ffffff;
   padding:5px 0px 10px 0px;

Modified: rt/branches/rt-3.3/html/REST/2.0/Search/index
==============================================================================
--- rt/branches/rt-3.3/html/REST/2.0/Search/index	(original)
+++ rt/branches/rt-3.3/html/REST/2.0/Search/index	Sat May  1 14:49:18 2004
@@ -1,34 +1,49 @@
+%# Search, aka FeedURI
 <?xml version="1.0" encoding="utf-8"?>
-<?xml-stylesheet type="text/css" href="<% $BaseURL %>/NoAuth/feed.css"?>
-<feed version="0.3" xmlns="http://purl.org/atom/ns#">
-  <title>Search result on <% $Type %></title>
+<?xml-stylesheet type="text/css" href="<% $BaseURI %>/NoAuth/feed.css"?>
+<feed version="0.3"
+  xmlns="http://purl.org/atom/ns#"
+  xmlns:html="http://www.w3.org/1999/xhtml"
+>
+  <title><&|/l&>Query</&>: <% loc($Type) %></title>
   <author>
     <name><% $RT::Organization %></name>
     <url><% $RT::WebURL %></url>
   </author>
-  <link rel="alternate" type="text/html" href="<% $RT::WebURL %>"/>
-  <link rel="service.post" type="application/x.atom+xml" href="<% $BaseURL %>/<% lc($Type) %>"/>
-  <link rel="service.feed" type="application/x.atom+xml" href="<% $BaseURL %>/<% lc($Type) %>"/>
-  <tagline mode="escaped"><% $count %> results found.</tagline>
+  <tagline mode="escaped">
+    <&|/l, $page, int(($TotalFound-1)/$rows)+1&>Page [_1] of [_2]</&>
+    (<&|/l, $TotalFound&>[_1] Total</&>)
+  </tagline>
+  <& $Link, Relation => "alternate", Type => 'text/html', URI => $RT::WebURL, Title => loc("Homepage") &>
   <id>rt-fsck.com://<% $RT::rtname %>/<% $Path %></id>
+  <link rel="service.post" type="application/x.atom+xml" href="<% $FeedURI %>/new"/>
+  <link rel="service.feed" type="application/x.atom+xml" href="<% $FeedURI %>"/>
   <modified><% $modified %></modified>
   <generator url="http://www.bestpractical.com/rt/" version="<% $RT::VERSION %>">RT</generator>
 % foreach my $entry (@entries) {
   <entry>
     <title mode="escaped"><% $entry->{Name} %></title>
-    <link rel="alternate" type="text/html" href="<% $RT::WebURL %><% $entry->{URL} %>"/>
-    <link rel="service.edit" type="application/x.atom+xml" href="<% $BaseURL %>/<% lc($Type) %>/<% $entry->{Id} %>"/>
+    <summary mode="escaped"><% $entry->{Description} %></summary>
     <modified><% $entry->{LastUpdated} %></modified>
     <issued><% $entry->{Created} %></issued>
     <created><% $entry->{Created} %></created>
     <id>rt-fsck.com://<% $RT::rtname %>/<% $Path %>/<% $entry->{Id} %></id>
-    <summary mode="escaped"><% $entry->{Description} %></summary>
+    <& $Link, Relation => "alternate", Type => 'text/html', URI => "$RT::WebURL$entry->{URI}", Title => $entry->{Name} &>
+    <link rel="service.edit" type="application/x.atom+xml" href="<% $FeedURI %>/<% $entry->{Id} %>"/>
     <content type="text/plain" mode="escaped"><% $entry->{Content} %></content>
   </entry>
 % }
+% if ($page > 1) {
+  <& $Link, URI => "$FeedURI?$prev", Title => loc("Previous Page"), Relation => 'prev', &>
+% }
+% if (($page * $rows) < $TotalFound) {
+  <& $Link, URI => "$FeedURI?$next", Title => loc("Next Page"), Relation => 'next', &>
+% }
 </feed>
 <%INIT>
-my %URL = (
+$r->content_type('text/xml');
+
+my %URI = (
     Tickets	=> 'Ticket/Display.html?id=',
     Templates	=> 'Admin/Global/Template.html?Template=',
     Scrips	=> 'Admin/Global/Scrip.html?id=',
@@ -36,15 +51,18 @@
     Users	=> 'Admin/Users/Modify.html?id=',
     Groups	=> 'Admin/Groups/Modify.html?id=',
 );
-my $BaseURL = "$RT::WebPath/REST/2.0";
-
-my $Collection = $CollectionClass->new($session{CurrentUser});
-$Collection->UnLimit;
-my $count = $Collection->Count;
-
-$r->content_type('text/xml');
-
-my $entries = '';
+my $BaseURI = "$RT::WebPath/REST/2.0";
+my $FeedURI = "$BaseURI/\l$Type";
+my $Link = "$BaseURI/Elements/Link";
+
+my $List = $CollectionClass->new($session{CurrentUser});
+$List->UnLimit;
+$List->RowsPerPage($rows) if $rows > 0;
+$List->GotoPage($page - 1) if $page > 0;
+
+my $TotalFound = $List->CountAll;
+$rows = $TotalFound if $rows <= 0;
+$page = 1 if $page <= 0;
 
 my $now = RT::Date->new($session{CurrentUser});
 $now->SetToNow;
@@ -52,24 +70,35 @@
 
 my @entries;
 
-while (my $entry = $Collection->Next) {
+while (my $entry = $List->Next) {
     my %entry = map { $_ => eval { $entry->$_ } || '' }
 	qw(Id Name Description Content);
     $entry{Created} = $entry->CreatedObj->W3CDTF;
     $entry{Created} =~ s/ /T/;
     $entry{LastUpdated} = $entry->LastUpdatedObj->W3CDTF;
     $entry{LastUpdated} =~ s/ /T/;
-    $entry{URL} = $URL{$Type} . $entry{Id};
+    $entry{URI} = $URI{$Type} . $entry{Id};
     if (my $queue = eval { $entry->Queue } ) {
-	$entry{URL} =~ s/Global/Queues/;
+	$entry{URI} =~ s/Global/Queues/;
 	$entry{Params} .= "&Queue=$queue";
     }
     push @entries, \%entry;
 }
 
+my %query;
+while (my ($k, $v) = each %ARGS) {
+    $query{$k} = $v if $k eq lc($k);
+}
+my $prev = $m->comp('/Elements/QueryString', %query, page => ($page-1));
+my $next = $m->comp('/Elements/QueryString', %query, page => ($page+1));
+
 </%INIT>
 <%ARGS>
 $Path
 $Type
 $CollectionClass
+
+$rows => 3
+$page => 1
+$query => undef
 </%ARGS>

Modified: rt/branches/rt-3.3/html/REST/2.0/autohandler
==============================================================================
--- rt/branches/rt-3.3/html/REST/2.0/autohandler	(original)
+++ rt/branches/rt-3.3/html/REST/2.0/autohandler	Sat May  1 14:49:18 2004
@@ -3,6 +3,7 @@
 % my $path = $m->base_comp->path;
 % if ($path =~ $RT::WebNoAuthRegex ) {
 %     $r->content_type('text/css') if $path =~ /\.css$/i;
+%     $r->content_type('text/xml') if $path =~ /\.xsl$/i;
 %     $m->call_next(%ARGS);
 %     $m->abort();
 % }


More information about the Rt-commit mailing list