[Svn] r4172 - in trunk/roundcubemail: . program/js program/localization/en_US program/localization/pl_PL program/steps/addressbook program/steps/mail

trac at roundcube.net trac at roundcube.net
Wed Nov 3 15:19:49 CET 2010


Author: alec
Date: 2010-11-03 09:19:48 -0500 (Wed, 03 Nov 2010)
New Revision: 4172

Modified:
   trunk/roundcubemail/CHANGELOG
   trunk/roundcubemail/program/js/app.js
   trunk/roundcubemail/program/localization/en_US/messages.inc
   trunk/roundcubemail/program/localization/pl_PL/messages.inc
   trunk/roundcubemail/program/steps/addressbook/delete.inc
   trunk/roundcubemail/program/steps/addressbook/groups.inc
   trunk/roundcubemail/program/steps/mail/copy.inc
   trunk/roundcubemail/program/steps/mail/func.inc
   trunk/roundcubemail/program/steps/mail/mark.inc
   trunk/roundcubemail/program/steps/mail/move_del.inc
   trunk/roundcubemail/program/steps/mail/show.inc
Log:
- Add missing confirmation/error messages on contact/group/message actions (#1486845)
- Add 'loading' message on message move/copy/delete/mark actions


Modified: trunk/roundcubemail/CHANGELOG
===================================================================
--- trunk/roundcubemail/CHANGELOG	2010-11-03 13:04:23 UTC (rev 4171)
+++ trunk/roundcubemail/CHANGELOG	2010-11-03 14:19:48 UTC (rev 4172)
@@ -60,6 +60,8 @@
 - Improve performance of message cache status checking with skip_disabled=true
 - Support contact's email addresses up to 255 characters long (#1487095)
 - Add option to place replies in the folder of the message being replied to (#1485945)
+- Add missing confirmation/error messages on contact/group/message actions (#1486845)
+- Add 'loading' message on message move/copy/delete/mark actions
 
 RELEASE 0.4.2
 -------------

Modified: trunk/roundcubemail/program/js/app.js
===================================================================
--- trunk/roundcubemail/program/js/app.js	2010-11-03 13:04:23 UTC (rev 4171)
+++ trunk/roundcubemail/program/js/app.js	2010-11-03 14:19:48 UTC (rev 4172)
@@ -2362,6 +2362,7 @@
       return;
 
     var a_uids = [],
+      lock = this.display_message(this.get_label('copyingmessage'), 'loading'),
       add_url = '&_target_mbox='+urlencode(mbox)+'&_from='+(this.env.action ? this.env.action : '');
 
     if (this.env.uid)
@@ -2374,7 +2375,7 @@
     }
 
     // send request to server
-    this.http_post('copy', '_uid='+a_uids.join(',')+'&_mbox='+urlencode(this.env.mailbox)+add_url, false);
+    this.http_post('copy', '_uid='+a_uids.join(',')+'&_mbox='+urlencode(this.env.mailbox)+add_url, lock);
   };
 
   // move selected messages to the specified mailbox
@@ -2425,7 +2426,7 @@
       return false;
     }
     // if there isn't a defined trash mailbox or we are in it
-    else if (!this.env.trash_mailbox || this.env.mailbox == this.env.trash_mailbox) 
+    else if (!this.env.trash_mailbox || this.env.mailbox == this.env.trash_mailbox)
       this.permanently_remove_messages();
     // if there is a trash mailbox defined and we're not currently in it
     else {
@@ -2456,7 +2457,7 @@
   // @private
   this._with_selected_messages = function(action, lock, add_url)
   {
-    var a_uids = [], count = 0;
+    var a_uids = [], count = 0, msg;
 
     if (this.env.uid)
       a_uids[0] = this.env.uid;
@@ -2486,7 +2487,7 @@
       }
     }
 
-    // also send search request to get the right messages 
+    // also send search request to get the right messages
     if (this.env.search_request)
       add_url += '&_search='+this.env.search_request;
 
@@ -2501,6 +2502,11 @@
 
     add_url += '&_uid='+this.uids_to_list(a_uids);
 
