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

Last change on this file since 11505 was 11504, checked in by Daniela Dorner, 13 years ago
added (interface to view configuration db)
  • Property svn:executable set to *
File size: 5.6 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\",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</u> the DB <b>%s</b>.\n", $db);
15 printf("For edit, please go <a href='edit_po.php'>here</a>.<br><br>\n");
16
17 $db_id = mysql_pconnect($host, $user, $pw);
18 if ($db_id==FALSE)
19 {
20 printf("mysql_connect returned the following error: %s\n", mysql_error());
21 die("");
22 }
23 mysql_select_db($db);
24
25 printf("<table><tbody>\n");
26
27 printf("<tr>\n");
28 printf("<td valign='top' id='progfield'></td>\n");
29 printf("<td valign='top' id='keyfield'></td>\n");
30 printf("</tr>\n");
31
32 printf("<tr><td colspan='2'>\n");
33 //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");
34 printf("<button onClick='get_values(2,\"all\",\"all\");get_values(3,\"all\",\"all\");CompareValues();' id='showpo' style='display:inline'>Show Status</button></div>\n");
35 printf("<button onClick='reset_dates(\"year\", \"empty\", \"empty\", 2);reset_dates(\"year\", \"empty\", \"empty\", 3)' id='resetdates' style='display:inline'>Reset Dates</button></div>\n");
36 printf("</td></tr>\n");
37
38 printf("<tr>\n");
39 for ($i=2; $i<4; $i++)
40 {
41 printf("<td>\n");
42 printf("<input name='dateformat%d' type='radio' onclick='ShowDatePulldown(%d)' value='pulldown' checked>pulldown \n", $i, $i);
43 printf("<input name='dateformat%d' type='radio' onclick='ShowDateInput(%d)' value='textinput'>text input \n", $i, $i);
44 printf("</td>\n");
45 }
46 printf("</tr>\n");
47
48 $query0="SELECT DATE_FORMAT(fValidFrom, '%Y') AS valid FROM History WHERE NOT fValidFrom='0000-00-00 00:00:00' group by valid";
49 $result0=mysql_query($query0, $db_id);
50
51
52 //date fields
53 printf("<tr>\n");
54 $rowcount=0;
55 for ($i=2; $i<4; $i++)
56 {
57 printf("<td>\n");
58 //input field
59 printf("<div id='dateinput%d' style='display:none'>Date (YYYY-MM-DD hh:mm:ss) \n", $i);
60 printf("<input id=\"statusdate%d\" type=\"text\" size=\"19\" maxlength=\"19\">\n", $i);
61 printf("<button onClick='get_timestamp(%s, \"next\");' id='nextimestamp%s' style='display:inline'>Next Time Stamp</button>\n", $i, $i);
62 printf("<button onClick='get_timestamp(%s, \"prev\");' id='nextimestamp%s' style='display:inline'>Prev Time Stamp</button>\n", $i, $i);
63 printf("</div>\n");
64 //pull down menus
65 printf("<div id='datepulldown%d' style='display:inline'>Date:\n", $i);
66 //select for years
67 printf("<div id='yearselect%d' style='display:inline'>\n", $i);
68 printf("<select id='year%d' onchange=\"get_dates('month', this.value, this.value, %d, 'yes')\">\n", $i, $i);
69 printf("<option value='empty'>year</option>\n");
70 while ($row0 = mysql_fetch_row($result0))
71 {
72 printf("<option value='%s'>%s </option>\n", $row0[0], $row0[0]);
73 $rowcount++;
74 }
75 printf("</select></div>\n");
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'>-</option>\n");
80 printf("</select></div>\n");
81 //select for days
82 printf("<div id='dayselect%d' style='display:inline'>\n", $i);
83 printf("<select id='day%d' onchange=\"get_dates('hour', this.value, 'empty', %d, 'yes')\">\n", $i, $i);
84 printf("<option value='empty'>-</option>\n");
85 printf("</select></div>\n");
86 //select for hours
87 printf("<div id='hourselect%d' style='display:inline'>\n", $i);
88 printf("<select id='hour%d' onchange=\"get_dates('min', this.value, 'empty', %d, 'yes')\">\n", $i, $i);
89 printf("<option value='empty'>-</option>\n");
90 printf("</select></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'>-</option>\n");
95 printf("</select></div>\n");
96 //select for seconds
97 printf("<div id='secselect%d' style='display:inline'><select id='sec%d'>\n", $i, $i);
98 printf("<option value='empty'>-</option>\n");
99 printf("</select></div>\n");
100 //buttton to show next timestamp
101 //printf("<button onClick='get_next_timestamp(%s);' id='nextimestamp%s' style='display:inline'>Next Time Stamp</button>\n", $i, $i);
102 printf("<button onClick='get_timestamp(%s, \"next\");' id='nextimestamp%s' style='display:inline'>Next Time Stamp</button>\n", $i, $i);
103 printf("<button onClick='get_timestamp(%s, \"prev\");' id='nextimestamp%s' style='display:inline'>Prev Time Stamp</button>\n", $i, $i);
104 printf("</td>\n");
105 if ($i==2 && $rowcount > 0)
106 mysql_data_seek($result0, 0);
107 }
108 printf("</tr>\n");
109 mysql_free_result($result0);
110
111 //list of POs
112 printf("<tr>\n");
113 printf("<td><div id='valuefield2'></div></td>\n");
114 printf("<td><div id='valuefield3'></div></td>\n");
115 printf("</tr>\n");
116
117 printf("</tbody>\n</table>\n");
118
119 echo (file_get_contents("index-footer.html"));
120
121 ini_set("display_errors", "Off");
122 ini_set("mysql.trace_mode", "Off");
123}
124?>
Note: See TracBrowser for help on using the repository browser.