Improve edit title
[infodrom.org/service.infodrom.org] / src / InfoCon / stempel / edit.wml
index 2771a0d..894544f 100644 (file)
@@ -5,21 +5,17 @@
   }
 ?>
 #include <infocon.style>
+#include "common.inc"
 
 <page func=InfoCon title="Stempeluhr">
 
 <?
-  function min2hour($minutes)
-  {
-      return sprintf('%02d:%02d', $minutes/60, $minutes%60);
-  }
-
   $dbh = pg_pconnect ("<dbhost>", "<dbport>", "<dbname>")
         or die("Unable to connect to SQL server");
 
   pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
 
-  $query = sprintf("SELECT start,stop,customer,time,task FROM stempel WHERE oid = %d", $_GET['id']);
+  $query = sprintf("SELECT start,stop,customer,time,task,status FROM stempel WHERE oid = %d", $_GET['id']);
 
   $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
 
@@ -31,7 +27,7 @@ label {
   display: block;
   font-weight: bold;
   font-size: 12px;
-  width: 160px;
+  width: 80px;
   text-align: left;
   padding-left: 5px;
   padding-top: 0px;
@@ -44,23 +40,36 @@ input {
   margin-bottom: 10px;
   border: 1px solid #1aa2fe;
 }
-select {
-  display: block;
-  width: 550px;
+input.radio {
+  width: auto;
+  margin: 0;
+  padding: 0;
+}
+div.radio {
+  width: 400px;
   margin-bottom: 10px;
   border: 1px solid #1aa2fe;
+  padding-top: 3px;
+  padding-bottom: 3px;
+}
+div.radio input.radio {
+  margin-left: 5px;
 }
 </style>
 
 <?
-printf('<h3 class="bar" align="center">- %s: %s</h3>', $row['customer'], $row['task']);
+$name = load_customers();
+$cname = $name[$row['customer']];
+if (!strlen($cname)) $cname = ucfirst($row['customer']);
+
+printf('<h3 class="bar" align="center">%s: %s</h3>', $cname, substring($row['task'],0,80-strlen($cname)));
 ?>
 
 <form method=post action="update.php">
 <input class=none type=hidden name=oid value="<? echo $_GET['id']; ?>">
 
 <label for=start>Start</label>
-<input id=start name=statrt size=40 maxlength=80 value="<? echo $row['start']; ?>">
+<input id=start name=start size=40 maxlength=80 value="<? echo $row['start']; ?>">
 
 <br class="none">
 <label for=stop>Stop</label>
@@ -74,6 +83,18 @@ printf('<h3 class="bar" align="center">- %s: %s</h3>', $row['customer'], $row['t
 <label for=task>Task</label>
 <input id=task name=task size=40 maxlength=80 value="<? echo $row['task']; ?>">
 
+<br class="none">
+<label for=status>Status</label>
+<div class="radio">
+<?
+  if (!is_array($stati))
+    $stati = find_status();
+
+  foreach ($stati as $k=>$v)
+    printf('<input type="radio" class="radio" name="status" value="%s"%s>%s&nbsp;', $k, $row['status']==$k?' checked':'', $v);
+?>
+</div>
+
 <p><center>
 <input class=button type=submit value="Update">
 <input class=button type=submit name=delete value="Delete">