commit | author | age
|
48e9c1
|
1 |
<?php |
T |
2 |
|
|
3 |
/** |
|
4 |
* jQuery UI |
|
5 |
* |
|
6 |
* Provide the jQuery UI library with according themes. |
|
7 |
* |
|
8 |
* @version 1.8.18 |
|
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.18'; |
|
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 |
9f1652
|
27 |
$skin = $rcmail->config->get('skin'); |
48e9c1
|
28 |
$ui_map = $rcmail->config->get('jquery_ui_skin_map', array()); |
T |
29 |
$ui_theme = $ui_map[$skin] ? $ui_map[$skin] : $skin; |
|
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 { |
9f1652
|
35 |
$this->include_stylesheet("themes/larry/jquery-ui-$version.custom.css"); |
48e9c1
|
36 |
} |
T |
37 |
|
|
38 |
// jquery UI localization |
|
39 |
$jquery_ui_i18n = $rcmail->config->get('jquery_ui_i18n', array('datepicker')); |
|
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 |
|
48 |
if (file_exists($this->home . "/js/i18n/jquery.ui.$package-$lang_s.js")) { |
|
49 |
$this->include_script("js/i18n/jquery.ui.$package-$lang_s.js"); |
|
50 |
} |
|
51 |
} |
|
52 |
} |
|
53 |
|
|
54 |
// Date format for datepicker |
|
55 |
$date_format = $rcmail->config->get('date_format', 'Y-m-d'); |
|
56 |
$date_format = strtr($date_format, array( |
|
57 |
'y' => 'y', |
|
58 |
'Y' => 'yy', |
|
59 |
'm' => 'mm', |
|
60 |
'n' => 'm', |
|
61 |
'd' => 'dd', |
|
62 |
'j' => 'd', |
|
63 |
)); |
|
64 |
$rcmail->output->set_env('date_format', $date_format); |
|
65 |
} |
|
66 |
|
|
67 |
} |