menu.php3 32.2 KB
Newer Older
1
<?php
Leigh B. Stoller's avatar
Leigh B. Stoller committed
2
3
#
# EMULAB-COPYRIGHT
4
# Copyright (c) 2000-2006 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
$noheaders	  = 0;
12
$autorefresh      = 0;
13

14
15
16
17
18
19
#
# 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	  = "";

20
#
21
22
# TOPBARCELL - Make a cell for the topbar. Actually, the name lies, it can be
# used for cells in a bottombar too.
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#
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\">";
    }
43
    echo "$contents";
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
    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\" />");
}

62
63
64
65
66
67
68
#
# WRITESIDEBARDIVIDER(): Put a bit of whitespace in the sidebar
#
function WRITESIDEBARDIVIDER() {
    global $BASEPATH;
    echo "<tr>";
    echo "<td class=\"menuoptdiv\">";
69
    # We have to put something in this cell, or IE ignores it. But, we do not
70
71
72
73
74
75
76
    # 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";
}

77
78
79
80
81
#
# 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
82
function WRITESIDEBARBUTTON($text, $base, $link ) {
83
84
    if ($base)
	$link = "$base/$link";
85
    SIDEBARCELL("<a href=\"$link\">$text</a>");
Chad Barb's avatar
   
Chad Barb committed
86
}
87

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

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

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

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

Chad Barb's avatar
   
Chad Barb committed
110
111
112
113
114
# 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";
115
    SIDEBARCELL("<a href=\"$link\">$text</a>",1);
Chad Barb's avatar
   
Chad Barb committed
116
117
}

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

Chad Barb's avatar
   
Chad Barb committed
123
124
# writes a message to the sidebar, without clickability.
function WRITESIDEBARNOTICE($text) {
125
126
127
128
129
130
131
132
133
134
135
136
137
138
    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;

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

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

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


    WRITETOPBARBUTTON("Advanced Experiment",
151
        $TBBASE, "beginexp_html.php3");
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
181
    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"));

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

185
186
}

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

#
# 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 "
204
205
206
	   <center>
	   <br>
	   <font size=-1>
207
	   <form method=get action=$TBDOCBASE/search.php3>
208
209
210
211
	   [ <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'>
212
		News</a> ]
213
214
215
216
	   </form>
	   </font>
	   <br>
	   </center>\n";
217
218
219

}

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

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

    #
    # 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 ".
247
		     "WHERE archived=0 ".
Chad Barb's avatar
   
Chad Barb committed
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
		     "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;
	}
    }

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

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

Chad Barb's avatar
   
Chad Barb committed
283
284

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

    }
Chad Barb's avatar
   
Chad Barb committed
292

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

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

    if ($rootEmulab) {
302
	# Leave _NEW here about 2 weeks
303
	WRITESIDEBARBUTTON_NEW("Papers and Talks (Feb 22)", $TBDOCBASE, "pubs.php3");
304
	WRITESIDEBARBUTTON("Software (Jul 18)",
305
			       $TBDOCBASE, "software.php3");
306
307
	#WRITESIDEBARBUTTON("Add Widearea Node (CD)",
	#		    $TBDOCBASE, "cdrom.php");
308
309
310
311
312
313
314
315

	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
316
    } else {
317
	# Link ALWAYS TO UTAH
318
319
	#WRITESIDEBARBUTTON_ABSCOOL("Add Widearea Node (CD)",
	#		       $TBDOCBASE, "http://www.emulab.net/cdrom.php");
Chad Barb's avatar
   
Chad Barb committed
320
321
322
	WRITESIDEBARLASTBUTTON("Projects on Emulab", $TBDOCBASE,
			       "projectlist.php3");
    }
323

324
    # The actual search box. Form starts above ...
325
    echo "<tr><td class=menuoptst>
326
327
328
329
                 <input class='textInputEmpty' name=query
                        value='Search String'
                        size=16 onfocus='focus_text(this, \"Search String\")'
                        onblur='blur_text(this, \"Search String\")' />".
