Convert in-place edit of task to jquery.editable
[infodrom.org/service.infodrom.org] / src / InfoCon / stempel / index.wml
index cda1025..5087641 100644 (file)
@@ -24,7 +24,9 @@
     $month = date('Y-m');
 ?>
 
+<future>
 <page func=InfoCon title="Stempeluhr">
+<script type="text/javascript" src="<root_prefix>jquery.editable.js"></script>
 
 <?
   $name = load_customers();
   <th width=80%%>Arbeitsbeschreibung</th>
 </tr>';
   $table_foot = '</table>';
-  $table_row = '<tr class="t%d"><td>%s</td><td align="center">%s</td><td align="center">%s</td><td><a href="edit.php?id=%d">%s</a></td></tr>';
+  if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mozilla/') === false)
+    $table_row = '<tr class="t%d"><td>%s</td><td align="center">%s</td><td align="center">%s</td><td><a href="edit.php?id=%d">%s</a></td></tr>';
+  else
+    $table_row = '<tr class="t%d"><td>%s</td><td align="center">%s</td><td align="center">%s</td><td><span route="Stempel/EditTask" item_id="%d">%s</span></td></tr>';
   $table_sum = '<tr class="t%d"><td>&nbsp;</td><td align="center"><strong>%s</strong></td><td>&nbsp;</td><td><strong>Summe</strong></td></tr>';
 
   $query = <<<EOS
-SELECT stempel.oid,start,stempel_customer.name AS customer,time,task,kurz
+SELECT stempel.oid,stempel.id,start,stempel_customer.name AS customer,time,task,kurz
 FROM stempel
 JOIN stempel_customer ON (stempel.customer = stempel_customer.short)
 JOIN stempel_status ON (stempel.status = stempel_status.id)
@@ -73,7 +78,9 @@ EOS;
     $sum += $row['time'];
     $d = explode(' ', $row['start']);
  
-    printf($table_row, $color, $d[0], min2hour($row['time']), $row['kurz'], $row['oid'], htmlspecialchars($row['task'], ENT_COMPAT | ENT_HTML401, 'ISO-8859-1'));
+    printf($table_row, $color, $d[0], min2hour($row['time']), $row['kurz'],
+          strpos($_SERVER['HTTP_USER_AGENT'], 'Mozilla/') === false ? $row['oid'] : $row['id'],
+          htmlspecialchars($row['task'], ENT_COMPAT | ENT_HTML401, 'ISO-8859-1'));
     $color = !$color;
   }
   printf($table_sum, $color, min2hour($sum));
@@ -101,6 +108,11 @@ EOS;
 </form>
 <div style="padding-top: 0.5em"></div>
 
+<protect><script type="text/javascript">
+$(function(){
+    make_editable('table.smallfont tr span');
+});
+</script></protect>
 </page>
 
 # Local variables: