[Rt-commit] [svn] r785 - in rt: . branches/rt-3.3/html/REST/2.0 branches/rt-3.3/lib/RT

autrijus at pallas.eruditorum.org autrijus at pallas.eruditorum.org
Sat May 1 07:16:26 EDT 2004


Author: autrijus
Date: Sat May  1 07:16:25 2004
New Revision: 785

Modified:
   rt/   (props changed)
   rt/branches/rt-3.3/html/REST/2.0/dhandler
   rt/branches/rt-3.3/lib/RT/Date.pm
Log:
 ----------------------------------------------------------------------
 r4323 at not:  autrijus | 2004-05-01T11:14:28.377660Z
 
 * implement ->W3CDTF.
 ----------------------------------------------------------------------
 r4324 at not:  autrijus | 2004-05-01T11:16:31.456041Z
 
 * we are now a valid Atom feed.
 ----------------------------------------------------------------------


Modified: rt/branches/rt-3.3/html/REST/2.0/dhandler
==============================================================================
--- rt/branches/rt-3.3/html/REST/2.0/dhandler	(original)
+++ rt/branches/rt-3.3/html/REST/2.0/dhandler	Sat May  1 07:16:25 2004
@@ -131,7 +131,10 @@
 }
 
 if ($CurrentUser and $CurrentUser->Id) {
-    my $type = ucfirst(lc($m->dhandler_arg)); # XXX - proper delegation goes here
+    # XXX - do proper delegation goes here
+
+    my $path = $m->dhandler_arg;
+    my $type = ucfirst(lc($path));
     $type =~ s{/.*}{};
     $type =~ s{s$}{};
 
@@ -140,11 +143,21 @@
     $collection->UnLimit;
     my $count = $collection->Count;
 
-    $r->content_type('text/xml');
+    $r->content_type('text/xml; charset=utf-8');
     my $entries = '';
+
+    my $now = RT::Date->new;
+    $now->SetToNow;
+    my $modified = $now->W3CDTF;
+
     while (my $entry = $collection->Next) {
 	my %entry = map { $_ => eval { $entry->$_ } || '' }
-	    qw(Id Name Description Content LastUpdated Created);
+	    qw(Id Name Description Content);
+        $entry{Created} = $entry->CreatedObj->W3CDTF;
+        $entry{Created} =~ s/ /T/;
+        $entry{LastUpdated} = $entry->LastUpdatedObj->W3CDTF;
+        $entry{LastUpdated} =~ s/ /T/;
+    
 	$entries .= <<".";
   <entry>
     <title mode="escaped">$entry{Name}</title>
@@ -154,7 +167,7 @@
     <created>$entry{Created}</created>
     <id>rt-fsck.com:$RT::rtname/$entry{Id}</id>
     <summary mode="escaped">$entry{Description}</summary>
-    <content type="text/html" mode="escaped" xml:base="http://diveintomark.org/archives/2004/04/19/feed-parser-beta-22">
+    <content type="text/plain" mode="escaped" xml:base="http://diveintomark.org/archives/2004/04/19/feed-parser-beta-22">
       <![CDATA[$entry{Content}]]>
     </content>
   </entry>
@@ -169,8 +182,10 @@
     <name>$RT::Organization</name>
     <url>$RT::WebURL</url>
   </author>
+  <link rel="alternate" type="text/html" href="$RT::WebURL"/>
   <tagline mode="escaped">$count results found.</tagline>
-  <id>$nonce</id>
+  <id>rt-fsck.com://$path</id>
+  <modified>$modified</modified>
   <generator url="http://www.bestpractical.com/rt/" version="$RT::VERSION">RT</generator>
   $entries
 </feed>

Modified: rt/branches/rt-3.3/lib/RT/Date.pm
==============================================================================
--- rt/branches/rt-3.3/lib/RT/Date.pm	(original)
+++ rt/branches/rt-3.3/lib/RT/Date.pm	Sat May  1 07:16:25 2004
@@ -529,6 +529,24 @@
 
 # }}}
 
+# {{{ sub ISO
+
+=head2 ISO
+
+Takes nothing
+
+Returns the object's date in W3C DTF format
+
+=cut
+
+sub W3CDTF {
+    my $self = shift;
+    my $date = $self->ISO . 'Z';
+    $date =~ s/ /T/;
+    return $date;
+};
+
+# }}}
 
 # {{{ sub LocalTimezone 
 =head2 LocalTimezone


More information about the Rt-commit mailing list