showstuff.php3 28.7 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
36
37
    $proj_head_uid	= $row[head_uid];
    $proj_members       = $row[num_members];
    $proj_pcs           = $row[num_pcs];
    $proj_sharks        = $row[num_sharks];
    $proj_why           = $row[why];
    $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
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
#
# A list of groups for a user.
#
function SHOWGROUPMEMBERSHIP($uid) {
    $query_result =
	DBQueryFatal("SELECT * FROM group_membership ".
		     "WHERE uid='$uid'");
    
    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];

        echo "<tr>
                  <td>$pid</td>
                  <td>$gid</td>
                  <td>$trust</td>\n";
	    
	echo "</tr>\n";
    }
    echo "</table>\n";
}

313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
#
# 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];
331
    $status      = $row[status];
332
333
334
335
336
337

    #
    # Last Login info.
    #
    if (($lastweblogin = LASTWEBLOGIN($uid)) == 0)
	$lastweblogin = "&nbsp";
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
    if (($lastuserslogininfo = LASTUSERSLOGIN($uid)) == 0)
	$lastuserslogin = "N/A";
    else {
	$lastuserslogin = $lastuserslogininfo["date"] . " " .
	                  $lastuserslogininfo["time"] . " " .
                          "(" . $lastuserslogininfo["node_id"] . ")";
    }
    
    if (($lastnodelogininfo = TBUidNodeLastLogin($uid)) == 0)
	$lastnodelogin = "N/A";
    else {
	$lastnodelogin = $lastnodelogininfo["date"] . " " .
		         $lastnodelogininfo["time"] . " " .
                         "(" . $lastnodelogininfo["node_id"] . ")";
    }
353
354
355
356
357
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
    
    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";
    
401
402
403
404
405
    echo "<tr>
              <td>Status:</td>
              <td>$status</td>
          </tr>\n";
    
406
407
408
409
410
411
412
413
414
415
    echo "<tr>
              <td>Last Web Login:</td>
              <td>$lastweblogin</td>
          </tr>\n";
    
    echo "<tr>
              <td>Last Users Login:</td>
              <td>$lastuserslogin</td>
          </tr>\n";
    
416
417
418
419
420
    echo "<tr>
              <td>Last Node Login:</td>
              <td>$lastnodelogin</td>
          </tr>\n";
    
421
422
423
424
    echo "</table>\n";

}

425
426
427
428
#
# Show an experiment.
#
function SHOWEXP($pid, $eid) {
429
    global $TBDBNAME, $TBDOCBASE;
430
		
Leigh B. Stoller's avatar
Leigh B. Stoller committed
431
432
433
434
435
436
    $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);
    }
437

Leigh B. Stoller's avatar
Leigh B. Stoller committed
438
    $exp_gid     = $exprow[gid];
439
440
441
442
    $exp_expires = $exprow[expt_expires];
    $exp_name    = $exprow[expt_name];
    $exp_created = $exprow[expt_created];
    $exp_start   = $exprow[expt_start];
443
    $exp_swapped = $exprow[expt_swapped];
444
445
446
    $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
447
    $exp_status  = $exprow[state];
448
    $exp_shared  = $exprow[shared];
449
450
451
452
    $exp_path    = $exprow[path];
    $batchmode   = $exprow[batchmode];
    $attempts    = $exprow[attempts];
    $batchstate  = $exprow[batchstate];
453
454
455
456
457
458
459
    $priority    = $exprow[priority];
    $swappable   = $exprow[swappable];

    if ($swappable)
	$swappable = "Yes";
    else
	$swappable = "No";
460
461
462
463

    #
    # Generate the table.
    #
464
    echo "<table align=center cellpadding=2 cellspacing=0 border=1>\n";
465
466
467

    echo "<tr>
            <td>Name: </td>
468
            <td class=left>$eid</td>
