Mercurial > hg > rc2
comparison plugins/jqueryui/jqueryui.php @ 8:bf99236cc5cd default tip
try to recover from upgrade fail
author | Charlie Root |
---|---|
date | Sat, 29 Dec 2018 07:07:34 -0500 |
parents | 4681f974d28b |
children |
comparison
equal
deleted
inserted
replaced
7:65fd7d441cf1 | 8:bf99236cc5cd |
---|---|
3 /** | 3 /** |
4 * jQuery UI | 4 * jQuery UI |
5 * | 5 * |
6 * Provide the jQuery UI library with according themes. | 6 * Provide the jQuery UI library with according themes. |
7 * | 7 * |
8 * @version 1.10.4 | 8 * @version 1.12.0 |
9 * @author Cor Bosman <roundcube@wa.ter.net> | 9 * @author Cor Bosman <roundcube@wa.ter.net> |
10 * @author Thomas Bruederli <roundcube@gmail.com> | 10 * @author Thomas Bruederli <roundcube@gmail.com> |
11 * @author Aleksander Machniak <alec@alec.pl> | |
11 * @license GNU GPLv3+ | 12 * @license GNU GPLv3+ |
12 */ | 13 */ |
13 class jqueryui extends rcube_plugin | 14 class jqueryui extends rcube_plugin |
14 { | 15 { |
15 public $noajax = true; | 16 public $noajax = true; |
16 public $version = '1.10.4'; | 17 public $version = '1.12.0'; |
17 | 18 |
18 private static $features = array(); | 19 private static $features = array(); |
19 private static $ui_theme; | 20 private static $ui_theme; |
20 | 21 |
21 public function init() | 22 public function init() |
22 { | 23 { |
23 $rcmail = rcmail::get_instance(); | 24 $rcmail = rcmail::get_instance(); |
25 | |
26 // the plugin might have been force-loaded so do some sanity check first | |
27 if ($rcmail->output->type != 'html' || self::$ui_theme) { | |
28 return; | |
29 } | |
30 | |
24 $this->load_config(); | 31 $this->load_config(); |
25 | 32 |
26 // include UI scripts | 33 // include UI scripts |
27 $this->include_script("js/jquery-ui-$this->version.custom.min.js"); | 34 $this->include_script("js/jquery-ui.min.js"); |
28 | 35 |
29 // include UI stylesheet | 36 // include UI stylesheet |
30 $skin = $rcmail->config->get('skin'); | 37 $skin = $rcmail->config->get('skin'); |
31 $ui_map = $rcmail->config->get('jquery_ui_skin_map', array()); | 38 $ui_map = $rcmail->config->get('jquery_ui_skin_map', array()); |
32 $ui_theme = $ui_map[$skin] ?: $skin; | 39 $ui_theme = $ui_map[$skin] ?: $skin; |
33 | 40 |
34 self::$ui_theme = $ui_theme; | 41 self::$ui_theme = $ui_theme; |
35 | 42 |
36 if (file_exists($this->home . "/themes/$ui_theme/jquery-ui-$this->version.custom.css")) { | 43 if (file_exists($this->home . "/themes/$ui_theme/jquery-ui.css")) { |
37 $this->include_stylesheet("themes/$ui_theme/jquery-ui-$this->version.custom.css"); | 44 $this->include_stylesheet("themes/$ui_theme/jquery-ui.css"); |
38 } | 45 } |
39 else { | 46 else { |
40 $this->include_stylesheet("themes/larry/jquery-ui-$this->version.custom.css"); | 47 $this->include_stylesheet("themes/larry/jquery-ui.css"); |
41 } | 48 } |
42 | 49 |
43 if ($ui_theme == 'larry') { | 50 if ($ui_theme == 'larry') { |
44 // patch dialog position function in order to fully fit the close button into the window | 51 // patch dialog position function in order to fully fit the close button into the window |
45 $rcmail->output->add_script("jQuery.extend(jQuery.ui.dialog.prototype.options.position, { | 52 $rcmail->output->add_script("jQuery.extend(jQuery.ui.dialog.prototype.options.position, { |
93 | 100 |
94 self::$features[] = 'miniColors'; | 101 self::$features[] = 'miniColors'; |
95 | 102 |
96 $ui_theme = self::$ui_theme; | 103 $ui_theme = self::$ui_theme; |
97 $rcube = rcube::get_instance(); | 104 $rcube = rcube::get_instance(); |
98 $script = 'plugins/jqueryui/js/jquery.miniColors.min.js'; | 105 $script = 'plugins/jqueryui/js/jquery.minicolors.min.js'; |
99 $css = "plugins/jqueryui/themes/$ui_theme/jquery.miniColors.css"; | 106 $css = "plugins/jqueryui/themes/$ui_theme/jquery.minicolors.css"; |
100 | 107 |
101 if (!file_exists(INSTALL_PATH . $css)) { | 108 if (!file_exists(INSTALL_PATH . $css)) { |
102 $css = "plugins/jqueryui/themes/larry/jquery.miniColors.css"; | 109 $css = "plugins/jqueryui/themes/larry/jquery.minicolors.css"; |
103 } | 110 } |
104 | 111 |
105 $rcube->output->include_css($css); | 112 $rcube->output->include_css($css); |
106 $rcube->output->add_header(html::tag('script', array('type' => "text/javascript", 'src' => $script))); | 113 $rcube->output->add_header(html::tag('script', array('type' => "text/javascript", 'src' => $script))); |
107 $rcube->output->add_script('$("input.colors").miniColors({colorValues: rcmail.env.mscolors})', 'docready'); | 114 $rcube->output->add_script('$.fn.miniColors = $.fn.minicolors; $("input.colors").minicolors()', 'docready'); |
108 $rcube->output->set_env('mscolors', self::get_color_values()); | |
109 } | 115 } |
110 | 116 |
111 public static function tagedit() | 117 public static function tagedit() |
112 { | 118 { |
113 if (in_array('tagedit', self::$features)) { | 119 if (in_array('tagedit', self::$features)) { |
126 } | 132 } |
127 | 133 |
128 $rcube->output->include_css($css); | 134 $rcube->output->include_css($css); |
129 $rcube->output->add_header(html::tag('script', array('type' => "text/javascript", 'src' => $script))); | 135 $rcube->output->add_header(html::tag('script', array('type' => "text/javascript", 'src' => $script))); |
130 } | 136 } |
131 | |
132 /** | |
133 * Return a (limited) list of color values to be used for calendar and category coloring | |
134 * | |
135 * @return mixed List for colors as hex values or false if no presets should be shown | |
136 */ | |
137 public static function get_color_values() | |
138 { | |
139 // selection from http://msdn.microsoft.com/en-us/library/aa358802%28v=VS.85%29.aspx | |
140 return array('000000','006400','2F4F4F','800000','808000','008000', | |
141 '008080','000080','800080','4B0082','191970','8B0000','008B8B', | |
142 '00008B','8B008B','556B2F','8B4513','228B22','6B8E23','2E8B57', | |
143 'B8860B','483D8B','A0522D','0000CD','A52A2A','00CED1','696969', | |
144 '20B2AA','9400D3','B22222','C71585','3CB371','D2691E','DC143C', | |
145 'DAA520','00FA9A','4682B4','7CFC00','9932CC','FF0000','FF4500', | |
146 'FF8C00','FFA500','FFD700','FFFF00','9ACD32','32CD32','00FF00', | |
147 '00FF7F','00FFFF','5F9EA0','00BFFF','0000FF','FF00FF','808080', | |
148 '708090','CD853F','8A2BE2','778899','FF1493','48D1CC','1E90FF', | |
149 '40E0D0','4169E1','6A5ACD','BDB76B','BA55D3','CD5C5C','ADFF2F', | |
150 '66CDAA','FF6347','8FBC8B','DA70D6','BC8F8F','9370DB','DB7093', | |
151 'FF7F50','6495ED','A9A9A9','F4A460','7B68EE','D2B48C','E9967A', | |
152 'DEB887','FF69B4','FA8072','F08080','EE82EE','87CEEB','FFA07A', | |
153 'F0E68C','DDA0DD','90EE90','7FFFD4','C0C0C0','87CEFA','B0C4DE', | |
154 '98FB98','ADD8E6','B0E0E6','D8BFD8','EEE8AA','AFEEEE','D3D3D3', | |
155 'FFDEAD' | |
156 ); | |
157 } | |
158 } | 137 } |