menu.php3 31.7 KB
Newer Older
1
<?php
Leigh B. Stoller's avatar
Leigh B. Stoller committed
2
3
#
# EMULAB-COPYRIGHT
4
# Copyright (c) 2000-2005 University of Utah and the Flux Group.
Leigh B. Stoller's avatar
Leigh B. Stoller committed
5
6
# All rights reserved.
#
7

8
$login_status     = CHECKLOGIN_NOTLOGGEDIN;
9
$login_uid        = 0;
10
$drewheader       = 0;
11
$autorefresh      = 0;
12

13
14
15
16
17
18
#
# This has to be set so we can spit out http or https paths properly!
# Thats because browsers do not like a mix of secure and nonsecure.
# 
$BASEPATH	  = "";

19
#
20
21
# TOPBARCELL - Make a cell for the topbar. Actually, the name lies, it can be
# used for cells in a bottombar too.
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#
function TOPBARCELL($contents) {
    echo "<td class=\"topbaropt\">";
    echo "<span class=\"topbaroption\">&nbsp;";
    echo $contents;
    echo "&nbsp;</span>";
    echo "</td>";
    echo "\n";
}

#
# SIDEBARCELL - Make a cell for the sidebar
#
function SIDEBARCELL($contents, $last = 0) {
    echo "<tr>";
    if ($last) {
	echo "<td class=\"menuoptb\">";
    } else {
	echo "<td class=\"menuopt\">";
    }
42
    echo "$contents";
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
    echo "</td>";
    echo "</tr>";
    echo "\n";
}

#
# WRITETOPBARBUTTON(text, base, link): Write a button in the topbar
#
function WRITETOPBARBUTTON($text, $base, $link ) {
    $link = "$base/$link";
    TOPBARCELL("<a href=\"$link\">$text</a>");
}
# same as above with "new" gif next to it.
function WRITETOPBARBUTTON_NEW($text, $base, $link ) {
    $link = "$base/$link";
    TOPBARCELL("<a href=\"$link\">$text</a>&nbsp;<img src=\"/new.gif\" />");
}

61
62
63
64
65
66
67
#
# WRITESIDEBARDIVIDER(): Put a bit of whitespace in the sidebar
#
function WRITESIDEBARDIVIDER() {
    global $BASEPATH;
    echo "<tr>";
    echo "<td class=\"menuoptdiv\">";
68
    # We have to put something in this cell, or IE ignores it. But, we do not
69
70
71
72
73
74
75
    # want to make the table row full line-height, so a space will not do.
    echo "<img src=\"$BASEPATH/1px.gif\" border=0 height=1 width=1 />";
    echo "</td>";
    echo "</tr>";
    echo "\n";
}

76
77
78
79
80
#
# WRITESIDEBARBUTTON(text, link): Write a button on the sidebar menu.
# We do not currently try to match the current selection so that its
# link looks different. Not sure its really necessary.
#
Chad Barb's avatar
   
Chad Barb committed
81
function WRITESIDEBARBUTTON($text, $base, $link ) {
82
83
    if ($base)
	$link = "$base/$link";
84
    SIDEBARCELL("<a href=\"$link\">$text</a>");
Chad Barb's avatar
   
Chad Barb committed
85
}
86

Chad Barb's avatar
   
Chad Barb committed
87
88
89
# same as above with "new" gif next to it.
function WRITESIDEBARBUTTON_NEW($text, $base, $link ) {
    $link = "$base/$link";
90
    SIDEBARCELL("<a href=\"$link\">$text</a>&nbsp;<img src=\"/new.gif\" />");
Chad Barb's avatar
   
Chad Barb committed
91
92
}

Chad Barb's avatar
   
Chad Barb committed
93
94
95
# same as above with "cool" gif next to it.
function WRITESIDEBARBUTTON_COOL($text, $base, $link ) {
    $link = "$base/$link";
96
    SIDEBARCELL("<a href=\"$link\">$text</a>&nbsp;<img src=\"/cool.gif\" />");
Chad Barb's avatar
   
Chad Barb committed
97
98
}

Leigh B. Stoller's avatar
Leigh B. Stoller committed
99
100
function WRITESIDEBARBUTTON_ABS($text, $base, $link ) {
    $link = "$link";
101
    SIDEBARCELL("<a href=\"$link\">$text</a>\n");
Leigh B. Stoller's avatar
Leigh B. Stoller committed
102
103
}

Chad Barb's avatar
   
Chad Barb committed
104
105
function WRITESIDEBARBUTTON_ABSCOOL($text, $base, $link ) {
    $link = "$link";
106
    SIDEBARCELL("<a href=\"$link\">$text</a>&nbsp;<img src=\"/cool.gif\" />");
Chad Barb's avatar
   
Chad Barb committed
107
108
}

Chad Barb's avatar
   
Chad Barb committed
109
110
111
112
113
# same as above, but uses a slightly different style sheet so there
# is more padding below the last button.
# The devil is, indeed, in the details.
function WRITESIDEBARLASTBUTTON($text, $base, $link) {
    $link = "$base/$link";
114
    SIDEBARCELL("<a href=\"$link\">$text</a>",1);
Chad Barb's avatar
   
Chad Barb committed
115
116
}

Chad Barb's avatar
Chad Barb committed
117
118
function WRITESIDEBARLASTBUTTON_COOL($text, $base, $link) {
    $link = "$base/$link";
119
    SIDEBARCELL("<a href=\"$link\">$text</a>&nbsp;<img src=\"/cool.gif\" />",1);
Chad Barb's avatar
Chad Barb committed
120
121
}

Chad Barb's avatar
   
Chad Barb committed
122
123
# writes a message to the sidebar, without clickability.
function WRITESIDEBARNOTICE($text) {
124
125
126
127
128
129
130
131
132
133
134
135
136
137
    SIDEBARCELL("<b>$text</b>");
}

