? spaces.preset_weight.patch
Index: spaces.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/spaces/spaces.module,v
retrieving revision 1.25.4.33.2.32.2.47
diff -u -p -r1.25.4.33.2.32.2.47 spaces.module
--- spaces.module	20 Aug 2010 15:45:21 -0000	1.25.4.33.2.32.2.47
+++ spaces.module	16 Feb 2011 01:01:32 -0000
@@ -254,6 +254,7 @@ function spaces_preset_load($name = NULL
         $return[$key] = $preset;
       }
     }
+    uasort($return, '_spaces_preset_load_sort');
     return $return;
   }
 }
@@ -977,3 +978,18 @@ function _spaces_json_decode($json) {
   eval($out . ';');
   return $x;
 }
+
+/**
+ * uasort() callback for preset order.
+ *
+ * Uses preset weights falling back to the preset title
+ * to sort the order of presets on load.
+ */
+function _spaces_preset_load_sort($p1, $p2) {
+  $p1_weight = variable_get('spaces_preset_weight_' . $p1->name, 0);
+  $p2_weight = variable_get('spaces_preset_weight_' . $p2->name, 0);
+  if ($p1_weight == $p2_weight) {
+    return strcasecmp($p1->title, $p2->title);
+  }
+  return $p1_weight < $p2_weight ? -1 : 1;
+}
Index: spaces_ui/export_ui/spaces_presets_export_ui.class.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/spaces/spaces_ui/export_ui/Attic/spaces_presets_export_ui.class.php,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 spaces_presets_export_ui.class.php
--- spaces_ui/export_ui/spaces_presets_export_ui.class.php	6 Aug 2010 16:44:46 -0000	1.1.2.1
+++ spaces_ui/export_ui/spaces_presets_export_ui.class.php	16 Feb 2011 01:01:32 -0000
@@ -160,6 +160,13 @@ function spaces_preset_editor(&$form, &$
     '#default_value' => $preset->space_type,
     '#disabled' => ($form_state['op'] === 'edit')
   );
+  $form['info']['weight'] = array(
+    '#title' => t('Weight'),
+    '#type' => 'weight',
+    '#delta' => 20,
+    '#default_value' => variable_get('spaces_preset_weight_' . $preset->name, 0),
+    '#decription' => t('Set the preset weight for how Spaces presets are ordered.'),
+  );
 
   $space = spaces_load($preset->space_type, 0);
   $stack = array('preset');
@@ -214,6 +221,7 @@ function spaces_preset_editor_submit(&$f
   $form_state['item']->title = $form_state['values']['title'];
   $form_state['item']->description = $form_state['values']['description'];
   $form_state['item']->space_type = $form_state['values']['space_type'];
+  variable_set('spaces_preset_weight_' . $form_state['values']['name'], $form_state['values']['weight']);
 }
 
 /**
