]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/plugin/PopUp.php
Harmonize file footer
[SourceForge/phpwiki.git] / lib / plugin / PopUp.php
1 <?php // -*-php-*-
2 // rcs_id('$Id$');
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
20  * along with PhpWiki; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  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         return _("PopUp");
51     }
52     function getDescription () {
53         return _("Used to create a clickable popup link.");
54     }
55     function getDefaultArguments() {
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         extract($this->getArgs($argstr, $request));
75         return HTML::a(array('href' => WikiURL($link),
76                               'target' => "_blank",
77                               'onclick' => ($close == "yes" ? "window.close()" : ("window.open('" .
78                                   WikiURL($link) . "', '" .
79                                   ($title == "" ? ($text == "" ? $link : $text) : $title) . "', '" .
80                                   "width=$width," .
81                                   "height=$height," .
82                                   "resizable=$resizable," .
83                                   "scrollbars=$scrollbars," .
84                                   "toolbar=$toolbar," .
85                                   "location=$location," .
86                                   "directories=$directories," .
87                                   "status=$status," .
88                                   "menubar=$menubar," .
89                                   "copyhistory=$copyhistory')"
90                                   )) . ";return false;"
91                              ),
92                         ($text == "" ? ($close == "yes" ? "Close window" : $link) : $text)
93                        );
94     }
95 };
96
97 // Local Variables:
98 // mode: php
99 // tab-width: 8
100 // c-basic-offset: 4
101 // c-hanging-comment-ender-p: nil
102 // indent-tabs-mode: nil
103 // End:
104 ?>