Naming fixes
This commit is contained in:
parent
a06ad38432
commit
e5fde5a436
@ -36,7 +36,7 @@
|
||||
<label class="control-label">Permissions: </label>
|
||||
</td>
|
||||
<td>
|
||||
<PermissionGrid EntityName="Folder" PermissionNames="Browse,View,Edit" Permissions="@_permissions" @ref="permissiongrid" />
|
||||
<PermissionGrid EntityName="Folder" PermissionNames="Browse,View,Edit" Permissions="@_permissions" @ref="_permissionGrid" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@ -65,14 +65,16 @@
|
||||
int _folderId = -1;
|
||||
string _name;
|
||||
int _parentId = -1;
|
||||
bool _isSystem = false;
|
||||
bool _isSystem;
|
||||
string _permissions = "";
|
||||
string _createdBy;
|
||||
DateTime _createdOn;
|
||||
string _modifiedBy;
|
||||
DateTime _modifiedOn;
|
||||
|
||||
#pragma warning disable 649
|
||||
PermissionGrid _permissionGrid;
|
||||
#pragma warning restore 649
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
|
@ -17,7 +17,7 @@
|
||||
<label class="control-label">Permissions: </label>
|
||||
</td>
|
||||
<td>
|
||||
<PermissionGrid EntityName="ModuleDefinition" PermissionNames="Utilize" Permissions="@_permissions" @ref="_permissiongrid" />
|
||||
<PermissionGrid EntityName="ModuleDefinition" PermissionNames="Utilize" Permissions="@_permissions" @ref="_permissionGrid" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@ -38,7 +38,9 @@
|
||||
string _modifiedby;
|
||||
DateTime _modifiedon;
|
||||
|
||||
PermissionGrid _permissiongrid;
|
||||
#pragma warning disable 649
|
||||
PermissionGrid _permissionGrid;
|
||||
#pragma warning restore 649
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
@ -68,7 +70,7 @@
|
||||
try
|
||||
{
|
||||
ModuleDefinition moduledefinition = await ModuleDefinitionService.GetModuleDefinitionAsync(_moduleDefinitionId, ModuleState.SiteId);
|
||||
moduledefinition.Permissions = _permissiongrid.GetPermissions();
|
||||
moduledefinition.Permissions = _permissionGrid.GetPermissions();
|
||||
await ModuleDefinitionService.UpdateModuleDefinitionAsync(moduledefinition);
|
||||
await logger.LogInformation("ModuleDefinition Saved {ModuleDefinition}", moduledefinition);
|
||||
NavigationManager.NavigateTo(NavigateUrl());
|
||||
|
@ -34,7 +34,7 @@
|
||||
<label for="Name" class="control-label">Permissions: </label>
|
||||
</td>
|
||||
<td>
|
||||
<PermissionGrid EntityName="Module" PermissionNames="@_permissionNames" Permissions="@_permissions" @ref="permissiongrid" />
|
||||
<PermissionGrid EntityName="Module" PermissionNames="@_permissionNames" Permissions="@_permissions" @ref="_permissionGrid" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -70,7 +70,7 @@
|
||||
string _permissions;
|
||||
string _pageId;
|
||||
|
||||
PermissionGrid _permissiongrid;
|
||||
PermissionGrid _permissionGrid;
|
||||
|
||||
RenderFragment DynamicComponent { get; set; }
|
||||
object _settings;
|
||||
@ -99,7 +99,7 @@
|
||||
private async Task SaveModule()
|
||||
{
|
||||
Module module = ModuleState;
|
||||
module.Permissions = _permissiongrid.GetPermissions();
|
||||
module.Permissions = _permissionGrid.GetPermissions();
|
||||
await ModuleService.UpdateModuleAsync(module);
|
||||
|
||||
PageModule pagemodule = await PageModuleService.GetPageModuleAsync(ModuleState.PageModuleId);
|
||||
@ -112,7 +112,7 @@
|
||||
Type moduleType = Type.GetType(ModuleState.ModuleType);
|
||||
if (moduleType != null)
|
||||
{
|
||||
moduleType.GetMethod("UpdateSettings").Invoke(_settings, null); // method must be public in settings component
|
||||
moduleType.GetMethod("UpdateSettings")?.Invoke(_settings, null); // method must be public in settings component
|
||||
}
|
||||
|
||||
NavigationManager.NavigateTo(NavigateUrl());
|
||||
|
@ -209,7 +209,7 @@
|
||||
themes = ThemeService.GetThemeTypes(Themes);
|
||||
|
||||
PageId = Int32.Parse(PageState.QueryString["id"]);
|
||||
Page page = PageState.Pages.Where(item => item.PageId == PageId).FirstOrDefault();
|
||||
Page page = PageState.Pages.FirstOrDefault(item => item.PageId == PageId);
|
||||
if (page != null)
|
||||
{
|
||||
name = page.Name;
|
||||
@ -310,7 +310,7 @@
|
||||
if (name != "" && !string.IsNullOrEmpty(themetype) && (panelayouts.Count == 0 || !string.IsNullOrEmpty(layouttype)))
|
||||
{
|
||||
page = PageState.Pages.Where(item => item.PageId == PageId).FirstOrDefault();
|
||||
string currentpath = page.Path;
|
||||
string currentPath = page.Path;
|
||||
|
||||
page.Name = name;
|
||||
if (path == "" && name.ToLower() != "home")
|
||||
@ -329,7 +329,7 @@
|
||||
else
|
||||
{
|
||||
page.ParentId = Int32.Parse(parentid);
|
||||
Page parent = PageState.Pages.Where(item => item.PageId == page.ParentId).FirstOrDefault();
|
||||
Page parent = PageState.Pages.FirstOrDefault(item => item.PageId == page.ParentId);
|
||||
if (parent.Path == "")
|
||||
{
|
||||
page.Path = Utilities.GetFriendlyUrl(parent.Name) + "/" + Utilities.GetFriendlyUrl(path);
|
||||
@ -348,12 +348,12 @@
|
||||
page.Order = 0;
|
||||
break;
|
||||
case "<":
|
||||
child = PageState.Pages.Where(item => item.PageId == childid).FirstOrDefault();
|
||||
page.Order = child.Order - 1;
|
||||
child = PageState.Pages.FirstOrDefault(item => item.PageId == childid);
|
||||
if (child != null) page.Order = child.Order - 1;
|
||||
break;
|
||||
case ">":
|
||||
child = PageState.Pages.Where(item => item.PageId == childid).FirstOrDefault();
|
||||
page.Order = child.Order + 1;
|
||||
child = PageState.Pages.FirstOrDefault(item => item.PageId == childid);
|
||||
if (child != null) page.Order = child.Order + 1;
|
||||
break;
|
||||
case ">>":
|
||||
page.Order = int.MaxValue;
|
||||
@ -363,8 +363,8 @@
|
||||
page.IsNavigation = (isnavigation == null ? true : Boolean.Parse(isnavigation));
|
||||
page.EditMode = (mode == "edit" ? true : false);
|
||||
page.ThemeType = themetype;
|
||||
page.LayoutType = (layouttype == null ? "" : layouttype);
|
||||
page.Icon = (icon == null ? "" : icon);
|
||||
page.LayoutType = layouttype ?? "";
|
||||
page.Icon = icon ?? "";
|
||||
page.Permissions = permissiongrid.GetPermissions();
|
||||
|
||||
if (page.ThemeType == PageState.Site.DefaultThemeType)
|
||||
@ -375,7 +375,7 @@
|
||||
{
|
||||
page.LayoutType = "";
|
||||
}
|
||||
page.IsPersonalizable = (ispersonalizable == null ? false : Boolean.Parse(ispersonalizable));
|
||||
page.IsPersonalizable = (ispersonalizable != null && Boolean.Parse(ispersonalizable));
|
||||
page.UserId = null;
|
||||
|
||||
page = await PageService.UpdatePageAsync(page);
|
||||
@ -392,9 +392,9 @@
|
||||
// update child paths
|
||||
if (parentid != currentparentid)
|
||||
{
|
||||
foreach (Page p in PageState.Pages.Where(item => item.Path.StartsWith(currentpath)))
|
||||
foreach (Page p in PageState.Pages.Where(item => item.Path.StartsWith(currentPath)))
|
||||
{
|
||||
p.Path = p.Path.Replace(currentpath, page.Path);
|
||||
p.Path = p.Path.Replace(currentPath, page.Path);
|
||||
await PageService.UpdatePageAsync(p);
|
||||
}
|
||||
}
|
||||
|
@ -6,15 +6,15 @@
|
||||
<div class="container">
|
||||
<div class="form-group">
|
||||
<label for="Username" class="control-label">Username: </label>
|
||||
<input type="text" class="form-control" placeholder="Username" @bind="@Username" readonly />
|
||||
<input type="text" class="form-control" placeholder="Username" @bind="@_username" readonly id="Username"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="Password" class="control-label">Password: </label>
|
||||
<input type="password" class="form-control" placeholder="Password" @bind="@Password" />
|
||||
<input type="password" class="form-control" placeholder="Password" @bind="@_password" id="Password"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="Password" class="control-label">Confirm Password: </label>
|
||||
<input type="password" class="form-control" placeholder="Password" @bind="@Confirm" />
|
||||
<label for="Confirm" class="control-label">Confirm Password: </label>
|
||||
<input type="password" class="form-control" placeholder="Password" @bind="@_confirm" id="Confirm"/>
|
||||
</div>
|
||||
<button type="button" class="btn btn-primary" @onclick="Reset">Reset Password</button>
|
||||
<button type="button" class="btn btn-secondary" @onclick="Cancel">Cancel</button>
|
||||
@ -23,15 +23,15 @@
|
||||
@code {
|
||||
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Anonymous; } }
|
||||
|
||||
string Username = "";
|
||||
string Password = "";
|
||||
string Confirm = "";
|
||||
string _username = "";
|
||||
string _password = "";
|
||||
string _confirm = "";
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
if (PageState.QueryString.ContainsKey("name") && PageState.QueryString.ContainsKey("token"))
|
||||
{
|
||||
Username = PageState.QueryString["name"];
|
||||
_username = PageState.QueryString["name"];
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -43,24 +43,26 @@
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Username != "" && Password != "" && Confirm != "")
|
||||
if (_username != "" && _password != "" && _confirm != "")
|
||||
{
|
||||
if (Password == Confirm)
|
||||
if (_password == _confirm)
|
||||
{
|
||||
User user = new User();
|
||||
user.SiteId = PageState.Site.SiteId;
|
||||
user.Username = Username;
|
||||
user.Password = Password;
|
||||
User user = new User
|
||||
{
|
||||
SiteId = PageState.Site.SiteId,
|
||||
Username = _username,
|
||||
Password = _password
|
||||
};
|
||||
user = await UserService.ResetPasswordAsync(user, PageState.QueryString["token"]);
|
||||
|
||||
if (user != null)
|
||||
{
|
||||
await logger.LogInformation("User Password Reset {Username}", Username);
|
||||
await logger.LogInformation("User Password Reset {Username}", _username);
|
||||
NavigationManager.NavigateTo(NavigateUrl("login"));
|
||||
}
|
||||
else
|
||||
{
|
||||
await logger.LogError("Error Resetting User Password {Username}", Username);
|
||||
await logger.LogError("Error Resetting User Password {Username}", _username);
|
||||
AddModuleMessage("Error Resetting User Password. Please Ensure Password Meets Complexity Requirements.", MessageType.Error);
|
||||
}
|
||||
}
|
||||
@ -76,7 +78,7 @@
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Resetting User Password {Username} {Error}", Username, ex.Message);
|
||||
await logger.LogError(ex, "Error Resetting User Password {Username} {Error}", _username, ex.Message);
|
||||
AddModuleMessage("Error Resetting User Password", MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +1,19 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Oqtane.Services;
|
||||
using Oqtane.Modules.HtmlText.Models;
|
||||
using Oqtane.Services;
|
||||
using Oqtane.Shared;
|
||||
using Oqtane.Models;
|
||||
|
||||
namespace Oqtane.Modules.HtmlText.Services
|
||||
{
|
||||
public class HtmlTextService : ServiceBase, IHtmlTextService
|
||||
{
|
||||
private readonly HttpClient _http;
|
||||
private readonly SiteState _siteState;
|
||||
private readonly NavigationManager _navigationManager;
|
||||
private readonly SiteState _siteState;
|
||||
|
||||
public HtmlTextService(HttpClient http, SiteState siteState, NavigationManager navigationManager)
|
||||
{
|
||||
@ -23,42 +22,39 @@ namespace Oqtane.Modules.HtmlText.Services
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "HtmlText"); }
|
||||
}
|
||||
private string ApiUrl => CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "HtmlText");
|
||||
|
||||
public async Task<HtmlTextInfo> GetHtmlTextAsync(int ModuleId)
|
||||
public async Task<HtmlTextInfo> GetHtmlTextAsync(int moduleId)
|
||||
{
|
||||
HtmlTextInfo htmltext;
|
||||
HtmlTextInfo htmlText;
|
||||
try
|
||||
{
|
||||
//because GetJsonAsync() returns an error if no content exists for the ModuleId ( https://github.com/aspnet/AspNetCore/issues/14041 )
|
||||
//null value is transfered as empty list
|
||||
var htmltextList = await _http.GetJsonAsync<List<HtmlTextInfo>>(apiurl + "/" + ModuleId.ToString() + "?entityid=" + ModuleId.ToString());
|
||||
htmltext = htmltextList.FirstOrDefault();
|
||||
var htmlTextList = await _http.GetJsonAsync<List<HtmlTextInfo>>(ApiUrl + "/" + moduleId + "?entityid=" + moduleId);
|
||||
htmlText = htmlTextList.FirstOrDefault();
|
||||
}
|
||||
catch
|
||||
{
|
||||
htmltext = null;
|
||||
htmlText = null;
|
||||
}
|
||||
return htmltext;
|
||||
|
||||
return htmlText;
|
||||
}
|
||||
|
||||
public async Task AddHtmlTextAsync(HtmlTextInfo htmltext)
|
||||
public async Task AddHtmlTextAsync(HtmlTextInfo htmlText)
|
||||
{
|
||||
await _http.PostJsonAsync(apiurl + "?entityid=" + htmltext.ModuleId.ToString(), htmltext);
|
||||
await _http.PostJsonAsync(ApiUrl + "?entityid=" + htmlText.ModuleId, htmlText);
|
||||
}
|
||||
|
||||
public async Task UpdateHtmlTextAsync(HtmlTextInfo htmltext)
|
||||
public async Task UpdateHtmlTextAsync(HtmlTextInfo htmlText)
|
||||
{
|
||||
await _http.PutJsonAsync(apiurl + "/" + htmltext.HtmlTextId.ToString() + "?entityid=" + htmltext.ModuleId.ToString(), htmltext);
|
||||
await _http.PutJsonAsync(ApiUrl + "/" + htmlText.HtmlTextId + "?entityid=" + htmlText.ModuleId, htmlText);
|
||||
}
|
||||
|
||||
public async Task DeleteHtmlTextAsync(int ModuleId)
|
||||
public async Task DeleteHtmlTextAsync(int moduleId)
|
||||
{
|
||||
await _http.DeleteAsync(apiurl + "/" + ModuleId.ToString() + "?entityid=" + ModuleId.ToString());
|
||||
await _http.DeleteAsync(ApiUrl + "/" + moduleId + "?entityid=" + moduleId);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user