function jscalendar_load in Javascript Tools 5
Load needed files.
1 call to jscalendar_load()
- jscalendar_form_alter in jscalendar/
jscalendar.module - Implementation of hook_form_alter().
File
- jscalendar/
jscalendar.module, line 106 - Provide popup calendar.
Code
function jscalendar_load($lib_locale = NULL) {
global $locale;
static $loaded = FALSE;
if ($loaded) {
return;
}
// If the locale library hasn't been explicitly set, we look for support for the current locale.
if (empty($lib_locale)) {
// Supported directly.
if (in_array($locale, array(
'af',
'bg',
'ca',
'da',
'de',
'el',
'es',
'fi',
'fr',
'hu',
'id',
'is',
'it',
'ja',
'kn',
'ko',
'lt',
'nl',
'pl',
'ro',
'ru',
'sk',
'sv',
'tr',
))) {
$lib_locale = $locale;
}
else {
if ($locale == 'cs') {
$lib_locale = 'cs-utf8';
}
else {
if ($locale == 'he') {
$lib_locale = 'he-utf8';
}
else {
if ($locale == 'pt-br' || $locale == 'pt-pt') {
$lib_locale = 'pt';
}
else {
if ($locale == 'zh-hans' || $locale == 'zh-hant') {
$lib_locale = 'zh';
}
else {
$lib_locale = 'en';
}
}
}
}
}
}
$path = drupal_get_path('module', 'jscalendar');
drupal_add_js($path . '/lib/calendar_stripped.js');
drupal_add_js($path . '/lib/calendar-setup_stripped.js');
drupal_add_js($path . '/lib/lang/calendar-' . $lib_locale . '.js');
drupal_add_js($path . '/jscalendar.js');
drupal_add_css($path . '/jscalendar.css');
drupal_add_css(variable_get('jscalendar_css', $path . '/lib/skins/aqua/theme.css'));
$loaded = TRUE;
}