Copy calendar item to log window
authorJoey Schulze <joey@infodrom.org>
Sat, 16 May 2020 17:13:04 +0000 (19:13 +0200)
committerJoey Schulze <joey@infodrom.org>
Sat, 16 May 2020 17:13:04 +0000 (19:13 +0200)
class/calendar_item.class.php
src/Infodrom/calendar/index.wml

index 08c656d..39b2b5c 100644 (file)
@@ -103,8 +103,12 @@ class Calendar_Item extends DatabaseTable {
     if ($this->data->location)
       $title .= ', ' . $this->data->location;
 
+    $sql = sprintf("SELECT color FROM calendar_item_data WHERE dav_id = %d", $this->id);
+    $bgcolor = $this->fetchValue($sql);
+    if ($bgcolor) $bgcolor = sprintf(' style="background:%s;"', $bgcolor);
+
     $color = 0;
-    $out = sprintf('<div class="caltitle">%s</div>', $title);
+    $out = sprintf('<div class="caltitle" %s>%s</div>', $bgcolor, $title);
 
     $items = array();
     $items[] = array('dt' => substr($this->data->created,0,16),
@@ -113,6 +117,7 @@ class Calendar_Item extends DatabaseTable {
 
     $sql = sprintf("SELECT id,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) {
       if (strlen($row->url))
          $items[] = array('dt' => substr($row->sys_edit,0,16),
index e23f4d2..f26c81f 100644 (file)
@@ -120,8 +120,13 @@ span.menu {
 span.menu:hover {
     background: #96ccff;
 }
-
+div.popup#calendar_log div.popup_body {
+    padding-left: 0px;
+    padding-right: 0px;
+}
 div.popup_body div#log div.caltitle {
+    padding-left: 2px;
+    padding-right: 2px;
     border-top: 0px !important;
 }
 div.logl {
@@ -134,7 +139,8 @@ div.logr {
 div.popup_body div#log div.row0,
 div.popup_body div#log div.row1 {
     margin: 0;
-    padding: 0;
+    padding-left: 2px;
+    padding-right: 2px;
     font-size: 90%;
     border-top: 1px solid #ccc;
 }
@@ -293,6 +299,7 @@ function show_log()
 
     if (!logwindow) {
        logwindow = new Popup('Protocol', '460px', false, '<div id="log"></div>');
+       logwindow.setId('calendar_log');
        logwindow.centerPopup();
     } else {
        logwindow.openPopup();