330
	"<input type=submit style='font-size:10px;' value=Search /><br>".
331
	"</td></tr>\n";
332
    WRITESIDEBARDIVIDER();
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361

    #
    # Cons up a nice message.
    # 
    switch ($login_status & CHECKLOGIN_STATUSMASK) {
    case CHECKLOGIN_LOGGEDIN:
	$login_message = 0;
	    
	if ($login_status & CHECKLOGIN_PSWDEXPIRED)
	    $login_message = "$login_message<br>(Password Expired!)";
	elseif ($login_status & CHECKLOGIN_UNAPPROVED)
	    $login_message = "$login_message<br>(Unapproved!)";
	break;
    case CHECKLOGIN_TIMEDOUT:
	$login_message = "Login Timed out.";
	break;
    default:
	$login_message = 0;
	break;
    }

    if ($login_message) {
      echo "<tr>";
      echo "<td class=menuoptst style='padding-top: 6px;' ><center><b>";
      echo "$login_message</b></center></td>";
      echo "</tr>";
    }

    #
362
363
    # Now the login box. Remember, already inside a table.
    # We want the links to the login pages to always be https,
364
365
366
    # but the images path depends on whether the page was loaded as
    # http or https, since we do not want to mix them, since they
    # cause warnings.
367
368
369
    #
    if (! ($login_status & (CHECKLOGIN_LOGGEDIN|CHECKLOGIN_MAYBEVALID)) &&
	!NOLOGINS()) {
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
	echo "<tr>";
	echo "<td class=\"menuoptst\" align=center valign=center>";

	if (!$firstinitstate) {
	    echo "<a href=\"$TBBASE/reqaccount.php3\">";
	    echo "<img alt=\"Request Account\" border=0 ";
	    echo "src=\"$BASEPATH/requestaccount.gif\"></a>";

	    echo "<br /><b>or</b><br />";
	}

	echo "<a href=\"$TBBASE/login.php3\">";
	echo "<img alt=\"logon\" border=0 ";
	echo "src=\"$BASEPATH/logon.gif\"></a>\n";

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

    #
    # Login message. Set via 'web/message' site variable
    #
    $message = TBGetSiteVar("web/message");
    if (0 != strcmp($message,"")) {
	WRITESIDEBARNOTICE($message);    	
    }

396
    echo "</table>\n";
397

398
399
400
401
402
403
404
405
    # Start Interaction section if going to spit out interaction options.
    if ($login_status & (CHECKLOGIN_LOGGEDIN|CHECKLOGIN_MAYBEVALID)) {
	echo "<table class=menu width=210 cellpadding=0 cellspacing=0>".
	    "<tr><td class=menuheader>".
	    "<b>Experimentation</b>".
	    "</td></tr>\n";
    }

406
407
408
409
410
411
    #
    # 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()) {
Leigh B. Stoller's avatar
Leigh B. Stoller committed
412
413
414
415
416
417
	if (! ($login_status &
	       (CHECKLOGIN_LOGGEDIN|CHECKLOGIN_MAYBEVALID))) {
	    echo "<table class=menu width=210 cellpadding=0 cellspacing=0>".
		"<tr><td class=menuheader> &nbsp".
		"</td></tr>\n";
	}
418
	
419
420
        WRITESIDEBARBUTTON("<font color=red> ".
			   "Web Interface Temporarily Unavailable</font>",
421
422
			   $TBDOCBASE, "nologins.php3");

Chad Barb's avatar
   
Chad Barb committed
423
424
425
        if (!$login_uid || !ISADMIN($login_uid)) {	
	    WRITESIDEBARNOTICE("Please Try Again Later");
        }
Leigh B. Stoller's avatar
Leigh B. Stoller committed
426
427
428
429
	if (! ($login_status &
	       (CHECKLOGIN_LOGGEDIN|CHECKLOGIN_MAYBEVALID))) {
	    echo "</table>\n";
	}
430
    }
