codestriker-commits Mailing List for Codestriker: collaborative code reviewer (Page 21)
Brought to you by:
sits
You can subscribe to this list here.
| 2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(58) |
Dec
(14) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2005 |
Jan
(12) |
Feb
(53) |
Mar
(2) |
Apr
|
May
(36) |
Jun
(59) |
Jul
(69) |
Aug
(47) |
Sep
(54) |
Oct
(45) |
Nov
|
Dec
|
| 2006 |
Jan
(20) |
Feb
(3) |
Mar
|
Apr
(6) |
May
(13) |
Jun
(18) |
Jul
(9) |
Aug
(12) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2007 |
Jan
|
Feb
(1) |
Mar
(4) |
Apr
(1) |
May
(2) |
Jun
(7) |
Jul
(7) |
Aug
(6) |
Sep
(5) |
Oct
(2) |
Nov
(1) |
Dec
|
| 2008 |
Jan
(7) |
Feb
(13) |
Mar
(9) |
Apr
|
May
|
Jun
(50) |
Jul
(22) |
Aug
(58) |
Sep
(28) |
Oct
|
Nov
|
Dec
|
|
From: <si...@us...> - 2005-02-02 22:19:05
|
Created Codestriker topic at: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=9977080&action=view User: sits Date: 05/02/02 14:18:51 Modified: lib/Codestriker/Action ViewTopicComments.pm template/en/default editcomment.html.tmpl viewtopiccomments.html.tmpl Log: Minor changes for file/topic level comment handling Index: ViewTopicComments.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Action/ViewTopicComments.pm,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- ViewTopicComments.pm 30 Jan 2005 00:48:08 -0000 1.12 +++ ViewTopicComments.pm 2 Feb 2005 22:18:48 -0000 1.13 @@ -109,7 +109,8 @@ $last_filenumber = $comment->{filenumber}; } - if ($show_context ne "" && $show_context > 0) { + if ($show_context ne "" && $show_context > 0 && + $comment->{filenumber} != -1 && $comment->{fileline} != -1) { my $delta = Codestriker::Model::Delta->get_delta($topicid, $comment->{filenumber}, $comment->{fileline} , Index: editcomment.html.tmpl =================================================================== RCS file: /cvsroot/codestriker/codestriker/template/en/default/editcomment.html.tmpl,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- editcomment.html.tmpl 1 Feb 2005 05:45:35 -0000 1.17 +++ editcomment.html.tmpl 2 Feb 2005 22:18:50 -0000 1.18 @@ -253,9 +253,11 @@ [% END %] </TABLE> +[% IF context != '' %] <hr> <P>Context: (<A onClick="save_form_data()" HREF="[% inc_context_url %]">increase</A> | <A onClick="save_form_data()" HREF="[% dec_context_url %]">decrease)</A> [% context %] +[% END %] <SCRIPT type="text/javascript"> // Now that the form has loaded, set the form fields. Index: viewtopiccomments.html.tmpl =================================================================== RCS file: /cvsroot/codestriker/codestriker/template/en/default/viewtopiccomments.html.tmpl,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- viewtopiccomments.html.tmpl 30 Jan 2005 00:48:12 -0000 1.17 +++ viewtopiccomments.html.tmpl 2 Feb 2005 22:18:50 -0000 1.18 @@ -115,10 +115,10 @@ [%# Display the comment thread information #%] <TD> [% IF comment.filename != '' %] - <A HREF="[% comment.view_file %]">[% comment.filename %][% IF comment.fileline != -1 %]:[% comment.fileline %][% END %]</A> + <A HREF="[% comment.view_file %]">[% comment.filename %][% IF comment.fileline != -1 %]:[% comment.fileline %]</A>[% ELSE %]</A> (File Level)[% END %] [% IF allow_repositories != 0 %] | <A HREF="[% comment.view_parallel %]">Parallel</A> [% END %] [% ELSIF comment.fileline == -1 && comment.filenumber == -1 %] - Topic-level + Topic Level [% ELSE %] Line: [% comment.line %] [% END %] |
|
From: <si...@us...> - 2005-02-02 22:19:02
|
Topic "CVS commit: Minor changes for file/topic level comment ha..." Author: si...@us... Reviewers: cod...@li... URL: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=9977080&action=view -------------------------------------------------------------- Description: Minor changes for file/topic level comment handling -------------------------------------------------------------- The topic was created with the following files: codestriker/lib/Codestriker/Action/ViewTopicComments.pm codestriker/template/en/default/editcomment.html.tmpl codestriker/template/en/default/viewtopiccomments.html.tmpl |
|
From: <si...@us...> - 2005-02-02 04:51:00
|
Created Codestriker topic at: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=2145648&action=view User: sits Date: 05/02/01 20:50:45 Modified: lib/Codestriker/Http Render.pm Log: Minor UI suggested changes from Jason Index: Render.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Render.pm,v retrieving revision 1.40 retrieving revision 1.41 diff -u -r1.40 -r1.41 --- Render.pm 30 Jan 2005 00:48:09 -0000 1.40 +++ Render.pm 2 Feb 2005 04:50:42 -0000 1.41 @@ -371,7 +371,7 @@ # Generate the text for the link to add a file-level comment. my $add_file_level_comment_link = "javascript:eo('$cfi','-1','1')"; my $add_file_level_comment_text = - $query->a({href=>$add_file_level_comment_link}, "[Add comment]"); + $query->a({href=>$add_file_level_comment_link}, "[Add File Comment]"); if ($repmatch && $revision ne $Codestriker::ADDED_REVISION && $revision ne $Codestriker::PATCH_REVISION) { @@ -973,7 +973,7 @@ # Render the "Add comment to topic" link. print $query->p($query->a({href=>"javascript:eo('-1','-1',1)"}, - "Add comment") . " to topic."); + "Add general comment") . " to topic."); } # Render the initial start of the coloured table, with an empty row setting @@ -1011,7 +1011,7 @@ # Render the "Add comment to topic" link. my $query = $self->{query}; print $query->p($query->a({href=>"javascript:eo('-1','-1',1)"}, - "Add comment") . " to topic."); + "Add general comment") . " to topic."); } # Display a line for a single file view. |
|
From: <si...@us...> - 2005-02-02 04:50:54
|
Topic "CVS commit: Minor UI suggested changes from Jason" Author: si...@us... Reviewers: cod...@li... URL: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=2145648&action=view -------------------------------------------------------------- Description: Minor UI suggested changes from Jason -------------------------------------------------------------- The topic was created with the following files: codestriker/lib/Codestriker/Http/Render.pm |
|
From: <si...@us...> - 2005-02-01 05:45:52
|
Created Codestriker topic at: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=4841396&action=view User: sits Date: 05/01/31 21:45:37 Modified: template/en/default editcomment.html.tmpl Log: Minor HTML fixes from Jason Index: editcomment.html.tmpl =================================================================== RCS file: /cvsroot/codestriker/codestriker/template/en/default/editcomment.html.tmpl,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- editcomment.html.tmpl 30 Jan 2005 02:35:52 -0000 1.16 +++ editcomment.html.tmpl 1 Feb 2005 05:45:35 -0000 1.17 @@ -1,7 +1,7 @@ [% USE AutomagicLinks %] [% USE JavascriptEscape %] -<SCRIPT LANGUAGE="JavaScript"> +<SCRIPT type="text/javascript"> // FOR getCookie() and setCookie() // Original JavaScript code by Duncan Crombie: dcrombie at chirp.com.au @@ -208,7 +208,6 @@ <TABLE> <TR> <TD>Your email address: </TD> - </SCRIPT> <TD> <INPUT TYPE="text" NAME="email" SIZE=50 MAXLENGTH=100> </TD> @@ -256,10 +255,9 @@ <hr> <P>Context: (<A onClick="save_form_data()" HREF="[% inc_context_url %]">increase</A> | <A onClick="save_form_data()" HREF="[% dec_context_url %]">decrease)</A> -<PRE>[% context %] -</PRE> +[% context %] -<SCRIPT> +<SCRIPT type="text/javascript"> // Now that the form has loaded, set the form fields. set_form_fields(); </SCRIPT> |
|
From: <si...@us...> - 2005-02-01 05:45:46
|
Topic "CVS commit: Minor HTML fixes from Jason" Author: si...@us... Reviewers: cod...@li... URL: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=4841396&action=view -------------------------------------------------------------- Description: Minor HTML fixes from Jason -------------------------------------------------------------- The topic was created with the following files: codestriker/template/en/default/editcomment.html.tmpl |
|
From: <si...@us...> - 2005-01-31 06:01:11
|
Created Codestriker topic at: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=5271893&action=view User: sits Date: 05/01/30 22:00:52 Modified: bin checksetup.pl Log: Set the has_rss variable correctly. Index: checksetup.pl =================================================================== RCS file: /cvsroot/codestriker/codestriker/bin/checksetup.pl,v retrieving revision 1.63 retrieving revision 1.64 diff -u -r1.63 -r1.64 --- checksetup.pl 21 Dec 2004 23:02:53 -0000 1.63 +++ checksetup.pl 31 Jan 2005 06:00:49 -0000 1.64 @@ -963,7 +963,7 @@ $template_vars->{codestriker_conf} = '\'' . cwd() . '/..\''; -$template_vars->{has_rss} = exists($missing_optional{'XML::RSS'}); +$template_vars->{has_rss} = !exists($missing_optional{'XML::RSS'}); $template_vars->{scary_warning} = "# !!!! THIS FILE IS AUTO-GENERATED by bin/checksetup.pl !!!\n". |
|
From: <si...@us...> - 2005-01-31 06:01:03
|
Topic "CVS commit: Set the has_rss variable correctly." Author: si...@us... Reviewers: cod...@li... URL: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=5271893&action=view -------------------------------------------------------------- Description: Set the has_rss variable correctly. -------------------------------------------------------------- The topic was created with the following files: codestriker/bin/checksetup.pl |
|
From: <si...@us...> - 2005-01-30 02:36:09
|
Created Codestriker topic at: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=597974&action=view User: sits Date: 05/01/29 18:35:53 Modified: bin codestriker.pl.base template/en/default editcomment.html.tmpl Added: lib/Codestriker/Template/Plugin JavascriptEscape.pm Log: Added in a JavascriptEscape Template Toolkit plugin module, so that if we are ever using variables within javascript strings, this will escape the necessary characters. Index: codestriker.pl.base =================================================================== RCS file: /cvsroot/codestriker/codestriker/bin/codestriker.pl.base,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- codestriker.pl.base 21 Dec 2004 23:02:53 -0000 1.16 +++ codestriker.pl.base 30 Jan 2005 02:35:50 -0000 1.17 @@ -60,6 +60,7 @@ [% IF has_rss %]use Codestriker::Action::ListTopicsRSS; [% END %] use Codestriker::Template::Plugin::AutomagicLinks; +use Codestriker::Template::Plugin::JavascriptEscape; # Set the temp file location, if one has been specified. if (defined $Codestriker::tmpdir && $Codestriker::tmpdir ne '') { Index: JavascriptEscape.pm =================================================================== RCS file: JavascriptEscape.pm diff -N JavascriptEscape.pm --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ JavascriptEscape.pm 30 Jan 2005 02:35:51 -0000 1.1 @@ -0,0 +1,22 @@ +package Codestriker::Template::Plugin::JavascriptEscape; + +# Simple template toolkit plugin module for escaping the appropriate +# characters within a javascript string. + +use Template::Plugin::Filter; +use Codestriker; + +use base qw( Template::Plugin::Filter ); + +sub filter { + my ($self, $text) = @_; + + # Escape double and single quotes and backslashes. + $text =~ s/\\/\\\\/g; + $text =~ s/\"/\\\"/g; + $text =~ s/\'/\\\'/g; + + return $text; +} + +1; Index: editcomment.html.tmpl =================================================================== RCS file: /cvsroot/codestriker/codestriker/template/en/default/editcomment.html.tmpl,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- editcomment.html.tmpl 24 Jan 2005 21:17:37 -0000 1.15 +++ editcomment.html.tmpl 30 Jan 2005 02:35:52 -0000 1.16 @@ -1,3 +1,6 @@ +[% USE AutomagicLinks %] +[% USE JavascriptEscape %] + <SCRIPT LANGUAGE="JavaScript"> // FOR getCookie() and setCookie() @@ -121,15 +124,13 @@ // reviewers to the Cc: field. function add_other_reviewers() { [% FOREACH reviewer = reviewers %] - add_other_reviewer("[% reviewer %]"); + add_other_reviewer("[% reviewer | $JavascriptEscape %]"); [% END %] } </Script> [%# Screen for the add comment form. #%] -[% USE AutomagicLinks %] - [% PROCESS header.html.tmpl displaymenu = 0 version = version help = "x483.html#ADD-COMMENT" %] <table border="0" cellpadding="5" cellspacing="0" width="100%"> |
|
From: <si...@us...> - 2005-01-30 02:36:01
|
Topic "CVS commit: Added in a JavascriptEscape Template Toolkit ..." Author: si...@us... Reviewers: cod...@li... URL: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=597974&action=view -------------------------------------------------------------- Description: Added in a JavascriptEscape Template Toolkit plugin module, so that if we are ever using variables within javascript strings, this will escape the necessary characters. -------------------------------------------------------------- The topic was created with the following files: codestriker/bin/codestriker.pl.base JavascriptEscape.pm codestriker/template/en/default/editcomment.html.tmpl |
|
From: <si...@us...> - 2005-01-30 00:48:33
|
Created Codestriker topic at: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=1715961&action=view User: sits Date: 05/01/29 16:48:13 Modified: . CHANGELOG lib/Codestriker/Action EditComment.pm SubmitEditCommentsState.pm ViewTopicComments.pm lib/Codestriker/Http Render.pm lib/Codestriker/Model Comment.pm lib/Codestriker/TopicListeners Email.pm template/en/default viewtopiccomments.html.tmpl Log: * It is now possible to create a comment associated with a specific file, or the topic itself, rather than being associated with a specific line. This allows reviewers to create file-level or topic-level comments. Index: CHANGELOG =================================================================== RCS file: /cvsroot/codestriker/codestriker/CHANGELOG,v retrieving revision 1.160 retrieving revision 1.161 diff -u -r1.160 -r1.161 --- CHANGELOG 28 Jan 2005 00:59:04 -0000 1.160 +++ CHANGELOG 30 Jan 2005 00:47:51 -0000 1.161 @@ -3,6 +3,11 @@ Version 1.8.6 +* It is now possible to create a comment associated with a specific + file, or the topic itself, rather than being associated with a + specific line. This allows reviewers to create file-level or + topic-level comments. + * Extra options are now available in the codestriker.conf file in regards to when emails are sent out. It is now possible to control whether emails are sent to the topic author and/or the comment Index: EditComment.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Action/EditComment.pm,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- EditComment.pm 23 Jan 2005 21:05:28 -0000 1.11 +++ EditComment.pm 30 Jan 2005 00:47:55 -0000 1.12 @@ -41,10 +41,6 @@ # Retrieve line-by-line versions of the description. my @document_description = split /\n/, $topic->{description}; - # Retrieve the diff hunk for this file and line number. - my $delta = Codestriker::Model::Delta->get_delta($topicid, $fn, - $line, $new); - # Display the header of this page. $http_response->generate_header(topic=>$topicid, topic_title=>"Edit Comment: $topic->{title}", @@ -80,7 +76,14 @@ $dec_context, $anchor, ""); $vars->{'inc_context_url'} = $inc_context_url; $vars->{'dec_context_url'} = $dec_context_url; - $vars->{'context'} = $query->pre( + $vars->{'context'} = ""; + if ($line != -1) { + # Retrieve the context for a comment made against a specific line. + my $delta = Codestriker::Model::Delta->get_delta($topicid, $fn, + $line, $new); + + $vars->{'context'} = + $query->pre( Codestriker::Http::Render->get_context($line, $context, 1, $delta->{old_linenumber}, @@ -88,6 +91,7 @@ $delta->{text}, $new)) . $query->p . "\n"; + } # Display the comments which have been made for this line number # in chronological order. Index: SubmitEditCommentsState.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Action/SubmitEditCommentsState.pm,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- SubmitEditCommentsState.pm 17 Aug 2004 22:28:46 -0000 1.5 +++ SubmitEditCommentsState.pm 30 Jan 2005 00:48:08 -0000 1.6 @@ -51,7 +51,7 @@ foreach my $metric (@{$Codestriker::comment_state_metrics}) { my $metric_name = $metric->{name}; my $prefix = "comment_state_metric\\|$metric_name"; - if ($param_name =~ /^($prefix\|\d+\|\d+\|\d+)\|(\d+)$/) { + if ($param_name =~ /^($prefix\|\-?\d+\|\-?\d+\|\d+)\|(\d+)$/) { $comment_state_version_map{$1} = $2; $comment_state_new_map{$1} = $query->param($param_name); } Index: ViewTopicComments.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Action/ViewTopicComments.pm,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- ViewTopicComments.pm 18 Sep 2004 00:54:19 -0000 1.11 +++ ViewTopicComments.pm 30 Jan 2005 00:48:08 -0000 1.12 @@ -79,8 +79,8 @@ # Go through all the comments and make them into an appropriate form for # displaying. - my $last_filenumber = -1; - my $last_fileline = -1; + my $last_filenumber = -999; + my $last_fileline = -999; my $index = 0; for (my $i = 0; $i <= $#comments; $i++) { my $comment = $comments[$i]; Index: Render.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Render.pm,v retrieving revision 1.39 retrieving revision 1.40 diff -u -r1.39 -r1.40 --- Render.pm 9 Nov 2004 21:01:15 -0000 1.39 +++ Render.pm 30 Jan 2005 00:48:09 -0000 1.40 @@ -368,6 +368,11 @@ . "#$$filenames[$bwd_index]"; } + # Generate the text for the link to add a file-level comment. + my $add_file_level_comment_link = "javascript:eo('$cfi','-1','1')"; + my $add_file_level_comment_text = + $query->a({href=>$add_file_level_comment_link}, "[Add comment]"); + if ($repmatch && $revision ne $Codestriker::ADDED_REVISION && $revision ne $Codestriker::PATCH_REVISION) { # File matches something in the repository. Link it to @@ -398,12 +403,13 @@ $revision_text); } - # Output the "back to contents" link - # and some browsing links for visiting - # the previous and next file (<<, >>). - + # Output the "back to contents" link and some browsing links + # for visiting the previous and next file (<<, >>), in + # addition to the "add file-level comment" link. + print $query->Tr($cell, # = file header $query->td({-class=>'file', align=>'right'}, + "$add_file_level_comment_text ", ($bwd_url ne "" ? $query->a({href=>$bwd_url},"[<<]") : ""), $query->a({href=>$contents_url},"[Top]"), ($fwd_url ne "" ? $query->a({href=>$fwd_url},"[>>]") : ""))); @@ -413,6 +419,7 @@ "File ", $query->a({name=>$filename},$filename)), $query->td({-class=>'file', align=>'right'}, + "$add_file_level_comment_text ", ($bwd_url ne "" ? $query->a({href=>$bwd_url},"[<<]") : ""), $query->a({href=>$contents_url},"[Top]"), ($fwd_url ne "" ? $query->a({href=>$fwd_url},"[>>]") : ""))); @@ -963,7 +970,10 @@ } } print $query->end_table() . "\n"; - $self->print_coloured_table(); + + # Render the "Add comment to topic" link. + print $query->p($query->a({href=>"javascript:eo('-1','-1',1)"}, + "Add comment") . " to topic."); } # Render the initial start of the coloured table, with an empty row setting @@ -997,6 +1007,11 @@ } print "</TABLE>\n"; + + # Render the "Add comment to topic" link. + my $query = $self->{query}; + print $query->p($query->a({href=>"javascript:eo('-1','-1',1)"}, + "Add comment") . " to topic."); } # Display a line for a single file view. Index: Comment.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Model/Comment.pm,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- Comment.pm 28 Sep 2004 22:15:18 -0000 1.18 +++ Comment.pm 30 Jan 2005 00:48:10 -0000 1.19 @@ -143,7 +143,7 @@ $self->{metrics}->{$metric->{name}} = $metric->{value}; } - # get the filename, for the new comment. + # Get the filename, for the new comment. my $get_filename = $dbh->prepare_cached('SELECT filename ' . 'FROM topicfile ' . 'WHERE topicid = ? AND ' . @@ -153,8 +153,8 @@ ( $self->{filename} ) = $get_filename->fetchrow_array(); - $select_commentstate = undef; - $get_filename = undef; + $select_commentstate->finish(); + $get_filename->finish(); Codestriker::DB::DBI->release_connection($dbh, $success); die $dbh->errstr if !$success; @@ -256,6 +256,9 @@ # Obtain a database connection. my $dbh = Codestriker::DB::DBI->get_connection(); + # Determine if we are using Oracle, since it can't handle LEFT OUTER JOINs. + my $using_oracle = $Codestriker::db =~ /^DBI:Oracle/i; + # Store the results into an array of objects. my @results = (); @@ -272,11 +275,17 @@ 'commentstate.id, ' . 'commentstate.creation_ts, ' . 'commentstate.modified_ts ' . - 'FROM commentdata, commentstate, topicfile ' . - 'WHERE commentstate.topicid = ? ' . - 'AND commentstate.id = commentdata.commentstateid ' . - 'AND topicfile.topicid = commentstate.topicid ' . - 'AND topicfile.sequence = commentstate.filenumber ' . + 'FROM commentdata, commentstate ' . + ($using_oracle ? + (', topicfile WHERE commentstate.topicid = ? ' . + 'AND commentstate.id = commentdata.commentstateid ' . + 'AND topicfile.topicid = commentstate.topicid(+) ' . + 'AND topicfile.sequence = commentstate.filenumber(+) ') : + ('LEFT OUTER JOIN topicfile ON ' . + 'commentstate.topicid = topicfile.topicid AND ' . + 'commentstate.filenumber = topicfile.sequence ' . + 'WHERE commentstate.topicid = ? ' . + 'AND commentstate.id = commentdata.commentstateid ')) . 'ORDER BY ' . 'commentstate.filenumber, ' . 'commentstate.fileline, ' . @@ -379,7 +388,7 @@ return @comments; } -# Update the specified metriuc for the specified commentstate. The version +# Update the specified metric for the specified commentstate. The version # parameter indicates what version of the commentstate the user was operating # on. sub change_state { Index: Email.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/TopicListeners/Email.pm,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- Email.pm 21 Dec 2004 22:44:25 -0000 1.13 +++ Email.pm 30 Jan 2005 00:48:11 -0000 1.14 @@ -315,13 +315,6 @@ $comment->{topicid}, "", "", $query->url()); - # Retrieve the diff hunk for this file and line number. - my $delta = Codestriker::Model::Delta->get_delta( - $comment->{topicid}, - $comment->{filenumber}, - $comment->{fileline}, - $comment->{filenew}); - # Retrieve the comment details for this topic. my @comments = $topic->read_comments(); @@ -350,23 +343,41 @@ $bcc = $comment->{author}; } - my $subject = "[REVIEW] Topic \"$topic->{title}\" comment added by $comment->{author}"; + my $subject = "[REVIEW] Topic \"$topic->{title}\" " . + "comment added by $comment->{author}"; my $body = - "$comment->{author} added a comment to Topic \"$topic->{title}\".\n\n" . + "$comment->{author} added a comment to " . + "Topic \"$topic->{title}\".\n\n" . "URL: $edit_url\n\n"; - $body .= "File: " . $delta->{filename} . " line $comment->{fileline}.\n\n"; + if (defined $comment->{filename} && $comment->{filename} ne '') { + $body .= "File: " . $comment->{filename}; + } + + if ($comment->{fileline} != -1) { + $body .= " line $comment->{fileline}.\n\n"; - $body .= "Context:\n$EMAIL_HR\n\n"; - my $email_context = $Codestriker::EMAIL_CONTEXT; - $body .= Codestriker::Http::Render->get_context($comment->{fileline}, + # Only show the context for a comment made against a specific line. + $body .= "Context:\n$EMAIL_HR\n\n"; + my $email_context = $Codestriker::EMAIL_CONTEXT; + + # Retrieve the diff hunk for this file and line number. + my $delta = + Codestriker::Model::Delta->get_delta($comment->{topicid}, + $comment->{filenumber}, + $comment->{fileline}, + $comment->{filenew}); + $body .= + Codestriker::Http::Render->get_context($comment->{fileline}, $email_context, 0, $delta->{old_linenumber}, $delta->{new_linenumber}, $delta->{text}, $comment->{filenew}) . "\n"; - $body .= "$EMAIL_HR\n\n"; + $body .= "$EMAIL_HR"; + } + $body .= "\n\n"; # Now display the comments that have already been submitted. for (my $i = $#comments; $i >= 0; $i--) { Index: viewtopiccomments.html.tmpl =================================================================== RCS file: /cvsroot/codestriker/codestriker/template/en/default/viewtopiccomments.html.tmpl,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- viewtopiccomments.html.tmpl 24 Nov 2004 11:18:09 -0000 1.16 +++ viewtopiccomments.html.tmpl 30 Jan 2005 00:48:12 -0000 1.17 @@ -104,8 +104,8 @@ <TABLE CELLPADDING="1" CELLSPACING="3" BORDER="0" WIDTH="100%"> -[% last_fileline = -1 %] -[% last_filenumber = -1 %] +[% last_fileline = -999 %] +[% last_filenumber = -999 %] [% FOREACH comment = comments %] [% FLUSH IF loop.count() % 10 == 1 %] @@ -115,8 +115,10 @@ [%# Display the comment thread information #%] <TD> [% IF comment.filename != '' %] - <A HREF="[% comment.view_file %]">[% comment.filename %]:[% comment.fileline %]</A> + <A HREF="[% comment.view_file %]">[% comment.filename %][% IF comment.fileline != -1 %]:[% comment.fileline %][% END %]</A> [% IF allow_repositories != 0 %] | <A HREF="[% comment.view_parallel %]">Parallel</A> [% END %] + [% ELSIF comment.fileline == -1 && comment.filenumber == -1 %] + Topic-level [% ELSE %] Line: [% comment.line %] [% END %] |
|
From: <si...@us...> - 2005-01-30 00:48:26
|
Topic "CVS commit: * It is now possible to create a comment asso..." Author: si...@us... Reviewers: cod...@li... URL: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=1715961&action=view -------------------------------------------------------------- Description: * It is now possible to create a comment associated with a specific file, or the topic itself, rather than being associated with a specific line. This allows reviewers to create file-level or topic-level comments. -------------------------------------------------------------- The topic was created with the following files: codestriker/CHANGELOG codestriker/lib/Codestriker/Action/EditComment.pm codestriker/lib/Codestriker/Action/SubmitEditCommentsState.pm codestriker/lib/Codestriker/Action/ViewTopicComments.pm codestriker/lib/Codestriker/Http/Render.pm codestriker/lib/Codestriker/Model/Comment.pm codestriker/lib/Codestriker/TopicListeners/Email.pm codestriker/template/en/default/viewtopiccomments.html.tmpl |
|
From: <si...@us...> - 2005-01-28 00:59:28
|
Created Codestriker topic at: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=9961406&action=view User: sits Date: 05/01/27 16:59:11 Modified: . CHANGELOG lib/Codestriker/TopicListeners Bugzilla.pm Log: * When creating new topics linked to Bugzilla, also include the topic description field in the Bugzilla comment. Index: CHANGELOG =================================================================== RCS file: /cvsroot/codestriker/codestriker/CHANGELOG,v retrieving revision 1.159 retrieving revision 1.160 diff -u -r1.159 -r1.160 --- CHANGELOG 23 Jan 2005 21:05:25 -0000 1.159 +++ CHANGELOG 28 Jan 2005 00:59:04 -0000 1.160 @@ -19,6 +19,9 @@ the other reviewers of the topic, for important comments that needs to be sent to all reviewers. +* When creating new topics linked to Bugzilla, also include the topic + description field in the Bugzilla comment. + Version 1.8.5 * Complete support for VSS repositories. Topics linked to a VSS Index: Bugzilla.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/TopicListeners/Bugzilla.pm,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- Bugzilla.pm 27 Sep 2004 22:55:09 -0000 1.5 +++ Bugzilla.pm 28 Jan 2005 00:59:10 -0000 1.6 @@ -44,7 +44,8 @@ my $text = "Codestriker topic: $topic_url created.\n" . "Author: $topic->{author}\n" . "Reviewer(s): $topic->{reviewers}\n" . - "Title: $topic->{title}\n"; + "Title: $topic->{title}\n" . + "Description:\n" . "$topic->{description}\n"; for (my $i = 0; $i <= $#ids; $i++) { $bug_db_connection->update_bug($ids[$i], $text); |
|
From: <si...@us...> - 2005-01-28 00:59:22
|
Topic "CVS commit: * When creating new topics linked to Bugzilla..." Author: si...@us... Reviewers: cod...@li... URL: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=9961406&action=view -------------------------------------------------------------- Description: * When creating new topics linked to Bugzilla, also include the topic description field in the Bugzilla comment. -------------------------------------------------------------- The topic was created with the following files: codestriker/CHANGELOG codestriker/lib/Codestriker/TopicListeners/Bugzilla.pm |
|
From: <si...@us...> - 2005-01-24 21:18:32
|
Topic "CVS commit: Made the javascript smarter so if a reviewer ..." Author: si...@us... Reviewers: cod...@li... URL: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=4691417&action=view -------------------------------------------------------------- Description: Made the javascript smarter so if a reviewer is already present in either the CC field or the email field, then don't add it into the CC field. -------------------------------------------------------------- The topic was created with the following files: codestriker/template/en/default/editcomment.html.tmpl |
|
From: <si...@us...> - 2005-01-24 21:18:32
|
Created Codestriker topic at: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=4691417&action=view User: sits Date: 05/01/24 13:18:03 Modified: template/en/default editcomment.html.tmpl Log: Made the javascript smarter so if a reviewer is already present in either the CC field or the email field, then don't add it into the CC field. Index: editcomment.html.tmpl =================================================================== RCS file: /cvsroot/codestriker/codestriker/template/en/default/editcomment.html.tmpl,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- editcomment.html.tmpl 23 Jan 2005 21:05:29 -0000 1.14 +++ editcomment.html.tmpl 24 Jan 2005 21:17:37 -0000 1.15 @@ -91,14 +91,37 @@ return true; } +// Check if a specific reviewer can be added to the cc field, assuming +// it isn't present already. +function add_other_reviewer(reviewer) { + if (document.add_comment.comment_cc.value != "") { + var addresses = new Array(); + if (document.add_comment.comment_cc.value.split) { + addresses = document.add_comment.comment_cc.value.split(/[\s,]+/); + } + var found = 0; + for (var i = 0; i < addresses.length; i++) { + if (addresses[i] == reviewer) { + found = 1; + break; + } + } + if (reviewer == document.add_comment.email.value) { + found = 1; + } + if (found == 0) { + document.add_comment.comment_cc.value += ", " + reviewer; + } + } else { + document.add_comment.comment_cc.value = reviewer; + } +} + // Called when the "add other reviewers" link is pressed, which adds all // reviewers to the Cc: field. function add_other_reviewers() { [% FOREACH reviewer = reviewers %] - if (document.add_comment.comment_cc.value != '') { - document.add_comment.comment_cc.value += ', '; - } - document.add_comment.comment_cc.value += "[% reviewer %]"; + add_other_reviewer("[% reviewer %]"); [% END %] } </Script> |
|
From: <si...@us...> - 2005-01-23 21:06:05
|
Created Codestriker topic at: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=3167705&action=view User: sits Date: 05/01/23 13:05:46 Modified: . CHANGELOG lib Codestriker.pm lib/Codestriker/Action EditComment.pm template/en/default editcomment.html.tmpl Log: * Added a "add other reviewers" link next to the Cc: field in the "add comment" screen. This allows the comment author to easily Cc all the other reviewers of the topic, for important comments that needs to be sent to all reviewers. Index: CHANGELOG =================================================================== RCS file: /cvsroot/codestriker/codestriker/CHANGELOG,v retrieving revision 1.158 retrieving revision 1.159 diff -u -r1.158 -r1.159 --- CHANGELOG 21 Dec 2004 23:02:51 -0000 1.158 +++ CHANGELOG 23 Jan 2005 21:05:25 -0000 1.159 @@ -14,6 +14,11 @@ * Added RSS support, so that the topic list screen now has an equivalent RSS view. From Jason Remillard. +* Added a "add other reviewers" link next to the Cc: field in the "add + comment" screen. This allows the comment author to easily Cc all + the other reviewers of the topic, for important comments that needs + to be sent to all reviewers. + Version 1.8.5 * Complete support for VSS repositories. Topics linked to a VSS Index: Codestriker.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker.pm,v retrieving revision 1.68 retrieving revision 1.69 diff -u -r1.68 -r1.69 --- Codestriker.pm 21 Dec 2004 23:02:54 -0000 1.68 +++ Codestriker.pm 23 Jan 2005 21:05:28 -0000 1.69 @@ -27,7 +27,7 @@ ); # Version of Codestriker. -$Codestriker::VERSION = "1.8.5"; +$Codestriker::VERSION = "1.8.6"; # Default title to display on each Codestriker screen. $Codestriker::title = "Codestriker $Codestriker::VERSION"; Index: EditComment.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Action/EditComment.pm,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- EditComment.pm 17 Aug 2004 22:28:46 -0000 1.10 +++ EditComment.pm 23 Jan 2005 21:05:28 -0000 1.11 @@ -141,6 +141,12 @@ $vars->{'fn'} = $fn; $vars->{'new'} = $new; + # Add the "other" reviewers, which is all the reviewers without the + # address set in $email. + my @reviewers = split ', ', $topic->{reviewers}; + @reviewers = grep !/^$email$/, @reviewers; + $vars->{'reviewers'} = \@reviewers; + # Display the output via the template. my $template = Codestriker::Http::Template->new("editcomment"); $template->process($vars); Index: editcomment.html.tmpl =================================================================== RCS file: /cvsroot/codestriker/codestriker/template/en/default/editcomment.html.tmpl,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- editcomment.html.tmpl 24 Nov 2004 11:18:09 -0000 1.13 +++ editcomment.html.tmpl 23 Jan 2005 21:05:29 -0000 1.14 @@ -91,7 +91,17 @@ return true; } -</SCRIPT> +// Called when the "add other reviewers" link is pressed, which adds all +// reviewers to the Cc: field. +function add_other_reviewers() { + [% FOREACH reviewer = reviewers %] + if (document.add_comment.comment_cc.value != '') { + document.add_comment.comment_cc.value += ', '; + } + document.add_comment.comment_cc.value += "[% reviewer %]"; + [% END %] +} +</Script> [%# Screen for the add comment form. #%] @@ -181,7 +191,7 @@ <TD></TD> </TR> <TR> - <TD>Cc: </TD> + <TD>Cc: <FONT SIZE="-1"><A HREF="javascript:add_other_reviewers();">(add other reviewers)</A></FONT> </TD> <TD> <INPUT TYPE="text" NAME="comment_cc" SIZE=50 MAXLENGTH=150> </TD> |
|
From: <si...@us...> - 2005-01-23 21:05:58
|
Topic "CVS commit: * Added a "add other reviewers" link next to ..." Author: si...@us... Reviewers: cod...@li... URL: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=3167705&action=view -------------------------------------------------------------- Description: * Added a "add other reviewers" link next to the Cc: field in the "add comment" screen. This allows the comment author to easily Cc all the other reviewers of the topic, for important comments that needs to be sent to all reviewers. -------------------------------------------------------------- The topic was created with the following files: codestriker/CHANGELOG codestriker/lib/Codestriker.pm codestriker/lib/Codestriker/Action/EditComment.pm codestriker/template/en/default/editcomment.html.tmpl |
|
From: <si...@us...> - 2004-12-22 05:46:23
|
Created Codestriker topic at: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=4019777&action=view User: sits Date: 04/12/21 21:46:09 Removed: lib/Codestriker/Action ListTopicsRss.pm Log: Remove duplicate file Index: ListTopicsRss.pm =================================================================== RCS file: ListTopicsRss.pm diff -N ListTopicsRss.pm --- ListTopicsRss.pm 21 Dec 2004 23:02:55 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,141 +0,0 @@ -############################################################################### -# 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; |
|
From: <si...@us...> - 2004-12-22 05:46:17
|
Topic "CVS commit: Remove duplicate file" Author: si...@us... Reviewers: cod...@li... URL: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=4019777&action=view -------------------------------------------------------------- Description: Remove duplicate file -------------------------------------------------------------- The topic was created with the following files: ListTopicsRss.pm |
|
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; |
|
From: <si...@us...> - 2004-12-22 00:19:16
|
Topic "CVS commit: Updated RSS handling from Jason" Author: si...@us... Reviewers: cod...@li... URL: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=3882797&action=view -------------------------------------------------------------- Description: Updated RSS handling from Jason -------------------------------------------------------------- The topic was created with the following files: codestriker/lib/Codestriker/Action/ListTopicsRSS.pm |
|
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('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: DBI.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/DB/DBI.pm,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- DBI.pm 17 Feb 2004 11:38:09 -0000 1.6 +++ DBI.pm 21 Dec 2004 23:02:55 -0000 1.7 @@ -14,12 +14,22 @@ use Codestriker; use Codestriker::DB::Database; +# DBI connections are expensive to make, only have one per process, and when +# the code asks for a connection, just keep returning the same one. +our $connection; + # Retrieve a connection to the codestriker database for the specified sub get_connection($) { my ($type) = @_; + # makeing a connection is expensive, cache it, + if ( !defined($connection) ) { my $database = Codestriker::DB::Database->get_database(); - return $database->get_connection(); + + $connection = $database->get_connection(); + } + + return $connection; } # Release a connection, and if $success is true and this is a transaction @@ -32,8 +42,6 @@ if ($connection->{AutoCommit} == 0) { $success ? $connection->commit : $connection->rollback; } - - $connection->disconnect; } 1; Index: Template.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Template.pm,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- Template.pm 30 Sep 2004 10:27:09 -0000 1.10 +++ Template.pm 21 Dec 2004 23:02:56 -0000 1.11 @@ -84,6 +84,8 @@ $vars->{'main_title'} = $Codestriker::title; + $vars->{'rss_enabled'} = $Codestriker::rss_enabled; + # Indicate if the repository field should be displayed. $vars->{'allow_repositories'} = scalar(@Codestriker::valid_repositories) ? 1 : 0; Index: UrlBuilder.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/UrlBuilder.pm,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- UrlBuilder.pm 3 Nov 2004 20:48:33 -0000 1.25 +++ UrlBuilder.pm 21 Dec 2004 23:02:57 -0000 1.26 @@ -115,16 +115,36 @@ return $self->{htmldir}; } -# Create the URL for listing the topics. +# Create the URL for listing the topics (and topic search). See +# _list_topics_url for true param list. sub list_topics_url ($$$$$$$$$$$\@\@$) { - my ($self, $sauthor, $sreviewer, $scc, $sbugid, $stext, + my ($self) = @_; + + shift @_; # peal off self. + + return $self->_list_topics_url("list_topics",@_); +} + +# Create the URL for listing the topics (and topic search) via RSS. See +# _list_topics_url for true param list. +sub list_topics_url_rss ($$$$$$$$$$$\@\@$) { + my ($self) = @_; + + shift @_; # peal off self. + + return $self->_list_topics_url("list_topics_rss",@_); +} + +# Create the URL for listing the topics. +sub _list_topics_url ($$$$$$$$$$$$\@\@$) { + my ($self, $action,$sauthor, $sreviewer, $scc, $sbugid, $stext, $stitle, $sdescription, $scomments, $sbody, $sfilename, $state_array_ref, $project_array_ref, $content) = @_; my $sstate = defined $state_array_ref ? (join ',', @$state_array_ref) : ""; my $sproject = defined $project_array_ref ? (join ',', @$project_array_ref) : ""; - return $self->{query}->url() . "?action=list_topics" . + return $self->{query}->url() . "?action=$action" . ($sauthor ne "" ? "&sauthor=$sauthor" : "") . ($sreviewer ne "" ? "&sreviewer=$sreviewer" : "") . ($scc ne "" ? "&scc=$scc" : "") . @@ -140,6 +160,7 @@ (defined $content && $content ne "" ? "&content=$content" : ""); } + # Construct a URL for editing a specific project. sub edit_project_url ($$) { my ($self, $projectid) = @_; Index: MetricStats.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Model/MetricStats.pm,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- MetricStats.pm 22 Aug 2004 12:09:29 -0000 1.10 +++ MetricStats.pm 21 Dec 2004 23:02:58 -0000 1.11 @@ -330,7 +330,7 @@ # Get the list of users for this review. my @users = $metrics->get_complete_list_of_topic_participants(); - my @user_metrics = $metrics->get_user_metrics_totals( @users ); + my @user_metrics = $metrics->get_user_metrics_totals(@users); for (my $index = 0; $index < scalar(@{$headers->{user}}); ++$index) { my $count = ""; Index: Metrics.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Model/Metrics.pm,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- Metrics.pm 17 Aug 2004 22:29:02 -0000 1.10 +++ Metrics.pm 21 Dec 2004 23:02:58 -0000 1.11 @@ -169,6 +169,29 @@ return @topic_metrics; } +# Get just the list of users that have actually looked at the review. This is +# used on the main page to out users that are not doing the reviews when invited. +sub get_list_of_actual_topic_participants { + my ($self) = @_; + + my $dbh = Codestriker::DB::DBI->get_connection(); + + my $actual_user_list_ref = + $dbh->selectall_arrayref( + 'SELECT DISTINCT email FROM topicviewhistory ' . + 'WHERE topicid = ?',{}, $self->{topicid}); + + my @actual_user_list = (); + foreach my $user ( @$actual_user_list_ref ) { + push @actual_user_list,$user->[0] if $user->[0] ne ""; + } + + # Close the connection, and check for any database errors. + Codestriker::DB::DBI->release_connection($dbh, 1); + + return @actual_user_list; +} + # Get a list of users that have metric data for this topic. People can # look at the topic even if they were not invited, so if somebody touches the # topic, they will appear in this list. Using this function rather than the @@ -433,7 +456,7 @@ } else { # Add them up! - for (my $index = 0; $index < scalar( @total_metrics) ; ++$index) { + for (my $index = 0; $index < scalar(@total_metrics) ; ++$index) { if ($metrics[$index]->{value} ne '') { if ($total_metrics[$index]->{value} eq '') { $total_metrics[$index]->{value} = 0; @@ -690,7 +713,7 @@ $select_topic->execute($self->{topicid}, $username); - my $total_time = $self->calculate_topic_view_time( $select_topic); + my $total_time = $self->calculate_topic_view_time($select_topic); Codestriker::DB::DBI->release_connection($dbh); Index: Topic.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Model/Topic.pm,v retrieving revision 1.41 retrieving revision 1.42 diff -u -r1.41 -r1.42 --- Topic.pm 17 Oct 2004 22:32:41 -0000 1.41 +++ Topic.pm 21 Dec 2004 23:02:58 -0000 1.42 @@ -368,6 +368,46 @@ return @{$self->{comments}}; } +# returns a count of the comments that have the given comment +# metric (commentmetrictype) set to value. Used +# on the search page. +sub get_comment_metric_count { + my ($self,$commentmetrictype,$value) = @_; + + my $count = 0; + + if (scalar(@{$self->{comments}}) == 0) { + + # Obtain a database connection. + my $dbh = Codestriker::DB::DBI->get_connection(); + + # the comments have not been read into memory yet. + $count = $dbh->selectrow_array(' + SELECT COUNT(commentstatemetric.value) + FROM commentstatemetric, commentstate + WHERE commentstate.topicid = ? AND + commentstate.id = commentstatemetric.id AND + commentstatemetric.name = ? AND + commentstatemetric.value = ?', + {}, $self->{topicid}, + $commentmetrictype, $value); + + Codestriker::DB::DBI->release_connection($dbh, 1); + + } else { + # already read into memory, don't hit the database. + + foreach my $comment (@{$self->{comments}}) { + if ( exists( $comment->{$commentmetrictype} ) && + $comment->{$commentmetrictype} eq $value ) { + ++$count; + } + } + } + + return $count; +} + # Retrieve the changed files which are a part of this review. It will only pull them # from the database once. @@ -669,8 +709,7 @@ # Return back the list of topics which match the specified parameters. sub query($$$$$$$$$$$$$$\@\@\@) { my ($type, $sauthor, $sreviewer, $scc, $sbugid, $sstate, $sproject, $stext, - $stitle, $sdescription, $scomments, $sbody, $sfilename, $sort_order, - $topic_query_results_ref) = @_; + $stitle, $sdescription, $scomments, $sbody, $sfilename, $sort_order) = @_; # Obtain a database connection. my $database = Codestriker::DB::Database->get_database(); @@ -872,6 +911,8 @@ my $select_topic = $dbh->prepare_cached($query); my $success = defined $select_topic; $success &&= $select_topic->execute(); + my $lastid; + my @topic_list; if ($success) { my ($id, $title, $author, $description, $creation_ts, $state, $bugid, $email, $type, $version); @@ -880,79 +921,29 @@ $bugid, $email, $type, $version) = $select_topic->fetchrow_array()) { - my $topic_query_row = { - id => $id, - title => $title, - description => $description, - author => $author, - ts => $creation_ts, - state => $state, - bugid => $bugid, - email => $email, - type => $type, - version => $version, - }; + # This is a bit heavy, but the search screen does need much + # of the information in the topic object, it is much cleaner + # to just return a fully formed topic object, rathe than a + # array tunned. If performace is an issue, then the topic + # object should use lazy instatation to don't pull data from + # the database unless it is needed. + if ( !defined($lastid) || $id ne $lastid ) { - push @$topic_query_results_ref, $topic_query_row; - } - $select_topic->finish(); - } + my $new_topic = Codestriker::Model::Topic->new($id); - # get the visited flag and the comment state metric. - my $comment_metric_counts = []; - my $lastid; - - foreach my $topicrow (@$topic_query_results_ref) { - # If they configured the comment metrics to be on the main - # page then do the queries here. Because we have a row per - # topic per reviewer, it will make the page load faster if the - # query is only done once per topic. - if ( !defined($lastid) || $topicrow->{id} ne $lastid ) { - $comment_metric_counts = []; - $lastid = $topicrow->{id}; - - 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 = $dbh->selectrow_array(' - SELECT count(commentstatemetric.value) - FROM commentstatemetric, commentstate - WHERE commentstate.topicid = ? and - commentstate.id = commentstatemetric.id and - commentstatemetric.name = ? and - commentstatemetric.value = ?', - {}, $topicrow->{id}, - $comment_state_metric->{name}, $value); - - push @$comment_metric_counts, - { name => $comment_state_metric->{name}, - value => $value, - count => $count }; - } - } + push @topic_list,$new_topic; } - } - $topicrow->{commentmetrics} = $comment_metric_counts; + $lastid = $id; - # See if the specified user has hit the topic yet. - # TODO: This should be in the HistoryRecorder module, called - # From ListTopics.pm, not from here. - my $visited = $dbh->selectrow_array(' - SELECT count(creation_ts) FROM topicviewhistory - WHERE topicid = ? and - email = ?', - {}, $topicrow->{id}, $topicrow->{email}); - - $topicrow->{visitedtopic} = $visited; } - + $select_topic->finish(); + } $database->release_connection(); die $dbh->errstr unless $success; + + return @topic_list; } # Add the condition to the specified query string, returning the new query. Index: listtopics.html.tmpl =================================================================== RCS file: /cvsroot/codestriker/codestriker/template/en/default/listtopics.html.tmpl,v retrieving revision 1.31 retrieving revision 1.32 diff -u -r1.31 -r1.32 --- listtopics.html.tmpl 23 Nov 2004 02:47:09 -0000 1.31 +++ listtopics.html.tmpl 21 Dec 2004 23:02:59 -0000 1.32 @@ -125,6 +125,11 @@ <a href="[% view_metrics_url | uri | html %]">Metrics Report</a> +[% IF rss_enabled %] + +| <a href="[% list_sort_url_rss | uri | html %]">RSS</a> + <link rel="alternate" type="application/rdf+xml" title="RSS" href="[% list_sort_url_rss | uri | html %]"> +[% END %] </p> |
|
From: <si...@us...> - 2004-12-21 23:03:09
|
Topic "CVS commit: * Added RSS support, so that the topic list s..." Author: si...@us... Reviewers: cod...@li... URL: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=1098312&action=view -------------------------------------------------------------- Description: * Added RSS support, so that the topic list screen now has an equivalent RSS view. From Jason Remillard. -------------------------------------------------------------- The topic was created with the following files: codestriker/CHANGELOG codestriker/bin/checksetup.pl codestriker/bin/codestriker.pl.base codestriker/lib/Codestriker.pm codestriker/lib/Codestriker/Action/ListTopics.pm ListTopicsRSS.pm ListTopicsRss.pm codestriker/lib/Codestriker/DB/DBI.pm codestriker/lib/Codestriker/Http/Template.pm codestriker/lib/Codestriker/Http/UrlBuilder.pm codestriker/lib/Codestriker/Model/MetricStats.pm codestriker/lib/Codestriker/Model/Metrics.pm codestriker/lib/Codestriker/Model/Topic.pm codestriker/template/en/default/listtopics.html.tmpl |
|
From: <si...@us...> - 2004-12-21 22:44:44
|
Created Codestriker topic at: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=3370564&action=view User: sits Date: 04/12/21 14:44:28 Modified: . CHANGELOG codestriker.conf lib Codestriker.pm lib/Codestriker/TopicListeners Email.pm test changetopicproperties.t cleanuptesttopics.t deletetopic.t htmlescape.t mainpagechangestate.t runtests.conf test/CodestrikerTest Config.pm MainPage.pm TopicContentPage.pm TopicPropertiesPage.pm Added: test diffparsers.t Log: * Extra options are now available in the codestriker.conf file in regards to when emails are sent out. It is now possible to control whether emails are sent to the topic author and/or the comment author when new comments are created. Also, there is an option which determines if all reviewers are notified if the topic's state is changed. This is all controlled by the $email_send_options configuration item. From Jason Remillard. Index: CHANGELOG =================================================================== RCS file: /cvsroot/codestriker/codestriker/CHANGELOG,v retrieving revision 1.156 retrieving revision 1.157 diff -u -r1.156 -r1.157 --- CHANGELOG 7 Dec 2004 21:47:09 -0000 1.156 +++ CHANGELOG 21 Dec 2004 22:44:22 -0000 1.157 @@ -1,6 +1,16 @@ *** When upgrading, don't forget to: "cd bin ; ./checksetup.pl" *** *** Also, it is _highly_ advisable to backup your data before upgrading *** +Version 1.8.6 + +* Extra options are now available in the codestriker.conf file in + regards to when emails are sent out. It is now possible to control + whether emails are sent to the topic author and/or the comment + author when new comments are created. Also, there is an option + which determines if all reviewers are notified if the topic's state + is changed. This is all controlled by the $email_send_options + configuration item. From Jason Remillard. + Version 1.8.5 * Complete support for VSS repositories. Topics linked to a VSS Index: codestriker.conf =================================================================== RCS file: /cvsroot/codestriker/codestriker/codestriker.conf,v retrieving revision 1.67 retrieving revision 1.68 diff -u -r1.67 -r1.68 --- codestriker.conf 21 Nov 2004 05:00:04 -0000 1.67 +++ codestriker.conf 21 Dec 2004 22:44:22 -0000 1.68 @@ -260,13 +260,29 @@ # truncate them, to beat SPAM harvesters. $antispam_email = 0; -# If true, codestriker will send out emails to the topic owner and -# comment submitter when a comment is added. If this option is false, -# no email will be sent to either the topic owner or the comment -# submitter. Emails about each comment may not be needed if a meeting + +# If comments_sent_to_topic_author is true, codestriker will send +# out email to the topic owner and when a comment is added. If this +# option is false, no email will be sent the topic owner. +# +# If comments_sent_to_commenter is set to true, codestriker will +# blind cc (bcc) the comment author on all comments. The preceding +# comments_sent_to_topic_author must be true in order for the blind +# cc of emails to be enabled. +# +# If topic_state_change_sent_to_reviewers is set to true, codestriker +# will send email to the reviewer list when a topic state is changed. +# +# Emails about each comment may not be needed if a meeting # is planned to discuss the topic. If the comment submitter specifies -# a cc user, an email is always sent out, regardless of this setting. -$allow_comment_email = 1; +# a cc user, an email is always sent out, regardless of any email +# settings. +$email_send_options = + { + comments_sent_to_topic_author => 1, + comments_sent_to_commenter => 0, + topic_state_change_sent_to_reviewers => 0 + }; # Default width of tabs. Most developers expect this to be 8, but # some expect to see 4. This is also stored in the user's cookie, and Index: Codestriker.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker.pm,v retrieving revision 1.66 retrieving revision 1.67 diff -u -r1.66 -r1.67 --- Codestriker.pm 12 Oct 2004 10:13:38 -0000 1.66 +++ Codestriker.pm 21 Dec 2004 22:44:24 -0000 1.67 @@ -19,7 +19,7 @@ $file_reviewer $db $dbuser $dbpasswd $codestriker_css $NORMAL_MODE $COLOURED_MODE $COLOURED_MONO_MODE $topic_states $bug_db $bug_db_host $bug_db_name $bug_db_password $bug_db_user - $lxr_map $allow_comment_email $default_topic_br_mode + $lxr_map $email_send_options $default_topic_br_mode $allow_delete $allow_searchlist $default_file_to_view $allow_projects $antispam_email $VERSION $title $BASEDIR $metric_config $tmpdir @metric_schema $comment_state_metrics Index: Email.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/TopicListeners/Email.pm,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- Email.pm 17 Nov 2004 10:04:40 -0000 1.12 +++ Email.pm 21 Dec 2004 22:44:25 -0000 1.13 @@ -92,6 +92,9 @@ # removed reviewer,cc - sent to the removed reviewer, and author if != user. # added reviwer,cc - send to the new cc, and author if != user. # any change not made by the author, sent to the author. + # + # If topic_state_change_sent_to_reviewers is true, then topic state changes + # will be sent out to the reviewers. # Record the list of email addresses already handled. my %handled_addresses = (); @@ -142,6 +145,15 @@ $handled_addresses{ $user } = 1; } + # Check for state changes + if ($topic->{topic_state} ne $topic_orig->{topic_state} && + $Codestriker::email_send_options->{topic_state_change_sent_to_reviewers}) { + + foreach my $user ( split /, /, $topic->{reviewers} ) { + $handled_addresses{ $user } = 1; + } + } + my @to_list = keys( %handled_addresses ); if ( @to_list ) { @@ -160,22 +172,7 @@ sub send_topic_changed_email { my ($self, $user_that_made_the_change, $topic_orig, $topic,@to_list) = @_; - my $changes; - - # First line is naming names on who made the change to the topic. - if ($user_that_made_the_change ne "") { - $changes .= "The following changes were made by $user_that_made_the_change.\n"; - } - else { - my $host = $ENV{'REMOTE_HOST'}; - my $addr = $ENV{'REMOTE_ADDR'}; - - $host = "(unknown)" if !defined($host); - $addr = "(unknown)" if !defined($addr); - - $changes .= "The following changes were made by an unknown user from " . - "host $host and address $addr\n"; - } + my $changes = ""; # Check for author change. if ($topic->{author} ne $topic_orig->{author}) { @@ -229,11 +226,6 @@ $changes .= "The description was changed.\n"; } - # Check for state changes - if ($topic->{topic_state} ne $topic_orig->{topic_state} ) { - $changes .= "The state was changed to $topic->{topic_state}.\n"; - } - if ($topic->{project_name} ne $topic_orig->{project_name}) { $changes .= "The project was changed to $topic->{project_name}.\n"; } @@ -242,6 +234,38 @@ $changes .= "The bug list was changed to $topic->{bug_ids}.\n"; } + my $change_event_name = "Modified"; + + # Check for state changes, has to be the last check. + if ($topic->{topic_state} ne $topic_orig->{topic_state} ) { + + if ( $changes eq "" ) { + # The state change is the only thing changed. This is a common + # case, so tell people in the title what state the topic is in + # now. + $change_event_name = $topic->{topic_state}; + } + + $changes .= "The state was changed to $topic->{topic_state}.\n"; + } + + # First line is naming names on who made the change to the topic. + if ($user_that_made_the_change ne "") { + $changes = "The following changes were made by $user_that_made_the_change.\n" . + $changes + } + else { + my $host = $ENV{'REMOTE_HOST'}; + my $addr = $ENV{'REMOTE_ADDR'}; + + $host = "(unknown)" if !defined($host); + $addr = "(unknown)" if !defined($addr); + + $changes = "The following changes were made by an unknown user from " . + "host $host and address $addr\n" . $changes; + } + + # See if anybody needs an mail, if so then send it out. if (@to_list) { my $from = $user_that_made_the_change; @@ -271,7 +295,7 @@ my $cc = ""; # Send off the email to the revelant parties. - $self->_send_topic_email($topic, 0, "Modified", 1, $from, + $self->_send_topic_email($topic, 0,$change_event_name , 1, $from, $to, $cc, $bcc,$changes); } } @@ -319,7 +343,13 @@ my $from = $comment->{author}; my $to = $topic->{author}; - my $bcc = $comment->{author}; + + # don't blind copy the comment authors unless configured to. + my $bcc = ""; + if ( $Codestriker::email_send_options->{comments_sent_to_commenter} ) { + $bcc = $comment->{author}; + } + my $subject = "[REVIEW] Topic \"$topic->{title}\" comment added by $comment->{author}"; my $body = "$comment->{author} added a comment to Topic \"$topic->{title}\".\n\n" . @@ -351,7 +381,8 @@ } # Send the email notification out, if it is allowed in the config file. - if ( $Codestriker::allow_comment_email || $comment->{cc} ne "") + if ( $Codestriker::email_send_options->{comments_sent_to_topic_author} || + $comment->{cc} ne "") { if (!$self->doit(0, $comment->{topicid}, $from, $to, join(', ',@cc_recipients), $bcc, Index: changetopicproperties.t =================================================================== RCS file: /cvsroot/codestriker/codestriker/test/changetopicproperties.t,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- changetopicproperties.t 8 Sep 2004 03:48:57 -0000 1.2 +++ changetopicproperties.t 21 Dec 2004 22:44:26 -0000 1.3 @@ -61,7 +61,7 @@ ok( $properties->CompareProperties( 'topic_state',$newState),"verify state to $newState"); } -ok( $properties->SetTopicProperties( 'topic_state','Delete'),"delete topic, cleanup"); +ok( $properties->SetTopicProperties( 'topic_state','Deleted'),"delete topic, cleanup"); sub TestField { @@ -82,7 +82,6 @@ { push @new_values,$CodestrikerTest::Config::email_adddress[0]; push @new_values,$CodestrikerTest::Config::email_adddress[1]; - push @bad_values,"xxxx"; } elsif ($type eq 'email_list') { @@ -98,9 +97,6 @@ push @new_values,"$em1;$em2"; push @new_values," $em1 , $em2 "; - - push @bad_values,"xxxx"; - push @bad_values,"$em1,xxxx"; } if ( $allow_empty ) Index: cleanuptesttopics.t =================================================================== RCS file: /cvsroot/codestriker/codestriker/test/cleanuptesttopics.t,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- cleanuptesttopics.t 8 Sep 2004 03:48:57 -0000 1.2 +++ cleanuptesttopics.t 21 Dec 2004 22:44:26 -0000 1.3 @@ -29,7 +29,7 @@ my $properties = $topic_content->GetLink('Topic Properties'); - ok( $properties->SetTopicProperties( topic_state=>'Delete'),"delete topic $topic->{title}"); + ok( $properties->SetTopicProperties( topic_state=>'Deleted'),"delete topic $topic->{title}"); } Index: deletetopic.t =================================================================== RCS file: /cvsroot/codestriker/codestriker/test/deletetopic.t,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- deletetopic.t 8 Sep 2004 03:48:57 -0000 1.2 +++ deletetopic.t 21 Dec 2004 22:44:26 -0000 1.3 @@ -40,7 +40,7 @@ my $properties = $topic_content->GetLink('Topic Properties'); -ok( $properties->SetTopicProperties( topic_state=>'Delete'),"change delete"); +ok( $properties->SetTopicProperties( topic_state=>'Deleted'),"change delete"); my $searchPage = $main->GetLink("Search"); Index: htmlescape.t =================================================================== RCS file: /cvsroot/codestriker/codestriker/test/htmlescape.t,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- htmlescape.t 8 Sep 2004 03:48:57 -0000 1.2 +++ htmlescape.t 21 Dec 2004 22:44:26 -0000 1.3 @@ -28,7 +28,7 @@ topic_description=>'description <PRE><TABLE>', email=>$CodestrikerTest::Config::email_adddress[0], reviewers=>$CodestrikerTest::Config::email_adddress[1], - topic_file=>'testtopictexts/htmlfile.txt', + topic_file=>'testtopictexts/txt-htmlfile.txt', cc=>''); ok( $confirmPage->TopicCreated(),"normal text file create" ); Index: mainpagechangestate.t =================================================================== RCS file: /cvsroot/codestriker/codestriker/test/mainpagechangestate.t,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- mainpagechangestate.t 8 Sep 2004 03:48:57 -0000 1.2 +++ mainpagechangestate.t 21 Dec 2004 22:44:26 -0000 1.3 @@ -132,7 +132,7 @@ topic_description=>'description', email=>$CodestrikerTest::Config::email_adddress[0], reviewers=>$CodestrikerTest::Config::email_adddress[1], - topic_file=>'testtopictexts/htmlfile.txt', + topic_file=>'testtopictexts/txt-htmlfile.txt', cc=>''); ok( $confirmPage->TopicCreated(),"created topic $title" ); Index: runtests.conf =================================================================== RCS file: /cvsroot/codestriker/codestriker/test/runtests.conf,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- runtests.conf 8 Sep 2004 03:48:57 -0000 1.2 +++ runtests.conf 21 Dec 2004 22:44:26 -0000 1.3 @@ -5,7 +5,7 @@ @email_adddress = ( 'jpr@clover','jpr2@clover','jpr3@clover' ); -$version = "1.8.3"; +$version = "1.8.5"; $check_help_links = 0; Index: diffparsers.t =================================================================== RCS file: diffparsers.t diff -N diffparsers.t --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ diffparsers.t 21 Dec 2004 22:44:26 -0000 1.1 @@ -0,0 +1,113 @@ + +# make sure if we don't have any repo configured that all traces of repo's +# are gone from the system. + +use strict; +use warnings; + +use Test::More qw(no_plan); + +use CodestrikerTest::Config; +use CodestrikerTest::MainPage; +use CodestrikerTest::Page; +use CodestrikerTest::PageFactory; +use CodestrikerTest::Util; + +CodestrikerTest::Config::ProcessCommandLine(); + +my $main = CodestrikerTest::PageFactory->CreatePage($CodestrikerTest::Config::main_url); + +my @filenames = <testtopictexts/*.txt>; + +foreach my $filename (@filenames) +{ + my $repo = '/home/sits/cvs'; + + $filename =~ /\/([a-zA-Z]+)/; + + my $repo_type = $1; + + if ($repo_type eq "cvs") + { + $repo = '/home/sits/cvs'; + } + elsif ($repo_type eq "perforce") + { + $repo = 'perforce:sits:sits2@localhost:1666'; + } + elsif ($repo_type eq "clearcase") + { + $repo = 'clearcase:c:\\stuff\\view_name\\vob_name'; + } + elsif ($repo_type eq "svn") + { + $repo = 'svn:http://svn.collab.net/repos/svn/trunk'; + } + elsif ($repo_type eq "vss") + { + $repo = 'vss:c:\\Program Files\\Microsoft Visual Studio\\VSS;admin;password'; + } + + print "# Creating topic for file $filename - $repo_type - $repo\n"; + + my $topic_content = $main->MakeAndNavigateToNewTopic(topic_file=>$filename,repository=>$repo); + + # clean it up. + my $properties = $topic_content->GetLink('Topic Properties'); + + my @files = $topic_content->GetTopcFileInfo(); + my @bench_files = (); + + if ( -e "$filename.bench" ) + { + open BENCH,"<$filename.bench" or die "$!"; + + my $index = 0; + + while ( <BENCH> ) + { + chop; + my ($sourcefilename,$version,$added,$removed) = split /\t/; + + is( $sourcefilename,$files[$index]->{filename}, + "$filename $index - $sourcefilename == $files[$index]->{filename}" ); + is( $version,$files[$index]->{version}, + "$filename $index - $version == $files[$index]->{version}" ); + is( $added,$files[$index]->{added_lines}, + "$filename $index - $added == $files[$index]->{added_lines}" ); + is( $removed,$files[$index]->{removed_lines}, + "$filename $index - $removed == $files[$index]->{removed_lines}" ); + + ++$index; + } + + close(BENCH); + } + else + { + print "# *** creating $filename.bench\n"; + + open BENCH,">$filename.bench" or die "$!"; + + my $index = 0; + foreach my $file (@files) + { + print BENCH $files[$index]->{filename} . "\t" . + $files[$index]->{version} . "\t" . + $files[$index]->{added_lines} . "\t" . + $files[$index]->{removed_lines} . "\n"; + + ++$index; + } + + close BENCH; + } + + ok( $properties->SetTopicProperties( topic_state=>'Deleted'),"change delete"); +} + + + + +0; + Index: Config.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/test/CodestrikerTest/Config.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Config.pm 8 Sep 2004 03:48:57 -0000 1.2 +++ Config.pm 21 Dec 2004 22:44:27 -0000 1.3 @@ -34,7 +34,8 @@ close FILE; } -BEGIN + +sub ReloadConfiguration { $run_quick = 0; $check_help_links = 0; @@ -53,14 +54,17 @@ close CONFIG_FILE; $title = "Codestriker $version"; - - # Restore the default config file that is stored in the current directory. - RestoreDefaultConfiguration(); } - +# called at the start of each test. Used to process the command line args +# from runtests.pl and reset the config of codestriker. sub ProcessCommandLine { + ReloadConfiguration(); + + # Restore the default config file that is stored in the current directory. + RestoreDefaultConfiguration(); + if ( $ENV{CSTEST_OPTIONS} ) { push @ARGV, split /\s/,$ENV{CSTEST_OPTIONS}; Index: MainPage.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/test/CodestrikerTest/MainPage.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- MainPage.pm 14 Dec 2004 21:39:49 -0000 1.3 +++ MainPage.pm 21 Dec 2004 22:44:27 -0000 1.4 @@ -141,7 +141,6 @@ my $p = HTML::TokeParser->new(doc=>\$content); - # Skip the top table, remove this to run against 1.7.8. $p->get_tag("table"); $p->get_tag("/table"); Index: TopicContentPage.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/test/CodestrikerTest/TopicContentPage.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- TopicContentPage.pm 8 Sep 2004 03:48:57 -0000 1.2 +++ TopicContentPage.pm 21 Dec 2004 22:44:27 -0000 1.3 @@ -91,6 +91,89 @@ return $count; } +sub GetTopcFileInfo +{ + my ($self) = @_; + + $self->_ParseFileList(); + + return @{$self->{file_list}}; + +} + +sub _ParseFileList +{ + my ($self) = @_; + + if ( !exists($self->{file_list})) + { + my $content = $self->{response}->content; + + my $p = HTML::TokeParser->new(doc=>\$content); + + $p->get_tag("table"); + $p->get_tag("table"); + $p->get_tag("table"); + $p->get_tag("/table"); + + # This is the topic table. + + $p->get_tag("/tr"); # move past the TOC header. + + my @files; + + while (my $token = $p->get_tag("tr","/table")) + { + last if $token->[0] eq "/table"; + + $token = $p->get_tag("td"); + + my $hasVersion = !exists( $token->[1]->{"colspan"} ); + + my $filename = $p->get_trimmed_text("/td"); + $filename =~ s/^\[Jump to\] //; + + my $version = ""; + if ( $hasVersion) + { + $p->get_tag("td"); + $version = $p->get_trimmed_text("/td"); + + # trim the white space, the \xA0 is a html character code for a space. + $version =~ s/^[\s\xA0]+//g; + $version =~ s/[\s\xA0]+$//g; + } + + $p->get_tag("td"); + my $added_removed_lines = $p->get_trimmed_text("/td"); + $added_removed_lines =~ /\+([0-9]+),-([0-9]+)/; + + my $added_lines = ""; + my $removed_lines = ""; + if ( defined($1) && defined($2)) + { + $added_lines = $1; + $removed_lines = $2; + } + + my $file = + { + filename=>$filename, + version=>$version, + added_lines=>$added_lines, + removed_lines=>$removed_lines + }; + + # for debugging. + # print "# " . scalar(@files) . " fn=$filename v=$version add=$added_lines remove=$removed_lines\n"; + + push (@files,$file); + } + + $self->{file_list} = \@files; + } +} + 1; Index: TopicPropertiesPage.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/test/CodestrikerTest/TopicPropertiesPage.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- TopicPropertiesPage.pm 8 Sep 2004 03:48:57 -0000 1.2 +++ TopicPropertiesPage.pm 21 Dec 2004 22:44:27 -0000 1.3 @@ -48,8 +48,11 @@ # The dumb form module does not like getting all of its params passed in at once. foreach my $key ( keys ( %options )) { + if ( $options{$key} ne $form->value( $key ) ) + { $form->value($key,$options{$key}); } + } #$form->dump(); |