[Rt-commit] [svn] r830 - in RTx-Atom: . html/Atom/0.3 html/Atom/0.3/Elements

autrijus at pallas.eruditorum.org autrijus at pallas.eruditorum.org
Wed May 5 06:32:09 EDT 2004


Author: autrijus
Date: Wed May  5 06:32:07 2004
New Revision: 830

Modified:
   RTx-Atom/   (props changed)
   RTx-Atom/html/Atom/0.3/Elements/Introspect
   RTx-Atom/html/Atom/0.3/dhandler
   RTx-Atom/html/Atom/0.3/index
Log:
 ----------------------------------------------------------------------
 r4468 at not:  autrijus | 2004-05-05T10:31:41.274541Z
 
 * Correctly canonize to full class names.
 ----------------------------------------------------------------------


Modified: RTx-Atom/html/Atom/0.3/Elements/Introspect
==============================================================================
--- RTx-Atom/html/Atom/0.3/Elements/Introspect	(original)
+++ RTx-Atom/html/Atom/0.3/Elements/Introspect	Wed May  5 06:32:07 2004
@@ -41,7 +41,7 @@
 return \%record_to_collection if $Want eq 'RecordToCollection';
 
 delete @collection_to_obj{keys %gone};
-return [sort keys %collection_to_obj];
+return [map $collection_to_class{$_}, sort keys %collection_to_obj];
 </%INIT>
 <%ARGS>
 $Want

Modified: RTx-Atom/html/Atom/0.3/dhandler
==============================================================================
--- RTx-Atom/html/Atom/0.3/dhandler	(original)
+++ RTx-Atom/html/Atom/0.3/dhandler	Wed May  5 06:32:07 2004
@@ -165,7 +165,7 @@
   or return $m->comp('Elements/Error', Status => 405, Allow => join(', ', sort keys %Methods));
 
 my $path = $m->dhandler_arg;
-$path =~ s{/+$}{}g;
+$path =~ s{/+(?:index\.html)?$}{}g;
 
 my ($type, @parts) = grep length, split('/', $path);
 $type =~ s{-}{::}g;
@@ -188,27 +188,24 @@
 }
 
 my $map;
-$map = $m->comp('Elements/Introspect', Want => 'CollectionToClass') if $type;
-
-my $class;
-foreach my $key (keys %$map) {
-    $key =~ /\b\Q$type\E$/ or next;
-    $class = $map->{$key};
-    $type = $1 if $class =~ m/([^:]+)$/;
-    last;
-}
+$map = $m->comp('Elements/Introspect', Want => 'TopLevelCollections') if $type;
 
 my $BaseURI = $RT::WebURL."Atom/0.3";
 
-if (!$class and $type) {
-    $map = $m->comp('Elements/Introspect', Want => 'RecordToCollection');
+my $class;
+foreach my $key (@$map) {
+    if ($key eq $type) {
+	$class = $type = $key;
+	$type =~ s/::/-/g;
+	last;
+    }
 
-    foreach my $key (keys %$map) {
-	$key =~ /\b\Q$type\E$/ or next;
-	my $new_type = $map->{$key};
+    if ($key =~ /\b\Q$type\E$/i) {
+	my $new_type = $key;
 	$new_type =~ s/::/-/g;
-	$path =~ s{([^/]*)}{$new_type};
-	$r->header_out(Location => "$BaseURI$path");
+	$path = join('/', $new_type, @parts);
+	my $query = $m->comp('/Elements/QueryString', $m->request_args);
+	$r->header_out(Location => "$BaseURI/$path?$query");
 	return $m->comp('Elements/Error', Status => 301);
     }
 }

Modified: RTx-Atom/html/Atom/0.3/index
==============================================================================
--- RTx-Atom/html/Atom/0.3/index	(original)
+++ RTx-Atom/html/Atom/0.3/index	Wed May  5 06:32:07 2004
@@ -9,13 +9,16 @@
   </author>
   <modified><% $Now->W3CDTF %></modified>
   <& $ShowLink, Type => 'text/html', URI => $RT::WebURL, Title => "Homepage" &>
-% foreach my $type (@{$m->comp('Elements/Introspect', Want => 'TopLevelCollections')}) {
+% foreach my $class (@{$m->comp('Elements/Introspect', Want => 'TopLevelCollections')}) {
+%    my $type = $class;
+%    $type =~ s/^.*:://;
+%    $class =~ s/::/-/g;
   <entry>
     <title><% loc($type) %></title>
-    <& $ShowLink, Relation => "service.feed", URI => "$BaseURI/$type?", Title => $type, IsChild => 1 &>
-    <& $ShowLink, Relation => 'service.post', URI => "$BaseURI/$type!add", Title => $type &>
+    <& $ShowLink, Relation => "service.feed", URI => "$BaseURI/$class?", Title => $type, IsChild => 1 &>
+    <& $ShowLink, Relation => 'service.post', URI => "$BaseURI/$class!add", Title => $type &>
     <& $ShowLink, Type => "text/html", URI => $BaseURI, Title => $type &>
-    <id><% $RT::SystemUser->UserObj->URI %>/<% $type %></id>
+    <id><% $RT::SystemUser->UserObj->URI %>/<% $class %></id>
     <issued><% $RT::SystemUser->UserObj->CreatedObj->W3CDTF %></issued>
     <modified><% $Now->W3CDTF %></modified>
   </entry>


More information about the Rt-commit mailing list