#
# Something like the sidebar, but across the top, with only a few options.
# Think Google. For PlanetLab users, but it would be easy enough to make
# others. Still a work in progress.
#
function WRITEPLABTOPBAR() {
    echo "<table class=\"topbar\" width=\"100%\" cellpadding=\"2\" cellspacing=\"0\" align=\"center\">\n";
    global $login_status, $login_uid;
    global $TBBASE, $TBDOCBASE, $BASEPATH;
    global $THISHOMEBASE;

138
139
    WRITETOPBARBUTTON("Create a Slice",
        $TBBASE, "plab_ez.php3");
140

141
    WRITETOPBARBUTTON("Nodes",
142
143
144
145
146
147
148
149
        $TBBASE, "plabmetrics.php3");

    WRITETOPBARBUTTON("My Testbed",
	$TBBASE,
	"showuser.php3?target_uid=$login_uid");


    WRITETOPBARBUTTON("Advanced Experiment",
150
        $TBBASE, "beginexp_html.php3");
151

152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
    if ($login_status & CHECKLOGIN_TRUSTED) {
	# Only project/group leaders can do these options
	# Show a "new" icon if there are people waiting for approval
	$query_result =
	DBQueryFatal("select g.* from group_membership as authed ".
		     "left join group_membership as g on ".
		     " g.pid=authed.pid and g.gid=authed.gid ".
		     "left join users as u on u.uid=g.uid ".
		     "where u.status!='".
		     TBDB_USERSTATUS_UNVERIFIED . "' and ".
		     " u.status!='" . TBDB_USERSTATUS_NEWUSER . 
		     "' and g.uid!='$login_uid' and ".
		     "  g.trust='". TBDB_TRUSTSTRING_NONE . "' ".
		     "  and authed.uid='$login_uid' and ".
		     "  (authed.trust='group_root' or ".
		     "   authed.trust='project_root') ".
		     "ORDER BY g.uid,g.pid,g.gid");
	if (mysql_num_rows($query_result) > 0) {
	     WRITETOPBARBUTTON_NEW("Approve Users",
				   $TBBASE, "approveuser_form.php3");
	} else {
	    WRITETOPBARBUTTON("Approve Users",
			       $TBBASE, "approveuser_form.php3");
	}
    }

    WRITETOPBARBUTTON("Log Out", $TBBASE, "logout.php3?next_page=" .
	urlencode($TBBASE . "/login_plab.php3"));

181
182
183
    echo "</table>\n";
    echo "<br>\n";

184
185
}

186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202

#
# Put a few things that PlanetLab users should see, but are non-essential,
# across the bottom of the page rather than the top
#
function WRITEPLABBOTTOMBAR() {
    global $login_status, $login_uid;
    global $TBBASE, $TBDOCBASE, $BASEPATH;
    global $THISHOMEBASE;

    if ($login_uid) {
	$newsBase = $TBBASE; 
    } else {
	$newsBase = $TBDOCBASE;
    }

    echo "
203
204
205
	   <center>
	   <br>
	   <font size=-1>
206
	   <form method=get action=$TBDOCBASE/search.php3>
207
208
209
210
	   [ <a href='$TBDOCBASE/doc.php3'>
		Documentation</a> : <input name=query size = 15/>
		  <input type=submit style='font-size:10px;' value='Search' /> ]
	   [ <a href='$newsBase/news.php3'>
211
		News</a> ]
212
213
214
215
	   </form>
	   </font>
	   <br>
	   </center>\n";
216
217
218

}

