use strict; package SuikaWiki::Plugin::Registry; our %Info; $Info{q#Map#}->{Name} = q#Map#; $Info{q#Map#}->{q#Version#} = q#2004.0921.0308#; $Info{q#Map#}->{q#InterfaceVersion#} = q#2.9.1#; $Info{q#Map#}->{q#mkpluginVersion#} = q#2.1.19#; $Info{q#Map#}->{q#module_name#} = q#SuikaWiki::Plugin::plugin::Map10408210308494g2v#; $Info{q#Map#}->{q#Date.RCS#} = q#$Date: 2010/05/16 23:05:49 $#; $Info{q#Map#}->{RequiredPlugin} = [q#Search#, q#WikiLinking#, q#WikiNamespace#]; $Info{q#Map#}->{Description} = [[q#Visualization of page to page relatinships#, q#en#, q##]]; $Info{q#Map#}->{License} = [[q#%%Perl%%#, q##, q##]]; $Info{q#Map#}->{Author} = [[[[q#Wakaba#, q#ja#, q#Latn#]], [[q#w@suika.fam.cx#]], [q##]]]; package SuikaWiki::Plugin::plugin::Map10408210308494g2v; #line 1 "(WikiPlugin module source map.wp2, block Plugin/Use)" use Message::Util::Error; my $WIKILINKING; my $WIKIRESOURCE; #line 1 "(WikiPlugin module Map, chunk 1)" $SuikaWiki::Plugin::Rule{view}->{m__wikipage_obsolete} = {q#Parameter#, {q#page#, {q#Type#, q#WikiName#, q#Default#, q#(current)#, q#Description#, [[q#The WikiPage that might be obsoleted.#, q#en#, q##]]}, q#desc_before#, {q#Type#, q#template#, q#Default#, q#(none)#, q#Description#, [[q#The description should be located before WikiPage names if any.#, q#en#, q##]]}, q#desc_after#, {q#Type#, q#template#, q#Default#, q#(none)#, q#Description#, [[q#The description should be located after WikiPage names if any.#, q#en#, q##]]}}, q#Description#, [[q#The navigation notify that this WikiPage is obsolete and should refer the other WikiPages.#, q#en#, q##]], q#main#, sub {my ($f, $rule_name, $p, $o, %opt) = @_; #line 1 "(WikiPlugin module source map.wp2, block FormattingRule[name()='[q#view#]/m__wikipage_obsolete']/Formatting)" my $page = $o->{wiki}->name ($p->{page} || $o->{wiki}->{var}->{page}); my $content_prop; try { $content_prop = $o->{wiki}->{db}->get (content_prop => $page); } catch SuikaWiki::DB::Util::Error with { my $err = shift; $err->throw if $err->{-type} eq 'ERROR_REPORTED'; } catch SuikaWiki::Format::Definition::error with { }; if ($content_prop) { my $obs = $content_prop->get_attribute_value (q#http://suika.fam.cx/~wakaba/archive/2004/7/20/sw\#obsolete#, as_array => 1, default => []); if (@$obs) { my $pp = $p->{-parent}->append_new_node (type => '#element', namespace_uri => q#http://www.w3.org/1999/xhtml#, local_name => 'p'); $pp->set_attribute (class => 'm--wikipage-obsolete'); $f->parse_attr ($p=>q#desc_before#, $o, -parent => $pp, -non_parsed_to_node => 1, %opt); my $i = 0; for (@$obs) { $pp->append_text (', ') if $i++; ($SuikaWiki::Plugin::Registry::Info{q#WikiLinking#}->{module_name} || SuikaWiki::Plugin->module_package (q#WikiLinking#))->to_wikipage_in_html ( { } => { base => $page, page_name_relative => $o->{wiki}->name ($_), }, { o => $o, parent => $pp, }); } $f->parse_attr ($p=>q#desc_after#, $o, -parent => $pp, -non_parsed_to_node => 1, %opt); } }}} #line 1 "(WikiPlugin module Map, chunk 2)" ; $SuikaWiki::Plugin::Rule{view}->{m__html_link_navigation} = {q#Parameter#, {q#page#, {q#Type#, q#WikiName#, q#Default#, q#(current)#, q#Description#, [[q#Target WikiPage#, q#en#, q##]]}}, q#Description#, [[q#Navigation links (HTML link elements) made from content properties#, q#en#, q##]], q#main#, sub {my ($f, $rule_name, $p, $o, %opt) = @_; #line 1 "(WikiPlugin module source map.wp2, block FormattingRule[name()='[q#view#]/m__html_link_navigation']/Formatting)" my $page = $o->{wiki}->name ($p->{page} || $o->{wiki}->{var}->{page}); my $content_prop; try { $content_prop = $o->{wiki}->{db}->get (content_prop => $page); } catch SuikaWiki::DB::Util::Error with { my $err = shift; $err->throw if $err->{-type} eq 'ERROR_REPORTED'; } catch SuikaWiki::Format::Definition::error with { }; if ($content_prop) { for my $rel ( {uri => q#http://suika.fam.cx/~wakaba/archive/2004/7/25/html-relrev\#prev#, html => 'prev'}, {uri => q#http://suika.fam.cx/~wakaba/archive/2004/7/25/html-relrev\#next#, html => 'next'}, {uri => q#http://suika.fam.cx/~wakaba/archive/2004/7/25/html-relrev\#contents#, html => 'contents'}, {uri => q#http://suika.fam.cx/~wakaba/archive/2004/7/25/html-relrev\#index#, html => 'index'}, {uri => q#http://suika.fam.cx/~wakaba/archive/2004/7/25/html-relrev\#up#, html => 'up'}, ) { if (my $val = $content_prop->get_attribute ($rel->{uri})) { $val = $val->value; for (ref $val eq 'ARRAY' ? @$val : $val) { ($SuikaWiki::Plugin::Registry::Info{q#WikiLinking#}->{module_name} || SuikaWiki::Plugin->module_package (q#WikiLinking#))->to_wikipage_in_html ( { label => qq(%html-link ( description => {%res (name => {Map:LinkNav:$rel->{html}:Description});: %page-name;: %page-headline;}p, );\n), } => { base => $page, page_name_relative => $o->{wiki}->name ($_), }, { o => $o, parent => $p->{-parent}, -rel => $rel->{html}, }); } } } }}} #line 1 "(WikiPlugin module Map, chunk 4)" ; {my $def = {q#Parameter#, {q#ns#, {q#Type#, q#WikiName#, q#Default#, q#(auto)#, q#Description#, [[q#WikiNamespace name to which listed WikiPages belong#, q#en#, q##]]}}, q#Description#, [[q#Recently changed WikiPage list#, q#en#, q##]], q#main#, sub {my ($f, $rule_name, $p, $o, %opt) = @_; #line 1 "(WikiPlugin module source map.wp2, block FormattingRule[name()='[q#form-input#, q#view#, q#view-resource#]/recent_change_list']/Formatting)" my $list = $p->{-parent}->append_new_node (type => '#element', namespace_uri => q#http://www.w3.org/1999/xhtml#, local_name => 'ol'); $list->set_attribute (class => 'm--recent-changes'); $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};$p->{q#recursive#} = do { my $r = $f->parse_attr ($p=>q#recursive#, $o, -non_parsed_to_node => 1, %opt); ref $r?$r->inner_text:$r}; $p->{recursive} = 1 unless length $p->{recursive}; my $ns = $o->{wiki}->name ($p->{ns}); my @target = map { try { [$_, $o->{wiki}->{db}->get (lastmodified => $_)] } catch SuikaWiki::DB::Util::Error with { my $err = shift; $err->throw if $err->{-type} eq 'ERROR_REPORTED'; [$_, undef]} } $o->{wiki}->{db}->keys ('lastmodified', -ns => $ns, -type => 'key', -recursive => $p->{recursive}); try { my $nsmodified = $o->{wiki}->{db}->get (lastmodified => $ns); push @target, [$ns, $nsmodified] if $nsmodified; } catch SuikaWiki::DB::Util::Error with { my $err = shift; $err->throw if $err->{-type} eq 'ERROR_REPORTED'; }; @target = sort {$b->[1] <=> $a->[1]} @target; $p->{q#start#} = do { my $r = $f->parse_attr ($p=>q#start#, $o, -non_parsed_to_node => 1, %opt); ref $r?$r->inner_text:$r}; $p->{q#n#} = do { my $r = $f->parse_attr ($p=>q#n#, $o, -non_parsed_to_node => 1, %opt); ref $r?$r->inner_text:$r}; my $start = length $p->{start} ? $p->{start} : $o->{wiki}->{input}->parameter ('m--change--range-start') || 0; $p->{n} = $o->{wiki}->{input}->parameter ('m--change--range-number') unless length $p->{n}; my $end = $p->{n} ? $start + $p->{n} - 1 : $start + 29; $start = 0 if $start > $#target or $start < 0; $end = $#target if $end < $start or $end > $#target; $end = $start + 255 if $end > $start + 255; local $o->{var}->{search__result} = { min => 0, max => $#target, start => $start, end => $end, number => $p->{n} || 30, query => $p->{query}, param_prefix => 'm--change', }; $p->{q#template#} = do { my $r = $f->parse_attr ($p=>q#template#, $o, -non_parsed_to_node => 1, %opt); ref $r?$r->inner_text:$r}; $p->{template} ||= ($WIKIRESOURCE ||= SuikaWiki::Plugin->module_package ('WikiResource'))->get (name => 'Link:toWikiPage:SourceLabelLong:RecentChangeItem', wiki => $o->{wiki}, o => $o); $p->{q#mode#} = do { my $r = $f->parse_attr ($p=>q#mode#, $o, -non_parsed_to_node => 1, %opt); ref $r?$r->inner_text:$r}; for my $target (@target[$start..$end]) { ($WIKILINKING ||= SuikaWiki::Plugin->module_package ('WikiLinking'))->to_wikipage_in_html ({ label => $p->{template}, } => { base => $o->{wiki}->{var}->{page}, page_name_relative => $o->{wiki}->name ($target->[0]), wiki_mode => $p->{mode}, _with_lm => 1, page_lastmodified => $target->[1], }, { o => $o, parent => $list->append_new_node (type => '#element', namespace_uri => q#http://www.w3.org/1999/xhtml#, local_name => 'li'), }); } if ($list->count) { $list->set_attribute (start => $start + 1); $f->parse_attr ($p=>q#post_list#, $o, -parent => $p->{-parent}, -non_parsed_to_node => 1, %opt); } else { $p->{-parent}->remove_child_node ($list); }}} #line 1 "(WikiPlugin module Map, chunk 6)" ; $SuikaWiki::Plugin::Rule{form_input}->{recent_change_list} = $def; $SuikaWiki::Plugin::Rule{view}->{recent_change_list} = $def; $SuikaWiki::Plugin::Rule{view_resource}->{recent_change_list} = $def; }; push @SuikaWiki::View::Implementation::CommonViewDefs, { condition => {q#mode#, q#m__change#, q#http_method#, [q#GET#, q#HEAD#, q#POST#]}, object_class => q#SuikaWiki::Plugin::plugin::Map10408210308494g2v::m__change10408210308496E6R#, }; package SuikaWiki::Plugin::plugin::Map10408210308494g2v::m__change10408210308496E6R; our @ISA = q#SuikaWiki::View::template#; sub main ($$$) { my ($self, $opt, $opt2) = @_; require SuikaWiki::Output::HTTP; $opt2->{output} = SuikaWiki::Output::HTTP->new (wiki => $self->{view}->{wiki}, view => $self->{view}, viewobj => $self); for (@{$self->{view}->{wiki}->{var}->{client}->{used_for_negotiate}}, 'Accept-Language') { $opt2->{output}->add_negotiate_header_field ($_); } $opt2->{template} = q#%html-document ( title => {%res (name => {Map:Change:WebPageTitle});}p, link-meta => {%template (name => links);}p, content => { %block ( id => tools1, class => tools, content => {%template (name => navbar);}p, ); %section ( title => {%res (name => {Map:Change:Title});}p, heading, id => WEBPAGE--M--CHANGE, content => {%recent-change-list ( n => 50, ns => {%page-name;}p, post-list => {%search--result-navigation ( fragment => WEBPAGE--M--CHANGE, );}p, );}p, ); %block ( id => footer, content => {%template (name => ws--footer);}p, ); }p, );#; $opt2->{o} = bless { ## SuikaWiki 3 WikiPlugin interface wiki => $self->{view}->{wiki}, plugin => $self->{view}->{wiki}->{plugin}, var => {}, }, 'SuikaWiki::Plugin'; $opt2->{output}->{status_code} = 200; $opt2->{output}->{entity}->{media_type} = q#text/html#; $opt2->{output}->{entity}->{charset} = $self->{view}->{wiki}->{config}->{charset}->{output}; $opt2->{output}->set_expires (%{$self->{view}->{wiki}->{config}->{entity}->{expires}->{q#list#}}); $opt2->{output}->{entity}->{body_is_octet_stream} = 0; $self->{view}->{wiki}->init_db; $self->main_pre ($opt, $opt2); require Message::Markup::XML::Serialize::HTML; use Message::Util::Error; try { $opt2->{output}->{entity}->{body} = Message::Markup::XML::Serialize::HTML::html_simple (SuikaWiki::Plugin->formatter ('view') ->replace ($opt2->{template}, param => $opt2->{o})); } $self->{view}->{wiki}->{config}->{catch}->{ formatter_view }; $opt2->{output}->output (output => 'http-cgi'); $self->main_post ($opt, $opt2); } package SuikaWiki::Plugin::plugin::Map10408210308494g2v; {my $def = {q#Parameter#, {q#ns#, {q#Type#, q#WikiName#, q#Default#, q#(auto)#, q#Description#, [[q#WikiNamespace name to which listed WikiPages belong#, q#en#, q##]]}}, q#Description#, [[q#WikiPage list#, q#en#, q##]], q#main#, sub {my ($f, $rule_name, $p, $o, %opt) = @_; #line 1 "(WikiPlugin module source map.wp2, block FormattingRule[name()='[q#form-input#, q#view#, q#view-resource#]/page_list']/Formatting)" my $list = $p->{-parent}->append_new_node (type => '#element', namespace_uri => q#http://www.w3.org/1999/xhtml#, local_name => 'ul'); $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};$p->{q#recursive#} = do { my $r = $f->parse_attr ($p=>q#recursive#, $o, -non_parsed_to_node => 1, %opt); ref $r?$r->inner_text:$r}; $p->{recursive} = 1 unless length $p->{recursive}; my $ns = $o->{wiki}->name ($p->{ns}); my @target = sort {$a->[1] cmp $b->[1]} map {[$_, join "\t", @{$_}]} # make sort key $o->{wiki}->{db}->keys ('content', -ns => $ns, -type => 'key', -recursive => $p->{recursive}); $p->{q#start#} = do { my $r = $f->parse_attr ($p=>q#start#, $o, -non_parsed_to_node => 1, %opt); ref $r?$r->inner_text:$r}; $p->{q#n#} = do { my $r = $f->parse_attr ($p=>q#n#, $o, -non_parsed_to_node => 1, %opt); ref $r?$r->inner_text:$r}; my $start = length $p->{start} ? $p->{start} : $o->{wiki}->{input}->parameter ('m--list--range-start') || 0; $p->{n} = $o->{wiki}->{input}->parameter ('m--list--range-number') unless length $p->{n}; my $end = $p->{n} ? $start + $p->{n} - 1 : $start + 29; $start = 0 if $start > $#target or $start < 0; $end = $#target if $end < $start or $end > $#target; $end = $start + 255 if $end > $start + 255; local $o->{var}->{search__result} = { min => 0, max => $#target, start => $start, end => $end, number => $p->{n} || 30, query => $p->{query}, param_prefix => 'm--list', }; $p->{q#template#} = do { my $r = $f->parse_attr ($p=>q#template#, $o, -non_parsed_to_node => 1, %opt); ref $r?$r->inner_text:$r}; $p->{template} ||= ($WIKIRESOURCE ||= SuikaWiki::Plugin->module_package ('WikiResource'))->get (name => 'Link:toWikiPage:SourceLabelLong:PageList', wiki => $o->{wiki}, o => $o); $p->{q#mode#} = do { my $r = $f->parse_attr ($p=>q#mode#, $o, -non_parsed_to_node => 1, %opt); ref $r?$r->inner_text:$r}; try { for (@target[$start..$end]) { ($WIKILINKING ||= SuikaWiki::Plugin->module_package ('WikiLinking'))->to_wikipage_in_html ({ label => $p->{template}, } => { base => $o->{wiki}->{var}->{page}, page_name_relative => $o->{wiki}->name ($_->[0]), wiki_mode => $p->{mode}, }, { o => $o, parent => $list->append_new_node (type => '#element', namespace_uri => q#http://www.w3.org/1999/xhtml#, local_name => 'li'), }); } } catch SuikaWiki::DB::Util::Error with { my $err = shift; $err->throw if $err->{-type} eq 'ERROR_REPORTED'; }; if ($list->count) { $list->set_attribute (start => $start + 1); $f->parse_attr ($p=>q#post_list#, $o, -parent => $p->{-parent}, -non_parsed_to_node => 1, %opt); } else { $p->{-parent}->remove_child_node ($list); }}} #line 1 "(WikiPlugin module Map, chunk 8)" ; $SuikaWiki::Plugin::Rule{form_input}->{page_list} = $def; $SuikaWiki::Plugin::Rule{view}->{page_list} = $def; $SuikaWiki::Plugin::Rule{view_resource}->{page_list} = $def; }; $SuikaWiki::Plugin::Rule{page_link}->{m__link_weight} = {q#Parameter#, {}, q#Description#, [], q#main#, sub {my ($f, $rule_name, $p, $o, %opt) = @_; #line 1 "(WikiPlugin module source map.wp2, block FormattingRule[name()='[q#page-link#]/m__link_weight']/Formatting)" $p->{-parent}->append_text ($o->{link}->{option}->{-m__weight}+0);}} #line 1 "(WikiPlugin module Map, chunk 10)" ; push @{$SuikaWiki::View::Implementation::TemplateFragment{q#ws__post_content#}}, { Main => q#%section ( id => children, title => {%res(name=>{Children:Title});}p, heading, content => {%page-list ( ns => {%page-name;}p, recursive => 0, type => both, template => {%resource-as-plain-text (name => {Children:Item});}p, post-list => {%search--result-navigation ( fragment => children, );}p, );}p, );#, Order => 100, Description => [[q#After content body -- children and backward links#, q#en#, q##]], }; push @{$SuikaWiki::View::Implementation::TemplateFragment{q#navbar#}}, { Main => q#%link-to-wikipage ( page => {%ns--root-wikiname;}p, mode => m--change, label => {%link-to-it ( label => {%res (name => GoToRecentChanges);}p, description => {%res (name => GoToRecentChangesLong);}p, );}, rel => news, ); #, Order => 21, Description => [], }; push @{$SuikaWiki::View::Implementation::TemplateFragment{q#links#}}, { Main => q#%m--html-link-navigation; %link-to-wikipage ( page => {%ns--root-wikiname;}p, rel => news, mode => m--change, label => {%html-link ( description => {%res(name=>GoToRecentChangesLink);}p, );}, ); %link-to-wikipage ( page => {%ns-page-path-name;}p, rel => news, mode => m--change, label => {%html-link ( description => {%res(name=> {Map:Change:Link:Parent:Description});}p, );}, ); %link-to-wikipage ( rel => news, mode => m--change, label => {%html-link ( description => {%res(name=> {Map:Change:Link:Local:Description});}p, );}, ); #, Order => 0, Description => [], }; package SuikaWiki::Plugin::Resource; our $BaseResource; $BaseResource->{q#und#}->{q##}->{q#Children:Title#} = q#%link-to-it(label=>{%ns-short-page-name;}p, description=>{%page-name(absolute);}p, ); %span(class=>headline, content=>{%page-headline;}p);#; $BaseResource->{q#und#}->{q##}->{q#Link:toWikiPage:SourceLabelLong:PageList#} = q#%link-to-it( label=>{%page-title(relative);}p, description=>{%page-name(absolute);}p, ); %span(class=>headline,content=>{%page-headline;}p);#; $BaseResource->{q#und#}->{q##}->{q#Link:toWikiPage:SourceLabelLong:RecentChangeItem#} = q#%last-modified; %link-to-it( label=>{%page-title(relative);}p, description=>{%page-name(absolute);}p, ); %span(class=>headline,content=>{%page-headline;}p);#; $BaseResource->{q#und#}->{q##}->{q#Link:toWikiPage:SourceLabelLong:SearchResult#} = q#{%m--link-weight;} %link-to-it( label=>{%page-title(relative);}p, description=>{%page-name(absolute);}p, ); %span(class=>headline,content=>{%page-headline;}p);#; $BaseResource->{q#en#}->{q##}->{q#GoToRecentChanges#} = q#Recent#; $BaseResource->{q#en#}->{q##}->{q#GoToRecentChangesLink#} = q#Recently modified WikiPages list#; $BaseResource->{q#en#}->{q##}->{q#GoToRecentChangesLong#} = q#Review recently modified WikiPages list#; $BaseResource->{q#en#}->{q##}->{q#Map:Change:Link:Local:Description#} = q#List of recently modified WikiPages in this namespace (%page-name;)#; $BaseResource->{q#en#}->{q##}->{q#Map:Change:Link:Parent:Description#} = q#List of recently modified WikiPages in parent namespace (%ns-page-path-name;)#; $BaseResource->{q#en#}->{q##}->{q#Map:Change:Title#} = q#Recent Changes#; $BaseResource->{q#en#}->{q##}->{q#Map:Change:WebPageTitle#} = q#Recent Changes (%page-name;)#; $BaseResource->{q#en#}->{q##}->{q#Map:LinkNav:prev:Description#} = q#Previous WikiPage#; $BaseResource->{q#en#}->{q##}->{q#Map:LinkNav:next:Description#} = q#Next WikiPage#; $BaseResource->{q#en#}->{q##}->{q#Map:LinkNav:contents:Description#} = q#Table of Contents#; $BaseResource->{q#en#}->{q##}->{q#Map:LinkNav:index:Description#} = q#Index#; $BaseResource->{q#en#}->{q##}->{q#Map:LinkNav:up:Description#} = q#Up#; package SuikaWiki::Plugin::Registry; $Info{q#Map#}->{provide} = {q#rule#, {q#form_input#, [q#recent_change_list#, q#page_list#], q#view#, [q#m__wikipage_obsolete#, q#m__html_link_navigation#, q#recent_change_list#, q#page_list#], q#view_resource#, [q#recent_change_list#, q#page_list#], q#page_link#, [q#m__link_weight#]}, q#viewfragment#, [{q#Name#, q#ws__post_content#}, {q#Name#, q#navbar#}, {q#Name#, q#links#}], q#viewdef#, [{q#Description#, [q#Show recently changed WikiPages list#, q#en#, q##], q#Name#, q#m__change#}]}; 1;