]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/plugin/PopUp.php
private --> protected
[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 getName()
50     {
51         return _("PopUp");
52     }
53
54     function getDescription()
55     {
56         return _("Create a clickable popup link.");
57     }
58
59     function getDefaultArguments()
60     {
61         return array('link' => "HomePage",
62             'title' => "",
63             'text' => "",
64             'width' => "500",
65             'height' => "400",
66             'resizable' => "no",
67             'scrollbars' => "no",
68             'toolbar' => "no",
69             'location' => "no",
70             'directories' => "no",
71             'status' => "no",
72             'menubar' => "no",
73             'copyhistory' => "no",
74             'close' => "no",
75         );
76     }
77
78     function run($dbi, $argstr, &$request, $basepage)
79     {
80         extract($this->getArgs($argstr, $request));
81         return HTML::a(array('href' => WikiURL($link),
82                 'target' => "_blank",
83                 'onclick' => ($close == "yes" ? "window.close()" : ("window.open('" .
84                     WikiURL($link) . "', '" .
85                     ($title == "" ? ($text == "" ? $link : $text) : $title) . "', '" .
86                     "width=$width," .
87                     "height=$height," .
88                     "resizable=$resizable," .
89                     "scrollbars=$scrollbars," .
90                     "toolbar=$toolbar," .
91                     "location=$location," .
92                     "directories=$directories," .
93                     "status=$status," .
94                     "menubar=$menubar," .
95                     "copyhistory=$copyhistory')"
96                 )) . ";return false;"
97             ),
98             ($text == "" ? ($close == "yes" ? "Close window" : $link) : $text)
99         );
100     }
101 }
102
103 // Local Variables:
104 // mode: php
105 // tab-width: 8
106 // c-basic-offset: 4
107 // c-hanging-comment-ender-p: nil
108 // indent-tabs-mode: nil
109 // End: