[Codestriker-commits] CVS update: codestriker/cgi-bin highlight.css
                
                Brought to you by:
                
                    sits
                    
                
            
            
        
        
        
    | 
      
      
      From: <si...@us...> - 2008-08-18 22:11:09
      
     | 
|   User: sits    
  Date: 08/08/18 15:11:06
  Modified:    lib/Codestriker/Http Dispatcher.pm
               .        codestriker.conf
  Added:       lib/Codestriker/Http/Method UpdateTopicStateMethod.pm
               t/Http/Method update-topic-states.t
               cgi-bin  highlight.css
  Log:
  Allow topic states to be updated via topic list screen.
  
  
  
  Index: Dispatcher.pm
  ===================================================================
  RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Dispatcher.pm,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Dispatcher.pm	18 Aug 2008 11:19:58 -0000	1.4
  +++ Dispatcher.pm	18 Aug 2008 22:11:05 -0000	1.5
  @@ -32,6 +32,7 @@
   use Codestriker::Http::Method::SubmitSearchTopicsMethod;
   use Codestriker::Http::Method::StaticResourcesMethod;
   use Codestriker::Http::Method::ViewMetricsMethod;
  +use Codestriker::Http::Method::UpdateTopicStateMethod;
   
   # Initialise all of the methods that are known to the system.
   # TODO: add configuration to the parameter.
  @@ -64,6 +65,7 @@
   	push @methods, Codestriker::Http::Method::SubmitSearchTopicsMethod->new($query);
   	push @methods, Codestriker::Http::Method::StaticResourcesMethod->new($query);
   	push @methods, Codestriker::Http::Method::ViewMetricsMethod->new($query);
  +	push @methods, Codestriker::Http::Method::UpdateTopicStateMethod->new($query);
   
   	$self->{methods} = \@methods;
       return bless $self, $type;
  
  
  
  
  
  Index: UpdateTopicStateMethod.pm
  ===================================================================
  RCS file: UpdateTopicStateMethod.pm
  diff -N UpdateTopicStateMethod.pm
  --- /dev/null	1 Jan 1970 00:00:00 -0000
  +++ UpdateTopicStateMethod.pm	18 Aug 2008 22:11:05 -0000	1.1
  @@ -0,0 +1,53 @@
  +###############################################################################
  +# 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 topic states.
  +
  +package Codestriker::Http::Method::UpdateTopicStateMethod;
  +
  +use strict;
  +use Carp;
  +use Codestriker::Http::Method;
  +
  +@Codestriker::Http::Method::UpdateTopicStateMethod::ISA = ("Codestriker::Http::Method");
  +
  +# Generate a URL for this method.
  +sub url() {
  +	my ($self, %args) = @_;
  +	
  +	if ($self->{cgi_style}) {
  +        return $self->{url_prefix} . "?action=change_topics_state";
  +	} else {
  +   	    confess "Parameter projectid missing" unless defined $args{projectid};
  +		return $self->{url_prefix} . "/project/$args{projectid}/topic/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 "change_topics_state") {  
  +		$http_input->extract_cgi_parameters();
  +		return 1;
  +	} elsif ($path_info =~ m{^$self->{url_prefix}/project/\d+/topic/update}) {
  +	    $self->_extract_nice_parameters($http_input,
  +	                                    project => 'projectid');
  +		return 1;
  +	} else {
  +		return 0;
  +	}
  +}
  +
  +sub execute {
  +	my ($self, $http_input, $http_output) = @_;
  +	
  +	Codestriker::Action::SubmitEditTopicsState->process($http_input, $http_output);
  +}
  +
  +1;
  
  
  
  
  
  Index: codestriker.conf
  ===================================================================
  RCS file: /cvsroot/codestriker/codestriker/codestriker.conf,v
  retrieving revision 1.100
  retrieving revision 1.101
  diff -u -r1.100 -r1.101
  --- codestriker.conf	1 Jul 2008 23:09:10 -0000	1.100
  +++ codestriker.conf	18 Aug 2008 22:11:06 -0000	1.101
  @@ -36,6 +36,7 @@
   # Location of the mailing host.  This is used when sending out codestriker
   # comments.
   $mailhost = 'localhost';
  +$mailhost = 'smtp.iinet.com.au';
   
   # Set the user and password parameters if $mailhost requires SMTP
   # authentication.  If commented out, it is assumed authentication is 
  @@ -60,8 +61,9 @@
   
   # Location of the svn binary.
   #$svn = 'c:/Program Files/SVN/svn.exe';
  -#$svn = 'c:/Program Files/svn-win32-1.4.4/bin/svn.exe';
  -$svn = '/usr/bin/svn';
  +$svn = 'c:/Program Files/svn-win32-1.4.4/bin/svn.exe';
  +$svn = 'c:/Program Files/CollabNet Subversion/svn.exe';
  +#$svn = '/usr/bin/svn';
   
   # Location of the ssh binary.  This is only required if a CVS :ext
   # type repository is used.
  @@ -536,6 +538,6 @@
   # documentations on how to add your own metrics into codestriker. It
   # is easy to do, and does not require any coding.
   
  -$metric_config = "none";
  +$metric_config = "all";
   
   
  
  
  
  
  
  Index: update-topic-states.t
  ===================================================================
  RCS file: update-topic-states.t
  diff -N update-topic-states.t
  --- /dev/null	1 Jan 1970 00:00:00 -0000
  +++ update-topic-states.t	18 Aug 2008 22:11:06 -0000	1.1
  @@ -0,0 +1,39 @@
  +# Tests for the UpdateTopicStates method.
  +
  +use strict;
  +use Test::More tests => 3;
  +
  +use lib '../../../lib';
  +use Test::MockObject;
  +use Codestriker;
  +use Codestriker::Http::Method::UpdateTopicStateMethod;
  +
  +# 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::UpdateTopicStateMethod->new($mock_query, 1);
  +my $url_nice = Codestriker::Http::Method::UpdateTopicStateMethod->new($mock_query, 0);
  +
  +is($url_cgi->url(projectid => 10),
  +   $mock_query->url() . '?action=change_topics_state',
  +   "Update topic state URL CGI syntax");
  +   
  +is($url_nice->url(projectid => 10),
  +   $mock_query->url() . '/project/10/topic/update',
  +   "Update topic state 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/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");
  +
  +                              
  \ No newline at end of file
  
  
  
  
  
  Index: highlight.css
  ===================================================================
  RCS file: highlight.css
  diff -N highlight.css
  --- /dev/null	1 Jan 1970 00:00:00 -0000
  +++ highlight.css	18 Aug 2008 22:11:06 -0000	1.1
  @@ -0,0 +1,21 @@
  +/* Style definition file generated by highlight 2.6.10, http://www.andre-simon.de/ */
  +
  +/* Highlighting theme definition: */
  +
  +body.hl	{ background-color:#ffffff; }
  +pre.hl	{ color:#000000; background-color:#ffffff; font-size:10pt; font-family:'Courier New';}
  +.hl.num { color:#2928ff; }
  +.hl.esc { color:#ff00ff; }
  +.hl.str { color:#ff0000; }
  +.hl.dstr { color:#818100; }
  +.hl.slc { color:#838183; font-style:italic; }
  +.hl.com { color:#838183; font-style:italic; }
  +.hl.dir { color:#008200; }
  +.hl.sym { color:#000000; }
  +.hl.line { color:#555555; }
  +.hl.mark	{ background-color:#ffffbb;}
  +.hl.kwa { color:#000000; font-weight:bold; }
  +.hl.kwb { color:#830000; }
  +.hl.kwc { color:#000000; font-weight:bold; }
  +.hl.kwd { color:#010181; }
  +
  
  
  
 |