showstuff.php3 32.5 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
#
# This is an included file. No headers or footers.
#
# Functions to dump out various things.  
#

#
# A project
#
function SHOWPROJECT($pid, $thisuid) {
    global $TBDBNAME;

    $query_result = mysql_db_query($TBDBNAME,
	"SELECT * FROM projects WHERE pid=\"$pid\"");
    if (mysql_num_rows($query_result) == 0) {
       USERERROR("The project $pid is not a valid project.", 1);
    }
    $row = mysql_fetch_array($query_result);

21
22
23
24
25
    echo "<center>
          <h3>Project Profile</h3>
          </center>
          <table align=center border=1>\n";
    
26
27
28
29
    $proj_created	= $row[created];
    $proj_expires	= $row[expires];
    $proj_name		= $row[name];
    $proj_URL		= $row[URL];
30
    $proj_public        = $row[public];
31
    $proj_funders	= $row[funders];
32
33
34
35
    $proj_head_uid	= $row[head_uid];
    $proj_members       = $row[num_members];
    $proj_pcs           = $row[num_pcs];
    $proj_sharks        = $row[num_sharks];
36
    $proj_why           = nl2br($row[why]);
37
    $control_node	= $row[control_node];
38
    $approved           = $row[approved];
39
40
    $expt_count         = $row[expt_count];
    $expt_last          = $row[expt_last];
41

42
43
44
45
46
47
48
    if ($proj_public) {
	$proj_public = "Yes";
    }
    else {
	$proj_public = "No";
    }

49
50
51
52
    if (!$expt_last) {
	$expt_last = "&nbsp";
    }

53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
    #
    # Generate the table.
    # 
    echo "<tr>
              <td>Name: </td>
              <td class=\"left\">$pid</td>
          </tr>\n";
    
    echo "<tr>
              <td>Long Name: </td>
              <td class=\"left\">$proj_name</td>
          </tr>\n";
    
    echo "<tr>
              <td>Project Head: </td>
              <td class=\"left\">
69
                <A href='showuser.php3?target_uid=$proj_head_uid'>
70
71
72
73
74
75
76
77
78
                     $proj_head_uid</A></td>
          </tr>\n";
    
    echo "<tr>
              <td>URL: </td>
              <td class=\"left\">
                  <A href='$proj_URL'>$proj_URL</A></td>
          </tr>\n";
    
79
80
81
82
83
    echo "<tr>
              <td>Publicly Visible: </td>
              <td class=\"left\">$proj_public</td>
          </tr>\n";
    
84
85
86
87
88
    echo "<tr>
              <td>Funders: </td>
              <td class=\"left\">$proj_funders</td>
          </tr>\n";

89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
    echo "<tr>
              <td>#Project Members: </td>
              <td class=\"left\">$proj_members</td>
          </tr>\n";
    
    echo "<tr>
              <td>#PCs: </td>
              <td class=\"left\">$proj_pcs</td>
          </tr>\n";
    
    echo "<tr>
              <td>#Sharks: </td>
              <td class=\"left\">$proj_sharks</td>
          </tr>\n";
    
    echo "<tr>
              <td>Created: </td>
              <td class=\"left\">$proj_created</td>
          </tr>\n";
    
    echo "<tr>
              <td>Expires: </td>
              <td class=\"left\">$proj_expires</td>
          </tr>\n";
    
114
115
116
117
118
119
120
121
122
123
    echo "<tr>
              <td>Experiments Created:</td>
              <td class=\"left\">$expt_count</td>
          </tr>\n";
    
    echo "<tr>
              <td>Date of last experiment:</td>
              <td class=\"left\">$expt_last</td>
          </tr>\n";
    
124
125
126
127
128
129
130
131
132
133
    echo "<tr>
              <td>Approved?: </td>\n";
    if ($approved) {
	echo "<td class=left><img alt=\"Y\" src=\"greenball.gif\"></td>\n";
    }
    else {
	echo "<td class=left><img alt=\"N\" src=\"redball.gif\"></td>\n";
    }
    echo "</tr>\n";

134
    echo "<tr>
135
              <td colspan='2'>Why?:</td>
136
137
138
139
140
141
142
143
144
          </tr>\n";
    
    echo "<tr>
              <td colspan='2' width=600>$proj_why</td>
          </tr>\n";
    
    echo "</table>\n";
}

