? calendar_weight.patch
Index: calendar_api.inc
===================================================================
RCS file: /cvs/drupal/contributions/modules/calendar/calendar_api.inc,v
retrieving revision 1.15.2.16
diff -u -r1.15.2.16 calendar_api.inc
--- calendar_api.inc	30 Mar 2007 16:57:38 -0000	1.15.2.16
+++ calendar_api.inc	16 Apr 2007 09:47:50 -0000
@@ -216,6 +216,25 @@
             }
             $rows[] = calendar_week_header($params['mini'], $params['with_weekno']);
 
+            // Set a weight foreach singleday and start node on any given day.
+            foreach ($days as $daykey => $dayvalue) {
+              $weight = 0;
+              foreach ($dayvalue as $nodekey => $nodevalue) {
+                switch ($nodevalue->calendar_state) {
+                case 'singleday':
+                case 'start':
+                  $GLOBALS['calendar_node_weight'][$nodevalue->nid] = $weight;
+                  $weight++;
+                  break;
+                case 'ongoing':
+                case 'end':
+                  $weight++;
+                  break;
+                }
+                $nodes[$nodevalue->nid]->weight = $GLOBALS['calendar_node_weight'][$nodevalue->nid];
+              }
+            }
+            
             while ($curstamp <= $lastday) {
             	for ($x = $start; $x < 7; $x++) {
                 $cur_day = (($week * 7) + ($x + 1) - $offset);
