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