Leigh B. Stoller's avatar
Leigh B. Stoller committed
145
146
147
148
149
150
151
152
#
# A Group
#
function SHOWGROUP($pid, $gid) {
    $query_result =
	DBQueryFatal("SELECT * FROM groups WHERE pid='$pid' and gid='$gid'");
    $row = mysql_fetch_array($query_result);

153
154
155
156
    echo "<center>
          <h3>Group Profile</h3>
          </center>
          <table align=center border=1>\n";
Leigh B. Stoller's avatar
Leigh B. Stoller committed
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237

    $leader	= $row[leader];
    $created	= $row[created];
    $description= $row[description];
    $expt_count = $row[expt_count];
    $expt_last  = $row[expt_last];
    $unix_gid   = $row[unix_gid];
    $unix_name  = $row[unix_name];

    if (!$expt_last) {
	$expt_last = "&nbsp";
    }

    #
    # Generate the table.
    # 
    echo "<tr>
              <td>GID: </td>
              <td class=\"left\">$gid</td>
          </tr>\n";
    
    echo "<tr>
              <td>PID: </td>
              <td class=\"left\">$pid</td>
          </tr>\n";
    
    echo "<tr>
              <td>Description: </td>
              <td class=\"left\">$description</td>
          </tr>\n";
    
    echo "<tr>
              <td>Unix GID: </td>
              <td class=\"left\">$unix_gid</td>
          </tr>\n";
    
    echo "<tr>
              <td>Unix Group Name: </td>
              <td class=\"left\">$unix_name</td>
          </tr>\n";
    
    echo "<tr>
              <td>Group Leader: </td>
              <td class=\"left\">
                <A href='showuser.php3?target_uid=$leader'>$leader</A></td>
          </tr>\n";
    
    echo "<tr>
              <td>Created: </td>
              <td class=\"left\">$created</td>
          </tr>\n";
    
    echo "<tr>
              <td>Experiments Created:</td>
              <td class=\"left\">$expt_count</td>
          </tr>\n";
    
    echo "<tr>
              <td>Date of last experiment:</td>
              <td class=\"left\">$expt_last</td>
          </tr>\n";
    
    echo "</table>\n";
}

#
# A list of Group members.
#
function SHOWGROUPMEMBERS($pid, $gid) {
    $query_result =
	DBQueryFatal("SELECT m.*,u.* FROM group_membership as m ".
		     "left join users as u on u.uid=m.uid ".
		     "WHERE pid='$pid' and gid='$gid'");
    
    if (! mysql_num_rows($query_result)) {
	return;
    }

    echo "<center>
          <h3>Group Members</h3>
          </center>
238
          <table align=center border=1 cellpadding=1 cellspacing=2>\n";
Leigh B. Stoller's avatar
Leigh B. Stoller committed
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274

    echo "<tr>
              <td align=center>Name</td>
              <td align=center>UID</td>
              <td align=center>Privs</td>
              <td align=center>Approved?</td>
          </tr>\n";

    while ($row = mysql_fetch_array($query_result)) {
        $target_uid = $row[uid];
	$usr_name   = $row[usr_name];
	$status     = $row[status];
	$trust      = $row[trust];

        echo "<tr>
                  <td>$usr_name</td>
                  <td>
                    <A href='showuser.php3?target_uid=$target_uid'>
                       $target_uid</A>
                  </td>
                  <td>$trust</td>\n";
	    
	if (strcmp($status, "active") == 0 ||
	    strcmp($status, "unverified") == 0) {
	    echo "<td align=center>
                      <img alt=\"Y\" src=\"greenball.gif\"></td>\n";
	}
	else {
	    echo "<td align=center>
                      <img alt=\"N\" src=\"redball.gif\"></td>\n";
	}
	echo "</tr>\n";
    }
    echo "</table>\n";
}

