Putting 4.2.0 on top of 4.0.17
[usit-rt.git] / share / html / Search / Elements / ResultsRSSView
index a6d634d..0d74b11 100644 (file)
@@ -96,16 +96,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 +128,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,