Add drag and drop. Doesn't save in the backend yet.
authorJan Schneider <jan@horde.org>
Mon, 16 Mar 2009 18:03:12 +0000 (19:03 +0100)
committerJan Schneider <jan@horde.org>
Mon, 16 Mar 2009 18:03:12 +0000 (19:03 +0100)
kronolith/js/src/kronolith.js
kronolith/lib/Kronolith.php
kronolith/themes/screen.css

index 21fc0a5..c9472f9 100644 (file)
@@ -395,10 +395,16 @@ KronolithCore = {
         var cell = row.down().setText(monday.getWeek()).next();
         while (cell) {
             cell.id = 'kronolithMonthDay' + day.dateString();
+            cell.writeAttribute('date', day.dateString());
             cell.removeClassName('kronolithOtherMonth');
             if (typeof month != 'undefined' && day.getMonth() != month) {
                 cell.addClassName('kronolithOtherMonth');
             }
+            new Drop(cell, { onDrop: function(drop) {
+                var el = DragDrop.Drags.drag.element;
+                this.doAction('UpdateEvent', { cal: el.readAttribute('calendar'), id: el.readAttribute('eventid'), att: $H({ start: drop.readAttribute('date') }).toJSON() });
+                drop.insert(el);
+            }.bind(this) });
             cell.down('.kronolithDay').setText(day.getDate());
             cell = cell.next();
             day.add(1).day();
@@ -590,6 +596,7 @@ KronolithCore = {
                             .observe('mouseover', div.addClassName.curry('kronolithSelected'))
                             .observe('mouseout', div.removeClassName.curry('kronolithSelected'));
                         $('kronolithMonthDay' + date.key).insert(div);
+                        new Drag('kronolithEventmonth' + r.response.cal + event.key, { ghosting: true, parentElement: function() { return document.body; } });
                         break;
                     }
                 }, this);
index 984c462..1b1307c 100644 (file)
@@ -73,6 +73,7 @@ class Kronolith
         // Need to include script files before we start output
         Horde::addScriptFile('prototype.js', 'horde', true);
         Horde::addScriptFile('effects.js', 'horde', true);
+        Horde::addScriptFile('dragdrop.js', 'imp', true);
 
         // ContextSensitive must be loaded first.
         while (list($key, $val) = each($scripts)) {
index 7701b76..fd2657b 100644 (file)
@@ -942,6 +942,10 @@ div.kronolithView div.kronolithViewBody div.kronolithRow {
 div.kronolithView div.kronolithViewBody div.kronolithRow div {
     font-size: 95%;
 }
+div.kronolithView div.kronolithViewBody .kronolithEvent {
+    margin-bottom: 2px;
+    margin-right: 2px;
+}
 div.kronolithView div.kronolithViewBody div.kronolithRow div.kronolithFirstCol {
     font-weight: bold;
     text-align: center;
@@ -1013,7 +1017,7 @@ div.kronolithView div.kronolithViewBody div.kronolithRow div div.kronolithMore a
 }
 
 /* Events */
-div.kronolithView div.kronolithViewBody div.kronolithRow div .kronolithEvent {
+div.kronolithView div.kronolithViewBody div.kronolithRow div .kronolithEvent, .kronolithEvent {
     float: none;
     width: auto;
     height: 15px;