Chad Barb's avatar
   
Chad Barb committed
431

432
    if ($login_status & (CHECKLOGIN_LOGGEDIN|CHECKLOGIN_MAYBEVALID)) {
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
	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) {
448
	    if ($login_status & CHECKLOGIN_PSWDEXPIRED) {
449
		WRITESIDEBARBUTTON("Change Your Password",
450
				   $TBBASE, "moduserinfo.php3");
451
	    }
Leigh B. Stoller's avatar
Leigh B. Stoller committed
452
	    elseif ($login_status & (CHECKLOGIN_WEBONLY|CHECKLOGIN_WIKIONLY)) {
453
454
455
		WRITESIDEBARBUTTON("My Emulab",
				   $TBBASE,
				   "showuser.php3?target_uid=$login_uid");
456
457
458
459
460

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

465
466
467
		WRITESIDEBARBUTTON("Update User Information",
				   $TBBASE, "moduserinfo.php3");
	    }
468
	    else {
Leigh B. Stoller's avatar
Leigh B. Stoller committed
469
		WRITESIDEBARBUTTON("My Emulab",
470
471
				   $TBBASE,
				   "showuser.php3?target_uid=$login_uid");
472

473
		#
474
475
476
477
                # 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.
                #
478
479
 		WRITESIDEBARBUTTON("Begin an Experiment",
				   $TBBASE, "beginexp_html.php3");
480
	
481
482
		# Put _NEW back when Plab is working again.
		WRITESIDEBARBUTTON("Create a PlanetLab Slice",
483
484
485
486
487
488
489
				       $TBBASE, "plab_ez.php3");

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

		WRITESIDEBARDIVIDER();

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

493
494
495
496
497
		SIDEBARCELL("List <a " .
			"href=\"$TBBASE/showimageid_list.php3\">" .
	        	"ImageIDs</a> or <a " .
	                "href=\"$TBBASE/showosid_list.php3\">OSIDs</a>");

498
		if ($login_status & CHECKLOGIN_TRUSTED) {
499
		  WRITESIDEBARDIVIDER();
500
501
502
                  # Only project/group leaders can do these options
                  # Show a "new" icon if there are people waiting for approval
		  $query_result =
503
504
505
		    DBQueryFatal("select g.* from group_membership as authed ".
				 "left join group_membership as g on ".
				 " g.pid=authed.pid and g.gid=authed.gid ".
506
				 "left join users as u on u.uid=g.uid ".
507
				 "where u.status!='".
508
				 TBDB_USERSTATUS_UNVERIFIED . "' and ".
509
510
511
512
513
514
				 " 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') ".
515
516
517
518
519
				 "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 {
520
521

		      WRITESIDEBARBUTTON("New User Approval",
522
				       $TBBASE, "approveuser_form.php3");
523
		  }
524
		}
525
	    }
526
	}
527
	elseif ($login_status & (CHECKLOGIN_UNVERIFIED|CHECKLOGIN_NEWUSER)) {
528
529
	    WRITESIDEBARBUTTON("New User Verification",
			       $TBBASE, "verifyusr_form.php3");
530
	    WRITESIDEBARBUTTON("Update User Information",
531
			       $TBBASE, "moduserinfo.php3");
532
	}
533
	elseif ($login_status & (CHECKLOGIN_UNAPPROVED)) {
534
	    WRITESIDEBARBUTTON("Update User Information",
535
			       $TBBASE, "moduserinfo.php3");
536
	}
537
538
	#
	# Standard options for logged in users!
539
540
541
542
543
	#
	if (!$firstinitstate) {
	    WRITESIDEBARDIVIDER();
	    SIDEBARCELL("<a href=\"$TBBASE/newproject.php3\">Start</a> or " .
	             "<a href=\"$TBBASE/joinproject.php3\">Join</a> a Project",
544
			0);
545
	}
