source: trunk/www/db_po/view_po.php@ 18066

Last change on this file since 18066 was 12449, checked in by Daniela Dorner, 13 years ago
removed variable selectsize from functions and set size of select box depending on fMode
  • Property svn:executable set to *
File size: 7.9 KB
Line 
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\",'view'); get_keys(\"all\",\"all\",'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' cellpadding='3px' style='border-spacing:10px 3px'><tbody>\n");
34
35 printf("<tr>\n");
36 printf("<th bgcolor='#DCFFDC'>Configuration 1</th>\n");
37 printf("<td colspan='2' align='center' bgcolor='#EEEEEE'>\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: &nbsp;\n");
50 else
51 printf("<td bgcolor='#DCDCFF'>Date: &nbsp;\n");
52 //buttons to show next/prev timestamp
53 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);
54 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);
55 //reset date button
56 printf("<button onClick='reset_dates(\"year\", \"empty\", \"empty\", %d);get_values(2,\"all\",\"all\");get_values(3,\"all\",\"all\");CompareValues();' id='resetdate%d' style='display:inline'>Reset Date</button>\n", $i, $i);
57 //input field
58 printf("<br>\n", $i);
59 printf("<div id='dateinput%d' style='display:none'>(YYYY-MM-DD hh:mm:ss) \n", $i);
60 printf("<input id=\"statusdate%d\" type=\"text\" size=\"19\" maxlength=\"19\">\n", $i);
61 printf("</div>\n");
62
63 //pull down menus
64 printf("<div id='datepulldown%d' style='display:inline'>\n", $i);
65 //select for years
66 printf("<div id='yearselect%d' style='display:inline'>\n", $i);
67 printf("<select id='year%d' onchange=\"get_dates('month', this.value, this.value, %d, 'yes')\">\n", $i, $i);
68 printf("<option value='empty'>YYYY</option>\n");
69 while ($row0 = mysql_fetch_row($result0))
70 {
71 printf("<option value='%s'>%s </option>\n", $row0[0], $row0[0]);
72 $rowcount++;
73 }
74 printf("</select></div>\n");
75
76 //select for months
77 printf("<div id='monthselect%d' style='display:inline'>\n", $i);
78 printf("<select id='month%d' onchange=\"get_dates('day', this.value, 'empty', %d, 'yes')\">\n", $i, $i);
79 printf("<option value='empty'>MM</option>\n");
80 printf("</select>\n");
81 printf("</div>\n");
82 //select for days
83 printf("<div id='dayselect%d' style='display:inline'>\n", $i);
84 printf("<select id='day%d' onchange=\"get_dates('hour', this.value, 'empty', %d, 'yes')\">\n", $i, $i);
85 printf("<option value='empty'>DD</option>\n");
86 printf("</select>\n");
87 printf("</div>\n");
88 //select for hours
89 printf("<div id='hourselect%d' style='display:inline'>\n", $i);
90 printf("<select id='hour%d' onchange=\"get_dates('min', this.value, 'empty', %d, 'yes')\">\n", $i, $i);
91 printf("<option value='empty'>hh</option>\n");
92 printf("</select>\n");
93 printf("</div>\n");
94 //select for minutes
95 printf("<div id='minselect%d' style='display:inline'>\n", $i);
96 printf("<select id='min%d' onchange=\"get_dates('sec', this.value, 'empty', %d, 'yes')\">\n", $i, $i);
97 printf("<option value='empty'>mm</option>\n");
98 printf("</select>\n");
99 printf("</div>\n");
100 //select for seconds
101 printf("<div id='secselect%d' style='display:inline'>\n", $i);
102 printf("<select id='sec%d'>\n", $i, $i);
103 printf("<option value='empty'>ss</option>\n");
104 printf("</select>\n");
105 printf("</div>\n");
106
107 printf("</div>\n");
108 printf("<br>\n");
109
110 //radio button to select input-format for date
111 printf("<input name='dateformat%d' type='radio' onclick='ShowDatePulldown(%d)' value='pulldown' checked>pulldown \n", $i, $i);
112 printf("<input name='dateformat%d' type='radio' onclick='ShowDateInput(%d)' value='textinput'>text input \n", $i, $i);
113 printf("</td>\n");
114
115 //reset mysql result to loop again over it
116 if ($i==2 && $rowcount > 0)
117 mysql_data_seek($result0, 0);
118
119 if ($i==2)
120 printf("<td colspan='2' align='center' bgcolor='#EEEEEE'><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");
121 }
122 printf("</tr>\n");
123 mysql_free_result($result0);
124
125 //print pulldown for programs/key and buttons
126 printf("<tr><td colspan='4'>\n");
127 printf("<br>Select a subset of program options:\n");
128 printf("<div id='progfield' style='display:inline'></div>\n");
129 printf("<div id='keyfield' style='display:inline'></div>\n");
130 //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");
131 printf("</td></tr>\n");
132
133 //checkboxes to show/hide part of the table
134 printf("<tr>\n");
135 for ($i=2; $i<4; $i++)
136 {
137 if ($i==2)
138 printf("<td bgcolor='#DCFFDC' colspan='2'>\n");
139 else
140 printf("<td bgcolor='#DCDCFF' colspan='2'>\n");
141 printf("Show:\n");
142 printf("<input type='checkbox' id='sh_indices%d' onclick='ShowHide(\"indices\", \"sh_indices\", %d);'>indices\n", $i, $i);
143 printf("<input type='checkbox' id='sh_validsince%d' onclick='ShowHide(\"validsince\", \"sh_validsince\", %d);'>validsince\n", $i, $i);
144 printf("<input type='checkbox' id='sh_descr%d' onclick='ShowHide(\"description\", \"sh_descr\", %d);'>description\n", $i, $i);
145 printf("<input type='checkbox' id='sh_min%d' onclick='ShowHide(\"minimum\", \"sh_min\", %d);'>min\n", $i, $i);
146 printf("<input type='checkbox' id='sh_max%d' onclick='ShowHide(\"maximum\", \"sh_max\", %d);'>max\n", $i, $i);
147 printf("<input type='checkbox' id='sh_user%d' onclick='ShowHide(\"user\", \"sh_user\", %d);'>user\n", $i, $i);
148 printf("</td>\n");
149 }
150 printf("</tr>\n");
151
152 //list of POs
153 printf("<tr>\n");
154 printf("<td bgcolor='#BEFFBE' colspan='2' valign='top'><div id='valuefield2'></div></td>\n");
155 printf("<td bgcolor='#BEBEFF' colspan='2' valign='top'><div id='valuefield3'></div></td>\n");
156 printf("</tr>\n");
157
158 printf("</tbody>\n</table>\n");
159
160 echo (file_get_contents("index-footer.html"));
161
162 ini_set("display_errors", "Off");
163 ini_set("mysql.trace_mode", "Off");
164}
165?>
Note: See TracBrowser for help on using the repository browser.