Merge branch 'tine20.com/2012.10' into 2013.03
[tine20] / tine20 / Felamimail / js / MessageEditDialog.js
index 7896626..7eed4cf 100644 (file)
@@ -184,6 +184,18 @@ Tine.Felamimail.MessageEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog, {
             tooltip: this.app.i18n._('Activate this toggle button to save the email text as a note attached to the recipient(s) contact(s).')
         });
 
+        this.action_toggleReadingConfirmation = new Ext.Action({
+            text: this.app.i18n._('Reading Confirmation'),
+            handler: this.onToggleReadingConfirmation,
+            iconCls: 'felamimail-action-reading-confirmation',
+            disabled: false,
+            scope: this,
+            enableToggle: true
+        });
+        this.button_toggleReadingConfirmation = Ext.apply(new Ext.Button(this.action_toggleReadingConfirmation), {
+            tooltip: this.app.i18n._('Activate this toggle button to receive a reading confirmation.')
+        });
+
         this.tbar = new Ext.Toolbar({
             defaults: {height: 55},
             items: [{
@@ -203,7 +215,8 @@ Tine.Felamimail.MessageEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog, {
                     }),
                     this.action_saveAsDraft,
                     this.button_saveEmailNote,
-                    this.action_saveAsTemplate
+                    this.action_saveAsTemplate,
+                    this.button_toggleReadingConfirmation
                 ]
             }]
         });
@@ -231,6 +244,7 @@ Tine.Felamimail.MessageEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog, {
         this.initRecipients();
         this.initSubject();
         this.initContent();
+        
         // legacy handling:...
         // TODO add this information to attachment(s) + flags and remove this
         if (this.replyTo) {
@@ -418,6 +432,23 @@ Tine.Felamimail.MessageEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog, {
                 this.subjectField.focus.defer(50, this.subjectField);
             }
         }, this);
+        
+        this.initHtmlEditorDD();
+    },
+    
+    
+    initHtmlEditorDD: function() {
+        if (! this.htmlEditor.rendered) {
+            return this.initHtmlEditorDD.defer(500, this);
+        }
+        
+        this.htmlEditor.getDoc().addEventListener('dragover', function(e) {
+            this.action_addAttachment.plugins[0].onBrowseButtonClick();
+        }.createDelegate(this));
+        
+        this.htmlEditor.getDoc().addEventListener('drop', function(e) {
+            this.action_addAttachment.plugins[0].onDrop(Ext.EventObject.setEvent(e));
+        }.createDelegate(this));
     },
     
     /**
@@ -655,6 +686,13 @@ Tine.Felamimail.MessageEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog, {
     },
     
     /**
+     * toggle Request Reading Confirmation
+     */
+    onToggleReadingConfirmation: function () {
+        this.record.set('reading_conf', (! this.record.get('reading_conf')));
+    },
+
+    /**
      * search for contacts as recipients
      */
     onSearchContacts: function() {
@@ -773,7 +811,7 @@ Tine.Felamimail.MessageEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog, {
             
             // add file upload button to toolbar
             this.action_addAttachment = this.attachmentGrid.getAddAction();
-            this.action_addAttachment.plugins[0].dropElSelector = null;
+            this.action_addAttachment.plugins[0].dropElSelector = 'div[id=' + this.id + ']';
             this.action_addAttachment.plugins[0].onBrowseButtonClick = function() {
                 this.southPanel.expand();
             }.createDelegate(this);