546
    }
547
548
    #WRITESIDEBARLASTBUTTON_COOL("Take our Survey",
    #    $TBDOCBASE, "survey.php3");
549

550
    # Terminate Interaction menu.
551
    if ($login_status & (CHECKLOGIN_LOGGEDIN|CHECKLOGIN_MAYBEVALID)) {
552
553
554
555
        # Logout option. No longer take up space with an image.
	WRITESIDEBARLASTBUTTON("<b>Logout</b>",
			       $TBBASE, "logout.php3?target_uid=$login_uid");
	
556
	echo "</table>\n";
557
    }
Chad Barb's avatar
Chad Barb committed
558

559
    # And now the Collaboration menu.
Leigh B. Stoller's avatar
Leigh B. Stoller committed
560
561
562
    if (($login_status & (CHECKLOGIN_LOGGEDIN|CHECKLOGIN_MAYBEVALID)) &&
	($WIKISUPPORT || $MAILMANSUPPORT || $BUGDBSUPPORT ||
	 $CVSSUPPORT  || $CHATSUPPORT)) {
563
564
565
566
567
568
569
570
571
572
	echo "<table class=menu width=210 cellpadding=0 cellspacing=0>".
	    "<tr><td class=menuheader>".
	    "<b>Collaboration</b>".
	    "</td></tr>\n";
     
	if ($WIKISUPPORT && $CHECKLOGIN_WIKINAME != "") {
	    $wikiname = $CHECKLOGIN_WIKINAME;
		
	    WRITESIDEBARBUTTON("My Wikis", $TBBASE,
			       "gotowiki.php3?redurl=Main/$wikiname");
573
	}
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
	if ($MAILMANSUPPORT || $BUGDBSUPPORT) {
	    if (!isset($pid) || $pid == "") {
		$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");
		if (mysql_num_rows($query_result)) {
		    $row = mysql_fetch_array($query_result);
		    $firstpid = $row[pid];
		}
	    }
	}
	if ($MAILMANSUPPORT) {
	    $mmurl  = "showmmlists.php3?target_uid=$login_uid";
	    WRITESIDEBARBUTTON("My Mailing Lists", $TBBASE, $mmurl);
	}
	if ($BUGDBSUPPORT) {
	    $bugdburl = "gotobugdb.php3";
		    
	    if (isset($pid) && !empty($pid)) {
		$bugdburl .= "?project_title=$pid";
	    }
	    elseif (isset($firstpid)) {
		$bugdburl .= "?project_title=$firstpid";
	    }
	    WRITESIDEBARBUTTON("My Bug Databases", $TBBASE, $bugdburl);
	}
	if ($CVSSUPPORT) {
603
604
	    WRITESIDEBARBUTTON("My CVS Repositories", $TBBASE,
			       "listrepos.php3?target_uid=$login_uid");
605
	}
606
607
	if ($CHATSUPPORT) {
	    WRITESIDEBARBUTTON("My Chat Buddies", $TBBASE,
608
609
610
			       "mychat.php3?target_uid=$login_uid");
	}
	WRITESIDEBARDIVIDER();
611
	echo "</table>\n";
612
    }
613

614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
    # Optional ADMIN menu.
    if ($login_status & CHECKLOGIN_LOGGEDIN && ISADMIN($login_uid)) {
	echo "<table class=menu width=210 cellpadding=0 cellspacing=0>".
	    "<tr><td class=menuheader>".
	    "<b>Administration</b>".
	    "</td></tr>\n";
	
	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("Edit Site Variables",
			   $TBBASE, "editsitevars.php3");

	WRITESIDEBARBUTTON("Edit Knowledge Base",
			   $TBBASE, "kb-manage.php3");
		    
	$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");
	}
	WRITESIDEBARBUTTON("Approve Widearea User",
			   $TBBASE, "approvewauser_form.php3");
Chad Barb's avatar
   
Chad Barb committed
649

