? .git
? station_views.patch
? playlist/station_260798.patch
? schedule/views/station_schedule_plugin_argument_validate_day.inc
Index: schedule/views/station_schedule.views.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/station/schedule/views/station_schedule.views.inc,v
retrieving revision 1.7
diff -u -p -r1.7 station_schedule.views.inc
--- schedule/views/station_schedule.views.inc	20 Sep 2009 06:56:56 -0000	1.7
+++ schedule/views/station_schedule.views.inc	21 Sep 2009 17:34:10 -0000
@@ -14,10 +14,10 @@ function station_schedule_views_handlers
       'station_schedule_handler_field_streams' => array(
         'parent' => 'views_handler_field',
       ),
-      'station_schedule_handler_field_start_time' => array(
+      'station_schedule_handler_field_time' => array(
         'parent' => 'views_handler_field',
       ),
-      'station_schedule_handler_field_finish_time' => array(
+      'station_schedule_handler_field_time_range' => array(
         'parent' => 'views_handler_field',
       ),
       'station_schedule_handler_field_iid_link' => array(
@@ -41,9 +41,9 @@ function station_schedule_views_handlers
       ),
 
       // Filter handlers
-//      'station_schedule_handler_filter_current_time' => array(
-//        'parent' => 'views_handler_filter_numeric',
-//      ),
+      'station_schedule_handler_filter_time' => array(
+        'parent' => 'views_handler_filter_numeric',
+      ),
     ),
   );
 }
