source: /cluster/svnroot/bccd-ng/bccd.net/ver3/survey.php @ 2769

Last change on this file since 2769 was 2769, checked in by fitz, 10 years ago

#532: more work on survey page

File size: 2.6 KB
Line 
1<?php
2
3include_once("../includes/bccdPage.php");
4
5$page = new bccdPage();
6
7$page->setSection(2);
8$page->setBasePath("..");
9
10$left = file_get_contents("includes/left.php");
11
12$page->setSlot('Head', '<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>');
13
14$js = <<<JAVASCRIPT
15// Select all
16function Check(control, form, field) {
17        chk = document.forms[form].elements[field];
18
19        if (typeof(chk.checked) == "boolean") {
20                chk.checked = control.checked;
21        } else {
22                for (i = 0; i < chk.length; i++) {
23                        chk[i].checked = control.checked;
24                }
25        }
26
27        if (control.checked)
28                $('#softwarelist tr.row').addClass('selected');
29        else
30                $('#softwarelist tr.row').removeClass('selected');
31}
32
33 // function(s) for selecting checkbox by clicking within the row
34$(document).ready(function() {
35                $('#softwarelist tr.row')
36                .filter(':has(:checkbox:checked)')
37                .addClass('selected')
38                .end()
39                .click(function(event) {
40                        $(this).toggleClass('selected');
41                        if (event.target.type !== 'checkbox') {
42                        $(':checkbox', this).attr('checked', function() {
43                                return !this.checked;
44                                });
45                        }
46                        });
47                });
48JAVASCRIPT;
49$page->addJS($js);
50
51$css = <<<CSS
52table {
53        border-width:0px;
54        border-spacing:0;
55        border-collapse:collapse;
56}
57table td {
58        border-width:0px;
59        padding:4px;
60}
61table tr:hover {
62        background-color: #AFD4F1;
63}
64table tr.meta:hover {
65        background-color: transparent;
66}
67.selected {
68        background-color: #FFFFAA;
69}
70CSS;
71$page->addCSS($css);
72
73$software = array(
74                "gcc"     => "GNU Compiler Suite",
75                "c3"      => "Cluster Command and Control (C3) Tools",
76                "cuda"    => "CUDA Libraries",
77                "icc"     => "Intel Compilers",
78                "java"    => "Java",
79                "mcell"   => "MCell",
80                "mpich2"  => "MPICH2",
81                "openmpi" => "OpenMPI",
82                "papi"    => "PAPI",
83                "torque"  => "Torque/PBS Job Scheduler"
84);
85
86$rightHTML = '
87<strong>Tell us about the software you use on the BCCD</strong>
88<hr>
89<form method="POST" action="" name="softwareList">
90<table id="softwarelist">
91';
92
93foreach ($software as $short => $long) {
94        $rightHTML .= '
95        <tr class="row">
96                <td><input type="checkbox" name="package[]" id="'.$short.'"></td>
97                <td>'.$long.'</td>
98        </tr>';
99}
100$rightHTML .= <<<HTML
101        <tr class="meta">
102                <td></td>
103                <td>
104                        <label for="checkAllSoftware" style="font-size: 8pt;">
105                                <input id="checkAllSoftware" type="checkbox" name="checkall" value="yes" onClick="Check(this, 'softwareList', 'package[]')">
106                                Select All
107                        </label>
108                </td>
109        </tr>
110</table>
111<br /><br />
112<strong>What additional software would you like to see?</strong>
113<hr>
114</form>
115HTML;
116
117$page->setSlot('LeftContent', $left);
118$page->setSlot('RightContent', $rightHTML);
119
120$page->render();
121?>
Note: See TracBrowser for help on using the repository browser.