275
276
277
278
#
# A list of groups for a user.
#
function SHOWGROUPMEMBERSHIP($uid) {
279
280
    $none = TBDB_TRUSTSTRING_NONE;
    
281
282
    $query_result =
	DBQueryFatal("SELECT * FROM group_membership ".
283
284
		     "WHERE uid='$uid' and trust!='$none' ".
		     "order by pid");
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
    
    if (! mysql_num_rows($query_result)) {
	return;
    }

    echo "<center>
          <h3>Group Membership</h3>
          </center>
          <table align=center border=1 cellpadding=1 cellspacing=2>\n";

    echo "<tr>
              <td align=center>PID</td>
              <td align=center>GID</td>
              <td align=center>Privs</td>
          </tr>\n";

    while ($row = mysql_fetch_array($query_result)) {
	$pid   = $row[pid];
	$gid   = $row[gid];
	$trust = $row[trust];

306
307
308
309
310
311
312
	if (TBTrustConvert($trust) != $TBDB_TRUST_NONE) {
	    echo "<tr>
                      <td>$pid</td>
                      <td>$gid</td>
                      <td>$trust</td>\n";
	    echo "</tr>\n";
	}
313
314
315
316
    }
    echo "</table>\n";
}

317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
#
# A User
#
function SHOWUSER($uid) {
    global $TBDBNAME;
		
    $userinfo_result = mysql_db_query($TBDBNAME,
	"SELECT * from users where uid=\"$uid\"");

    $row	= mysql_fetch_array($userinfo_result);
    $usr_expires = $row[usr_expires];
    $usr_email   = $row[usr_email];
    $usr_URL     = $row[usr_URL];
    $usr_addr    = $row[usr_addr];
    $usr_name    = $row[usr_name];
    $usr_phone   = $row[usr_phone];
    $usr_title   = $row[usr_title];
    $usr_affil   = $row[usr_affil];
335
    $status      = $row[status];
336
337
    $admin       = $row[admin];
    $adminoff    = $row[adminoff];
338
339
340
341
342
343

    #
    # Last Login info.
    #
    if (($lastweblogin = LASTWEBLOGIN($uid)) == 0)
	$lastweblogin = "&nbsp";
344
    if (($lastuserslogininfo = TBUsersLastLogin($uid)) == 0)
345
346
347
	$lastuserslogin = "N/A";
    else {
	$lastuserslogin = $lastuserslogininfo["date"] . " " .
348
		          $lastuserslogininfo["time"];
349
350
351
352
353
354
355
356
357
    }
    
    if (($lastnodelogininfo = TBUidNodeLastLogin($uid)) == 0)
	$lastnodelogin = "N/A";
    else {
	$lastnodelogin = $lastnodelogininfo["date"] . " " .
		         $lastnodelogininfo["time"] . " " .
                         "(" . $lastnodelogininfo["node_id"] . ")";
    }
358
359
360
361
362
363
364
365
366
367
368
369
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
396
397
398
399
400
401
402
403
404
405
    
    echo "<table align=center border=1>\n";
    
    echo "<tr>
              <td>Username:</td>
              <td>$uid</td>
          </tr>\n";
    
    echo "<tr>
              <td>Full Name:</td>
              <td>$usr_name</td>
          </tr>\n";
    
    echo "<tr>
              <td>Email Address:</td>
              <td>$usr_email</td>
          </tr>\n";
    
    echo "<tr>
              <td>Home Page URL:</td>
              <td><A href='$usr_URL'>$usr_URL</A></td>
          </tr>\n";
    
    echo "<tr>
              <td>Expiration date:</td>
              <td>$usr_expires</td>
          </tr>\n";
    
    echo "<tr>
              <td>Mailing Address:</td>
              <td>$usr_addr</td>
          </tr>\n";
    
    echo "<tr>
              <td>Phone #:</td>
              <td>$usr_phone</td>
          </tr>\n";
    
    echo "<tr>
              <td>Title/Position:</td>
              <td>$usr_title</td>
         </tr>\n";
    
    echo "<tr>
              <td>Institutional Affiliation:</td>
              <td>$usr_affil</td>
          </tr>\n";
    
406
407
408
409
    echo "<tr>
              <td>Status:</td>
              <td>$status</td>
          </tr>\n";
410
411
412
413
414
415
416
417
418
419
420

    if ($admin) {
	$onoff = ($adminoff ? "Off" : "On");
	$flip  = ($adminoff ? 0 : 1);
	echo "<tr>
                  <td>Admin (on/off):</td>
                  <td>Yes
                      <a href=adminmode.php3?target_uid=$uid&adminoff=$flip>
                         ($onoff)</td>
              </tr>\n";
    }
421
    
422
423
424
425
426
427
428
429
430
431
    echo "<tr>
              <td>Last Web Login:</td>
              <td>$lastweblogin</td>
          </tr>\n";
    
    echo "<tr>
              <td>Last Users Login:</td>
              <td>$lastuserslogin</td>
          </tr>\n";
    
432
433
434
435
436
    echo "<tr>
              <td>Last Node Login:</td>
              <td>$lastnodelogin</td>
          </tr>\n";
    
437
438
439
440
    echo "</table>\n";

}

