W.I.P of VFS Select widget restructure

This commit is contained in:
Hadi Nategh
2017-10-11 18:27:42 +02:00
parent f9aec1bf46
commit 448cc8975f
12 changed files with 777 additions and 556 deletions

View File

@@ -290,31 +290,31 @@ app.classes.filemanager = app.classes.filemanager.extend({
// new file
else
{
// create file selector
var vfs_select = et2_createWidget('vfs-select', {
var vfs_attrs = {
id:'savefile',
mode: 'saveas',
button_caption:"",
button_label:_egwAction.id == 'saveas'?"save as":"save",
value: "doc.odt"
}, this.et2);
// bind change handler for setting the selected path and calling save
jQuery(vfs_select.getDOMNode()).on('change', function (){
file_path = vfs_select.get_value();
if (vfs_select.get_value())
{
// Add odt extension if not exist
if (!file_path.match(/\.odt$/,'ig')) file_path += '.odt';
widgetFilePath.set_value(file_path);
self.editor.getDocumentAsByteArray(saveByteArrayLocally);
self.editor_leaveSession(function(){
var path = window.location.href.split('&path=');
window.location.href = path[0]+'&path='+self.editor_getFilePath();
});
egw.refresh('','filemanager');
value: "doc.odt",
onchange: function (){
file_path = vfs_select.get_value();
if (vfs_select.get_value())
{
// Add odt extension if not exist
if (!file_path.match(/\.odt$/,'ig')) file_path += '.odt';
widgetFilePath.set_value(file_path);
self.editor.getDocumentAsByteArray(saveByteArrayLocally);
self.editor_leaveSession(function(){
var path = window.location.href.split('&path=');
window.location.href = path[0]+'&path='+self.editor_getFilePath();
});
egw.refresh('','filemanager');
}
}
});
};
// create file selector
var vfs_select = et2_createWidget('vfs-select', vfs_attrs, this.et2);
// start the file selector dialog
jQuery(vfs_select.getDOMNode()).click();
}