Implement save into VFS for mail compose toolbar

This commit is contained in:
Hadi Nategh 2015-01-08 17:06:56 +00:00
parent f9c1883713
commit bc1578693c
2 changed files with 30 additions and 1 deletions

View File

@ -178,6 +178,13 @@ class mail_compose
'children' => array(),
'toolbarDefault' => true,
'hint' => 'Select the message priority tag'
),
'save2vfs' => array (
'caption' => 'Save to VFS',
'icon' => 'filesave',
'group' => ++$group,
'onExecute' => 'javaScript:app.mail.compose_saveDraft2fm',
'hint' => 'Save the drafted message as eml file into VFS'
)
);
foreach (self::$priorities as $priority)

View File

@ -2567,7 +2567,8 @@ app.classes.mail = AppJS.extend(
var url = window.egw_webserverUrl+'/index.php?';
url += 'menuaction=filemanager.filemanager_select.select'; // todo compose for Draft folder
url += '&mode=saveas';
var filename =dataElem.data.subject.replace(/[\f\n\t\v/\\:*#?<>\|]/g,"_");
var subject = dataElem? dataElem.data.subject: _elems[0].subject;
var filename = subject.replace(/[\f\n\t\v/\\:*#?<>\|]/g,"_")|| 'unknown';
url += '&name='+encodeURIComponent(filename+'.eml');
url += '&mime=message'+encodeURIComponent('/')+'rfc822';
url += '&method=mail.mail_ui.vfsSaveMessage';
@ -4275,4 +4276,25 @@ app.classes.mail = AppJS.extend(
}
}
},
/**
* Save drafted compose as eml file into VFS
* @param {type} _action action
*/
compose_saveDraft2fm: function (_action)
{
var content = this.et2.getArrayMgr('content').data;
var subject = this.et2.getWidgetById('subject');
var elem = {0:{id:"", subject:""}};
if (typeof content != 'undefined' && content.lastDrafted && subject)
{
elem[0].id = content.lastDrafted;
elem[0].subject = subject.get_value();
this.mail_save2fm(_action, elem);
}
else
{
et2_dialog.alert('You need to save the message as draft first before to be able to save it into VFS','Save into VFS','info');
}
}
});