From 1a3c911d925ae0dd19c35c29f8f1a0c164015a69 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Wed, 06 Jul 2011 08:54:56 -0400
Subject: [PATCH] - Fixed issues related to creating contacts in source which isn't currently selected (#1487990)

---
 program/js/app.js |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/program/js/app.js b/program/js/app.js
index d26b0d5..6a35c59 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -637,7 +637,7 @@
           }
           // contacts/identities
           else {
-            //
+            // reload form
             if (props == 'reload') {
               form.action += '?_reload=1';
             }
@@ -647,7 +647,7 @@
               break;
             }
             else if (this.task == 'settings' && (this.env.identities_level % 2) == 0  &&
-              (input = $("input[name='_email']", form)) && input.length&& !rcube_check_email(input.val())
+              (input = $("input[name='_email']", form)) && input.length && !rcube_check_email(input.val())
             ) {
               alert(this.get_label('noemailwarning'));
               input.focus();
@@ -657,6 +657,10 @@
             // clear empty input fields
             $('input.placeholder').each(function(){ if (this.value == this._placeholder) this.value = ''; });
           }
+
+          // add selected source (on the list)
+          if (parent.rcmail && parent.rcmail.env.source)
+            form.action = this.add_url(form.action, '_orig_source', parent.rcmail.env.source);
 
           form.submit();
         }
@@ -3803,6 +3807,13 @@
       add_url = '&_framed=1';
       target = window.frames[this.env.contentframe];
       this.show_contentframe(true);
+
+      // load dummy content
+      if (!cid) {
+        // unselect selected row(s)
+        this.contact_list.clear_selection();
+        this.enable_command('delete', 'compose', false);
+      }
     }
     else if (framed)
       return false;

--
Gitblit v1.9.1