[Codestriker-commits] CVS update: codestriker/template/en/default viewtopiccomments.html.tmpl viewto
Brought to you by:
sits
|
From: <si...@us...> - 2005-05-22 11:26:48
|
Created Codestriker topic at: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=5250071&action=view User: sits Date: 05/05/22 04:26:31 Modified: . CHANGELOG codestriker.conf lib Codestriker.pm lib/Codestriker/Action ViewTopicComments.pm lib/Codestriker/Http Render.pm Template.pm lib/Codestriker/Repository Subversion.pm template/en/default viewtopiccomments.html.tmpl viewtopicproperties.html.tmpl Log: * 'Readonly' topic states are now specified in codestriker.conf. For installations that add their own topic states, this allows them to have more than one state in which topics can be edited. From Dan Prince <dan...@al...>. * Subversion topic creation fixes from Michael R. Brumm <mic...@us...>. If module refers to file, path workaround duplicates the file's name at the end of the file path in the filename field. Starting and ending slash not removed from module name during getDiff. Index: CHANGELOG =================================================================== RCS file: /cvsroot/codestriker/codestriker/CHANGELOG,v retrieving revision 1.169 retrieving revision 1.170 diff -u -r1.169 -r1.170 --- CHANGELOG 22 May 2005 10:56:16 -0000 1.169 +++ CHANGELOG 22 May 2005 11:26:28 -0000 1.170 @@ -78,6 +78,17 @@ * Fixed message "Character in 'c' format wrapped in pack at ... Response.pm", as reported by an anonymous user. +* 'Readonly' topic states are now specified in codestriker.conf. For + installations that add their own topic states, this allows them to + have more than one state in which topics can be edited. + From Dan Prince <dan...@al...>. + +* Subversion topic creation fixes from Michael R. Brumm + <mic...@us...>. If module refers to file, + path workaround duplicates the file's name at the end of the file + path in the filename field. Starting and ending slash not removed + from module name during getDiff. + 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.71 retrieving revision 1.72 diff -u -r1.71 -r1.72 --- codestriker.conf 22 May 2005 10:46:25 -0000 1.71 +++ codestriker.conf 22 May 2005 11:26:28 -0000 1.72 @@ -224,6 +224,11 @@ # to delete topics. @topic_states = ('Open', 'Closed', 'Committed', 'Obsoleted', 'Deleted'); +# Which states (in topic_states, above) represent a 'readonly' state. +# If a topic is in a readonly state, then certain activities are disabled, such +# as adding new comments, editing the metrics of existing comments, etc. +@readonly_states = ('Closed', 'Committed', 'Obsoleted', 'Deleted'); + # Indicate if topics can be listed/searched. Turning this to false can be # useful for "anonymous" installations of codestriker. $allow_searchlist = 1; Index: Codestriker.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker.pm,v retrieving revision 1.70 retrieving revision 1.71 diff -u -r1.70 -r1.71 --- Codestriker.pm 22 May 2005 10:46:32 -0000 1.70 +++ Codestriker.pm 22 May 2005 11:26:28 -0000 1.71 @@ -463,6 +463,12 @@ return $#Codestriker::project_states > 0; } -1; +# Returns true if the given topic is 'readonly', i.e. if the given topic +# status is in the list of readonly_states in codestriker.conf. +sub topic_readonly($) { + my ($topic_state) = @_; + return (grep /^$topic_state$/, @Codestriker::readonly_states); +} +1; Index: ViewTopicComments.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Action/ViewTopicComments.pm,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- ViewTopicComments.pm 1 Mar 2005 10:12:49 -0000 1.14 +++ ViewTopicComments.pm 22 May 2005 11:26:29 -0000 1.15 @@ -153,7 +153,7 @@ $vars->{'metrics'} = \@metrics; # Store the topic status - $vars->{'topic_status'} = $topic->{topic_state}; + $vars->{'default_state'} = $topic->{topic_state}; $vars->{'topic_states'} = \@Codestriker::topic_states; # Send the data to the template for rendering. Index: Render.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Render.pm,v retrieving revision 1.49 retrieving revision 1.50 diff -u -r1.49 -r1.50 --- Render.pm 1 Mar 2005 10:12:52 -0000 1.49 +++ Render.pm 22 May 2005 11:26:29 -0000 1.50 @@ -783,8 +783,8 @@ $params->{name} = $anchor; # Only set the href attribute if the comment is in open state. - if ($self->{topic_state} eq $Codestriker::topic_states[0]) { - $params->{href} = $edit_url; + if (!Codestriker::topic_readonly($self->{topic_state})) { + $params->{href} = $edit_url; } # If a comment exists on this line, set span and the overlib hooks onto Index: Template.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Template.pm,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- Template.pm 21 Dec 2004 23:02:56 -0000 1.11 +++ Template.pm 22 May 2005 11:26:29 -0000 1.12 @@ -98,6 +98,10 @@ 0 : $Codestriker::suggested_topic_size_lines; + # Determine whether the current topic is 'readonly'; this determines + # the editability of various fields. + $vars->{'topic_readonly'} = + Codestriker::topic_readonly($vars->{'default_state'}); my $query = new CGI; my $url_builder = Codestriker::Http::UrlBuilder->new($query); Index: Subversion.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Repository/Subversion.pm,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- Subversion.pm 17 Nov 2004 10:04:39 -0000 1.8 +++ Subversion.pm 22 May 2005 11:26:30 -0000 1.9 @@ -45,7 +45,7 @@ $filename =~ s/ /%20/g; my $cmd = "svn cat --non-interactive --no-auth-cache " . $self->{userCmdLine} . - "--revision $revision " . + " --revision $revision " . "\"" . $self->{repository_url} . "/$filename\""; my $write_stdin_fh = new FileHandle; @@ -100,19 +100,58 @@ sub getDiff ($$$$$) { my ($self, $start_tag, $end_tag, $module_name, $stdout_fh, $stderr_fh) = @_; - my $cmd = "svn diff --non-interactive --no-auth-cache " . $self->{userCmdLine} . - "-r $start_tag:$end_tag " . - "--old \"$self->{repository_url}\" \"$module_name\""; + # Make sure the moduel does not end or start with a / + $module_name =~ s/\/$//; + $module_name =~ s/^\///; + + # Replace any spaces with %20 uri friendly escapes. + my $filename = $module_name; + $filename =~ s/ /%20/g; + + my $cmd = "svn cat --non-interactive --no-auth-cache " . $self->{userCmdLine} . + " --revision HEAD " . + "\"" . $self->{repository_url} . "/$filename\""; my $write_stdin_fh = new FileHandle; my $read_stdout_fh = new FileHandle; my $read_stderr_fh = new FileHandle; - my $pid = open3($write_stdin_fh, $read_stdout_fh, $read_stderr_fh,$cmd); + my $pid = open3($write_stdin_fh, $read_stdout_fh, $read_stderr_fh, $cmd); - # Make sure the moduel does not end or start with a / - $module_name =~ s/\\$//; - $module_name =~ s/^\\//; + while(<$read_stdout_fh>) {} + + my $directory; + + # If there is an error about it being a directory, then use the + # module name as a directory. + while(<$read_stderr_fh>) { + my $line = $_; + + if ($line =~ /^svn: URL '.*' refers to a directory/) { + $directory = $module_name; + } + } + + # if there was no error, then the module name is a file, so get the + # directory before the file name. + if (! defined $directory) { + $module_name =~ /(.*)\/[^\/]+/; + $directory = $1; + } + + $write_stdin_fh->close(); + $read_stdout_fh->close(); + $read_stderr_fh->close(); + + $cmd = "svn diff --non-interactive --no-auth-cache " . $self->{userCmdLine} . + " -r $start_tag:$end_tag " . + "--old \"$self->{repository_url}\" \"$module_name\""; + + $write_stdin_fh = new FileHandle; + $read_stdout_fh = new FileHandle; + $read_stderr_fh = new FileHandle; + + $pid = open3($write_stdin_fh, $read_stdout_fh, $read_stderr_fh, $cmd); while(<$read_stdout_fh>) { my $line = $_; @@ -131,9 +170,9 @@ $line =~ /^--- $module_name/ == 0 && $line =~ /^Index: $module_name/ == 0) { - $line =~ s/^--- /--- $module_name\// or - $line =~ s/^Index: /Index: $module_name\// or - $line =~ s/^\+\+\+ /\+\+\+ $module_name\//; + $line =~ s/^--- /--- $directory\// or + $line =~ s/^Index: /Index: $directory\// or + $line =~ s/^\+\+\+ /\+\+\+ $directory\//; } } Index: viewtopiccomments.html.tmpl =================================================================== RCS file: /cvsroot/codestriker/codestriker/template/en/default/viewtopiccomments.html.tmpl,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- viewtopiccomments.html.tmpl 21 Feb 2005 11:25:32 -0000 1.19 +++ viewtopiccomments.html.tmpl 22 May 2005 11:26:30 -0000 1.20 @@ -101,7 +101,6 @@ </TABLE> <P> - <TABLE CELLPADDING="1" CELLSPACING="3" BORDER="0" WIDTH="100%"> [% last_fileline = -999 %] @@ -124,7 +123,7 @@ [% END %] [%# Check to see if the topic is open or not #%] - [% IF topic_states.0 == topic_status %] + [% IF topic_readonly == 0 %] | <A NAME="[% comment.anchor %]" HREF="[% comment.edit_url %]">Add comment</A> [% END %] </TD> @@ -138,8 +137,8 @@ [% metric_name %]: <SELECT NAME="comment_state_metric|[% metric_name %]|[%comment.filenumber %]|[% comment.fileline %]|[% comment.filenew %]|[% comment.version %]" - [%# Check to see if the topic is open or not #%] - [% IF topic_states.0 != topic_status %] + [%# Check to see if the topic is readonly or not #%] + [% IF topic_readonly != 0 %] disabled [% END %] > @@ -188,7 +187,7 @@ </TABLE> [%# Check to see if the topic is open or not #%] -[% IF topic_states.0 == topic_status %] +[% IF topic_readonly == 0 %] <P> <INPUT TYPE="submit" NAME="button" VALUE="Update"> [% END %] Index: viewtopicproperties.html.tmpl =================================================================== RCS file: /cvsroot/codestriker/codestriker/template/en/default/viewtopicproperties.html.tmpl,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- viewtopicproperties.html.tmpl 21 Feb 2005 11:25:32 -0000 1.16 +++ viewtopicproperties.html.tmpl 22 May 2005 11:26:30 -0000 1.17 @@ -54,7 +54,7 @@ <input type="text" name="topic_title" value="[% title | html_entity %]" size="70" [%# Check to see if the topic is open or not #%] - [% IF states.0 != default_state %] + [% IF topic_readonly != 0 %] readonly [% END %] maxlength="70"> @@ -67,7 +67,7 @@ <input type="text" name="author" value="[% author | html_entity %]" size="50" maxlength="80" [%# Check to see if the topic is open or not #%] - [% IF antispam_email || states.0 != default_state %]readonly[% END %]> + [% IF antispam_email || topic_readonly != 0 %]readonly[% END %]> </td> </tr> @@ -81,7 +81,7 @@ <td>Bug IDs:</td> <td> <input type="text" name="bug_ids" value="[% bug_ids %]" - size="30" maxlength="50" [% IF states.0 != default_state %]readonly[% END %]> + size="30" maxlength="50" [% IF topic_readonly != 0 %]readonly[% END %]> Links: [% FOREACH bug = bug_id_array %] [% IF loop.count() != 1 %], [% END %] @@ -97,7 +97,7 @@ <input type="text" name="reviewers" value="[% reviewers | html_entity %]" size="50" maxlength="150" [%# Check to see if the topic is open or not #%] - [% IF antispam_email || states.0 != default_state %]readonly[% END %]> + [% IF antispam_email || topic_readonly != 0 %]readonly[% END %]> </td> </tr> @@ -107,7 +107,7 @@ <input type="text" name="cc" value="[% cc | html_entity %]" size="50" maxlength="150" [%# Check to see if the topic is open or not #%] - [% IF antispam_email || states.0 != default_state %]readonly[% END %]> + [% IF antispam_email || topic_readonly != 0 %]readonly[% END %]> </td> </tr> @@ -150,7 +150,7 @@ <td>Project:</td> <td> [%# Check to see if the project is open or not #%] - [% IF states.0 == default_state %] + [% IF topic_readonly == 0 %] <select name="projectid"> [% FOREACH project = projects %] [% IF project.id == topic_projectid %] @@ -182,7 +182,7 @@ <td> <textarea name="topic_description" rows="12" cols="70" [%# Check to see if the topic is open or not #%] - [% IF states.0 != default_state %] readonly [% END %] + [% IF topic_readonly != 0 %] readonly [% END %] wrap="hard">[% description | html_entity %]</textarea> </td> </tr> |