Open log window on click, improve alterating background
[infodrom.org/service.infodrom.org] / class / calendar_item.class.php
index 99f0cf1..2eeb005 100644 (file)
@@ -103,20 +103,23 @@ class Calendar_Item extends DatabaseTable {
     if ($this->data->location)
       $title .= ', ' . $this->data->location;
 
+    $color = 0;
     $out = sprintf('<div class="caltitle">%s</div>', $title);
-    $out .= sprintf('<div>%s: Item created</div>', substr($this->data->created,0,16));
+    $out .= sprintf('<div class="row%d">%s: Item created</div>', $color, substr($this->data->created,0,16));
     # $out .= sprintf('<div>Last modified %s</div>', $this->data->last_modified);
 
     $sql = sprintf("SELECT name,url,comment,sys_edit,sys_user " .
                   "FROM calendar_item_log WHERE dav_id = %d ORDER BY sys_edit", $this->id);
     foreach ($this->fetchObjectList($sql) as $row) {
+      $color = !$color;
       if (strlen($row->url))
-       $out .= sprintf('<div>%s: <a href="%s" target="_blank">%s</a></div>',
+       $out .= sprintf('<div class="row%d">%s: <a href="%s" target="_blank">%s</a></div>',
+                       $color,
                        substr($row->sys_edit,0,16),
                        $row->url,
                        $row->name ? $row->name : 'Link');
       if (strlen($row->comment))
-       $out .= sprintf('<div>%s: %s</div>', substr($row->sys_edit,0,16), $row->comment);
+       $out .= sprintf('<div class="row%d">%s: %s</div>', $color, substr($row->sys_edit,0,16), $row->comment);
     }
 
     return array('html' => array('log' => $out));