Thread: [Codestriker-commits] CVS update: codestriker/template/en/default editcomment.html.tmpl
                
                Brought to you by:
                
                    sits
                    
                
            
            
        
        
        
    | 
      
      
      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-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-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-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-14 09:44:06
       | 
| Created Codestriker topic at: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=6549985&action=view User: sits Date: 05/02/14 01:43:49 Modified: . CHANGELOG template/en/default editcomment.html.tmpl Added: lib/Codestriker/Template/Plugin StringObfuscator.pm Log: Make sure the email addresses in the javascript code for the "add other reviewers" link is suitable obfuscated so they can't be grabbed by email harvestors. Index: CHANGELOG =================================================================== RCS file: /cvsroot/codestriker/codestriker/CHANGELOG,v retrieving revision 1.161 retrieving revision 1.162 diff -u -r1.161 -r1.162 --- CHANGELOG 30 Jan 2005 00:47:51 -0000 1.161 +++ CHANGELOG 14 Feb 2005 09:43:46 -0000 1.162 @@ -19,6 +19,8 @@ * Added RSS support, so that the topic list screen now has an equivalent RSS view. From Jason Remillard. +* Optimised database ocnnection code, 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 Index: StringObfuscator.pm =================================================================== RCS file: StringObfuscator.pm diff -N StringObfuscator.pm --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ StringObfuscator.pm 14 Feb 2005 09:43:48 -0000 1.1 @@ -0,0 +1,27 @@ +package Codestriker::Template::Plugin::StringObfuscator; + +# Simple template toolkit plugin module for modifying the string +# into a more obfuscated form which spam harvesters can't use for +# nabbing email addresses. + +use Template::Plugin::Filter; +use Codestriker; + +use base qw( Template::Plugin::Filter ); + +sub filter { + my ($self, $text) = @_; + + my $length = length($text); + my $result = ""; + for (my $i = 0; $i < $length; $i++) { + my $char = substr $text, $i, 1; + $result .= "\"" unless $i == 0; + $result .= "$char"; + $result .= "\"+" unless $i == $length-1; + } + + return $result; +} + +1; Index: editcomment.html.tmpl =================================================================== RCS file: /cvsroot/codestriker/codestriker/template/en/default/editcomment.html.tmpl,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- editcomment.html.tmpl 2 Feb 2005 22:18:50 -0000 1.18 +++ editcomment.html.tmpl 14 Feb 2005 09:43:49 -0000 1.19 @@ -1,5 +1,6 @@ [% USE AutomagicLinks %] [% USE JavascriptEscape %] +[% USE StringObfuscator %] <SCRIPT type="text/javascript"> @@ -124,7 +125,7 @@ // reviewers to the Cc: field. function add_other_reviewers() { [% FOREACH reviewer = reviewers %] - add_other_reviewer("[% reviewer | $JavascriptEscape %]"); + add_other_reviewer("[% reviewer | $JavascriptEscape | $StringObfuscator %]"); [% END %] } </Script> |