/** * Return html for a structured list <ul> for the mailbox tree */ public function render_folder_tree_html(&$arrFolders, &$mbox_name, &$jslist, $attrib, $nestLevel = 0) { $maxlength = intval($attrib['maxlength']); $realnames = (bool) $attrib['realnames']; $msgcounts = $this->storage->get_cache('messagecount'); $collapsed = $this->config->get('collapsed_folders'); $realnames = $this->config->get('show_real_foldernames'); $out = ''; foreach ($arrFolders as $folder) { $title = null; $folder_class = $this->folder_classname($folder['id']); $is_collapsed = strpos($collapsed, '&' . rawurlencode($folder['id']) . '&') !== false; $unread = $msgcounts ? intval($msgcounts[$folder['id']]['UNSEEN']) : 0; if ($folder_class && !$realnames) { $foldername = $this->gettext($folder_class); } else { $foldername = $folder['name']; // shorten the folder name to a given length if ($maxlength && $maxlength > 1) { $fname = abbreviate_string($foldername, $maxlength); if ($fname != $foldername) { $title = $foldername; } $foldername = $fname; } } // make folder name safe for ids and class names $folder_id = rcube_utils::html_identifier($folder['id'], true); $classes = array('mailbox'); // set special class for Sent, Drafts, Trash and Junk if ($folder_class) { $classes[] = $folder_class; } if ($folder['id'] == $mbox_name) { $classes[] = 'selected'; } if ($folder['virtual']) { $classes[] = 'virtual'; } else { if ($unread) { $classes[] = 'unread'; } } $js_name = $this->JQ($folder['id']); $html_name = $this->Q($foldername) . ($unread ? html::span('unreadcount', sprintf($attrib['unreadwrap'], $unread)) : ''); $link_attrib = $folder['virtual'] ? array() : array('href' => $this->url(array('_mbox' => $folder['id'])), 'onclick' => sprintf("return %s.command('list','%s',this,event)", rcmail_output::JS_OBJECT_NAME, $js_name), 'rel' => $folder['id'], 'title' => $title); $out .= html::tag('li', array('id' => "rcmli" . $folder_id, 'class' => join(' ', $classes), 'noclose' => true), html::a($link_attrib, $html_name)); if (!empty($folder['folders'])) { $out .= html::div('treetoggle ' . ($is_collapsed ? 'collapsed' : 'expanded'), ' '); } $jslist[$folder['id']] = array('id' => $folder['id'], 'name' => $foldername, 'virtual' => $folder['virtual']); if (!empty($folder_class)) { $jslist[$folder['id']]['class'] = $folder_class; } if (!empty($folder['folders'])) { $out .= html::tag('ul', array('style' => $is_collapsed ? "display:none;" : null), $this->render_folder_tree_html($folder['folders'], $mbox_name, $jslist, $attrib, $nestLevel + 1)); } $out .= "</li>\n"; } return $out; }
/** * Handler for ACL delete action */ private function action_delete() { $mbox = trim(rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_GPC, true)); //UTF7-IMAP $user = trim(rcube_utils::get_input_value('_user', rcube_utils::INPUT_GPC)); $user = explode(',', $user); foreach ($user as $u) { $u = trim($u); if ($this->rc->storage->delete_acl($mbox, $u)) { $this->rc->output->command('acl_remove_row', rcube_utils::html_identifier($u)); } else { $error = true; } } if (!$error) { $this->rc->output->show_message('acl.deletesuccess', 'confirmation'); } else { $this->rc->output->show_message('acl.deleteerror', 'error'); } }
function html_identifier($str, $encode = false) { return rcube_utils::html_identifier($str, $encode); }
/** * Return html for a structured list <ul> for the folder tree */ public function list_tree_html($node, $data, &$jsenv, $attrib) { $out = ''; foreach ($node->children as $folder) { $id = $folder->id; $prop = $data[$id]; $is_collapsed = false; // TODO: determine this somehow? $content = $this->calendar_list_item($id, $prop, $jsenv, $attrib['activeonly']); if (!empty($folder->children)) { $content .= html::tag('ul', array('style' => $is_collapsed ? "display:none;" : null), $this->list_tree_html($folder, $data, $jsenv, $attrib)); } if (strlen($content)) { $out .= html::tag('li', array('id' => 'rcmlical' . rcube_utils::html_identifier($id), 'class' => $prop['group'] . ($prop['virtual'] ? ' virtual' : '')), $content); } } return $out; }
function html_identifier($str, $encode = false) { _deprecation_warning(__FUNCTION__); return rcube_utils::html_identifier($str, $encode); }