Fix vfsSelectUI path closed dialog if you pressed enter

This commit is contained in:
nathan 2023-04-06 16:14:09 -06:00
parent b0e2c95593
commit 36ba2f567e
3 changed files with 58 additions and 20 deletions

View File

@ -1098,6 +1098,7 @@ export class et2_vfsSelect extends et2_inputWidget
{
this.dialog.close();
}
app.vfsSelectUI.destroy();
delete app.vfsSelectUI;
}
let attrs = {
@ -1136,7 +1137,8 @@ export class et2_vfsSelect extends et2_inputWidget
{
label: egw.lang(_data.content.label),
id: "submit",
image: _data.content.mode.match(/saveas|select-dir/) ? "save" : this.options.button_icon
image: _data.content.mode.match(/saveas|select-dir/) ? "save" : this.options.button_icon,
default: false
}
];
let extra_buttons_action = {};
@ -1173,7 +1175,7 @@ export class et2_vfsSelect extends et2_inputWidget
let data = jQuery.extend(_data, {'currentapp': currentApp, etemplate_exec_id: et2.etemplate_exec_id});
// define a mini app object for vfs select UI
app.vfsSelectUI = new app.classes.vfsSelectUI;
app.vfsSelectUI = et2.app_obj['vfsSelectUI'] = new app.classes.vfsSelectUI;
// callback for dialog
this.submit_callback = function(submit_button_id, submit_value, savemode)
@ -1277,6 +1279,7 @@ export class et2_vfsSelect extends et2_inputWidget
app.vfsSelectUI.et2 = self.dialog.template.widgetContainer;
app.vfsSelectUI.vfsSelectWidget = self;
app.vfsSelectUI.et2_ready(app.vfsSelectUI.et2, 'api.vfsSelectUI');
app.vfsSelectUI.et2.getInstanceManager().app_obj['vfsSelectUI'] = app.vfsSelectUI;
});
this.dialog.addEventListener("close", () =>
{

View File

@ -283,16 +283,41 @@ export class vfsSelectUI extends EgwApp
*/
do_action(action : string, widget : Et2Button | Et2Select | et2_vfsPath)
{
if (!action) return;
let field = '', value : string|string[] = '' ;
switch (action)
if(!this.et2)
{
case 'path': field = 'path'; value = (<et2_vfsPath>widget).getValue(); break;
case 'home': field = 'action'; value = 'home'; break;
case 'app': field = 'app'; value = (<Et2Select>widget).getValue(); break;
case 'mime': field = 'mime'; value = (<Et2Select>widget).getValue(); break;
// Etemplate has already gone
return;
}
if(!action && widget && widget.id)
{
action = widget.id;
}
if(!action)
{
return;
}
let field = '', value : string | string[] = '';
switch(action)
{
case 'path':
field = 'path';
value = (<et2_vfsPath>widget).getValue();
break;
case 'home':
field = 'action';
value = 'home';
break;
case 'app':
field = 'app';
value = (<Et2Select>widget).getValue();
break;
case 'mime':
field = 'mime';
value = (<Et2Select>widget).getValue();
break;
}
this.submit(field, value);
return false;
}
/**

View File

@ -13,15 +13,25 @@
<row class="nextmatch_header_row">
<et2-vbox>
<et2-box class="et2_toolbar">
<et2-button statustext="Go to your home directory" id="home" onclick="app.vfsSelectUI.do_action('home', widget)" image="filemanager/gohome" noSubmit="true"></et2-button>
<et2-button statustext="Up" id="up" onclick="app.vfsSelectUI.change_dir('..', widget);" image="filemanager/goup" noSubmit="true"></et2-button>
<et2-button statustext="Favorites" id="favorites" onclick="app.vfsSelectUI.change_dir('/apps/favorites', widget);" image="filemanager/fav_filter" noSubmit="true"></et2-button>
<et2-select width="175" id="app" onchange="app.vfsSelectUI.do_action('app', widget)" emptyLabel="Applications" noLang="1"></et2-select>
<et2-button statustext="Create directory" id="createdir" class="createDir" onclick="app.vfsSelectUI.createdir" image="filemanager/button_createdir" noSubmit="true" roImage="filemanager/createdir_disabled"></et2-button>
<file id="upload_file" statustext="upload file" progress_dropdownlist = "true" multiple="true" onFinish="app.vfsSelectUI.storeFile"/>
<et2-button statustext="Go to your home directory" id="home"
onclick="app.vfsSelectUI.do_action('home', widget)" image="filemanager/gohome"
noSubmit="true"></et2-button>
<et2-button statustext="Up" id="up" onclick="app.vfsSelectUI.change_dir('..', widget);"
image="filemanager/goup" noSubmit="true"></et2-button>
<et2-button statustext="Favorites" id="favorites"
onclick="app.vfsSelectUI.change_dir('/apps/favorites', widget);"
image="filemanager/fav_filter" noSubmit="true"></et2-button>
<et2-select width="175" id="app" onchange="app.vfsSelectUI.do_action('app', widget)"
emptyLabel="Applications" noLang="1"></et2-select>
<et2-button statustext="Create directory" id="createdir" class="createDir"
onclick="app.vfsSelectUI.createdir" image="filemanager/button_createdir"
noSubmit="true" roImage="filemanager/createdir_disabled"></et2-button>
<file id="upload_file" statustext="upload file" progress_dropdownlist="true" multiple="true"
onFinish="app.vfsSelectUI.storeFile"/>
<et2-searchbox id="search" onchange="app.vfsSelectUI.search"></et2-searchbox>
</et2-box>
<vfs-path id="path" class="et2_fullWidth selectPath" align="left" onchange="app.vfsSelectUI.do_action('path', widget)" width="99.2%"/>
<vfs-path id="path" class="et2_fullWidth selectPath" align="left"
onchange="app.vfsSelectUI.do_action" width="99.2%"/>
</et2-vbox>
</row>
<row>