219
220
221
222
223
#
# WRITESIDEBAR(): Write the menu. The actual menu options the user
# sees depends on the login status and the DB status.
#
function WRITESIDEBAR() {
224
225
    global $login_status, $login_uid, $pid, $gid;
    global $TBBASE, $TBDOCBASE, $BASEPATH, $WIKISUPPORT, $MAILMANSUPPORT;
226
    global $BUGDBSUPPORT, $BUGDBURL;
227
    global $CHECKLOGIN_WIKINAME;
228
    global $THISHOMEBASE;
229
    $firstinitstate = TBGetFirstInitState();
230
231
232

    #
    # The document base cannot be a mix of secure and nonsecure.
233
    #
Chad Barb's avatar
   
Chad Barb committed
234
235
236
    
    # create the main menu table, which also happens to reside in a form
    # (for search.)
Chad Barb's avatar
   
Chad Barb committed
237
238
239
240
241
242
243
244
245

    #
    # get post time of most recent news;
    # get both displayable version and age in days.
    #
    $query_result = 
	DBQueryFatal("SELECT DATE_FORMAT(date, '%M&nbsp;%e') AS prettydate, ".
		     " (TO_DAYS(NOW()) - TO_DAYS(date)) AS age ".
		     "FROM webnews ".
246
		     "WHERE archived=0 ".
Chad Barb's avatar
   
Chad Barb committed
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
		     "ORDER BY date DESC ".
		     "LIMIT 1");
    $newsDate = "";
    $newNews  = 0;

    #
    # This is so an admin can use the editing features of news.
    #
    if ($login_uid) { # && ISADMIN($login_uid)) { 
	$newsBase = $TBBASE; 
    } else {
	$newsBase = $TBDOCBASE;
    }

    if ($row = mysql_fetch_array($query_result)) {
	$newsDate = "(".$row[prettydate].")";
	if ($row[age] < 7) {
	    $newNews = 1;
	}
    }

268
    echo "<FORM method=get ACTION=$TBDOCBASE/search.php3>\n";
Chad Barb's avatar
   
Chad Barb committed
269
?>
270
  <table class="menu" width=210 cellpadding="0" cellspacing="0">
Chad Barb's avatar
   
Chad Barb committed
271
272
    <tr><td class="menuheader"><b>Information</b></td></tr>
<?php
Chad Barb's avatar
   
Chad Barb committed
273
274
275
276
277
278
    if (0 == strcasecmp($THISHOMEBASE, "emulab.net")) {
	$rootEmulab = 1;
    } else {
	$rootEmulab = 0;
    }

279
    WRITESIDEBARBUTTON("Home", $TBDOCBASE, "index.php3?stayhome=1");
280

Chad Barb's avatar
   
Chad Barb committed
281
282

    if ($rootEmulab) {
283
	WRITESIDEBARBUTTON("Other Emulabs", $TBDOCBASE,
Chad Barb's avatar
   
Chad Barb committed
284
285
286
287
288
289
			       "docwrapper.php3?docname=otheremulabs.html");
    } else {
	WRITESIDEBARBUTTON_ABS("Utah Emulab", $TBDOCBASE,
			       "http://www.emulab.net/");

    }
Chad Barb's avatar
   
Chad Barb committed
290

Chad Barb's avatar
   
Chad Barb committed
291
292
293
294
295
296
    if ($newNews) {
	WRITESIDEBARBUTTON_NEW("News $newsDate", $newsBase, "news.php3");
    } else {
	WRITESIDEBARBUTTON("News $newsDate", $newsBase, "news.php3");
    }

297
    WRITESIDEBARBUTTON("Documentation", $TBDOCBASE, "doc.php3");
Chad Barb's avatar
   
Chad Barb committed
298
299

    if ($rootEmulab) {
Kirk Webb's avatar
   
Kirk Webb committed
300
	WRITESIDEBARBUTTON("Papers (Jul 28)", $TBDOCBASE, "pubs.php3");
301
	WRITESIDEBARBUTTON("Software (Mar 12)",
302
			       $TBDOCBASE, "software.php3");
303
304
305
306
307
308
309
310
311
312
	WRITESIDEBARBUTTON("Add Widearea Node (CD)",
				$TBDOCBASE, "cdrom.php");

	SIDEBARCELL("<a href=\"$TBDOCBASE/people.php3\">People</a> and " .
	            "<a href=\"$TBDOCBASE/gallery/gallery.php3\">Photos</a>");

	SIDEBARCELL("Emulab <a href=\"$TBDOCBASE/doc/docwrapper.php3? " .
		    "docname=users.html\">Users</a> and " .
	            "<a href=\"$TBDOCBASE/docwrapper.php3? " .
		    "docname=sponsors.html\">Sponsors</a>",1);
Chad Barb's avatar
   
Chad Barb committed
313
    } else {
314
315
316
	# Link ALWAYS TO UTAH
	WRITESIDEBARBUTTON_ABSCOOL("Add Widearea Node (CD)",
			       $TBDOCBASE, "http://www.emulab.net/cdrom.php");
Chad Barb's avatar
   
Chad Barb committed
317
318
319
	WRITESIDEBARLASTBUTTON("Projects on Emulab", $TBDOCBASE,
			       "projectlist.php3");
    }
320

Chad Barb's avatar
   
Chad Barb committed
321
322
323
    # create the search bit, then the second table for the Web Interface.
?>
    <tr><td class="menuoptst"><b>Search Documentation:</b></td></tr>
324
325
326
    <tr><td class="menuoptsb"><input name=query size = 15/>
      <input type=submit style="font-size:10px;" value="Go" /><br>
    </td></tr>
327
328
329
330
<?php # BACK TO PHP
    echo "</table>\n";
    echo "</form>\n";
?>
331
<table class="menu" width=210 cellpadding="0" cellspacing="0">
332
333
334
    <tr><td class="menuheader">
      <b>Interaction</b>
    </td></tr>
Chad Barb's avatar
   
Chad Barb committed
335
<?php # BACK TO PHP
336

337
    if ($login_status & CHECKLOGIN_LOGGEDIN) {
Chad Barb's avatar
   
Chad Barb committed
338
         $freepcs = TBFreePCs();
339
	 WRITESIDEBARNOTICE( "($freepcs free PCs)" );
340
    }
341

342
343
344
345
346
347
348
349
    #
    # Basically, we want to let admin people continue to use
    # the web interface even when nologins set. But, we want to make
    # it clear its disabled.
    # 
    if (NOLOGINS()) {
        WRITESIDEBARBUTTON("<font color=red> ".
			   "Web Interface Temporarily Unavailable</font>",
350
351
			   $TBDOCBASE, "nologins.php3");

Chad Barb's avatar
   
Chad Barb committed
352
353
354
        if (!$login_uid || !ISADMIN($login_uid)) {	
	    WRITESIDEBARNOTICE("Please Try Again Later");
        }
355
    }
Chad Barb's avatar
   
Chad Barb committed
356

357
    if ($login_status & (CHECKLOGIN_LOGGEDIN|CHECKLOGIN_MAYBEVALID)) {
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
	if ($firstinitstate != null) {    
	    if ($firstinitstate == "createproject") {
		WRITESIDEBARBUTTON("Create First Project",
				   $TBBASE, "newproject.php3");
	    }
	    elseif ($firstinitstate == "approveproject") {
		$firstinitpid = TBGetFirstInitPid();
		
		WRITESIDEBARBUTTON("Approve First Project",
				   $TBBASE,
				   "approveproject.php3?pid=$firstinitpid".
				   "&approval=approve");
	    }
	}
	elseif ($login_status & CHECKLOGIN_ACTIVE) {
373
	    if ($login_status & CHECKLOGIN_PSWDEXPIRED) {
374
		WRITESIDEBARBUTTON("Change Your Password",
375
				   $TBBASE, "moduserinfo.php3");
376
	    }
Leigh B. Stoller's avatar
Leigh B. Stoller committed
377
	    elseif ($login_status & (CHECKLOGIN_WEBONLY|CHECKLOGIN_WIKIONLY)) {
378
379
380
		WRITESIDEBARBUTTON("My Emulab",
				   $TBBASE,
				   "showuser.php3?target_uid=$login_uid");
381
382
383
384
385

		if ($WIKISUPPORT && $CHECKLOGIN_WIKINAME != "") {
		    $wikiname = $CHECKLOGIN_WIKINAME;
		
		    WRITESIDEBARBUTTON_ABSCOOL("My Wikis",
386
387
			       "gotowiki.php3?redurl=Main/$wikiname",
			       "gotowiki.php3?redurl=Main/$wikiname");
388
		}
389
390
391

		if ($MAILMANSUPPORT || $BUGDBSUPPORT) {
		    if (!isset($pid) || $pid == "") {
Timothy Stack's avatar
   
Timothy Stack committed
392
393
394
395
			$query_result = DBQueryFatal(
			    "select pid from group_membership where ".
			    "uid='$login_uid' and pid=gid and trust!='none' ".
			    "order by date_approved asc limit 1");
396
			if (mysql_num_rows($query_result)) {
Timothy Stack's avatar
   
Timothy Stack committed
397
			    $row = mysql_fetch_array($query_result);
398
			    $firstpid = $row[pid];
Timothy Stack's avatar
   
Timothy Stack committed
399
400
			}
		    }
401
402
		}

403
		if ($MAILMANSUPPORT) {
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
		    $showit = 0;
		    $mmurl  = "gotommlist.php3";
		    
		    if (isset($pid) && !empty($pid)) {
		        $mmurl .= "?pid=$pid";

			if (isset($gid) && !empty($gid)) {
			    $mmurl .= "&gid=$gid";
			}
			$showit = 1;
		    }
		    elseif (isset($firstpid)) {
		        $mmurl .= "?pid=$firstpid";
			$showit = 1;
		    }
		    if ($showit) {
			WRITESIDEBARBUTTON_ABSCOOL("My Mailing Lists",
						   $mmurl, $mmurl);
		    }
		}

		if ($BUGDBSUPPORT) {
		    $bugdburl = "gotobugdb.php3";
		    
		    if (isset($pid) && !empty($pid)) {
			$bugdburl .= "?project_title=$pid";
		    }
		    elseif (isset($firstpid)) {
			$bugdburl .= "?project_title=$firstpid";
		    }
434
		    WRITESIDEBARBUTTON_ABSCOOL("My Bug Databases",
Timothy Stack's avatar
   
Timothy Stack committed
435
436
					       $bugdburl,
					       $bugdburl);
437
438
		}
	    
439
440
		WRITESIDEBARBUTTON("Update User Information",
				   $TBBASE, "moduserinfo.php3");
441
442
443
444
445
446
447
448
449

	        if (ISADMIN($login_uid)) {
		    WRITESIDEBARBUTTON("Approve New Projects",
				       $TBBASE, "approveproject_list.php3");
		    WRITESIDEBARBUTTON("User List",
				       $TBBASE, "showuser_list.php3");
		    WRITESIDEBARBUTTON("New User Approval",
				       $TBBASE, "approveuser_form.php3");
		}
450
	    }
451
	    else {
Leigh B. Stoller's avatar
Leigh B. Stoller committed
452
		WRITESIDEBARBUTTON("My Emulab",
453
454
				   $TBBASE,
				   "showuser.php3?target_uid=$login_uid");
455
456
457
458
459

		if ($WIKISUPPORT && $CHECKLOGIN_WIKINAME != "") {
		    $wikiname = $CHECKLOGIN_WIKINAME;
		
		    WRITESIDEBARBUTTON_ABSCOOL("My Wikis",
460
461
			       "gotowiki.php3?redurl=Main/$wikiname",
			       "gotowiki.php3?redurl=Main/$wikiname");
462
		}
463

464
465
		if ($MAILMANSUPPORT || $BUGDBSUPPORT) {
		    if (!isset($pid) || $pid == "") {
Timothy Stack's avatar
   
Timothy Stack committed
466
467
468
469
			$query_result = DBQueryFatal(
			    "select pid from group_membership where ".
			    "uid='$login_uid' and pid=gid and trust!='none' ".
			    "order by date_approved asc limit 1");
470
			if (mysql_num_rows($query_result)) {
Timothy Stack's avatar
   
Timothy Stack committed
471
			    $row = mysql_fetch_array($query_result);
472
			    $firstpid = $row[pid];
Timothy Stack's avatar
   
Timothy Stack committed
473
474
			}
		    }
475
476
		}

477
		if ($MAILMANSUPPORT) {
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
		    $showit = 0;
		    $mmurl  = "gotommlist.php3";
		    
		    if (isset($pid) && !empty($pid)) {
		        $mmurl .= "?pid=$pid";

			if (isset($gid) && !empty($gid)) {
			    $mmurl .= "&gid=$gid";
			}
			$showit = 1;
		    }
		    elseif (isset($firstpid)) {
		        $mmurl .= "?pid=$firstpid";
			$showit = 1;
		    }
		    if ($showit) {
			WRITESIDEBARBUTTON_ABSCOOL("My Mailing Lists",
						   $mmurl, $mmurl);
		    }
		}

		if ($BUGDBSUPPORT) {
		    $bugdburl = "gotobugdb.php3";
		    
		    if (isset($pid) && !empty($pid)) {
			$bugdburl .= "?project_title=$pid";
		    }
		    elseif (isset($firstpid)) {
			$bugdburl .= "?project_title=$firstpid";
		    }
508
		    WRITESIDEBARBUTTON_ABSCOOL("My Bug Databases",
Timothy Stack's avatar
   
Timothy Stack committed
509
510
					       $bugdburl,
					       $bugdburl);
511
		}
512
	    
513
514
515
516
                # Since a user can be a member of more than one project,
                # display this option, and let the form decide if the 
                # user is allowed to do this.
                #
517

518
		WRITESIDEBARDIVIDER();
519

520
521
 		WRITESIDEBARBUTTON("Begin an Experiment",
				   $TBBASE, "beginexp_html.php3");
522

523
524
		# Put _NEW back when Plab is working again.
		WRITESIDEBARBUTTON("Create a PlanetLab Slice",
525
526
527
528
529
530
531
532
533
534
				       $TBBASE, "plab_ez.php3");

		WRITESIDEBARBUTTON("Experiment List",
				   $TBBASE, "showexp_list.php3");

		WRITESIDEBARDIVIDER();

		WRITESIDEBARBUTTON("Node Status",
				   $TBBASE, "nodecontrol_list.php3");

535
536
537
538
539
		SIDEBARCELL("List <a " .
			"href=\"$TBBASE/showimageid_list.php3\">" .
	        	"ImageIDs</a> or <a " .
	                "href=\"$TBBASE/showosid_list.php3\">OSIDs</a>");

540
541
542
		if ($login_status & CHECKLOGIN_CVSWEB) {
		    WRITESIDEBARBUTTON("CVS Repository",
				       $TBBASE, "cvsweb/cvsweb.php3");
543
544
		}
		if ($login_status & CHECKLOGIN_TRUSTED) {
545
		  WRITESIDEBARDIVIDER();
546
547
548
                  # Only project/group leaders can do these options
                  # Show a "new" icon if there are people waiting for approval
		  $query_result =
549
550
551
		    DBQueryFatal("select g.* from group_membership as authed ".
				 "left join group_membership as g on ".
				 " g.pid=authed.pid and g.gid=authed.gid ".
552
				 "left join users as u on u.uid=g.uid ".
553
				 "where u.status!='".
554
				 TBDB_USERSTATUS_UNVERIFIED . "' and ".
555
556
557
558
559
560
				 " u.status!='" . TBDB_USERSTATUS_NEWUSER . 
				 "' and g.uid!='$login_uid' and ".
				 "  g.trust='". TBDB_TRUSTSTRING_NONE . "' ".
				 "  and authed.uid='$login_uid' and ".
				 "  (authed.trust='group_root' or ".
				 "   authed.trust='project_root') ".
561
562
563
564
565
				 "ORDER BY g.uid,g.pid,g.gid");
		  if (mysql_num_rows($query_result) > 0) {
		    WRITESIDEBARBUTTON_NEW("New User Approval",
					   $TBBASE, "approveuser_form.php3");
		  } else {
566
567

		      WRITESIDEBARBUTTON("New User Approval",
568
				       $TBBASE, "approveuser_form.php3");
569
		  }
570
		}
571
		if (ISADMIN($login_uid)) {
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
		    WRITESIDEBARDIVIDER();

		    SIDEBARCELL("List <a " .
				" href=\"$TBBASE/showproject_list.php3\">" .
		                "Projects</a> or <a " .
		                "href=\"$TBBASE/showuser_list.php3\">Users</a>");

		    WRITESIDEBARBUTTON("View Testbed Stats",
				       $TBBASE, "showstats.php3");

		    WRITESIDEBARBUTTON("Approve New Projects",
				       $TBBASE, "approveproject_list.php3");

		    WRITESIDEBARBUTTON("Approve Widearea User",
				       $TBBASE, "approvewauser_form.php3");
587

Chad Barb's avatar
   
Chad Barb committed
588
589
		    WRITESIDEBARBUTTON("Edit Site Variables",
				       $TBBASE, "editsitevars.php3");
590

Leigh B. Stoller's avatar
Leigh B. Stoller committed
591
592
593
		    WRITESIDEBARBUTTON("Edit Knowledge Base",
				       $TBBASE, "kb-manage.php3");
		    
594
595
596
597
598
599
600
601
602
		    $query_result
		      = DBQUeryFatal("select new_node_id from new_nodes");
                    if (mysql_num_rows($query_result) > 0) {
		        WRITESIDEBARBUTTON_NEW("Add Testbed Nodes",
				           $TBBASE, "newnodes_list.php3");
		    } else {
		        WRITESIDEBARBUTTON("Add Testbed Nodes",
				           $TBBASE, "newnodes_list.php3");
		    }
603

604
		}
605

606
	    }
607
	}
608
	elseif ($login_status & (CHECKLOGIN_UNVERIFIED|CHECKLOGIN_NEWUSER)) {
609
610
	    WRITESIDEBARBUTTON("New User Verification",
			       $TBBASE, "verifyusr_form.php3");
611
	    WRITESIDEBARBUTTON("Update User Information",
612
			       $TBBASE, "moduserinfo.php3");
613
	}
614
	elseif ($login_status & (CHECKLOGIN_UNAPPROVED)) {
615
	    WRITESIDEBARBUTTON("Update User Information",
616
			       $TBBASE, "moduserinfo.php3");
617
	}
618
619
	#
	# Standard options for logged in users!
620
621
622
623
624
625
626
	#
	if (!$firstinitstate) {
	    WRITESIDEBARDIVIDER();
	    SIDEBARCELL("<a href=\"$TBBASE/newproject.php3\">Start</a> or " .
	             "<a href=\"$TBBASE/joinproject.php3\">Join</a> a Project",
			1);
	}
627
    }
628

629
630
    #WRITESIDEBARLASTBUTTON_COOL("Take our Survey",
    #    $TBDOCBASE, "survey.php3");
631

632
633
634
635
636
    #
    # Cons up a nice message.
    # 
    switch ($login_status & CHECKLOGIN_STATUSMASK) {
    case CHECKLOGIN_LOGGEDIN:
Chad Barb's avatar
Chad Barb committed
637
	$login_message = "'$login_uid' Logged in.";
638
639
	    
	if ($login_status & CHECKLOGIN_PSWDEXPIRED)
Chad Barb's avatar
Chad Barb committed
640
	    $login_message = "$login_message<br>(Password Expired!)";
641
	elseif ($login_status & CHECKLOGIN_UNAPPROVED)
Chad Barb's avatar
Chad Barb committed
642
	    $login_message = "$login_message<br>(Unapproved!)";
643
	break;
644
    case CHECKLOGIN_TIMEDOUT:
Chad Barb's avatar
Chad Barb committed
645
	$login_message = "Login Timed out.";
646
	break;
647
648
    default:
	$login_message = 0;
649
	break;
650
651
    }

Chad Barb's avatar
   
Chad Barb committed
652
    if ($login_message) {
Chad Barb's avatar
   
Chad Barb committed
653
      echo "<tr>";
Chad Barb's avatar
Chad Barb committed
654
      echo "<td class=\"menufooter\" style='padding-top: 6px;' ><center><b>";
Chad Barb's avatar
   
Chad Barb committed
655
656
      echo "$login_message</b></center></td>";
      echo "</tr>";
Chad Barb's avatar
   
Chad Barb committed
657
658
    }

659
660
    #
    # Now the login/logout box. Remember, already inside a table.
661
662
    # We want the links to the login/logout pages to always be https,
    # but the images path depends on whether the page was loaded as
663
    # http or https, since we do not want to mix them, since they
664
    # cause warnings.
665
    # 
666
    if ($login_status & (CHECKLOGIN_LOGGEDIN|CHECKLOGIN_MAYBEVALID)) {
Chad Barb's avatar
   
Chad Barb committed
667
668
      echo "<tr>";
      echo "<td class=\"menufooter\" align=center valign=center>";
669
      echo "<a href=\"$TBBASE/logout.php3?target_uid=$login_uid\">";
Chad Barb's avatar
   
Chad Barb committed
670
671
672
      echo "<img alt=\"logoff\" border=0 ";
      echo "src=\"$BASEPATH/logoff.gif\"></a>\n";
      echo "</td></tr>\n";
673
    }
674
    elseif (!NOLOGINS()) {
675
676
	echo "<tr>";
	echo "<td class=\"menufooter\" align=center valign=center>";
Chad Barb's avatar
Chad Barb committed
677

678
679
680
681
	if (!$firstinitstate) {
	    echo "<a href=\"$TBBASE/reqaccount.php3\">";
	    echo "<img alt=\"Request Account\" border=0 ";
	    echo "src=\"$BASEPATH/requestaccount.gif\"></a>";
Chad Barb's avatar
Chad Barb committed
682

683
684
	    echo "<br /><b>or</b><br />";
	}
Chad Barb's avatar
Chad Barb committed
685

686
687
688
	echo "<a href=\"$TBBASE/login.php3\">";
	echo "<img alt=\"logon\" border=0 ";
	echo "src=\"$BASEPATH/logon.gif\"></a>\n";
Chad Barb's avatar
Chad Barb committed
689

690
	echo "</td></tr>\n";
691
    }
692

693
    #
Chad Barb's avatar
   
Chad Barb committed
694
    # Login message. Set via 'web/message' site variable
695
    #
Chad Barb's avatar
   
Chad Barb committed
696
697
    $message = TBGetSiteVar("web/message");
    if (0 != strcmp($message,"")) {
Robert Ricci's avatar
Robert Ricci committed
698
	WRITESIDEBARNOTICE($message);    	
699
    }
Chad Barb's avatar
   
Chad Barb committed
700

Chad Barb's avatar
   
Chad Barb committed
701
    echo "</table>\n";
702
703
}

