thomascube
2011-08-18 fbe54043cf598b19a753dc2b21a7ed558d23fd15
program/steps/settings/edit_folder.inc
@@ -24,7 +24,7 @@
// init IMAP connection
$RCMAIL->imap_connect();
function rcube_folder_form($attrib)
function rcmail_folder_form($attrib)
{
    global $RCMAIL;
@@ -41,7 +41,7 @@
    // Get mailbox parameters
    if (strlen($mbox)) {
        $options   = rcube_folder_options($mbox_imap);
        $options   = rcmail_folder_options($mbox_imap);
        $namespace = $RCMAIL->imap->get_namespace();
        $path   = explode($delimiter, $mbox_imap);
@@ -79,7 +79,7 @@
    // Location (name)
    if ($options['protected']) {
        $foldername = Q(rcmail_localize_foldername($mbox_imap));
        $foldername = Q(str_replace($delimiter, ' » ', rcmail_localize_folderpath($mbox_imap)));
    }
    else if ($options['norename']) {
        $foldername = Q($folder);
@@ -106,27 +106,26 @@
        ),
    );
    if (strlen($path)) {
        if (!empty($options) && ($options['norename'] || $options['namespace'] != 'personal')) {
            // prevent user from moving folder
            $hidden_path = new html_hiddenfield(array('name' => '_parent', 'value' => $path));
            $form['props']['fieldsets']['location']['content']['name']['value'] .= $hidden_path->show();
        }
        else {
            $radio1 = new html_radiobutton(array('name' => '_parent', 'value' => ''));
            $radio2 = new html_radiobutton(array('name' => '_parent', 'value' => $path_id));
            $selected  = isset($_POST['_parent']) ? $_POST['_parent'] : $path_id;
    if (!empty($options) && ($options['norename'] || $options['protected'])) {
        // prevent user from moving folder
        $hidden_path = new html_hiddenfield(array('name' => '_parent', 'value' => $path));
        $form['props']['fieldsets']['location']['content']['name']['value'] .= $hidden_path->show();
    }
    else {
        $selected = isset($_POST['_parent']) ? $_POST['_parent'] : $path_id;
        $select = rcmail_mailbox_select(array(
            'name'        => '_parent',
            'noselection' => '---',
            'realnames'   => false,
            'maxlength'   => 150,
            'unsubscribed' => true,
            'exceptions' => array($mbox_imap),
        ));
            $html_path = str_replace($delimiter, ' » ', rcmail_localize_folderpath($path));
            $folderpath = $radio1->show($selected) . Q(rcube_label('none')) . ' '
                .$radio2->show($selected) . Q($html_path);
            $form['props']['fieldsets']['location']['content']['path'] = array(
                'label' => rcube_label('parentfolder'),
                'value' => $folderpath,
            );
        }
        $form['props']['fieldsets']['location']['content']['path'] = array(
            'label' => rcube_label('parentfolder'),
            'value' => $select->show($selected),
        );
    }
    // Settings
@@ -135,7 +134,7 @@
    );
    // Settings: threading
    if ($threading_supported && !$options['noselect']) {
    if ($threading_supported && !$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);
@@ -192,7 +191,7 @@
            'content' => array()
        );
        if (!$options['noselect']) {
        if (!$options['noselect'] && !$options['is_root']) {
            $msgcount = $RCMAIL->imap->messagecount($mbox_imap, 'ALL', true, false);
            // Size
@@ -256,7 +255,7 @@
            $content = rcmail_get_form_part($tab);
        }
        if ($content) {
        if ($content) {
            $out .= html::tag('fieldset', null, html::tag('legend', null, Q($tab['name'])) . $content) ."\n";
        }
    }
@@ -290,36 +289,12 @@
    return $content;
}
function rcmail_localize_folderpath($path)
{
    global $RCMAIL;
    $protect_folders = $RCMAIL->config->get('protect_default_folders');
    $default_folders = (array) $RCMAIL->config->get('default_imap_folders');
    $delimiter       = $RCMAIL->imap->get_hierarchy_delimiter();
    $path            = explode($delimiter, $path);
    $result          = array();
    foreach ($path as $idx => $dir) {
        $directory = implode($delimiter, array_slice($path, 0, $idx+1));
        if ($protect_folders && in_array($directory, $default_folders)) {
            unset($result);
            $result[] = rcmail_localize_foldername($directory);
        }
        else {
            $result[] = rcube_charset_convert($dir, 'UTF7-IMAP');
        }
    }
    return implode($delimiter, $result);
}
//$OUTPUT->set_pagetitle(rcube_label('folders'));
// register UI objects
$OUTPUT->add_handlers(array(
    'folderdetails' => 'rcube_folder_form',
    'folderdetails' => 'rcmail_folder_form',
));
$OUTPUT->add_label('nonamewarning');