Et2VfsSelectDialog: Get add directory button responding to current path permissions

This commit is contained in:
nathan 2024-02-09 09:15:11 -07:00
parent e25152fb1e
commit 63083ee811
2 changed files with 14 additions and 2 deletions

View File

@ -112,6 +112,7 @@ export class Et2VfsSelectDialog extends Et2InputWidget(LitElement) implements Se
@state() open : boolean = false;
@state() currentFile : Et2VfsSelectRow;
@state() selectedFiles : Et2VfsSelectRow[] = [];
@state() _pathWritable : boolean = false;
// SearchMixinInterface //
@ -364,7 +365,12 @@ export class Et2VfsSelectDialog extends Et2InputWidget(LitElement) implements Se
if(typeof results.path === "string")
{
// Something like a redirect or link followed - server is sending us a "corrected" path
this._pathNode.value = results.path;
this.path = results.path;
}
if(typeof results.writable !== "undefined")
{
this._pathWritable = results.writable;
this.requestUpdate("_pathWritable");
}
this.helpText = results?.message ?? "";
this._fileList = results?.files ?? [];
@ -725,13 +731,16 @@ export class Et2VfsSelectDialog extends Et2InputWidget(LitElement) implements Se
</et2-select>
<et2-button statustext="Create directory" id="createdir" class="createDir"
arial-label=${this.egw().lang("Create directory")}
?disabled=${!this._pathWritable}
noSubmit="true"
image="filemanager/button_createdir"
roImage="filemanager/createdir_disabled"
@click=${this.handleCreateDirectory}
></et2-button>
<file id="upload_file" statustext="upload file" progress_dropdownlist="true" multiple="true"
onFinish="app.vfsSelectUI.storeFile"></file>
?disabled=${!this._pathWritable}
onFinish="app.vfsSelectUI.storeFile"
></file>
<et2-searchbox id="search"
@keydown=${this.handleSearchKeyDown}
@sl-clear=${this.startSearch}

View File

@ -605,6 +605,8 @@ class Vfs extends File
/**
* Get a list of files that match the given parameters
*
* Can also give a new path (like a link, not redirect), and a writable flag
*
* @param $search
* @param $content
* @return void
@ -618,6 +620,7 @@ class Vfs extends File
{
$content['path'] = $response['path'] = Api\Vfs::get_home_dir();
}
$response['writable'] = Api\Vfs::is_writable($content['path']);
// Filemanager favorites as directories
if(substr($content['path'], 0, strlen('/apps/favorites')) == '/apps/favorites')