? .DS_Store
? sort_filter.patch
Index: handlers/views_handler_sort.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views/handlers/views_handler_sort.inc,v
retrieving revision 1.1
diff -u -p -r1.1 views_handler_sort.inc
--- handlers/views_handler_sort.inc	3 Sep 2008 19:21:28 -0000	1.1
+++ handlers/views_handler_sort.inc	29 Dec 2008 03:24:08 -0000
@@ -16,7 +16,14 @@ class views_handler_sort extends views_h
   function query() {
     $this->ensure_my_table();
     // Add the field.
-    $this->query->add_orderby($this->table_alias, $this->real_field, $this->options['order']);
+    $this->field_alias = $this->query->add_orderby($this->table_alias, $this->real_field, $this->options['order']);
+    
+    // Optionally filter on this value to cut off sorted data.
+    if (!empty($this->filter_value)) {
+      $value = is_numeric($this->filter_value) ? $this->filter_value : "'$this->filter_value'";
+      $operator = $this->filter_operator;
+      $this->query->add_where(0, "$this->field_alias $operator $value");
+    }
   }
 
   function option_definition() {
@@ -56,6 +63,14 @@ class views_handler_sort extends views_h
       '#default_value' => $this->options['order'],
     );
   }
+  
+  /**
+   * Optionally filter the results based on this sort's data
+   */
+  function filter($operator, $value) {
+    $this->filter_operator = $operator;
+    $this->filter_value = $value;
+  }
 }
 
 /**
Index: includes/query.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views/includes/query.inc,v
retrieving revision 1.32
diff -u -p -r1.32 query.inc
--- includes/query.inc	28 Oct 2008 20:08:10 -0000	1.32
+++ includes/query.inc	29 Dec 2008 03:24:08 -0000
@@ -804,6 +804,8 @@ class views_query {
     if ($this->groupby && $table) {
       $this->add_groupby($as);
     }
+    
+    return $as;
   }
 
   /**
