From 4d0413dd899f9407bf44c563924324e56945981f Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Wed, 19 Sep 2007 02:48:18 -0400
Subject: [PATCH] Unlock interface when message sending fails (#1484570)

---
 CHANGELOG                           |    3 ++-
 program/include/rcmail_template.inc |    6 +++++-
 program/js/app.js                   |    1 +
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 39f5050..f227acb 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,8 +1,9 @@
 CHANGELOG RoundCube Webmail
 ---------------------------
 
-2007/09/18 (thomasb)
+2007/09/19 (thomasb)
 ----------
+- Unlock interface when message sending fails (#1484570)
 - Eval PHP code in template includes (if configured)
 - Show message when folder is empty. Mo more static text in table (#1484395)
 - Only display unread count in page title when new messages arrived
diff --git a/program/include/rcmail_template.inc b/program/include/rcmail_template.inc
index 734032e..15752f8 100644
--- a/program/include/rcmail_template.inc
+++ b/program/include/rcmail_template.inc
@@ -242,6 +242,10 @@
    */
   function write($template='')
   {
+    // unlock interface after iframe load
+    if ($this->framed)
+      array_unshift($this->js_commands, array('set_busy', false));
+    
     // write all env variables to client
     $js = $this->framed ? "if(window.parent) {\n" : '';
     $js .= $this->get_js_commands() . ($this->framed ? ' }' : '');
@@ -305,7 +309,7 @@
   function get_js_commands()
   {
     $out = '';
-    if (!$this->framed)
+    if (!$this->framed && !empty($this->js_env))
       $out .= ($this->ajax_call ? 'this' : JS_OBJECT_NAME) . '.set_env('.json_serialize($this->js_env).");\n";
     
     foreach ($this->js_commands as $i => $args)
diff --git a/program/js/app.js b/program/js/app.js
index 9693ff5..1711ab5 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -804,6 +804,7 @@
         this.set_busy(true, 'savingmessage');
         var form = this.gui_objects.messageform;
         form.target = "savetarget";
+        form._draft.value = '1';
         form.submit();
         break;
 

--
Gitblit v1.9.1