Thread: [Codestriker-commits] CVS update: codestriker/template/en/default listtopics.html.tmpl
Brought to you by:
sits
|
From: <si...@us...> - 2004-11-23 02:47:34
|
Created Codestriker topic at: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=8578125&action=view&brmode=1&fview=-1 User: sits Date: 04/11/22 18:47:10 Modified: lib/Codestriker/Action SubmitEditTopicsState.pm template/en/default listtopics.html.tmpl Log: Ensure Obsoleted and Deleted states can't be selected from ListTopics screen. Index: SubmitEditTopicsState.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Action/SubmitEditTopicsState.pm,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- SubmitEditTopicsState.pm 21 Nov 2004 05:00:08 -0000 1.7 +++ SubmitEditTopicsState.pm 23 Nov 2004 02:47:06 -0000 1.8 @@ -38,7 +38,7 @@ } # The main topic list page does not allow deletes, so block this out. - if ($topic_state eq "Deleted") { + if ($topic_state eq "Deleted" || $topic_state eq "Obsoleted") { $http_response->error("This function has been disabled"); } Index: listtopics.html.tmpl =================================================================== RCS file: /cvsroot/codestriker/codestriker/template/en/default/listtopics.html.tmpl,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- listtopics.html.tmpl 21 Nov 2004 05:00:10 -0000 1.30 +++ listtopics.html.tmpl 23 Nov 2004 02:47:09 -0000 1.31 @@ -81,10 +81,14 @@ Change state: <select name="topic_state"> [% FOREACH state = states %] - [% IF state == default_state %] - <option selected value="[% state %]">[% state %]</option> - [% ELSE %] - <option value="[% state %]">[% state %]</option> + + [%# Obsoleted and Deleted states aren't available for selection. #%] + [% IF state != 'Obsoleted' && state != 'Deleted' %] + [% IF state == default_state %] + <option selected value="[% state %]">[% state %]</option> + [% ELSE %] + <option value="[% state %]">[% state %]</option> + [% END %] [% END %] [% IF state == 'Obsoleted' %] |
|
From: <si...@us...> - 2004-12-21 23:03:26
|
Created Codestriker topic at: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=1098312&action=view User: sits Date: 04/12/21 15:03:00 Modified: . CHANGELOG bin checksetup.pl codestriker.pl.base lib Codestriker.pm lib/Codestriker/Action ListTopics.pm lib/Codestriker/DB DBI.pm lib/Codestriker/Http Template.pm UrlBuilder.pm lib/Codestriker/Model MetricStats.pm Metrics.pm Topic.pm template/en/default listtopics.html.tmpl Added: lib/Codestriker/Action ListTopicsRSS.pm ListTopicsRss.pm Log: * Added RSS support, so that the topic list screen now has an equivalent RSS view. From Jason Remillard. Index: CHANGELOG =================================================================== RCS file: /cvsroot/codestriker/codestriker/CHANGELOG,v retrieving revision 1.157 retrieving revision 1.158 diff -u -r1.157 -r1.158 --- CHANGELOG 21 Dec 2004 22:44:22 -0000 1.157 +++ CHANGELOG 21 Dec 2004 23:02:51 -0000 1.158 @@ -11,6 +11,9 @@ is changed. This is all controlled by the $email_send_options configuration item. From Jason Remillard. +* Added RSS support, so that the topic list screen now has an + equivalent RSS view. From Jason Remillard. + Version 1.8.5 * Complete support for VSS repositories. Topics linked to a VSS Index: checksetup.pl =================================================================== RCS file: /cvsroot/codestriker/codestriker/bin/checksetup.pl,v retrieving revision 1.62 retrieving revision 1.63 diff -u -r1.62 -r1.63 --- checksetup.pl 22 Nov 2004 11:06:52 -0000 1.62 +++ checksetup.pl 21 Dec 2004 23:02:53 -0000 1.63 @@ -74,6 +74,11 @@ { name => 'File::Temp', version => '0' + }, + { + name => 'XML::RSS', + version => '1.05', + optional => 1 } ]; @@ -86,11 +91,20 @@ push @{$modules}, $database->get_module_dependencies(); }; +my %missing_optional = (); my %missing = (); foreach my $module (@{$modules}) { - unless (have_vers($module->{name}, $module->{version})) { + + my $optional = exists($module->{optional}) && $module->{optional}; + + unless (have_vers($module->{name}, $module->{version},$optional)) { + if ( $optional == 0) { $missing{$module->{name}} = $module->{version}; } + else { + $missing_optional{$module->{name}} = $module->{version}; + } + } } # vers_cmp is adapted from Sort::Versions 1.3 1996/07/11 13:37:00 kjahds, @@ -126,7 +140,7 @@ # This was originally clipped from the libnet Makefile.PL, adapted here to # use the above vers_cmp routine for accurate version checking. sub have_vers { - my ($pkg, $wanted) = @_; + my ($pkg, $wanted, $optional) = @_; my ($msg, $vnum, $vstr); no strict 'refs'; printf("Checking for %15s %-9s ", $pkg, !$wanted?'(any)':"(v$wanted)"); @@ -137,7 +151,13 @@ $vnum = -1 if $@; if ($vnum eq "-1") { # string compare just in case it's non-numeric - $vstr = "not found"; + if ( $optional ) { + $vstr = "ok: not found, optional"; + } + else { + $vstr = " not found"; + } + } elsif (vers_cmp($vnum,"0") > -1) { $vstr = "found v$vnum"; @@ -216,6 +236,7 @@ exit; } + # Obtain a database connection. my $dbh = $database->get_connection(); @@ -922,37 +943,40 @@ # configuration details set (basically, the location of the lib dir). print "Generating cgi-bin/codestriker.pl file...\n"; mkdir '../cgi-bin', 0755; -open(CODESTRIKER_BASE, "codestriker.pl.base") - || die "Unable to open codestriker.pl.base file: $!"; -open(CODESTRIKER_PL, ">../cgi-bin/codestriker.pl") - || die "Unable to create ../cgi-bin/codestriker.pl file: $!"; + +my $template = Template->new(); + +eval("use Template;"); +die "Unable to load Template module: $@\n" if $@; + +my $template_vars = {}; # For Win32, don't enable tainting mode. There are weird issues with # ActivePerl, and sometimes with IIS as well. if ($windows) { - print CODESTRIKER_PL '#!perl.exe -w' . "\n"; + $template_vars->{hash_ex_line} = '#!perl.exe -w'; } else { - print CODESTRIKER_PL '#!/usr/bin/perl -wT' . "\n"; + $template_vars->{hash_ex_line} = '#!/usr/bin/perl -wT'; } -my $codestriker_lib = 'use lib \'' . cwd() . '/../lib\';'; -for (my $i = 0; <CODESTRIKER_BASE>; $i++) { - # Check if this line requires any config substitutions. - my $line = $_; - $line =~ s/\@CODESTRIKER_LIB_DECLARATION\@/$codestriker_lib/g; - print CODESTRIKER_PL $line; +$template_vars->{codestriker_lib} = 'use lib \'' . cwd() . '/../lib\';'; - if ($i == 0) { - # Print out a message indicating this is an auto-generated file. - print CODESTRIKER_PL "\n# !!!! THIS FILE IS AUTO-GENERATED by bin/checksetup.pl !!!\n"; - print CODESTRIKER_PL "# !!!! DO NOT EDIT !!!\n"; +$template_vars->{codestriker_conf} = '\'' . cwd() . '/..\''; - print CODESTRIKER_PL "# The base source is bin/codestriker.pl.base.\n"; - } -} -close CODESTRIKER_BASE; +$template_vars->{has_rss} = exists($missing_optional{'XML::RSS'}); + +$template_vars->{scary_warning} = + "# !!!! THIS FILE IS AUTO-GENERATED by bin/checksetup.pl !!!\n". + "# !!!! DO NOT EDIT !!!\n". + "# The base source is bin/codestriker.pl.base.\n"; + +open(CODESTRIKER_PL, ">../cgi-bin/codestriker.pl") + || die "Unable to create ../cgi-bin/codestriker.pl file: $!"; + +$template->process("codestriker.pl.base", $template_vars,\*CODESTRIKER_PL); close CODESTRIKER_PL; + # Make sure the generated file is executable. chmod 0755, '../cgi-bin/codestriker.pl'; Index: codestriker.pl.base =================================================================== RCS file: /cvsroot/codestriker/codestriker/bin/codestriker.pl.base,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- codestriker.pl.base 22 Nov 2004 20:49:59 -0000 1.15 +++ codestriker.pl.base 21 Dec 2004 23:02:53 -0000 1.16 @@ -1,4 +1,6 @@ -# -*-perl-*- +[% hash_ex_line %] + +[% scary_warning %] ############################################################################### # Codestriker: Copyright (c) 2001, 2002 David Sitsky. All rights reserved. @@ -21,7 +23,7 @@ # effectively "pre-load" all of the Codestriker modules in the system, as the # modules below load all of their supporting modules. That is why the # template plugins are "pre-loaded" here. -@CODESTRIKER_LIB_DECLARATION@ +[% codestriker_lib %] use strict; @@ -55,6 +57,8 @@ use Codestriker::Action::ViewTopic; use Codestriker::Action::ViewTopicProperties; use Codestriker::Action::ViewTopicComments; +[% IF has_rss %]use Codestriker::Action::ListTopicsRSS; [% END %] + use Codestriker::Template::Plugin::AutomagicLinks; # Set the temp file location, if one has been specified. @@ -80,8 +84,15 @@ sub main() { # Initialise Codestriker, load up the configuration file. - $0 =~ /^(.*)cgi-bin/; - Codestriker->initialise($1); + Codestriker->initialise([% codestriker_conf %]); + +[% IF has_rss %] + # only generated if checksetup.pl found a good version of XML::RSS. + $Codestriker::rss_enabled = 1; +[% ELSE %] + # valid XML::RSS not found + $Codestriker::rss_enabled = 0; +[% END %] # If allow_delete is defined, but topic state 'Delete' is not, add it # in. This accounts for older configuration files. @@ -170,6 +181,13 @@ } elsif ($action eq "metrics_download") { Codestriker::Action::MetricsReport->process_download($http_input, $http_response); +[% IF has_rss %] + # only generated if checksetup.pl found a good version of XML::RSS. + } elsif ($action eq "list_topics_rss") { + Codestriker::Action::ListTopicsRSS->process($http_input, + $http_response); +[% END %] + } else { # Default action is to list topics that are in state open if the # list functionality is enabled, otherwise go to the create topic Index: Codestriker.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker.pm,v retrieving revision 1.67 retrieving revision 1.68 diff -u -r1.67 -r1.68 --- Codestriker.pm 21 Dec 2004 22:44:24 -0000 1.67 +++ Codestriker.pm 21 Dec 2004 23:02:54 -0000 1.68 @@ -23,7 +23,7 @@ $allow_delete $allow_searchlist $default_file_to_view $allow_projects $antispam_email $VERSION $title $BASEDIR $metric_config $tmpdir @metric_schema $comment_state_metrics - $project_states + $project_states $rss_enabled ); # Version of Codestriker. Index: ListTopics.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Action/ListTopics.pm,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- ListTopics.pm 27 Sep 2004 11:20:45 -0000 1.29 +++ ListTopics.pm 21 Dec 2004 23:02:55 -0000 1.30 @@ -27,46 +27,22 @@ # 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 = _get_topic_sort_order($http_input); + my ( $sauthor, $sreviewer, $scc, $sbugid, + $sstate, $sproject, $stext, + $stitle, $sdescription, + $scomments, $sbody, $sfilename, + $sort_order) = get_topic_list_query_params($http_input); # Query the model for the specified data. - my @topic_query_results; - Codestriker::Model::Topic->query($sauthor, $sreviewer, $scc, $sbugid, + my @topics = Codestriker::Model::Topic->query($sauthor, $sreviewer, $scc, $sbugid, $sstate, $sproject, $stext, $stitle, $sdescription, $scomments, $sbody, $sfilename, - \@sort_order, \@topic_query_results); + $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 @@ -79,7 +55,7 @@ $http_response->generate_header(topic_title=>"Topic List", projectid=>$projectid_cookie, - topicsort=>join(',',@sort_order), + topicsort=>join(',',@$sort_order), reload=>0, cache=>0); # Create the hash for the template variables. @@ -124,108 +100,178 @@ $sbody, $sfilename, [ split ',', $sstate] , \@project_ids); - # The list of topics. - my @topics; + $vars->{'list_sort_url_rss'} = + $url_builder->list_topics_url_rss($sauthor, $sreviewer, $scc, $sbugid, + $stext, $stitle, + $sdescription, $scomments, + $sbody, $sfilename, + [ split ',', $sstate] , \@project_ids); + + # The list of topics in the template toolkit. + my @template_topics; # 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. The - # query function will return a row per topic, per reviewer so this loop - # needs to combine rows that are from the same topic. - for (my $index = 0; $index < scalar(@topic_query_results); ++$index) { - my $topic_row = $topic_query_results[$index]; - - my @accum_bugs = (); - my @accum_reviewers = (); - my @accum_reviewers_not_visited = (); - my @accum_cc = (); - my $accum_id = $topic_row->{id}; - - # Onl include the username part of the email address to save space. - $topic_row->{author} =~ s/\@.*$//o; - my $accum_author = $topic_row->{author}; - - # Accumulate the bug ids, reviewers and cc here for the same topic. - # Note these will be only a few elements long, if that. - for (; $index < scalar(@topic_query_results) && - $accum_id == $topic_row->{id}; - $index++, $topic_row = $topic_query_results[$index]) { + # 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 $template_topic = {}; + + $template_topic->{'view_topic_url'} = + $url_builder->view_url($topic->{topicid}, -1, $mode, + $Codestriker::default_topic_br_mode); + + $template_topic->{'description'} = $topic->{description}; + + $template_topic->{'created'} = + Codestriker->format_short_timestamp($topic->{creation_ts}); + + $template_topic->{'id'} = $topic->{topicid}; + $template_topic->{'title'} = $topic->{title}; - if (defined $topic_row->{bugid}) { - _insert_nonduplicate(\@accum_bugs, $topic_row->{bugid}); + $template_topic->{'version'} = $topic->{version}; + + $template_topic->{'state'} = $Codestriker::topic_states[$topic->{topic_state_id}]; + + # Only include the username part of the email address to save space. + my $accum_author = $topic->{author}; + $accum_author =~ s/\@.*$//o; + $template_topic->{'author'} = $accum_author; + + # cc + my $cc = $topic->{cc}; + $cc =~ s/\@.*$//o; + $template_topic->{'cc'} = $cc; + + # bug ids + my @accum_bugs = split /, /, $topic->{bug_ids}; + for ( my $index = 0; $index < scalar(@accum_bugs); ++$index) { + $accum_bugs[$index] = + $query->a({href=>"$Codestriker::bugtracker$accum_bugs[$index]"}, + $accum_bugs[$index]); + } + $template_topic->{'bugids'} = join ', ', @accum_bugs; + + # do the reviewers + my @reviewers_vistited = + $topic->get_metrics()->get_list_of_actual_topic_participants(); + + my @reviewers = split /, /, $topic->{reviewers}; + for ( my $index = 0; $index < scalar(@reviewers); ++$index) { + + my $reviewer = $reviewers[$index]; + + my $is_visted = 0; + foreach my $visted (@reviewers_vistited) { + if ($visted eq $reviewer) { + $is_visted = 1; + last; + } } # Output the accumulated information into the row. Only # include the username part of an email address for now to # save some space. This should be made a dynamic option # in the future. - $topic_row->{email} =~ s/\@.*$//o; + $reviewer =~ s/\@.*$//o; - if (defined $topic_row->{email}) { - if ($topic_row->{type} == $Codestriker::PARTICIPANT_REVIEWER) { + if ( $is_visted == 0) { + $reviewer = "(" . $reviewer . ")"; + } - if (!$topic_row->{visitedtopic}) { - $topic_row->{email} = "(" . $topic_row->{email} . ")"; + $reviewers[$index] = $reviewer; } - _insert_nonduplicate(\@accum_reviewers, - $topic_row->{email}); - } else { - _insert_nonduplicate(\@accum_cc, $topic_row->{email}); + $template_topic->{'reviewer'} = join(", ",@reviewers); + + my @main_page_comment_metrics = (); + foreach my $comment_state_metric (@{$Codestriker::comment_state_metrics}) { + + if ( exists($comment_state_metric->{show_on_mainpage})) { + foreach my $value (@{$comment_state_metric->{show_on_mainpage}}) { + + my $count = $topic->get_comment_metric_count($comment_state_metric->{name},$value); + + my $template_comment_metric = + { + name => $comment_state_metric->{name}, + value => $value, + count => $count + }; + + push @main_page_comment_metrics,$template_comment_metric; } } } - --$index; - $topic_row = $topic_query_results[$index]; - - my $reviewer_text = join ', ', @accum_reviewers; - my $cc_text = ($#accum_cc >= 0) ? (join ', ', @accum_cc) : ""; - - for (my $i = 0; $i <= $#accum_bugs; $i++) { - $accum_bugs[$i] = - $query->a({href=>"$Codestriker::bugtracker$accum_bugs[$i]"}, - $accum_bugs[$i]); - } - my $bugid_text = join ', ', @accum_bugs; + $template_topic->{'commentmetrics'} = \@main_page_comment_metrics; - # Add this row to the list of topics. - my $topic = {}; - $topic->{'view_topic_url'} = - $url_builder->view_url($accum_id, -1, $mode, - $Codestriker::default_topic_br_mode); - $topic->{'id'} = $accum_id; - $topic->{'title'} = $topic_row->{title}; - $topic->{'description'} = $topic_row->{description}; - $topic->{'author'} = $accum_author; - $topic->{'reviewer'} = $reviewer_text; - $topic->{'cc'} = $cc_text; - $topic->{'created'} = - Codestriker->format_short_timestamp($topic_row->{ts}); - $topic->{'bugids'} = $bugid_text; - $topic->{'state'} = $Codestriker::topic_states[$topic_row->{state}]; - $topic->{'version'} = $topic_row->{version}; - $topic->{'commentmetrics'} = $topic_row->{commentmetrics}; - push @topics, $topic; + push @template_topics, $template_topic; } - $vars->{'topics'} = \@topics; + + $vars->{'topics'} = \@template_topics; $vars->{'states'} = \@Codestriker::topic_states; $vars->{'list_projects_url'} = $url_builder->list_projects_url(); $vars->{'view_metrics_url'} = $url_builder->metric_report_url(); - my $template = Codestriker::Http::Template->new("listtopics"); $template->process($vars); $http_response->generate_footer(); } +# Process the input and return the parts that will feed into the topic +# list query. Returns in the same order that the topic query function +# takes them. +sub get_topic_list_query_params { + my ($http_input) = @_; + + # Check that the appropriate fields have been filled in. + 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 $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 = get_topic_sort_order($http_input); + + return ( $sauthor, $sreviewer, $scc, $sbugid, + $sstate, $sproject, $stext, + $stitle, $sdescription, + $scomments, $sbody, $sfilename, + \@sort_order); +} + # Process the topic_sort_change input request (if any), and the current sort # cookie (topicsort), and returns a list that defines the topic sort order # that should be used for this request. The function will ensure that # column types are not repeated, and will sort in the opposite direction # if the user clicks on the same column twice. -sub _get_topic_sort_order { +sub get_topic_sort_order { my ($http_input) = @_; my $topic_sort_change = $http_input->get('topic_sort_change'); @@ -274,7 +320,6 @@ } } - # Pull out any elements that are not valid (from a bad cookie or from a bad # input. @@ -293,16 +338,4 @@ return @sort_order; } -# Append an element into an array if it doesn't exist already. Note this is -# only called for arrays of very small sizes (ie typically 1-2 elements). -sub _insert_nonduplicate(\@$) { - my ($array_ref, $value) = @_; - my @array = @$array_ref; - my $i; - for ($i = 0; $i <= $#array; $i++) { - last if ($array[$i] eq $value); - } - push @$array_ref, $value if ($i > $#array); -} - 1; Index: ListTopicsRSS.pm =================================================================== RCS file: ListTopicsRSS.pm diff -N ListTopicsRSS.pm --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ ListTopicsRSS.pm 21 Dec 2004 23:02:55 -0000 1.1 @@ -0,0 +1,141 @@ +############################################################################### +# Codestriker: Copyright (c) 2001, 2002 David Sitsky. All rights reserved. +# si...@us... +# +# This program is free software; you can redistribute it and modify it under +# the terms of the GPL. + +# Action object for displaying a list of topics. + +package Codestriker::Action::ListTopicsRSS; + +use strict; +use Codestriker::Http::Template; +use Codestriker::Model::Topic; +use XML::RSS; + +# If the input is valid, list the appropriate topics. +sub process($$$) { + my ($type, $http_input, $http_response) = @_; + + my $query = $http_response->get_query(); + + # Check if this action is allowed. + if ($Codestriker::allow_searchlist == 0) { + $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); + + # 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. + my @project_ids = (); + 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(); +} + +1; Index: ListTopicsRss.pm =================================================================== RCS file: ListTopicsRss.pm diff -N ListTopicsRss.pm --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ ListTopicsRss.pm 21 Dec 2004 23:02:55 -0000 1.1 @@ -0,0 +1,141 @@ +############################################################################### +# Codestriker: Copyright (c) 2001, 2002 David Sitsky. All rights reserved. +# si...@us... +# +# This program is free software; you can redistribute it and modify it under +# the terms of the GPL. + +# Action object for displaying a list of topics. + +package Codestriker::Action::ListTopicsRSS; + +use strict; +use Codestriker::Http::Template; +use Codestriker::Model::Topic; +use XML::RSS; + +# If the input is valid, list the appropriate topics. +sub process($$$) { + my ($type, $http_input, $http_response) = @_; + + my $query = $http_response->get_query(); + + # Check if this action is allowed. + if ($Codestriker::allow_searchlist == 0) { + $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('sproj... [truncated message content] |