469
470
471
472
473
474
475
476
477
          </tr>\n";

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

    echo "<tr>
            <td>Project: </td>
478
479
            <td class=\"left\">
                <A href='showproject.php3?pid=$pid'>$pid</td>
480
481
          </tr>\n";

Leigh B. Stoller's avatar
Leigh B. Stoller committed
482
483
484
485
486
487
    echo "<tr>
            <td>Group: </td>
            <td class=\"left\">
                <A href='showgroup.php3?pid=$pid&gid=$exp_gid'>$exp_gid</td>
          </tr>\n";

488
489
490
491
492
493
494
495
496
497
498
499
500
    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>
501
502
            <td>Expires: </td>
            <td class=\"left\">$exp_expires</td>
503
504
505
          </tr>\n";

    echo "<tr>
506
507
            <td>Started: </td>
            <td class=\"left\">$exp_start</td>
508
509
          </tr>\n";

510
511
512
513
514
    echo "<tr>
            <td>Last Swapped (in or out): </td>
            <td class=\"left\">$exp_swapped</td>
          </tr>\n";

515
    echo "<tr>
516
            <td><a href='$TBDOCBASE/faq.php3#UTT-Swapping'>Swappable:</a></td>
517
518
519
520
521
522
523
524
            <td class=\"left\">$swappable</td>
          </tr>\n";

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

525
526
527
528
529
530
531
532
533
534
535
536
    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";

537
538
539
540
541
    echo "<tr>
            <td>Path: </td>
            <td class=left>$exp_path</td>
          </tr>\n";

542
543
544
545
546
    echo "<tr>
            <td>Status: </td>
            <td class=\"left\">$exp_status</td>
          </tr>\n";

547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
    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";
    }

564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
    echo "</table>\n";
}

#
# Show Node information for an experiment.
#
function SHOWNODES($pid, $eid) {
    global $TBDBNAME;
		
    $reserved_result = mysql_db_query($TBDBNAME,
		"SELECT * FROM reserved WHERE ".
		"eid=\"$eid\" and pid=\"$pid\"");
    
    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>
                <td align=center>Node Name</td>
                <td align=center>Type</td>
586
                <td align=center>Default<br>OSID</td>
587
588
                <td align=center>Default<br>Path</td>
                <td align=center>Default<br>Cmdline</td>
589
                <td align=center>Boot<br>Status[1]</td>
590
                <td align=center>Startup<br>Command</td>
591
592
                <td align=center>Startup<br>Status[2]</td>
                <td align=center>Ready<br>Status[3]</td>
593
594
595
596
597
598
599
              </tr>\n";
	
	$query_result = mysql_db_query($TBDBNAME,
		"SELECT nodes.*,reserved.vname ".
	        "FROM nodes LEFT JOIN reserved ".
	        "ON nodes.node_id=reserved.node_id ".
	        "WHERE reserved.eid=\"$eid\" and reserved.pid=\"$pid\" ".
600
	        "ORDER BY type,priority");
601
602
603
604
605

	while ($row = mysql_fetch_array($query_result)) {
	    $node_id = $row[node_id];
	    $vname   = $row[vname];
	    $type    = $row[type];
606
	    $def_boot_osid      = $row[def_boot_osid];
607
608
609
610
611
612
	    $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];
613
	    $readystatus        = $row[ready];
614
	    $bootstatus         = $row[bootstatus];
615
616
617
618
619
620
621
622
623
624
625
626
627

	    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 = "--";
628
629
630
631
	    if ($readystatus)
		$readylabel = "Yes";
	    else
		$readylabel = "No";
632
633

	    echo "<tr>
Leigh B. Stoller's avatar
Leigh B. Stoller committed
634
635
                    <td><A href='shownode.php3?node_id=$node_id'>$node_id</a>
                        </td>
636
                    <td>$vname</td>
637
638
639
640
641
642
643
                    <td>$type</td>\n";
	    if ($def_boot_osid)
		echo "<td><A href='showosinfo.php3?osid=$def_boot_osid'>
                             $def_boot_osid</A></td>\n";
	    else
		echo "<td>&nbsp</td>\n";
	    
644
	    echo "  <td>$def_boot_path</td>
645
                    <td>$def_boot_cmd_line</td>
646
                    <td align=center>$bootstatus</td>
647
648
                    <td>$startupcmd</td>
                    <td align=center>$startstatus</td>
649
                    <td align=center>$readylabel</td>
650
                   </tr>\n";
651
652
	}
	echo "</table>\n";
