Stefan Seidel

Chronological ordering of events

In the Kronolith month and agenda view, all events are sorted first by calendar, then by their start time. This is obviously highly inconvenient if you want to know what happens on a certain day — one event after another, and not one group of events first, then the next. So I made this tiny patch to fix it:

--- a/kronolith/js/kronolith.js
+++ b/kronolith/js/kronolith.js
@@ -2069,7 +2069,19 @@ KronolithCore = {
                 .setStyle({ backgroundColor: Kronolith.conf.calendars[calendar[0]][calendar[1]].bg,
                             color: Kronolith.conf.calendars[calendar[0]][calendar[1]].fg });
             this.createAgendaDay(date);
-            $('kronolithAgendaDay' + date).insert(div);
+            div.store('sort', event.value.sort);
+            agendaDay = $('kronolithAgendaDay' + date);
+            chd = agendaDay.children;
+            for (i = 0; i < chd.length; i++) {
+                if (chd[i].retrieve('sort') > event.value.sort) {
+                    chd[i].insert({ before: div});
+                    found = true;
+                    break;
+                }
+            }
+            if (i == chd.length) {
+                agendaDay.insert(div);
+            }
             break;
         }

You can download the patch file here as well: kronolith-ordering.patch