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