+    if (!lock) {
+      msg = action == 'moveto' ? 'movingmessage' : 'deletingmessage';
+      lock = this.display_message(this.get_label(msg), 'loading');
+    }
+
     // send request to server
     this.http_post(action, '_mbox='+urlencode(this.env.mailbox)+add_url, lock);
   };
@@ -2564,13 +2570,14 @@
     for (var i=0; i<a_uids.length; i++)
       this.set_message(a_uids[i], 'unread', (flag=='unread' ? true : false));
 
-    var url = '_uid='+this.uids_to_list(a_uids)+'&_flag='+flag;
+    var url = '_uid='+this.uids_to_list(a_uids)+'&_flag='+flag,
+      lock = this.display_message(this.get_label('markingmessage'), 'loading');
 
     // also send search request to get the right messages
     if (this.env.search_request)
       url += '&_search='+this.env.search_request;
 
-    this.http_post('mark', url);
+    this.http_post('mark', url, lock);
 
     for (var i=0; i<a_uids.length; i++)
       this.update_thread_root(a_uids[i], flag);
@@ -2583,13 +2590,14 @@
     for (var i=0; i<a_uids.length; i++)
       this.set_message(a_uids[i], 'flagged', (flag=='flagged' ? true : false));
 
-    var url = '_uid='+this.uids_to_list(a_uids)+'&_flag='+flag;
+    var url = '_uid='+this.uids_to_list(a_uids)+'&_flag='+flag,
+      lock = this.display_message(this.get_label('markingmessage'), 'loading');
 
     // also send search request to get the right messages
     if (this.env.search_request)
       url += '&_search='+this.env.search_request;
 
-    this.http_post('mark', url);
+    this.http_post('mark', url, lock);
   };
 
   // mark all message rows as deleted/undeleted
@@ -2628,13 +2636,14 @@
     for (var i=0, len=a_uids.length; i<len; i++)
       this.set_message(a_uids[i], 'deleted', false);
 
-    var url = '_uid='+this.uids_to_list(a_uids)+'&_flag=undelete';
+    var url = '_uid='+this.uids_to_list(a_uids)+'&_flag=undelete',
+      lock = this.display_message(this.get_label('markingmessage'), 'loading');
 
     // also send search request to get the right messages
     if (this.env.search_request)
       url += '&_search='+this.env.search_request;
 
-    this.http_post('mark', url);
+    this.http_post('mark', url, lock);
     return true;
   };
 
@@ -2671,7 +2680,8 @@
         this.delete_excessive_thread_rows();
     }
 
-    add_url = '&_from='+(this.env.action ? this.env.action : '');
+    add_url = '&_from='+(this.env.action ? this.env.action : ''),
+      lock = this.display_message(this.get_label('markingmessage'), 'loading');
 
     // ??
     if (r_uids.length)
@@ -2686,8 +2696,8 @@
     if (this.env.search_request)
       add_url += '&_search='+this.env.search_request;
 
-    this.http_post('mark', '_uid='+this.uids_to_list(a_uids)+'&_flag=delete'+add_url);
-    return true;  
+    this.http_post('mark', '_uid='+this.uids_to_list(a_uids)+'&_flag=delete'+add_url, lock);
+    return true;
   };
 
   // flag as read without mark request (called from backend)

Modified: trunk/roundcubemail/program/localization/en_US/messages.inc
===================================================================
--- trunk/roundcubemail/program/localization/en_US/messages.inc	2010-11-03 13:04:23 UTC (rev 4171)
+++ trunk/roundcubemail/program/localization/en_US/messages.inc	2010-11-03 14:19:48 UTC (rev 4172)
@@ -87,8 +87,10 @@
 $messages['copyerror'] = 'Could not copy any addresses';
 $messages['sourceisreadonly'] = 'This address source is read only';
 $messages['errorsavingcontact'] = 'Could not save the contact address';