704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
#
# Simple version of above, that just writes the given menu.
# 
function WRITESIMPLESIDEBAR($menudefs) {
    $menutitle = $menudefs['title'];
    
    echo "<table class=menu width=210 cellpadding=0 cellspacing=0>
           <tr><td class=menuheader>\n";

    echo "<b>$menutitle</b>";
    echo " </td>";
    echo "</tr>\n";

    each($menudefs);    
    while (list($key, $val) = each($menudefs)) {
	WRITESIDEBARBUTTON("$key", null, "$val");
    }
    echo "</table>\n";
}

Chad Barb's avatar
   
Chad Barb committed
724
725
726
#
# spits out beginning part of page
#
727
function PAGEBEGINNING( $title, $nobanner = 0 ) {
728
    global $BASEPATH, $TBMAINSITE, $THISHOMEBASE, $ELABINELAB;
Chad Barb's avatar
Chad Barb committed
729
    global $TBDIR, $WWW;
Chad Barb's avatar
   
Chad Barb committed
730
    global $MAINPAGE;
731
    global $TBDOCBASE;
732
    global $autorefresh;
Chad Barb's avatar
   
Chad Barb committed
733

734
735
    $MAINPAGE = !strcmp($TBDIR, "/usr/testbed/");

Chad Barb's avatar
   
Chad Barb committed
736
737
738
739
740
    echo "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 
          'http://www.w3.org/TR/html4/loose.dtd'>
	<html>
	  <head>
	    <title>$THISHOMEBASE - $title</title>
741
742
            <!--<link rel=\"SHORTCUT ICON\" HREF=\"netbed.ico\">-->
            <link rel=\"SHORTCUT ICON\" HREF=\"netbed.png\" TYPE=\"image/png\">
Chad Barb's avatar
   
Chad Barb committed
743
744
    	    <!-- dumbed-down style sheet for any browser that groks (eg NS47). -->
	    <link REL='stylesheet' HREF='$BASEPATH/common-style.css' TYPE='text/css' />
745
746
    	    <!-- do not import full style sheet into NS47, since it does bad job
            of handling it. NS47 does not understand '@import'. -->
Chad Barb's avatar
   
Chad Barb committed
747
748
749
750
751
752
753
    	    <style type='text/css' media='all'>
            <!-- @import '$BASEPATH/style.css'; -->";

    if (!$MAINPAGE) {
	echo "<!-- @import '$BASEPATH/style-nonmain.css'; -->";
    } 

Leigh B. Stoller's avatar
Leigh B. Stoller committed
754
    echo "</style>\n";
Chad Barb's avatar
   
Chad Barb committed
755
756

    if ($TBMAINSITE) {
Leigh B. Stoller's avatar
Leigh B. Stoller committed
757
	echo "<meta NAME=\"keywords\" ".
Leigh B. Stoller's avatar
Leigh B. Stoller committed
758
759
	           "CONTENT=\"network, emulation, internet, emulator, ".
	           "mobile, wireless, robotic\">\n";
Leigh B. Stoller's avatar
Leigh B. Stoller committed
760
761
762
763
764
	echo "<meta NAME=\"robots\" ".
	           "CONTENT=\"NOARCHIVE\">\n";
	echo "<meta NAME=\"description\" ".
                   "CONTENT=\"emulab - network emulation testbed home\">\n";
    }
Chad Barb's avatar
   
Chad Barb committed
765
766
    echo "</head>
            <body bgcolor='#FFFFFF' 
767
             topmargin='0' leftmargin='0' marginheight='0' marginwidth='0'>\n";
768
769
770
771
    
    if ($autorefresh) {
	echo "<meta HTTP-EQUIV=\"Refresh\" CONTENT=\"$autorefresh\">\n";
    }
772
    if (! $nobanner ) {
773
774
775
776
777
778
	echo "<map name=overlaymap>
                 <area shape=rect coords=\"100,60,369,100\"
                       href='http://www.emulab.net/index.php3'>
                 <area shape=rect coords=\"0,0,369,100\"
                       href='$TBDOCBASE/index.php3'>
              </map>
Chad Barb's avatar
   
Chad Barb committed
779
            <table cellpadding='0' cellspacing='0' width='100%'>
780
781
782
783
            <tr valign='top'>
              <td valign='top' class='bannercell'
                  background='$BASEPATH/headerbgbb.jpg'
                  bgcolor=#3D627F
784
785
786
787
788
789
790
791
792
              <img width=369 height=100 border=0 usemap=\"#overlaymap\" ";

	if ($ELABINELAB) {
	    echo "src='$BASEPATH/overlay.elabinelab.gif' ";
	}
	else {
	    echo "src='$BASEPATH/overlay.".strtolower($THISHOMEBASE).".gif' ";
	}
	echo "alt='$THISHOMEBASE - the network testbed'>\n";
793
794
795
796
        if (!$MAINPAGE) {
	     echo "<font size='+1' color='#CCFFCC'>&nbsp;<b>$WWW</b></font>";
	}
	echo "</td></tr></table>\n";
Chad Barb's avatar
   
Chad Barb committed
797
798
799
800
801
802
    }

    echo "<table cellpadding='8' cellspacing='0' height='100%' width='100%'>
            <tr height='100%'>
              <td valign='top' class='leftcell' bgcolor='#ccddee'>
              <!-- sidebar begins -->";
Chad Barb's avatar
   
Chad Barb committed
803
804
805
806
807
808
809
}

