use strict; package SuikaWiki::Plugin::Registry; our %Info; $Info{q#BugTrack#}->{Name} = q#BugTrack#; $Info{q#BugTrack#}->{q#Version#} = q#2004.0811.0509#; $Info{q#BugTrack#}->{q#InterfaceVersion#} = q#2.9.1#; $Info{q#BugTrack#}->{q#mkpluginVersion#} = q#2.1.19#; $Info{q#BugTrack#}->{q#module_name#} = q#SuikaWiki::Plugin::plugin::BugTrack1040711050942eZAE#; $Info{q#BugTrack#}->{q#Date.RCS#} = q#$Date: 2010/05/16 23:05:49 $#; $Info{q#BugTrack#}->{RequiredPlugin} = [q#WikiLinking#, q#WikiResource#]; $Info{q#BugTrack#}->{Description} = [[q#SuikaWiki Bug Tracking System#, q#en#, q##]]; $Info{q#BugTrack#}->{License} = [[q#%%Perl%%#, q##, q##]]; $Info{q#BugTrack#}->{Author} = [[[[q#Wakaba#, q#ja#, q#Latn#]], [[q#w@suika.fam.cx#]], [q##]]]; package SuikaWiki::Plugin::plugin::BugTrack1040711050942eZAE; #line 1 "(WikiPlugin module source bugtrack.wp2, block Plugin/Use)" my $WIKILINKING; my $WIKIRESOURCE; my %BugProp = ( Status => { name => 'Status', uri => q#http://suika.fam.cx/~wakaba/archive/2004/8/11/sw-bt\#status#, }, Priority => { name => 'Priority', uri => q#http://suika.fam.cx/~wakaba/archive/2004/8/11/sw-bt\#priority#, }, Category => { name => 'Category', uri => q#http://suika.fam.cx/~wakaba/archive/2004/8/11/sw-bt\#category#, is_list => 1, }, Subject => { name => 'Subject', uri => q#http://suika.fam.cx/~wakaba/archive/2004/8/11/sw-bt\#subject#, }, CreationDate => { name => 'CreationDate', uri => q#http://suika.fam.cx/~wakaba/archive/2004/8/11/sw-bt\#creation-date#, }, ); #line 1 "(WikiPlugin module BugTrack, chunk 1)" {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) = @_; #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#view#, q#view-resource#, q#form-input#]/bt__bug_list']/Formatting)" $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}; my $ns = $o->{wiki}->name ($p->{ns} || $o->{wiki}->{var}->{page}); my $option_ns = $ns->clone; $option_ns->append_component ('Options'); my @bugs = map {[$o->{wiki}->name ($_), $_->[$#$_-1] * 100 + $_->[$#$_]]} grep {$_->[$#$_] =~ /^[0-9]+$/} map {$o->{wiki}->{db}->keys ('content', -ns => $_, -type => 'key', -recursive => 0)} grep {$_->[$#$_] =~ /^[0-9]+$/} $o->{wiki}->{db}->keys ('content', -ns => $ns, -type => 'ns', -recursive => 0); my $props = ($WIKIRESOURCE ||= SuikaWiki::Plugin->module_package ('WikiResource'))->get (name => 'Plugin:BugTrack:Table:Row', wiki => $o->{wiki}, o => $o); my $fmt = SuikaWiki::Plugin->formatter ('bt__bug_table_header'); my $tbl = $p->{-parent} ->append_new_node (type => '#element', namespace_uri => q#http://www.w3.org/1999/xhtml#, local_name => 'table'); $tbl->set_attribute (class => 'bt--bugtrack'); $tbl->set_attribute (summary => ($WIKIRESOURCE ||= SuikaWiki::Plugin->module_package ('WikiResource'))->get_op ('BugTrack:Table:Summary', $o)->inner_text); $fmt->replace ($props, param => $o, -parent => $tbl->append_new_node (type => '#element', namespace_uri => q#http://www.w3.org/1999/xhtml#, local_name => 'thead') ->append_new_node (type => '#element', namespace_uri => q#http://www.w3.org/1999/xhtml#, local_name => 'tr')); $tbl->append_text ("\n"); $fmt = SuikaWiki::Plugin->formatter ('bt__bug_item'); my $tb = $tbl->append_new_node (type => '#element', namespace_uri => q#http://www.w3.org/1999/xhtml#, local_name => 'tbody'); my $weight = { Priority => {high => 1, normal => 2, low => 3}, Status => {open => 1, reserved => 2, closed => 3}, }; for $_ (sort { $weight->{Status}->{$a->{prop}->{Status}||'open'} <=> $weight->{Status}->{$b->{prop}->{Status}||'open'} || $weight->{Priority}->{$a->{prop}->{Priority}||'normal'} <=> $weight->{Priority}->{$b->{prop}->{Priority}||'normal'} || $b->{lm} <=> $a->{lm} || $a->{prop}->{Category} cmp $b->{prop}->{Category} || $b->{bug_no} <=> $a->{bug_no} } map {{ bug_ns => $ns, bug_option_ns => $option_ns, bug_page => $_->[0], bug_no => $_->[1], prop => SuikaWiki::Plugin::plugin::BugTrack1040711050942eZAE->get_bug_properties (page => $_->[0], o => $o), lm => $o->{wiki}->{db}->get (lastmodified => $_->[0]), }} @bugs) { local $o->{bt__bug} = $_; my @class; push @class, $o->{bt__bug}->{prop}->{Status}||'open'; push @class, $o->{bt__bug}->{prop}->{Priority}||'normal'; push @class, $o->{bt__bug}->{prop}->{Category}; my $tr = $tb->append_new_node (type => '#element', namespace_uri => q#http://www.w3.org/1999/xhtml#, local_name => 'tr'); $tr->set_attribute (class => join ' ', grep /^[\w_.+-]+$/, @class); $fmt->replace ($props, param => $o, -parent => $tr); $tb->append_text ("\n"); }}} #line 1 "(WikiPlugin module BugTrack, chunk 2)" ; $SuikaWiki::Plugin::Rule{view}->{bt__bug_list} = $def; $SuikaWiki::Plugin::Rule{view_resource}->{bt__bug_list} = $def; $SuikaWiki::Plugin::Rule{form_input}->{bt__bug_list} = $def; }; sub get_bug_properties { #line 1 "(WikiPlugin module source bugtrack.wp2, block Function[Name='get_bug_properties']/Main)" my (undef, %opt) = @_; my $content_prop = $opt{o}->{wiki}->{db}->get (content_prop => $opt{page}); my %bug_prop; PROP: { for (keys %BugProp) { $bug_prop{$_} = ($content_prop->get_attribute ($BugProp{$_}->{uri}) or last PROP) ->value; } return \%bug_prop; } # PROP if ($content_prop->get_attribute_value (q#http://suika.fam.cx/~wakaba/-temp/2004/04/24/mt\#media-type#, default => q) eq q) { my $bug_info = $opt{o}->{wiki}->{db}->get (content => $opt{page}); my $f = 0; for (split /\n/, $bug_info) { tr/\x0A\x0D//d; if (/^-\s*([0-9A-Za-z-]+)\s*:\s*(\S.*\S)/) { $bug_prop{$1} = $2; $f = 1; } elsif (!/^-/) { last if $f; } } } return \%bug_prop; } #line 1 "(WikiPlugin module BugTrack, chunk 4)" $SuikaWiki::Plugin::Rule{bt__bug_item}->{-default} = {q#pre#, sub {my ($f, $rule_name, $p, $o, %opt) = @_; #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#bt--bug-item#]/-default']/Pre)" $p->{-cell_namespace_uri} = q#http://www.w3.org/1999/xhtml#; $p->{-cell_local_name} = 'td';}, q#post#, sub {my ($f, $rule_name, $p, $o, %opt) = @_; #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#bt--bug-item#]/-default']/Post)" local $p->{-parent} = $o->{-result} ->append_new_node (type => '#element', namespace_uri => $p->{-cell_namespace_uri}, local_name => $p->{-cell_local_name}); $f->call ($rule_name, 'main', $p, $o, %opt);}, q#Parameter#, {}, q#attr#, sub {my ($f, $rule_name, $p, $o, $param_name => $param_value, %opt) = @_; #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#bt--bug-item#]/-default']/Attribute)" if ($param_name eq '-boolean') { $p->{$param_value} = 1; } else { if ($opt{-value_flag} and index ($opt{-value_flag}, 'p') > -1) { $p->{-parse_flag}->{$param_name} = 1; } $p->{$param_name} = $param_value; }}, q#Description#, [[q#Default formatting for bug list item information#, q#en#, q##]], q#main#, sub { #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#bt--bug-item#]/-default']/Formatting)" }} #line 1 "(WikiPlugin module BugTrack, chunk 5)" ; $SuikaWiki::Plugin::Rule{bt__bug_table_header}->{-default} = {q#pre#, sub {my ($f, $rule_name, $p, $o, %opt) = @_; #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#bt--bug-table-header#]/-default']/Pre)" $p->{-cell_namespace_uri} = q#http://www.w3.org/1999/xhtml#; $p->{-cell_local_name} = 'th';}, q#post#, sub {my ($f, $rule_name, $p, $o, %opt) = @_; #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#bt--bug-table-header#]/-default']/Post)" local $p->{-parent} = $o->{-result} ->append_new_node (type => '#element', namespace_uri => $p->{-cell_namespace_uri}, local_name => $p->{-cell_local_name}); $p->{-parent}->set_attribute (class => $rule_name); $p->{-parent}->set_attribute (scope => 'col'); $f->call ($rule_name, 'main', $p, $o, %opt);}, q#Parameter#, {}, q#attr#, sub {my ($f, $rule_name, $p, $o, $param_name => $param_value, %opt) = @_; #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#bt--bug-table-header#]/-default']/Attribute)" if ($param_name eq '-boolean') { $p->{$param_value} = 1; } else { if ($opt{-value_flag} and index ($opt{-value_flag}, 'p') > -1) { $p->{-parse_flag}->{$param_name} = 1; } $p->{$param_name} = $param_value; }}, q#Description#, [[q#Default formatting for bug list item information#, q#en#, q##]], q#main#, sub { #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#bt--bug-table-header#]/-default']/Formatting)" }} #line 1 "(WikiPlugin module BugTrack, chunk 7)" ; $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) = @_; #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#bt--bug-item#]/-undef']/Formatting)" $p->{-parent}->append_text ("[undef: $f->{-category_name}/$rule_name]");}} #line 1 "(WikiPlugin module BugTrack, chunk 9)" ; $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) = @_; #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#bt--bug-table-header#]/-undef']/Formatting)" ($WIKIRESOURCE ||= SuikaWiki::Plugin->module_package ('WikiResource'))->get_op ('Plugin:BugTrack:Column:'.$rule_name, $o, $p->{-parent});}} #line 1 "(WikiPlugin module BugTrack, chunk 11)" ; {my $def = {q#Parameter#, {}, q#Description#, [[q#Bare text out of rule - to be ignored#, q#en#, q##]], q#main#, sub { #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#bt--bug-table-header#, q#bt--bug-item#]/-bare_text']/Formatting)" }} #line 1 "(WikiPlugin module BugTrack, chunk 13)" ; $SuikaWiki::Plugin::Rule{bt__bug_table_header}->{-bare_text} = $def; $SuikaWiki::Plugin::Rule{bt__bug_item}->{-bare_text} = $def; }; $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) = @_; #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#bt--bug-item#]/no']/Formatting)" ($WIKILINKING ||= SuikaWiki::Plugin->module_package ('WikiLinking'))->to_wikipage_in_html ({ label => ($WIKIRESOURCE ||= SuikaWiki::Plugin->module_package ('WikiResource'))->get (name => 'BugTrack:Item:Number:Label', wiki => $o->{wiki}, o => $o), } => { base => $o->{bt__bug}->{bug_ns}, page_name_relative => $o->{bt__bug}->{bug_page}, }, { o => $o, parent => $p->{-parent}, });}} #line 1 "(WikiPlugin module BugTrack, chunk 15)" ; $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) = @_; #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#bt--bug-item#]/subject']/Formatting)" ($WIKILINKING ||= SuikaWiki::Plugin->module_package ('WikiLinking'))->to_wikipage_in_html ({ label => ($WIKIRESOURCE ||= SuikaWiki::Plugin->module_package ('WikiResource'))->get (name => 'BugTrack:Item:Subject:Label', wiki => $o->{wiki}, o => $o), } => { base => $o->{bt__bug}->{bug_ns}, page_name_relative => $o->{bt__bug}->{bug_page}, }, { o => $o, parent => $p->{-parent}, });}} #line 1 "(WikiPlugin module BugTrack, chunk 17)" ; $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) = @_; #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#page-link#]/bt__property']/Formatting)" $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}; $p->{name} =~ tr/-/_/; exists $o->{bt__bug}->{prop}->{$p->{name}} ? $p->{-parent}->append_text ($o->{bt__bug}->{prop}->{$p->{name}}) : exists $o->{bt__bug}->{$p->{name}} ? $p->{-parent}->append_text ($o->{bt__bug}->{$p->{name}}) : do {$f->parse_attr ($p=>q#default#, $o, -parent => $p->{-parent}, -non_parsed_to_node => 1, %opt);};}} #line 1 "(WikiPlugin module BugTrack, chunk 19)" ; $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) = @_; #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#bt--bug-item#]/status']/Formatting)" ($WIKIRESOURCE ||= SuikaWiki::Plugin->module_package ('WikiResource'))->get_op ('Status:'.($o->{bt__bug}->{prop}->{Status} or '(default)'), $o, $p->{-parent}, ns => $o->{bt__bug}->{bug_option_ns}, default => $o->{bt__bug}->{prop}->{Status} || '(default)');}} #line 1 "(WikiPlugin module BugTrack, chunk 21)" ; $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) = @_; #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#bt--bug-item#]/priority']/Formatting)" ($WIKIRESOURCE ||= SuikaWiki::Plugin->module_package ('WikiResource'))->get_op ('Priority:'.($o->{bt__bug}->{prop}->{Priority} or '(default)'), $o, $p->{-parent}, ns => $o->{bt__bug}->{bug_option_ns}, default => $o->{bt__bug}->{prop}->{Priority} || '(default)');}} #line 1 "(WikiPlugin module BugTrack, chunk 23)" ; $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) = @_; #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#bt--bug-item#]/category']/Formatting)" ($WIKIRESOURCE ||= SuikaWiki::Plugin->module_package ('WikiResource'))->get_op ('Category:'.($o->{bt__bug}->{prop}->{Category} or '(default)'), $o, $p->{-parent}, ns => $o->{bt__bug}->{bug_option_ns}, default => $o->{bt__bug}->{prop}->{Category} || '(default)');}} #line 1 "(WikiPlugin module BugTrack, chunk 25)" ; $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) = @_; #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#bt--bug-item#]/last_modified']/Formatting)" my @time = gmtime $o->{bt__bug}->{lm}; $p->{-parent}->append_text (sprintf '%04d-%02d-%02d %02d:%02d:%02d +00:00', $time[5]+1900,$time[4]+1,@time[3,2,1,0]);}} #line 1 "(WikiPlugin module BugTrack, chunk 27)" ; {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) = @_; #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#view#, q#view-resource#, q#form-input#]/bt__create_new_bug']/Formatting)" $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}; my $page = $o->{wiki}->name ($p->{ns} || $o->{wiki}->{var}->{page}); SuikaWiki::Plugin->module_package ('WikiFormCore') ->make_form_in_html ($p->{-parent}, $p->{content} || ($WIKIRESOURCE ||= SuikaWiki::Plugin->module_package ('WikiResource'))->get (name => 'BugTrack:CreateForm:Content', o => $o, wiki => $o->{wiki}), wiki => $o->{wiki}, o => $o, index => -1, output => { mode => 'bt--bug-create', page => $page, });}} #line 1 "(WikiPlugin module BugTrack, chunk 29)" ; $SuikaWiki::Plugin::Rule{view}->{bt__create_new_bug} = $def; $SuikaWiki::Plugin::Rule{view_resource}->{bt__create_new_bug} = $def; $SuikaWiki::Plugin::Rule{form_input}->{bt__create_new_bug} = $def; }; sub get_new_bug_page { #line 1 "(WikiPlugin module source bugtrack.wp2, block Function[Name='get_new_bug_page']/Main)" my (undef, %opt) = @_; my $max_ns = $opt{ns}->clone; $max_ns->append_component ('1'); for ( grep {$_->[$#$_] =~ /^[0-9]+$/} $opt{o}->{wiki}->{db}->keys ('content', -ns => $opt{ns}, -type => 'ns', -recursive => 0)) { $max_ns = $_ if $_->[$#$_] > $max_ns->[$#$_]; } my $max = ref $max_ns eq 'ARRAY' ? $opt{o}->{wiki}->name ($max_ns) : $max_ns->clone; $max->append_component ('0'); for ( grep {$_->[$#$_] =~ /^[0-9]+$/} $opt{o}->{wiki}->{db}->keys ('content', -ns => $max_ns, -type => 'key', -recursive => 0)) { $max = $_ if $_->[$#$_] > $max->[$#$_]; } $max->[$#$max]++; $max->[$#$max-1]++, $max->[$#$max] = 1 if $max->[$#$max] > 100; $opt{o}->{wiki}->name ($max); } #line 1 "(WikiPlugin module BugTrack, chunk 31)" {my $def = {q#Parameter#, {}, q#Description#, [[q#Root of bugtrack#, q#en#, q##]], q#main#, sub {my ($f, $rule_name, $p, $o, %opt) = @_; #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#view#, q#view-resource#, q#form-input#]/bt__bug_root_page']/Formatting)" $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}; my $ns = $o->{wiki}->name ($p->{ns} || $o->{wiki}->{var}->{page}); if ($#$ns > 1) { delete $ns->[$#$ns] if $ns->[$#$ns] =~ /^[0-9]+$/; delete $ns->[$#$ns] if $ns->[$#$ns] =~ /^[0-9]+$/; } $p->{-parent}->append_text ($ns->stringify (wiki => $o->{wiki}));}} #line 1 "(WikiPlugin module BugTrack, chunk 32)" ; $SuikaWiki::Plugin::Rule{view}->{bt__bug_root_page} = $def; $SuikaWiki::Plugin::Rule{view_resource}->{bt__bug_root_page} = $def; $SuikaWiki::Plugin::Rule{form_input}->{bt__bug_root_page} = $def; }; {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) = @_; #line 1 "(WikiPlugin module source bugtrack.wp2, block FormattingRule[name()='[q#view#, q#view-resource#, q#form-input#]/bt__if_one_of_bug']/Formatting)" $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}; my $ns = $o->{wiki}->name ($p->{ns} || $o->{wiki}->{var}->{page}); if ($#$ns > 1 and $ns->[$#$ns] =~ /^[0-9]+$/ and $ns->[$#$ns - 1] =~ /^[0-9]+$/) { $f->parse_attr ($p=>q#true#, $o, -parent => $p->{-parent}, -non_parsed_to_node => 1, %opt); } else { $f->parse_attr ($p=>q#false#, $o, -parent => $p->{-parent}, -non_parsed_to_node => 1, %opt); }}} #line 1 "(WikiPlugin module BugTrack, chunk 34)" ; $SuikaWiki::Plugin::Rule{view}->{bt__if_one_of_bug} = $def; $SuikaWiki::Plugin::Rule{view_resource}->{bt__if_one_of_bug} = $def; $SuikaWiki::Plugin::Rule{form_input}->{bt__if_one_of_bug} = $def; }; push @SuikaWiki::View::Implementation::CommonViewDefs, { condition => {q#mode#, q#bt__bug_create#, q#output#, q#http-cgi#, q#http_method#, [q#POST#]}, object_class => q#SuikaWiki::Plugin::plugin::BugTrack1040711050942eZAE::bt__bug_create10407110509420Q_5#, }; package SuikaWiki::Plugin::plugin::BugTrack1040711050942eZAE::bt__bug_create10407110509420Q_5; our @ISA = q#SuikaWiki::View::template#; sub main ($$) { my ($self, $opt, $opt2) = @_; #line 1 "(WikiPlugin module source bugtrack.wp2, block ViewDefinition[Mode='bt__bug_create']/method[Name='main'])" my $wiki = $self->{view}->{wiki}; $wiki->{var}->{db}->{read_only}->{content} = 0; $wiki->{var}->{db}->{read_only}->{content_prop} = 0; $wiki->{var}->{db}->{read_only}->{lastmodified} = 0; $self->{view}->init_db; my $ns = $wiki->{var}->{page}; my $o = { wiki => $wiki, }; $o->{bt__bug} = { bug_ns => $ns, bug_page => SuikaWiki::Plugin::plugin::BugTrack1040711050942eZAE->get_new_bug_page (ns => $ns, o => $o), }; my $content_prop = $wiki->{db}->get (content_prop => $o->{bt__bug}->{bug_page}); $content_prop->set_attribute (q#http://suika.fam.cx/~wakaba/-temp/2004/04/24/mt\#media-type# => q); my @page; for (qw/Subject Priority Status Category/) { my $value = $o->{wiki}->{input}->parameter ('bt--' . lc $_) || ($SuikaWiki::Plugin::Registry::Info{q#WikiResource#}->{module_name} || SuikaWiki::Plugin->module_package (q#WikiResource#)) ->get (name => 'BugTrack:'.$_.':Default', o => $o, wiki => $o->{wiki}); $content_prop->set_attribute ($BugProp{$_}->{uri} => $value); $o->{bt__bug}->{prop}->{$_} = $value; } $content_prop->set_attribute ($BugProp{CreationDate}->{uri} => time); $wiki->{db}->set (content_prop => $o->{bt__bug}->{bug_page} => $content_prop); $wiki->{db}->set (lastmodified => $o->{bt__bug}->{bug_page} => time); my $page = '[1]' . "\n" . $o->{wiki}->{input}->parameter ('bt--body'); $wiki->{db}->set (content => $o->{bt__bug}->{bug_page} => join "\x0A", $page); my $uri = $self->{view}->{wiki}->uri_reference (page => $o->{bt__bug}->{bug_page}, up_to_date => 1); require SuikaWiki::Output::HTTP; my $output = SuikaWiki::Output::HTTP->new (wiki => $self->{view}->{wiki}); $output->set_redirect (uri => $uri, status_code => 303, status_phrase => q(Created)); $output->output (output => 'http-cgi');} #line 1 "(WikiPlugin module BugTrack, chunk 36)" push @{$SuikaWiki::View::Implementation::TemplateFragment{q#links#}}, { Main => q#%bt--if-one-of-bug ( true => { %link-to-wikipage ( page => {%bt--bug-root-page;}p, rel => top, label => {%html-link ( description => {%page-name;}p, );}, ); }p, );#, Order => 0, Description => [[q#Web page to web page links - bug tracking system#, q#en#, q##]], }; push @{$SuikaWiki::View::Implementation::TemplateFragment{q#wr__read_body#}}, { Main => q#%bt--if-one-of-bug ( true => { %pe--propedit (template => { %resource-as-plain-text (name => {BugTrack:PropEdit:Template}); }p); }p, );#, Order => -10, Description => [[q#"Read" mode body -- Bug information#, q#en#, q##]], }; package SuikaWiki::Plugin::Resource; our $BaseResource; $BaseResource->{q#en#}->{q##}->{q#BugTrack:Category:Default#} = q#(default)#; $BaseResource->{q#en#}->{q##}->{q#BugTrack:Category:Label#} = q#Category#; $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);#; $BaseResource->{q#en#}->{q##}->{q#BugTrack:CreateForm:MainText:Label#} = q#Bug description#; $BaseResource->{q#und#}->{q##}->{q#BugTrack:Item:Number:Label#} = q#%link-to-it (label => {%bt--property (name => bug-no);}p, default => {0});#; $BaseResource->{q#en#}->{q##}->{q#BugTrack:Item:Subject:Default#} = q#No Title#; $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);#; $BaseResource->{q#en#}->{q##}->{q#BugTrack:Priority:Default#} = q#normal#; $BaseResource->{q#en#}->{q##}->{q#BugTrack:Priority:Label#} = q#Priority#; $BaseResource->{q#en#}->{q##}->{q#BugTrack:Priority:high#} = q#HIGH#; $BaseResource->{q#en#}->{q##}->{q#BugTrack:Priority:low#} = q#low#; $BaseResource->{q#en#}->{q##}->{q#BugTrack:Priority:normal#} = q#normal#; $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, );#; $BaseResource->{q#en#}->{q##}->{q#BugTrack:Status:Default#} = q#open#; $BaseResource->{q#en#}->{q##}->{q#BugTrack:Status:Label#} = q#Status#; $BaseResource->{q#en#}->{q##}->{q#BugTrack:Status:closed#} = q#closed#; $BaseResource->{q#en#}->{q##}->{q#BugTrack:Status:open#} = q#OPEN#; $BaseResource->{q#en#}->{q##}->{q#BugTrack:Status:reserved#} = q#reserved#; $BaseResource->{q#en#}->{q##}->{q#BugTrack:Subject:Default#} = q#New bug#; $BaseResource->{q#en#}->{q##}->{q#BugTrack:Subject:Label#} = q#Subject#; $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.#; $BaseResource->{q#en#}->{q##}->{q#Plugin:BugTrack:Column:category#} = q#Category#; $BaseResource->{q#en#}->{q##}->{q#Plugin:BugTrack:Column:last_modified#} = q#Last Modified#; $BaseResource->{q#en#}->{q##}->{q#Plugin:BugTrack:Column:no#} = q#\##; $BaseResource->{q#en#}->{q##}->{q#Plugin:BugTrack:Column:priority#} = q#Priority#; $BaseResource->{q#en#}->{q##}->{q#Plugin:BugTrack:Column:status#} = q#Status#; $BaseResource->{q#en#}->{q##}->{q#Plugin:BugTrack:Column:subject#} = q#Subject#; $BaseResource->{q#en#}->{q##}->{q#Plugin:BugTrack:Table:Row#} = q#%no; %status; %priority; %category; %subject; %last-modified;#; package SuikaWiki::Plugin::Registry; $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#}]}; 1;