-$messages['movingmessage'] = 'Moving message...';
-$messages['copyingmessage'] = 'Copying message...';
+$messages['movingmessage'] = 'Moving message(s)...';
+$messages['copyingmessage'] = 'Copying message(s)...';
+$messages['deletingmessage'] = 'Deleting message(s)...';
+$messages['markingmessage'] = 'Marking message(s)...';
 $messages['receiptsent'] = 'Successfully sent a read receipt';
 $messages['errorsendingreceipt'] = 'Could not send the receipt';
 $messages['nodeletelastidentity'] = 'You cannot delete this identity, it\'s your last one.';
@@ -116,5 +118,14 @@
 $messages['toomanyrecipients'] = 'Too many recipients. Reduce the number of recipients to $max.';
 $messages['maxgroupmembersreached'] = 'The number of group members exceeds the maximum of $max';
 $messages['internalerror'] = 'An internal error occured. Please try again';
+$messages['contactdelerror'] = 'Could not delete contact(s)';
+$messages['contactdeleted'] = 'Contact(s) deleted successfully';
+$messages['groupdeleted'] = 'Group deleted successfully';
+$messages['grouprenamed'] = 'Group renamed successfully';
+$messages['groupcreated'] = 'Group created successfully';
+$messages['messagedeleted'] = 'Message(s) deleted successfully';
+$messages['messagemoved'] = 'Message(s) moved successfully';
+$messages['messagecopied'] = 'Message(s) copied successfully';
+$messages['messagemarked'] = 'Message(s) marked successfully';
 
 ?>

Modified: trunk/roundcubemail/program/localization/pl_PL/messages.inc
===================================================================
--- trunk/roundcubemail/program/localization/pl_PL/messages.inc	2010-11-03 13:04:23 UTC (rev 4171)
+++ trunk/roundcubemail/program/localization/pl_PL/messages.inc	2010-11-03 14:19:48 UTC (rev 4172)
@@ -94,6 +94,8 @@
 $messages['errorsavingcontact'] = 'Nie można było zapisać adresu kontaktu';
 $messages['movingmessage'] = 'Przenoszenie wiadomości...';
 $messages['copyingmessage'] = 'Kopiowanie wiadomości...';
+$messages['deletingmessage'] = 'Usuwanie wiadomości...';
+$messages['markingmessage'] = 'Oznaczanie wiadomości...';
 $messages['receiptsent'] = 'Pomyślnie wysłano potwierdzenie dostarczenia';
 $messages['errorsendingreceipt'] = 'Nie można wysłać potwierdzenia';
 $messages['nodeletelastidentity'] = 'Nie można skasować tej tożsamości, ponieważ jest ostatnią.';
@@ -120,6 +122,15 @@
 $messages['emailformaterror'] = 'Błędny adres e-mail: $email';
 $messages['toomanyrecipients'] = 'Zbyt wielu odbiorców. Zmniejsz ich liczbę do $max.';
 $messages['maxgroupmembersreached'] = 'Liczba członków grupy nie może być większa niż $max';
-$messages['internalerror'] = 'Wystąpił wewnętrzny błąd systemu. Spróbuj jeszcze raz'
+$messages['internalerror'] = 'Wystąpił wewnętrzny błąd systemu. Spróbuj jeszcze raz';
+$messages['contactdelerror'] = 'Usuwanie kontaktów nie powiodło się';
+$messages['contactdeleted'] = 'Kontakt(y) został(y) usunięte';
+$messages['groupdeleted'] = 'Grupa została usunięta';
+$messages['grouprenamed'] = 'Nazwa grupy została zmieniona';
+$messages['groupcreated'] = 'Grupa została utworzona';
+$messages['messagedeleted'] = 'Wiadomości zostały usunięte';
+$messages['messagemoved'] = 'Wiadomości zostały przeniesione';
+$messages['messagecopied'] = 'Wiadomości zostały skopiowane';
+$messages['messagemarked'] = 'Wiadomości zostały oznaczone';
 
 ?>