#
# finishes sidebar td
#
function FINISHSIDEBAR()
{
Chad Barb's avatar
   
Chad Barb committed
810
    echo "<!-- sidebar ends -->
Chad Barb's avatar
   
Chad Barb committed
811
        </td>
Chad Barb's avatar
   
Chad Barb committed
812
        <td valign='top' width='100%' class='rightcell'>
813
          <!-- content body table -->
Chad Barb's avatar
   
Chad Barb committed
814
          <table class='content' width='100%' cellpadding='0' cellspacing='0'>
Chad Barb's avatar
   
Chad Barb committed
815
            <tr>
Chad Barb's avatar
   
Chad Barb committed
816
              <td class='contentheader'>";
Chad Barb's avatar
   
Chad Barb committed
817
818
}

819
820
821
#
# Spit out a vanilla page header.
#
822
function PAGEHEADER($title, $view = NULL) {
823
    global $login_status, $login_uid, $TBBASE, $TBDOCBASE, $THISHOMEBASE;
824
    global $BASEPATH, $SSL_PROTOCOL, $drewheader, $autorefresh;
825
    global $TBMAINSITE;
826
827

    $drewheader = 1;
828
829
830
    if (isset($_GET['refreshrate']) && is_numeric($_GET['refreshrate'])) {
	$autorefresh = $_GET['refreshrate'];
    }
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846

    #
    # Determine the proper basepath, which depends on whether the page
    # was loaded as http or https. This lets us be consistent in the URLs
    # we spit back, so that users do not get those pesky warnings. These
    # warnings are generated when a page *loads* (say, images, style files),
    # a mix of http and https. Links can be mixed, and in fact when there
    # is no login active, we want to spit back http for the documentation,
    # but https for the start/join pages.
    #
    if (isset($SSL_PROTOCOL)) {
	$BASEPATH = $TBBASE;
    }
    else {
	$BASEPATH = $TBDOCBASE;
    }
847

848
    #
849
    # Figure out who is logged in, if anyone.
850
    # 
851
852
853
854
    if (($known_uid = GETUID()) != FALSE) {
        #
        # Check to make sure the UID is logged in (not timed out).
        #
855
856
857
        $login_status = CHECKLOGIN($known_uid);
	if ($login_status & (CHECKLOGIN_LOGGEDIN|CHECKLOGIN_MAYBEVALID)) {
	    $login_uid = $known_uid;
858
859
860
	}
    }

861
862
863
864
865
866
867
    #
    # If no view options were specified, get the ones for the current user
    #
    if (!$view) {
	$view = GETUSERVIEW();
    }

868
    #
869
870
    # Check for NOLOGINS. 
    # We want to allow admin types to continue using the web interface,
871
872
    # and logout anyone else that is currently logged in!
    #
873
874
875
876
    if (NOLOGINS() && $login_uid && !ISADMIN($login_uid)) {
	DOLOGOUT($login_uid);
	$login_status = CHECKLOGIN_NOTLOGGEDIN;
	$login_uid    = 0;
877
    }
878
    
879
880
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    
881
    if (1) {
882
883
884
885
886
887
888
	header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
	header("Cache-Control: no-cache, must-revalidate");
	header("Pragma: no-cache");
    }
    else {
	header("Expires: " . gmdate("D, d M Y H:i:s", time() + 300) . " GMT"); 
    }
Chad Barb's avatar
   
Chad Barb committed
889

890
891
892
893
894
895
896
897
898
    if (isset($view['hide_banner'])) {
	$nobanner = 1;
    } else {
	$nobanner = 0;
    }
    PAGEBEGINNING( $title, $nobanner );
    if (!isset($view['hide_sidebar'])) {
	WRITESIDEBAR();
    }
899
900
901
    elseif (isset($view['menu'])) {
	WRITESIMPLESIDEBAR($view['menu']);
    }
Chad Barb's avatar
   
Chad Barb committed
902
    FINISHSIDEBAR();
903
    echo "<h2 class=\"nomargin\">\n";
Chad Barb's avatar
   
Chad Barb committed
904

905
    if ($login_uid && ISADMINISTRATOR()) {
Chad Barb's avatar
   
Chad Barb committed
906
	if (ISADMIN($login_uid)) {
907
	    echo "<a href=$TBBASE/toggle.php?target_uid=$login_uid&type=adminoff&value=1>
Chad Barb's avatar
   
Chad Barb committed
908
909
910
911
	             <img src='/redball.gif'
                          border=0 alt='Admin On'></a>\n";
	}
	else {
912
	    echo "<a href=$TBBASE/toggle.php?target_uid=$login_uid&type=adminoff&value=0>
Chad Barb's avatar
   
Chad Barb committed
913
914
915
	             <img src='/greenball.gif'
                          border=0 alt='Admin Off'></a>\n";
	}
916
    }
917
918
919
920
    $major = "";
    $minor = "";
    $build = "";
    TBGetVersionInfo($major, $minor, $build);
921
922
923
924
    if ($view['hide_versioninfo'] == 1)
	$versioninfo = "";
    else
	$versioninfo = "Vers: $major.$minor Build: $build";
925
    
926
927
    $now = date("D M d g:ia T");
    echo "$title</h2></td>\n";
928
    echo "<td class=contentheader align=right>\n";
929
930
    echo "<table border='0' cellpadding='0' cellspacing='0'>";
    echo "  <tr>";
931
    echo "  <td class=contentheader><font size=-2>$versioninfo</font></td>";
932
933
    echo "  <td class=contentheader>&nbsp&nbsp</td>";
    echo "  <td class=contentheader align=right>";
Robert Ricci's avatar
Robert Ricci committed
934
935
    if ($login_uid) {
	echo "<font size=-1>'<b>$login_uid</b>' Logged in.<br>$now</font>\n";
936
937
    }
    else {
Robert Ricci's avatar
Robert Ricci committed
938
	echo "$now";
Chad Barb's avatar
   
Chad Barb committed
939
940
    }
    echo "</td>";
941
942
943
    echo "</tr>";
    echo "</table>";
    echo "</td>";
Chad Barb's avatar
   
Chad Barb committed
944
945
    echo "</tr>\n";
    echo "<tr><td colspan=3 class=\"contentbody\" width=*>";
Chad Barb's avatar
   
Chad Barb committed
946
    echo "<!-- begin content -->\n";
947
948
949
    if ($view['show_topbar'] == "plab") {
	WRITEPLABTOPBAR();
    }
950
951
952
953
954
955
}