650
651
652
653
654
	# Link ALWAYS TO UTAH
	WRITESIDEBARLASTBUTTON("Add Widearea Node (CD)",
			       $TBDOCBASE, "http://www.emulab.net/cdrom.php");
	echo "</table>\n";
    }
655
    echo "</form>\n";
656
657
}

658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
#
# 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
678
679
680
#
# spits out beginning part of page
#
681
682
function PAGEBEGINNING( $title, $nobanner = 0, $nocontent = 0,
        $extra_headers = NULL ) {
683
    global $BASEPATH, $TBMAINSITE, $THISHOMEBASE, $ELABINELAB;
Chad Barb's avatar
Chad Barb committed
684
    global $TBDIR, $WWW;
Chad Barb's avatar
   
Chad Barb committed
685
    global $MAINPAGE;
686
    global $TBDOCBASE;
687
    global $autorefresh;
Chad Barb's avatar
   
Chad Barb committed
688

689
690
    $MAINPAGE = !strcmp($TBDIR, "/usr/testbed/");

Chad Barb's avatar
   
Chad Barb committed
691
692
693
694
695
    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>
696
697
            <!--<link rel=\"SHORTCUT ICON\" HREF=\"netbed.ico\">-->
            <link rel=\"SHORTCUT ICON\" HREF=\"netbed.png\" TYPE=\"image/png\">
Chad Barb's avatar
   
Chad Barb committed
698
699
    	    <!-- dumbed-down style sheet for any browser that groks (eg NS47). -->
	    <link REL='stylesheet' HREF='$BASEPATH/common-style.css' TYPE='text/css' />
700
701
    	    <!-- 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
702
703
704
    	    <style type='text/css' media='all'>
            <!-- @import '$BASEPATH/style.css'; -->";

705
706
707
    if (!$MAINPAGE) {
	echo "<!-- @import '$BASEPATH/style-nonmain.css'; -->";
    } 
Chad Barb's avatar
   
Chad Barb committed
708

Leigh B. Stoller's avatar
Leigh B. Stoller committed
709
    echo "</style>\n";
Chad Barb's avatar
   
Chad Barb committed
710
711

    if ($TBMAINSITE) {
Leigh B. Stoller's avatar
Leigh B. Stoller committed
712
	echo "<meta NAME=\"keywords\" ".
Leigh B. Stoller's avatar
Leigh B. Stoller committed
713
714
	           "CONTENT=\"network, emulation, internet, emulator, ".
	           "mobile, wireless, robotic\">\n";
Leigh B. Stoller's avatar
Leigh B. Stoller committed
715
716
717
718
719
	echo "<meta NAME=\"robots\" ".
	           "CONTENT=\"NOARCHIVE\">\n";
	echo "<meta NAME=\"description\" ".
                   "CONTENT=\"emulab - network emulation testbed home\">\n";
    }
720
721
722
    if ($extra_headers) {
        echo $extra_headers;
    }
Chad Barb's avatar
   
Chad Barb committed
723
724
    echo "</head>
            <body bgcolor='#FFFFFF' 
725
             topmargin='0' leftmargin='0' marginheight='0' marginwidth='0'>\n";
726
727
728
729
    
    if ($autorefresh) {
	echo "<meta HTTP-EQUIV=\"Refresh\" CONTENT=\"$autorefresh\">\n";
    }
730
    if (! $nobanner ) {
731
732
733
734
735
736
	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
737
            <table cellpadding='0' cellspacing='0' width='100%'>
738
739
740
            <tr valign='top'>
              <td valign='top' class='bannercell'
                  background='$BASEPATH/headerbgbb.jpg'
Leigh B. Stoller's avatar
Leigh B. Stoller committed
741
                  bgcolor=#3D627F>
742
743
744
745
746
747
748
749
750
              <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";
751
752
753
        if (!$MAINPAGE) {
	     echo "<font size='+1' color='#CCFFCC'>&nbsp;<b>$WWW</b></font>";
	}
754
	echo "</td>\n";
Leigh B. Stoller's avatar
Leigh B. Stoller committed
755
	echo "<td valign=top align=right width=200
756
                 class=banneriframe>
757
             <iframe src=$BASEPATH/currentusage.php3
758
759
760
761
762
763
764
765
766
767
                 width=100% height=100 marginheight=0 marginwidth=0
                 scrolling=no frameborder=0></iframe></td>\n";
        echo "</tr></table>\n";
    }
    if (! $nocontent ) {
	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
768
    }
Chad Barb's avatar
   
Chad Barb committed
769
770
771
772
773
774
775
}

