more plugin fixups
[diogenes.git] / include / diogenes.toplevel.inc.php
... / ...
CommitLineData
1<?php
2/*
3 * Copyright (C) 2003-2004 Polytechnique.org
4 * http://opensource.polytechnique.org/
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21
22require_once 'diogenes.page.inc.php';
23require_once 'Barrel/Options.php';
24
25/** This class describes a toplevel Diogenes page.
26 */
27class DiogenesToplevel extends DiogenesPage {
28
29 /** The constructor.
30 *
31 * @param admin is this an admin page?
32 */
33 function DiogenesToplevel($admin = false)
34 {
35 // page basics
36 $this->DiogenesPage();
37 $this->makeHead();
38 $this->assign('site',"Diogenes");
39 $this->assign('page', $admin ? __("Toplevel administration") : __("Home"));
40
41 // start session
42 $this->startSession();
43
44 // handle logout request
45 if (isset($_REQUEST['dologout']))
46 $this->doLogout();
47
48 // do auth
49 if ($admin || isset($_REQUEST['doauth']))
50 $_SESSION['session']->doAuth($this);
51
52 if ($admin && !$_SESSION['session']->hasPerms("root"))
53 $this->kill(__("You are not authorized to view this page!"), 403);
54 }
55
56
57
58 /** Build the contents of the page's "head" tag.
59 */
60 function makeHead()
61 {
62 array_push($this->head, '<meta name="description" content="Diogenes content management system" />');
63 array_push($this->head, '<meta name="keywords" content="Diogenes, Polytechnique.org, Jeremy Lain&eacute;" />');
64 array_push($this->head, '<link rel="stylesheet" href="'.$this->url("common.css").'" type="text/css" />');
65 array_push($this->head, '<link rel="stylesheet" href="'.$this->url("toplevel.css").'" type="text/css" />');
66 array_push($this->head, '<link rel="icon" href="'.$this->url("images/favicon.png").'" type="image/png" />');
67 }
68
69
70 /** Build the page's menu.
71 */
72 function makeMenu()
73 {
74 global $globals;
75
76 // menu style & theme
77 $this->assign('menustyle', $globals->menu_style);
78 $this->assign('menutheme', $globals->menu_theme);
79
80 // menu items
81 array_push($this->menu, array(0,"Diogenes", "", 1));
82 array_push($this->menu, array(1,__("Home"), $this->url("")));
83 array_push($this->menu, array(1,__("User manual"), __("http://diogenes-doc.polytechnique.org/en-user/")) );
84
85 if ($this->isLogged()) {
86 array_push($this->menu, array(1,__("Preferences"),$this->url("prefs.php")) );
87 array_push($this->menu, array(1,__("Logout"), $this->url("?dologout=1")) );
88 } else {
89 array_push($this->menu, array(1,__("Login"), $this->url("?doauth=1")) );
90 }
91 if ($this->isRoot()) {
92 array_push($this->menu, array(0,__("Sites"), "", 1));
93 array_push($this->menu, array(1, __("Root manual"), __("http://diogenes-doc.polytechnique.org/en-root/")) );
94 array_push($this->menu, array(1,__("List of sites"), $this->url("toplevel/")) );
95 array_push($this->menu, array(1,__("Administrators"),$this->url("toplevel/admins.php")) );
96 array_push($this->menu, array(1,__("Global options"),$this->url("toplevel/options.php")) );
97 array_push($this->menu, array(1,__("Plugins"),$this->url("toplevel/plugins.php")));
98 array_push($this->menu, array(0,__("Users"), "", 1));
99 array_push($this->menu, array(1,__("User accounts"),$this->url("toplevel/accounts.php")) );
100 array_push($this->menu, array(1,__("Browse user log"),$this->url("toplevel/logger.php")) );
101 array_push($this->menu, array(1,__("Logger actions"),$this->url("toplevel/logger_actions.php")) );
102 }
103 }
104
105}
106
107?>