Created
May 16, 2011 17:12
-
-
Save afternoon/974872 to your computer and use it in GitHub Desktop.
Remove requirement for jquery_ui module from date_popup in Drupal date module (make sure you drupal_add_js("jquery-ui.min.js"))
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git date_popup/date_popup.module date_popup/date_popup.module | |
index 513aace..6111004 100644 | |
--- date_popup/date_popup.module | |
+++ date_popup/date_popup.module | |
@@ -29,9 +29,6 @@ function date_popup_load() { | |
return; | |
} | |
$path = drupal_get_path('module', 'date_popup'); | |
- if (module_exists('jquery_ui')) { | |
- jquery_ui_add('ui.datepicker'); | |
- } | |
if (variable_get('date_popup_timepicker', 'default') == 'default') { | |
drupal_add_js($path .'/lib/jquery.timeentry.pack.js'); | |
} | |
@@ -39,36 +36,12 @@ function date_popup_load() { | |
} | |
function date_popup_css_default() { | |
- if (!module_exists('jquery_ui')) { | |
- return ''; | |
- } | |
- $version = jquery_ui_get_version(); | |
- $jquery_ui_path = drupal_get_path('module', 'jquery_ui'); | |
- switch ($version) { | |
- case '1.6': | |
- return drupal_get_path('module', 'date_popup') .'/themes/datepicker.css'; | |
- default: | |
- return drupal_get_path('module', 'date_popup') .'/themes/datepicker.1.7.css'; | |
- } | |
+ return drupal_get_path('module', 'date_popup') .'/themes/datepicker.1.7.css'; | |
} | |
function date_popup_css_options() { | |
$paths = array(); | |
- if (!module_exists('jquery_ui')) { | |
- return $paths; | |
- } | |
- $version = jquery_ui_get_version(); | |
- $jquery_ui_path = drupal_get_path('module', 'jquery_ui'); | |
- switch ($version) { | |
- case '1.6': | |
- $paths[drupal_get_path('module', 'date_popup') .'/themes/datepicker.css'] = t('Date Popup default'); | |
- $paths[$jquery_ui_path .'/jquery.ui/themes/default/ui.datepicker.css'] = t('jQuery UI default'); | |
- break; | |
- default: | |
- $paths[drupal_get_path('module', 'date_popup') .'/themes/datepicker.1.7.css'] = t('Date Popup default'); | |
- $paths[$jquery_ui_path .'/jquery.ui/themes/base/ui.datepicker.css'] = t('jQuery UI default'); | |
- break; | |
- } | |
+ $paths[drupal_get_path('module', 'date_popup') .'/themes/datepicker.1.7.css'] = t('Date Popup default'); | |
return $paths; | |
} | |
@@ -77,10 +50,6 @@ function date_popup_css_options() { | |
*/ | |
function date_popup_init() { | |
global $user; | |
- if (!module_exists('jquery_ui') && $user->uid == 1) { | |
- drupal_set_message(t('The Date Popup module now requires the <a href="@link">jQuery UI module</a> as a source for the datepicker. Please install it immediately.', array('@link' => 'http://drupal.org/project/jquery_ui')), 'error'); | |
- return; | |
- } | |
drupal_add_css(variable_get('date_popup_css_file', date_popup_css_default())); | |
@@ -126,7 +95,7 @@ function date_popup_js_settings_id($id, $func, $settings) { | |
// The 1.7 version of datepicker renders the range of year options | |
// relative to the drawn year in the popup, and will re-render the options | |
// whenever the year changes. | |
- if (strpos(jquery_ui_get_version(), '1.7') === 0 && ($parts[0] >= 0 || 0 >= $parts[1])) { | |
+ if ($parts[0] >= 0 || 0 >= $parts[1]) { | |
$range = max($parts) - min($parts); | |
$defaultDate = $parts[0]; | |
$settings['yearRange'] = '-' . $range . ':' . '+' . $range; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment