]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - themes/fusionforge/themeinfo.php
Remove $Id$
[SourceForge/phpwiki.git] / themes / fusionforge / themeinfo.php
1 <?php
2 // Avoid direct call to this file.
3 // PHPWIKI_VERSION is defined in lib/prepend.php
4 if (!defined('PHPWIKI_VERSION')) {
5     header("Location: /");
6     exit;
7 }
8
9 require_once 'lib/WikiTheme.php';
10 require_once 'themes/wikilens/themeinfo.php';
11
12 class WikiTheme_fusionforge extends WikiTheme_Wikilens {
13
14     function getCSS () {
15         $css = array();
16         $css[] = $this->_CSSlink("", "fusionforge.css", "");
17         $css[] = $this->_CSSlink("", "fusionforge-print.css", "print");
18         $css[] = $this->_CSSlink("Fullscreen", "fusionforge-fullscreen.css", "screen", true);
19         $css[] = $this->_CSSlink("Autonumbering", "fusionforge-autonumbering.css", "", true);
20         $css[] = $this->_CSSlink("Rereading Mode", "fusionforge-rereading.css", "", true);
21         return HTML($css);
22     }
23
24     function header() {
25         global $HTML, $group_id, $group_public_name, $request, $project;
26
27         $pagename = $request->getArg('pagename');
28
29         $submenu = Template('navbar')->asXML();
30
31         if (defined('FUSIONFORGE') and FUSIONFORGE) {
32
33             $domain = textdomain(NULL);
34             textdomain('fusionforge');
35
36             //group is private
37             if (!$project->isPublic()) {
38                 //if it's a private group, you must be a member of that group
39                 session_require_perm('project_read', $group_id);
40             }
41
42             //for dead projects must be member of admin project
43             if (!$project->isActive()) {
44                 //only SF group can view non-active, non-holding groups
45                 session_require_global_perm('forge_admin');
46             }
47
48             $HTML->header(array('h1' => '',
49                                 'title'=> $group_public_name._(": ").htmlspecialchars($pagename),
50                                 'group' => $group_id,
51                                 'toptab' => 'wiki',
52                                 'submenu' => $submenu
53                                )
54                          );
55
56             // Display a warning banner for internal users when the wiki is opened
57             // to external users.
58             if (method_exists($project, 'getIsExternal') && $project->getIsExternal()) {
59                 $external_user = false;
60                 if (session_loggedin()) {
61                    $user = session_get_user();
62                    $external_user = $user->getIsExternal();
63                 }
64                 if (!$external_user) {
65                     $page = $request->getPage();
66                     if ($page->get('external')) {
67                         $external_msg = _("This page is external.");
68                     }
69                     echo $HTML->information(_("This project is shared with third-party users") .
70                                             sprintf(_(" (non %s users)."), forge_get_config('company')) .
71                                             (isset($external_msg) ? ' ' . $external_msg : ''));
72                 }
73             }
74             textdomain($domain);
75         }
76     }
77
78     function footer() {
79
80         if (defined('FUSIONFORGE') and FUSIONFORGE) {
81             global $HTML;
82
83             $domain = textdomain(NULL);
84             textdomain('fusionforge');
85
86             $HTML->footer(array());
87
88             textdomain($domain);
89         }
90     }
91
92     function initGlobals() {
93         global $request;
94         static $already = 0;
95         if (!$already) {
96             $script_url = deduce_script_name();
97             $script_url .= '/'. $GLOBALS['group_name'] ;
98             if ((DEBUG & _DEBUG_REMOTE) and isset($_GET['start_debug']))
99                 $script_url .= ("?start_debug=".$_GET['start_debug']);
100             $folderArrowPath = dirname($this->_findData('images/folderArrowLoading.gif'));
101             $pagename = $request->getArg('pagename');
102             $this->addMoreHeaders(JavaScript('', array('src' => $this->_findData("wikilens.js"))));
103             $js = "var data_path = '". javascript_quote_string(DATA_PATH) ."';\n"
104             // Temp remove pagename because of XSS warning
105             //  ."var pagename  = '". javascript_quote_string($pagename) ."';\n"
106                 ."var script_url= '". javascript_quote_string($script_url) ."';\n"
107                 ."var stylepath = data_path+'/".javascript_quote_string($this->_theme)."/';\n"
108                 ."var folderArrowPath = '".javascript_quote_string($folderArrowPath)."';\n"
109                 ."var use_path_info = " . (USE_PATH_INFO ? "true" : "false") .";\n";
110             $this->addMoreHeaders(JavaScript($js));
111             $already = 1;
112         }
113     }
114     function load() {
115
116         $this->initGlobals();
117
118         /**
119          * The Signature image is shown after saving an edited page. If this
120          * is set to false then the "Thank you for editing..." screen will
121          * be omitted.
122          */
123
124         $this->addImageAlias('signature', WIKI_NAME . "Signature.png");
125         // Uncomment this next line to disable the signature.
126         $this->addImageAlias('signature', false);
127
128         /*
129          * Link icons.
130          */
131         $this->setLinkIcon('http');
132         $this->setLinkIcon('https');
133         $this->setLinkIcon('ftp');
134         $this->setLinkIcon('mailto');
135
136         $this->setButtonSeparator("");
137
138         /**
139          * WikiWords can automatically be split by inserting spaces between
140          * the words. The default is to leave WordsSmashedTogetherLikeSo.
141          */
142         $this->setAutosplitWikiWords(false);
143
144         /**
145          * Layout improvement with dangling links for mostly closed wiki's:
146          * If false, only users with edit permissions will be presented the
147          * special wikiunknown class with "?" and Tooltip.
148          * If true (default), any user will see the ?, but will be presented
149          * the PrintLoginForm on a click.
150          */
151         $this->setAnonEditUnknownLinks(false);
152
153         /*
154          * You may adjust the formats used for formatting dates and times
155          * below.  (These examples give the default formats.)
156          * Formats are given as format strings to PHP strftime() function See
157          * http://www.php.net/manual/en/function.strftime.php for details.
158          * Do not include the server's zone (%Z), times are converted to the
159          * user's time zone.
160          */
161         $this->setDateFormat("%d %B %Y");
162         $this->setTimeFormat("%H:%M");
163     }
164
165     /* Callback when a new user creates or edits a page */
166     function CbNewUserEdit (&$request, $userid) {
167         $content = "{{Template/UserPage}}\n\n----\n[[CategoryWiki user]]";
168         $dbi =& $request->_dbi;
169         $page = $dbi->getPage($userid);
170         $page->save($content, WIKIDB_FORCE_CREATE, array('author' => $userid));
171         $dbi->touch();
172     }
173 }
174
175 $WikiTheme = new WikiTheme_fusionforge('fusionforge');
176
177 // Local Variables:
178 // mode: php
179 // tab-width: 8
180 // c-basic-offset: 4
181 // c-hanging-comment-ender-p: nil
182 // indent-tabs-mode: nil
183 // End: