User: sits    
  Date: 08/08/14 23:10:42

  Modified:    lib/Codestriker/Http Dispatcher.pm UrlBuilder.pm
               lib/Codestriker/Http/Method ListTopicsMethod.pm
               lib/Codestriker/Action ViewTopicProperties.pm
                        SubmitSearch.pm ViewTopicInfo.pm
  Added:       lib/Codestriker/Http/Method SubmitSearchTopicsMethod.pm
               t/Http/Method submit-search-topics.t
  Log:
  More minor changes for the new URL dispatching code.
  
  
  
  Index: Dispatcher.pm
  ===================================================================
  RCS file: 
/cvsroot/codestriker/codestriker/lib/Codestriker/Http/Dispatcher.pm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Dispatcher.pm     13 Aug 2008 11:30:47 -0000      1.1
  +++ Dispatcher.pm     15 Aug 2008 06:10:40 -0000      1.2
  @@ -27,6 +27,7 @@
   use Codestriker::Http::Method::EditProjectMethod;
   use Codestriker::Http::Method::ListProjectsMethod;
   use Codestriker::Http::Method::SearchTopicsMethod;
  +use Codestriker::Http::Method::SubmitSearchTopicsMethod;
   use Codestriker::Http::Method::StaticResourcesMethod;
   use Codestriker::Http::Method::ViewMetricsMethod;
   
  @@ -56,6 +57,7 @@
        push @methods, 
Codestriker::Http::Method::EditProjectMethod->new($query);
        push @methods, 
Codestriker::Http::Method::ListProjectsMethod->new($query);
        push @methods, 
Codestriker::Http::Method::SearchTopicsMethod->new($query);
  +     push @methods, 
Codestriker::Http::Method::SubmitSearchTopicsMethod->new($query);
        push @methods, 
Codestriker::Http::Method::StaticResourcesMethod->new($query);
        push @methods, 
Codestriker::Http::Method::ViewMetricsMethod->new($query);
   
  
  
  
  
  
  Index: UrlBuilder.pm
  ===================================================================
  RCS file: 
/cvsroot/codestriker/codestriker/lib/Codestriker/Http/UrlBuilder.pm,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- UrlBuilder.pm     13 Aug 2008 11:31:12 -0000      1.39
  +++ UrlBuilder.pm     15 Aug 2008 06:10:41 -0000      1.40
  @@ -83,10 +83,6 @@
       }
       $self->{htmldir} = $htmlurl;
       
  -    # Initialise all of the methods.
  -    $self->{list_topics_method} =
  -        Codestriker::Http::Method::ListTopicsMethod->new($self->{query}, 
$self->{url_prefix}, $self->{cgi_style});
  -
       return bless $self, $type;
   }
   
  @@ -147,6 +143,7 @@
   sub list_topics_url {
       my ($self, %args) = @_;
   
  +    print STDERR "list sauthor is " . $args{sauthor} . "\n";
       $args{action} = "list_topics";
       return $self->_list_topics_url(%args);
   }
  @@ -163,6 +160,8 @@
   # Create the URL for listing the topics.
   sub _list_topics_url {
       my ($self, %args) = @_;
  +    print STDERR "_list sauthor is " . $args{sauthor} . "\n";
  +    
       return 
Codestriker::Http::Method::ListTopicsMethod->new($self->{query})->url(%args);
   }
   
  
  
  
  
  
  Index: ListTopicsMethod.pm
  ===================================================================
  RCS file: 
/cvsroot/codestriker/codestriker/lib/Codestriker/Http/Method/ListTopicsMethod.pm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ListTopicsMethod.pm       10 Aug 2008 12:18:42 -0000      1.1
  +++ ListTopicsMethod.pm       15 Aug 2008 06:10:41 -0000      1.2
  @@ -23,6 +23,8 @@
       my $sproject = defined $args{sproject} ? CGI::escape(join ',', 
@{$args{sproject}}) : "";
       my $action = defined $args{rss} && $args{rss} ? "list_topics_rss" : 
"list_topics";
       
  +    print STDERR "sauthor is " . $args{sauthor} . "\n";
  +    
       if ($self->{cgi_style}) {
           return $self->{url_prefix} . "?action=$action" .
                   (defined $args{sauthor} && $args{sauthor} ne "" ? 
"&sauthor=" . CGI::escape($args{sauthor}) : "") .
  
  
  
  
  
  Index: SubmitSearchTopicsMethod.pm
  ===================================================================
  RCS file: SubmitSearchTopicsMethod.pm
  diff -N SubmitSearchTopicsMethod.pm
  --- /dev/null 1 Jan 1970 00:00:00 -0000
  +++ SubmitSearchTopicsMethod.pm       15 Aug 2008 06:10:41 -0000      1.1
  @@ -0,0 +1,49 @@
  
+###############################################################################
  +# Codestriker: Copyright (c) 2001, 2002 David Sitsky.  All rights reserved.
  +# [EMAIL PROTECTED]
  +#
  +# 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.
  +
  +package Codestriker::Http::Method::SubmitSearchTopicsMethod;
  +
  +use strict;
  +use Codestriker::Http::Method;
  +
  [EMAIL PROTECTED]::Http::Method::SubmitSearchTopicsMethod::ISA = 
("Codestriker::Http::Method");
  +
  +# Generate a URL for this method.
  +sub url() {
  +    my ($self) = @_;
  +     
  +    if ($self->{cgi_style}) {
  +        return $self->{url_prefix} . "?action=submit_search";
  +    } else {
  +     return $self->{url_prefix} . "/topics/submitsearch";
  +    }
  +}
  +
  +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 "submit_search") 
{  
  +             $http_input->extract_cgi_parameters();
  +             return 1;
  +     } elsif ($path_info =~ m{^$self->{url_prefix}/topics/submitsearch/}) {
  +             return 1;
  +     } else {
  +             return 0;
  +     }
  +}
  +
  +sub execute {
  +     my ($self, $http_input, $http_output) = @_;
  +     
  +     Codestriker::Action::SubmitSearch->process($http_input, $http_output);
  +}
  +
  +1;
  
  
  
  
  
  Index: ViewTopicProperties.pm
  ===================================================================
  RCS file: 