Modified: trunk/roundcubemail/program/steps/addressbook/delete.inc
===================================================================
--- trunk/roundcubemail/program/steps/addressbook/delete.inc	2010-11-03 13:04:23 UTC (rev 4171)
+++ trunk/roundcubemail/program/steps/addressbook/delete.inc	2010-11-03 14:19:48 UTC (rev 4172)
@@ -23,30 +23,33 @@
     ($cid = get_input_value('_cid', RCUBE_INPUT_POST)) &&
     preg_match('/^[a-zA-Z0-9\+\/=_-]+(,[a-zA-Z0-9\+\/=_-]+)*$/', $cid)
 ) {
-  $plugin = $RCMAIL->plugins->exec_hook('contact_delete', array(
-    'id' => $cid, 'source' => get_input_value('_source', RCUBE_INPUT_GPC)));
+    $plugin = $RCMAIL->plugins->exec_hook('contact_delete', array(
+        'id' => $cid, 'source' => get_input_value('_source', RCUBE_INPUT_GPC)));
 
-  $deleted = !$plugin['abort'] ? $CONTACTS->delete($cid) : $plugin['result'];
+    $deleted = !$plugin['abort'] ? $CONTACTS->delete($cid) : $plugin['result'];
 
-  if (!$deleted) {
-    // send error message
-    exit;
-  }
+    if (!$deleted) {
+        $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'contactdelerror', 'error');
+        $OUTPUT->command('list_contacts');
+    }
+    else {
+        $OUTPUT->show_message('contactdeleted', 'confirmation');
 
-  // count contacts for this user
-  $result = $CONTACTS->count();
+        // count contacts for this user
+        $result = $CONTACTS->count();
 
-  // update message count display
-  $OUTPUT->set_env('pagecount', ceil($result->count / $CONTACTS->page_size));
-  $OUTPUT->command('set_rowcount', rcmail_get_rowcount_text($result->count));
+        // update message count display
+        $OUTPUT->set_env('pagecount', ceil($result->count / $CONTACTS->page_size));
+        $OUTPUT->command('set_rowcount', rcmail_get_rowcount_text($result->count));
 
-  // add new rows from next page (if any)
-  $pages = ceil(($result->count + $deleted) / $CONTACTS->page_size);
-  if ($_GET['_from'] != 'show' && $pages > 1 && $CONTACTS->list_page < $pages)
-    rcmail_js_contacts_list($CONTACTS->list_records(null, -$deleted));
+        // add new rows from next page (if any)
+        $pages = ceil(($result->count + $deleted) / $CONTACTS->page_size);
+        if ($_GET['_from'] != 'show' && $pages > 1 && $CONTACTS->list_page < $pages)
+            rcmail_js_contacts_list($CONTACTS->list_records(null, -$deleted));
+    }
 
-  // send response
-  $OUTPUT->send();
+    // send response
+    $OUTPUT->send();
 }
 
 exit;

Modified: trunk/roundcubemail/program/steps/addressbook/groups.inc
===================================================================
--- trunk/roundcubemail/program/steps/addressbook/groups.inc	2010-11-03 13:04:23 UTC (rev 4171)
+++ trunk/roundcubemail/program/steps/addressbook/groups.inc	2010-11-03 14:19:48 UTC (rev 4172)
@@ -29,10 +29,10 @@
 if ($RCMAIL->action == 'group-addmembers') {
   if (($gid = get_input_value('_gid', RCUBE_INPUT_POST)) && ($ids = get_input_value('_cid', RCUBE_INPUT_POST))) {
     $plugin = $RCMAIL->plugins->exec_hook('group_addmembers', array('group_id' => $gid, 'ids' => $ids, 'source' => $source));
-    
+
     $CONTACTS->set_group($gid);
     $num2add = count(explode(',', $plugin['ids']));
-    
+
     if (!$plugin['abort']) {
       if (($maxnum = $RCMAIL->config->get('max_group_members', 0)) && ($CONTACTS->count()->count + $num2add > $maxnum)) {
         $OUTPUT->show_message('maxgroupmembersreached', 'warning', array('max' => $maxnum));
@@ -44,26 +44,26 @@
       $result = $plugin['result'];
     }
 
-    if ($result) 
+    if ($result)
       $OUTPUT->show_message('contactaddedtogroup');
-    else if ($plugin['message'])
-      $OUTPUT->show_message($plugin['message'], 'warning');
+    else
+      $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error');
   }
 }
 
 else if ($RCMAIL->action ==