single from address was shown twice in mail display

This commit is contained in:
Ralf Becker 2014-09-23 08:45:10 +00:00
parent 712b9acd94
commit d83d3db364

View File

@ -191,12 +191,12 @@ app.classes.mail = AppJS.extend(
var that = this; var that = this;
this.mail_isMainWindow = false; this.mail_isMainWindow = false;
this.compose_fieldExpander_hide(); this.compose_fieldExpander_hide();
// Set autosaving interval to 2 minutes for compose message // Set autosaving interval to 2 minutes for compose message
window.setInterval(function (){ window.setInterval(function (){
that.saveAsDraft(null,that.et2.getWidgetById('button[saveAsDraft]'),'autosaving'); that.saveAsDraft(null,that.et2.getWidgetById('button[saveAsDraft]'),'autosaving');
}, 120000); }, 120000);
/* Control focus actions on subject to handle expanders properly.*/ /* Control focus actions on subject to handle expanders properly.*/
jQuery("#mail-compose_subject").on({ jQuery("#mail-compose_subject").on({
focus:function(){ focus:function(){
@ -636,9 +636,12 @@ app.classes.mail = AppJS.extend(
var content = _dataElem.data[field.data] || []; var content = _dataElem.data[field.data] || [];
// Add in single address, if there // Add in single address, if there
if(typeof field.data_one != 'undefined') if(typeof field.data_one != 'undefined' && field.data != field.data_one)
{ {
content.unshift(_dataElem.data[field.data_one]); if (jQuery.isArray(_dataElem.data[field.data_one]))
content = content.concat(_dataElem.data[field.data_one]);
else
content.unshift(_dataElem.data[field.data_one]);
// Unique // Unique
content = content.filter(function(value, index, self) { content = content.filter(function(value, index, self) {
return self.indexOf(value) === index; return self.indexOf(value) === index;
@ -3141,11 +3144,11 @@ app.classes.mail = AppJS.extend(
} }
} }
}, },
/** /**
* Save as Draft (VFS) * Save as Draft (VFS)
* -handel both actions save as draft and save as draft and print * -handel both actions save as draft and save as draft and print
* *
* @param {egw object} _egw * @param {egw object} _egw
* @param {widget object} _widget * @param {widget object} _widget
* @param {string} _action autosaving trigger action * @param {string} _action autosaving trigger action
@ -3158,7 +3161,7 @@ app.classes.mail = AppJS.extend(
{ {
var action = _action == 'autosaving'?_action: _widget.id; var action = _action == 'autosaving'?_action: _widget.id;
} }
var widgets = ['from','to','cc','bcc','subject','folder','replyto','mailaccount', 'mail_htmltext', 'mail_plaintext', 'lastDrafted']; var widgets = ['from','to','cc','bcc','subject','folder','replyto','mailaccount', 'mail_htmltext', 'mail_plaintext', 'lastDrafted'];
var widget = {}; var widget = {};
for (var index in widgets) for (var index in widgets)
@ -3170,8 +3173,8 @@ app.classes.mail = AppJS.extend(
} }
} }
var self = this; var self = this;
if (content) if (content)
{ {
this.egw.json('mail.mail_compose.ajax_saveAsDraft',[content],function(_data){ this.egw.json('mail.mail_compose.ajax_saveAsDraft',[content],function(_data){
self.savingDraft_response(_data,action); self.savingDraft_response(_data,action);
}).sendRequest(true); }).sendRequest(true);
@ -3181,14 +3184,14 @@ app.classes.mail = AppJS.extend(
/** /**
* Set content of drafted message with new information sent back from server * Set content of drafted message with new information sent back from server
* This function would be used as callback of send request to ajax_saveAsDraft. * This function would be used as callback of send request to ajax_saveAsDraft.
* *
* @param {object} _responseData response data sent back from server by ajax_saveAsDraft function. * @param {object} _responseData response data sent back from server by ajax_saveAsDraft function.
* the object conatins below items: * the object conatins below items:
* -draftedId: new drafted id created by server * -draftedId: new drafted id created by server
* -message: resault message * -message: resault message
* -success: true if saving was successful otherwise false * -success: true if saving was successful otherwise false
* -draftfolder: Name of draft folder including its delimiter * -draftfolder: Name of draft folder including its delimiter
* *
* @param {string} _action action is the element which caused saving draft, it could be as such: * @param {string} _action action is the element which caused saving draft, it could be as such:
* -button[saveAsDraft] * -button[saveAsDraft]
* -button[saveAsDraftAndPrint] * -button[saveAsDraftAndPrint]
@ -3202,7 +3205,7 @@ app.classes.mail = AppJS.extend(
this.egw.message('Could not saved the message. Because, the response from server failed.', 'error'); this.egw.message('Could not saved the message. Because, the response from server failed.', 'error');
return false; return false;
} }
if (_responseData.success) if (_responseData.success)
{ {
var content = this.et2.getArrayMgr('content'); var content = this.et2.getArrayMgr('content');
@ -3241,7 +3244,7 @@ app.classes.mail = AppJS.extend(
this.egw.message(_responseData.message, 'error'); this.egw.message(_responseData.message, 'error');
} }
}, },
/** /**
* Focus handler for folder, address, reject textbox/taglist to automatic check associated radio button * Focus handler for folder, address, reject textbox/taglist to automatic check associated radio button
* *
@ -3797,7 +3800,7 @@ app.classes.mail = AppJS.extend(
} }
}, },
/** /**
* Print a mail from compose * Print a mail from compose
* @param {stirng} _id id of new draft * @param {stirng} _id id of new draft
@ -3806,17 +3809,17 @@ app.classes.mail = AppJS.extend(
{ {
this.egw.open(_id,'mail','view','&print='+_id+'&mode=print'); this.egw.open(_id,'mail','view','&print='+_id+'&mode=print');
}, },
/** /**
* Bind special handler on print media. * Bind special handler on print media.
* -FF and IE have onafterprint event, and as Chrome does not have that event we bind afterprint function to onFocus * -FF and IE have onafterprint event, and as Chrome does not have that event we bind afterprint function to onFocus
*/ */
print_for_compose: function() print_for_compose: function()
{ {
var afterprint = function (){ var afterprint = function (){
window.close(); window.close();
}; };
if (!window.onafterprint) if (!window.onafterprint)
{ {
// For browsers which does not support onafterprint event, eg. Chrome // For browsers which does not support onafterprint event, eg. Chrome
@ -3828,8 +3831,8 @@ app.classes.mail = AppJS.extend(
{ {
window.onafterprint = afterprint; window.onafterprint = afterprint;
} }
}, },
/** /**
* Print a mail from Display * Print a mail from Display
* *