[Codestriker-commits] CVS update: codestriker/lib Codestriker.pm
Brought to you by:
sits
|
From: <si...@us...> - 2008-08-29 10:49:07
|
User: sits
Date: 08/08/29 03:49:04
Modified: lib/Codestriker/Http/Method StaticResourcesMethod.pm
AddProjectMethod.pm UpdateTopicStateMethod.pm
CreateTopicMethod.pm ViewTopicTextMethod.pm
SearchTopicsMethod.pm SubmitSearchTopicsMethod.pm
DownloadMetricsMethod.pm AddCommentMethod.pm
ViewMetricsMethod.pm CreateProjectMethod.pm
ViewTopicPropertiesMethod.pm
ViewTopicCommentsMethod.pm
DownloadTopicTextMethod.pm AddTopicMethod.pm
ListProjectsMethod.pm EditProjectMethod.pm
ViewTopicMetricsMethod.pm CreateCommentMethod.pm
UpdateTopicPropertiesMethod.pm
UpdateProjectMethod.pm ViewTopicFileMethod.pm
ListTopicsMethod.pm
lib/Codestriker/Action SubmitEditTopicMetrics.pm
ViewTopicInfo.pm ViewTopicProperties.pm
CreateTopic.pm EditComment.pm
SubmitEditTopicProperties.pm
template/en/default editcomment.html.tmpl
createtopic.html.tmpl viewtopicinfo.html.tmpl
viewtopicproperties.html.tmpl
html codestriker.js
. codestriker.conf
lib/Codestriker/Http Dispatcher.pm UrlBuilder.pm Method.pm
Response.pm
lib Codestriker.pm
Added: lib/Codestriker/Http/Method UpdateTopicMetricsMethod.pm
t/Http/Method update-topic-metrics.t
Log:
More work on the nice URL - can now add comments.
Index: StaticResourcesMethod.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Method/StaticResourcesMethod.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- StaticResourcesMethod.pm 10 Aug 2008 12:18:42 -0000 1.1
+++ StaticResourcesMethod.pm 29 Aug 2008 10:48:57 -0000 1.2
@@ -35,7 +35,7 @@
if ($self->{cgi_style}) {
return $htmlurl;
} else {
- return $self->{url_prefix} . "/static";
+ return $self->{url_prefix} . "/html";
}
}
Index: AddProjectMethod.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Method/AddProjectMethod.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AddProjectMethod.pm 26 Aug 2008 22:18:51 -0000 1.1
+++ AddProjectMethod.pm 29 Aug 2008 10:48:57 -0000 1.2
@@ -33,7 +33,7 @@
if ($self->{cgi_style} && defined $action && $action eq "submit_project") {
$http_input->extract_cgi_parameters();
return 1;
- } elsif ($path_info =~ m{^$self->{url_prefix}/admin/projects/add}) {
+ } elsif ($path_info =~ m{^/admin/projects/add}) {
return 1;
} else {
return 0;
Index: UpdateTopicStateMethod.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Method/UpdateTopicStateMethod.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- UpdateTopicStateMethod.pm 18 Aug 2008 22:11:05 -0000 1.1
+++ UpdateTopicStateMethod.pm 29 Aug 2008 10:48:57 -0000 1.2
@@ -35,7 +35,7 @@
if ($self->{cgi_style} && defined $action && $action eq "change_topics_state") {
$http_input->extract_cgi_parameters();
return 1;
- } elsif ($path_info =~ m{^$self->{url_prefix}/project/\d+/topic/update}) {
+ } elsif ($path_info =~ m{^/project/\d+/topic/update}) {
$self->_extract_nice_parameters($http_input,
project => 'projectid');
return 1;
Index: CreateTopicMethod.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Method/CreateTopicMethod.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CreateTopicMethod.pm 10 Aug 2008 12:18:42 -0000 1.1
+++ CreateTopicMethod.pm 29 Aug 2008 10:48:57 -0000 1.2
@@ -32,10 +32,11 @@
my $action = $http_input->{query}->param('action');
my $path_info = $http_input->{query}->path_info();
+ print STDERR "Check path: $path_info\n";
if ($self->{cgi_style} && defined $action && $action eq "create") {
$http_input->extract_cgi_parameters();
return 1;
- } elsif ($path_info =~ m{^$self->{url_prefix}/topics/create/}) {
+ } elsif ($path_info =~ m{^/topics/create}) {
$self->_extract_nice_parameters($http_input,
obsoletes => 'obsoletes');
return 1;
Index: ViewTopicTextMethod.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Method/ViewTopicTextMethod.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ViewTopicTextMethod.pm 20 Aug 2008 00:43:33 -0000 1.3
+++ ViewTopicTextMethod.pm 29 Aug 2008 10:48:57 -0000 1.4
@@ -32,7 +32,7 @@
} else {
confess "Parameter projectid missing" unless defined $args{projectid};
return $self->{url_prefix} . "/project/$args{projectid}/topic/$args{topicid}/text" .
- (defined $args{fview} ? "/filenumber/$args{filenumber}" : "") .
+ (defined $args{fview} ? "/filenumber/$args{fview}" : "") .
(defined $args{mode} ? "/mode/$args{mode}" : "") .
(defined $args{filenumber} ? "#" . "$args{filenumber}|$args{line}|$args{new}" : "");
}
@@ -46,9 +46,9 @@
if ($self->{cgi_style} && defined $action && $action eq "view") {
$http_input->extract_cgi_parameters();
return 1;
- } elsif ($path_info =~ m{^$self->{url_prefix}/project/\d+/topic/\d+/text}) {
+ } elsif ($path_info =~ m{^/project/\d+/topic/\d+/text}) {
$self->_extract_nice_parameters($http_input,
- project => 'projectid', topic => 'topicid',
+ project => 'projectid', topic => 'topic',
filenumber => 'fview', mode => 'mode');
return 1;
} else {
Index: SearchTopicsMethod.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Method/SearchTopicsMethod.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SearchTopicsMethod.pm 10 Aug 2008 12:18:42 -0000 1.1
+++ SearchTopicsMethod.pm 29 Aug 2008 10:48:57 -0000 1.2
@@ -33,7 +33,7 @@
if ($self->{cgi_style} && defined $action && $action eq "search") {
$http_input->extract_cgi_parameters();
return 1;
- } elsif ($path_info =~ m{^$self->{url_prefix}/topics/search/}) {
+ } elsif ($path_info =~ m{^/topics/search/}) {
return 1;
} else {
return 0;
Index: SubmitSearchTopicsMethod.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Method/SubmitSearchTopicsMethod.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SubmitSearchTopicsMethod.pm 15 Aug 2008 06:10:41 -0000 1.1
+++ SubmitSearchTopicsMethod.pm 29 Aug 2008 10:48:57 -0000 1.2
@@ -33,7 +33,7 @@
if ($self->{cgi_style} && defined $action && $action eq "submit_search") {
$http_input->extract_cgi_parameters();
return 1;
- } elsif ($path_info =~ m{^$self->{url_prefix}/topics/submitsearch/}) {
+ } elsif ($path_info =~ m{^/topics/submitsearch/}) {
return 1;
} else {
return 0;
Index: DownloadMetricsMethod.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Method/DownloadMetricsMethod.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DownloadMetricsMethod.pm 10 Aug 2008 12:18:42 -0000 1.1
+++ DownloadMetricsMethod.pm 29 Aug 2008 10:48:57 -0000 1.2
@@ -33,7 +33,7 @@
if ($self->{cgi_style} && defined $action && $action eq "metrics_download") {
$http_input->extract_cgi_parameters();
return 1;
- } elsif ($path_info =~ m{^$self->{url_prefix}/metrics/download$}) {
+ } elsif ($path_info =~ m{^/metrics/download$}) {
return 1;
} else {
return 0;
Index: AddCommentMethod.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Method/AddCommentMethod.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AddCommentMethod.pm 18 Aug 2008 11:11:29 -0000 1.2
+++ AddCommentMethod.pm 29 Aug 2008 10:48:57 -0000 1.3
@@ -5,7 +5,7 @@
# This program is free software; you can redistribute it and modify it under
# the terms of the GPL.
-# Method for submitting a searching topic form.
+# Method for submitting a new comment.
package Codestriker::Http::Method::AddCommentMethod;
@@ -24,8 +24,8 @@
die "Parameter topicid missing" unless defined $args{topicid};
die "Parameter projectid missing" unless defined $args{projectid};
- return $self->{url_prefix} . "/project/$args{projectid}/topic/$args{topicid}/comment/" .
- "$args{filenumber}|$args{line}|$args{new}/add";
+ return $self->{url_prefix} . "/project/$args{projectid}/topic/$args{topicid}/comment" .
+ (defined $args{filenumber} && $args{filenumber} ne "" ? "/$args{filenumber}|$args{line}|$args{new}/add" : "");
}
}
@@ -37,13 +37,13 @@
if ($self->{cgi_style} && defined $action && $action eq "submit_comment") {
$http_input->extract_cgi_parameters();
return 1;
- } elsif ($path_info =~ m{^$self->{url_prefix}/project/\d+/topic/\d+/comment/(\d+)\|(\d+)\|(\d+)/add}) {
+ } elsif ($path_info =~ m{^/project/\d+/topic/\d+/comment/(\d+)\|(\d+)\|(\d+)/add}) {
+ $self->_extract_nice_parameters($http_input,
+ project => 'projectid', topic => 'topic',
+ anchor => 'anchor', context => 'context');
$http_input->{fn} = $1;
$http_input->{line} = $2;
$http_input->{new} = $3;
- $self->_extract_nice_parameters($http_input,
- project => 'projectid', topic => 'topicid',
- anchor => 'anchor', context => 'context');
return 1;
} else {
return 0;
Index: ViewMetricsMethod.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Method/ViewMetricsMethod.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ViewMetricsMethod.pm 10 Aug 2008 12:18:42 -0000 1.1
+++ ViewMetricsMethod.pm 29 Aug 2008 10:48:57 -0000 1.2
@@ -33,7 +33,7 @@
if ($self->{cgi_style} && defined $action && $action eq "metrics_report") {
$http_input->extract_cgi_parameters();
return 1;
- } elsif ($path_info =~ m{^$self->{url_prefix}/metrics/view$}) {
+ } elsif ($path_info =~ m{^/metrics/view$}) {
return 1;
} else {
return 0;
Index: CreateProjectMethod.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Method/CreateProjectMethod.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CreateProjectMethod.pm 10 Aug 2008 12:18:42 -0000 1.1
+++ CreateProjectMethod.pm 29 Aug 2008 10:48:57 -0000 1.2
@@ -33,7 +33,7 @@
if ($self->{cgi_style} && defined $action && $action eq "create_project") {
$http_input->extract_cgi_parameters();
return 1;
- } elsif ($path_info =~ m{^$self->{url_prefix}/admin/projects/create$}) {
+ } elsif ($path_info =~ m{^/admin/projects/create$}) {
return 1;
} else {
return 0;
Index: ViewTopicPropertiesMethod.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Method/ViewTopicPropertiesMethod.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ViewTopicPropertiesMethod.pm 18 Aug 2008 11:19:59 -0000 1.2
+++ ViewTopicPropertiesMethod.pm 29 Aug 2008 10:48:57 -0000 1.3
@@ -36,9 +36,9 @@
if ($self->{cgi_style} && defined $action && $action eq "view_topic_properties") {
$http_input->extract_cgi_parameters();
return 1;
- } elsif ($path_info =~ m{^$self->{url_prefix}/project/\d+/topic/\d+/properties/view}) {
+ } elsif ($path_info =~ m{^/project/\d+/topic/\d+/properties/view}) {
$self->_extract_nice_parameters($http_input,
- project => 'projectid', topic => 'topicid');
+ project => 'projectid', topic => 'topic');
return 1;
} else {
return 0;
Index: ViewTopicCommentsMethod.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Method/ViewTopicCommentsMethod.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ViewTopicCommentsMethod.pm 10 Aug 2008 12:18:42 -0000 1.1
+++ ViewTopicCommentsMethod.pm 29 Aug 2008 10:48:57 -0000 1.2
@@ -36,9 +36,9 @@
if ($self->{cgi_style} && defined $action && $action eq "list_comments") {
$http_input->extract_cgi_parameters();
return 1;
- } elsif ($path_info =~ m{^$self->{url_prefix}/project/\d+/topic/\d+/comments}) {
+ } elsif ($path_info =~ m{^/project/\d+/topic/\d+/comments}) {
$self->_extract_nice_parameters($http_input,
- project => 'projectid', topic => 'topicid');
+ project => 'projectid', topic => 'topic');
return 1;
} else {
return 0;
Index: DownloadTopicTextMethod.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Method/DownloadTopicTextMethod.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DownloadTopicTextMethod.pm 26 Aug 2008 22:18:51 -0000 1.1
+++ DownloadTopicTextMethod.pm 29 Aug 2008 10:48:57 -0000 1.2
@@ -38,7 +38,7 @@
if ($self->{cgi_style} && defined $action && $action eq "download") {
$http_input->extract_cgi_parameters();
return 1;
- } elsif ($path_info =~ m{^$self->{url_prefix}/project/\d+/topic/\d+/download}) {
+ } elsif ($path_info =~ m{^/project/\d+/topic/\d+/download}) {
$self->_extract_nice_parameters($http_input,
project => 'projectid', topic => 'topicid');
return 1;
Index: AddTopicMethod.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Method/AddTopicMethod.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AddTopicMethod.pm 17 Aug 2008 22:25:37 -0000 1.2
+++ AddTopicMethod.pm 29 Aug 2008 10:48:57 -0000 1.3
@@ -35,7 +35,7 @@
if ($self->{cgi_style} && defined $action && $action eq "submit_new_topic") {
$http_input->extract_cgi_parameters();
return 1;
- } elsif ($path_info =~ m{^$self->{url_prefix}/project/\d+/topics/add}) {
+ } elsif ($path_info =~ m{^/project/\d+/topics/add}) {
$self->_extract_nice_parameters($http_input,
project => 'projectid');
return 1;
Index: ListProjectsMethod.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Method/ListProjectsMethod.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ListProjectsMethod.pm 26 Aug 2008 22:18:51 -0000 1.2
+++ ListProjectsMethod.pm 29 Aug 2008 10:48:57 -0000 1.3
@@ -33,7 +33,7 @@
if ($self->{cgi_style} && defined $action && $action eq "list_projects") {
$http_input->extract_cgi_parameters();
return 1;
- } elsif ($path_info =~ m{^$self->{url_prefix}/admin/projects/list$}) {
+ } elsif ($path_info =~ m{^/admin/projects/list$}) {
return 1;
} else {
return 0;
Index: EditProjectMethod.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Method/EditProjectMethod.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- EditProjectMethod.pm 10 Aug 2008 12:18:42 -0000 1.1
+++ EditProjectMethod.pm 29 Aug 2008 10:48:57 -0000 1.2
@@ -33,7 +33,7 @@
if ($self->{cgi_style} && defined $action && $action eq "edit_project") {
$http_input->extract_cgi_parameters();
return 1;
- } elsif ($path_info =~ m{^$self->{url_prefix}/admin/project/\d+/edit$}) {
+ } elsif ($path_info =~ m{^/admin/project/\d+/edit$}) {
$self->_extract_nice_parameters($http_input,
project => 'projectid');
return 1;
Index: ViewTopicMetricsMethod.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Method/ViewTopicMetricsMethod.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ViewTopicMetricsMethod.pm 10 Aug 2008 12:18:42 -0000 1.1
+++ ViewTopicMetricsMethod.pm 29 Aug 2008 10:48:57 -0000 1.2
@@ -36,9 +36,9 @@
if ($self->{cgi_style} && defined $action && $action eq "viewinfo") {
$http_input->extract_cgi_parameters();
return 1;
- } elsif ($path_info =~ m{^$self->{url_prefix}/project/\d+/topic/\d+/metrics}) {
+ } elsif ($path_info =~ m{^/project/\d+/topic/\d+/metrics}) {
$self->_extract_nice_parameters($http_input,
- project => 'projectid', topic => 'topicid');
+ project => 'projectid', topic => 'topic');
return 1;
} else {
return 0;
Index: CreateCommentMethod.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Method/CreateCommentMethod.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CreateCommentMethod.pm 20 Aug 2008 00:43:33 -0000 1.2
+++ CreateCommentMethod.pm 29 Aug 2008 10:48:57 -0000 1.3
@@ -22,14 +22,15 @@
confess "Parameter topicid missing" unless defined $args{topicid};
if ($self->{cgi_style}) {
- return $self->{url_prefix} . "?action=edit&fn=$args{filenumber}&line=$args{line}&new=$args{new}&topic=$args{topicid}" .
+ return $self->{url_prefix} . "?action=edit&topic=$args{topicid}" .
+ (defined $args{filenumber} && $args{filenumber} ne "" . "&fn=$args{filenumber}&line=$args{line}&new=$args{new}") .
(defined $args{anchor} ? "&a=$args{anchor}" : "") .
(defined $args{context} ? "&context=$args{context}" : "");
} else {
confess "Parameter projectid missing" unless defined $args{projectid};
return $self->{url_prefix} . "/project/$args{projectid}/topic/$args{topicid}/comment/" .
- "$args{filenumber}|$args{line}|$args{new}/create" .
- (defined $args{anchor} ? "/anchor/$args{anchor}" : "") .
+ (defined $args{filenumber} && $args{filenumber} ne "" ? "$args{filenumber}|$args{line}|$args{new}/create" : "") .
+ (defined $args{anchor} && $args{anchor} ne '' ? "/anchor/$args{anchor}" : "") .
(defined $args{context} ? "/context/$args{context}" : "");
}
}
@@ -42,13 +43,13 @@
if ($self->{cgi_style} && defined $action && $action eq "edit") {
$http_input->extract_cgi_parameters();
return 1;
- } elsif ($path_info =~ m{^$self->{url_prefix}/project/\d+/topic/\d+/comment/(\d+)\|(\d+)\|(\d+)/create}) {
+ } elsif ($path_info =~ m{^/project/\d+/topic/\d+/comment/(\d+)\|(\d+)\|(\d+)/create}) {
+ $self->_extract_nice_parameters($http_input,
+ project => 'projectid', topic => 'topic',
+ anchor => 'anchor', context => 'context');
$http_input->{fn} = $1;
$http_input->{line} = $2;
$http_input->{new} = $3;
- $self->_extract_nice_parameters($http_input,
- project => 'projectid', topic => 'topicid',
- anchor => 'anchor', context => 'context');
return 1;
} else {
return 0;
Index: UpdateTopicPropertiesMethod.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Method/UpdateTopicPropertiesMethod.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- UpdateTopicPropertiesMethod.pm 18 Aug 2008 11:19:59 -0000 1.1
+++ UpdateTopicPropertiesMethod.pm 29 Aug 2008 10:48:57 -0000 1.2
@@ -36,7 +36,7 @@
if ($self->{cgi_style} && defined $action && $action eq "edit_topic_properties") {
$http_input->extract_cgi_parameters();
return 1;
- } elsif ($path_info =~ m{^$self->{url_prefix}/project/\d+/topic/\d+/properties}) {
+ } elsif ($path_info =~ m{^/project/\d+/topic/\d+/properties}) {
$self->_extract_nice_parameters($http_input,
project => 'projectid', topic => 'topicid');
return 1;
Index: UpdateProjectMethod.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Method/UpdateProjectMethod.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- UpdateProjectMethod.pm 27 Aug 2008 08:43:10 -0000 1.1
+++ UpdateProjectMethod.pm 29 Aug 2008 10:48:57 -0000 1.2
@@ -33,7 +33,7 @@
if ($self->{cgi_style} && defined $action && $action eq "submit_editproject") {
$http_input->extract_cgi_parameters();
return 1;
- } elsif ($path_info =~ m{^$self->{url_prefix}/admin/project/\d+/update$}) {
+ } elsif ($path_info =~ m{^/admin/project/\d+/update$}) {
$self->_extract_nice_parameters($http_input,
project => 'projectid');
return 1;
Index: ViewTopicFileMethod.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Method/ViewTopicFileMethod.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ViewTopicFileMethod.pm 10 Aug 2008 12:18:42 -0000 1.1
+++ ViewTopicFileMethod.pm 29 Aug 2008 10:48:58 -0000 1.2
@@ -41,7 +41,7 @@
if ($self->{cgi_style} && defined $action && $action eq "view_file") {
$http_input->extract_cgi_parameters();
return 1;
- } elsif ($path_info =~ m{^$self->{url_prefix}/project/\d+/topic/\d+/file/\d+}) {
+ } elsif ($path_info =~ m{^/project/\d+/topic/\d+/file/\d+}) {
$self->_extract_nice_parameters($http_input,
project => 'projectid', topic => 'topicid',
file => 'fn');
Index: ListTopicsMethod.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Method/ListTopicsMethod.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ListTopicsMethod.pm 15 Aug 2008 06:30:39 -0000 1.3
+++ ListTopicsMethod.pm 29 Aug 2008 10:48:58 -0000 1.4
@@ -66,8 +66,8 @@
($action eq "list_topics" || $action eq "list_topics_rss")) {
$http_input->extract_cgi_parameters();
return 1;
- } elsif ($path_info =~ m{^$self->{url_prefix}/feed/topics/list} ||
- $path_info =~ m{^$self->{url_prefix}/topics/list}) {
+ } elsif ($path_info =~ m{^/feed/topics/list} ||
+ $path_info =~ m{^/topics/list}) {
$self->_extract_nice_parameters($http_input,
author => 'sauthor', reviewer => 'sreviewer',
cc => 'scc', bugid => 'sbugid', text => 'stext',
Index: UpdateTopicMetricsMethod.pm
===================================================================
RCS file: UpdateTopicMetricsMethod.pm
diff -N UpdateTopicMetricsMethod.pm
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ UpdateTopicMetricsMethod.pm 29 Aug 2008 10:48:57 -0000 1.1
@@ -0,0 +1,54 @@
+###############################################################################
+# 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.
+
+# Method for updating the topic metrics.
+
+package Codestriker::Http::Method::UpdateTopicMetricsMethod;
+
+use strict;
+use Carp;
+use Codestriker::Http::Method;
+
+@Codestriker::Http::Method::UpdateTopicMetricsMethod::ISA = ("Codestriker::Http::Method");
+
+# Generate a URL for this method.
+sub url() {
+ my ($self, %args) = @_;
+
+ if ($self->{cgi_style}) {
+ return $self->{url_prefix} . "?action=edit_topic_metrics&topic=$args{topicid}";
+ } else {
+ confess "Parameter topicid missing" unless defined $args{topicid};
+ confess "Parameter projectid missing" unless defined $args{projectid};
+ return $self->{url_prefix} . "/project/$args{projectid}/topic/$args{topicid}/metrics/update";
+ }
+}
+
+sub extract_parameters {
+ my ($self, $http_input) = @_;
+
+ my $action = $http_input->{query}->param('action');
+ my $path_info = $http_input->{query}->path_info();
+ if ($self->{cgi_style} && defined $action && $action eq "edit_topic_metrics") {
+ $http_input->extract_cgi_parameters();
+ return 1;
+ } elsif ($path_info =~ m{^/project/\d+/topic/\d+/properties}) {
+ $self->_extract_nice_parameters($http_input,
+ project => 'projectid', topic => 'topicid');
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+sub execute {
+ my ($self, $http_input, $http_output) = @_;
+
+ Codestriker::Action::SubmitEditTopicMetrics->process($http_input, $http_output);
+}
+
+1;
Index: SubmitEditTopicMetrics.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Action/SubmitEditTopicMetrics.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SubmitEditTopicMetrics.pm 29 Jun 2004 02:51:41 -0000 1.3
+++ SubmitEditTopicMetrics.pm 29 Aug 2008 10:48:59 -0000 1.4
@@ -5,7 +5,7 @@
# This program is free software; you can redistribute it and modify it under
# the terms of the GPL.
-# Action object for handling the submission of changing the properties of a
+# Action object for handling the submission of changing the metrics of a
# topic.
package Codestriker::Action::SubmitEditTopicMetrics;
Index: ViewTopicInfo.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Action/ViewTopicInfo.pm,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- ViewTopicInfo.pm 15 Aug 2008 06:10:42 -0000 1.16
+++ ViewTopicInfo.pm 29 Aug 2008 10:48:59 -0000 1.17
@@ -130,6 +130,8 @@
$vars->{'view_comments_url'} = $url_builder->view_comments_url(topicid => $topicid,
projectid => $topic->{project_id});
$vars->{'list_projects_url'} = $url_builder->list_projects_url();
+ $vars->{'action_url'} = $url_builder->update_topicinfo_url(topicid => $topicid,
+ projectid => $topic->{project_id});
# Display the "update" message if the topic state has been changed.
$vars->{'updated'} = $http_input->get('updated');
Index: ViewTopicProperties.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Action/ViewTopicProperties.pm,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- ViewTopicProperties.pm 15 Aug 2008 06:10:41 -0000 1.19
+++ ViewTopicProperties.pm 29 Aug 2008 10:48:59 -0000 1.20
@@ -60,6 +60,8 @@
# Obtain a new URL builder object.
my $url_builder = Codestriker::Http::UrlBuilder->new($query);
+ $vars->{'action_url'} = $url_builder->update_topic_properties_url(topicid => $topicid,
+ projectid => $topic->{project_id});
Codestriker::Action::ViewTopic::ProcessTopicHeader($vars, $topic,
$url_builder);
Index: CreateTopic.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Action/CreateTopic.pm,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- CreateTopic.pm 19 Aug 2008 10:50:17 -0000 1.33
+++ CreateTopic.pm 29 Aug 2008 10:48:59 -0000 1.34
@@ -43,7 +43,7 @@
$vars->{'search_url'} = $url_builder->search_url();
# TODO: fix this once create topic is only done within context of a project.
- $vars->{'add_topic_url'} = $url_builder->add_topic_url(projectid => 0);
+ $vars->{'action_url'} = $url_builder->add_topic_url(projectid => 0);
# Retrieve the email, reviewers, cc, repository and projectid from
# the cookie.
Index: EditComment.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Action/EditComment.pm,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- EditComment.pm 10 Aug 2008 12:18:43 -0000 1.18
+++ EditComment.pm 29 Aug 2008 10:48:59 -0000 1.19
@@ -63,22 +63,25 @@
new => $new, line => $line);
my $view_comments_url = $url_builder->view_comments_url(topicid => $topicid,
projectid => $topic->{project_id});
+ my $add_comment_url = $url_builder->add_comment_url(topicid => $topicid, projectid => $topic->{project_id},
+ filenumber => $fn, new => $new, line => $line);
$vars->{'view_topic_url'} = $view_topic_url;
$vars->{'view_comments_url'} = $view_comments_url;
$vars->{'doc_url'} = $url_builder->doc_url();
-
+ $vars->{'action_url'} = $add_comment_url;
+
# Retrieve the context in question. Allow the user to increase it
# or decrease it appropriately.
my $inc_context = ($context <= 0) ? 1 : $context*2;
my $dec_context = ($context <= 0) ? 0 : int($context/2);
my $inc_context_url =
$url_builder->edit_url(filenumber => $fn, line => $line, new => $new,
- topicid => $topicid, projectid => $topic->{projectid},
+ topicid => $topicid, projectid => $topic->{project_id},
context => $inc_context, anchor => $anchor);
my $dec_context_url =
$url_builder->edit_url(filenumber => $fn, line => $line, new => $new,
- topicid => $topicid, projectid => $topic->{projectid},
+ topicid => $topicid, projectid => $topic->{project_id},
context => $dec_context, anchor => $anchor);
$vars->{'inc_context_url'} = $inc_context_url;
$vars->{'dec_context_url'} = $dec_context_url;
Index: SubmitEditTopicProperties.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Action/SubmitEditTopicProperties.pm,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- SubmitEditTopicProperties.pm 11 Jun 2006 07:54:01 -0000 1.13
+++ SubmitEditTopicProperties.pm 29 Aug 2008 10:48:59 -0000 1.14
@@ -43,6 +43,7 @@
# Retrieve the current state of the topic.
my $topic = Codestriker::Model::Topic->new($topicid);
+ my $url_builder = Codestriker::Http::UrlBuilder->new($query);
my $feedback = "";
my $rc = $Codestriker::OK;
@@ -103,7 +104,6 @@
elsif ($topic_state eq "Obsoleted") {
# Redirect to the create topic screen with this topic being
# the one to obsolete.
- my $url_builder = Codestriker::Http::UrlBuilder->new($query);
my $create_topic_url =
$url_builder->create_topic_url("$topicid,$version");
print $query->redirect(-URI=>$create_topic_url);
@@ -174,8 +174,8 @@
}
} else {
# Go to the view topic properties screen.
- Codestriker::Action::ViewTopicProperties->process($http_input,
- $http_response);
+ Codestriker::Action::ViewTopicProperties->process($http_input,
+ $http_response);
}
}
Index: editcomment.html.tmpl
===================================================================
RCS file: /cvsroot/codestriker/codestriker/template/en/default/editcomment.html.tmpl,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- editcomment.html.tmpl 8 Aug 2008 07:02:08 -0000 1.27
+++ editcomment.html.tmpl 29 Aug 2008 10:48:59 -0000 1.28
@@ -129,7 +129,8 @@
<P>
-<FORM NAME="add_comment" METHOD="POST" onSubmit="return verify();" ENCTYPE="application/x-www-form-urlencoded">
+<FORM NAME="add_comment" METHOD="POST" onSubmit="return verify();" ENCTYPE="application/x-www-form-urlencoded"
+ ACTION="[% action_url %]">
<INPUT TYPE="hidden" NAME="action" VALUE="submit_comment">
<INPUT TYPE="hidden" NAME="line" VALUE="[% line %]">
<INPUT TYPE="hidden" NAME="topic" VALUE="[% topic %]">
Index: createtopic.html.tmpl
===================================================================
RCS file: /cvsroot/codestriker/codestriker/template/en/default/createtopic.html.tmpl,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -r1.56 -r1.57
--- createtopic.html.tmpl 19 Aug 2008 10:50:17 -0000 1.56
+++ createtopic.html.tmpl 29 Aug 2008 10:49:00 -0000 1.57
@@ -20,7 +20,7 @@
<p>
[% END %]
-<FORM METHOD="post" ENCTYPE="multipart/form-data" ACCEPT-CHARSET="UTF-8">
+<FORM METHOD="post" ENCTYPE="multipart/form-data" ACCEPT-CHARSET="UTF-8" ACTION="[% action_url %]">
<INPUT TYPE="hidden" NAME="action" VALUE="submit_new_topic" />
<INPUT TYPE="hidden" NAME="obsoletes" VALUE="[% obsoletes %]" />
Index: viewtopicinfo.html.tmpl
===================================================================
RCS file: /cvsroot/codestriker/codestriker/template/en/default/viewtopicinfo.html.tmpl,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- viewtopicinfo.html.tmpl 8 Aug 2008 07:02:08 -0000 1.25
+++ viewtopicinfo.html.tmpl 29 Aug 2008 10:49:00 -0000 1.26
@@ -8,7 +8,7 @@
[%# Create a form to allow the topic's metrics to be changed #%]
[% SET metric_input_exists = 0 %]
-<form method="post" enctype="multipart/form-data" name="form" accept-charset="UTF-8">
+<form method="post" enctype="multipart/form-data" name="form" accept-charset="UTF-8" action="[% action_url %]">
<input type="hidden" name="action" value="edit_topic_metrics" />
<input type="hidden" name="topic" value="[% topic %]" />
Index: viewtopicproperties.html.tmpl
===================================================================
RCS file: /cvsroot/codestriker/codestriker/template/en/default/viewtopicproperties.html.tmpl,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- viewtopicproperties.html.tmpl 19 Aug 2008 10:50:17 -0000 1.29
+++ viewtopicproperties.html.tmpl 29 Aug 2008 10:49:00 -0000 1.30
@@ -33,7 +33,7 @@
</script>
[%# Create a form to allow the topic's properties to be changed #%]
-<form method="post" name="form" enctype="multipart/form-data" accept-charset="UTF-8">
+<form method="post" name="form" enctype="multipart/form-data" accept-charset="UTF-8" action="[% action_url %]">
<input type="hidden" name="action" value="edit_topic_properties" />
<input type="hidden" name="topic" value="[% topicid %]" />
Index: codestriker.js
===================================================================
RCS file: /cvsroot/codestriker/codestriker/html/codestriker.js,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- codestriker.js 15 Jun 2006 07:12:37 -0000 1.16
+++ codestriker.js 29 Aug 2008 10:49:00 -0000 1.17
@@ -94,9 +94,8 @@
function add_comment_html(file, line, new_value)
{
// Get the location of the codestriker URL.
- var l = top.location;
- var url = l.protocol + '//' + l.host + l.pathname;
-
+ var url = cs_add_comment_url + '/' + file + '|' + line + '|' + new_value + '/add';
+
// Create the hidden error span, and the initial form, with the
// appropriate hidden fields.
var html = '<html><head>' +
@@ -109,7 +108,7 @@
'<form name="add_comment" method="POST" ' +
'action="' + url + '" ' +
'onSubmit="return top.verify(document.add_comment, getElt(\'statusField\'));" ' +
- 'enctype="application/x-www-form-urlencoded">\n' +
+ 'enctype="application/x-www-form-urlencoded" action="' + url + '">\n' +
'<input type="hidden" name="action" value="submit_comment">\n' +
'<input type="hidden" name="line" value="' + line + '">\n' +
'<input type="hidden" name="topic" value="' + cs_topicid + '">\n' +
@@ -265,6 +264,9 @@
// If we reached here, then all metrics have been set. Send the
// request as an XMLHttpRequest, and return false so the browser
// does nothing else.
+ var url = cs_add_comment_url + '/' +
+ comment_form.fn.value + '|' + comment_form.line.value + '|' +
+ comment_form.newval.value + '/add';
var params = 'action=submit_comment';
params += '&line=' + encodeURIComponent(comment_form.line.value);
params += '&topic=' + encodeURIComponent(comment_form.topic.value);
@@ -284,7 +286,7 @@
setStatusText('Submitting comment...');
- postXMLDoc(params);
+ postXMLDoc(url, params);
return false;
}
@@ -348,12 +350,8 @@
}
// Function for posting to Codestriker using the XMLHttpRequest object.
-function postXMLDoc(params)
+function postXMLDoc(url, params)
{
- // Generate the basic Codestriker URL.
- var l = top.location;
- var url = l.protocol + '//' + l.host + l.pathname;
-
// Check for Mozilla/Safari.
if (window.XMLHttpRequest) {
cs_request = new XMLHttpRequest();
Index: codestriker.conf
===================================================================
RCS file: /cvsroot/codestriker/codestriker/codestriker.conf,v
retrieving revision 1.101
retrieving revision 1.102
diff -u -r1.101 -r1.102
--- codestriker.conf 18 Aug 2008 22:11:06 -0000 1.101
+++ codestriker.conf 29 Aug 2008 10:49:01 -0000 1.102
@@ -100,6 +100,10 @@
#$codestriker_css = 'codestriker.css';
#$codestriker_css = 'codestriker-alternative.css';
+# Indicate what style URLs to support. The default is CGI-style URLs. Set
+# this value to 0 for "nicer" URLs.
+$cgi_style = 0;
+
# Valid repositories which may be selected at the create topic screen.
# The order shown here is the order presented in the option list. Most
# deployments will only require a single repository to be specified.
Index: update-topic-metrics.t
===================================================================
RCS file: update-topic-metrics.t
diff -N update-topic-metrics.t
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ update-topic-metrics.t 29 Aug 2008 10:49:01 -0000 1.1
@@ -0,0 +1,40 @@
+# Tests for the UpdateTopicMetrics method.
+
+use strict;
+use Test::More tests => 4;
+
+use lib '../../../lib';
+use Test::MockObject;
+use Codestriker;
+use Codestriker::Http::Method::UpdateTopicMetricsMethod;
+
+# Create a CGI mock object for these tests.
+my $mock_query = Test::MockObject->new();
+$mock_query->mock('url',
+ sub { 'http://localhost.localdomain/codestriker/codestriker.pl' } );
+
+# Create two method objects to test each URL scheme.
+my $url_cgi = Codestriker::Http::Method::UpdateTopicMetricsMethod->new($mock_query, 1);
+my $url_nice = Codestriker::Http::Method::UpdateTopicMetricsMethod->new($mock_query, 0);
+
+is($url_cgi->url(topicid => 1234, projectid => 10),
+ $mock_query->url() . '?action=submit_edit_topic_metrics&topic=1234',
+ "Update topic metrics URL CGI syntax");
+
+is($url_nice->url(topicid => 1234, projectid => 10),
+ $mock_query->url() . '/project/10/topic/1234/metrics/update',
+ "Update topic metrics URL nice syntax");
+
+# Check that the parameters extracted correctly.
+my $mock_http_input = Test::MockObject->new();
+$mock_http_input->{query} = $mock_query;
+$mock_query->mock('path_info',
+ sub {
+ return $mock_query->url() . '/project/10/topic/1234/metrics/update';
+ });
+$mock_query->mock('param', sub { return undef; });
+$url_nice->extract_parameters($mock_http_input);
+is ($mock_http_input->{projectid}, "10", "project nice URL parameter extraction");
+is ($mock_http_input->{topicid}, "1234", "topicid nice URL parameter extraction");
+
+
\ No newline at end of file
Index: Dispatcher.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Dispatcher.pm,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Dispatcher.pm 27 Aug 2008 08:43:10 -0000 1.7
+++ Dispatcher.pm 29 Aug 2008 10:49:02 -0000 1.8
@@ -22,6 +22,7 @@
use Codestriker::Http::Method::ViewTopicPropertiesMethod;
use Codestriker::Http::Method::DownloadTopicTextMethod;
use Codestriker::Http::Method::UpdateTopicPropertiesMethod;
+use Codestriker::Http::Method::UpdateTopicMetricsMethod;
use Codestriker::Http::Method::AddCommentMethod;
use Codestriker::Http::Method::CreateCommentMethod;
use Codestriker::Http::Method::AddTopicMethod;
@@ -55,6 +56,7 @@
push @methods, Codestriker::Http::Method::ViewTopicMetricsMethod->new($query);
push @methods, Codestriker::Http::Method::ViewTopicPropertiesMethod->new($query);
push @methods, Codestriker::Http::Method::UpdateTopicPropertiesMethod->new($query);
+ push @methods, Codestriker::Http::Method::UpdateTopicMetricsMethod->new($query);
push @methods, $self->{list_topics_method};
push @methods, Codestriker::Http::Method::CreateCommentMethod->new($query);
push @methods, Codestriker::Http::Method::AddCommentMethod->new($query);
Index: UrlBuilder.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/UrlBuilder.pm,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- UrlBuilder.pm 26 Aug 2008 22:18:50 -0000 1.44
+++ UrlBuilder.pm 29 Aug 2008 10:49:02 -0000 1.45
@@ -50,15 +50,16 @@
use Codestriker::Http::Method::SubmitSearchTopicsMethod;
use Codestriker::Http::Method::StaticResourcesMethod;
use Codestriker::Http::Method::ViewMetricsMethod;
+use Codestriker::Http::Method::UpdateTopicPropertiesMethod;
+use Codestriker::Http::Method::UpdateTopicMetricsMethod;
# Constructor for this class.
sub new {
- my ($type, $query, $cgi_style) = @_;
+ my ($type, $query) = @_;
my $self = {};
$self->{query} = $query;
- $self->{cgi_style} = 1;
- $self->{cgi_style} = $cgi_style if defined $cgi_style;
+ $self->{cgi_style} = defined $Codestriker::cgi_style ? $Codestriker::cgi_style : 1;
# Determine what prefix is required when using relative URLs.
# Unfortunately, Netcsape 4.x does things differently to everyone
@@ -191,18 +192,42 @@
return Codestriker::Http::Method::ViewTopicCommentsMethod->new($self->{query})->url(%args);
}
+# Create the URL for updating comments.
+sub update_comments_url {
+ my ($self, %args) = @_;
+# return Codestriker::Http::Method::UpdateTopicCommentsMethod->new($self->{query})->url(%args);
+}
+
# Create the URL for viewing the topic properties.
sub view_topic_properties_url {
my ($self, %args) = @_;
return Codestriker::Http::Method::ViewTopicPropertiesMethod->new($self->{query})->url(%args);
}
+# Create the URL for updating the topic properties.
+sub update_topic_properties_url {
+ my ($self, %args) = @_;
+ return Codestriker::Http::Method::UpdateTopicPropertiesMethod->new($self->{query})->url(%args);
+}
+
# Create the URL for viewing the topic metrics.
sub view_topicinfo_url {
my ($self, %args) = @_;
return Codestriker::Http::Method::ViewTopicMetricsMethod->new($self->{query})->url(%args);
}
+# Create the URL for updating the topic metrics.
+sub update_topicinfo_url {
+ my ($self, %args) = @_;
+ return Codestriker::Http::Method::UpdateTopicMetricsMethod->new($self->{query})->url(%args);
+}
+
+# Create the URL for adding new comments.
+sub add_comment_url {
+ my ($self, %args) = @_;
+ return Codestriker::Http::Method::AddCommentMethod->new($self->{query})->url(%args);
+}
+
sub metric_report_url {
my ($self) = @_;
return Codestriker::Http::Method::ViewMetricsMethod->new($self->{query})->url();
Index: Method.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Method.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Method.pm 13 Aug 2008 11:30:47 -0000 1.3
+++ Method.pm 29 Aug 2008 10:49:02 -0000 1.4
@@ -19,7 +19,11 @@
my $self = {};
$self->{query} = $query;
- $self->{cgi_style} = defined $cgi_style ? $cgi_style : 1;
+ if (defined $cgi_style) {
+ $self->{cgi_style} = $cgi_style;
+ } else {
+ $self->{cgi_style} = defined $Codestriker::cgi_style ? $Codestriker::cgi_style : 1;
+ }
# Determine what prefix is required when using relative URLs.
# Unfortunately, Netcsape 4.x does things differently to everyone
@@ -58,6 +62,8 @@
# Utility method for extracting the specified parameter from a URL if it exists.
sub _extract_nice_parameters {
my ($self, $http_input, %parameters) = @_;
+
+ $http_input->extract_cgi_parameters();
my $path_info = $http_input->{query}->path_info();
foreach my $nice_parameter (keys %parameters) {
Index: Response.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Response.pm,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- Response.pm 18 Aug 2008 11:11:28 -0000 1.48
+++ Response.pm 29 Aug 2008 10:49:02 -0000 1.49
@@ -12,6 +12,7 @@
use strict;
use Codestriker::Http::Cookie;
+use Codestriker::Http::UrlBuilder;
use HTML::Entities ();
# Constructor for this class. Indicate that the response header hasn't been
@@ -230,7 +231,11 @@
} else {
# Use the default CSS file.
$codestriker_css = $query->url();
- $codestriker_css =~ s#/[^/]+?/codestriker\.pl#/codestrikerhtml/codestriker.css#;
+ if (defined $Codestriker::cgi_style && $Codestriker::cgi_style) {
+ $codestriker_css =~ s#/[^/]+?/codestriker\.pl#/codestrikerhtml/codestriker.css#;
+ } else {
+ $codestriker_css = $query->url() . "html/codestriker.css";
+ }
}
@@ -261,6 +266,7 @@
print " var cs_load_anchor = '$load_anchor';\n";
print " var cs_reload = $reload;\n";
print " var cs_topicid = $topic->{topicid};\n" if defined $topic;
+ print " var cs_projectid = $topic->{project_id};\n" if defined $topic;
print " var cs_email = '$email';\n" if defined $email;
print " var cs_css = '$codestriker_css';\n";
print " var cs_xbdhtml_js = '$xbdhtml_js';\n";
@@ -284,6 +290,13 @@
}
$i++;
}
+
+ # Output the URL to post to for adding comments.
+ if (defined $topic) {
+ my $url_builder = Codestriker::Http::UrlBuilder->new($self->{query});
+ print " var cs_add_comment_url = '" .
+ $url_builder->add_comment_url(topicid => $topic->{topicid}, projectid => $topic->{project_id}) . "';\n";
+ }
# Check that the external javascript files were loaded, and if not
# output an error message. This is usually due to a
Index: Codestriker.pm
===================================================================
RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker.pm,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -r1.110 -r1.111
--- Codestriker.pm 11 Aug 2008 03:58:11 -0000 1.110
+++ Codestriker.pm 29 Aug 2008 10:49:03 -0000 1.111
@@ -32,7 +32,7 @@
$metric_config $tmpdir @metric_schema $comment_state_metrics
$project_states $rss_enabled
$repository_name_map $repository_url_map
- @valid_repository_names $topic_text_encoding
+ @valid_repository_names $topic_text_encoding $cgi_style
);
# Version of Codestriker.
|