Compare commits
67 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 |
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,6 +28,7 @@
|
|||||||
</table>
|
</table>
|
||||||
<Pager Items="@_files">
|
<Pager Items="@_files">
|
||||||
<Header>
|
<Header>
|
||||||
|
<th style="width: 1px;"> </th>
|
||||||
<th style="width: 1px;"> </th>
|
<th style="width: 1px;"> </th>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Modified</th>
|
<th>Modified</th>
|
||||||
@ -35,6 +36,7 @@
|
|||||||
<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>
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -299,7 +299,7 @@
|
|||||||
Page page = null;
|
Page page = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (_name != string.Empty && !string.IsNullOrEmpty(_themetype) && (_layouts.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;
|
||||||
@ -389,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
@ -448,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)
|
||||||
|
@ -402,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
@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
|
||||||
{
|
{
|
||||||
@ -26,7 +26,7 @@
|
|||||||
<Label HelpText="Upload a framework package and select Install to complete the installation">Framework: </Label>
|
<Label HelpText="Upload a framework package and select Install to complete the installation">Framework: </Label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<FileManager Filter="nupkg" Folder="Framework" />
|
<FileManager Filter="nupkg" ShowFiles="false" Folder="Framework" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
@ -79,6 +79,8 @@ else
|
|||||||
@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>
|
||||||
@ -241,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)
|
||||||
{
|
{
|
||||||
@ -261,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
|
||||||
{
|
{
|
||||||
@ -269,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)
|
||||||
@ -279,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));
|
||||||
|
@ -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;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
@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">
|
||||||
|
@ -63,7 +63,7 @@
|
|||||||
<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>
|
||||||
}
|
}
|
||||||
@ -86,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;
|
||||||
|
@ -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.2</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,7 +15,7 @@
|
|||||||
<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>https://github.com/oqtane/oqtane.framework/releases/tag/v1.0.2</PackageReleaseNotes>
|
<PackageReleaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v1.0.4</PackageReleaseNotes>
|
||||||
<RootNamespace>Oqtane</RootNamespace>
|
<RootNamespace>Oqtane</RootNamespace>
|
||||||
<IsPackable>true</IsPackable>
|
<IsPackable>true</IsPackable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_paneadminborder = "container";
|
_paneadminborder = "";
|
||||||
_panetitle = "";
|
_panetitle = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>Oqtane.Client</id>
|
<id>Oqtane.Client</id>
|
||||||
<version>1.0.2</version>
|
<version>1.0.4</version>
|
||||||
<authors>Shaun Walker</authors>
|
<authors>Shaun Walker</authors>
|
||||||
<owners>.NET Foundation</owners>
|
<owners>.NET Foundation</owners>
|
||||||
<title>Oqtane Framework</title>
|
<title>Oqtane Framework</title>
|
||||||
@ -13,7 +13,7 @@
|
|||||||
<projectUrl>https://github.com/oqtane/oqtane.framework</projectUrl>
|
<projectUrl>https://github.com/oqtane/oqtane.framework</projectUrl>
|
||||||
<iconUrl>https://www.oqtane.org/Portals/0/icon.jpg</iconUrl>
|
<iconUrl>https://www.oqtane.org/Portals/0/icon.jpg</iconUrl>
|
||||||
<tags>oqtane</tags>
|
<tags>oqtane</tags>
|
||||||
<releaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v1.0.2</releaseNotes>
|
<releaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v1.0.4</releaseNotes>
|
||||||
<summary>A modular application framework for Blazor</summary>
|
<summary>A modular application framework for Blazor</summary>
|
||||||
</metadata>
|
</metadata>
|
||||||
<files>
|
<files>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>Oqtane.Framework</id>
|
<id>Oqtane.Framework</id>
|
||||||
<version>1.0.2</version>
|
<version>1.0.4</version>
|
||||||
<authors>Shaun Walker</authors>
|
<authors>Shaun Walker</authors>
|
||||||
<owners>.NET Foundation</owners>
|
<owners>.NET Foundation</owners>
|
||||||
<title>Oqtane Framework</title>
|
<title>Oqtane Framework</title>
|
||||||
@ -13,16 +13,11 @@
|
|||||||
<projectUrl>https://github.com/oqtane/oqtane.framework</projectUrl>
|
<projectUrl>https://github.com/oqtane/oqtane.framework</projectUrl>
|
||||||
<iconUrl>https://www.oqtane.org/Portals/0/icon.jpg</iconUrl>
|
<iconUrl>https://www.oqtane.org/Portals/0/icon.jpg</iconUrl>
|
||||||
<tags>oqtane framework</tags>
|
<tags>oqtane framework</tags>
|
||||||
<releaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v1.0.2</releaseNotes>
|
<releaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v1.0.4</releaseNotes>
|
||||||
<summary>A modular application framework for Blazor</summary>
|
<summary>A modular application framework for Blazor</summary>
|
||||||
</metadata>
|
</metadata>
|
||||||
<files>
|
<files>
|
||||||
<file src="..\Oqtane.Client\bin\Release\netstandard2.1\Oqtane.Client.dll" target="lib\netcoreapp3.1" />
|
<file src="..\Oqtane.Server\bin\Release\netcoreapp3.1\publish\*.*" target="lib\netcoreapp3.1" />
|
||||||
<file src="..\Oqtane.Client\bin\Release\netstandard2.1\Oqtane.Client.pdb" target="lib\netcoreapp3.1" />
|
<file src="..\Oqtane.Server\bin\Release\netcoreapp3.1\publish\wwwroot\**\*.*" target="wwwroot" />
|
||||||
<file src="..\Oqtane.Server\bin\Release\netcoreapp3.1\Oqtane.Server.dll" target="lib\netcoreapp3.1" />
|
|
||||||
<file src="..\Oqtane.Server\bin\Release\netcoreapp3.1\Oqtane.Server.pdb" target="lib\netcoreapp3.1" />
|
|
||||||
<file src="..\Oqtane.Shared\bin\Release\netstandard2.1\Oqtane.Shared.dll" target="lib\netcoreapp3.1" />
|
|
||||||
<file src="..\Oqtane.Shared\bin\Release\netstandard2.1\Oqtane.Shared.pdb" target="lib\netcoreapp3.1" />
|
|
||||||
<file src="..\Oqtane.Server\wwwroot\**\*.*" target="wwwroot" />
|
|
||||||
</files>
|
</files>
|
||||||
</package>
|
</package>
|
@ -2,7 +2,7 @@
|
|||||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>Oqtane.Server</id>
|
<id>Oqtane.Server</id>
|
||||||
<version>1.0.2</version>
|
<version>1.0.4</version>
|
||||||
<authors>Shaun Walker</authors>
|
<authors>Shaun Walker</authors>
|
||||||
<owners>.NET Foundation</owners>
|
<owners>.NET Foundation</owners>
|
||||||
<title>Oqtane Framework</title>
|
<title>Oqtane Framework</title>
|
||||||
@ -13,7 +13,7 @@
|
|||||||
<projectUrl>https://github.com/oqtane/oqtane.framework</projectUrl>
|
<projectUrl>https://github.com/oqtane/oqtane.framework</projectUrl>
|
||||||
<iconUrl>https://www.oqtane.org/Portals/0/icon.jpg</iconUrl>
|
<iconUrl>https://www.oqtane.org/Portals/0/icon.jpg</iconUrl>
|
||||||
<tags>oqtane</tags>
|
<tags>oqtane</tags>
|
||||||
<releaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v1.0.2</releaseNotes>
|
<releaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v1.0.4</releaseNotes>
|
||||||
<summary>A modular application framework for Blazor</summary>
|
<summary>A modular application framework for Blazor</summary>
|
||||||
</metadata>
|
</metadata>
|
||||||
<files>
|
<files>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>Oqtane.Shared</id>
|
<id>Oqtane.Shared</id>
|
||||||
<version>1.0.2</version>
|
<version>1.0.4</version>
|
||||||
<authors>Shaun Walker</authors>
|
<authors>Shaun Walker</authors>
|
||||||
<owners>.NET Foundation</owners>
|
<owners>.NET Foundation</owners>
|
||||||
<title>Oqtane Framework</title>
|
<title>Oqtane Framework</title>
|
||||||
@ -13,7 +13,7 @@
|
|||||||
<projectUrl>https://github.com/oqtane/oqtane.framework</projectUrl>
|
<projectUrl>https://github.com/oqtane/oqtane.framework</projectUrl>
|
||||||
<iconUrl>https://www.oqtane.org/Portals/0/icon.jpg</iconUrl>
|
<iconUrl>https://www.oqtane.org/Portals/0/icon.jpg</iconUrl>
|
||||||
<tags>oqtane</tags>
|
<tags>oqtane</tags>
|
||||||
<releaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v1.0.2</releaseNotes>
|
<releaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v1.0.4</releaseNotes>
|
||||||
<summary>A modular application framework for Blazor</summary>
|
<summary>A modular application framework for Blazor</summary>
|
||||||
</metadata>
|
</metadata>
|
||||||
<files>
|
<files>
|
||||||
|
1
Oqtane.Package/install.ps1
Normal file
1
Oqtane.Package/install.ps1
Normal file
@ -0,0 +1 @@
|
|||||||
|
Compress-Archive -Path "..\Oqtane.Server\bin\Release\netcoreapp3.1\publish\*" -DestinationPath "..\Oqtane.Server\bin\Release\Oqtane.Framework.1.0.4.Install.zip" -Force
|
Binary file not shown.
@ -1,7 +1,18 @@
|
|||||||
DEL "*.nupkg"
|
del "*.nupkg"
|
||||||
dotnet clean -c Release ..\Oqtane.sln
|
dotnet clean -c Release ..\Oqtane.sln
|
||||||
dotnet build -c Release ..\Oqtane.sln
|
dotnet build -c Release ..\Oqtane.sln
|
||||||
nuget.exe pack Oqtane.Framework.nuspec
|
|
||||||
nuget.exe pack Oqtane.Client.nuspec
|
nuget.exe pack Oqtane.Client.nuspec
|
||||||
nuget.exe pack Oqtane.Server.nuspec
|
nuget.exe pack Oqtane.Server.nuspec
|
||||||
nuget.exe pack Oqtane.Shared.nuspec
|
nuget.exe pack Oqtane.Shared.nuspec
|
||||||
|
del /F/Q/S "..\Oqtane.Server\bin\Release\netcoreapp3.1\publish" > NUL
|
||||||
|
rmdir /Q/S "..\Oqtane.Server\bin\Release\netcoreapp3.1\publish"
|
||||||
|
dotnet publish ..\Oqtane.Server\Oqtane.Server.csproj /p:Configuration=Release
|
||||||
|
del "..\Oqtane.Server\bin\Release\netcoreapp3.1\publish\appsettings.json"
|
||||||
|
ren "..\Oqtane.Server\bin\Release\netcoreapp3.1\publish\appsettings.release.json" "appsettings.json"
|
||||||
|
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe ".\install.ps1"
|
||||||
|
del "..\Oqtane.Server\bin\Release\netcoreapp3.1\publish\appsettings.json"
|
||||||
|
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe ".\upgrade.ps1"
|
||||||
|
del "..\Oqtane.Server\bin\Release\netcoreapp3.1\publish\Oqtane.Upgrade.*"
|
||||||
|
nuget.exe pack Oqtane.Framework.nuspec
|
||||||
|
|
||||||
|
|
||||||
|
1
Oqtane.Package/upgrade.ps1
Normal file
1
Oqtane.Package/upgrade.ps1
Normal file
@ -0,0 +1 @@
|
|||||||
|
Compress-Archive -Path "..\Oqtane.Server\bin\Release\netcoreapp3.1\publish\*" -DestinationPath "..\Oqtane.Server\bin\Release\Oqtane.Framework.1.0.4.Upgrade.zip" -Force
|
@ -135,8 +135,20 @@ namespace Oqtane.Controllers
|
|||||||
[Authorize(Roles = Constants.RegisteredRole)]
|
[Authorize(Roles = Constants.RegisteredRole)]
|
||||||
public Models.File Put(int id, [FromBody] Models.File file)
|
public Models.File Put(int id, [FromBody] Models.File file)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, EntityNames.Folder, file.Folder.FolderId, PermissionNames.Edit))
|
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, EntityNames.Folder, file.FolderId, PermissionNames.Edit))
|
||||||
{
|
{
|
||||||
|
file.Folder = _folders.GetFolder(file.FolderId);
|
||||||
|
Models.File _file = _files.GetFile(id, false);
|
||||||
|
if (_file.Name != file.Name || _file.FolderId != file.FolderId)
|
||||||
|
{
|
||||||
|
string folderpath = GetFolderPath(file.Folder);
|
||||||
|
if (!Directory.Exists(folderpath))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(folderpath);
|
||||||
|
}
|
||||||
|
System.IO.File.Move(Path.Combine(GetFolderPath(_file.Folder), _file.Name), Path.Combine(folderpath, file.Name));
|
||||||
|
}
|
||||||
|
file.Extension = Path.GetExtension(file.Name).ToLower().Replace(".", "");
|
||||||
file = _files.UpdateFile(file);
|
file = _files.UpdateFile(file);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Update, "File Updated {File}", file);
|
_logger.Log(LogLevel.Information, this, LogFunction.Update, "File Updated {File}", file);
|
||||||
}
|
}
|
||||||
|
@ -11,20 +11,25 @@ using Oqtane.Extensions;
|
|||||||
using Oqtane.Infrastructure;
|
using Oqtane.Infrastructure;
|
||||||
using Oqtane.Repository;
|
using Oqtane.Repository;
|
||||||
using Oqtane.Security;
|
using Oqtane.Security;
|
||||||
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
|
||||||
namespace Oqtane.Controllers
|
namespace Oqtane.Controllers
|
||||||
{
|
{
|
||||||
[Route("{alias}/api/[controller]")]
|
[Route("{alias}/api/[controller]")]
|
||||||
public class FolderController : Controller
|
public class FolderController : Controller
|
||||||
{
|
{
|
||||||
|
private readonly IWebHostEnvironment _environment;
|
||||||
private readonly IFolderRepository _folders;
|
private readonly IFolderRepository _folders;
|
||||||
private readonly IUserPermissions _userPermissions;
|
private readonly IUserPermissions _userPermissions;
|
||||||
|
private readonly ITenantResolver _tenants;
|
||||||
private readonly ILogManager _logger;
|
private readonly ILogManager _logger;
|
||||||
|
|
||||||
public FolderController(IFolderRepository folders, IUserPermissions userPermissions, ILogManager logger)
|
public FolderController(IWebHostEnvironment environment, IFolderRepository folders, IUserPermissions userPermissions, ITenantResolver tenants, ILogManager logger)
|
||||||
{
|
{
|
||||||
|
_environment = environment;
|
||||||
_folders = folders;
|
_folders = folders;
|
||||||
_userPermissions = userPermissions;
|
_userPermissions = userPermissions;
|
||||||
|
_tenants = tenants;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,12 +148,19 @@ namespace Oqtane.Controllers
|
|||||||
{
|
{
|
||||||
if (folder.IsPathValid())
|
if (folder.IsPathValid())
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(folder.Path) && folder.ParentId != null)
|
if (folder.ParentId != null)
|
||||||
{
|
{
|
||||||
Folder parent = _folders.GetFolder(folder.ParentId.Value);
|
Folder parent = _folders.GetFolder(folder.ParentId.Value);
|
||||||
folder.Path = Utilities.PathCombine(parent.Path, folder.Name);
|
folder.Path = Utilities.PathCombine(parent.Path, folder.Name);
|
||||||
}
|
}
|
||||||
folder.Path = Utilities.PathCombine(folder.Path, Path.DirectorySeparatorChar.ToString());
|
folder.Path = Utilities.PathCombine(folder.Path, Path.DirectorySeparatorChar.ToString());
|
||||||
|
|
||||||
|
Models.Folder _folder = _folders.GetFolder(id, false);
|
||||||
|
if (_folder.Path != folder.Path && Directory.Exists(GetFolderPath(_folder)))
|
||||||
|
{
|
||||||
|
Directory.Move(GetFolderPath(_folder), GetFolderPath(folder));
|
||||||
|
}
|
||||||
|
|
||||||
folder = _folders.UpdateFolder(folder);
|
folder = _folders.UpdateFolder(folder);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Update, "Folder Updated {Folder}", folder);
|
_logger.Log(LogLevel.Information, this, LogFunction.Update, "Folder Updated {Folder}", folder);
|
||||||
}
|
}
|
||||||
@ -202,6 +214,11 @@ namespace Oqtane.Controllers
|
|||||||
{
|
{
|
||||||
if (_userPermissions.IsAuthorized(User, EntityNames.Folder, id, PermissionNames.Edit))
|
if (_userPermissions.IsAuthorized(User, EntityNames.Folder, id, PermissionNames.Edit))
|
||||||
{
|
{
|
||||||
|
Models.Folder _folder = _folders.GetFolder(id, false);
|
||||||
|
if (Directory.Exists(GetFolderPath(_folder)))
|
||||||
|
{
|
||||||
|
Directory.Delete(GetFolderPath(_folder));
|
||||||
|
}
|
||||||
_folders.DeleteFolder(id);
|
_folders.DeleteFolder(id);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Folder Deleted {FolderId}", id);
|
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Folder Deleted {FolderId}", id);
|
||||||
}
|
}
|
||||||
@ -211,5 +228,10 @@ namespace Oqtane.Controllers
|
|||||||
HttpContext.Response.StatusCode = 401;
|
HttpContext.Response.StatusCode = 401;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string GetFolderPath(Folder folder)
|
||||||
|
{
|
||||||
|
return Utilities.PathCombine(_environment.ContentRootPath, "Content", "Tenants", _tenants.GetTenant().TenantId.ToString(), "Sites", folder.SiteId.ToString(), folder.Path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ using System;
|
|||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
namespace Oqtane.Controllers
|
namespace Oqtane.Controllers
|
||||||
{
|
{
|
||||||
@ -94,8 +95,8 @@ namespace Oqtane.Controllers
|
|||||||
[Authorize(Roles = Constants.HostRole)]
|
[Authorize(Roles = Constants.HostRole)]
|
||||||
public void InstallModules()
|
public void InstallModules()
|
||||||
{
|
{
|
||||||
_installationManager.InstallPackages("Modules", true);
|
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Create, "Modules Installed");
|
_logger.Log(LogLevel.Information, this, LogFunction.Create, "Modules Installed");
|
||||||
|
_installationManager.InstallPackages("Modules", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// DELETE api/<controller>/5?siteid=x
|
// DELETE api/<controller>/5?siteid=x
|
||||||
@ -110,6 +111,7 @@ namespace Oqtane.Controllers
|
|||||||
{
|
{
|
||||||
Type moduletype = Type.GetType(moduledefinition.ServerManagerType);
|
Type moduletype = Type.GetType(moduledefinition.ServerManagerType);
|
||||||
|
|
||||||
|
// execute uninstall logic
|
||||||
foreach (Tenant tenant in _tenants.GetTenants())
|
foreach (Tenant tenant in _tenants.GetTenants())
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -131,24 +133,27 @@ namespace Oqtane.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// use assets.json to clean up file resources
|
||||||
|
string assetfilepath = Path.Combine(_environment.WebRootPath, "Modules", Utilities.GetTypeName(moduledefinition.ModuleDefinitionName), "assets.json");
|
||||||
|
if (System.IO.File.Exists(assetfilepath))
|
||||||
|
{
|
||||||
|
List<string> assets = JsonSerializer.Deserialize<List<string>>(System.IO.File.ReadAllText(assetfilepath));
|
||||||
|
foreach(string asset in assets)
|
||||||
|
{
|
||||||
|
if (System.IO.File.Exists(asset))
|
||||||
|
{
|
||||||
|
System.IO.File.Delete(asset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Module Assets Removed For {ModuleDefinitionName}", moduledefinition.ModuleDefinitionName);
|
||||||
|
}
|
||||||
|
|
||||||
// clean up module static resource folder
|
// clean up module static resource folder
|
||||||
string folder = Path.Combine(_environment.WebRootPath, Path.Combine("Modules", Utilities.GetTypeName(moduledefinition.ModuleDefinitionName)));
|
string folder = Path.Combine(_environment.WebRootPath, Path.Combine("Modules", Utilities.GetTypeName(moduledefinition.ModuleDefinitionName)));
|
||||||
if (Directory.Exists(folder))
|
if (Directory.Exists(folder))
|
||||||
{
|
{
|
||||||
Directory.Delete(folder, true);
|
Directory.Delete(folder, true);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Module Static Resources Removed For {ModuleDefinitionName}", moduledefinition.ModuleDefinitionName);
|
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Module Resources Folder Removed For {ModuleDefinitionName}", moduledefinition.ModuleDefinitionName);
|
||||||
}
|
|
||||||
|
|
||||||
// get root assembly name ( note that this only works if modules follow a specific naming convention for their assemblies )
|
|
||||||
string assemblyname = Utilities.GetAssemblyName(moduledefinition.ModuleDefinitionName).ToLower();
|
|
||||||
assemblyname = assemblyname.Replace(".client", "").Replace(".oqtane", "");
|
|
||||||
|
|
||||||
// remove module assemblies from /bin
|
|
||||||
string binfolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
|
|
||||||
foreach (string file in Directory.EnumerateFiles(binfolder, assemblyname + "*.*"))
|
|
||||||
{
|
|
||||||
System.IO.File.Delete(file);
|
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Module Assembly {Filename} Removed For {ModuleDefinitionName}", file, moduledefinition.ModuleDefinitionName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove module definition
|
// remove module definition
|
||||||
@ -175,14 +180,14 @@ namespace Oqtane.Controllers
|
|||||||
if (moduleDefinition.Template == "internal")
|
if (moduleDefinition.Template == "internal")
|
||||||
{
|
{
|
||||||
rootPath = Utilities.PathCombine(rootFolder.FullName,Path.DirectorySeparatorChar.ToString());
|
rootPath = Utilities.PathCombine(rootFolder.FullName,Path.DirectorySeparatorChar.ToString());
|
||||||
moduleDefinition.ModuleDefinitionName = moduleDefinition.Owner + "." + moduleDefinition.Name + "s, Oqtane.Client";
|
moduleDefinition.ModuleDefinitionName = moduleDefinition.Owner + "." + moduleDefinition.Name + ", Oqtane.Client";
|
||||||
moduleDefinition.ServerManagerType = moduleDefinition.Owner + "." + moduleDefinition.Name + "s.Manager." + moduleDefinition.Name + "Manager, Oqtane.Server";
|
moduleDefinition.ServerManagerType = moduleDefinition.Owner + "." + moduleDefinition.Name + ".Manager." + moduleDefinition.Name + "Manager, Oqtane.Server";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rootPath = Utilities.PathCombine(rootFolder.Parent.FullName , moduleDefinition.Owner + "." + moduleDefinition.Name + "s",Path.DirectorySeparatorChar.ToString());
|
rootPath = Utilities.PathCombine(rootFolder.Parent.FullName , moduleDefinition.Owner + "." + moduleDefinition.Name,Path.DirectorySeparatorChar.ToString());
|
||||||
moduleDefinition.ModuleDefinitionName = moduleDefinition.Owner + "." + moduleDefinition.Name + "s, " + moduleDefinition.Owner + "." + moduleDefinition.Name + "s.Client.Oqtane";
|
moduleDefinition.ModuleDefinitionName = moduleDefinition.Owner + "." + moduleDefinition.Name + ", " + moduleDefinition.Owner + "." + moduleDefinition.Name + ".Client.Oqtane";
|
||||||
moduleDefinition.ServerManagerType = moduleDefinition.Owner + "." + moduleDefinition.Name + "s.Manager." + moduleDefinition.Name + "Manager, " + moduleDefinition.Owner + "." + moduleDefinition.Name + "s.Server.Oqtane";
|
moduleDefinition.ServerManagerType = moduleDefinition.Owner + "." + moduleDefinition.Name + ".Manager." + moduleDefinition.Name + "Manager, " + moduleDefinition.Owner + "." + moduleDefinition.Name + ".Server.Oqtane";
|
||||||
}
|
}
|
||||||
|
|
||||||
ProcessTemplatesRecursively(new DirectoryInfo(templatePath), rootPath, rootFolder.Name, templatePath, moduleDefinition);
|
ProcessTemplatesRecursively(new DirectoryInfo(templatePath), rootPath, rootFolder.Name, templatePath, moduleDefinition);
|
||||||
@ -196,8 +201,8 @@ namespace Oqtane.Controllers
|
|||||||
{
|
{
|
||||||
// add embedded resources to project
|
// add embedded resources to project
|
||||||
List<string> resources = new List<string>();
|
List<string> resources = new List<string>();
|
||||||
resources.Add(Utilities.PathCombine("Modules", moduleDefinition.Owner + "." + moduleDefinition.Name + "s", "Scripts", moduleDefinition.Owner + "." + moduleDefinition.Name + "s.1.0.0.sql"));
|
resources.Add(Utilities.PathCombine("Modules", moduleDefinition.Owner + "." + moduleDefinition.Name, "Scripts", moduleDefinition.Owner + "." + moduleDefinition.Name + ".1.0.0.sql"));
|
||||||
resources.Add(Utilities.PathCombine("Modules", moduleDefinition.Owner + "." + moduleDefinition.Name + "s", "Scripts", moduleDefinition.Owner + "." + moduleDefinition.Name + "s.Uninstall.sql"));
|
resources.Add(Utilities.PathCombine("Modules", moduleDefinition.Owner + "." + moduleDefinition.Name, "Scripts", moduleDefinition.Owner + "." + moduleDefinition.Name + ".Uninstall.sql"));
|
||||||
EmbedResourceFiles(Utilities.PathCombine(rootPath, "Oqtane.Server", "Oqtane.Server.csproj"), resources);
|
EmbedResourceFiles(Utilities.PathCombine(rootPath, "Oqtane.Server", "Oqtane.Server.csproj"), resources);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,7 +240,20 @@ namespace Oqtane.Controllers
|
|||||||
text = text.Replace("[ServerManagerType]", moduleDefinition.ServerManagerType);
|
text = text.Replace("[ServerManagerType]", moduleDefinition.ServerManagerType);
|
||||||
text = text.Replace("[Folder]", folderPath);
|
text = text.Replace("[Folder]", folderPath);
|
||||||
text = text.Replace("[File]", Path.GetFileName(filePath));
|
text = text.Replace("[File]", Path.GetFileName(filePath));
|
||||||
|
if (moduleDefinition.Version == "local")
|
||||||
|
{
|
||||||
text = text.Replace("[FrameworkVersion]", Constants.Version);
|
text = text.Replace("[FrameworkVersion]", Constants.Version);
|
||||||
|
text = text.Replace("[ClientReference]", "<Reference Include=\"Oqtane.Client\"><HintPath>..\\..\\oqtane.framework\\Oqtane.Server\\bin\\Debug\\netcoreapp3.1\\Oqtane.Client.dll</HintPath></Reference>");
|
||||||
|
text = text.Replace("[ServerReference]", "<Reference Include=\"Oqtane.Server\"><HintPath>..\\..\\oqtane.framework\\Oqtane.Server\\bin\\Debug\\netcoreapp3.1\\Oqtane.Server.dll</HintPath></Reference>");
|
||||||
|
text = text.Replace("[SharedReference]", "<Reference Include=\"Oqtane.Shared\"><HintPath>..\\..\\oqtane.framework\\Oqtane.Server\\bin\\Debug\\netcoreapp3.1\\Oqtane.Shared.dll</HintPath></Reference>");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
text = text.Replace("[FrameworkVersion]", moduleDefinition.Version);
|
||||||
|
text = text.Replace("[ClientReference]", "<PackageReference Include=\"Oqtane.Client\" Version=\"" + moduleDefinition.Version + "\" />");
|
||||||
|
text = text.Replace("[ServerReference]", "<PackageReference Include=\"Oqtane.Server\" Version=\"" + moduleDefinition.Version + "\" />");
|
||||||
|
text = text.Replace("[SharedReference]", "<PackageReference Include=\"Oqtane.Shared\" Version=\"" + moduleDefinition.Version + "\" />");
|
||||||
|
}
|
||||||
System.IO.File.WriteAllText(filePath, text);
|
System.IO.File.WriteAllText(filePath, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ using Microsoft.AspNetCore.Hosting;
|
|||||||
using Oqtane.Enums;
|
using Oqtane.Enums;
|
||||||
using Oqtane.Infrastructure;
|
using Oqtane.Infrastructure;
|
||||||
using Oqtane.Repository;
|
using Oqtane.Repository;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
// ReSharper disable StringIndexOfIsCultureSpecific.1
|
// ReSharper disable StringIndexOfIsCultureSpecific.1
|
||||||
|
|
||||||
@ -43,8 +44,8 @@ namespace Oqtane.Controllers
|
|||||||
[Authorize(Roles = Constants.HostRole)]
|
[Authorize(Roles = Constants.HostRole)]
|
||||||
public void InstallThemes()
|
public void InstallThemes()
|
||||||
{
|
{
|
||||||
_installationManager.InstallPackages("Themes", true);
|
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Create, "Themes Installed");
|
_logger.Log(LogLevel.Information, this, LogFunction.Create, "Themes Installed");
|
||||||
|
_installationManager.InstallPackages("Themes", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// DELETE api/<controller>/xxx
|
// DELETE api/<controller>/xxx
|
||||||
@ -56,19 +57,29 @@ namespace Oqtane.Controllers
|
|||||||
Theme theme = themes.Where(item => item.ThemeName == themename).FirstOrDefault();
|
Theme theme = themes.Where(item => item.ThemeName == themename).FirstOrDefault();
|
||||||
if (theme != null && Utilities.GetAssemblyName(theme.ThemeName) != "Oqtane.Client")
|
if (theme != null && Utilities.GetAssemblyName(theme.ThemeName) != "Oqtane.Client")
|
||||||
{
|
{
|
||||||
|
// use assets.json to clean up file resources
|
||||||
|
string assetfilepath = Path.Combine(_environment.WebRootPath, "Modules", Utilities.GetTypeName(theme.ThemeName), "assets.json");
|
||||||
|
if (System.IO.File.Exists(assetfilepath))
|
||||||
|
{
|
||||||
|
List<string> assets = JsonSerializer.Deserialize<List<string>>(System.IO.File.ReadAllText(assetfilepath));
|
||||||
|
foreach (string asset in assets)
|
||||||
|
{
|
||||||
|
if (System.IO.File.Exists(asset))
|
||||||
|
{
|
||||||
|
System.IO.File.Delete(asset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Theme Assets Removed For {ThemeName}", theme.ThemeName);
|
||||||
|
}
|
||||||
|
|
||||||
// clean up theme static resource folder
|
// clean up theme static resource folder
|
||||||
string folder = Path.Combine(_environment.WebRootPath, "Themes" , Utilities.GetTypeName(theme.ThemeName));
|
string folder = Path.Combine(_environment.WebRootPath, "Themes" , Utilities.GetTypeName(theme.ThemeName));
|
||||||
if (Directory.Exists(folder))
|
if (Directory.Exists(folder))
|
||||||
{
|
{
|
||||||
Directory.Delete(folder, true);
|
Directory.Delete(folder, true);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Theme Static Resources Removed For {ThemeName}", theme.ThemeName);
|
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Theme Resource Folder Removed For {ThemeName}", theme.ThemeName);
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove theme assembly from /bin
|
|
||||||
string binfolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
|
|
||||||
System.IO.File.Delete(Path.Combine(binfolder, Utilities.GetAssemblyName(theme.ThemeName) + ".dll"));
|
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Theme Assembly {Filename} Removed For {ThemeName}", Utilities.GetAssemblyName(theme.ThemeName) + ".dll", themename);
|
|
||||||
|
|
||||||
_installationManager.RestartApplication();
|
_installationManager.RestartApplication();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -342,7 +342,8 @@ namespace Oqtane.Infrastructure
|
|||||||
if (!string.IsNullOrEmpty(moduledefinition.ReleaseVersions) && !string.IsNullOrEmpty(moduledefinition.ServerManagerType))
|
if (!string.IsNullOrEmpty(moduledefinition.ReleaseVersions) && !string.IsNullOrEmpty(moduledefinition.ServerManagerType))
|
||||||
{
|
{
|
||||||
Type moduletype = Type.GetType(moduledefinition.ServerManagerType);
|
Type moduletype = Type.GetType(moduledefinition.ServerManagerType);
|
||||||
|
if (moduletype != null)
|
||||||
|
{
|
||||||
string[] versions = moduledefinition.ReleaseVersions.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
string[] versions = moduledefinition.ReleaseVersions.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
using (var db = new InstallationContext(NormalizeConnectionString(_config.GetConnectionString(SettingKeys.ConnectionStringKey))))
|
using (var db = new InstallationContext(NormalizeConnectionString(_config.GetConnectionString(SettingKeys.ConnectionStringKey))))
|
||||||
{
|
{
|
||||||
@ -387,6 +388,7 @@ namespace Oqtane.Infrastructure
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(result.Message))
|
if (string.IsNullOrEmpty(result.Message))
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.IO.Compression;
|
using System.IO.Compression;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Text.Json;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.Extensions.Caching.Memory;
|
using Microsoft.Extensions.Caching.Memory;
|
||||||
@ -80,6 +82,8 @@ namespace Oqtane.Infrastructure
|
|||||||
// if compatible with framework version
|
// if compatible with framework version
|
||||||
if (frameworkversion == "" || Version.Parse(Constants.Version).CompareTo(Version.Parse(frameworkversion)) >= 0)
|
if (frameworkversion == "" || Version.Parse(Constants.Version).CompareTo(Version.Parse(frameworkversion)) >= 0)
|
||||||
{
|
{
|
||||||
|
List<string> assets = new List<string>();
|
||||||
|
|
||||||
// module and theme packages must be in form of name.1.0.0.nupkg
|
// module and theme packages must be in form of name.1.0.0.nupkg
|
||||||
string name = Path.GetFileNameWithoutExtension(packagename);
|
string name = Path.GetFileNameWithoutExtension(packagename);
|
||||||
string[] segments = name?.Split('.');
|
string[] segments = name?.Split('.');
|
||||||
@ -96,18 +100,32 @@ namespace Oqtane.Infrastructure
|
|||||||
case "lib":
|
case "lib":
|
||||||
filename = Path.Combine(binFolder, filename);
|
filename = Path.Combine(binFolder, filename);
|
||||||
ExtractFile(entry, filename);
|
ExtractFile(entry, filename);
|
||||||
|
assets.Add(filename);
|
||||||
break;
|
break;
|
||||||
case "wwwroot":
|
case "wwwroot":
|
||||||
filename = Path.Combine(webRootPath, Utilities.PathCombine(entry.FullName.Replace($"wwwroot/", "").Split('/')));
|
filename = Path.Combine(webRootPath.Replace(Path.DirectorySeparatorChar + "wwwroot", ""), Utilities.PathCombine(entry.FullName.Split('/')));
|
||||||
ExtractFile(entry, filename);
|
ExtractFile(entry, filename);
|
||||||
|
assets.Add(filename);
|
||||||
break;
|
break;
|
||||||
case "runtimes":
|
case "runtimes":
|
||||||
var destSubFolder = Path.GetDirectoryName(entry.FullName);
|
var destSubFolder = Path.GetDirectoryName(entry.FullName);
|
||||||
filename = Path.Combine(binFolder, destSubFolder, filename);
|
filename = Path.Combine(binFolder, destSubFolder, filename);
|
||||||
ExtractFile(entry, filename);
|
ExtractFile(entry, filename);
|
||||||
|
assets.Add(filename);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// save list of assets
|
||||||
|
if (assets.Count != 0)
|
||||||
|
{
|
||||||
|
string assetfilepath = Path.Combine(webRootPath, "Modules", name, "assets.json");
|
||||||
|
if (File.Exists(assetfilepath))
|
||||||
|
{
|
||||||
|
File.Delete(assetfilepath);
|
||||||
|
}
|
||||||
|
File.WriteAllText(assetfilepath, JsonSerializer.Serialize(assets));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,24 +144,14 @@ namespace Oqtane.Infrastructure
|
|||||||
{
|
{
|
||||||
Directory.CreateDirectory(Path.GetDirectoryName(filename));
|
Directory.CreateDirectory(Path.GetDirectoryName(filename));
|
||||||
}
|
}
|
||||||
if (!FileInUse(filename) == false)
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
entry.ExtractToFile(filename, true);
|
entry.ExtractToFile(filename, true);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
private static bool FileInUse(string path)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using (FileStream fs = new FileStream(path, FileMode.OpenOrCreate))
|
|
||||||
{
|
|
||||||
var flag = fs.CanWrite;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
return true;
|
// an error occurred extracting the file
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,12 +194,13 @@ namespace Oqtane.Infrastructure
|
|||||||
packageversion = node.InnerText;
|
packageversion = node.InnerText;
|
||||||
}
|
}
|
||||||
reader.Close();
|
reader.Close();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ensure package version is higher than current framework version
|
// ensure package version is greater than or equal to current framework version
|
||||||
if (packageversion != "" && Version.Parse(Constants.Version).CompareTo(Version.Parse(packageversion)) < 0)
|
if (packageversion != "" && Version.Parse(Constants.Version).CompareTo(Version.Parse(packageversion)) <= 0)
|
||||||
{
|
{
|
||||||
FinishUpgrade();
|
FinishUpgrade();
|
||||||
}
|
}
|
||||||
@ -202,28 +211,26 @@ namespace Oqtane.Infrastructure
|
|||||||
private void FinishUpgrade()
|
private void FinishUpgrade()
|
||||||
{
|
{
|
||||||
// check if upgrade application exists
|
// check if upgrade application exists
|
||||||
|
string Upgrader = "Oqtane.Upgrade.dll";
|
||||||
string folder = Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location);
|
string folder = Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location);
|
||||||
if (folder == null || !File.Exists(Path.Combine(folder, "Oqtane.Upgrade.exe"))) return;
|
if (folder == null || !File.Exists(Path.Combine(folder, Upgrader))) return;
|
||||||
|
|
||||||
// run upgrade application
|
// run upgrade application
|
||||||
var process = new Process
|
using (var process = new Process())
|
||||||
{
|
{
|
||||||
StartInfo =
|
process.StartInfo = new ProcessStartInfo
|
||||||
{
|
{
|
||||||
FileName = Path.Combine(folder, "Oqtane.Upgrade.exe"),
|
WorkingDirectory = folder,
|
||||||
Arguments = "\"" + _environment.ContentRootPath + "\" \"" + _environment.WebRootPath + "\"",
|
FileName = "dotnet",
|
||||||
ErrorDialog = false,
|
Arguments = Path.Combine(folder, Upgrader) + " \"" + _environment.ContentRootPath + "\" \"" + _environment.WebRootPath + "\"",
|
||||||
UseShellExecute = false,
|
UseShellExecute = false,
|
||||||
|
ErrorDialog = false,
|
||||||
CreateNoWindow = true,
|
CreateNoWindow = true,
|
||||||
RedirectStandardOutput = false,
|
RedirectStandardOutput = false,
|
||||||
RedirectStandardError = false
|
RedirectStandardError = false
|
||||||
}
|
|
||||||
};
|
};
|
||||||
process.Start();
|
process.Start();
|
||||||
process.Dispose();
|
};
|
||||||
|
|
||||||
// stop application so upgrade application can proceed
|
|
||||||
RestartApplication();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RestartApplication()
|
public void RestartApplication()
|
||||||
|
11
Oqtane.Server/Infrastructure/Interfaces/IHostResources.cs
Normal file
11
Oqtane.Server/Infrastructure/Interfaces/IHostResources.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
using Oqtane.Models;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Oqtane.Infrastructure
|
||||||
|
{
|
||||||
|
public interface IHostResources
|
||||||
|
{
|
||||||
|
List<Resource> Resources { get; } // identifies global resources for an application
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -4,7 +4,7 @@
|
|||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
<LangVersion>7.3</LangVersion>
|
<LangVersion>7.3</LangVersion>
|
||||||
<Configurations>Debug;Release</Configurations>
|
<Configurations>Debug;Release</Configurations>
|
||||||
<Version>1.0.2</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>
|
||||||
@ -13,7 +13,7 @@
|
|||||||
<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>https://github.com/oqtane/oqtane.framework/releases/tag/v1.0.2</PackageReleaseNotes>
|
<PackageReleaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v1.0.4</PackageReleaseNotes>
|
||||||
<RootNamespace>Oqtane</RootNamespace>
|
<RootNamespace>Oqtane</RootNamespace>
|
||||||
<IsPackable>true</IsPackable>
|
<IsPackable>true</IsPackable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
@ -22,9 +22,6 @@
|
|||||||
<Content Remove="wwwroot\Modules\Templates\**" />
|
<Content Remove="wwwroot\Modules\Templates\**" />
|
||||||
<EmbeddedResource Remove="wwwroot\Modules\Templates\**" />
|
<EmbeddedResource Remove="wwwroot\Modules\Templates\**" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<None Remove="Scripts\Tenant.01.00.02.01.sql" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="Scripts\Master.00.00.00.00.sql" />
|
<EmbeddedResource Include="Scripts\Master.00.00.00.00.sql" />
|
||||||
<EmbeddedResource Include="Scripts\Master.00.09.00.00.sql" />
|
<EmbeddedResource Include="Scripts\Master.00.09.00.00.sql" />
|
||||||
@ -52,5 +49,16 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Oqtane.Client\Oqtane.Client.csproj" />
|
<ProjectReference Include="..\Oqtane.Client\Oqtane.Client.csproj" />
|
||||||
<ProjectReference Include="..\Oqtane.Shared\Oqtane.Shared.csproj" />
|
<ProjectReference Include="..\Oqtane.Shared\Oqtane.Shared.csproj" />
|
||||||
|
<ProjectReference Include="..\Oqtane.Upgrade\Oqtane.Upgrade.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
<ItemGroup>
|
||||||
|
<UpgradeFiles Include="$(ProjectDir)bin\Release\netcoreapp3.1\Oqtane.Upgrade.deps.json" />
|
||||||
|
<UpgradeFiles Include="$(ProjectDir)bin\Release\netcoreapp3.1\Oqtane.Upgrade.dll" />
|
||||||
|
<UpgradeFiles Include="$(ProjectDir)bin\Release\netcoreapp3.1\Oqtane.Upgrade.pdb" />
|
||||||
|
<UpgradeFiles Include="$(ProjectDir)bin\Release\netcoreapp3.1\Oqtane.Upgrade.runtimeconfig.json" />
|
||||||
|
<TemplateFiles Include="$(ProjectDir)wwwroot\Modules\Templates\**\*.*" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Target Name="AddPayloadsFolder" AfterTargets="Publish">
|
||||||
|
<Copy SourceFiles="@(UpgradeFiles)" DestinationFiles="@(UpgradeFiles->'$(PublishDir)%(RecursiveDir)%(Filename)%(Extension)')" SkipUnchangedFiles="false" />
|
||||||
|
<Copy SourceFiles="@(TemplateFiles)" DestinationFiles="@(TemplateFiles->'$(PublishDir)wwwroot\Modules\Templates\%(RecursiveDir)%(Filename)%(Extension)')" SkipUnchangedFiles="false" />
|
||||||
|
</Target></Project>
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||||
@using Microsoft.Extensions.Configuration
|
@using Microsoft.Extensions.Configuration
|
||||||
@inject IConfiguration Configuration
|
@inject IConfiguration Configuration
|
||||||
|
@model Oqtane.Pages.HostModel
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
@ -16,6 +17,7 @@
|
|||||||
<link id="app-manifest" rel="manifest" />
|
<link id="app-manifest" rel="manifest" />
|
||||||
<link rel="stylesheet" href="css/app.css" />
|
<link rel="stylesheet" href="css/app.css" />
|
||||||
<script src="js/loadjs.min.js"></script>
|
<script src="js/loadjs.min.js"></script>
|
||||||
|
@Html.Raw(@Model.Resources)
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@(Html.AntiForgeryToken())
|
@(Html.AntiForgeryToken())
|
||||||
@ -30,7 +32,7 @@
|
|||||||
<environment include="Development">
|
<environment include="Development">
|
||||||
An unhandled exception has occurred. See browser dev tools for details.
|
An unhandled exception has occurred. See browser dev tools for details.
|
||||||
</environment>
|
</environment>
|
||||||
<a href="~/" class="reload">Reload</a>
|
<a href="" class="reload">Reload</a>
|
||||||
<a class="dismiss">🗙</a>
|
<a class="dismiss">🗙</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
62
Oqtane.Server/Pages/_Host.cshtml.cs
Normal file
62
Oqtane.Server/Pages/_Host.cshtml.cs
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
|
using Oqtane.Infrastructure;
|
||||||
|
using Oqtane.Shared;
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace Oqtane.Pages
|
||||||
|
{
|
||||||
|
public class HostModel : PageModel
|
||||||
|
{
|
||||||
|
public string Resources = "";
|
||||||
|
|
||||||
|
public void OnGet()
|
||||||
|
{
|
||||||
|
var assemblies = AppDomain.CurrentDomain.GetOqtaneAssemblies();
|
||||||
|
foreach (Assembly assembly in assemblies)
|
||||||
|
{
|
||||||
|
var types = assembly.GetTypes().Where(item => item.GetInterfaces().Contains(typeof(IHostResources)));
|
||||||
|
foreach (var type in types)
|
||||||
|
{
|
||||||
|
var obj = Activator.CreateInstance(type) as IHostResources;
|
||||||
|
foreach (var resource in obj.Resources)
|
||||||
|
{
|
||||||
|
switch (resource.ResourceType)
|
||||||
|
{
|
||||||
|
case ResourceType.Stylesheet:
|
||||||
|
Resources += "<link rel=\"stylesheet\" href=\"" + resource.Url + "\"" + CrossOrigin(resource.CrossOrigin) + Integrity(resource.Integrity) + " />" + Environment.NewLine;
|
||||||
|
break;
|
||||||
|
case ResourceType.Script:
|
||||||
|
Resources += "<script src=\"" + resource.Url + "\"" + CrossOrigin(resource.CrossOrigin) + Integrity(resource.Integrity) + "></script>" + Environment.NewLine;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string CrossOrigin(string crossorigin)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(crossorigin))
|
||||||
|
{
|
||||||
|
return " crossorigin=\"" + crossorigin + "\"";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private string Integrity(string integrity)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(integrity))
|
||||||
|
{
|
||||||
|
return " integrity=\"" + integrity + "\"";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -45,7 +45,21 @@ namespace Oqtane.Repository
|
|||||||
|
|
||||||
public File GetFile(int fileId)
|
public File GetFile(int fileId)
|
||||||
{
|
{
|
||||||
File file = _db.File.Where(item => item.FileId == fileId).Include(item => item.Folder).FirstOrDefault();
|
return GetFile(fileId, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public File GetFile(int fileId, bool tracking)
|
||||||
|
{
|
||||||
|
File file;
|
||||||
|
if (tracking)
|
||||||
|
{
|
||||||
|
file = _db.File.Where(item => item.FileId == fileId).Include(item => item.Folder).FirstOrDefault();
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
file = _db.File.AsNoTracking().Where(item => item.FileId == fileId).Include(item => item.Folder).FirstOrDefault();
|
||||||
|
}
|
||||||
if (file != null)
|
if (file != null)
|
||||||
{
|
{
|
||||||
IEnumerable<Permission> permissions = _permissions.GetPermissions(EntityNames.Folder, file.FolderId).ToList();
|
IEnumerable<Permission> permissions = _permissions.GetPermissions(EntityNames.Folder, file.FolderId).ToList();
|
||||||
|
@ -47,7 +47,20 @@ namespace Oqtane.Repository
|
|||||||
|
|
||||||
public Folder GetFolder(int folderId)
|
public Folder GetFolder(int folderId)
|
||||||
{
|
{
|
||||||
Folder folder = _db.Folder.Find(folderId);
|
return GetFolder(folderId, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Folder GetFolder(int folderId, bool tracking)
|
||||||
|
{
|
||||||
|
Folder folder;
|
||||||
|
if (tracking)
|
||||||
|
{
|
||||||
|
folder = _db.Folder.Where(item => item.FolderId == folderId).FirstOrDefault();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
folder = _db.Folder.AsNoTracking().Where(item => item.FolderId == folderId).FirstOrDefault();
|
||||||
|
}
|
||||||
if (folder != null)
|
if (folder != null)
|
||||||
{
|
{
|
||||||
folder.Permissions = _permissions.GetPermissionString(EntityNames.Folder, folder.FolderId);
|
folder.Permissions = _permissions.GetPermissionString(EntityNames.Folder, folder.FolderId);
|
||||||
|
@ -9,6 +9,7 @@ namespace Oqtane.Repository
|
|||||||
File AddFile(File file);
|
File AddFile(File file);
|
||||||
File UpdateFile(File file);
|
File UpdateFile(File file);
|
||||||
File GetFile(int fileId);
|
File GetFile(int fileId);
|
||||||
|
File GetFile(int fileId, bool tracking);
|
||||||
void DeleteFile(int fileId);
|
void DeleteFile(int fileId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ namespace Oqtane.Repository
|
|||||||
Folder AddFolder(Folder folder);
|
Folder AddFolder(Folder folder);
|
||||||
Folder UpdateFolder(Folder folder);
|
Folder UpdateFolder(Folder folder);
|
||||||
Folder GetFolder(int folderId);
|
Folder GetFolder(int folderId);
|
||||||
|
Folder GetFolder(int folderId, bool tracking);
|
||||||
Folder GetFolder(int siteId, string path);
|
Folder GetFolder(int siteId, string path);
|
||||||
void DeleteFolder(int folderId);
|
void DeleteFolder(int folderId);
|
||||||
}
|
}
|
||||||
|
3
Oqtane.Server/Scripts/Tenant.01.00.04.01.sql
Normal file
3
Oqtane.Server/Scripts/Tenant.01.00.04.01.sql
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
ALTER TABLE [dbo].[Page]
|
||||||
|
ALTER COLUMN [Path] [nvarchar](256) NOT NULL
|
||||||
|
GO
|
15
Oqtane.Server/appsettings.release.json
Normal file
15
Oqtane.Server/appsettings.release.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"Runtime": "Server",
|
||||||
|
"ConnectionStrings": {
|
||||||
|
"DefaultConnection": ""
|
||||||
|
},
|
||||||
|
"Installation": {
|
||||||
|
"DefaultAlias": "",
|
||||||
|
"HostPassword": "",
|
||||||
|
"HostEmail": "",
|
||||||
|
"SiteTemplate": "",
|
||||||
|
"DefaultTheme": "",
|
||||||
|
"DefaultLayout": "",
|
||||||
|
"DefaultContainer": ""
|
||||||
|
}
|
||||||
|
}
|
@ -1,8 +1,8 @@
|
|||||||
@using Oqtane.Modules.Controls
|
@using Oqtane.Modules.Controls
|
||||||
@using [Owner].[Module]s.Services
|
@using [Owner].[Module].Services
|
||||||
@using [Owner].[Module]s.Models
|
@using [Owner].[Module].Models
|
||||||
|
|
||||||
@namespace [Owner].[Module]s
|
@namespace [Owner].[Module]
|
||||||
@inherits ModuleBase
|
@inherits ModuleBase
|
||||||
@inject I[Module]Service [Module]Service
|
@inject I[Module]Service [Module]Service
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
@ -10,10 +10,10 @@
|
|||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label class="control-label">Name: </label>
|
<Label For="name" HelpText="Enter a name">Name: </Label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input id="_name" class="form-control" @bind="@_name" />
|
<input id="name" class="form-control" @bind="@_name" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@ -31,6 +31,8 @@
|
|||||||
|
|
||||||
public override string Actions => "Add,Edit";
|
public override string Actions => "Add,Edit";
|
||||||
|
|
||||||
|
public override string Title => "Manage [Module]";
|
||||||
|
|
||||||
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" }
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
@using [Owner].[Module]s.Services
|
@using [Owner].[Module].Services
|
||||||
@using [Owner].[Module]s.Models
|
@using [Owner].[Module].Models
|
||||||
|
|
||||||
@namespace [Owner].[Module]s
|
@namespace [Owner].[Module]
|
||||||
@inherits ModuleBase
|
@inherits ModuleBase
|
||||||
@inject I[Module]Service [Module]Service
|
@inject I[Module]Service [Module]Service
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
@ -17,16 +17,16 @@ else
|
|||||||
<br />
|
<br />
|
||||||
@if (@_[Module]s.Count != 0)
|
@if (@_[Module]s.Count != 0)
|
||||||
{
|
{
|
||||||
<Pager Items="@_[Module]s" Format="Grid">
|
<Pager Items="@_[Module]s">
|
||||||
<Header>
|
<Header>
|
||||||
<div class="col"><strong>[Module]s</strong></div>
|
<th style="width: 1px;"> </th>
|
||||||
|
<th style="width: 1px;"> </th>
|
||||||
|
<th>Name</th>
|
||||||
</Header>
|
</Header>
|
||||||
<Row>
|
<Row>
|
||||||
<div class="col">
|
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.[Module]Id.ToString())" /></td>
|
||||||
<ActionLink Action="Edit" Parameters="@($"id=" + context.[Module]Id.ToString())" />
|
<td><ActionDialog Header="Delete [Module]" Message="@("Are You Sure You Wish To Delete The " + context.Name + " [Module]?")" Action="Delete" Security="SecurityAccessLevel.Edit" Class="btn btn-danger" OnClick="@(async () => await Delete(context))" /></td>
|
||||||
<ActionDialog Header="Delete [Module]" Message="@("Are You Sure You Wish To Delete The " + context.Name + " [Module]?")" Action="Delete" Security="SecurityAccessLevel.Edit" Class="btn btn-danger" OnClick="@(async () => await Delete(context))" />
|
<td>@context.Name</td>
|
||||||
@context.Name
|
|
||||||
</div>
|
|
||||||
</Row>
|
</Row>
|
||||||
</Pager>
|
</Pager>
|
||||||
}
|
}
|
||||||
@ -41,7 +41,7 @@ else
|
|||||||
<hr />
|
<hr />
|
||||||
[Module] Module Created Successfully. Use Edit Mode To Add A [Module]. You Can Access The Files At The Following Locations:<br /><br />
|
[Module] Module Created Successfully. Use Edit Mode To Add A [Module]. You Can Access The Files At The Following Locations:<br /><br />
|
||||||
[RootPath]Client\<br />
|
[RootPath]Client\<br />
|
||||||
- [Owner].[Module]s.Client.csproj - client project<br />
|
- [Owner].[Module].Client.csproj - client project<br />
|
||||||
- _Imports.razor - global imports for module components<br />
|
- _Imports.razor - global imports for module components<br />
|
||||||
- Edit.razor - component for adding or editing content<br />
|
- Edit.razor - component for adding or editing content<br />
|
||||||
- Index.razor - main component for your module **the content you are reading is in this file**<br />
|
- Index.razor - main component for your module **the content you are reading is in this file**<br />
|
||||||
@ -50,22 +50,22 @@ else
|
|||||||
- Services\I[Module]Service.cs - interface for defining service API methods<br />
|
- Services\I[Module]Service.cs - interface for defining service API methods<br />
|
||||||
- Services\[Module]Service.cs - implements service API interface methods<br /><br />
|
- Services\[Module]Service.cs - implements service API interface methods<br /><br />
|
||||||
[RootPath]Package\<br />
|
[RootPath]Package\<br />
|
||||||
- [Owner].[Module]s.nuspec - nuget manifest for packaging module<br />
|
- [Owner].[Module].nuspec - nuget manifest for packaging module<br />
|
||||||
- [Owner].[Module]s.Package.csproj - packaging project<br />
|
- [Owner].[Module].Package.csproj - packaging project<br />
|
||||||
- debug.cmd - copies assemblies to Oqtane bin folder when in Debug mode<br />
|
- debug.cmd - copies assemblies to Oqtane bin folder when in Debug mode<br />
|
||||||
- release.cmd - creates nuget package and deploys to Oqtane wwwroot/modules folder when in Release mode<br /><br />
|
- release.cmd - creates nuget package and deploys to Oqtane wwwroot/modules folder when in Release mode<br /><br />
|
||||||
[RootPath]Server\<br />
|
[RootPath]Server\<br />
|
||||||
- [Owner].[Module]s.Server.csproj - server project<br />
|
- [Owner].[Module].Server.csproj - server project<br />
|
||||||
- Controllers\[Module]Controller.cs - API methods implemented using a REST pattern<br />
|
- Controllers\[Module]Controller.cs - API methods implemented using a REST pattern<br />
|
||||||
- Manager\[Module]Manager.cs - implements optional module interfaces for features such as import/export of content<br />
|
- Manager\[Module]Manager.cs - implements optional module interfaces for features such as import/export of content<br />
|
||||||
- Repository\I[Module]Repository.cs - interface for defining repository methods<br />
|
- Repository\I[Module]Repository.cs - interface for defining repository methods<br />
|
||||||
- Repository\[Module]Respository.cs - implements repository interface methods for data access using EF Core<br />
|
- Repository\[Module]Respository.cs - implements repository interface methods for data access using EF Core<br />
|
||||||
- Repository\[Module]Context.cs - provides a DB Context for data access<br />
|
- Repository\[Module]Context.cs - provides a DB Context for data access<br />
|
||||||
- Scripts\[Owner].[Module]s.1.0.0.sql - database schema definition script<br />
|
- Scripts\[Owner].[Module].1.0.0.sql - database schema definition script<br />
|
||||||
- Scripts\[Owner].[Module]s.Uninstall.sql - database uninstall script<br />
|
- Scripts\[Owner].[Module].Uninstall.sql - database uninstall script<br />
|
||||||
- wwwroot\Module.css - module style sheet<br /><br />
|
- wwwroot\Module.css - module style sheet<br /><br />
|
||||||
[RootPath]Shared\<br />
|
[RootPath]Shared\<br />
|
||||||
- [Owner].[Module]s.csproj - shared project<br />
|
- [Owner].[Module].csproj - shared project<br />
|
||||||
- Models\[Module].cs - model definition<br /><br />
|
- Models\[Module].cs - model definition<br /><br />
|
||||||
|
|
||||||
<!-- The content above is for informational purposes only and can be safely removed -->
|
<!-- The content above is for informational purposes only and can be safely removed -->
|
||||||
@ -73,7 +73,8 @@ else
|
|||||||
@code {
|
@code {
|
||||||
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" },
|
||||||
|
new Resource { ResourceType = ResourceType.Script, Url = ModulePath() + "Module.js" }
|
||||||
};
|
};
|
||||||
|
|
||||||
List<[Module]> _[Module]s;
|
List<[Module]> _[Module]s;
|
||||||
|
15
Oqtane.Server/wwwroot/Modules/Templates/External/Client/Interop.cs
vendored
Normal file
15
Oqtane.Server/wwwroot/Modules/Templates/External/Client/Interop.cs
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using Microsoft.JSInterop;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace [Owner].[Module]
|
||||||
|
{
|
||||||
|
public class Interop
|
||||||
|
{
|
||||||
|
private readonly IJSRuntime _jsRuntime;
|
||||||
|
|
||||||
|
public Interop(IJSRuntime jsRuntime)
|
||||||
|
{
|
||||||
|
_jsRuntime = jsRuntime;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
using Oqtane.Models;
|
using Oqtane.Models;
|
||||||
using Oqtane.Modules;
|
using Oqtane.Modules;
|
||||||
|
|
||||||
namespace [Owner].[Module]s
|
namespace [Owner].[Module]
|
||||||
{
|
{
|
||||||
public class ModuleInfo : IModule
|
public class ModuleInfo : IModule
|
||||||
{
|
{
|
||||||
@ -12,7 +12,7 @@ namespace [Owner].[Module]s
|
|||||||
Version = "1.0.0",
|
Version = "1.0.0",
|
||||||
ServerManagerType = "[ServerManagerType]",
|
ServerManagerType = "[ServerManagerType]",
|
||||||
ReleaseVersions = "1.0.0",
|
ReleaseVersions = "1.0.0",
|
||||||
Dependencies = "[Owner].[Module]s.Shared.Oqtane"
|
Dependencies = "[Owner].[Module].Shared.Oqtane"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using [Owner].[Module]s.Models;
|
using [Owner].[Module].Models;
|
||||||
|
|
||||||
namespace [Owner].[Module]s.Services
|
namespace [Owner].[Module].Services
|
||||||
{
|
{
|
||||||
public interface I[Module]Service
|
public interface I[Module]Service
|
||||||
{
|
{
|
||||||
Task<List<[Module]>> Get[Module]sAsync(int ModuleId);
|
Task<List<Models.[Module]>> Get[Module]sAsync(int ModuleId);
|
||||||
|
|
||||||
Task<[Module]> Get[Module]Async(int [Module]Id, int ModuleId);
|
Task<Models.[Module]> Get[Module]Async(int [Module]Id, int ModuleId);
|
||||||
|
|
||||||
Task<[Module]> Add[Module]Async([Module] [Module]);
|
Task<Models.[Module]> Add[Module]Async(Models.[Module] [Module]);
|
||||||
|
|
||||||
Task<[Module]> Update[Module]Async([Module] [Module]);
|
Task<Models.[Module]> Update[Module]Async(Models.[Module] [Module]);
|
||||||
|
|
||||||
Task Delete[Module]Async(int [Module]Id, int ModuleId);
|
Task Delete[Module]Async(int [Module]Id, int ModuleId);
|
||||||
}
|
}
|
||||||
|
@ -5,9 +5,9 @@ using System.Threading.Tasks;
|
|||||||
using Oqtane.Modules;
|
using Oqtane.Modules;
|
||||||
using Oqtane.Services;
|
using Oqtane.Services;
|
||||||
using Oqtane.Shared;
|
using Oqtane.Shared;
|
||||||
using [Owner].[Module]s.Models;
|
using [Owner].[Module].Models;
|
||||||
|
|
||||||
namespace [Owner].[Module]s.Services
|
namespace [Owner].[Module].Services
|
||||||
{
|
{
|
||||||
public class [Module]Service : ServiceBase, I[Module]Service, IService
|
public class [Module]Service : ServiceBase, I[Module]Service, IService
|
||||||
{
|
{
|
||||||
@ -20,42 +20,30 @@ namespace [Owner].[Module]s.Services
|
|||||||
|
|
||||||
private string Apiurl => CreateApiUrl(_siteState.Alias, "[Module]");
|
private string Apiurl => CreateApiUrl(_siteState.Alias, "[Module]");
|
||||||
|
|
||||||
public async Task<List<[Module]>> Get[Module]sAsync(int ModuleId)
|
public async Task<List<Models.[Module]>> Get[Module]sAsync(int ModuleId)
|
||||||
{
|
{
|
||||||
List<[Module]> [Module]s = await GetJsonAsync<List<[Module]>>(CreateAuthPolicyUrl($"{Apiurl}?moduleid={ModuleId}", ModuleId));
|
List<Models.[Module]> [Module]s = await GetJsonAsync<List<Models.[Module]>>(CreateAuthorizationPolicyUrl($"{Apiurl}?moduleid={ModuleId}", ModuleId));
|
||||||
return [Module]s.OrderBy(item => item.Name).ToList();
|
return [Module]s.OrderBy(item => item.Name).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<[Module]> Get[Module]Async(int [Module]Id, int ModuleId)
|
public async Task<Models.[Module]> Get[Module]Async(int [Module]Id, int ModuleId)
|
||||||
{
|
{
|
||||||
return await GetJsonAsync<[Module]>(CreateAuthPolicyUrl($"{Apiurl}/{[Module]Id}", ModuleId));
|
return await GetJsonAsync<Models.[Module]>(CreateAuthorizationPolicyUrl($"{Apiurl}/{[Module]Id}", ModuleId));
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<[Module]> Add[Module]Async([Module] [Module])
|
public async Task<Models.[Module]> Add[Module]Async(Models.[Module] [Module])
|
||||||
{
|
{
|
||||||
return await PostJsonAsync<[Module]>(CreateAuthPolicyUrl($"{Apiurl}", [Module].ModuleId), [Module]);
|
return await PostJsonAsync<Models.[Module]>(CreateAuthorizationPolicyUrl($"{Apiurl}", [Module].ModuleId), [Module]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<[Module]> Update[Module]Async([Module] [Module])
|
public async Task<Models.[Module]> Update[Module]Async(Models.[Module] [Module])
|
||||||
{
|
{
|
||||||
return await PutJsonAsync<[Module]>(CreateAuthPolicyUrl($"{Apiurl}/{[Module].[Module]Id}", [Module].ModuleId), [Module]);
|
return await PutJsonAsync<Models.[Module]>(CreateAuthorizationPolicyUrl($"{Apiurl}/{[Module].[Module]Id}", [Module].ModuleId), [Module]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task Delete[Module]Async(int [Module]Id, int ModuleId)
|
public async Task Delete[Module]Async(int [Module]Id, int ModuleId)
|
||||||
{
|
{
|
||||||
await DeleteAsync(CreateAuthPolicyUrl($"{Apiurl}/{[Module]Id}", ModuleId));
|
await DeleteAsync(CreateAuthorizationPolicyUrl($"{Apiurl}/{[Module]Id}", ModuleId));
|
||||||
}
|
|
||||||
|
|
||||||
private string CreateAuthPolicyUrl(string Url, int ModuleId)
|
|
||||||
{
|
|
||||||
if (Url.Contains("?"))
|
|
||||||
{
|
|
||||||
return Url + "&entityid=" + ModuleId.ToString();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return Url + "?entityid=" + ModuleId.ToString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
@namespace [Owner].[Module]s
|
@namespace [Owner].[Module]
|
||||||
@inherits ModuleBase
|
@inherits ModuleBase
|
||||||
@inject ISettingService SettingService
|
@inject ISettingService SettingService
|
||||||
|
|
||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Setting" class="control-label">Setting: </label>
|
<Label For="value" HelpText="Enter a value">Name: </Label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" class="form-control" @bind="_value" />
|
<input id="value" type="text" class="form-control" @bind="@_value" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
@ -7,9 +7,9 @@
|
|||||||
<Authors>[Owner]</Authors>
|
<Authors>[Owner]</Authors>
|
||||||
<Company>[Owner]</Company>
|
<Company>[Owner]</Company>
|
||||||
<Description>[Description]</Description>
|
<Description>[Description]</Description>
|
||||||
<Product>[Owner].[Module]s</Product>
|
<Product>[Owner].[Module]</Product>
|
||||||
<Copyright>[Owner]</Copyright>
|
<Copyright>[Owner]</Copyright>
|
||||||
<AssemblyName>[Owner].[Module]s.Client.Oqtane</AssemblyName>
|
<AssemblyName>[Owner].[Module].Client.Oqtane</AssemblyName>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@ -21,12 +21,12 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Shared\[Owner].[Module]s.Shared.csproj" />
|
<ProjectReference Include="..\Shared\[Owner].[Module].Shared.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Oqtane.Client" Version="1.0.2" />
|
[ClientReference]
|
||||||
<PackageReference Include="Oqtane.Shared" Version="1.0.2" />
|
[SharedReference]
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
@ -6,9 +6,9 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Client\[Owner].[Module]s.Client.csproj" />
|
<ProjectReference Include="..\Client\[Owner].[Module].Client.csproj" />
|
||||||
<ProjectReference Include="..\Server\[Owner].[Module]s.Server.csproj" />
|
<ProjectReference Include="..\Server\[Owner].[Module].Server.csproj" />
|
||||||
<ProjectReference Include="..\Shared\[Owner].[Module]s.Shared.csproj" />
|
<ProjectReference Include="..\Shared\[Owner].[Module].Shared.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
@ -1,12 +1,12 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>[Owner].[Module]s</id>
|
<id>[Owner].[Module]</id>
|
||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
<authors>[Owner]</authors>
|
<authors>[Owner]</authors>
|
||||||
<owners>[Owner]</owners>
|
<owners>[Owner]</owners>
|
||||||
<title>[Module]s</title>
|
<title>[Module]</title>
|
||||||
<description>[Module]s</description>
|
<description>[Module]</description>
|
||||||
<copyright>[Owner]</copyright>
|
<copyright>[Owner]</copyright>
|
||||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||||
<license type="expression">MIT</license>
|
<license type="expression">MIT</license>
|
||||||
@ -20,12 +20,12 @@
|
|||||||
</dependencies>
|
</dependencies>
|
||||||
</metadata>
|
</metadata>
|
||||||
<files>
|
<files>
|
||||||
<file src="..\Client\bin\Release\netstandard2.1\[Owner].[Module]s.Client.Oqtane.dll" target="lib\netstandard2.1" />
|
<file src="..\Client\bin\Release\netstandard2.1\[Owner].[Module].Client.Oqtane.dll" target="lib\netstandard2.1" />
|
||||||
<file src="..\Client\bin\Release\netstandard2.1\[Owner].[Module]s.Client.Oqtane.pdb" target="lib\netstandard2.1" />
|
<file src="..\Client\bin\Release\netstandard2.1\[Owner].[Module].Client.Oqtane.pdb" target="lib\netstandard2.1" />
|
||||||
<file src="..\Server\bin\Release\netcoreapp3.1\[Owner].[Module]s.Server.Oqtane.dll" target="lib\netcoreapp3.1" />
|
<file src="..\Server\bin\Release\netcoreapp3.1\[Owner].[Module].Server.Oqtane.dll" target="lib\netcoreapp3.1" />
|
||||||
<file src="..\Server\bin\Release\netcoreapp3.1\[Owner].[Module]s.Server.Oqtane.pdb" target="lib\netcoreapp3.1" />
|
<file src="..\Server\bin\Release\netcoreapp3.1\[Owner].[Module].Server.Oqtane.pdb" target="lib\netcoreapp3.1" />
|
||||||
<file src="..\Shared\bin\Release\netstandard2.1\[Owner].[Module]s.Shared.Oqtane.dll" target="lib\netstandard2.1" />
|
<file src="..\Shared\bin\Release\netstandard2.1\[Owner].[Module].Shared.Oqtane.dll" target="lib\netstandard2.1" />
|
||||||
<file src="..\Shared\bin\Release\netstandard2.1\[Owner].[Module]s.Shared.Oqtane.pdb" target="lib\netstandard2.1" />
|
<file src="..\Shared\bin\Release\netstandard2.1\[Owner].[Module].Shared.Oqtane.pdb" target="lib\netstandard2.1" />
|
||||||
<file src="..\Server\wwwroot\**\*.*" target="wwwroot" />
|
<file src="..\Server\wwwroot\**\*.*" target="wwwroot" />
|
||||||
</files>
|
</files>
|
||||||
</package>
|
</package>
|
@ -1,7 +1,7 @@
|
|||||||
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].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 "..\Client\bin\Debug\netstandard2.1\[Owner].[Module].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].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 "..\Server\bin\Debug\netcoreapp3.1\[Owner].[Module].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].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
|
XCOPY "..\Shared\bin\Debug\netstandard2.1\[Owner].[Module].Shared.Oqtane.pdb" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y
|
||||||
XCOPY "..\Server\wwwroot\Modules\[Owner].[Module]s\*" "..\..\[RootFolder]\Oqtane.Server\wwwroot\Modules\[Owner].[Module]s\" /Y /S /I
|
XCOPY "..\Server\wwwroot\Modules\[Owner].[Module]\*" "..\..\[RootFolder]\Oqtane.Server\wwwroot\Modules\[Owner].[Module]\" /Y /S /I
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
"..\..\[RootFolder]\oqtane.package\nuget.exe" pack [Owner].[Module]s.nuspec
|
"..\..\[RootFolder]\oqtane.package\nuget.exe" pack [Owner].[Module].nuspec
|
||||||
XCOPY "*.nupkg" "..\..\[RootFolder]\Oqtane.Server\wwwroot\Modules\" /Y
|
XCOPY "*.nupkg" "..\..\[RootFolder]\Oqtane.Server\wwwroot\Modules\" /Y
|
||||||
|
@ -5,21 +5,21 @@ using Microsoft.AspNetCore.Http;
|
|||||||
using Oqtane.Shared;
|
using Oqtane.Shared;
|
||||||
using Oqtane.Enums;
|
using Oqtane.Enums;
|
||||||
using Oqtane.Infrastructure;
|
using Oqtane.Infrastructure;
|
||||||
using [Owner].[Module]s.Models;
|
using [Owner].[Module].Models;
|
||||||
using [Owner].[Module]s.Repository;
|
using [Owner].[Module].Repository;
|
||||||
|
|
||||||
namespace [Owner].[Module]s.Controllers
|
namespace [Owner].[Module].Controllers
|
||||||
{
|
{
|
||||||
[Route("{alias}/api/[controller]")]
|
[Route("{alias}/api/[controller]")]
|
||||||
public class [Module]Controller : Controller
|
public class [Module]Controller : Controller
|
||||||
{
|
{
|
||||||
private readonly I[Module]Repository _[Module]s;
|
private readonly I[Module]Repository _[Module]Repository;
|
||||||
private readonly ILogManager _logger;
|
private readonly ILogManager _logger;
|
||||||
protected int _entityId = -1;
|
protected int _entityId = -1;
|
||||||
|
|
||||||
public [Module]Controller(I[Module]Repository [Module]s, ILogManager logger, IHttpContextAccessor accessor)
|
public [Module]Controller(I[Module]Repository [Module]Repository, ILogManager logger, IHttpContextAccessor accessor)
|
||||||
{
|
{
|
||||||
_[Module]s = [Module]s;
|
_[Module]Repository = [Module]Repository;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
|
||||||
if (accessor.HttpContext.Request.Query.ContainsKey("entityid"))
|
if (accessor.HttpContext.Request.Query.ContainsKey("entityid"))
|
||||||
@ -31,17 +31,17 @@ namespace [Owner].[Module]s.Controllers
|
|||||||
// GET: api/<controller>?moduleid=x
|
// GET: api/<controller>?moduleid=x
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Authorize(Policy = "ViewModule")]
|
[Authorize(Policy = "ViewModule")]
|
||||||
public IEnumerable<[Module]> Get(string moduleid)
|
public IEnumerable<Models.[Module]> Get(string moduleid)
|
||||||
{
|
{
|
||||||
return _[Module]s.Get[Module]s(int.Parse(moduleid));
|
return _[Module]Repository.Get[Module]s(int.Parse(moduleid));
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET api/<controller>/5
|
// GET api/<controller>/5
|
||||||
[HttpGet("{id}")]
|
[HttpGet("{id}")]
|
||||||
[Authorize(Policy = "ViewModule")]
|
[Authorize(Policy = "ViewModule")]
|
||||||
public [Module] Get(int id)
|
public Models.[Module] Get(int id)
|
||||||
{
|
{
|
||||||
[Module] [Module] = _[Module]s.Get[Module](id);
|
Models.[Module] [Module] = _[Module]Repository.Get[Module](id);
|
||||||
if ([Module] != null && [Module].ModuleId != _entityId)
|
if ([Module] != null && [Module].ModuleId != _entityId)
|
||||||
{
|
{
|
||||||
[Module] = null;
|
[Module] = null;
|
||||||
@ -52,11 +52,11 @@ namespace [Owner].[Module]s.Controllers
|
|||||||
// POST api/<controller>
|
// POST api/<controller>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Authorize(Policy = "EditModule")]
|
[Authorize(Policy = "EditModule")]
|
||||||
public [Module] Post([FromBody] [Module] [Module])
|
public Models.[Module] Post([FromBody] Models.[Module] [Module])
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid && [Module].ModuleId == _entityId)
|
if (ModelState.IsValid && [Module].ModuleId == _entityId)
|
||||||
{
|
{
|
||||||
[Module] = _[Module]s.Add[Module]([Module]);
|
[Module] = _[Module]Repository.Add[Module]([Module]);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Create, "[Module] Added {[Module]}", [Module]);
|
_logger.Log(LogLevel.Information, this, LogFunction.Create, "[Module] Added {[Module]}", [Module]);
|
||||||
}
|
}
|
||||||
return [Module];
|
return [Module];
|
||||||
@ -65,11 +65,11 @@ namespace [Owner].[Module]s.Controllers
|
|||||||
// PUT api/<controller>/5
|
// PUT api/<controller>/5
|
||||||
[HttpPut("{id}")]
|
[HttpPut("{id}")]
|
||||||
[Authorize(Policy = "EditModule")]
|
[Authorize(Policy = "EditModule")]
|
||||||
public [Module] Put(int id, [FromBody] [Module] [Module])
|
public Models.[Module] Put(int id, [FromBody] Models.[Module] [Module])
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid && [Module].ModuleId == _entityId)
|
if (ModelState.IsValid && [Module].ModuleId == _entityId)
|
||||||
{
|
{
|
||||||
[Module] = _[Module]s.Update[Module]([Module]);
|
[Module] = _[Module]Repository.Update[Module]([Module]);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Update, "[Module] Updated {[Module]}", [Module]);
|
_logger.Log(LogLevel.Information, this, LogFunction.Update, "[Module] Updated {[Module]}", [Module]);
|
||||||
}
|
}
|
||||||
return [Module];
|
return [Module];
|
||||||
@ -80,10 +80,10 @@ namespace [Owner].[Module]s.Controllers
|
|||||||
[Authorize(Policy = "EditModule")]
|
[Authorize(Policy = "EditModule")]
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
[Module] [Module] = _[Module]s.Get[Module](id);
|
Models.[Module] [Module] = _[Module]Repository.Get[Module](id);
|
||||||
if ([Module] != null && [Module].ModuleId == _entityId)
|
if ([Module] != null && [Module].ModuleId == _entityId)
|
||||||
{
|
{
|
||||||
_[Module]s.Delete[Module](id);
|
_[Module]Repository.Delete[Module](id);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "[Module] Deleted {[Module]Id}", id);
|
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "[Module] Deleted {[Module]Id}", id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,36 +5,36 @@ using Oqtane.Modules;
|
|||||||
using Oqtane.Models;
|
using Oqtane.Models;
|
||||||
using Oqtane.Infrastructure;
|
using Oqtane.Infrastructure;
|
||||||
using Oqtane.Repository;
|
using Oqtane.Repository;
|
||||||
using [Owner].[Module]s.Models;
|
using [Owner].[Module].Models;
|
||||||
using [Owner].[Module]s.Repository;
|
using [Owner].[Module].Repository;
|
||||||
|
|
||||||
namespace [Owner].[Module]s.Manager
|
namespace [Owner].[Module].Manager
|
||||||
{
|
{
|
||||||
public class [Module]Manager : IInstallable, IPortable
|
public class [Module]Manager : IInstallable, IPortable
|
||||||
{
|
{
|
||||||
private I[Module]Repository _[Module]s;
|
private I[Module]Repository _[Module]Repository;
|
||||||
private ISqlRepository _sql;
|
private ISqlRepository _sql;
|
||||||
|
|
||||||
public [Module]Manager(I[Module]Repository [Module]s, ISqlRepository sql)
|
public [Module]Manager(I[Module]Repository [Module]Repository, ISqlRepository sql)
|
||||||
{
|
{
|
||||||
_[Module]s = [Module]s;
|
_[Module]Repository = [Module]Repository;
|
||||||
_sql = sql;
|
_sql = sql;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Install(Tenant tenant, string version)
|
public bool Install(Tenant tenant, string version)
|
||||||
{
|
{
|
||||||
return _sql.ExecuteScript(tenant, GetType().Assembly, "[Owner].[Module]s." + version + ".sql");
|
return _sql.ExecuteScript(tenant, GetType().Assembly, "[Owner].[Module]." + version + ".sql");
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Uninstall(Tenant tenant)
|
public bool Uninstall(Tenant tenant)
|
||||||
{
|
{
|
||||||
return _sql.ExecuteScript(tenant, GetType().Assembly, "[Owner].[Module]s.Uninstall.sql");
|
return _sql.ExecuteScript(tenant, GetType().Assembly, "[Owner].[Module].Uninstall.sql");
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ExportModule(Module module)
|
public string ExportModule(Module module)
|
||||||
{
|
{
|
||||||
string content = "";
|
string content = "";
|
||||||
List<[Module]> [Module]s = _[Module]s.Get[Module]s(module.ModuleId).ToList();
|
List<Models.[Module]> [Module]s = _[Module]Repository.Get[Module]s(module.ModuleId).ToList();
|
||||||
if ([Module]s != null)
|
if ([Module]s != null)
|
||||||
{
|
{
|
||||||
content = JsonSerializer.Serialize([Module]s);
|
content = JsonSerializer.Serialize([Module]s);
|
||||||
@ -44,19 +44,16 @@ namespace [Owner].[Module]s.Manager
|
|||||||
|
|
||||||
public void ImportModule(Module module, string content, string version)
|
public void ImportModule(Module module, string content, string version)
|
||||||
{
|
{
|
||||||
List<[Module]> [Module]s = null;
|
List<Models.[Module]> [Module]s = null;
|
||||||
if (!string.IsNullOrEmpty(content))
|
if (!string.IsNullOrEmpty(content))
|
||||||
{
|
{
|
||||||
[Module]s = JsonSerializer.Deserialize<List<[Module]>>(content);
|
[Module]s = JsonSerializer.Deserialize<List<Models.[Module]>>(content);
|
||||||
}
|
}
|
||||||
if ([Module]s != null)
|
if ([Module]s != null)
|
||||||
{
|
{
|
||||||
foreach([Module] [Module] in [Module]s)
|
foreach(var [Module] in [Module]s)
|
||||||
{
|
{
|
||||||
[Module] _[Module] = new [Module]();
|
_[Module]Repository.Add[Module](new Models.[Module] { ModuleId = module.ModuleId, Name = [Module].Name });
|
||||||
_[Module].ModuleId = module.ModuleId;
|
|
||||||
_[Module].Name = [Module].Name;
|
|
||||||
_[Module]s.Add[Module](_[Module]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using [Owner].[Module]s.Models;
|
using [Owner].[Module].Models;
|
||||||
|
|
||||||
namespace [Owner].[Module]s.Repository
|
namespace [Owner].[Module].Repository
|
||||||
{
|
{
|
||||||
public interface I[Module]Repository
|
public interface I[Module]Repository
|
||||||
{
|
{
|
||||||
IEnumerable<[Module]> Get[Module]s(int ModuleId);
|
IEnumerable<Models.[Module]> Get[Module]s(int ModuleId);
|
||||||
[Module] Get[Module](int [Module]Id);
|
Models.[Module] Get[Module](int [Module]Id);
|
||||||
[Module] Add[Module]([Module] [Module]);
|
Models.[Module] Add[Module](Models.[Module] [Module]);
|
||||||
[Module] Update[Module]([Module] [Module]);
|
Models.[Module] Update[Module](Models.[Module] [Module]);
|
||||||
void Delete[Module](int [Module]Id);
|
void Delete[Module](int [Module]Id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,13 +2,13 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Oqtane.Modules;
|
using Oqtane.Modules;
|
||||||
using Oqtane.Repository;
|
using Oqtane.Repository;
|
||||||
using [Owner].[Module]s.Models;
|
using [Owner].[Module].Models;
|
||||||
|
|
||||||
namespace [Owner].[Module]s.Repository
|
namespace [Owner].[Module].Repository
|
||||||
{
|
{
|
||||||
public class [Module]Context : DBContextBase, IService
|
public class [Module]Context : DBContextBase, IService
|
||||||
{
|
{
|
||||||
public virtual DbSet<[Module]> [Module] { get; set; }
|
public virtual DbSet<Models.[Module]> [Module] { get; set; }
|
||||||
|
|
||||||
public [Module]Context(ITenantResolver tenantResolver, IHttpContextAccessor accessor) : base(tenantResolver, accessor)
|
public [Module]Context(ITenantResolver tenantResolver, IHttpContextAccessor accessor) : base(tenantResolver, accessor)
|
||||||
{
|
{
|
||||||
|
@ -2,9 +2,9 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Oqtane.Modules;
|
using Oqtane.Modules;
|
||||||
using [Owner].[Module]s.Models;
|
using [Owner].[Module].Models;
|
||||||
|
|
||||||
namespace [Owner].[Module]s.Repository
|
namespace [Owner].[Module].Repository
|
||||||
{
|
{
|
||||||
public class [Module]Repository : I[Module]Repository, IService
|
public class [Module]Repository : I[Module]Repository, IService
|
||||||
{
|
{
|
||||||
@ -15,24 +15,24 @@ namespace [Owner].[Module]s.Repository
|
|||||||
_db = context;
|
_db = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<[Module]> Get[Module]s(int ModuleId)
|
public IEnumerable<Models.[Module]> Get[Module]s(int ModuleId)
|
||||||
{
|
{
|
||||||
return _db.[Module].Where(item => item.ModuleId == ModuleId);
|
return _db.[Module].Where(item => item.ModuleId == ModuleId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public [Module] Get[Module](int [Module]Id)
|
public Models.[Module] Get[Module](int [Module]Id)
|
||||||
{
|
{
|
||||||
return _db.[Module].Find([Module]Id);
|
return _db.[Module].Find([Module]Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public [Module] Add[Module]([Module] [Module])
|
public Models.[Module] Add[Module](Models.[Module] [Module])
|
||||||
{
|
{
|
||||||
_db.[Module].Add([Module]);
|
_db.[Module].Add([Module]);
|
||||||
_db.SaveChanges();
|
_db.SaveChanges();
|
||||||
return [Module];
|
return [Module];
|
||||||
}
|
}
|
||||||
|
|
||||||
public [Module] Update[Module]([Module] [Module])
|
public Models.[Module] Update[Module](Models.[Module] [Module])
|
||||||
{
|
{
|
||||||
_db.Entry([Module]).State = EntityState.Modified;
|
_db.Entry([Module]).State = EntityState.Modified;
|
||||||
_db.SaveChanges();
|
_db.SaveChanges();
|
||||||
@ -41,7 +41,7 @@ namespace [Owner].[Module]s.Repository
|
|||||||
|
|
||||||
public void Delete[Module](int [Module]Id)
|
public void Delete[Module](int [Module]Id)
|
||||||
{
|
{
|
||||||
[Module] [Module] = _db.[Module].Find([Module]Id);
|
Models.[Module] [Module] = _db.[Module].Find([Module]Id);
|
||||||
_db.[Module].Remove([Module]);
|
_db.[Module].Remove([Module]);
|
||||||
_db.SaveChanges();
|
_db.SaveChanges();
|
||||||
}
|
}
|
||||||
|
@ -5,17 +5,17 @@
|
|||||||
<LangVersion>7.3</LangVersion>
|
<LangVersion>7.3</LangVersion>
|
||||||
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
|
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
|
||||||
<Version>1.0.0</Version>
|
<Version>1.0.0</Version>
|
||||||
<Product>[Owner].[Module]s</Product>
|
<Product>[Owner].[Module]</Product>
|
||||||
<Authors>[Owner]</Authors>
|
<Authors>[Owner]</Authors>
|
||||||
<Company>[Owner]</Company>
|
<Company>[Owner]</Company>
|
||||||
<Description>[Description]</Description>
|
<Description>[Description]</Description>
|
||||||
<Copyright>[Owner]</Copyright>
|
<Copyright>[Owner]</Copyright>
|
||||||
<AssemblyName>[Owner].[Module]s.Server.Oqtane</AssemblyName>
|
<AssemblyName>[Owner].[Module].Server.Oqtane</AssemblyName>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="Scripts\[Owner].[Module]s.1.0.0.sql" />
|
<EmbeddedResource Include="Scripts\[Owner].[Module].1.0.0.sql" />
|
||||||
<EmbeddedResource Include="Scripts\[Owner].[Module]s.Uninstall.sql" />
|
<EmbeddedResource Include="Scripts\[Owner].[Module].Uninstall.sql" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@ -27,11 +27,11 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Shared\[Owner].[Module]s.Shared.csproj" />
|
<ProjectReference Include="..\Shared\[Owner].[Module].Shared.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Oqtane.Server" Version="1.0.2" />
|
[ServerReference]
|
||||||
<PackageReference Include="Oqtane.Shared" Version="1.0.2" />
|
[SharedReference]
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
@ -0,0 +1,5 @@
|
|||||||
|
/* Module Script */
|
||||||
|
var [Owner] = [Owner] || {};
|
||||||
|
|
||||||
|
[Owner].[Module] = {
|
||||||
|
};
|
@ -1 +0,0 @@
|
|||||||
/* Module Script */
|
|
@ -2,7 +2,7 @@ using System;
|
|||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using Oqtane.Models;
|
using Oqtane.Models;
|
||||||
|
|
||||||
namespace [Owner].[Module]s.Models
|
namespace [Owner].[Module].Models
|
||||||
{
|
{
|
||||||
[Table("[Owner][Module]")]
|
[Table("[Owner][Module]")]
|
||||||
public class [Module] : IAuditable
|
public class [Module] : IAuditable
|
||||||
|
@ -4,12 +4,12 @@
|
|||||||
<TargetFramework>netstandard2.1</TargetFramework>
|
<TargetFramework>netstandard2.1</TargetFramework>
|
||||||
<LangVersion>7.3</LangVersion>
|
<LangVersion>7.3</LangVersion>
|
||||||
<Version>1.0.0</Version>
|
<Version>1.0.0</Version>
|
||||||
<Product>[Owner].[Module]s</Product>
|
<Product>[Owner].[Module]</Product>
|
||||||
<Authors>[Owner]</Authors>
|
<Authors>[Owner]</Authors>
|
||||||
<Company>[Owner]</Company>
|
<Company>[Owner]</Company>
|
||||||
<Description>[Description]</Description>
|
<Description>[Description]</Description>
|
||||||
<Copyright>[Owner]</Copyright>
|
<Copyright>[Owner]</Copyright>
|
||||||
<AssemblyName>[Owner].[Module]s.Shared.Oqtane</AssemblyName>
|
<AssemblyName>[Owner].[Module].Shared.Oqtane</AssemblyName>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@ -17,7 +17,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Oqtane.Shared" Version="1.0.2" />
|
[SharedReference]
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
@ -3,13 +3,13 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||||||
# Visual Studio Version 16
|
# Visual Studio Version 16
|
||||||
VisualStudioVersion = 16.0.28621.142
|
VisualStudioVersion = 16.0.28621.142
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "[Owner].[Module]s.Client", "Client\[Owner].[Module]s.Client.csproj", "{AA8E58A1-CD09-4208-BF66-A8BB341FD669}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "[Owner].[Module].Client", "Client\[Owner].[Module].Client.csproj", "{AA8E58A1-CD09-4208-BF66-A8BB341FD669}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "[Owner].[Module]s.Server", "Server\[Owner].[Module]s.Server.csproj", "{04B05448-788F-433D-92C0-FED35122D45A}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "[Owner].[Module].Server", "Server\[Owner].[Module].Server.csproj", "{04B05448-788F-433D-92C0-FED35122D45A}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "[Owner].[Module]s.Shared", "Shared\[Owner].[Module]s.Shared.csproj", "{18D73F73-D7BE-4388-85BA-FBD9AC96FCA2}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "[Owner].[Module].Shared", "Shared\[Owner].[Module].Shared.csproj", "{18D73F73-D7BE-4388-85BA-FBD9AC96FCA2}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "[Owner].[Module]s.Package", "Package\[Owner].[Module]s.Package.csproj", "{C5CE512D-CBB7-4545-AF0F-9B6591A0C3A7}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "[Owner].[Module].Package", "Package\[Owner].[Module].Package.csproj", "{C5CE512D-CBB7-4545-AF0F-9B6591A0C3A7}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
@ -1,8 +1,8 @@
|
|||||||
@using Oqtane.Modules.Controls
|
@using Oqtane.Modules.Controls
|
||||||
@using [Owner].[Module]s.Services
|
@using [Owner].[Module].Services
|
||||||
@using [Owner].[Module]s.Models
|
@using [Owner].[Module].Models
|
||||||
|
|
||||||
@namespace [Owner].[Module]s
|
@namespace [Owner].[Module]
|
||||||
@inherits ModuleBase
|
@inherits ModuleBase
|
||||||
@inject I[Module]Service [Module]Service
|
@inject I[Module]Service [Module]Service
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
@ -10,10 +10,10 @@
|
|||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label class="control-label">Name: </label>
|
<Label For="name" HelpText="Enter a name">Name: </Label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input id="_name" class="form-control" @bind="@_name" />
|
<input id="name" class="form-control" @bind="@_name" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@ -31,6 +31,8 @@
|
|||||||
|
|
||||||
public override string Actions => "Add,Edit";
|
public override string Actions => "Add,Edit";
|
||||||
|
|
||||||
|
public override string Title => "Manage [Module]";
|
||||||
|
|
||||||
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" }
|
@ -1,7 +1,7 @@
|
|||||||
@using [Owner].[Module]s.Services
|
@using [Owner].[Module].Services
|
||||||
@using [Owner].[Module]s.Models
|
@using [Owner].[Module].Models
|
||||||
|
|
||||||
@namespace [Owner].[Module]s
|
@namespace [Owner].[Module]
|
||||||
@inherits ModuleBase
|
@inherits ModuleBase
|
||||||
@inject I[Module]Service [Module]Service
|
@inject I[Module]Service [Module]Service
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
@ -17,16 +17,16 @@ else
|
|||||||
<br />
|
<br />
|
||||||
@if (@_[Module]s.Count != 0)
|
@if (@_[Module]s.Count != 0)
|
||||||
{
|
{
|
||||||
<Pager Items="@_[Module]s" Format="Grid">
|
<Pager Items="@_[Module]s">
|
||||||
<Header>
|
<Header>
|
||||||
<div class="col"><strong>[Module]s</strong></div>
|
<th style="width: 1px;"> </th>
|
||||||
|
<th style="width: 1px;"> </th>
|
||||||
|
<th>Name</th>
|
||||||
</Header>
|
</Header>
|
||||||
<Row>
|
<Row>
|
||||||
<div class="col">
|
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.[Module]Id.ToString())" /></td>
|
||||||
<ActionLink Action="Edit" Parameters="@($"id=" + context.[Module]Id.ToString())" />
|
<td><ActionDialog Header="Delete [Module]" Message="@("Are You Sure You Wish To Delete The " + context.Name + " [Module]?")" Action="Delete" Security="SecurityAccessLevel.Edit" Class="btn btn-danger" OnClick="@(async () => await Delete(context))" /></td>
|
||||||
<ActionDialog Header="Delete [Module]" Message="@("Are You Sure You Wish To Delete The " + context.Name + " [Module]?")" Action="Delete" Security="SecurityAccessLevel.Edit" Class="btn btn-danger" OnClick="@(async () => await Delete(context))" />
|
<td>@context.Name</td>
|
||||||
@context.Name
|
|
||||||
</div>
|
|
||||||
</Row>
|
</Row>
|
||||||
</Pager>
|
</Pager>
|
||||||
}
|
}
|
||||||
@ -63,7 +63,8 @@ else
|
|||||||
@code {
|
@code {
|
||||||
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" },
|
||||||
|
new Resource { ResourceType = ResourceType.Script, Url = ModulePath() + "Module.js" }
|
||||||
};
|
};
|
||||||
|
|
||||||
List<[Module]> _[Module]s;
|
List<[Module]> _[Module]s;
|
@ -0,0 +1,15 @@
|
|||||||
|
using Microsoft.JSInterop;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace [Owner].[Module]
|
||||||
|
{
|
||||||
|
public class Interop
|
||||||
|
{
|
||||||
|
private readonly IJSRuntime _jsRuntime;
|
||||||
|
|
||||||
|
public Interop(IJSRuntime jsRuntime)
|
||||||
|
{
|
||||||
|
_jsRuntime = jsRuntime;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
using Oqtane.Models;
|
using Oqtane.Models;
|
||||||
using Oqtane.Modules;
|
using Oqtane.Modules;
|
||||||
|
|
||||||
namespace [Owner].[Module]s
|
namespace [Owner].[Module]
|
||||||
{
|
{
|
||||||
public class ModuleInfo : IModule
|
public class ModuleInfo : IModule
|
||||||
{
|
{
|
@ -0,0 +1,19 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using [Owner].[Module].Models;
|
||||||
|
|
||||||
|
namespace [Owner].[Module].Services
|
||||||
|
{
|
||||||
|
public interface I[Module]Service
|
||||||
|
{
|
||||||
|
Task<List<Models.[Module]>> Get[Module]sAsync(int ModuleId);
|
||||||
|
|
||||||
|
Task<Models.[Module]> Get[Module]Async(int [Module]Id, int ModuleId);
|
||||||
|
|
||||||
|
Task<Models.[Module]> Add[Module]Async(Models.[Module] [Module]);
|
||||||
|
|
||||||
|
Task<Models.[Module]> Update[Module]Async(Models.[Module] [Module]);
|
||||||
|
|
||||||
|
Task Delete[Module]Async(int [Module]Id, int ModuleId);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
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].Models;
|
||||||
|
|
||||||
|
namespace [Owner].[Module].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<Models.[Module]>> Get[Module]sAsync(int ModuleId)
|
||||||
|
{
|
||||||
|
List<Models.[Module]> [Module]s = await GetJsonAsync<List<Models.[Module]>>(CreateAuthorizationPolicyUrl($"{Apiurl}?moduleid={ModuleId}", ModuleId));
|
||||||
|
return [Module]s.OrderBy(item => item.Name).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Models.[Module]> Get[Module]Async(int [Module]Id, int ModuleId)
|
||||||
|
{
|
||||||
|
return await GetJsonAsync<Models.[Module]>(CreateAuthorizationPolicyUrl($"{Apiurl}/{[Module]Id}", ModuleId));
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Models.[Module]> Add[Module]Async(Models.[Module] [Module])
|
||||||
|
{
|
||||||
|
return await PostJsonAsync<Models.[Module]>(CreateAuthorizationPolicyUrl($"{Apiurl}", [Module].ModuleId), [Module]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Models.[Module]> Update[Module]Async(Models.[Module] [Module])
|
||||||
|
{
|
||||||
|
return await PutJsonAsync<Models.[Module]>(CreateAuthorizationPolicyUrl($"{Apiurl}/{[Module].[Module]Id}", [Module].ModuleId), [Module]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task Delete[Module]Async(int [Module]Id, int ModuleId)
|
||||||
|
{
|
||||||
|
await DeleteAsync(CreateAuthorizationPolicyUrl($"{Apiurl}/{[Module]Id}", ModuleId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,14 +1,14 @@
|
|||||||
@namespace [Owner].[Module]s
|
@namespace [Owner].[Module]
|
||||||
@inherits ModuleBase
|
@inherits ModuleBase
|
||||||
@inject ISettingService SettingService
|
@inject ISettingService SettingService
|
||||||
|
|
||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label for="Setting" class="control-label">Setting: </label>
|
<Label For="value" HelpText="Enter a value">Name: </Label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" class="form-control" @bind="_value" />
|
<input id="value" type="text" class="form-control" @bind="@_value" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
@ -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, int ModuleId);
|
|
||||||
|
|
||||||
Task<[Module]> Add[Module]Async([Module] [Module]);
|
|
||||||
|
|
||||||
Task<[Module]> Update[Module]Async([Module] [Module]);
|
|
||||||
|
|
||||||
Task Delete[Module]Async(int [Module]Id, int ModuleId);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,61 +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]>>(CreateAuthPolicyUrl($"{Apiurl}?moduleid={ModuleId}", ModuleId));
|
|
||||||
return [Module]s.OrderBy(item => item.Name).ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<[Module]> Get[Module]Async(int [Module]Id, int ModuleId)
|
|
||||||
{
|
|
||||||
return await GetJsonAsync<[Module]>(CreateAuthPolicyUrl($"{Apiurl}/{[Module]Id}", ModuleId));
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<[Module]> Add[Module]Async([Module] [Module])
|
|
||||||
{
|
|
||||||
return await PostJsonAsync<[Module]>(CreateAuthPolicyUrl($"{Apiurl}?entityid={[Module].ModuleId}", [Module].ModuleId), [Module]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<[Module]> Update[Module]Async([Module] [Module])
|
|
||||||
{
|
|
||||||
return await PutJsonAsync<[Module]>(CreateAuthPolicyUrl($"{Apiurl}/{[Module].[Module]Id}", [Module].ModuleId), [Module]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task Delete[Module]Async(int [Module]Id, int ModuleId)
|
|
||||||
{
|
|
||||||
await DeleteAsync(CreateAuthPolicyUrl($"{Apiurl}/{[Module]Id}", ModuleId));
|
|
||||||
}
|
|
||||||
|
|
||||||
private string CreateAuthPolicyUrl(string Url, int ModuleId)
|
|
||||||
{
|
|
||||||
if (Url.Contains("?"))
|
|
||||||
{
|
|
||||||
return Url + "&entityid=" + ModuleId.ToString();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return Url + "?entityid=" + ModuleId.ToString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -5,21 +5,21 @@ using Microsoft.AspNetCore.Http;
|
|||||||
using Oqtane.Shared;
|
using Oqtane.Shared;
|
||||||
using Oqtane.Enums;
|
using Oqtane.Enums;
|
||||||
using Oqtane.Infrastructure;
|
using Oqtane.Infrastructure;
|
||||||
using [Owner].[Module]s.Models;
|
using [Owner].[Module].Models;
|
||||||
using [Owner].[Module]s.Repository;
|
using [Owner].[Module].Repository;
|
||||||
|
|
||||||
namespace [Owner].[Module]s.Controllers
|
namespace [Owner].[Module].Controllers
|
||||||
{
|
{
|
||||||
[Route("{alias}/api/[controller]")]
|
[Route("{alias}/api/[controller]")]
|
||||||
public class [Module]Controller : Controller
|
public class [Module]Controller : Controller
|
||||||
{
|
{
|
||||||
private readonly I[Module]Repository _[Module]s;
|
private readonly I[Module]Repository _[Module]Repository;
|
||||||
private readonly ILogManager _logger;
|
private readonly ILogManager _logger;
|
||||||
protected int _entityId = -1;
|
protected int _entityId = -1;
|
||||||
|
|
||||||
public [Module]Controller(I[Module]Repository [Module]s, ILogManager logger, IHttpContextAccessor accessor)
|
public [Module]Controller(I[Module]Repository [Module]Repository, ILogManager logger, IHttpContextAccessor accessor)
|
||||||
{
|
{
|
||||||
_[Module]s = [Module]s;
|
_[Module]Repository = [Module]Repository;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
|
||||||
if (accessor.HttpContext.Request.Query.ContainsKey("entityid"))
|
if (accessor.HttpContext.Request.Query.ContainsKey("entityid"))
|
||||||
@ -31,17 +31,17 @@ namespace [Owner].[Module]s.Controllers
|
|||||||
// GET: api/<controller>?moduleid=x
|
// GET: api/<controller>?moduleid=x
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Authorize(Policy = "ViewModule")]
|
[Authorize(Policy = "ViewModule")]
|
||||||
public IEnumerable<[Module]> Get(string moduleid)
|
public IEnumerable<Models.[Module]> Get(string moduleid)
|
||||||
{
|
{
|
||||||
return _[Module]s.Get[Module]s(int.Parse(moduleid));
|
return _[Module]Repository.Get[Module]s(int.Parse(moduleid));
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET api/<controller>/5
|
// GET api/<controller>/5
|
||||||
[HttpGet("{id}")]
|
[HttpGet("{id}")]
|
||||||
[Authorize(Policy = "ViewModule")]
|
[Authorize(Policy = "ViewModule")]
|
||||||
public [Module] Get(int id)
|
public Models.[Module] Get(int id)
|
||||||
{
|
{
|
||||||
[Module] [Module] = _[Module]s.Get[Module](id);
|
Models.[Module] [Module] = _[Module]Repository.Get[Module](id);
|
||||||
if ([Module] != null && [Module].ModuleId != _entityId)
|
if ([Module] != null && [Module].ModuleId != _entityId)
|
||||||
{
|
{
|
||||||
[Module] = null;
|
[Module] = null;
|
||||||
@ -52,11 +52,11 @@ namespace [Owner].[Module]s.Controllers
|
|||||||
// POST api/<controller>
|
// POST api/<controller>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Authorize(Policy = "EditModule")]
|
[Authorize(Policy = "EditModule")]
|
||||||
public [Module] Post([FromBody] [Module] [Module])
|
public Models.[Module] Post([FromBody] Models.[Module] [Module])
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid && [Module].ModuleId == _entityId)
|
if (ModelState.IsValid && [Module].ModuleId == _entityId)
|
||||||
{
|
{
|
||||||
[Module] = _[Module]s.Add[Module]([Module]);
|
[Module] = _[Module]Repository.Add[Module]([Module]);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Create, "[Module] Added {[Module]}", [Module]);
|
_logger.Log(LogLevel.Information, this, LogFunction.Create, "[Module] Added {[Module]}", [Module]);
|
||||||
}
|
}
|
||||||
return [Module];
|
return [Module];
|
||||||
@ -65,11 +65,11 @@ namespace [Owner].[Module]s.Controllers
|
|||||||
// PUT api/<controller>/5
|
// PUT api/<controller>/5
|
||||||
[HttpPut("{id}")]
|
[HttpPut("{id}")]
|
||||||
[Authorize(Policy = "EditModule")]
|
[Authorize(Policy = "EditModule")]
|
||||||
public [Module] Put(int id, [FromBody] [Module] [Module])
|
public Models.[Module] Put(int id, [FromBody] Models.[Module] [Module])
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid && [Module].ModuleId == _entityId)
|
if (ModelState.IsValid && [Module].ModuleId == _entityId)
|
||||||
{
|
{
|
||||||
[Module] = _[Module]s.Update[Module]([Module]);
|
[Module] = _[Module]Repository.Update[Module]([Module]);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Update, "[Module] Updated {[Module]}", [Module]);
|
_logger.Log(LogLevel.Information, this, LogFunction.Update, "[Module] Updated {[Module]}", [Module]);
|
||||||
}
|
}
|
||||||
return [Module];
|
return [Module];
|
||||||
@ -80,10 +80,10 @@ namespace [Owner].[Module]s.Controllers
|
|||||||
[Authorize(Policy = "EditModule")]
|
[Authorize(Policy = "EditModule")]
|
||||||
public void Delete(int id)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
[Module] [Module] = _[Module]s.Get[Module](id);
|
Models.[Module] [Module] = _[Module]Repository.Get[Module](id);
|
||||||
if ([Module] != null && [Module].ModuleId == _entityId)
|
if ([Module] != null && [Module].ModuleId == _entityId)
|
||||||
{
|
{
|
||||||
_[Module]s.Delete[Module](id);
|
_[Module]Repository.Delete[Module](id);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "[Module] Deleted {[Module]Id}", id);
|
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "[Module] Deleted {[Module]Id}", id);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
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].Models;
|
||||||
|
using [Owner].[Module].Repository;
|
||||||
|
|
||||||
|
namespace [Owner].[Module].Manager
|
||||||
|
{
|
||||||
|
public class [Module]Manager : IInstallable, IPortable
|
||||||
|
{
|
||||||
|
private I[Module]Repository _[Module]Repository;
|
||||||
|
private ISqlRepository _sql;
|
||||||
|
|
||||||
|
public [Module]Manager(I[Module]Repository [Module]Repository, ISqlRepository sql)
|
||||||
|
{
|
||||||
|
_[Module]Repository = [Module]Repository;
|
||||||
|
_sql = sql;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Install(Tenant tenant, string version)
|
||||||
|
{
|
||||||
|
return _sql.ExecuteScript(tenant, GetType().Assembly, "[Owner].[Module]." + version + ".sql");
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Uninstall(Tenant tenant)
|
||||||
|
{
|
||||||
|
return _sql.ExecuteScript(tenant, GetType().Assembly, "[Owner].[Module].Uninstall.sql");
|
||||||
|
}
|
||||||
|
|
||||||
|
public string ExportModule(Module module)
|
||||||
|
{
|
||||||
|
string content = "";
|
||||||
|
List<Models.[Module]> [Module]s = _[Module]Repository.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<Models.[Module]> [Module]s = null;
|
||||||
|
if (!string.IsNullOrEmpty(content))
|
||||||
|
{
|
||||||
|
[Module]s = JsonSerializer.Deserialize<List<Models.[Module]>>(content);
|
||||||
|
}
|
||||||
|
if ([Module]s != null)
|
||||||
|
{
|
||||||
|
foreach(var [Module] in [Module]s)
|
||||||
|
{
|
||||||
|
_[Module]Repository.Add[Module](new Models.[Module] { ModuleId = module.ModuleId, Name = [Module].Name });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using [Owner].[Module].Models;
|
||||||
|
|
||||||
|
namespace [Owner].[Module].Repository
|
||||||
|
{
|
||||||
|
public interface I[Module]Repository
|
||||||
|
{
|
||||||
|
IEnumerable<Models.[Module]> Get[Module]s(int ModuleId);
|
||||||
|
Models.[Module] Get[Module](int [Module]Id);
|
||||||
|
Models.[Module] Add[Module](Models.[Module] [Module]);
|
||||||
|
Models.[Module] Update[Module](Models.[Module] [Module]);
|
||||||
|
void Delete[Module](int [Module]Id);
|
||||||
|
}
|
||||||
|
}
|
@ -2,13 +2,13 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Oqtane.Modules;
|
using Oqtane.Modules;
|
||||||
using Oqtane.Repository;
|
using Oqtane.Repository;
|
||||||
using [Owner].[Module]s.Models;
|
using [Owner].[Module].Models;
|
||||||
|
|
||||||
namespace [Owner].[Module]s.Repository
|
namespace [Owner].[Module].Repository
|
||||||
{
|
{
|
||||||
public class [Module]Context : DBContextBase, IService
|
public class [Module]Context : DBContextBase, IService
|
||||||
{
|
{
|
||||||
public virtual DbSet<[Module]> [Module] { get; set; }
|
public virtual DbSet<Models.[Module]> [Module] { get; set; }
|
||||||
|
|
||||||
public [Module]Context(ITenantResolver tenantResolver, IHttpContextAccessor accessor) : base(tenantResolver, accessor)
|
public [Module]Context(ITenantResolver tenantResolver, IHttpContextAccessor accessor) : base(tenantResolver, accessor)
|
||||||
{
|
{
|
@ -2,9 +2,9 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Oqtane.Modules;
|
using Oqtane.Modules;
|
||||||
using [Owner].[Module]s.Models;
|
using [Owner].[Module].Models;
|
||||||
|
|
||||||
namespace [Owner].[Module]s.Repository
|
namespace [Owner].[Module].Repository
|
||||||
{
|
{
|
||||||
public class [Module]Repository : I[Module]Repository, IService
|
public class [Module]Repository : I[Module]Repository, IService
|
||||||
{
|
{
|
||||||
@ -15,24 +15,24 @@ namespace [Owner].[Module]s.Repository
|
|||||||
_db = context;
|
_db = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<[Module]> Get[Module]s(int ModuleId)
|
public IEnumerable<Models.[Module]> Get[Module]s(int ModuleId)
|
||||||
{
|
{
|
||||||
return _db.[Module].Where(item => item.ModuleId == ModuleId);
|
return _db.[Module].Where(item => item.ModuleId == ModuleId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public [Module] Get[Module](int [Module]Id)
|
public Models.[Module] Get[Module](int [Module]Id)
|
||||||
{
|
{
|
||||||
return _db.[Module].Find([Module]Id);
|
return _db.[Module].Find([Module]Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public [Module] Add[Module]([Module] [Module])
|
public Models.[Module] Add[Module](Models.[Module] [Module])
|
||||||
{
|
{
|
||||||
_db.[Module].Add([Module]);
|
_db.[Module].Add([Module]);
|
||||||
_db.SaveChanges();
|
_db.SaveChanges();
|
||||||
return [Module];
|
return [Module];
|
||||||
}
|
}
|
||||||
|
|
||||||
public [Module] Update[Module]([Module] [Module])
|
public Models.[Module] Update[Module](Models.[Module] [Module])
|
||||||
{
|
{
|
||||||
_db.Entry([Module]).State = EntityState.Modified;
|
_db.Entry([Module]).State = EntityState.Modified;
|
||||||
_db.SaveChanges();
|
_db.SaveChanges();
|
||||||
@ -41,7 +41,7 @@ namespace [Owner].[Module]s.Repository
|
|||||||
|
|
||||||
public void Delete[Module](int [Module]Id)
|
public void Delete[Module](int [Module]Id)
|
||||||
{
|
{
|
||||||
[Module] [Module] = _db.[Module].Find([Module]Id);
|
Models.[Module] [Module] = _db.[Module].Find([Module]Id);
|
||||||
_db.[Module].Remove([Module]);
|
_db.[Module].Remove([Module]);
|
||||||
_db.SaveChanges();
|
_db.SaveChanges();
|
||||||
}
|
}
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,5 @@
|
|||||||
|
/* Module Script */
|
||||||
|
var [Owner] = [Owner] || {};
|
||||||
|
|
||||||
|
[Owner].[Module] = {
|
||||||
|
};
|
@ -1 +0,0 @@
|
|||||||
/* Module Script */
|
|
@ -2,7 +2,7 @@ using System;
|
|||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using Oqtane.Models;
|
using Oqtane.Models;
|
||||||
|
|
||||||
namespace [Owner].[Module]s.Models
|
namespace [Owner].[Module].Models
|
||||||
{
|
{
|
||||||
[Table("[Owner][Module]")]
|
[Table("[Owner][Module]")]
|
||||||
public class [Module] : IAuditable
|
public class [Module] : IAuditable
|
@ -9,8 +9,8 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div>
|
<div>
|
||||||
<br /><br /><h1 align="center">Please Wait... Upgrade In Progress....</h1>
|
<br /><br />
|
||||||
<img src="https://www.oqtane.org/Portals/0/oqtane-black.png" style="position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);" />
|
<h1 align="center">Please Wait... Upgrade In Progress....</h1>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -52,6 +52,31 @@ app {
|
|||||||
width: 80%; /* Could be more or less, depending on screen size */
|
width: 80%; /* Could be more or less, depending on screen size */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Action Dialog */
|
||||||
|
.app-actiondialog .modal {
|
||||||
|
position: fixed; /* Stay in place */
|
||||||
|
z-index: 9999; /* Sit on top */
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
display: block;
|
||||||
|
width: 100%; /* Full width */
|
||||||
|
height: 100%; /* Full height */
|
||||||
|
overflow: auto; /* Enable scroll if needed */
|
||||||
|
background: rgba(0,0,0,0.3); /* Dim background */
|
||||||
|
}
|
||||||
|
|
||||||
|
.app-actiondialog .modal-dialog {
|
||||||
|
width: 100%; /* Full width */
|
||||||
|
height: 100%; /* Full height */
|
||||||
|
max-width: none; /* Override default of 500px */
|
||||||
|
}
|
||||||
|
|
||||||
|
.app-actiondialog .modal-content {
|
||||||
|
margin: 15% auto; /* 15% from the top and centered */
|
||||||
|
width: 40%; /* Could be more or less, depending on screen size */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Admin Pane */
|
||||||
.app-pane-admin-border {
|
.app-pane-admin-border {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border-width: 1px;
|
border-width: 1px;
|
||||||
|
@ -327,7 +327,7 @@ Oqtane.Interop = {
|
|||||||
|
|
||||||
while (Chunk = FileChunk.shift()) {
|
while (Chunk = FileChunk.shift()) {
|
||||||
PartCount++;
|
PartCount++;
|
||||||
var FileName = file.name + ".part_" + PartCount + "_" + TotalParts;
|
var FileName = file.name + ".part_" + PartCount.toString().padStart(3, '0') + "_" + TotalParts.toString().padStart(3, '0');
|
||||||
|
|
||||||
var data = new FormData();
|
var data = new FormData();
|
||||||
data.append('folder', folder);
|
data.append('folder', folder);
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 92 KiB |
Binary file not shown.
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 31 KiB |
BIN
Oqtane.Server/wwwroot/oqtane.png
Normal file
BIN
Oqtane.Server/wwwroot/oqtane.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 92 KiB |
@ -4,7 +4,7 @@
|
|||||||
<TargetFramework>netstandard2.1</TargetFramework>
|
<TargetFramework>netstandard2.1</TargetFramework>
|
||||||
<LangVersion>7.3</LangVersion>
|
<LangVersion>7.3</LangVersion>
|
||||||
<Configurations>Debug;Release</Configurations>
|
<Configurations>Debug;Release</Configurations>
|
||||||
<Version>1.0.2</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>
|
||||||
@ -13,7 +13,7 @@
|
|||||||
<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>https://github.com/oqtane/oqtane.framework/releases/tag/v1.0.2</PackageReleaseNotes>
|
<PackageReleaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v1.0.4</PackageReleaseNotes>
|
||||||
<RootNamespace>Oqtane</RootNamespace>
|
<RootNamespace>Oqtane</RootNamespace>
|
||||||
<IsPackable>true</IsPackable>
|
<IsPackable>true</IsPackable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
@ -5,8 +5,8 @@ namespace Oqtane.Shared
|
|||||||
public class Constants
|
public class Constants
|
||||||
{
|
{
|
||||||
public const string PackageId = "Oqtane.Framework";
|
public const string PackageId = "Oqtane.Framework";
|
||||||
public const string Version = "1.0.2";
|
public const string Version = "1.0.4";
|
||||||
public const string ReleaseVersions = "0.9.0,0.9.1,0.9.2,1.0.0,1.0.1,1.0.2";
|
public const string ReleaseVersions = "1.0.0,1.0.1,1.0.2,1.0.3,1.0.4";
|
||||||
|
|
||||||
public const string PageComponent = "Oqtane.UI.ThemeBuilder, Oqtane.Client";
|
public const string PageComponent = "Oqtane.UI.ThemeBuilder, Oqtane.Client";
|
||||||
public const string ContainerComponent = "Oqtane.UI.ContainerBuilder, Oqtane.Client";
|
public const string ContainerComponent = "Oqtane.UI.ContainerBuilder, Oqtane.Client";
|
||||||
@ -45,8 +45,8 @@ namespace Oqtane.Shared
|
|||||||
public const string AdminRole = "Administrators";
|
public const string AdminRole = "Administrators";
|
||||||
public const string RegisteredRole = "Registered Users";
|
public const string RegisteredRole = "Registered Users";
|
||||||
|
|
||||||
public const string ImageFiles = "jpg,jpeg,jpe,gif,bmp,png";
|
public const string ImageFiles = "jpg,jpeg,jpe,gif,bmp,png,svg,ico";
|
||||||
public const string UploadableFiles = "jpg,jpeg,jpe,gif,bmp,png,mov,wmv,avi,mp4,mp3,doc,docx,xls,xlsx,ppt,pptx,pdf,txt,zip,nupkg";
|
public const string UploadableFiles = "jpg,jpeg,jpe,gif,bmp,png,svg,ico,mov,wmv,avi,mp4,mp3,doc,docx,xls,xlsx,ppt,pptx,pdf,txt,zip,nupkg";
|
||||||
public const string ReservedDevices = "CON,NUL,PRN,COM0,COM1,COM2,COM3,COM4,COM5,COM6,COM7,COM8,COM9,LPT0,LPT1,LPT2,LPT3,LPT4,LPT5,LPT6,LPT7,LPT8,LPT9,CONIN$,CONOUT$";
|
public const string ReservedDevices = "CON,NUL,PRN,COM0,COM1,COM2,COM3,COM4,COM5,COM6,COM7,COM8,COM9,LPT0,LPT1,LPT2,LPT3,LPT4,LPT5,LPT6,LPT7,LPT8,LPT9,CONIN$,CONOUT$";
|
||||||
|
|
||||||
public static readonly char[] InvalidFileNameChars =
|
public static readonly char[] InvalidFileNameChars =
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
<LangVersion>7.3</LangVersion>
|
<LangVersion>7.3</LangVersion>
|
||||||
<Configurations>Debug;Release</Configurations>
|
<Configurations>Debug;Release</Configurations>
|
||||||
<Version>1.0.2</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>
|
||||||
@ -13,7 +13,7 @@
|
|||||||
<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>https://github.com/oqtane/oqtane.framework/releases/tag/v1.0.2</PackageReleaseNotes>
|
<PackageReleaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v1.0.4</PackageReleaseNotes>
|
||||||
<RootNamespace>Oqtane</RootNamespace>
|
<RootNamespace>Oqtane</RootNamespace>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
<LangVersion>7.3</LangVersion>
|
<LangVersion>7.3</LangVersion>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<Version>1.0.2</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>
|
||||||
@ -13,7 +13,7 @@
|
|||||||
<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>https://github.com/oqtane/oqtane.framework/releases/tag/v1.0.2</PackageReleaseNotes>
|
<PackageReleaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v1.0.4</PackageReleaseNotes>
|
||||||
<RootNamespace>Oqtane</RootNamespace>
|
<RootNamespace>Oqtane</RootNamespace>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
@ -11,12 +11,13 @@ namespace Oqtane.Upgrade
|
|||||||
{
|
{
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
|
// requires 2 arguments - the ContentRootPath and the WebRootPath of the site
|
||||||
|
|
||||||
// for testing purposes set Oqtane.Upgrade as startup project and modify values below
|
// for testing purposes set Oqtane.Upgrade as startup project and modify values below
|
||||||
//Array.Resize(ref args, 2);
|
//Array.Resize(ref args, 2);
|
||||||
//args[0] = @"C:\yourpath\oqtane.framework\Oqtane.Server";
|
//args[0] = @"C:\yourpath\oqtane.framework\Oqtane.Server";
|
||||||
//args[1] = @"C:\yourpath\oqtane.framework\Oqtane.Server\wwwroot";
|
//args[1] = @"C:\yourpath\oqtane.framework\Oqtane.Server\wwwroot";
|
||||||
|
|
||||||
// requires 2 arguments - the contentrootpath and the webrootpath of the site
|
|
||||||
if (args.Length == 2)
|
if (args.Length == 2)
|
||||||
{
|
{
|
||||||
string binfolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
|
string binfolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
|
||||||
@ -47,30 +48,41 @@ namespace Oqtane.Upgrade
|
|||||||
{
|
{
|
||||||
foreach (ZipArchiveEntry entry in archive.Entries)
|
foreach (ZipArchiveEntry entry in archive.Entries)
|
||||||
{
|
{
|
||||||
switch (Path.GetDirectoryName(entry.FullName).Split('\\')[0])
|
string filename = Path.GetFileName(entry.FullName);
|
||||||
|
if (!string.IsNullOrEmpty(filename))
|
||||||
|
{
|
||||||
|
// use top level folder to determine location to extract files
|
||||||
|
switch (Path.GetDirectoryName(entry.FullName).Split(Path.DirectorySeparatorChar)[0])
|
||||||
{
|
{
|
||||||
case "lib":
|
case "lib":
|
||||||
files.Add(Path.Combine(binfolder, Path.GetFileName(entry.FullName)));
|
files.Add(Path.Combine(binfolder, filename));
|
||||||
break;
|
break;
|
||||||
case "wwwroot":
|
case "wwwroot":
|
||||||
files.Add(Path.Combine(webrootfolder, entry.FullName.Replace("wwwroot/", "").Replace("/","\\")));
|
files.Add(Path.Combine(webrootfolder.Replace(Path.DirectorySeparatorChar + "wwwroot", ""), entry.FullName.Replace('/', Path.DirectorySeparatorChar)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ensure files are not locked
|
// ensure files are not locked
|
||||||
if (CanAccessFiles(files))
|
if (CanAccessFiles(files))
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
// create backup
|
// create backup
|
||||||
foreach (string file in files)
|
foreach (string file in files)
|
||||||
{
|
{
|
||||||
|
if (File.Exists(file))
|
||||||
|
{
|
||||||
|
// remove previous backup if it exists
|
||||||
if (File.Exists(file + ".bak"))
|
if (File.Exists(file + ".bak"))
|
||||||
{
|
{
|
||||||
File.Delete(file + ".bak");
|
File.Delete(file + ".bak");
|
||||||
}
|
}
|
||||||
File.Move(file, file + ".bak");
|
File.Move(file, file + ".bak");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// extract files
|
// extract files
|
||||||
bool success = true;
|
bool success = true;
|
||||||
@ -80,28 +92,36 @@ namespace Oqtane.Upgrade
|
|||||||
{
|
{
|
||||||
foreach (ZipArchiveEntry entry in archive.Entries)
|
foreach (ZipArchiveEntry entry in archive.Entries)
|
||||||
{
|
{
|
||||||
string filename = "";
|
string filename = Path.GetFileName(entry.FullName);
|
||||||
switch (Path.GetDirectoryName(entry.FullName).Split('\\')[0])
|
if (!string.IsNullOrEmpty(filename))
|
||||||
|
{
|
||||||
|
// use top level folder to determine location to extract files
|
||||||
|
switch (Path.GetDirectoryName(entry.FullName).Split(Path.DirectorySeparatorChar)[0])
|
||||||
{
|
{
|
||||||
case "lib":
|
case "lib":
|
||||||
filename = Path.Combine(binfolder, Path.GetFileName(entry.FullName));
|
filename = Path.Combine(binfolder, filename);
|
||||||
break;
|
break;
|
||||||
case "wwwroot":
|
case "wwwroot":
|
||||||
filename = Path.Combine(webrootfolder, entry.FullName.Replace("wwwroot/", "").Replace("/", "\\"));
|
filename = Path.Combine(webrootfolder.Replace(Path.DirectorySeparatorChar + "wwwroot", ""), entry.FullName.Replace('/', Path.DirectorySeparatorChar));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (files.Contains(filename))
|
if (files.Contains(filename))
|
||||||
{
|
{
|
||||||
|
if (!Directory.Exists(Path.GetDirectoryName(filename)))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(Path.GetDirectoryName(filename));
|
||||||
|
}
|
||||||
entry.ExtractToFile(filename, true);
|
entry.ExtractToFile(filename, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch
|
}
|
||||||
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
// an error occurred extracting a file
|
// an error occurred extracting a file
|
||||||
success = false;
|
success = false;
|
||||||
|
Console.WriteLine("Update Not Successful: Error Extracting Files From Package - " + ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
@ -127,10 +147,22 @@ namespace Oqtane.Upgrade
|
|||||||
{
|
{
|
||||||
File.Delete(file);
|
File.Delete(file);
|
||||||
}
|
}
|
||||||
|
if (File.Exists(file + ".bak"))
|
||||||
|
{
|
||||||
File.Move(file + ".bak", file);
|
File.Move(file + ".bak", file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Update Not Successful: " + ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine("Upgrade Not Successful: Some Files Are Locked");
|
||||||
|
}
|
||||||
|
|
||||||
// bring the app back online
|
// bring the app back online
|
||||||
if (File.Exists(Path.Combine(contentrootfolder, "app_offline.htm")))
|
if (File.Exists(Path.Combine(contentrootfolder, "app_offline.htm")))
|
||||||
@ -138,8 +170,20 @@ namespace Oqtane.Upgrade
|
|||||||
File.Delete(Path.Combine(contentrootfolder, "app_offline.htm"));
|
File.Delete(Path.Combine(contentrootfolder, "app_offline.htm"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine("Framework Upgrade Package Not Found");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine("Framework Upgrade Folder " + deployfolder + " Does Not Exist");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine("Missing ContentRootPath and WebRootPath Parameters");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool CanAccessFiles(List<string> files)
|
private static bool CanAccessFiles(List<string> files)
|
||||||
@ -157,10 +201,17 @@ namespace Oqtane.Upgrade
|
|||||||
while (attempts < 30 && locked)
|
while (attempts < 30 && locked)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
if (File.Exists(filepath))
|
||||||
{
|
{
|
||||||
stream = File.Open(filepath, FileMode.Open, FileAccess.Read, FileShare.None);
|
stream = File.Open(filepath, FileMode.Open, FileAccess.Read, FileShare.None);
|
||||||
locked = false;
|
locked = false;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
locked = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
catch // file is locked by another process
|
catch // file is locked by another process
|
||||||
{
|
{
|
||||||
Thread.Sleep(1000); // wait 1 second
|
Thread.Sleep(1000); // wait 1 second
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user