#
# finishes sidebar td
#
function FINISHSIDEBAR()
{
Chad Barb's avatar
   
Chad Barb committed
776
    echo "<!-- sidebar ends -->
Chad Barb's avatar
   
Chad Barb committed
777
        </td>
Chad Barb's avatar
   
Chad Barb committed
778
        <td valign='top' width='100%' class='rightcell'>
779
          <!-- content body table -->
Chad Barb's avatar
   
Chad Barb committed
780
          <table class='content' width='100%' cellpadding='0' cellspacing='0'>
Chad Barb's avatar
   
Chad Barb committed
781
            <tr>
Chad Barb's avatar
   
Chad Barb committed
782
              <td class='contentheader'>";
Chad Barb's avatar
   
Chad Barb committed
783
784
}

785
786
787
#
# Spit out a vanilla page header.
#
788
function PAGEHEADER($title, $view = NULL, $extra_headers = NULL) {
789
    global $login_status, $login_uid, $TBBASE, $TBDOCBASE, $THISHOMEBASE;
790
    global $BASEPATH, $SSL_PROTOCOL, $drewheader, $autorefresh;
791
    global $TBMAINSITE;
792
793

    $drewheader = 1;
794
795
796
    if (isset($_GET['refreshrate']) && is_numeric($_GET['refreshrate'])) {
	$autorefresh = $_GET['refreshrate'];
    }
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812

    #
    # 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;
    }
813

814
    #
815
    # Figure out who is logged in, if anyone.
816
    # 
817
818
819
820
    if (($known_uid = GETUID()) != FALSE) {
        #
        # Check to make sure the UID is logged in (not timed out).
        #
821
822
823
        $login_status = CHECKLOGIN($known_uid);
	if ($login_status & (CHECKLOGIN_LOGGEDIN|CHECKLOGIN_MAYBEVALID)) {
	    $login_uid = $known_uid;
824
825
826
	}
    }

827
828
829
830
831
832
833
    #
    # If no view options were specified, get the ones for the current user
    #
    if (!$view) {
	$view = GETUSERVIEW();
    }

834
    #
835
836
    # Check for NOLOGINS. 
    # We want to allow admin types to continue using the web interface,
837
838
    # and logout anyone else that is currently logged in!
    #
839
840
841
842
    if (NOLOGINS() && $login_uid && !ISADMIN($login_uid)) {
	DOLOGOUT($login_uid);
	$login_status = CHECKLOGIN_NOTLOGGEDIN;
	$login_uid    = 0;
843
    }
844
    