#
# ENDPAGE(): This terminates the table started above.
# 
function ENDPAGE() {
Chad Barb's avatar
   
Chad Barb committed
956
957
  echo "</td></tr></table>";
  echo "</td></tr></table>";
958
959
960
961
962
}

#
# Spit out a vanilla page footer.
#
963
function PAGEFOOTER($view = NULL) {
964
    global $TBDOCBASE, $TBMAILADDR, $THISHOMEBASE;
Leigh B. Stoller's avatar
Leigh B. Stoller committed
965
    global $TBMAINSITE, $SSL_PROTOCOL;
966

967
968
969
970
    if (!$view) {
	$view = GETUSERVIEW();
    }

971
972
    $today = getdate();
    $year  = $today["year"];
Chad Barb's avatar
   
Chad Barb committed
973

974
975
976
977
978
979
    echo "<!-- end content -->\n";
    if ($view['show_bottombar'] == "plab") {
	WRITEPLABBOTTOMBAR();
    }

    echo "
Chad Barb's avatar
   
Chad Barb committed
980
              </td>
981
982
            </tr>
            <tr>
983
984
985
              <td colspan=2 class=contentbody>\n";
    if (!$view['hide_copyright']) {
	echo "
986
987
	        <center>
                <font size=-1>
988
		[ <a href=http://www.cs.utah.edu/flux/>
989
                    Flux&nbsp;Research&nbsp;Group</a> ]
990
991
992
		[ <a href=http://www.cs.utah.edu/>
                    School&nbsp;of&nbsp;Computing</a> ]
		[ <a href=http://www.utah.edu/>
993
                    University&nbsp;of&nbsp;Utah</a> ]
994
995
		</font>
		<br>
Chad Barb's avatar
   
Chad Barb committed
996
                <!-- begin copyright -->
997
                <font size=-2>
998
999
1000
1001
                <a href='$TBDOCBASE/docwrapper.php3?docname=copyright.html'>
                    Copyright &copy; 2000-$year The University of Utah</a>
                </font>
                <br>
1002
1003
1004
		</center>\n";
    }
    echo "
1005
                <p align=right>
Chad Barb's avatar
   
Chad Barb committed
1006
1007
		  <font size=-2>
                    Problems?
1008
	            Contact $TBMAILADDR.
Chad Barb's avatar
   
Chad Barb committed
1009
1010
                  </font>
                </p>
1011
                <!-- end copyright -->\n";
Chad Barb's avatar
   
Chad Barb committed
1012
1013

    ENDPAGE();
1014

Leigh B. Stoller's avatar
Leigh B. Stoller committed
1015
1016
1017
    # Plug the home site from all others.
    echo "\n<p><a href=\"www.emulab.net/netemu.php3\"></a>\n";

Chad Barb's avatar
   
Chad Barb committed
1018
    echo "</body></html>\n";
1019
}
1020
1021
1022
1023
1024

