| 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 |
@License: %%GPL%% |
@@lang:en |
| 10 |
@Author[list]: |
@License: %%Perl%% |
| 11 |
Wakaba <w@suika.fam.cx> |
@Author: |
| 12 |
@Date.RCS: $Date$ |
@@Name: |
| 13 |
|
@@@@:Wakaba |
| 14 |
|
@@@lang:ja |
| 15 |
|
@@@script:Latn |
| 16 |
|
@@Mail:w@suika.fam.cx |
| 17 |
|
@Date.RCS: |
| 18 |
|
$Date$ |
| 19 |
|
@RequiredModule[list]: |
| 20 |
|
SuikaWiki::Output::HTTP |
| 21 |
|
@RequiredPlugin[list]: |
| 22 |
|
WikiLinking |
| 23 |
|
WikiResource |
| 24 |
|
|
| 25 |
ViewDefinition: |
ViewDefinition: |
| 26 |
@Mode: RandomJump |
@Mode: RandomJump |
| 27 |
@Condition: |
@Condition: |
| 28 |
@@output: http-cgi |
@@output: http-cgi |
| 29 |
@Description:Redirection to a wiki page selected randomly |
@Description: |
| 30 |
|
@@@:Redirection to some WikiPage selected randomly |
| 31 |
|
@@lang:en |
| 32 |
@method: |
@method: |
| 33 |
@@@: |
@@@: |
| 34 |
$self->{view}->init_db; |
$self->{view}->init_db; |
| 35 |
my @list = $self->{view}->{wiki}->{db}->keys ('content'); |
my @list = $self->{view}->{wiki}->{db}->keys ('content'); |
| 36 |
&main::_http_see_other (page => $list[rand @list]); |
|
| 37 |
|
my $uri = $self->{view}->{wiki}->uri_reference |
| 38 |
|
(page => $self->{view}->{wiki}->name ($list[rand @list]), |
| 39 |
|
up_to_date => 1); |
| 40 |
|
|
| 41 |
|
require SuikaWiki::Output::HTTP; |
| 42 |
|
my $output = SuikaWiki::Output::HTTP->new (wiki => $self->{view}->{wiki}); |
| 43 |
|
$output->set_redirect (uri => $uri, status_code => 307); |
| 44 |
|
$output->output (output => 'http-cgi'); |
| 45 |
@@Name: main |
@@Name: main |
| 46 |
|
|
| 47 |
|
ViewFragment: |
| 48 |
|
@Name: navbar |
| 49 |
|
@Description: |
| 50 |
|
@@@: "Go somewhere" button on navigation bar |
| 51 |
|
@@lang:en |
| 52 |
|
@Order: 110 |
| 53 |
|
@Formatting: |
| 54 |
|
%link-to-wikipage ( |
| 55 |
|
mode => RandomJump, up-to-date, |
| 56 |
|
rel => jump, |
| 57 |
|
label => {%link-to-it ( |
| 58 |
|
label => {%res (name => GoSomewhere);}p, |
| 59 |
|
description => {%res (name => GoSomewhereLong);}p, |
| 60 |
|
class => randomlink, |
| 61 |
|
);}, |
| 62 |
|
); |
| 63 |
|
|
| 64 |
|
ViewFragment: |
| 65 |
|
@Name: links |
| 66 |
|
@Description: |
| 67 |
|
@@@: "Go somewhere" link |
| 68 |
|
@@lang:en |
| 69 |
|
@Formatting: |
| 70 |
|
%link-wiki (mode => RandomJump, up-to-date, |
| 71 |
|
rel => jump, class => randomlink, |
| 72 |
|
description => {%res(name=>GoSomewhereLink);}p); |
| 73 |
|
|
| 74 |
|
Resource: |
| 75 |
|
@GoSomewhere: |
| 76 |
|
@@@: Lucky |
| 77 |
|
@@lang:en |
| 78 |
|
@GoSomewhereLink: |
| 79 |
|
@@@: Go somewhere in this wiki |
| 80 |
|
@@lang:en |
| 81 |
|
@GoSomewhereLong: |
| 82 |
|
@@@: Go somewhere in this wiki |
| 83 |
|
@@lang:en |