Compare commits
331 Commits
Author | SHA1 | Date | |
---|---|---|---|
38f2fa5733 | |||
7f15a5f464 | |||
0c5d992d18 | |||
57dd983c1f | |||
d89927ca96 | |||
63744d9ec2 | |||
c67526b5b0 | |||
1cb6bf2a6b | |||
ac9969c1b6 | |||
510cd23d5e | |||
c94ccbff69 | |||
93d0cc5e1a | |||
075ea0aafd | |||
e75fe19103 | |||
e76f1b9663 | |||
cb1c725ec1 | |||
98cd361fc0 | |||
d0c8399dd9 | |||
4effa8ec66 | |||
4065d87a74 | |||
eb9acc770c | |||
a8cd84e798 | |||
74e5b83026 | |||
4aa0b83807 | |||
fd592e8d9f | |||
bb21eba39f | |||
b09cb9d655 | |||
bbbe48b976 | |||
a036ee19a4 | |||
5b45c79357 | |||
760fc3b8d4 | |||
fc50a45ecd | |||
e3fe8c5914 | |||
2624b9c105 | |||
2f9f823330 | |||
6cc144d733 | |||
df404c12a4 | |||
faec53b3c5 | |||
e1ec58b297 | |||
38738e0844 | |||
abe0a1a806 | |||
809946685a | |||
20c8f1528d | |||
282579fcf2 | |||
c8e3fa88e7 | |||
aec5882de1 | |||
bc231b18cf | |||
6bcb769fe5 | |||
90110a653c | |||
3c561cc413 | |||
73f9622ba2 | |||
cf198ff781 | |||
648fc56495 | |||
ea6dc6b983 | |||
c0e8d09ce1 | |||
a471784cf3 | |||
1d2a4bf484 | |||
3fa620f3bc | |||
35f186b532 | |||
5cf35fd70a | |||
1eef08eaeb | |||
1750f28a9f | |||
41edbc5e22 | |||
04257f75e7 | |||
5fb602f733 | |||
94f0bdcce9 | |||
0ba24f9a3a | |||
aac7d6b97a | |||
bcc33af52b | |||
24fd42636a | |||
8d539d058c | |||
abda377f6f | |||
51bf822392 | |||
d3f135a9c7 | |||
07ba99cc41 | |||
336550c571 | |||
679cc04178 | |||
75fe4e7c89 | |||
410f8c74e5 | |||
05f67d6a2a | |||
3a6cde0e24 | |||
fe1de2b243 | |||
62a6b5f28a | |||
d648fa0f02 | |||
e706e8cf1f | |||
9eb8a7e65c | |||
11c610edf0 | |||
a65cdbd7ad | |||
97c56ba142 | |||
9fe72a1c98 | |||
7b40725534 | |||
5e1671afe3 | |||
50d74cbcee | |||
bc73e5e3d0 | |||
b02bdee8cb | |||
9db4985b14 | |||
6f281c256b | |||
807252c9e5 | |||
23e7f66188 | |||
57c500f4bc | |||
fe302aa9e4 | |||
f14f927df7 | |||
c3f74a5217 | |||
457d1bb563 | |||
25918056cb | |||
86517dd793 | |||
00ce083a2c | |||
bce262cd8e | |||
b5db62ef6a | |||
3703d87d50 | |||
f515def414 | |||
4bdf20822f | |||
49f4e64cb4 | |||
e615263706 | |||
2a7e256116 | |||
a083405b48 | |||
3ea280c82a | |||
192433f02d | |||
56a2e9dcea | |||
921cced1c8 | |||
b17f679f38 | |||
8e43fcab21 | |||
73c5092e46 | |||
56537e4785 | |||
3bd7d7196d | |||
7b5a192b82 | |||
d4be058d07 | |||
6c20fea46a | |||
2e7cfefb2e | |||
038894cf64 | |||
954e30d89f | |||
93d9c4534d | |||
468ca8c6a9 | |||
e7a4c08dea | |||
69d639ee42 | |||
a780569a6f | |||
568c283efd | |||
fccdd07a08 | |||
5e816ea912 | |||
cb2d529689 | |||
c5037e7084 | |||
fdc39d57fb | |||
4960e2c668 | |||
66cc3a1392 | |||
6e7c8e7b05 | |||
727b943fa3 | |||
a4a0334ec0 | |||
9ea5da525b | |||
fa15a5e44b | |||
35d037bbf4 | |||
e8387103f1 | |||
16965fd027 | |||
f81ef89c61 | |||
6034a161e7 | |||
ff23865711 | |||
3ac4116a84 | |||
65df0549fd | |||
04ffb079ea | |||
99d99ca6ad | |||
0659fc53b7 | |||
2febd81b4a | |||
0f814bfefe | |||
120066fce1 | |||
f4ca525bb5 | |||
5dced08f7a | |||
882412b8ff | |||
563345638a | |||
20b83c8809 | |||
7d89670930 | |||
40571bfb6e | |||
5a7a47ef27 | |||
ee5553ad8a | |||
ab8a1e7324 | |||
9e633d2d6d | |||
975e7217a5 | |||
95053d8671 | |||
61498862b5 | |||
a57e25d3d3 | |||
7cd18b1fe1 | |||
0636227284 | |||
d4d12b6f41 | |||
7c24bae753 | |||
06480d9a7e | |||
71b3b695fc | |||
db6d5d2b64 | |||
7d7e8e9e66 | |||
354382a580 | |||
288cad3d3f | |||
597a935cac | |||
1e4b2404c4 | |||
048d8f1b87 | |||
ec416a7fef | |||
c8630d7b05 | |||
42696eacbd | |||
b668a5d0ae | |||
4285603563 | |||
1c0d24ac25 | |||
4e6b4a20ef | |||
ea89cc1a64 | |||
79622819aa | |||
88e3a9adc3 | |||
f0c95c46c9 | |||
1a0e8f7e19 | |||
b5d4f8b176 | |||
8053cc0af6 | |||
134f21e29c | |||
a67330dbbb | |||
06820b9b63 | |||
f5d47a0308 | |||
937ae32a9e | |||
5124dea72c | |||
2ceeb25d0e | |||
e2732d83bd | |||
3e56e9cc04 | |||
836c4505b9 | |||
ef5ae77060 | |||
86b7fe193f | |||
3503f20255 | |||
51b69e05fb | |||
095a95a3a9 | |||
8d17153686 | |||
6efbeeb2b4 | |||
af1aab5b8d | |||
f854b948ce | |||
7b9cd39cb7 | |||
6f6f2b77d7 | |||
ed2822ac7c | |||
41348b285d | |||
5b0da056b4 | |||
2d079bdc06 | |||
aed71fbf96 | |||
4ebdf5721c | |||
99cad13890 | |||
4edb3f32f0 | |||
01a3b7ed95 | |||
c79199357e | |||
e24c6fc235 | |||
cdc4de432a | |||
5544d2bed3 | |||
aa4b00c900 | |||
c4f1d37421 | |||
c6b22d660b | |||
ec11587b28 | |||
1b7ca45d4a | |||
01491b063d | |||
4142cc63e7 | |||
20dc749d05 | |||
4144be5323 | |||
27a3ac8d1c | |||
f45cb8b069 | |||
0cc325ee95 | |||
7d21cfefc1 | |||
652d46f64a | |||
be4813d9c0 | |||
fe92d3d74f | |||
833ea9461a | |||
47a917a3df | |||
cb484665ca | |||
64b0c2f128 | |||
6402723d2a | |||
b1a007491f | |||
17ef268594 | |||
58d97dd731 | |||
ee3a4d1624 | |||
f9035f8fdf | |||
3a5b6954e3 | |||
1794d54a3f | |||
7d251b20cc | |||
0f09df13b5 | |||
73763f1623 | |||
1b2c7772ef | |||
3b2583a1bd | |||
f7470e3c5b | |||
19f8b3d429 | |||
fd249a7734 | |||
d5f3b7513d | |||
2a3b7caa9f | |||
612a820dac | |||
e80f42f1d9 | |||
8b5004c628 | |||
151e37c470 | |||
e935451d93 | |||
b0af00aa47 | |||
cbbac26881 | |||
f2230dd530 | |||
963148c639 | |||
215e52e42e | |||
945d7870c0 | |||
cc40733cff | |||
795f591da2 | |||
4cab49e022 | |||
3b685fe571 | |||
97df673609 | |||
cbcec0481a | |||
2f272ef4b6 | |||
a4ed06f2fc | |||
3339690e2a | |||
e4b37c17d8 | |||
f1f07f45c6 | |||
068803615b | |||
ddbb08ea75 | |||
6ac2b64d7d | |||
93497eb776 | |||
e1b0dbcdf7 | |||
c2ddd248e4 | |||
a4ec456205 | |||
23764d1ae4 | |||
f77a8a964f | |||
c089b90659 | |||
32cd34b090 | |||
d8fca5de20 | |||
2f8a15fb89 | |||
1495a5c017 | |||
61b1b710db | |||
24579dc4d0 | |||
066ef44773 | |||
1355233b92 | |||
dc55c5b3ec | |||
ed3f07ff61 | |||
028485b653 | |||
b43d191536 | |||
43dfad38c9 | |||
6f1e930474 | |||
1d52de53a6 | |||
3aec68d9fa | |||
4dc24f4c78 | |||
a73e088abc | |||
b61446a50a | |||
31773abb01 | |||
85c491224d | |||
71f79bd90b |
2
.deployment
Normal file
2
.deployment
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[config]
|
||||||
|
project = Oqtane.Server/Oqtane.Server.csproj
|
111
Oqtane.Client/Modules/Admin/Files/Details.razor
Normal file
111
Oqtane.Client/Modules/Admin/Files/Details.razor
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
@namespace Oqtane.Modules.Admin.Files
|
||||||
|
@inherits ModuleBase
|
||||||
|
@inject IFileService FileService
|
||||||
|
@inject IFolderService FolderService
|
||||||
|
@inject NavigationManager NavigationManager
|
||||||
|
|
||||||
|
@if (_folders != null)
|
||||||
|
{
|
||||||
|
<table class="table table-borderless">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<Label for="name" HelpText="The name of the file">Name: </Label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input id="name" class="form-control" @bind="@_name" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<Label For="parent" HelpText="The folder where the file is located">Folder: </Label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<select id="parent" class="form-control" @bind="@_folderId">
|
||||||
|
@foreach (Folder folder in _folders)
|
||||||
|
{
|
||||||
|
<option value="@(folder.FolderId)">@(new string('-', folder.Level * 2))@(folder.Name)</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<Label for="size" HelpText="The size of the file (in bytes)">Size: </Label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input id="size" class="form-control" @bind="@_size" readonly />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<button type="button" class="btn btn-success" @onclick="SaveFile">Save</button>
|
||||||
|
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<AuditInfo CreatedBy="@_createdBy" CreatedOn="@_createdOn" ModifiedBy="@_modifiedBy" ModifiedOn="@_modifiedOn"></AuditInfo>
|
||||||
|
}
|
||||||
|
|
||||||
|
@code {
|
||||||
|
private int _fileId = -1;
|
||||||
|
private string _name;
|
||||||
|
private List<Folder> _folders;
|
||||||
|
private int _folderId = -1;
|
||||||
|
private int _size;
|
||||||
|
private string _createdBy;
|
||||||
|
private DateTime _createdOn;
|
||||||
|
private string _modifiedBy;
|
||||||
|
private DateTime _modifiedOn;
|
||||||
|
|
||||||
|
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Admin;
|
||||||
|
|
||||||
|
public override string Title => "File Management";
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_folders = await FolderService.GetFoldersAsync(PageState.Site.SiteId);
|
||||||
|
_fileId = Int32.Parse(PageState.QueryString["id"]);
|
||||||
|
File file = await FileService.GetFileAsync(_fileId);
|
||||||
|
if (file != null)
|
||||||
|
{
|
||||||
|
_name = file.Name;
|
||||||
|
_folderId = file.FolderId;
|
||||||
|
_size = file.Size;
|
||||||
|
_createdBy = file.CreatedBy;
|
||||||
|
_createdOn = file.CreatedOn;
|
||||||
|
_modifiedBy = file.ModifiedBy;
|
||||||
|
_modifiedOn = file.ModifiedOn;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
await logger.LogError(ex, "Error Loading File {FileId} {Error}", _fileId, ex.Message);
|
||||||
|
AddModuleMessage("Error Loading File", MessageType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task SaveFile()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_name.IsPathOrFileValid())
|
||||||
|
{
|
||||||
|
File file = await FileService.GetFileAsync(_fileId);
|
||||||
|
file.Name = _name;
|
||||||
|
file.FolderId = _folderId;
|
||||||
|
file = await FileService.UpdateFileAsync(file);
|
||||||
|
await logger.LogInformation("File Saved {File}", file);
|
||||||
|
NavigationManager.NavigateTo(NavigateUrl());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AddModuleMessage("File Name Not Valid", MessageType.Warning);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
await logger.LogError(ex, "Error Saving File {FileId} {Error}", _fileId, ex.Message);
|
||||||
|
AddModuleMessage("Error Saving File", MessageType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,7 @@
|
|||||||
@namespace Oqtane.Modules.Admin.Files
|
@namespace Oqtane.Modules.Admin.Files
|
||||||
@inherits ModuleBase
|
@inherits ModuleBase
|
||||||
@inject IFolderService FolderService
|
@inject IFolderService FolderService
|
||||||
|
@inject IFileService FileService
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
|
|
||||||
@if (_folders != null)
|
@if (_folders != null)
|
||||||
@ -45,7 +46,7 @@
|
|||||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||||
@if (!_isSystem && PageState.QueryString.ContainsKey("id"))
|
@if (!_isSystem && PageState.QueryString.ContainsKey("id"))
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-danger" @onclick="DeleteFolder">Delete</button>
|
<ActionDialog Header="Delete Folder" Message="@("Are You Sure You Wish To Delete This Folder?")" Action="Delete" Security="SecurityAccessLevel.Admin" Class="btn btn-danger" OnClick="@(async () => await DeleteFolder())" />
|
||||||
}
|
}
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
@ -174,17 +175,41 @@
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
await logger.LogError(ex, "Error Saving Folder {FolderId} {Error}", _folderId, ex.Message);
|
await logger.LogError(ex, "Error Saving Folder {FolderId} {Error}", _folderId, ex.Message);
|
||||||
AddModuleMessage("Error Saving Module", MessageType.Error);
|
AddModuleMessage("Error Saving Folder", MessageType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task DeleteFolder()
|
private async Task DeleteFolder()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
bool isparent = false;
|
||||||
|
foreach (Folder folder in _folders)
|
||||||
|
{
|
||||||
|
if (folder.ParentId == _folderId)
|
||||||
|
{
|
||||||
|
isparent = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!isparent)
|
||||||
|
{
|
||||||
|
var files = await FileService.GetFilesAsync(_folderId);
|
||||||
|
if (files.Count == 0)
|
||||||
{
|
{
|
||||||
await FolderService.DeleteFolderAsync(_folderId);
|
await FolderService.DeleteFolderAsync(_folderId);
|
||||||
await logger.LogInformation("Folder Deleted {Folder}", _folderId);
|
await logger.LogInformation("Folder Deleted {Folder}", _folderId);
|
||||||
AddModuleMessage("Folder Deleted", MessageType.Success);
|
NavigationManager.NavigateTo(NavigateUrl());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AddModuleMessage("Folder Has Files And Cannot Be Deleted", MessageType.Warning);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AddModuleMessage("Folder Has Subfolders And Cannot Be Deleted", MessageType.Warning);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -28,13 +28,15 @@
|
|||||||
</table>
|
</table>
|
||||||
<Pager Items="@_files">
|
<Pager Items="@_files">
|
||||||
<Header>
|
<Header>
|
||||||
<th> </th>
|
<th style="width: 1px;"> </th>
|
||||||
|
<th style="width: 1px;"> </th>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Modified</th>
|
<th>Modified</th>
|
||||||
<th>Type</th>
|
<th>Type</th>
|
||||||
<th>Size</th>
|
<th>Size</th>
|
||||||
</Header>
|
</Header>
|
||||||
<Row>
|
<Row>
|
||||||
|
<td><ActionLink Action="Details" Text="Edit" Parameters="@($"id=" + context.FileId.ToString())" /></td>
|
||||||
<td><ActionDialog Header="Delete File" Message="@("Are You Sure You Wish To Delete " + context.Name + "?")" Action="Delete" Security="SecurityAccessLevel.Admin" Class="btn btn-danger" OnClick="@(async () => await DeleteFile(context))" /></td>
|
<td><ActionDialog Header="Delete File" Message="@("Are You Sure You Wish To Delete " + context.Name + "?")" Action="Delete" Security="SecurityAccessLevel.Admin" Class="btn btn-danger" OnClick="@(async () => await DeleteFile(context))" /></td>
|
||||||
<td><a href="@(ContentUrl(context.FileId))" target="_new">@context.Name</a></td>
|
<td><a href="@(ContentUrl(context.FileId))" target="_new">@context.Name</a></td>
|
||||||
<td>@context.ModifiedOn</td>
|
<td>@context.ModifiedOn</td>
|
||||||
|
@ -63,10 +63,18 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<Label For="retention-log" HelpText="What items do you want in the retention log">Retention Log (Items): </Label>
|
<Label For="retention" HelpText="Number of log entries to retain for this job">Retention Log (Items): </Label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input id="retention-log" class="form-control" @bind="@_retentionHistory" />
|
<input id="retention" class="form-control" @bind="@_retentionHistory" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<Label For="next" HelpText="Next execution for this job.">Next Execution: </Label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input id="next" class="form-control" @bind="@_nextExecution" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@ -83,6 +91,7 @@
|
|||||||
private string _startDate = string.Empty;
|
private string _startDate = string.Empty;
|
||||||
private string _endDate = string.Empty;
|
private string _endDate = string.Empty;
|
||||||
private string _retentionHistory = string.Empty;
|
private string _retentionHistory = string.Empty;
|
||||||
|
private string _nextExecution = string.Empty;
|
||||||
|
|
||||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
|
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
|
||||||
|
|
||||||
@ -102,6 +111,7 @@
|
|||||||
_startDate = (job.StartDate != null) ? job.StartDate.ToString() : string.Empty;
|
_startDate = (job.StartDate != null) ? job.StartDate.ToString() : string.Empty;
|
||||||
_endDate = (job.EndDate != null) ? job.EndDate.ToString() : string.Empty;
|
_endDate = (job.EndDate != null) ? job.EndDate.ToString() : string.Empty;
|
||||||
_retentionHistory = job.RetentionHistory.ToString();
|
_retentionHistory = job.RetentionHistory.ToString();
|
||||||
|
_nextExecution = job.NextExecution.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -140,6 +150,15 @@
|
|||||||
job.EndDate = DateTime.Parse(_endDate);
|
job.EndDate = DateTime.Parse(_endDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_nextExecution == string.Empty)
|
||||||
|
{
|
||||||
|
job.NextExecution = null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
job.NextExecution = DateTime.Parse(_nextExecution);
|
||||||
|
}
|
||||||
|
|
||||||
job.RetentionHistory = int.Parse(_retentionHistory);
|
job.RetentionHistory = int.Parse(_retentionHistory);
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -15,14 +15,14 @@ else
|
|||||||
|
|
||||||
<Pager Items="@_jobs">
|
<Pager Items="@_jobs">
|
||||||
<Header>
|
<Header>
|
||||||
<th> </th>
|
<th style="width: 1px;"> </th>
|
||||||
<th> </th>
|
<th style="width: 1px;"> </th>
|
||||||
<th> </th>
|
<th style="width: 1px;"> </th>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Status</th>
|
<th>Status</th>
|
||||||
<th>Frequency</th>
|
<th>Frequency</th>
|
||||||
<th>Next Execution</th>
|
<th>Next Execution</th>
|
||||||
<th> </th>
|
<th style="width: 1px;"> </th>
|
||||||
</Header>
|
</Header>
|
||||||
<Row>
|
<Row>
|
||||||
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.JobId.ToString())" /></td>
|
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.JobId.ToString())" /></td>
|
||||||
|
@ -22,7 +22,7 @@ else
|
|||||||
<td>@context.FinishDate</td>
|
<td>@context.FinishDate</td>
|
||||||
</Row>
|
</Row>
|
||||||
<Detail>
|
<Detail>
|
||||||
<td colspan="4">@context.Notes</td>
|
<td colspan="4">@((MarkupString)context.Notes)</td>
|
||||||
</Detail>
|
</Detail>
|
||||||
</Pager>
|
</Pager>
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
@namespace Oqtane.Modules.Admin.Login
|
@namespace Oqtane.Modules.Admin.Login
|
||||||
@inherits ModuleBase
|
@inherits ModuleBase
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
@inject IJSRuntime JsRuntime
|
|
||||||
@inject IUserService UserService
|
@inject IUserService UserService
|
||||||
@inject IServiceProvider ServiceProvider
|
@inject IServiceProvider ServiceProvider
|
||||||
|
|
||||||
@ -96,7 +95,7 @@
|
|||||||
{
|
{
|
||||||
await logger.LogInformation("Login Successful For Username {Username}", _username);
|
await logger.LogInformation("Login Successful For Username {Username}", _username);
|
||||||
// complete the login on the server so that the cookies are set correctly on SignalR
|
// complete the login on the server so that the cookies are set correctly on SignalR
|
||||||
var interop = new Interop(JsRuntime);
|
var interop = new Interop(JSRuntime);
|
||||||
string antiforgerytoken = await interop.GetElementByName("__RequestVerificationToken");
|
string antiforgerytoken = await interop.GetElementByName("__RequestVerificationToken");
|
||||||
var fields = new { __RequestVerificationToken = antiforgerytoken, username = _username, password = _password, remember = _remember, returnurl = _returnUrl };
|
var fields = new { __RequestVerificationToken = antiforgerytoken, username = _username, password = _password, remember = _remember, returnurl = _returnUrl };
|
||||||
await interop.SubmitForm($"/{PageState.Alias.AliasId}/pages/login/", fields);
|
await interop.SubmitForm($"/{PageState.Alias.AliasId}/pages/login/", fields);
|
||||||
|
@ -49,7 +49,7 @@ else
|
|||||||
{
|
{
|
||||||
<Pager Items="@_logs">
|
<Pager Items="@_logs">
|
||||||
<Header>
|
<Header>
|
||||||
<th> </th>
|
<th style="width: 1px;"> </th>
|
||||||
<th>Date</th>
|
<th>Date</th>
|
||||||
<th>Level</th>
|
<th>Level</th>
|
||||||
<th>Feature</th>
|
<th>Feature</th>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
@inject IModuleService ModuleService
|
@inject IModuleService ModuleService
|
||||||
@inject ISystemService SystemService
|
@inject ISystemService SystemService
|
||||||
|
|
||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<Label For="owner" HelpText="Enter the name of the organization who is developing this module. It should not contain spaces or punctuation.">Owner Name: </Label>
|
<Label For="owner" HelpText="Enter the name of the organization who is developing this module. It should not contain spaces or punctuation.">Owner Name: </Label>
|
||||||
@ -16,7 +16,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<Label For="module" HelpText="Enter a name for this module. It should be in singular form (ie. Car) and not contain spaces or punctuation.">Module Name: </Label>
|
<Label For="module" HelpText="Enter a name for this module. It should not contain spaces or punctuation.">Module Name: </Label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input id="module" class="form-control" @bind="@_module" />
|
<input id="module" class="form-control" @bind="@_module" />
|
||||||
@ -42,6 +42,20 @@
|
|||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<Label For="reference" HelpText="Select a framework reference version">Framework Reference: </Label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<select id="reference" class="form-control" @bind="@_reference">
|
||||||
|
@foreach (string version in Constants.ReleaseVersions.Split(','))
|
||||||
|
{
|
||||||
|
<option value="@(version)">@(version)</option>
|
||||||
|
}
|
||||||
|
<option value="local">Local</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
@if (!string.IsNullOrEmpty(_location))
|
@if (!string.IsNullOrEmpty(_location))
|
||||||
{
|
{
|
||||||
<tr>
|
<tr>
|
||||||
@ -53,7 +67,7 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<button type="button" class="btn btn-success" @onclick="CreateModule">Create Module</button>
|
<button type="button" class="btn btn-success" @onclick="CreateModule">Create Module</button>
|
||||||
|
|
||||||
@ -62,6 +76,7 @@
|
|||||||
private string _module = string.Empty;
|
private string _module = string.Empty;
|
||||||
private string _description = string.Empty;
|
private string _description = string.Empty;
|
||||||
private string _template = "-";
|
private string _template = "-";
|
||||||
|
public string _reference = Constants.Version;
|
||||||
private string _location = string.Empty;
|
private string _location = string.Empty;
|
||||||
|
|
||||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
|
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
|
||||||
@ -77,7 +92,7 @@
|
|||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(_owner) && !string.IsNullOrEmpty(_module) && _template != "-")
|
if (!string.IsNullOrEmpty(_owner) && !string.IsNullOrEmpty(_module) && _template != "-")
|
||||||
{
|
{
|
||||||
var moduleDefinition = new ModuleDefinition { Owner = _owner.Replace(" ", ""), Name = _module.Replace(" ", ""), Description = _description, Template = _template };
|
var moduleDefinition = new ModuleDefinition { Owner = _owner.Replace(" ", ""), Name = _module.Replace(" ", ""), Description = _description, Template = _template, Version = _reference };
|
||||||
await ModuleDefinitionService.CreateModuleDefinitionAsync(moduleDefinition, ModuleState.ModuleId);
|
await ModuleDefinitionService.CreateModuleDefinitionAsync(moduleDefinition, ModuleState.ModuleId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -105,11 +120,11 @@
|
|||||||
string[] path = systeminfo["serverpath"].Split('\\');
|
string[] path = systeminfo["serverpath"].Split('\\');
|
||||||
if (_template == "internal")
|
if (_template == "internal")
|
||||||
{
|
{
|
||||||
_location = string.Join("\\", path, 0, path.Length - 1) + "\\Oqtane.Client\\Modules\\" + _owner + "." + _module + "s";
|
_location = string.Join("\\", path, 0, path.Length - 1) + "\\Oqtane.Client\\Modules\\" + _owner + "." + _module;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_location = string.Join("\\", path, 0, path.Length - 2) + "\\" + _owner + "." + _module + "s";
|
_location = string.Join("\\", path, 0, path.Length - 2) + "\\" + _owner + "." + _module;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using [Owner].[Module]s.Models;
|
|
||||||
|
|
||||||
namespace [Owner].[Module]s.Services
|
|
||||||
{
|
|
||||||
public interface I[Module]Service
|
|
||||||
{
|
|
||||||
Task<List<[Module]>> Get[Module]sAsync(int ModuleId);
|
|
||||||
|
|
||||||
Task<[Module]> Get[Module]Async(int [Module]Id);
|
|
||||||
|
|
||||||
Task<[Module]> Add[Module]Async([Module] [Module]);
|
|
||||||
|
|
||||||
Task<[Module]> Update[Module]Async([Module] [Module]);
|
|
||||||
|
|
||||||
Task Delete[Module]Async(int [Module]Id);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,49 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Net.Http;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Oqtane.Modules;
|
|
||||||
using Oqtane.Services;
|
|
||||||
using Oqtane.Shared;
|
|
||||||
using [Owner].[Module]s.Models;
|
|
||||||
|
|
||||||
namespace [Owner].[Module]s.Services
|
|
||||||
{
|
|
||||||
public class [Module]Service : ServiceBase, I[Module]Service, IService
|
|
||||||
{
|
|
||||||
private readonly SiteState _siteState;
|
|
||||||
|
|
||||||
public [Module]Service(HttpClient http, SiteState siteState) : base(http)
|
|
||||||
{
|
|
||||||
_siteState = siteState;
|
|
||||||
}
|
|
||||||
|
|
||||||
private string Apiurl=> CreateApiUrl(_siteState.Alias, "[Module]");
|
|
||||||
|
|
||||||
public async Task<List<[Module]>> Get[Module]sAsync(int ModuleId)
|
|
||||||
{
|
|
||||||
List<[Module]> [Module]s = await GetJsonAsync<List<[Module]>>($"{Apiurl}?moduleid={ModuleId}");
|
|
||||||
return [Module]s.OrderBy(item => item.Name).ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<[Module]> Get[Module]Async(int [Module]Id)
|
|
||||||
{
|
|
||||||
return await GetJsonAsync<[Module]>($"{Apiurl}/{[Module]Id}");
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<[Module]> Add[Module]Async([Module] [Module])
|
|
||||||
{
|
|
||||||
return await PostJsonAsync<[Module]>($"{Apiurl}?entityid={[Module].ModuleId}", [Module]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<[Module]> Update[Module]Async([Module] [Module])
|
|
||||||
{
|
|
||||||
return await PutJsonAsync<[Module]>($"{Apiurl}/{[Module].[Module]Id}?entityid={[Module].ModuleId}", [Module]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task Delete[Module]Async(int [Module]Id)
|
|
||||||
{
|
|
||||||
await DeleteAsync($"{Apiurl}/{[Module]Id}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
XCOPY "..\Client\bin\Debug\netstandard2.1\[Owner].[Module]s.Client.Oqtane.dll" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y
|
|
||||||
XCOPY "..\Client\bin\Debug\netstandard2.1\[Owner].[Module]s.Client.Oqtane.pdb" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y
|
|
||||||
XCOPY "..\Server\bin\Debug\netcoreapp3.1\[Owner].[Module]s.Server.Oqtane.dll" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y
|
|
||||||
XCOPY "..\Server\bin\Debug\netcoreapp3.1\[Owner].[Module]s.Server.Oqtane.pdb" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y
|
|
||||||
XCOPY "..\Shared\bin\Debug\netstandard2.1\[Owner].[Module]s.Shared.Oqtane.dll" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y
|
|
||||||
XCOPY "..\Shared\bin\Debug\netstandard2.1\[Owner].[Module]s.Shared.Oqtane.pdb" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y
|
|
@ -1,75 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Microsoft.AspNetCore.Authorization;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using Oqtane.Shared;
|
|
||||||
using Oqtane.Enums;
|
|
||||||
using Oqtane.Infrastructure;
|
|
||||||
using [Owner].[Module]s.Models;
|
|
||||||
using [Owner].[Module]s.Repository;
|
|
||||||
|
|
||||||
namespace [Owner].[Module]s.Controllers
|
|
||||||
{
|
|
||||||
[Route("{site}/api/[controller]")]
|
|
||||||
public class [Module]Controller : Controller
|
|
||||||
{
|
|
||||||
private readonly I[Module]Repository _[Module]s;
|
|
||||||
private readonly ILogManager _logger;
|
|
||||||
|
|
||||||
public [Module]Controller(I[Module]Repository [Module]s, ILogManager logger)
|
|
||||||
{
|
|
||||||
_[Module]s = [Module]s;
|
|
||||||
_logger = logger;
|
|
||||||
}
|
|
||||||
|
|
||||||
// GET: api/<controller>?moduleid=x
|
|
||||||
[HttpGet]
|
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
|
||||||
public IEnumerable<[Module]> Get(string moduleid)
|
|
||||||
{
|
|
||||||
return _[Module]s.Get[Module]s(int.Parse(moduleid));
|
|
||||||
}
|
|
||||||
|
|
||||||
// GET api/<controller>/5
|
|
||||||
[HttpGet("{id}")]
|
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
|
||||||
public [Module] Get(int id)
|
|
||||||
{
|
|
||||||
return _[Module]s.Get[Module](id);
|
|
||||||
}
|
|
||||||
|
|
||||||
// POST api/<controller>
|
|
||||||
[HttpPost]
|
|
||||||
[Authorize(Roles = Constants.AdminRole)]
|
|
||||||
public [Module] Post([FromBody] [Module] [Module])
|
|
||||||
{
|
|
||||||
if (ModelState.IsValid)
|
|
||||||
{
|
|
||||||
[Module] = _[Module]s.Add[Module]([Module]);
|
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Create, "[Module] Added {[Module]}", [Module]);
|
|
||||||
}
|
|
||||||
return [Module];
|
|
||||||
}
|
|
||||||
|
|
||||||
// PUT api/<controller>/5
|
|
||||||
[HttpPut("{id}")]
|
|
||||||
[Authorize(Roles = Constants.AdminRole)]
|
|
||||||
public [Module] Put(int id, [FromBody] [Module] [Module])
|
|
||||||
{
|
|
||||||
if (ModelState.IsValid)
|
|
||||||
{
|
|
||||||
[Module] = _[Module]s.Update[Module]([Module]);
|
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Update, "[Module] Updated {[Module]}", [Module]);
|
|
||||||
}
|
|
||||||
return [Module];
|
|
||||||
}
|
|
||||||
|
|
||||||
// DELETE api/<controller>/5
|
|
||||||
[HttpDelete("{id}")]
|
|
||||||
[Authorize(Roles = Constants.AdminRole)]
|
|
||||||
public void Delete(int id)
|
|
||||||
{
|
|
||||||
_[Module]s.Delete[Module](id);
|
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "[Module] Deleted {[Module]Id}", id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using [Owner].[Module]s.Models;
|
|
||||||
|
|
||||||
namespace [Owner].[Module]s.Repository
|
|
||||||
{
|
|
||||||
public interface I[Module]Repository
|
|
||||||
{
|
|
||||||
IEnumerable<[Module]> Get[Module]s(int ModuleId);
|
|
||||||
[Module] Get[Module](int [Module]Id);
|
|
||||||
[Module] Add[Module]([Module] [Module]);
|
|
||||||
[Module] Update[Module]([Module] [Module]);
|
|
||||||
void Delete[Module](int [Module]Id);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
This is the location where static resources for third party libraries should be located ( the third party library assemblies will be included in the /lib folder ). They should be placed in subfolders which match the naming convention of the third party library. When the module package is deployed the static resource subfolders will be extracted under the web root.
|
|
@ -1 +0,0 @@
|
|||||||
This is the location where static resources such as images, style sheets, or scripts for this module will be located. Static assets can be organized in subfolders. When the module package is deployed the assets will be extracted under the web root in a folder that matches the module namespace.
|
|
@ -1,19 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using [Owner].[Module]s.Models;
|
|
||||||
|
|
||||||
namespace [Owner].[Module]s.Services
|
|
||||||
{
|
|
||||||
public interface I[Module]Service
|
|
||||||
{
|
|
||||||
Task<List<[Module]>> Get[Module]sAsync(int ModuleId);
|
|
||||||
|
|
||||||
Task<[Module]> Get[Module]Async(int [Module]Id);
|
|
||||||
|
|
||||||
Task<[Module]> Add[Module]Async([Module] [Module]);
|
|
||||||
|
|
||||||
Task<[Module]> Update[Module]Async([Module] [Module]);
|
|
||||||
|
|
||||||
Task Delete[Module]Async(int [Module]Id);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,49 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Net.Http;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Oqtane.Modules;
|
|
||||||
using Oqtane.Services;
|
|
||||||
using Oqtane.Shared;
|
|
||||||
using [Owner].[Module]s.Models;
|
|
||||||
|
|
||||||
namespace [Owner].[Module]s.Services
|
|
||||||
{
|
|
||||||
public class [Module]Service : ServiceBase, I[Module]Service, IService
|
|
||||||
{
|
|
||||||
private readonly SiteState _siteState;
|
|
||||||
|
|
||||||
public [Module]Service(HttpClient http, SiteState siteState) : base(http)
|
|
||||||
{
|
|
||||||
_siteState = siteState;
|
|
||||||
}
|
|
||||||
|
|
||||||
private string Apiurl=> CreateApiUrl(_siteState.Alias, "[Module]");
|
|
||||||
|
|
||||||
public async Task<List<[Module]>> Get[Module]sAsync(int ModuleId)
|
|
||||||
{
|
|
||||||
List<[Module]> [Module]s = await GetJsonAsync<List<[Module]>>($"{Apiurl}?moduleid={ModuleId}");
|
|
||||||
return [Module]s.OrderBy(item => item.Name).ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<[Module]> Get[Module]Async(int [Module]Id)
|
|
||||||
{
|
|
||||||
return await GetJsonAsync<[Module]>($"{Apiurl}/{[Module]Id}");
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<[Module]> Add[Module]Async([Module] [Module])
|
|
||||||
{
|
|
||||||
return await PostJsonAsync<[Module]>($"{Apiurl}?entityid={[Module].ModuleId}", [Module]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<[Module]> Update[Module]Async([Module] [Module])
|
|
||||||
{
|
|
||||||
return await PutJsonAsync<[Module]>($"{Apiurl}/{[Module].[Module]Id}?entityid={[Module].ModuleId}", [Module]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task Delete[Module]Async(int [Module]Id)
|
|
||||||
{
|
|
||||||
await DeleteAsync($"{Apiurl}/{[Module]Id}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,75 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Microsoft.AspNetCore.Authorization;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using Oqtane.Shared;
|
|
||||||
using Oqtane.Enums;
|
|
||||||
using Oqtane.Infrastructure;
|
|
||||||
using [Owner].[Module]s.Models;
|
|
||||||
using [Owner].[Module]s.Repository;
|
|
||||||
|
|
||||||
namespace [Owner].[Module]s.Controllers
|
|
||||||
{
|
|
||||||
[Route("{site}/api/[controller]")]
|
|
||||||
public class [Module]Controller : Controller
|
|
||||||
{
|
|
||||||
private readonly I[Module]Repository _[Module]s;
|
|
||||||
private readonly ILogManager _logger;
|
|
||||||
|
|
||||||
public [Module]Controller(I[Module]Repository [Module]s, ILogManager logger)
|
|
||||||
{
|
|
||||||
_[Module]s = [Module]s;
|
|
||||||
_logger = logger;
|
|
||||||
}
|
|
||||||
|
|
||||||
// GET: api/<controller>?moduleid=x
|
|
||||||
[HttpGet]
|
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
|
||||||
public IEnumerable<[Module]> Get(string moduleid)
|
|
||||||
{
|
|
||||||
return _[Module]s.Get[Module]s(int.Parse(moduleid));
|
|
||||||
}
|
|
||||||
|
|
||||||
// GET api/<controller>/5
|
|
||||||
[HttpGet("{id}")]
|
|
||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
|
||||||
public [Module] Get(int id)
|
|
||||||
{
|
|
||||||
return _[Module]s.Get[Module](id);
|
|
||||||
}
|
|
||||||
|
|
||||||
// POST api/<controller>
|
|
||||||
[HttpPost]
|
|
||||||
[Authorize(Roles = Constants.AdminRole)]
|
|
||||||
public [Module] Post([FromBody] [Module] [Module])
|
|
||||||
{
|
|
||||||
if (ModelState.IsValid)
|
|
||||||
{
|
|
||||||
[Module] = _[Module]s.Add[Module]([Module]);
|
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Create, "[Module] Added {[Module]}", [Module]);
|
|
||||||
}
|
|
||||||
return [Module];
|
|
||||||
}
|
|
||||||
|
|
||||||
// PUT api/<controller>/5
|
|
||||||
[HttpPut("{id}")]
|
|
||||||
[Authorize(Roles = Constants.AdminRole)]
|
|
||||||
public [Module] Put(int id, [FromBody] [Module] [Module])
|
|
||||||
{
|
|
||||||
if (ModelState.IsValid)
|
|
||||||
{
|
|
||||||
[Module] = _[Module]s.Update[Module]([Module]);
|
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Update, "[Module] Updated {[Module]}", [Module]);
|
|
||||||
}
|
|
||||||
return [Module];
|
|
||||||
}
|
|
||||||
|
|
||||||
// DELETE api/<controller>/5
|
|
||||||
[HttpDelete("{id}")]
|
|
||||||
[Authorize(Roles = Constants.AdminRole)]
|
|
||||||
public void Delete(int id)
|
|
||||||
{
|
|
||||||
_[Module]s.Delete[Module](id);
|
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "[Module] Deleted {[Module]Id}", id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,52 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text.Json;
|
|
||||||
using Oqtane.Modules;
|
|
||||||
using Oqtane.Models;
|
|
||||||
using Oqtane.Infrastructure;
|
|
||||||
using Oqtane.Repository;
|
|
||||||
using [Owner].[Module]s.Models;
|
|
||||||
using [Owner].[Module]s.Repository;
|
|
||||||
|
|
||||||
namespace [Owner].[Module]s.Manager
|
|
||||||
{
|
|
||||||
public class [Module]Manager : IPortable
|
|
||||||
{
|
|
||||||
private I[Module]Repository _[Module]s;
|
|
||||||
|
|
||||||
public [Module]Manager(I[Module]Repository [Module]s)
|
|
||||||
{
|
|
||||||
_[Module]s = [Module]s;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string ExportModule(Module module)
|
|
||||||
{
|
|
||||||
string content = "";
|
|
||||||
List<[Module]> [Module]s = _[Module]s.Get[Module]s(module.ModuleId).ToList();
|
|
||||||
if ([Module]s != null)
|
|
||||||
{
|
|
||||||
content = JsonSerializer.Serialize([Module]s);
|
|
||||||
}
|
|
||||||
return content;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ImportModule(Module module, string content, string version)
|
|
||||||
{
|
|
||||||
List<[Module]> [Module]s = null;
|
|
||||||
if (!string.IsNullOrEmpty(content))
|
|
||||||
{
|
|
||||||
[Module]s = JsonSerializer.Deserialize<List<[Module]>>(content);
|
|
||||||
}
|
|
||||||
if ([Module]s != null)
|
|
||||||
{
|
|
||||||
foreach([Module] [Module] in [Module]s)
|
|
||||||
{
|
|
||||||
[Module] _[Module] = new [Module]();
|
|
||||||
_[Module].ModuleId = module.ModuleId;
|
|
||||||
_[Module].Name = [Module].Name;
|
|
||||||
_[Module]s.Add[Module](_[Module]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using [Owner].[Module]s.Models;
|
|
||||||
|
|
||||||
namespace [Owner].[Module]s.Repository
|
|
||||||
{
|
|
||||||
public interface I[Module]Repository
|
|
||||||
{
|
|
||||||
IEnumerable<[Module]> Get[Module]s(int ModuleId);
|
|
||||||
[Module] Get[Module](int [Module]Id);
|
|
||||||
[Module] Add[Module]([Module] [Module]);
|
|
||||||
[Module] Update[Module]([Module] [Module]);
|
|
||||||
void Delete[Module](int [Module]Id);
|
|
||||||
}
|
|
||||||
}
|
|
@ -16,7 +16,7 @@
|
|||||||
<Header>
|
<Header>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Version</th>
|
<th>Version</th>
|
||||||
<th></th>
|
<th style="width: 1px"></th>
|
||||||
</Header>
|
</Header>
|
||||||
<Row>
|
<Row>
|
||||||
<td>@context.Name</td>
|
<td>@context.Name</td>
|
||||||
@ -77,8 +77,10 @@
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
ShowProgressIndicator();
|
||||||
|
var interop = new Interop(JSRuntime);
|
||||||
|
await interop.RedirectBrowser(NavigateUrl(), 10);
|
||||||
await ModuleDefinitionService.InstallModuleDefinitionsAsync();
|
await ModuleDefinitionService.InstallModuleDefinitionsAsync();
|
||||||
NavigationManager.NavigateTo(NavigateUrl());
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -75,12 +75,20 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<Label For="license" HelpText="The license of the module">License: </Label>
|
<Label For="license" HelpText="The module license terms">License: </Label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<textarea id="license" class="form-control" @bind="@_license" rows="5" disabled></textarea>
|
<textarea id="license" class="form-control" @bind="@_license" rows="5" disabled></textarea>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<Label For="runtimes" HelpText="The Blazor runtimes which this module supports">Runtimes: </Label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input id="runtimes" class="form-control" @bind="@_runtimes" disabled />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</Section>
|
</Section>
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
@ -110,6 +118,7 @@
|
|||||||
private string _url = "";
|
private string _url = "";
|
||||||
private string _contact = "";
|
private string _contact = "";
|
||||||
private string _license = "";
|
private string _license = "";
|
||||||
|
private string _runtimes = "";
|
||||||
private string _permissions;
|
private string _permissions;
|
||||||
private string _createdby;
|
private string _createdby;
|
||||||
private DateTime _createdon;
|
private DateTime _createdon;
|
||||||
@ -139,6 +148,7 @@
|
|||||||
_url = moduleDefinition.Url;
|
_url = moduleDefinition.Url;
|
||||||
_contact = moduleDefinition.Contact;
|
_contact = moduleDefinition.Contact;
|
||||||
_license = moduleDefinition.License;
|
_license = moduleDefinition.License;
|
||||||
|
_runtimes = moduleDefinition.Runtimes;
|
||||||
_permissions = moduleDefinition.Permissions;
|
_permissions = moduleDefinition.Permissions;
|
||||||
_createdby = moduleDefinition.CreatedBy;
|
_createdby = moduleDefinition.CreatedBy;
|
||||||
_createdon = moduleDefinition.CreatedOn;
|
_createdon = moduleDefinition.CreatedOn;
|
||||||
|
@ -14,11 +14,11 @@ else
|
|||||||
|
|
||||||
<Pager Items="@_moduleDefinitions">
|
<Pager Items="@_moduleDefinitions">
|
||||||
<Header>
|
<Header>
|
||||||
<th> </th>
|
<th style="width: 1px;"> </th>
|
||||||
<th> </th>
|
<th style="width: 1px;"> </th>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Version</th>
|
<th>Version</th>
|
||||||
<th> </th>
|
<th style="width: 1px;"> </th>
|
||||||
</Header>
|
</Header>
|
||||||
<Row>
|
<Row>
|
||||||
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.ModuleDefinitionId.ToString())" /></td>
|
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.ModuleDefinitionId.ToString())" /></td>
|
||||||
@ -54,21 +54,27 @@ else
|
|||||||
_packages = await PackageService.GetPackagesAsync("module");
|
_packages = await PackageService.GetPackagesAsync("module");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
if (_moduleDefinitions == null)
|
||||||
{
|
{
|
||||||
await logger.LogError(ex, "Error Loading Modules {Error}", ex.Message);
|
await logger.LogError(ex, "Error Loading Modules {Error}", ex.Message);
|
||||||
AddModuleMessage("Error Loading Modules", MessageType.Error);
|
AddModuleMessage("Error Loading Modules", MessageType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private bool UpgradeAvailable(string moduledefinitionname, string version)
|
private bool UpgradeAvailable(string moduledefinitionname, string version)
|
||||||
{
|
{
|
||||||
var upgradeavailable = false;
|
var upgradeavailable = false;
|
||||||
|
if (_packages != null)
|
||||||
|
{
|
||||||
var package = _packages.Where(item => item.PackageId == Utilities.GetTypeName(moduledefinitionname)).FirstOrDefault();
|
var package = _packages.Where(item => item.PackageId == Utilities.GetTypeName(moduledefinitionname)).FirstOrDefault();
|
||||||
if (package != null)
|
if (package != null)
|
||||||
{
|
{
|
||||||
upgradeavailable = (Version.Parse(package.Version).CompareTo(Version.Parse(version)) > 0);
|
upgradeavailable = (Version.Parse(package.Version).CompareTo(Version.Parse(version)) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
return upgradeavailable;
|
return upgradeavailable;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,9 +83,11 @@ else
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
await PackageService.DownloadPackageAsync(moduledefinitionname, version, "Modules");
|
await PackageService.DownloadPackageAsync(moduledefinitionname, version, "Modules");
|
||||||
await ModuleDefinitionService.InstallModuleDefinitionsAsync();
|
|
||||||
await logger.LogInformation("Module Downloaded {ModuleDefinitionName} {Version}", moduledefinitionname, version);
|
await logger.LogInformation("Module Downloaded {ModuleDefinitionName} {Version}", moduledefinitionname, version);
|
||||||
NavigationManager.NavigateTo(NavigateUrl());
|
ShowProgressIndicator();
|
||||||
|
var interop = new Interop(JSRuntime);
|
||||||
|
await interop.RedirectBrowser(NavigateUrl(), 10);
|
||||||
|
await ModuleDefinitionService.InstallModuleDefinitionsAsync();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -92,9 +100,10 @@ else
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
ShowProgressIndicator();
|
||||||
|
var interop = new Interop(JSRuntime);
|
||||||
|
await interop.RedirectBrowser(NavigateUrl(), 10);
|
||||||
await ModuleDefinitionService.DeleteModuleDefinitionAsync(moduleDefinition.ModuleDefinitionId, moduleDefinition.SiteId);
|
await ModuleDefinitionService.DeleteModuleDefinitionAsync(moduleDefinition.ModuleDefinitionId, moduleDefinition.SiteId);
|
||||||
await logger.LogInformation("Module Deleted {ModuleDefinition}", moduleDefinition);
|
|
||||||
NavigationManager.NavigateTo(NavigateUrl());
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -31,9 +31,15 @@
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await ModuleService.ImportModuleAsync(ModuleState.ModuleId, _content);
|
bool success = await ModuleService.ImportModuleAsync(ModuleState.ModuleId, _content);
|
||||||
StateHasChanged();
|
if (success)
|
||||||
NavigationManager.NavigateTo(NavigateUrl());
|
{
|
||||||
|
AddModuleMessage("Content Imported Successfully", MessageType.Success);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AddModuleMessage("A Problem Was Encountered Importing Content. Please Ensure The Content Is Formatted Correctly For The Module.", MessageType.Warning);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -25,9 +25,9 @@
|
|||||||
<td>
|
<td>
|
||||||
<select id="container" class="form-control" @bind="@_containerType">
|
<select id="container" class="form-control" @bind="@_containerType">
|
||||||
<option value="-"><Inherit From Page Or Site></option>
|
<option value="-"><Inherit From Page Or Site></option>
|
||||||
@foreach (KeyValuePair<string, string> container in _containers)
|
@foreach (var container in _containers)
|
||||||
{
|
{
|
||||||
<option value="@container.Key">@container.Value</option>
|
<option value="@container.TypeName">@container.Name</option>
|
||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
@ -63,7 +63,7 @@
|
|||||||
}
|
}
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
<TabPanel Name="Permissions">
|
<TabPanel Name="Permissions">
|
||||||
@if (_containers != null)
|
@if (_permissions != null)
|
||||||
{
|
{
|
||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<tr>
|
<tr>
|
||||||
@ -85,12 +85,12 @@
|
|||||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
private Dictionary<string, string> _containers;
|
private List<ThemeControl> _containers = new List<ThemeControl>();
|
||||||
private string _title;
|
private string _title;
|
||||||
private string _containerType;
|
private string _containerType;
|
||||||
private string _allPages = "false";
|
private string _allPages = "false";
|
||||||
private string _permissionNames = "";
|
private string _permissionNames = "";
|
||||||
private string _permissions;
|
private string _permissions = null;
|
||||||
private string _pageId;
|
private string _pageId;
|
||||||
private PermissionGrid _permissionGrid;
|
private PermissionGrid _permissionGrid;
|
||||||
private Type _settingsModuleType;
|
private Type _settingsModuleType;
|
||||||
@ -105,7 +105,7 @@
|
|||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
_title = ModuleState.Title;
|
_title = ModuleState.Title;
|
||||||
_containers = ThemeService.GetContainerTypes(await ThemeService.GetThemesAsync());
|
_containers = ThemeService.GetContainerControls(await ThemeService.GetThemesAsync(), PageState.Page.ThemeType);
|
||||||
_containerType = ModuleState.ContainerType;
|
_containerType = ModuleState.ContainerType;
|
||||||
if (!string.IsNullOrEmpty(PageState.Page.DefaultContainerType) && _containerType == PageState.Page.DefaultContainerType)
|
if (!string.IsNullOrEmpty(PageState.Page.DefaultContainerType) && _containerType == PageState.Page.DefaultContainerType)
|
||||||
{
|
{
|
||||||
|
@ -102,20 +102,22 @@
|
|||||||
<td>
|
<td>
|
||||||
<select id="Theme" class="form-control" @onchange="(e => ThemeChanged(e))">
|
<select id="Theme" class="form-control" @onchange="(e => ThemeChanged(e))">
|
||||||
<option value="-"><Inherit From Site></option>
|
<option value="-"><Inherit From Site></option>
|
||||||
@foreach (KeyValuePair<string, string> item in _themes)
|
@foreach (var theme in _themes)
|
||||||
{
|
{
|
||||||
if (item.Key == _themetype)
|
if (theme.TypeName == _themetype)
|
||||||
{
|
{
|
||||||
<option value="@item.Key" selected>@item.Value</option>
|
<option value="@theme.TypeName" selected>@theme.Name</option>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<option value="@item.Key">@item.Value</option>
|
<option value="@theme.TypeName">@theme.Name</option>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@if (_layouts.Count > 0)
|
||||||
|
{
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<Label For="Layout" HelpText="Select a layout for the page (if the selected theme supports it)">Layout: </Label>
|
<Label For="Layout" HelpText="Select a layout for the page (if the selected theme supports it)">Layout: </Label>
|
||||||
@ -123,20 +125,21 @@
|
|||||||
<td>
|
<td>
|
||||||
<select id="Layout" class="form-control" @bind="@_layouttype">
|
<select id="Layout" class="form-control" @bind="@_layouttype">
|
||||||
<option value="-"><Inherit From Site></option>
|
<option value="-"><Inherit From Site></option>
|
||||||
@foreach (KeyValuePair<string, string> panelayout in _panelayouts)
|
@foreach (var layout in _layouts)
|
||||||
{
|
{
|
||||||
if (panelayout.Key == _layouttype)
|
if (layout.TypeName == _layouttype)
|
||||||
{
|
{
|
||||||
<option value="@panelayout.Key" selected>@panelayout.Value</option>
|
<option value="@(layout.TypeName)" selected>@(layout.Name)</option>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<option value="@panelayout.Key">@panelayout.Value</option>
|
<option value="@(layout.TypeName)">@(layout.Name)</option>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<Label For="defaultContainer" HelpText="Select the default container for the page">Default Container: </Label>
|
<Label For="defaultContainer" HelpText="Select the default container for the page">Default Container: </Label>
|
||||||
@ -144,9 +147,9 @@
|
|||||||
<td>
|
<td>
|
||||||
<select id="defaultContainer" class="form-control" @bind="@_containertype">
|
<select id="defaultContainer" class="form-control" @bind="@_containertype">
|
||||||
<option value="-"><Inherit From Site></option>
|
<option value="-"><Inherit From Site></option>
|
||||||
@foreach (KeyValuePair<string, string> container in _containers)
|
@foreach (var container in _containers)
|
||||||
{
|
{
|
||||||
<option value="@container.Key">@container.Value</option>
|
<option value="@container.TypeName">@container.Name</option>
|
||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
@ -159,17 +162,6 @@
|
|||||||
<input id="Icon" class="form-control" @bind="@_icon" />
|
<input id="Icon" class="form-control" @bind="@_icon" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<Label For="Default-Mode" HelpText="Select the default administration mode you want for this page">Default Mode? </Label>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<select id="Default-Mode" class="form-control" @bind="@_mode">
|
|
||||||
<option value="view">View Mode</option>
|
|
||||||
<option value="edit">Edit Mode</option>
|
|
||||||
</select>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<Label For="Personalizable" HelpText="Select whether you would like users to be able to personalize this page with their own content">Personalizable? </Label>
|
<Label For="Personalizable" HelpText="Select whether you would like users to be able to personalize this page with their own content">Personalizable? </Label>
|
||||||
@ -199,10 +191,10 @@
|
|||||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
private Dictionary<string, string> _themes;
|
|
||||||
private Dictionary<string, string> _panelayouts;
|
|
||||||
private Dictionary<string, string> _containers = new Dictionary<string, string>();
|
|
||||||
private List<Theme> _themeList;
|
private List<Theme> _themeList;
|
||||||
|
private List<ThemeControl> _themes = new List<ThemeControl>();
|
||||||
|
private List<ThemeControl> _layouts = new List<ThemeControl>();
|
||||||
|
private List<ThemeControl> _containers = new List<ThemeControl>();
|
||||||
private List<Page> _pageList;
|
private List<Page> _pageList;
|
||||||
private string _name;
|
private string _name;
|
||||||
private string _title;
|
private string _title;
|
||||||
@ -214,7 +206,6 @@
|
|||||||
private string _isnavigation = "True";
|
private string _isnavigation = "True";
|
||||||
private string _url;
|
private string _url;
|
||||||
private string _ispersonalizable = "False";
|
private string _ispersonalizable = "False";
|
||||||
private string _mode = "view";
|
|
||||||
private string _themetype = "-";
|
private string _themetype = "-";
|
||||||
private string _layouttype = "-";
|
private string _layouttype = "-";
|
||||||
private string _containertype = "-";
|
private string _containertype = "-";
|
||||||
@ -232,10 +223,7 @@
|
|||||||
_pageList = PageState.Pages;
|
_pageList = PageState.Pages;
|
||||||
_children = PageState.Pages.Where(item => item.ParentId == null).ToList();
|
_children = PageState.Pages.Where(item => item.ParentId == null).ToList();
|
||||||
|
|
||||||
_themes = ThemeService.GetThemeTypes(_themeList);
|
_themes = ThemeService.GetThemeControls(_themeList);
|
||||||
_panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype);
|
|
||||||
_containers = ThemeService.GetContainerTypes(_themeList);
|
|
||||||
|
|
||||||
_permissions = string.Empty;
|
_permissions = string.Empty;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -287,12 +275,16 @@
|
|||||||
_themetype = (string)e.Value;
|
_themetype = (string)e.Value;
|
||||||
if (_themetype != "-")
|
if (_themetype != "-")
|
||||||
{
|
{
|
||||||
_panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype);
|
_layouts = ThemeService.GetLayoutControls(_themeList, _themetype);
|
||||||
|
_containers = ThemeService.GetContainerControls(_themeList, _themetype);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_panelayouts = new Dictionary<string, string>();
|
_layouts = new List<ThemeControl>();
|
||||||
|
_containers = new List<ThemeControl>();
|
||||||
}
|
}
|
||||||
|
_layouttype = "-";
|
||||||
|
_containertype = "-";
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -307,7 +299,7 @@
|
|||||||
Page page = null;
|
Page page = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (_name != string.Empty && !string.IsNullOrEmpty(_themetype) && (_panelayouts.Count == 0 || !string.IsNullOrEmpty(_layouttype)))
|
if (_name != string.Empty && !string.IsNullOrEmpty(_themetype) && (_layouts.Count == 0 || _layouttype != "-"))
|
||||||
{
|
{
|
||||||
page = new Page();
|
page = new Page();
|
||||||
page.SiteId = PageState.Page.SiteId;
|
page.SiteId = PageState.Page.SiteId;
|
||||||
@ -342,6 +334,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!PagePathIsUnique(page.Path, page.SiteId, _pageList))
|
||||||
|
{
|
||||||
|
AddModuleMessage($"A page with path {_path} already exists for the selected parent page. The page path needs to be unique for the selected parent.", MessageType.Warning);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Page child;
|
Page child;
|
||||||
switch (_insert)
|
switch (_insert)
|
||||||
{
|
{
|
||||||
@ -363,7 +361,6 @@
|
|||||||
|
|
||||||
page.IsNavigation = (_isnavigation == null ? true : Boolean.Parse(_isnavigation));
|
page.IsNavigation = (_isnavigation == null ? true : Boolean.Parse(_isnavigation));
|
||||||
page.Url = _url;
|
page.Url = _url;
|
||||||
page.EditMode = (_mode == "edit" ? true : false);
|
|
||||||
page.ThemeType = (_themetype != "-") ? _themetype : string.Empty;
|
page.ThemeType = (_themetype != "-") ? _themetype : string.Empty;
|
||||||
if (!string.IsNullOrEmpty(page.ThemeType) && page.ThemeType == PageState.Site.DefaultThemeType)
|
if (!string.IsNullOrEmpty(page.ThemeType) && page.ThemeType == PageState.Site.DefaultThemeType)
|
||||||
{
|
{
|
||||||
@ -392,7 +389,7 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AddModuleMessage("You Must Provide Page Name And Theme", MessageType.Warning);
|
AddModuleMessage("You Must Provide Page Name And Theme/Layout", MessageType.Warning);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -403,4 +400,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool PagePathIsUnique(string pagePath, int siteId, List<Page> existingPages)
|
||||||
|
{
|
||||||
|
return !existingPages.Any(page => page.SiteId == siteId && page.Path == pagePath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,20 +113,22 @@
|
|||||||
<td>
|
<td>
|
||||||
<select id="Theme" class="form-control" @onchange="(e => ThemeChanged(e))">
|
<select id="Theme" class="form-control" @onchange="(e => ThemeChanged(e))">
|
||||||
<option value="-"><Inherit From Site></option>
|
<option value="-"><Inherit From Site></option>
|
||||||
@foreach (KeyValuePair<string, string> item in _themes)
|
@foreach (var theme in _themes)
|
||||||
{
|
{
|
||||||
if (item.Key == _themetype)
|
if (theme.TypeName == _themetype)
|
||||||
{
|
{
|
||||||
<option value="@item.Key" selected>@item.Value</option>
|
<option value="@theme.TypeName" selected>@theme.Name</option>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<option value="@item.Key">@item.Value</option>
|
<option value="@theme.TypeName">@theme.Name</option>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@if (_layouts.Count > 0)
|
||||||
|
{
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<Label For="Layout" HelpText="Select a layout for the page (if the selected theme supports it)">Layout: </Label>
|
<Label For="Layout" HelpText="Select a layout for the page (if the selected theme supports it)">Layout: </Label>
|
||||||
@ -134,20 +136,21 @@
|
|||||||
<td>
|
<td>
|
||||||
<select id="Layout" class="form-control" @bind="@_layouttype">
|
<select id="Layout" class="form-control" @bind="@_layouttype">
|
||||||
<option value="-"><Inherit From Site></option>
|
<option value="-"><Inherit From Site></option>
|
||||||
@foreach (KeyValuePair<string, string> panelayout in _panelayouts)
|
@foreach (var layout in _layouts)
|
||||||
{
|
{
|
||||||
if (panelayout.Key == _layouttype)
|
if (layout.TypeName == _layouttype)
|
||||||
{
|
{
|
||||||
<option value="@panelayout.Key" selected>@panelayout.Value</option>
|
<option value="@(layout.TypeName)" selected>@(layout.Name)</option>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<option value="@panelayout.Key">@panelayout.Value</option>
|
<option value="@(layout.TypeName)">@(layout.Name)</option>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<Label For="defaultContainer" HelpText="Select the default container for the page">Default Container: </Label>
|
<Label For="defaultContainer" HelpText="Select the default container for the page">Default Container: </Label>
|
||||||
@ -155,9 +158,9 @@
|
|||||||
<td>
|
<td>
|
||||||
<select id="defaultContainer" class="form-control" @bind="@_containertype">
|
<select id="defaultContainer" class="form-control" @bind="@_containertype">
|
||||||
<option value="-"><Inherit From Site></option>
|
<option value="-"><Inherit From Site></option>
|
||||||
@foreach (KeyValuePair<string, string> container in _containers)
|
@foreach (var container in _containers)
|
||||||
{
|
{
|
||||||
<option value="@container.Key">@container.Value</option>
|
<option value="@container.TypeName">@container.Name</option>
|
||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
@ -170,17 +173,6 @@
|
|||||||
<input id="Icon" class="form-control" @bind="@_icon" />
|
<input id="Icon" class="form-control" @bind="@_icon" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<Label For="Default-Mode" HelpText="Select the default administration mode you want for this page">Default Mode? </Label>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<select id="Default-Mode" class="form-control" @bind="@_mode">
|
|
||||||
<option value="view">View Mode</option>
|
|
||||||
<option value="edit">Edit Mode</option>
|
|
||||||
</select>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<Label For="Personalizable" HelpText="Select whether you would like users to be able to personalize this page with their own content">Personalizable? </Label>
|
<Label For="Personalizable" HelpText="Select whether you would like users to be able to personalize this page with their own content">Personalizable? </Label>
|
||||||
@ -199,6 +191,8 @@
|
|||||||
}
|
}
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
<TabPanel Name="Permissions">
|
<TabPanel Name="Permissions">
|
||||||
|
@if (_permissions != null)
|
||||||
|
{
|
||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
@ -206,16 +200,17 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
}
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
</TabStrip>
|
</TabStrip>
|
||||||
<button type="button" class="btn btn-success" @onclick="SavePage">Save</button>
|
<button type="button" class="btn btn-success" @onclick="SavePage">Save</button>
|
||||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
private Dictionary<string, string> _themes;
|
|
||||||
private Dictionary<string, string> _panelayouts;
|
|
||||||
private Dictionary<string, string> _containers = new Dictionary<string, string>();
|
|
||||||
private List<Theme> _themeList;
|
private List<Theme> _themeList;
|
||||||
|
private List<ThemeControl> _themes = new List<ThemeControl>();
|
||||||
|
private List<ThemeControl> _layouts = new List<ThemeControl>();
|
||||||
|
private List<ThemeControl> _containers = new List<ThemeControl>();
|
||||||
private List<Page> _pageList;
|
private List<Page> _pageList;
|
||||||
private int _pageId;
|
private int _pageId;
|
||||||
private string _name;
|
private string _name;
|
||||||
@ -229,12 +224,11 @@
|
|||||||
private string _isnavigation;
|
private string _isnavigation;
|
||||||
private string _url;
|
private string _url;
|
||||||
private string _ispersonalizable;
|
private string _ispersonalizable;
|
||||||
private string _mode;
|
|
||||||
private string _themetype = "-";
|
private string _themetype = "-";
|
||||||
private string _layouttype = "-";
|
private string _layouttype = "-";
|
||||||
private string _containertype = "-";
|
private string _containertype = "-";
|
||||||
private string _icon;
|
private string _icon;
|
||||||
private string _permissions;
|
private string _permissions = null;
|
||||||
private string _createdby;
|
private string _createdby;
|
||||||
private DateTime _createdon;
|
private DateTime _createdon;
|
||||||
private string _modifiedby;
|
private string _modifiedby;
|
||||||
@ -252,12 +246,11 @@
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_themeList = await ThemeService.GetThemesAsync();
|
|
||||||
_pageList = PageState.Pages;
|
_pageList = PageState.Pages;
|
||||||
_children = PageState.Pages.Where(item => item.ParentId == null).ToList();
|
_children = PageState.Pages.Where(item => item.ParentId == null).ToList();
|
||||||
|
|
||||||
_themes = ThemeService.GetThemeTypes(_themeList);
|
_themeList = await ThemeService.GetThemesAsync();
|
||||||
_containers = ThemeService.GetContainerTypes(_themeList);
|
_themes = ThemeService.GetThemeControls(_themeList);
|
||||||
|
|
||||||
_pageId = Int32.Parse(PageState.QueryString["id"]);
|
_pageId = Int32.Parse(PageState.QueryString["id"]);
|
||||||
var page = PageState.Pages.FirstOrDefault(item => item.PageId == _pageId);
|
var page = PageState.Pages.FirstOrDefault(item => item.PageId == _pageId);
|
||||||
@ -285,18 +278,18 @@
|
|||||||
_isnavigation = page.IsNavigation.ToString();
|
_isnavigation = page.IsNavigation.ToString();
|
||||||
_url = page.Url;
|
_url = page.Url;
|
||||||
_ispersonalizable = page.IsPersonalizable.ToString();
|
_ispersonalizable = page.IsPersonalizable.ToString();
|
||||||
_mode = (page.EditMode) ? "edit" : "view";
|
|
||||||
_themetype = page.ThemeType;
|
_themetype = page.ThemeType;
|
||||||
if (_themetype == PageState.Site.DefaultThemeType)
|
if (_themetype == PageState.Site.DefaultThemeType)
|
||||||
{
|
{
|
||||||
_themetype = "-";
|
_themetype = "-";
|
||||||
}
|
}
|
||||||
_panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype);
|
_layouts = ThemeService.GetLayoutControls(_themeList, page.ThemeType);
|
||||||
_layouttype = page.LayoutType;
|
_layouttype = page.LayoutType;
|
||||||
if (_layouttype == PageState.Site.DefaultLayoutType)
|
if (_layouttype == PageState.Site.DefaultLayoutType)
|
||||||
{
|
{
|
||||||
_layouttype = "-";
|
_layouttype = "-";
|
||||||
}
|
}
|
||||||
|
_containers = ThemeService.GetContainerControls(_themeList, page.ThemeType);
|
||||||
_containertype = page.DefaultContainerType;
|
_containertype = page.DefaultContainerType;
|
||||||
if (string.IsNullOrEmpty(_containertype))
|
if (string.IsNullOrEmpty(_containertype))
|
||||||
{
|
{
|
||||||
@ -327,7 +320,7 @@
|
|||||||
_children = new List<Page>();
|
_children = new List<Page>();
|
||||||
if (_parentid == "-1")
|
if (_parentid == "-1")
|
||||||
{
|
{
|
||||||
foreach(Page p in PageState.Pages.Where(item => item.ParentId == null))
|
foreach (Page p in PageState.Pages.Where(item => item.ParentId == null))
|
||||||
{
|
{
|
||||||
if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, p.Permissions))
|
if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, p.Permissions))
|
||||||
{
|
{
|
||||||
@ -369,12 +362,16 @@
|
|||||||
_themetype = (string)e.Value;
|
_themetype = (string)e.Value;
|
||||||
if (_themetype != "-")
|
if (_themetype != "-")
|
||||||
{
|
{
|
||||||
_panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype);
|
_layouts = ThemeService.GetLayoutControls(_themeList, _themetype);
|
||||||
|
_containers = ThemeService.GetContainerControls(_themeList, _themetype);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_panelayouts = new Dictionary<string, string>();
|
_layouts = new List<ThemeControl>();
|
||||||
|
_containers = new List<ThemeControl>();
|
||||||
}
|
}
|
||||||
|
_layouttype = "-";
|
||||||
|
_containertype = "-";
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -423,6 +420,13 @@
|
|||||||
page.Path = parent.Path + "/" + Utilities.GetFriendlyUrl(_path);
|
page.Path = parent.Path + "/" + Utilities.GetFriendlyUrl(_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!PagePathIsUnique(page.Path, page.SiteId, page.PageId, _pageList))
|
||||||
|
{
|
||||||
|
AddModuleMessage($"A page with path {_path} already exists for the selected parent page. The page path needs to be unique for the selected parent.", MessageType.Warning);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (_insert != "=")
|
if (_insert != "=")
|
||||||
{
|
{
|
||||||
Page child;
|
Page child;
|
||||||
@ -446,7 +450,6 @@
|
|||||||
}
|
}
|
||||||
page.IsNavigation = (_isnavigation == null || Boolean.Parse(_isnavigation));
|
page.IsNavigation = (_isnavigation == null || Boolean.Parse(_isnavigation));
|
||||||
page.Url = _url;
|
page.Url = _url;
|
||||||
page.EditMode = (_mode == "edit");
|
|
||||||
page.ThemeType = (_themetype != "-") ? _themetype : string.Empty;
|
page.ThemeType = (_themetype != "-") ? _themetype : string.Empty;
|
||||||
if (!string.IsNullOrEmpty(page.ThemeType) && page.ThemeType == PageState.Site.DefaultThemeType)
|
if (!string.IsNullOrEmpty(page.ThemeType) && page.ThemeType == PageState.Site.DefaultThemeType)
|
||||||
{
|
{
|
||||||
@ -502,4 +505,9 @@
|
|||||||
AddModuleMessage("Error Saving Page", MessageType.Error);
|
AddModuleMessage("Error Saving Page", MessageType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool PagePathIsUnique(string pagePath, int siteId, int pageId, List<Page> existingPages)
|
||||||
|
{
|
||||||
|
return !existingPages.Any(page => page.SiteId == siteId && page.Path == pagePath && page.PageId != pageId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,8 @@
|
|||||||
|
|
||||||
<Pager Items="@PageState.Pages.Where(item => !item.IsDeleted)">
|
<Pager Items="@PageState.Pages.Where(item => !item.IsDeleted)">
|
||||||
<Header>
|
<Header>
|
||||||
<th> </th>
|
<th style="width: 1px;"> </th>
|
||||||
<th> </th>
|
<th style="width: 1px;"> </th>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
</Header>
|
</Header>
|
||||||
<Row>
|
<Row>
|
||||||
|
@ -145,6 +145,7 @@
|
|||||||
profile = new Profile();
|
profile = new Profile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
profile.SiteId = PageState.Site.SiteId;
|
||||||
profile.Name = _name;
|
profile.Name = _name;
|
||||||
profile.Title = _title;
|
profile.Title = _title;
|
||||||
profile.Description = _description;
|
profile.Description = _description;
|
||||||
|
@ -12,8 +12,8 @@ else
|
|||||||
|
|
||||||
<Pager Items="@_profiles">
|
<Pager Items="@_profiles">
|
||||||
<Header>
|
<Header>
|
||||||
<th> </th>
|
<th style="width: 1px;"> </th>
|
||||||
<th> </th>
|
<th style="width: 1px;"> </th>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
</Header>
|
</Header>
|
||||||
<Row>
|
<Row>
|
||||||
|
@ -16,8 +16,8 @@
|
|||||||
{
|
{
|
||||||
<Pager Items="@_pages">
|
<Pager Items="@_pages">
|
||||||
<Header>
|
<Header>
|
||||||
<th> </th>
|
<th style="width: 1px;"> </th>
|
||||||
<th> </th>
|
<th style="width: 1px;"> </th>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Deleted By</th>
|
<th>Deleted By</th>
|
||||||
<th>Deleted On</th>
|
<th>Deleted On</th>
|
||||||
@ -42,8 +42,8 @@
|
|||||||
{
|
{
|
||||||
<Pager Items="@_modules">
|
<Pager Items="@_modules">
|
||||||
<Header>
|
<Header>
|
||||||
<th> </th>
|
<th style="width: 1px;"> </th>
|
||||||
<th> </th>
|
<th style="width: 1px;"> </th>
|
||||||
<th>Page</th>
|
<th>Page</th>
|
||||||
<th>Module</th>
|
<th>Module</th>
|
||||||
<th>Deleted By</th>
|
<th>Deleted By</th>
|
||||||
|
@ -12,9 +12,9 @@ else
|
|||||||
|
|
||||||
<Pager Items="@_roles">
|
<Pager Items="@_roles">
|
||||||
<Header>
|
<Header>
|
||||||
<th> </th>
|
<th style="width: 1px;"> </th>
|
||||||
<th> </th>
|
<th style="width: 1px;"> </th>
|
||||||
<th> </th>
|
<th style="width: 1px;"> </th>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
</Header>
|
</Header>
|
||||||
<Row>
|
<Row>
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
@inject IThemeService ThemeService
|
@inject IThemeService ThemeService
|
||||||
@inject ISettingService SettingService
|
@inject ISettingService SettingService
|
||||||
|
|
||||||
@if (_themes != null)
|
@if (_initialized)
|
||||||
{
|
{
|
||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<tr>
|
<tr>
|
||||||
@ -56,45 +56,48 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select id="defaultTheme" class="form-control" @onchange="(e => ThemeChanged(e))">
|
<select id="defaultTheme" class="form-control" @onchange="(e => ThemeChanged(e))">
|
||||||
<option value=""><Select Theme></option>
|
<option value="-"><Select Theme></option>
|
||||||
@foreach (KeyValuePair<string, string> item in _themes)
|
@foreach (var theme in _themes)
|
||||||
{
|
{
|
||||||
if (item.Key == _themetype)
|
if (theme.TypeName == _themetype)
|
||||||
{
|
{
|
||||||
<option value="@item.Key" selected>@item.Value</option>
|
<option value="@theme.TypeName" selected>@theme.Name</option>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<option value="@item.Key">@item.Value</option>
|
<option value="@theme.TypeName">@theme.Name</option>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@if (_layouts.Count > 0)
|
||||||
|
{
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<Label For="defaultLayout" HelpText="Select the sites default layout">Default Layout: </Label>
|
<Label For="defaultLayout" HelpText="Select the sites default layout">Default Layout: </Label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select id="defaultLayout" class="form-control" @bind="@_layouttype">
|
<select id="defaultLayout" class="form-control" @bind="@_layouttype">
|
||||||
<option value=""><Select Layout></option>
|
<option value="-"><Select Layout></option>
|
||||||
@foreach (KeyValuePair<string, string> panelayout in _panelayouts)
|
@foreach (var layout in _layouts)
|
||||||
{
|
{
|
||||||
<option value="@panelayout.Key">@panelayout.Value</option>
|
<option value="@(layout.TypeName)">@(layout.Name)</option>
|
||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<Label For="defaultContainer" HelpText="Select the default container for the site">Default Container: </Label>
|
<Label For="defaultContainer" HelpText="Select the default container for the site">Default Container: </Label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select id="defaultContainer" class="form-control" @bind="@_containertype">
|
<select id="defaultContainer" class="form-control" @bind="@_containertype">
|
||||||
<option value=""><Select Container></option>
|
<option value="-"><Select Container></option>
|
||||||
@foreach (KeyValuePair<string, string> container in _containers)
|
@foreach (var container in _containers)
|
||||||
{
|
{
|
||||||
<option value="@container.Key">@container.Value</option>
|
<option value="@container.TypeName">@container.Name</option>
|
||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
@ -208,10 +211,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
private Dictionary<string, string> _themes;
|
private bool _initialized = false;
|
||||||
private Dictionary<string, string> _panelayouts;
|
|
||||||
private Dictionary<string, string> _containers;
|
|
||||||
private List<Theme> _themeList;
|
private List<Theme> _themeList;
|
||||||
|
private List<ThemeControl> _themes = new List<ThemeControl>();
|
||||||
|
private List<ThemeControl> _layouts = new List<ThemeControl>();
|
||||||
|
private List<ThemeControl> _containers = new List<ThemeControl>();
|
||||||
private string _name = string.Empty;
|
private string _name = string.Empty;
|
||||||
private List<Tenant> _tenantList;
|
private List<Tenant> _tenantList;
|
||||||
private string _tenant = string.Empty;
|
private string _tenant = string.Empty;
|
||||||
@ -221,9 +225,9 @@
|
|||||||
private FileManager _logofilemanager;
|
private FileManager _logofilemanager;
|
||||||
private int _faviconfileid = -1;
|
private int _faviconfileid = -1;
|
||||||
private FileManager _faviconfilemanager;
|
private FileManager _faviconfilemanager;
|
||||||
private string _themetype;
|
private string _themetype = "-";
|
||||||
private string _layouttype;
|
private string _layouttype = "-";
|
||||||
private string _containertype;
|
private string _containertype = "-";
|
||||||
private string _allowregistration;
|
private string _allowregistration;
|
||||||
private string _smtphost = string.Empty;
|
private string _smtphost = string.Empty;
|
||||||
private string _smtpport = string.Empty;
|
private string _smtpport = string.Empty;
|
||||||
@ -271,9 +275,11 @@
|
|||||||
_faviconfileid = site.FaviconFileId.Value;
|
_faviconfileid = site.FaviconFileId.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_themes = ThemeService.GetThemeControls(_themeList);
|
||||||
_themetype = site.DefaultThemeType;
|
_themetype = site.DefaultThemeType;
|
||||||
_panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype);
|
_layouts = ThemeService.GetLayoutControls(_themeList, _themetype);
|
||||||
_layouttype = site.DefaultLayoutType;
|
_layouttype = site.DefaultLayoutType;
|
||||||
|
_containers = ThemeService.GetContainerControls(_themeList, _themetype);
|
||||||
_containertype = site.DefaultContainerType;
|
_containertype = site.DefaultContainerType;
|
||||||
_allowregistration = site.AllowRegistration.ToString();
|
_allowregistration = site.AllowRegistration.ToString();
|
||||||
|
|
||||||
@ -313,10 +319,9 @@
|
|||||||
_deletedby = site.DeletedBy;
|
_deletedby = site.DeletedBy;
|
||||||
_deletedon = site.DeletedOn;
|
_deletedon = site.DeletedOn;
|
||||||
_isdeleted = site.IsDeleted.ToString();
|
_isdeleted = site.IsDeleted.ToString();
|
||||||
}
|
|
||||||
|
|
||||||
_themes = ThemeService.GetThemeTypes(_themeList);
|
_initialized = true;
|
||||||
_containers = ThemeService.GetContainerTypes(_themeList);
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -330,14 +335,18 @@
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
_themetype = (string)e.Value;
|
_themetype = (string)e.Value;
|
||||||
if (_themetype != string.Empty)
|
if (_themetype != "-")
|
||||||
{
|
{
|
||||||
_panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype);
|
_layouts = ThemeService.GetLayoutControls(_themeList, _themetype);
|
||||||
|
_containers = ThemeService.GetContainerControls(_themeList, _themetype);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_panelayouts = new Dictionary<string, string>();
|
_layouts = new List<ThemeControl>();
|
||||||
|
_containers = new List<ThemeControl>();
|
||||||
}
|
}
|
||||||
|
_layouttype = "-";
|
||||||
|
_containertype = "-";
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -351,7 +360,7 @@
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (_name != string.Empty && _urls != string.Empty && !string.IsNullOrEmpty(_themetype) && (_panelayouts.Count == 0 || !string.IsNullOrEmpty(_layouttype)) && !string.IsNullOrEmpty(_containertype))
|
if (_name != string.Empty && _urls != string.Empty && _themetype != "-" && (_layouts.Count == 0 || _layouttype != "-") && _containertype != "-")
|
||||||
{
|
{
|
||||||
var unique = true;
|
var unique = true;
|
||||||
foreach (string name in _urls.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
|
foreach (string name in _urls.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
|
||||||
@ -376,7 +385,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
site.DefaultThemeType = _themetype;
|
site.DefaultThemeType = _themetype;
|
||||||
site.DefaultLayoutType = (_layouttype == null ? string.Empty : _layouttype);
|
site.DefaultLayoutType = (_layouttype == "-" ? string.Empty : _layouttype);
|
||||||
site.DefaultContainerType = _containertype;
|
site.DefaultContainerType = _containertype;
|
||||||
site.AllowRegistration = (_allowregistration == null ? true : Boolean.Parse(_allowregistration));
|
site.AllowRegistration = (_allowregistration == null ? true : Boolean.Parse(_allowregistration));
|
||||||
site.IsDeleted = (_isdeleted == null ? true : Boolean.Parse(_isdeleted));
|
site.IsDeleted = (_isdeleted == null ? true : Boolean.Parse(_isdeleted));
|
||||||
@ -439,7 +448,7 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AddModuleMessage("You Must Provide A Site Name, Alias, And Default Theme/Container", MessageType.Warning);
|
AddModuleMessage("You Must Provide A Site Name, Alias, And Default Theme/Layout/Container", MessageType.Warning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -38,38 +38,41 @@ else
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select id="defaultTheme" class="form-control" @onchange="(e => ThemeChanged(e))">
|
<select id="defaultTheme" class="form-control" @onchange="(e => ThemeChanged(e))">
|
||||||
<option value=""><Select Theme></option>
|
<option value="-"><Select Theme></option>
|
||||||
@foreach (KeyValuePair<string, string> item in _themes)
|
@foreach (var theme in _themes)
|
||||||
{
|
{
|
||||||
<option value="@item.Key">@item.Value</option>
|
<option value="@theme.TypeName">@theme.Name</option>
|
||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@if (_layouts.Count > 0)
|
||||||
|
{
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<Label For="defaultLayout" HelpText="Select the default layout for the site">Default Layout: </Label>
|
<Label For="defaultLayout" HelpText="Select the default layout for the site">Default Layout: </Label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select id="defaultLayout" class="form-control" @bind="@_layouttype">
|
<select id="defaultLayout" class="form-control" @bind="@_layouttype">
|
||||||
<option value=""><Select Layout></option>
|
<option value="-"><Select Layout></option>
|
||||||
@foreach (KeyValuePair<string, string> panelayout in _panelayouts)
|
@foreach (var layout in _layouts)
|
||||||
{
|
{
|
||||||
<option value="@panelayout.Key">@panelayout.Value</option>
|
<option value="@(layout.TypeName)">@(layout.Name)</option>
|
||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<Label For="defaultContainer" HelpText="Select the default container for the site">Default Container: </Label>
|
<Label For="defaultContainer" HelpText="Select the default container for the site">Default Container: </Label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select id="defaultContainer" class="form-control" @bind="@_containertype">
|
<select id="defaultContainer" class="form-control" @bind="@_containertype">
|
||||||
<option value=""><Select Container></option>
|
<option value="-"><Select Container></option>
|
||||||
@foreach (KeyValuePair<string, string> container in _containers)
|
@foreach (var container in _containers)
|
||||||
{
|
{
|
||||||
<option value="@container.Key">@container.Value</option>
|
<option value="@container.TypeName">@container.Name</option>
|
||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
@ -80,7 +83,7 @@ else
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select id="siteTemplate" class="form-control" @bind="@_sitetemplatetype">
|
<select id="siteTemplate" class="form-control" @bind="@_sitetemplatetype">
|
||||||
<option value=""><Select Site Template></option>
|
<option value="-"><Select Site Template></option>
|
||||||
@foreach (SiteTemplate siteTemplate in _siteTemplates)
|
@foreach (SiteTemplate siteTemplate in _siteTemplates)
|
||||||
{
|
{
|
||||||
<option value="@siteTemplate.TypeName">@siteTemplate.Name</option>
|
<option value="@siteTemplate.TypeName">@siteTemplate.Name</option>
|
||||||
@ -198,11 +201,11 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
private Dictionary<string, string> _themes = new Dictionary<string, string>();
|
|
||||||
private Dictionary<string, string> _panelayouts = new Dictionary<string, string>();
|
|
||||||
private Dictionary<string, string> _containers = new Dictionary<string, string>();
|
|
||||||
private List<SiteTemplate> _siteTemplates;
|
|
||||||
private List<Theme> _themeList;
|
private List<Theme> _themeList;
|
||||||
|
private List<ThemeControl> _themes = new List<ThemeControl>();
|
||||||
|
private List<ThemeControl> _layouts = new List<ThemeControl>();
|
||||||
|
private List<ThemeControl> _containers = new List<ThemeControl>();
|
||||||
|
private List<SiteTemplate> _siteTemplates;
|
||||||
private List<Tenant> _tenants;
|
private List<Tenant> _tenants;
|
||||||
private string _tenantid = "-";
|
private string _tenantid = "-";
|
||||||
|
|
||||||
@ -218,20 +221,19 @@ else
|
|||||||
|
|
||||||
private string _name = string.Empty;
|
private string _name = string.Empty;
|
||||||
private string _urls = string.Empty;
|
private string _urls = string.Empty;
|
||||||
private string _themetype = string.Empty;
|
private string _themetype = "-";
|
||||||
private string _layouttype = string.Empty;
|
private string _layouttype = "-";
|
||||||
private string _containertype = string.Empty;
|
private string _containertype = "-";
|
||||||
private string _sitetemplatetype = string.Empty;
|
private string _sitetemplatetype = "-";
|
||||||
|
|
||||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
|
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
_themeList = await ThemeService.GetThemesAsync();
|
|
||||||
_tenants = await TenantService.GetTenantsAsync();
|
_tenants = await TenantService.GetTenantsAsync();
|
||||||
_urls = PageState.Alias.Name;
|
_urls = PageState.Alias.Name;
|
||||||
_themes = ThemeService.GetThemeTypes(_themeList);
|
_themeList = await ThemeService.GetThemesAsync();
|
||||||
_containers = ThemeService.GetContainerTypes(_themeList);
|
_themes = ThemeService.GetThemeControls(_themeList);
|
||||||
_siteTemplates = await SiteTemplateService.GetSiteTemplatesAsync();
|
_siteTemplates = await SiteTemplateService.GetSiteTemplatesAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,15 +265,18 @@ else
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
_themetype = (string)e.Value;
|
_themetype = (string)e.Value;
|
||||||
if (_themetype != string.Empty)
|
if (_themetype != "-")
|
||||||
{
|
{
|
||||||
_panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype);
|
_layouts = ThemeService.GetLayoutControls(_themeList, _themetype);
|
||||||
|
_containers = ThemeService.GetContainerControls(_themeList, _themetype);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_panelayouts = new Dictionary<string, string>();
|
_layouts = new List<ThemeControl>();
|
||||||
|
_containers = new List<ThemeControl>();
|
||||||
}
|
}
|
||||||
|
_layouttype = "-";
|
||||||
|
_containertype = "-";
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -283,7 +288,7 @@ else
|
|||||||
|
|
||||||
private async Task SaveSite()
|
private async Task SaveSite()
|
||||||
{
|
{
|
||||||
if (_tenantid != "-" && _name != string.Empty && _urls != string.Empty && !string.IsNullOrEmpty(_themetype) && (_panelayouts.Count == 0 || !string.IsNullOrEmpty(_layouttype)) && !string.IsNullOrEmpty(_containertype) && !string.IsNullOrEmpty(_sitetemplatetype))
|
if (_tenantid != "-" && _name != string.Empty && _urls != string.Empty && _themetype != "-" && (_layouts.Count == 0 || _layouttype != "-") && _containertype != "-" && _sitetemplatetype != "-")
|
||||||
{
|
{
|
||||||
var duplicates = new List<string>();
|
var duplicates = new List<string>();
|
||||||
var aliases = await AliasService.GetAliasesAsync();
|
var aliases = await AliasService.GetAliasesAsync();
|
||||||
@ -397,7 +402,7 @@ else
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AddModuleMessage("You Must Provide A Tenant, Site Name, Alias, Default Theme/Container, And Site Template", MessageType.Warning);
|
AddModuleMessage("You Must Provide A Tenant, Site Name, Alias, Default Theme/Layout/Container, And Site Template", MessageType.Warning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
@inject IAliasService AliasService
|
@inject IAliasService AliasService
|
||||||
@inject IThemeService ThemeService
|
@inject IThemeService ThemeService
|
||||||
|
|
||||||
@if (_themes != null)
|
@if (_initialized)
|
||||||
{
|
{
|
||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<tr>
|
<tr>
|
||||||
@ -39,45 +39,48 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select id="defaultTheme" class="form-control" @onchange="(e => ThemeChanged(e))">
|
<select id="defaultTheme" class="form-control" @onchange="(e => ThemeChanged(e))">
|
||||||
<option value=""><Select Theme></option>
|
<option value="-"><Select Theme></option>
|
||||||
@foreach (KeyValuePair<string, string> item in _themes)
|
@foreach (var theme in _themes)
|
||||||
{
|
{
|
||||||
if (item.Key == _themetype)
|
if (theme.TypeName == _themetype)
|
||||||
{
|
{
|
||||||
<option value="@item.Key" selected>@item.Value</option>
|
<option value="@theme.TypeName" selected>@theme.Name</option>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<option value="@item.Key">@item.Value</option>
|
<option value="@theme.TypeName">@theme.Name</option>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@if (_layouts.Count > 0)
|
||||||
|
{
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<Label For="defaultLayout" HelpText="Select the default layout for the site">Default Layout: </Label>
|
<Label For="defaultLayout" HelpText="Select the default layout for the site">Default Layout: </Label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select id="defaultLayout" class="form-control" @bind="@_layouttype">
|
<select id="defaultLayout" class="form-control" @bind="@_layouttype">
|
||||||
<option value=""><Select Layout></option>
|
<option value="-"><Select Layout></option>
|
||||||
@foreach (KeyValuePair<string, string> panelayout in _panelayouts)
|
@foreach (var layout in _layouts)
|
||||||
{
|
{
|
||||||
<option value="@panelayout.Key">@panelayout.Value</option>
|
<option value="@(layout.TypeName)">@(layout.Name)</option>
|
||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<Label For="defaultContainer" HelpText="Select the default container for the site">Default Container: </Label>
|
<Label For="defaultContainer" HelpText="Select the default container for the site">Default Container: </Label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select id="defaultIdea" class="form-control" @bind="@_containertype">
|
<select id="defaultIdea" class="form-control" @bind="@_containertype">
|
||||||
<option value=""><Select Container></option>
|
<option value="-"><Select Container></option>
|
||||||
@foreach (KeyValuePair<string, string> container in _containers)
|
@foreach (var container in _containers)
|
||||||
{
|
{
|
||||||
<option value="@container.Key">@container.Value</option>
|
<option value="@container.TypeName">@container.Name</option>
|
||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
@ -103,11 +106,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
private Dictionary<string, string> _themes;
|
private bool _initialized = false;
|
||||||
private Dictionary<string, string> _panelayouts;
|
|
||||||
private Dictionary<string, string> _containers;
|
|
||||||
private Alias _alias;
|
|
||||||
private List<Theme> _themeList;
|
private List<Theme> _themeList;
|
||||||
|
private List<ThemeControl> _themes = new List<ThemeControl>();
|
||||||
|
private List<ThemeControl> _layouts = new List<ThemeControl>();
|
||||||
|
private List<ThemeControl> _containers = new List<ThemeControl>();
|
||||||
|
private Alias _alias;
|
||||||
private string _name = string.Empty;
|
private string _name = string.Empty;
|
||||||
private List<Tenant> _tenantList;
|
private List<Tenant> _tenantList;
|
||||||
private string _tenant = string.Empty;
|
private string _tenant = string.Empty;
|
||||||
@ -147,9 +151,11 @@
|
|||||||
_urls += alias.Name + "\n";
|
_urls += alias.Name + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_themes = ThemeService.GetThemeControls(_themeList);
|
||||||
_themetype = site.DefaultThemeType;
|
_themetype = site.DefaultThemeType;
|
||||||
_panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype);
|
_layouts = ThemeService.GetLayoutControls(_themeList, _themetype);
|
||||||
_layouttype = site.DefaultLayoutType;
|
_layouttype = site.DefaultLayoutType;
|
||||||
|
_containers = ThemeService.GetContainerControls(_themeList, _themetype);
|
||||||
_containertype = site.DefaultContainerType;
|
_containertype = site.DefaultContainerType;
|
||||||
_createdby = site.CreatedBy;
|
_createdby = site.CreatedBy;
|
||||||
_createdon = site.CreatedOn;
|
_createdon = site.CreatedOn;
|
||||||
@ -158,10 +164,9 @@
|
|||||||
_deletedby = site.DeletedBy;
|
_deletedby = site.DeletedBy;
|
||||||
_deletedon = site.DeletedOn;
|
_deletedon = site.DeletedOn;
|
||||||
_isdeleted = site.IsDeleted.ToString();
|
_isdeleted = site.IsDeleted.ToString();
|
||||||
}
|
|
||||||
|
|
||||||
_themes = ThemeService.GetThemeTypes(_themeList);
|
_initialized = true;
|
||||||
_containers = ThemeService.GetContainerTypes(_themeList);
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -175,15 +180,18 @@
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
_themetype = (string)e.Value;
|
_themetype = (string)e.Value;
|
||||||
if (_themetype != string.Empty)
|
if (_themetype != "-")
|
||||||
{
|
{
|
||||||
_panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype);
|
_layouts = ThemeService.GetLayoutControls(_themeList, _themetype);
|
||||||
|
_containers = ThemeService.GetContainerControls(_themeList, _themetype);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_panelayouts = new Dictionary<string, string>();
|
_layouts = new List<ThemeControl>();
|
||||||
|
_containers = new List<ThemeControl>();
|
||||||
}
|
}
|
||||||
|
_layouttype = "-";
|
||||||
|
_containertype = "-";
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -197,7 +205,7 @@
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (_name != string.Empty && _urls != string.Empty && !string.IsNullOrEmpty(_themetype) && (_panelayouts.Count == 0 || !string.IsNullOrEmpty(_layouttype)) && !string.IsNullOrEmpty(_containertype))
|
if (_name != string.Empty && _urls != string.Empty && _themetype != "-" && (_layouts.Count == 0 || _layouttype != "-") && _containertype != "-")
|
||||||
{
|
{
|
||||||
var unique = true;
|
var unique = true;
|
||||||
foreach (string name in _urls.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
|
foreach (string name in _urls.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
|
||||||
|
@ -14,8 +14,8 @@ else
|
|||||||
|
|
||||||
<Pager Items="@_sites">
|
<Pager Items="@_sites">
|
||||||
<Header>
|
<Header>
|
||||||
<th> </th>
|
<th style="width: 1px;"> </th>
|
||||||
<th> </th>
|
<th style="width: 1px;"> </th>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
</Header>
|
</Header>
|
||||||
<Row>
|
<Row>
|
||||||
|
@ -11,8 +11,8 @@ else
|
|||||||
{
|
{
|
||||||
<Pager Items="@tenants">
|
<Pager Items="@tenants">
|
||||||
<Header>
|
<Header>
|
||||||
<th> </th>
|
<th style="width: 1px;"> </th>
|
||||||
<th> </th>
|
<th style="width: 1px;"> </th>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
</Header>
|
</Header>
|
||||||
<Row>
|
<Row>
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
@if (_packages != null)
|
@if (_packages != null)
|
||||||
{
|
{
|
||||||
<TabStrip>
|
<TabStrip>
|
||||||
@if (_packages.Count > 0)
|
@if (_packages.Count > 0)
|
||||||
{
|
{
|
||||||
<TabPanel Name="Download">
|
<TabPanel Name="Download">
|
||||||
@ -16,7 +16,7 @@
|
|||||||
<Header>
|
<Header>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Version</th>
|
<th>Version</th>
|
||||||
<th></th>
|
<th style="width: 1px;"></th>
|
||||||
</Header>
|
</Header>
|
||||||
<Row>
|
<Row>
|
||||||
<td>@context.Name</td>
|
<td>@context.Name</td>
|
||||||
@ -40,10 +40,10 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
</TabStrip>
|
</TabStrip>
|
||||||
|
|
||||||
<button type="button" class="btn btn-success" @onclick="InstallThemes">Install</button>
|
<button type="button" class="btn btn-success" @onclick="InstallThemes">Install</button>
|
||||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||||
}
|
}
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
@ -77,8 +77,10 @@
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
ShowProgressIndicator();
|
||||||
|
var interop = new Interop(JSRuntime);
|
||||||
|
await interop.RedirectBrowser(NavigateUrl(), 10);
|
||||||
await ThemeService.InstallThemesAsync();
|
await ThemeService.InstallThemesAsync();
|
||||||
NavigationManager.NavigateTo(NavigateUrl());
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -101,4 +103,4 @@
|
|||||||
AddModuleMessage("Error Downloading Theme", MessageType.Error);
|
AddModuleMessage("Error Downloading Theme", MessageType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
@namespace Oqtane.Modules.Admin.Themes
|
@namespace Oqtane.Modules.Admin.Themes
|
||||||
|
@using System.Net
|
||||||
@inherits ModuleBase
|
@inherits ModuleBase
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
@inject IThemeService ThemeService
|
@inject IThemeService ThemeService
|
||||||
@inject IPackageService PackageService
|
@inject IPackageService PackageService
|
||||||
|
|
||||||
@if (themes == null)
|
@if (_themes == null)
|
||||||
{
|
{
|
||||||
<p><em>Loading...</em></p>
|
<p><em>Loading...</em></p>
|
||||||
}
|
}
|
||||||
@ -12,14 +13,16 @@ else
|
|||||||
{
|
{
|
||||||
<ActionLink Action="Add" Text="Install Theme" />
|
<ActionLink Action="Add" Text="Install Theme" />
|
||||||
|
|
||||||
<Pager Items="@themes">
|
<Pager Items="@_themes">
|
||||||
<Header>
|
<Header>
|
||||||
<th> </th>
|
<th style="width: 1px;"> </th>
|
||||||
<th>Name</th>
|
<th style="width: 1px;"> </th>
|
||||||
<th>Version</th>
|
<th scope="col">Name</th>
|
||||||
|
<th scope="col">Version</th>
|
||||||
<th> </th>
|
<th> </th>
|
||||||
</Header>
|
</Header>
|
||||||
<Row>
|
<Row>
|
||||||
|
<td><ActionLink Action="View" Parameters="@($"name=" + WebUtility.UrlEncode(context.ThemeName))" /></td>
|
||||||
<td>
|
<td>
|
||||||
@if (context.AssemblyName != "Oqtane.Client")
|
@if (context.AssemblyName != "Oqtane.Client")
|
||||||
{
|
{
|
||||||
@ -34,46 +37,79 @@ else
|
|||||||
<button type="button" class="btn btn-success" @onclick=@(async () => await DownloadTheme(context.ThemeName, context.Version))>Upgrade</button>
|
<button type="button" class="btn btn-success" @onclick=@(async () => await DownloadTheme(context.ThemeName, context.Version))>Upgrade</button>
|
||||||
}
|
}
|
||||||
</td>
|
</td>
|
||||||
|
<td></td>
|
||||||
</Row>
|
</Row>
|
||||||
</Pager>
|
</Pager>
|
||||||
}
|
}
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
private List<Theme> themes;
|
private List<Theme> _themes;
|
||||||
private List<Package> packages;
|
private List<Package> _packages;
|
||||||
|
|
||||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
|
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
themes = await ThemeService.GetThemesAsync();
|
try
|
||||||
packages = await PackageService.GetPackagesAsync("module");
|
{
|
||||||
|
_themes = await ThemeService.GetThemesAsync();
|
||||||
|
_packages = await PackageService.GetPackagesAsync("theme");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
if (_themes == null)
|
||||||
|
{
|
||||||
|
await logger.LogError(ex, "Error Loading Themes {Error}", ex.Message);
|
||||||
|
AddModuleMessage("Error Loading Themes", MessageType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool UpgradeAvailable(string themename, string version)
|
private bool UpgradeAvailable(string themename, string version)
|
||||||
{
|
{
|
||||||
var upgradeavailable = false;
|
var upgradeavailable = false;
|
||||||
var package = packages.Where(item => item.PackageId == Utilities.GetTypeName(themename)).FirstOrDefault();
|
if (_packages != null)
|
||||||
|
{
|
||||||
|
var package = _packages.Where(item => item.PackageId == Utilities.GetTypeName(themename)).FirstOrDefault();
|
||||||
if (package != null)
|
if (package != null)
|
||||||
{
|
{
|
||||||
upgradeavailable = (Version.Parse(package.Version).CompareTo(Version.Parse(version)) > 0);
|
upgradeavailable = (Version.Parse(package.Version).CompareTo(Version.Parse(version)) > 0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return upgradeavailable;
|
return upgradeavailable;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task DownloadTheme(string themename, string version)
|
private async Task DownloadTheme(string themename, string version)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
await PackageService.DownloadPackageAsync(themename, version, "Themes");
|
await PackageService.DownloadPackageAsync(themename, version, "Themes");
|
||||||
await logger.LogInformation("Theme Downloaded {ThemeName} {Version}", themename, version);
|
await logger.LogInformation("Theme Downloaded {ThemeName} {Version}", themename, version);
|
||||||
|
ShowProgressIndicator();
|
||||||
|
var interop = new Interop(JSRuntime);
|
||||||
|
await interop.RedirectBrowser(NavigateUrl(), 10);
|
||||||
await ThemeService.InstallThemesAsync();
|
await ThemeService.InstallThemesAsync();
|
||||||
NavigationManager.NavigateTo(NavigateUrl());
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
await logger.LogError(ex, "Error Downloading Theme {ThemeName} {Version} {Error}", themename, version, ex.Message);
|
||||||
|
AddModuleMessage("Error Downloading Theme", MessageType.Error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task DeleteTheme(Theme Theme)
|
private async Task DeleteTheme(Theme Theme)
|
||||||
{
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ShowProgressIndicator();
|
||||||
|
var interop = new Interop(JSRuntime);
|
||||||
|
await interop.RedirectBrowser(NavigateUrl(), 10);
|
||||||
await ThemeService.DeleteThemeAsync(Theme.ThemeName);
|
await ThemeService.DeleteThemeAsync(Theme.ThemeName);
|
||||||
await logger.LogInformation("Theme Deleted {Theme}", Theme);
|
}
|
||||||
NavigationManager.NavigateTo(NavigateUrl());
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
await logger.LogError(ex, "Error Deleting Theme {Theme} {Error}", Theme, ex.Message);
|
||||||
|
AddModuleMessage("Error Deleting Theme", MessageType.Error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
101
Oqtane.Client/Modules/Admin/Themes/View.razor
Normal file
101
Oqtane.Client/Modules/Admin/Themes/View.razor
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
@namespace Oqtane.Modules.Admin.Themes
|
||||||
|
@using System.Net
|
||||||
|
@inherits ModuleBase
|
||||||
|
@inject IThemeService ThemeService
|
||||||
|
@inject NavigationManager NavigationManager
|
||||||
|
|
||||||
|
<table class="table table-borderless">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<Label For="name" HelpText="The name of the theme">Name: </Label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input id="name" class="form-control" @bind="@_name" disabled />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<Label For="themename" HelpText="The internal name of the module">Internal Name: </Label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input id="themename" class="form-control" @bind="@_themeName" disabled />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<Label For="version" HelpText="The version of the thene">Version: </Label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input id="version" class="form-control" @bind="@_version" disabled />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<Label For="owner" HelpText="The owner or creator of the theme">Owner: </Label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input id="owner" class="form-control" @bind="@_owner" disabled />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<Label For="url" HelpText="The reference url of the theme">Reference Url: </Label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input id="url" class="form-control" @bind="@_url" disabled />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<Label For="contact" HelpText="The contact for the theme">Contact: </Label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input id="contact" class="form-control" @bind="@_contact" disabled />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<Label For="license" HelpText="The license of the theme">License: </Label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<textarea id="license" class="form-control" @bind="@_license" rows="5" disabled></textarea>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
private string _themeName = "";
|
||||||
|
private string _name;
|
||||||
|
private string _version;
|
||||||
|
private string _owner = "";
|
||||||
|
private string _url = "";
|
||||||
|
private string _contact = "";
|
||||||
|
private string _license = "";
|
||||||
|
|
||||||
|
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_themeName = WebUtility.UrlDecode(PageState.QueryString["name"]);
|
||||||
|
var themes = await ThemeService.GetThemesAsync();
|
||||||
|
var theme = themes.FirstOrDefault(item => item.ThemeName == _themeName);
|
||||||
|
if (theme != null)
|
||||||
|
{
|
||||||
|
_name = theme.Name;
|
||||||
|
_version = theme.Version;
|
||||||
|
_owner = theme.Owner;
|
||||||
|
_url = theme.Url;
|
||||||
|
_contact = theme.Contact;
|
||||||
|
_license = theme.License;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
await logger.LogError(ex, "Error Loading Theme {ThemeName} {Error}", _themeName, ex.Message);
|
||||||
|
AddModuleMessage("Error Loading Theme", MessageType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -7,12 +7,12 @@
|
|||||||
|
|
||||||
@if (_package != null)
|
@if (_package != null)
|
||||||
{
|
{
|
||||||
<TabStrip>
|
<TabStrip>
|
||||||
<TabPanel Name="Download">
|
<TabPanel Name="Download">
|
||||||
@if (_upgradeavailable)
|
@if (_upgradeavailable)
|
||||||
{
|
{
|
||||||
<ModuleMessage Type="MessageType.Info" Message="Select The Upgrade Button To Install a New Framework Version"></ModuleMessage>
|
<ModuleMessage Type="MessageType.Info" Message="Select The Upgrade Button To Install a New Framework Version"></ModuleMessage>
|
||||||
@("Framework") @_package.Version <button type="button" class="btn btn-success" @onclick=@(async () => await Download(Constants.PackageId, Constants.Version))>Upgrade</button>
|
<button type="button" class="btn btn-success" @onclick=@(async () => await Download(Constants.PackageId, @_package.Version))>Upgrade To @_package.Version</button>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -32,7 +32,7 @@
|
|||||||
</table>
|
</table>
|
||||||
<button type="button" class="btn btn-success" @onclick="Upgrade">Install</button>
|
<button type="button" class="btn btn-success" @onclick="Upgrade">Install</button>
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
</TabStrip>
|
</TabStrip>
|
||||||
}
|
}
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
@ -42,8 +42,12 @@
|
|||||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
|
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
List<Package> packages = await PackageService.GetPackagesAsync("framework");
|
List<Package> packages = await PackageService.GetPackagesAsync("framework");
|
||||||
|
if (packages != null)
|
||||||
|
{
|
||||||
_package = packages.FirstOrDefault();
|
_package = packages.FirstOrDefault();
|
||||||
if (_package != null)
|
if (_package != null)
|
||||||
{
|
{
|
||||||
@ -54,17 +58,43 @@
|
|||||||
_package = new Package { Name = Constants.PackageId, Version = Constants.Version };
|
_package = new Package { Name = Constants.PackageId, Version = Constants.Version };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// can be caused by no network connection
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async Task Upgrade()
|
private async Task Upgrade()
|
||||||
{
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ShowProgressIndicator();
|
||||||
|
var interop = new Interop(JSRuntime);
|
||||||
|
await interop.RedirectBrowser(NavigateUrl(), 10);
|
||||||
await InstallationService.Upgrade();
|
await InstallationService.Upgrade();
|
||||||
NavigationManager.NavigateTo(NavigateUrl());
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
await logger.LogError(ex, "Error Executing Upgrade {Error}", ex.Message);
|
||||||
|
AddModuleMessage("Error Executing Upgrade", MessageType.Error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task Download(string packageid, string version)
|
private async Task Download(string packageid, string version)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
await PackageService.DownloadPackageAsync(packageid, version, "Framework");
|
await PackageService.DownloadPackageAsync(packageid, version, "Framework");
|
||||||
|
ShowProgressIndicator();
|
||||||
|
var interop = new Interop(JSRuntime);
|
||||||
|
await interop.RedirectBrowser(NavigateUrl(), 10);
|
||||||
await InstallationService.Upgrade();
|
await InstallationService.Upgrade();
|
||||||
NavigationManager.NavigateTo(NavigateUrl());
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
await logger.LogError(ex, "Error Downloading Framework {Error}", ex.Message);
|
||||||
|
AddModuleMessage("Error Downloading Framework", MessageType.Error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
@namespace Oqtane.Modules.Admin.UserProfile
|
@namespace Oqtane.Modules.Admin.UserProfile
|
||||||
@inherits ModuleBase
|
@inherits ModuleBase
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
@inject IUserRoleService UserRoleService
|
@inject IUserService UserService
|
||||||
@inject INotificationService NotificationService
|
@inject INotificationService NotificationService
|
||||||
|
|
||||||
@if (PageState.User != null)
|
@if (PageState.User != null)
|
||||||
@ -9,19 +9,10 @@
|
|||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<Label For="to" HelpText="Select the user it is going to">To: </Label>
|
<Label For="to" HelpText="Enter the username you wish to send a message to">To: </Label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select id="to" class="form-control" @bind="@userid">
|
<input id="to" class="form-control" @bind="@username" />
|
||||||
<option value="-1"><Select User></option>
|
|
||||||
@if (userroles != null)
|
|
||||||
{
|
|
||||||
foreach (UserRole userrole in userroles)
|
|
||||||
{
|
|
||||||
<option value="@userrole.UserId">@userrole.User.DisplayName</option>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</select>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -46,8 +37,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
private List<UserRole> userroles;
|
private string username = "";
|
||||||
private string userid = "-1";
|
|
||||||
private string subject = "";
|
private string subject = "";
|
||||||
private string body = "";
|
private string body = "";
|
||||||
|
|
||||||
@ -55,42 +45,37 @@
|
|||||||
|
|
||||||
public override string Title => "Send Notification";
|
public override string Title => "Send Notification";
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
userroles = await UserRoleService.GetUserRolesAsync(PageState.Site.SiteId);
|
|
||||||
userroles = userroles.Where(item => item.Role.Name == Constants.RegisteredRole || item.Role.Name == Constants.HostRole)
|
|
||||||
.OrderBy(item => item.User.DisplayName).ToList();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
await logger.LogError(ex, "Error Loading Users {Error}", ex.Message);
|
|
||||||
AddModuleMessage("Error Loading Users", MessageType.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task Send()
|
private async Task Send()
|
||||||
{
|
{
|
||||||
var notification = new Notification();
|
var notification = new Notification();
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
var user = await UserService.GetUserAsync(username, PageState.Site.SiteId);
|
||||||
|
if (user != null)
|
||||||
{
|
{
|
||||||
notification.SiteId = PageState.Site.SiteId;
|
notification.SiteId = PageState.Site.SiteId;
|
||||||
notification.FromUserId = PageState.User.UserId;
|
notification.FromUserId = PageState.User.UserId;
|
||||||
notification.ToUserId = int.Parse(userid);
|
notification.FromDisplayName = PageState.User.DisplayName;
|
||||||
notification.ToEmail = "";
|
notification.FromEmail = PageState.User.Email;
|
||||||
|
notification.ToUserId = user.UserId;
|
||||||
|
notification.ToDisplayName = user.DisplayName;
|
||||||
|
notification.ToEmail = user.Email;
|
||||||
notification.Subject = subject;
|
notification.Subject = subject;
|
||||||
notification.Body = body;
|
notification.Body = body;
|
||||||
notification.ParentId = null;
|
notification.ParentId = null;
|
||||||
notification.CreatedOn = DateTime.UtcNow;
|
notification.CreatedOn = DateTime.UtcNow;
|
||||||
notification.IsDelivered = false;
|
notification.IsDelivered = false;
|
||||||
notification.DeliveredOn = null;
|
notification.DeliveredOn = null;
|
||||||
|
notification.SendOn = DateTime.UtcNow;
|
||||||
notification = await NotificationService.AddNotificationAsync(notification);
|
notification = await NotificationService.AddNotificationAsync(notification);
|
||||||
|
|
||||||
await logger.LogInformation("Notification Created {Notification}", notification);
|
await logger.LogInformation("Notification Created {Notification}", notification);
|
||||||
NavigationManager.NavigateTo(NavigateUrl());
|
NavigationManager.NavigateTo(NavigateUrl());
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AddModuleMessage("User Does Not Exist. Please Verify That The Username Provided Is Correct.", MessageType.Warning);
|
||||||
|
}
|
||||||
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
await logger.LogError(ex, "Error Adding Notification {Notification} {Error}", notification, ex.Message);
|
await logger.LogError(ex, "Error Adding Notification {Notification} {Error}", notification, ex.Message);
|
||||||
|
@ -32,7 +32,7 @@ else
|
|||||||
<label for="Name" class="control-label">Password: </label>
|
<label for="Name" class="control-label">Password: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="password" class="form-control" @bind="@password" />
|
<input type="password" class="form-control" @bind="@password" autocomplete="new-password" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -40,7 +40,7 @@ else
|
|||||||
<label for="Name" class="control-label">Confirm Password: </label>
|
<label for="Name" class="control-label">Confirm Password: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="password" class="form-control" @bind="@confirm" />
|
<input type="password" class="form-control" @bind="@confirm" autocomplete="new-password" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -73,12 +73,14 @@ else
|
|||||||
}
|
}
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
<TabPanel Name="Profile">
|
<TabPanel Name="Profile">
|
||||||
@if (profiles != null)
|
@if (profiles != null && settings != null)
|
||||||
{
|
{
|
||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
@foreach (Profile profile in profiles)
|
@foreach (Profile profile in profiles)
|
||||||
{
|
{
|
||||||
var p = profile;
|
var p = profile;
|
||||||
|
if (!p.IsPrivate || UserSecurity.IsAuthorized(PageState.User, Constants.AdminRole))
|
||||||
|
{
|
||||||
if (p.Category != category)
|
if (p.Category != category)
|
||||||
{
|
{
|
||||||
<tr>
|
<tr>
|
||||||
@ -90,13 +92,21 @@ else
|
|||||||
}
|
}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="@p.Name" class="control-label">@p.Title: </label>
|
<Label For="@p.Name" HelpText="@p.Description">@p.Title</Label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" maxlength="@p.MaxLength" value="@GetProfileValue(p.Name, p.DefaultValue)" placeholder="@p.Description" @onchange="@(e => ProfileChanged(e, p.Name))" />
|
@if (p.IsRequired)
|
||||||
|
{
|
||||||
|
<input id="@p.Name" class="form-control" maxlength="@p.MaxLength" value="@GetProfileValue(p.Name, p.DefaultValue)" required @onchange="@(e => ProfileChanged(e, p.Name))" />
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<input id="@p.Name" class="form-control" maxlength="@p.MaxLength" value="@GetProfileValue(p.Name, p.DefaultValue)" @onchange="@(e => ProfileChanged(e, p.Name))" />
|
||||||
|
}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</table>
|
</table>
|
||||||
<button type="button" class="btn btn-primary" @onclick="Save">Save</button>
|
<button type="button" class="btn btn-primary" @onclick="Save">Save</button>
|
||||||
<button type="button" class="btn btn-secondary" @onclick="Cancel">Cancel</button>
|
<button type="button" class="btn btn-secondary" @onclick="Cancel">Cancel</button>
|
||||||
@ -111,8 +121,8 @@ else
|
|||||||
{
|
{
|
||||||
<Pager Items="@notifications">
|
<Pager Items="@notifications">
|
||||||
<Header>
|
<Header>
|
||||||
<th> </th>
|
<th style="width: 1px;"> </th>
|
||||||
<th> </th>
|
<th style="width: 1px;"> </th>
|
||||||
<th>From</th>
|
<th>From</th>
|
||||||
<th>Subject</th>
|
<th>Subject</th>
|
||||||
<th>Received</th>
|
<th>Received</th>
|
||||||
@ -120,13 +130,22 @@ else
|
|||||||
<Row>
|
<Row>
|
||||||
<td><ActionLink Action="View" Parameters="@($"id=" + context.NotificationId.ToString())" Security="SecurityAccessLevel.View" EditMode="false" /></td>
|
<td><ActionLink Action="View" Parameters="@($"id=" + context.NotificationId.ToString())" Security="SecurityAccessLevel.View" EditMode="false" /></td>
|
||||||
<td><ActionDialog Header="Delete Notification" Message="@("Are You Sure You Wish To Delete This Notification?")" Action="Delete" Security="SecurityAccessLevel.View" Class="btn btn-danger" OnClick="@(async () => await Delete(context))" EditMode="false" /></td>
|
<td><ActionDialog Header="Delete Notification" Message="@("Are You Sure You Wish To Delete This Notification?")" Action="Delete" Security="SecurityAccessLevel.View" Class="btn btn-danger" OnClick="@(async () => await Delete(context))" EditMode="false" /></td>
|
||||||
<td>@(context.FromUser == null ? "System" : context.FromUser.DisplayName)</td>
|
<td>@context.FromDisplayName</td>
|
||||||
<td>@context.Subject</td>
|
<td>@context.Subject</td>
|
||||||
<td>@context.CreatedOn</td>
|
<td>@context.CreatedOn</td>
|
||||||
</Row>
|
</Row>
|
||||||
<Detail>
|
<Detail>
|
||||||
<td colspan="2"></td>
|
<td colspan="2"></td>
|
||||||
<td colspan="3">@(context.Body.Length > 100 ? context.Body.Substring(0, 100) : context.Body)</td>
|
<td colspan="3">
|
||||||
|
@{
|
||||||
|
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)
|
||||||
|
</td>
|
||||||
</Detail>
|
</Detail>
|
||||||
</Pager>
|
</Pager>
|
||||||
}
|
}
|
||||||
@ -143,13 +162,22 @@ else
|
|||||||
<Row>
|
<Row>
|
||||||
<td><ActionLink Action="View" Parameters="@($"id=" + context.NotificationId.ToString())" Security="SecurityAccessLevel.View" EditMode="false" /></td>
|
<td><ActionLink Action="View" Parameters="@($"id=" + context.NotificationId.ToString())" Security="SecurityAccessLevel.View" EditMode="false" /></td>
|
||||||
<td><ActionDialog Header="Delete Notification" Message="@("Are You Sure You Wish To Delete This Notification?")" Action="Delete" Security="SecurityAccessLevel.View" Class="btn btn-danger" OnClick="@(async () => await Delete(context))" EditMode="false" /></td>
|
<td><ActionDialog Header="Delete Notification" Message="@("Are You Sure You Wish To Delete This Notification?")" Action="Delete" Security="SecurityAccessLevel.View" Class="btn btn-danger" OnClick="@(async () => await Delete(context))" EditMode="false" /></td>
|
||||||
<td>@(context.ToUser == null ? context.ToEmail : context.ToUser.DisplayName)</td>
|
<td>@context.ToDisplayName</td>
|
||||||
<td>@context.Subject</td>
|
<td>@context.Subject</td>
|
||||||
<td>@context.CreatedOn</td>
|
<td>@context.CreatedOn</td>
|
||||||
</Row>
|
</Row>
|
||||||
<Detail>
|
<Detail>
|
||||||
<td colspan="2"></td>
|
<td colspan="2"></td>
|
||||||
<td colspan="3">@(context.Body.Length > 100 ? context.Body.Substring(0, 100) : context.Body)</td>
|
<td colspan="3">
|
||||||
|
@{
|
||||||
|
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)
|
||||||
|
</td>
|
||||||
</Detail>
|
</Detail>
|
||||||
</Pager>
|
</Pager>
|
||||||
}
|
}
|
||||||
@ -223,7 +251,7 @@ else
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (username != string.Empty && email != string.Empty)
|
if (username != string.Empty && email != string.Empty && ValidateProfiles())
|
||||||
{
|
{
|
||||||
if (password == confirm)
|
if (password == confirm)
|
||||||
{
|
{
|
||||||
@ -243,6 +271,7 @@ else
|
|||||||
await UserService.UpdateUserAsync(user);
|
await UserService.UpdateUserAsync(user);
|
||||||
await SettingService.UpdateUserSettingsAsync(settings, PageState.User.UserId);
|
await SettingService.UpdateUserSettingsAsync(settings, PageState.User.UserId);
|
||||||
await logger.LogInformation("User Profile Saved");
|
await logger.LogInformation("User Profile Saved");
|
||||||
|
AddModuleMessage("User Profile Updated Successfully", MessageType.Success);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -251,7 +280,7 @@ else
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AddModuleMessage("You Must Provide A Username and Email Address", MessageType.Warning);
|
AddModuleMessage("You Must Provide A Username and Email Address As Well As All Required Profile Information", MessageType.Warning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -261,6 +290,26 @@ else
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool ValidateProfiles()
|
||||||
|
{
|
||||||
|
bool valid = true;
|
||||||
|
foreach (Profile profile in profiles)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(SettingService.GetSetting(settings, profile.Name, string.Empty)) && !string.IsNullOrEmpty(profile.DefaultValue))
|
||||||
|
{
|
||||||
|
settings = SettingService.SetSetting(settings, profile.Name, profile.DefaultValue);
|
||||||
|
}
|
||||||
|
if (!profile.IsPrivate || UserSecurity.IsAuthorized(PageState.User, Constants.AdminRole))
|
||||||
|
{
|
||||||
|
if (profile.IsRequired && string.IsNullOrEmpty(SettingService.GetSetting(settings, profile.Name, string.Empty)))
|
||||||
|
{
|
||||||
|
valid = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return valid;
|
||||||
|
}
|
||||||
|
|
||||||
private void Cancel()
|
private void Cancel()
|
||||||
{
|
{
|
||||||
NavigationManager.NavigateTo(NavigateUrl(string.Empty));
|
NavigationManager.NavigateTo(NavigateUrl(string.Empty));
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
@namespace Oqtane.Modules.Admin.UserProfile
|
@namespace Oqtane.Modules.Admin.UserProfile
|
||||||
@inherits ModuleBase
|
@inherits ModuleBase
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
@inject IUserRoleService UserRoleService
|
@inject IUserService UserService
|
||||||
@inject INotificationService NotificationService
|
@inject INotificationService NotificationService
|
||||||
|
|
||||||
@if (PageState.User != null)
|
@if (PageState.User != null)
|
||||||
@ -11,26 +11,35 @@
|
|||||||
<td>
|
<td>
|
||||||
<label class="control-label">@title: </label>
|
<label class="control-label">@title: </label>
|
||||||
</td>
|
</td>
|
||||||
|
@if (title == "From")
|
||||||
|
{
|
||||||
<td>
|
<td>
|
||||||
<select class="form-control" readonly @bind="userid">
|
<input class="form-control" @bind="@username" readonly />
|
||||||
<option value="-1"><System></option>
|
|
||||||
@if (userroles != null)
|
|
||||||
{
|
|
||||||
foreach (UserRole userrole in userroles)
|
|
||||||
{
|
|
||||||
<option value="@userrole.UserId">@userrole.User.DisplayName</option>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</select>
|
|
||||||
</td>
|
</td>
|
||||||
|
}
|
||||||
|
@if (title == "To")
|
||||||
|
{
|
||||||
|
<td>
|
||||||
|
<input class="form-control" @bind="@username" />
|
||||||
|
</td>
|
||||||
|
}
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label class="control-label">Subject: </label>
|
<label class="control-label">Subject: </label>
|
||||||
</td>
|
</td>
|
||||||
|
@if (title == "From")
|
||||||
|
{
|
||||||
|
<td>
|
||||||
|
<input class="form-control" @bind="@subject" readonly />
|
||||||
|
</td>
|
||||||
|
}
|
||||||
|
@if (title == "To")
|
||||||
|
{
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@subject" />
|
<input class="form-control" @bind="@subject" />
|
||||||
</td>
|
</td>
|
||||||
|
}
|
||||||
</tr>
|
</tr>
|
||||||
@if (title == "From")
|
@if (title == "From")
|
||||||
{
|
{
|
||||||
@ -39,10 +48,23 @@
|
|||||||
<label class="control-label">Date: </label>
|
<label class="control-label">Date: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" @bind="@createdon" />
|
<input class="form-control" @bind="@createdon" readonly />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
|
@if (title == "From")
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label class="control-label">Message: </label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<textarea class="form-control" @bind="@body" rows="5" readonly />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
@if (title == "To")
|
||||||
|
{
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label class="control-label">Message: </label>
|
<label class="control-label">Message: </label>
|
||||||
@ -51,29 +73,35 @@
|
|||||||
<textarea class="form-control" @bind="@body" rows="5" />
|
<textarea class="form-control" @bind="@body" rows="5" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
}
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
@if (reply != string.Empty)
|
@if (reply != string.Empty)
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-primary" @onclick="Send">Send</button>
|
<button type="button" class="btn btn-primary" @onclick="Send">Send</button> }
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (title == "From")
|
if (title == "From")
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-primary" @onclick="Reply">Reply</button>
|
<button type="button" class="btn btn-primary" @onclick="Reply">Reply</button>}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
<p>@reply</p>
|
@if (title == "To")
|
||||||
}
|
{
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label">Original Message </label>
|
||||||
|
<textarea class="form-control" @bind="@reply" rows="5" readonly />
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
private int notificationid;
|
private int notificationid;
|
||||||
private string title = string.Empty;
|
private string title = string.Empty;
|
||||||
private List<UserRole> userroles;
|
private string username = "";
|
||||||
private string userid = "-1";
|
|
||||||
private string subject = string.Empty;
|
private string subject = string.Empty;
|
||||||
private string createdon = string.Empty;
|
private string createdon = string.Empty;
|
||||||
private string body = string.Empty;
|
private string body = string.Empty;
|
||||||
@ -86,20 +114,17 @@
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
userroles = await UserRoleService.GetUserRolesAsync(PageState.Site.SiteId);
|
|
||||||
userroles = userroles.Where(item => item.Role.Name == Constants.RegisteredRole || item.Role.Name == Constants.HostRole)
|
|
||||||
.OrderBy(item => item.User.DisplayName).ToList();
|
|
||||||
|
|
||||||
notificationid = Int32.Parse(PageState.QueryString["id"]);
|
notificationid = Int32.Parse(PageState.QueryString["id"]);
|
||||||
Notification notification = await NotificationService.GetNotificationAsync(notificationid);
|
Notification notification = await NotificationService.GetNotificationAsync(notificationid);
|
||||||
if (notification != null)
|
if (notification != null)
|
||||||
{
|
{
|
||||||
|
int userid = -1;
|
||||||
if (notification.ToUserId == PageState.User.UserId)
|
if (notification.ToUserId == PageState.User.UserId)
|
||||||
{
|
{
|
||||||
title = "From";
|
title = "From";
|
||||||
if (notification.FromUserId != null)
|
if (notification.FromUserId != null)
|
||||||
{
|
{
|
||||||
userid = notification.FromUserId.ToString();
|
userid = notification.FromUserId.Value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -107,10 +132,21 @@
|
|||||||
title = "To";
|
title = "To";
|
||||||
if (notification.ToUserId != null)
|
if (notification.ToUserId != null)
|
||||||
{
|
{
|
||||||
userid = notification.ToUserId.ToString();
|
userid = notification.ToUserId.Value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (userid != -1)
|
||||||
|
{
|
||||||
|
var user = await UserService.GetUserAsync(userid, PageState.Site.SiteId);
|
||||||
|
if (user != null)
|
||||||
|
{
|
||||||
|
username = user.Username;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (username == "")
|
||||||
|
{
|
||||||
|
username = "System";
|
||||||
|
}
|
||||||
subject = notification.Subject;
|
subject = notification.Subject;
|
||||||
createdon = notification.CreatedOn.ToString();
|
createdon = notification.CreatedOn.ToString();
|
||||||
body = notification.Body;
|
body = notification.Body;
|
||||||
@ -126,37 +162,51 @@
|
|||||||
private void Reply()
|
private void Reply()
|
||||||
{
|
{
|
||||||
title = "To";
|
title = "To";
|
||||||
|
if (!subject.Contains("RE:"))
|
||||||
|
{
|
||||||
subject = "RE: " + subject;
|
subject = "RE: " + subject;
|
||||||
|
}
|
||||||
reply = body;
|
reply = body;
|
||||||
|
body = "\n\n____________________________________________\nSent: " + createdon + "\nSubject: " + subject + "\n\n" + body;
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task Send()
|
private async Task Send()
|
||||||
{
|
{
|
||||||
var notification = new Notification();
|
var notification = new Notification();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var user = await UserService.GetUserAsync(username, PageState.Site.SiteId);
|
||||||
|
if (user != null)
|
||||||
|
{
|
||||||
notification.SiteId = PageState.Site.SiteId;
|
notification.SiteId = PageState.Site.SiteId;
|
||||||
notification.FromUserId = PageState.User.UserId;
|
notification.FromUserId = PageState.User.UserId;
|
||||||
notification.ToUserId = int.Parse(userid);
|
notification.FromDisplayName = PageState.User.DisplayName;
|
||||||
notification.ToEmail = string.Empty;
|
notification.FromEmail = PageState.User.Email;
|
||||||
|
notification.ToUserId = user.UserId;
|
||||||
|
notification.ToDisplayName = user.DisplayName;
|
||||||
|
notification.ToEmail = user.Email;
|
||||||
notification.Subject = subject;
|
notification.Subject = subject;
|
||||||
notification.Body = body;
|
notification.Body = body;
|
||||||
notification.ParentId = notificationid;
|
notification.ParentId = notificationid;
|
||||||
notification.CreatedOn = DateTime.UtcNow;
|
notification.CreatedOn = DateTime.UtcNow;
|
||||||
notification.IsDelivered = false;
|
notification.IsDelivered = false;
|
||||||
notification.DeliveredOn = null;
|
notification.DeliveredOn = null;
|
||||||
|
notification.SendOn = DateTime.UtcNow;
|
||||||
try
|
|
||||||
{
|
|
||||||
notification = await NotificationService.AddNotificationAsync(notification);
|
notification = await NotificationService.AddNotificationAsync(notification);
|
||||||
|
|
||||||
await logger.LogInformation("Notification Created {Notification}", notification);
|
await logger.LogInformation("Notification Created {Notification}", notification);
|
||||||
NavigationManager.NavigateTo(NavigateUrl());
|
NavigationManager.NavigateTo(NavigateUrl());
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AddModuleMessage("User Does Not Exist. Please Verify That The Username Provided Is Correct.", MessageType.Warning);
|
||||||
|
}
|
||||||
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
await logger.LogError(ex, "Error Adding Notification {Notification} {Error}", notification, ex.Message);
|
await logger.LogError(ex, "Error Adding Notification {Notification} {Error}", notification, ex.Message);
|
||||||
AddModuleMessage("Error Adding Notification", MessageType.Error);
|
AddModuleMessage("Error Adding Notification", MessageType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,10 +71,17 @@
|
|||||||
}
|
}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="@p.Name" class="control-label">@p.Title: </label>
|
<Label For="@p.Name" HelpText="@p.Description">@p.Title</Label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" maxlength="@p.MaxLength" placeholder="@p.Description" @onchange="@(e => ProfileChanged(e, p.Name))" />
|
@if (p.IsRequired)
|
||||||
|
{
|
||||||
|
<input id="@p.Name" class="form-control" maxlength="@p.MaxLength" value="@GetProfileValue(p.Name, p.DefaultValue)" required @onchange="@(e => ProfileChanged(e, p.Name))" />
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<input id="@p.Name" class="form-control" maxlength="@p.MaxLength" value="@GetProfileValue(p.Name, p.DefaultValue)" @onchange="@(e => ProfileChanged(e, p.Name))" />
|
||||||
|
}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
@ -112,11 +119,14 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string GetProfileValue(string SettingName, string DefaultValue)
|
||||||
|
=> SettingService.GetSetting(settings, SettingName, DefaultValue);
|
||||||
|
|
||||||
private async Task SaveUser()
|
private async Task SaveUser()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (username != string.Empty && password != string.Empty && confirm != string.Empty && email != string.Empty)
|
if (username != string.Empty && password != string.Empty && confirm != string.Empty && email != string.Empty && ValidateProfiles())
|
||||||
{
|
{
|
||||||
if (password == confirm)
|
if (password == confirm)
|
||||||
{
|
{
|
||||||
@ -149,7 +159,7 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AddModuleMessage("You Must Provide A Username, Password, and Email Address", MessageType.Warning);
|
AddModuleMessage("You Must Provide A Username, Password, Email Address And All Required Profile Information", MessageType.Warning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -159,6 +169,23 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool ValidateProfiles()
|
||||||
|
{
|
||||||
|
bool valid = true;
|
||||||
|
foreach (Profile profile in profiles)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(SettingService.GetSetting(settings, profile.Name, string.Empty)) && !string.IsNullOrEmpty(profile.DefaultValue))
|
||||||
|
{
|
||||||
|
settings = SettingService.SetSetting(settings, profile.Name, profile.DefaultValue);
|
||||||
|
}
|
||||||
|
if (profile.IsRequired && string.IsNullOrEmpty(SettingService.GetSetting(settings, profile.Name, string.Empty)))
|
||||||
|
{
|
||||||
|
valid = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return valid;
|
||||||
|
}
|
||||||
|
|
||||||
private void ProfileChanged(ChangeEventArgs e, string SettingName)
|
private void ProfileChanged(ChangeEventArgs e, string SettingName)
|
||||||
{
|
{
|
||||||
var value = (string)e.Value;
|
var value = (string)e.Value;
|
||||||
|
@ -98,10 +98,17 @@ else
|
|||||||
}
|
}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="@p.Name" class="control-label">@p.Title: </label>
|
<Label For="@p.Name" HelpText="@p.Description">@p.Title</Label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input class="form-control" maxlength="@p.MaxLength" value="@GetProfileValue(p.Name, p.DefaultValue)" placeholder="@p.Description" @onchange="@(e => ProfileChanged(e, p.Name))" />
|
@if (p.IsRequired)
|
||||||
|
{
|
||||||
|
<input id="@p.Name" class="form-control" maxlength="@p.MaxLength" value="@GetProfileValue(p.Name, p.DefaultValue)" required @onchange="@(e => ProfileChanged(e, p.Name))" />
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<input id="@p.Name" class="form-control" maxlength="@p.MaxLength" value="@GetProfileValue(p.Name, p.DefaultValue)" @onchange="@(e => ProfileChanged(e, p.Name))" />
|
||||||
|
}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
@ -180,7 +187,7 @@ else
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (username != string.Empty && email != string.Empty)
|
if (username != string.Empty && email != string.Empty && ValidateProfiles())
|
||||||
{
|
{
|
||||||
if (password == confirm)
|
if (password == confirm)
|
||||||
{
|
{
|
||||||
@ -213,7 +220,7 @@ else
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AddModuleMessage("You Must Provide A Username, Password, and Email Address", MessageType.Warning);
|
AddModuleMessage("You Must Provide A Username, Password, Email Address, And All Required Profile Information", MessageType.Warning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -223,6 +230,23 @@ else
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool ValidateProfiles()
|
||||||
|
{
|
||||||
|
bool valid = true;
|
||||||
|
foreach (Profile profile in profiles)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(SettingService.GetSetting(settings, profile.Name, string.Empty)) && !string.IsNullOrEmpty(profile.DefaultValue))
|
||||||
|
{
|
||||||
|
settings = SettingService.SetSetting(settings, profile.Name, profile.DefaultValue);
|
||||||
|
}
|
||||||
|
if (profile.IsRequired && string.IsNullOrEmpty(SettingService.GetSetting(settings, profile.Name, string.Empty)))
|
||||||
|
{
|
||||||
|
valid = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return valid;
|
||||||
|
}
|
||||||
|
|
||||||
private void ProfileChanged(ChangeEventArgs e, string SettingName)
|
private void ProfileChanged(ChangeEventArgs e, string SettingName)
|
||||||
{
|
{
|
||||||
var value = (string)e.Value;
|
var value = (string)e.Value;
|
||||||
|
@ -2,40 +2,79 @@
|
|||||||
@inherits ModuleBase
|
@inherits ModuleBase
|
||||||
@inject IUserRoleService UserRoleService
|
@inject IUserRoleService UserRoleService
|
||||||
@inject IUserService UserService
|
@inject IUserService UserService
|
||||||
|
@inject ISettingService SettingService
|
||||||
|
|
||||||
@if (userroles == null)
|
@if (userroles == null)
|
||||||
{
|
{
|
||||||
<p><em>Loading...</em></p>
|
<p>
|
||||||
|
<em>Loading...</em>
|
||||||
|
</p>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<ActionLink Action="Add" Text="Add User" />
|
<ActionLink Action="Add" Text="Add User"/>
|
||||||
|
|
||||||
|
<div class="d-flex p-1">
|
||||||
|
<input class="form-control mr-4" @bind="@_search"/><button class="btn btn-outline-primary ml-1" @onclick="OnSearch">Search</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<Pager Items="@userroles">
|
<Pager Items="@userroles">
|
||||||
<Header>
|
<Header>
|
||||||
<th> </th>
|
<th style="width: 1px;"> </th>
|
||||||
<th> </th>
|
<th style="width: 1px;"> </th>
|
||||||
<th> </th>
|
<th style="width: 1px;"> </th>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
</Header>
|
</Header>
|
||||||
<Row>
|
<Row>
|
||||||
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.UserId.ToString())" /></td>
|
<td>
|
||||||
<td><ActionDialog Header="Delete User" Message="@("Are You Sure You Wish To Delete " + context.User.DisplayName + "?")" Action="Delete" Security="SecurityAccessLevel.Admin" Class="btn btn-danger" OnClick="@(async () => await DeleteUser(context))" /></td>
|
<ActionLink Action="Edit" Parameters="@($"id=" + context.UserId.ToString())"/>
|
||||||
<td><ActionLink Action="Roles" Parameters="@($"id=" + context.UserId.ToString())" /></td>
|
</td>
|
||||||
|
<td>
|
||||||
|
<ActionDialog Header="Delete User" Message="@("Are You Sure You Wish To Delete " + context.User.DisplayName + "?")" Action="Delete" Security="SecurityAccessLevel.Admin" Class="btn btn-danger" OnClick="@(async () => await DeleteUser(context))"/>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<ActionLink Action="Roles" Parameters="@($"id=" + context.UserId.ToString())"/>
|
||||||
|
</td>
|
||||||
<td>@context.User.DisplayName</td>
|
<td>@context.User.DisplayName</td>
|
||||||
</Row>
|
</Row>
|
||||||
</Pager>
|
</Pager>
|
||||||
}
|
}
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
private List<UserRole> allroles;
|
||||||
private List<UserRole> userroles;
|
private List<UserRole> userroles;
|
||||||
|
private string _search;
|
||||||
|
|
||||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Admin;
|
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Admin;
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
userroles = await UserRoleService.GetUserRolesAsync(PageState.Site.SiteId);
|
allroles = await UserRoleService.GetUserRolesAsync(PageState.Site.SiteId);
|
||||||
userroles = userroles.Where(item => item.Role.Name == Constants.RegisteredRole).ToList();
|
await LoadSettingsAsync();
|
||||||
|
userroles = Search(_search);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<UserRole> Search(string search)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(_search))
|
||||||
|
{
|
||||||
|
return allroles.Where(item => item.Role.Name == Constants.RegisteredRole).ToList();
|
||||||
|
}
|
||||||
|
return allroles
|
||||||
|
.Where(item => item.Role.Name == Constants.RegisteredRole &&
|
||||||
|
(
|
||||||
|
item.User.Username.Contains(search, StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
item.User.Email.Contains(search, StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
item.User.DisplayName.Contains(search, StringComparison.OrdinalIgnoreCase)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task OnSearch()
|
||||||
|
{
|
||||||
|
userroles = Search(_search);
|
||||||
|
await UpdateSettingsAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task DeleteUser(UserRole UserRole)
|
private async Task DeleteUser(UserRole UserRole)
|
||||||
@ -56,4 +95,20 @@ else
|
|||||||
AddModuleMessage(ex.Message, MessageType.Error);
|
AddModuleMessage(ex.Message, MessageType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string settingSearch = "AU-search";
|
||||||
|
|
||||||
|
private async Task LoadSettingsAsync()
|
||||||
|
{
|
||||||
|
Dictionary<string, string> settings = await SettingService.GetUserSettingsAsync(PageState.User.UserId);
|
||||||
|
_search = SettingService.GetSetting(settings, settingSearch, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task UpdateSettingsAsync()
|
||||||
|
{
|
||||||
|
Dictionary<string, string> settings = await SettingService.GetUserSettingsAsync(PageState.User.UserId);
|
||||||
|
SettingService.SetSetting(settings, settingSearch, _search);
|
||||||
|
await SettingService.UpdateUserSettingsAsync(settings, PageState.User.UserId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,9 +1,9 @@
|
|||||||
@namespace Oqtane.Modules.Controls
|
@namespace Oqtane.Modules.Controls
|
||||||
@inherits ModuleBase
|
@inherits ModuleControlBase
|
||||||
@attribute [OqtaneIgnore]
|
|
||||||
@if (_visible)
|
@if (_visible)
|
||||||
{
|
{
|
||||||
<div class="app-admin-modal">
|
<div class="app-actiondialog">
|
||||||
<div class="modal" tabindex="-1" role="dialog">
|
<div class="modal" tabindex="-1" role="dialog">
|
||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
@code {
|
@code {
|
||||||
private bool _visible = false;
|
private bool _visible = false;
|
||||||
private bool _editmode = true;
|
private bool _editmode = false;
|
||||||
private bool _authorized = false;
|
private bool _authorized = false;
|
||||||
private string _iconSpan = string.Empty;
|
private string _iconSpan = string.Empty;
|
||||||
|
|
||||||
@ -66,7 +66,7 @@
|
|||||||
public bool Disabled { get; set; } // optional
|
public bool Disabled { get; set; } // optional
|
||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public string EditMode { get; set; } // optional - specifies if a user must be in edit mode to see the action - default is true
|
public string EditMode { get; set; } // optional - specifies if an authorized user must be in edit mode to see the action - default is false
|
||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public Action OnClick { get; set; } // required if an Action is specified - executes a method in the calling component
|
public Action OnClick { get; set; } // required if an Action is specified - executes a method in the calling component
|
||||||
@ -84,6 +84,7 @@
|
|||||||
{
|
{
|
||||||
Class = "btn btn-success";
|
Class = "btn btn-success";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(EditMode))
|
if (!string.IsNullOrEmpty(EditMode))
|
||||||
{
|
{
|
||||||
_editmode = bool.Parse(EditMode);
|
_editmode = bool.Parse(EditMode);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
@namespace Oqtane.Modules.Controls
|
@namespace Oqtane.Modules.Controls
|
||||||
@inherits ModuleBase
|
@inherits ModuleControlBase
|
||||||
@attribute [OqtaneIgnore]
|
|
||||||
@inject IUserService UserService
|
@inject IUserService UserService
|
||||||
|
|
||||||
@if (_authorized)
|
@if (_authorized)
|
||||||
@ -21,7 +20,7 @@
|
|||||||
private string _parameters = string.Empty;
|
private string _parameters = string.Empty;
|
||||||
private string _classname = "btn btn-primary";
|
private string _classname = "btn btn-primary";
|
||||||
private string _style = string.Empty;
|
private string _style = string.Empty;
|
||||||
private bool _editmode = true;
|
private bool _editmode = false;
|
||||||
private bool _authorized = false;
|
private bool _authorized = false;
|
||||||
private string _iconSpan = string.Empty;
|
private string _iconSpan = string.Empty;
|
||||||
|
|
||||||
@ -47,11 +46,14 @@
|
|||||||
public bool Disabled { get; set; } // optional
|
public bool Disabled { get; set; } // optional
|
||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public string EditMode { get; set; } // optional - specifies if a user must be in edit mode to see the action - default is true
|
public string EditMode { get; set; } // optional - specifies if an authorized user must be in edit mode to see the action - default is false.
|
||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public string IconName { get; set; } // optional - specifies an icon for the link - default is no icon
|
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
|
||||||
|
|
||||||
protected override void OnParametersSet()
|
protected override void OnParametersSet()
|
||||||
{
|
{
|
||||||
_text = Action;
|
_text = Action;
|
||||||
@ -60,6 +62,11 @@
|
|||||||
_text = Text;
|
_text = Text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IconOnly && !string.IsNullOrEmpty(IconName))
|
||||||
|
{
|
||||||
|
_text = string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(Parameters))
|
if (!string.IsNullOrEmpty(Parameters))
|
||||||
{
|
{
|
||||||
_parameters = Parameters;
|
_parameters = Parameters;
|
||||||
@ -82,7 +89,8 @@
|
|||||||
|
|
||||||
if (!string.IsNullOrEmpty(IconName))
|
if (!string.IsNullOrEmpty(IconName))
|
||||||
{
|
{
|
||||||
_iconSpan = $"<span class=\"oi oi-{IconName}\"></span> ";
|
_iconSpan = $"<span class=\"oi oi-{IconName}\"></span>{(IconOnly ? "" : " ")}";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_url = EditUrl(Action, _parameters);
|
_url = EditUrl(Action, _parameters);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
@namespace Oqtane.Modules.Controls
|
@namespace Oqtane.Modules.Controls
|
||||||
@inherits ModuleBase
|
@inherits ModuleControlBase
|
||||||
@attribute [OqtaneIgnore]
|
|
||||||
|
|
||||||
@if (_text != string.Empty)
|
@if (_text != string.Empty)
|
||||||
{
|
{
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
@namespace Oqtane.Modules.Controls
|
@namespace Oqtane.Modules.Controls
|
||||||
@inherits ModuleBase
|
@inherits ModuleControlBase
|
||||||
|
|
||||||
@attribute [OqtaneIgnore]
|
|
||||||
@inject IFolderService FolderService
|
@inject IFolderService FolderService
|
||||||
@inject IFileService FileService
|
@inject IFileService FileService
|
||||||
@inject IJSRuntime JsRuntime
|
|
||||||
|
|
||||||
@if (_folders != null)
|
@if (_folders != null)
|
||||||
{
|
{
|
||||||
@ -57,16 +54,16 @@
|
|||||||
<div>
|
<div>
|
||||||
@if (UploadMultiple)
|
@if (UploadMultiple)
|
||||||
{
|
{
|
||||||
<input type="file" id="@_fileinputid" name="file" accept="@_filter" multiple/>
|
<input type="file" id="@_fileinputid" name="file" accept="@_filter" multiple />
|
||||||
}
|
}
|
||||||
else
|
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 id="@_progressinfoid"></span><progress id="@_progressbarid" style="width: 150px; visibility: hidden;"></progress>
|
||||||
<span class="float-right">
|
<span class="float-right">
|
||||||
<button type="button" class="btn btn-success" @onclick="UploadFile">Upload</button>
|
<button type="button" class="btn btn-success" @onclick="UploadFile">Upload</button>
|
||||||
@if (_showfiles && GetFileId() != -1)
|
@if (ShowFiles && GetFileId() != -1)
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-danger" @onclick="DeleteFile">Delete</button>
|
<button type="button" class="btn btn-danger" @onclick="DeleteFile">Delete</button>
|
||||||
}
|
}
|
||||||
@ -89,7 +86,6 @@
|
|||||||
private string _id;
|
private string _id;
|
||||||
private List<Folder> _folders;
|
private List<Folder> _folders;
|
||||||
private List<File> _files = new List<File>();
|
private List<File> _files = new List<File>();
|
||||||
private bool _showfiles = true;
|
|
||||||
private string _fileinputid = string.Empty;
|
private string _fileinputid = string.Empty;
|
||||||
private string _progressinfoid = string.Empty;
|
private string _progressinfoid = string.Empty;
|
||||||
private string _progressbarid = string.Empty;
|
private string _progressbarid = string.Empty;
|
||||||
@ -135,7 +131,7 @@
|
|||||||
|
|
||||||
if (!string.IsNullOrEmpty(Folder))
|
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;
|
FolderId = -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -212,7 +208,7 @@
|
|||||||
_message = string.Empty;
|
_message = string.Empty;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
FolderId = int.Parse((string) e.Value);
|
FolderId = int.Parse((string)e.Value);
|
||||||
await GetFiles();
|
await GetFiles();
|
||||||
FileId = -1;
|
FileId = -1;
|
||||||
_image = string.Empty;
|
_image = string.Empty;
|
||||||
@ -228,7 +224,7 @@
|
|||||||
private async Task FileChanged(ChangeEventArgs e)
|
private async Task FileChanged(ChangeEventArgs e)
|
||||||
{
|
{
|
||||||
_message = string.Empty;
|
_message = string.Empty;
|
||||||
FileId = int.Parse((string) e.Value);
|
FileId = int.Parse((string)e.Value);
|
||||||
|
|
||||||
await SetImage();
|
await SetImage();
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
@ -245,8 +241,8 @@
|
|||||||
var maxwidth = 200;
|
var maxwidth = 200;
|
||||||
var maxheight = 200;
|
var maxheight = 200;
|
||||||
|
|
||||||
var ratioX = (double) maxwidth / (double) file.ImageWidth;
|
var ratioX = (double)maxwidth / (double)file.ImageWidth;
|
||||||
var ratioY = (double) maxheight / (double) file.ImageHeight;
|
var ratioY = (double)maxheight / (double)file.ImageHeight;
|
||||||
var ratio = ratioX < ratioY ? ratioX : ratioY;
|
var ratio = ratioX < ratioY ? ratioX : ratioY;
|
||||||
|
|
||||||
_image = "<img src=\"" + ContentUrl(FileId) + "\" alt=\"" + file.Name +
|
_image = "<img src=\"" + ContentUrl(FileId) + "\" alt=\"" + file.Name +
|
||||||
@ -258,7 +254,7 @@
|
|||||||
|
|
||||||
private async Task UploadFile()
|
private async Task UploadFile()
|
||||||
{
|
{
|
||||||
var interop = new Interop(JsRuntime);
|
var interop = new Interop(JSRuntime);
|
||||||
var upload = await interop.GetFiles(_fileinputid);
|
var upload = await interop.GetFiles(_fileinputid);
|
||||||
if (upload.Length > 0)
|
if (upload.Length > 0)
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
@namespace Oqtane.Modules.Controls
|
@namespace Oqtane.Modules.Controls
|
||||||
@inherits ModuleBase
|
@inherits ModuleControlBase
|
||||||
@attribute [OqtaneIgnore]
|
|
||||||
|
|
||||||
@if (!string.IsNullOrEmpty(HelpText))
|
@if (!string.IsNullOrEmpty(HelpText))
|
||||||
{
|
{
|
||||||
|
@ -1,10 +1,16 @@
|
|||||||
@namespace Oqtane.Modules.Controls
|
@namespace Oqtane.Modules.Controls
|
||||||
@inherits ModuleBase
|
@inherits ModuleControlBase
|
||||||
@attribute [OqtaneIgnore]
|
@inject NavigationManager NavigationManager
|
||||||
|
|
||||||
@if (!string.IsNullOrEmpty(_message))
|
@if (!string.IsNullOrEmpty(_message))
|
||||||
{
|
{
|
||||||
<div class="@_classname" role="alert">@_message</div>
|
<div class="@_classname" role="alert">
|
||||||
|
@_message
|
||||||
|
@if (Type == MessageType.Error && UserSecurity.IsAuthorized(PageState.User, Constants.HostRole))
|
||||||
|
{
|
||||||
|
@((MarkupString)" ")<NavLink href="@NavigateUrl("admin/log")">View Details</NavLink>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
<br />
|
<br />
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
@namespace Oqtane.Modules.Controls
|
@namespace Oqtane.Modules.Controls
|
||||||
@inherits ModuleBase
|
@inherits ModuleControlBase
|
||||||
@attribute [OqtaneIgnore]
|
|
||||||
@typeparam TableItem
|
@typeparam TableItem
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@if(Format == "Table")
|
@if (Format == "Table")
|
||||||
{
|
{
|
||||||
<table class="@Class">
|
<table class="@Class">
|
||||||
<thead>
|
<thead>
|
||||||
@ -23,7 +21,7 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
}
|
}
|
||||||
@if(Format == "Grid")
|
@if (Format == "Grid")
|
||||||
{
|
{
|
||||||
<div class="@Class">
|
<div class="@Class">
|
||||||
<div class="row">@Header</div>
|
<div class="row">@Header</div>
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
@namespace Oqtane.Modules.Controls
|
@namespace Oqtane.Modules.Controls
|
||||||
@inherits ModuleBase
|
@inherits ModuleControlBase
|
||||||
@attribute [OqtaneIgnore]
|
|
||||||
@inject IRoleService RoleService
|
@inject IRoleService RoleService
|
||||||
@inject IUserService UserService
|
@inject IUserService UserService
|
||||||
|
|
||||||
@ -10,10 +9,10 @@
|
|||||||
<table class="table" style="width: 50%; min-width: 250px;">
|
<table class="table" style="width: 50%; min-width: 250px;">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Role</th>
|
<th scope="col">Role</th>
|
||||||
@foreach (PermissionString permission in _permissions)
|
@foreach (PermissionString permission in _permissions)
|
||||||
{
|
{
|
||||||
<th style="text-align: center;">@permission.PermissionName</th>
|
<th style="text-align: center; width: 1px;">@permission.PermissionName</th>
|
||||||
}
|
}
|
||||||
</tr>
|
</tr>
|
||||||
@foreach (Role role in _roles)
|
@foreach (Role role in _roles)
|
||||||
@ -36,10 +35,10 @@
|
|||||||
<table class="table" style="width: 50%; min-width: 250px;">
|
<table class="table" style="width: 50%; min-width: 250px;">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>User</th>
|
<th scope="col">User</th>
|
||||||
@foreach (PermissionString permission in _permissions)
|
@foreach (PermissionString permission in _permissions)
|
||||||
{
|
{
|
||||||
<th style="text-align: center;">@permission.PermissionName</th>
|
<th style="text-align: center; width: 1px;">@permission.PermissionName</th>
|
||||||
}
|
}
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@ -52,7 +51,7 @@
|
|||||||
@foreach (PermissionString permission in _permissions)
|
@foreach (PermissionString permission in _permissions)
|
||||||
{
|
{
|
||||||
var p = permission;
|
var p = permission;
|
||||||
<td style="text-align: center;">
|
<td style="text-align: center; width: 1px;">
|
||||||
<TriStateCheckBox Value=@GetPermissionValue(p.Permissions, userid) Disabled=false OnChange="@(e => PermissionChanged(e, p.PermissionName, userid))" />
|
<TriStateCheckBox Value=@GetPermissionValue(p.Permissions, userid) Disabled=false OnChange="@(e => PermissionChanged(e, p.PermissionName, userid))" />
|
||||||
</td>
|
</td>
|
||||||
}
|
}
|
||||||
@ -64,9 +63,10 @@
|
|||||||
<table class="table" style="width: 50%; min-width: 250px;">
|
<table class="table" style="width: 50%; min-width: 250px;">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="text-align: right;"><label for="Username" class="control-label">User: </label></td>
|
<td class="input-group">
|
||||||
<td><input type="text" name="Username" class="form-control" placeholder="Enter Username" @bind="@_username" /></td>
|
<input type="text" name="Username" class="form-control" placeholder="Enter Username" @bind="@_username" />
|
||||||
<td style="text-align: left;"><button type="button" class="btn btn-primary" @onclick="AddUser">Add</button></td>
|
<button type="button" class="btn btn-primary" @onclick="AddUser">Add</button>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
@namespace Oqtane.Modules.Controls
|
@namespace Oqtane.Modules.Controls
|
||||||
@inherits ModuleBase
|
@inherits ModuleControlBase
|
||||||
@attribute [OqtaneIgnore]
|
|
||||||
@inject IJSRuntime JsRuntime
|
|
||||||
|
|
||||||
<div class="row" style="margin-bottom: 50px;">
|
<div class="row" style="margin-bottom: 50px;">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
@ -108,6 +106,13 @@
|
|||||||
[Parameter]
|
[Parameter]
|
||||||
public string DebugLevel { get; set; } = "info";
|
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()
|
protected override void OnInitialized()
|
||||||
{
|
{
|
||||||
_content = Content; // raw HTML
|
_content = Content; // raw HTML
|
||||||
@ -117,8 +122,11 @@
|
|||||||
{
|
{
|
||||||
if (firstRender)
|
if (firstRender)
|
||||||
{
|
{
|
||||||
await RichTextEditorInterop.CreateEditor(
|
await base.OnAfterRenderAsync(firstRender);
|
||||||
JsRuntime,
|
|
||||||
|
var interop = new RichTextEditorInterop(JSRuntime);
|
||||||
|
|
||||||
|
await interop.CreateEditor(
|
||||||
_editorElement,
|
_editorElement,
|
||||||
_toolBar,
|
_toolBar,
|
||||||
ReadOnly,
|
ReadOnly,
|
||||||
@ -126,14 +134,10 @@
|
|||||||
Theme,
|
Theme,
|
||||||
DebugLevel);
|
DebugLevel);
|
||||||
|
|
||||||
await RichTextEditorInterop.LoadEditorContent(
|
await interop.LoadEditorContent(_editorElement, Content);
|
||||||
JsRuntime,
|
|
||||||
_editorElement, Content);
|
|
||||||
|
|
||||||
// preserve a copy of the rich text content ( Quill sanitizes content so we need to retrieve it from the editor )
|
// preserve a copy of the rich text content ( Quill sanitizes content so we need to retrieve it from the editor )
|
||||||
_original = await RichTextEditorInterop.GetHtml(
|
_original = await interop.GetHtml(_editorElement);
|
||||||
JsRuntime,
|
|
||||||
_editorElement);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,25 +150,22 @@
|
|||||||
|
|
||||||
public async Task RefreshRichText()
|
public async Task RefreshRichText()
|
||||||
{
|
{
|
||||||
await RichTextEditorInterop.LoadEditorContent(
|
var interop = new RichTextEditorInterop(JSRuntime);
|
||||||
JsRuntime,
|
await interop.LoadEditorContent(_editorElement, _content);
|
||||||
_editorElement, _content);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task RefreshRawHtml()
|
public async Task RefreshRawHtml()
|
||||||
{
|
{
|
||||||
_content = await RichTextEditorInterop.GetHtml(
|
var interop = new RichTextEditorInterop(JSRuntime);
|
||||||
JsRuntime,
|
_content = await interop.GetHtml(_editorElement);
|
||||||
_editorElement);
|
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<string> GetHtml()
|
public async Task<string> GetHtml()
|
||||||
{
|
{
|
||||||
// get rich text content
|
// get rich text content
|
||||||
string content = await RichTextEditorInterop.GetHtml(
|
var interop = new RichTextEditorInterop(JSRuntime);
|
||||||
JsRuntime,
|
string content = await interop.GetHtml(_editorElement);
|
||||||
_editorElement);
|
|
||||||
|
|
||||||
if (_original != content)
|
if (_original != content)
|
||||||
{
|
{
|
||||||
@ -185,9 +186,8 @@
|
|||||||
var fileid = _fileManager.GetFileId();
|
var fileid = _fileManager.GetFileId();
|
||||||
if (fileid != -1)
|
if (fileid != -1)
|
||||||
{
|
{
|
||||||
await RichTextEditorInterop.InsertImage(
|
var interop = new RichTextEditorInterop(JSRuntime);
|
||||||
JsRuntime,
|
await interop.InsertImage(_editorElement, ContentUrl(fileid));
|
||||||
_editorElement, ContentUrl(fileid));
|
|
||||||
_filemanagervisible = false;
|
_filemanagervisible = false;
|
||||||
_message = string.Empty;
|
_message = string.Empty;
|
||||||
}
|
}
|
||||||
@ -207,22 +207,19 @@
|
|||||||
// other rich text editor methods which can be used by developers
|
// other rich text editor methods which can be used by developers
|
||||||
public async Task<string> GetText()
|
public async Task<string> GetText()
|
||||||
{
|
{
|
||||||
return await RichTextEditorInterop.GetText(
|
var interop = new RichTextEditorInterop(JSRuntime);
|
||||||
JsRuntime,
|
return await interop.GetText(_editorElement);
|
||||||
_editorElement);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<string> GetContent()
|
public async Task<string> GetContent()
|
||||||
{
|
{
|
||||||
return await RichTextEditorInterop.GetContent(
|
var interop = new RichTextEditorInterop(JSRuntime);
|
||||||
JsRuntime,
|
return await interop.GetContent(_editorElement);
|
||||||
_editorElement);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task EnableEditor(bool mode)
|
public async Task EnableEditor(bool mode)
|
||||||
{
|
{
|
||||||
await RichTextEditorInterop.EnableEditor(
|
var interop = new RichTextEditorInterop(JSRuntime);
|
||||||
JsRuntime,
|
await interop.EnableEditor(_editorElement, mode);
|
||||||
_editorElement, mode);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,10 +4,16 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace Oqtane.Modules.Controls
|
namespace Oqtane.Modules.Controls
|
||||||
{
|
{
|
||||||
public static class RichTextEditorInterop
|
public class RichTextEditorInterop
|
||||||
{
|
{
|
||||||
internal static ValueTask<object> CreateEditor(
|
private readonly IJSRuntime _jsRuntime;
|
||||||
IJSRuntime jsRuntime,
|
|
||||||
|
public RichTextEditorInterop(IJSRuntime jsRuntime)
|
||||||
|
{
|
||||||
|
_jsRuntime = jsRuntime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task CreateEditor(
|
||||||
ElementReference quillElement,
|
ElementReference quillElement,
|
||||||
ElementReference toolbar,
|
ElementReference toolbar,
|
||||||
bool readOnly,
|
bool readOnly,
|
||||||
@ -15,66 +21,103 @@ namespace Oqtane.Modules.Controls
|
|||||||
string theme,
|
string theme,
|
||||||
string debugLevel)
|
string debugLevel)
|
||||||
{
|
{
|
||||||
return jsRuntime.InvokeAsync<object>(
|
try
|
||||||
"interop.createQuill",
|
{
|
||||||
quillElement, toolbar, readOnly,
|
await _jsRuntime.InvokeAsync<object>(
|
||||||
placeholder, theme, debugLevel);
|
"Oqtane.RichTextEditor.createQuill",
|
||||||
|
quillElement, toolbar, readOnly, placeholder, theme, debugLevel);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// handle exception
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static ValueTask<string> GetText(
|
public ValueTask<string> GetText(ElementReference quillElement)
|
||||||
IJSRuntime jsRuntime,
|
|
||||||
ElementReference quillElement)
|
|
||||||
{
|
{
|
||||||
return jsRuntime.InvokeAsync<string>(
|
try
|
||||||
"interop.getQuillText",
|
{
|
||||||
|
return _jsRuntime.InvokeAsync<string>(
|
||||||
|
"Oqtane.RichTextEditor.getQuillText",
|
||||||
quillElement);
|
quillElement);
|
||||||
}
|
}
|
||||||
|
catch
|
||||||
internal static ValueTask<string> GetHtml(
|
|
||||||
IJSRuntime jsRuntime,
|
|
||||||
ElementReference quillElement)
|
|
||||||
{
|
{
|
||||||
return jsRuntime.InvokeAsync<string>(
|
return new ValueTask<string>(Task.FromResult(string.Empty));
|
||||||
"interop.getQuillHTML",
|
}
|
||||||
quillElement);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static ValueTask<string> GetContent(
|
public ValueTask<string> GetHtml(ElementReference quillElement)
|
||||||
IJSRuntime jsRuntime,
|
|
||||||
ElementReference quillElement)
|
|
||||||
{
|
{
|
||||||
return jsRuntime.InvokeAsync<string>(
|
try
|
||||||
"interop.getQuillContent",
|
{
|
||||||
|
return _jsRuntime.InvokeAsync<string>(
|
||||||
|
"Oqtane.RichTextEditor.getQuillHTML",
|
||||||
quillElement);
|
quillElement);
|
||||||
}
|
}
|
||||||
|
catch
|
||||||
internal static ValueTask<object> LoadEditorContent(
|
|
||||||
IJSRuntime jsRuntime,
|
|
||||||
ElementReference quillElement,
|
|
||||||
string content)
|
|
||||||
{
|
{
|
||||||
return jsRuntime.InvokeAsync<object>(
|
return new ValueTask<string>(Task.FromResult(string.Empty));
|
||||||
"interop.loadQuillContent",
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ValueTask<string> GetContent(ElementReference quillElement)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return _jsRuntime.InvokeAsync<string>(
|
||||||
|
"Oqtane.RichTextEditor.getQuillContent",
|
||||||
|
quillElement);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return new ValueTask<string>(Task.FromResult(string.Empty));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task LoadEditorContent(ElementReference quillElement, string content)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_jsRuntime.InvokeAsync<object>(
|
||||||
|
"Oqtane.RichTextEditor.loadQuillContent",
|
||||||
quillElement, content);
|
quillElement, content);
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static ValueTask<object> EnableEditor(
|
public Task EnableEditor(ElementReference quillElement, bool mode)
|
||||||
IJSRuntime jsRuntime,
|
|
||||||
ElementReference quillElement,
|
|
||||||
bool mode)
|
|
||||||
{
|
{
|
||||||
return jsRuntime.InvokeAsync<object>(
|
try
|
||||||
"interop.enableQuillEditor", quillElement, mode);
|
{
|
||||||
|
_jsRuntime.InvokeAsync<object>(
|
||||||
|
"Oqtane.RichTextEditor.enableQuillEditor", quillElement, mode);
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static ValueTask<object> InsertImage(
|
public Task InsertImage(ElementReference quillElement, string imageUrl)
|
||||||
IJSRuntime jsRuntime,
|
|
||||||
ElementReference quillElement,
|
|
||||||
string imageUrl)
|
|
||||||
{
|
{
|
||||||
return jsRuntime.InvokeAsync<object>(
|
try
|
||||||
"interop.insertQuillImage",
|
{
|
||||||
|
_jsRuntime.InvokeAsync<object>(
|
||||||
|
"Oqtane.RichTextEditor.insertQuillImage",
|
||||||
quillElement, imageUrl);
|
quillElement, imageUrl);
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,14 @@
|
|||||||
@namespace Oqtane.Modules.Controls
|
@namespace Oqtane.Modules.Controls
|
||||||
@inherits ModuleBase
|
@inherits ModuleControlBase
|
||||||
@attribute [OqtaneIgnore]
|
|
||||||
|
|
||||||
<div class="d-flex">
|
<div class="d-flex">
|
||||||
<div>
|
<div>
|
||||||
<a data-toggle="collapse" class="app-link-unstyled" href="#@Name" aria-expanded="@_expanded" aria-controls="@Name">
|
<a data-toggle="collapse" class="app-link-unstyled" href="#@Name" aria-expanded="@_expanded" aria-controls="@Name" @onclick:preventDefault="true">
|
||||||
<h5>@_heading</h5>
|
<h5>@_heading</h5>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="ml-auto">
|
<div class="ml-auto">
|
||||||
<a data-toggle="collapse" class="app-link-unstyled float-right" href="#@Name" aria-expanded="@_expanded" aria-controls="@Name">
|
<a data-toggle="collapse" class="app-link-unstyled float-right" href="#@Name" aria-expanded="@_expanded" aria-controls="@Name" @onclick:preventDefault="true">
|
||||||
<i class="oi oi-chevron-bottom"></i>
|
<i class="oi oi-chevron-bottom"></i>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
@namespace Oqtane.Modules.Controls
|
@namespace Oqtane.Modules.Controls
|
||||||
@inherits ModuleBase
|
@inherits ModuleControlBase
|
||||||
@attribute [OqtaneIgnore]
|
|
||||||
|
|
||||||
@if (Name == Parent.ActiveTab)
|
@if (Name == Parent.ActiveTab)
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
@namespace Oqtane.Modules.Controls
|
@namespace Oqtane.Modules.Controls
|
||||||
@inherits ModuleBase
|
@inherits ModuleControlBase
|
||||||
@attribute [OqtaneIgnore]
|
|
||||||
|
|
||||||
<CascadingValue Value="this">
|
<CascadingValue Value="this">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
@ -11,13 +10,13 @@
|
|||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
@if (tabPanel.Name == ActiveTab)
|
@if (tabPanel.Name == ActiveTab)
|
||||||
{
|
{
|
||||||
<a class="nav-link active" data-toggle="tab" href="#@tabPanel.Name" role="tab">
|
<a class="nav-link active" data-toggle="tab" href="#@tabPanel.Name" role="tab" @onclick:preventDefault="true">
|
||||||
@DisplayHeading(tabPanel.Name, tabPanel.Heading)
|
@DisplayHeading(tabPanel.Name, tabPanel.Heading)
|
||||||
</a>
|
</a>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<a class="nav-link" data-toggle="tab" href="#@tabPanel.Name" role="tab">
|
<a class="nav-link" data-toggle="tab" href="#@tabPanel.Name" role="tab" @onclick:preventDefault="true">
|
||||||
@DisplayHeading(tabPanel.Name, tabPanel.Heading)
|
@DisplayHeading(tabPanel.Name, tabPanel.Heading)
|
||||||
</a>
|
</a>
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
@namespace Oqtane.Modules.Controls
|
@namespace Oqtane.Modules.Controls
|
||||||
|
@inherits ModuleControlBase
|
||||||
|
|
||||||
<img src="@_src" title="@_title" @onclick="SetValue" />
|
<img src="@_src" title="@_title" @onclick="SetValue" />
|
||||||
|
|
||||||
|
@ -27,12 +27,8 @@
|
|||||||
public override List<Resource> Resources => new List<Resource>()
|
public override List<Resource> Resources => new List<Resource>()
|
||||||
{
|
{
|
||||||
new Resource { ResourceType = ResourceType.Stylesheet, Url = ModulePath() + "Module.css" },
|
new Resource { ResourceType = ResourceType.Stylesheet, Url = ModulePath() + "Module.css" },
|
||||||
// the following resources should be declared in the RichTextEditor component however the framework currently only supports resource management for modules and themes
|
|
||||||
new Resource { ResourceType = ResourceType.Stylesheet, Url = "css/quill/quill1.3.6.bubble.css" },
|
new Resource { ResourceType = ResourceType.Stylesheet, Url = "css/quill/quill1.3.6.bubble.css" },
|
||||||
new Resource { ResourceType = ResourceType.Stylesheet, Url = "css/quill/quill1.3.6.snow.css" },
|
new Resource { ResourceType = ResourceType.Stylesheet, Url = "css/quill/quill1.3.6.snow.css" }
|
||||||
new Resource { ResourceType = ResourceType.Script, Url = "js/quill1.3.6.min.js" },
|
|
||||||
new Resource { ResourceType = ResourceType.Script, Url = "js/quill-blot-formatter.min.js" },
|
|
||||||
new Resource { ResourceType = ResourceType.Script, Url = "js/quill-interop.js" }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
private RichTextEditor RichTextEditorHtml;
|
private RichTextEditor RichTextEditorHtml;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
@if (PageState.EditMode)
|
@if (PageState.EditMode)
|
||||||
{
|
{
|
||||||
<br /><ActionLink Action="Edit" /><br /><br />
|
<br /><ActionLink Action="Edit" EditMode="true" /><br /><br />
|
||||||
}
|
}
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
@ -21,23 +21,23 @@ namespace Oqtane.Modules.HtmlText.Services
|
|||||||
|
|
||||||
public async Task<HtmlTextInfo> GetHtmlTextAsync(int moduleId)
|
public async Task<HtmlTextInfo> GetHtmlTextAsync(int moduleId)
|
||||||
{
|
{
|
||||||
var htmltext = await GetJsonAsync<List<HtmlTextInfo>>($"{ApiUrl}/{moduleId}?entityid={moduleId}");
|
var htmltext = await GetJsonAsync<List<HtmlTextInfo>>(CreateAuthorizationPolicyUrl($"{ApiUrl}/{moduleId}", moduleId));
|
||||||
return htmltext.FirstOrDefault();
|
return htmltext.FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task AddHtmlTextAsync(HtmlTextInfo htmlText)
|
public async Task AddHtmlTextAsync(HtmlTextInfo htmlText)
|
||||||
{
|
{
|
||||||
await PostJsonAsync($"{ApiUrl}?entityid={htmlText.ModuleId}", htmlText);
|
await PostJsonAsync(CreateAuthorizationPolicyUrl($"{ApiUrl}", htmlText.ModuleId), htmlText);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task UpdateHtmlTextAsync(HtmlTextInfo htmlText)
|
public async Task UpdateHtmlTextAsync(HtmlTextInfo htmlText)
|
||||||
{
|
{
|
||||||
await PutJsonAsync($"{ApiUrl}/{htmlText.HtmlTextId}?entityid={htmlText.ModuleId}", htmlText);
|
await PutJsonAsync(CreateAuthorizationPolicyUrl($"{ApiUrl}/{htmlText.HtmlTextId}", htmlText.ModuleId), htmlText);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DeleteHtmlTextAsync(int moduleId)
|
public async Task DeleteHtmlTextAsync(int moduleId)
|
||||||
{
|
{
|
||||||
await DeleteAsync($"{ApiUrl}/{moduleId}?entityid={moduleId}");
|
await DeleteAsync(CreateAuthorizationPolicyUrl($"{ApiUrl}/{moduleId}", moduleId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,8 @@ using System;
|
|||||||
using Oqtane.Enums;
|
using Oqtane.Enums;
|
||||||
using Oqtane.UI;
|
using Oqtane.UI;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Microsoft.JSInterop;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace Oqtane.Modules
|
namespace Oqtane.Modules
|
||||||
{
|
{
|
||||||
@ -19,6 +21,9 @@ namespace Oqtane.Modules
|
|||||||
[Inject]
|
[Inject]
|
||||||
protected ILogService LoggingService { get; set; }
|
protected ILogService LoggingService { get; set; }
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
protected IJSRuntime JSRuntime { get; set; }
|
||||||
|
|
||||||
[CascadingParameter]
|
[CascadingParameter]
|
||||||
protected PageState PageState { get; set; }
|
protected PageState PageState { get; set; }
|
||||||
|
|
||||||
@ -28,7 +33,6 @@ namespace Oqtane.Modules
|
|||||||
[CascadingParameter]
|
[CascadingParameter]
|
||||||
protected ModuleInstance ModuleInstance { get; set; }
|
protected ModuleInstance ModuleInstance { get; set; }
|
||||||
|
|
||||||
|
|
||||||
// optional interface properties
|
// optional interface properties
|
||||||
public virtual SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.View; } set { } } // default security
|
public virtual SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.View; } set { } } // default security
|
||||||
|
|
||||||
@ -40,6 +44,24 @@ namespace Oqtane.Modules
|
|||||||
|
|
||||||
public virtual List<Resource> Resources { get; set; }
|
public virtual List<Resource> Resources { get; set; }
|
||||||
|
|
||||||
|
// base lifecycle method for handling JSInterop script registration
|
||||||
|
|
||||||
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||||
|
{
|
||||||
|
if (firstRender)
|
||||||
|
{
|
||||||
|
if (Resources != null && Resources.Exists(item => item.ResourceType == ResourceType.Script))
|
||||||
|
{
|
||||||
|
var scripts = new List<object>();
|
||||||
|
foreach (Resource resource in Resources.Where(item => item.ResourceType == ResourceType.Script))
|
||||||
|
{
|
||||||
|
scripts.Add(new { href = resource.Url, bundle = resource.Bundle ?? "", integrity = resource.Integrity ?? "", crossorigin = resource.CrossOrigin ?? "" });
|
||||||
|
}
|
||||||
|
var interop = new Interop(JSRuntime);
|
||||||
|
await interop.IncludeScripts(scripts.ToArray());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// path method
|
// path method
|
||||||
|
|
||||||
@ -94,6 +116,54 @@ namespace Oqtane.Modules
|
|||||||
return Utilities.ContentUrl(PageState.Alias, fileid);
|
return Utilities.ContentUrl(PageState.Alias, fileid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual Dictionary<string, string> GetUrlParameters(string parametersTemplate = "")
|
||||||
|
{
|
||||||
|
var urlParameters = new Dictionary<string, string>();
|
||||||
|
string[] templateSegments;
|
||||||
|
var parameters = PageState.UrlParameters.Split('/', StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
var parameterId = 0;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(parametersTemplate))
|
||||||
|
{
|
||||||
|
for (int i = 0; i < parameters.Length; i++)
|
||||||
|
{
|
||||||
|
urlParameters.TryAdd("parameter" + i, parameters[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
templateSegments = parametersTemplate.Split('/', StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
|
||||||
|
if (parameters.Length == templateSegments.Length)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < parameters.Length; i++)
|
||||||
|
{
|
||||||
|
if (parameters.Length > i)
|
||||||
|
{
|
||||||
|
if (templateSegments[i] == parameters[i])
|
||||||
|
{
|
||||||
|
urlParameters.TryAdd("parameter" + parameterId, parameters[i]);
|
||||||
|
parameterId++;
|
||||||
|
}
|
||||||
|
else if (templateSegments[i].StartsWith("{") && templateSegments[i].EndsWith("}"))
|
||||||
|
{
|
||||||
|
var key = templateSegments[i].Replace("{", "");
|
||||||
|
key = key.Replace("}", "");
|
||||||
|
urlParameters.TryAdd(key, parameters[i]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
i = parameters.Length;
|
||||||
|
urlParameters.Clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return urlParameters;
|
||||||
|
}
|
||||||
|
|
||||||
// user feedback methods
|
// user feedback methods
|
||||||
public void AddModuleMessage(string message, MessageType type)
|
public void AddModuleMessage(string message, MessageType type)
|
||||||
{
|
{
|
||||||
@ -132,12 +202,15 @@ namespace Oqtane.Modules
|
|||||||
case "add":
|
case "add":
|
||||||
logFunction = LogFunction.Create;
|
logFunction = LogFunction.Create;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "edit":
|
case "edit":
|
||||||
logFunction = LogFunction.Update;
|
logFunction = LogFunction.Update;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "delete":
|
case "delete":
|
||||||
logFunction = LogFunction.Delete;
|
logFunction = LogFunction.Delete;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
logFunction = LogFunction.Read;
|
logFunction = LogFunction.Read;
|
||||||
break;
|
break;
|
||||||
|
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
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -6,7 +6,7 @@
|
|||||||
<LangVersion>7.3</LangVersion>
|
<LangVersion>7.3</LangVersion>
|
||||||
<RazorLangVersion>3.0</RazorLangVersion>
|
<RazorLangVersion>3.0</RazorLangVersion>
|
||||||
<Configurations>Debug;Release</Configurations>
|
<Configurations>Debug;Release</Configurations>
|
||||||
<Version>1.0.0</Version>
|
<Version>1.0.4</Version>
|
||||||
<Product>Oqtane</Product>
|
<Product>Oqtane</Product>
|
||||||
<Authors>Shaun Walker</Authors>
|
<Authors>Shaun Walker</Authors>
|
||||||
<Company>.NET Foundation</Company>
|
<Company>.NET Foundation</Company>
|
||||||
@ -15,8 +15,9 @@
|
|||||||
<PackageProjectUrl>https://www.oqtane.org</PackageProjectUrl>
|
<PackageProjectUrl>https://www.oqtane.org</PackageProjectUrl>
|
||||||
<RepositoryUrl>https://github.com/oqtane</RepositoryUrl>
|
<RepositoryUrl>https://github.com/oqtane</RepositoryUrl>
|
||||||
<RepositoryType>Git</RepositoryType>
|
<RepositoryType>Git</RepositoryType>
|
||||||
<PackageReleaseNotes>Not for production use.</PackageReleaseNotes>
|
<PackageReleaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v1.0.4</PackageReleaseNotes>
|
||||||
<RootNamespace>Oqtane</RootNamespace>
|
<RootNamespace>Oqtane</RootNamespace>
|
||||||
|
<IsPackable>true</IsPackable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@ -37,5 +38,4 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Oqtane.Shared\Oqtane.Shared.csproj" />
|
<ProjectReference Include="..\Oqtane.Shared\Oqtane.Shared.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -7,9 +7,9 @@ namespace Oqtane.Services
|
|||||||
public interface IThemeService
|
public interface IThemeService
|
||||||
{
|
{
|
||||||
Task<List<Theme>> GetThemesAsync();
|
Task<List<Theme>> GetThemesAsync();
|
||||||
Dictionary<string, string> GetThemeTypes(List<Theme> themes);
|
List<ThemeControl> GetThemeControls(List<Theme> themes);
|
||||||
Dictionary<string, string> GetPaneLayoutTypes(List<Theme> themes, string themeName);
|
List<ThemeControl> GetLayoutControls(List<Theme> themes, string themeName);
|
||||||
Dictionary<string, string> GetContainerTypes(List<Theme> themes);
|
List<ThemeControl> GetContainerControls(List<Theme> themes, string themeName);
|
||||||
Task InstallThemesAsync();
|
Task InstallThemesAsync();
|
||||||
Task DeleteThemeAsync(string themeName);
|
Task DeleteThemeAsync(string themeName);
|
||||||
}
|
}
|
||||||
|
@ -170,6 +170,19 @@ namespace Oqtane.Services
|
|||||||
// can be used to override the default alias
|
// can be used to override the default alias
|
||||||
public Alias Alias { get; set; }
|
public Alias Alias { get; set; }
|
||||||
|
|
||||||
|
// add entityid parameter to url for custom authorization policy
|
||||||
|
public string CreateAuthorizationPolicyUrl(string url, int entityId)
|
||||||
|
{
|
||||||
|
if (url.Contains("?"))
|
||||||
|
{
|
||||||
|
return url + "&entityid=" + entityId.ToString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return url + "?entityid=" + entityId.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Obsolete("This method is obsolete. Use CreateApiUrl(Alias alias, string serviceName) instead.", false)]
|
[Obsolete("This method is obsolete. Use CreateApiUrl(Alias alias, string serviceName) instead.", false)]
|
||||||
public string CreateApiUrl(Alias alias, string absoluteUri, string serviceName)
|
public string CreateApiUrl(Alias alias, string absoluteUri, string serviceName)
|
||||||
{
|
{
|
||||||
|
@ -153,7 +153,7 @@ namespace Oqtane.Services
|
|||||||
public string GetSetting(Dictionary<string, string> settings, string settingName, string defaultValue)
|
public string GetSetting(Dictionary<string, string> settings, string settingName, string defaultValue)
|
||||||
{
|
{
|
||||||
string value = defaultValue;
|
string value = defaultValue;
|
||||||
if (settings.ContainsKey(settingName))
|
if (settings != null && settings.ContainsKey(settingName))
|
||||||
{
|
{
|
||||||
value = settings[settingName];
|
value = settings[settingName];
|
||||||
}
|
}
|
||||||
@ -162,6 +162,10 @@ namespace Oqtane.Services
|
|||||||
|
|
||||||
public Dictionary<string, string> SetSetting(Dictionary<string, string> settings, string settingName, string settingValue)
|
public Dictionary<string, string> SetSetting(Dictionary<string, string> settings, string settingName, string settingValue)
|
||||||
{
|
{
|
||||||
|
if (settings == null)
|
||||||
|
{
|
||||||
|
settings = new Dictionary<string, string>();
|
||||||
|
}
|
||||||
if (settings.ContainsKey(settingName))
|
if (settings.ContainsKey(settingName))
|
||||||
{
|
{
|
||||||
settings[settingName] = settingValue;
|
settings[settingName] = settingValue;
|
||||||
|
@ -1,81 +1,54 @@
|
|||||||
using Oqtane.Models;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Reflection;
|
using Oqtane.Models;
|
||||||
using System;
|
|
||||||
using Oqtane.Shared;
|
using Oqtane.Shared;
|
||||||
|
|
||||||
namespace Oqtane.Services
|
namespace Oqtane.Services
|
||||||
{
|
{
|
||||||
public class ThemeService : ServiceBase, IThemeService
|
public class ThemeService : ServiceBase, IThemeService
|
||||||
{
|
{
|
||||||
private readonly HttpClient _http;
|
private readonly SiteState _siteState;
|
||||||
|
|
||||||
public ThemeService(HttpClient http) : base(http)
|
public ThemeService(HttpClient http, SiteState siteState) : base(http)
|
||||||
{
|
{
|
||||||
_http = http;
|
_siteState = siteState;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string Apiurl => CreateApiUrl("Theme");
|
private string ApiUrl => CreateApiUrl(_siteState.Alias, "Theme");
|
||||||
|
|
||||||
public async Task<List<Theme>> GetThemesAsync()
|
public async Task<List<Theme>> GetThemesAsync()
|
||||||
{
|
{
|
||||||
List<Theme> themes = await GetJsonAsync<List<Theme>>(Apiurl);
|
List<Theme> themes = await GetJsonAsync<List<Theme>>(ApiUrl);
|
||||||
return themes.OrderBy(item => item.Name).ToList();
|
return themes.OrderBy(item => item.Name).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dictionary<string, string> GetThemeTypes(List<Theme> themes)
|
public List<ThemeControl> GetThemeControls(List<Theme> themes)
|
||||||
{
|
{
|
||||||
var selectableThemes = new Dictionary<string, string>();
|
return themes.SelectMany(item => item.Themes).ToList();
|
||||||
foreach (Theme theme in themes)
|
|
||||||
{
|
|
||||||
foreach (string themecontrol in theme.ThemeControls.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
|
|
||||||
{
|
|
||||||
selectableThemes.Add(themecontrol, theme.Name + " - " + Utilities.GetTypeNameLastSegment(themecontrol, 0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return selectableThemes;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dictionary<string, string> GetPaneLayoutTypes(List<Theme> themes, string themeName)
|
public List<ThemeControl> GetLayoutControls(List<Theme> themes, string themeName)
|
||||||
{
|
{
|
||||||
var selectablePaneLayouts = new Dictionary<string, string>();
|
return themes.Where(item => Utilities.GetTypeName(themeName).StartsWith(Utilities.GetTypeName(item.ThemeName)))
|
||||||
foreach (Theme theme in themes)
|
.SelectMany(item => item.Layouts).ToList();
|
||||||
{
|
|
||||||
if (themeName.StartsWith(theme.ThemeName))
|
|
||||||
{
|
|
||||||
foreach (string panelayout in theme.PaneLayouts.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
|
|
||||||
{
|
|
||||||
selectablePaneLayouts.Add(panelayout, theme.Name + " - " + @Utilities.GetTypeNameLastSegment(panelayout, 0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return selectablePaneLayouts;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dictionary<string, string> GetContainerTypes(List<Theme> themes)
|
public List<ThemeControl> GetContainerControls(List<Theme> themes, string themeName)
|
||||||
{
|
{
|
||||||
var selectableContainers = new Dictionary<string, string>();
|
return themes.Where(item => Utilities.GetTypeName(themeName).StartsWith(Utilities.GetTypeName(item.ThemeName)))
|
||||||
foreach (Theme theme in themes)
|
.SelectMany(item => item.Containers).ToList();
|
||||||
{
|
|
||||||
foreach (string container in theme.ContainerControls.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
|
|
||||||
{
|
|
||||||
selectableContainers.Add(container, theme.Name + " - " + @Utilities.GetTypeNameLastSegment(container, 0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return selectableContainers;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task InstallThemesAsync()
|
public async Task InstallThemesAsync()
|
||||||
{
|
{
|
||||||
await GetJsonAsync<List<string>>($"{Apiurl}/install");
|
await GetJsonAsync<List<string>>($"{ApiUrl}/install");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DeleteThemeAsync(string themeName)
|
public async Task DeleteThemeAsync(string themeName)
|
||||||
{
|
{
|
||||||
await DeleteAsync($"{Apiurl}/{themeName}");
|
await DeleteAsync($"{ApiUrl}/{themeName}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,11 @@
|
|||||||
|
|
||||||
public override List<Resource> Resources => new List<Resource>()
|
public override List<Resource> Resources => new List<Resource>()
|
||||||
{
|
{
|
||||||
new Resource { ResourceType = ResourceType.Stylesheet, Url = ThemePath() + "Theme.css" }
|
new Resource { ResourceType = ResourceType.Stylesheet, Url = "https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css", Integrity = "sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk", CrossOrigin = "anonymous" },
|
||||||
|
new Resource { ResourceType = ResourceType.Stylesheet, Url = ThemePath() + "Theme.css" },
|
||||||
|
new Resource { ResourceType = ResourceType.Script, Bundle = "Bootstrap", Url = "https://code.jquery.com/jquery-3.5.1.slim.min.js", Integrity = "sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj", CrossOrigin = "anonymous" },
|
||||||
|
new Resource { ResourceType = ResourceType.Script, Bundle = "Bootstrap", Url = "https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js", Integrity = "sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo", CrossOrigin = "anonymous" },
|
||||||
|
new Resource { ResourceType = ResourceType.Script, Bundle = "Bootstrap", Url = "https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js", Integrity = "sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI", CrossOrigin = "anonymous" }
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
@ -1,62 +1,12 @@
|
|||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
using Microsoft.JSInterop;
|
|
||||||
using Oqtane.Shared;
|
|
||||||
using Oqtane.Models;
|
using Oqtane.Models;
|
||||||
using Oqtane.UI;
|
|
||||||
|
|
||||||
namespace Oqtane.Themes
|
namespace Oqtane.Themes
|
||||||
{
|
{
|
||||||
public class ContainerBase : ComponentBase, IContainerControl
|
public abstract class ContainerBase : ThemeBase, IContainerControl
|
||||||
{
|
{
|
||||||
[Inject]
|
|
||||||
protected IJSRuntime JSRuntime { get; set; }
|
|
||||||
|
|
||||||
[CascadingParameter]
|
|
||||||
protected PageState PageState { get; set; }
|
|
||||||
|
|
||||||
[CascadingParameter]
|
[CascadingParameter]
|
||||||
protected Module ModuleState { get; set; }
|
protected Module ModuleState { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public string ThemePath()
|
|
||||||
{
|
|
||||||
return "Themes/" + GetType().Namespace + "/";
|
|
||||||
}
|
|
||||||
|
|
||||||
public string NavigateUrl()
|
|
||||||
{
|
|
||||||
return NavigateUrl(PageState.Page.Path);
|
|
||||||
}
|
|
||||||
|
|
||||||
public string NavigateUrl(string path)
|
|
||||||
{
|
|
||||||
return NavigateUrl(path, "");
|
|
||||||
}
|
|
||||||
|
|
||||||
public string NavigateUrl(string path, string parameters)
|
|
||||||
{
|
|
||||||
return Utilities.NavigateUrl(PageState.Alias.Path, path, parameters);
|
|
||||||
}
|
|
||||||
|
|
||||||
public string EditUrl(string action, string parameters)
|
|
||||||
{
|
|
||||||
return EditUrl(ModuleState.ModuleId, action, parameters);
|
|
||||||
}
|
|
||||||
|
|
||||||
public string EditUrl(int moduleid, string action)
|
|
||||||
{
|
|
||||||
return EditUrl(moduleid, action, "");
|
|
||||||
}
|
|
||||||
|
|
||||||
public string EditUrl(int moduleid, string action, string parameters)
|
|
||||||
{
|
|
||||||
return EditUrl(PageState.Page.Path, moduleid, action, parameters);
|
|
||||||
}
|
|
||||||
|
|
||||||
public string EditUrl(string path, int moduleid, string action, string parameters)
|
|
||||||
{
|
|
||||||
return Utilities.EditUrl(PageState.Alias.Path, path, moduleid, action, parameters);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
@namespace Oqtane.Themes.Controls
|
@namespace Oqtane.Themes.Controls
|
||||||
@inherits ThemeControlBase
|
@inherits ThemeControlBase
|
||||||
@attribute [OqtaneIgnore]
|
|
||||||
|
|
||||||
@if (BreadCrumbPages.Any())
|
@if (BreadCrumbPages.Any())
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
@namespace Oqtane.Themes.Controls
|
@namespace Oqtane.Themes.Controls
|
||||||
@inherits ThemeControlBase
|
@inherits ThemeControlBase
|
||||||
@attribute [OqtaneIgnore]
|
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
@inject IUserService UserService
|
@inject IUserService UserService
|
||||||
@inject IModuleDefinitionService ModuleDefinitionService
|
@inject IModuleDefinitionService ModuleDefinitionService
|
||||||
@ -9,8 +8,9 @@
|
|||||||
@inject IPageService PageService
|
@inject IPageService PageService
|
||||||
@inject IPageModuleService PageModuleService
|
@inject IPageModuleService PageModuleService
|
||||||
@inject ILogService logger
|
@inject ILogService logger
|
||||||
|
@inject ISettingService SettingService
|
||||||
|
|
||||||
@if (_moduleDefinitions != null && UserSecurity.IsAuthorized(PageState.User,PermissionNames.Edit, PageState.Page.Permissions))
|
@if (_moduleDefinitions != null && UserSecurity.IsAuthorized(PageState.User, PermissionNames.Edit, PageState.Page.Permissions))
|
||||||
{
|
{
|
||||||
<div class="app-controlpanel" style="@_display">
|
<div class="app-controlpanel" style="@_display">
|
||||||
|
|
||||||
@ -49,6 +49,21 @@
|
|||||||
<button class="btn btn-danger btn-block mx-auto" @onclick="ConfirmDelete">Delete</button>
|
<button class="btn btn-danger btn-block mx-auto" @onclick="ConfirmDelete">Delete</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<br />
|
||||||
|
<div class="row">
|
||||||
|
@if (UserSecurity.GetPermissionStrings(PageState.Page.Permissions).FirstOrDefault(item => item.PermissionName == PermissionNames.View).Permissions.Split(';').Contains(Constants.AllUsersRole))
|
||||||
|
{
|
||||||
|
<div class="col">
|
||||||
|
<button type="button" class="btn btn-primary btn-block mx-auto" @onclick=@(async () => Publish("unpublish"))>Unpublish Page</button>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<div class="col">
|
||||||
|
<button type="button" class="btn btn-primary btn-block mx-auto" @onclick=@(async () => Publish("publish"))>Publish Page</button>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (_deleteConfirmation)
|
@if (_deleteConfirmation)
|
||||||
@ -78,18 +93,18 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col text-center">
|
<div class="col text-center">
|
||||||
<label for="Module" class="control-label">Module Management: </label>
|
<label for="Module" class="control-label">Module Management: </label>
|
||||||
<select class="form-control" @bind="@_moduleType">
|
<select class="form-control" @bind="@ModuleType">
|
||||||
<option value="new">Add New Module</option>
|
<option value="new">Add New Module</option>
|
||||||
<option value="existing">Add Existing Module</option>
|
<option value="existing">Add Existing Module</option>
|
||||||
</select>
|
</select>
|
||||||
@if (_moduleType == "new")
|
@if (ModuleType == "new")
|
||||||
{
|
{
|
||||||
@if (_moduleDefinitions != null)
|
@if (_moduleDefinitions != null)
|
||||||
{
|
{
|
||||||
<select class="form-control" @onchange="(e => CategoryChanged(e))">
|
<select class="form-control" @onchange="(e => CategoryChanged(e))">
|
||||||
@foreach (var category in _categories)
|
@foreach (var category in _categories)
|
||||||
{
|
{
|
||||||
if (category == _category)
|
if (category == Category)
|
||||||
{
|
{
|
||||||
<option value="@category" selected>@category Modules</option>
|
<option value="@category" selected>@category Modules</option>
|
||||||
}
|
}
|
||||||
@ -100,7 +115,7 @@
|
|||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
<select class="form-control" @onchange="(e => ModuleChanged(e))">
|
<select class="form-control" @onchange="(e => ModuleChanged(e))">
|
||||||
@if (_moduleDefinitionName == "-")
|
@if (ModuleDefinitionName == "-")
|
||||||
{
|
{
|
||||||
<option value="-" selected><Select Module></option>
|
<option value="-" selected><Select Module></option>
|
||||||
}
|
}
|
||||||
@ -111,12 +126,15 @@
|
|||||||
@foreach (var moduledefinition in _moduleDefinitions)
|
@foreach (var moduledefinition in _moduleDefinitions)
|
||||||
{
|
{
|
||||||
if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.Utilize, moduledefinition.Permissions))
|
if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.Utilize, moduledefinition.Permissions))
|
||||||
|
{
|
||||||
|
if (moduledefinition.Runtimes == "" || moduledefinition.Runtimes.Contains(PageState.Runtime.ToString()))
|
||||||
{
|
{
|
||||||
<option value="@moduledefinition.ModuleDefinitionName">@moduledefinition.Name</option>
|
<option value="@moduledefinition.ModuleDefinitionName">@moduledefinition.Name</option>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</select>
|
</select>
|
||||||
@((MarkupString)@_description)
|
@((MarkupString) Description)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -128,7 +146,7 @@
|
|||||||
<option value="@p.PageId">@p.Name</option>
|
<option value="@p.PageId">@p.Name</option>
|
||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
<select class="form-control" @bind="@_moduleId">
|
<select class="form-control" @bind="@ModuleId">
|
||||||
<option value="-"><Select Module></option>
|
<option value="-"><Select Module></option>
|
||||||
@foreach (Module module in _modules)
|
@foreach (Module module in _modules)
|
||||||
{
|
{
|
||||||
@ -141,14 +159,15 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col text-center">
|
<div class="col text-center">
|
||||||
<label for="Title" class="control-label">Title: </label>
|
<label for="Title" class="control-label">Title: </label>
|
||||||
<input type="text" name="Title" class="form-control" @bind="@_title" />
|
<input type="text" name="Title" class="form-control" @bind="@Title" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@if (_pane.Length > 1)
|
||||||
|
{
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col text-center">
|
<div class="col text-center">
|
||||||
<label for="Pane" class="control-label">Pane: </label>
|
<label for="Pane" class="control-label">Pane: </label>
|
||||||
<select class="form-control" @bind="@_pane">
|
<select class="form-control" @bind="@Pane">
|
||||||
<option value=""><Select Pane></option>
|
|
||||||
@foreach (string pane in PageState.Page.Panes)
|
@foreach (string pane in PageState.Page.Panes)
|
||||||
{
|
{
|
||||||
<option value="@pane">@pane Pane</option>
|
<option value="@pane">@pane Pane</option>
|
||||||
@ -156,13 +175,14 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col text-center">
|
<div class="col text-center">
|
||||||
<label for="Container" class="control-label">Container: </label>
|
<label for="Container" class="control-label">Container: </label>
|
||||||
<select class="form-control" @bind="@_containerType">
|
<select class="form-control" @bind="@ContainerType">
|
||||||
@foreach (KeyValuePair<string, string> container in _containers)
|
@foreach (var container in _containers)
|
||||||
{
|
{
|
||||||
<option value="@container.Key">@container.Value</option>
|
<option value="@container.TypeName">@container.Name</option>
|
||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@ -171,22 +191,14 @@
|
|||||||
<br />
|
<br />
|
||||||
|
|
||||||
<button type="button" class="btn btn-primary btn-block mx-auto" @onclick="@AddModule">Add Module To Page</button>
|
<button type="button" class="btn btn-primary btn-block mx-auto" @onclick="@AddModule">Add Module To Page</button>
|
||||||
@((MarkupString) _message)
|
@((MarkupString) Message)
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (UserSecurity.IsAuthorized(PageState.User,PermissionNames.Edit, PageState.Page.Permissions) || (PageState.Page.IsPersonalizable && PageState.User != null))
|
@if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.Edit, PageState.Page.Permissions) || (PageState.Page.IsPersonalizable && PageState.User != null))
|
||||||
{
|
{
|
||||||
@if (PageState.Page.EditMode)
|
|
||||||
{
|
|
||||||
<button type="button" class="btn @ButtonClass active" aria-pressed="true" autocomplete="off">
|
|
||||||
<span class="oi oi-pencil"></span>
|
|
||||||
</button>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (PageState.EditMode)
|
if (PageState.EditMode)
|
||||||
{
|
{
|
||||||
<button type="button" class="btn @ButtonClass active" data-toggle="button" aria-pressed="true" autocomplete="off" @onclick="(async () => await ToggleEditMode(PageState.EditMode))">
|
<button type="button" class="btn @ButtonClass active" data-toggle="button" aria-pressed="true" autocomplete="off" @onclick="(async () => await ToggleEditMode(PageState.EditMode))">
|
||||||
@ -199,195 +211,181 @@
|
|||||||
<span class="oi oi-pencil"></span>
|
<span class="oi oi-pencil"></span>
|
||||||
</button>
|
</button>
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (UserSecurity.IsAuthorized(PageState.User,PermissionNames.Edit, PageState.Page.Permissions))
|
@if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.Edit, PageState.Page.Permissions))
|
||||||
{
|
{
|
||||||
<button type="button" class="btn @ButtonClass" @onclick="ShowControlPanel">
|
<button type="button" class="btn @ButtonClass" @onclick="ShowControlPanel">
|
||||||
<span class="oi oi-cog"></span>
|
<span class="oi oi-cog"></span>
|
||||||
</button>
|
</button>
|
||||||
}
|
}
|
||||||
|
|
||||||
@code {
|
@code{
|
||||||
|
|
||||||
private bool _deleteConfirmation = false;
|
private bool _deleteConfirmation = false;
|
||||||
private string _moduleType = "new";
|
|
||||||
private List<string> _categories = new List<string>();
|
private List<string> _categories = new List<string>();
|
||||||
private List<ModuleDefinition> _allModuleDefinitions;
|
private List<ModuleDefinition> _allModuleDefinitions;
|
||||||
private List<ModuleDefinition> _moduleDefinitions;
|
private List<ModuleDefinition> _moduleDefinitions;
|
||||||
private List<Page> _pages = new List<Page>();
|
private List<Page> _pages = new List<Page>();
|
||||||
private string _pageId = "-";
|
|
||||||
private string _moduleId = "-";
|
|
||||||
private List<Module> _modules = new List<Module>();
|
private List<Module> _modules = new List<Module>();
|
||||||
private Dictionary<string, string> _containers = new Dictionary<string, string>();
|
private List<ThemeControl> _containers = new List<ThemeControl>();
|
||||||
private string _moduleDefinitionName = "-";
|
|
||||||
private string _category = "Common";
|
|
||||||
private string _description = "";
|
|
||||||
private string _pane = "";
|
|
||||||
private string _title = "";
|
|
||||||
private string _containerType = "";
|
|
||||||
private string _display = "display: none;";
|
private string _display = "display: none;";
|
||||||
private string _message = "";
|
private string _category = "Common";
|
||||||
|
|
||||||
[Parameter]
|
protected string PageId { get; private set; } = "-";
|
||||||
public string ButtonClass { get; set; }
|
protected string ModuleId { get; private set; } = "-";
|
||||||
|
protected string ModuleType { get; private set; } = "new";
|
||||||
|
protected string ModuleDefinitionName { get; private set; } = "-";
|
||||||
|
|
||||||
[Parameter]
|
protected string Category
|
||||||
public string CardClass { get; set; }
|
|
||||||
|
|
||||||
[Parameter]
|
|
||||||
public string HeaderClass { get; set; }
|
|
||||||
|
|
||||||
[Parameter]
|
|
||||||
public string BodyClass { get; set; }
|
|
||||||
|
|
||||||
protected override async Task OnParametersSetAsync()
|
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(ButtonClass))
|
get => _category;
|
||||||
|
private set
|
||||||
{
|
{
|
||||||
ButtonClass = "btn-outline-secondary";
|
if (_category != value)
|
||||||
|
{
|
||||||
|
_category = value;
|
||||||
|
_moduleDefinitions = _allModuleDefinitions.Where(item => item.Categories.Contains(Category)).ToList();
|
||||||
|
ModuleDefinitionName = "-";
|
||||||
|
Description = "";
|
||||||
|
StateHasChanged();
|
||||||
|
_ = UpdateSettingsAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(CardClass))
|
protected string Pane
|
||||||
{
|
{
|
||||||
CardClass = "card border-secondary mb-3";
|
get => _pane;
|
||||||
|
private set
|
||||||
|
{
|
||||||
|
if (_pane != value)
|
||||||
|
{
|
||||||
|
_pane = value;
|
||||||
|
_ = UpdateSettingsAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(HeaderClass))
|
|
||||||
{
|
|
||||||
HeaderClass = "card-header";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(BodyClass))
|
protected string Description { get; private set; } = "";
|
||||||
{
|
|
||||||
BodyClass = "card-body";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (UserSecurity.IsAuthorized(PageState.User,PermissionNames.Edit, PageState.Page.Permissions))
|
protected string Title { get; private set; } = "";
|
||||||
|
protected string ContainerType { get; private set; } = "";
|
||||||
|
protected string Message { get; private set; } = "";
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public string ButtonClass { get; set; } = "btn-outline-secondary";
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public string CardClass { get; set; } = "card border-secondary mb-3";
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public string HeaderClass { get; set; } = "card-header";
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public string BodyClass { get; set; } = "card-body";
|
||||||
|
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.Edit, PageState.Page.Permissions))
|
||||||
{
|
{
|
||||||
_pages?.Clear();
|
_pages?.Clear();
|
||||||
|
|
||||||
foreach (Page p in PageState.Pages)
|
foreach (Page p in PageState.Pages)
|
||||||
{
|
{
|
||||||
if (UserSecurity.IsAuthorized(PageState.User,PermissionNames.View, p.Permissions))
|
if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, p.Permissions))
|
||||||
{
|
{
|
||||||
_pages.Add(p);
|
_pages.Add(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
await LoadSettingsAsync();
|
||||||
|
|
||||||
var panes = PageState.Page.Panes;
|
|
||||||
_pane = panes.Count() == 1 ? panes.SingleOrDefault() : "";
|
|
||||||
var themes = await ThemeService.GetThemesAsync();
|
var themes = await ThemeService.GetThemesAsync();
|
||||||
_containers = ThemeService.GetContainerTypes(themes);
|
_containers = ThemeService.GetContainerControls(themes, PageState.Page.ThemeType);
|
||||||
_containerType = PageState.Site.DefaultContainerType;
|
ContainerType = PageState.Site.DefaultContainerType;
|
||||||
|
|
||||||
_allModuleDefinitions = await ModuleDefinitionService.GetModuleDefinitionsAsync(PageState.Site.SiteId);
|
_allModuleDefinitions = await ModuleDefinitionService.GetModuleDefinitionsAsync(PageState.Site.SiteId);
|
||||||
|
_moduleDefinitions = _allModuleDefinitions.Where(item => item.Categories.Contains(Category)).ToList();
|
||||||
_categories = new List<string>();
|
_categories = _allModuleDefinitions.SelectMany(m => m.Categories.Split(',')).Distinct().ToList();
|
||||||
foreach (ModuleDefinition moduledefinition in _allModuleDefinitions)
|
|
||||||
{
|
|
||||||
if (moduledefinition.Categories != "")
|
|
||||||
{
|
|
||||||
foreach (string category in moduledefinition.Categories.Split(','))
|
|
||||||
{
|
|
||||||
if (!_categories.Contains(category))
|
|
||||||
{
|
|
||||||
_categories.Add(category);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_category = "Common";
|
|
||||||
_moduleDefinitions = _allModuleDefinitions.Where(item => item.Categories.Contains(_category)).ToList();
|
|
||||||
_moduleDefinitionName = "-";
|
|
||||||
_description = "";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CategoryChanged(ChangeEventArgs e)
|
private void CategoryChanged(ChangeEventArgs e)
|
||||||
{
|
{
|
||||||
_category = (string) e.Value;
|
Category = (string) e.Value;
|
||||||
_moduleDefinitions = _allModuleDefinitions.Where(item => item.Categories.Contains(_category)).ToList();
|
|
||||||
_moduleDefinitionName = "-";
|
|
||||||
_description = "";
|
|
||||||
StateHasChanged();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ModuleChanged(ChangeEventArgs e)
|
private void ModuleChanged(ChangeEventArgs e)
|
||||||
{
|
{
|
||||||
_moduleDefinitionName = (string)e.Value;
|
ModuleDefinitionName = (string) e.Value;
|
||||||
if (_moduleDefinitionName != "-")
|
if (ModuleDefinitionName != "-")
|
||||||
{
|
{
|
||||||
var moduleDefinition = _moduleDefinitions.FirstOrDefault(item => item.ModuleDefinitionName == _moduleDefinitionName);
|
var moduleDefinition = _moduleDefinitions.FirstOrDefault(item => item.ModuleDefinitionName == ModuleDefinitionName);
|
||||||
_description = "<br /><div class=\"alert alert-info\" role=\"alert\">" + moduleDefinition.Description + "</div>";
|
Description = "<br /><div class=\"alert alert-info\" role=\"alert\">" + moduleDefinition.Description + "</div>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_description = "";
|
Description = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PageChanged(ChangeEventArgs e)
|
private void PageChanged(ChangeEventArgs e)
|
||||||
{
|
{
|
||||||
_pageId = (string) e.Value;
|
PageId = (string) e.Value;
|
||||||
_modules?.Clear();
|
if (PageId != "-")
|
||||||
|
|
||||||
if (_pageId != "-")
|
|
||||||
{
|
{
|
||||||
foreach (Module module in PageState.Modules.Where(item => item.PageId == int.Parse(_pageId) && !item.IsDeleted))
|
_modules = PageState.Modules
|
||||||
{
|
.Where(module => module.PageId == int.Parse(PageId)
|
||||||
if (UserSecurity.IsAuthorized(PageState.User,PermissionNames.View, module.Permissions))
|
&& !module.IsDeleted
|
||||||
{
|
&& UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, module.Permissions))
|
||||||
_modules.Add(module);
|
.ToList();
|
||||||
}
|
}
|
||||||
}
|
ModuleId = "-";
|
||||||
}
|
|
||||||
|
|
||||||
_moduleId = "-";
|
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task AddModule()
|
private async Task AddModule()
|
||||||
{
|
{
|
||||||
if (UserSecurity.IsAuthorized(PageState.User,PermissionNames.Edit, PageState.Page.Permissions))
|
if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.Edit, PageState.Page.Permissions))
|
||||||
{
|
{
|
||||||
if ((_moduleType == "new" && _moduleDefinitionName != "-") || (_moduleType != "new" && _moduleId != "-"))
|
if ((ModuleType == "new" && ModuleDefinitionName != "-") || (ModuleType != "new" && ModuleId != "-"))
|
||||||
{
|
{
|
||||||
if (_moduleType == "new")
|
if (ModuleType == "new")
|
||||||
{
|
{
|
||||||
Module module = new Module();
|
Module module = new Module();
|
||||||
module.SiteId = PageState.Site.SiteId;
|
module.SiteId = PageState.Site.SiteId;
|
||||||
module.PageId = PageState.Page.PageId;
|
module.PageId = PageState.Page.PageId;
|
||||||
module.ModuleDefinitionName = _moduleDefinitionName;
|
module.ModuleDefinitionName = ModuleDefinitionName;
|
||||||
module.AllPages = false;
|
module.AllPages = false;
|
||||||
module.Permissions = PageState.Page.Permissions;
|
module.Permissions = PageState.Page.Permissions;
|
||||||
module = await ModuleService.AddModuleAsync(module);
|
module = await ModuleService.AddModuleAsync(module);
|
||||||
_moduleId = module.ModuleId.ToString();
|
ModuleId = module.ModuleId.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
var pageModule = new PageModule
|
var pageModule = new PageModule
|
||||||
{
|
{
|
||||||
PageId = PageState.Page.PageId,
|
PageId = PageState.Page.PageId,
|
||||||
ModuleId = int.Parse(_moduleId),
|
ModuleId = int.Parse(ModuleId),
|
||||||
Title = _title
|
Title = Title
|
||||||
};
|
};
|
||||||
if (pageModule.Title == "")
|
if (pageModule.Title == "")
|
||||||
{
|
{
|
||||||
if (_moduleType == "new")
|
if (ModuleType == "new")
|
||||||
{
|
{
|
||||||
pageModule.Title = _moduleDefinitions.FirstOrDefault(item => item.ModuleDefinitionName == _moduleDefinitionName)?.Name;
|
pageModule.Title = _moduleDefinitions.FirstOrDefault(item => item.ModuleDefinitionName == ModuleDefinitionName)?.Name;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pageModule.Title = _modules.FirstOrDefault(item => item.ModuleId == int.Parse(_moduleId))?.Title;
|
pageModule.Title = _modules.FirstOrDefault(item => item.ModuleId == int.Parse(ModuleId))?.Title;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pageModule.Pane = _pane;
|
pageModule.Pane = Pane;
|
||||||
pageModule.Order = int.MaxValue;
|
pageModule.Order = int.MaxValue;
|
||||||
pageModule.ContainerType = _containerType;
|
pageModule.ContainerType = ContainerType;
|
||||||
|
|
||||||
if (pageModule.ContainerType == PageState.Site.DefaultContainerType)
|
if (pageModule.ContainerType == PageState.Site.DefaultContainerType)
|
||||||
{
|
{
|
||||||
@ -397,32 +395,23 @@
|
|||||||
await PageModuleService.AddPageModuleAsync(pageModule);
|
await PageModuleService.AddPageModuleAsync(pageModule);
|
||||||
await PageModuleService.UpdatePageModuleOrderAsync(pageModule.PageId, pageModule.Pane);
|
await PageModuleService.UpdatePageModuleOrderAsync(pageModule.PageId, pageModule.Pane);
|
||||||
|
|
||||||
_message = "<br /><div class=\"alert alert-success\" role=\"alert\">Module Added To Page</div>";
|
Message = "<br /><div class=\"alert alert-success\" role=\"alert\">Module Added To Page</div>";
|
||||||
|
|
||||||
_moduleDefinitionName = "-";
|
|
||||||
_description = "";
|
|
||||||
_pane = "";
|
|
||||||
_title = "";
|
|
||||||
_containerType = "";
|
|
||||||
_pageId = "-";
|
|
||||||
_moduleId = "-";
|
|
||||||
|
|
||||||
NavigationManager.NavigateTo(NavigateUrl());
|
NavigationManager.NavigateTo(NavigateUrl());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_message = "<br /><div class=\"alert alert-warning\" role=\"alert\">You Must Select A Module</div>";
|
Message = "<br /><div class=\"alert alert-warning\" role=\"alert\">You Must Select A Module</div>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_message = "<br /><div class=\"alert alert-error\" role=\"alert\">Not Authorized</div>";
|
Message = "<br /><div class=\"alert alert-error\" role=\"alert\">Not Authorized</div>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task ToggleEditMode(bool EditMode)
|
private async Task ToggleEditMode(bool EditMode)
|
||||||
{
|
{
|
||||||
if (UserSecurity.IsAuthorized(PageState.User,PermissionNames.Edit, PageState.Page.Permissions))
|
if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.Edit, PageState.Page.Permissions))
|
||||||
{
|
{
|
||||||
if (EditMode)
|
if (EditMode)
|
||||||
{
|
{
|
||||||
@ -432,6 +421,7 @@
|
|||||||
{
|
{
|
||||||
PageState.EditMode = true;
|
PageState.EditMode = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
NavigationManager.NavigateTo(NavigateUrl(PageState.Page.Path, "edit=" + ((PageState.EditMode) ? "1" : "0")));
|
NavigationManager.NavigateTo(NavigateUrl(PageState.Page.Path, "edit=" + ((PageState.EditMode) ? "1" : "0")));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -447,14 +437,14 @@
|
|||||||
|
|
||||||
private void ShowControlPanel()
|
private void ShowControlPanel()
|
||||||
{
|
{
|
||||||
_message = "";
|
Message = "";
|
||||||
_display = "width: 25%; min-width: 375px;";
|
_display = "width: 25%; min-width: 375px;";
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HideControlPanel()
|
private void HideControlPanel()
|
||||||
{
|
{
|
||||||
_message = "";
|
Message = "";
|
||||||
_display = "width: 0%;";
|
_display = "width: 0%;";
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
@ -503,6 +493,61 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async void Publish(string action)
|
||||||
|
{
|
||||||
|
if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.Edit, PageState.Page.Permissions))
|
||||||
|
{
|
||||||
|
List<PermissionString> permissions;
|
||||||
|
|
||||||
|
if (action == "publish")
|
||||||
|
{
|
||||||
|
// publish all modules
|
||||||
|
foreach (var module in PageState.Modules.Where(item => item.PageId == PageState.Page.PageId))
|
||||||
|
{
|
||||||
|
permissions = UserSecurity.GetPermissionStrings(module.Permissions);
|
||||||
|
foreach (var permissionstring in permissions)
|
||||||
|
{
|
||||||
|
if (permissionstring.PermissionName == PermissionNames.View)
|
||||||
|
{
|
||||||
|
List<string> ids = permissionstring.Permissions.Split(';').ToList();
|
||||||
|
if (!ids.Contains(Constants.AllUsersRole)) ids.Add(Constants.AllUsersRole);
|
||||||
|
if (!ids.Contains(Constants.RegisteredRole)) ids.Add(Constants.RegisteredRole);
|
||||||
|
permissionstring.Permissions = string.Join(";", ids.ToArray());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
module.Permissions = UserSecurity.SetPermissionStrings(permissions);
|
||||||
|
await ModuleService.UpdateModuleAsync(module);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// publish page
|
||||||
|
var page = PageState.Page;
|
||||||
|
permissions = UserSecurity.GetPermissionStrings(page.Permissions);
|
||||||
|
foreach (var permissionstring in permissions)
|
||||||
|
{
|
||||||
|
if (permissionstring.PermissionName == PermissionNames.View)
|
||||||
|
{
|
||||||
|
List<string> ids = permissionstring.Permissions.Split(';').ToList();
|
||||||
|
switch (action)
|
||||||
|
{
|
||||||
|
case "publish":
|
||||||
|
if (!ids.Contains(Constants.AllUsersRole)) ids.Add(Constants.AllUsersRole);
|
||||||
|
if (!ids.Contains(Constants.RegisteredRole)) ids.Add(Constants.RegisteredRole);
|
||||||
|
break;
|
||||||
|
case "unpublish":
|
||||||
|
ids.Remove(Constants.AllUsersRole);
|
||||||
|
ids.Remove(Constants.RegisteredRole);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
permissionstring.Permissions = string.Join(";", ids.ToArray());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
page.Permissions = UserSecurity.SetPermissionStrings(permissions);
|
||||||
|
await PageService.UpdatePageAsync(page);
|
||||||
|
NavigationManager.NavigateTo(NavigateUrl(PageState.Page.Path, "reload"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void ConfirmDelete()
|
private void ConfirmDelete()
|
||||||
{
|
{
|
||||||
_deleteConfirmation = !_deleteConfirmation;
|
_deleteConfirmation = !_deleteConfirmation;
|
||||||
@ -536,4 +581,24 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string settingCategory = "CP-category";
|
||||||
|
private string settingPane = "CP-pane";
|
||||||
|
private string _pane = "";
|
||||||
|
|
||||||
|
private async Task LoadSettingsAsync()
|
||||||
|
{
|
||||||
|
Dictionary<string, string> settings = await SettingService.GetUserSettingsAsync(PageState.User.UserId);
|
||||||
|
_category = SettingService.GetSetting(settings, settingCategory, "Common");
|
||||||
|
var pane = SettingService.GetSetting(settings, settingPane, "");
|
||||||
|
_pane = PageState.Page.Panes.Contains(pane) ? pane : PageState.Page.Panes.FirstOrDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task UpdateSettingsAsync()
|
||||||
|
{
|
||||||
|
Dictionary<string, string> settings = await SettingService.GetUserSettingsAsync(PageState.User.UserId);
|
||||||
|
SettingService.SetSetting(settings, settingCategory, _category);
|
||||||
|
SettingService.SetSetting(settings, settingPane, _pane);
|
||||||
|
await SettingService.UpdateUserSettingsAsync(settings, PageState.User.UserId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
@namespace Oqtane.Themes.Controls
|
@namespace Oqtane.Themes.Controls
|
||||||
@inherits LoginBase
|
@inherits LoginBase
|
||||||
@attribute [OqtaneIgnore]
|
|
||||||
|
|
||||||
<span class="app-login">
|
<span class="app-login">
|
||||||
<AuthorizeView>
|
<AuthorizeView>
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
@namespace Oqtane.Themes.Controls
|
@namespace Oqtane.Themes.Controls
|
||||||
@inherits ThemeControlBase
|
@inherits ThemeControlBase
|
||||||
@attribute [OqtaneIgnore]
|
|
||||||
|
|
||||||
@if (PageState.Site.LogoFileId != null)
|
@if (PageState.Site.LogoFileId != null)
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
@namespace Oqtane.Themes.Controls
|
@namespace Oqtane.Themes.Controls
|
||||||
@inherits MenuBase
|
@inherits MenuBase
|
||||||
@attribute [OqtaneIgnore]
|
|
||||||
@if (MenuPages.Any())
|
@if (MenuPages.Any())
|
||||||
{
|
{
|
||||||
<span class="app-menu-toggler">
|
<span class="app-menu-toggler">
|
||||||
@ -16,7 +16,7 @@
|
|||||||
if (p.PageId == PageState.Page.PageId)
|
if (p.PageId == PageState.Page.PageId)
|
||||||
{
|
{
|
||||||
<li class="nav-item active">
|
<li class="nav-item active">
|
||||||
<a class="nav-link" href="@NavigateUrl(p.Path)">
|
<a class="nav-link" href="@GetUrl(p)" target="@GetTarget(p)" >
|
||||||
@if (p.Icon != string.Empty)
|
@if (p.Icon != string.Empty)
|
||||||
{
|
{
|
||||||
<span class="oi oi-@p.Icon" aria-hidden="true"></span>
|
<span class="oi oi-@p.Icon" aria-hidden="true"></span>
|
||||||
@ -28,7 +28,7 @@
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="@NavigateUrl(p.Path)">
|
<a class="nav-link" href="@GetUrl(p)" target="@GetTarget(p)" >
|
||||||
@if (p.Icon != string.Empty)
|
@if (p.Icon != string.Empty)
|
||||||
{
|
{
|
||||||
<span class="oi oi-@p.Icon" aria-hidden="true"></span>
|
<span class="oi oi-@p.Icon" aria-hidden="true"></span>
|
@ -1,6 +1,6 @@
|
|||||||
@namespace Oqtane.Themes.Controls
|
@namespace Oqtane.Themes.Controls
|
||||||
@inherits MenuBase
|
@inherits MenuBase
|
||||||
@attribute [OqtaneIgnore]
|
|
||||||
@if (MenuPages.Any())
|
@if (MenuPages.Any())
|
||||||
{
|
{
|
||||||
<span class="app-menu-toggler">
|
<span class="app-menu-toggler">
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
@inherits ModuleActionsBase
|
@inherits ModuleActionsBase
|
||||||
@attribute [OqtaneIgnore]
|
@attribute [OqtaneIgnore]
|
||||||
|
|
||||||
@if (PageState.EditMode && !PageState.Page.EditMode && UserSecurity.IsAuthorized(PageState.User,PermissionNames.Edit, ModuleState.Permissions))
|
@if (PageState.EditMode && UserSecurity.IsAuthorized(PageState.User,PermissionNames.Edit, ModuleState.Permissions))
|
||||||
{
|
{
|
||||||
<div class="app-moduleactions">
|
<div class="app-moduleactions">
|
||||||
<a class="nav-link dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"></a>
|
<a class="nav-link dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"></a>
|
||||||
@ -15,7 +15,18 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<a class="dropdown-item" @onclick="(async () => await ModuleAction(action))">@action.Name</a>
|
<a class="dropdown-item" @onclick="(async () => await ModuleAction(action))">
|
||||||
|
@if (string.IsNullOrEmpty(action.Icon))
|
||||||
|
{
|
||||||
|
@((MarkupString) " ");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<span class="oi oi-@action.Icon" aria-hidden="true"></span>
|
||||||
|
}
|
||||||
|
|
||||||
|
@action.Name
|
||||||
|
</a>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
using Oqtane.Models;
|
using Oqtane.Models;
|
||||||
@ -16,8 +17,9 @@ namespace Oqtane.Themes.Controls
|
|||||||
{
|
{
|
||||||
[Inject] public NavigationManager NavigationManager { get; set; }
|
[Inject] public NavigationManager NavigationManager { get; set; }
|
||||||
[Inject] public IPageModuleService PageModuleService { get; set; }
|
[Inject] public IPageModuleService PageModuleService { get; set; }
|
||||||
|
[Inject] public IModuleService ModuleService { get; set; }
|
||||||
|
|
||||||
protected List<ActionViewModel> Actions;
|
public List<ActionViewModel> Actions;
|
||||||
|
|
||||||
protected override void OnParametersSet()
|
protected override void OnParametersSet()
|
||||||
{
|
{
|
||||||
@ -29,42 +31,52 @@ namespace Oqtane.Themes.Controls
|
|||||||
var actionList = new List<ActionViewModel>();
|
var actionList = new List<ActionViewModel>();
|
||||||
if (PageState.EditMode && UserSecurity.IsAuthorized(PageState.User, PermissionNames.Edit, ModuleState.Permissions))
|
if (PageState.EditMode && UserSecurity.IsAuthorized(PageState.User, PermissionNames.Edit, ModuleState.Permissions))
|
||||||
{
|
{
|
||||||
actionList.Add(new ActionViewModel {Name = "Manage Settings", Action = async (u, m) => await Settings(u, m)});
|
actionList.Add(new ActionViewModel {Icon = Icons.Cog, Name = "Manage Settings", Action = async (u, m) => await Settings(u, m)});
|
||||||
|
|
||||||
|
if (UserSecurity.GetPermissionStrings(ModuleState.Permissions).FirstOrDefault(item => item.PermissionName == PermissionNames.View).Permissions.Split(';').Contains(Constants.AllUsersRole))
|
||||||
|
{
|
||||||
|
actionList.Add(new ActionViewModel {Icon=Icons.CircleX, Name = "Unpublish Module", Action = async (s, m) => await Unpublish(s, m) });
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
actionList.Add(new ActionViewModel {Icon=Icons.CircleCheck, Name = "Publish Module", Action = async (s, m) => await Publish(s, m) });
|
||||||
|
}
|
||||||
|
actionList.Add(new ActionViewModel {Icon=Icons.Trash, Name = "Delete Module", Action = async (u, m) => await DeleteModule(u, m) });
|
||||||
|
|
||||||
if (ModuleState.ModuleDefinition != null && ModuleState.ModuleDefinition.ServerManagerType != "")
|
if (ModuleState.ModuleDefinition != null && ModuleState.ModuleDefinition.ServerManagerType != "")
|
||||||
{
|
{
|
||||||
actionList.Add(new ActionViewModel {Name = "Import Content", Action = async (u, m) => await EditUrlAsync(u, m.ModuleId, "Import")});
|
actionList.Add(new ActionViewModel { Name = "" });
|
||||||
actionList.Add(new ActionViewModel {Name = "Export Content", Action = async (u, m) => await EditUrlAsync(u, m.ModuleId, "Export")});
|
actionList.Add(new ActionViewModel {Icon=Icons.CloudUpload, Name = "Import Content", Action = async (u, m) => await EditUrlAsync(u, m.ModuleId, "Import")});
|
||||||
|
actionList.Add(new ActionViewModel {Icon = Icons.CloudDownload, Name = "Export Content", Action = async (u, m) => await EditUrlAsync(u, m.ModuleId, "Export")});
|
||||||
}
|
}
|
||||||
|
|
||||||
actionList.Add(new ActionViewModel {Name = "Delete Module", Action = async (u, m) => await DeleteModule(u, m)});
|
|
||||||
actionList.Add(new ActionViewModel {Name = ""});
|
actionList.Add(new ActionViewModel {Name = ""});
|
||||||
|
|
||||||
if (ModuleState.PaneModuleIndex > 0)
|
if (ModuleState.PaneModuleIndex > 0)
|
||||||
{
|
{
|
||||||
actionList.Add(new ActionViewModel {Name = "Move To Top", Action = async (s, m) => await MoveTop(s, m)});
|
actionList.Add(new ActionViewModel {Icon = Icons.DataTransferUpload ,Name = "Move To Top", Action = async (s, m) => await MoveTop(s, m)});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ModuleState.PaneModuleIndex > 0)
|
if (ModuleState.PaneModuleIndex > 0)
|
||||||
{
|
{
|
||||||
actionList.Add(new ActionViewModel {Name = "Move Up", Action = async (s, m) => await MoveUp(s, m)});
|
actionList.Add(new ActionViewModel {Icon = Icons.ArrowThickTop, Name = "Move Up", Action = async (s, m) => await MoveUp(s, m)});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ModuleState.PaneModuleIndex < (ModuleState.PaneModuleCount - 1))
|
if (ModuleState.PaneModuleIndex < (ModuleState.PaneModuleCount - 1))
|
||||||
{
|
{
|
||||||
actionList.Add(new ActionViewModel {Name = "Move Down", Action = async (s, m) => await MoveDown(s, m)});
|
actionList.Add(new ActionViewModel {Icon = Icons.ArrowThickBottom, Name = "Move Down", Action = async (s, m) => await MoveDown(s, m)});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ModuleState.PaneModuleIndex < (ModuleState.PaneModuleCount - 1))
|
if (ModuleState.PaneModuleIndex < (ModuleState.PaneModuleCount - 1))
|
||||||
{
|
{
|
||||||
actionList.Add(new ActionViewModel {Name = "Move To Bottom", Action = async (s, m) => await MoveBottom(s, m)});
|
actionList.Add(new ActionViewModel {Icon = Icons.DataTransferDownload, Name = "Move To Bottom", Action = async (s, m) => await MoveBottom(s, m)});
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (string pane in PageState.Page.Panes)
|
foreach (string pane in PageState.Page.Panes)
|
||||||
{
|
{
|
||||||
if (pane != ModuleState.Pane)
|
if (pane != ModuleState.Pane)
|
||||||
{
|
{
|
||||||
actionList.Add(new ActionViewModel {Name = "Move To " + pane + " Pane", Action = async (s, m) => await MoveToPane(s, pane, m)});
|
actionList.Add(new ActionViewModel {Icon = Icons.AccountLogin, Name = "Move To " + pane + " Pane", Action = async (s, m) => await MoveToPane(s, pane, m)});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -121,6 +133,42 @@ namespace Oqtane.Themes.Controls
|
|||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task<string> Publish(string s, PageModule pagemodule)
|
||||||
|
{
|
||||||
|
var permissions = UserSecurity.GetPermissionStrings(pagemodule.Module.Permissions);
|
||||||
|
foreach (var permissionstring in permissions)
|
||||||
|
{
|
||||||
|
if (permissionstring.PermissionName == PermissionNames.View)
|
||||||
|
{
|
||||||
|
List<string> ids = permissionstring.Permissions.Split(';').ToList();
|
||||||
|
if (!ids.Contains(Constants.AllUsersRole)) ids.Add(Constants.AllUsersRole);
|
||||||
|
if (!ids.Contains(Constants.RegisteredRole)) ids.Add(Constants.RegisteredRole);
|
||||||
|
permissionstring.Permissions = string.Join(";", ids.ToArray());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pagemodule.Module.Permissions = UserSecurity.SetPermissionStrings(permissions);
|
||||||
|
await ModuleService.UpdateModuleAsync(pagemodule.Module);
|
||||||
|
return NavigateUrl(s, "reload");
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<string> Unpublish(string s, PageModule pagemodule)
|
||||||
|
{
|
||||||
|
var permissions = UserSecurity.GetPermissionStrings(pagemodule.Module.Permissions);
|
||||||
|
foreach (var permissionstring in permissions)
|
||||||
|
{
|
||||||
|
if (permissionstring.PermissionName == PermissionNames.View)
|
||||||
|
{
|
||||||
|
List<string> ids = permissionstring.Permissions.Split(';').ToList();
|
||||||
|
ids.Remove(Constants.AllUsersRole);
|
||||||
|
ids.Remove(Constants.RegisteredRole);
|
||||||
|
permissionstring.Permissions = string.Join(";", ids.ToArray());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pagemodule.Module.Permissions = UserSecurity.SetPermissionStrings(permissions);
|
||||||
|
await ModuleService.UpdateModuleAsync(pagemodule.Module);
|
||||||
|
return NavigateUrl(s, "reload");
|
||||||
|
}
|
||||||
|
|
||||||
private async Task<string> MoveTop(string s, PageModule pagemodule)
|
private async Task<string> MoveTop(string s, PageModule pagemodule)
|
||||||
{
|
{
|
||||||
pagemodule.Order = 0;
|
pagemodule.Order = 0;
|
||||||
@ -155,8 +203,8 @@ namespace Oqtane.Themes.Controls
|
|||||||
|
|
||||||
public class ActionViewModel
|
public class ActionViewModel
|
||||||
{
|
{
|
||||||
|
public string Icon { get; set; }
|
||||||
public string Name { set; get; }
|
public string Name { set; get; }
|
||||||
|
|
||||||
public Func<string, PageModule, Task<string>> Action { set; get; }
|
public Func<string, PageModule, Task<string>> Action { set; get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
@namespace Oqtane.Themes.Controls
|
@namespace Oqtane.Themes.Controls
|
||||||
@inherits ThemeControlBase
|
@inherits ThemeControlBase
|
||||||
@attribute [OqtaneIgnore]
|
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
|
|
||||||
<span class="app-profile">
|
<span class="app-profile">
|
||||||
|
@ -2,5 +2,6 @@
|
|||||||
{
|
{
|
||||||
public interface IContainerControl
|
public interface IContainerControl
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
{
|
{
|
||||||
public interface ILayoutControl
|
public interface ILayoutControl
|
||||||
{
|
{
|
||||||
string Panes { get; } // identifies all panes in a theme ( delimited by ";" )
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,7 @@
|
|||||||
using Microsoft.AspNetCore.Components;
|
namespace Oqtane.Themes
|
||||||
using Oqtane.Shared;
|
|
||||||
using Oqtane.UI;
|
|
||||||
|
|
||||||
namespace Oqtane.Themes
|
|
||||||
{
|
{
|
||||||
public class LayoutBase : ComponentBase, ILayoutControl
|
public abstract class LayoutBase : ThemeBase, ILayoutControl
|
||||||
{
|
{
|
||||||
[CascadingParameter]
|
|
||||||
protected PageState PageState { get; set; }
|
|
||||||
public virtual string Panes { get; set; }
|
|
||||||
|
|
||||||
public string LayoutPath()
|
|
||||||
{
|
|
||||||
return "Themes/" + GetType().Namespace + "/";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,3 +13,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
public override string Name => "Standard Header";
|
||||||
|
}
|
@ -17,14 +17,16 @@
|
|||||||
</main>
|
</main>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
public override string Name => "Default";
|
||||||
|
|
||||||
public override string Panes => string.Empty;
|
public override string Panes => string.Empty;
|
||||||
|
|
||||||
public override List<Resource> Resources => new List<Resource>()
|
public override List<Resource> Resources => new List<Resource>()
|
||||||
{
|
{
|
||||||
new Resource { ResourceType = ResourceType.Stylesheet, Url = ThemePath() + "BootswatchCyborg.css" },
|
new Resource { ResourceType = ResourceType.Stylesheet, Url = "https://stackpath.bootstrapcdn.com/bootswatch/4.5.0/cyborg/bootstrap.min.css", Integrity = "sha384-GKugkVcT8wqoh3M8z1lqHbU+g6j498/ZT/zuXbepz7Dc09/otQZxTimkEMTkRWHP", CrossOrigin = "anonymous" },
|
||||||
// remote stylesheets can be linked using the format below, however we want the default theme to display properly in local development scenarios where an Internet connection is not available
|
new Resource { ResourceType = ResourceType.Stylesheet, Url = ThemePath() + "Theme.css" },
|
||||||
//new Resource { ResourceType = ResourceType.Stylesheet, Url = "https://stackpath.bootstrapcdn.com/bootswatch/4.4.1/cyborg/bootstrap.min.css", Integrity = "sha384-l7xaoY0cJM4h9xh1RfazbgJVUZvdtyLWPueWNtLAphf/UbBgOVzqbOTogxPwYLHM", CrossOrigin = "anonymous" },
|
new Resource { ResourceType = ResourceType.Script, Bundle = "Bootstrap", Url = "https://code.jquery.com/jquery-3.5.1.slim.min.js", Integrity = "sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj", CrossOrigin = "anonymous" },
|
||||||
new Resource { ResourceType = ResourceType.Stylesheet, Url = ThemePath() + "Theme.css" }
|
new Resource { ResourceType = ResourceType.Script, Bundle = "Bootstrap", Url = "https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js", Integrity = "sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo", CrossOrigin = "anonymous" },
|
||||||
|
new Resource { ResourceType = ResourceType.Script, Bundle = "Bootstrap", Url = "https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js", Integrity = "sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI", CrossOrigin = "anonymous" }
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,5 +14,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
public override string Panes => "Top;Left;Content;Right;Bottom";
|
public override string Name => "Multiple Panes";
|
||||||
|
|
||||||
|
public override string Panes => "Top,Left,Content,Right,Bottom";
|
||||||
}
|
}
|
@ -7,3 +7,7 @@
|
|||||||
}
|
}
|
||||||
<ModuleInstance />
|
<ModuleInstance />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
public override string Name => "No Header";
|
||||||
|
}
|
@ -6,5 +6,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
public override string Name => "Single Pane";
|
||||||
|
|
||||||
public override string Panes => "Content";
|
public override string Panes => "Content";
|
||||||
}
|
}
|
@ -4,11 +4,12 @@ using Oqtane.Models;
|
|||||||
using Oqtane.Shared;
|
using Oqtane.Shared;
|
||||||
using Oqtane.UI;
|
using Oqtane.UI;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Oqtane.Themes
|
namespace Oqtane.Themes
|
||||||
{
|
{
|
||||||
public class ThemeBase : ComponentBase, IThemeControl
|
public abstract class ThemeBase : ComponentBase, IThemeControl
|
||||||
{
|
{
|
||||||
[Inject]
|
[Inject]
|
||||||
protected IJSRuntime JSRuntime { get; set; }
|
protected IJSRuntime JSRuntime { get; set; }
|
||||||
@ -17,9 +18,30 @@ namespace Oqtane.Themes
|
|||||||
|
|
||||||
[CascadingParameter]
|
[CascadingParameter]
|
||||||
protected PageState PageState { get; set; }
|
protected PageState PageState { get; set; }
|
||||||
|
public virtual string Name { get; set; }
|
||||||
|
public virtual string Thumbnail { get; set; }
|
||||||
public virtual string Panes { get; set; }
|
public virtual string Panes { get; set; }
|
||||||
public virtual List<Resource> Resources { get; set; }
|
public virtual List<Resource> Resources { get; set; }
|
||||||
|
|
||||||
|
// base lifecycle method for handling JSInterop script registration
|
||||||
|
|
||||||
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||||
|
{
|
||||||
|
if (firstRender)
|
||||||
|
{
|
||||||
|
if (Resources != null && Resources.Exists(item => item.ResourceType == ResourceType.Script))
|
||||||
|
{
|
||||||
|
var scripts = new List<object>();
|
||||||
|
foreach (Resource resource in Resources.Where(item => item.ResourceType == ResourceType.Script))
|
||||||
|
{
|
||||||
|
scripts.Add(new { href = resource.Url, bundle = resource.Bundle ?? "", integrity = resource.Integrity ?? "", crossorigin = resource.CrossOrigin ?? "" });
|
||||||
|
}
|
||||||
|
var interop = new Interop(JSRuntime);
|
||||||
|
await interop.IncludeScripts(scripts.ToArray());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// path method
|
// path method
|
||||||
|
|
||||||
public string ThemePath()
|
public string ThemePath()
|
||||||
@ -58,5 +80,10 @@ namespace Oqtane.Themes
|
|||||||
{
|
{
|
||||||
return Utilities.EditUrl(PageState.Alias.Path, path, moduleid, action, parameters);
|
return Utilities.EditUrl(PageState.Alias.Path, path, moduleid, action, parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string ContentUrl(int fileid)
|
||||||
|
{
|
||||||
|
return Utilities.ContentUrl(PageState.Alias, fileid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,47 +1,10 @@
|
|||||||
using Microsoft.AspNetCore.Components;
|
using Oqtane.Shared;
|
||||||
using Oqtane.Shared;
|
|
||||||
using Oqtane.UI;
|
|
||||||
|
|
||||||
namespace Oqtane.Themes
|
namespace Oqtane.Themes
|
||||||
{
|
{
|
||||||
public class ThemeControlBase : ComponentBase
|
[OqtaneIgnore]
|
||||||
|
public abstract class ThemeControlBase : ThemeBase
|
||||||
{
|
{
|
||||||
[CascadingParameter]
|
|
||||||
protected PageState PageState { get; set; }
|
|
||||||
|
|
||||||
public string NavigateUrl()
|
|
||||||
{
|
|
||||||
return NavigateUrl(PageState.Page.Path);
|
|
||||||
}
|
|
||||||
|
|
||||||
public string NavigateUrl(string path)
|
|
||||||
{
|
|
||||||
return NavigateUrl(path, "");
|
|
||||||
}
|
|
||||||
|
|
||||||
public string NavigateUrl(string path, string parameters)
|
|
||||||
{
|
|
||||||
return Utilities.NavigateUrl(PageState.Alias.Path, path, parameters);
|
|
||||||
}
|
|
||||||
|
|
||||||
public string EditUrl(int moduleid, string action)
|
|
||||||
{
|
|
||||||
return EditUrl(moduleid, action, "");
|
|
||||||
}
|
|
||||||
|
|
||||||
public string EditUrl(int moduleid, string action, string parameters)
|
|
||||||
{
|
|
||||||
return EditUrl(PageState.Page.Path, moduleid, action, parameters);
|
|
||||||
}
|
|
||||||
|
|
||||||
public string EditUrl(string path, int moduleid, string action, string parameters)
|
|
||||||
{
|
|
||||||
return Utilities.EditUrl(PageState.Alias.Path, path, moduleid, action, parameters);
|
|
||||||
}
|
|
||||||
|
|
||||||
public string ContentUrl(int fileid)
|
|
||||||
{
|
|
||||||
return Utilities.ContentUrl(PageState.Alias, fileid);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
{
|
{
|
||||||
_moduleState = Module; // passed in from Pane component
|
_moduleState = Module; // passed in from Pane component
|
||||||
string container = _moduleState.ContainerType;
|
string container = _moduleState.ContainerType;
|
||||||
if (PageState.ModuleId != -1 && PageState.Action != "" && _moduleState.UseAdminContainer)
|
if (PageState.ModuleId != -1 && _moduleState.UseAdminContainer)
|
||||||
{
|
{
|
||||||
container = Constants.DefaultAdminContainer;
|
container = Constants.DefaultAdminContainer;
|
||||||
}
|
}
|
||||||
@ -27,18 +27,13 @@
|
|||||||
DynamicComponent = builder =>
|
DynamicComponent = builder =>
|
||||||
{
|
{
|
||||||
Type containerType = Type.GetType(container);
|
Type containerType = Type.GetType(container);
|
||||||
if (containerType != null)
|
if (containerType == null)
|
||||||
{
|
{
|
||||||
|
// fallback
|
||||||
|
containerType = Type.GetType(Constants.DefaultContainer);
|
||||||
|
}
|
||||||
builder.OpenComponent(0, containerType);
|
builder.OpenComponent(0, containerType);
|
||||||
builder.CloseComponent();
|
builder.CloseComponent();
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// container does not exist with type specified
|
|
||||||
builder.OpenComponent(0, Type.GetType(Constants.ModuleMessageComponent));
|
|
||||||
builder.AddAttribute(1, "Message", "Error Loading Module Container " + container);
|
|
||||||
builder.CloseComponent();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
@inject IInstallationService InstallationService
|
@inject IInstallationService InstallationService
|
||||||
@inject ISiteService SiteService
|
@inject ISiteService SiteService
|
||||||
@inject IUserService UserService
|
@inject IUserService UserService
|
||||||
|
@inject IJSRuntime JSRuntime
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -138,6 +139,15 @@
|
|||||||
private string _integratedSecurityDisplay = "display: none;";
|
private string _integratedSecurityDisplay = "display: none;";
|
||||||
private string _loadingDisplay = "display: none;";
|
private string _loadingDisplay = "display: none;";
|
||||||
|
|
||||||
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||||
|
{
|
||||||
|
if (firstRender)
|
||||||
|
{
|
||||||
|
var interop = new Interop(JSRuntime);
|
||||||
|
await interop.IncludeLink("app-stylesheet", "stylesheet", "https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css", "text/css", "sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T", "anonymous", "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void SetIntegratedSecurity(ChangeEventArgs e)
|
private void SetIntegratedSecurity(ChangeEventArgs e)
|
||||||
{
|
{
|
||||||
_integratedSecurityDisplay = Convert.ToBoolean((string)e.Value)
|
_integratedSecurityDisplay = Convert.ToBoolean((string)e.Value)
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.JSInterop;
|
||||||
using Microsoft.JSInterop;
|
using Oqtane.Models;
|
||||||
using System;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Oqtane.UI
|
namespace Oqtane.UI
|
||||||
@ -18,8 +17,8 @@ namespace Oqtane.UI
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_jsRuntime.InvokeAsync<string>(
|
_jsRuntime.InvokeVoidAsync(
|
||||||
"interop.setCookie",
|
"Oqtane.Interop.setCookie",
|
||||||
name, value, days);
|
name, value, days);
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
@ -34,7 +33,7 @@ namespace Oqtane.UI
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
return _jsRuntime.InvokeAsync<string>(
|
return _jsRuntime.InvokeAsync<string>(
|
||||||
"interop.getCookie",
|
"Oqtane.Interop.getCookie",
|
||||||
name);
|
name);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
@ -47,8 +46,8 @@ namespace Oqtane.UI
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_jsRuntime.InvokeAsync<string>(
|
_jsRuntime.InvokeVoidAsync(
|
||||||
"interop.updateTitle",
|
"Oqtane.Interop.updateTitle",
|
||||||
title);
|
title);
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
@ -58,13 +57,13 @@ namespace Oqtane.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task IncludeMeta(string id, string attribute, string name, string content)
|
public Task IncludeMeta(string id, string attribute, string name, string content, string key)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_jsRuntime.InvokeAsync<string>(
|
_jsRuntime.InvokeVoidAsync(
|
||||||
"interop.includeMeta",
|
"Oqtane.Interop.includeMeta",
|
||||||
id, attribute, name, content);
|
id, attribute, name, content, key);
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
@ -73,13 +72,13 @@ namespace Oqtane.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task IncludeLink(string id, string rel, string url, string type, string integrity, string crossorigin)
|
public Task IncludeLink(string id, string rel, string href, string type, string integrity, string crossorigin, string key)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_jsRuntime.InvokeAsync<string>(
|
_jsRuntime.InvokeVoidAsync(
|
||||||
"interop.includeLink",
|
"Oqtane.Interop.includeLink",
|
||||||
id, rel, url, type, integrity, crossorigin);
|
id, rel, href, type, integrity, crossorigin, key);
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
@ -88,13 +87,13 @@ namespace Oqtane.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task IncludeScript(string id, string src, string content, string location, string integrity, string crossorigin)
|
public Task IncludeLinks(object[] links)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_jsRuntime.InvokeAsync<string>(
|
_jsRuntime.InvokeVoidAsync(
|
||||||
"interop.includeScript",
|
"Oqtane.Interop.includeLinks",
|
||||||
id, src, content, location, integrity, crossorigin);
|
(object) links);
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
@ -103,13 +102,13 @@ namespace Oqtane.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task IncludeCSS(string id, string url)
|
public Task IncludeScript(string id, string src, string integrity, string crossorigin, string content, string location, string key)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_jsRuntime.InvokeAsync<string>(
|
_jsRuntime.InvokeVoidAsync(
|
||||||
"interop.includeLink",
|
"Oqtane.Interop.includeScript",
|
||||||
id, "stylesheet", url, "text/css");
|
id, src, integrity, crossorigin, content, location, key);
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
@ -118,12 +117,26 @@ namespace Oqtane.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task IncludeScripts(object[] scripts)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await _jsRuntime.InvokeVoidAsync(
|
||||||
|
"Oqtane.Interop.includeScripts",
|
||||||
|
(object)scripts);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// ignore exception
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Task RemoveElementsById(string prefix, string first, string last)
|
public Task RemoveElementsById(string prefix, string first, string last)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_jsRuntime.InvokeAsync<string>(
|
_jsRuntime.InvokeVoidAsync(
|
||||||
"interop.removeElementsById",
|
"Oqtane.Interop.removeElementsById",
|
||||||
prefix, first, last);
|
prefix, first, last);
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
@ -133,13 +146,12 @@ namespace Oqtane.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public ValueTask<string> GetElementByName(string name)
|
public ValueTask<string> GetElementByName(string name)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return _jsRuntime.InvokeAsync<string>(
|
return _jsRuntime.InvokeAsync<string>(
|
||||||
"interop.getElementByName",
|
"Oqtane.Interop.getElementByName",
|
||||||
name);
|
name);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
@ -152,8 +164,8 @@ namespace Oqtane.UI
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_jsRuntime.InvokeAsync<string>(
|
_jsRuntime.InvokeVoidAsync(
|
||||||
"interop.submitForm",
|
"Oqtane.Interop.submitForm",
|
||||||
path, fields);
|
path, fields);
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
@ -168,7 +180,7 @@ namespace Oqtane.UI
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
return _jsRuntime.InvokeAsync<string[]>(
|
return _jsRuntime.InvokeAsync<string[]>(
|
||||||
"interop.getFiles",
|
"Oqtane.Interop.getFiles",
|
||||||
id);
|
id);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
@ -181,8 +193,8 @@ namespace Oqtane.UI
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_jsRuntime.InvokeAsync<string>(
|
_jsRuntime.InvokeVoidAsync(
|
||||||
"interop.uploadFiles",
|
"Oqtane.Interop.uploadFiles",
|
||||||
posturl, folder, id);
|
posturl, folder, id);
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
@ -191,5 +203,36 @@ namespace Oqtane.UI
|
|||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Task RefreshBrowser(bool force, int wait)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_jsRuntime.InvokeVoidAsync(
|
||||||
|
"Oqtane.Interop.refreshBrowser",
|
||||||
|
force, wait);
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task RedirectBrowser(string url, int wait)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_jsRuntime.InvokeVoidAsync(
|
||||||
|
"Oqtane.Interop.redirectBrowser",
|
||||||
|
url, wait);
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ namespace Oqtane.UI
|
|||||||
public List<Module> Modules { get; set; }
|
public List<Module> Modules { get; set; }
|
||||||
public Uri Uri { get; set; }
|
public Uri Uri { get; set; }
|
||||||
public Dictionary<string, string> QueryString { get; set; }
|
public Dictionary<string, string> QueryString { get; set; }
|
||||||
|
public string UrlParameters { get; set; }
|
||||||
public int ModuleId { get; set; }
|
public int ModuleId { get; set; }
|
||||||
public string Action { get; set; }
|
public string Action { get; set; }
|
||||||
public bool EditMode { get; set; }
|
public bool EditMode { get; set; }
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
@namespace Oqtane.UI
|
@using Microsoft.AspNetCore.Components.Rendering
|
||||||
|
@namespace Oqtane.UI
|
||||||
@inject IUserService UserService
|
@inject IUserService UserService
|
||||||
@inject IModuleService ModuleService
|
@inject IModuleService ModuleService
|
||||||
@inject IModuleDefinitionService ModuleDefinitionService
|
@inject IModuleDefinitionService ModuleDefinitionService
|
||||||
@ -25,25 +26,25 @@
|
|||||||
|
|
||||||
protected override void OnParametersSet()
|
protected override void OnParametersSet()
|
||||||
{
|
{
|
||||||
if (PageState.EditMode && !PageState.Page.EditMode && UserSecurity.IsAuthorized(PageState.User,PermissionNames.Edit, PageState.Page.Permissions) && Name != Constants.AdminPane)
|
if (PageState.EditMode && UserSecurity.IsAuthorized(PageState.User,PermissionNames.Edit, PageState.Page.Permissions) && Name != Constants.AdminPane)
|
||||||
{
|
{
|
||||||
_paneadminborder = "app-pane-admin-border";
|
_paneadminborder = "app-pane-admin-border";
|
||||||
_panetitle = "<div class=\"app-pane-admin-title\">" + Name + " Pane</div>";
|
_panetitle = "<div class=\"app-pane-admin-title\">" + Name + " Pane</div>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_paneadminborder = "container";
|
_paneadminborder = "";
|
||||||
_panetitle = "";
|
_panetitle = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicComponent = builder =>
|
DynamicComponent = builder =>
|
||||||
{
|
{
|
||||||
if (PageState.ModuleId != -1 && PageState.Action != "")
|
if (PageState.ModuleId != -1 && PageState.Action != Constants.DefaultAction)
|
||||||
{
|
{
|
||||||
if (Name.ToLower() == Constants.AdminPane.ToLower())
|
if (Name.ToLower() == Constants.AdminPane.ToLower())
|
||||||
{
|
{
|
||||||
Module module = PageState.Modules.FirstOrDefault(item => item.ModuleId == PageState.ModuleId);
|
Module module = PageState.Modules.FirstOrDefault(item => item.ModuleId == PageState.ModuleId);
|
||||||
if (module != null)
|
if (module != null && !module.IsDeleted)
|
||||||
{
|
{
|
||||||
var typename = module.ModuleType;
|
var typename = module.ModuleType;
|
||||||
// check for core module actions component
|
// check for core module actions component
|
||||||
@ -88,10 +89,7 @@
|
|||||||
{
|
{
|
||||||
module.Title = module.ControlTitle;
|
module.Title = module.ControlTitle;
|
||||||
}
|
}
|
||||||
|
CreateComponent(builder, module);
|
||||||
builder.OpenComponent(0, Type.GetType(Constants.ContainerComponent));
|
|
||||||
builder.AddAttribute(1, "Module", module);
|
|
||||||
builder.CloseComponent();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -106,14 +104,12 @@
|
|||||||
if (PageState.ModuleId != -1)
|
if (PageState.ModuleId != -1)
|
||||||
{
|
{
|
||||||
Module module = PageState.Modules.FirstOrDefault(item => item.ModuleId == PageState.ModuleId);
|
Module module = PageState.Modules.FirstOrDefault(item => item.ModuleId == PageState.ModuleId);
|
||||||
if (module != null && module.Pane.ToLower() == Name.ToLower())
|
if (module != null && module.Pane.ToLower() == Name.ToLower() && !module.IsDeleted)
|
||||||
{
|
{
|
||||||
// check if user is authorized to view module
|
// check if user is authorized to view module
|
||||||
if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, module.Permissions))
|
if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, module.Permissions))
|
||||||
{
|
{
|
||||||
builder.OpenComponent(0, Type.GetType(Constants.ContainerComponent));
|
CreateComponent(builder, module);
|
||||||
builder.AddAttribute(1, "Module", module);
|
|
||||||
builder.CloseComponent();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -124,14 +120,19 @@
|
|||||||
// check if user is authorized to view module
|
// check if user is authorized to view module
|
||||||
if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, module.Permissions))
|
if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, module.Permissions))
|
||||||
{
|
{
|
||||||
builder.OpenComponent(0, Type.GetType(Constants.ContainerComponent));
|
CreateComponent(builder, module);
|
||||||
builder.AddAttribute(1, "Module", module);
|
|
||||||
builder.SetKey(module.PageModuleId);
|
|
||||||
builder.CloseComponent();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CreateComponent(RenderTreeBuilder builder, Module module)
|
||||||
|
{
|
||||||
|
builder.OpenComponent(0, Type.GetType(Constants.ContainerComponent));
|
||||||
|
builder.AddAttribute(1, "Module", module);
|
||||||
|
builder.SetKey(module.PageModuleId);
|
||||||
|
builder.CloseComponent();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,15 +13,13 @@
|
|||||||
DynamicComponent = builder =>
|
DynamicComponent = builder =>
|
||||||
{
|
{
|
||||||
var layoutType = Type.GetType(PageState.Page.LayoutType);
|
var layoutType = Type.GetType(PageState.Page.LayoutType);
|
||||||
if (layoutType != null)
|
if (layoutType == null)
|
||||||
{
|
{
|
||||||
|
// fallback
|
||||||
|
layoutType = Type.GetType(Constants.DefaultLayout);
|
||||||
|
}
|
||||||
builder.OpenComponent(0, layoutType);
|
builder.OpenComponent(0, layoutType);
|
||||||
builder.CloseComponent();
|
builder.CloseComponent();
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// layout does not exist with type specified
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user