1 |
snetram |
1.1 |
--- smeserver-trac-0.4/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/trac.pm.add2general 2007-04-27 08:54:46.000000000 +0200 |
2 |
|
|
+++ smeserver-trac-0.4/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/trac.pm 2008-04-26 16:38:42.000000000 +0200 |
3 |
|
|
@@ -1,954 +1,954 @@ |
4 |
|
|
-#!/usr/bin/perl -w |
5 |
|
|
-#---------------------------------------------------------------------- |
6 |
|
|
-# $Id: trac.pm 69 2007-03-25 13:20:24Z marco $ |
7 |
|
|
-# vim: ft=perl ts=4 sw=4 et: |
8 |
|
|
-#---------------------------------------------------------------------- |
9 |
|
|
-# Copyright (C) 2007 Marco Hess |
10 |
|
|
-# |
11 |
|
|
-# This program is free software; you can redistribute it and/or modify |
12 |
|
|
-# it under the terms of the GNU General Public License as published by |
13 |
|
|
-# the Free Software Foundation; either version 2 of the License, or |
14 |
|
|
-# (at your option) any later version. |
15 |
|
|
-# |
16 |
|
|
-# This program is distributed in the hope that it will be useful, |
17 |
|
|
-# but WITHOUT ANY WARRANTY; without even the implied warranty of |
18 |
|
|
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
19 |
|
|
-# GNU General Public License for more details. |
20 |
|
|
-# |
21 |
|
|
-# You should have received a copy of the GNU General Public License |
22 |
|
|
-# along with this program; if not, write to the Free Software |
23 |
|
|
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
24 |
|
|
-#---------------------------------------------------------------------- |
25 |
|
|
- |
26 |
|
|
-package esmith::FormMagick::Panel::trac; |
27 |
|
|
- |
28 |
|
|
-use strict; |
29 |
|
|
-use warnings; |
30 |
|
|
- |
31 |
|
|
-use esmith::FormMagick; |
32 |
|
|
-use esmith::AccountsDB; |
33 |
|
|
-use esmith::ConfigDB; |
34 |
|
|
-use esmith::DomainsDB; |
35 |
|
|
-use esmith::cgi; |
36 |
|
|
-use esmith::util; |
37 |
|
|
-use File::Basename; |
38 |
|
|
-use Exporter; |
39 |
|
|
-use Carp; |
40 |
|
|
-use Sys::Syslog; |
41 |
|
|
- |
42 |
|
|
-use constant TRUE => 1; |
43 |
|
|
-use constant FALSE => 0; |
44 |
|
|
- |
45 |
|
|
-our @ISA = qw(esmith::FormMagick Exporter); |
46 |
|
|
- |
47 |
|
|
-our @EXPORT = qw( |
48 |
|
|
- show_trac_projects |
49 |
|
|
- print_trac_field_name |
50 |
|
|
- repositories_list |
51 |
|
|
- group_list |
52 |
|
|
- user_list |
53 |
|
|
- max_trac_project_name_length |
54 |
|
|
- handle_trac_projects |
55 |
|
|
- create_trac_project |
56 |
|
|
- remove_trac_project |
57 |
|
|
- getExtraParams |
58 |
|
|
- print_save_or_add_button |
59 |
|
|
- validate_name |
60 |
|
|
- validate_radio |
61 |
|
|
- wherenext |
62 |
|
|
- maxLength |
63 |
|
|
-); |
64 |
|
|
- |
65 |
|
|
-our $ConfigDB = esmith::ConfigDB->open |
66 |
|
|
- or die "Can't open the Config database : $!\n" ; |
67 |
|
|
- |
68 |
|
|
-our $AccountsDB = esmith::AccountsDB->open |
69 |
|
|
- or die "Can't open the Account database : $!\n" ; |
70 |
|
|
- |
71 |
|
|
-our $DomainsDB = esmith::DomainsDB->open |
72 |
|
|
- or die "Can't open the Domains database : $!\n" ; |
73 |
|
|
- |
74 |
|
|
- |
75 |
|
|
-# fields and records separator for sub records |
76 |
|
|
-use constant FS => "," ; |
77 |
|
|
-use constant RS => ";" ; |
78 |
|
|
- |
79 |
|
|
-=pod |
80 |
|
|
- |
81 |
|
|
-=head1 NAME |
82 |
|
|
- |
83 |
|
|
-esmith::FormMagick::Panels::trac - Trac |
84 |
|
|
- |
85 |
|
|
-=head1 SYNOPSIS |
86 |
|
|
- |
87 |
|
|
-use esmith::FormMagick::Panels::trac |
88 |
|
|
- |
89 |
|
|
-my $panel = esmith::FormMagick::Panel::trac->new(); |
90 |
|
|
-$panel->display(); |
91 |
|
|
- |
92 |
|
|
-=head1 DESCRIPTION |
93 |
|
|
- |
94 |
|
|
-This module is the backend to the Trac panel, responsible |
95 |
|
|
-for supplying all functions used by that panel. It is a subclass |
96 |
|
|
-of esmith::FormMagick itself, so it inherits the functionality |
97 |
|
|
-of a FormMagick object. |
98 |
|
|
- |
99 |
|
|
-=cut |
100 |
|
|
- |
101 |
|
|
-=head2 new() |
102 |
|
|
- |
103 |
|
|
-Exactly as for esmith::FormMagick |
104 |
|
|
- |
105 |
|
|
-=cut |
106 |
|
|
- |
107 |
|
|
-sub new |
108 |
|
|
-{ |
109 |
|
|
- my $proto = shift; |
110 |
|
|
- my $class = ref($proto) || $proto; |
111 |
|
|
- my $self = esmith::FormMagick::new($class); |
112 |
|
|
- $self->{calling_package} = (caller)[0]; |
113 |
|
|
- |
114 |
|
|
- return $self; |
115 |
|
|
-} |
116 |
|
|
- |
117 |
|
|
-=head1 HTML GENERATION ROUTINES |
118 |
|
|
- |
119 |
|
|
-Routines for generating chunks of HTML needed by the panel. |
120 |
|
|
- |
121 |
|
|
-=cut |
122 |
|
|
- |
123 |
|
|
-=head2 show_trac_projects() |
124 |
|
|
- |
125 |
|
|
-This function displays a table of trac project environments on the system |
126 |
|
|
-including the links to modify and remove the trac project environment. |
127 |
|
|
- |
128 |
|
|
-=cut |
129 |
|
|
- |
130 |
|
|
-sub show_trac_projects { |
131 |
|
|
- my $fm = shift; |
132 |
|
|
- my $q = $fm->{cgi}; |
133 |
|
|
- |
134 |
|
|
- # Setup the various localised text field for the trac project table |
135 |
|
|
- my $name = $fm->localise('TRAC_TABLE_HEADER_NAME'); |
136 |
|
|
- my $description = $fm->localise('TRAC_TABLE_HEADER_DESCRIPTION'); |
137 |
|
|
- my $domains = $fm->localise('TRAC_TABLE_HEADER_DOMAINS'); |
138 |
|
|
- my $repository = $fm->localise('TRAC_TABLE_HEADER_REPOSITORY'); |
139 |
|
|
- my $path = $fm->localise('TRAC_TABLE_HEADER_PATH'); |
140 |
|
|
- my $access = $fm->localise('TRAC_TABLE_HEADER_ACCESS'); |
141 |
|
|
- my $action_h = $fm->localise('TRAC_TABLE_HEADER_ACTION'); |
142 |
|
|
- my $view = $fm->localise('TRAC_ACTION_VIEW'); |
143 |
|
|
- my $modify = $fm->localise('TRAC_ACTION_MODIFY'); |
144 |
|
|
- my $remove = $fm->localise('TRAC_ACTION_REMOVE'); |
145 |
|
|
- my $backup = $fm->localise('TRAC_ACTION_BACKUP'); |
146 |
|
|
- my $restore = $fm->localise('TRAC_ACTION_RESTORE'); |
147 |
|
|
- |
148 |
|
|
- print $q->start_table({-class => 'sme-noborder'}), "\n"; |
149 |
|
|
- |
150 |
|
|
- # Check if any repositories exist |
151 |
|
|
- my @repositories = $AccountsDB->get_all_by_prop('type' => 'repository'); |
152 |
|
|
- unless ( scalar @repositories ) |
153 |
|
|
- { |
154 |
|
|
- print $q->Tr($q->td($q->h2($fm->localise('NO_REPOSITORIES')))); |
155 |
|
|
- return ""; |
156 |
|
|
- } |
157 |
|
|
- |
158 |
|
|
- # TODO what about the case that all repositories have been deleted |
159 |
|
|
- # but the Trac project environments are still there? Can we remove the |
160 |
|
|
- # trac projects or do we need to reassign the projects to |
161 |
|
|
- # another repository? The code above prevents us from accessing the |
162 |
|
|
- # trac projects when there are no more repositories. |
163 |
|
|
- |
164 |
|
|
- print $q->Tr($q->td($q->a({-class => "button-like", |
165 |
|
|
- href => "trac?page=0&page_stack=&Next=Next&wherenext=Create"}, |
166 |
|
|
- $fm->localise('TRAC_ADD_BUTTON')))); |
167 |
|
|
- |
168 |
|
|
- # Check if any trac projects exist |
169 |
|
|
- my @TracProjects = $AccountsDB->get_all_by_prop('type' => 'trac'); |
170 |
|
|
- unless ( scalar @TracProjects ) |
171 |
|
|
- { |
172 |
|
|
- print $q->Tr($q->td($q->h2($fm->localise('NO_TRAC_PROJECTS')))); |
173 |
|
|
- return ""; |
174 |
|
|
- } |
175 |
|
|
- |
176 |
|
|
- # Show the list of configures trac projects |
177 |
|
|
- print $q->Tr($q->td($q->h2($fm->localise('CURRENT_TRAC_PROJECTS')))); |
178 |
|
|
- |
179 |
|
|
- print $q->Tr($q->td($fm->localise('TRAC_MODIFY_REMOVE_BUTTON_DESCRIPTION'))); |
180 |
|
|
- |
181 |
|
|
- print $q->start_table({-CLASS => "sme-border"}),"\n"; |
182 |
|
|
- print $q->Tr ( |
183 |
|
|
- esmith::cgi::genSmallCell($q, $name, "header"), |
184 |
|
|
- esmith::cgi::genSmallCell($q, $description,"header"), |
185 |
|
|
- esmith::cgi::genSmallCell($q, $domains, "header"), |
186 |
|
|
- esmith::cgi::genSmallCell($q, $repository, "header"), |
187 |
|
|
- esmith::cgi::genSmallCell($q, $path, "header"), |
188 |
|
|
- esmith::cgi::genSmallCell($q, $access, "header"), |
189 |
|
|
- esmith::cgi::genSmallCell($q, $action_h, "header", 3)),"\n"; |
190 |
|
|
- |
191 |
|
|
- my $scriptname = basename($0); |
192 |
|
|
- |
193 |
|
|
- foreach my $TracProject (@TracProjects) |
194 |
|
|
- { |
195 |
|
|
- my $trac_name = $TracProject->key(); |
196 |
|
|
- my $trac_desc = $TracProject->prop('Description'); |
197 |
|
|
- my $trac_domains = join("<br>", split(FS, $TracProject->prop('Domains'))); |
198 |
|
|
- my $trac_repo = $TracProject->prop('Repository'); |
199 |
|
|
- my $trac_path = $TracProject->prop('RepositoryPath'); |
200 |
|
|
- my $trac_access = $TracProject->prop('Access') || 'local'; |
201 |
|
|
- my $modifiable = $TracProject->prop('Modifiable') || 'yes'; |
202 |
|
|
- my $removable = $TracProject->prop('Removable') || 'yes'; |
203 |
|
|
- |
204 |
|
|
- my $params = $fm->build_trac_project_cgi_params($trac_name, $TracProject->props()); |
205 |
|
|
- |
206 |
|
|
- my $href = "$scriptname?$params&action=modify&wherenext="; |
207 |
|
|
- |
208 |
|
|
- my $actionView = ' '; |
209 |
|
|
- $actionView .= $q->a({href => '/' . $TracProject->key(), |
210 |
|
|
- target => '_blank'}, $view ) . ' '; |
211 |
|
|
- |
212 |
|
|
- my $actionModify = ' '; |
213 |
|
|
- if ($modifiable eq 'yes') |
214 |
|
|
- { |
215 |
|
|
- $actionModify .= $q->a({href => "${href}Modify"}, $modify) . ' '; |
216 |
|
|
- } |
217 |
|
|
- |
218 |
|
|
- my $actionRemove = ' '; |
219 |
|
|
- if ($removable eq 'yes') |
220 |
|
|
- { |
221 |
|
|
- $actionRemove .= $q->a({href => "${href}Remove"}, $remove) . ' '; |
222 |
|
|
- } |
223 |
|
|
- |
224 |
|
|
- my $actionBackup = ' '; |
225 |
|
|
- $actionBackup .= $q->a({href => "${href}Backup"}, $backup) . ' '; |
226 |
|
|
- |
227 |
|
|
- my $actionRestore = ' '; |
228 |
|
|
- $actionRestore .= $q->a({href => "${href}Restore"}, $restore) . ' '; |
229 |
|
|
- |
230 |
|
|
- print $q->Tr( |
231 |
|
|
- esmith::cgi::genSmallCell($q, $trac_name, "normal"), |
232 |
|
|
- esmith::cgi::genSmallCell($q, $trac_desc, "normal"), |
233 |
|
|
- esmith::cgi::genSmallCell($q, $trac_domains, "normal"), |
234 |
|
|
- esmith::cgi::genSmallCell($q, $trac_repo, "normal"), |
235 |
|
|
- esmith::cgi::genSmallCell($q, $trac_path, "normal"), |
236 |
|
|
- esmith::cgi::genSmallCell($q, $trac_access, "normal"), |
237 |
|
|
- esmith::cgi::genSmallCell($q, $actionView, "normal"), |
238 |
|
|
- esmith::cgi::genSmallCell($q, $actionModify, "normal"), |
239 |
|
|
- esmith::cgi::genSmallCell($q, $actionRemove, "normal") |
240 |
|
|
- ); |
241 |
|
|
- } |
242 |
|
|
- |
243 |
|
|
- print $q->end_table,"\n"; |
244 |
|
|
- |
245 |
|
|
- print $q->end_table,"\n"; |
246 |
|
|
- |
247 |
|
|
- return ""; |
248 |
|
|
-} |
249 |
|
|
- |
250 |
|
|
-=cut |
251 |
|
|
- |
252 |
|
|
-=head2 print_save_or_add_button() |
253 |
|
|
- |
254 |
|
|
-Prints the ADD button when a new trac project environment is addded and the SAVE buttom |
255 |
|
|
-whem modifications are made. |
256 |
|
|
- |
257 |
|
|
-=cut |
258 |
|
|
- |
259 |
|
|
-sub print_save_or_add_button { |
260 |
|
|
- |
261 |
|
|
- my ($fm) = @_; |
262 |
|
|
- |
263 |
|
|
- my $cgi = $fm->{cgi}; |
264 |
|
|
- |
265 |
|
|
- if (($cgi->param("action") || '') eq "modify") { |
266 |
|
|
- $fm->print_button("SAVE"); |
267 |
|
|
- } else { |
268 |
|
|
- $fm->print_button("ADD"); |
269 |
|
|
- } |
270 |
|
|
-} |
271 |
|
|
- |
272 |
|
|
-=head1 HELPER FUNCTIONS FOR THE PANEL |
273 |
|
|
- |
274 |
|
|
-Routines for modifying the database and signaling events |
275 |
|
|
-from the server-manager panel |
276 |
|
|
- |
277 |
|
|
-=cut |
278 |
|
|
- |
279 |
|
|
-=head2 build_trac_project_cgi_params($fm, $tracprojectname, %oldprops) |
280 |
|
|
- |
281 |
|
|
-Constructs the parameters for the links in the trac project environments table |
282 |
|
|
- |
283 |
|
|
-=cut |
284 |
|
|
- |
285 |
|
|
-sub build_trac_project_cgi_params { |
286 |
|
|
- my ($self, $tracprojectname, %oldprops) = @_; |
287 |
|
|
- |
288 |
|
|
- my %props = ( |
289 |
|
|
- page => 0, |
290 |
|
|
- page_stack => "", |
291 |
|
|
- tracName => $tracprojectname, |
292 |
|
|
- ); |
293 |
|
|
- |
294 |
|
|
- return $self->props_to_query_string(\%props); |
295 |
|
|
-} |
296 |
|
|
- |
297 |
|
|
-*wherenext = \&CGI::FormMagick::wherenext; |
298 |
|
|
- |
299 |
|
|
-=head2 print_trac_field_name() |
300 |
|
|
- |
301 |
|
|
-Helper function to print the field NAME so that it becomes |
302 |
|
|
-an edit field upon ADD and a fixed field upon MODIFY. |
303 |
|
|
- |
304 |
|
|
-Also read all the account db values so the other fields |
305 |
|
|
-can show the existing values. |
306 |
|
|
- |
307 |
|
|
-=cut |
308 |
|
|
- |
309 |
|
|
-sub print_trac_field_name { |
310 |
|
|
- my $fm = shift; |
311 |
|
|
- my $in = $fm->{cgi}->param('tracName') || ''; |
312 |
|
|
- my $action = $fm->{cgi}->param('action') || ''; |
313 |
|
|
- |
314 |
|
|
- print qq(<tr><td class="sme-noborders-label">) . |
315 |
|
|
- $fm->localise('TRAC_FIELD_PROJECT_NAME') . qq(</td>\n); |
316 |
|
|
- |
317 |
|
|
- if ($action eq 'modify' and $in) { |
318 |
|
|
- #------------------------------------------------------- |
319 |
|
|
- # Updating an existing record. |
320 |
|
|
- #-------------------------------------------------------- |
321 |
|
|
- |
322 |
|
|
- my $rec = $AccountsDB->get($in); |
323 |
|
|
- my $modifiable = $rec->prop('Modifiable') || 'yes'; |
324 |
|
|
- my $removable = $rec->prop('Removable') || 'yes'; |
325 |
|
|
- |
326 |
|
|
- print qq( |
327 |
|
|
- <td class="sme-noborders-content">$in |
328 |
|
|
- <input type="hidden" name="tracName" value="$in"> |
329 |
|
|
- <input type="hidden" name="action" value="modify"> |
330 |
|
|
- </td> |
331 |
|
|
- ); |
332 |
|
|
- |
333 |
|
|
- # Read the values for each field from the accounts db and store |
334 |
|
|
- # them in the cgi object so our form will have the correct |
335 |
|
|
- # info displayed. |
336 |
|
|
- my $q = $fm->{cgi}; |
337 |
|
|
- if ($rec) |
338 |
|
|
- { |
339 |
|
|
- $q->param(-name=>'tracDescription',-value=> |
340 |
|
|
- $rec->prop('Description')); |
341 |
|
|
- |
342 |
|
|
- $q->param(-name=>'tracRepository',-value=> |
343 |
|
|
- $rec->prop('Repository')); |
344 |
|
|
- |
345 |
|
|
- $q->param(-name=>'tracRepositoryPath',-value=> |
346 |
|
|
- $rec->prop('RepositoryPath')); |
347 |
|
|
- |
348 |
|
|
- # domain list is handled separately |
349 |
|
|
- |
350 |
|
|
- $q->param(-name=>'tracGroups',-value=> |
351 |
|
|
- join(FS, split(FS, $rec->prop('Groups')))); |
352 |
|
|
- |
353 |
|
|
- $q->param(-name=>'tracUsers',-value=> |
354 |
|
|
- join(FS, split(FS, $rec->prop('Users')))); |
355 |
|
|
- |
356 |
|
|
- $q->param(-name=>'tracAccess',-value=> |
357 |
|
|
- $rec->prop('Access')), |
358 |
|
|
- } |
359 |
|
|
- } else { |
360 |
|
|
- #------------------------------------------------------- |
361 |
|
|
- # Adding a new record so allow an entry field for the |
362 |
|
|
- # name. |
363 |
|
|
- #-------------------------------------------------------- |
364 |
|
|
- print qq( |
365 |
|
|
- <td><input type="text" name="tracName" value="$in"> |
366 |
|
|
- <input type="hidden" name="action" value="create"> |
367 |
|
|
- </td> |
368 |
|
|
- ); |
369 |
|
|
- } |
370 |
|
|
- |
371 |
|
|
- print qq(</tr>\n); |
372 |
|
|
- return undef; |
373 |
|
|
-} |
374 |
|
|
- |
375 |
|
|
- |
376 |
|
|
-=head2 print_trac_domains() |
377 |
|
|
- |
378 |
|
|
-When this server has more than one domain this function takes |
379 |
|
|
-the list of domains and returns a string of html checkboxes |
380 |
|
|
-for all these domains. |
381 |
|
|
- |
382 |
|
|
-Those domains that are listed with this Trac environment |
383 |
|
|
-will have their checkbox checked. |
384 |
|
|
- |
385 |
|
|
-=cut |
386 |
|
|
- |
387 |
|
|
-sub print_trac_domains() { |
388 |
|
|
- |
389 |
|
|
- # Retrieve the Trac account name from the CGI parameters |
390 |
|
|
- my $fm = shift; |
391 |
|
|
- my $name = $fm->{'cgi'}->param('tracName'); |
392 |
|
|
- my $action = $fm->{'cgi'}->param("action") || ''; |
393 |
|
|
- my $out = ""; |
394 |
|
|
- |
395 |
|
|
- # Get a full list of all the domains on this server. |
396 |
|
|
- my @domains = $DomainsDB->get_all_by_prop( type => 'domain' ); |
397 |
|
|
- my $numdomains = @domains; |
398 |
|
|
- |
399 |
|
|
- # If there is more than one domain, we generate a list |
400 |
|
|
- # of checkboxes. Otherwise we just show the primary domain. |
401 |
|
|
- if ($numdomains > 1) { |
402 |
|
|
- |
403 |
|
|
- # With the Trac account name, get the list of the Domains for which |
404 |
|
|
- # this Trac account is active. |
405 |
|
|
- my $trac_domains_list = ""; |
406 |
|
|
- if ($AccountsDB->get($name)) { |
407 |
|
|
- $trac_domains_list = $AccountsDB->get($name)->prop('Domains'); |
408 |
|
|
- } |
409 |
|
|
- |
410 |
|
|
- # Split the comma separated list into the individual bits. |
411 |
|
|
- my %trac_domains; |
412 |
|
|
- foreach my $trac_domain ( split ( /,/, $trac_domains_list ) ) { |
413 |
|
|
- $trac_domains{$trac_domain} = 1; |
414 |
|
|
- } |
415 |
|
|
- |
416 |
|
|
- # Now generate the table of domains with a checkbox in front of it. |
417 |
|
|
- # If the domain is in our listed domains for the Trac environment, the |
418 |
|
|
- # checkbox will show checked. |
419 |
|
|
- $out = " <tr>\n"; |
420 |
|
|
- $out .= " <td colspan=2>" . $fm->localise('TRAC_FIELD_DOMAINS_DESCRIPTION') . "</td>"; |
421 |
|
|
- $out .= " </tr>\n"; |
422 |
|
|
- $out .= " <tr>\n"; |
423 |
|
|
- $out .= " <td class=\"sme-noborders-label\">" . $fm->localise('TRAC_FIELD_DOMAINS') . "</td>\n"; |
424 |
|
|
- $out .= " <td>\n"; |
425 |
|
|
- $out .= " <table border='0' cellspacing='0' cellpadding='0'>\n"; |
426 |
|
|
- $out .= " <tr>\n"; |
427 |
|
|
- |
428 |
|
|
- foreach my $domain (sort @domains) { |
429 |
|
|
- |
430 |
|
|
- # If this is a ADD form, we default check all domains, otherwise only |
431 |
|
|
- # those that are in our Trac project list. |
432 |
|
|
- my $checked = ""; |
433 |
|
|
- if ( $action eq 'modify' ) { |
434 |
|
|
- if ( $trac_domains{ $domain->key() } ) { |
435 |
|
|
- $checked = "checked"; |
436 |
|
|
- } |
437 |
|
|
- } else { |
438 |
|
|
- $checked = "checked"; |
439 |
|
|
- } |
440 |
|
|
- |
441 |
|
|
- $out .= " <tr>\n"; |
442 |
|
|
- $out .= " <td><input type=\"checkbox\" name=\"tracDomains\" $checked value=\"" . $domain->key . "\"></td>\n"; |
443 |
|
|
- $out .= " <td>" . $domain->key . "</td>\n"; |
444 |
|
|
- $out .= " </tr>\n"; |
445 |
|
|
- } |
446 |
|
|
- |
447 |
|
|
- $out .= " </table>\n"; |
448 |
|
|
- $out .= " </td>\n"; |
449 |
|
|
- $out .= " </tr>\n"; |
450 |
|
|
- } |
451 |
|
|
- else |
452 |
|
|
- { |
453 |
|
|
- # We only have a single domain, so we just show this domain but without the |
454 |
|
|
- # checkbox (so it can't be unchecked). |
455 |
|
|
- my $domainname = $ConfigDB->get('DomainName')->value(); |
456 |
|
|
- $out = " <tr>\n"; |
457 |
|
|
- $out .= " <td colspan=2>" . $fm->localise('TRAC_FIELD_DOMAIN_DESCRIPTION') . "</td>"; |
458 |
|
|
- $out .= " </tr>\n"; |
459 |
|
|
- $out .= " <tr>\n"; |
460 |
|
|
- $out .= " <td class=\"sme-noborders-label\">" . $fm->localise('TRAC_FIELD_DOMAIN') . "</td>\n"; |
461 |
|
|
- $out .= " <td><input type=\"hidden\" name=\"tracDomains\" value=\"" . $domainname . "\">"; |
462 |
|
|
- $out .= $domainname . "</td>\n"; |
463 |
|
|
- $out .= " </tr>\n"; |
464 |
|
|
- } |
465 |
|
|
- |
466 |
|
|
- return $out; |
467 |
|
|
-} |
468 |
|
|
- |
469 |
|
|
- |
470 |
|
|
-=pod |
471 |
|
|
- |
472 |
|
|
-=head2 repositories_list() |
473 |
|
|
- |
474 |
|
|
-Returns a hash of repositories for the Create/Modify screen's repository |
475 |
|
|
-field's drop down list. |
476 |
|
|
- |
477 |
|
|
-=cut |
478 |
|
|
- |
479 |
|
|
-sub repositories_list |
480 |
|
|
-{ |
481 |
|
|
- my @repositories = $AccountsDB->get_all_by_prop('type' => 'repository'); |
482 |
|
|
- my %repositories = (); |
483 |
|
|
- foreach my $repository (@repositories) { |
484 |
|
|
- $repositories{$repository->key()} = $repository->prop('Description') . " (" . $repository->key . ")"; |
485 |
|
|
- } |
486 |
|
|
- return \%repositories; |
487 |
|
|
-} |
488 |
|
|
- |
489 |
|
|
-=head2 group_list() |
490 |
|
|
- |
491 |
|
|
-Returns a hash of groups for the Create/Modify screen's group |
492 |
|
|
-field's drop down list. |
493 |
|
|
- |
494 |
|
|
-=cut |
495 |
|
|
- |
496 |
|
|
-sub group_list |
497 |
|
|
-{ |
498 |
|
|
- my @groups = $AccountsDB->groups(); |
499 |
|
|
- my %groups = (); |
500 |
|
|
- foreach my $group (@groups) { |
501 |
|
|
- $groups{$group->key()} = $group->prop('Description')." (".$group->key.")"; |
502 |
|
|
- } |
503 |
|
|
- return \%groups; |
504 |
|
|
-} |
505 |
|
|
- |
506 |
|
|
-=head2 user_list() |
507 |
|
|
- |
508 |
|
|
-Returns a hash of users for the Create/Modify screen's user field's |
509 |
|
|
-drop down list. |
510 |
|
|
- |
511 |
|
|
-=cut |
512 |
|
|
- |
513 |
|
|
-sub user_list |
514 |
|
|
-{ |
515 |
|
|
- my @users = $AccountsDB->users(); |
516 |
|
|
- my %users = (); |
517 |
|
|
- foreach my $user (@users) { |
518 |
|
|
- $users{$user->key()} = $user->prop('LastName').", ". $user->prop('FirstName')." (". $user->key.")"; |
519 |
|
|
- } |
520 |
|
|
- return \%users; |
521 |
|
|
-} |
522 |
|
|
- |
523 |
|
|
-=head1 THE ROUTINES THAT ACTUALLY DO THE WORK |
524 |
|
|
- |
525 |
|
|
-=cut |
526 |
|
|
- |
527 |
|
|
-=head2 handle_trac_projects() |
528 |
|
|
- |
529 |
|
|
-Determine whether to modify or add the trac project environment |
530 |
|
|
- |
531 |
|
|
-=cut |
532 |
|
|
- |
533 |
|
|
-sub handle_trac_projects { |
534 |
|
|
- |
535 |
|
|
- my ($fm) = @_; |
536 |
|
|
- |
537 |
|
|
- if ($fm->cgi->param("action") eq "create") { |
538 |
|
|
- $fm->create_trac_project(); |
539 |
|
|
- } else { |
540 |
|
|
- $fm->modify_trac_project(); |
541 |
|
|
- } |
542 |
|
|
- |
543 |
|
|
-} |
544 |
|
|
- |
545 |
|
|
-=head2 create_trac_project() |
546 |
|
|
- |
547 |
|
|
-Handle the create event for the trac project environment |
548 |
|
|
- |
549 |
|
|
-=cut |
550 |
|
|
- |
551 |
|
|
-sub create_trac_project { |
552 |
|
|
- |
553 |
|
|
- my ($fm) = @_; |
554 |
|
|
- |
555 |
|
|
- # Validate Name |
556 |
|
|
- # ============= |
557 |
|
|
- |
558 |
|
|
- my $name = $fm->cgi->param('tracName'); |
559 |
|
|
- my $msg; |
560 |
|
|
- |
561 |
|
|
- $msg = $fm->validate_name($name); |
562 |
|
|
- unless ($msg eq "OK") |
563 |
|
|
- { |
564 |
|
|
- return $fm->error($msg); |
565 |
|
|
- } |
566 |
|
|
- |
567 |
|
|
- $msg = $fm->max_trac_project_name_length($name); |
568 |
|
|
- unless ($msg eq "OK") |
569 |
|
|
- { |
570 |
|
|
- return $fm->error($msg); |
571 |
|
|
- } |
572 |
|
|
- |
573 |
|
|
- $msg = $fm->conflict_check($name); |
574 |
|
|
- unless ($msg eq "OK") |
575 |
|
|
- { |
576 |
|
|
- return $fm->error($msg); |
577 |
|
|
- } |
578 |
|
|
- |
579 |
|
|
- # Validate & Setup Domain List |
580 |
|
|
- # ============================ |
581 |
|
|
- |
582 |
|
|
- my @active_trac_domains = $fm->cgi->param('tracDomains'); |
583 |
|
|
- |
584 |
|
|
- $msg = $fm->validate_trac_has_domains(@active_trac_domains); |
585 |
|
|
- unless ($msg eq "OK") |
586 |
|
|
- { |
587 |
|
|
- return $fm->error($msg); |
588 |
|
|
- } |
589 |
|
|
- |
590 |
|
|
- my $domain_list = ""; |
591 |
|
|
- foreach my $domain (@active_trac_domains) { |
592 |
|
|
- if ($domain_list) { |
593 |
|
|
- $domain_list .= "," . $domain; |
594 |
|
|
- } else { |
595 |
|
|
- $domain_list = $domain; |
596 |
|
|
- } |
597 |
|
|
- } |
598 |
|
|
- |
599 |
|
|
- # Setup Group List |
600 |
|
|
- # ================ |
601 |
|
|
- |
602 |
|
|
- my @groups = $fm->cgi->param('tracGroups'); |
603 |
|
|
- |
604 |
|
|
- my $group_list = ""; |
605 |
|
|
- foreach my $group (@groups) { |
606 |
|
|
- if ($group_list) { |
607 |
|
|
- $group_list .= "," . $group; |
608 |
|
|
- } else { |
609 |
|
|
- $group_list = $group; |
610 |
|
|
- } |
611 |
|
|
- } |
612 |
|
|
- |
613 |
|
|
- # Setup User List |
614 |
|
|
- # =============== |
615 |
|
|
- |
616 |
|
|
- my @users = $fm->cgi->param('tracUsers'); |
617 |
|
|
- |
618 |
|
|
- my $user_list = ""; |
619 |
|
|
- foreach my $user (@users) { |
620 |
|
|
- if ($user_list) { |
621 |
|
|
- $user_list .= "," . $user; |
622 |
|
|
- } else { |
623 |
|
|
- $user_list = $user; |
624 |
|
|
- } |
625 |
|
|
- } |
626 |
|
|
- |
627 |
|
|
- # Update Database |
628 |
|
|
- # =============== |
629 |
|
|
- |
630 |
|
|
- my $uid = $AccountsDB->get_next_uid(); |
631 |
|
|
- if (my $acct = $AccountsDB->new_record($name, { |
632 |
|
|
- Description => $fm->cgi->param('tracDescription'), |
633 |
|
|
- Repository => $fm->cgi->param('tracRepository'), |
634 |
|
|
- RepositoryPath => $fm->cgi->param('tracRepositoryPath'), |
635 |
|
|
- Domains => "$domain_list", |
636 |
|
|
- Groups => "$group_list", |
637 |
|
|
- Users => "$user_list", |
638 |
|
|
- Modifiable => 'yes', |
639 |
|
|
- Removable => 'yes', |
640 |
|
|
- Access => $fm->cgi->param('tracAccess'), |
641 |
|
|
- type => 'trac', |
642 |
|
|
- }) ) |
643 |
|
|
- { |
644 |
|
|
- # Untaint $name before use in system() |
645 |
|
|
- $name =~ /(.+)/; $name = $1; |
646 |
|
|
- |
647 |
|
|
- $fm->clear_params(); |
648 |
|
|
- |
649 |
|
|
- if (system ("/sbin/e-smith/signal-event", "trac-project-create", $name) == 0) { |
650 |
|
|
- $fm->success("SUCCESSFULLY_CREATED_TRAC_PROJECT"); |
651 |
|
|
- } else { |
652 |
|
|
- $fm->error("ERROR_WHILE_CREATING_TRAC_PROJECT"); |
653 |
|
|
- } |
654 |
|
|
- } else { |
655 |
|
|
- $fm->error('CANT_CREATE_TRAC_PROJECT'); |
656 |
|
|
- } |
657 |
|
|
-} |
658 |
|
|
- |
659 |
|
|
-=head2 modify_trac_project() |
660 |
|
|
- |
661 |
|
|
-Handle the modify event for the trac project environment |
662 |
|
|
- |
663 |
|
|
-=cut |
664 |
|
|
- |
665 |
|
|
-sub modify_trac_project { |
666 |
|
|
- |
667 |
|
|
- my ($fm) = @_; |
668 |
|
|
- my $name = $fm->cgi->param('tracName'); |
669 |
|
|
- |
670 |
|
|
- # Validate Name |
671 |
|
|
- # ============= |
672 |
|
|
- |
673 |
|
|
- my $msg = $fm->validate_name($name); |
674 |
|
|
- unless ($msg eq "OK") |
675 |
|
|
- { |
676 |
|
|
- return $fm->error($msg); |
677 |
|
|
- } |
678 |
|
|
- |
679 |
|
|
- # Validate & Setup Domain List |
680 |
|
|
- # ============================ |
681 |
|
|
- |
682 |
|
|
- my @active_trac_domains = $fm->cgi->param('tracDomains'); |
683 |
|
|
- |
684 |
|
|
- $msg = $fm->validate_trac_has_domains(@active_trac_domains); |
685 |
|
|
- unless ($msg eq "OK") |
686 |
|
|
- { |
687 |
|
|
- return $fm->error($msg); |
688 |
|
|
- } |
689 |
|
|
- |
690 |
|
|
- my $domain_list; |
691 |
|
|
- foreach my $domain (@active_trac_domains) { |
692 |
|
|
- if ($domain_list) { |
693 |
|
|
- $domain_list .= "," . $domain; |
694 |
|
|
- } else { |
695 |
|
|
- $domain_list = $domain; |
696 |
|
|
- } |
697 |
|
|
- } |
698 |
|
|
- |
699 |
|
|
- # Setup Group List |
700 |
|
|
- # ================ |
701 |
|
|
- |
702 |
|
|
- my @groups = $fm->cgi->param('tracGroups'); |
703 |
|
|
- |
704 |
|
|
- my $group_list; |
705 |
|
|
- foreach my $group (@groups) { |
706 |
|
|
- if ($group_list) { |
707 |
|
|
- $group_list .= "," . $group; |
708 |
|
|
- } else { |
709 |
|
|
- $group_list = $group; |
710 |
|
|
- } |
711 |
|
|
- } |
712 |
|
|
- |
713 |
|
|
- # Setup User List |
714 |
|
|
- # =============== |
715 |
|
|
- |
716 |
|
|
- my @users = $fm->cgi->param('tracUsers'); |
717 |
|
|
- |
718 |
|
|
- my $user_list; |
719 |
|
|
- foreach my $user (@users) { |
720 |
|
|
- if ($user_list) { |
721 |
|
|
- $user_list .= "," . $user; |
722 |
|
|
- } else { |
723 |
|
|
- $user_list = $user; |
724 |
|
|
- } |
725 |
|
|
- } |
726 |
|
|
- |
727 |
|
|
- # Update Database |
728 |
|
|
- # =============== |
729 |
|
|
- |
730 |
|
|
- if (my $acct = $AccountsDB->get($name)) { |
731 |
|
|
- if ($acct->prop('type') eq 'trac') { |
732 |
|
|
- |
733 |
|
|
- $acct->merge_props( |
734 |
|
|
- Description => $fm->cgi->param('tracDescription'), |
735 |
|
|
- Repository => $fm->cgi->param('tracRepository'), |
736 |
|
|
- RepositoryPath => $fm->cgi->param('tracRepositoryPath'), |
737 |
|
|
- Domains => $domain_list, |
738 |
|
|
- Groups => $group_list, |
739 |
|
|
- Users => $user_list, |
740 |
|
|
- Access => $fm->cgi->param('tracAccess'), |
741 |
|
|
- type => 'trac', |
742 |
|
|
- ); |
743 |
|
|
- |
744 |
|
|
- # Untaint $name before use in system() |
745 |
|
|
- $name =~ /(.+)/; $name = $1; |
746 |
|
|
- |
747 |
|
|
- $fm->clear_params(); |
748 |
|
|
- |
749 |
|
|
- if (system ("/sbin/e-smith/signal-event", "trac-project-modify", $name) == 0) |
750 |
|
|
- { |
751 |
|
|
- $fm->success("SUCCESSFULLY_MODIFIED_TRAC_PROJECT"); |
752 |
|
|
- } else { |
753 |
|
|
- $fm->error("ERROR_WHILE_MODIFYING_TRAC_PROJECT"); |
754 |
|
|
- } |
755 |
|
|
- } else { |
756 |
|
|
- $fm->error('CANT_FIND_TRAC_PROJECT'); |
757 |
|
|
- } |
758 |
|
|
- } else { |
759 |
|
|
- $fm->error('CANT_FIND_TRAC_PROJECT'); |
760 |
|
|
- } |
761 |
|
|
-} |
762 |
|
|
- |
763 |
|
|
-=head2 remove_trac_project() |
764 |
|
|
- |
765 |
|
|
-Handle the remove event for the trac project environment |
766 |
|
|
- |
767 |
|
|
-=cut |
768 |
|
|
- |
769 |
|
|
-sub remove_trac_project { |
770 |
|
|
- |
771 |
|
|
- my $fm = shift; |
772 |
|
|
- |
773 |
|
|
- my $name = $fm->cgi->param('tracName'); |
774 |
|
|
- if (my $acct = $AccountsDB->get($name)) { |
775 |
|
|
- if ($acct->prop('type') eq 'trac') { |
776 |
|
|
- $acct->set_prop('type', 'trac-deleted'); |
777 |
|
|
- |
778 |
|
|
- # Untaint $name before use in system() |
779 |
|
|
- $name =~ /(.+)/; $name = $1; |
780 |
|
|
- if (system ("/sbin/e-smith/signal-event", "trac-project-delete", $name) == 0) { |
781 |
|
|
- $fm ->success("SUCCESSFULLY_DELETED_TRAC_PROJECT"); |
782 |
|
|
- $acct->delete(); |
783 |
|
|
- } else { |
784 |
|
|
- $fm ->error("ERROR_WHILE_DELETING_TRAC_PROJECT"); |
785 |
|
|
- } |
786 |
|
|
- } else { |
787 |
|
|
- $fm->error('CANT_FIND_TRAC_PROJECT'); |
788 |
|
|
- } |
789 |
|
|
- |
790 |
|
|
- } else { |
791 |
|
|
- $fm->error('CANT_FIND_TRAC_PROJECT'); |
792 |
|
|
- } |
793 |
|
|
- $fm->wherenext('First'); |
794 |
|
|
-} |
795 |
|
|
- |
796 |
|
|
-=head1 VALIDATION ROUTINES |
797 |
|
|
- |
798 |
|
|
-=head2 max_trac_project_name_length() |
799 |
|
|
- |
800 |
|
|
-Checks the length of a given trac project environment name against the |
801 |
|
|
-maximum set in the maxTracNameLength record of the configuration database. |
802 |
|
|
-Defaults to a maximum length of $self->{defaultMaxLength} if nothing is |
803 |
|
|
-set in the config db. |
804 |
|
|
- |
805 |
|
|
-=cut |
806 |
|
|
- |
807 |
|
|
-sub max_trac_project_name_length { |
808 |
|
|
- my ($fm, $data) = @_; |
809 |
|
|
- |
810 |
|
|
- $ConfigDB->reload(); |
811 |
|
|
- my $max; |
812 |
|
|
- if (my $max_record = $ConfigDB->get('maxTracNameLength')) { |
813 |
|
|
- $max = $max_record->value(); |
814 |
|
|
- } |
815 |
|
|
- |
816 |
|
|
- if (length($data) <= $max) { |
817 |
|
|
- return "OK"; |
818 |
|
|
- } else { |
819 |
|
|
- return $fm->localise("MAX_TRAC_NAME_LENGTH_ERROR", |
820 |
|
|
- {acctName => $data, |
821 |
|
|
- maxRepositoryNameLength => $max, |
822 |
|
|
- maxLength => $max}); |
823 |
|
|
- } |
824 |
|
|
-} |
825 |
|
|
- |
826 |
|
|
-=head2 getExtraParams() |
827 |
|
|
- |
828 |
|
|
-Sets variables used in the lexicon to their required values. |
829 |
|
|
- |
830 |
|
|
-=cut |
831 |
|
|
- |
832 |
|
|
-sub getExtraParams { |
833 |
|
|
- |
834 |
|
|
- my $fm = shift; |
835 |
|
|
- my $TracProjectName = $fm->cgi->param('tracName'); |
836 |
|
|
- my $TracProjectDescription = ''; |
837 |
|
|
- my $maxLength = $ConfigDB->get('maxTracNameLength'); |
838 |
|
|
- |
839 |
|
|
- if ($TracProjectName) |
840 |
|
|
- { |
841 |
|
|
- my $TracAccount = $AccountsDB->get($TracProjectName); |
842 |
|
|
- if ($TracAccount) |
843 |
|
|
- { |
844 |
|
|
- $TracProjectDescription = $TracAccount->prop('Description'); |
845 |
|
|
- } |
846 |
|
|
- } |
847 |
|
|
- |
848 |
|
|
- return (name => $TracProjectName, |
849 |
|
|
- description => $TracProjectDescription, |
850 |
|
|
- maxLength => $maxLength); |
851 |
|
|
-} |
852 |
|
|
- |
853 |
|
|
-=head2 validate_name() |
854 |
|
|
- |
855 |
|
|
-Checks that the name supplied does not contain any unacceptable chars. |
856 |
|
|
-Returns OK on success or a localised error message otherwise. |
857 |
|
|
- |
858 |
|
|
-=cut |
859 |
|
|
- |
860 |
|
|
-sub validate_name { |
861 |
|
|
- |
862 |
|
|
- my ($fm, $tracName) = @_; |
863 |
|
|
- |
864 |
|
|
- unless ($tracName =~ /^([a-z][\_\.\-a-z0-9]*)$/) |
865 |
|
|
- { |
866 |
|
|
- return $fm->localise('TRAC_PROJECT_NAME_HAS_INVALID_CHARS', {tracName => $tracName}); |
867 |
|
|
- } |
868 |
|
|
- |
869 |
|
|
- return "OK"; |
870 |
|
|
-} |
871 |
|
|
- |
872 |
|
|
-=head2 conflict_check() |
873 |
|
|
- |
874 |
|
|
-Check the proposed name for clashes with existing pseudonyms or other |
875 |
|
|
-accounts of any type. |
876 |
|
|
- |
877 |
|
|
-=cut |
878 |
|
|
- |
879 |
|
|
-sub conflict_check { |
880 |
|
|
- |
881 |
|
|
- my ($fm, $name) = @_; |
882 |
|
|
- my $rec = $AccountsDB->get($name); |
883 |
|
|
- |
884 |
|
|
- my $type; |
885 |
|
|
- if (defined $rec) |
886 |
|
|
- { |
887 |
|
|
- my $type = $rec->prop('type'); |
888 |
|
|
- if ($type eq "pseudonym") |
889 |
|
|
- { |
890 |
|
|
- my $acct = $rec->prop("Account"); |
891 |
|
|
- my $acct_type = $AccountsDB->get($acct)->prop('type'); |
892 |
|
|
- |
893 |
|
|
- return $fm->localise('ACCT_CLASHES_WITH_PSEUDONYM', |
894 |
|
|
- {acctName => $name, acctType => $acct_type, acct => $acct}); |
895 |
|
|
- } |
896 |
|
|
- } |
897 |
|
|
- elsif (defined getpwnam($name) || defined getgrnam($name)) |
898 |
|
|
- { |
899 |
|
|
- $type = 'system'; |
900 |
|
|
- } |
901 |
|
|
- else |
902 |
|
|
- { |
903 |
|
|
- # No account record and no account |
904 |
|
|
- return 'OK'; |
905 |
|
|
- } |
906 |
|
|
- return $fm->localise('ACCOUNT_EXISTS', |
907 |
|
|
- {acctName => $name, acctType => $type}); |
908 |
|
|
-} |
909 |
|
|
- |
910 |
|
|
-=head2 validate_trac_has_domains() |
911 |
|
|
- |
912 |
|
|
-Validates that the cgi parameter DOMAINS is an array with at least one entry |
913 |
|
|
-Returns OK if true. Otherwise, returns NO_DOMAINS |
914 |
|
|
- |
915 |
|
|
-=cut |
916 |
|
|
- |
917 |
|
|
-sub validate_trac_has_domains { |
918 |
|
|
- |
919 |
|
|
- my $fm = shift; |
920 |
|
|
- my @domains = @_; |
921 |
|
|
- |
922 |
|
|
- my $count = @domains; |
923 |
|
|
- |
924 |
|
|
- if ( $count == 0 ) { |
925 |
|
|
- return ('NO_DOMAINS'); |
926 |
|
|
- } |
927 |
|
|
- else { |
928 |
|
|
- return ('OK'); |
929 |
|
|
- } |
930 |
|
|
-} |
931 |
|
|
- |
932 |
|
|
-=head2 clear_params() |
933 |
|
|
- |
934 |
|
|
-This method clears-out the parameters used in form submission so that they are |
935 |
|
|
-not inadvertenly picked-up where they should not be. |
936 |
|
|
- |
937 |
|
|
-=cut |
938 |
|
|
- |
939 |
|
|
-sub clear_params { |
940 |
|
|
- |
941 |
|
|
- my $fm = shift; |
942 |
|
|
- my $q = $fm->{cgi}; |
943 |
|
|
- |
944 |
|
|
- # Don't delete tracName here as we need in the next page for |
945 |
|
|
- # status messages. |
946 |
|
|
- |
947 |
|
|
- $q->delete('tracDescription'); |
948 |
|
|
- $q->delete('tracRepository'); |
949 |
|
|
- $q->delete('tracRepositoryPath'); |
950 |
|
|
- $q->delete('tracDomains'); |
951 |
|
|
- $q->delete('tracGroups'); |
952 |
|
|
- $q->delete('tracUsers'); |
953 |
|
|
- $q->delete('tracAccess'); |
954 |
|
|
- |
955 |
|
|
-} |
956 |
|
|
- |
957 |
|
|
-1; |
958 |
|
|
+#!/usr/bin/perl -w |
959 |
|
|
+#---------------------------------------------------------------------- |
960 |
|
|
+# $Id: trac.pm 69 2007-03-25 13:20:24Z marco $ |
961 |
|
|
+# vim: ft=perl ts=4 sw=4 et: |
962 |
|
|
+#---------------------------------------------------------------------- |
963 |
|
|
+# Copyright (C) 2007 Marco Hess |
964 |
|
|
+# |
965 |
|
|
+# This program is free software; you can redistribute it and/or modify |
966 |
|
|
+# it under the terms of the GNU General Public License as published by |
967 |
|
|
+# the Free Software Foundation; either version 2 of the License, or |
968 |
|
|
+# (at your option) any later version. |
969 |
|
|
+# |
970 |
|
|
+# This program is distributed in the hope that it will be useful, |
971 |
|
|
+# but WITHOUT ANY WARRANTY; without even the implied warranty of |
972 |
|
|
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
973 |
|
|
+# GNU General Public License for more details. |
974 |
|
|
+# |
975 |
|
|
+# You should have received a copy of the GNU General Public License |
976 |
|
|
+# along with this program; if not, write to the Free Software |
977 |
|
|
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
978 |
|
|
+#---------------------------------------------------------------------- |
979 |
|
|
+ |
980 |
|
|
+package esmith::FormMagick::Panel::trac; |
981 |
|
|
+ |
982 |
|
|
+use strict; |
983 |
|
|
+use warnings; |
984 |
|
|
+ |
985 |
|
|
+use esmith::FormMagick; |
986 |
|
|
+use esmith::AccountsDB; |
987 |
|
|
+use esmith::ConfigDB; |
988 |
|
|
+use esmith::DomainsDB; |
989 |
|
|
+use esmith::cgi; |
990 |
|
|
+use esmith::util; |
991 |
|
|
+use File::Basename; |
992 |
|
|
+use Exporter; |
993 |
|
|
+use Carp; |
994 |
|
|
+use Sys::Syslog; |
995 |
|
|
+ |
996 |
|
|
+use constant TRUE => 1; |
997 |
|
|
+use constant FALSE => 0; |
998 |
|
|
+ |
999 |
|
|
+our @ISA = qw(esmith::FormMagick Exporter); |
1000 |
|
|
+ |
1001 |
|
|
+our @EXPORT = qw( |
1002 |
|
|
+ show_trac_projects |
1003 |
|
|
+ print_trac_field_name |
1004 |
|
|
+ repositories_list |
1005 |
|
|
+ group_list |
1006 |
|
|
+ user_list |
1007 |
|
|
+ max_trac_project_name_length |
1008 |
|
|
+ handle_trac_projects |
1009 |
|
|
+ create_trac_project |
1010 |
|
|
+ remove_trac_project |
1011 |
|
|
+ getExtraParams |
1012 |
|
|
+ print_save_or_add_button |
1013 |
|
|
+ validate_name |
1014 |
|
|
+ validate_radio |
1015 |
|
|
+ wherenext |
1016 |
|
|
+ maxLength |
1017 |
|
|
+); |
1018 |
|
|
+ |
1019 |
|
|
+our $ConfigDB = esmith::ConfigDB->open |
1020 |
|
|
+ or die "Can't open the Config database : $!\n" ; |
1021 |
|
|
+ |
1022 |
|
|
+our $AccountsDB = esmith::AccountsDB->open |
1023 |
|
|
+ or die "Can't open the Account database : $!\n" ; |
1024 |
|
|
+ |
1025 |
|
|
+our $DomainsDB = esmith::DomainsDB->open |
1026 |
|
|
+ or die "Can't open the Domains database : $!\n" ; |
1027 |
|
|
+ |
1028 |
|
|
+ |
1029 |
|
|
+# fields and records separator for sub records |
1030 |
|
|
+use constant FS => "," ; |
1031 |
|
|
+use constant RS => ";" ; |
1032 |
|
|
+ |
1033 |
|
|
+=pod |
1034 |
|
|
+ |
1035 |
|
|
+=head1 NAME |
1036 |
|
|
+ |
1037 |
|
|
+esmith::FormMagick::Panels::trac - Trac |
1038 |
|
|
+ |
1039 |
|
|
+=head1 SYNOPSIS |
1040 |
|
|
+ |
1041 |
|
|
+use esmith::FormMagick::Panels::trac |
1042 |
|
|
+ |
1043 |
|
|
+my $panel = esmith::FormMagick::Panel::trac->new(); |
1044 |
|
|
+$panel->display(); |
1045 |
|
|
+ |
1046 |
|
|
+=head1 DESCRIPTION |
1047 |
|
|
+ |
1048 |
|
|
+This module is the backend to the Trac panel, responsible |
1049 |
|
|
+for supplying all functions used by that panel. It is a subclass |
1050 |
|
|
+of esmith::FormMagick itself, so it inherits the functionality |
1051 |
|
|
+of a FormMagick object. |
1052 |
|
|
+ |
1053 |
|
|
+=cut |
1054 |
|
|
+ |
1055 |
|
|
+=head2 new() |
1056 |
|
|
+ |
1057 |
|
|
+Exactly as for esmith::FormMagick |
1058 |
|
|
+ |
1059 |
|
|
+=cut |
1060 |
|
|
+ |
1061 |
|
|
+sub new |
1062 |
|
|
+{ |
1063 |
|
|
+ my $proto = shift; |
1064 |
|
|
+ my $class = ref($proto) || $proto; |
1065 |
|
|
+ my $self = esmith::FormMagick::new($class); |
1066 |
|
|
+ $self->{calling_package} = (caller)[0]; |
1067 |
|
|
+ |
1068 |
|
|
+ return $self; |
1069 |
|
|
+} |
1070 |
|
|
+ |
1071 |
|
|
+=head1 HTML GENERATION ROUTINES |
1072 |
|
|
+ |
1073 |
|
|
+Routines for generating chunks of HTML needed by the panel. |
1074 |
|
|
+ |
1075 |
|
|
+=cut |
1076 |
|
|
+ |
1077 |
|
|
+=head2 show_trac_projects() |
1078 |
|
|
+ |
1079 |
|
|
+This function displays a table of trac project environments on the system |
1080 |
|
|
+including the links to modify and remove the trac project environment. |
1081 |
|
|
+ |
1082 |
|
|
+=cut |
1083 |
|
|
+ |
1084 |
|
|
+sub show_trac_projects { |
1085 |
|
|
+ my $fm = shift; |
1086 |
|
|
+ my $q = $fm->{cgi}; |
1087 |
|
|
+ |
1088 |
|
|
+ # Setup the various localised text field for the trac project table |
1089 |
|
|
+ my $name = $fm->localise('NAME'); |
1090 |
|
|
+ my $description = $fm->localise('DESCRIPTION'); |
1091 |
|
|
+ my $domains = $fm->localise('DOMAINS'); |
1092 |
|
|
+ my $repository = $fm->localise('REPOSITORY'); |
1093 |
|
|
+ my $path = $fm->localise('PATH'); |
1094 |
|
|
+ my $access = $fm->localise('DESCRIPTION'); |
1095 |
|
|
+ my $action_h = $fm->localise('ACTION'); |
1096 |
|
|
+ my $view = $fm->localise('VIEW'); |
1097 |
|
|
+ my $modify = $fm->localise('MODIFY'); |
1098 |
|
|
+ my $remove = $fm->localise('REMOVE'); |
1099 |
|
|
+ my $backup = $fm->localise('BACKUP'); |
1100 |
|
|
+ my $restore = $fm->localise('RESTORE'); |
1101 |
|
|
+ |
1102 |
|
|
+ print $q->start_table({-class => 'sme-noborder'}), "\n"; |
1103 |
|
|
+ |
1104 |
|
|
+ # Check if any repositories exist |
1105 |
|
|
+ my @repositories = $AccountsDB->get_all_by_prop('type' => 'repository'); |
1106 |
|
|
+ unless ( scalar @repositories ) |
1107 |
|
|
+ { |
1108 |
|
|
+ print $q->Tr($q->td($q->h2($fm->localise('NO_REPOSITORIES')))); |
1109 |
|
|
+ return ""; |
1110 |
|
|
+ } |
1111 |
|
|
+ |
1112 |
|
|
+ # TODO what about the case that all repositories have been deleted |
1113 |
|
|
+ # but the Trac project environments are still there? Can we remove the |
1114 |
|
|
+ # trac projects or do we need to reassign the projects to |
1115 |
|
|
+ # another repository? The code above prevents us from accessing the |
1116 |
|
|
+ # trac projects when there are no more repositories. |
1117 |
|
|
+ |
1118 |
|
|
+ print $q->Tr($q->td($q->a({-class => "button-like", |
1119 |
|
|
+ href => "trac?page=0&page_stack=&Next=Next&wherenext=Create"}, |
1120 |
|
|
+ $fm->localise('TRAC_ADD_BUTTON')))); |
1121 |
|
|
+ |
1122 |
|
|
+ # Check if any trac projects exist |
1123 |
|
|
+ my @TracProjects = $AccountsDB->get_all_by_prop('type' => 'trac'); |
1124 |
|
|
+ unless ( scalar @TracProjects ) |
1125 |
|
|
+ { |
1126 |
|
|
+ print $q->Tr($q->td($q->h2($fm->localise('NO_TRAC_PROJECTS')))); |
1127 |
|
|
+ return ""; |
1128 |
|
|
+ } |
1129 |
|
|
+ |
1130 |
|
|
+ # Show the list of configures trac projects |
1131 |
|
|
+ print $q->Tr($q->td($q->h2($fm->localise('CURRENT_TRAC_PROJECTS')))); |
1132 |
|
|
+ |
1133 |
|
|
+ print $q->Tr($q->td($fm->localise('TRAC_MODIFY_REMOVE_BUTTON_DESCRIPTION'))); |
1134 |
|
|
+ |
1135 |
|
|
+ print $q->start_table({-CLASS => "sme-border"}),"\n"; |
1136 |
|
|
+ print $q->Tr ( |
1137 |
|
|
+ esmith::cgi::genSmallCell($q, $name, "header"), |
1138 |
|
|
+ esmith::cgi::genSmallCell($q, $description,"header"), |
1139 |
|
|
+ esmith::cgi::genSmallCell($q, $domains, "header"), |
1140 |
|
|
+ esmith::cgi::genSmallCell($q, $repository, "header"), |
1141 |
|
|
+ esmith::cgi::genSmallCell($q, $path, "header"), |
1142 |
|
|
+ esmith::cgi::genSmallCell($q, $access, "header"), |
1143 |
|
|
+ esmith::cgi::genSmallCell($q, $action_h, "header", 3)),"\n"; |
1144 |
|
|
+ |
1145 |
|
|
+ my $scriptname = basename($0); |
1146 |
|
|
+ |
1147 |
|
|
+ foreach my $TracProject (@TracProjects) |
1148 |
|
|
+ { |
1149 |
|
|
+ my $trac_name = $TracProject->key(); |
1150 |
|
|
+ my $trac_desc = $TracProject->prop('Description'); |
1151 |
|
|
+ my $trac_domains = join("<br>", split(FS, $TracProject->prop('Domains'))); |
1152 |
|
|
+ my $trac_repo = $TracProject->prop('Repository'); |
1153 |
|
|
+ my $trac_path = $TracProject->prop('RepositoryPath'); |
1154 |
|
|
+ my $trac_access = $TracProject->prop('Access') || 'local'; |
1155 |
|
|
+ my $modifiable = $TracProject->prop('Modifiable') || 'yes'; |
1156 |
|
|
+ my $removable = $TracProject->prop('Removable') || 'yes'; |
1157 |
|
|
+ |
1158 |
|
|
+ my $params = $fm->build_trac_project_cgi_params($trac_name, $TracProject->props()); |
1159 |
|
|
+ |
1160 |
|
|
+ my $href = "$scriptname?$params&action=modify&wherenext="; |
1161 |
|
|
+ |
1162 |
|
|
+ my $actionView = ' '; |
1163 |
|
|
+ $actionView .= $q->a({href => '/' . $TracProject->key(), |
1164 |
|
|
+ target => '_blank'}, $view ) . ' '; |
1165 |
|
|
+ |
1166 |
|
|
+ my $actionModify = ' '; |
1167 |
|
|
+ if ($modifiable eq 'yes') |
1168 |
|
|
+ { |
1169 |
|
|
+ $actionModify .= $q->a({href => "${href}Modify"}, $modify) . ' '; |
1170 |
|
|
+ } |
1171 |
|
|
+ |
1172 |
|
|
+ my $actionRemove = ' '; |
1173 |
|
|
+ if ($removable eq 'yes') |
1174 |
|
|
+ { |
1175 |
|
|
+ $actionRemove .= $q->a({href => "${href}Remove"}, $remove) . ' '; |
1176 |
|
|
+ } |
1177 |
|
|
+ |
1178 |
|
|
+ my $actionBackup = ' '; |
1179 |
|
|
+ $actionBackup .= $q->a({href => "${href}Backup"}, $backup) . ' '; |
1180 |
|
|
+ |
1181 |
|
|
+ my $actionRestore = ' '; |
1182 |
|
|
+ $actionRestore .= $q->a({href => "${href}Restore"}, $restore) . ' '; |
1183 |
|
|
+ |
1184 |
|
|
+ print $q->Tr( |
1185 |
|
|
+ esmith::cgi::genSmallCell($q, $trac_name, "normal"), |
1186 |
|
|
+ esmith::cgi::genSmallCell($q, $trac_desc, "normal"), |
1187 |
|
|
+ esmith::cgi::genSmallCell($q, $trac_domains, "normal"), |
1188 |
|
|
+ esmith::cgi::genSmallCell($q, $trac_repo, "normal"), |
1189 |
|
|
+ esmith::cgi::genSmallCell($q, $trac_path, "normal"), |
1190 |
|
|
+ esmith::cgi::genSmallCell($q, $trac_access, "normal"), |
1191 |
|
|
+ esmith::cgi::genSmallCell($q, $actionView, "normal"), |
1192 |
|
|
+ esmith::cgi::genSmallCell($q, $actionModify, "normal"), |
1193 |
|
|
+ esmith::cgi::genSmallCell($q, $actionRemove, "normal") |
1194 |
|
|
+ ); |
1195 |
|
|
+ } |
1196 |
|
|
+ |
1197 |
|
|
+ print $q->end_table,"\n"; |
1198 |
|
|
+ |
1199 |
|
|
+ print $q->end_table,"\n"; |
1200 |
|
|
+ |
1201 |
|
|
+ return ""; |
1202 |
|
|
+} |
1203 |
|
|
+ |
1204 |
|
|
+=cut |
1205 |
|
|
+ |
1206 |
|
|
+=head2 print_save_or_add_button() |
1207 |
|
|
+ |
1208 |
|
|
+Prints the ADD button when a new trac project environment is addded and the SAVE buttom |
1209 |
|
|
+whem modifications are made. |
1210 |
|
|
+ |
1211 |
|
|
+=cut |
1212 |
|
|
+ |
1213 |
|
|
+sub print_save_or_add_button { |
1214 |
|
|
+ |
1215 |
|
|
+ my ($fm) = @_; |
1216 |
|
|
+ |
1217 |
|
|
+ my $cgi = $fm->{cgi}; |
1218 |
|
|
+ |
1219 |
|
|
+ if (($cgi->param("action") || '') eq "modify") { |
1220 |
|
|
+ $fm->print_button("SAVE"); |
1221 |
|
|
+ } else { |
1222 |
|
|
+ $fm->print_button("ADD"); |
1223 |
|
|
+ } |
1224 |
|
|
+} |
1225 |
|
|
+ |
1226 |
|
|
+=head1 HELPER FUNCTIONS FOR THE PANEL |
1227 |
|
|
+ |
1228 |
|
|
+Routines for modifying the database and signaling events |
1229 |
|
|
+from the server-manager panel |
1230 |
|
|
+ |
1231 |
|
|
+=cut |
1232 |
|
|
+ |
1233 |
|
|
+=head2 build_trac_project_cgi_params($fm, $tracprojectname, %oldprops) |
1234 |
|
|
+ |
1235 |
|
|
+Constructs the parameters for the links in the trac project environments table |
1236 |
|
|
+ |
1237 |
|
|
+=cut |
1238 |
|
|
+ |
1239 |
|
|
+sub build_trac_project_cgi_params { |
1240 |
|
|
+ my ($self, $tracprojectname, %oldprops) = @_; |
1241 |
|
|
+ |
1242 |
|
|
+ my %props = ( |
1243 |
|
|
+ page => 0, |
1244 |
|
|
+ page_stack => "", |
1245 |
|
|
+ tracName => $tracprojectname, |
1246 |
|
|
+ ); |
1247 |
|
|
+ |
1248 |
|
|
+ return $self->props_to_query_string(\%props); |
1249 |
|
|
+} |
1250 |
|
|
+ |
1251 |
|
|
+*wherenext = \&CGI::FormMagick::wherenext; |
1252 |
|
|
+ |
1253 |
|
|
+=head2 print_trac_field_name() |
1254 |
|
|
+ |
1255 |
|
|
+Helper function to print the field NAME so that it becomes |
1256 |
|
|
+an edit field upon ADD and a fixed field upon MODIFY. |
1257 |
|
|
+ |
1258 |
|
|
+Also read all the account db values so the other fields |
1259 |
|
|
+can show the existing values. |
1260 |
|
|
+ |
1261 |
|
|
+=cut |
1262 |
|
|
+ |
1263 |
|
|
+sub print_trac_field_name { |
1264 |
|
|
+ my $fm = shift; |
1265 |
|
|
+ my $in = $fm->{cgi}->param('tracName') || ''; |
1266 |
|
|
+ my $action = $fm->{cgi}->param('action') || ''; |
1267 |
|
|
+ |
1268 |
|
|
+ print qq(<tr><td class="sme-noborders-label">) . |
1269 |
|
|
+ $fm->localise('TRAC_FIELD_PROJECT_NAME') . qq(</td>\n); |
1270 |
|
|
+ |
1271 |
|
|
+ if ($action eq 'modify' and $in) { |
1272 |
|
|
+ #------------------------------------------------------- |
1273 |
|
|
+ # Updating an existing record. |
1274 |
|
|
+ #-------------------------------------------------------- |
1275 |
|
|
+ |
1276 |
|
|
+ my $rec = $AccountsDB->get($in); |
1277 |
|
|
+ my $modifiable = $rec->prop('Modifiable') || 'yes'; |
1278 |
|
|
+ my $removable = $rec->prop('Removable') || 'yes'; |
1279 |
|
|
+ |
1280 |
|
|
+ print qq( |
1281 |
|
|
+ <td class="sme-noborders-content">$in |
1282 |
|
|
+ <input type="hidden" name="tracName" value="$in"> |
1283 |
|
|
+ <input type="hidden" name="action" value="modify"> |
1284 |
|
|
+ </td> |
1285 |
|
|
+ ); |
1286 |
|
|
+ |
1287 |
|
|
+ # Read the values for each field from the accounts db and store |
1288 |
|
|
+ # them in the cgi object so our form will have the correct |
1289 |
|
|
+ # info displayed. |
1290 |
|
|
+ my $q = $fm->{cgi}; |
1291 |
|
|
+ if ($rec) |
1292 |
|
|
+ { |
1293 |
|
|
+ $q->param(-name=>'tracDescription',-value=> |
1294 |
|
|
+ $rec->prop('Description')); |
1295 |
|
|
+ |
1296 |
|
|
+ $q->param(-name=>'tracRepository',-value=> |
1297 |
|
|
+ $rec->prop('Repository')); |
1298 |
|
|
+ |
1299 |
|
|
+ $q->param(-name=>'tracRepositoryPath',-value=> |
1300 |
|
|
+ $rec->prop('RepositoryPath')); |
1301 |
|
|
+ |
1302 |
|
|
+ # domain list is handled separately |
1303 |
|
|
+ |
1304 |
|
|
+ $q->param(-name=>'tracGroups',-value=> |
1305 |
|
|
+ join(FS, split(FS, $rec->prop('Groups')))); |
1306 |
|
|
+ |
1307 |
|
|
+ $q->param(-name=>'tracUsers',-value=> |
1308 |
|
|
+ join(FS, split(FS, $rec->prop('Users')))); |
1309 |
|
|
+ |
1310 |
|
|
+ $q->param(-name=>'tracAccess',-value=> |
1311 |
|
|
+ $rec->prop('Access')), |
1312 |
|
|
+ } |
1313 |
|
|
+ } else { |
1314 |
|
|
+ #------------------------------------------------------- |
1315 |
|
|
+ # Adding a new record so allow an entry field for the |
1316 |
|
|
+ # name. |
1317 |
|
|
+ #-------------------------------------------------------- |
1318 |
|
|
+ print qq( |
1319 |
|
|
+ <td><input type="text" name="tracName" value="$in"> |
1320 |
|
|
+ <input type="hidden" name="action" value="create"> |
1321 |
|
|
+ </td> |
1322 |
|
|
+ ); |
1323 |
|
|
+ } |
1324 |
|
|
+ |
1325 |
|
|
+ print qq(</tr>\n); |
1326 |
|
|
+ return undef; |
1327 |
|
|
+} |
1328 |
|
|
+ |
1329 |
|
|
+ |
1330 |
|
|
+=head2 print_trac_domains() |
1331 |
|
|
+ |
1332 |
|
|
+When this server has more than one domain this function takes |
1333 |
|
|
+the list of domains and returns a string of html checkboxes |
1334 |
|
|
+for all these domains. |
1335 |
|
|
+ |
1336 |
|
|
+Those domains that are listed with this Trac environment |
1337 |
|
|
+will have their checkbox checked. |
1338 |
|
|
+ |
1339 |
|
|
+=cut |
1340 |
|
|
+ |
1341 |
|
|
+sub print_trac_domains() { |
1342 |
|
|
+ |
1343 |
|
|
+ # Retrieve the Trac account name from the CGI parameters |
1344 |
|
|
+ my $fm = shift; |
1345 |
|
|
+ my $name = $fm->{'cgi'}->param('tracName'); |
1346 |
|
|
+ my $action = $fm->{'cgi'}->param("action") || ''; |
1347 |
|
|
+ my $out = ""; |
1348 |
|
|
+ |
1349 |
|
|
+ # Get a full list of all the domains on this server. |
1350 |
|
|
+ my @domains = $DomainsDB->get_all_by_prop( type => 'domain' ); |
1351 |
|
|
+ my $numdomains = @domains; |
1352 |
|
|
+ |
1353 |
|
|
+ # If there is more than one domain, we generate a list |
1354 |
|
|
+ # of checkboxes. Otherwise we just show the primary domain. |
1355 |
|
|
+ if ($numdomains > 1) { |
1356 |
|
|
+ |
1357 |
|
|
+ # With the Trac account name, get the list of the Domains for which |
1358 |
|
|
+ # this Trac account is active. |
1359 |
|
|
+ my $trac_domains_list = ""; |
1360 |
|
|
+ if ($AccountsDB->get($name)) { |
1361 |
|
|
+ $trac_domains_list = $AccountsDB->get($name)->prop('Domains'); |
1362 |
|
|
+ } |
1363 |
|
|
+ |
1364 |
|
|
+ # Split the comma separated list into the individual bits. |
1365 |
|
|
+ my %trac_domains; |
1366 |
|
|
+ foreach my $trac_domain ( split ( /,/, $trac_domains_list ) ) { |
1367 |
|
|
+ $trac_domains{$trac_domain} = 1; |
1368 |
|
|
+ } |
1369 |
|
|
+ |
1370 |
|
|
+ # Now generate the table of domains with a checkbox in front of it. |
1371 |
|
|
+ # If the domain is in our listed domains for the Trac environment, the |
1372 |
|
|
+ # checkbox will show checked. |
1373 |
|
|
+ $out = " <tr>\n"; |
1374 |
|
|
+ $out .= " <td colspan=2>" . $fm->localise('TRAC_FIELD_DOMAINS_DESCRIPTION') . "</td>"; |
1375 |
|
|
+ $out .= " </tr>\n"; |
1376 |
|
|
+ $out .= " <tr>\n"; |
1377 |
|
|
+ $out .= " <td class=\"sme-noborders-label\">" . $fm->localise('DOMAINS') . "</td>\n"; |
1378 |
|
|
+ $out .= " <td>\n"; |
1379 |
|
|
+ $out .= " <table border='0' cellspacing='0' cellpadding='0'>\n"; |
1380 |
|
|
+ $out .= " <tr>\n"; |
1381 |
|
|
+ |
1382 |
|
|
+ foreach my $domain (sort @domains) { |
1383 |
|
|
+ |
1384 |
|
|
+ # If this is a ADD form, we default check all domains, otherwise only |
1385 |
|
|
+ # those that are in our Trac project list. |
1386 |
|
|
+ my $checked = ""; |
1387 |
|
|
+ if ( $action eq 'modify' ) { |
1388 |
|
|
+ if ( $trac_domains{ $domain->key() } ) { |
1389 |
|
|
+ $checked = "checked"; |
1390 |
|
|
+ } |
1391 |
|
|
+ } else { |
1392 |
|
|
+ $checked = "checked"; |
1393 |
|
|
+ } |
1394 |
|
|
+ |
1395 |
|
|
+ $out .= " <tr>\n"; |
1396 |
|
|
+ $out .= " <td><input type=\"checkbox\" name=\"tracDomains\" $checked value=\"" . $domain->key . "\"></td>\n"; |
1397 |
|
|
+ $out .= " <td>" . $domain->key . "</td>\n"; |
1398 |
|
|
+ $out .= " </tr>\n"; |
1399 |
|
|
+ } |
1400 |
|
|
+ |
1401 |
|
|
+ $out .= " </table>\n"; |
1402 |
|
|
+ $out .= " </td>\n"; |
1403 |
|
|
+ $out .= " </tr>\n"; |
1404 |
|
|
+ } |
1405 |
|
|
+ else |
1406 |
|
|
+ { |
1407 |
|
|
+ # We only have a single domain, so we just show this domain but without the |
1408 |
|
|
+ # checkbox (so it can't be unchecked). |
1409 |
|
|
+ my $domainname = $ConfigDB->get('DomainName')->value(); |
1410 |
|
|
+ $out = " <tr>\n"; |
1411 |
|
|
+ $out .= " <td colspan=2>" . $fm->localise('TRAC_FIELD_DOMAIN_DESCRIPTION') . "</td>"; |
1412 |
|
|
+ $out .= " </tr>\n"; |
1413 |
|
|
+ $out .= " <tr>\n"; |
1414 |
|
|
+ $out .= " <td class=\"sme-noborders-label\">" . $fm->localise('DOMAIN') . "</td>\n"; |
1415 |
|
|
+ $out .= " <td><input type=\"hidden\" name=\"tracDomains\" value=\"" . $domainname . "\">"; |
1416 |
|
|
+ $out .= $domainname . "</td>\n"; |
1417 |
|
|
+ $out .= " </tr>\n"; |
1418 |
|
|
+ } |
1419 |
|
|
+ |
1420 |
|
|
+ return $out; |
1421 |
|
|
+} |
1422 |
|
|
+ |
1423 |
|
|
+ |
1424 |
|
|
+=pod |
1425 |
|
|
+ |
1426 |
|
|
+=head2 repositories_list() |
1427 |
|
|
+ |
1428 |
|
|
+Returns a hash of repositories for the Create/Modify screen's repository |
1429 |
|
|
+field's drop down list. |
1430 |
|
|
+ |
1431 |
|
|
+=cut |
1432 |
|
|
+ |
1433 |
|
|
+sub repositories_list |
1434 |
|
|
+{ |
1435 |
|
|
+ my @repositories = $AccountsDB->get_all_by_prop('type' => 'repository'); |
1436 |
|
|
+ my %repositories = (); |
1437 |
|
|
+ foreach my $repository (@repositories) { |
1438 |
|
|
+ $repositories{$repository->key()} = $repository->prop('Description') . " (" . $repository->key . ")"; |
1439 |
|
|
+ } |
1440 |
|
|
+ return \%repositories; |
1441 |
|
|
+} |
1442 |
|
|
+ |
1443 |
|
|
+=head2 group_list() |
1444 |
|
|
+ |
1445 |
|
|
+Returns a hash of groups for the Create/Modify screen's group |
1446 |
|
|
+field's drop down list. |
1447 |
|
|
+ |
1448 |
|
|
+=cut |
1449 |
|
|
+ |
1450 |
|
|
+sub group_list |
1451 |
|
|
+{ |
1452 |
|
|
+ my @groups = $AccountsDB->groups(); |
1453 |
|
|
+ my %groups = (); |
1454 |
|
|
+ foreach my $group (@groups) { |
1455 |
|
|
+ $groups{$group->key()} = $group->prop('Description')." (".$group->key.")"; |
1456 |
|
|
+ } |
1457 |
|
|
+ return \%groups; |
1458 |
|
|
+} |
1459 |
|
|
+ |
1460 |
|
|
+=head2 user_list() |
1461 |
|
|
+ |
1462 |
|
|
+Returns a hash of users for the Create/Modify screen's user field's |
1463 |
|
|
+drop down list. |
1464 |
|
|
+ |
1465 |
|
|
+=cut |
1466 |
|
|
+ |
1467 |
|
|
+sub user_list |
1468 |
|
|
+{ |
1469 |
|
|
+ my @users = $AccountsDB->users(); |
1470 |
|
|
+ my %users = (); |
1471 |
|
|
+ foreach my $user (@users) { |
1472 |
|
|
+ $users{$user->key()} = $user->prop('LastName').", ". $user->prop('FirstName')." (". $user->key.")"; |
1473 |
|
|
+ } |
1474 |
|
|
+ return \%users; |
1475 |
|
|
+} |
1476 |
|
|
+ |
1477 |
|
|
+=head1 THE ROUTINES THAT ACTUALLY DO THE WORK |
1478 |
|
|
+ |
1479 |
|
|
+=cut |
1480 |
|
|
+ |
1481 |
|
|
+=head2 handle_trac_projects() |
1482 |
|
|
+ |
1483 |
|
|
+Determine whether to modify or add the trac project environment |
1484 |
|
|
+ |
1485 |
|
|
+=cut |
1486 |
|
|
+ |
1487 |
|
|
+sub handle_trac_projects { |
1488 |
|
|
+ |
1489 |
|
|
+ my ($fm) = @_; |
1490 |
|
|
+ |
1491 |
|
|
+ if ($fm->cgi->param("action") eq "create") { |
1492 |
|
|
+ $fm->create_trac_project(); |
1493 |
|
|
+ } else { |
1494 |
|
|
+ $fm->modify_trac_project(); |
1495 |
|
|
+ } |
1496 |
|
|
+ |
1497 |
|
|
+} |
1498 |
|
|
+ |
1499 |
|
|
+=head2 create_trac_project() |
1500 |
|
|
+ |
1501 |
|
|
+Handle the create event for the trac project environment |
1502 |
|
|
+ |
1503 |
|
|
+=cut |
1504 |
|
|
+ |
1505 |
|
|
+sub create_trac_project { |
1506 |
|
|
+ |
1507 |
|
|
+ my ($fm) = @_; |
1508 |
|
|
+ |
1509 |
|
|
+ # Validate Name |
1510 |
|
|
+ # ============= |
1511 |
|
|
+ |
1512 |
|
|
+ my $name = $fm->cgi->param('tracName'); |
1513 |
|
|
+ my $msg; |
1514 |
|
|
+ |
1515 |
|
|
+ $msg = $fm->validate_name($name); |
1516 |
|
|
+ unless ($msg eq "OK") |
1517 |
|
|
+ { |
1518 |
|
|
+ return $fm->error($msg); |
1519 |
|
|
+ } |
1520 |
|
|
+ |
1521 |
|
|
+ $msg = $fm->max_trac_project_name_length($name); |
1522 |
|
|
+ unless ($msg eq "OK") |
1523 |
|
|
+ { |
1524 |
|
|
+ return $fm->error($msg); |
1525 |
|
|
+ } |
1526 |
|
|
+ |
1527 |
|
|
+ $msg = $fm->conflict_check($name); |
1528 |
|
|
+ unless ($msg eq "OK") |
1529 |
|
|
+ { |
1530 |
|
|
+ return $fm->error($msg); |
1531 |
|
|
+ } |
1532 |
|
|
+ |
1533 |
|
|
+ # Validate & Setup Domain List |
1534 |
|
|
+ # ============================ |
1535 |
|
|
+ |
1536 |
|
|
+ my @active_trac_domains = $fm->cgi->param('tracDomains'); |
1537 |
|
|
+ |
1538 |
|
|
+ $msg = $fm->validate_trac_has_domains(@active_trac_domains); |
1539 |
|
|
+ unless ($msg eq "OK") |
1540 |
|
|
+ { |
1541 |
|
|
+ return $fm->error($msg); |
1542 |
|
|
+ } |
1543 |
|
|
+ |
1544 |
|
|
+ my $domain_list = ""; |
1545 |
|
|
+ foreach my $domain (@active_trac_domains) { |
1546 |
|
|
+ if ($domain_list) { |
1547 |
|
|
+ $domain_list .= "," . $domain; |
1548 |
|
|
+ } else { |
1549 |
|
|
+ $domain_list = $domain; |
1550 |
|
|
+ } |
1551 |
|
|
+ } |
1552 |
|
|
+ |
1553 |
|
|
+ # Setup Group List |
1554 |
|
|
+ # ================ |
1555 |
|
|
+ |
1556 |
|
|
+ my @groups = $fm->cgi->param('tracGroups'); |
1557 |
|
|
+ |
1558 |
|
|
+ my $group_list = ""; |
1559 |
|
|
+ foreach my $group (@groups) { |
1560 |
|
|
+ if ($group_list) { |
1561 |
|
|
+ $group_list .= "," . $group; |
1562 |
|
|
+ } else { |
1563 |
|
|
+ $group_list = $group; |
1564 |
|
|
+ } |
1565 |
|
|
+ } |
1566 |
|
|
+ |
1567 |
|
|
+ # Setup User List |
1568 |
|
|
+ # =============== |
1569 |
|
|
+ |
1570 |
|
|
+ my @users = $fm->cgi->param('tracUsers'); |
1571 |
|
|
+ |
1572 |
|
|
+ my $user_list = ""; |
1573 |
|
|
+ foreach my $user (@users) { |
1574 |
|
|
+ if ($user_list) { |
1575 |
|
|
+ $user_list .= "," . $user; |
1576 |
|
|
+ } else { |
1577 |
|
|
+ $user_list = $user; |
1578 |
|
|
+ } |
1579 |
|
|
+ } |
1580 |
|
|
+ |
1581 |
|
|
+ # Update Database |
1582 |
|
|
+ # =============== |
1583 |
|
|
+ |
1584 |
|
|
+ my $uid = $AccountsDB->get_next_uid(); |
1585 |
|
|
+ if (my $acct = $AccountsDB->new_record($name, { |
1586 |
|
|
+ Description => $fm->cgi->param('tracDescription'), |
1587 |
|
|
+ Repository => $fm->cgi->param('tracRepository'), |
1588 |
|
|
+ RepositoryPath => $fm->cgi->param('tracRepositoryPath'), |
1589 |
|
|
+ Domains => "$domain_list", |
1590 |
|
|
+ Groups => "$group_list", |
1591 |
|
|
+ Users => "$user_list", |
1592 |
|
|
+ Modifiable => 'yes', |
1593 |
|
|
+ Removable => 'yes', |
1594 |
|
|
+ Access => $fm->cgi->param('tracAccess'), |
1595 |
|
|
+ type => 'trac', |
1596 |
|
|
+ }) ) |
1597 |
|
|
+ { |
1598 |
|
|
+ # Untaint $name before use in system() |
1599 |
|
|
+ $name =~ /(.+)/; $name = $1; |
1600 |
|
|
+ |
1601 |
|
|
+ $fm->clear_params(); |
1602 |
|
|
+ |
1603 |
|
|
+ if (system ("/sbin/e-smith/signal-event", "trac-project-create", $name) == 0) { |
1604 |
|
|
+ $fm->success("SUCCESSFULLY_CREATED_TRAC_PROJECT"); |
1605 |
|
|
+ } else { |
1606 |
|
|
+ $fm->error("ERROR_WHILE_CREATING_TRAC_PROJECT"); |
1607 |
|
|
+ } |
1608 |
|
|
+ } else { |
1609 |
|
|
+ $fm->error('CANT_CREATE_TRAC_PROJECT'); |
1610 |
|
|
+ } |
1611 |
|
|
+} |
1612 |
|
|
+ |
1613 |
|
|
+=head2 modify_trac_project() |
1614 |
|
|
+ |
1615 |
|
|
+Handle the modify event for the trac project environment |
1616 |
|
|
+ |
1617 |
|
|
+=cut |
1618 |
|
|
+ |
1619 |
|
|
+sub modify_trac_project { |
1620 |
|
|
+ |
1621 |
|
|
+ my ($fm) = @_; |
1622 |
|
|
+ my $name = $fm->cgi->param('tracName'); |
1623 |
|
|
+ |
1624 |
|
|
+ # Validate Name |
1625 |
|
|
+ # ============= |
1626 |
|
|
+ |
1627 |
|
|
+ my $msg = $fm->validate_name($name); |
1628 |
|
|
+ unless ($msg eq "OK") |
1629 |
|
|
+ { |
1630 |
|
|
+ return $fm->error($msg); |
1631 |
|
|
+ } |
1632 |
|
|
+ |
1633 |
|
|
+ # Validate & Setup Domain List |
1634 |
|
|
+ # ============================ |
1635 |
|
|
+ |
1636 |
|
|
+ my @active_trac_domains = $fm->cgi->param('tracDomains'); |
1637 |
|
|
+ |
1638 |
|
|
+ $msg = $fm->validate_trac_has_domains(@active_trac_domains); |
1639 |
|
|
+ unless ($msg eq "OK") |
1640 |
|
|
+ { |
1641 |
|
|
+ return $fm->error($msg); |
1642 |
|
|
+ } |
1643 |
|
|
+ |
1644 |
|
|
+ my $domain_list; |
1645 |
|
|
+ foreach my $domain (@active_trac_domains) { |
1646 |
|
|
+ if ($domain_list) { |
1647 |
|
|
+ $domain_list .= "," . $domain; |
1648 |
|
|
+ } else { |
1649 |
|
|
+ $domain_list = $domain; |
1650 |
|
|
+ } |
1651 |
|
|
+ } |
1652 |
|
|
+ |
1653 |
|
|
+ # Setup Group List |
1654 |
|
|
+ # ================ |
1655 |
|
|
+ |
1656 |
|
|
+ my @groups = $fm->cgi->param('tracGroups'); |
1657 |
|
|
+ |
1658 |
|
|
+ my $group_list; |
1659 |
|
|
+ foreach my $group (@groups) { |
1660 |
|
|
+ if ($group_list) { |
1661 |
|
|
+ $group_list .= "," . $group; |
1662 |
|
|
+ } else { |
1663 |
|
|
+ $group_list = $group; |
1664 |
|
|
+ } |
1665 |
|
|
+ } |
1666 |
|
|
+ |
1667 |
|
|
+ # Setup User List |
1668 |
|
|
+ # =============== |
1669 |
|
|
+ |
1670 |
|
|
+ my @users = $fm->cgi->param('tracUsers'); |
1671 |
|
|
+ |
1672 |
|
|
+ my $user_list; |
1673 |
|
|
+ foreach my $user (@users) { |
1674 |
|
|
+ if ($user_list) { |
1675 |
|
|
+ $user_list .= "," . $user; |
1676 |
|
|
+ } else { |
1677 |
|
|
+ $user_list = $user; |
1678 |
|
|
+ } |
1679 |
|
|
+ } |
1680 |
|
|
+ |
1681 |
|
|
+ # Update Database |
1682 |
|
|
+ # =============== |
1683 |
|
|
+ |
1684 |
|
|
+ if (my $acct = $AccountsDB->get($name)) { |
1685 |
|
|
+ if ($acct->prop('type') eq 'trac') { |
1686 |
|
|
+ |
1687 |
|
|
+ $acct->merge_props( |
1688 |
|
|
+ Description => $fm->cgi->param('tracDescription'), |
1689 |
|
|
+ Repository => $fm->cgi->param('tracRepository'), |
1690 |
|
|
+ RepositoryPath => $fm->cgi->param('tracRepositoryPath'), |
1691 |
|
|
+ Domains => $domain_list, |
1692 |
|
|
+ Groups => $group_list, |
1693 |
|
|
+ Users => $user_list, |
1694 |
|
|
+ Access => $fm->cgi->param('tracAccess'), |
1695 |
|
|
+ type => 'trac', |
1696 |
|
|
+ ); |
1697 |
|
|
+ |
1698 |
|
|
+ # Untaint $name before use in system() |
1699 |
|
|
+ $name =~ /(.+)/; $name = $1; |
1700 |
|
|
+ |
1701 |
|
|
+ $fm->clear_params(); |
1702 |
|
|
+ |
1703 |
|
|
+ if (system ("/sbin/e-smith/signal-event", "trac-project-modify", $name) == 0) |
1704 |
|
|
+ { |
1705 |
|
|
+ $fm->success("SUCCESSFULLY_MODIFIED_TRAC_PROJECT"); |
1706 |
|
|
+ } else { |
1707 |
|
|
+ $fm->error("ERROR_WHILE_MODIFYING_TRAC_PROJECT"); |
1708 |
|
|
+ } |
1709 |
|
|
+ } else { |
1710 |
|
|
+ $fm->error('CANT_FIND_TRAC_PROJECT'); |
1711 |
|
|
+ } |
1712 |
|
|
+ } else { |
1713 |
|
|
+ $fm->error('CANT_FIND_TRAC_PROJECT'); |
1714 |
|
|
+ } |
1715 |
|
|
+} |
1716 |
|
|
+ |
1717 |
|
|
+=head2 remove_trac_project() |
1718 |
|
|
+ |
1719 |
|
|
+Handle the remove event for the trac project environment |
1720 |
|
|
+ |
1721 |
|
|
+=cut |
1722 |
|
|
+ |
1723 |
|
|
+sub remove_trac_project { |
1724 |
|
|
+ |
1725 |
|
|
+ my $fm = shift; |
1726 |
|
|
+ |
1727 |
|
|
+ my $name = $fm->cgi->param('tracName'); |
1728 |
|
|
+ if (my $acct = $AccountsDB->get($name)) { |
1729 |
|
|
+ if ($acct->prop('type') eq 'trac') { |
1730 |
|
|
+ $acct->set_prop('type', 'trac-deleted'); |
1731 |
|
|
+ |
1732 |
|
|
+ # Untaint $name before use in system() |
1733 |
|
|
+ $name =~ /(.+)/; $name = $1; |
1734 |
|
|
+ if (system ("/sbin/e-smith/signal-event", "trac-project-delete", $name) == 0) { |
1735 |
|
|
+ $fm ->success("SUCCESSFULLY_DELETED_TRAC_PROJECT"); |
1736 |
|
|
+ $acct->delete(); |
1737 |
|
|
+ } else { |
1738 |
|
|
+ $fm ->error("ERROR_WHILE_DELETING_TRAC_PROJECT"); |
1739 |
|
|
+ } |
1740 |
|
|
+ } else { |
1741 |
|
|
+ $fm->error('CANT_FIND_TRAC_PROJECT'); |
1742 |
|
|
+ } |
1743 |
|
|
+ |
1744 |
|
|
+ } else { |
1745 |
|
|
+ $fm->error('CANT_FIND_TRAC_PROJECT'); |
1746 |
|
|
+ } |
1747 |
|
|
+ $fm->wherenext('First'); |
1748 |
|
|
+} |
1749 |
|
|
+ |
1750 |
|
|
+=head1 VALIDATION ROUTINES |
1751 |
|
|
+ |
1752 |
|
|
+=head2 max_trac_project_name_length() |
1753 |
|
|
+ |
1754 |
|
|
+Checks the length of a given trac project environment name against the |
1755 |
|
|
+maximum set in the maxTracNameLength record of the configuration database. |
1756 |
|
|
+Defaults to a maximum length of $self->{defaultMaxLength} if nothing is |
1757 |
|
|
+set in the config db. |
1758 |
|
|
+ |
1759 |
|
|
+=cut |
1760 |
|
|
+ |
1761 |
|
|
+sub max_trac_project_name_length { |
1762 |
|
|
+ my ($fm, $data) = @_; |
1763 |
|
|
+ |
1764 |
|
|
+ $ConfigDB->reload(); |
1765 |
|
|
+ my $max; |
1766 |
|
|
+ if (my $max_record = $ConfigDB->get('maxTracNameLength')) { |
1767 |
|
|
+ $max = $max_record->value(); |
1768 |
|
|
+ } |
1769 |
|
|
+ |
1770 |
|
|
+ if (length($data) <= $max) { |
1771 |
|
|
+ return "OK"; |
1772 |
|
|
+ } else { |
1773 |
|
|
+ return $fm->localise("MAX_TRAC_NAME_LENGTH_ERROR", |
1774 |
|
|
+ {acctName => $data, |
1775 |
|
|
+ maxRepositoryNameLength => $max, |
1776 |
|
|
+ maxLength => $max}); |
1777 |
|
|
+ } |
1778 |
|
|
+} |
1779 |
|
|
+ |
1780 |
|
|
+=head2 getExtraParams() |
1781 |
|
|
+ |
1782 |
|
|
+Sets variables used in the lexicon to their required values. |
1783 |
|
|
+ |
1784 |
|
|
+=cut |
1785 |
|
|
+ |
1786 |
|
|
+sub getExtraParams { |
1787 |
|
|
+ |
1788 |
|
|
+ my $fm = shift; |
1789 |
|
|
+ my $TracProjectName = $fm->cgi->param('tracName'); |
1790 |
|
|
+ my $TracProjectDescription = ''; |
1791 |
|
|
+ my $maxLength = $ConfigDB->get('maxTracNameLength'); |
1792 |
|
|
+ |
1793 |
|
|
+ if ($TracProjectName) |
1794 |
|
|
+ { |
1795 |
|
|
+ my $TracAccount = $AccountsDB->get($TracProjectName); |
1796 |
|
|
+ if ($TracAccount) |
1797 |
|
|
+ { |
1798 |
|
|
+ $TracProjectDescription = $TracAccount->prop('Description'); |
1799 |
|
|
+ } |
1800 |
|
|
+ } |
1801 |
|
|
+ |
1802 |
|
|
+ return (name => $TracProjectName, |
1803 |
|
|
+ description => $TracProjectDescription, |
1804 |
|
|
+ maxLength => $maxLength); |
1805 |
|
|
+} |
1806 |
|
|
+ |
1807 |
|
|
+=head2 validate_name() |
1808 |
|
|
+ |
1809 |
|
|
+Checks that the name supplied does not contain any unacceptable chars. |
1810 |
|
|
+Returns OK on success or a localised error message otherwise. |
1811 |
|
|
+ |
1812 |
|
|
+=cut |
1813 |
|
|
+ |
1814 |
|
|
+sub validate_name { |
1815 |
|
|
+ |
1816 |
|
|
+ my ($fm, $tracName) = @_; |
1817 |
|
|
+ |
1818 |
|
|
+ unless ($tracName =~ /^([a-z][\_\.\-a-z0-9]*)$/) |
1819 |
|
|
+ { |
1820 |
|
|
+ return $fm->localise('TRAC_PROJECT_NAME_HAS_INVALID_CHARS', {tracName => $tracName}); |
1821 |
|
|
+ } |
1822 |
|
|
+ |
1823 |
|
|
+ return "OK"; |
1824 |
|
|
+} |
1825 |
|
|
+ |
1826 |
|
|
+=head2 conflict_check() |
1827 |
|
|
+ |
1828 |
|
|
+Check the proposed name for clashes with existing pseudonyms or other |
1829 |
|
|
+accounts of any type. |
1830 |
|
|
+ |
1831 |
|
|
+=cut |
1832 |
|
|
+ |
1833 |
|
|
+sub conflict_check { |
1834 |
|
|
+ |
1835 |
|
|
+ my ($fm, $name) = @_; |
1836 |
|
|
+ my $rec = $AccountsDB->get($name); |
1837 |
|
|
+ |
1838 |
|
|
+ my $type; |
1839 |
|
|
+ if (defined $rec) |
1840 |
|
|
+ { |
1841 |
|
|
+ my $type = $rec->prop('type'); |
1842 |
|
|
+ if ($type eq "pseudonym") |
1843 |
|
|
+ { |
1844 |
|
|
+ my $acct = $rec->prop("Account"); |
1845 |
|
|
+ my $acct_type = $AccountsDB->get($acct)->prop('type'); |
1846 |
|
|
+ |
1847 |
|
|
+ return $fm->localise('ACCT_CLASHES_WITH_PSEUDONYM', |
1848 |
|
|
+ {acctName => $name, acctType => $acct_type, acct => $acct}); |
1849 |
|
|
+ } |
1850 |
|
|
+ } |
1851 |
|
|
+ elsif (defined getpwnam($name) || defined getgrnam($name)) |
1852 |
|
|
+ { |
1853 |
|
|
+ $type = 'system'; |
1854 |
|
|
+ } |
1855 |
|
|
+ else |
1856 |
|
|
+ { |
1857 |
|
|
+ # No account record and no account |
1858 |
|
|
+ return 'OK'; |
1859 |
|
|
+ } |
1860 |
|
|
+ return $fm->localise('ACCOUNT_EXISTS', |
1861 |
|
|
+ {acctName => $name, acctType => $type}); |
1862 |
|
|
+} |
1863 |
|
|
+ |
1864 |
|
|
+=head2 validate_trac_has_domains() |
1865 |
|
|
+ |
1866 |
|
|
+Validates that the cgi parameter DOMAINS is an array with at least one entry |
1867 |
|
|
+Returns OK if true. Otherwise, returns NO_DOMAINS |
1868 |
|
|
+ |
1869 |
|
|
+=cut |
1870 |
|
|
+ |
1871 |
|
|
+sub validate_trac_has_domains { |
1872 |
|
|
+ |
1873 |
|
|
+ my $fm = shift; |
1874 |
|
|
+ my @domains = @_; |
1875 |
|
|
+ |
1876 |
|
|
+ my $count = @domains; |
1877 |
|
|
+ |
1878 |
|
|
+ if ( $count == 0 ) { |
1879 |
|
|
+ return ('NO_DOMAINS'); |
1880 |
|
|
+ } |
1881 |
|
|
+ else { |
1882 |
|
|
+ return ('OK'); |
1883 |
|
|
+ } |
1884 |
|
|
+} |
1885 |
|
|
+ |
1886 |
|
|
+=head2 clear_params() |
1887 |
|
|
+ |
1888 |
|
|
+This method clears-out the parameters used in form submission so that they are |
1889 |
|
|
+not inadvertenly picked-up where they should not be. |
1890 |
|
|
+ |
1891 |
|
|
+=cut |
1892 |
|
|
+ |
1893 |
|
|
+sub clear_params { |
1894 |
|
|
+ |
1895 |
|
|
+ my $fm = shift; |
1896 |
|
|
+ my $q = $fm->{cgi}; |
1897 |
|
|
+ |
1898 |
|
|
+ # Don't delete tracName here as we need in the next page for |
1899 |
|
|
+ # status messages. |
1900 |
|
|
+ |
1901 |
|
|
+ $q->delete('tracDescription'); |
1902 |
|
|
+ $q->delete('tracRepository'); |
1903 |
|
|
+ $q->delete('tracRepositoryPath'); |
1904 |
|
|
+ $q->delete('tracDomains'); |
1905 |
|
|
+ $q->delete('tracGroups'); |
1906 |
|
|
+ $q->delete('tracUsers'); |
1907 |
|
|
+ $q->delete('tracAccess'); |
1908 |
|
|
+ |
1909 |
|
|
+} |
1910 |
|
|
+ |
1911 |
|
|
+1; |
1912 |
|
|
--- smeserver-trac-0.4/root/etc/e-smith/locale/es/etc/e-smith/web/functions/trac.add2general 2008-04-26 16:17:44.000000000 +0200 |
1913 |
|
|
+++ smeserver-trac-0.4/root/etc/e-smith/locale/es/etc/e-smith/web/functions/trac 2008-04-26 16:43:13.000000000 +0200 |
1914 |
|
|
@@ -161,12 +161,12 @@ |
1915 |
|
|
</entry> |
1916 |
|
|
|
1917 |
|
|
<entry> |
1918 |
|
|
- <base>TRAC_TABLE_HEADER_REPOSITORY</base> |
1919 |
|
|
+ <base>REPOSITORY</base> |
1920 |
|
|
<trans>Repositorio</trans> |
1921 |
|
|
</entry> |
1922 |
|
|
|
1923 |
|
|
<entry> |
1924 |
|
|
- <base>TRAC_TABLE_HEADER_PATH</base> |
1925 |
|
|
+ <base>PATH</base> |
1926 |
|
|
<trans>Ruta</trans> |
1927 |
|
|
</entry> |
1928 |
|
|
|
1929 |
|
|
@@ -181,7 +181,7 @@ |
1930 |
|
|
</entry> |
1931 |
|
|
|
1932 |
|
|
<entry> |
1933 |
|
|
- <base>TRAC_ACTION_VIEW</base> |
1934 |
|
|
+ <base>VIEW</base> |
1935 |
|
|
<trans>Ver Proyecto Trac</trans> |
1936 |
|
|
</entry> |
1937 |
|
|
|
1938 |
|
|
--- smeserver-trac-0.4/root/etc/e-smith/locale/sv/etc/e-smith/web/functions/trac.add2general 2008-04-26 16:17:44.000000000 +0200 |
1939 |
|
|
+++ smeserver-trac-0.4/root/etc/e-smith/locale/sv/etc/e-smith/web/functions/trac 2008-04-26 16:46:30.000000000 +0200 |
1940 |
|
|
@@ -161,12 +161,12 @@ |
1941 |
|
|
</entry> |
1942 |
|
|
|
1943 |
|
|
<entry> |
1944 |
|
|
- <base>TRAC_TABLE_HEADER_REPOSITORY</base> |
1945 |
|
|
+ <base>REPOSITORY</base> |
1946 |
|
|
<trans>Förråd</trans> |
1947 |
|
|
</entry> |
1948 |
|
|
|
1949 |
|
|
<entry> |
1950 |
|
|
- <base>TRAC_TABLE_HEADER_PATH</base> |
1951 |
|
|
+ <base>PATH</base> |
1952 |
|
|
<trans>Sökväg</trans> |
1953 |
|
|
</entry> |
1954 |
|
|
|
1955 |
|
|
@@ -181,7 +181,7 @@ |
1956 |
|
|
</entry> |
1957 |
|
|
|
1958 |
|
|
<entry> |
1959 |
|
|
- <base>TRAC_ACTION_VIEW</base> |
1960 |
|
|
+ <base>VIEW</base> |
1961 |
|
|
<trans>Visa Trac-projekt</trans> |
1962 |
|
|
</entry> |
1963 |
|
|
|
1964 |
|
|
--- smeserver-trac-0.4/root/etc/e-smith/locale/de/etc/e-smith/web/functions/trac.add2general 2008-04-26 16:17:44.000000000 +0200 |
1965 |
|
|
+++ smeserver-trac-0.4/root/etc/e-smith/locale/de/etc/e-smith/web/functions/trac 2008-04-26 16:42:09.000000000 +0200 |
1966 |
|
|
@@ -161,12 +161,12 @@ |
1967 |
|
|
</entry> |
1968 |
|
|
|
1969 |
|
|
<entry> |
1970 |
|
|
- <base>TRAC_TABLE_HEADER_REPOSITORY</base> |
1971 |
|
|
+ <base>REPOSITORY</base> |
1972 |
|
|
<trans>Repository</trans> |
1973 |
|
|
</entry> |
1974 |
|
|
|
1975 |
|
|
<entry> |
1976 |
|
|
- <base>TRAC_TABLE_HEADER_PATH</base> |
1977 |
|
|
+ <base>PATH</base> |
1978 |
|
|
<trans>Pfad</trans> |
1979 |
|
|
</entry> |
1980 |
|
|
|
1981 |
|
|
@@ -181,7 +181,7 @@ |
1982 |
|
|
</entry> |
1983 |
|
|
|
1984 |
|
|
<entry> |
1985 |
|
|
- <base>TRAC_ACTION_VIEW</base> |
1986 |
|
|
+ <base>VIEW</base> |
1987 |
|
|
<trans>Trac Projekt ansehen</trans> |
1988 |
|
|
</entry> |
1989 |
|
|
|
1990 |
|
|
--- smeserver-trac-0.4/root/etc/e-smith/locale/id/etc/e-smith/web/functions/trac.add2general 2008-04-26 16:17:44.000000000 +0200 |
1991 |
|
|
+++ smeserver-trac-0.4/root/etc/e-smith/locale/id/etc/e-smith/web/functions/trac 2008-04-26 16:44:24.000000000 +0200 |
1992 |
|
|
@@ -161,12 +161,12 @@ |
1993 |
|
|
</entry> |
1994 |
|
|
|
1995 |
|
|
<entry> |
1996 |
|
|
- <base>TRAC_TABLE_HEADER_REPOSITORY</base> |
1997 |
|
|
+ <base>REPOSITORY</base> |
1998 |
|
|
<trans>Repository</trans> |
1999 |
|
|
</entry> |
2000 |
|
|
|
2001 |
|
|
<entry> |
2002 |
|
|
- <base>TRAC_TABLE_HEADER_PATH</base> |
2003 |
|
|
+ <base>PATH</base> |
2004 |
|
|
<trans>Path</trans> |
2005 |
|
|
</entry> |
2006 |
|
|
|
2007 |
|
|
@@ -181,7 +181,7 @@ |
2008 |
|
|
</entry> |
2009 |
|
|
|
2010 |
|
|
<entry> |
2011 |
|
|
- <base>TRAC_ACTION_VIEW</base> |
2012 |
|
|
+ <base>VIEW</base> |
2013 |
|
|
<trans>View Trac Project</trans> |
2014 |
|
|
</entry> |
2015 |
|
|
|
2016 |
|
|
--- smeserver-trac-0.4/root/etc/e-smith/locale/pt_BR/etc/e-smith/web/functions/trac.add2general 2008-04-26 16:17:44.000000000 +0200 |
2017 |
|
|
+++ smeserver-trac-0.4/root/etc/e-smith/locale/pt_BR/etc/e-smith/web/functions/trac 2008-04-26 16:45:37.000000000 +0200 |
2018 |
|
|
@@ -161,12 +161,12 @@ |
2019 |
|
|
</entry> |
2020 |
|
|
|
2021 |
|
|
<entry> |
2022 |
|
|
- <base>TRAC_TABLE_HEADER_REPOSITORY</base> |
2023 |
|
|
+ <base>REPOSITORY</base> |
2024 |
|
|
<trans>Repositório</trans> |
2025 |
|
|
</entry> |
2026 |
|
|
|
2027 |
|
|
<entry> |
2028 |
|
|
- <base>TRAC_TABLE_HEADER_PATH</base> |
2029 |
|
|
+ <base>PATH</base> |
2030 |
|
|
<trans>Caminho</trans> |
2031 |
|
|
</entry> |
2032 |
|
|
|
2033 |
|
|
@@ -181,7 +181,7 @@ |
2034 |
|
|
</entry> |
2035 |
|
|
|
2036 |
|
|
<entry> |
2037 |
|
|
- <base>TRAC_ACTION_VIEW</base> |
2038 |
|
|
+ <base>VIEW</base> |
2039 |
|
|
<trans>Ver Projeto Trac</trans> |
2040 |
|
|
</entry> |
2041 |
|
|
|
2042 |
|
|
--- smeserver-trac-0.4/root/etc/e-smith/locale/sl/etc/e-smith/web/functions/trac.add2general 2008-04-26 16:17:44.000000000 +0200 |
2043 |
|
|
+++ smeserver-trac-0.4/root/etc/e-smith/locale/sl/etc/e-smith/web/functions/trac 2008-04-26 16:46:07.000000000 +0200 |
2044 |
|
|
@@ -161,12 +161,12 @@ |
2045 |
|
|
</entry> |
2046 |
|
|
|
2047 |
|
|
<entry> |
2048 |
|
|
- <base>TRAC_TABLE_HEADER_REPOSITORY</base> |
2049 |
|
|
+ <base>REPOSITORY</base> |
2050 |
|
|
<trans>Repository</trans> |
2051 |
|
|
</entry> |
2052 |
|
|
|
2053 |
|
|
<entry> |
2054 |
|
|
- <base>TRAC_TABLE_HEADER_PATH</base> |
2055 |
|
|
+ <base>PATH</base> |
2056 |
|
|
<trans>Path</trans> |
2057 |
|
|
</entry> |
2058 |
|
|
|
2059 |
|
|
@@ -181,7 +181,7 @@ |
2060 |
|
|
</entry> |
2061 |
|
|
|
2062 |
|
|
<entry> |
2063 |
|
|
- <base>TRAC_ACTION_VIEW</base> |
2064 |
|
|
+ <base>VIEW</base> |
2065 |
|
|
<trans>View Trac Project</trans> |
2066 |
|
|
</entry> |
2067 |
|
|
|
2068 |
|
|
--- smeserver-trac-0.4/root/etc/e-smith/locale/fr/etc/e-smith/web/functions/trac.add2general 2008-04-26 16:17:44.000000000 +0200 |
2069 |
|
|
+++ smeserver-trac-0.4/root/etc/e-smith/locale/fr/etc/e-smith/web/functions/trac 2008-04-26 16:43:34.000000000 +0200 |
2070 |
|
|
@@ -161,12 +161,12 @@ |
2071 |
|
|
</entry> |
2072 |
|
|
|
2073 |
|
|
<entry> |
2074 |
|
|
- <base>TRAC_TABLE_HEADER_REPOSITORY</base> |
2075 |
|
|
+ <base>REPOSITORY</base> |
2076 |
|
|
<trans>Entrepôt</trans> |
2077 |
|
|
</entry> |
2078 |
|
|
|
2079 |
|
|
<entry> |
2080 |
|
|
- <base>TRAC_TABLE_HEADER_PATH</base> |
2081 |
|
|
+ <base>PATH</base> |
2082 |
|
|
<trans>Sentier</trans> |
2083 |
|
|
</entry> |
2084 |
|
|
|
2085 |
|
|
@@ -181,7 +181,7 @@ |
2086 |
|
|
</entry> |
2087 |
|
|
|
2088 |
|
|
<entry> |
2089 |
|
|
- <base>TRAC_ACTION_VIEW</base> |
2090 |
|
|
+ <base>VIEW</base> |
2091 |
|
|
<trans>Vue</trans> |
2092 |
|
|
</entry> |
2093 |
|
|
|
2094 |
|
|
--- smeserver-trac-0.4/root/etc/e-smith/locale/nl/etc/e-smith/web/functions/trac.add2general 2008-04-26 16:17:44.000000000 +0200 |
2095 |
|
|
+++ smeserver-trac-0.4/root/etc/e-smith/locale/nl/etc/e-smith/web/functions/trac 2008-04-26 16:45:14.000000000 +0200 |
2096 |
|
|
@@ -161,12 +161,12 @@ |
2097 |
|
|
</entry> |
2098 |
|
|
|
2099 |
|
|
<entry> |
2100 |
|
|
- <base>TRAC_TABLE_HEADER_REPOSITORY</base> |
2101 |
|
|
+ <base>REPOSITORY</base> |
2102 |
|
|
<trans>Subversion bewaarplaats</trans> |
2103 |
|
|
</entry> |
2104 |
|
|
|
2105 |
|
|
<entry> |
2106 |
|
|
- <base>TRAC_TABLE_HEADER_PATH</base> |
2107 |
|
|
+ <base>PATH</base> |
2108 |
|
|
<trans>Pad</trans> |
2109 |
|
|
</entry> |
2110 |
|
|
|
2111 |
|
|
@@ -181,7 +181,7 @@ |
2112 |
|
|
</entry> |
2113 |
|
|
|
2114 |
|
|
<entry> |
2115 |
|
|
- <base>TRAC_ACTION_VIEW</base> |
2116 |
|
|
+ <base>VIEW</base> |
2117 |
|
|
<trans>Bekijk Trac project</trans> |
2118 |
|
|
</entry> |
2119 |
|
|
|
2120 |
|
|
--- smeserver-trac-0.4/root/etc/e-smith/locale/hu/etc/e-smith/web/functions/trac.add2general 2008-04-26 16:17:44.000000000 +0200 |
2121 |
|
|
+++ smeserver-trac-0.4/root/etc/e-smith/locale/hu/etc/e-smith/web/functions/trac 2008-04-26 16:43:59.000000000 +0200 |
2122 |
|
|
@@ -161,12 +161,12 @@ |
2123 |
|
|
</entry> |
2124 |
|
|
|
2125 |
|
|
<entry> |
2126 |
|
|
- <base>TRAC_TABLE_HEADER_REPOSITORY</base> |
2127 |
|
|
+ <base>REPOSITORY</base> |
2128 |
|
|
<trans>Repository</trans> |
2129 |
|
|
</entry> |
2130 |
|
|
|
2131 |
|
|
<entry> |
2132 |
|
|
- <base>TRAC_TABLE_HEADER_PATH</base> |
2133 |
|
|
+ <base>PATH</base> |
2134 |
|
|
<trans>Path</trans> |
2135 |
|
|
</entry> |
2136 |
|
|
|
2137 |
|
|
@@ -181,7 +181,7 @@ |
2138 |
|
|
</entry> |
2139 |
|
|
|
2140 |
|
|
<entry> |
2141 |
|
|
- <base>TRAC_ACTION_VIEW</base> |
2142 |
|
|
+ <base>VIEW</base> |
2143 |
|
|
<trans>View Trac Project</trans> |
2144 |
|
|
</entry> |
2145 |
|
|
|
2146 |
|
|
--- smeserver-trac-0.4/root/etc/e-smith/locale/el/etc/e-smith/web/functions/trac.add2general 2008-04-26 16:17:44.000000000 +0200 |
2147 |
|
|
+++ smeserver-trac-0.4/root/etc/e-smith/locale/el/etc/e-smith/web/functions/trac 2008-04-26 16:42:47.000000000 +0200 |
2148 |
|
|
@@ -161,12 +161,12 @@ |
2149 |
|
|
</entry> |
2150 |
|
|
|
2151 |
|
|
<entry> |
2152 |
|
|
- <base>TRAC_TABLE_HEADER_REPOSITORY</base> |
2153 |
|
|
+ <base>REPOSITORY</base> |
2154 |
|
|
<trans>Repository</trans> |
2155 |
|
|
</entry> |
2156 |
|
|
|
2157 |
|
|
<entry> |
2158 |
|
|
- <base>TRAC_TABLE_HEADER_PATH</base> |
2159 |
|
|
+ <base>PATH</base> |
2160 |
|
|
<trans>Path</trans> |
2161 |
|
|
</entry> |
2162 |
|
|
|
2163 |
|
|
@@ -181,7 +181,7 @@ |
2164 |
|
|
</entry> |
2165 |
|
|
|
2166 |
|
|
<entry> |
2167 |
|
|
- <base>TRAC_ACTION_VIEW</base> |
2168 |
|
|
+ <base>VIEW</base> |
2169 |
|
|
<trans>View Trac Project</trans> |
2170 |
|
|
</entry> |
2171 |
|
|
|
2172 |
|
|
--- smeserver-trac-0.4/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/trac.add2general 2008-04-26 16:17:44.000000000 +0200 |
2173 |
|
|
+++ smeserver-trac-0.4/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/trac 2008-04-26 16:39:18.000000000 +0200 |
2174 |
|
|
@@ -129,20 +129,6 @@ |
2175 |
|
|
</entry> |
2176 |
|
|
|
2177 |
|
|
<entry> |
2178 |
|
|
- <base>TRAC_FIELD_PROJECT_DESCRIPTION</base> |
2179 |
|
|
- <trans> |
2180 |
|
|
- Description |
2181 |
|
|
- </trans> |
2182 |
|
|
- </entry> |
2183 |
|
|
- |
2184 |
|
|
- <entry> |
2185 |
|
|
- <base>TRAC_FIELD_DOMAIN</base> |
2186 |
|
|
- <trans> |
2187 |
|
|
- Domain |
2188 |
|
|
- </trans> |
2189 |
|
|
- </entry> |
2190 |
|
|
- |
2191 |
|
|
- <entry> |
2192 |
|
|
<base>TRAC_FIELD_DOMAIN_DESCRIPTION</base> |
2193 |
|
|
<trans> |
2194 |
|
|
When you have more than one domain configured on this server, you can |
2195 |
|
|
@@ -152,13 +138,6 @@ |
2196 |
|
|
</entry> |
2197 |
|
|
|
2198 |
|
|
<entry> |
2199 |
|
|
- <base>TRAC_FIELD_DOMAINS</base> |
2200 |
|
|
- <trans> |
2201 |
|
|
- Domains |
2202 |
|
|
- </trans> |
2203 |
|
|
- </entry> |
2204 |
|
|
- |
2205 |
|
|
- <entry> |
2206 |
|
|
<base>TRAC_FIELD_DOMAINS_DESCRIPTION</base> |
2207 |
|
|
<trans> |
2208 |
|
|
There are multiple domains configured on this server. You can select |
2209 |
|
|
@@ -241,90 +220,29 @@ |
2210 |
|
|
</entry> |
2211 |
|
|
|
2212 |
|
|
<entry> |
2213 |
|
|
- <base>TRAC_TABLE_HEADER_NAME</base> |
2214 |
|
|
- <trans> |
2215 |
|
|
- Name |
2216 |
|
|
- </trans> |
2217 |
|
|
- </entry> |
2218 |
|
|
- |
2219 |
|
|
- <entry> |
2220 |
|
|
- <base>TRAC_TABLE_HEADER_DESCRIPTION</base> |
2221 |
|
|
- <trans> |
2222 |
|
|
- Description |
2223 |
|
|
- </trans> |
2224 |
|
|
- </entry> |
2225 |
|
|
- |
2226 |
|
|
- <entry> |
2227 |
|
|
- <base>TRAC_TABLE_HEADER_DOMAINS</base> |
2228 |
|
|
- <trans> |
2229 |
|
|
- Domains |
2230 |
|
|
- </trans> |
2231 |
|
|
- </entry> |
2232 |
|
|
- |
2233 |
|
|
- <entry> |
2234 |
|
|
- <base>TRAC_TABLE_HEADER_REPOSITORY</base> |
2235 |
|
|
+ <base>REPOSITORY</base> |
2236 |
|
|
<trans> |
2237 |
|
|
Repository |
2238 |
|
|
</trans> |
2239 |
|
|
</entry> |
2240 |
|
|
|
2241 |
|
|
<entry> |
2242 |
|
|
- <base>TRAC_TABLE_HEADER_PATH</base> |
2243 |
|
|
+ <base>PATH</base> |
2244 |
|
|
<trans> |
2245 |
|
|
Path |
2246 |
|
|
</trans> |
2247 |
|
|
</entry> |
2248 |
|
|
|
2249 |
|
|
<entry> |
2250 |
|
|
- <base>TRAC_TABLE_HEADER_ACCESS</base> |
2251 |
|
|
- <trans> |
2252 |
|
|
- Access |
2253 |
|
|
- </trans> |
2254 |
|
|
- </entry> |
2255 |
|
|
|
2256 |
|
|
<entry> |
2257 |
|
|
- <base>TRAC_TABLE_HEADER_ACTION</base> |
2258 |
|
|
- <trans> |
2259 |
|
|
- Action |
2260 |
|
|
- </trans> |
2261 |
|
|
- </entry> |
2262 |
|
|
- |
2263 |
|
|
- <entry> |
2264 |
|
|
- <base>TRAC_ACTION_VIEW</base> |
2265 |
|
|
+ <base>VIEW</base> |
2266 |
|
|
<trans> |
2267 |
|
|
View Trac Project |
2268 |
|
|
</trans> |
2269 |
|
|
</entry> |
2270 |
|
|
|
2271 |
|
|
<entry> |
2272 |
|
|
- <base>TRAC_ACTION_MODIFY</base> |
2273 |
|
|
- <trans> |
2274 |
|
|
- Modify |
2275 |
|
|
- </trans> |
2276 |
|
|
- </entry> |
2277 |
|
|
- |
2278 |
|
|
- <entry> |
2279 |
|
|
- <base>TRAC_ACTION_REMOVE</base> |
2280 |
|
|
- <trans> |
2281 |
|
|
- Remove |
2282 |
|
|
- </trans> |
2283 |
|
|
- </entry> |
2284 |
|
|
- |
2285 |
|
|
- <entry> |
2286 |
|
|
- <base>TRAC_ACTION_BACKUP</base> |
2287 |
|
|
- <trans> |
2288 |
|
|
- Backup |
2289 |
|
|
- </trans> |
2290 |
|
|
- </entry> |
2291 |
|
|
- |
2292 |
|
|
- <entry> |
2293 |
|
|
- <base>TRAC_ACTION_RESTORE</base> |
2294 |
|
|
- <trans> |
2295 |
|
|
- Restore |
2296 |
|
|
- </trans> |
2297 |
|
|
- </entry> |
2298 |
|
|
- |
2299 |
|
|
- <entry> |
2300 |
|
|
<base>ERROR_WHILE_CREATING_TRAC_PROJECT</base> |
2301 |
|
|
<trans> |
2302 |
|
|
An error occurred while creating the Trac project environment. |
2303 |
|
|
@@ -364,13 +282,6 @@ |
2304 |
|
|
</entry> |
2305 |
|
|
|
2306 |
|
|
<entry> |
2307 |
|
|
- <base>DESCRIPTION_ERROR</base> |
2308 |
|
|
- <trans> |
2309 |
|
|
- Unexpected characters in description. |
2310 |
|
|
- </trans> |
2311 |
|
|
- </entry> |
2312 |
|
|
- |
2313 |
|
|
- <entry> |
2314 |
|
|
<base>NO_DOMAINS</base> |
2315 |
|
|
<trans> |
2316 |
|
|
There are no domains selected for the Trac project environment. |
2317 |
|
|
@@ -481,15 +392,5 @@ |
2318 |
|
|
<trans>Local Network Only</trans> |
2319 |
|
|
</entry> |
2320 |
|
|
|
2321 |
|
|
- <entry> |
2322 |
|
|
- <base>YES</base> |
2323 |
|
|
- <trans>Yes</trans> |
2324 |
|
|
- </entry> |
2325 |
|
|
- |
2326 |
|
|
- <entry> |
2327 |
|
|
- <base>NO</base> |
2328 |
|
|
- <trans>No</trans> |
2329 |
|
|
- </entry> |
2330 |
|
|
- |
2331 |
|
|
</lexicon> |
2332 |
|
|
|
2333 |
|
|
--- smeserver-trac-0.4/root/etc/e-smith/locale/it/etc/e-smith/web/functions/trac.add2general 2008-04-26 16:17:44.000000000 +0200 |
2334 |
|
|
+++ smeserver-trac-0.4/root/etc/e-smith/locale/it/etc/e-smith/web/functions/trac 2008-04-26 16:44:51.000000000 +0200 |
2335 |
|
|
@@ -161,12 +161,12 @@ |
2336 |
|
|
</entry> |
2337 |
|
|
|
2338 |
|
|
<entry> |
2339 |
|
|
- <base>TRAC_TABLE_HEADER_REPOSITORY</base> |
2340 |
|
|
+ <base>REPOSITORY</base> |
2341 |
|
|
<trans>Repository</trans> |
2342 |
|
|
</entry> |
2343 |
|
|
|
2344 |
|
|
<entry> |
2345 |
|
|
- <base>TRAC_TABLE_HEADER_PATH</base> |
2346 |
|
|
+ <base>PATH</base> |
2347 |
|
|
<trans>Path</trans> |
2348 |
|
|
</entry> |
2349 |
|
|
|
2350 |
|
|
@@ -181,7 +181,7 @@ |
2351 |
|
|
</entry> |
2352 |
|
|
|
2353 |
|
|
<entry> |
2354 |
|
|
- <base>TRAC_ACTION_VIEW</base> |
2355 |
|
|
+ <base>VIEW</base> |
2356 |
|
|
<trans>View Trac Project</trans> |
2357 |
|
|
</entry> |
2358 |
|
|
|
2359 |
|
|
--- smeserver-trac-0.4/root/etc/e-smith/locale/da/etc/e-smith/web/functions/trac.add2general 2008-04-26 16:17:44.000000000 +0200 |
2360 |
|
|
+++ smeserver-trac-0.4/root/etc/e-smith/locale/da/etc/e-smith/web/functions/trac 2008-04-26 16:40:46.000000000 +0200 |
2361 |
|
|
@@ -161,12 +161,12 @@ |
2362 |
|
|
</entry> |
2363 |
|
|
|
2364 |
|
|
<entry> |
2365 |
|
|
- <base>TRAC_TABLE_HEADER_REPOSITORY</base> |
2366 |
|
|
+ <base>REPOSITORY</base> |
2367 |
|
|
<trans>Lager(repository)</trans> |
2368 |
|
|
</entry> |
2369 |
|
|
|
2370 |
|
|
<entry> |
2371 |
|
|
- <base>TRAC_TABLE_HEADER_PATH</base> |
2372 |
|
|
+ <base>PATH</base> |
2373 |
|
|
<trans>Sti</trans> |
2374 |
|
|
</entry> |
2375 |
|
|
|
2376 |
|
|
@@ -181,7 +181,7 @@ |
2377 |
|
|
</entry> |
2378 |
|
|
|
2379 |
|
|
<entry> |
2380 |
|
|
- <base>TRAC_ACTION_VIEW</base> |
2381 |
|
|
+ <base>VIEW</base> |
2382 |
|
|
<trans>Vis Trac projekt</trans> |
2383 |
|
|
</entry> |
2384 |
|
|
|
2385 |
|
|
--- smeserver-trac-0.4/root/etc/e-smith/web/functions/trac.add2general 2007-04-27 04:42:10.000000000 +0200 |
2386 |
|
|
+++ smeserver-trac-0.4/root/etc/e-smith/web/functions/trac 2008-04-26 16:30:23.000000000 +0200 |
2387 |
|
|
@@ -1,235 +1,235 @@ |
2388 |
|
|
-#!/usr/bin/perl -wT |
2389 |
|
|
-# vim: ft=xml: |
2390 |
|
|
-# $Id: trac 69 2007-03-25 13:20:24Z marco $ |
2391 |
|
|
- |
2392 |
|
|
-#---------------------------------------------------------------------- |
2393 |
|
|
-# heading : Collaboration |
2394 |
|
|
-# description : TRAC_NAVIGATION_DESCRIPTION |
2395 |
|
|
-# navigation : 2650 2650 |
2396 |
|
|
-#---------------------------------------------------------------------- |
2397 |
|
|
- |
2398 |
|
|
-use strict; |
2399 |
|
|
-use warnings; |
2400 |
|
|
-use esmith::FormMagick::Panel::trac; |
2401 |
|
|
-my $f = esmith::FormMagick::Panel::trac->new(); |
2402 |
|
|
-$f->display(); |
2403 |
|
|
- |
2404 |
|
|
-=pod |
2405 |
|
|
- |
2406 |
|
|
-=head1 NAME |
2407 |
|
|
- |
2408 |
|
|
-Trac project environment -- add/remove/manage trac project environments |
2409 |
|
|
- |
2410 |
|
|
-=head2 DESCRIPTION |
2411 |
|
|
- |
2412 |
|
|
-This screen allows the administrator to manage Trac environments for the subversion repositories. |
2413 |
|
|
- |
2414 |
|
|
-=begin testing |
2415 |
|
|
- |
2416 |
|
|
-use esmith::FormMagick::Tester; |
2417 |
|
|
-use esmith::TestUtils; |
2418 |
|
|
-use esmith::TestUtils; |
2419 |
|
|
-use esmith::ConfigDB; |
2420 |
|
|
-use esmith::AccountsDB; |
2421 |
|
|
-my $panel = $Original_File; |
2422 |
|
|
-my $ua = esmith::FormMagick::Tester->new(); |
2423 |
|
|
- |
2424 |
|
|
-my $c = esmith::ConfigDB->open(); |
2425 |
|
|
-my $a = esmith::AccountsDB->open(); |
2426 |
|
|
- |
2427 |
|
|
-is (mode($panel), '4750', "Check permissions on script"); |
2428 |
|
|
-ok ($ua->get_panel($panel), "ABOUT TO RUN L10N TESTS"); |
2429 |
|
|
-is ($ua->{status}, 200, "200 OK"); |
2430 |
|
|
-like($ua->{content}, qr/FORM_TITLE/, "Saw untranslated form title"); |
2431 |
|
|
-ok ($ua->set_language("en"), "Set language to English"); |
2432 |
|
|
-ok ($ua->get_panel($panel), "Get panel"); |
2433 |
|
|
-is ($ua->{status}, 200, "200 OK"); |
2434 |
|
|
- |
2435 |
|
|
-ok ($ua->get_panel($panel), "ABOUT TO TEST CREATING TRAC ENVIRONMENT"); |
2436 |
|
|
-ok ($ua->follow("Click here"), "Follow 'create repository' link"); |
2437 |
|
|
-is ($ua->{status}, 200, "200 OK"); |
2438 |
|
|
-like($ua->{content}, qr/Create a new Trac environment/, "Saw page title"); |
2439 |
|
|
-like($ua->{content}, qr/Brief description/, "Saw description field"); |
2440 |
|
|
-like($ua->{content}, qr/Add/, "Saw add button"); |
2441 |
|
|
- |
2442 |
|
|
-SKIP: { |
2443 |
|
|
- |
2444 |
|
|
- skip 10, "Unsafe!" unless destruction_ok(); |
2445 |
|
|
- |
2446 |
|
|
- ok ($ua->follow("Click here"), "ACTUALLY ADDING A TRAC ENVIRONMENT"); |
2447 |
|
|
- $ua->field(); |
2448 |
|
|
- $ua->click("Add"); |
2449 |
|
|
- like($ua->{content}, qr/Successfully added Trac environment/, "Saw success message"); |
2450 |
|
|
- |
2451 |
|
|
- ok ($ua->follow("Remove"), "REMOVING TRAC ENVIRONMENT"); |
2452 |
|
|
- like($ua->{content}, qr/Are you sure/, "Saw confirmation message"); |
2453 |
|
|
- $ua->click("Remove"); |
2454 |
|
|
- like($ua->{content}, qr/Successfully deleted/, "Saw success message"); |
2455 |
|
|
-} |
2456 |
|
|
- |
2457 |
|
|
-=end testing |
2458 |
|
|
- |
2459 |
|
|
-=cut |
2460 |
|
|
- |
2461 |
|
|
-__DATA__ |
2462 |
|
|
-<form |
2463 |
|
|
- title="TRAC_FORM_TITLE" |
2464 |
|
|
- header="/etc/e-smith/web/common/head.tmpl" |
2465 |
|
|
- footer="/etc/e-smith/web/common/foot.tmpl"> |
2466 |
|
|
- |
2467 |
|
|
- <!-- page 0 --> |
2468 |
|
|
- <page |
2469 |
|
|
- name="First" |
2470 |
|
|
- pre-event="print_status_message()"> |
2471 |
|
|
- |
2472 |
|
|
- <description>TRAC_FORM_DESCRIPTION</description> |
2473 |
|
|
- |
2474 |
|
|
- <subroutine src="show_trac_projects()" /> |
2475 |
|
|
- </page> |
2476 |
|
|
- |
2477 |
|
|
- <!-- page 1 --> |
2478 |
|
|
- <page |
2479 |
|
|
- name="Create" |
2480 |
|
|
- pre-event="turn_off_buttons()" |
2481 |
|
|
- post-event="handle_trac_projects()"> |
2482 |
|
|
- |
2483 |
|
|
- <title>TRAC_FORM_ADD_TITLE</title> |
2484 |
|
|
- |
2485 |
|
|
- <description>TRAC_FORM_ADD_DESCRIPTION</description> |
2486 |
|
|
- |
2487 |
|
|
- <subroutine src="print_trac_field_name()" /> |
2488 |
|
|
- |
2489 |
|
|
- <field |
2490 |
|
|
- type="text" |
2491 |
|
|
- id="tracDescription" |
2492 |
|
|
- validation="validate_description"> |
2493 |
|
|
- <label>TRAC_FIELD_PROJECT_DESCRIPTION</label> |
2494 |
|
|
- </field> |
2495 |
|
|
- |
2496 |
|
|
- <field |
2497 |
|
|
- type="select" |
2498 |
|
|
- id="tracRepository" |
2499 |
|
|
- options="repositories_list()"> |
2500 |
|
|
- <description>TRAC_FIELD_REPOSITORY_NAME_DESCRIPTION</description> |
2501 |
|
|
- <label>TRAC_FIELD_REPOSITORY_NAME</label> |
2502 |
|
|
- </field> |
2503 |
|
|
- |
2504 |
|
|
- <field |
2505 |
|
|
- type="text" |
2506 |
|
|
- id="tracRepositoryPath"> |
2507 |
|
|
- <description>TRAC_FIELD_REPOSITORY_PATH_DESCRIPTION</description> |
2508 |
|
|
- <label>TRAC_FIELD_REPOSITORY_PATH</label> |
2509 |
|
|
- </field> |
2510 |
|
|
- |
2511 |
|
|
- <subroutine src="print_trac_domains()" /> |
2512 |
|
|
- |
2513 |
|
|
- <field |
2514 |
|
|
- type="select" |
2515 |
|
|
- id="tracAccess" |
2516 |
|
|
- options="'local' => 'LOCAL', |
2517 |
|
|
- 'global' => 'GLOBAL'" |
2518 |
|
|
- value='local'> |
2519 |
|
|
- <description>TRAC_FIELD_ACCESS_TYPE_DESCRIPTION</description> |
2520 |
|
|
- <label>TRAC_FIELD_ACCESS_TYPE</label> |
2521 |
|
|
- </field> |
2522 |
|
|
- |
2523 |
|
|
- <field |
2524 |
|
|
- type="select" |
2525 |
|
|
- id="tracGroups" |
2526 |
|
|
- options="group_list()" |
2527 |
|
|
- multiple="1" size="5"> |
2528 |
|
|
- <description>TRAC_FIELD_GROUPS_DESCRIPTION</description> |
2529 |
|
|
- <label>TRAC_FIELD_GROUPS</label> |
2530 |
|
|
- </field> |
2531 |
|
|
- |
2532 |
|
|
- <field |
2533 |
|
|
- type="select" |
2534 |
|
|
- id="tracUsers" |
2535 |
|
|
- options="user_list()" |
2536 |
|
|
- multiple="1" size="5"> |
2537 |
|
|
- <label>TRAC_FIELD_USERS</label> |
2538 |
|
|
- </field> |
2539 |
|
|
- |
2540 |
|
|
- <subroutine src="print_save_or_add_button()" /> |
2541 |
|
|
- </page> |
2542 |
|
|
- |
2543 |
|
|
- <!-- page 2 --> |
2544 |
|
|
- <page |
2545 |
|
|
- name="Modify" |
2546 |
|
|
- pre-event="turn_off_buttons()" |
2547 |
|
|
- post-event="handle_trac_projects()"> |
2548 |
|
|
- |
2549 |
|
|
- <title>TRAC_FORM_MODIFY_TITLE</title> |
2550 |
|
|
- <description>TRAC_FORM_MODIFY_DESCRIPTION</description> |
2551 |
|
|
- |
2552 |
|
|
- <subroutine src="print_trac_field_name()" /> |
2553 |
|
|
- |
2554 |
|
|
- <field |
2555 |
|
|
- type="text" |
2556 |
|
|
- id="tracDescription" |
2557 |
|
|
- validation="validate_description"> |
2558 |
|
|
- <label>TRAC_FIELD_PROJECT_DESCRIPTION</label> |
2559 |
|
|
- </field> |
2560 |
|
|
- |
2561 |
|
|
- |
2562 |
|
|
- <field |
2563 |
|
|
- type="select" |
2564 |
|
|
- id="tracRepository" |
2565 |
|
|
- options="repositories_list()"> |
2566 |
|
|
- <description>TRAC_FIELD_REPOSITORY_NAME_DESCRIPTION</description> |
2567 |
|
|
- <label>TRAC_FIELD_REPOSITORY_NAME</label> |
2568 |
|
|
- </field> |
2569 |
|
|
- |
2570 |
|
|
- <field |
2571 |
|
|
- type="text" |
2572 |
|
|
- id="tracRepositoryPath"> |
2573 |
|
|
- <description>TRAC_FIELD_REPOSITORY_PATH_DESCRIPTION</description> |
2574 |
|
|
- <label>TRAC_FIELD_REPOSITORY_PATH</label> |
2575 |
|
|
- </field> |
2576 |
|
|
- |
2577 |
|
|
- <subroutine src="print_trac_domains()" /> |
2578 |
|
|
- |
2579 |
|
|
- <field |
2580 |
|
|
- type="select" |
2581 |
|
|
- id="tracAccess" |
2582 |
|
|
- options="'local' => 'LOCAL', |
2583 |
|
|
- 'global' => 'GLOBAL'"> |
2584 |
|
|
- <description>TRAC_FIELD_ACCESS_TYPE_DESCRIPTION</description> |
2585 |
|
|
- <label>TRAC_FIELD_ACCESS_TYPE</label> |
2586 |
|
|
- </field> |
2587 |
|
|
- |
2588 |
|
|
- <field |
2589 |
|
|
- type="select" |
2590 |
|
|
- id="tracGroups" |
2591 |
|
|
- options="group_list()" |
2592 |
|
|
- multiple="1" size="5"> |
2593 |
|
|
- <description>TRAC_FIELD_GROUPS_DESCRIPTION</description> |
2594 |
|
|
- <label>TRAC_FIELD_GROUPS</label> |
2595 |
|
|
- </field> |
2596 |
|
|
- |
2597 |
|
|
- <field |
2598 |
|
|
- type="select" |
2599 |
|
|
- id="tracUsers" |
2600 |
|
|
- options="user_list()" |
2601 |
|
|
- multiple="1" size="5"> |
2602 |
|
|
- <label>TRAC_FIELD_USERS</label> |
2603 |
|
|
- </field> |
2604 |
|
|
- |
2605 |
|
|
- <subroutine src="print_save_or_add_button()" /> |
2606 |
|
|
- |
2607 |
|
|
- </page> |
2608 |
|
|
- |
2609 |
|
|
- <!-- page 3 --> |
2610 |
|
|
- <page |
2611 |
|
|
- name="Remove" |
2612 |
|
|
- pre-event="turn_off_buttons()" |
2613 |
|
|
- post-event="remove_trac_project()"> |
2614 |
|
|
- |
2615 |
|
|
- <title>TRAC_FORM_REMOVE_TITLE</title> |
2616 |
|
|
- <description>TRAC_FORM_REMOVE_DESCRIPTION</description> |
2617 |
|
|
- |
2618 |
|
|
- <subroutine src="print_button('REMOVE')" /> |
2619 |
|
|
- |
2620 |
|
|
- </page> |
2621 |
|
|
- |
2622 |
|
|
-</form> |
2623 |
|
|
+#!/usr/bin/perl -wT |
2624 |
|
|
+# vim: ft=xml: |
2625 |
|
|
+# $Id: trac 69 2007-03-25 13:20:24Z marco $ |
2626 |
|
|
+ |
2627 |
|
|
+#---------------------------------------------------------------------- |
2628 |
|
|
+# heading : Collaboration |
2629 |
|
|
+# description : TRAC_NAVIGATION_DESCRIPTION |
2630 |
|
|
+# navigation : 2650 2650 |
2631 |
|
|
+#---------------------------------------------------------------------- |
2632 |
|
|
+ |
2633 |
|
|
+use strict; |
2634 |
|
|
+use warnings; |
2635 |
|
|
+use esmith::FormMagick::Panel::trac; |
2636 |
|
|
+my $f = esmith::FormMagick::Panel::trac->new(); |
2637 |
|
|
+$f->display(); |
2638 |
|
|
+ |
2639 |
|
|
+=pod |
2640 |
|
|
+ |
2641 |
|
|
+=head1 NAME |
2642 |
|
|
+ |
2643 |
|
|
+Trac project environment -- add/remove/manage trac project environments |
2644 |
|
|
+ |
2645 |
|
|
+=head2 DESCRIPTION |
2646 |
|
|
+ |
2647 |
|
|
+This screen allows the administrator to manage Trac environments for the subversion repositories. |
2648 |
|
|
+ |
2649 |
|
|
+=begin testing |
2650 |
|
|
+ |
2651 |
|
|
+use esmith::FormMagick::Tester; |
2652 |
|
|
+use esmith::TestUtils; |
2653 |
|
|
+use esmith::TestUtils; |
2654 |
|
|
+use esmith::ConfigDB; |
2655 |
|
|
+use esmith::AccountsDB; |
2656 |
|
|
+my $panel = $Original_File; |
2657 |
|
|
+my $ua = esmith::FormMagick::Tester->new(); |
2658 |
|
|
+ |
2659 |
|
|
+my $c = esmith::ConfigDB->open(); |
2660 |
|
|
+my $a = esmith::AccountsDB->open(); |
2661 |
|
|
+ |
2662 |
|
|
+is (mode($panel), '4750', "Check permissions on script"); |
2663 |
|
|
+ok ($ua->get_panel($panel), "ABOUT TO RUN L10N TESTS"); |
2664 |
|
|
+is ($ua->{status}, 200, "200 OK"); |
2665 |
|
|
+like($ua->{content}, qr/FORM_TITLE/, "Saw untranslated form title"); |
2666 |
|
|
+ok ($ua->set_language("en"), "Set language to English"); |
2667 |
|
|
+ok ($ua->get_panel($panel), "Get panel"); |
2668 |
|
|
+is ($ua->{status}, 200, "200 OK"); |
2669 |
|
|
+ |
2670 |
|
|
+ok ($ua->get_panel($panel), "ABOUT TO TEST CREATING TRAC ENVIRONMENT"); |
2671 |
|
|
+ok ($ua->follow("Click here"), "Follow 'create repository' link"); |
2672 |
|
|
+is ($ua->{status}, 200, "200 OK"); |
2673 |
|
|
+like($ua->{content}, qr/Create a new Trac environment/, "Saw page title"); |
2674 |
|
|
+like($ua->{content}, qr/Brief description/, "Saw description field"); |
2675 |
|
|
+like($ua->{content}, qr/Add/, "Saw add button"); |
2676 |
|
|
+ |
2677 |
|
|
+SKIP: { |
2678 |
|
|
+ |
2679 |
|
|
+ skip 10, "Unsafe!" unless destruction_ok(); |
2680 |
|
|
+ |
2681 |
|
|
+ ok ($ua->follow("Click here"), "ACTUALLY ADDING A TRAC ENVIRONMENT"); |
2682 |
|
|
+ $ua->field(); |
2683 |
|
|
+ $ua->click("Add"); |
2684 |
|
|
+ like($ua->{content}, qr/Successfully added Trac environment/, "Saw success message"); |
2685 |
|
|
+ |
2686 |
|
|
+ ok ($ua->follow("Remove"), "REMOVING TRAC ENVIRONMENT"); |
2687 |
|
|
+ like($ua->{content}, qr/Are you sure/, "Saw confirmation message"); |
2688 |
|
|
+ $ua->click("Remove"); |
2689 |
|
|
+ like($ua->{content}, qr/Successfully deleted/, "Saw success message"); |
2690 |
|
|
+} |
2691 |
|
|
+ |
2692 |
|
|
+=end testing |
2693 |
|
|
+ |
2694 |
|
|
+=cut |
2695 |
|
|
+ |
2696 |
|
|
+__DATA__ |
2697 |
|
|
+<form |
2698 |
|
|
+ title="TRAC_FORM_TITLE" |
2699 |
|
|
+ header="/etc/e-smith/web/common/head.tmpl" |
2700 |
|
|
+ footer="/etc/e-smith/web/common/foot.tmpl"> |
2701 |
|
|
+ |
2702 |
|
|
+ <!-- page 0 --> |
2703 |
|
|
+ <page |
2704 |
|
|
+ name="First" |
2705 |
|
|
+ pre-event="print_status_message()"> |
2706 |
|
|
+ |
2707 |
|
|
+ <description>TRAC_FORM_DESCRIPTION</description> |
2708 |
|
|
+ |
2709 |
|
|
+ <subroutine src="show_trac_projects()" /> |
2710 |
|
|
+ </page> |
2711 |
|
|
+ |
2712 |
|
|
+ <!-- page 1 --> |
2713 |
|
|
+ <page |
2714 |
|
|
+ name="Create" |
2715 |
|
|
+ pre-event="turn_off_buttons()" |
2716 |
|
|
+ post-event="handle_trac_projects()"> |
2717 |
|
|
+ |
2718 |
|
|
+ <title>TRAC_FORM_ADD_TITLE</title> |
2719 |
|
|
+ |
2720 |
|
|
+ <description>TRAC_FORM_ADD_DESCRIPTION</description> |
2721 |
|
|
+ |
2722 |
|
|
+ <subroutine src="print_trac_field_name()" /> |
2723 |
|
|
+ |
2724 |
|
|
+ <field |
2725 |
|
|
+ type="text" |
2726 |
|
|
+ id="tracDescription" |
2727 |
|
|
+ validation="validate_description"> |
2728 |
|
|
+ <label>DESCRIPTION</label> |
2729 |
|
|
+ </field> |
2730 |
|
|
+ |
2731 |
|
|
+ <field |
2732 |
|
|
+ type="select" |
2733 |
|
|
+ id="tracRepository" |
2734 |
|
|
+ options="repositories_list()"> |
2735 |
|
|
+ <description>TRAC_FIELD_REPOSITORY_NAME_DESCRIPTION</description> |
2736 |
|
|
+ <label>TRAC_FIELD_REPOSITORY_NAME</label> |
2737 |
|
|
+ </field> |
2738 |
|
|
+ |
2739 |
|
|
+ <field |
2740 |
|
|
+ type="text" |
2741 |
|
|
+ id="tracRepositoryPath"> |
2742 |
|
|
+ <description>TRAC_FIELD_REPOSITORY_PATH_DESCRIPTION</description> |
2743 |
|
|
+ <label>TRAC_FIELD_REPOSITORY_PATH</label> |
2744 |
|
|
+ </field> |
2745 |
|
|
+ |
2746 |
|
|
+ <subroutine src="print_trac_domains()" /> |
2747 |
|
|
+ |
2748 |
|
|
+ <field |
2749 |
|
|
+ type="select" |
2750 |
|
|
+ id="tracAccess" |
2751 |
|
|
+ options="'local' => 'LOCAL', |
2752 |
|
|
+ 'global' => 'GLOBAL'" |
2753 |
|
|
+ value='local'> |
2754 |
|
|
+ <description>TRAC_FIELD_ACCESS_TYPE_DESCRIPTION</description> |
2755 |
|
|
+ <label>TRAC_FIELD_ACCESS_TYPE</label> |
2756 |
|
|
+ </field> |
2757 |
|
|
+ |
2758 |
|
|
+ <field |
2759 |
|
|
+ type="select" |
2760 |
|
|
+ id="tracGroups" |
2761 |
|
|
+ options="group_list()" |
2762 |
|
|
+ multiple="1" size="5"> |
2763 |
|
|
+ <description>TRAC_FIELD_GROUPS_DESCRIPTION</description> |
2764 |
|
|
+ <label>TRAC_FIELD_GROUPS</label> |
2765 |
|
|
+ </field> |
2766 |
|
|
+ |
2767 |
|
|
+ <field |
2768 |
|
|
+ type="select" |
2769 |
|
|
+ id="tracUsers" |
2770 |
|
|
+ options="user_list()" |
2771 |
|
|
+ multiple="1" size="5"> |
2772 |
|
|
+ <label>TRAC_FIELD_USERS</label> |
2773 |
|
|
+ </field> |
2774 |
|
|
+ |
2775 |
|
|
+ <subroutine src="print_save_or_add_button()" /> |
2776 |
|
|
+ </page> |
2777 |
|
|
+ |
2778 |
|
|
+ <!-- page 2 --> |
2779 |
|
|
+ <page |
2780 |
|
|
+ name="Modify" |
2781 |
|
|
+ pre-event="turn_off_buttons()" |
2782 |
|
|
+ post-event="handle_trac_projects()"> |
2783 |
|
|
+ |
2784 |
|
|
+ <title>TRAC_FORM_MODIFY_TITLE</title> |
2785 |
|
|
+ <description>TRAC_FORM_MODIFY_DESCRIPTION</description> |
2786 |
|
|
+ |
2787 |
|
|
+ <subroutine src="print_trac_field_name()" /> |
2788 |
|
|
+ |
2789 |
|
|
+ <field |
2790 |
|
|
+ type="text" |
2791 |
|
|
+ id="tracDescription" |
2792 |
|
|
+ validation="validate_description"> |
2793 |
|
|
+ <label>DESCRIPTION</label> |
2794 |
|
|
+ </field> |
2795 |
|
|
+ |
2796 |
|
|
+ |
2797 |
|
|
+ <field |
2798 |
|
|
+ type="select" |
2799 |
|
|
+ id="tracRepository" |
2800 |
|
|
+ options="repositories_list()"> |
2801 |
|
|
+ <description>TRAC_FIELD_REPOSITORY_NAME_DESCRIPTION</description> |
2802 |
|
|
+ <label>TRAC_FIELD_REPOSITORY_NAME</label> |
2803 |
|
|
+ </field> |
2804 |
|
|
+ |
2805 |
|
|
+ <field |
2806 |
|
|
+ type="text" |
2807 |
|
|
+ id="tracRepositoryPath"> |
2808 |
|
|
+ <description>TRAC_FIELD_REPOSITORY_PATH_DESCRIPTION</description> |
2809 |
|
|
+ <label>TRAC_FIELD_REPOSITORY_PATH</label> |
2810 |
|
|
+ </field> |
2811 |
|
|
+ |
2812 |
|
|
+ <subroutine src="print_trac_domains()" /> |
2813 |
|
|
+ |
2814 |
|
|
+ <field |
2815 |
|
|
+ type="select" |
2816 |
|
|
+ id="tracAccess" |
2817 |
|
|
+ options="'local' => 'LOCAL', |
2818 |
|
|
+ 'global' => 'GLOBAL'"> |
2819 |
|
|
+ <description>TRAC_FIELD_ACCESS_TYPE_DESCRIPTION</description> |
2820 |
|
|
+ <label>TRAC_FIELD_ACCESS_TYPE</label> |
2821 |
|
|
+ </field> |
2822 |
|
|
+ |
2823 |
|
|
+ <field |
2824 |
|
|
+ type="select" |
2825 |
|
|
+ id="tracGroups" |
2826 |
|
|
+ options="group_list()" |
2827 |
|
|
+ multiple="1" size="5"> |
2828 |
|
|
+ <description>TRAC_FIELD_GROUPS_DESCRIPTION</description> |
2829 |
|
|
+ <label>TRAC_FIELD_GROUPS</label> |
2830 |
|
|
+ </field> |
2831 |
|
|
+ |
2832 |
|
|
+ <field |
2833 |
|
|
+ type="select" |
2834 |
|
|
+ id="tracUsers" |
2835 |
|
|
+ options="user_list()" |
2836 |
|
|
+ multiple="1" size="5"> |
2837 |
|
|
+ <label>TRAC_FIELD_USERS</label> |
2838 |
|
|
+ </field> |
2839 |
|
|
+ |
2840 |
|
|
+ <subroutine src="print_save_or_add_button()" /> |
2841 |
|
|
+ |
2842 |
|
|
+ </page> |
2843 |
|
|
+ |
2844 |
|
|
+ <!-- page 3 --> |
2845 |
|
|
+ <page |
2846 |
|
|
+ name="Remove" |
2847 |
|
|
+ pre-event="turn_off_buttons()" |
2848 |
|
|
+ post-event="remove_trac_project()"> |
2849 |
|
|
+ |
2850 |
|
|
+ <title>TRAC_FORM_REMOVE_TITLE</title> |
2851 |
|
|
+ <description>TRAC_FORM_REMOVE_DESCRIPTION</description> |
2852 |
|
|
+ |
2853 |
|
|
+ <subroutine src="print_button('REMOVE')" /> |
2854 |
|
|
+ |
2855 |
|
|
+ </page> |
2856 |
|
|
+ |
2857 |
|
|
+</form> |