allow filename to be provided during module export
This commit is contained in:
@ -27,6 +27,12 @@
|
||||
<FileManager ShowFiles="false" ShowUpload="false" @ref="_filemanager" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-1 align-items-center">
|
||||
<Label Class="col-sm-3" For="filename" HelpText="Specify a name for the file (without an extension)" ResourceKey="Filename">Filename: </Label>
|
||||
<div class="col-sm-9">
|
||||
<input id="content" type="text" class="form-control" @bind="@_filename" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<button type="button" class="btn btn-success" @onclick="ExportFile">@Localizer["Export"]</button>
|
||||
@ -39,6 +45,7 @@
|
||||
@code {
|
||||
private string _content = string.Empty;
|
||||
private FileManager _filemanager;
|
||||
private string _filename = string.Empty;
|
||||
|
||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Edit;
|
||||
public override string Title => "Export Content";
|
||||
@ -62,12 +69,12 @@
|
||||
try
|
||||
{
|
||||
var folderid = _filemanager.GetFolderId();
|
||||
if (folderid != -1)
|
||||
if (folderid != -1 && !string.IsNullOrEmpty(_filename))
|
||||
{
|
||||
var result = await ModuleService.ExportModuleAsync(ModuleState.ModuleId, PageState.Page.PageId, folderid);
|
||||
var result = await ModuleService.ExportModuleAsync(ModuleState.ModuleId, PageState.Page.PageId, folderid, _filename);
|
||||
if (result.Success)
|
||||
{
|
||||
AddModuleMessage(string.Format(Localizer["Success.Export.File"], result.Message), MessageType.Success);
|
||||
AddModuleMessage(Localizer["Success.Content.Export"], MessageType.Success);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user