653
654
655
	echo "<h4><blockquote><blockquote><blockquote><blockquote>
              <dl COMPACT>
                <dt>[1]
656
657
                    <dd>Node has rebooted successfully after experiment
                        creation.
658
                <dt>[2]
659
660
661
                    <dd>Exit value of the node startup command. A value of
                        666 indicates a testbed internal error.
                <dt>[3]
662
                    <dd>User application ready status, reported via TMCC.
663
664
              </dl>
              </blockquote></blockquote></blockquote></blockquote></h4>\n";
665
666
667
    }
}

668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
#
# 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_machinetype = $osrow[machinetype];
    $os_osfeatures  = $osrow[osfeatures];
    $os_pid         = $osrow[pid];

    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";
    if (!$os_pid)
	$os_pid = "&nbsp";

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

    echo "<tr>
            <td>OSID: </td>
            <td class=\"left\">$osid</td>
          </tr>\n";

    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>Project: </td>
            <td class=\"left\">$os_pid</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>
            <td>Node Type: </td>
            <td class=\"left\">$os_machinetype</td>
          </tr>\n";

    echo "<tr>
            <td>Features: </td>
            <td class=\"left\">$os_osfeatures</td>
          </tr>\n";

    echo "</table>\n";
}

754
755
756
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
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
#
# Show ImageID record.
#
function SHOWIMAGEID($imageid, $edit) {
    global $TBDBNAME;
		
    $query_result = mysql_db_query($TBDBNAME,
		"SELECT * FROM images WHERE imageid='$imageid'");

    $row = mysql_fetch_array($query_result);

    $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];
    $pid	 = $row[pid];
    $loadaddr	 = $row[load_address];

    if (!$pid)
	$pid = "&nbsp";
    if ($edit) {
	if (!$description)
	    $description = "";
	if (!$path)
	    $path = "";
	if (!$loadaddr)
	    $loadaddr = "";
    }
    else {
	if (!$description)
	    $description = "&nbsp";
	if (!$path)
	    $path = "&nbsp";
	if (!$loadaddr)
	    $loadaddr = "&nbsp";
    }
    
    #
    # 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>
            <td>ImageID: </td>
            <td class=\"left\">$imageid</td>
          </tr>\n";

    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>Project: </td>
            <td class=\"left\">$pid</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>
                 <td>Slice 1 OSID: </td>
                 <td class=\"left\">
                    <A href='showosinfo.php3?osid=$part1_osid'>$part1_osid</A>
              </tr>\n";
    }

    if ($part2_osid) {
	echo "<tr>
                 <td>Slice 2 OSID: </td>
                 <td class=\"left\">
                    <A href='showosinfo.php3?osid=$part2_osid'>$part2_osid</A>
              </tr>\n";
    }

    if ($part3_osid) {
	echo "<tr>
                 <td>Slice 3 OSID: </td>
                 <td class=\"left\">
                    <A href='showosinfo.php3?osid=$part3_osid'>$part3_osid</A>
              </tr>\n";
    }

    if ($part4_osid) {
	echo "<tr>
                 <td>Slice 4 OSID: </td>
                 <td class=\"left\">
                    <A href='showosinfo.php3?osid=$part4_osid'>$part4_osid</A>
              </tr>\n";
    }

    if ($default_osid) {
	echo "<tr>
                 <td>Default OSID: </td>
                 <td class=\"left\">
                    <A href='showosinfo.php3?osid=$default_osid'>
                       $default_osid</A>
              </tr>\n";
    }

    echo "<tr>
