]> git.uio.no Git - usit-rt.git/blobdiff - share/html/Search/Elements/ResultsRSSView
Upgrade to 4.2.8
[usit-rt.git] / share / html / Search / Elements / ResultsRSSView
index a6d634ddd51160a9599e6ab0aa9377dadffc6d0b..45e73697a6345a98538e0f96d48679519beaa007 100644 (file)
@@ -2,7 +2,7 @@
 %#
 %# COPYRIGHT:
 %#
-%# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2014 Best Practical Solutions, LLC
 %#                                          <sales@bestpractical.com>
 %#
 %# (Except where explicitly superseded by other copyright notices)
@@ -46,8 +46,6 @@
 %#
 %# END BPS TAGGED BLOCK }}}
 <%INIT>
-use Encode ();
-
 my $old_current_user;
 
 if ( $m->request_comp->path =~ RT->Config->Get('WebNoAuthRegex') ) {
@@ -67,8 +65,8 @@ if ( $m->request_comp->path =~ RT->Config->Get('WebNoAuthRegex') ) {
     # Unescape parts
     $name =~ s/\%([0-9a-z]{2})/chr(hex($1))/gei;
 
-    # convert to perl strings
-    $name = Encode::decode_utf8($name);
+    # Decode from bytes to characters
+    $name = Encode::decode( "UTF-8", $name );
 
     my $user = RT::User->new(RT->SystemUser);
     $user->Load($name);
@@ -96,16 +94,25 @@ if ($OrderBy =~ /\|/) {
 } else {
     $Tickets->OrderBy(FIELD => $OrderBy, ORDER => $Order);
 }
-$r->content_type('application/rss+xml');
+$r->content_type('application/rss+xml; charset=utf-8');
 
 
 
         # create an RSS 1.0 file (http://purl.org/rss/1.0/)
         use XML::RSS;
         my $rss = XML::RSS->new(version => '1.0');
+
+        my $url;
+        if ( RT->Config->Get('CanonicalizeURLsInFeeds') ) {
+            $url = RT->Config->Get('WebURL');
+        }
+        else {
+            $url = RT::Interface::Web::GetWebURLFromRequest();
+        }
+
         $rss->channel(
           title        => RT->Config->Get('rtname').": Search " . $ARGS{'Query'},
-          link         => RT->Config->Get('WebURL'),
+          link         => $url,
           description  => "",
           dc => {
           },
@@ -119,11 +126,11 @@ $r->content_type('application/rss+xml');
 
 
     while ( my $Ticket = $Tickets->Next()) {
-        my $creator_str = $m->scomp('/Elements/ShowUser', User => $Ticket->CreatorObj);
+        my $creator_str = $Ticket->CreatorObj->Format;
         $creator_str =~ s/[\r\n]//g;
         $rss->add_item(
           title       =>  $Ticket->Subject || loc('No Subject'),
-          link        => RT->Config->Get('WebURL')."Ticket/Display.html?id=".$Ticket->id,
+          link        => $url . "Ticket/Display.html?id=".$Ticket->id,
           description => $Ticket->Transactions->First->Content,
           dc          => { creator => $creator_str,
                            date => $Ticket->CreatedObj->RFC2822,