| 1293 |
dpurdie |
1 |
###############################################################################
|
|
|
2 |
# Codestriker: Copyright (c) 2001, 2002 David Sitsky. All rights reserved.
|
|
|
3 |
# sits@users.sourceforge.net
|
|
|
4 |
#
|
|
|
5 |
# This program is free software; you can redistribute it and modify it under
|
|
|
6 |
# the terms of the GPL.
|
|
|
7 |
|
|
|
8 |
# Action object for editing a project.
|
|
|
9 |
|
|
|
10 |
package Codestriker::Action::EditProject;
|
|
|
11 |
|
|
|
12 |
use strict;
|
|
|
13 |
use Codestriker;
|
|
|
14 |
use Codestriker::Model::Project;
|
|
|
15 |
|
|
|
16 |
# Create an appropriate form for editing a project.
|
|
|
17 |
sub process($$$) {
|
|
|
18 |
my ($type, $http_input, $http_response) = @_;
|
|
|
19 |
|
|
|
20 |
# Check if this operation is allowed.
|
|
|
21 |
if (Codestriker->projects_disabled()) {
|
|
|
22 |
$http_response->error("This function has been disabled");
|
|
|
23 |
}
|
|
|
24 |
|
|
|
25 |
# Get the project id that is being edited.
|
|
|
26 |
my $query = $http_response->get_query();
|
|
|
27 |
my $projectid = $http_input->get('projectid');
|
|
|
28 |
my $feedback = $http_input->get('feedback');
|
|
|
29 |
$feedback =~ s/\n/<BR>/g;
|
|
|
30 |
|
|
|
31 |
$http_response->generate_header(topic_title=> "Edit Project",
|
|
|
32 |
reload=>0, cache=>1);
|
|
|
33 |
|
|
|
34 |
# Read the project information from the model.
|
|
|
35 |
my $project = Codestriker::Model::Project->read($projectid);
|
|
|
36 |
|
|
|
37 |
# Obtain a URL builder object.
|
|
|
38 |
my $url_builder = Codestriker::Http::UrlBuilder->new($query);
|
|
|
39 |
|
|
|
40 |
# Construct the template object.
|
|
|
41 |
my $vars = {};
|
|
|
42 |
$vars->{'feedback'} = $feedback;
|
|
|
43 |
$vars->{'project'} = $project;
|
|
|
44 |
$vars->{'list_projects_url'} = $url_builder->list_projects_url();
|
|
|
45 |
$vars->{'search_url'} = $url_builder->search_url();
|
|
|
46 |
$vars->{'doc_url'} = $url_builder->doc_url();
|
|
|
47 |
$vars->{'project_states'} = \@Codestriker::project_states;
|
|
|
48 |
$vars->{'project_state_change_enabled'} =
|
|
|
49 |
Codestriker->project_state_change_enabled() ? 1 : 0;
|
|
|
50 |
|
|
|
51 |
# Display the output via the template.
|
|
|
52 |
my $template = Codestriker::Http::Template->new("editproject");
|
|
|
53 |
$template->process($vars);
|
|
|
54 |
|
|
|
55 |
$http_response->generate_footer();
|
|
|
56 |
}
|
|
|
57 |
|
|
|
58 |
1;
|