Added folder purge function and some checks

release-0.6
thomascube 19 years ago
parent c9d09bbe43
commit 5e35126796

@ -244,7 +244,7 @@ if ($_task=='mail')
if ($_action=='addcontact')
include('program/steps/mail/addcontact.inc');
if ($_action=='expunge')
if ($_action=='expunge' || $_action=='purge')
include('program/steps/mail/folders.inc');
if ($_action=='check-recent')

@ -986,8 +986,18 @@ class rcube_imap
if ($msg_count>0)
{
$this->clear_message_cache($mailbox.'.msg');
return iil_C_ClearFolder($this->conn, $mailbox);
$cleared = iil_C_ClearFolder($this->conn, $mailbox);
// make sure the message count cache is cleared as well
if ($cleared)
{
$this->clear_message_cache($mailbox.'.msg');
$a_mailbox_cache = $this->get_cache('messagecount');
unset($a_mailbox_cache[$mailbox]);
$this->update_cache('messagecount', $a_mailbox_cache);
}
return $cleared;
}
else
return 0;

@ -145,6 +145,9 @@ function rcube_webmail()
if (this.env.messagecount)
this.enable_command('select-all', 'select-none', 'sort', 'expunge', true);
if (this.env.messagecount && this.env.mailbox==this.env.trash_mailbox)
this.enable_command('purge', true);
this.set_page_buttons();
// focus this window
@ -622,9 +625,10 @@ function rcube_webmail()
this.expunge_mailbox(this.env.mailbox);
break;
case 'clear-mailbox':
//if (this.env.messagecount)
//this.clear_mailbox(this.env.mailbox);
case 'purge':
case 'empty-mailbox':
if (this.env.messagecount)
this.purge_mailbox(this.env.mailbox);
break;
@ -1435,6 +1439,28 @@ function rcube_webmail()
};
this.purge_mailbox = function(mbox)
{
var lock = false;
var add_url = '';
if (!confirm(this.get_label('purgefolderconfirm')))
return false;
// lock interface if it's the active mailbox
if (mbox == this.env.mailbox)
{
lock = true;
this.set_busy(true, 'loading');
add_url = '&_reload=1';
}
// send request to server
var url = '_mbox='+escape(mbox);
this.http_request('purge', url+add_url, lock);
};
// move selected messages to the specified mailbox
this.move_messages = function(mbox)
{
@ -2068,6 +2094,7 @@ function rcube_webmail()
return false;
//if (this.env.framed && add_url=='')
// add_url = '&_framed=1';
if (action && (cid || action=='add'))
@ -2081,9 +2108,9 @@ function rcube_webmail()
this.delete_contacts = function()
{
// exit if no mailbox specified or if selection is empty
if (!(this.selection.length || this.env.cid))
if (!(this.selection.length || this.env.cid) || !confirm(this.get_label('deletecontactconfirm')))
return;
var a_cids = new Array();
if (this.env.cid)
@ -2821,7 +2848,7 @@ function rcube_webmail()
if (request_obj.__lock)
this.set_busy(false);
console(request_obj.responseText);
console(request_obj.get_text());
// if we get javascript code from server -> execute it
if (request_obj.get_text() && (ctype=='text/javascript' || ctype=='application/x-javascript'))
@ -2837,9 +2864,12 @@ function rcube_webmail()
break;
case 'list':
if (this.env.messagecount)
this.enable_command('purge', (this.env.mailbox==this.env.trash_mailbox));
case 'expunge':
this.enable_command('select-all', 'select-none', 'expunge', this.env.messagecount ? true : false);
break;
break;
}
request_obj.reset();

@ -6,11 +6,11 @@
| Copyright (C) 2005, RoundCube Dev, - Switzerland |
| Licensed under the GNU GPL |
| |
| Modified:2005/11/06 (roundcube) |
| |
+-----------------------------------------------------------------------+
| Author: Thomas Bruederli <roundcube@gmail.com> |
+-----------------------------------------------------------------------+
$Id$
*/
@ -271,7 +271,7 @@ function rcube_check_email(input, inline)
{
var reg_str = '([a-z0-9][-a-z0-9\.\+_]*)\@(([-a-z0-9][\.]?)*[a-z0-9]\.[a-z]{2,9})';
var reg1 = inline ? new RegExp(reg_str, 'i') : new RegExp('^'+reg_str+'$', 'i');
var reg2 = /[\._\-\@]{2}/;
var reg2 = /[\._\-]{2}/;
return reg1.test(input) && !reg2.test(input) ? true : false;
}
return false;

@ -478,7 +478,6 @@ class MDB2_Driver_Manager_fbsql extends MDB2_Driver_Manager_Common
* @return mixed data array on success, a MDB2 error on failure
* @access public
*/
*/
function listTableIndexes($table)
{
$db =& $this->getDBInstance();

@ -91,6 +91,9 @@ function rcmail_contacts_list($attrib)
$OUTPUT->add_script($javascript);
// add some labels to client
rcube_add_label('deletecontactconfirm');
return $out;
}

@ -22,10 +22,10 @@
$REMOTE_REQUEST = TRUE;
$mbox = $IMAP->get_mailbox_name();
if ($recent_count = $IMAP->messagecount(NULL, 'RECENT'))
if ($recent_count = $IMAP->messagecount(NULL, 'RECENT', TRUE))
{
$count = $IMAP->messagecount();
$unread_count = $IMAP->messagecount(NULL, 'UNSEEN');
$unread_count = $IMAP->messagecount(NULL, 'UNSEEN', TRUE);
$commands = sprintf("this.set_unread_count('%s', %d, true);\n", addslashes($mbox), $unread_count);
$commands .= sprintf("this.set_env('messagecount', %d);\n", $count);

@ -16,7 +16,6 @@
+-----------------------------------------------------------------------+
$Id$
*/
$REMOTE_REQUEST = TRUE;
@ -26,7 +25,7 @@ $mbox = $IMAP->get_mailbox_name();
// send EXPUNGE command
if ($_action=='expunge')
{
$success = $IMAP->expunge();
$success = $IMAP->expunge($_GET['_mbox']);
// reload message list if current mailbox
if ($success && $_GET['_reload'])
@ -42,11 +41,12 @@ if ($_action=='expunge')
// clear mailbox
else if ($_action=='purge')
{
$success = $IMAP->clear_mailbox();
$success = $IMAP->clear_mailbox($_GET['_mbox']);
if ($success && $_GET['_reload'])
{
$commands = "this.set_env('messagecount', 0);\n";
$commands = "this.clear_message_list();\n";
$commands .= "this.set_env('messagecount', 0);\n";
$commands .= "this.set_env('pagecount', 0);\n";
$commands .= sprintf("this.set_rowcount('%s');\n", rcmail_get_messagecount_text());
$commands .= sprintf("this.set_unread_count('%s', 0);\n", addslashes($mbox));

@ -66,6 +66,9 @@ function rcmail_mailbox_list($attrib)
global $IMAP, $CONFIG, $OUTPUT, $JS_OBJECT_NAME, $COMM_PATH;
static $s_added_script = FALSE;
static $a_mailboxes;
// add some labels to client
rcube_add_label('purgefolderconfirm');
// $mboxlist_start = rcube_timer();

@ -31,6 +31,7 @@
<div id="mailboxcontrols">
<roundcube:label name="folder" />:&nbsp;
<roundcube:button command="expunge" label="compact" classAct="active" />&nbsp;
<roundcube:button command="purge" label="empty" classAct="active" />&nbsp;
</div>

Loading…
Cancel
Save