/[pub]/suikawiki/script/misc/plugins/bugtrack.pm
Suika

Contents of /suikawiki/script/misc/plugins/bugtrack.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Sun May 16 23:05:49 2010 UTC (14 years, 11 months ago) by wakaba
Branch: MAIN
CVS Tags: suikawiki3-redirect, HEAD
added latest .pm files

1 use strict;
2 package SuikaWiki::Plugin::Registry;
3
4
5 our %Info;
6 $Info{q#BugTrack#}->{Name} = q#BugTrack#;
7 $Info{q#BugTrack#}->{q#Version#} = q#2004.0811.0509#;
8 $Info{q#BugTrack#}->{q#InterfaceVersion#} = q#2.9.1#;
9 $Info{q#BugTrack#}->{q#mkpluginVersion#} = q#2.1.19#;
10 $Info{q#BugTrack#}->{q#module_name#} = q#SuikaWiki::Plugin::plugin::BugTrack1040711050942eZAE#;
11 $Info{q#BugTrack#}->{q#Date.RCS#} = q#$Date: 2004/05/18 11:25:11 $#;
12 $Info{q#BugTrack#}->{RequiredPlugin} = [q#WikiLinking#, q#WikiResource#];
13 $Info{q#BugTrack#}->{Description} = [[q#SuikaWiki Bug Tracking System#, q#en#, q##]];
14 $Info{q#BugTrack#}->{License} = [[q#%%Perl%%#, q##, q##]];
15 $Info{q#BugTrack#}->{Author} = [[[[q#Wakaba#, q#ja#, q#Latn#]], [[q#w@suika.fam.cx#]], [q##]]];
16 package SuikaWiki::Plugin::plugin::BugTrack1040711050942eZAE;
17
18
19 #line 1 "(WikiPlugin module source bugtrack.wp2, block Plugin/Use)"
20 my $WIKILINKING;
21 my $WIKIRESOURCE;
22 my %BugProp = (
23 Status => {
24 name => 'Status',
25 uri => q#http://suika.fam.cx/~wakaba/archive/2004/8/11/sw-bt\#status#,
26 },
27 Priority => {
28 name => 'Priority',
29 uri => q#http://suika.fam.cx/~wakaba/archive/2004/8/11/sw-bt\#priority#,
30 },
31 Category => {
32 name => 'Category',
33 uri => q#http://suika.fam.cx/~wakaba/archive/2004/8/11/sw-bt\#category#,
34 is_list => 1,
35 },
36 Subject => {
37 name => 'Subject',
38 uri => q#http://suika.fam.cx/~wakaba/archive/2004/8/11/sw-bt\#subject#,
39 },
40 CreationDate => {
41 name => 'CreationDate',
42 uri => q#http://suika.fam.cx/~wakaba/archive/2004/8/11/sw-bt\#creation-date#,
43 },
44 );
45 #line 1 "(WikiPlugin module BugTrack, chunk 1)"
46
47 {my $def = {q#Parameter#, {q#ns#, {q#Type#, q#WikiName#, q#Default#, q#(auto)#, q#Description#, [[q#Bug track WikiPage#, q#en#, q##]]}}, q#Description#, [[q#Bug list#, q#en#, q##]], q#main#, sub {my ($f, $rule_name, $p, $o, %opt) = @_;
48
49 #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#view#, q#view-resource#, q#form-input#]/bt__bug_list']/Formatting)"
50 $p->{q#ns#} = do { my $r = $f->parse_attr ($p=>q#ns#, $o, -non_parsed_to_node => 1, %opt); ref $r?$r->inner_text:$r};
51 my $ns = $o->{wiki}->name ($p->{ns} || $o->{wiki}->{var}->{page});
52 my $option_ns = $ns->clone;
53 $option_ns->append_component ('Options');
54 my @bugs = map {[$o->{wiki}->name ($_), $_->[$#$_-1] * 100 + $_->[$#$_]]}
55 grep {$_->[$#$_] =~ /^[0-9]+$/}
56 map {$o->{wiki}->{db}->keys ('content',
57 -ns => $_,
58 -type => 'key',
59 -recursive => 0)}
60 grep {$_->[$#$_] =~ /^[0-9]+$/}
61 $o->{wiki}->{db}->keys ('content',
62 -ns => $ns,
63 -type => 'ns',
64 -recursive => 0);
65 my $props = ($WIKIRESOURCE ||= SuikaWiki::Plugin->module_package ('WikiResource'))->get (name => 'Plugin:BugTrack:Table:Row',
66 wiki => $o->{wiki}, o => $o);
67 my $fmt = SuikaWiki::Plugin->formatter ('bt__bug_table_header');
68 my $tbl = $p->{-parent}
69 ->append_new_node (type => '#element',
70 namespace_uri => q#http://www.w3.org/1999/xhtml#,
71 local_name => 'table');
72 $tbl->set_attribute (class => 'bt--bugtrack');
73 $tbl->set_attribute (summary => ($WIKIRESOURCE ||= SuikaWiki::Plugin->module_package ('WikiResource'))->get_op
74 ('BugTrack:Table:Summary', $o)->inner_text);
75 $fmt->replace ($props, param => $o,
76 -parent =>
77 $tbl->append_new_node (type => '#element',
78 namespace_uri => q#http://www.w3.org/1999/xhtml#,
79 local_name => 'thead')
80 ->append_new_node (type => '#element',
81 namespace_uri => q#http://www.w3.org/1999/xhtml#,
82 local_name => 'tr'));
83 $tbl->append_text ("\n");
84 $fmt = SuikaWiki::Plugin->formatter ('bt__bug_item');
85 my $tb = $tbl->append_new_node (type => '#element',
86 namespace_uri => q#http://www.w3.org/1999/xhtml#,
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 => SuikaWiki::Plugin::plugin::BugTrack1040711050942eZAE->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 push @class, $o->{bt__bug}->{prop}->{Status}||'open';
112 push @class, $o->{bt__bug}->{prop}->{Priority}||'normal';
113 push @class, $o->{bt__bug}->{prop}->{Category};
114 my $tr = $tb->append_new_node
115 (type => '#element',
116 namespace_uri => q#http://www.w3.org/1999/xhtml#,
117 local_name => 'tr');
118 $tr->set_attribute (class => join ' ', grep /^[\w_.+-]+$/, @class);
119 $fmt->replace ($props, param => $o, -parent => $tr);
120 $tb->append_text ("\n");
121 }}}
122 #line 1 "(WikiPlugin module BugTrack, chunk 2)"
123 ;
124 $SuikaWiki::Plugin::Rule{view}->{bt__bug_list} = $def;
125 $SuikaWiki::Plugin::Rule{view_resource}->{bt__bug_list} = $def;
126 $SuikaWiki::Plugin::Rule{form_input}->{bt__bug_list} = $def;
127 };
128
129
130 sub get_bug_properties {
131
132 #line 1 "(WikiPlugin module source bugtrack.wp2, block Function[Name='get_bug_properties']/Main)"
133 my (undef, %opt) = @_;
134 my $content_prop = $opt{o}->{wiki}->{db}->get (content_prop => $opt{page});
135 my %bug_prop;
136 PROP: {
137 for (keys %BugProp) {
138 $bug_prop{$_} = ($content_prop->get_attribute ($BugProp{$_}->{uri})
139 or last PROP)
140 ->value;
141 }
142 return \%bug_prop;
143 } # PROP
144 if ($content_prop->get_attribute_value
145 (q#http://suika.fam.cx/~wakaba/-temp/2004/04/24/mt\#media-type#,
146 default => q<IMT:text/x-suikawiki;version="0.9"##>) eq
147 q<IMT:text/x-suikawiki;version="0.9"##>) {
148 my $bug_info = $opt{o}->{wiki}->{db}->get (content => $opt{page});
149 my $f = 0;
150 for (split /\n/, $bug_info) {
151 tr/\x0A\x0D//d;
152 if (/^-\s*([0-9A-Za-z-]+)\s*:\s*(\S.*\S)/) {
153 $bug_prop{$1} = $2;
154 $f = 1;
155 } elsif (!/^-/) {
156 last if $f;
157 }
158 }
159 }
160 return \%bug_prop;
161 }
162
163 #line 1 "(WikiPlugin module BugTrack, chunk 4)"
164
165
166 $SuikaWiki::Plugin::Rule{bt__bug_item}->{-default} = {q#pre#, sub {my ($f, $rule_name, $p, $o, %opt) = @_;
167
168 #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#bt--bug-item#]/-default']/Pre)"
169 $p->{-cell_namespace_uri} = q#http://www.w3.org/1999/xhtml#;
170 $p->{-cell_local_name} = 'td';}, q#post#, sub {my ($f, $rule_name, $p, $o, %opt) = @_;
171
172 #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#bt--bug-item#]/-default']/Post)"
173 local $p->{-parent} = $o->{-result}
174 ->append_new_node
175 (type => '#element',
176 namespace_uri => $p->{-cell_namespace_uri},
177 local_name => $p->{-cell_local_name});
178 $f->call ($rule_name, 'main', $p, $o, %opt);}, q#Parameter#, {}, q#attr#, sub {my ($f, $rule_name, $p, $o, $param_name => $param_value, %opt) = @_;
179
180 #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#bt--bug-item#]/-default']/Attribute)"
181 if ($param_name eq '-boolean') {
182 $p->{$param_value} = 1;
183 } else {
184 if ($opt{-value_flag} and index ($opt{-value_flag}, 'p') > -1) {
185 $p->{-parse_flag}->{$param_name} = 1;
186 }
187 $p->{$param_name} = $param_value;
188 }}, q#Description#, [[q#Default formatting for bug list item information#, q#en#, q##]], q#main#, sub {
189 #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#bt--bug-item#]/-default']/Formatting)"
190 }}
191 #line 1 "(WikiPlugin module BugTrack, chunk 5)"
192 ;
193
194 $SuikaWiki::Plugin::Rule{bt__bug_table_header}->{-default} = {q#pre#, sub {my ($f, $rule_name, $p, $o, %opt) = @_;
195
196 #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#bt--bug-table-header#]/-default']/Pre)"
197 $p->{-cell_namespace_uri} = q#http://www.w3.org/1999/xhtml#;
198 $p->{-cell_local_name} = 'th';}, q#post#, sub {my ($f, $rule_name, $p, $o, %opt) = @_;
199
200 #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#bt--bug-table-header#]/-default']/Post)"
201 local $p->{-parent} = $o->{-result}
202 ->append_new_node
203 (type => '#element',
204 namespace_uri => $p->{-cell_namespace_uri},
205 local_name => $p->{-cell_local_name});
206 $p->{-parent}->set_attribute (class => $rule_name);
207 $p->{-parent}->set_attribute (scope => 'col');
208 $f->call ($rule_name, 'main', $p, $o, %opt);}, q#Parameter#, {}, q#attr#, sub {my ($f, $rule_name, $p, $o, $param_name => $param_value, %opt) = @_;
209
210 #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#bt--bug-table-header#]/-default']/Attribute)"
211 if ($param_name eq '-boolean') {
212 $p->{$param_value} = 1;
213 } else {
214 if ($opt{-value_flag} and index ($opt{-value_flag}, 'p') > -1) {
215 $p->{-parse_flag}->{$param_name} = 1;
216 }
217 $p->{$param_name} = $param_value;
218 }}, q#Description#, [[q#Default formatting for bug list item information#, q#en#, q##]], q#main#, sub {
219 #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#bt--bug-table-header#]/-default']/Formatting)"
220 }}
221 #line 1 "(WikiPlugin module BugTrack, chunk 7)"
222 ;
223
224 $SuikaWiki::Plugin::Rule{bt__bug_item}->{-undef} = {q#Parameter#, {}, q#Description#, [[q#Undefined rule indication#, q#en#, q##]], q#main#, sub {my ($f, $rule_name, $p, $o, %opt) = @_;
225
226 #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#bt--bug-item#]/-undef']/Formatting)"
227 $p->{-parent}->append_text ("[undef: $f->{-category_name}/$rule_name]");}}
228 #line 1 "(WikiPlugin module BugTrack, chunk 9)"
229 ;
230
231 $SuikaWiki::Plugin::Rule{bt__bug_table_header}->{-undef} = {q#Parameter#, {}, q#Description#, [[q#Column header for bug properties#, q#en#, q##]], q#main#, sub {my ($f, $rule_name, $p, $o, %opt) = @_;
232
233 #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#bt--bug-table-header#]/-undef']/Formatting)"
234 ($WIKIRESOURCE ||= SuikaWiki::Plugin->module_package ('WikiResource'))->get_op
235 ('Plugin:BugTrack:Column:'.$rule_name, $o, $p->{-parent});}}
236 #line 1 "(WikiPlugin module BugTrack, chunk 11)"
237 ;
238
239 {my $def = {q#Parameter#, {}, q#Description#, [[q#Bare text out of rule - to be ignored#, q#en#, q##]], q#main#, sub {
240 #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#bt--bug-table-header#, q#bt--bug-item#]/-bare_text']/Formatting)"
241 }}
242 #line 1 "(WikiPlugin module BugTrack, chunk 13)"
243 ;
244 $SuikaWiki::Plugin::Rule{bt__bug_table_header}->{-bare_text} = $def;
245 $SuikaWiki::Plugin::Rule{bt__bug_item}->{-bare_text} = $def;
246 };
247
248 $SuikaWiki::Plugin::Rule{bt__bug_item}->{no} = {q#Parameter#, {}, q#Description#, [[q#Bug number#, q#en#, q##]], q#main#, sub {my ($f, $rule_name, $p, $o, %opt) = @_;
249
250 #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#bt--bug-item#]/no']/Formatting)"
251 ($WIKILINKING ||= SuikaWiki::Plugin->module_package ('WikiLinking'))->to_wikipage_in_html ({
252 label => ($WIKIRESOURCE ||= SuikaWiki::Plugin->module_package ('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 #line 1 "(WikiPlugin module BugTrack, chunk 15)"
262 ;
263
264 $SuikaWiki::Plugin::Rule{bt__bug_item}->{subject} = {q#Parameter#, {}, q#Description#, [[q#Bug subject#, q#en#, q##]], q#main#, sub {my ($f, $rule_name, $p, $o, %opt) = @_;
265
266 #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#bt--bug-item#]/subject']/Formatting)"
267 ($WIKILINKING ||= SuikaWiki::Plugin->module_package ('WikiLinking'))->to_wikipage_in_html ({
268 label => ($WIKIRESOURCE ||= SuikaWiki::Plugin->module_package ('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 #line 1 "(WikiPlugin module BugTrack, chunk 17)"
278 ;
279
280 $SuikaWiki::Plugin::Rule{page_link}->{bt__property} = {q#Parameter#, {q#name#, {q#Type#, q#name#, q#Default#, q#\#REQUIRED#, q#Description#, [[q#Bug property name#, q##, q##]]}, q#default#, {q#Type#, q#CDATA#, q#Default#, q#(none)#, q#Description#, []}}, q#Description#, [], q#main#, sub {my ($f, $rule_name, $p, $o, %opt) = @_;
281
282 #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#page-link#]/bt__property']/Formatting)"
283 $p->{q#name#} = do { my $r = $f->parse_attr ($p=>q#name#, $o, -non_parsed_to_node => 1, %opt); ref $r?$r->inner_text:$r};
284 $p->{name} =~ tr/-/_/;
285 exists $o->{bt__bug}->{prop}->{$p->{name}} ?
286 $p->{-parent}->append_text ($o->{bt__bug}->{prop}->{$p->{name}}) :
287 exists $o->{bt__bug}->{$p->{name}} ?
288 $p->{-parent}->append_text ($o->{bt__bug}->{$p->{name}}) :
289 do {$f->parse_attr ($p=>q#default#, $o, -parent => $p->{-parent}, -non_parsed_to_node => 1, %opt);};}}
290 #line 1 "(WikiPlugin module BugTrack, chunk 19)"
291 ;
292
293 $SuikaWiki::Plugin::Rule{bt__bug_item}->{status} = {q#Parameter#, {}, q#Description#, [[q#Bug status#, q#en#, q##]], q#main#, sub {my ($f, $rule_name, $p, $o, %opt) = @_;
294
295 #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#bt--bug-item#]/status']/Formatting)"
296 ($WIKIRESOURCE ||= SuikaWiki::Plugin->module_package ('WikiResource'))->get_op ('Status:'.($o->{bt__bug}->{prop}->{Status}
297 or '(default)'),
298 $o, $p->{-parent},
299 ns => $o->{bt__bug}->{bug_option_ns},
300 default => $o->{bt__bug}->{prop}->{Status}
301 || '(default)');}}
302 #line 1 "(WikiPlugin module BugTrack, chunk 21)"
303 ;
304
305 $SuikaWiki::Plugin::Rule{bt__bug_item}->{priority} = {q#Parameter#, {}, q#Description#, [[q#Bug priority#, q#en#, q##]], q#main#, sub {my ($f, $rule_name, $p, $o, %opt) = @_;
306
307 #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#bt--bug-item#]/priority']/Formatting)"
308 ($WIKIRESOURCE ||= SuikaWiki::Plugin->module_package ('WikiResource'))->get_op ('Priority:'.($o->{bt__bug}->{prop}->{Priority}
309 or '(default)'),
310 $o, $p->{-parent},
311 ns => $o->{bt__bug}->{bug_option_ns},
312 default => $o->{bt__bug}->{prop}->{Priority}
313 || '(default)');}}
314 #line 1 "(WikiPlugin module BugTrack, chunk 23)"
315 ;
316
317 $SuikaWiki::Plugin::Rule{bt__bug_item}->{category} = {q#Parameter#, {}, q#Description#, [[q#Bug category#, q#en#, q##]], q#main#, sub {my ($f, $rule_name, $p, $o, %opt) = @_;
318
319 #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#bt--bug-item#]/category']/Formatting)"
320 ($WIKIRESOURCE ||= SuikaWiki::Plugin->module_package ('WikiResource'))->get_op ('Category:'.($o->{bt__bug}->{prop}->{Category}
321 or '(default)'),
322 $o, $p->{-parent},
323 ns => $o->{bt__bug}->{bug_option_ns},
324 default => $o->{bt__bug}->{prop}->{Category}
325 || '(default)');}}
326 #line 1 "(WikiPlugin module BugTrack, chunk 25)"
327 ;
328
329 $SuikaWiki::Plugin::Rule{bt__bug_item}->{last_modified} = {q#Parameter#, {}, q#Description#, [[q#Bug last modified date-time#, q#en#, q##]], q#main#, sub {my ($f, $rule_name, $p, $o, %opt) = @_;
330
331 #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#bt--bug-item#]/last_modified']/Formatting)"
332 my @time = gmtime $o->{bt__bug}->{lm};
333 $p->{-parent}->append_text
334 (sprintf '%04d-%02d-%02d %02d:%02d:%02d +00:00',
335 $time[5]+1900,$time[4]+1,@time[3,2,1,0]);}}
336 #line 1 "(WikiPlugin module BugTrack, chunk 27)"
337 ;
338
339 {my $def = {q#Parameter#, {q#ns#, {q#Type#, q#WikiName#, q#Default#, q#(auto)#, q#Description#, [[q#WikiPage name of bug tracking#, q#en#, q##]]}}, q#Description#, [[q#Creating-new-bug-item form#, q#en#, q##]], q#main#, sub {my ($f, $rule_name, $p, $o, %opt) = @_;
340
341 #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#view#, q#view-resource#, q#form-input#]/bt__create_new_bug']/Formatting)"
342 $p->{q#ns#} = do { my $r = $f->parse_attr ($p=>q#ns#, $o, -non_parsed_to_node => 1, %opt); ref $r?$r->inner_text:$r};
343 my $page = $o->{wiki}->name ($p->{ns} || $o->{wiki}->{var}->{page});
344 SuikaWiki::Plugin->module_package ('WikiFormCore')
345 ->make_form_in_html
346 ($p->{-parent}, $p->{content} ||
347 ($WIKIRESOURCE ||= SuikaWiki::Plugin->module_package ('WikiResource'))->get
348 (name => 'BugTrack:CreateForm:Content',
349 o => $o, wiki => $o->{wiki}),
350 wiki => $o->{wiki}, o => $o,
351 index => -1,
352 output => {
353 mode => 'bt--bug-create',
354 page => $page,
355 });}}
356 #line 1 "(WikiPlugin module BugTrack, chunk 29)"
357 ;
358 $SuikaWiki::Plugin::Rule{view}->{bt__create_new_bug} = $def;
359 $SuikaWiki::Plugin::Rule{view_resource}->{bt__create_new_bug} = $def;
360 $SuikaWiki::Plugin::Rule{form_input}->{bt__create_new_bug} = $def;
361 };
362
363
364 sub get_new_bug_page {
365
366 #line 1 "(WikiPlugin module source bugtrack.wp2, block Function[Name='get_new_bug_page']/Main)"
367 my (undef, %opt) = @_;
368 my $max_ns = $opt{ns}->clone;
369 $max_ns->append_component ('1');
370 for ( grep {$_->[$#$_] =~ /^[0-9]+$/}
371 $opt{o}->{wiki}->{db}->keys ('content',
372 -ns => $opt{ns},
373 -type => 'ns',
374 -recursive => 0)) {
375 $max_ns = $_ if $_->[$#$_] > $max_ns->[$#$_];
376 }
377 my $max = ref $max_ns eq 'ARRAY' ? $opt{o}->{wiki}->name ($max_ns)
378 : $max_ns->clone;
379 $max->append_component ('0');
380 for ( grep {$_->[$#$_] =~ /^[0-9]+$/}
381 $opt{o}->{wiki}->{db}->keys ('content',
382 -ns => $max_ns,
383 -type => 'key',
384 -recursive => 0)) {
385 $max = $_ if $_->[$#$_] > $max->[$#$_];
386 }
387 $max->[$#$max]++;
388 $max->[$#$max-1]++, $max->[$#$max] = 1 if $max->[$#$max] > 100;
389 $opt{o}->{wiki}->name ($max);
390 }
391
392 #line 1 "(WikiPlugin module BugTrack, chunk 31)"
393
394
395 {my $def = {q#Parameter#, {}, q#Description#, [[q#Root of bugtrack#, q#en#, q##]], q#main#, sub {my ($f, $rule_name, $p, $o, %opt) = @_;
396
397 #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#view#, q#view-resource#, q#form-input#]/bt__bug_root_page']/Formatting)"
398 $p->{q#ns#} = do { my $r = $f->parse_attr ($p=>q#ns#, $o, -non_parsed_to_node => 1, %opt); ref $r?$r->inner_text:$r};
399 my $ns = $o->{wiki}->name ($p->{ns} || $o->{wiki}->{var}->{page});
400 if ($#$ns > 1) {
401 delete $ns->[$#$ns] if $ns->[$#$ns] =~ /^[0-9]+$/;
402 delete $ns->[$#$ns] if $ns->[$#$ns] =~ /^[0-9]+$/;
403 }
404 $p->{-parent}->append_text ($ns->stringify (wiki => $o->{wiki}));}}
405 #line 1 "(WikiPlugin module BugTrack, chunk 32)"
406 ;
407 $SuikaWiki::Plugin::Rule{view}->{bt__bug_root_page} = $def;
408 $SuikaWiki::Plugin::Rule{view_resource}->{bt__bug_root_page} = $def;
409 $SuikaWiki::Plugin::Rule{form_input}->{bt__bug_root_page} = $def;
410 };
411
412 {my $def = {q#Parameter#, {}, q#Description#, [[q#If one of bug track item WikiPages#, q#en#, q##]], q#main#, sub {my ($f, $rule_name, $p, $o, %opt) = @_;
413
414 #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#view#, q#view-resource#, q#form-input#]/bt__if_one_of_bug']/Formatting)"
415 $p->{q#ns#} = do { my $r = $f->parse_attr ($p=>q#ns#, $o, -non_parsed_to_node => 1, %opt); ref $r?$r->inner_text:$r};
416 my $ns = $o->{wiki}->name ($p->{ns} || $o->{wiki}->{var}->{page});
417 if ($#$ns > 1 and
418 $ns->[$#$ns] =~ /^[0-9]+$/ and
419 $ns->[$#$ns - 1] =~ /^[0-9]+$/) {
420 $f->parse_attr ($p=>q#true#, $o, -parent => $p->{-parent}, -non_parsed_to_node => 1, %opt);
421 } else {
422 $f->parse_attr ($p=>q#false#, $o, -parent => $p->{-parent}, -non_parsed_to_node => 1, %opt);
423 }}}
424 #line 1 "(WikiPlugin module BugTrack, chunk 34)"
425 ;
426 $SuikaWiki::Plugin::Rule{view}->{bt__if_one_of_bug} = $def;
427 $SuikaWiki::Plugin::Rule{view_resource}->{bt__if_one_of_bug} = $def;
428 $SuikaWiki::Plugin::Rule{form_input}->{bt__if_one_of_bug} = $def;
429 };
430
431 push @SuikaWiki::View::Implementation::CommonViewDefs, {
432 condition => {q#mode#, q#bt__bug_create#, q#output#, q#http-cgi#, q#http_method#, [q#POST#]},
433 object_class => q#SuikaWiki::Plugin::plugin::BugTrack1040711050942eZAE::bt__bug_create10407110509420Q_5#,
434 };
435 package SuikaWiki::Plugin::plugin::BugTrack1040711050942eZAE::bt__bug_create10407110509420Q_5;
436
437
438 our @ISA = q#SuikaWiki::View::template#;
439 sub main ($$) {
440 my ($self, $opt, $opt2) = @_;
441
442 #line 1 "(WikiPlugin module source bugtrack.wp2, block ViewDefinition[Mode='bt__bug_create']/method[Name='main'])"
443 my $wiki = $self->{view}->{wiki};
444 $wiki->{var}->{db}->{read_only}->{content} = 0;
445 $wiki->{var}->{db}->{read_only}->{content_prop} = 0;
446 $wiki->{var}->{db}->{read_only}->{lastmodified} = 0;
447 $self->{view}->init_db;
448 my $ns = $wiki->{var}->{page};
449 my $o = {
450 wiki => $wiki,
451 };
452 $o->{bt__bug} = {
453 bug_ns => $ns,
454 bug_page => SuikaWiki::Plugin::plugin::BugTrack1040711050942eZAE->get_new_bug_page
455 (ns => $ns, o => $o),
456 };
457 my $content_prop = $wiki->{db}->get
458 (content_prop => $o->{bt__bug}->{bug_page});
459 $content_prop->set_attribute
460 (q#http://suika.fam.cx/~wakaba/-temp/2004/04/24/mt\#media-type# => q<IMT:text/x-suikawiki;version="0.9"##>);
461 my @page;
462 for (qw/Subject Priority Status Category/) {
463 my $value = $o->{wiki}->{input}->parameter ('bt--' . lc $_)
464 || ($SuikaWiki::Plugin::Registry::Info{q#WikiResource#}->{module_name} || SuikaWiki::Plugin->module_package (q#WikiResource#))
465 ->get (name => 'BugTrack:'.$_.':Default',
466 o => $o, wiki => $o->{wiki});
467 $content_prop->set_attribute ($BugProp{$_}->{uri} => $value);
468 $o->{bt__bug}->{prop}->{$_} = $value;
469 }
470 $content_prop->set_attribute ($BugProp{CreationDate}->{uri} => time);
471 $wiki->{db}->set (content_prop => $o->{bt__bug}->{bug_page}
472 => $content_prop);
473 $wiki->{db}->set (lastmodified => $o->{bt__bug}->{bug_page}
474 => time);
475 my $page = '[1]' . "\n" . $o->{wiki}->{input}->parameter ('bt--body');
476 $wiki->{db}->set (content => $o->{bt__bug}->{bug_page}
477 => join "\x0A", $page);
478 my $uri = $self->{view}->{wiki}->uri_reference
479 (page => $o->{bt__bug}->{bug_page},
480 up_to_date => 1);
481 require SuikaWiki::Output::HTTP;
482 my $output = SuikaWiki::Output::HTTP->new (wiki => $self->{view}->{wiki});
483 $output->set_redirect (uri => $uri, status_code => 303,
484 status_phrase => q(Created));
485 $output->output (output => 'http-cgi');}
486
487 #line 1 "(WikiPlugin module BugTrack, chunk 36)"
488
489 push @{$SuikaWiki::View::Implementation::TemplateFragment{q#links#}}, {
490 Main => q#%bt--if-one-of-bug (
491 true => {
492 %link-to-wikipage (
493 page => {%bt--bug-root-page;}p,
494 rel => top,
495 label => {%html-link (
496 description => {%page-name;}p,
497 );},
498 );
499 }p,
500 );#,
501 Order => 0,
502 Description => [[q#Web page to web page links - bug tracking system#, q#en#, q##]],
503 };
504
505 push @{$SuikaWiki::View::Implementation::TemplateFragment{q#wr__read_body#}}, {
506 Main => q#%bt--if-one-of-bug (
507 true => {
508 %pe--propedit (template => {
509 %resource-as-plain-text (name => {BugTrack:PropEdit:Template});
510 }p);
511 }p,
512 );#,
513 Order => -10,
514 Description => [[q#"Read" mode body -- Bug information#, q#en#, q##]],
515 };
516
517 package SuikaWiki::Plugin::Resource;
518
519 our $BaseResource;
520 $BaseResource->{q#en#}->{q##}->{q#BugTrack:Category:Default#} = q#(default)#;
521 $BaseResource->{q#en#}->{q##}->{q#BugTrack:Category:Label#} = q#Category#;
522 $BaseResource->{q#und#}->{q##}->{q#BugTrack:CreateForm:Content#} = q#%line (content => { %text (id=>bt--subject,label=>{%res (name => {BugTrack:Subject:Label});}p,default=>{%res (name => {BugTrack:Subject:Default});}p,size=>15); }p); %line (content => { %res (name => {BugTrack:Priority:Label}); %radio(id=>bt--priority,label=>{%res (name => {BugTrack:Priority:high});}p,value=>{high}); %radio(id=>bt--priority,default,label=>{%res (name => {BugTrack:Priority:normal});}p,value=>{normal}); %radio(id=>bt--priority,label=>{%res (name => {BugTrack:Priority:low});}p,value=>{low}); }p); %line (content => { %res (name => {BugTrack:Status:Label}); %radio(id=>bt--status,default,label=>{%res (name => {BugTrack:Status:open});}p,value=>{open}); %radio(id=>bt--status,label=>{%res (name => {BugTrack:Status:reserved});}p,value=>{reserved}); %radio(id=>bt--status,label=>{%res (name => {BugTrack:Status:closed});}p,value=>{closed}); }p); %line (content => { %text (id=>bt--category,label=>{%res (name => {BugTrack:Category:Label});}p,size=>10); }p); %line (content => { %textarea ( id => bt--body, size=>15,lines=>5, label=>{%res (name => {BugTrack:CreateForm:MainText:Label});}p, ); %submit (label => {%res (name => {Form:Label:Add});}p, description => {%res (name => {Form:Description:Add});}p); }p);#;
523 $BaseResource->{q#en#}->{q##}->{q#BugTrack:CreateForm:MainText:Label#} = q#Bug description#;
524 $BaseResource->{q#und#}->{q##}->{q#BugTrack:Item:Number:Label#} = q#%link-to-it (label => {%bt--property (name => bug-no);}p, default => {0});#;
525 $BaseResource->{q#en#}->{q##}->{q#BugTrack:Item:Subject:Default#} = q#No Title#;
526 $BaseResource->{q#und#}->{q##}->{q#BugTrack:Item:Subject:Label#} = q#%link-to-it (label => {%bt--property ( name => Subject, default => {%res (name => {BugTrack:Item:Subject:Default});}p, );}p);#;
527 $BaseResource->{q#en#}->{q##}->{q#BugTrack:Priority:Default#} = q#normal#;
528 $BaseResource->{q#en#}->{q##}->{q#BugTrack:Priority:Label#} = q#Priority#;
529 $BaseResource->{q#en#}->{q##}->{q#BugTrack:Priority:high#} = q#HIGH#;
530 $BaseResource->{q#en#}->{q##}->{q#BugTrack:Priority:low#} = q#low#;
531 $BaseResource->{q#en#}->{q##}->{q#BugTrack:Priority:normal#} = q#normal#;
532 $BaseResource->{q#und#}->{q##}->{q#BugTrack:PropEdit:Template#} = q#%line (content => { %text (label => {%res (name => {BugTrack:Subject:Label});}p, id => bt--subject, size => 20, source => prop); }p); %list ( x => { %text (label => {%res (name => {BugTrack:Category:Label});}p, id => bt--category, size => 20, source => prop); }p, x => {%submit (label => {%res (name => {WikiForm:Change});}p);}p, );#;
533 $BaseResource->{q#en#}->{q##}->{q#BugTrack:Status:Default#} = q#open#;
534 $BaseResource->{q#en#}->{q##}->{q#BugTrack:Status:Label#} = q#Status#;
535 $BaseResource->{q#en#}->{q##}->{q#BugTrack:Status:closed#} = q#closed#;
536 $BaseResource->{q#en#}->{q##}->{q#BugTrack:Status:open#} = q#OPEN#;
537 $BaseResource->{q#en#}->{q##}->{q#BugTrack:Status:reserved#} = q#reserved#;
538 $BaseResource->{q#en#}->{q##}->{q#BugTrack:Subject:Default#} = q#New bug#;
539 $BaseResource->{q#en#}->{q##}->{q#BugTrack:Subject:Label#} = q#Subject#;
540 $BaseResource->{q#en#}->{q##}->{q#BugTrack:Table:Summary#} = q#This table shows reported bugs. Each row represent each bug, each row in turn contains of bug number, status, priority, subject and last-modified date-time.#;
541 $BaseResource->{q#en#}->{q##}->{q#Plugin:BugTrack:Column:category#} = q#Category#;
542 $BaseResource->{q#en#}->{q##}->{q#Plugin:BugTrack:Column:last_modified#} = q#Last Modified#;
543 $BaseResource->{q#en#}->{q##}->{q#Plugin:BugTrack:Column:no#} = q#\##;
544 $BaseResource->{q#en#}->{q##}->{q#Plugin:BugTrack:Column:priority#} = q#Priority#;
545 $BaseResource->{q#en#}->{q##}->{q#Plugin:BugTrack:Column:status#} = q#Status#;
546 $BaseResource->{q#en#}->{q##}->{q#Plugin:BugTrack:Column:subject#} = q#Subject#;
547 $BaseResource->{q#en#}->{q##}->{q#Plugin:BugTrack:Table:Row#} = q#%no; %status; %priority; %category; %subject; %last-modified;#;
548 package SuikaWiki::Plugin::Registry;
549
550 $Info{q#BugTrack#}->{provide} = {q#rule#, {q#form_input#, [q#bt__bug_list#, q#bt__create_new_bug#, q#bt__bug_root_page#, q#bt__if_one_of_bug#], q#bt__bug_item#, [q#-default#, q#-undef#, q#-bare_text#, q#no#, q#subject#, q#status#, q#priority#, q#category#, q#last_modified#], q#view#, [q#bt__bug_list#, q#bt__create_new_bug#, q#bt__bug_root_page#, q#bt__if_one_of_bug#], q#view_resource#, [q#bt__bug_list#, q#bt__create_new_bug#, q#bt__bug_root_page#, q#bt__if_one_of_bug#], q#bt__bug_table_header#, [q#-default#, q#-undef#, q#-bare_text#], q#page_link#, [q#bt__property#]}, q#viewfragment#, [{q#Name#, q#links#}, {q#Name#, q#wr__read_body#}], q#viewdef#, [{q#Description#, [q#Create a new bug WikiPage#, q#en#, q##], q#Name#, q#bt__bug_create#}]};
551
552 1;

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24