diff --git fullcalendar.module fullcalendar.module index 10c0073..00e313f 100644 --- fullcalendar.module +++ fullcalendar.module @@ -30,6 +30,18 @@ * Implements hook_library(). */ function fullcalendar_library() { + + $dependencies = array( + array('system', 'ui.draggable'), + array('system', 'ui.droppable'), + array('system', 'ui.resizable'), + array('system', 'effects.highlight'), + ); + + if (module_exists('qtip')) { + array_push($dependencies, array('qtip', 'qtip')); + } + $libraries['fullcalendar'] = array( 'title' => 'FullCalendar', 'website' => 'http://arshaw.com/fullcalendar', @@ -47,12 +59,7 @@ 'media' => 'screen', ), ), - 'dependencies' => array( - array('system', 'ui.draggable'), - array('system', 'ui.droppable'), - array('system', 'ui.resizable'), - array('system', 'effects.highlight'), - ), + 'dependencies' => $dependencies, ); return $libraries; } @@ -224,6 +231,7 @@ 'todayString' => t('Today'), 'isRTL' => $language->direction, 'gcal' => $options['gcal'], + 'qtip' => $options['modules']['fc_qtip'], ), ); @@ -235,8 +243,8 @@ drupal_add_library('fullcalendar', 'fullcalendar'); drupal_add_js(array('fullcalendar' => $settings), 'setting'); + drupal_add_js(drupal_get_path('module', 'fullcalendar') . '/gcal.js'); drupal_add_js(drupal_get_path('module', 'fullcalendar') . '/fullcalendar.views.js'); - drupal_add_js(drupal_get_path('module', 'fullcalendar') . '/gcal.js'); } /** @@ -295,6 +303,9 @@ if (!empty($vars['options']['custom']['fc_date'])) { $date_fields = array_intersect_key($date_fields, $vars['options']['custom']['fc_date_field']); } + + $description_fields = array_intersect_key($fields, $vars['options']['custom']['fc_qtip_description_field']); + $entity->description = implode(" ", $description_fields); // Iterate through all available fields. foreach ($date_fields as $field) { @@ -350,6 +361,7 @@ 'entity_type' => $entity_type, 'cn' => $entity->class, 'title' => $entity->title, + 'description' => $entity->description, 'class' => array('fullcalendar-event-details'), 'editable' => $entity->editable, ); diff --git fullcalendar.views.js fullcalendar.views.js index 804b061..d66e8d4 100644 --- fullcalendar.views.js +++ fullcalendar.views.js @@ -81,6 +81,7 @@ eid: $(this).attr('eid'), entity_type: $(this).attr('entity_type'), title: $(this).attr('title'), + description: $(this).attr('description'), start: $(this).attr('start'), end: $(this).attr('end'), url: $(this).attr('href'), @@ -96,6 +97,31 @@ // Add events from Google Calendar feeds. $.fullCalendar.gcalFeedArray(settings.gcal) ], + eventRender: function(event, element) { + if (settings.qtip) { + element.qtip({ + content: { + title: { + text: event.title + }, + text: event.description + }, + position: { + corner: { + target: Drupal.settings.qtip.target_position, + tooltip: Drupal.settings.qtip.tooltip_position + } + }, + style: { + classes: Drupal.settings.qtip.color, + tip: { + corner: Drupal.settings.qtip.tooltip_position, + border: 5 + } + }, + }); + } + }, eventDrop: function(event, dayDelta, minuteDelta, allDay, revertFunc) { $.post(Drupal.settings.basePath + 'fullcalendar/ajax/update/drop/'+ event.eid, 'field=' + event.field + '&entity_type=' + event.entity_type + '&index=' + event.index + '&day_delta=' + dayDelta + '&minute_delta=' + minuteDelta + '&all_day=' + allDay + '&dom_id=' + event.dom_id, diff --git views_plugin_node_fullcalendar.inc views_plugin_node_fullcalendar.inc index f9a94fd..f66aee9 100644 --- views_plugin_node_fullcalendar.inc +++ views_plugin_node_fullcalendar.inc @@ -20,6 +20,7 @@ 'fc_title_field' => array('default' => ''), 'fc_url_field' => array('default' => ''), 'fc_date_field' => array('default' => ''), + 'fc_qtip_description_field' => array('default' => ''), 'fc_title' => array('default' => FALSE), 'fc_url' => array('default' => FALSE), 'fc_date' => array('default' => FALSE), @@ -85,6 +86,15 @@ '#process' => array('form_process_select', 'ctools_dependent_process'), '#dependency' => array('edit-row-options-custom-fc-date' => array(1)), ); + $form['custom']['fc_qtip_description_field'] = array( + '#type' => 'select', + '#title' => t('Description Fields'), + '#options' => $field_options, + '#default_value' => $this->options['custom']['fc_qtip_description_field'], + '#description' => t('Select the fields for the qTip message'), + '#multiple' => TRUE, + '#size' => count($field_options), + ); // Disable form elements when not needed. if (empty($field_options)) { diff --git views_plugin_style_fullcalendar.inc views_plugin_style_fullcalendar.inc index 404f5a2..9722979 100644 --- views_plugin_style_fullcalendar.inc +++ views_plugin_style_fullcalendar.inc @@ -23,6 +23,7 @@ 'fc_url_colorbox_class' => array('default' => '#content'), 'fc_url_colorbox_width' => array('default' => '80%'), 'fc_url_colorbox_height' => array('default' => '80%'), + 'fc_qtip' => array('default' => FALSE), 'fc_window' => array('default' => FALSE), ), ); @@ -49,6 +50,8 @@ } function options_form(&$form, &$form_state) { + $field_options = $this->display->handler->get_field_labels(); + $form['display'] = array( '#type' => 'fieldset', '#title' => t('Display settings'), @@ -199,6 +202,13 @@ '#process' => array('ctools_dependent_process'), '#dependency' => array('edit-style-options-modules-fc-url-colorbox' => array(1)), ); + } + if (module_exists('qtip')) { + $form['modules']['fc_qtip'] = array( + '#type' => 'checkbox', + '#title' => t('Show event information in a qTip'), + '#default_value' => $this->options['modules']['fc_qtip'], + ); } $form['modules']['fc_window'] = array( '#type' => 'checkbox',