4 // Copyright 1999-2000 (c) The SourceForge Crew
6 // This is a modified version made by the Savannah Project
7 // Copyright 2000, 2001, 2002 (c) Free Software Foundation
9 // Further modified by rts for GForge
11 // This program is free software; you can redistribute it and/or
12 // modify it under the terms of the GNU General Public License
13 // as published by the Free Software Foundation; either version 2
14 // of the License, or (at your option) any later version.
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
21 // You should have received a copy of the GNU General Public License
22 // along with this program; if not, write to the Free Software
23 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 // http://savannah.gnu.org
29 // This file contains the menu_* functions required by the Savannah themes.
31 /* The correct theme.php must be included by this point -- Geoffrey */
33 // Menu entry for all admin tasks when logged as site administor
34 function menu_site_admin() {
35 global $HTML, $sys_name;
36 $HTML->menuhtml_top($sys_name." "._('Admin'));
37 $HTML->menu_entry('/admin/',_('Site admin'));
38 $HTML->menu_entry('/admin/grouplist.php',_('Group list admin'));
39 $HTML->menu_entry('/admin/userlist.php',_('User list admin'));
40 $HTML->menu_entry('/admin/approve-pending.php',_('Approve pending projects'));
41 $HTML->menu_entry('/news/admin/',_('News admin approval'));
42 $HTML->menu_entry('/admin/massmail.php',_('Massmail admin'));
43 $HTML->menu_entry('/people/admin/',_('People admin'));
45 $HTML->menuhtml_bottom();
49 function menu_show_search_box() {
50 global $words,$forum_id,$group_id,$atid,$exact,$type_of_search;
52 // if there is no search currently, set the default
53 if ( ! isset($type_of_search) ) {
57 print "\t<br /><form action=\"/search/\" method=\"post\" class=\"menusearch\">\n";
58 print "\t<input type=\"text\" size=\"12\" name=\"words\" value=\"$words\" /> <br />\n";
59 print "\tSoftware/Group<input type=\"radio\" name=\"type_of_search\" value=\"soft\"".( $type_of_search == "soft" ? ' checked="checked"' : "" )."".( $type_of_search == "" ? ' checked="checked"' : "" )." /> <br />\n";
60 print "\tPeople<input type=\"radio\" name=\"type_of_search\" value=\"people\"".( $type_of_search == "people" ? ' checked="checked"' : "" )." /> <br />\n";
61 if ($atid && $group_id) {
62 $group =& group_get_object($group_id);
63 if ($group && is_object($group)) {
64 $ath = new ArtifactTypeHtml($group,$atid);
65 if ($ath && is_object($ath)) {
66 print "\t".$ath->getName()."<input type=\"radio\" name=\"type_of_search\" value=\"artifact\"".( $type_of_search == "artifact" ? ' checked="checked"' : "" )." /> <br />\n";
69 } else if ($group_id && $forum_id) {
70 print "\tThis Forum<input type=\"radio\" name=\"type_of_search\" value=\"forums\"".( $type_of_search == "forums" ? ' checked="checked"' : "" )." /> <br />\n";
72 // print "\tRequire All Words<input type=\"checkbox\" name=\"exact\" value=\"1\"".( $exact ? " checked" : " unchecked" )."> <br />\n";
74 if ( isset($forum_id) ) {
75 print "\t<input type=\"hidden\" value=\"$forum_id\" name=\"forum_id\" />\n";
78 print "\t<input type=\"hidden\" value=\"$atid\" name=\"atid\" />\n";
80 if ( isset($group_id) ) {
81 print "\t<input type=\"hidden\" value=\"$group_id\" name=\"group_id\" />\n";
84 print "\t<input type=\"submit\" name=\"Search\" value=\"Search\" /> \n";
88 //deprecated - theme wrapper
89 function menuhtml_top($title) {
91 Use only for the top most menu
93 theme_menuhtml_top($title);
96 function menu_site_help() {
97 global $HTML, $sys_name;
98 $HTML->menuhtml_top($sys_name);
99 $HTML->menu_entry('/', _('Home'));
100 $HTML->menu_entry('/snippet/', _('Code Snippets'));
101 if (session_loggedin()) {
102 $HTML->menu_entry('/register/',_('Register New Project'));
104 $HTML->menu_entry('/people/',_('Project Openings'));
105 $HTML->menuhtml_bottom();
109 function menu_project_info($group) {
111 $project =& group_get_object($group);
112 if ($project->isError()) {
114 } elseif (!$project->isProject()) {
117 $HTML->menuhtml_top($project->getPublicName());
118 $HTML->menu_entry('/projects/'.$project->getUnixName().'/', _('Summary'));
119 if (user_ismember($group, 'A')) {
121 $HTML->menu_entry('/project/admin/?group_id='.$group, _('Admin'));
124 if ($project->usesForum()) {
125 $HTML->menu_entry('/forum/?group_id='.$group, _('Forums'));
128 $HTML->menu_entry('/tracker/?group_id='.$group, _('Tracker'));
130 if ($project->usesMail()) {
131 $HTML->menu_entry('/mail/?group_id='.$group, _('Lists'));
134 if ($project->usesPm()) {
135 $HTML->menu_entry('/pm/?group_id='.$group, _('Tasks'));
138 if ($project->usesDocman()) {
139 $HTML->menu_entry('/docman/?group_id='.$group, _('Docs'));
142 if ($project->usesSurvey()) {
143 $HTML->menu_entry('/survey/?group_id='.$group, _('Surveys'));
146 if ($project->usesNews()) {
147 $HTML->menu_entry('/news/?group_id='.$group, _('News'));
150 if ($project->usesSCM()) {
151 $HTML->menu_entry('/scm/?group_id='.$group, _('SCM'));
154 $HTML->menu_entry('/project/showfiles.php?group_id='.$group, _('Files'));
155 $HTML->menuhtml_bottom();
159 function menu_search() {
161 $HTML->menuhtml_top(_('Search'));
162 menu_show_search_box();
163 $HTML->menuhtml_bottom();
166 function menu_valid_html() {
169 $HTML->menuhtml_top(' ');
171 // /check?uri= works better than /check/referer
172 $valid_server = getStringFromServer('HTTP_HOST');
173 $valid_page = getStringFromServer('PHP_SELF');
174 echo "<a href=\"http://validator.w3.org/check?uri=http://".$valid_server.$valid_page."\">";
175 print html_image("valid-html401.png",array('width'=>'88', 'height'=>'31', 'alt'=>'Valid HTML 4.01!'));
177 print "\t</center>\n";
178 $HTML->menuhtml_bottom();
182 function menu_loggedin($page_title) {
183 global $HTML, $Language, $sys_name;
185 Show links appropriate for someone logged in, like account maintenance, etc
187 $HTML->menuhtml_top($Language->getText('menu', 'logged_in_as', user_getname()));
188 $HTML->menu_entry('/my/',_('My Personal Page'));
189 $HTML->menu_entry('/account/',_('My Account'));
190 if (!$GLOBALS['HTTP_POST_VARS']) {
191 $bookmark_title = urlencode( str_replace($sys_name.': ', '', $page_title));
192 $HTML->menu_entry('/my/bookmark_add.php?bookmark_url='.urlencode(getStringFromServer('REQUEST_URI')).'&bookmark_title='.$bookmark_title,_('Bookmark Page'));
194 $HTML->menu_entry('/account/logout.php',_('Logout'));
195 $HTML->menuhtml_bottom();
198 function menu_notloggedin() {
200 $HTML->menuhtml_top('Login Status:');
201 echo "<span class=\"error\">NOT LOGGED IN</span> <br />";
202 // $HTML->menu_entry($GLOBALS['sys_home'].'faq/?group='.$GLOBALS['sys_unix_group_name'].'&question=Why_to_log_in.txt','Why Log In?');
203 $HTML->menu_entry('/account/login.php',_('Login'));
204 $HTML->menu_entry('/account/register.php',_('New User via SSL'));
205 $HTML->menuhtml_bottom();
208 function menu_print_sidebar($params) {
209 if (!session_loggedin()) {
210 echo menu_notloggedin();
212 echo menu_loggedin($params['title']);
214 // Site Admin menu added here
215 if (user_ismember(1,'A')) {
216 echo menu_site_admin();
218 echo menu_site_help();
219 if ($params['group']) {
220 echo menu_project_info($params['group']);
223 echo menu_valid_html();
228 // c-file-style: "bsd"