Index: fullcalendar.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fullcalendar/fullcalendar.install,v
retrieving revision 1.2.4.3
diff -u -p -r1.2.4.3 fullcalendar.install
--- fullcalendar.install	19 Jan 2011 18:47:26 -0000	1.2.4.3
+++ fullcalendar.install	26 Jan 2011 03:54:16 -0000
@@ -37,7 +37,7 @@ function fullcalendar_requirements($phas
 }
 
 /**
- * Implementation of hook_uninstall().
+ * Implements hook_uninstall().
  */
 function fullcalendar_uninstall() {
   variable_del('fullcalendar_path');
Index: fullcalendar.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fullcalendar/fullcalendar.module,v
retrieving revision 1.8.2.8
diff -u -p -r1.8.2.8 fullcalendar.module
--- fullcalendar.module	20 Jan 2011 18:34:18 -0000	1.8.2.8
+++ fullcalendar.module	26 Jan 2011 03:54:16 -0000
@@ -197,9 +197,6 @@ function template_preprocess_views_view_
     'left' => $vars['options']['header']['fc_left'],
     'center' => $vars['options']['header']['fc_center'],
     'right' => $vars['options']['header']['fc_right'],
-    'year' => $vars['options']['defaults']['fc_year'],
-    'month' => $vars['options']['defaults']['fc_month'],
-    'day' => $vars['options']['defaults']['fc_day'],
     'agenda' => $vars['options']['times']['fc_timeformat'],
     'clock' => $vars['options']['times']['fc_clock'],
     'monthNames' => array_values(date_month_names(TRUE)),
@@ -212,6 +209,13 @@ function template_preprocess_views_view_
     'monthString' => t('Month'),
     'todayString' => t('Today'),
   );
+
+  if ($vars['options']['times']['fc_default_date']) {
+    $settings['year'] = $vars['options']['times']['fc_date']['year'];
+    $settings['month'] = $vars['options']['times']['fc_date']['month'];
+    $settings['day'] = $vars['options']['times']['fc_date']['day'];
+  }
+
   drupal_add_library('fullcalendar', 'fullcalendar');
   drupal_add_js(array('fullcalendar' => $settings), 'setting');
   drupal_add_js(drupal_get_path('module', 'fullcalendar') . '/fullcalendar.views.js');
