[Codestriker-commits] CVS update: codestriker/lib/Codestriker/Action CreateTopic.pm
Brought to you by:
sits
From: <si...@us...> - 2008-09-06 06:03:58
|
User: sits Date: 08/09/05 23:03:57 Modified: template/en/default createtopic.html.tmpl t/Http/Method update-topic-states.t lib/Codestriker/Http UrlBuilder.pm Response.pm Method.pm lib/Codestriker/Action CreateTopic.pm Log: Changes so that create topic now works under the nice URL structure. Index: createtopic.html.tmpl =================================================================== RCS file: /cvsroot/codestriker/codestriker/template/en/default/createtopic.html.tmpl,v retrieving revision 1.58 retrieving revision 1.59 diff -u -r1.58 -r1.59 --- createtopic.html.tmpl 31 Aug 2008 12:02:12 -0000 1.58 +++ createtopic.html.tmpl 6 Sep 2008 06:03:56 -0000 1.59 @@ -20,7 +20,8 @@ <p> [% END %] -<FORM METHOD="post" ENCTYPE="multipart/form-data" ACCEPT-CHARSET="UTF-8" ACTION="[% action_url %]"> +<FORM NAME="createtopicform" METHOD="post" ENCTYPE="multipart/form-data" ACCEPT-CHARSET="UTF-8" action="[% action_url %]" + ONSUBMIT="document.createtopicform.action = '[% action_url %]/project/' + document.createtopicform.elements['projectid'].options[document.createtopicform.elements['projectid'].selectedIndex].value + '/topics/add';"> <INPUT TYPE="hidden" NAME="action" VALUE="submit_new_topic" /> <INPUT TYPE="hidden" NAME="obsoletes" VALUE="[% obsoletes %]" /> Index: update-topic-states.t =================================================================== RCS file: /cvsroot/codestriker/codestriker/t/Http/Method/update-topic-states.t,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- update-topic-states.t 6 Sep 2008 03:31:07 -0000 1.3 +++ update-topic-states.t 6 Sep 2008 06:03:56 -0000 1.4 @@ -1,7 +1,7 @@ # Tests for the UpdateTopicStates method. use strict; -use Test::More tests => 3; +use Test::More tests => 2; use lib '../../../lib'; use Test::MockObject; @@ -35,5 +35,3 @@ }); $mock_query->mock('param', sub { return undef; }); $url_nice->extract_parameters($mock_http_input); - - Index: UrlBuilder.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/UrlBuilder.pm,v retrieving revision 1.48 retrieving revision 1.49 diff -u -r1.48 -r1.49 --- UrlBuilder.pm 6 Sep 2008 03:31:07 -0000 1.48 +++ UrlBuilder.pm 6 Sep 2008 06:03:56 -0000 1.49 @@ -42,7 +42,6 @@ my $self = {}; $self->{query} = $query; - $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 Index: Response.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Response.pm,v retrieving revision 1.52 retrieving revision 1.53 diff -u -r1.52 -r1.53 --- Response.pm 6 Sep 2008 00:31:47 -0000 1.52 +++ Response.pm 6 Sep 2008 06:03:56 -0000 1.53 @@ -223,10 +223,10 @@ } else { # Use the default CSS file. $codestriker_css = $query->url(); - if (! defined $Codestriker::cgi_style || $Codestriker::cgi_style) { + if ($query->url() =~ /codestriker.pl$/) { $codestriker_css =~ s#/[^/]+?/codestriker\.pl#/codestrikerhtml/codestriker.css#; } else { - $codestriker_css = $query->url() . "/html/codestriker.css"; + $codestriker_css = $query->url() . "html/codestriker.css"; } } Index: Method.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Method.pm,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- Method.pm 6 Sep 2008 00:31:47 -0000 1.5 +++ Method.pm 6 Sep 2008 06:03:56 -0000 1.6 @@ -22,9 +22,9 @@ # Determine what style URLs are being used. if (defined $cgi_style) { - $self->{cgoi_style} = $cgi_style; + $self->{cgi_style} = $cgi_style; } else { - $self->{cgi_style} = $query =~ /codestriker.pl$/ ? 1 : 0; + $self->{cgi_style} = $query->url() =~ /codestriker.pl$/ ? 1 : 0; } # Determine what prefix is required when using relative URLs. Index: CreateTopic.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Action/CreateTopic.pm,v retrieving revision 1.35 retrieving revision 1.36 diff -u -r1.35 -r1.36 --- CreateTopic.pm 6 Sep 2008 00:31:45 -0000 1.35 +++ CreateTopic.pm 6 Sep 2008 06:03:56 -0000 1.36 @@ -42,8 +42,8 @@ $vars->{'doc_url'} = $url_builder->doc_url(); $vars->{'search_url'} = $url_builder->search_url(); - # TODO: fix this once create topic is only done within context of a project. - $vars->{'action_url'} = $url_builder->add_topic_url(projectid => 0); + # Set this as the base URL for the form to use. + $vars->{'action_url'} = $query->url(); # Retrieve the email, reviewers, cc, repository and projectid from # the cookie. |