441
442
443
444
#
# Show an experiment.
#
function SHOWEXP($pid, $eid) {
445
    global $TBDBNAME, $TBDOCBASE;
446
		
Leigh B. Stoller's avatar
Leigh B. Stoller committed
447
448
449
450
451
452
    $query_result =
	DBQueryFatal("SELECT * FROM experiments WHERE ".
		     "eid='$eid' and pid='$pid'");
    if (($exprow = mysql_fetch_array($query_result)) == 0) {
	TBERROR("Experiment $eid in project $pid is gone!\n", 1);
    }
453

Leigh B. Stoller's avatar
Leigh B. Stoller committed
454
    $exp_gid     = $exprow[gid];
455
456
457
458
    $exp_expires = $exprow[expt_expires];
    $exp_name    = $exprow[expt_name];
    $exp_created = $exprow[expt_created];
    $exp_start   = $exprow[expt_start];
459
    $exp_swapped = $exprow[expt_swapped];
460
461
462
    $exp_end     = $exprow[expt_end];
    $exp_created = $exprow[expt_created];
    $exp_head    = $exprow[expt_head_uid];
Leigh B. Stoller's avatar
Leigh B. Stoller committed
463
    $exp_status  = $exprow[state];
464
    $exp_shared  = $exprow[shared];
465
466
467
468
    $exp_path    = $exprow[path];
    $batchmode   = $exprow[batchmode];
    $attempts    = $exprow[attempts];
    $batchstate  = $exprow[batchstate];
469
470
471
472
473
474
475
    $priority    = $exprow[priority];
    $swappable   = $exprow[swappable];

    if ($swappable)
	$swappable = "Yes";
    else
	$swappable = "No";
476
477
478
479

    #
    # Generate the table.
    #
480
    echo "<table align=center cellpadding=2 cellspacing=0 border=1>\n";
481
482
483

    echo "<tr>
            <td>Name: </td>
484
            <td class=left>$eid</td>
485
486
487
488
489
490
491
492
493
          </tr>\n";

    echo "<tr>
            <td>Long Name: </td>
            <td class=\"left\">$exp_name</td>
          </tr>\n";

    echo "<tr>
            <td>Project: </td>
494
495
            <td class=\"left\">
                <A href='showproject.php3?pid=$pid'>$pid</td>
496
497
          </tr>\n";

Leigh B. Stoller's avatar
Leigh B. Stoller committed
498
499
500
501
502
503
    echo "<tr>
            <td>Group: </td>
            <td class=\"left\">
                <A href='showgroup.php3?pid=$pid&gid=$exp_gid'>$exp_gid</td>
          </tr>\n";

504
505
506
507
508
509
510
511
512
513
514
515
516
    echo "<tr>
            <td>Experiment Head: </td>
            <td class=\"left\">
                <A href='showuser.php3?target_uid=$exp_head'>
                   $exp_head</td>
          </tr>\n";

    echo "<tr>
            <td>Created: </td>
            <td class=\"left\">$exp_created</td>
          </tr>\n";

    echo "<tr>
517
518
            <td>Expires: </td>
            <td class=\"left\">$exp_expires</td>
519
520
521
          </tr>\n";

    echo "<tr>
522
523
            <td>Started: </td>
            <td class=\"left\">$exp_start</td>
524
525
          </tr>\n";

526
527
528
529
530
    echo "<tr>
            <td>Last Swapped (in or out): </td>
            <td class=\"left\">$exp_swapped</td>
          </tr>\n";

531
    echo "<tr>
532
            <td><a href='$TBDOCBASE/faq.php3#UTT-Swapping'>Swappable:</a></td>
533
534
535
536
537
538
539
540
            <td class=\"left\">$swappable</td>
          </tr>\n";

    echo "<tr>
            <td>Priority: (0 is highest) </td>
            <td class=\"left\">$priority</td>
          </tr>\n";

541
542
543
544
545
546
547
548
549
550
551
552
    echo "<tr>
            <td>Shared: </td>
            <td class=\"left\">";
    if ($exp_shared) {
	echo "<A href='expaccess_form.php3?pid=$pid&eid=$eid'>Yes</a>";
    }
    else {
	echo "No";
    }
    echo "   </td>
          </tr>\n";

553
554
555
556
557
    echo "<tr>
            <td>Path: </td>
            <td class=left>$exp_path</td>
          </tr>\n";

558
559
560
561
562
    echo "<tr>
            <td>Status: </td>
            <td class=\"left\">$exp_status</td>
          </tr>\n";

563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
    if ($batchmode) {
	    echo "<tr>
                    <td>Batch Mode: </td>
                    <td class=\"left\">Yes</td>
                  </tr>\n";

	    echo "<tr>
                    <td>Batch Status: </td>
                    <td class=\"left\">$batchstate</td>
                  </tr>\n";

	    echo "<tr>
                    <td>Start Attempts: </td>
                    <td class=\"left\">$attempts</td>
                  </tr>\n";
    }

580
581
582
583
584
585
586
587
    echo "</table>\n";
}

