Hi, I'm new to roundcube and I'm customizing it for my university project.
I've created a plugin to add a tab for blacklist in the settingstab. But the problem is the HTML content is not displaying properly in side the tab. I have attached the code here with. Is my approach is not correct? How can I do it efficiantly?(I have analyed the seetings and moruserinfo plugins to get an idea)
<?php class moreblacklist extends rcube_plugin { public $task = 'settings'; function init(){ $rcmail = rcmail::get_instance(); $this->register_handler(' plugin.blacklist_sections', array($this, 'blacklist_sections')); $this->register_action('plugin.blacklist', array($this, 'blacklist')); $this->add_hook('list_prefs_sections', array($this, 'blacklist_link')); $this->add_hook('user_preferences', array($this, 'prefs_table')); $skin = $rcmail->config->get('skin'); $_skin = get_input_value('_skin', RCUBE_INPUT_POST); if($_skin != "") $skin = $_skin; // abort if there are no css adjustments if(!file_exists('plugins/moreblacklist/skins/' . $skin . '/settings.css')){ if(!file_exists('plugins/moreblacklist/skins/default/settings.css')) return; else $skin = "default"; } $nav_hooks = (array)$rcmail->config->get('settingsnav'); $nav = array(); foreach($nav_hooks as $key => $val) $nav['settingsnav'][] = $val; $rcmail->config->merge($nav); $this->include_stylesheet('skins/' . $skin . '/settings.css'); $browser = new rcube_browser(); if($browser->ie){ if($browser->ver < 8) $this->include_stylesheet('skins/' . $skin . '/iehacks.css'); if($browser->ver < 7) $this->include_stylesheet('skins/' . $skin . '/ie6hacks.css'); } $this->add_hook('template_object_userprefs', array($this, 'userprefs')); $this->add_texts('localization/'); $rcmail->output->add_label('moreblacklist.blacklist'); } function blacklist() { $rcmail = rcmail::get_instance(); $rcmail->output->send("moreblacklist.blacklist"); exit; } function blacklist_link($args) { $temp = array(); $temp['blacklistlink']['id'] = 'blacklistlink'; $temp['blacklistlink']['section'] = $this->gettext('moreblacklist.blacklist'); $args['list'] = $args['list'] + $temp; return $args; } function blacklist_sections() { $this->infohtml(""); } function prefs_table($args) { if ($args['section'] == 'blacklistlink') { $args['blocks']['main']['options']['blacklistlink']['title'] = ""; $args['blocks']['main']['options']['blacklistlink']['content'] = $this->blacklist_sections(""); } return $args; } //the content genarated by this code is not displaying function infohtml() { $table = new html_table(array('cols' => 2, 'cellpadding' => 3)); $field_id = 'blackselect'; $table->add('title', html::label($field_id, Q($this->gettext('blacklist')))); $imap_host = new html_select(array('name' => '_blacklistinf', 'id' => $field_id, 'size' => 20)); $table->add(null, $imap_host->show()); $out .= $table->show(); return $out; } function userprefs($p) { $rcmail = rcmail::get_instance(); (array)$parts = explode(",",$p['parts']); foreach($parts as $key => $val) $parts[$key] = trim($val); (array)$temparr = explode("<fieldset>",$p['content']); for($i=1;$i<count($temparr);$i++){ $temparr[$i] = "<div class=\"settingsplugin\" id=\"" . $parts[$i-1] . "\"><fieldset>" . str_replace("</fieldset>","</fieldset></div>",$temparr[$i]); if($_GET['_section'] == "blacklistlink" || $_POST['_section'] == "blacklistlink"){ $temparr[$i] = str_replace("<legend />","<legend>" . $this->gettext('blacklist') . "</legend>",$temparr[$i]); } } $p['content'] = implode($temparr); return $p; } } ?>
I would be greatful if some one could help me on this.
Thanks, Chamila
List info: http://lists.roundcube.net/dev/