3 |
Plugin: |
Plugin: |
4 |
@Name: RandomJump |
@Name: RandomJump |
5 |
@Description: |
@Description: |
6 |
|
@@@: |
7 |
This plugin module provides "random jump" functions |
This plugin module provides "random jump" functions |
8 |
to select wiki pages randomly. |
to select wiki pages randomly. |
9 |
|
@@lang:en |
10 |
@License: %%GPL%% |
@License: %%GPL%% |
11 |
@Author[list]: |
@Author: |
12 |
Wakaba <w@suika.fam.cx> |
@@Name: |
13 |
|
@@@@:Wakaba |
14 |
|
@@@lang:ja |
15 |
|
@@@script:Latn |
16 |
|
@@Mail:w@suika.fam.cx |
17 |
@Date.RCS: $Date$ |
@Date.RCS: $Date$ |
18 |
|
|
19 |
ViewDefinition: |
ViewDefinition: |
20 |
@Mode: RandomJump |
@Mode: RandomJump |
21 |
@Condition: |
@Condition: |
22 |
@@output: http-cgi |
@@output: http-cgi |
23 |
@Description:Redirection to a wiki page selected randomly |
@Description: |
24 |
|
@@@:Redirection to some WikiPage selected randomly |
25 |
|
@@lang:en |
26 |
@method: |
@method: |
27 |
@@@: |
@@@: |
28 |
$self->{view}->init_db; |
$self->{view}->init_db; |
29 |
my @list = $self->{view}->{wiki}->{db}->keys ('content'); |
my @list = $self->{view}->{wiki}->{db}->keys ('content'); |
30 |
&main::_http_see_other (page => $list[rand @list]); |
|
31 |
|
my $uri = SuikaWiki::Plugin->_uri_wiki_page |
32 |
|
(join ('//', @{$list[rand @list]}), |
33 |
|
up_to_date => 1, absolute => 1); |
34 |
|
|
35 |
|
require SuikaWiki::Output::HTTP; |
36 |
|
my $output = SuikaWiki::Output::HTTP->new (wiki => $self->{view}->{wiki}); |
37 |
|
$output->set_redirect (uri => $uri, status_code => 303); |
38 |
|
$output->output (output => 'http-cgi'); |
39 |
@@Name: main |
@@Name: main |
40 |
|
|
41 |
|
ViewFragment: |
42 |
|
@Name: navbar |
43 |
|
@Description: |
44 |
|
@@@: "Go somewhere" button on navigation bar |
45 |
|
@@lang:en |
46 |
|
@Order: 110 |
47 |
|
@Formatting: |
48 |
|
%anchor-wiki(mode=>RandomJump,up-to-date,rel=>jump, |
49 |
|
class=>"wiki randomlink", |
50 |
|
label=>"%res(name=>GoSomewhere);"p, |
51 |
|
title=>"%res(name=>GoSomewhereLong);"p); |
52 |
|
|
53 |
|
ViewFragment: |
54 |
|
@Name: links |
55 |
|
@Description: |
56 |
|
@@@: "Go somewhere" link |
57 |
|
@@lang:en |
58 |
|
@Formatting: |
59 |
|
%link-wiki(mode=>RandomJump,up-to-date,rel=>jump, |
60 |
|
class=>"wiki randomlink", |
61 |
|
title=>"%res(name=>GoSomewhereLink);"p); |
62 |
|
|
63 |
|
Resource: |
64 |
|
@GoSomewhere: |
65 |
|
@@@: Lucky |
66 |
|
@@lang:en |
67 |
|
@GoSomewhereLink: |
68 |
|
@@@: Go somewhere in this wiki |
69 |
|
@@lang:en |
70 |
|
@GoSomewhereLong: |
71 |
|
@@@: Go somewhere in this wiki |
72 |
|
@@lang:en |