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