#?SuikaWikiConfig/2.0 Plugin: @Name: Map @Description: @@@: Visualization of page to page relatinships @@lang:en @License: %%Perl%% @Author: @@Name: @@@@: Wakaba @@@lang:ja @@@script:Latn @@Mail[list]: w@suika.fam.cx @Date.RCS: $Date: 2004/08/06 03:38:11 $ @RequiredPlugin[list]: Search WikiLinking WikiNamespace @Use: use Message::Util::Error; my $WIKILINKING; my $WIKIRESOURCE; @Namespace: @@relrev: http://suika.fam.cx/~wakaba/archive/2004/7/25/html-relrev# PluginConst: @NS_XHTML1: http://www.w3.org/1999/xhtml @NS_RDF: http://www.w3.org/1999/02/22-rdf-syntax-ns# @NS_RSS: http://purl.org/rss/1.0/ @NS_DC: http://purl.org/dc/elements/1.1/ @NS_MAP: http://members.jcom.home.ne.jp/jintrick/2003/02/site-concept.xml# @WIKILINKING: {($WIKILINKING ||= SuikaWiki::Plugin->module_package ('WikiLinking'))} @WIKIRESOURCE: {($WIKIRESOURCE ||= SuikaWiki::Plugin->module_package ('WikiResource'))} FormattingRule: @Category[list]: view @Name: m--html-link-navigation @Description: @@@: Navigation links (HTML link elements) made from content properties @@lang: en @Parameter: @@Name: page @@Type: WikiName @@Default: (current) @@Description: @@@lang: en @@@@: Target WikiPage @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 => , html => 'prev'}, {uri => , html => 'next'}, {uri => , html => 'contents'}, {uri => , html => 'index'}, {uri => , html => 'up'}, ) { if (my $val = $content_prop->get_attribute ($rel->{uri})) { $val = $val->value; for (ref $val eq 'ARRAY' ? @$val : $val) { __FUNCPACK{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}, }); } } } } FormattingRule: @Category[list]: form-input view view-resource @Name: recent-change-list @Description: @@@: Recently changed WikiPage list @@lang: en @Parameter: @@Name: ns @@Type: WikiName @@Default: (auto) @@Description: @@@@: WikiNamespace name to which listed WikiPages belong @@@lang: en @Formatting: my $list = $p->{-parent}->append_new_node (type => '#element', namespace_uri => $NS_XHTML1, local_name => 'ol'); $list->set_attribute (class => 'm--recent-changes'); __ATTRTEXT:%ns__;__ATTRTEXT:%recursive__; $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; __ATTRTEXT:%start__; __ATTRTEXT:%n__; 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', }; __ATTRTEXT:%template__; $p->{template} ||= $WIKIRESOURCE->get (name => 'Link:toWikiPage:SourceLabelLong:RecentChangeItem', wiki => $o->{wiki}, o => $o); __ATTRTEXT:%mode__; for my $target (@target[$start..$end]) { $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 => $NS_XHTML1, local_name => 'li'), }); } if ($list->count) { $list->set_attribute (start => $start + 1); __ATTRNODE:%post_list->{$p->{-parent}}__; } else { $p->{-parent}->remove_child_node ($list); } ViewDefinition: @Mode: m--change @Condition: @@http-method[list]: GET HEAD POST @Description: @@@: Show recently changed WikiPages list @@lang: en @template: @@http-status-code: 200 @@media-type: text/html @@use-media-type-charset: 1 @@expires: %%list%% @@body: %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, ); FormattingRule: @Category[list]: form-input view view-resource @Name: page-list @Description: @@@: WikiPage list @@lang: en @Parameter: @@Name: ns @@Type: WikiName @@Default: (auto) @@Description: @@@@: WikiNamespace name to which listed WikiPages belong @@@lang: en @Formatting: my $list = $p->{-parent}->append_new_node (type => '#element', namespace_uri => $NS_XHTML1, local_name => 'ul'); __ATTRTEXT:%ns__;__ATTRTEXT:%recursive__; $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}); __ATTRTEXT:%start__; __ATTRTEXT:%n__; 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', }; __ATTRTEXT:%template__; $p->{template} ||= $WIKIRESOURCE->get (name => 'Link:toWikiPage:SourceLabelLong:PageList', wiki => $o->{wiki}, o => $o); __ATTRTEXT:%mode__; try { for (@target[$start..$end]) { $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 => $NS_XHTML1, 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); __ATTRNODE:%post_list->{$p->{-parent}}__; } else { $p->{-parent}->remove_child_node ($list); } FormattingRule: @Category[list]: page-link @Name: m--link-weight @Formatting: $p->{-parent}->append_text ($o->{link}->{option}->{-m__weight}+0); ViewFragment: @Name: ws--post-content @Description: @@@: After content body -- children and backward links @@lang:en @Order: 100 @Formatting: %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, ); ViewFragment: @Name: navbar @Order: 21 @Formatting: %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, ); ViewFragment: @Name: links @Formatting: %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, );}, ); Resource: @Children:Title: %link-to-it(label=>{%ns-short-page-name;}p, description=>{%page-name(absolute);}p, ); %span(class=>headline, content=>{%page-headline;}p); @Link:toWikiPage:SourceLabelLong:PageList: %link-to-it( label=>{%page-title(relative);}p, description=>{%page-name(absolute);}p, ); %span(class=>headline,content=>{%page-headline;}p); @Link:toWikiPage:SourceLabelLong:RecentChangeItem: %last-modified; %link-to-it( label=>{%page-title(relative);}p, description=>{%page-name(absolute);}p, ); %span(class=>headline,content=>{%page-headline;}p); @Link:toWikiPage:SourceLabelLong:SearchResult: {%m--link-weight;} %link-to-it( label=>{%page-title(relative);}p, description=>{%page-name(absolute);}p, ); %span(class=>headline,content=>{%page-headline;}p); @GoToRecentChanges: @@@: Recent @@lang: en @GoToRecentChangesLink: @@@: Recently modified WikiPages list @@lang: en @GoToRecentChangesLong: @@@: Review recently modified WikiPages list @@lang: en @Map:Change:Link:Local:Description: @@@: List of recently modified WikiPages in this namespace (%page-name;) @@lang: en @Map:Change:Link:Parent:Description: @@@: List of recently modified WikiPages in parent namespace (%ns-page-path-name;) @@lang: en @Map:Change:Title: @@@: Recent Changes @@lang: en @Map:Change:WebPageTitle: @@@: Recent Changes (%page-name;) @@lang: en @Map:LinkNav:prev:Description: @@lang: en @@@: Previous WikiPage @Map:LinkNav:next:Description: @@lang: en @@@: Next WikiPage @Map:LinkNav:contents:Description: @@lang: en @@@: Table of Contents @Map:LinkNav:index:Description: @@lang: en @@@: Index @Map:LinkNav:up:Description: @@lang: en @@@: Up