Index: content_views.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/cck/content_views.inc,v
retrieving revision 1.2.2.7
diff -u -r1.2.2.7 content_views.inc
--- content_views.inc	31 Jan 2007 02:54:37 -0000	1.2.2.7
+++ content_views.inc	10 Feb 2007 04:06:16 -0000
@@ -72,6 +72,17 @@
         );
       }
 
+      // SM: additional sorts
+      $sorts = module_invoke($module, 'field_settings', 'sorts', $field);
+      foreach ((array)$sorts as $column => $data) {
+        if ($column) {
+          $table['sorts'][$column] = $data;
+	}
+	else {
+	  $table['sorts'][$main_column['column']] = array_merge($table['sorts'][$main_column['column']], $data);
+	}
+      }
+
       $filters = module_invoke($module, 'field_settings', 'filters', $field);
       if (is_array($filters) && count($filters)) {
         $table['filters'] = array();


Index: date.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/date/date.module,v
retrieving revision 1.49
diff -u -r1.49 date.module
--- date.module	9 Feb 2007 16:51:34 -0000	1.49
+++ date.module	15 Feb 2007 23:45:34 -0000
@@ -238,6 +238,10 @@
 
     case 'filters':
       return date_views_filters($field);
+
+    // SM: additional sorts
+    case 'sorts':
+      return date_views_sorts($field);
   }
 }
 
Index: date_views.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/date/date_views.inc,v
retrieving revision 1.28
diff -u -r1.28 date_views.inc
--- date_views.inc	1 Feb 2007 18:48:58 -0000	1.28
+++ date_views.inc	15 Feb 2007 23:48:28 -0000
@@ -57,7 +57,6 @@
 }
 
 function date_views_filters($field) {
-
   switch ($field['type']) {
     case ('date'):
       $handler = 'date_views_filter_handler';
@@ -129,6 +128,49 @@
       'extra' => array('field' => $field),
       'help' => t('Filter by day. Enter \'now\' to use the current day.  You may enter a delta (in seconds) to the option that will be added to the time; this is most useful when combined with now. '),
       ),
+
+    // SM: handle date TO filtering
+    'todate' => array(
+      'name' => t('DateTo'),
+      'operator' => $operator,
+      'value' => date_views_handler_filter_date_value_form($field),
+      'option' => 'string',
+      'handler' => $handler,
+      'type' => 'DATE',
+      'extra' => array('field' => $field, 'todate' => TRUE),  // SM: handle TO date filtering
+      'help' => t('This filter allows events to be filtered by their date To. Enter dates in the format: %format. Enter \'now\' to use the current time. You may enter a delta (in seconds) to the option that will be added to the time; this is most useful when combined with now. If you have the jscalendar module from jstools installed, you can use a popup date picker here.', array('%format' => $format)),
+      ),
+    'todate_year' => array(
+      'name' => t('DateTo').'-'.t('Year'),
+      'operator' => $operator,
+      'handler' => $handler,
+      'option' => 'string',
+      'type' => 'YEAR',
+      'extra' => array('field' => $field, 'todate' => TRUE),  // SM: handle TO date filtering
+      'help' => t('Filter by year. Enter \'now\' to use the current year.  You may enter a delta (in seconds) to the option that will be added to the time; this is most useful when combined with now. '),
+      ),
+    'todate_month' => array(
+      'name' => t('DateTo').'-'.t('Month'),
+      'operator' => $operator,
+      'list' => $months,
+      'list-type' => 'select',
+      'handler' => $handler,
+      'option' => 'string',
+      'type' => 'MONTH',
+      'extra' => array('field' => $field, 'todate' => TRUE),  // SM: handle TO date filtering
+      'help' => t('Filter by month. Enter \'now\' to use the current month.  You may enter a delta (in seconds) to the option that will be added to the time; this is most useful when combined with now. '),
+      ),
+    'todate_day' => array(
+      'name' => t('DateTo').'-'.t('Day'),
+      'operator' => $operator,
+      'list' => $days,
+      'list-type' => 'select',
+      'handler' => $handler,
+      'option' => 'string',
+      'type' => 'DAY',
+      'extra' => array('field' => $field, 'todate' => TRUE),  // SM: handle TO date filtering
+      'help' => t('Filter by day. Enter \'now\' to use the current day.  You may enter a delta (in seconds) to the option that will be added to the time; this is most useful when combined with now. '),
+      ),
    );
 }
 
@@ -150,6 +192,12 @@
   $db_info = content_database_info($field);
   $value   = $db_info['columns']['value']['column'];
   $table   = 'node_data_'. $field['field_name'];
+
+  // SM: handle date TO filtering
+  if ($filterinfo['extra']['todate']) {
+    $value   = $db_info['columns']['value2']['column'];
+  }
+
   $offset  = intval(date_views_offset($field) - intval($filter['options']));
 
   switch ($filterinfo['type']) {
@@ -162,7 +210,6 @@
   }
   $query->ensure_table($table);
   $query->add_where(date_sql($filterinfo['type'], $table .".". $value, $field_type, $offset) . $filter['operator'] . $date);
-
 }
 
 /**
@@ -848,4 +895,10 @@
   $output .= theme($display, $view, $nodes, $type, $teasers, $links);
 
   return $output;
-}
\ No newline at end of file
+}
+
+// SM: handle date TO sort
+function date_views_sorts($field) {
+  $data = array('name' => 'Date: Date To ('.$field['field_name'].')', 'field' => $field['field_name'].'_value2');
+  return array($field['field_name'].'_value2' => $data);
+}
