/[pub]/suikawiki/script/misc/plugins/link/map.wp2
Suika

Contents of /suikawiki/script/misc/plugins/link/map.wp2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.10 - (show annotations) (download)
Fri Mar 19 03:42:06 2004 UTC (21 years, 3 months ago) by wakaba
Branch: MAIN
Changes since 1.9: +1 -90 lines
New module

1 #?SuikaWikiConfig/2.0
2
3 Plugin:
4 @Name: Map
5 @Description:
6 @@@:
7 Visualization of page to page relatinships
8 @@lang:en
9 @License: %%Perl%%
10 @Author:
11 @@Name:
12 @@@@: Wakaba
13 @@@lang:ja
14 @@@script:Latn
15 @@Mail[list]: w@suika.fam.cx
16 @Date.RCS:
17 $Date: 2004/03/13 13:43:33 $
18 @RequiredPlugin[list]:
19 WikiLinking
20 @Use:
21 use Message::Util::Error;
22 my $WIKILINKING;
23 my $WIKIRESOURCE;
24
25 PluginConst:
26 @NS_XHTML1:
27 http://www.w3.org/1999/xhtml
28 @NS_RDF:
29 http://www.w3.org/1999/02/22-rdf-syntax-ns#
30 @NS_RSS:
31 http://purl.org/rss/1.0/
32 @NS_DC:
33 http://purl.org/dc/elements/1.1/
34 @NS_MAP:
35 http://members.jcom.home.ne.jp/jintrick/2003/02/site-concept.xml#
36 @WIKILINKING:
37 {($WIKILINKING ||= SuikaWiki::Plugin->module_package ('WikiLinking'))}
38 @WIKIRESOURCE:
39 {($WIKIRESOURCE ||= SuikaWiki::Plugin->module_package ('WikiResource'))}
40
41 FormattingRule:
42 @Category[list]:
43 form-input
44 view
45 view-resource
46 @Name: recent-change-list
47 @Description:
48 @@@: Recently changed WikiPage list
49 @@lang: en
50 @Parameter:
51 @@Name: ns
52 @@Type: WikiName
53 @@Default: (auto)
54 @@Description:
55 @@@@:
56 WikiNamespace name to which listed WikiPages belong
57 @@@lang: en
58 @Formatting:
59 my $list = $p->{-parent}->append_new_node
60 (type => '#element',
61 namespace_uri => $NS_XHTML1,
62 local_name => 'ol');
63 $list->set_attribute (class => 'm--recent-changes');
64
65 __ATTRTEXT:%ns__;__ATTRTEXT:%recursive__;
66 __ATTRTEXT:%n__;
67 $p->{recursive} = 1 unless length $p->{recursive};
68 my $ns = $o->{wiki}->name ($p->{ns});
69 #$ns->append_component ('') unless $ns->[$#$ns] eq '';
70 my $i = 0;
71 $p->{n} ||= 10;
72 __ATTRTEXT:%template__;
73 $p->{template} ||= $WIKIRESOURCE->get
74 (name => 'Link:toWikiPage:SourceLabelLong:RecentChangeItem',
75 wiki => $o->{wiki}, o => $o);
76 __ATTRTEXT:%mode__;
77 for (sort {$b->[1] <=> $a->[1]}
78 map { try { [$_, $o->{wiki}->{db}->get (lastmodified => $_)] }
79 catch SuikaWiki::DB::Util::Error with {
80 my $err = shift;
81 $err->throw if $err->{-type} eq 'ERROR_REPORTED';
82 [$_, undef]} }
83 $o->{wiki}->{db}->keys ('content',
84 -ns => $ns,
85 -type => 'key',
86 -recursive => $p->{recursive})) {
87 next unless $_->[0];
88 last if $i++ == $p->{n};
89
90 $WIKILINKING->to_wikipage_in_html ({
91 label => $p->{template},
92 } => {
93 base => $o->{wiki}->{var}->{page},
94 page_name_relative => $o->{wiki}->name ($_->[0]),
95 wiki_mode => $p->{mode},
96 _with_lm => 1,
97 page_lastmodified => $_->[1],
98 }, {
99 o => $o,
100 parent => $list->append_new_node
101 (type => '#element',
102 namespace_uri => $NS_XHTML1,
103 local_name => 'li'),
104 });
105 }
106
107 FormattingRule:
108 @Category[list]:
109 form-input
110 view
111 view-resource
112 @Name: page-list
113 @Description:
114 @@@: WikiPage list
115 @@lang: en
116 @Parameter:
117 @@Name: ns
118 @@Type: WikiName
119 @@Default: (auto)
120 @@Description:
121 @@@@:
122 WikiNamespace name to which listed WikiPages belong
123 @@@lang: en
124 @Formatting:
125 my $list = $p->{-parent}->append_new_node
126 (type => '#element',
127 namespace_uri => $NS_XHTML1,
128 local_name => 'ul');
129
130 __ATTRTEXT:%ns__;__ATTRTEXT:%recursive__;
131 __ATTRTEXT:%n__;
132 $p->{recursive} = 1 unless length $p->{recursive};
133 my $ns = $o->{wiki}->name ($p->{ns});
134 #$ns->append_component ('') unless $ns->[$#$ns] eq '';
135 my $i = 0;
136 $p->{n} ||= -1;
137 __ATTRTEXT:%template__;
138 $p->{template} ||= $WIKIRESOURCE->get
139 (name => 'Link:toWikiPage:SourceLabelLong:PageList',
140 wiki => $o->{wiki}, o => $o);
141 __ATTRTEXT:%match__; ## WARNING: This parameter might be dangerous!
142 my $reg = $p->{match} ? qr/$p->{match}/ : qr/./;
143 __ATTRTEXT:%mode__;
144 try {
145 for (sort {$a->[1] cmp $b->[1]}
146 grep {$_->[1] =~ /$reg/}
147 map {[$_, join '//', @{$_}]} # make sort key
148 $o->{wiki}->{db}->keys ('content',
149 -ns => $ns,
150 -type => 'key',
151 -recursive => $p->{recursive})) {
152 last if $i++ == $p->{n};
153
154 $WIKILINKING->to_wikipage_in_html ({
155 label => $p->{template},
156 } => {
157 base => $o->{wiki}->{var}->{page},
158 page_name_relative => $o->{wiki}->name ($_->[0]),
159 wiki_mode => $p->{mode},
160 }, {
161 o => $o,
162 parent => $list->append_new_node
163 (type => '#element',
164 namespace_uri => $NS_XHTML1,
165 local_name => 'li'),
166 });
167 }
168 } catch SuikaWiki::DB::Util::Error with {
169 my $err = shift;
170 $err->throw if $err->{-type} eq 'ERROR_REPORTED';
171 };
172 $p->{-parent}->remove_child_node ($list) unless $list->count;
173
174 FormattingRule:
175 @Category[list]:
176 page-link
177 @Name: m--link-weight
178 @Formatting:
179 $p->{-parent}->append_text ($o->{link}->{option}->{-m__weight}+0);
180
181 ViewFragment:
182 @Name: ws--post-content
183 @Description:
184 @@@: After content body -- children and backward links
185 @@lang:en
186 @Order: 100
187 @Formatting:
188 %section (
189 id => children,
190 title => {%res(name=>{Children:Title});}p, heading,
191 content => {%page-list (
192 ns => {%page-name;}p, recursive => 0,
193 type => both,
194 template => {%resource-as-plain-text (name => {Children:Item});}p,
195 );}p,
196 );
197
198 Resource:
199 @Children:Title:
200 %link-to-it(label=>{%ns-short-page-name;}p,
201 description=>{%page-name(absolute);}p,
202 );
203 %span(class=>headline, content=>{%page-headline;}p);
204 @Link:toWikiPage:SourceLabelLong:PageList:
205 %link-to-it(
206 label=>{%page-title(relative);}p,
207 description=>{%page-name(absolute);}p,
208 );
209 %span(class=>headline,content=>{%page-headline;}p);
210 @Link:toWikiPage:SourceLabelLong:RecentChangeItem:
211 %last-modified;
212 %link-to-it(
213 label=>{%page-title(relative);}p,
214 description=>{%page-name(absolute);}p,
215 );
216 %span(class=>headline,content=>{%page-headline;}p);
217
218 ## TODO: Make recent-changes page name customizable
219 ViewFragment:
220 @Name: navbar
221 @Order: 21
222 @Formatting:
223 %link-to-wikipage (
224 page => {RecentChanges},
225 label => {%link-to-it (
226 label => {%res (name => GoToRecentChanges);}p,
227 description => {%res (name => GoToRecentChangesLong);}p,
228 );},
229 rel => news,
230 );
231
232 ## TODO:
233 ViewFragment:
234 @Name: links
235 @Formatting:
236 %link-to-wikipage (
237 page => {RecentChanges},
238 rel => news,
239 label => {%html-link (
240 description => {%res(name=>GoToRecentChangesLink);}p,
241 );},
242 );
243
244 Resource:
245 @GoToRecentChanges:
246 @@@: Recent
247 @@lang: en
248 @GoToRecentChangesLink:
249 @@@: Recently modified WikiPages list
250 @@lang: en
251 @GoToRecentChangesLong:
252 @@@: Review recently modified WikiPages list
253 @@lang: en

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24