]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/plugin/PopUp.php
getName should not translate
[SourceForge/phpwiki.git] / lib / plugin / PopUp.php
1 <?php
2
3 /**
4  * Copyright 2004 Nicolas Noble <pixels@users.sf.net>
5  * Copyright 2009 Marc-Etienne Vargenau, Alcatel-Lucent
6  *
7  * This file is part of PhpWiki.
8  *
9  * PhpWiki is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * PhpWiki is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License along
20  * with PhpWiki; if not, write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22  */
23
24 /**
25  * Display a page in a clickable popup link.
26  *
27  * Usage:
28  * <<PopUp
29  *     link="HomePage"
30  *     title="PopUpped HomePage"
31  *     text="Click here to popup the HomePage"
32  *     width=300
33  *     height=200
34  *     resizable=no
35  *     scrollbars=no
36  *     toolbar=no
37  *     location=no
38  *     directories=no
39  *     status=no
40  *     menubar=no
41  *     copyhistory=no
42  * >>
43  * <<PopUp close=yes >>
44  */
45
46 class WikiPlugin_PopUp
47     extends WikiPlugin
48 {
49     function getDescription()
50     {
51         return _("Create a clickable popup link.");
52     }
53
54     function getDefaultArguments()
55     {
56         return array('link' => "HomePage",
57             'title' => "",
58             'text' => "",
59             'width' => "500",
60             'height' => "400",
61             'resizable' => "no",
62             'scrollbars' => "no",
63             'toolbar' => "no",
64             'location' => "no",
65             'directories' => "no",
66             'status' => "no",
67             'menubar' => "no",
68             'copyhistory' => "no",
69             'close' => "no",
70         );
71     }
72
73     function run($dbi, $argstr, &$request, $basepage)
74     {
75         extract($this->getArgs($argstr, $request));
76         return HTML::a(array('href' => WikiURL($link),
77                 'target' => "_blank",
78                 'onclick' => ($close == "yes" ? "window.close()" : ("window.open('" .
79                     WikiURL($link) . "', '" .
80                     ($title == "" ? ($text == "" ? $link : $text) : $title) . "', '" .
81                     "width=$width," .
82                     "height=$height," .
83                     "resizable=$resizable," .
84                     "scrollbars=$scrollbars," .
85                     "toolbar=$toolbar," .
86                     "location=$location," .
87                     "directories=$directories," .
88                     "status=$status," .
89                     "menubar=$menubar," .
90                     "copyhistory=$copyhistory')"
91                 )) . ";return false;"
92             ),
93             ($text == "" ? ($close == "yes" ? "Close window" : $link) : $text)
94         );
95     }
96 }
97
98 // Local Variables:
99 // mode: php
100 // tab-width: 8
101 // c-basic-offset: 4
102 // c-hanging-comment-ender-p: nil
103 // indent-tabs-mode: nil
104 // End: