added ModuleControlBase
This commit is contained in:
parent
fa15a5e44b
commit
a4a0334ec0
|
@ -1,6 +1,6 @@
|
|||
@namespace Oqtane.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
@attribute [OqtaneIgnore]
|
||||
@inherits ModuleControlBase
|
||||
|
||||
@if (_visible)
|
||||
{
|
||||
<div class="app-admin-modal">
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
@namespace Oqtane.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
@attribute [OqtaneIgnore]
|
||||
@inherits ModuleControlBase
|
||||
@inject IUserService UserService
|
||||
|
||||
@if (_authorized)
|
||||
|
@ -51,7 +50,7 @@
|
|||
|
||||
[Parameter]
|
||||
public string IconName { get; set; } // optional - specifies an icon for the link - default is no icon
|
||||
|
||||
|
||||
[Parameter]
|
||||
public bool IconOnly { get; set; } // optional - specifies only icon in link
|
||||
|
||||
|
@ -90,8 +89,8 @@
|
|||
|
||||
if (!string.IsNullOrEmpty(IconName))
|
||||
{
|
||||
_iconSpan = $"<span class=\"oi oi-{IconName}\"></span>{(IconOnly?"":" ")}";
|
||||
|
||||
_iconSpan = $"<span class=\"oi oi-{IconName}\"></span>{(IconOnly ? "" : " ")}";
|
||||
|
||||
}
|
||||
|
||||
_url = EditUrl(Action, _parameters);
|
||||
|
@ -123,7 +122,7 @@
|
|||
{
|
||||
security = Security.Value;
|
||||
}
|
||||
|
||||
|
||||
switch (security)
|
||||
{
|
||||
case SecurityAccessLevel.Anonymous:
|
||||
|
@ -143,7 +142,7 @@
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return authorized;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
@namespace Oqtane.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
@attribute [OqtaneIgnore]
|
||||
@inherits ModuleControlBase
|
||||
|
||||
@if (_text != string.Empty)
|
||||
{
|
||||
|
@ -8,7 +7,7 @@
|
|||
}
|
||||
|
||||
@code {
|
||||
|
||||
|
||||
private string _text = string.Empty;
|
||||
|
||||
[Parameter]
|
||||
|
@ -22,7 +21,7 @@
|
|||
|
||||
[Parameter]
|
||||
public DateTime ModifiedOn { get; set; }
|
||||
|
||||
|
||||
[Parameter]
|
||||
public string DeletedBy { get; set; }
|
||||
|
||||
|
@ -41,51 +40,51 @@
|
|||
if (!String.IsNullOrEmpty(CreatedBy) || CreatedOn != null)
|
||||
{
|
||||
_text += "<p style=\"" + Style + "\">Created ";
|
||||
|
||||
|
||||
if (!String.IsNullOrEmpty(CreatedBy))
|
||||
{
|
||||
_text += " by <b>" + CreatedBy + "</b>";
|
||||
}
|
||||
|
||||
|
||||
if (CreatedOn != null)
|
||||
{
|
||||
_text += " on <b>" + CreatedOn.ToString("MMM dd yyyy HH:mm:ss") + "</b>";
|
||||
}
|
||||
|
||||
|
||||
_text += "</p>";
|
||||
}
|
||||
|
||||
if (!String.IsNullOrEmpty(ModifiedBy) || ModifiedOn != null)
|
||||
{
|
||||
_text += "<p style=\"" + Style + "\">Last modified ";
|
||||
|
||||
|
||||
if (!String.IsNullOrEmpty(ModifiedBy))
|
||||
{
|
||||
_text += " by <b>" + ModifiedBy + "</b>";
|
||||
}
|
||||
|
||||
|
||||
if (ModifiedOn != null)
|
||||
{
|
||||
_text += " on <b>" + ModifiedOn.ToString("MMM dd yyyy HH:mm:ss") + "</b>";
|
||||
}
|
||||
|
||||
|
||||
_text += "</p>";
|
||||
}
|
||||
|
||||
if (!String.IsNullOrEmpty(DeletedBy) || DeletedOn.HasValue)
|
||||
{
|
||||
_text += "<p style=\"" + Style + "\">Deleted ";
|
||||
|
||||
|
||||
if (!String.IsNullOrEmpty(DeletedBy))
|
||||
{
|
||||
_text += " by <b>" + DeletedBy + "</b>";
|
||||
}
|
||||
|
||||
|
||||
if (DeletedOn != null)
|
||||
{
|
||||
_text += " on <b>" + DeletedOn.Value.ToString("MMM dd yyyy HH:mm:ss") + "</b>";
|
||||
}
|
||||
|
||||
|
||||
_text += "</p>";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
@namespace Oqtane.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
|
||||
@attribute [OqtaneIgnore]
|
||||
@inherits ModuleControlBase
|
||||
@inject IFolderService FolderService
|
||||
@inject IFileService FileService
|
||||
|
||||
|
@ -56,11 +54,11 @@
|
|||
<div>
|
||||
@if (UploadMultiple)
|
||||
{
|
||||
<input type="file" id="@_fileinputid" name="file" accept="@_filter" multiple/>
|
||||
<input type="file" id="@_fileinputid" name="file" accept="@_filter" multiple />
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="file" id="@_fileinputid" name="file" accept="@_filter"/>
|
||||
<input type="file" id="@_fileinputid" name="file" accept="@_filter" />
|
||||
}
|
||||
<span id="@_progressinfoid"></span><progress id="@_progressbarid" style="width: 150px; visibility: hidden;"></progress>
|
||||
<span class="float-right">
|
||||
|
@ -134,7 +132,7 @@
|
|||
|
||||
if (!string.IsNullOrEmpty(Folder))
|
||||
{
|
||||
_folders = new List<Folder> {new Folder {FolderId = -1, Name = Folder}};
|
||||
_folders = new List<Folder> { new Folder { FolderId = -1, Name = Folder } };
|
||||
FolderId = -1;
|
||||
}
|
||||
else
|
||||
|
@ -163,7 +161,7 @@
|
|||
|
||||
await GetFiles();
|
||||
|
||||
// create unique id for component
|
||||
// create unique id for component
|
||||
_guid = Guid.NewGuid().ToString("N");
|
||||
_fileinputid = _guid + "FileInput";
|
||||
_progressinfoid = _guid + "ProgressInfo";
|
||||
|
@ -211,7 +209,7 @@
|
|||
_message = string.Empty;
|
||||
try
|
||||
{
|
||||
FolderId = int.Parse((string) e.Value);
|
||||
FolderId = int.Parse((string)e.Value);
|
||||
await GetFiles();
|
||||
FileId = -1;
|
||||
_image = string.Empty;
|
||||
|
@ -227,7 +225,7 @@
|
|||
private async Task FileChanged(ChangeEventArgs e)
|
||||
{
|
||||
_message = string.Empty;
|
||||
FileId = int.Parse((string) e.Value);
|
||||
FileId = int.Parse((string)e.Value);
|
||||
|
||||
await SetImage();
|
||||
StateHasChanged();
|
||||
|
@ -244,8 +242,8 @@
|
|||
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 = "<img src=\"" + ContentUrl(FileId) + "\" alt=\"" + file.Name +
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
@namespace Oqtane.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
@attribute [OqtaneIgnore]
|
||||
@inherits ModuleControlBase
|
||||
|
||||
@if (!string.IsNullOrEmpty(HelpText))
|
||||
{
|
||||
|
@ -16,7 +15,7 @@ else
|
|||
private string _closeLabel = "</label>";
|
||||
|
||||
[Parameter]
|
||||
public RenderFragment ChildContent { get; set; }
|
||||
public RenderFragment ChildContent { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public string For { get; set; } // optional - the id of the associated input control for accessibility
|
||||
|
@ -34,12 +33,12 @@ else
|
|||
{
|
||||
_openLabel += " for=\"" + For + "\"";
|
||||
}
|
||||
|
||||
|
||||
if (!string.IsNullOrEmpty(Class))
|
||||
{
|
||||
_openLabel += " class=\"" + Class + "\"";
|
||||
}
|
||||
|
||||
|
||||
_openLabel += ">";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
@namespace Oqtane.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
@attribute [OqtaneIgnore]
|
||||
@inherits ModuleControlBase
|
||||
|
||||
@if (!string.IsNullOrEmpty(_message))
|
||||
{
|
||||
|
@ -52,7 +51,7 @@
|
|||
classname = "alert alert-danger";
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return classname;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,41 +1,39 @@
|
|||
@namespace Oqtane.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
@attribute [OqtaneIgnore]
|
||||
@typeparam TableItem
|
||||
|
||||
@inherits ModuleControlBase
|
||||
@typeparam TableItem
|
||||
|
||||
<p>
|
||||
@if(Format == "Table")
|
||||
@if (Format == "Table")
|
||||
{
|
||||
<table class="@Class">
|
||||
<thead>
|
||||
<tr>@Header</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<table class="@Class">
|
||||
<thead>
|
||||
<tr>@Header</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in ItemList)
|
||||
{
|
||||
<tr>@Row(item)</tr>
|
||||
@if (Detail != null)
|
||||
{
|
||||
<tr>@Detail(item)</tr>
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
@if (Format == "Grid")
|
||||
{
|
||||
<div class="@Class">
|
||||
<div class="row">@Header</div>
|
||||
@foreach (var item in ItemList)
|
||||
{
|
||||
<tr>@Row(item)</tr>
|
||||
<div class="row">@Row(item)</div>
|
||||
@if (Detail != null)
|
||||
{
|
||||
<tr>@Detail(item)</tr>
|
||||
<div class="row">@Detail(item)</div>
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
@if(Format == "Grid")
|
||||
{
|
||||
<div class="@Class">
|
||||
<div class="row">@Header</div>
|
||||
@foreach (var item in ItemList)
|
||||
{
|
||||
<div class="row">@Row(item)</div>
|
||||
@if (Detail != null)
|
||||
{
|
||||
<div class="row">@Detail(item)</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
<div class="mx-auto text-center">
|
||||
@if (_page > _maxPages)
|
||||
|
@ -44,7 +42,7 @@
|
|||
}
|
||||
@if (_endPage > 1)
|
||||
{
|
||||
<button class="btn btn-secondary" @onclick=@(async () => NavigateToPage("previous"))><span class="oi oi-chevron-left" title="previous" aria-hidden="true"></span></button>
|
||||
<button class="btn btn-secondary" @onclick=@(async () => NavigateToPage("previous"))><span class="oi oi-chevron-left" title="previous" aria-hidden="true"></span></button>
|
||||
@for (int i = _startPage; i <= _endPage; i++)
|
||||
{
|
||||
var pager = i;
|
||||
|
@ -105,7 +103,7 @@
|
|||
{
|
||||
Format = "Table";
|
||||
}
|
||||
|
||||
|
||||
if (string.IsNullOrEmpty(Class))
|
||||
{
|
||||
if (Format == "Table")
|
||||
|
@ -117,7 +115,7 @@
|
|||
Class = "container";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (string.IsNullOrEmpty(PageSize))
|
||||
{
|
||||
_maxItems = 10;
|
||||
|
@ -126,7 +124,7 @@
|
|||
{
|
||||
_maxItems = int.Parse(PageSize);
|
||||
}
|
||||
|
||||
|
||||
if (string.IsNullOrEmpty(DisplayPages))
|
||||
{
|
||||
_maxPages = 5;
|
||||
|
@ -149,7 +147,7 @@
|
|||
{
|
||||
ItemList = Items.Skip((currentPage - 1) * _maxItems).Take(_maxItems);
|
||||
_page = currentPage;
|
||||
|
||||
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
|
@ -174,7 +172,7 @@
|
|||
{
|
||||
_endPage = _pages;
|
||||
}
|
||||
|
||||
|
||||
StateHasChanged();
|
||||
}
|
||||
else if (direction == "back")
|
||||
|
@ -208,7 +206,7 @@
|
|||
_page -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
UpdateList(_page);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
@namespace Oqtane.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
@attribute [OqtaneIgnore]
|
||||
@inherits ModuleControlBase
|
||||
@inject IRoleService RoleService
|
||||
@inject IUserService UserService
|
||||
|
||||
|
@ -39,7 +38,7 @@
|
|||
<th scope="col">User</th>
|
||||
@foreach (PermissionString permission in _permissions)
|
||||
{
|
||||
<th style="text-align: center; width: 1px;">@permission.PermissionName</th>
|
||||
<th style="text-align: center; width: 1px;">@permission.PermissionName</th>
|
||||
}
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -48,7 +47,7 @@
|
|||
{
|
||||
string userid = "[" + user.UserId.ToString() + "]";
|
||||
<tr>
|
||||
<td >@user.DisplayName</td>
|
||||
<td>@user.DisplayName</td>
|
||||
@foreach (PermissionString permission in _permissions)
|
||||
{
|
||||
var p = permission;
|
||||
|
@ -107,13 +106,13 @@
|
|||
_roles.Insert(0, new Role { Name = Constants.AllUsersRole });
|
||||
|
||||
_permissions = new List<PermissionString>();
|
||||
|
||||
|
||||
foreach (string permissionname in _permissionnames.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
// initialize with admin role
|
||||
_permissions.Add(new PermissionString { PermissionName = permissionname, Permissions = Constants.AdminRole });
|
||||
}
|
||||
|
||||
|
||||
if (!string.IsNullOrEmpty(Permissions))
|
||||
{
|
||||
// populate permissions
|
||||
|
@ -123,7 +122,7 @@
|
|||
{
|
||||
_permissions[_permissions.FindIndex(item => item.PermissionName == permissionstring.PermissionName)].Permissions = permissionstring.Permissions;
|
||||
}
|
||||
|
||||
|
||||
if (permissionstring.Permissions.Contains("["))
|
||||
{
|
||||
foreach (string user in permissionstring.Permissions.Split(new char[] { '[' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
|
@ -183,7 +182,7 @@
|
|||
_message = "Username Does Not Exist";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
_username = string.Empty;
|
||||
}
|
||||
|
||||
|
@ -209,7 +208,7 @@
|
|||
case null:
|
||||
break; // permission not specified
|
||||
}
|
||||
|
||||
|
||||
_permissions[_permissions.FindIndex(item => item.PermissionName == permissionName)].Permissions = string.Join(";", ids.ToArray());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
@namespace Oqtane.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
@attribute [OqtaneIgnore]
|
||||
@inherits ModuleControlBase
|
||||
|
||||
<div class="row" style="margin-bottom: 50px;">
|
||||
<div class="col">
|
||||
|
@ -108,12 +107,12 @@
|
|||
public string DebugLevel { get; set; } = "info";
|
||||
|
||||
public override List<Resource> Resources => new List<Resource>()
|
||||
{
|
||||
{
|
||||
new Resource { ResourceType = ResourceType.Script, Bundle = "Quill", Url = "js/quill1.3.6.min.js" },
|
||||
new Resource { ResourceType = ResourceType.Script, Bundle = "Quill", Url = "js/quill-blot-formatter.min.js" },
|
||||
new Resource { ResourceType = ResourceType.Script, Bundle = "Quill", Url = "js/quill-interop.js" }
|
||||
};
|
||||
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
_content = Content; // raw HTML
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
@namespace Oqtane.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
@attribute [OqtaneIgnore]
|
||||
@inherits ModuleControlBase
|
||||
|
||||
<div class="d-flex">
|
||||
<div>
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
@namespace Oqtane.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
@attribute [OqtaneIgnore]
|
||||
@inherits ModuleControlBase
|
||||
|
||||
@if (Name == Parent.ActiveTab)
|
||||
{
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
@namespace Oqtane.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
@attribute [OqtaneIgnore]
|
||||
@inherits ModuleControlBase
|
||||
|
||||
<CascadingValue Value="this">
|
||||
<div class="container-fluid">
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
@namespace Oqtane.Modules.Controls
|
||||
@inherits ModuleControlBase
|
||||
|
||||
<img src="@_src" title="@_title" @onclick="SetValue" />
|
||||
|
||||
|
@ -38,7 +39,7 @@
|
|||
_value = true;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
SetImage();
|
||||
OnChange(_value);
|
||||
}
|
||||
|
|
10
Oqtane.Client/Modules/ModuleControlBase.cs
Normal file
10
Oqtane.Client/Modules/ModuleControlBase.cs
Normal file
|
@ -0,0 +1,10 @@
|
|||
using Oqtane.Shared;
|
||||
|
||||
namespace Oqtane.Modules
|
||||
{
|
||||
[OqtaneIgnore]
|
||||
public abstract class ModuleControlBase : ModuleBase
|
||||
{
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user