summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2006-07-30 19:38:06 +0000
committerthomascube <thomas@roundcube.net>2006-07-30 19:38:06 +0000
commitf9c107afbe9bb01627a9e6de48efdfbbda8e56e6 (patch)
treec9758b06f319953e2491c601d8fc09bf859e295a /program
parentfe79b1bcf828b6b9f947c4b32d5e7bf297438be4 (diff)
Fixed folder renaming; added confirmation after deleting a folder
Diffstat (limited to 'program')
-rw-r--r--program/include/rcube_imap.inc31
-rw-r--r--program/js/app.js13
-rw-r--r--program/localization/de_CH/messages.inc2
-rw-r--r--program/localization/de_DE/messages.inc2
-rw-r--r--program/localization/en_GB/messages.inc13
-rw-r--r--program/localization/en_US/messages.inc2
-rw-r--r--program/steps/settings/manage_folders.inc12
7 files changed, 51 insertions, 24 deletions
diff --git a/program/include/rcube_imap.inc b/program/include/rcube_imap.inc
index c98c480a9..4137d109a 100644
--- a/program/include/rcube_imap.inc
+++ b/program/include/rcube_imap.inc
@@ -1245,28 +1245,29 @@ class rcube_imap
// set a new name to an existing mailbox
- function rename_mailbox($mbox_name, $new_name, $subscribe=TRUE)
+ function rename_mailbox($mbox_name, $new_name)
{
$result = FALSE;
// replace backslashes
$name = preg_replace('/[\\\]+/', '-', $new_name);
+
+ // encode mailbox name and reduce it to 100 chars
+ $name_enc = substr(UTF7EncodeString($new_name), 0, 100);
- $name_enc = UTF7EncodeString($new_name);
-
- // reduce mailbox name to 100 chars
- $name_enc = substr($name_enc, 0, 100);
-
+ // make absolute path
+ $mailbox = $this->_mod_mailbox($mbox_name);
$abs_name = $this->_mod_mailbox($name_enc);
- $a_mailbox_cache = $this->get_cache('mailboxes');
-
- if (strlen($abs_name) && (!is_array($a_mailbox_cache) || !in_array($abs_name, $a_mailbox_cache)))
- $result = iil_C_RenameFolder($this->conn, $mbox_name, $abs_name);
-
- // update mailboxlist cache
- if ($result && $subscribe)
- $this->unsubscribe($mbox_name);
- $this->subscribe($name_enc);
+
+ if (strlen($abs_name))
+ $result = iil_C_RenameFolder($this->conn, $mailbox, $abs_name);
+
+ // clear cache
+ if ($result)
+ {
+ $this->clear_message_cache($mailbox.'.msg');
+ $this->clear_cache('mailboxes');
+ }
return $result ? $name : FALSE;
}
diff --git a/program/js/app.js b/program/js/app.js
index 84e9e45c7..51d9f8570 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -2848,10 +2848,12 @@ function rcube_webmail()
row.cells[3].firstChild.onclick = new Function(this.ref+".command('delete-folder','"+name.replace('\'','\\\'')+"')");
// add new folder to rename-folder list and clear input field
- if (!replace && (form = this.gui_objects.editform) && form.elements['_folder_name'])
+ if (!replace && (form = this.gui_objects.editform))
{
- form.elements['_folder_oldname'].options[form.elements['_folder_oldname'].options.length] = new Option(name,name);
- form.elements['_folder_name'].value = '';
+ if (form.elements['_folder_oldname'])
+ form.elements['_folder_oldname'].options[form.elements['_folder_oldname'].options.length] = new Option(name,name);
+ if (form.elements['_folder_name'])
+ form.elements['_folder_name'].value = '';
}
};
@@ -2909,7 +2911,8 @@ function rcube_webmail()
}
}
- form.elements['_folder_newname'].value = '';
+ if (form && form.elements['_folder_newname'])
+ form.elements['_folder_newname'].value = '';
};
@@ -3151,7 +3154,7 @@ function rcube_webmail()
if (!this.gui_objects.message)
return false;
-
+
if (this.message_timer)
clearTimeout(this.message_timer);
diff --git a/program/localization/de_CH/messages.inc b/program/localization/de_CH/messages.inc
index d3314a9d6..f1c7e5be3 100644
--- a/program/localization/de_CH/messages.inc
+++ b/program/localization/de_CH/messages.inc
@@ -102,5 +102,7 @@ $messages['checking'] = 'Prüfe...';
$messages['nospellerrors'] = 'Keine Rechtschreibfehler gefunden';
+$messages['folderdeleted'] = 'Ordner erfolgreich gelöscht';
+
?> \ No newline at end of file
diff --git a/program/localization/de_DE/messages.inc b/program/localization/de_DE/messages.inc
index c6ca701a0..8a178edba 100644
--- a/program/localization/de_DE/messages.inc
+++ b/program/localization/de_DE/messages.inc
@@ -104,4 +104,6 @@ $messages['checking'] = 'Prüfe...';
$messages['nospellerrors'] = 'Keine Rechtschreibfehler gefunden';
+$messages['folderdeleted'] = 'Ordner erfolgreich gelöscht';
+
?> \ No newline at end of file
diff --git a/program/localization/en_GB/messages.inc b/program/localization/en_GB/messages.inc
index 262e30007..7a60b835d 100644
--- a/program/localization/en_GB/messages.inc
+++ b/program/localization/en_GB/messages.inc
@@ -90,4 +90,17 @@ $messages['nocontactsreturned'] = 'No contacts were found';
$messages['nosearchname'] = 'Please enter a contact name or email address';
+$messages['searchsuccessful'] = '$nr messages found';
+
+$messages['searchnomatch'] = 'Search returned no matches';
+
+$messages['searching'] = 'Searching...';
+
+$messages['checking'] = 'Checking...';
+
+$messages['nospellerrors'] = 'No spelling errors found';
+
+$messages['folderdeleted'] = 'Folder successfully deleted';
+
+
?>
diff --git a/program/localization/en_US/messages.inc b/program/localization/en_US/messages.inc
index a5ffc091c..f406ff128 100644
--- a/program/localization/en_US/messages.inc
+++ b/program/localization/en_US/messages.inc
@@ -104,5 +104,7 @@ $messages['checking'] = 'Checking...';
$messages['nospellerrors'] = 'No spelling errors found';
+$messages['folderdeleted'] = 'Folder successfully deleted';
+
?>
diff --git a/program/steps/settings/manage_folders.inc b/program/steps/settings/manage_folders.inc
index 770bac2fd..457fcb5d2 100644
--- a/program/steps/settings/manage_folders.inc
+++ b/program/steps/settings/manage_folders.inc
@@ -67,7 +67,7 @@ else if ($_action=='create-folder')
else if ($_action=='rename-folder')
{
if (!empty($_GET['_folder_oldname']) && !empty($_GET['_folder_newname']))
- $rename = $IMAP->rename_mailbox(get_input_value('_folder_oldname', RCUBE_INPUT_GET), trim(get_input_value('_folder_newname', RCUBE_INPUT_GET)), TRUE);
+ $rename = $IMAP->rename_mailbox(get_input_value('_folder_oldname', RCUBE_INPUT_GET), trim(get_input_value('_folder_newname', RCUBE_INPUT_GET)));
if ($rename && $REMOTE_REQUEST)
{
@@ -89,11 +89,15 @@ else if ($_action=='rename-folder')
// delete an existing IMAP mailbox
else if ($_action=='delete-folder')
{
- if (strlen($_GET['_mboxes']))
- $deleted = $IMAP->delete_mailbox(array($_GET['_mboxes']));
+ if (!empty($_GET['_mboxes']))
+ $deleted = $IMAP->delete_mailbox(array(get_input_value('_mboxes', RCUBE_INPUT_GET)));
if ($REMOTE_REQUEST && $deleted)
- rcube_remote_response(sprintf("this.remove_folder_row('%s')", rep_specialchars_output($_GET['_mboxes'], 'js')));
+ {
+ $commands = sprintf("this.remove_folder_row('%s');\n", rep_specialchars_output(get_input_value('_mboxes', RCUBE_INPUT_GET), 'js'));
+ $commands .= show_message('folderdeleted', 'confirmation');
+ rcube_remote_response($commands);
+ }
else if ($REMOTE_REQUEST)
{
$commands = show_message('errorsaving', 'error');