From 4af76d20cafcd456bf3ce0fcb17b25a888c45160 Mon Sep 17 00:00:00 2001 From: Thomas <thomas@roundcube.net> Date: Mon, 21 Oct 2013 15:14:46 -0400 Subject: [PATCH] Bump version --- program/steps/settings/edit_folder.inc | 57 +++++++++++++++++++++++++++++++++------------------------ 1 files changed, 33 insertions(+), 24 deletions(-) diff --git a/program/steps/settings/edit_folder.inc b/program/steps/settings/edit_folder.inc index fe9cdc0..fdb38e6 100644 --- a/program/steps/settings/edit_folder.inc +++ b/program/steps/settings/edit_folder.inc @@ -6,7 +6,10 @@ | | | This file is part of the Roundcube Webmail client | | Copyright (C) 2005-2009, The Roundcube Dev Team | - | Licensed under the GNU GPL | + | | + | Licensed under the GNU General Public License version 3 or | + | any later version with exceptions for skins & plugins. | + | See the README file for a full license statement. | | | | PURPOSE: | | Provide functionality to create/edit a folder | @@ -14,19 +17,15 @@ +-----------------------------------------------------------------------+ | Author: Aleksander Machniak <alec@alec.pl> | +-----------------------------------------------------------------------+ - - $Id$ - */ // WARNING: folder names in UI are encoded with RCMAIL_CHARSET -// init IMAP connection -$RCMAIL->imap_connect(); - function rcmail_folder_form($attrib) { global $RCMAIL; + + $storage = $RCMAIL->get_storage(); // edited folder name (empty in create-folder mode) $mbox = trim(get_input_value('_mbox', RCUBE_INPUT_GPC, true)); @@ -36,13 +35,13 @@ $parent = trim(get_input_value('_path', RCUBE_INPUT_GPC, true)); $parent_imap = rcube_charset_convert($parent, RCMAIL_CHARSET, 'UTF7-IMAP'); - $threading_supported = $RCMAIL->imap->get_capability('THREAD'); - $delimiter = $RCMAIL->imap->get_hierarchy_delimiter(); + $threading_supported = $storage->get_capability('THREAD'); + $delimiter = $storage->get_hierarchy_delimiter(); // Get mailbox parameters if (strlen($mbox)) { $options = rcmail_folder_options($mbox_imap); - $namespace = $RCMAIL->imap->get_namespace(); + $namespace = $storage->get_namespace(); $path = explode($delimiter, $mbox_imap); $folder = array_pop($path); @@ -57,14 +56,14 @@ // allow creating subfolders of INBOX folder if ($path == 'INBOX') { - $path = $RCMAIL->imap->mod_mailbox($path, 'in'); + $path = $storage->mod_folder($path, 'in'); } } // remove personal namespace prefix if (strlen($path)) { $path_id = $path; - $path = $RCMAIL->imap->mod_mailbox($path.$delimiter); + $path = $storage->mod_folder($path.$delimiter); if ($path[strlen($path)-1] == $delimiter) { $path = substr($path, 0, -1); } @@ -79,7 +78,7 @@ // Location (name) if ($options['protected']) { - $foldername = Q(str_replace($delimiter, ' » ', rcmail_localize_folderpath($mbox_imap))); + $foldername = str_replace($delimiter, ' » ', Q(rcmail_localize_folderpath($mbox_imap))); } else if ($options['norename']) { $foldername = Q($folder); @@ -113,13 +112,23 @@ } else { $selected = isset($_POST['_parent']) ? $_POST['_parent'] : $path_id; + $exceptions = array($mbox_imap); + + // Exclude 'prefix' namespace from parent folders list (#1488349) + // If INBOX. namespace exists, folders created as INBOX subfolders + // will be listed at the same level - selecting INBOX as a parent does nothing + if ($prefix = $storage->get_namespace('prefix')) { + $exceptions[] = substr($prefix, 0, -1); + } + $select = rcmail_mailbox_select(array( 'name' => '_parent', 'noselection' => '---', 'realnames' => false, 'maxlength' => 150, 'unsubscribed' => true, - 'exceptions' => array($mbox_imap), + 'skip_noinferiors' => true, + 'exceptions' => $exceptions, )); $form['props']['fieldsets']['location']['content']['path'] = array( @@ -134,7 +143,7 @@ ); // Settings: threading - if ($threading_supported && !$options['noselect'] && !$options['is_root']) { + if ($threading_supported && ($mbox_imap == 'INBOX' || (!$options['noselect'] && !$options['is_root']))) { $select = new html_select(array('name' => '_viewmode', 'id' => '_listmode')); $select->add(rcube_label('list'), 0); $select->add(rcube_label('threads'), 1); @@ -191,8 +200,8 @@ 'content' => array() ); - if (!$options['noselect'] && !$options['is_root']) { - $msgcount = $RCMAIL->imap->messagecount($mbox_imap, 'ALL', true, false); + if ((!$options['noselect'] && !$options['is_root']) || $mbox_imap == 'INBOX') { + $msgcount = $storage->count($mbox_imap, 'ALL', true, false); // Size if ($msgcount) { @@ -235,7 +244,7 @@ // Set form tags and hidden fields list($form_start, $form_end) = get_form_tags($attrib, 'save-folder', null, $hidden_fields); - unset($attrib['form']); + unset($attrib['form'], $attrib['id']); // return the complete edit form as table $out = "$form_start\n"; @@ -245,17 +254,17 @@ if (!empty($tab['fieldsets']) && is_array($tab['fieldsets'])) { $content = ''; foreach ($tab['fieldsets'] as $fieldset) { - $subcontent = rcmail_get_form_part($fieldset); + $subcontent = rcmail_get_form_part($fieldset, $attrib); if ($subcontent) { $content .= html::tag('fieldset', null, html::tag('legend', null, Q($fieldset['name'])) . $subcontent) ."\n"; } } } else { - $content = rcmail_get_form_part($tab); + $content = rcmail_get_form_part($tab, $attrib); } - if ($content) { + if ($content) { $out .= html::tag('fieldset', null, html::tag('legend', null, Q($tab['name'])) . $content) ."\n"; } } @@ -267,7 +276,7 @@ return $out; } -function rcmail_get_form_part($form) +function rcmail_get_form_part($form, $attrib = array()) { $content = ''; @@ -277,10 +286,10 @@ $colprop['id'] = '_'.$col; $label = !empty($colprop['label']) ? $colprop['label'] : rcube_label($col); - $table->add('title', sprintf('<label for="%s">%s</label>', $colprop['id'], Q($label))); + $table->add('title', html::label($colprop['id'], Q($label))); $table->add(null, $colprop['value']); } - $content = $table->show(); + $content = $table->show($attrib); } else { $content = $form['content']; -- Gitblit v1.9.1