diff --git a/.gitignore b/.gitignore
index 18de70f2..24d48481 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,6 +18,6 @@ Oqtane.Server/Data/*.db
/Oqtane.Server/Properties/PublishProfiles/FolderProfile.pubxml
Oqtane.Server/Content
-Oqtane.Server/wwwroot/Packages/**/assets.json
+Oqtane.Server/wwwroot/Content
Oqtane.Server/wwwroot/Packages/*.log
diff --git a/Oqtane.Client/Modules/Admin/Files/Edit.razor b/Oqtane.Client/Modules/Admin/Files/Edit.razor
index b2ac3b64..4f6054db 100644
--- a/Oqtane.Client/Modules/Admin/Files/Edit.razor
+++ b/Oqtane.Client/Modules/Admin/Files/Edit.razor
@@ -33,6 +33,24 @@
+
@@ -60,8 +78,9 @@
@code {
private List _folders;
private int _folderId = -1;
- private string _name;
private int _parentId = -1;
+ private string _name;
+ private string _type = FolderTypes.Private;
private bool _isSystem;
private string _permissions = string.Empty;
private string _createdBy;
@@ -91,6 +110,7 @@
{
_parentId = folder.ParentId ?? -1;
_name = folder.Name;
+ _type = folder.Type;
_isSystem = folder.IsSystem;
_permissions = folder.Permissions;
_createdBy = folder.CreatedBy;
@@ -150,6 +170,7 @@
}
folder.Name = _name;
+ folder.Type = _type;
folder.IsSystem = _isSystem;
folder.Permissions = _permissionGrid.GetPermissions();
diff --git a/Oqtane.Client/Modules/Admin/Files/Index.razor b/Oqtane.Client/Modules/Admin/Files/Index.razor
index 58990804..bd670d21 100644
--- a/Oqtane.Client/Modules/Admin/Files/Index.razor
+++ b/Oqtane.Client/Modules/Admin/Files/Index.razor
@@ -39,7 +39,7 @@
|
|
- @context.Name |
+ @context.Name |
@context.ModifiedOn |
@context.Extension.ToUpper() @Localizer["File"] |
@string.Format("{0:0.00}", ((decimal)context.Size / 1000)) KB |
diff --git a/Oqtane.Client/Modules/Admin/UserProfile/Index.razor b/Oqtane.Client/Modules/Admin/UserProfile/Index.razor
index 4b2874b6..9c15f010 100644
--- a/Oqtane.Client/Modules/Admin/UserProfile/Index.razor
+++ b/Oqtane.Client/Modules/Admin/UserProfile/Index.razor
@@ -5,11 +5,12 @@
@inject IProfileService ProfileService
@inject ISettingService SettingService
@inject INotificationService NotificationService
+@inject IFileService FileService
@inject IStringLocalizer Localizer
-@if (PageState.User != null && photofileid != -1)
+@if (PageState.User != null && photo != null)
{
-
+
}
else
{
@@ -76,58 +77,58 @@ else
@if (profiles != null && settings != null)
{
-
- @foreach (Profile profile in profiles)
- {
- var p = profile;
- if (!p.IsPrivate || UserSecurity.IsAuthorized(PageState.User, RoleNames.Admin))
+
+ @foreach (Profile profile in profiles)
{
- if (p.Category != category)
+ var p = profile;
+ if (!p.IsPrivate || UserSecurity.IsAuthorized(PageState.User, RoleNames.Admin))
{
+ if (p.Category != category)
+ {
+
+
+ @p.Category
+ |
+
+ category = p.Category;
+ }
-
- @p.Category
- |
-
- category = p.Category;
- }
-
-
-
- |
-
- @if (!string.IsNullOrEmpty(p.Options))
- {
-
- }
- else
- {
- @if (p.IsRequired)
+ |
+
+ |
+
+ @if (!string.IsNullOrEmpty(p.Options))
{
- ProfileChanged(e, p.Name))" />
+
}
else
{
- ProfileChanged(e, p.Name))" />
+ @if (p.IsRequired)
+ {
+ ProfileChanged(e, p.Name))" />
+ }
+ else
+ {
+ ProfileChanged(e, p.Name))" />
+ }
}
- }
- |
-
+
+
+ }
}
- }
-
+
}
@@ -157,13 +158,14 @@ else
|
- @{
- string input = "___";
- if (context.Body.Contains(input)){
- context.Body = context.Body.Split(input)[0];
- context.Body = context.Body.Replace("\n", "");
- context.Body = context.Body.Replace("\r", "");
- } }
+ @{
+ string input = "___";
+ if (context.Body.Contains(input))
+ {
+ context.Body = context.Body.Split(input)[0];
+ context.Body = context.Body.Replace("\n", "");
+ context.Body = context.Body.Replace("\r", "");
+ } }
@(context.Body.Length > 100 ? (context.Body.Substring(0, 97) + "...") : context.Body)
|
@@ -189,13 +191,14 @@ else
|
- @{
- string input = "___";
- if (context.Body.Contains(input)){
- context.Body = context.Body.Split(input)[0];
- context.Body = context.Body.Replace("\n", "");
- context.Body = context.Body.Replace("\r", "");
- } }
+ @{
+ string input = "___";
+ if (context.Body.Contains(input))
+ {
+ context.Body = context.Body.Split(input)[0];
+ context.Body = context.Body.Replace("\n", "");
+ context.Body = context.Body.Replace("\r", "");
+ } }
@(context.Body.Length > 100 ? (context.Body.Substring(0, 97) + "...") : context.Body)
|
@@ -218,6 +221,7 @@ else
private string displayname = string.Empty;
private FileManager filemanager;
private int photofileid = -1;
+ private File photo = null;
private List profiles;
private Dictionary settings;
private string category = string.Empty;
@@ -226,7 +230,7 @@ else
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.View;
- protected override async Task OnInitializedAsync()
+ protected override async Task OnParametersSetAsync()
{
try
{
@@ -239,6 +243,12 @@ else
if (PageState.User.PhotoFileId != null)
{
photofileid = PageState.User.PhotoFileId.Value;
+ photo = await FileService.GetFileAsync(photofileid);
+ }
+ else
+ {
+ photofileid = -1;
+ photo = null;
}
profiles = await ProfileService.GetProfilesAsync(ModuleState.SiteId);
@@ -280,18 +290,17 @@ else
user.Password = password;
user.Email = email;
user.DisplayName = (displayname == string.Empty ? username : displayname);
- user.PhotoFileId = null;
- photofileid = filemanager.GetFileId();
-
- if (photofileid != -1)
+ user.PhotoFileId = filemanager.GetFileId();
+ if (user.PhotoFileId == -1)
{
- user.PhotoFileId = photofileid;
+ user.PhotoFileId = null;
}
await UserService.UpdateUserAsync(user);
await SettingService.UpdateUserSettingsAsync(settings, PageState.User.UserId);
await logger.LogInformation("User Profile Saved");
- AddModuleMessage(Localizer["User Profile Updated Successfully"], MessageType.Success);
+
+ NavigationManager.NavigateTo(NavigateUrl());
}
else
{
diff --git a/Oqtane.Client/Modules/Admin/Users/Edit.razor b/Oqtane.Client/Modules/Admin/Users/Edit.razor
index be68ff7d..19254613 100644
--- a/Oqtane.Client/Modules/Admin/Users/Edit.razor
+++ b/Oqtane.Client/Modules/Admin/Users/Edit.razor
@@ -4,11 +4,12 @@
@inject IUserService UserService
@inject IProfileService ProfileService
@inject ISettingService SettingService
+@inject IFileService FileService
@inject IStringLocalizer Localizer
-@if (PageState.User != null && photofileid != -1)
+@if (PageState.User != null && photo != null)
{
-
+
}
else
{
@@ -133,6 +134,7 @@ else
private string displayname = string.Empty;
private FileManager filemanager;
private int photofileid = -1;
+ private File photo = null;
private List profiles;
private Dictionary settings;
private string category = string.Empty;
@@ -146,7 +148,7 @@ else
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Admin;
- protected override async Task OnInitializedAsync()
+ protected override async Task OnParametersSetAsync()
{
try
{
@@ -159,12 +161,16 @@ else
username = user.Username;
email = user.Email;
displayname = user.DisplayName;
-
if (user.PhotoFileId != null)
{
photofileid = user.PhotoFileId.Value;
+ photo = await FileService.GetFileAsync(photofileid);
+ }
+ else
+ {
+ photofileid = -1;
+ photo = null;
}
-
settings = await SettingService.GetUserSettingsAsync(user.UserId);
createdby = user.CreatedBy;
createdon = user.CreatedOn;
@@ -200,11 +206,10 @@ else
user.Email = email;
user.DisplayName = string.IsNullOrWhiteSpace(displayname) ? username : displayname;
user.PhotoFileId = null;
- photofileid = filemanager.GetFileId();
-
- if (photofileid != -1)
+ user.PhotoFileId = filemanager.GetFileId();
+ if (user.PhotoFileId == -1)
{
- user.PhotoFileId = photofileid;
+ user.PhotoFileId = null;
}
user.IsDeleted = (isdeleted == null ? true : Boolean.Parse(isdeleted));
diff --git a/Oqtane.Client/Modules/Controls/FileManager.razor b/Oqtane.Client/Modules/Controls/FileManager.razor
index 90bc48c5..df468bbe 100644
--- a/Oqtane.Client/Modules/Controls/FileManager.razor
+++ b/Oqtane.Client/Modules/Controls/FileManager.razor
@@ -79,6 +79,7 @@
private string _filter = "*";
private bool _haseditpermission = false;
private string _image = string.Empty;
+ private File _file = null;
private string _guid;
private string _message = string.Empty;
private MessageType _messagetype;
@@ -199,6 +200,7 @@
FolderId = int.Parse((string)e.Value);
await GetFiles();
FileId = -1;
+ _file = null;
_image = string.Empty;
StateHasChanged();
}
@@ -223,21 +225,22 @@
private async Task SetImage()
{
_image = string.Empty;
+ _file = null;
if (FileId != -1)
{
- File file = await FileService.GetFileAsync(FileId);
- if (file != null && file.ImageHeight != 0 && file.ImageWidth != 0)
+ _file = await FileService.GetFileAsync(FileId);
+ if (_file != null && _file.ImageHeight != 0 && _file.ImageWidth != 0)
{
var maxwidth = 200;
var maxheight = 200;
- var ratioX = (double)maxwidth / (double)file.ImageWidth;
- var ratioY = (double)maxheight / (double)file.ImageHeight;
+ var ratioX = (double)maxwidth / (double)_file.ImageWidth;
+ var ratioY = (double)maxheight / (double)_file.ImageHeight;
var ratio = ratioX < ratioY ? ratioX : ratioY;
- _image = " ";
+ _image = " ";
}
}
}
@@ -331,4 +334,5 @@
public int GetFileId() => FileId;
+ public File GetFile() => _file;
}
diff --git a/Oqtane.Client/Modules/Controls/RichTextEditor.razor b/Oqtane.Client/Modules/Controls/RichTextEditor.razor
index 1d3a2751..ce50272d 100644
--- a/Oqtane.Client/Modules/Controls/RichTextEditor.razor
+++ b/Oqtane.Client/Modules/Controls/RichTextEditor.razor
@@ -191,11 +191,11 @@
_message = string.Empty;
if (_filemanagervisible)
{
- var fileid = _fileManager.GetFileId();
- if (fileid != -1)
+ var file = _fileManager.GetFile();
+ if (file != null)
{
var interop = new RichTextEditorInterop(JSRuntime);
- await interop.InsertImage(_editorElement, ContentUrl(fileid));
+ await interop.InsertImage(_editorElement, file.Url, file.Name);
_filemanagervisible = false;
}
else
diff --git a/Oqtane.Client/Modules/Controls/RichTextEditorInterop.cs b/Oqtane.Client/Modules/Controls/RichTextEditorInterop.cs
index 0ecce251..6765cad9 100644
--- a/Oqtane.Client/Modules/Controls/RichTextEditorInterop.cs
+++ b/Oqtane.Client/Modules/Controls/RichTextEditorInterop.cs
@@ -1,4 +1,4 @@
-using Microsoft.AspNetCore.Components;
+using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using System.Threading.Tasks;
@@ -105,13 +105,13 @@ namespace Oqtane.Modules.Controls
}
}
- public Task InsertImage(ElementReference quillElement, string imageUrl)
+ public Task InsertImage(ElementReference quillElement, string imageUrl, string altText)
{
try
{
_jsRuntime.InvokeAsync |