Fix add emails from AB to mail compose getting join with comma. Additionally, fix warnings, and complete undocumented functions

This commit is contained in:
Hadi Nategh 2014-05-16 15:39:05 +00:00
parent a4a3f7b61f
commit 029adcca5e

View File

@ -373,10 +373,12 @@ app.classes.mail = AppJS.extend(
* @memberOf mail * @memberOf mail
* *
* @param {String} window_name The name of an open content window. * @param {String} window_name The name of an open content window.
* @param content Data to set into the window's fields * @param {object} content
* @param content.to Addresses to add to the to line *
* @param content.cc Addresses to add to the CC line * @description content Data to set into the window's fields
* @param content.bcc Addresses to add to the BCC line * content.to Addresses to add to the to line
* content.cc Addresses to add to the CC line
* content.bcc Addresses to add to the BCC line
* *
* @return {boolean} Success * @return {boolean} Success
*/ */
@ -392,15 +394,16 @@ app.classes.mail = AppJS.extend(
{ {
return false; return false;
} }
// Set each field provided // Set each field provided
var success = true; var success = true;
var arrContent = [];
for(var field in content) for(var field in content)
{ {
try try
{ {
var widget = compose_et2[0].widgetContainer.getWidgetById(field); var widget = compose_et2[0].widgetContainer.getWidgetById(field);
// Merge array values, replace strings // Merge array values, replace strings
var value = widget.getValue() || content[field]; var value = widget.getValue() || content[field];
if(jQuery.isArray(value)) if(jQuery.isArray(value))
@ -411,7 +414,11 @@ app.classes.mail = AppJS.extend(
} }
else else
{ {
value.push(content[field]); arrContent = content[field].split(',');
for (var k=0;k < arrContent.length;k++)
{
value.push(arrContent[k]);
}
} }
} }
widget.set_value(value); widget.set_value(value);
@ -565,7 +572,7 @@ app.classes.mail = AppJS.extend(
if (window.location.search.search('&print=') >= 0) if (window.location.search.search('&print=') >= 0)
{ {
var that = this; var that = this;
jQuery('#mail-display_mailDisplayBodySrc').bind('load',function(){that.mail_print()}); jQuery('#mail-display_mailDisplayBodySrc').bind('load',function(){that.mail_print();});
} }
}, },
@ -741,8 +748,11 @@ app.classes.mail = AppJS.extend(
/** /**
* mail_refreshFolderStatus, function to call to read the counters of a folder and apply them * mail_refreshFolderStatus, function to call to read the counters of a folder and apply them
* *
* @param _nodeID * @param {stirng} _nodeID
* @param mode * @param {string} mode
* @param {boolean} _refreshGridArea
* @param {boolean} _refreshQuotaDisplay
*
*/ */
mail_refreshFolderStatus: function(_nodeID,mode,_refreshGridArea,_refreshQuotaDisplay) { mail_refreshFolderStatus: function(_nodeID,mode,_refreshGridArea,_refreshQuotaDisplay) {
if (typeof _nodeID != 'undefined' && typeof _nodeID[_nodeID] != 'undefined' && _nodeID[_nodeID]) if (typeof _nodeID != 'undefined' && typeof _nodeID[_nodeID] != 'undefined' && _nodeID[_nodeID])
@ -785,6 +795,8 @@ app.classes.mail = AppJS.extend(
/** /**
* mail_refreshQuotaDisplay, function to call to read the quota for the active server * mail_refreshQuotaDisplay, function to call to read the quota for the active server
*
* @param {object} _server
* *
*/ */
mail_refreshQuotaDisplay: function(_server) mail_refreshQuotaDisplay: function(_server)
@ -795,6 +807,8 @@ app.classes.mail = AppJS.extend(
/** /**
* mail_setQuotaDisplay, function to call to read the quota for the active server * mail_setQuotaDisplay, function to call to read the quota for the active server
*
* @param {object} _data
* *
*/ */
mail_setQuotaDisplay: function(_data) mail_setQuotaDisplay: function(_data)
@ -826,6 +840,8 @@ app.classes.mail = AppJS.extend(
/** /**
* mail_callRefreshVacationNotice, function to call the serverside function to refresh the vacationnotice for the active server * mail_callRefreshVacationNotice, function to call the serverside function to refresh the vacationnotice for the active server
*
* @param {object} _server
* *
*/ */
mail_callRefreshVacationNotice: function(_server) mail_callRefreshVacationNotice: function(_server)
@ -835,6 +851,8 @@ app.classes.mail = AppJS.extend(
/** /**
* mail_refreshVacationNotice, function to call with appropriate data to refresh the vacationnotice for the active server * mail_refreshVacationNotice, function to call with appropriate data to refresh the vacationnotice for the active server
*
* @param {object} _data
* *
*/ */
mail_refreshVacationNotice: function(_data) mail_refreshVacationNotice: function(_data)
@ -869,6 +887,8 @@ app.classes.mail = AppJS.extend(
/** /**
* mail_refreshFilter2Options, function to call with appropriate data to refresh the filter2 options for the active server * mail_refreshFilter2Options, function to call with appropriate data to refresh the filter2 options for the active server
*
* @param {object} _data
* *
*/ */
mail_refreshFilter2Options: function(_data) mail_refreshFilter2Options: function(_data)
@ -899,6 +919,8 @@ app.classes.mail = AppJS.extend(
/** /**
* mail_refreshFilterOptions, function to call with appropriate data to refresh the filter options for the active server * mail_refreshFilterOptions, function to call with appropriate data to refresh the filter options for the active server
*
* @param {object} _data
* *
*/ */
mail_refreshFilterOptions: function(_data) mail_refreshFilterOptions: function(_data)
@ -931,6 +953,8 @@ app.classes.mail = AppJS.extend(
/** /**
* Queues a refreshFolderList request for 10ms. Actually this will just execute the * Queues a refreshFolderList request for 10ms. Actually this will just execute the
* code after the calling script has finished. * code after the calling script has finished.
*
* @param {array} _folders description
*/ */
mail_queueRefreshFolderList: function(_folders) mail_queueRefreshFolderList: function(_folders)
{ {
@ -944,11 +968,12 @@ app.classes.mail = AppJS.extend(
/** /**
* mail_CheckFolderNoSelect - implementation of the mail_CheckFolderNoSelect action to control right click options on the tree * mail_CheckFolderNoSelect - implementation of the mail_CheckFolderNoSelect action to control right click options on the tree
* *
* @param _action * @param {object} action
* @param _senders - the representation of the tree leaf to be manipulated * @param {object} _senders the representation of the tree leaf to be manipulated
* @param {object} _currentNode
*/ */
mail_CheckFolderNoSelect: function(action,_senders,_currentNode) { mail_CheckFolderNoSelect: function(action,_senders,_currentNode) {
//console.log(action,_senders,_currentNode);
// Abort if user selected an un-selectable node // Abort if user selected an un-selectable node
// Use image over anything else because...? // Use image over anything else because...?
var ftree, node; var ftree, node;
@ -969,6 +994,8 @@ app.classes.mail = AppJS.extend(
/** /**
* mail_setFolderStatus, function to set the status for the visible folders * mail_setFolderStatus, function to set the status for the visible folders
*
* @param {array} _status
*/ */
mail_setFolderStatus: function(_status) { mail_setFolderStatus: function(_status) {
var ftree = this.et2.getWidgetById(this.nm_index+'[foldertree]'); var ftree = this.et2.getWidgetById(this.nm_index+'[foldertree]');
@ -982,7 +1009,7 @@ app.classes.mail = AppJS.extend(
/** /**
* mail_setLeaf, function to set the id and description for the folder given by status key * mail_setLeaf, function to set the id and description for the folder given by status key
* @param array _status status array with the required data (new id, desc, old desc) * @param {array} _status status array with the required data (new id, desc, old desc)
* key is the original id of the leaf to change * key is the original id of the leaf to change
* multiple sets can be passed to mail_setLeaf * multiple sets can be passed to mail_setLeaf
*/ */
@ -1008,7 +1035,7 @@ app.classes.mail = AppJS.extend(
/** /**
* mail_removeLeaf, function to remove the leaf represented by the given ID * mail_removeLeaf, function to remove the leaf represented by the given ID
* @param array _status status array with the required data (KEY id, VALUE desc) * @param {array} _status status array with the required data (KEY id, VALUE desc)
* key is the id of the leaf to delete * key is the id of the leaf to delete
* multiple sets can be passed to mail_deleteLeaf * multiple sets can be passed to mail_deleteLeaf
*/ */
@ -1065,6 +1092,8 @@ app.classes.mail = AppJS.extend(
/** /**
* mail_refreshMessageGrid, function to call to reread ofthe current folder * mail_refreshMessageGrid, function to call to reread ofthe current folder
*
* @param {boolean} _isPopup
*/ */
mail_refreshMessageGrid: function(_isPopup) { mail_refreshMessageGrid: function(_isPopup) {
if (typeof _isPopup == 'undefined') _isPopup = false; if (typeof _isPopup == 'undefined') _isPopup = false;
@ -1096,7 +1125,7 @@ app.classes.mail = AppJS.extend(
/** /**
* mail_setMsg - sets a Message, with the msg container, and controls if the container is enabled/disabled * mail_setMsg - sets a Message, with the msg container, and controls if the container is enabled/disabled
* @param string myMsg - the message * @param {string} myMsg - the message
*/ */
mail_setMsg: function(myMsg) mail_setMsg: function(myMsg)
{ {
@ -1167,6 +1196,9 @@ app.classes.mail = AppJS.extend(
/** /**
* mail_splitRowId * mail_splitRowId
*
* @param {string} _rowID
*
*/ */
mail_splitRowId: function(_rowID) mail_splitRowId: function(_rowID)
{ {
@ -1183,8 +1215,9 @@ app.classes.mail = AppJS.extend(
/** /**
* Delete mails - actually calls the backend function for deletion * Delete mails - actually calls the backend function for deletion
* takes in all arguments * takes in all arguments
* @param _msg - message list * @param {string} _msg - message list
* @param _action - optional action * @param {object} _action - optional action
* @param {object} _calledFromPopup
*/ */
mail_deleteMessages: function(_msg,_action,_calledFromPopup) mail_deleteMessages: function(_msg,_action,_calledFromPopup)
{ {
@ -1266,6 +1299,9 @@ app.classes.mail = AppJS.extend(
/** /**
* mail_emptyTrash * mail_emptyTrash
*
* @param {object} action
* @param {object} _senders
*/ */
mail_emptyTrash: function(action,_senders) { mail_emptyTrash: function(action,_senders) {
var server = _senders[0].iface.id.split('::'); var server = _senders[0].iface.id.split('::');
@ -1281,6 +1317,10 @@ app.classes.mail = AppJS.extend(
/** /**
* mail_compressFolder * mail_compressFolder
*
* @param {object} action
* @param {object} _senders
*
*/ */
mail_compressFolder: function(action,_senders) { mail_compressFolder: function(action,_senders) {
//console.log(action,_senders,FolderName); //console.log(action,_senders,FolderName);
@ -1294,11 +1334,12 @@ app.classes.mail = AppJS.extend(
/** /**
* mail_changeProfile * mail_changeProfile
* @param folder, the ID of the selected Node -> should be an integer *
* @param _widget, handle to the tree widget * @param {string} folder the ID of the selected Node -> should be an integer
* @param {object} _widget handle to the tree widget
* @param {boolean} getFolders Flag to indicate that the profile needs the mail * @param {boolean} getFolders Flag to indicate that the profile needs the mail
* folders. False means they're already loaded in the tree, and we don't need * folders. False means they're already loaded in the tree, and we don't need
* them again * them again
*/ */
mail_changeProfile: function(folder,_widget, getFolders) { mail_changeProfile: function(folder,_widget, getFolders) {
if(typeof getFolders == 'undefined') if(typeof getFolders == 'undefined')
@ -1312,7 +1353,7 @@ app.classes.mail = AppJS.extend(
egw.json('mail.mail_ui.ajax_changeProfile',[folder, getFolders], jQuery.proxy(function() { egw.json('mail.mail_ui.ajax_changeProfile',[folder, getFolders], jQuery.proxy(function() {
// Profile changed, select inbox // Profile changed, select inbox
var inbox = folder + '::INBOX'; var inbox = folder + '::INBOX';
_widget.reSelectItem(inbox) _widget.reSelectItem(inbox);
this.mail_changeFolder(inbox,_widget,''); this.mail_changeFolder(inbox,_widget,'');
this.unlock_tree(); this.unlock_tree();
},this)) },this))
@ -1323,8 +1364,8 @@ app.classes.mail = AppJS.extend(
/** /**
* mail_changeFolder * mail_changeFolder
* @param _folder, the ID of the selected Node * @param {string} _folder the ID of the selected Node
* @param _widget, handle to the tree widget * @param {widget object} _widget handle to the tree widget
* @param {string} _previous - Previously selected node ID * @param {string} _previous - Previously selected node ID
*/ */
mail_changeFolder: function(_folder,_widget, _previous) { mail_changeFolder: function(_folder,_widget, _previous) {
@ -1516,8 +1557,9 @@ app.classes.mail = AppJS.extend(
/** /**
* Flag mail as 'read', 'unread', 'flagged' or 'unflagged' * Flag mail as 'read', 'unread', 'flagged' or 'unflagged'
* *
* @param _action _action.id is 'read', 'unread', 'flagged' or 'unflagged' * @param {object} _flag
* @param _elems * @param {object} _elems
* @param {boolean} _isPopup
*/ */
mail_flagMessages: function(_flag, _elems,_isPopup) mail_flagMessages: function(_flag, _elems,_isPopup)
{ {
@ -1633,16 +1675,22 @@ app.classes.mail = AppJS.extend(
/** /**
* User clicked an address (FROM, TO, etc) * User clicked an address (FROM, TO, etc)
* *
* @param object tag_info with values for attributes id, label, title, ... * @param {object} tag_info with values for attributes id, label, title, ...
* @param et2_taglist widget * @param {widget object} widget
*
* @todo seems this function is not implemented, need to be checked if it is neccessary at all
*/ */
address_click: function(tag_info, widget) address_click: function(tag_info, widget)
{ {
console.log(this, arguments);
}, },
/** /**
* displayAttachment * displayAttachment
*
* @param {object} tag_info
* @param {widget object} widget
* @param {object} calledForCompose
*/ */
displayAttachment: function(tag_info, widget, calledForCompose) displayAttachment: function(tag_info, widget, calledForCompose)
{ {
@ -1766,6 +1814,9 @@ app.classes.mail = AppJS.extend(
/** /**
* displayUploadedFile * displayUploadedFile
*
* @param {object} tag_info
* @param {widget object} widget
*/ */
displayUploadedFile: function(tag_info, widget) displayUploadedFile: function(tag_info, widget)
{ {
@ -1995,7 +2046,7 @@ app.classes.mail = AppJS.extend(
var filename =dataElem.data.subject.replace(/[\f\n\t\v/\\:*#?<>\|]/g,"_"); var filename =dataElem.data.subject.replace(/[\f\n\t\v/\\:*#?<>\|]/g,"_");
url += '&name='+encodeURIComponent(filename+'.eml'); url += '&name='+encodeURIComponent(filename+'.eml');
url += '&mime=message'+encodeURIComponent('/')+'rfc822'; url += '&mime=message'+encodeURIComponent('/')+'rfc822';
url += '&method=mail.mail_ui.vfsSaveMessage' url += '&method=mail.mail_ui.vfsSaveMessage';
url += '&id='+_elems[0].id; url += '&id='+_elems[0].id;
url += '&label=Save'; url += '&label=Save';
//window.open(url,'_blank','dependent=yes,width=100,height=100,scrollbars=yes,status=yes') //window.open(url,'_blank','dependent=yes,width=100,height=100,scrollbars=yes,status=yes')
@ -2103,7 +2154,8 @@ app.classes.mail = AppJS.extend(
/** /**
* mail_getFormData * mail_getFormData
* *
* @param _actionObjects, the senders * @param {object} _actionObjects the senders
*
* @return structured array of message ids: array(msg=>message-ids) * @return structured array of message ids: array(msg=>message-ids)
*/ */
mail_getFormData: function(_actionObjects) { mail_getFormData: function(_actionObjects) {
@ -2129,7 +2181,8 @@ app.classes.mail = AppJS.extend(
/** /**
* mail_setRowClass * mail_setRowClass
* *
* @param _actionObjects, the senders * @param {object} _actionObjects the senders
* @param {string} _class
*/ */
mail_setRowClass: function(_actionObjects,_class) { mail_setRowClass: function(_actionObjects,_class) {
if (typeof _class == 'undefined') return false; if (typeof _class == 'undefined') return false;
@ -2173,8 +2226,8 @@ app.classes.mail = AppJS.extend(
* mail_removeRowFlag * mail_removeRowFlag
* Removes a flag and updates the CSS class. Updates the UI, but not the server. * Removes a flag and updates the CSS class. Updates the UI, but not the server.
* *
* @param _actionObjects, the senders, or a messages object * @param {action object} _actionObjects the senders, or a messages object
* @param _class, the class to be removed * @param {string} _class the class to be removed
*/ */
mail_removeRowClass: function(_actionObjects,_class) { mail_removeRowClass: function(_actionObjects,_class) {
if (typeof _class == 'undefined') return false; if (typeof _class == 'undefined') return false;
@ -2437,13 +2490,12 @@ app.classes.mail = AppJS.extend(
/** /**
* Send names of uploaded files (again) to server, to process them: either copy to vfs or ask overwrite/rename * Send names of uploaded files (again) to server, to process them: either copy to vfs or ask overwrite/rename
* *
* @param _event * @param {event object} _event
* @param _file_count * @param {string} _file_count
* @param {string} [_path=current directory] Where the file is uploaded to. * @param {string} _path [_path=current directory] Where the file is uploaded to.
*/ */
uploadForCompose: function(_event, _file_count, _path) uploadForCompose: function(_event, _file_count, _path)
{ {
//console.log(_event,_file_count,_path);
// path is probably not needed when uploading for file; maybe it is when from vfs // path is probably not needed when uploading for file; maybe it is when from vfs
if(typeof _path == 'undefined') if(typeof _path == 'undefined')
{ {
@ -2460,6 +2512,13 @@ app.classes.mail = AppJS.extend(
} }
}, },
/**
* Upload for import (VFS)
*
* @param {egw object} _egw
* @param {widget object} _widget
* @param {window object} _window
*/
vfsUploadForImport: function(_egw, _widget, _window) { vfsUploadForImport: function(_egw, _widget, _window) {
//console.log(_egw, _widget, _window); //console.log(_egw, _widget, _window);
if (jQuery.isEmptyObject(_widget)) return; if (jQuery.isEmptyObject(_widget)) return;
@ -2469,6 +2528,13 @@ app.classes.mail = AppJS.extend(
} }
}, },
/**
* Upload for compose (VFS)
*
* @param {egw object} _egw
* @param {widget object} _widget
* @param {window object} _window
*/
vfsUploadForCompose: function(_egw, _widget, _window) vfsUploadForCompose: function(_egw, _widget, _window)
{ {
//console.log(_egw, _widget, _window); //console.log(_egw, _widget, _window);
@ -2479,6 +2545,13 @@ app.classes.mail = AppJS.extend(
} }
}, },
/**
* Submit on change (VFS)
*
* @param {egw object} _egw
* @param {widget object} _widget
* @param {window object} _window
*/
submitOnChange: function(_egw, _widget, _window) { submitOnChange: function(_egw, _widget, _window) {
//console.log(_egw, _widget, _window); //console.log(_egw, _widget, _window);
if (!jQuery.isEmptyObject(_widget)) if (!jQuery.isEmptyObject(_widget))
@ -2490,11 +2563,25 @@ app.classes.mail = AppJS.extend(
} }
}, },
/**
* Save as Draft (VFS)
*
* @param {egw object} _egw
* @param {widget object} _widget
* @param {window object} _window
*/
saveAsDraft: function(_egw, _widget, _window) saveAsDraft: function(_egw, _widget, _window)
{ {
this.et2_obj.submit(); this.et2_obj.submit();
}, },
/**
* Save as Draf and pring (VFS)
*
* @param {egw object} _egw
* @param {widget object} _widget
* @param {window object} _window
*/
saveAsDraftAndPrint: function(_egw, _widget, _window) saveAsDraftAndPrint: function(_egw, _widget, _window)
{ {
this.et2_obj.submit(); this.et2_obj.submit();
@ -2551,7 +2638,6 @@ app.classes.mail = AppJS.extend(
* *
* @param _type - action name * @param _type - action name
* @param _selected - selected row from the sieve rule list * @param _selected - selected row from the sieve rule list
* @param _msg - messages
*/ */
action: function(_type, _selected) action: function(_type, _selected)
{ {
@ -2574,7 +2660,7 @@ app.classes.mail = AppJS.extend(
actionData = _type.parent.data.widget.getArrayMgr('content'); actionData = _type.parent.data.widget.getArrayMgr('content');
that._do_action(typeId, actionData['data'],ruleID); that._do_action(typeId, actionData['data'],ruleID);
} }
} };
var confirmDeleteDialog = et2_dialog.show_dialog(callbackDeleteDialog, this.egw.lang("Do you really want to DELETE this Rule"),this.egw.lang("Delete"), {},et2_dialog.BUTTONS_YES_NO_CANCEL, et2_dialog.WARNING_MESSAGE); var confirmDeleteDialog = et2_dialog.show_dialog(callbackDeleteDialog, this.egw.lang("Do you really want to DELETE this Rule"),this.egw.lang("Delete"), {},et2_dialog.BUTTONS_YES_NO_CANCEL, et2_dialog.WARNING_MESSAGE);
break; break;
@ -2601,9 +2687,9 @@ app.classes.mail = AppJS.extend(
}, },
/** /**
* Send back action resault to server * Send back sieve action resault to server
* *
* @param {string} _typeId action name * @param {string} _typeID action name
* @param {object} _data content * @param {object} _data content
* @param {string} _selectedID selected row id * @param {string} _selectedID selected row id
* @param {string} _msg message * @param {string} _msg message
@ -2620,7 +2706,7 @@ app.classes.mail = AppJS.extend(
/** /**
* *
* @todo: Need to find a way how to refresh the grid * Send ajax request to server to refresh the sieve grid
* *
* *
*/ */
@ -2715,7 +2801,7 @@ app.classes.mail = AppJS.extend(
{ {
this.egw.open_link('mail.mail_sieve.editVacation','_blank','700x480'); this.egw.open_link('mail.mail_sieve.editVacation','_blank','700x480');
}, },
/** /**
* Popup the subscription dialog * Popup the subscription dialog
* *
@ -2961,7 +3047,7 @@ app.classes.mail = AppJS.extend(
mail_prev_print: function (_action, _elems) mail_prev_print: function (_action, _elems)
{ {
this.mail_open(_action, _elems, 'print'); this.mail_open(_action, _elems, 'print');
}, }
}); });
@ -2992,7 +3078,7 @@ $j(function() {
//.fadeIn("slow"); // doesn't work because of stop() //.fadeIn("slow"); // doesn't work because of stop()
}, },
function () { function () {
$j(this).fadeOut("400", function(){ $j(this).remove(); }) $j(this).fadeOut("400", function(){ $j(this).remove(); });
} }
); );
} }