1 |
wakaba |
1.1 |
#?SuikaWikiConfig/2.0 |
2 |
|
|
|
3 |
|
|
Plugin: |
4 |
|
|
@Name: BugTrack |
5 |
|
|
@Description: |
6 |
|
|
@@@: SuikaWiki Bug Tracking System |
7 |
|
|
@@lang:en |
8 |
|
|
@License: %%Perl%% |
9 |
|
|
@Author: |
10 |
|
|
@@Name: |
11 |
|
|
@@@@: Wakaba |
12 |
|
|
@@@lang:ja |
13 |
|
|
@@@script:Latn |
14 |
|
|
@@Mail[list]: w@suika.fam.cx |
15 |
|
|
@Date.RCS: |
16 |
|
|
$Date: 2004/01/16 07:54:22 $ |
17 |
|
|
@RequiredPlugin[list]: |
18 |
|
|
WikiLinking |
19 |
|
|
WikiResource |
20 |
|
|
@Use: |
21 |
|
|
my $WIKILINKING; |
22 |
|
|
my $WIKIRESOURCE; |
23 |
|
|
|
24 |
|
|
PluginConst: |
25 |
|
|
@NS_XHTML1: |
26 |
|
|
http://www.w3.org/1999/xhtml |
27 |
|
|
@WIKILINKING: |
28 |
|
|
{($WIKILINKING ||= SuikaWiki::Plugin->module_package ('WikiLinking'))} |
29 |
|
|
@WIKIRESOURCE: |
30 |
|
|
{($WIKIRESOURCE ||= SuikaWiki::Plugin->module_package ('WikiResource'))} |
31 |
|
|
|
32 |
|
|
FormattingRule: |
33 |
|
|
@Category[list]: |
34 |
|
|
view |
35 |
|
|
view-resource |
36 |
|
|
form-input |
37 |
|
|
@Name: bt--bug-list |
38 |
|
|
@Description: |
39 |
|
|
@@@: Bug list |
40 |
|
|
@@lang: en |
41 |
|
|
@Parameter: |
42 |
|
|
@@Name: ns |
43 |
|
|
@@Type: WikiName |
44 |
|
|
@@Default: (auto) |
45 |
|
|
@@Description: |
46 |
|
|
@@@@: Bug track WikiPage |
47 |
|
|
@@@lang: en |
48 |
|
|
@Formatting: |
49 |
|
|
__ATTRTEXT:%ns__; |
50 |
|
|
my $ns = $o->{wiki}->name ($p->{ns} || $o->{wiki}->{var}->{page}); |
51 |
|
|
my $option_ns = $ns->clone; |
52 |
|
|
$option_ns->append_component ('Options'); |
53 |
|
|
my @bugs = map {[$o->{wiki}->name ($_), $_->[$#$_-1] * 100 + $_->[$#$_]]} |
54 |
|
|
grep {$_->[$#$_] =~ /^[0-9]+$/} |
55 |
|
|
map {$o->{wiki}->{db}->keys ('content', |
56 |
|
|
-ns => $_, |
57 |
|
|
-type => 'key', |
58 |
|
|
-recursive => 0)} |
59 |
|
|
grep {$_->[$#$_] =~ /^[0-9]+$/} |
60 |
|
|
$o->{wiki}->{db}->keys ('content', |
61 |
|
|
-ns => $ns, |
62 |
|
|
-type => 'ns', |
63 |
|
|
-recursive => 0); |
64 |
|
|
my $props = $WIKIRESOURCE->get (name => 'Plugin:BugTrack:Table:Row', |
65 |
|
|
wiki => $o->{wiki}, o => $o); |
66 |
|
|
my $fmt = SuikaWiki::Plugin->formatter ('bt__bug_table_header'); |
67 |
|
|
my $tbl = $p->{-parent} |
68 |
|
|
->append_new_node (type => '#element', |
69 |
|
|
namespace_uri => $NS_XHTML1, |
70 |
|
|
local_name => 'table'); |
71 |
|
|
$tbl->set_attribute (class => 'bt--bugtrack'); |
72 |
|
|
$fmt->replace ($props, param => $o, |
73 |
|
|
-parent => |
74 |
|
|
$tbl->append_new_node (type => '#element', |
75 |
|
|
namespace_uri => $NS_XHTML1, |
76 |
|
|
local_name => 'thead') |
77 |
|
|
->append_new_node (type => '#element', |
78 |
|
|
namespace_uri => $NS_XHTML1, |
79 |
|
|
local_name => 'tr')); |
80 |
|
|
$tbl->append_text ("\n"); |
81 |
|
|
|
82 |
|
|
$fmt = SuikaWiki::Plugin->formatter ('bt__bug_item'); |
83 |
|
|
my $tb = $tbl->append_new_node (type => '#element', |
84 |
|
|
namespace_uri => $NS_XHTML1, |
85 |
|
|
local_name => 'tbody'); |
86 |
|
|
my $weight = { |
87 |
|
|
Priority => {high => 1, normal => 2, low => 3}, |
88 |
|
|
Status => {open => 1, reserved => 2, closed => 3}, |
89 |
|
|
}; |
90 |
|
|
for $_ (sort { |
91 |
|
|
$weight->{Status}->{$a->{prop}->{Status}||'open'} |
92 |
|
|
<=> $weight->{Status}->{$b->{prop}->{Status}||'open'} |
93 |
|
|
|| $weight->{Priority}->{$a->{prop}->{Priority}||'normal'} |
94 |
|
|
<=> $weight->{Priority}->{$b->{prop}->{Priority}||'normal'} |
95 |
|
|
|| $b->{lm} <=> $a->{lm} |
96 |
|
|
|| $a->{prop}->{Category} cmp $b->{prop}->{Category} |
97 |
|
|
|| $b->{bug_no} <=> $a->{bug_no} |
98 |
|
|
} map {{ |
99 |
|
|
bug_ns => $ns, |
100 |
|
|
bug_option_ns => $option_ns, |
101 |
|
|
bug_page => $_->[0], |
102 |
|
|
bug_no => $_->[1], |
103 |
|
|
prop => __FUNCPACK__->get_bug_properties |
104 |
|
|
(page => $_->[0], o => $o), |
105 |
|
|
lm => $o->{wiki}->{db}->get (lastmodified => $_->[0]), |
106 |
|
|
}} @bugs) { |
107 |
|
|
local $o->{bt__bug} = $_; |
108 |
|
|
my @class; |
109 |
|
|
## TODO: ensure each class name is NMTOKEN |
110 |
|
|
push @class, $o->{bt__bug}->{prop}->{Status}||'open'; |
111 |
|
|
push @class, $o->{bt__bug}->{prop}->{Priority}||'normal'; |
112 |
|
|
push @class, $o->{bt__bug}->{prop}->{Category}; |
113 |
|
|
my $tr = $tb->append_new_node |
114 |
|
|
(type => '#element', |
115 |
|
|
namespace_uri => $NS_XHTML1, |
116 |
|
|
local_name => 'tr'); |
117 |
|
|
$tr->set_attribute (class => join ' ', grep /^[\w_.+-]+$/, @class); |
118 |
|
|
$fmt->replace ($props, param => $o, -parent => $tr); |
119 |
|
|
$tb->append_text ("\n"); |
120 |
|
|
} |
121 |
|
|
|
122 |
|
|
Function: |
123 |
|
|
@Name: get_bug_properties |
124 |
|
|
@Description: |
125 |
|
|
@@@: |
126 |
|
|
Returning a hash reference that has some bug properties, |
127 |
|
|
taken from each bug WikiPages. |
128 |
|
|
@@lang: en |
129 |
|
|
@Main: |
130 |
|
|
my (undef, %opt) = @_; |
131 |
|
|
## TODO: New style property should also be implemented |
132 |
|
|
my $bug_info = $opt{o}->{wiki}->{db}->get (content => $opt{page}); |
133 |
|
|
my %bug_prop; |
134 |
|
|
for (split /\n/, $bug_info) { |
135 |
|
|
tr/\x0A\x0D//d; |
136 |
|
|
if (/^-\s*([0-9A-Za-z-]+)\s*:\s*(\S.*\S)/) { |
137 |
|
|
$bug_prop{$1} = $2; |
138 |
|
|
} elsif (!/^[-#]/) { |
139 |
|
|
last; |
140 |
|
|
} |
141 |
|
|
} |
142 |
|
|
\ \%bug_prop; |
143 |
|
|
|
144 |
|
|
FormattingRule: |
145 |
|
|
@Category[list]: |
146 |
|
|
bt--bug-item |
147 |
|
|
@Name: -default |
148 |
|
|
@Description: |
149 |
|
|
@@@: Default formatting for bug list item information |
150 |
|
|
@@lang: en |
151 |
|
|
@Pre: |
152 |
|
|
$p->{-cell_namespace_uri} = $NS_XHTML1; |
153 |
|
|
$p->{-cell_local_name} = 'td'; |
154 |
|
|
@Post: |
155 |
|
|
local $p->{-parent} = $o->{-result} |
156 |
|
|
->append_new_node |
157 |
|
|
(type => '#element', |
158 |
|
|
namespace_uri => $p->{-cell_namespace_uri}, |
159 |
|
|
local_name => $p->{-cell_local_name}); |
160 |
|
|
$f->call ($rule_name, 'main', $p, $o, %opt); |
161 |
|
|
@Formatting: |
162 |
|
|
\ |
163 |
|
|
@Attribute: |
164 |
|
|
if ($param_name eq '-boolean') { |
165 |
|
|
$p->{$param_value} = 1; |
166 |
|
|
} else { |
167 |
|
|
if ($opt{-value_flag} and index ($opt{-value_flag}, 'p') > -1) { |
168 |
|
|
$p->{-parse_flag}->{$param_name} = 1; |
169 |
|
|
} |
170 |
|
|
$p->{$param_name} = $param_value; |
171 |
|
|
} |
172 |
|
|
|
173 |
|
|
FormattingRule: |
174 |
|
|
@Category[list]: |
175 |
|
|
bt--bug-table-header |
176 |
|
|
@Name: -default |
177 |
|
|
@Description: |
178 |
|
|
@@@: Default formatting for bug list item information |
179 |
|
|
@@lang: en |
180 |
|
|
@Pre: |
181 |
|
|
$p->{-cell_namespace_uri} = $NS_XHTML1; |
182 |
|
|
$p->{-cell_local_name} = 'th'; |
183 |
|
|
@Post: |
184 |
|
|
local $p->{-parent} = $o->{-result} |
185 |
|
|
->append_new_node |
186 |
|
|
(type => '#element', |
187 |
|
|
namespace_uri => $p->{-cell_namespace_uri}, |
188 |
|
|
local_name => $p->{-cell_local_name}); |
189 |
|
|
$p->{-parent}->set_attribute (class => $rule_name); |
190 |
|
|
$p->{-parent}->set_attribute (scope => 'col'); |
191 |
|
|
$f->call ($rule_name, 'main', $p, $o, %opt); |
192 |
|
|
@Formatting: |
193 |
|
|
\ |
194 |
|
|
@Attribute: |
195 |
|
|
if ($param_name eq '-boolean') { |
196 |
|
|
$p->{$param_value} = 1; |
197 |
|
|
} else { |
198 |
|
|
if ($opt{-value_flag} and index ($opt{-value_flag}, 'p') > -1) { |
199 |
|
|
$p->{-parse_flag}->{$param_name} = 1; |
200 |
|
|
} |
201 |
|
|
$p->{$param_name} = $param_value; |
202 |
|
|
} |
203 |
|
|
|
204 |
|
|
FormattingRule: |
205 |
|
|
@Category[list]: |
206 |
|
|
bt--bug-item |
207 |
|
|
@Name: -undef |
208 |
|
|
@Description: |
209 |
|
|
@@@: Undefined rule indication |
210 |
|
|
@@lang: en |
211 |
|
|
@Formatting: |
212 |
|
|
$p->{-parent}->append_text ("[undef: $f->{-category_name}/$rule_name]"); |
213 |
|
|
|
214 |
|
|
FormattingRule: |
215 |
|
|
@Category[list]: |
216 |
|
|
bt--bug-table-header |
217 |
|
|
@Name: -undef |
218 |
|
|
@Description: |
219 |
|
|
@@@: Column header for bug properties |
220 |
|
|
@@lang: en |
221 |
|
|
@Formatting: |
222 |
|
|
$WIKIRESOURCE->get_op |
223 |
|
|
('Plugin:BugTrack:Column:'.$rule_name, $o, $p->{-parent}); |
224 |
|
|
|
225 |
|
|
FormattingRule: |
226 |
|
|
@Category[list]: |
227 |
|
|
bt--bug-table-header |
228 |
|
|
bt--bug-item |
229 |
|
|
@Name: -bare-text |
230 |
|
|
@Description: |
231 |
|
|
@@@: Bare text out of rule - to be ignored |
232 |
|
|
@@lang: en |
233 |
|
|
@Formatting: |
234 |
|
|
\ |
235 |
|
|
|
236 |
|
|
FormattingRule[list]: |
237 |
|
|
@Category[list]: |
238 |
|
|
bt--bug-item |
239 |
|
|
@Name: no |
240 |
|
|
@Description: |
241 |
|
|
@@@: Bug number |
242 |
|
|
@@lang: en |
243 |
|
|
@Formatting: |
244 |
|
|
$WIKILINKING->to_wikipage_in_html ({ |
245 |
|
|
label => $WIKIRESOURCE->get (name => 'BugTrack:Item:Number:Label', |
246 |
|
|
wiki => $o->{wiki}, o => $o), |
247 |
|
|
} => { |
248 |
|
|
base => $o->{bt__bug}->{bug_ns}, |
249 |
|
|
page_name_relative => $o->{bt__bug}->{bug_page}, |
250 |
|
|
}, { |
251 |
|
|
o => $o, |
252 |
|
|
parent => $p->{-parent}, |
253 |
|
|
}); |
254 |
|
|
|
255 |
|
|
FormattingRule[list]: |
256 |
|
|
@Category[list]: |
257 |
|
|
bt--bug-item |
258 |
|
|
@Name: subject |
259 |
|
|
@Description: |
260 |
|
|
@@@: Bug subject |
261 |
|
|
@@lang: en |
262 |
|
|
@Formatting: |
263 |
|
|
$WIKILINKING->to_wikipage_in_html ({ |
264 |
|
|
label => $WIKIRESOURCE->get (name => 'BugTrack:Item:Subject:Label', |
265 |
|
|
wiki => $o->{wiki}, o => $o), |
266 |
|
|
} => { |
267 |
|
|
base => $o->{bt__bug}->{bug_ns}, |
268 |
|
|
page_name_relative => $o->{bt__bug}->{bug_page}, |
269 |
|
|
}, { |
270 |
|
|
o => $o, |
271 |
|
|
parent => $p->{-parent}, |
272 |
|
|
}); |
273 |
|
|
|
274 |
|
|
FormattingRule: |
275 |
|
|
@Category[list]: |
276 |
|
|
page-link |
277 |
|
|
@Name: bt--property |
278 |
|
|
@Parameter: |
279 |
|
|
@@Name: default |
280 |
|
|
@@Type: CDATA |
281 |
|
|
@@Default: (none) |
282 |
|
|
@@Default: |
283 |
|
|
@@@: Default text |
284 |
|
|
@@lang: en |
285 |
|
|
@Parameter: |
286 |
|
|
@@Name: name |
287 |
|
|
@@Type: name |
288 |
|
|
@@Default: #REQUIRED |
289 |
|
|
@@Description: |
290 |
|
|
@@@: Bug property name |
291 |
|
|
@@lang: en |
292 |
|
|
@Formatting: |
293 |
|
|
__ATTRTEXT:%name__; |
294 |
|
|
$p->{name} =~ tr/-/_/; |
295 |
|
|
|
296 |
|
|
exists $o->{bt__bug}->{prop}->{$p->{name}} ? |
297 |
|
|
$p->{-parent}->append_text ($o->{bt__bug}->{prop}->{$p->{name}}) : |
298 |
|
|
exists $o->{bt__bug}->{$p->{name}} ? |
299 |
|
|
$p->{-parent}->append_text ($o->{bt__bug}->{$p->{name}}) : |
300 |
|
|
do {__ATTRNODE:%default->{$p->{-parent}}__;}; |
301 |
|
|
|
302 |
|
|
FormattingRule[list]: |
303 |
|
|
@Category[list]: |
304 |
|
|
bt--bug-item |
305 |
|
|
@Name: status |
306 |
|
|
@Description: |
307 |
|
|
@@@: Bug status |
308 |
|
|
@@lang: en |
309 |
|
|
@Formatting: |
310 |
|
|
$WIKIRESOURCE->get_op ('Status:'.($o->{bt__bug}->{prop}->{Status} |
311 |
|
|
or '(default)'), |
312 |
|
|
$o, $p->{-parent}, |
313 |
|
|
ns => $o->{bt__bug}->{bug_option_ns}, |
314 |
|
|
default => $o->{bt__bug}->{prop}->{Status} |
315 |
|
|
|| '(default)'); |
316 |
|
|
|
317 |
|
|
FormattingRule[list]: |
318 |
|
|
@Category[list]: |
319 |
|
|
bt--bug-item |
320 |
|
|
@Name: priority |
321 |
|
|
@Description: |
322 |
|
|
@@@: Bug priority |
323 |
|
|
@@lang: en |
324 |
|
|
@Formatting: |
325 |
|
|
$WIKIRESOURCE->get_op ('Priority:'.($o->{bt__bug}->{prop}->{Priority} |
326 |
|
|
or '(default)'), |
327 |
|
|
$o, $p->{-parent}, |
328 |
|
|
ns => $o->{bt__bug}->{bug_option_ns}, |
329 |
|
|
default => $o->{bt__bug}->{prop}->{Priority} |
330 |
|
|
|| '(default)'); |
331 |
|
|
|
332 |
|
|
FormattingRule[list]: |
333 |
|
|
@Category[list]: |
334 |
|
|
bt--bug-item |
335 |
|
|
@Name: category |
336 |
|
|
@Description: |
337 |
|
|
@@@: Bug category |
338 |
|
|
@@lang: en |
339 |
|
|
@Formatting: |
340 |
|
|
$WIKIRESOURCE->get_op ('Category:'.($o->{bt__bug}->{prop}->{Category} |
341 |
|
|
or '(default)'), |
342 |
|
|
$o, $p->{-parent}, |
343 |
|
|
ns => $o->{bt__bug}->{bug_option_ns}, |
344 |
|
|
default => $o->{bt__bug}->{prop}->{Category} |
345 |
|
|
|| '(default)'); |
346 |
|
|
|
347 |
|
|
FormattingRule[list]: |
348 |
|
|
@Category[list]: |
349 |
|
|
bt--bug-item |
350 |
|
|
@Name: last-modified |
351 |
|
|
@Description: |
352 |
|
|
@@@: Bug last modified date-time |
353 |
|
|
@@lang: en |
354 |
|
|
@Formatting: |
355 |
|
|
## TODO: custom date format (Message::Field::Date) |
356 |
|
|
my @time = gmtime $o->{bt__bug}->{lm}; |
357 |
|
|
$p->{-parent}->append_text |
358 |
|
|
(sprintf '%04d-%02d-%02d %02d:%02d:%02d +00:00', |
359 |
|
|
$time[5]+1900,$time[4]+1,@time[3,2,1,0]); |
360 |
|
|
|
361 |
|
|
FormattingRule: |
362 |
|
|
@Category[list]: |
363 |
|
|
view |
364 |
|
|
view-resource |
365 |
|
|
form-input |
366 |
|
|
@Name: bt--create-new-bug |
367 |
|
|
@Description: |
368 |
|
|
@@@: Creating-new-bug-item form |
369 |
|
|
@@lang: en |
370 |
|
|
@Parameter: |
371 |
|
|
@@Name: ns |
372 |
|
|
@@Type: WikiName |
373 |
|
|
@@Default: (auto) |
374 |
|
|
@@Description: |
375 |
|
|
@@@@: WikiPage name of bug tracking |
376 |
|
|
@@@lang:en |
377 |
|
|
@Formatting: |
378 |
|
|
__ATTRTEXT:%ns__; |
379 |
|
|
|
380 |
|
|
my $page = $o->{wiki}->name ($p->{ns} || $o->{wiki}->{var}->{page}); |
381 |
|
|
SuikaWiki::Plugin->module_package ('WikiFormCore') |
382 |
|
|
->make_form_in_html |
383 |
|
|
($p->{-parent}, $p->{content} || |
384 |
|
|
$WIKIRESOURCE->get |
385 |
|
|
(name => 'BugTrack:CreateForm:Content', |
386 |
|
|
o => $o, wiki => $o->{wiki}), |
387 |
|
|
wiki => $o->{wiki}, o => $o, |
388 |
|
|
index => -1, |
389 |
|
|
output => { |
390 |
|
|
mode => 'bt--bug-create', |
391 |
|
|
page => $page, |
392 |
|
|
}); |
393 |
|
|
|
394 |
|
|
Function: |
395 |
|
|
@Name: get_new_bug_page |
396 |
|
|
@Main: |
397 |
|
|
my (undef, %opt) = @_; |
398 |
|
|
my $max_ns = $opt{ns}->clone; |
399 |
|
|
$max_ns->append_component ('1'); |
400 |
|
|
for ( grep {$_->[$#$_] =~ /^[0-9]+$/} |
401 |
|
|
$opt{o}->{wiki}->{db}->keys ('content', |
402 |
|
|
-ns => $opt{ns}, |
403 |
|
|
-type => 'ns', |
404 |
|
|
-recursive => 0)) { |
405 |
|
|
$max_ns = $_ if $_->[$#$_] > $max_ns->[$#$_]; |
406 |
|
|
} |
407 |
|
|
my $max = ref $max_ns eq 'ARRAY' ? $opt{o}->{wiki}->name ($max_ns) |
408 |
|
|
: $max_ns->clone; |
409 |
|
|
$max->append_component ('0'); |
410 |
|
|
for ( grep {$_->[$#$_] =~ /^[0-9]+$/} |
411 |
|
|
$opt{o}->{wiki}->{db}->keys ('content', |
412 |
|
|
-ns => $max_ns, |
413 |
|
|
-type => 'key', |
414 |
|
|
-recursive => 0)) { |
415 |
|
|
$max = $_ if $_->[$#$_] > $max->[$#$_]; |
416 |
|
|
} |
417 |
|
|
$max->[$#$max]++; |
418 |
|
|
$max->[$#$max-1]++, $max->[$#$max] = 1 if $max->[$#$max] > 100; |
419 |
|
|
$opt{o}->{wiki}->name ($max); |
420 |
|
|
|
421 |
|
|
FormattingRule: |
422 |
|
|
@Category[list]: |
423 |
|
|
view |
424 |
|
|
view-resource |
425 |
|
|
form-input |
426 |
|
|
@Name: bt--bug-root-page |
427 |
|
|
@Description: |
428 |
|
|
@@@: Root of bugtrack |
429 |
|
|
@@lang: en |
430 |
|
|
@Formatting: |
431 |
|
|
__ATTRTEXT:%ns__; |
432 |
|
|
my $ns = $o->{wiki}->name ($p->{ns} || $o->{wiki}->{var}->{page}); |
433 |
|
|
if ($#$ns > 1) { |
434 |
|
|
delete $ns->[$#$ns] if $ns->[$#$ns] =~ /^[0-9]+$/; |
435 |
|
|
delete $ns->[$#$ns] if $ns->[$#$ns] =~ /^[0-9]+$/; |
436 |
|
|
} |
437 |
|
|
$p->{-parent}->append_text ($ns->stringify (wiki => $o->{wiki})); |
438 |
|
|
|
439 |
|
|
FormattingRule: |
440 |
|
|
@Category[list]: |
441 |
|
|
view |
442 |
|
|
view-resource |
443 |
|
|
form-input |
444 |
|
|
@Name: bt--if-one-of-bug |
445 |
|
|
@Description: |
446 |
|
|
@@@: If one of bug track item WikiPages |
447 |
|
|
@@lang: en |
448 |
|
|
@Formatting: |
449 |
|
|
__ATTRTEXT:%ns__; |
450 |
|
|
my $ns = $o->{wiki}->name ($p->{ns} || $o->{wiki}->{var}->{page}); |
451 |
|
|
if ($#$ns > 1 and |
452 |
|
|
$ns->[$#$ns] =~ /^[0-9]+$/ and |
453 |
|
|
$ns->[$#$ns - 1] =~ /^[0-9]+$/) { |
454 |
|
|
__ATTRNODE:%true->{$p->{-parent}}__; |
455 |
|
|
} else { |
456 |
|
|
__ATTRNODE:%false->{$p->{-parent}}__; |
457 |
|
|
} |
458 |
|
|
|
459 |
|
|
|
460 |
|
|
ViewDefinition: |
461 |
|
|
@Mode: bt--bug-create |
462 |
|
|
@Condition: |
463 |
|
|
@@output: http-cgi |
464 |
|
|
@@http-method[list]: |
465 |
|
|
POST |
466 |
|
|
@Description: |
467 |
|
|
@@@: Create a new bug WikiPage |
468 |
|
|
@@lang:en |
469 |
|
|
@method: |
470 |
|
|
@@@: |
471 |
|
|
my $wiki = $self->{view}->{wiki}; |
472 |
|
|
## Open Database |
473 |
|
|
$wiki->{var}->{db}->{read_only}->{content} = 0; |
474 |
|
|
$wiki->{var}->{db}->{read_only}->{lastmodified} = 0; |
475 |
|
|
$self->{view}->init_db; |
476 |
|
|
|
477 |
|
|
my $ns = $wiki->{var}->{page}; |
478 |
|
|
my $o = { |
479 |
|
|
wiki => $wiki, |
480 |
|
|
}; |
481 |
|
|
$o->{bt__bug} = { |
482 |
|
|
bug_ns => $ns, |
483 |
|
|
bug_page => __FUNCPACK__->get_new_bug_page |
484 |
|
|
(ns => $ns, o => $o), |
485 |
|
|
}; |
486 |
|
|
|
487 |
|
|
## Generate new content |
488 |
|
|
my @page = ('#?SuikaWiki/0.9', ''); |
489 |
|
|
for (qw/Subject Priority Status Category/) { |
490 |
|
|
my $value = $o->{wiki}->{input}->parameter ('bt--' . lc $_) |
491 |
|
|
|| $WIKIRESOURCE->get (name => 'BugTrack:'.$_.':Default', |
492 |
|
|
o => $o, wiki => $o->{wiki}); |
493 |
|
|
push @page, '- ' . $_ . ': ' . $value; |
494 |
|
|
$o->{bt__bug}->{prop}->{$_} = $value; |
495 |
|
|
} |
496 |
|
|
my @time = gmtime; |
497 |
|
|
push @page, '- Creation-Date: ' . |
498 |
|
|
sprintf '%04d-%02d-%02d %02d:%02d:%02d +00:00', |
499 |
|
|
$time[5]+1900,$time[4]+1,@time[3,2,1,0]; |
500 |
|
|
push @page, ''; |
501 |
|
|
push @page, '[1] ' . $o->{wiki}->{input}->parameter ('body'); |
502 |
|
|
$wiki->{db}->set (content => $o->{bt__bug}->{bug_page} |
503 |
|
|
=> join "\x0A", @page); |
504 |
|
|
|
505 |
|
|
my $uri = $self->{view}->{wiki}->uri_reference |
506 |
|
|
(page => $o->{bt__bug}->{bug_page}, |
507 |
|
|
up_to_date => 1); |
508 |
|
|
|
509 |
|
|
require SuikaWiki::Output::HTTP; |
510 |
|
|
my $output = SuikaWiki::Output::HTTP->new (wiki => $self->{view}->{wiki}); |
511 |
|
|
$output->set_redirect (uri => $uri, status_code => 303); |
512 |
|
|
## Should we use 201 Created? |
513 |
|
|
$output->output (output => 'http-cgi'); |
514 |
|
|
@@Name: main |
515 |
|
|
|
516 |
|
|
ViewFragment: |
517 |
|
|
@Template[list]: links |
518 |
|
|
@Description: |
519 |
|
|
@@@: Web page to web page links - bug tracking system |
520 |
|
|
@@lang:en |
521 |
|
|
@Formatting: |
522 |
|
|
%bt--if-one-of-bug ( |
523 |
|
|
true => { |
524 |
|
|
%link-to-wikipage ( |
525 |
|
|
page => {%bt--bug-root-page;}p, |
526 |
|
|
rel => top, |
527 |
|
|
label => {%html-link ( |
528 |
|
|
description => {%page-name;}p, |
529 |
|
|
);}, |
530 |
|
|
); |
531 |
|
|
}p, |
532 |
|
|
); |
533 |
|
|
|
534 |
|
|
Resource: |
535 |
|
|
@BugTrack:Category:Default: |
536 |
|
|
@@@: (default) |
537 |
|
|
@@lang: en |
538 |
|
|
@BugTrack:Category:Label: |
539 |
|
|
@@@: Category |
540 |
|
|
@@lang: en |
541 |
|
|
@BugTrack:CreateForm:Content: |
542 |
|
|
%line (content => { |
543 |
|
|
%text (id=>bt--subject,label=>{%res (name => {BugTrack:Subject:Label});}p,default=>{%res (name => {BugTrack:Subject:Default});}p,size=>15); |
544 |
|
|
}p); |
545 |
|
|
%line (content => { |
546 |
|
|
%res (name => {BugTrack:Priority:Label}); |
547 |
|
|
%radio(id=>bt--priority,label=>{%res (name => {BugTrack:Priority:high});}p,value=>{high}); |
548 |
|
|
%radio(id=>bt--priority,default,label=>{%res (name => {BugTrack:Priority:normal});}p,value=>{normal}); |
549 |
|
|
%radio(id=>bt--priority,label=>{%res (name => {BugTrack:Priority:low});}p,value=>{low}); |
550 |
|
|
}p); |
551 |
|
|
%line (content => { |
552 |
|
|
%res (name => {BugTrack:Status:Label}); |
553 |
|
|
%radio(id=>bt--status,default,label=>{%res (name => {BugTrack:Status:open});}p,value=>{open}); |
554 |
|
|
%radio(id=>bt--status,label=>{%res (name => {BugTrack:Status:reserved});}p,value=>{reserved}); |
555 |
|
|
%radio(id=>bt--status,label=>{%res (name => {BugTrack:Status:closed});}p,value=>{closed}); |
556 |
|
|
}p); |
557 |
|
|
%line (content => { |
558 |
|
|
%text (id=>bt--category,label=>{%res (name => {BugTrack:Category:Label});}p,size=>10); |
559 |
|
|
}p); |
560 |
|
|
%line (content => { |
561 |
|
|
%textarea ( |
562 |
|
|
id => bt--body, size=>15,lines=>5, |
563 |
|
|
label=>{%res (name => {BugTrack:CreateForm:MainText:Label});}p, |
564 |
|
|
); |
565 |
|
|
%submit (label => {%res (name => {Form:Label:Add});}p, |
566 |
|
|
description => {%res (name => {Form:Label:Description});}p); |
567 |
|
|
}p); |
568 |
|
|
@BugTrack:CreateForm:MainText:Label: |
569 |
|
|
@@@: Bug description |
570 |
|
|
@@lang: en |
571 |
|
|
@BugTrack:Item:Number:Label: |
572 |
|
|
%link-to-it (label => {%bt--property (name => bug-no);}p, default => {0}); |
573 |
|
|
@BugTrack:Item:Subject:Default: |
574 |
|
|
@@@: No Title |
575 |
|
|
@@lang: en |
576 |
|
|
@BugTrack:Item:Subject:Label: |
577 |
|
|
%link-to-it (label => {%bt--property ( |
578 |
|
|
name => Subject, |
579 |
|
|
default => {%res (name => {BugTrack:Item:Subject:Default});}p, |
580 |
|
|
);}p); |
581 |
|
|
@BugTrack:Priority:Default: |
582 |
|
|
@@@: normal |
583 |
|
|
@@lang: en |
584 |
|
|
@BugTrack:Priority:Label: |
585 |
|
|
@@@: Priority |
586 |
|
|
@@lang: en |
587 |
|
|
@BugTrack:Priority:high: |
588 |
|
|
@@@: HIGH |
589 |
|
|
@@lang: en |
590 |
|
|
@BugTrack:Priority:low: |
591 |
|
|
@@@: low |
592 |
|
|
@@lang: en |
593 |
|
|
@BugTrack:Priority:normal: |
594 |
|
|
@@@: normal |
595 |
|
|
@@lang: en |
596 |
|
|
@BugTrack:Status:Default: |
597 |
|
|
@@@: open |
598 |
|
|
@@lang: en |
599 |
|
|
@BugTrack:Status:Label: |
600 |
|
|
@@@: Status |
601 |
|
|
@@lang: en |
602 |
|
|
@BugTrack:Status:closed: |
603 |
|
|
@@@: closed |
604 |
|
|
@@lang: en |
605 |
|
|
@BugTrack:Status:open: |
606 |
|
|
@@@: OPEN |
607 |
|
|
@@lang: en |
608 |
|
|
@BugTrack:Status:reserved: |
609 |
|
|
@@@: reserved |
610 |
|
|
@@lang: en |
611 |
|
|
@BugTrack:Subject:Default: |
612 |
|
|
@@@: New bug |
613 |
|
|
@@lang: en |
614 |
|
|
@BugTrack:Subject:Label: |
615 |
|
|
@@@: Subject |
616 |
|
|
@@lang: en |
617 |
|
|
|
618 |
|
|
Parameter: |
619 |
|
|
@Name: bt--subject |
620 |
|
|
@Description: |
621 |
|
|
@@@: Bug tracking system - subject |
622 |
|
|
@@lang: en |
623 |
|
|
|
624 |
|
|
Parameter: |
625 |
|
|
@Name: bt--category |
626 |
|
|
@Description: |
627 |
|
|
@@@: Bug tracking system - category |
628 |
|
|
@@lang: en |
629 |
|
|
|
630 |
|
|
Parameter: |
631 |
|
|
@Name: bt--priority |
632 |
|
|
@Description: |
633 |
|
|
@@@: Bug tracking system - priority |
634 |
|
|
@@lang: en |
635 |
|
|
|
636 |
|
|
Parameter: |
637 |
|
|
@Name: bt--status |
638 |
|
|
@Description: |
639 |
|
|
@@@: Bug tracking system - status |
640 |
|
|
@@lang: en |
641 |
|
|
|
642 |
|
|
Parameter: |
643 |
|
|
@Name: bt--body |
644 |
|
|
@Description: |
645 |
|
|
@@@: Bug tracking system - main description |
646 |
|
|
@@lang: en |
647 |
|
|
|