884
            <td>Filename: </td>
885
886
887
888
889
890
891
892
893
894
895
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
            <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";

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

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

    if ($edit) {
	echo "<tr>
                 <td colspan=2 align=center>
                     <b><input type=submit value=Submit></b>
                 </td>
              </tr>
              </form>\n";
    }

    echo "</table>\n";
}

Leigh B. Stoller's avatar
Leigh B. Stoller committed
923
924
925
926
927
#
# Show node record.
#
function SHOWNODE($node_id) {
    $query_result =
928
929
930
	DBQueryFatal("select n.*,r.vname from nodes as n ".
		     "left join reserved as r on n.node_id=r.node_id ".
		     "where n.node_id='$node_id'");
Leigh B. Stoller's avatar
Leigh B. Stoller committed
931
932
933
934
935
936
937
938
939
    
    if (mysql_num_rows($query_result) == 0) {
	TBERROR("The node $node_id is not a valid nodeid!", 1);
    }
		
    $row = mysql_fetch_array($query_result);

    $node_id            = $row[node_id]; 
    $type               = $row[type];
940
    $vname		= $row[vname];
941
    $bios               = $row[bios_version];
Leigh B. Stoller's avatar
Leigh B. Stoller committed
942
943
944
945
946
947
948
949
950
    $def_boot_osid      = $row[def_boot_osid];
    $def_boot_path      = $row[def_boot_path];
    $def_boot_cmd_line  = $row[def_boot_cmd_line];
    $next_boot_osid     = $row[next_boot_osid];
    $next_boot_path     = $row[next_boot_path];
    $next_boot_cmd_line = $row[next_boot_cmd_line];
    $rpms               = $row[rpms];
    $tarballs           = $row[tarballs];
    $startupcmd         = $row[startupcmd];
951
    $routertype         = $row[routertype];
Leigh B. Stoller's avatar
Leigh B. Stoller committed
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968

    if (!$def_boot_cmd_line)
	$def_boot_cmd_line = "&nbsp";
    if (!$def_boot_path)
	$def_boot_path = "&nbsp";
    if (!$next_boot_osid)
	$next_boot_osid = "&nbsp";
    if (!$next_boot_path)
	$next_boot_path = "&nbsp";
    if (!$next_boot_cmd_line)
	$next_boot_cmd_line = "&nbsp";
    if (!$rpms)
	$rpms = "&nbsp";
    if (!$tarballs)
	$tarballs = "&nbsp";
    if (!$startupcmd)
	$startupcmd = "&nbsp";
969
970
    if (!$bios)
	$bios = "&nbsp";
Leigh B. Stoller's avatar
Leigh B. Stoller committed
971
972
973
974
975
976
977

    echo "<table border=2 cellpadding=0 cellspacing=2
                 align=center>\n";

    echo "<tr>
              <td>Node ID:</td>
              <td class=left>$node_id</td>
978
979
980
981
982
983
984
985
          </tr>\n";

    if ($vname) {
	echo "<tr>
                  <td>Virtual Name:</td>
                  <td class=left>$vname</td>
              </tr>\n";
    }
Leigh B. Stoller's avatar
Leigh B. Stoller committed
986
987
988
989
990
991

    echo "<tr>
              <td>Node Type:</td>
              <td class=left>$type</td>
          </tr>\n";

992
993
994
995
996
    echo "<tr>
              <td>Bios Version:</td>
              <td class=left>$bios</td>
          </tr>\n";

Leigh B. Stoller's avatar
Leigh B. Stoller committed
997
998
999
1000
    echo "<tr>
              <td>Def Boot OSID:</td>
              <td class=left>$def_boot_osid</td>
          </tr>\n";