? fc_full_entity_support_v1.patch
? fullcalendar_people_fix.patch
? fullcalendar_people_fix_version4.patch
? man.exe.stackdump
Index: fullcalendar.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fullcalendar/fullcalendar.module,v
retrieving revision 1.10.2.6
diff -u -p -r1.10.2.6 fullcalendar.module
--- fullcalendar.module	30 Jan 2011 22:11:32 -0000	1.10.2.6
+++ fullcalendar.module	2 Feb 2011 02:27:50 -0000
@@ -97,7 +97,7 @@ function fullcalendar_menu() {
     'page arguments' => array('fullcalendar_admin_settings'),
     'access arguments' => array('administer site configuration'),
   );
-  $items['fullcalendar/ajax/update/%/%node'] = array(
+  $items['fullcalendar/ajax/update/%/%'] = array(
     'title' => 'Update event',
     'description' => 'Save the updated event datetime.',
     'page callback' => 'fullcalendar_update',
@@ -118,33 +118,44 @@ function fullcalendar_menu() {
  * @param $node
  *   The node that will be updated.
  */
-function fullcalendar_update($action, $node) {
+function fullcalendar_update($action, $entityid) {
   // Retrieve the post vars form the ajax call.
   $field = $_POST['field'];
   $index = $_POST['index'];
   $all_day = isset($_POST['all_day']) ? $_POST['all_day'] : '';
   $day_delta = $_POST['day_delta'];
   $minute_delta = $_POST['minute_delta'];
+  $entity_type = $_POST['entitytype'];
+  
+  $entity = entity_load_unchanged($entity_type,$entityid);
+  
+  $langcode = field_language($entity_type, $entity, $field);
+  $date = $entity->{$field}[$langcode][$index];
 
   if (!empty($field) && isset($index)) {
-    $langcode = field_language('node', $node, $field);
-    $old_start = $node->{$field}[$langcode][$index]['value'];
-    $old_end = $node->{$field}[$langcode][$index]['value2'];
-
+    
+    $old_start = $entity->{$field}[$langcode][$index]['value'];
+    $old_end = $entity->{$field}[$langcode][$index]['value2'];
+    
+    $newstart = date('Y-m-d H:i:s', strtotime($old_start . ' ' . $day_delta . ' days ' . $minute_delta . ' minutes'));
+    $newend = date('Y-m-d H:i:s', strtotime($old_end . ' ' . $day_delta . ' days ' . $minute_delta . ' minutes'));
+    
     switch ($action) {
       case 'drop':
-        $node->{$field}[$langcode][$index]['value'] = date('Y-m-d H:i:s', strtotime($old_start . ' ' . $day_delta . ' days ' . $minute_delta . ' minutes'));
-        $node->{$field}[$langcode][$index]['value2'] = date('Y-m-d H:i:s', strtotime($old_end . ' ' . $day_delta . ' days ' . $minute_delta . ' minutes'));
+        $date['value'] = $newstart;
+        $date['value2'] = $newend;
         break;
       case 'resize':
-        $node->{$field}[$langcode][$index]['value2'] = date('Y-m-d H:i:s', strtotime($old_end . ' ' . $day_delta . ' days ' . $minute_delta . ' minutes'));
+        $date['value2'] = $newend;
         break;
     }
-
-    // Save the new start/end values.
-    node_save($node);
-
-    drupal_json_output(array('msg' => 'The new event time has been saved. [<a href="javascript:void(0);" class="fullcalendar-status-close">close</a>]'));
+    
+    $entity->{$field}[$langcode][$index] = $date;
+    entity_save($entity_type, $entity);
+
+    drupal_json_output(array('msg' => 'The event as been updated. [<a href="javascript:void(0);" class="fullcalendar-status-close">close</a>]', 'type' => "success"));
+  }else{
+    drupal_json_output(array('msg' => 'Event has not been updated. [<a href="javascript:void(0);" class="fullcalendar-status-close">close</a>]', 'type' => 'error'));
   }
 }
 
@@ -179,7 +190,7 @@ function theme_fullcalendar_classname($v
   $entity = $variables['entity'];
   $className = array(
     'fc-event-default',
-    $entity->type,
+    $entity->bundle,
   );
   return implode(' ', $className);
 }
@@ -231,6 +242,7 @@ function template_preprocess_views_view_
  * Prepares variables for template file invoked for node row type.
  */
 function template_preprocess_views_view_node_fullcalendar(&$vars) {
+
   // If the view has no availble nodes, exit.
   if (isset($vars['view']->empty_text)) {
     $vars['empty_text'] = $vars['view']->empty_text;
@@ -240,33 +252,55 @@ function template_preprocess_views_view_
   // Fetch the available fields in this view.
   $fields = $vars['view']->display_handler->get_field_labels();
 
-  // Check if the entity is empty.
-  $entity = $vars['row']->_field_data[$vars['field_alias']]['entity'];
-  if (empty($entity)) {
+  // Check if we have field data.
+  if (!isset($vars['row']->_field_data)) {
      return;
    }
 
+  // Check if the entity is empty.
+  $entity = $vars['row']->_field_data[$vars['view']->base_field]['entity'];
+
   $vars['data'] = array(); // Contains the start, end & allDay values.
 
-  $entity_type = $vars['row']->_field_data[$vars['field_alias']]['entity_type'];
+  $entity->id = $vars['row']->{$vars['view']->base_field};
+  $entity_type = $vars['row']->_field_data[$vars['view']->base_field]['entity_type'];
   $entity->editable = _fullcalendar_update_access($entity);
+
+  list(, , $bundle) = entity_extract_ids($entity_type, $entity);
+  $entity->bundle = $bundle;
   $entity->class = theme('fullcalendar_classname', array('entity' => $entity));
+  $entity->entity_type = $entity_type;
 
   // Default URL.
-  $entity->url = 'node/' . $vars['row']->{$vars['field_alias']};
+  $entity->url = $entity_type . '/' . $vars['row']->{$vars['view']->base_field};
   // Fetch custom URL if needed.
   if (!empty($vars['options']['custom']['fc_url'])) {
-    $url_field = field_get_items($entity_type, $entity, $fields[$vars['options']['custom']['fc_url_field']]);
-    if (!empty($url_field[0]['value'])) {
-      $entity->url = $url_field[0]['value'];
+    $field_name = $vars['options']['custom']['fc_url_field'];
+    if (!empty($entity->$field_name)) {
+      $entity->url = $entity->$field_name;
+    }
+    else {
+      $url_field = field_get_items($entity_type, $entity, $fields[$field_name]);
+      if (!empty($url_field[0]['value'])) {
+        $entity->url = $url_field[0]['value'];
+      }
     }
   }
 
   // Fetch custom title if needed.
+  if (!isset($entity->title)) {
+    $entity->title = '';
+  }
   if (!empty($vars['options']['custom']['fc_title'])) {
-    $title_field = field_get_items($entity_type, $entity, $fields[$vars['options']['custom']['fc_title_field']]);
-    if (!empty($title_field[0]['value'])) {
-      $entity->title = $title_field[0]['value'];
+    $field_name = $vars['options']['custom']['fc_title_field'];
+    if (!empty($entity->$field_name)) {
+      $entity->title = $entity->$field_name;
+    }
+    else {
+      $title_field = field_get_items($entity_type, $entity, $fields[$field_name]);
+      if (!empty($title_field[0]['value'])) {
+        $entity->title = $title_field[0]['value'];
+      }
     }
   }
 
@@ -280,7 +314,7 @@ function template_preprocess_views_view_
 
   // Iterate through all available fields.
   foreach (fullcalendar_date_fields($fields) as $field_name => $field) {
-    $instance = field_info_instance($entity_type, $field_name, $entity->type);
+    $instance = field_info_instance($entity_type, $field_name, $bundle);
     $items = field_get_items($entity_type, $entity, $field_name);
     // Filter fields without value.
     if (!empty($items)) {
@@ -328,11 +362,13 @@ function _fullcalendar_set_display_times
     'allDay' => date_field_all_day($field, $instance, $date1, $date2),
     'start' => $date1,
     'end' => $date2,
-    'nid' => $entity->nid,
+    'id' => $entity->id,
+    'bundle' => $entity->bundle,
     'cn' => $entity->class,
     'title' => $entity->title,
     'class' => 'fullcalendar_event_details',
     'editable' => $entity->editable,
+    'entity_type' => $entity->entity_type,
   );
 }
 
@@ -370,8 +406,8 @@ function _fullcalendar_update_access($en
 
   if (!empty($entity) && (user_access('administer content')
       || user_access('update any fullcalendar event')
-      || user_access('edit any ' . $entity->type . ' content')
-      || (user_access('edit own ' . $entity->type . ' content') && $entity->uid == $user->uid))) {
+      || user_access('edit any ' . $entity->bundle . ' content')
+      || (user_access('edit own ' . $entity->bundle . ' content') && $entity->uid == $user->uid))) {
         return TRUE;
   }
 
Index: fullcalendar.views.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fullcalendar/fullcalendar.views.js,v
retrieving revision 1.4.2.2
diff -u -p -r1.4.2.2 fullcalendar.views.js
--- fullcalendar.views.js	30 Jan 2011 22:11:32 -0000	1.4.2.2
+++ fullcalendar.views.js	2 Feb 2011 02:27:50 -0000
@@ -62,14 +62,17 @@ attach: function(context) {
           events.push({
             field: $(this).attr('field'),
             index: $(this).attr('index'),
-            nid: $(this).attr('nid'),
+            id: $(this).attr('id')+'-'+$(this).attr('index'), //must be unique for multiple values wth different index of same entity id
+            entityid:$(this).attr('id'),
+            bundle: $(this).attr('bundle'),
             title: $(this).attr('title'),
             start: $(this).attr('start'),
             end: $(this).attr('end'),
             url: $(this).attr('href'),
             allDay: ($(this).attr('allDay') === '1'),
             className: $(this).attr('cn'),
-            editable: $(this).attr('editable')
+            editable: $(this).attr('editable'),
+            entitytype: $(this).attr('entity_type'),
           });
         });
       });
@@ -77,24 +80,31 @@ attach: function(context) {
       callback(events);
     },
     eventDrop: function(event, dayDelta, minuteDelta, allDay, revertFunc) {
-      $.post(Drupal.settings.basePath + 'fullcalendar/ajax/update/drop/'+ event.nid,
-        'field=' + event.field + '&index=' + event.index + '&day_delta=' + dayDelta + '&minute_delta=' + minuteDelta + '&all_day=' + allDay,
+      $.post(Drupal.settings.basePath + 'fullcalendar/ajax/update/drop/'+ event.entityid,
+        'field=' + event.field + '&entitytype=' + event.entitytype + '&bundle=' + event.bundle + '&index=' + event.index + '&day_delta=' + dayDelta + '&minute_delta=' + minuteDelta + '&all_day=' + allDay,
         fullcalendarUpdate);
       return false;
     },
     eventResize: function(event, dayDelta, minuteDelta, revertFunc) {
-      $.post(Drupal.settings.basePath + 'fullcalendar/ajax/update/resize/'+ event.nid,
-        'field=' + event.field + '&index=' + event.index + '&day_delta=' + dayDelta + '&minute_delta=' + minuteDelta,
+      $.post(Drupal.settings.basePath + 'fullcalendar/ajax/update/resize/'+ event.entityid,
+        'field=' + event.field + '&entitytype=' + event.entitytype + '&bundle=' + event.bundle + '&index=' + event.index + '&day_delta=' + dayDelta + '&minute_delta=' + minuteDelta,
         fullcalendarUpdate);
       return false;
     }
   });
 
   var fullcalendarUpdate = function(result) {
+    var msg = (result.msg)?result.msg:result;
+    if(result.msg && result.type){
+      $('#fullcalendar-status').addClass(result.type);
+    }else{
+      $('#fullcalendar-status').removeClass();
+    }
+    
     if ($('#fullcalendar-status').text() === '') {
-      $('#fullcalendar-status').html(result.msg).slideDown();
+      $('#fullcalendar-status').html(msg).slideDown();
     } else {
-      $('#fullcalendar-status').html(result.msg).effect('highlight', {}, 5000);
+      $('#fullcalendar-status').html(msg).effect('highlight', {}, 5000);
     }
     return false;
   };
Index: views_plugin_node_fullcalendar.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fullcalendar/views_plugin_node_fullcalendar.inc,v
retrieving revision 1.5.2.3
diff -u -p -r1.5.2.3 views_plugin_node_fullcalendar.inc
--- views_plugin_node_fullcalendar.inc	27 Jan 2011 21:15:35 -0000	1.5.2.3
+++ views_plugin_node_fullcalendar.inc	2 Feb 2011 02:27:50 -0000
@@ -12,9 +12,6 @@
  * Most of the code on this object is in the theme function.
  */
 class views_plugin_node_fullcalendar extends views_plugin_row {
-  // Basic properties that let the row style follow relationships.
-  var $base_table = 'node';
-  var $base_field = 'nid';
 
   function option_definition() {
     $options = parent::option_definition();
@@ -95,7 +92,6 @@ class views_plugin_node_fullcalendar ext
       'view' => $this->view,
       'options' => $this->options,
       'row' => $row,
-      'field_alias' => $this->field_alias,
     ));
   }
 }
