[Codestriker-commits] CVS update: codestriker/lib/Codestriker/Action ListTopicsRSS.pm
Brought to you by:
sits
|
From: <si...@us...> - 2004-12-22 00:19:22
|
Created Codestriker topic at: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=3882797&action=view User: sits Date: 04/12/21 16:19:09 Modified: lib/Codestriker/Action ListTopicsRSS.pm Log: Updated RSS handling from Jason Index: ListTopicsRSS.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Action/ListTopicsRSS.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ListTopicsRSS.pm 21 Dec 2004 23:02:55 -0000 1.1 +++ ListTopicsRSS.pm 22 Dec 2004 00:19:07 -0000 1.2 @@ -11,7 +11,7 @@ use strict; use Codestriker::Http::Template; -use Codestriker::Model::Topic; +use Codestriker::Model::Topic; use XML::RSS; # If the input is valid, list the appropriate topics. @@ -25,49 +25,23 @@ $http_response->error("This function has been disabled"); } - # Obtain a new URL builder object. - my $url_builder = Codestriker::Http::UrlBuilder->new($query); - - # Check that the appropriate fields have been filled in. - my $mode = $http_input->get('mode'); - my $sauthor = $http_input->get('sauthor') || ""; - my $sreviewer = $http_input->get('sreviewer') || ""; - my $scc = $http_input->get('scc') || ""; - my $sbugid = $http_input->get('sbugid') || ""; - my $stext = $http_input->get('stext') || ""; - my $sstate = $http_input->get('sstate'); - my $sproject = $http_input->get('sproject'); - my $stitle = $http_input->get('stitle') || 0; - my $sdescription = $http_input->get('sdescription') || 0; - my $scomments = $http_input->get('scomments') || 0; - my $sbody = $http_input->get('sbody') || 0; - my $sfilename = $http_input->get('sfilename') || 0; - my $feedback = $http_input->get('feedback'); - my $projectid = $http_input->get('projectid'); - - # If $sproject has been set to -1, then retrieve the value of the projectid - # from the cookie as the project search value. This is done to facilate - # integration with other systems, which jump straight to this URL, and - # set the cookie explicitly. - if ($sproject eq "-1") { - $sproject = (defined $projectid) ? $projectid : ""; - } - - # Only show open topics if codestriker.pl was run without parameters. - if (defined($http_input->{query}->param) == 0 || !defined($sstate)) { - $sstate = 0; - } - - # handle the sort order of the topics. - my @sort_order = Codestriker::Action::ListTopics::get_topic_sort_order($http_input); - - # Query the model for the specified data. - my @topics = Codestriker::Model::Topic->query($sauthor, $sreviewer, $scc, $sbugid, - $sstate, $sproject, $stext, - $stitle, $sdescription, - $scomments, $sbody, $sfilename, - \@sort_order); - + # Query the model for the specified data. + + my $mode = $http_input->get('mode'); + + my ( $sauthor, $sreviewer, $scc, $sbugid, + $sstate, $sproject, $stext, + $stitle, $sdescription, + $scomments, $sbody, $sfilename, + $sort_order) = Codestriker::Action::ListTopics::get_topic_list_query_params($http_input); + + # Query the model for the specified data. + my @topics = Codestriker::Model::Topic->query($sauthor, $sreviewer, $scc, $sbugid, + $sstate, $sproject, $stext, + $stitle, $sdescription, + $scomments, $sbody, $sfilename, + $sort_order); + # Display the data, with each topic title linked to the view topic screen. # If only a single project id is being searched over, set that id in the # cookie. @@ -75,67 +49,74 @@ if ($sproject ne "") { @project_ids = split ',', $sproject; } - - # Dump the raw topic data as text/plain. - print $query->header(); - - my $rss = new XML::RSS(version => '2.0'); - - my $this_url = - $url_builder->list_topics_url_rss($sauthor, $sreviewer, $scc, $sbugid, - $stext, $stitle, - $sdescription, $scomments, - $sbody, $sfilename, - [ split ',', $sstate] , \@project_ids); - - - $rss->channel(title=>$Codestriker::title, language=>"en",link=>$this_url); - - # For each topic, collect all the reviewers, CC, and bugs, and display it - # as a row in the table. Each bug should be linked appropriately. - foreach my $topic (@topics) { - - # do the easy stuff first, 1 to 1 mapping into the template. - my $link = - $url_builder->view_url($topic->{topicid}, -1, $mode, - $Codestriker::default_topic_br_mode); - - my $comment_link = $url_builder->view_comments_url($topic->{topicid}); - - my $description = $topic->{description}; - my $title = $topic->{title}; - - if (0) { - # Send out the list of files changes in the RSS description. - my (@filenames, @revisions, @offsets, @binary); - $topic->get_filestable( - \@filenames, - \@revisions, - \@offsets, - \@binary); - - $description .= "<p>" . join( "\n",@filenames); - } - - my @comments = $topic->read_comments(); - - $description .= "<p>Comments: " . scalar( @comments ) . ", "; - $description .= "State: " . $topic->{topic_state} . ", "; - $description .= "Author: " . Codestriker->filter_email($topic->{author}); - - $rss->add_item( - title=>$title, - permaLink=>$link, - description=>$description, - author=> Codestriker->filter_email($topic->{author}), - pubDate=>Codestriker->format_short_timestamp($topic->{creation_ts}), - category=>$topic->{project_name}, - comments=>$comment_link - ); - - } - - print $rss->as_string(); + + # Print the header. Should really be application/rss+xml, except when + # people click on the link they get a pop-up asking for an application + # that knows how to show application/rss+xml. Very confusing, so we + # will just say it is xml, (which it is of coarse). The link tag in + # the template lists it as application/rss+xml. + print $query->header(-type=>'application/xml'); + + # Obtain a new URL builder object. + my $url_builder = Codestriker::Http::UrlBuilder->new($query); + + my $rss = new XML::RSS(version => '2.0'); + + my $this_url = + $url_builder->list_topics_url_rss($sauthor, $sreviewer, $scc, $sbugid, + $stext, $stitle, + $sdescription, $scomments, + $sbody, $sfilename, + [ split ',', $sstate] , \@project_ids); + + + $rss->channel(title=>$Codestriker::title, language=>"en",link=>$this_url); + + # For each topic, collect all the reviewers, CC, and bugs, and display it + # as a row in the table. Each bug should be linked appropriately. + foreach my $topic (@topics) { + + # do the easy stuff first, 1 to 1 mapping into the template. + my $link = + $url_builder->view_url($topic->{topicid}, -1, $mode, + $Codestriker::default_topic_br_mode); + + my $comment_link = $url_builder->view_comments_url($topic->{topicid}); + + my $description = $topic->{description}; + my $title = $topic->{title}; + + # Change to 1 to send out the list of files changes in the RSS description. + if (0) { + my (@filenames, @revisions, @offsets, @binary); + $topic->get_filestable( + \@filenames, + \@revisions, + \@offsets, + \@binary); + + $description .= "<p>" . join( "\n",@filenames); + } + + my @comments = $topic->read_comments(); + + $description .= "<p>Comments: " . scalar( @comments ) . ", "; + $description .= "State: " . $topic->{topic_state} . ", "; + $description .= "Author: " . Codestriker->filter_email($topic->{author}); + + $rss->add_item( + title=>$title, + permaLink=>$link, + description=>$description, + author=> Codestriker->filter_email($topic->{author}), + pubDate=>Codestriker->format_short_timestamp($topic->{creation_ts}), + category=>$topic->{project_name}, + comments=>$comment_link + ); + + } + + print $rss->as_string(); } 1; |