Changeset 2287 in subversion
- Timestamp:
- Feb 10, 2009 6:14:03 PM (4 years ago)
- Location:
- branches/devel-api
- Files:
-
- 2 added
- 12 edited
-
index.php (modified) (2 diffs)
-
plugins/markasjunk/localization (added)
-
plugins/markasjunk/localization/en_US.inc (added)
-
plugins/markasjunk/markasjunk.js (modified) (1 diff)
-
plugins/markasjunk/markasjunk.php (modified) (2 diffs)
-
plugins/userinfo/localization/de_CH.inc (modified) (1 diff)
-
plugins/userinfo/localization/en_US.inc (modified) (1 diff)
-
plugins/userinfo/userinfo.js (modified) (1 diff)
-
plugins/userinfo/userinfo.php (modified) (1 diff)
-
program/include/rcmail.php (modified) (1 diff)
-
program/include/rcube_plugin.php (modified) (4 diffs)
-
program/include/rcube_plugin_api.php (modified) (6 diffs)
-
program/include/rcube_template.php (modified) (1 diff)
-
program/js/app.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/devel-api/index.php
r2266 r2287 3 3 +-------------------------------------------------------------------------+ 4 4 | RoundCube Webmail IMAP Client | 5 | Version 0.3-200902 01|5 | Version 0.3-20090210 | 6 6 | | 7 7 | Copyright (C) 2005-2009, RoundCube Dev. - Switzerland | … … 36 36 // init output class 37 37 $OUTPUT = !empty($_REQUEST['_remote']) ? $RCMAIL->init_json() : $RCMAIL->load_gui(!empty($_REQUEST['_framed'])); 38 39 // init plugin API 40 $RCMAIL->plugins->init(); 38 41 39 42 // set output buffering -
branches/devel-api/plugins/markasjunk/markasjunk.js
r2285 r2287 17 17 18 18 // create button 19 var button = $('<A>').html('<img src="plugins/markasjunk/junk_pas.png" id="rcmButtonMarkAsJunk" width="32" height="32" alt="" title=" " />').css('cursor', 'pointer');19 var button = $('<A>').html('<img src="plugins/markasjunk/junk_pas.png" id="rcmButtonMarkAsJunk" width="32" height="32" alt="" title="'+rcmail.gettext('buttontitle', 'markasjunk')+'" />').css('cursor', 'pointer'); 20 20 button.bind('click', function(e){ return rcmail.command('plugin.markasjunk', this) }); 21 21 -
branches/devel-api/plugins/markasjunk/markasjunk.php
r2279 r2287 15 15 16 16 $rcmail = rcmail::get_instance(); 17 if ($rcmail->action == '' || $rcmail->action == 'show') 17 if ($rcmail->action == '' || $rcmail->action == 'show') { 18 18 $this->include_script('markasjunk.js'); 19 $this->add_texts('localization', true); 20 } 19 21 } 20 22 21 23 function request_action() 22 24 { 23 $ rcmail = rcmail::get_instance();25 $this->add_texts('localization'); 24 26 25 $ count = sizeof(explode(',', ($uids = get_input_value('_uid', RCUBE_INPUT_POST))));27 $uids = get_input_value('_uid', RCUBE_INPUT_POST); 26 28 $mbox = get_input_value('_mbox', RCUBE_INPUT_POST); 27 29 30 $rcmail = rcmail::get_instance(); 28 31 $rcmail->imap->set_flag($uids, 'JUNK'); 29 32 … … 32 35 } 33 36 34 $rcmail->output-> show_message('reportedasspam', 'confirmation');37 $rcmail->output->command('display_message', $this->gettext('reportedasjunk'), 'confirmation'); 35 38 $rcmail->output->send(); 36 39 } -
branches/devel-api/plugins/userinfo/localization/de_CH.inc
r2279 r2287 2 2 3 3 $labels = array(); 4 $labels['userinfo'] = 'Benutzerinfo'; 4 5 $labels['created'] = 'Erstellt'; 5 6 $labels['lastlogin'] = 'Letztes Login'; -
branches/devel-api/plugins/userinfo/localization/en_US.inc
r2279 r2287 2 2 3 3 $labels = array(); 4 $labels['userinfo'] = 'User info'; 4 5 $labels['created'] = 'Created'; 5 6 $labels['lastlogin'] = 'Last Login'; -
branches/devel-api/plugins/userinfo/userinfo.js
r2285 r2287 6 6 var tab = $('<span>').attr('id', 'settingstabpluginuserinfo').addClass('tablink'); 7 7 8 var button = $('<a>').attr('href', rcmail.env.comm_path+'&_action=plugin.userinfo').html( 'Userinfo').appendTo(tab);8 var button = $('<a>').attr('href', rcmail.env.comm_path+'&_action=plugin.userinfo').html(rcmail.gettext('userinfo', 'userinfo')).appendTo(tab); 9 9 button.bind('click', function(e){ return rcmail.command('plugin.userinfo', this) }); 10 10 -
branches/devel-api/plugins/userinfo/userinfo.php
r2279 r2287 11 11 function init() 12 12 { 13 $this->add_texts('localization/' );13 $this->add_texts('localization/', array('userinfo')); 14 14 $this->register_action('plugin.userinfo', array($this, 'infostep')); 15 15 $this->include_script('userinfo.js'); -
branches/devel-api/program/include/rcmail.php
r2279 r2287 320 320 $this->output->add_label('loading'); 321 321 322 // load plugins stuff323 $this->plugins->init_gui($this->output);324 325 322 return $this->output; 326 323 } -
branches/devel-api/program/include/rcube_plugin.php
r2285 r2287 62 62 * 63 63 * @param string Directory to search in 64 * @param string Domain to save texts64 * @param mixed Make texts also available on the client (array with list or true for all) 65 65 */ 66 public function add_texts($dir )66 public function add_texts($dir, $add2client = false) 67 67 { 68 if (empty($domain)) 69 $domain = $this->ID; 68 $domain = $this->ID; 70 69 71 70 $lang = $_SESSION['language']; … … 86 85 $rcmail = rcmail::get_instance(); 87 86 $rcmail->load_language($lang, $add); 87 88 // add labels to client 89 if ($add2client) { 90 $js_labels = is_array($add2client) ? array_map(array($this, 'label_map_callback'), $add2client) : array_keys($add); 91 $rcmail->output->add_label($js_labels); 92 } 88 93 } 89 94 } … … 91 96 /** 92 97 * Wrapper for rcmail::gettext() adding the plugin ID as domain 98 * 99 * @return string Localized text 100 * @see rcmail::gettext() 93 101 */ 94 102 function gettext($p) … … 155 163 } 156 164 165 /** 166 * Callback function for array_map 167 */ 168 private function label_map_callback($key) 169 { 170 return $this->ID.'.'.$key; 171 } 172 157 173 158 174 } -
branches/devel-api/program/include/rcube_plugin_api.php
r2285 r2287 36 36 private $actions = array(); 37 37 private $actionmap = array(); 38 private $templobjects = array();39 38 private $objectsmap = array(); 40 private $scripts = array();41 private $stylesheets = array();42 39 private $output; 43 40 … … 70 67 71 68 $this->dir = realpath($rcmail->config->get('plugins_dir')); 72 73 // load all enabled plugins 69 } 70 71 72 /** 73 * Load and init all enabled plugins 74 * 75 * This has to be done after rcmail::load_gui() or rcmail::init_json() 76 * was called because plugins need to have access to rcmail->output 77 */ 78 public function init() 79 { 80 $rcmail = rcmail::get_instance(); 81 $this->output = $rcmail->output; 82 74 83 $plugins_dir = dir($this->dir); 75 84 $plugins_enabled = (array)$rcmail->config->get('plugins', array()); … … 104 113 105 114 /** 106 * Add GUI things once the output objects is created107 */108 public function init_gui($output)109 {110 if ($output->type == 'html') {111 $output->add_handlers($this->objectsmap);112 113 foreach ($this->stylesheets as $css)114 $output->add_header(html::tag('link', array('rel' => "stylesheet", 'type' => "text/css", 'href' => $css)));115 116 foreach ($this->scripts as $script)117 $output->add_header(html::tag('script', array('type' => "text/javascript", 'src' => $script)));118 }119 120 $this->output = $output;121 }122 123 124 /**125 115 * Allows a plugin object to register a callback for a certain hook 126 116 * … … 218 208 // can register handler only if it's not taken or registered by myself 219 209 if (!isset($this->objectsmap[$name]) || $this->objectsmap[$name] == $owner) { 220 // output is ready 221 if ($this->output) { 222 $this->output->add_handler($name, $callback); 223 } 224 else { 225 $this->templobjects[$name] = $callback; 226 $this->objectsmap[$name] = $owner; 227 } 210 $this->output->add_handler($name, $callback); 211 $this->objectsmap[$name] = $owner; 228 212 } 229 213 else { … … 237 221 public function include_script($fn) 238 222 { 239 $src = $this->ressource_url($fn); 240 241 if ($this->output) 223 if ($this->output->type == 'html') { 224 $src = $this->ressource_url($fn); 242 225 $this->output->add_header(html::tag('script', array('type' => "text/javascript", 'src' => $src))); 243 else 244 $this->scripts[] = $src; 226 } 245 227 } 246 228 … … 250 232 public function include_stylesheet($fn) 251 233 { 252 $src = $this->ressource_url($fn); 253 254 if ($this->output) 234 if ($this->output->type == 'html') { 235 $src = $this->ressource_url($fn); 255 236 $this->output->add_header(html::tag('link', array('rel' => "stylesheet", 'type' => "text/css", 'href' => $src))); 256 else 257 $this->stylesheets[] = $src; 237 } 258 238 } 259 239 -
branches/devel-api/program/include/rcube_template.php
r2285 r2287 210 210 public function add_label() 211 211 { 212 $arg_list = func_get_args(); 213 foreach ($arg_list as $i => $name) { 212 $args = func_get_args(); 213 if (count($args) == 1 && is_array($args[0])) 214 $args = $args[0]; 215 216 foreach ($args as $name) { 214 217 $this->command('add_label', $name, rcube_label($name)); 215 218 } -
branches/devel-api/program/js/app.js
r2285 r2287 1159 1159 1160 1160 // return a localized string 1161 this.get_label = function(name) 1162 { 1163 if (this.labels[name]) 1161 this.get_label = function(name, domain) 1162 { 1163 if (domain && this.labels[domain+'.'+name]) 1164 return this.labels[domain+'.'+name]; 1165 else if (this.labels[name]) 1164 1166 return this.labels[name]; 1165 1167 else 1166 1168 return name; 1167 1169 }; 1170 1171 // alias for convenience reasons 1172 this.gettext = this.get_label; 1168 1173 1169 1174 // switch to another application task
Note: See TracChangeset
for help on using the changeset viewer.
