Index: README.txt =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/fullcalendar/README.txt,v retrieving revision 1.1.2.2 diff -u -p -r1.1.2.2 README.txt --- README.txt 8 Dec 2010 14:24:21 -0000 1.1.2.2 +++ README.txt 27 Dec 2010 22:32:56 -0000 @@ -1,3 +1,8 @@ +This module requires the 3rd party library for FullCalendar located at +http://arshaw.com/fullcalendar. Download and unzip this library into the +sites/all/libraries/fullcalendar directory, or use the Libraries API module for +site specific libraries. + This version of FullCalendar requires specific versions of the following: The 6.x-2.x branch of jQuery Update (http://drupal.org/project/jquery_update) Version 1.7 of jQuery UI (http://drupal.org/project/jquery_ui) Index: fullcalendar.custom.css =================================================================== RCS file: fullcalendar.custom.css diff -N fullcalendar.custom.css --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ fullcalendar.custom.css 27 Dec 2010 22:32:56 -0000 @@ -0,0 +1,38 @@ +/* $Id: fullcalendar.css,v 1.1.2.2 2010/12/01 13:36:17 timplunkett Exp $ */ + +/* Undo Drupal default theme link colors */ +.fc-content a:link, +.fc-content a:visited { + color: #fff; + text-decoration: none; +} + +/* Reset FullCalendar generic style */ +.fc-event, +.fc-agenda .fc-event-time, +.fc-event a { + border-style: none; + background-color: transparent; + color: inherit; +} + +/* Set FullCalendar default style */ +.fc-event-default, +.fc-agenda .fc-event-default .fc-event-time, +.fc-event-default a { + border-color: #36c; + border-style: solid; + background-color: #36c; + color: #fff; +} + +/* Styling for updated message */ +#fullcalendar-status { + background: #ecf8f4; + border: 1px solid #fff; + color: #687; + display: none; + margin: 0 0 10px 0; + padding: 15px; + text-align: center; +} Index: fullcalendar.drush.inc =================================================================== RCS file: fullcalendar.drush.inc diff -N fullcalendar.drush.inc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ fullcalendar.drush.inc 27 Dec 2010 22:32:56 -0000 @@ -0,0 +1,99 @@ + dt("Downloads the FullCalendar plugin."), + 'arguments' => array( + 'path' => dt('Optional. A path where to install the FullCalendar plugin. If omitted Drush will use the default location.'), + ), + ); + + return $items; +} + +/** + * Implementation of hook_drush_help(). + */ +function fullcalendar_drush_help($section) { + switch ($section) { + case 'drush:fullcalendar-plugin': + return dt("Downloads the FullCalendar plugin from arshaw.com, default location is sites/all/libraries."); + } +} + +/** + * Command to download the FullCalendar plugin. + */ +function drush_fullcalendar_plugin($path = 'sites/all/libraries') { + if (!drush_shell_exec('type unzip')) { + return drush_set_error(dt('Missing dependency: unzip. Install it before using this command.')); + } + + // Create the path if it does not exist. + if (!is_dir($path)) { + drush_op('mkdir', $path); + drush_log(dt('Directory @path was created', array('@path' => $path)), 'notice'); + } + + // Set the directory to the download location. + $olddir = getcwd(); + chdir($path); + + $filename = basename(FULLCALENDAR_DOWNLOAD_URI); + $dirname = basename(FULLCALENDAR_DOWNLOAD_URI, '.zip'); + + // Remove any existing FullCalendar plugin directory + if (is_dir($dirname)) { + drush_log(dt('A existing FullCalendar plugin was overwritten at @path', array('@path' => $path)), 'notice'); + } + // Remove any existing FullCalendar plugin zip archive + if (is_file($filename)) { + drush_op('unlink', $filename); + } + + // Download the zip archive + if (!drush_shell_exec('wget '. FULLCALENDAR_DOWNLOAD_URI)) { + drush_shell_exec('curl -O '. FULLCALENDAR_DOWNLOAD_URI); + } + + if (is_file($filename)) { + // Decompress the zip archive + drush_shell_exec('unzip -qq -o '. $filename); + // Remove the zip archive + drush_op('unlink', $filename); + if (is_dir('fullcalendar')) { + drush_shell_exec('rm -rf fullcalendar'); + } + drush_shell_exec('mv ' . $dirname . '/fullcalendar fullcalendar'); + drush_shell_exec('rm -rf ' . $dirname); + } + + // Set working directory back to the previous working directory. + chdir($olddir); + + if (is_dir($path .'/fullcalendar')) { + drush_log(dt('FullCalendar plugin has been downloaded to @path', array('@path' => $path)), 'success'); + } + else { + drush_log(dt('Drush was unable to download the FullCalendar plugin to @path', array('@path' => $path)), 'error'); + } +} + Index: fullcalendar.install =================================================================== RCS file: fullcalendar.install diff -N fullcalendar.install --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ fullcalendar.install 27 Dec 2010 22:32:56 -0000 @@ -0,0 +1,55 @@ + $t('FullCalendar required jQuery version'), + 'value' => $t('Between @a and @b', array('@a' => FULLCALENDAR_MIN_JQUERY_VERSION, '@b' => FULLCALENDAR_MAX_JQUERY_VERSION)), + 'severity' => REQUIREMENT_ERROR, + 'description' => $t('You need to download and install a 6.x-2.x version of the !jquery_update module.', array('!jquery_update' => l(t('jQuery Update'), 'http://drupal.org/project/jquery_update'))), + ); + } + + if (!$status['jqueryui_version']) { + $requirements['fullcalendar_jqueryui_version'] = array( + 'title' => $t('FullCalendar required jQuery UI version'), + 'value' => $t('Between @a and @b', array('@a' => FULLCALENDAR_MIN_JQUERYUI_VERSION, '@b' => FULLCALENDAR_MAX_JQUERYUI_VERSION)), + 'severity' => REQUIREMENT_ERROR, + 'description' => $t('You need to download and install a 6.x-1.x version of the !jquery_ui module.', array('!jquery_ui' => l(t('jQuery UI'), 'http://drupal.org/project/jquery_ui'))), + ); + } + + if (!$status['fullcalendar_plugin']) { + $requirements['fullcalendar_plugin'] = array( + 'title' => $t('FullCalendar plugin'), + 'value' => $t('At least @a', array('@a' => FULLCALENDAR_MIN_PLUGIN_VERSION)), + 'severity' => REQUIREMENT_ERROR, + 'description' => $t('You need to download the !fullcalendar and extract the entire contents of the archive into the %path folder of your server.', array('!fullcalendar' => l(t('FullCalendar plugin'), 'http://arshaw.com/fullcalendar/download'), '%path' => 'sites/all/libraries')), + ); + } + else { + $requirements['fullcalendar_plugin'] = array( + 'title' => $t('FullCalendar plugin'), + 'severity' => REQUIREMENT_OK, + 'value' => fullcalendar_get_version(), + ); + } + } + + return $requirements; +} Index: fullcalendar.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/fullcalendar/fullcalendar.module,v retrieving revision 1.1.2.6 diff -u -p -r1.1.2.6 fullcalendar.module --- fullcalendar.module 20 Dec 2010 22:29:56 -0000 1.1.2.6 +++ fullcalendar.module 27 Dec 2010 22:32:56 -0000 @@ -7,6 +7,16 @@ */ /** + * The default path to the FullCalender plugin. + */ +define('FULLCALENDAR_PATH', 'sites/all/libraries/fullcalendar'); +define('FULLCALENDAR_MIN_PLUGIN_VERSION', '1.4.9'); +define('FULLCALENDAR_MIN_JQUERY_VERSION', '1.3.2'); +define('FULLCALENDAR_MAX_JQUERY_VERSION', '1.4+'); +define('FULLCALENDAR_MIN_JQUERYUI_VERSION', '1.7.3'); +define('FULLCALENDAR_MAX_JQUERYUI_VERSION', '1.8+'); + +/** * Implementation of hook_views_api(). */ function fullcalendar_views_api() { @@ -20,10 +30,9 @@ function fullcalendar_views_api() { * Implementation of 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_js(fullcalendar_get_path()); + drupal_add_css(FULLCALENDAR_PATH . '/fullcalendar.css'); + drupal_add_css(drupal_get_path('module', 'fullcalendar') . '/fullcalendar.custom.css'); // We need some jQuery UI files. $files = array( @@ -303,3 +312,67 @@ function fullcalendar_date_fields($node) } return $fields; } + +/** + * Check Colorbox dependencies, jQuery version and Colorbox plugin. + * + * @return + * array with TRUE/FALSE for each dependency. + * + * @see fullcalendar_requirements() + */ +function _fullcalendar_status() { + $status = array(); + $status['jquery_version'] = FALSE; + $status['fullcalendar_plugin'] = FALSE; + + if (function_exists('jquery_update_get_version')) { + if (version_compare(jquery_update_get_version(), FULLCALENDAR_MIN_JQUERY_VERSION, '>=')) { + $status['jquery_version'] = TRUE; + } + } + if (function_exists('jquery_ui_get_version')) { + if (version_compare(jquery_ui_get_version(), FULLCALENDAR_MIN_JQUERYUI_VERSION, '>=')) { + $status['jqueryui_version'] = TRUE; + } + } + + if (version_compare(fullcalendar_get_version(), FULLCALENDAR_MIN_PLUGIN_VERSION, '>=')) { + $status['fullcalendar_plugin'] = TRUE; + } + + return $status; +} + +/** + * Return the version of Colorbox plugin that is installed. + * + * This can be used by other modules' hook_requirements() to ensure that the + * proper version of Colorbox plugin is installed. + * + * @see version_compare + */ +function fullcalendar_get_version($fullcalendar_path = NULL) { + $version = 0; + $pattern = '#FullCalendar v([0-9\.a-z]+)#'; + + // No file is passed in so use the default location. + if (is_null($fullcalendar_path)) { + $fullcalendar_path = fullcalendar_get_path(); + } + + // Return the version of Colorbox plugin. + $fullcalendar_plugin = file_get_contents($fullcalendar_path, NULL, NULL, 0, 40); + if (preg_match($pattern, $fullcalendar_plugin, $matches)) { + $version = $matches[1]; + } + + return $version; +} + +/** + * Return the path to the Colorbox plugin. + */ +function fullcalendar_get_path() { + return FULLCALENDAR_PATH . '/fullcalendar.js'; +}