OSDN Git Service

BugTrack-wiki/349 : 削除ページ完全削除で添付ファイル削除対応
[fswiki/fswiki.git] / plugin / recent / Recent.pm
1 ############################################################
2
3 # <p>ºÇ¶á¹¹¿·¤µ¤ì¤¿¥Ú¡¼¥¸¤ò°ìÍ÷ɽ¼¨¤·¤Þ¤¹¡£</p>
4 # <p>°ú¿ô¤Çɽ¼¨·ï¿ô¤ò»ØÄê¤Ç¤­¤Þ¤¹¡£</p>
5 # <pre>
6 # {{recent 5}}
7 # </pre>
8 # <p>½Ä¤Ëɽ¼¨¤¹¤ë¤³¤È¤â¤Ç¤­¤Þ¤¹¡£</p>
9 # <pre>
10 # {{recent 5,v}}
11 # </pre>
12 # <p>ÆüÉÕ¤´¤È¤Ë°ìÍ÷ɽ¼¨¤¹¤ë¤Ë¤Ïrecentdays¥×¥é¥°¥¤¥ó¤ò»ÈÍѤ·¤Þ¤¹¡£</p>
13
14 ############################################################
15 package plugin::recent::Recent;
16 use strict;
17 #===========================================================
18 # ¥³¥ó¥¹¥È¥é¥¯¥¿
19 #===========================================================
20 sub new {
21         my $class = shift;
22         my $self = {};
23         return bless $self,$class;
24 }
25
26 #===========================================================
27 # ¥Ñ¥é¥°¥é¥Õ¥á¥½¥Ã¥É
28 #===========================================================
29 sub paragraph {
30         my $self   = shift;
31         my $wiki   = shift;
32         my $max    = shift;
33         my $way    = shift;
34         my $cgi    = $wiki->get_CGI;
35         
36         # É½¼¨Êý¼°¤ò·èÄê
37         if($way eq ""){
38                 $way = "H";
39         }
40         
41         if($max eq "V" || $max eq "v"){
42                 $way = "V";
43                 $max = 0;
44                 
45         } elsif($max eq "H" || $max eq "h"){
46                 $way = "H";
47                 $max = 0;
48                 
49         } elsif($max eq ""){
50                 $max = 0;
51         }
52         
53         # É½¼¨ÆâÍƤòºîÀ®
54         my $content = "";
55         my $count   = 0;
56         foreach my $page ($wiki->get_page_list({-sort   =>'last_modified',
57                                                 -permit =>'show',
58                                                 -max    =>$max})){
59                 
60                 if($way eq "H" || $way eq "h"){
61                         if($count!=0){
62                                 $content = $content." / ";
63                         }
64                 } else {
65                         $content = $content."*";
66                 }
67                 
68                 $content = $content."[[$page]]";
69                 
70                 if($way ne "H" && $way ne "h"){
71                         $content .= "\n";
72                 }
73                 
74                 $count++;
75         }
76         
77         return $content;
78 }
79
80 1;