845
846
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    
847
    if (1) {
848
849
850
851
852
853
854
	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
855

856
857
858
859
860
    if (isset($view['hide_banner'])) {
	$nobanner = 1;
    } else {
	$nobanner = 0;
    }
861
    PAGEBEGINNING( $title, $nobanner, 0, $extra_headers );
862
863
864
    if (!isset($view['hide_sidebar'])) {
	WRITESIDEBAR();
    }
865
866
867
    elseif (isset($view['menu'])) {
	WRITESIMPLESIDEBAR($view['menu']);
    }
Chad Barb's avatar
   
Chad Barb committed
868
    FINISHSIDEBAR();
869
    echo "<h2 class=\"nomargin\">\n";
Chad Barb's avatar
   
Chad Barb committed
870

871
    if ($login_uid && ISADMINISTRATOR()) {
Chad Barb's avatar
   
Chad Barb committed
872
	if (ISADMIN($login_uid)) {
873
	    echo "<a href=$TBBASE/toggle.php?target_uid=$login_uid&type=adminoff&value=1>
Chad Barb's avatar
   
Chad Barb committed
874
875
876
877
	             <img src='/redball.gif'
                          border=0 alt='Admin On'></a>\n";
	}
	else {
878
	    echo "<a href=$TBBASE/toggle.php?target_uid=$login_uid&type=adminoff&value=0>
Chad Barb's avatar
   
Chad Barb committed
879
880
881
	             <img src='/greenball.gif'
                          border=0 alt='Admin Off'></a>\n";
	}
882
    }
883
884
885
886
    $major = "";
    $minor = "";
    $build = "";
    TBGetVersionInfo($major, $minor, $build);
887
888
889
890
    if ($view['hide_versioninfo'] == 1)
	$versioninfo = "";
    else
	$versioninfo = "Vers: $major.$minor Build: $build";
891
    
892
893
    $now = date("D M d g:ia T");
    echo "$title</h2></td>\n";
894
    echo "<td class=contentheader align=right>\n";
895
896
    echo "<table border='0' cellpadding='0' cellspacing='0'>";
    echo "  <tr>";
897
    echo "  <td class=contentheader><font size=-2>$versioninfo</font></td>";
898
899
    echo "  <td class=contentheader>&nbsp&nbsp</td>";
    echo "  <td class=contentheader align=right>";
Robert Ricci's avatar
Robert Ricci committed
900
901
    if ($login_uid) {
	echo "<font size=-1>'<b>$login_uid</b>' Logged in.<br>$now</font>\n";
902
903
    }
    else {
Robert Ricci's avatar
Robert Ricci committed
904
	echo "$now";
Chad Barb's avatar
   
Chad Barb committed
905
906
    }
    echo "</td>";
907
908
909
    echo "</tr>";
    echo "</table>";
    echo "</td>";
Chad Barb's avatar
   
Chad Barb committed
910
911
    echo "</tr>\n";
    echo "<tr><td colspan=3 class=\"contentbody\" width=*>";
Chad Barb's avatar
   
Chad Barb committed
912
    echo "<!-- begin content -->\n";
913
914
915
    if ($view['show_topbar'] == "plab") {
	WRITEPLABTOPBAR();
    }
916
917
918
919
920
921
}

#
# ENDPAGE(): This terminates the table started above.
# 
function ENDPAGE() {
Chad Barb's avatar
   
Chad Barb committed
922
923
  echo "</td></tr></table>";
  echo "</td></tr></table>";
924
925
926
927
928
}

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

933
934
935
936
    if (!$view) {
	$view = GETUSERVIEW();
    }

937
938
    $today = getdate();
    $year  = $today["year"];
Chad Barb's avatar
   
Chad Barb committed
939

940
941
942
943
944
945
    echo "<!-- end content -->\n";
    if ($view['show_bottombar'] == "plab") {
	WRITEPLABBOTTOMBAR();
    }

    echo "
Chad Barb's avatar
   
Chad Barb committed
946
              </td>
947
948
            </tr>
            <tr>
