Changeset 7f5a849 in github
- Timestamp:
- Jul 7, 2011 7:44:26 AM (23 months ago)
- Branches:
- master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
- Children:
- 65b61cd
- Parents:
- 632528f
- Files:
-
- 1 added
- 15 edited
-
CHANGELOG (modified) (1 diff)
-
program/include/rcmail.php (modified) (1 diff)
-
program/include/rcube_addressbook.php (modified) (2 diffs)
-
program/include/rcube_contacts.php (modified) (2 diffs)
-
program/include/rcube_json_output.php (modified) (1 diff)
-
program/include/rcube_template.php (modified) (1 diff)
-
program/js/app.js (modified) (7 diffs)
-
program/localization/en_US/labels.inc (modified) (1 diff)
-
program/localization/en_US/messages.inc (modified) (2 diffs)
-
program/localization/pl_PL/labels.inc (modified) (1 diff)
-
program/localization/pl_PL/messages.inc (modified) (1 diff)
-
program/steps/addressbook/delete.inc (modified) (4 diffs)
-
program/steps/addressbook/func.inc (modified) (1 diff)
-
program/steps/addressbook/undo.inc (added)
-
skins/default/common.css (modified) (1 diff)
-
skins/default/templates/mail.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
CHANGELOG
r1564d4e r7f5a849 2 2 =========================== 3 3 4 - Added possibility to undo last contact delete operation 4 5 - Fix sorting of contact groups after group create (#1487747) 5 6 - Add optional textual upload progress indicator (#1486039) -
program/include/rcmail.php
r77406bb r7f5a849 508 508 $this->output->set_charset(RCMAIL_CHARSET); 509 509 510 // add some basic label to client510 // add some basic labels to client 511 511 $this->output->add_label('loading', 'servererror'); 512 512 -
program/include/rcube_addressbook.php
rcc90ed1 r7f5a849 39 39 public $groups = false; 40 40 public $readonly = true; 41 public $undelete = false; 41 42 public $ready = false; 42 43 public $group_id = null; … … 257 258 258 259 /** 259 * Remove all records from the database 260 * Unmark delete flag on contact record(s) 261 * 262 * @param array Record identifiers 263 */ 264 function undelete($ids) 265 { 266 /* empty for read-only address books */ 267 } 268 269 /** 270 * Mark all records in database as deleted 260 271 */ 261 272 function delete_all() -
program/include/rcube_contacts.php
rcc90ed1 r7f5a849 53 53 public $readonly = false; 54 54 public $groups = true; 55 public $undelete = true; 55 56 public $list_page = 1; 56 57 public $page_size = 10; … … 693 694 694 695 /** 696 * Undelete one or more contact records 697 * 698 * @param array Record identifiers 699 */ 700 function undelete($ids) 701 { 702 if (!is_array($ids)) 703 $ids = explode(',', $ids); 704 705 $ids = $this->db->array2list($ids, 'integer'); 706 707 // flag record as deleted 708 $this->db->query( 709 "UPDATE ".get_table_name($this->db_name). 710 " SET del=0, changed=".$this->db->now(). 711 " WHERE user_id=?". 712 " AND contact_id IN ($ids)", 713 $this->user_id 714 ); 715 716 $this->cache = null; 717 718 return $this->db->affected_rows(); 719 } 720 721 722 /** 695 723 * Remove all records from the database 696 724 */ 697 725 function delete_all() 698 726 { 699 $this->db->query("DELETE FROM ".get_table_name($this->db_name)." WHERE user_id = ?", $this->user_id);700 727 $this->cache = null; 728 729 $this->db->query("UPDATE ".get_table_name($this->db_name). 730 " SET del=1, changed=".$this->db->now(). 731 " WHERE user_id = ?", $this->user_id); 732 701 733 return $this->db->affected_rows(); 702 734 } -
program/include/rcube_json_output.php
r07b95dc r7f5a849 165 165 * @param array $vars Key-value pairs to be replaced in localized text 166 166 * @param boolean $override Override last set message 167 * @param int $timeout Message displaying time in seconds 167 168 * @uses self::command() 168 169 */ 169 public function show_message($message, $type='notice', $vars=null, $override=true )170 public function show_message($message, $type='notice', $vars=null, $override=true, $timeout=0) 170 171 { 171 172 if ($override || !$this->message) { 172 173 $this->message = $message; 173 174 $msgtext = rcube_label_exists($message) ? rcube_label(array('name' => $message, 'vars' => $vars)) : $message; 174 $this->command('display_message', $msgtext, $type );175 $this->command('display_message', $msgtext, $type, $timeout * 1000); 175 176 } 176 177 } -
program/include/rcube_template.php
r5bfa444 r7f5a849 239 239 * Invoke display_message command 240 240 * 241 * @param string Message to display 242 * @param string Message type [notice|confirm|error] 243 * @param array Key-value pairs to be replaced in localized text 244 * @param boolean Override last set message 241 * @param string $message Message to display 242 * @param string $type Message type [notice|confirm|error] 243 * @param array $vars Key-value pairs to be replaced in localized text 244 * @param boolean $override Override last set message 245 * @param int $timeout Message display time in seconds 245 246 * @uses self::command() 246 247 */ 247 public function show_message($message, $type='notice', $vars=null, $override=true )248 public function show_message($message, $type='notice', $vars=null, $override=true, $timeout=0) 248 249 { 249 250 if ($override || !$this->message) { 250 251 $this->message = $message; 251 252 $msgtext = rcube_label_exists($message) ? rcube_label(array('name' => $message, 'vars' => $vars)) : $message; 252 $this->command('display_message', $msgtext, $type );253 $this->command('display_message', $msgtext, $type, $timeout * 1000); 253 254 } 254 255 } -
program/js/app.js
r1a3c911 r7f5a849 165 165 166 166 // enable general commands 167 this.enable_command('logout', 'mail', 'addressbook', 'settings', 'save-pref', true);167 this.enable_command('logout', 'mail', 'addressbook', 'settings', 'save-pref', 'undo', true); 168 168 169 169 if (this.env.permaurl) … … 412 412 // show message 413 413 if (this.pending_message) 414 this.display_message(this.pending_message[0], this.pending_message[1] );414 this.display_message(this.pending_message[0], this.pending_message[1], this.pending_message[2]); 415 415 416 416 // map implicit containers … … 1047 1047 break; 1048 1048 1049 case 'undo': 1050 this.http_request('undo', '', this.display_message('', 'loading')); 1051 break; 1052 1049 1053 // unified command call (command name == function name) 1050 1054 default: … … 1297 1301 var li, div, pos, mouse, check, oldclass, 1298 1302 layerclass = 'draglayernormal'; 1299 1303 1300 1304 if (this.contact_list && this.contact_list.draglayer) 1301 1305 oldclass = this.contact_list.draglayer.attr('class'); … … 4981 4985 $elem.addClass('placeholder').attr('spellcheck', false).val(elem._placeholder); 4982 4986 }; 4983 4987 4984 4988 // write to the document/window title 4985 4989 this.set_pagetitle = function(title) … … 4990 4994 4991 4995 // display a system message, list of types in common.css (below #message definition) 4992 this.display_message = function(msg, type )4996 this.display_message = function(msg, type, timeout) 4993 4997 { 4994 4998 // pass command to parent window 4995 4999 if (this.is_framed()) 4996 return parent.rcmail.display_message(msg, type );5000 return parent.rcmail.display_message(msg, type, timeout); 4997 5001 4998 5002 if (!this.gui_objects.message) { 4999 5003 // save message in order to display after page loaded 5000 5004 if (type != 'loading') 5001 this.pending_message = new Array(msg, type );5005 this.pending_message = new Array(msg, type, timeout); 5002 5006 return false; 5003 5007 } … … 5006 5010 5007 5011 var ref = this, 5008 key = msg,5012 key = String(msg).replace(this.identifier_expr, '_'), 5009 5013 date = new Date(), 5010 id = type + date.getTime(), 5014 id = type + date.getTime(); 5015 5016 if (!timeout) 5011 5017 timeout = this.message_time * (type == 'error' || type == 'warning' ? 2 : 1); 5012 5018 5013 5019 if (type == 'loading') { 5014 5020 key = 'loading'; -
program/localization/en_US/labels.inc
r4171c59 r7f5a849 449 449 $labels['sortasc'] = 'Sort ascending'; 450 450 $labels['sortdesc'] = 'Sort descending'; 451 $labels['undo'] = 'Undo'; 451 452 452 453 // units -
program/localization/en_US/messages.inc
r1d5779b r7f5a849 129 129 $messages['contactdelerror'] = 'Could not delete contact(s)'; 130 130 $messages['contactdeleted'] = 'Contact(s) deleted successfully'; 131 $messages['contactrestoreerror'] = 'Could not restore deleted contact(s)'; 132 $messages['contactrestored'] = 'Contact(s) restored successfully'; 131 133 $messages['groupdeleted'] = 'Group deleted successfully'; 132 134 $messages['grouprenamed'] = 'Group renamed successfully'; … … 143 145 $messages['invalidimageformat'] = 'Not a valid image format'; 144 146 $messages['mispellingsfound'] = 'Spelling errors detected in the message'; 147 $messages['itemsdeleted'] = '$num item(s) has been deleted.'; 145 148 146 149 ?> -
program/localization/pl_PL/labels.inc
r81a0cfb r7f5a849 468 468 $labels['grouprename'] = 'ZmieÅ nazwÄ grupy'; 469 469 $labels['groupdelete'] = 'UsuÅ grupÄ'; 470 $labels['undo'] = 'Cofnij'; 470 471 471 472 ?> -
program/localization/pl_PL/messages.inc
r12bfc55e r7f5a849 194 194 $messages['invalidimageformat'] = 'Niepoprawny format obrazka'; 195 195 $messages['mispellingsfound'] = 'Wykryto bÅÄdy pisowni w tej wiadomoÅci'; 196 $messages['itemsdeleted'] = '$num elemenów zostaÅo usuniÄtych.'; 197 $messages['contactrestoreerror'] = 'Przywracanie kontaktów nie powiodÅo siÄ'; 198 $messages['contactrestored'] = 'Kontakt(y) zostaÅy przywrócone'; 196 199 197 200 ?> -
program/steps/addressbook/delete.inc
recf295f r7f5a849 27 27 $delcnt = 0; 28 28 29 // remove previous deletes 30 $RCMAIL->session->remove('contact_undo'); 31 29 32 foreach ($cids as $source => $cid) 30 33 { … … 37 40 $OUTPUT->show_message('contactdelerror', 'error'); 38 41 $OUTPUT->command('list_contacts'); 42 $OUTPUT->send(); 39 43 } 40 44 continue; … … 53 57 else { 54 58 $delcnt += $deleted; 59 60 // store deleted contacts IDs in session for undelete 61 if ($CONTACTS->undelete) { 62 $_SESSION['contact_undo']['data'][$source] = $cid; 63 } 55 64 } 56 65 } 57 58 $OUTPUT->show_message('contactdeleted', 'confirmation');59 66 60 67 $page = isset($_SESSION['page']) ? $_SESSION['page'] : 1; … … 136 143 $OUTPUT->command('set_rowcount', rcmail_get_rowcount_text($result)); 137 144 145 if (!empty($_SESSION['contact_undo'])) { 146 $_SESSION['contact_undo']['ts'] = time(); 147 $msg = html::span(null, rcube_label(array('name' => 'itemsdeleted', 'vars' => array('num' => $deleted)))) 148 . ' ' . html::a(array('onclick' => JS_OBJECT_NAME.".command('undo', '', this)"), rcube_label('undo')); 149 150 $OUTPUT->show_message($msg, 'confirmation', null, true, $RCMAIL->config->get('undo_timeout', 15)); 151 } 152 else { 153 $OUTPUT->show_message('contactdeleted', 'confirmation'); 154 } 155 138 156 // add new rows from next page (if any) 139 157 if (!empty($records)) { -
program/steps/addressbook/func.inc
r5b3ac324 r7f5a849 89 89 } 90 90 91 // remove undo information... 92 if ($undo = $_SESSION['contact_undo']) { 93 // ...after 30 seconds 94 if ($undo['ts'] < time() - 30) 95 $RCMAIL->session->remove('contact_undo'); 96 } 91 97 92 98 // instantiate a contacts object according to the given source -
skins/default/common.css
r39d8ccd r7f5a849 251 251 background-color: #EBEBEB; 252 252 border: 1px solid #CCCCCC; 253 } 254 255 #message a 256 { 257 cursor: pointer; 258 text-decoration: underline; 253 259 } 254 260 -
skins/default/templates/mail.html
r8e99ffb r7f5a849 197 197 </div> 198 198 </div> 199 199 <div id="undelete-message">11 item(s) has been deleted. <a href="#">Undo</a></div> 200 200 </body> 201 201 </html>
Note: See TracChangeset
for help on using the changeset viewer.
