OSDN Git Service

バージョン番号を3.6.5に変更。
[fswiki/fswiki.git] / plugin / info / PluginHelp.pm
1 ##############################################################
2 #
3 # <p>¥×¥é¥°¥¤¥ó¤Î´Ê°×¥Ø¥ë¥×¤òɽ¼¨¤·¤Þ¤¹¡£</p>
4 # <pre>
5 # {{pluginhelp}}
6 # </pre>
7 # <p>
8 #   ¤È¤¹¤ë¤È¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤Æ¤¤¤ë¥×¥é¥°¥¤¥ó¤Î°ìÍ÷¤È´Êñ¤Ê
9 #   ÀâÌÀ¤¬°ìÍ÷ɽ¼¨¤µ¤ì¤Þ¤¹¡£¥×¥é¥°¥¤¥ó̾¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¤È
10 #   ¤½¤Î¥×¥é¥°¥¤¥ó¤Î¾ÜºÙ¤ÊÀâÌÀ¤¬É½¼¨¤µ¤ì¤Þ¤¹¡£
11 # </p>
12 # <p>
13 #   ¤Þ¤¿¡¢¥ª¥×¥·¥ç¥ó¤Ç¥×¥é¥°¥¤¥ó̾¤ò»ØÄꤹ¤ë¤È¡¢
14 #   ¤½¤Î¥×¥é¥°¥¤¥ó¤Î¥Ø¥ë¥×¤òɽ¼¨¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
15 # </p>
16 # <pre>
17 # {{pluginhelp ¥×¥é¥°¥¤¥ó̾,¥×¥é¥°¥¤¥ó̾,...}}
18 # </pre>
19 #
20 ##############################################################
21 package plugin::info::PluginHelp;
22 use strict;
23 use plugin::info::PluginHelpHandler;
24 #=============================================================
25 # ¥³¥ó¥¹¥È¥é¥¯¥¿
26 #=============================================================
27 sub new {
28         my $class = shift;
29         my $self = {};
30         return bless $self,$class;
31 }
32
33 #=============================================================
34 # ¥Ñ¥é¥°¥é¥Õ¥á¥½¥Ã¥É
35 #=============================================================
36 sub paragraph {
37         my $self   = shift;
38         my $wiki   = shift;
39         my @plugin = @_;
40         my $buf    = "";
41         
42         # »ØÄꤷ¤¿¥×¥é¥°¥¤¥ó¤Î¤ßɽ¼¨
43         if ( scalar(@plugin) > 0 ) {
44                 $buf .= "<dl>\n";
45                 for my $p ( @plugin ) {
46                         $buf .= "<dt>".Util::escapeHTML($p)."</dt>\n";
47                         if (my $plugin = $wiki->{"plugin"}->{$p}->{CLASS}) {
48                                 my $comment = &plugin::info::PluginHelpHandler::get_comment($wiki,$plugin);
49                                 $buf .= "<dd>$comment</dd>\n";
50                         } else {
51                                 $buf .= "<dd><font class=\"error\">{{".Util::escapeHTML($p)."}}¥×¥é¥°¥¤¥ó¤Ï¸ºß¤·¤Þ¤»¤ó¡£</font></dd>\n"
52                         }
53                 }
54                 $buf .= "</dl>\n";
55                 
56         # Á´¤Æ¤Î¥×¥é¥°¥¤¥ó¤òɽ¼¨
57         } else {
58                 my @plugins = sort { $a cmp $b } keys(%{$wiki->{"plugin"}});
59                 
60                 foreach my $p (@plugins){
61                         my $name   = $p;
62                         my $plugin = $wiki->{"plugin"}->{$p}->{CLASS};
63                         my $comment = &plugin::info::PluginHelpHandler::get_comment($wiki,$plugin);
64                         my $comment = (split(/\n/,$comment))[0];
65                         $comment = &Util::delete_tag($comment);
66                         
67                         $buf .= "<dl>".
68                                 "<dt><a href=\"".$wiki->create_url({ action=>"PLUGINHELP", name=>$name, plugin=>$plugin })."\">$name</a></dt>".
69                                 "<dd>$comment</dd></dl>\n";
70                 }
71         }
72         return $buf;
73 }
74
75 1;