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