#
# Show Node information for an experiment.
#
function SHOWNODES($pid, $eid) {
    global $TBDBNAME;
588
    global $TBOPSPID;
589
590
591
592
593
		
    $reserved_result = mysql_db_query($TBDBNAME,
		"SELECT * FROM reserved WHERE ".
		"eid=\"$eid\" and pid=\"$pid\"");
    
594
595
596
597
598
599
600
601
602
603
604
    # If this is an expt in emulab-ops, we don't care about vname,
    # since it won't be defined. But we do want to know when the node
    # entered the experiment, since it won't match the experiment's
    # swapin date.
    $nodename="Node Name";
    $vnamefield="vname";
    if (!strcmp($pid, $TBOPSPID)) {
      $nodename="Reserve Time";
      $vnamefield="rsrvtime";
    }
    
605
606
607
608
609
610
611
    if (mysql_num_rows($reserved_result)) {
	echo "<center>
              <h3>Reserved Nodes</h3>
              </center>
              <table align=center border=1>
              <tr>
                <td align=center>Node ID</td>
612
                <td align=center>$nodename</td>
613
                <td align=center>Type</td>
614
                <td align=center>Default<br>OSID</td>
615
616
                <td align=center>Default<br>Path</td>
                <td align=center>Default<br>Cmdline</td>
617
                <td align=center>Boot<br>Status[<b>1</b>]</td>
618
                <td align=center>Startup<br>Command</td>
619
620
                <td align=center>Startup<br>Status[<b>2</b>]</td>
                <td align=center>Ready<br>Status[<b>3</b>]</td>
621
622
623
              </tr>\n";
	
	$query_result = mysql_db_query($TBDBNAME,
624
625
		"SELECT nodes.*,reserved.vname, ".
	        "date_format(rsrv_time,\"%Y-%m-%d&nbsp;%T\") as rsrvtime ".
626
627
628
	        "FROM nodes LEFT JOIN reserved ".
	        "ON nodes.node_id=reserved.node_id ".
	        "WHERE reserved.eid=\"$eid\" and reserved.pid=\"$pid\" ".
629
	        "ORDER BY type,priority");
630
631
632

	while ($row = mysql_fetch_array($query_result)) {
	    $node_id = $row[node_id];
633
	    $vname   = $row[$vnamefield];
634
	    $type    = $row[type];
635
	    $def_boot_osid      = $row[def_boot_osid];
636
637
638
639
640
641
	    $def_boot_path      = $row[def_boot_path];
	    $def_boot_cmd_line  = $row[def_boot_cmd_line];
	    $next_boot_path     = $row[next_boot_path];
	    $next_boot_cmd_line = $row[next_boot_cmd_line];
	    $startupcmd         = $row[startupcmd];
	    $startstatus        = $row[startstatus];
642
	    $readystatus        = $row[ready];
643
	    $bootstatus         = $row[bootstatus];
644
645
646
647
648
649
650
651
652
653
654
655
656

	    if (!$def_boot_cmd_line)
		$def_boot_cmd_line = "NULL";
	    if (!$def_boot_path)
		$def_boot_path = "NULL";
	    if (!$next_boot_path)
		$next_boot_path = "NULL";
	    if (!$next_boot_cmd_line)
		$next_boot_cmd_line = "NULL";
	    if (!$startupcmd)
		$startupcmd = "NULL";
	    if (!$vname)
		$vname = "--";
657
658
659
660
	    if ($readystatus)
		$readylabel = "Yes";
	    else
		$readylabel = "No";
661
662

	    echo "<tr>
Leigh B. Stoller's avatar
Leigh B. Stoller committed
663
664
                    <td><A href='shownode.php3?node_id=$node_id'>$node_id</a>
                        </td>
665
                    <td>$vname</td>
666
                    <td>$type</td>\n";
667
668
669
670
671
	    if ($def_boot_osid) {
		echo "<td>";
		SPITOSINFOLINK($def_boot_osid);
		echo "</td>";
	    }
672
673
674
	    else
		echo "<td>&nbsp</td>\n";
	    
675
	    echo "  <td>$def_boot_path</td>
676
                    <td>$def_boot_cmd_line</td>
677
                    <td align=center>$bootstatus</td>
678
679
                    <td>$startupcmd</td>
                    <td align=center>$startstatus</td>
680
                    <td align=center>$readylabel</td>
681
                   </tr>\n";
682
683
	}
	echo "</table>\n";
684
685
686
687
	echo "<h4><blockquote><blockquote><blockquote>
              <ol>
                <li>Node has rebooted successfully after experiment creation.
                <li>Exit value of the node startup command. A value of
688
                        666 indicates a testbed internal error.
689
690
691
                <li>User application ready status, reported via TMCC.
              </ol>
              </blockquote></blockquote></blockquote></h4>\n";
692
693
694
    }
}

