| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | /** |
|---|
| 4 | * jQuery UI |
|---|
| 5 | * |
|---|
| 6 | * Provide the jQuery UI library with according themes. |
|---|
| 7 | * |
|---|
| 8 | * @version 1.8.12 |
|---|
| 9 | * @author Cor Bosman <roundcube@wa.ter.net> |
|---|
| 10 | * @author Thomas Bruederli <roundcube@gmail.com> |
|---|
| 11 | */ |
|---|
| 12 | class jqueryui extends rcube_plugin |
|---|
| 13 | { |
|---|
| 14 | public $noajax = true; |
|---|
| 15 | |
|---|
| 16 | public function init() |
|---|
| 17 | { |
|---|
| 18 | $version = '1.8.14'; |
|---|
| 19 | |
|---|
| 20 | $rcmail = rcmail::get_instance(); |
|---|
| 21 | $this->load_config(); |
|---|
| 22 | |
|---|
| 23 | // include UI scripts |
|---|
| 24 | $this->include_script("js/jquery-ui-$version.custom.min.js"); |
|---|
| 25 | |
|---|
| 26 | // include UI stylesheet |
|---|
| 27 | $skin = $rcmail->config->get('skin', 'default'); |
|---|
| 28 | $ui_map = $rcmail->config->get('jquery_ui_skin_map', array()); |
|---|
| 29 | $ui_theme = $ui_map[$skin] ? $ui_map[$skin] : 'default'; |
|---|
| 30 | |
|---|
| 31 | if (file_exists($this->home . "/themes/$ui_theme/jquery-ui-$version.custom.css")) { |
|---|
| 32 | $this->include_stylesheet("themes/$ui_theme/jquery-ui-$version.custom.css"); |
|---|
| 33 | } |
|---|
| 34 | else { |
|---|
| 35 | $this->include_stylesheet("themes/default/jquery-ui-$version.custom.css"); |
|---|
| 36 | } |
|---|
| 37 | |
|---|
| 38 | // jquery UI localization |
|---|
| 39 | $jquery_ui_i18n = $rcmail->config->get('jquery_ui_i18n', array()); |
|---|
| 40 | if (count($jquery_ui_i18n) > 0) { |
|---|
| 41 | $lang_l = str_replace('_', '-', substr($_SESSION['language'], 0, 5)); |
|---|
| 42 | $lang_s = substr($_SESSION['language'], 0, 2); |
|---|
| 43 | foreach($jquery_ui_i18n as $package) { |
|---|
| 44 | if (file_exists($this->home . "/js/i18n/jquery.ui.$package-$lang_l.js")) { |
|---|
| 45 | $this->include_script("js/i18n/jquery.ui.$package-$lang_l.js"); |
|---|
| 46 | } |
|---|
| 47 | else if (file_exists($this->home . "/js/i18n/jquery.ui.$package-$lang_s.js")) { |
|---|
| 48 | $this->include_script("js/i18n/jquery.ui.$package-$lang_s.js"); |
|---|
| 49 | } |
|---|
| 50 | } |
|---|
| 51 | } |
|---|
| 52 | } |
|---|
| 53 | |
|---|
| 54 | } |
|---|