@@ -67,9 +67,7 @@ function station_schedule_views_plugins(
  * Implementation of views_query_substitutions().
  */
 function station_schedule_views_query_substitutions($view) {
-  $timestamp = station_local_ts(time());
-  $minute = station_minute_from_day_hour(date('w', $timestamp), date('G', $timestamp));
-  return array('***CURRENT_STATION_MINUTE***' => $minute);
+  return array('***CURRENT_STATION_MINUTE***' => station_minute_from_local_ts());
 }
 
 /**
@@ -203,21 +201,33 @@ function station_schedule_views_data() {
       'label' => t('Program'),
     ),
   );
-  $data['station_schedule_item']['start'] = array(
-    'title' => t('Time'),
-    'help' => t("Schedule instance start time."),
+  $data['station_schedule_item']['time'] = array(
+    'title' => t('Time range'),
+    'help' => t("Schedule instance time range."),
     'field' => array(
-      'handler' => 'station_schedule_handler_field_start_time',
-      'click sortable' => TRUE,
+      'handler' => 'station_schedule_handler_field_time_range',
+      'additional fields' => array('start', 'finish'),
     ),
     'argument' => array(
       'handler' => 'station_schedule_handler_argument_day',
       'label' => t('Day of week'),
     ),
-//    'filter' => array(
-//      'handler' => 'station_schedule_handler_filter_time',
-//      'label' => t('Start'),
-//    ),
+    'sort' => array(
+      'handler' => 'station_schedule_handler_sort_time',
+    ),
+  );
+  $data['station_schedule_item']['start'] = array(
+    'title' => t('Start'),
+    'help' => t("Schedule instance start time."),
+    'field' => array(
+      'handler' => 'station_schedule_handler_field_time',
+      'click sortable' => TRUE,
+    ),
+    'filter' => array(
+      'handler' => 'station_schedule_handler_filter_time',
+      'allow empty' => FALSE,
+      'label' => t('Start'),
+    ),
     'sort' => array(
       'handler' => 'station_schedule_handler_sort_time',
     ),
@@ -226,13 +236,14 @@ function station_schedule_views_data() {
     'title' => t('Finish'),
     'help' => t("Schedule instance completion time."),
     'field' => array(
-      'handler' => 'station_schedule_handler_field_finish_time',
+      'handler' => 'station_schedule_handler_field_time',
       'click sortable' => TRUE,
     ),
-//     'filter' => array(
-//       'handler' => 'station_schedule_handler_filter_time',
-//       'label' => t('Finish'),
-//     ),
+    'filter' => array(
+      'handler' => 'station_schedule_handler_filter_time',
+      'allow empty' => FALSE,
+      'label' => t('Finish'),
+    ),
     'sort' => array(
       'handler' => 'station_schedule_handler_sort_time',
     ),
Index: schedule/views/station_schedule.views_default.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/station/schedule/views/station_schedule.views_default.inc,v
retrieving revision 1.7
diff -u -p -r1.7 station_schedule.views_default.inc
--- schedule/views/station_schedule.views_default.inc	15 Sep 2009 04:14:18 -0000	1.7
+++ schedule/views/station_schedule.views_default.inc	21 Sep 2009 17:34:10 -0000
@@ -1,7 +1,6 @@
 <?php
 
 // $Id: station_schedule.views_default.inc,v 1.7 2009/09/15 04:14:18 drewish Exp $
-
 /**
  * Implementation of hook_views_default_views().
  */
@@ -40,6 +39,22 @@ function station_schedule_views_default_
   $handler->override_option('fields', array(
     'start' => array(
       'label' => 'Time',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => '',
+        'alt' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'strip_tags' => 0,
+        'html' => 0,
+      ),
       'style' => 'station_hour',
       'exclude' => 0,
       'id' => 'start',
@@ -280,7 +295,23 @@ function station_schedule_views_default_
   $handler->override_option('fields', array(
     'start' => array(
       'label' => 'Time',
-      'style' => 'station_hour_range',
+      'alter' => array(
+        'alter_text' => 0,
+        'text' => '',
+        'make_link' => 0,
+        'path' => '',
+        'alt' => '',
+        'prefix' => '',
+        'suffix' => '',
+        'help' => '',
+        'trim' => 0,
+        'max_length' => '',
+        'word_boundary' => 1,
+        'ellipsis' => 1,
+        'strip_tags' => 0,
+        'html' => 0,
+      ),
+      'style' => 'station_hour',
       'exclude' => 0,
       'id' => 'start',
       'table' => 'station_schedule_item',
@@ -687,4 +718,3 @@ function station_schedule_views_default_
 }
 
 
-
Index: schedule/views/station_schedule_handler_field_finish_time.inc
===================================================================
RCS file: schedule/views/station_schedule_handler_field_finish_time.inc
diff -N schedule/views/station_schedule_handler_field_finish_time.inc
--- schedule/views/station_schedule_handler_field_finish_time.inc	10 Jun 2009 05:07:12 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,37 +0,0 @@
-<?php
-// $Id: station_schedule_handler_field_finish_time.inc,v 1.2 2009/06/10 05:07:12 drewish Exp $
-
-class station_schedule_handler_field_finish_time extends views_handler_field {
-  function construct() {
-    parent::construct();
-    $this->additional_fields['start'] = 'start';
-  }
-
-  function option_definition() {
-    $options = parent::option_definition();
-    $options['style'] = array('default' => 'station_hour');
-    return $options;
-  }
-
-  function options_form(&$form, &$form_state) {
-    parent::options_form($form, $form_state);
-
-    $form['style'] = array(
-      '#type' => 'radios',
-      '#title' => t('Style'),
-      '#options' => array(
-        'station_hour' => t('Time'),
-        'station_dayhour' => t('Day time'),
-        'station_hour_duration' => t('Duration'),
-      ),
-      '#default_value' => $this->options['style'],
-      '#description' => t('Which time style should be used.'),
-    );
-  }
-
-  function render($values) {
-    $start = $values->{$this->aliases['start']};
-    $finish = $values->{$this->field_alias};
-    return theme($this->options['style'], $start, $finish);
-  }
-}
Index: schedule/views/station_schedule_handler_field_start_time.inc
===================================================================
RCS file: schedule/views/station_schedule_handler_field_start_time.inc
diff -N schedule/views/station_schedule_handler_field_start_time.inc
--- schedule/views/station_schedule_handler_field_start_time.inc	10 Jun 2009 05:07:12 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,38 +0,0 @@
-<?php
-// $Id: station_schedule_handler_field_start_time.inc,v 1.2 2009/06/10 05:07:12 drewish Exp $
-
-class station_schedule_handler_field_start_time extends views_handler_field {
-  function construct() {
-    parent::construct();
-    $this->additional_fields['finish'] = 'finish';
-  }
-
-  function option_definition() {
-    $options = parent::option_definition();
-    $options['style'] = array('default' => 'station_hour');
-    return $options;
-  }
-
-  function options_form(&$form, &$form_state) {
-    parent::options_form($form, $form_state);
-
-    $form['style'] = array(
-      '#type' => 'radios',
-      '#title' => t('Style'),
-      '#options' => array(
-        'station_hour' => t('Time'),
-        'station_hour_range' => t('Time range'),
-        'station_dayhour' => t('Day time'),
-        'station_dayhour_range' => t('Day time range'),
-      ),
-      '#default_value' => $this->options['style'],
-      '#description' => t('Which time style should be used.'),
-    );
-  }
-
-  function render($values) {
-    $start = $values->{$this->field_alias};
-    $finish = $values->{$this->aliases['finish']};
-    return theme($this->options['style'], $start, $finish);
-  }
-}
Index: schedule/views/station_schedule_handler_field_time.inc
===================================================================
RCS file: schedule/views/station_schedule_handler_field_time.inc
diff -N schedule/views/station_schedule_handler_field_time.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ schedule/views/station_schedule_handler_field_time.inc	21 Sep 2009 17:34:10 -0000
@@ -0,0 +1,29 @@
+<?php
+// $Id: station_schedule_handler_field_finish_time.inc,v 1.2 2009/06/10 05:07:12 drewish Exp $
+
+class station_schedule_handler_field_time extends views_handler_field {
+  function option_definition() {
+    $options = parent::option_definition();
+    $options['style'] = array('default' => 'station_hour');
+    return $options;
+  }
+
+  function options_form(&$form, &$form_state) {
+    parent::options_form($form, $form_state);
+
+    $form['style'] = array(
+      '#type' => 'radios',
+      '#title' => t('Style'),
+      '#options' => array(
+        'station_hour' => t('Hour'),
+        'station_dayhour' => t('Day/hour'),
+      ),
+      '#default_value' => $this->options['style'],
+      '#description' => t('Which time style should be used.'),
+    );
+  }
+
+  function render($values) {
+    return theme($this->options['style'], $values->{$this->field_alias});
+  }
+}
Index: schedule/views/station_schedule_handler_field_time_range.inc
===================================================================
RCS file: schedule/views/station_schedule_handler_field_time_range.inc
diff -N schedule/views/station_schedule_handler_field_time_range.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ schedule/views/station_schedule_handler_field_time_range.inc	21 Sep 2009 17:34:10 -0000
@@ -0,0 +1,40 @@
+<?php
+// $Id: station_schedule_handler_field_start_time.inc,v 1.2 2009/06/10 05:07:12 drewish Exp $
+
+class station_schedule_handler_field_time_range extends views_handler_field {
+  function option_definition() {
+    $options = parent::option_definition();
+    $options['style'] = array('default' => 'station_hour_range');
+    return $options;
+  }
+
+  function options_form(&$form, &$form_state) {
+    parent::options_form($form, $form_state);
+
+    $form['style'] = array(
+      '#type' => 'radios',
+      '#title' => t('Style'),
+      '#options' => array(
+        'station_hour_duration' => t('Duration'),
+        'station_hour_range' => t('Hour range'),
+        'station_dayhour_range' => t('Day/hour range'),
+
+      ),
+      '#default_value' => $this->options['style'],
+      '#description' => t('Which time style should be used.'),
+    );
+  }
+
+  function query() {
+    // Since 'time' isn't a real field just add in our additional fields and
+    // be done with it.
+    $this->ensure_my_table();
+    $this->add_additional_fields();
+  }
+
+  function render($values) {
+    $start = $values->{$this->aliases['start']};
+    $finish = $values->{$this->aliases['finish']};
+    return theme($this->options['style'], $start, $finish);
+  }
+}
Index: schedule/views/station_schedule_handler_filter_time.inc
===================================================================
RCS file: schedule/views/station_schedule_handler_filter_time.inc
diff -N schedule/views/station_schedule_handler_filter_time.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ schedule/views/station_schedule_handler_filter_time.inc	21 Sep 2009 17:34:10 -0000
@@ -0,0 +1,106 @@
+<?php
+// $Id: views_handler_filter_upload_fid.inc,v 1.1 2008/09/03 19:21:30 merlinofchaos Exp $
+
+class station_schedule_handler_filter_time extends views_handler_filter_numeric {
+  // Hide a bunch of the operators.
+  function operators() {
+    $operators = parent::operators();
+    //  BETWEEN doesn't really work with the 'now' module.
+    unset($operators['between'], $operators['not between']);
+    // NULLs don't make sense since we require values for start and finish.
+    unset($operators['empty'], $operators['not empty']);
+    return $operators;
+  }
+
+  function option_definition() {
+    $options = parent::option_definition();
+    $options['value']['contains']['mode']['default'] = 'now';
+    $options['value']['contains']['offset']['default'] = 0;
+    return $options;
+  }
+
+  function value_form(&$form, &$form_state) {
+    $form['value']['mode'] = array(
+      '#type' => 'radios',
+      '#title' => 'Mode',
+      '#options' => array(
+        'now' => t('Current time'),
+        'minutes' => t('Specific time'),
+      ),
+      '#default_value' => $this->value['mode'],
+    );
+
+    parent::value_form($form, $form_state);
+
+    $form['value']['offset'] = array(
+      '#type' => 'textfield',
+      '#title' => empty($form_state['exposed']) ? t('Minute offset') : '',
+      '#size' => 10,
+      '#default_value' => $this->value['offset'],
+      '#description' => t('Offset in minutes, e.g. -60 for one hour ago, 1440 for one day from now.'),
+      '#process' => array('views_process_dependency'),
+      '#dependency' => array('radio:options[value][mode]' => array('now')),
+    );
+    $form['value']['value'] = array(
+      '#type' => 'station_schedule_daytime',
+      '#title' => $form['value']['value']['#title'],
+      '#default_value' => $this->value['value'],
+      '#process' => array('expand_station_schedule_daytime', 'views_process_dependency'),
+      '#dependency' => $form['value']['value']['#dependency'] + array('radio:options[value][mode]' => array('minutes')),
+      '#dependency_count' => 2,
+    );
+  }
+
+  function admin_summary() {
+    $options = $this->operator_options('short');
+    $output = check_plain($options[$this->operator]) . ' ';
+
+    switch ($this->value['mode']) {
+      case 'now':
+        if (empty($this->value['offset'])) {
+          $output .= t('Now');
+        }
+        elseif ($this->value['offset'] < 0) {
+          $output .= t('Now minus @offset minutes', array('@offset' => (int) $this->value['offset']));
+        }
+        else {
+          $output .= t('Now plus @offset minutes', array('@offset' => (int) $this->value['offset']));
+        }
+        break;
+
+      case 'minutes':
+        $output .= theme('station_dayhour', $this->value['value']);
+        break;
+
+      default:
+        $output .= check_plain((string) $this->value['value']);
+    }
+    return $output;
+  }
+
+  function query() {
+    $this->ensure_my_table();
+    $field = "$this->table_alias.$this->real_field";
+
+    $minutes_in_week = MINUTES_IN_WEEK;
+    $info = $this->operators();
+    if (!empty($info[$this->operator]['method'])) {
+      switch ($this->value['mode']) {
+      case 'now':
+        $offset = (int) $this->value['offset'];
+        if (empty($offset)) {
+          $this->query->add_where($this->options['group'], "$field $this->operator ***CURRENT_STATION_MINUTE***");
+        }
+        else {
+          $this->query->add_where($this->options['group'], "$field $this->operator (***CURRENT_STATION_MINUTE*** + %d + {$minutes_in_week}) %% {$minutes_in_week}", $offset);
+        }
+        break;
+
+      case 'minutes':
+        $this->query->add_where($this->options['group'], "$field $this->operator %d", $this->value['value']);
+        break;
+      }
+    }
+    return;
+  }
+}
\ No newline at end of file