695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
#
# Show OS INFO record.
#
function SHOWOSINFO($osid) {
    global $TBDBNAME;
		
    $query_result = mysql_db_query($TBDBNAME,
		"SELECT * FROM os_info WHERE osid='$osid'");

    $osrow = mysql_fetch_array($query_result);

    $os_description = $osrow[description];
    $os_OS          = $osrow[OS];
    $os_version     = $osrow[version];
    $os_path        = $osrow[path];
    $os_magic       = $osrow[magic];
    $os_osfeatures  = $osrow[osfeatures];
    $os_pid         = $osrow[pid];
713
714
    $os_shared      = $osrow[shared];
    $os_osname      = $osrow[osname];
715
716
    $creator        = $osrow[creator];
    $created        = $osrow[created];
717
    $mustclean      = $osrow[mustclean];
718
719
720
721
722
723
724
725
726
727
728

    if (!$os_description)
	$os_description = "&nbsp";
    if (!$os_version)
	$os_version = "&nbsp";
    if (!$os_path)
	$os_path = "&nbsp";
    if (!$os_magic)
	$os_magic = "&nbsp";
    if (!$os_osfeatures)
	$os_osfeatures = "&nbsp";
729
730
    if (!$created)
	$created = "N/A";
731
732
733
734
735
736
737

    #
    # Generate the table.
    #
    echo "<table align=center border=1>\n";

    echo "<tr>
738
739
740
741
742
743
744
            <td>Name: </td>
            <td class=\"left\">$os_osname</td>
          </tr>\n";

    echo "<tr>
            <td>Project: </td>
            <td class=\"left\">$os_pid</td>
745
746
          </tr>\n";

747
748
749
750
751
752
753
754
755
756
    echo "<tr>
            <td>Creator: </td>
            <td class=left>$creator</td>
 	  </tr>\n";

    echo "<tr>
            <td>Created: </td>
            <td class=left>$created</td>
 	  </tr>\n";

757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
    echo "<tr>
            <td>Description: </td>
            <td class=\"left\">$os_description</td>
          </tr>\n";

    echo "<tr>
            <td>Operating System: </td>
            <td class=\"left\">$os_OS</td>
          </tr>\n";

    echo "<tr>
            <td>Version: </td>
            <td class=\"left\">$os_version</td>
          </tr>\n";

    echo "<tr>
            <td>Path: </td>
            <td class=\"left\">$os_path</td>
          </tr>\n";

    echo "<tr>
            <td>Magic (uname -r -s): </td>
            <td class=\"left\">$os_magic</td>
          </tr>\n";

    echo "<tr>
783
784
            <td>Features: </td>
            <td class=\"left\">$os_osfeatures</td>
785
786
787
          </tr>\n";

    echo "<tr>
788
789
790
791
792
793
794
795
796
797
798
            <td>Shared?: </td>
            <td class=left>\n";

    if ($os_shared)
	echo "Yes";
    else
	echo "No";
    
    echo "  </td>
          </tr>\n";

799
800
801
802
803
804
805
806
807
808
809
810
    echo "<tr>
            <td>Must Clean?: </td>
            <td class=left>\n";

    if ($mustclean)
	echo "Yes";
    else
	echo "No";
    
    echo "  </td>
          </tr>\n";

811
812
813
    echo "<tr>
            <td>Internal ID: </td>
            <td class=\"left\">$osid</td>
814
815
816
817
818
          </tr>\n";

    echo "</table>\n";
}

