]> code.delx.au - comingnext/commitdiff
fixed sorting for events without dates
authorMichael Prager <michael@pragers.de>
Mon, 21 Mar 2011 15:01:20 +0000 (16:01 +0100)
committerMichael Prager <michael@pragers.de>
Mon, 21 Mar 2011 15:01:20 +0000 (16:01 +0100)
Readme.txt
comingNext/index.html

index 634fdb52f8b1a37d7405df5f128a8a3ff1835aab..d3856e038dd5ca8c1ff774c70052fc6742227bb6 100644 (file)
@@ -259,3 +259,4 @@ Changelog:
   - added spanish translation (thanks to dragomerlin)\r
   - added italian translation (thanks to Marcella Ferrari and Venos)\r
   - fixed "About" link opening inside browser instead of widget\r
+  - fixed sorting of events without date\r
index bc731c4ff400d03d8d9dea2a0225cadf663b905d..cd61eaaa77a277a427dcf9f3ca924fcc7535d537 100644 (file)
@@ -1434,6 +1434,33 @@ function sortCalendarEntries(a, b)
                        }\r
                }\r
        }\r
+       // NOTE: events my have no date information at all. In that case, we list events without date first\r
+       else if (atime && !btime) {\r
+               return 1;\r
+       }\r
+       else if (!atime && btime) {\r
+               return -1;\r
+       }\r
+       else if (!atime && !btime) {\r
+               // sort by type\r
+               if (a.Type != b.Type) {\r
+                       if (a.Type < b.Type) {\r
+                               return -1;\r
+                       }\r
+                       else if (a.Type > b.Type) {\r
+                               return 1;\r
+                       }\r
+               }\r
+               // sort by description\r
+               else if (a.Summary && b.Summary && a.Summary != b.Summary) {\r
+                       if (a.Summary < b.Summary) {\r
+                               return -1;\r
+                       }\r
+                       else if (a.Summary > b.Summary) {\r
+                               return 1;\r
+                       }\r
+               }\r
+       }\r
 \r
        return 0;\r
 }\r