-
Notifications
You must be signed in to change notification settings - Fork 43
/
Index.cshtml
55 lines (47 loc) · 1.82 KB
/
Index.cshtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
@page
@using EasyAbp.FileManagement.Files
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Abp.AspNetCore.Mvc.UI.Layout
@using EasyAbp.FileManagement.Localization
@using EasyAbp.FileManagement.Web.Pages.FileManagement.Components.FileManagerWidget
@using Microsoft.Extensions.DependencyInjection
@using Volo.Abp.Users
@inject IPageLayout PageLayout
@inject IHtmlLocalizer<FileManagementResource> L
@inject ICurrentUser CurrentUser
@{
PageLayout.Content.Title = L["File"].Value;
PageLayout.Content.BreadCrumb.Add(L["Menu:File"].Value);
PageLayout.Content.MenuItemName = "FileManagementFile";
const string fileContainerName = "default";
var ownerUserId = CurrentUser.GetId();
Guid? parentId = null; // the root directory
var path = HttpContext.Request.Query["path"].FirstOrDefault();
if (path is not null)
{
var fileAppService = HttpContext.RequestServices.GetRequiredService<IFileAppService>();
var result = await fileAppService.GetByPathAsync(path, fileContainerName, ownerUserId);
if (!result.Found)
{
Response.Redirect(Request.Path);
return;
}
parentId = result.FileInfo!.Id;
}
// add a file manager widget
@await Component.InvokeAsync("FileManager", new
{
fileContainerName = "default", // specify a container
ownerUserId = CurrentUser.GetId(), // can be null if it's a shared container
parentId = parentId,
policy = new FileManagerPolicyModel // with a custom policy model
{ CanUploadFile = false, CanMoveFile = false }
})
// you can add more than one file manager widget on the same page
@await Component.InvokeAsync("FileManager", new
{
fileContainerName = "default",
ownerUserId = CurrentUser.GetId(),
parentId = (Guid?)null
})
}