819
820
821
822
823
824
#
# Show ImageID record.
#
function SHOWIMAGEID($imageid, $edit) {
    global $TBDBNAME;
		
825
826
    $query_result =
	DBQueryFatal("select * from images where imageid='$imageid'");
827
828
829

    $row = mysql_fetch_array($query_result);

830
831
    $imagename   = $row[imagename];
    $pid         = $row[pid];
832
833
834
835
836
837
838
839
840
841
    $description = $row[description];
    $loadpart	 = $row[loadpart];
    $loadlength	 = $row[loadlength];
    $part1_osid	 = $row[part1_osid];
    $part2_osid	 = $row[part2_osid];
    $part3_osid	 = $row[part3_osid];
    $part4_osid	 = $row[part4_osid];
    $default_osid= $row[default_osid];
    $path 	 = $row[path];
    $loadaddr	 = $row[load_address];
842
    $shared	 = $row[shared];
843
844
    $creator     = $row[creator];
    $created     = $row[created];
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860

    if ($edit) {
	if (!$description)
	    $description = "";
	if (!$path)
	    $path = "";
	if (!$loadaddr)
	    $loadaddr = "";
    }
    else {
	if (!$description)
	    $description = "&nbsp";
	if (!$path)
	    $path = "&nbsp";
	if (!$loadaddr)
	    $loadaddr = "&nbsp";
861
862
	if (!$created)
	    $created = "N/A";
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
    }
    
    #
    # Generate the table.
    #
    echo "<table align=center border=2 cellpadding=2 cellspacing=2>\n";

    if ($edit) {
	$imageid_encoded = rawurlencode($imageid);
	
	echo "<form action='editimageid.php3?imageid=$imageid_encoded'
                    method=post>\n";
    }

    echo "<tr>
878
879
880
881
882
883
884
            <td>Image Name: </td>
            <td class=\"left\">$imagename</td>
          </tr>\n";

    echo "<tr>
            <td>Project: </td>
            <td class=\"left\">$pid</td>
885
          </tr>\n";
886
887
888
889
890
891
892
893
894
895

    echo "<tr>
            <td>Creator: </td>
            <td class=left>$creator</td>
 	  </tr>\n";

    echo "<tr>
            <td>Created: </td>
            <td class=left>$created</td>
 	  </tr>\n";
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922

    echo "<tr>
            <td>Description: </td>
            <td class=left>\n";

    if ($edit) {
	echo "<input type=text name=description size=60
                     maxlength=256 value='$description'>";
    }
    else {
	echo "$description";
    }
    echo "   </td>
 	  </tr>\n";

    echo "<tr>
            <td>Load Partition: </td>
            <td class=\"left\">$loadpart</td>
          </tr>\n";

    echo "<tr>
            <td>Load Length: </td>
            <td class=\"left\">$loadlength</td>
          </tr>\n";

    if ($part1_osid) {
	echo "<tr>
923
924
925
926
                 <td>Partition 1 OS: </td>
                 <td class=\"left\">";
	SPITOSINFOLINK($part1_osid);
	echo "   </td>
927
928
929
930
931
              </tr>\n";
    }

    if ($part2_osid) {
	echo "<tr>
932
933
934
935
                 <td>Partition 2 OS: </td>
                 <td class=\"left\">";
	SPITOSINFOLINK($part2_osid);
	echo "   </td>
936
937
938
939
940
              </tr>\n";
    }

    if ($part3_osid) {
	echo "<tr>
941
942
943
944
                 <td>Partition 3 OS: </td>
                 <td class=\"left\">";
	SPITOSINFOLINK($part3_osid);
	echo "   </td>
945
946
947
948
949
              </tr>\n";
    }

    if ($part4_osid) {
	echo "<tr>
950
951
952
953
                 <td>Partition 4 OS: </td>
                 <td class=\"left\">";
	SPITOSINFOLINK($part4_osid);
	echo "   </td>
954
955
956
957
958
              </tr>\n";
    }

    if ($default_osid) {
	echo "<tr>
959
960
961
962
                 <td>Boot OS: </td>
                 <td class=\"left\">";
	SPITOSINFOLINK($default_osid);
	echo "   </td>
963
964
965
966
              </tr>\n";
    }

    echo "<tr>
967
            <td>Filename: </td>
968
969
970
971
972
973
974
975
976
977
978
979
            <td class=left>\n";

    if ($edit) {
	echo "<input type=text name=path size=60
                     maxlength=256 value='$path'>";
    }
    else {
	echo "$path";
    }
    echo "  </td>
          </tr>\n";

980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
    if (! $edit) {
	echo "<tr>
                  <td>Types: </td>
                  <td class=left>\n";

	$types_result =
	    DBQueryFatal("select distinct type from osidtoimageid ".
			 "where imageid='$imageid'");

	if (mysql_num_rows($types_result)) {
	    while ($row = mysql_fetch_array($types_result)) {
		$type = $row[type];
		echo "$type &nbsp ";
	    }
	}
	else {
	    echo "&nbsp";
	}
	echo "  </td>
              </tr>\n";
    }