/cvsroot/codestriker/codestriker/lib/Codestriker/Action/ViewTopicProperties.pm,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- ViewTopicProperties.pm    10 Aug 2008 12:18:43 -0000      1.18
  +++ ViewTopicProperties.pm    15 Aug 2008 06:10:41 -0000      1.19
  @@ -70,8 +70,9 @@
        $url_builder->view_url(topicid => $topicid, projectid => 
$topic->{project_id},
                               mode => $mode);
   
  -    $vars->{'view_topicinfo_url'} = 
$url_builder->view_topicinfo_url($topicid);
  -    $vars->{'view_comments_url'} = $url_builder->view_comments_url(topicid 
=> $topic->{topicid},
  +    $vars->{'view_topicinfo_url'} = $url_builder->view_topicinfo_url(topicid 
=> $topicid,
  +                                                                     
projectid => $topic->{project_id});
  +    $vars->{'view_comments_url'} = $url_builder->view_comments_url(topicid 
=> $topicid,
                                                                      projectid 
=> $topic->{project_id});
       $vars->{'list_projects_url'} = $url_builder->list_projects_url();
   
  
  
  
  
  
  Index: SubmitSearch.pm
  ===================================================================
  RCS file: 
/cvsroot/codestriker/codestriker/lib/Codestriker/Action/SubmitSearch.pm,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SubmitSearch.pm   26 Jan 2004 21:17:08 -0000      1.4
  +++ SubmitSearch.pm   15 Aug 2008 06:10:42 -0000      1.5
  @@ -80,11 +80,13 @@
       # Redirect the user to the list topics page.
       my $url_builder = Codestriker::Http::UrlBuilder->new($query);
       my $redirect_url =
  -     $url_builder->list_topics_url($sauthor, $sreviewer, $scc, $sbugid,
  -                                   $stext, $search_title,
  -                                   $search_description, $search_comments,
  -                                   $search_body, $search_filename,
  -                                   [EMAIL PROTECTED], [EMAIL PROTECTED]);
  +     $url_builder->list_topics_url(sauthor => $sauthor, sreviewer => 
$sreviewer,
  +                                   scc => $scc, sbugid => $sbugid,
  +                                               stext => $stext, stitle => 
$search_title,
  +                                               sdescription => 
$search_description,
  +                                               scomments => $search_comments,
  +                                               sbody => $search_body, 
sfilename => $search_filename,
  +                                               sstate => [EMAIL PROTECTED], 
sproject => [EMAIL PROTECTED]);
   
       print $query->redirect(-URI=>$redirect_url);
   }
  
  
  
  
  
  Index: ViewTopicInfo.pm
  ===================================================================
  RCS file: 
/cvsroot/codestriker/codestriker/lib/Codestriker/Action/ViewTopicInfo.pm,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- ViewTopicInfo.pm  10 Aug 2008 12:18:43 -0000      1.15
  +++ ViewTopicInfo.pm  15 Aug 2008 06:10:42 -0000      1.16
  @@ -125,8 +125,9 @@
        $url_builder->view_url(topicid => $topicid, projectid => 
$topic->{project_id},
                               mode => $mode);
   
  -    $vars->{'view_topicinfo_url'} = 
$url_builder->view_topicinfo_url($topicid);
  -    $vars->{'view_comments_url'} = $url_builder->view_comments_url(topicid 
=> $topic->{topicid},
  +    $vars->{'view_topicinfo_url'} = $url_builder->view_topicinfo_url(topicid 
=> $topicid,
  +                                                                     
projectid => $topic->{project_id});
  +    $vars->{'view_comments_url'} = $url_builder->view_comments_url(topicid 
=> $topicid,
                                                                      projectid 
=> $topic->{project_id});
       $vars->{'list_projects_url'} = $url_builder->list_projects_url();
   
  
  
  
  
  
  Index: submit-search-topics.t
  ===================================================================
  RCS file: submit-search-topics.t
  diff -N submit-search-topics.t
  --- /dev/null 1 Jan 1970 00:00:00 -0000
  +++ submit-search-topics.t    15 Aug 2008 06:10:42 -0000      1.1
  @@ -0,0 +1,23 @@
  +# Tests for the SubmitSearchTopics method.
  +
  +use strict;
  +use Test::More tests => 2;
  +
  +use lib '../../../lib';
  +use Test::MockObject;
  +use Codestriker;
  +use Codestriker::Http::Method::SearchTopicsMethod;
  +
  +# 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::SubmitSearchTopicsMethod->new($mock_query, 1);
  +my $url_nice = 
Codestriker::Http::Method::SubmitSearchTopicsMethod->new($mock_query, 0);
  +
  +is($url_cgi->url(), $mock_query->url() . '?action=submit_search',
  +   "Search URL CGI syntax");
  +is($url_nice->url(), $mock_query->url() . '/topics/submitsearch',
  +   "Search URL nice syntax");
  
  
  

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Codestriker-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/codestriker-commits

Reply via email to