1 | <?php
|
---|
2 | {
|
---|
3 | ini_set("display_errors", "On");
|
---|
4 | ini_set("mysql.trace_mode", "On");
|
---|
5 |
|
---|
6 | echo (file_get_contents("index-header.html"));
|
---|
7 |
|
---|
8 | //call get_progs() at startup
|
---|
9 | printf("<script type=\"text/javascript\" >\n");
|
---|
10 | printf("window.onload = function () { get_progs(\"all\",1,'view'); get_keys(\"all\",\"all\",1,'view'); }\n");
|
---|
11 | printf("</script>\n");
|
---|
12 |
|
---|
13 | include("db.php");
|
---|
14 | printf("This page is to <u>view and compare</u> entries from the DB <b>%s</b>.\n", $db);
|
---|
15 | printf("<button onClick='show_viewinfo()' id='showinfo' style='display:inline'>More Info</button>\n");
|
---|
16 | printf("For edit, please go <a href='edit_po.php'>here</a>.<br><br>\n");
|
---|
17 | printf("<div id='viewinfo' style='display:none'>\n");
|
---|
18 | echo (file_get_contents("view-info.html"));
|
---|
19 | printf("</div>\n");
|
---|
20 |
|
---|
21 | $db_id = mysql_pconnect($host, $user, $pw);
|
---|
22 | if ($db_id==FALSE)
|
---|
23 | {
|
---|
24 | printf("mysql_connect returned the following error: %s\n", mysql_error());
|
---|
25 | die("");
|
---|
26 | }
|
---|
27 | mysql_select_db($db);
|
---|
28 |
|
---|
29 | $query0="SELECT DATE_FORMAT(fValidFrom, '%Y') AS valid FROM History WHERE NOT fValidFrom='0000-00-00 00:00:00' group by valid";
|
---|
30 | $result0=mysql_query($query0, $db_id);
|
---|
31 |
|
---|
32 |
|
---|
33 | printf("<table border='0' cellspacing='2px'><tbody>\n");
|
---|
34 |
|
---|
35 | printf("<tr>\n");
|
---|
36 | printf("<th bgcolor='#DCFFDC'>Configuration 1</th>\n");
|
---|
37 | printf("<td colspan='2' align='center'>\n");
|
---|
38 | printf("<button onClick='get_values(2,\"all\",\"all\");get_values(3,\"all\",\"all\");CompareValues();' id='showpo' style='display:inline'>Show /<br>Compare</button>\n");
|
---|
39 | printf("</td>\n");
|
---|
40 | printf("<th bgcolor='#DCDCFF'>Configuration 2</th>\n");
|
---|
41 | printf("</tr>\n");
|
---|
42 |
|
---|
43 | //date fields
|
---|
44 | printf("<tr>\n");
|
---|
45 | $rowcount=0;
|
---|
46 | for ($i=2; $i<4; $i++)
|
---|
47 | {
|
---|
48 | if ($i==2)
|
---|
49 | printf("<td bgcolor='#DCFFDC'>Date: \n");
|
---|
50 | else
|
---|
51 | printf("<td bgcolor='#DCDCFF'>Date: \n");
|
---|
52 | //buttons to show next/prev timestamp
|
---|
53 | printf("<button onClick='get_timestamp(%s, \"next\");get_values(2,\"all\",\"all\");get_values(3,\"all\",\"all\");CompareValues();' id='nexttimestamp%s' style='display:inline'>Next Time Stamp</button>\n", $i, $i);
|
---|
54 | printf("<button onClick='get_timestamp(%s, \"prev\");get_values(2,\"all\",\"all\");get_values(3,\"all\",\"all\");CompareValues();' id='prevtimestamp%s' style='display:inline'>Prev Time Stamp</button>\n", $i, $i);
|
---|
55 | //input field
|
---|
56 | printf("<br>\n", $i);
|
---|
57 | printf("<div id='dateinput%d' style='display:none'>(YYYY-MM-DD hh:mm:ss) \n", $i);
|
---|
58 | printf("<input id=\"statusdate%d\" type=\"text\" size=\"19\" maxlength=\"19\"><br>\n", $i);
|
---|
59 | printf("</div>\n");
|
---|
60 |
|
---|
61 | //pull down menus
|
---|
62 | printf("<div id='datepulldown%d' style='display:inline'>\n", $i);
|
---|
63 | //select for years
|
---|
64 | printf("<div id='yearselect%d' style='display:inline'>\n", $i);
|
---|
65 | printf("<select id='year%d' onchange=\"get_dates('month', this.value, this.value, %d, 'yes')\">\n", $i, $i);
|
---|
66 | printf("<option value='empty'>year</option>\n");
|
---|
67 | while ($row0 = mysql_fetch_row($result0))
|
---|
68 | {
|
---|
69 | printf("<option value='%s'>%s </option>\n", $row0[0], $row0[0]);
|
---|
70 | $rowcount++;
|
---|
71 | }
|
---|
72 | printf("</select></div>\n");
|
---|
73 | //select for months
|
---|
74 | printf("<div id='monthselect%d' style='display:inline'>\n", $i);
|
---|
75 | printf("<select id='month%d' onchange=\"get_dates('day', this.value, 'empty', %d, 'yes')\">\n", $i, $i);
|
---|
76 | printf("<option value='empty'>month</option>\n");
|
---|
77 | printf("</select>\n");
|
---|
78 | printf("</div>\n");
|
---|
79 | //select for days
|
---|
80 | printf("<div id='dayselect%d' style='display:inline'>\n", $i);
|
---|
81 | printf("<select id='day%d' onchange=\"get_dates('hour', this.value, 'empty', %d, 'yes')\">\n", $i, $i);
|
---|
82 | printf("<option value='empty'>day</option>\n");
|
---|
83 | printf("</select>\n");
|
---|
84 | printf("</div>\n");
|
---|
85 | //select for hours
|
---|
86 | printf("<div id='hourselect%d' style='display:inline'>\n", $i);
|
---|
87 | printf("<select id='hour%d' onchange=\"get_dates('min', this.value, 'empty', %d, 'yes')\">\n", $i, $i);
|
---|
88 | printf("<option value='empty'>hour</option>\n");
|
---|
89 | printf("</select>\n");
|
---|
90 | printf("</div>\n");
|
---|
91 | //select for minutes
|
---|
92 | printf("<div id='minselect%d' style='display:inline'>\n", $i);
|
---|
93 | printf("<select id='min%d' onchange=\"get_dates('sec', this.value, 'empty', %d, 'yes')\">\n", $i, $i);
|
---|
94 | printf("<option value='empty'>min</option>\n");
|
---|
95 | printf("</select>\n");
|
---|
96 | printf("</div>\n");
|
---|
97 | //select for seconds
|
---|
98 | printf("<div id='secselect%d' style='display:inline'>\n", $i);
|
---|
99 | printf("<select id='sec%d'>\n", $i, $i);
|
---|
100 | printf("<option value='empty'>sec</option>\n");
|
---|
101 | printf("</select>\n");
|
---|
102 | printf("</div>\n");
|
---|
103 | //buttton to show next timestamp
|
---|
104 | //printf("<button onClick='get_timestamp(%s, \"next\");get_values(2,\"all\",\"all\");get_values(3,\"all\",\"all\");CompareValues();' id='nexttimestamp%s' style='display:inline'>Next Time Stamp</button>\n", $i, $i);
|
---|
105 | //printf("<button onClick='get_timestamp(%s, \"prev\");get_values(2,\"all\",\"all\");get_values(3,\"all\",\"all\");CompareValues();' id='prevtimestamp%s' style='display:inline'>Prev Time Stamp</button>\n", $i, $i);
|
---|
106 | printf("</div>\n");
|
---|
107 | printf("<br>\n");
|
---|
108 |
|
---|
109 | //radio button to select input-format for date
|
---|
110 | printf("<input name='dateformat%d' type='radio' onclick='ShowDatePulldown(%d)' value='pulldown' checked>pulldown \n", $i, $i);
|
---|
111 | printf("<input name='dateformat%d' type='radio' onclick='ShowDateInput(%d)' value='textinput'>text input \n", $i, $i);
|
---|
112 | printf("</td>\n");
|
---|
113 |
|
---|
114 | //reset mysql result to loop again over it
|
---|
115 | if ($i==2 && $rowcount > 0)
|
---|
116 | mysql_data_seek($result0, 0);
|
---|
117 |
|
---|
118 | if ($i==2)
|
---|
119 | printf("<td colspan='2' align='center'><button onClick='reset_dates(\"year\", \"empty\", \"empty\", 2);reset_dates(\"year\", \"empty\", \"empty\", 3);get_values(2,\"all\",\"all\");get_values(3,\"all\",\"all\");CompareValues();' id='resetdates' style='display:inline'>Reset Dates</button></td>\n");
|
---|
120 | }
|
---|
121 | printf("</tr>\n");
|
---|
122 | mysql_free_result($result0);
|
---|
123 |
|
---|
124 | //print pulldown for programs/key and buttons
|
---|
125 | printf("<tr><td colspan='4'>\n");
|
---|
126 | printf("<br>Select a subset of program options:\n");
|
---|
127 | printf("<div id='progfield' style='display:inline'></div>\n");
|
---|
128 | printf("<div id='keyfield' style='display:inline'></div>\n");
|
---|
129 | //printf("<button onClick='get_values(2,\"all\",\"all\");get_values(3,\"all\",\"all\");alert(\"wait\");CompareValues();' id='showpo' style='display:inline'>Show Status</button></div>\n");
|
---|
130 | printf("</td></tr>\n");
|
---|
131 |
|
---|
132 | //checkboxes to show/hide part of the table
|
---|
133 | printf("<tr>\n");
|
---|
134 | for ($i=2; $i<4; $i++)
|
---|
135 | {
|
---|
136 | if ($i==2)
|
---|
137 | printf("<td bgcolor='#DCFFDC' colspan='2'>\n");
|
---|
138 | else
|
---|
139 | printf("<td bgcolor='#DCDCFF' colspan='2'>\n");
|
---|
140 | printf("Show:\n");
|
---|
141 | printf("<input type='checkbox' id='sh_indices%d' onclick='ShowHide(\"indices\", \"sh_indices\", %d);'>indices\n", $i, $i);
|
---|
142 | printf("<input type='checkbox' id='sh_validsince%d' onclick='ShowHide(\"validsince\", \"sh_validsince\", %d);'>validsince\n", $i, $i);
|
---|
143 | printf("<input type='checkbox' id='sh_descr%d' onclick='ShowHide(\"description\", \"sh_descr\", %d);'>description\n", $i, $i);
|
---|
144 | printf("<input type='checkbox' id='sh_min%d' onclick='ShowHide(\"minimum\", \"sh_min\", %d);'>min\n", $i, $i);
|
---|
145 | printf("<input type='checkbox' id='sh_max%d' onclick='ShowHide(\"maximum\", \"sh_max\", %d);'>max\n", $i, $i);
|
---|
146 | printf("<input type='checkbox' id='sh_user%d' onclick='ShowHide(\"user\", \"sh_user\", %d);'>user\n", $i, $i);
|
---|
147 | printf("</td>\n");
|
---|
148 | }
|
---|
149 | printf("</tr>\n");
|
---|
150 |
|
---|
151 | //list of POs
|
---|
152 | printf("<tr>\n");
|
---|
153 | printf("<td bgcolor='#BEFFBE' colspan='2'><div id='valuefield2'></div></td>\n");
|
---|
154 | printf("<td bgcolor='#BEBEFF' colspan='2'><div id='valuefield3'></div></td>\n");
|
---|
155 | printf("</tr>\n");
|
---|
156 |
|
---|
157 | printf("</tbody>\n</table>\n");
|
---|
158 |
|
---|
159 | echo (file_get_contents("index-footer.html"));
|
---|
160 |
|
---|
161 | ini_set("display_errors", "Off");
|
---|
162 | ini_set("mysql.trace_mode", "Off");
|
---|
163 | }
|
---|
164 | ?>
|
---|