function PAGEERROR($msg) {
    global $drewheader;

    if (! $drewheader)
1025
	PAGEHEADER("Page Error");
1026
1027
1028
1029
1030
1031

    echo "$msg\n";

    PAGEFOOTER();
    die("");
}
1032
1033
1034
1035

#
# Sub Page/Menu Stuff
#
1036
function WRITESUBMENUBUTTON($text, $link, $target = "") {
Chad Barb's avatar
   
Chad Barb committed
1037

1038
1039
1040
1041
1042
1043
    #
    # Optional 'target' agument, so that we can pop up new windows
    #
    if ($target) {
	$targettext = "target='$target'";
    }
Chad Barb's avatar
   
Chad Barb committed
1044

1045
1046
1047
1048
    echo "<!-- Table row for button $text -->
          <tr>
            <td valign=center align=left nowrap>
                <b>
1049
         	 <a class=sidebarbutton href='$link' $targettext>$text</a>\n";
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059

    echo "      </b>
            </td>
          </tr>\n";
}

#
# Start/End a page within a page. 
#
function SUBPAGESTART() {
Chad Barb's avatar
   
Chad Barb committed
1060
    echo "<!-- begin subpage -->";
Chad Barb's avatar
   
Chad Barb committed
1061
    echo "<table class=\"stealth\"
1062
	  cellspacing='0' cellpadding='0' width='100%' border='0'>\n
1063
            <tr>\n
Chad Barb's avatar
   
Chad Barb committed
1064
              <td class=\"stealth\"valign=top>\n";
1065
1066
1067
1068
1069
1070
}

