From 1a1d853579721a0b2ae24c5829dabecd21c919da Mon Sep 17 00:00:00 2001 From: thomasb Date: Sun, 1 May 2011 20:09:56 +0000 Subject: Add jquery UI plugin with Roundcube default styles to be used in various plugins git-svn-id: https://svn.roundcube.net/trunk@4715 208e9e7b-5314-0410-a742-e7e81cd9613c --- plugins/jqueryui/jqueryui.php | 54 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 plugins/jqueryui/jqueryui.php (limited to 'plugins/jqueryui/jqueryui.php') diff --git a/plugins/jqueryui/jqueryui.php b/plugins/jqueryui/jqueryui.php new file mode 100644 index 000000000..d3f2519db --- /dev/null +++ b/plugins/jqueryui/jqueryui.php @@ -0,0 +1,54 @@ + + * @author Thomas Bruederli + */ +class jqueryui extends rcube_plugin +{ + public function init() + { + $version = '1.8.12'; + + $rcmail = rcmail::get_instance(); + $this->load_config(); + + // 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] : 'default'; + + 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/$ui_theme/jquery-ui-$version.custom.css"); + } + + // jquery UI localization + $jquery_ui_i18n = $rcmail->config->get('jquery_ui_i18n', array()); + 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"); + } + } + } + } + +} + +?> -- cgit v1.2.3