summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2012-01-01 12:25:11 +0000
committeralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2012-01-01 12:25:11 +0000
commitc362e59647f1461d900963acfa1069bd65ee3a02 (patch)
treee90bcf0e7c87dfcaacb2d34a2ac48d3e7b12e4a2
parent4515a9ad510aa6515cfe2e0a7b480ae03c735825 (diff)
- Move setting datepicker's date format to jqueryui plugin, PHPCS fix
git-svn-id: https://svn.roundcube.net/trunk@5677 208e9e7b-5314-0410-a742-e7e81cd9613c
-rw-r--r--plugins/jqueryui/jqueryui.php79
1 files changed, 46 insertions, 33 deletions
diff --git a/plugins/jqueryui/jqueryui.php b/plugins/jqueryui/jqueryui.php
index 22eb726ab..65fba344f 100644
--- a/plugins/jqueryui/jqueryui.php
+++ b/plugins/jqueryui/jqueryui.php
@@ -2,53 +2,66 @@
/**
* jQuery UI
- *
+ *
* Provide the jQuery UI library with according themes.
- *
+ *
* @version 1.8.14
* @author Cor Bosman <roundcube@wa.ter.net>
* @author Thomas Bruederli <roundcube@gmail.com>
*/
class jqueryui extends rcube_plugin
{
- public $noajax = true;
+ public $noajax = true;
- public function init()
- {
- $version = '1.8.14';
+ public function init()
+ {
+ $version = '1.8.14';
- $rcmail = rcmail::get_instance();
- $this->load_config();
+ $rcmail = rcmail::get_instance();
+ $this->load_config();
- // include UI scripts
- $this->include_script("js/jquery-ui-$version.custom.min.js");
+ // include UI scripts
+ $this->include_script("js/jquery-ui-$version.custom.min.js");
- // include UI stylesheet
- $skin = $rcmail->config->get('skin', 'default');
- $ui_map = $rcmail->config->get('jquery_ui_skin_map', array());
- $ui_theme = $ui_map[$skin] ? $ui_map[$skin] : $skin;
+ // include UI stylesheet
+ $skin = $rcmail->config->get('skin', 'default');
+ $ui_map = $rcmail->config->get('jquery_ui_skin_map', array());
+ $ui_theme = $ui_map[$skin] ? $ui_map[$skin] : $skin;
- if (file_exists($this->home . "/themes/$ui_theme/jquery-ui-$version.custom.css")) {
- $this->include_stylesheet("themes/$ui_theme/jquery-ui-$version.custom.css");
- }
- else {
- $this->include_stylesheet("themes/default/jquery-ui-$version.custom.css");
- }
-
- // jquery UI localization
- $jquery_ui_i18n = $rcmail->config->get('jquery_ui_i18n', array('datepicker'));
- if (count($jquery_ui_i18n) > 0) {
- $lang_l = str_replace('_', '-', substr($_SESSION['language'], 0, 5));
- $lang_s = substr($_SESSION['language'], 0, 2);
- foreach($jquery_ui_i18n as $package) {
- if (file_exists($this->home . "/js/i18n/jquery.ui.$package-$lang_l.js")) {
- $this->include_script("js/i18n/jquery.ui.$package-$lang_l.js");
+ if (file_exists($this->home . "/themes/$ui_theme/jquery-ui-$version.custom.css")) {
+ $this->include_stylesheet("themes/$ui_theme/jquery-ui-$version.custom.css");
}
- else if (file_exists($this->home . "/js/i18n/jquery.ui.$package-$lang_s.js")) {
- $this->include_script("js/i18n/jquery.ui.$package-$lang_s.js");
+ else {
+ $this->include_stylesheet("themes/default/jquery-ui-$version.custom.css");
}
- }
+
+ // jquery UI localization
+ $jquery_ui_i18n = $rcmail->config->get('jquery_ui_i18n', array('datepicker'));
+ if (count($jquery_ui_i18n) > 0) {
+ $lang_l = str_replace('_', '-', substr($_SESSION['language'], 0, 5));
+ $lang_s = substr($_SESSION['language'], 0, 2);
+ foreach ($jquery_ui_i18n as $package) {
+ if (file_exists($this->home . "/js/i18n/jquery.ui.$package-$lang_l.js")) {
+ $this->include_script("js/i18n/jquery.ui.$package-$lang_l.js");
+ }
+ else
+ if (file_exists($this->home . "/js/i18n/jquery.ui.$package-$lang_s.js")) {
+ $this->include_script("js/i18n/jquery.ui.$package-$lang_s.js");
+ }
+ }
+ }
+
+ // Date format for datepicker
+ $date_format = $rcmail->config->get('date_format', 'Y-m-d');
+ $date_format = strtr($date_format, array(
+ 'y' => 'y',
+ 'Y' => 'yy',
+ 'm' => 'mm',
+ 'n' => 'm',
+ 'd' => 'dd',
+ 'j' => 'd',
+ ));
+ $rcmail->output->set_env('date_format', $date_format);
}
- }
}