An attempt to fix feature request #1457344, select parent folder when creating new folder.
To do:
Comments so far, anybody?
Robin
--- program/include/main.inc (revision 455) +++ program/include/main.inc (working copy) @@ -1366,6 +1366,7 @@ 'identityform' => 'rcube_identity_form', 'foldersubscription' => 'rcube_subscription_form', 'createfolder' => 'rcube_create_folder_form',
'parentfolder' => 'rcube_parent_folder_form',
'renamefolder' => 'rcube_rename_folder_form',
'composebody' => 'rcmail_compose_body'
);
--- program/localization/en_US/labels.inc (revision 455) +++ program/localization/en_US/labels.inc (working copy) @@ -223,6 +223,7 @@
$labels['folder'] = 'Folder'; $labels['folders'] = 'Folders'; +$labels['parentfolder'] = 'Parent folder'; $labels['foldername'] = 'Folder name'; $labels['subscribed'] = 'Subscribed'; $labels['create'] = 'Create'; Index: program/js/app.js =================================================================== --- program/js/app.js (revision 455) +++ program/js/app.js (working copy) @@ -2426,10 +2426,13 @@
var form;
if ((form = this.gui_objects.editform) && form.elements['_folder_name'])
{ name = form.elements['_folder_name'].value;
fparent = form.elements['_folder_parent'].value;
}
if (name)
this.http_request('create-folder', '_name='+urlencode(name), true);
this.http_request('create-folder', '_name='+urlencode(name)+'&_parent='+urlencode(fparent), true);
else if (form.elements['_folder_name'])
form.elements['_folder_name'].focus();
};--- program/steps/settings/manage_folders.inc (revision 455) +++ program/steps/settings/manage_folders.inc (working copy) @@ -47,18 +47,24 @@ else if ($_action=='create-folder') { if (!empty($_GET['_name']))
{
$name = trim(get_input_value('_name', RCUBE_INPUT_GET, FALSE, 'UTF-7'));
if (!empty($_GET['_parent']))
$name = trim(get_input_value('_parent', RCUBE_INPUT_GET, FALSE, 'UTF-7')) . $IMAP->delimiter . $name;
$create = $IMAP->create_mailbox($name, TRUE);
}
if ($create && $REMOTE_REQUEST) {
JQ(rcube_charset_convert($create, 'UTF-7')));
JQ($display_create));
rcube_remote_response($commands);
}
else if (!$create && $REMOTE_REQUEST)
{@@ -167,7 +173,9 @@ $zebra_class = $i%2 ? 'even' : 'odd'; $folder_js = JQ($folder); $folder_js_enc = JQ(rcube_charset_convert($folder, 'UTF-7'));
$display_folder = str_repeat(' ', substr_count($folder, $IMAP->delimiter)).preg_replace('/.*'.preg_quote($IMAP->delimiter).'/', '', rcube_charset_convert($folder, 'UTF-7'));
$folder_html = $CONFIG['protect_default_folders'] && in_array($folder, $CONFIG['default_imap_folders']) ? rcube_label(strtolower($folder)) : $display_folder;
if (!$protected) $a_js_folders['rcmrow'.($i+1)] = array($folder_js, $folder_js_enc);
@@ -239,6 +247,23 @@ return $out; }
+function rcube_parent_folder_form($attrib)
function rcube_rename_folder_form($attrib) { global $CONFIG, $IMAP, $JS_OBJECT_NAME; Index: skins/default/templates/managefolders.html =================================================================== --- skins/default/templates/managefolders.html (revision 455) +++ skins/default/templates/managefolders.html (working copy) @@ -25,9 +25,25 @@
<div class="boxtitle"><roundcube:label name="createfolder" /></div>
<div class="settingspart"> +<table border="0" cellspacing="0" cellpadding="1"> +<tr> +<td> +<roundcube:label name="parentfolder" />: +</td> +<td> +<roundcube:object name="parentfolder" form="subscriptionform" /> +</td> +</tr> +<tr> +<td> <roundcube:label name="foldername" />: +</td> +<td> <roundcube:object name="createfolder" form="subscriptionform" /> <roundcube:button command="create-folder" type="input" class="button" label="create" /> +</td> +</tr> +</table> </div> </div>