949
950
951
              <td colspan=2 class=contentbody>\n";
    if (!$view['hide_copyright']) {
	echo "
952
953
	        <center>
                <font size=-1>
954
		[ <a href=http://www.cs.utah.edu/flux/>
955
                    Flux&nbsp;Research&nbsp;Group</a> ]
956
957
958
		[ <a href=http://www.cs.utah.edu/>
                    School&nbsp;of&nbsp;Computing</a> ]
		[ <a href=http://www.utah.edu/>
959
                    University&nbsp;of&nbsp;Utah</a> ]
960
961
		</font>
		<br>
Chad Barb's avatar
   
Chad Barb committed
962
                <!-- begin copyright -->
963
                <font size=-2>
964
965
966
967
                <a href='$TBDOCBASE/docwrapper.php3?docname=copyright.html'>
                    Copyright &copy; 2000-$year The University of Utah</a>
                </font>
                <br>
968
969
		</center>\n";
    }
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
    echo "      <table width='100%' cellpadding='0' cellspacing='0'
                       class=stealth>
                <tr>
                 <td class=stealth align=left>\n";
    if (! $TBMAINSITE) {
	echo "       <a href='http://www.emulab.net'>
                         <img src='$TBDOCBASE/builtwith.png'></a>";
    }
    else {
	echo " &nbsp";
    }
    echo "       </td>
                 <td class=stealth align=right>
                    <font size=-2>Problems? Contact $TBMAILADDR
                 </td>
                </tr></table>\n";
    echo " <!-- end copyright -->\n";
Chad Barb's avatar
   
Chad Barb committed
987
988

    ENDPAGE();
989

Leigh B. Stoller's avatar
Leigh B. Stoller committed
990
991
992
    # 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
993
    echo "</body></html>\n";
994
}
995
996

function PAGEERROR($msg) {
997
    global $drewheader, $noheaders;
998

999
    if (! $drewheader && ! $noheaders)
1000
	PAGEHEADER("Page Error");
1001
1002
1003

    echo "$msg\n";

1004
1005
    if (! $noheaders) 
	PAGEFOOTER();
1006
1007
    die("");
}
1008
1009
1010
1011

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

1014
1015
1016
1017
1018
1019
    #
    # Optional 'target' agument, so that we can pop up new windows
    #
    if ($target) {
	$targettext = "target='$target'";
    }
Chad Barb's avatar
   
Chad Barb committed
1020

1021
1022
    echo "<!-- Table row for button $text -->
          <tr>
1023
1024
            <td class=submenuopt nowrap>
         	 <a href='$link' $targettext>$text</a>
1025
1026
1027
1028
            </td>
          </tr>\n";
}

1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
function WRITESUBMENUDIVIDER() {
    global $BASEPATH;
    echo "<tr>";
    echo "<td class=\"submenuoptdiv\">";
    # We have to put something in this cell, or IE ignores it. But, we do not
    # 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";
}

1041
1042
1043
1044
#
# Start/End a page within a page. 
#
function SUBPAGESTART() {
Chad Barb's avatar
   
Chad Barb committed
1045
    echo "<!-- begin subpage -->";
Chad Barb's avatar
   
Chad Barb committed
1046
    echo "<table class=\"stealth\"
1047
	  cellspacing='0' cellpadding='0' width='100%' border='0'>\n
1048
            <tr>\n
Chad Barb's avatar
   
Chad Barb committed
1049
              <td class=\"stealth\"valign=top>\n";
1050
1051
1052
1053
1054
1055
}

function SUBPAGEEND() {
    echo "    </td>\n
            </tr>\n
          </table>\n";
Chad Barb's avatar
   
Chad Barb committed
1056
    echo "<!-- end subpage -->";
1057
1058
1059
1060
1061
1062
1063
}

#
# 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
1064
1065
?>
    <!-- begin submenu -->
1066
    <table class="submenu" cellpadding="0" cellspacing="0">
Chad Barb's avatar
   
Chad Barb committed
1067
1068
1069
1070
      <tr>
        <td class="menuheader"><b><?php echo "$title";?></b></td>
      </tr>
<?php
1071
1072
1073
}

function SUBMENUEND() {
Chad Barb's avatar
   
Chad Barb committed
1074
1075
1076
1077
?>
    </table>
    <!-- end submenu -->
  </td>
1078
  <td class="stealth" valign=top align=left width='100%'>
Chad Barb's avatar
   
Chad Barb committed
1079
<?php
1080
1081
}

1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
# 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
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116

# 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
}

1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
#
# 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();
    }
}

1131
?>