function SUBPAGEEND() {
    echo "    </td>\n
            </tr>\n
          </table>\n";
Chad Barb's avatar
   
Chad Barb committed
1071
    echo "<!-- end subpage -->";
1072
1073
1074
1075
1076
1077
1078
}

#
# Start/End a sub menu, located in the upper left of the main frame.
# Note that these cannot be used outside of the SUBPAGE macros above.
#
function SUBMENUSTART($title) {
Chad Barb's avatar
   
Chad Barb committed
1079
1080
?>
    <!-- begin submenu -->
1081
    <table class='menu' cellpadding="0" cellspacing="0"
Chad Barb's avatar
   
Chad Barb committed
1082
	style="margin-right: 6px;" >
Chad Barb's avatar
   
Chad Barb committed
1083
1084
1085
1086
      <tr>
        <td class="menuheader"><b><?php echo "$title";?></b></td>
      </tr>
<?php
1087
1088
1089
}

function SUBMENUEND() {
Chad Barb's avatar
   
Chad Barb committed
1090
1091
1092
1093
?>
    </table>
    <!-- end submenu -->
  </td>
1094
  <td class="stealth" valign=top align=left width='100%'>
Chad Barb's avatar
   
Chad Barb committed
1095
<?php
1096
1097
}

1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
# Start a new section in an existing submenu
# This includes ending the one before it
function SUBMENUSECTION($title) {
    SUBMENUSECTIONEND();
?>
      <!-- new submenu section -->
      <tr>
        <td class="menuheader"><b><?php echo "$title";?></b></td>
      </tr>
<?php
}

# End a submenu section - only need this on the last one of the table.
function SUBMENUSECTIONEND() {
?>
      <tr height=5><td></td></tr>
<?php
}
Chad Barb's avatar
   
Chad Barb committed
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132

# These are here so you can wedge something else under the menu in the left column.

function SUBMENUEND_2A() {
?>
    </table>
    <!-- end submenu -->
<?php
}

function SUBMENUEND_2B() {
?>
  </td>
  <td class="stealth" valign=top align=left width='85%'>
<?php
}

1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
#
# Get a view, for use with PAGEHEADER and PAGEFOOTER, for the current user
#
function GETUSERVIEW() {
    if (GETUID() && ISPLABUSER()) {
	return array('hide_sidebar' => 1, 'hide_banner' => 1,
	    'show_topbar' => "plab", 'show_bottombar' => 'plab',
	    'hide_copyright' => 1);
    } else {
	# Most users get the default view
	return array();
    }
}

1147
?>