Added folder purge function and some checks
| | |
| | | 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') |
| | |
| | | |
| | | 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; |
| | |
| | | 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 |
| | |
| | | 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; |
| | | |
| | | |
| | |
| | | }; |
| | | |
| | | |
| | | 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) |
| | | { |
| | |
| | | return false; |
| | | |
| | | //if (this.env.framed && add_url=='') |
| | | |
| | | // add_url = '&_framed=1'; |
| | | |
| | | if (action && (cid || action=='add')) |
| | |
| | | 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) |
| | |
| | | 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')) |
| | |
| | | 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(); |
| | |
| | | | Copyright (C) 2005, RoundCube Dev, - Switzerland | |
| | | | Licensed under the GNU GPL | |
| | | | | |
| | | | Modified:2005/11/06 (roundcube) | |
| | | | | |
| | | +-----------------------------------------------------------------------+ |
| | | | Author: Thomas Bruederli <roundcube@gmail.com> | |
| | | +-----------------------------------------------------------------------+ |
| | | |
| | | $Id$ |
| | | */ |
| | | |
| | | |
| | |
| | | { |
| | | 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; |
| | |
| | | * @return mixed data array on success, a MDB2 error on failure |
| | | * @access public |
| | | */ |
| | | */ |
| | | function listTableIndexes($table) |
| | | { |
| | | $db =& $this->getDBInstance(); |
| | |
| | | |
| | | $OUTPUT->add_script($javascript); |
| | | |
| | | // add some labels to client |
| | | rcube_add_label('deletecontactconfirm'); |
| | | |
| | | return $out; |
| | | } |
| | | |
| | |
| | | $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); |
| | |
| | | +-----------------------------------------------------------------------+ |
| | | |
| | | $Id$ |
| | | |
| | | */ |
| | | |
| | | $REMOTE_REQUEST = TRUE; |
| | |
| | | // send EXPUNGE command |
| | | if ($_action=='expunge') |
| | | { |
| | | $success = $IMAP->expunge(); |
| | | $success = $IMAP->expunge($_GET['_mbox']); |
| | | |
| | | // reload message list if current mailbox |
| | | if ($success && $_GET['_reload']) |
| | |
| | | // 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)); |
| | |
| | | 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(); |
| | | |
| | |
| | | <div id="mailboxcontrols"> |
| | | <roundcube:label name="folder" />: |
| | | <roundcube:button command="expunge" label="compact" classAct="active" /> |
| | | <roundcube:button command="purge" label="empty" classAct="active" /> |
| | | </div> |
| | | |
| | | |