Index: fullcalendar.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fullcalendar/fullcalendar.info,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 fullcalendar.info
--- fullcalendar.info	1 Dec 2010 13:36:17 -0000	1.1.2.1
+++ fullcalendar.info	16 Dec 2010 13:31:49 -0000
@@ -1,9 +1,14 @@
 ; $Id: fullcalendar.info,v 1.1.2.1 2010/12/01 13:36:17 timplunkett Exp $ 
 name = FullCalendar
 description = Provides a views style plugin for FullCalendar
-core = 6.x
+core = 7.x
 package = "Views"
 dependencies[] = views
 dependencies[] = date
-dependencies[] = jquery_ui
-dependencies[] = jquery_update
+
+files[] = fullcalendar.module
+files[] = fullcalendar.views.inc
+files[] = views-view-fullcalendar.tpl.php
+files[] = views-view-node-fullcalendar.tpl.php
+files[] = views_plugin_node_fullcalendar.inc
+files[] = views_plugin_style_fullcalendar.inc
Index: fullcalendar.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fullcalendar/fullcalendar.module,v
retrieving revision 1.1.2.4
diff -u -p -r1.1.2.4 fullcalendar.module
--- fullcalendar.module	15 Dec 2010 13:09:23 -0000	1.1.2.4
+++ fullcalendar.module	16 Dec 2010 13:31:50 -0000
@@ -7,7 +7,7 @@
  */
 
 /**
- * Implementation of hook_views_api().
+ * Implements hook_views_api().
  */
 function fullcalendar_views_api() {
   return array(
@@ -17,35 +17,36 @@ function fullcalendar_views_api() {
 }
 
 /**
- * Implementation of hook_init().
+ * Implements hook_init().
  */
 function fullcalendar_init() {
   $path = drupal_get_path('module', 'fullcalendar');
 
-  drupal_add_css($path . '/fullcalendar.css', 'module');
-  drupal_add_js($path . '/fullcalendar.js', 'module');
+  drupal_add_css($path . '/fullcalendar.css');
+  drupal_add_js($path . '/fullcalendar.js');
 
-  // We need some jQuery UI files.
-  $files = array(
-    'ui.draggable',
-    'ui.droppable',
-    'ui.resizable',
-    'effects.highlight',
-  );
-  jquery_ui_add($files);
+  drupal_add_library('system', 'ui.draggable');
+  drupal_add_library('system', 'ui.droppable');
+  drupal_add_library('system', 'ui.resizable');
+  drupal_add_library('system', 'effects.highlight');
 }
 
 /**
- * Implementation of hook_perm().
+ * Implements hook_permission().
  *
  * @return array An array of valid permissions for the fullcalendar module
  */
-function fullcalendar_perm() {
-  return array('update any fullcalendar event');
+function fullcalendar_permission() {
+  return array(
+    'update any fullcalendar event' => array(
+      'title' => t('Update any FullCalendar event'),
+      'description' => t('Allow user to edit events, ignoring other permissions.'),
+    ),
+  );
 }
 
 /**
- * Implementation of hook_menu().
+ * Implements hook_menu().
  *
  * @return An array of menu items.
  */
@@ -97,7 +98,7 @@ function fullcalendar_update($action, $n
     // Save the new start/end values.
     node_save($node);
 
-    drupal_json(array('msg' => 'The new event time has been saved. [<a href="javascript:void(0);" class="fullcalendar-status-close">close</a>]'));
+    drupal_json_output(array('msg' => 'The new event time has been saved. [<a href="javascript:void(0);" class="fullcalendar-status-close">close</a>]'));
   }
 }
 
@@ -107,12 +108,12 @@ function fullcalendar_update($action, $n
 //}
 
 /**
- * Implementation of hook_theme().
+ * Implements hook_theme().
  */
 function fullcalendar_theme() {
   return array(
     'fullcalendar_classname' => array(
-      'arguments' => array('node' => NULL),
+      'variables' => array('node' => NULL),
     ),
   );
 }
@@ -126,7 +127,8 @@ function fullcalendar_theme() {
  * @return
  *   A string suitable for use as a CSS class.
  */
-function theme_fullcalendar_classname($node) {
+function theme_fullcalendar_classname($variables) {
+  $node = $variables['node'];
   $className = array(
     'fc-event-default',
     $node->type,
@@ -136,6 +138,7 @@ function theme_fullcalendar_classname($n
 
 //Prepare variables for template file invoked for node row type
 function template_preprocess_views_view_node_fullcalendar(&$vars) {
+  $entity_type = 'node';
   $nid = $vars['row']->{$vars['field_alias']};
   if (!is_numeric($nid)) {
     return;
@@ -147,13 +150,13 @@ function template_preprocess_views_view_
 
   // Allow resize/drag/drop of an event if user has proper permissions.
   $vars['editable'] = _fullcalendar_update_access($node);
-  $vars['className'] = theme('fullcalendar_classname', $node);
+  $vars['className'] = theme('fullcalendar_classname', array('node' => $node));
   $vars['node'] = $node;
   $vars['data'] = array(); // Contains the start, end & allDay values.
   $index = 0; // Used to create $vars['data'] variable.
   if ($url = $vars['options']['fullcalendar_url_field']) {
-    if (isset($node->{$url}[0]['value'])) {
-      $vars['url'] = $node->{$url}[0]['value'];
+    if ($url = field_get_items('node', $node, $url)) {
+      $vars['url'] = $url[0]['value'];
     }
   }
   if (empty($vars['url'])) {
@@ -166,7 +169,7 @@ function template_preprocess_views_view_
     foreach (explode("\n", $field_names) as $field_name) {
       $field_name = trim(strip_tags($field_name));
       if (($field_name == 'created') || ($field_name == 'changed')) {
-        $vars['data'][$index] = _fullcalendar_set_display_times($node, $field_name);
+        $vars['data'][$index] = _fullcalendar_set_display_times($entity_type, $node, $field_name);
         $vars['data'][$index]['index'] = 0;
         return;
       }
@@ -179,8 +182,9 @@ function template_preprocess_views_view_
   }
   // Iterate through available fields, using the first one found.
   foreach ($display_field as $field_name => $field) {
-    foreach ($node->$field_name as $key => $item) {
-      $vars['data'][$index] = _fullcalendar_set_display_times($node, $field_name, $field, $item);
+    $instance = field_info_instance($entity_type, $field_name, $node->type);
+    foreach (field_get_items($entity_type, $node, $field_name) as $key => $item) {
+      $vars['data'][$index] = _fullcalendar_set_display_times($entity_type, $node, $field_name, $instance, $field, $item);
       $vars['data'][$index]['index'] = $key;
       $index++;
     }
@@ -197,27 +201,21 @@ function template_preprocess_views_view_
  * @param integer $index
  * @param array $vars
  */
-function _fullcalendar_set_display_times($node, $field_name, $field = NULL, $item = NULL) {
-  if (is_array($node->$field_name)) {
-    $dfp_info = array(
-      '#node' => $node,
-      '#field_name' => $field_name,
-      '#formatter' => NULL,
-      '#item' => $item,
-    );
-    $date = date_formatter_process($dfp_info);
+function _fullcalendar_set_display_times($entity_type, $entity, $field_name, $instance = NULL, $field = NULL, $item = NULL) {
+  if (is_array($entity->$field_name)) {
+    $date = date_formatter_process(NULL, $entity_type, $entity, $field, $instance, $entity->language, $item, NULL);
     $date1 = $date['value']['local']['object'];
     $date2 = $date['value2']['local']['object'];
   }
   else {
-    $date1 = date_make_date($node->$field_name, date_default_timezone(), DATE_UNIX);
+    $date1 = new DateObject($entity->$field_name, date_default_timezone(), DATE_FORMAT_UNIX);
     $date2 = $date1;
   }
   return array(
     'field' => $field_name,
-    'allDay' => date_field_all_day($field, $date1, $date2),
-    'start' => date_format($date1, DATE_FORMAT_DATETIME),
-    'end' => date_format($date2, DATE_FORMAT_DATETIME),
+    'allDay' => date_field_all_day($field, $instance, $date1, $date2),
+    'start' => $date1->format(DATE_FORMAT_DATETIME),
+    'end' => $date2->format(DATE_FORMAT_DATETIME),
     'start_formatted' => date_format_date($date1),
     'end_formatted' => date_format_date($date2),
   );
@@ -242,10 +240,23 @@ function _fullcalendar_update_access($no
   return FALSE;
 }
 
-function fullcalendar_date_fields($node) {
-  $type = content_types($node->type);
+/**
+ * Find all date fields in this instance.
+ *
+ * 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;
+  }
   $fields = array();
-  foreach ($type['fields'] as $field_name => $field) {
+  foreach (array_keys(field_info_instances($entity_type, $bundle)) as $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.1.2.1
diff -u -p -r1.1.2.1 fullcalendar.views.inc
--- fullcalendar.views.inc	2 Dec 2010 05:17:55 -0000	1.1.2.1
+++ fullcalendar.views.inc	16 Dec 2010 13:31:50 -0000
@@ -7,16 +7,19 @@
  */
 
 /**
- * Implementation of hook_views_plugins().
+ * Implements hook_views_plugins().
  */
 function fullcalendar_views_plugins() {
+  $path = drupal_get_path('module', 'fullcalendar');
   return array(
+    'module' => 'fullcalendar',
     'style' => array(
       'fullcalendar' => array(
       'title' => t('FullCalendar'),
       'help' => t('Displays items on a calendar.'),
       'handler' => 'views_plugin_style_fullcalendar',
       'theme' => 'views_view_fullcalendar',
+      'theme path' => $path,
       'uses row plugin' => TRUE,
       'uses options' => TRUE,
       'uses grouping' => TRUE,
@@ -25,16 +28,12 @@ function fullcalendar_views_plugins() {
       ),
     ),
     'row' => array(
-      'parent' => array(
-        'no ui' => TRUE,
-        'handler' => 'views_plugin_row',
-        'parent' => '',
-      ),
       'fullcalendar_node' => array(
         'title' => t('Node - 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 options' => TRUE,
         'type' => 'normal',
Index: views-view-fullcalendar.tpl.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fullcalendar/views-view-fullcalendar.tpl.php,v
retrieving revision 1.1.2.5
diff -u -p -r1.1.2.5 views-view-fullcalendar.tpl.php
--- views-view-fullcalendar.tpl.php	15 Dec 2010 13:05:17 -0000	1.1.2.5
+++ views-view-fullcalendar.tpl.php	16 Dec 2010 13:31:50 -0000
@@ -28,7 +28,10 @@
   ?>
 </div>
 <script type="text/javascript">
-Drupal.behaviors.fullCalendar = function(context) {
+(function($) {
+
+Drupal.behaviors.fullCalendar = {
+attach: function(context) {
   $('#fullcalendar-content').hide(); //hide the failover display
   $('#fullcalendar').fullCalendar({
     defaultView: '<?php echo $options['display']['fc_view']; ?>',
@@ -125,5 +128,8 @@ Drupal.behaviors.fullCalendar = function
 
   //trigger a window resize so that calendar will redraw itself as it loads funny in some browsers occasionally
   $(window).resize();
+}
 };
+
+})(jQuery);
 </script>
Index: views_plugin_node_fullcalendar.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fullcalendar/views_plugin_node_fullcalendar.inc,v
retrieving revision 1.1.2.2
diff -u -p -r1.1.2.2 views_plugin_node_fullcalendar.inc
--- views_plugin_node_fullcalendar.inc	2 Dec 2010 05:17:55 -0000	1.1.2.2
+++ views_plugin_node_fullcalendar.inc	16 Dec 2010 13:31:50 -0000
@@ -40,6 +40,13 @@ class views_plugin_node_fullcalendar ext
   }
 
   function render($row) {
-    return theme($this->theme_functions(), $this->view, $this->options, $row, $this->field_alias);
+    return theme($this->theme_functions(),
+      array(
+        'view' => $this->view,
+        'options' => $this->options,
+        'row' => $row,
+        'field_alias' => $this->field_alias
+      )
+    );
   }
 }