@@ -222,10 +226,16 @@ function template_preprocess_views_view_
  */
 function template_preprocess_views_view_node_fullcalendar(&$vars) {
   $entity_type = 'node';
+  // If the view has no availble nodes, exit.
   if (isset($vars['view']->empty_text)) {
     $vars['empty_text'] = $vars['view']->empty_text;
     return;
   }
+
+  // Fetch the available fields in this view.
+  $fields = $vars['view']->display_handler->get_field_labels();
+
+  // Get the node and return if not found or empty.
   $nid = $vars['row']->{$vars['field_alias']};
   if (!is_numeric($nid)) {
     return;
@@ -238,49 +248,48 @@ function template_preprocess_views_view_
   // Allow resize/drag/drop of an event if user has proper permissions.
   $node->editable = _fullcalendar_update_access($node);
   $node->class = theme('fullcalendar_classname', array('node' => $node));
+
+  // Prepare structures.
   $vars['node'] = $node;
   $vars['data'] = array(); // Contains the start, end & allDay values.
+
+  // Default URL.
   $node->url = 'node/' . $nid;
-  if ($url_field = $vars['options']['fullcalendar_url_field']) {
-    if ($url_field = field_get_items('node', $node, $url_field)) {
-      $vars['url'] = $url_field[0]['value'];
+  // Fetch custom URL if needed.
+  if (!empty($vars['options']['fullcalendar_custom_url'])) {
+    $url_field = field_get_items($entity_type, $node, $fields[$vars['options']['fullcalendar_url_field']]);
+    if (!empty($url_field[0]['value'])) {
+      $node->url = $url_field[0]['value'];
     }
   }
 
-  $title_field = $vars['options']['fullcalendar_title_field'];
-  if (!empty($title_field) && !empty($node->{$title_field}[0]['value'])) {
-    $node->title = $node->{$title_field}[0]['value'];
-  }
-  $display_field = fullcalendar_date_fields($node);
-  $field_names = trim(strip_tags($vars['options']['fullcalendar_date_fields']));
-  if (!empty($field_names)) {
-    foreach (explode("\n", $field_names) as $field_name) {
-      $field_name = trim(strip_tags($field_name));
-      if (($field_name == 'created') || ($field_name == 'changed')) {
-        $attributes = _fullcalendar_set_display_times($entity_type, $node, $field_name);
-        $vars['data'][] = theme('fullcalendar_link',
-          array('node' => $node, 'attributes' => $attributes, 'index' => 0)
-        );
-        $display_field = array();
-        break;
-      }
-      // If a date_type field exists
-      if (isset($display_field[$field_name])) {
-        $display_field = array($field_name => $display_field[$field_name]);
-        break;
-      }
+  // Fetch custom title if needed.
+  if (!empty($vars['options']['fullcalendar_custom_title'])) {
+    $title_field = field_get_items($entity_type, $node, $fields[$vars['options']['fullcalendar_title_field']]);
+    if (!empty($title_field[0]['value'])) {
+      $node->title = $title_field[0]['value'];
     }
   }
-  // Iterate through available fields, using the first one found.
-  foreach ($display_field as $field_name => $field) {
+
+  // Fetch custom dates if needed.
+  if (!empty($vars['options']['fullcalendar_custom_date'])) {
+    $fields = array_intersect_key($fields, $vars['options']['fullcalendar_date_fields']);
+  }
+
+  // Iterate through all available fields.
+  foreach (fullcalendar_date_fields($fields) as $field_name => $field) {
     $instance = field_info_instance($entity_type, $field_name, $node->type);
-    foreach (field_get_items($entity_type, $node, $field_name) as $index => $item) {
-      $attributes = _fullcalendar_set_display_times($entity_type, $node, $field_name, $instance, $field, $item);
-      $vars['data'][] = theme('fullcalendar_link',
-        array('node' => $node, 'attributes' => $attributes, 'index' => $index)
-      );
+    $items = field_get_items($entity_type, $node, $field_name);
+    // Filter fields without value.
+    if (!empty($items)) {
+      foreach ($items as $index => $item) {
+        $vars['data'][] = theme('fullcalendar_link', array(
+          'node' => $node,
+          'attributes' => _fullcalendar_set_display_times($entity_type, $node, $field_name, $instance, $field, $item),
+          'index' => $index,
+        ));
+      }
     }
-    break;
   }
 }
 
@@ -368,21 +377,14 @@ function _fullcalendar_update_access($no
 }
 
 /**
- * Find all date fields in this instance.
+ * Filters the date fields.
  *
- * Field type is not in the $field array we get from
- * field_info_instances(), we need to call
- * field_info_field() to find that.
- */
-function fullcalendar_date_fields($entity, $entity_type = 'node') {
-  $bundle = '';
-  switch ($entity_type) {
-    case 'node':
-      $bundle = $entity->type;
-      break;
-  }
+ * @param $view_fields
+ *   Array of possible date fields.
+ */
+function fullcalendar_date_fields($field_options) {
   $fields = array();
-  foreach (array_keys(field_info_instances($entity_type, $bundle)) as $field_name) {
+  foreach ($field_options as $entity_name => $field_name) {
     $field = field_info_field($field_name);
     if (in_array($field['type'], array('date', 'datestamp', 'datetime'))) {
       $fields[$field_name] = $field;
Index: fullcalendar.views.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fullcalendar/fullcalendar.views.inc,v
retrieving revision 1.2.2.1
diff -u -p -r1.2.2.1 fullcalendar.views.inc
--- fullcalendar.views.inc	23 Dec 2010 21:14:22 -0000	1.2.2.1
+++ fullcalendar.views.inc	26 Jan 2011 03:54:16 -0000
@@ -52,12 +52,12 @@ function fullcalendar_views_plugins() {
     ),
     'row' => array(
       'fullcalendar_node' => array(
-        'title' => t('Node - FullCalendar'),
+        'title' => t('Fields (FullCalendar)'),
         'help' => t('For use with FullCalendar style'),
         'handler' => 'views_plugin_node_fullcalendar',
         'theme' => 'views_view_node_fullcalendar',
         'theme path' => $path,
-        'uses fields' => FALSE,
+        'uses fields' => TRUE,
         'uses options' => TRUE,
         'type' => 'normal',
       ),
Index: fullcalendar_plugin_display_page.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fullcalendar/fullcalendar_plugin_display_page.inc,v
retrieving revision 1.2.2.1
diff -u -p -r1.2.2.1 fullcalendar_plugin_display_page.inc
--- fullcalendar_plugin_display_page.inc	23 Dec 2010 21:14:22 -0000	1.2.2.1
+++ fullcalendar_plugin_display_page.inc	26 Jan 2011 03:54:16 -0000
@@ -17,4 +17,17 @@ class fullcalendar_plugin_display_page e
     }
     return parent::render();
   }
+
+  function validate() {
+    $errors = parent::validate();
+
+    $field_options = $this->display->handler->get_field_labels();
+    $date_fields = fullcalendar_date_fields($field_options);
+
+    if (empty($date_fields)) {
+      $errors[] = t('Display "@display" requires at least one date field.', array('@display' => $this->display->display_title));
+    }
+
+    return $errors;
+  }
 }
Index: views_plugin_node_fullcalendar.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fullcalendar/views_plugin_node_fullcalendar.inc,v
retrieving revision 1.3.2.1
diff -u -p -r1.3.2.1 views_plugin_node_fullcalendar.inc
--- views_plugin_node_fullcalendar.inc	23 Dec 2010 21:14:22 -0000	1.3.2.1
+++ views_plugin_node_fullcalendar.inc	26 Jan 2011 03:54:17 -0000
@@ -21,39 +21,69 @@ class views_plugin_node_fullcalendar ext
     $options['fullcalendar_url_field'] = array('default' => '');
     $options['fullcalendar_date_fields'] = array('default' => '');
     $options['fullcalendar_title_field'] = array('default' => '');
+    $options['fullcalendar_custom_url'] = array('default' => FALSE);
+    $options['fullcalendar_custom_title'] = array('default' => FALSE);
+    $options['fullcalendar_custom_date'] = array('default' => FALSE);
     return $options;
   }
 
   function options_form(&$form, &$form_state) {
     parent::options_form($form, $form_state);
-    $form['fullcalendar_date_fields'] = array(
-      '#type' => 'textarea',
-      '#title' => t('Date Fields'),
-      '#default_value' => $this->options['fullcalendar_date_fields'],
-      '#description' => t('Normally this plugin uses the first node field that is either a date or a datetime field type. However, if you wish to override this behavior, please enter the names of the fields to use instead. For example "field_scheduled_for". Enter one per line. They will be searched in the order listed. Enter "created" or "changed" to use the respective node timestamps.'),
+    $field_options = $this->display->handler->get_field_labels();
+    $date_fields = array_intersect($field_options, array_keys(fullcalendar_date_fields($field_options)));
+
+    $form['fullcalendar_custom_title'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Use a custom event title.'),
+      '#default_value' => $this->options['fullcalendar_custom_title'],
     );
     $form['fullcalendar_title_field'] = array(
-      '#type' => 'textfield',
+      '#type' => 'select',
       '#title' => t('Title Field'),
+      '#options' => $field_options,
       '#default_value' => $this->options['fullcalendar_title_field'],
-      '#description' => t('The title of the event to be displayed. If blank, the node title will be used. For example: "field_event_title".'),
+      '#description' => t('Choose the field with the custom title.'),
+      '#process' => array('form_process_select', 'ctools_dependent_process'),
+      '#dependency' => array('edit-row-options-fullcalendar-custom-title' => array(1)),
+    );
+    $form['fullcalendar_custom_url'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Use a custom event redirect URL.'),
+      '#default_value' => $this->options['fullcalendar_custom_url'],
     );
     $form['fullcalendar_url_field'] = array(
-      '#type' => 'textfield',
+      '#type' => 'select',
       '#title' => t('URL Field'),
+      '#options' => $field_options,
       '#default_value' => $this->options['fullcalendar_url_field'],
-      '#description' => t('If the calendar items should not link directly to the node, enter the name of the cck field to use for the url instead. For example: "field_url".'),
+      '#description' => t('Choose the field with the custom link.'),
+      '#process' => array('form_process_select', 'ctools_dependent_process'),
+      '#dependency' => array('edit-row-options-fullcalendar-custom-url' => array(1)),
+    );
+    $form['fullcalendar_custom_date'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Use a custom date field.'),
+      '#default_value' => $this->options['fullcalendar_custom_date'],
+    );
+    $form['fullcalendar_date_fields'] = array(
+      '#type' => 'select',
+      '#title' => t('Date Fields'),
+      '#options' => $date_fields,
+      '#default_value' => $this->options['fullcalendar_date_fields'],
+      '#description' => t('Select one or more date fields.'),
+      '#multiple' => TRUE,
+      '#size' => count($date_fields),
+      '#process' => array('form_process_select', 'ctools_dependent_process'),
+      '#dependency' => array('edit-row-options-fullcalendar-custom-date' => array(1)),
     );
   }
 
   function render($row) {
-    return theme($this->theme_functions(),
-      array(
-        'view' => $this->view,
-        'options' => $this->options,
-        'row' => $row,
-        'field_alias' => $this->field_alias
-      )
-    );
+    return theme($this->theme_functions(), array(
+      'view' => $this->view,
+      'options' => $this->options,
+      'row' => $row,
+      'field_alias' => $this->field_alias,
+    ));
   }
 }
Index: views_plugin_style_fullcalendar.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fullcalendar/views_plugin_style_fullcalendar.inc,v
retrieving revision 1.5
diff -u -p -r1.5 views_plugin_style_fullcalendar.inc
--- views_plugin_style_fullcalendar.inc	23 Dec 2010 21:09:39 -0000	1.5
+++ views_plugin_style_fullcalendar.inc	26 Jan 2011 03:54:17 -0000
@@ -29,17 +29,16 @@ class views_plugin_style_fullcalendar ex
         'fc_right' => array('default' => 'month agendaWeek agendaDay'),
       ),
     );
-    $options['defaults'] = array(
-      'contains' => array(
-        'fc_year' => array('default' => ''),
-        'fc_month' => array('default' => ''),
-        'fc_day' => array('default' => ''),
-      ),
-    );
     $options['times'] = array(
       'contains' => array(
         'fc_timeformat' => array('default' => 'h:mm{ - h:mm}'),
         'fc_clock' => array('default' => FALSE),
+        'fc_default_date' => array('default' => FALSE),
+        'fc_date' => array('default' => array(
+          'year' => '',
+          'month' => '',
+          'day' => '',
+        )),
       ),
     );
     return $options;
@@ -49,7 +48,6 @@ class views_plugin_style_fullcalendar ex
     $form['display'] = array(
       '#type' => 'fieldset',
       '#title' => t('Display settings'),
-      '#description' => 'Blank values will use the current day, month, or year.',
       '#attributes' => array(
         'class' => 'clear-block',
       ),
@@ -64,20 +62,19 @@ class views_plugin_style_fullcalendar ex
         'agendaDay' => 'Day (Agenda)',
         'basicDay' => 'Day (Basic)',
       ),
+      '#description' => l(t('More info'), 'http://arshaw.com/fullcalendar/docs/views/Available_Views', array('attributes' => array('target' => '_blank'))),
       '#default_value' => $this->options['display']['fc_view'],
-      '#description' => l(t('Default timespan displayed.'), 'http://arshaw.com/fullcalendar/docs/views/Available_Views', array('attributes' => array('target' => '_blank'))),
       '#prefix' => '<div class="views-left-30">',
       '#suffix' => '</div>',
     );
     $form['display']['fc_firstday'] = array(
       '#type' => 'select',
-      '#title' => t('First day'),
+      '#title' => t('Week starts on'),
       '#options' => array(
-        '0' => 'Sunday',
-        '1' => 'Monday',
+        '0' => t('Sunday'),
+        '1' => t('Monday'),
       ),
       '#default_value' => $this->options['display']['fc_firstday'],
-      '#description' => l(t('The day each week begins.'), 'http://arshaw.com/fullcalendar/docs/display/firstDay', array('attributes' => array('target' => '_blank'))),
       '#prefix' => '<div class="views-left-30">',
       '#suffix' => '</div>',
     );
@@ -90,21 +87,21 @@ class views_plugin_style_fullcalendar ex
         'variable' => 'Variable',
       ),
       '#default_value' => $this->options['display']['fc_weekmode'],
-      '#description' => l(t('Number of weeks displayed.'), 'http://arshaw.com/fullcalendar/docs/display/weekMode', array('attributes' => array('target' => '_blank'))),
+      '#description' => l(t('More info'), 'http://arshaw.com/fullcalendar/docs/display/weekMode', array('attributes' => array('target' => '_blank'))),
       '#prefix' => '<div class="views-left-30">',
       '#suffix' => '</div>',
     );
     $form['header'] = array(
       '#type' => 'fieldset',
-      '#title' => t('Header elements'),
-      '#description' => l(t('Buttons and title to be shown in header.'), 'http://arshaw.com/fullcalendar/docs/display/header', array('attributes' => array('target' => '_blank'))),
+      '#title' => t('Header settings'),
+      '#description' => l(t('More info'), 'http://arshaw.com/fullcalendar/docs/display/header', array('attributes' => array('target' => '_blank'))),
       '#attributes' => array(
         'class' => 'clear-block',
       ),
     );
     $form['header']['fc_left'] = array(
       '#type' => 'textfield',
-      '#title' => t('Left header'),
+      '#title' => t('Left'),
       '#default_value' => $this->options['header']['fc_left'],
       '#prefix' => '<div class="views-left-30">',
       '#suffix' => '</div>',
@@ -112,7 +109,7 @@ class views_plugin_style_fullcalendar ex
     );
     $form['header']['fc_center'] = array(
       '#type' => 'textfield',
-      '#title' => t('Center header'),
+      '#title' => t('Center'),
       '#default_value' => $this->options['header']['fc_center'],
       '#prefix' => '<div class="views-left-30">',
       '#suffix' => '</div>',
@@ -120,51 +117,15 @@ class views_plugin_style_fullcalendar ex
     );
     $form['header']['fc_right'] = array(
       '#type' => 'textfield',
-      '#title' => t('Right header'),
+      '#title' => t('Right'),
       '#default_value' => $this->options['header']['fc_right'],
       '#prefix' => '<div class="views-left-40">',
       '#suffix' => '</div>',
       '#size' => '30',
     );
-    $form['defaults'] = array(
-      '#type' => 'fieldset',
-      '#title' => t('Default values'),
-      '#description' => 'Blank values will use the current day, month, or year.',
-      '#attributes' => array(
-        'class' => 'clear-block',
-      ),
-    );
-    $form['defaults']['fc_year'] = array(
-      '#type' => 'textfield',
-      '#title' => t('Year'),
-      '#default_value' => $this->options['defaults']['fc_year'],
-      '#description' => t('Full 4 digits.'),
-      '#prefix' => '<div class="views-left-30">',
-      '#suffix' => '</div>',
-      '#size' => '20',
-    );
-    $form['defaults']['fc_month'] = array(
-      '#type' => 'textfield',
-      '#title' => t('Month'),
-      '#default_value' => $this->options['defaults']['fc_month'],
-      '#description' => t('No leading zeros.'),
-      '#prefix' => '<div class="views-left-30">',
-      '#suffix' => '</div>',
-      '#size' => '20',
-    );
-    $form['defaults']['fc_day'] = array(
-      '#type' => 'textfield',
-      '#title' => t('Day'),
-      '#default_value' => $this->options['defaults']['fc_day'],
-      '#description' => t('No leading zeros.'),
-      '#prefix' => '<div class="views-left-30">',
-      '#suffix' => '</div>',
-      '#size' => '20',
-    );
     $form['times'] = array(
       '#type' => 'fieldset',
-      '#title' => t('Time display'),
-      '#description' => l(t('Formatting options for time.'), 'http://arshaw.com/fullcalendar/docs/utilities/formatDate', array('attributes' => array('target' => '_blank'))),
+      '#title' => t('Time/date settings'),
       '#attributes' => array(
         'class' => 'clear-block',
       ),
@@ -172,19 +133,32 @@ class views_plugin_style_fullcalendar ex
     $form['times']['fc_timeformat'] = array(
       '#type' => 'textfield',
       '#title' => t('Time format'),
+      '#description' => l(t('More info'), 'http://arshaw.com/fullcalendar/docs/utilities/formatDate', array('attributes' => array('target' => '_blank'))),
       '#default_value' => $this->options['times']['fc_timeformat'],
-      '#description' => 'Format of time display on each event.',
     );
     $form['times']['fc_clock'] = array(
       '#type' => 'checkbox',
       '#title' => t('Use 24 hour display'),
       '#default_value' => $this->options['times']['fc_clock'],
-      '#description' => 'Use 24 display (ignores custom time format).',
+    );
+    $form['times']['fc_default_date'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Use a custom default date'),
+      '#default_value' => $this->options['times']['fc_default_date'],
+    );
+    $form['times']['fc_date'] = array(
+      '#type' => 'date',
+      '#title' => t('Custom default date'),
+      '#default_value' => $this->options['times']['fc_date'],
+
+      '#prefix' => '<div id="edit-style-options-times-fc-date-wrapper"><div id="edit-style-options-times-fc-date">',
+      '#suffix' => '</div></div>',
+      '#process' => array('form_process_date', 'ctools_dependent_process'),
+      '#dependency' => array('edit-style-options-times-fc-default-date' => array(1)),
     );
     $form['modules'] = array(
       '#type' => 'fieldset',
-      '#title' => t('Module integration'),
-      '#description' => 'Settings for integration with other modules.',
+      '#title' => t('Visual settings'),
       '#attributes' => array(
         'class' => 'clear-block',
       ),
@@ -193,13 +167,13 @@ class views_plugin_style_fullcalendar ex
       '#type' => 'checkbox',
       '#title' => t('Use jQuery UI Theme'),
       '#default_value' => $this->options['modules']['fc_theme'],
-      '#description' => t('If checked, the calendar will use any loaded jQuery UI themes.'),
-    );
-    $form['modules']['fc_url_colorbox'] = array(
-      '#type' => 'checkbox',
-      '#title' => t('Open events in colorbox'),
-      '#default_value' => $this->options['modules']['fc_url_colorbox'],
-      '#description' => t('If checked, each event will open in colorbox (if it is installed).'),
     );
+    if (module_exists('colorbox')) {
+      $form['modules']['fc_url_colorbox'] = array(
+        '#type' => 'checkbox',
+        '#title' => t('Open events in colorbox'),
+        '#default_value' => $this->options['modules']['fc_url_colorbox'],
+      );
+    }
   }
 }
