Compare commits
35 Commits
v0.9.0-bet
...
v0.9.1-bet
Author | SHA1 | Date | |
---|---|---|---|
8516e328f7 | |||
f6f895b516 | |||
043f8d07de | |||
c2ed71ab0d | |||
552df0c9fc | |||
c5d12d0430 | |||
1e270e6423 | |||
aaf2c96374 | |||
86309dc264 | |||
051534b80c | |||
d3ce5bc17c | |||
97354a9525 | |||
f07146fd50 | |||
5b08cac48d | |||
d53bdc5bb6 | |||
a63a659888 | |||
d6f3fd108b | |||
47f17a589f | |||
d7ad175cd7 | |||
d58b6e5d83 | |||
e78a5e090d | |||
c394c6ea7a | |||
6586883979 | |||
e09fcd7e42 | |||
b5aa6c5a48 | |||
00bf917f6c | |||
a02cfea6c9 | |||
db33a91c4b | |||
8f1a3c99c3 | |||
bf84f12471 | |||
979680f46d | |||
922c7796f2 | |||
45aeb17020 | |||
3afa489f22 | |||
a34e2521c6 |
@ -99,7 +99,7 @@
|
||||
var interop = new Interop(JsRuntime);
|
||||
string antiforgerytoken = await interop.GetElementByName("__RequestVerificationToken");
|
||||
var fields = new { __RequestVerificationToken = antiforgerytoken, username = _username, password = _password, remember = _remember, returnurl = _returnUrl };
|
||||
await interop.SubmitForm("/pages/login/", fields);
|
||||
await interop.SubmitForm($"/{PageState.Alias.AliasId}/pages/login/", fields);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -13,7 +13,7 @@
|
||||
<Label For="dateTime" HelpText="The date and time of this log">Date/Time: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="dateTime" class="form-control" @bind="@_logDate" disabled />
|
||||
<input id="dateTime" class="form-control" @bind="@_logDate" readonly />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -21,7 +21,7 @@
|
||||
<Label For="level" HelpText="The level of this log">Level: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="level" class="form-control" @bind="@_level" disabled />
|
||||
<input id="level" class="form-control" @bind="@_level" readonly />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -29,7 +29,7 @@
|
||||
<Label For="feature" HelpText="The feature that was affected">Feature: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="feature" class="form-control" @bind="@_feature" disabled />
|
||||
<input id="feature" class="form-control" @bind="@_feature" readonly />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -37,7 +37,7 @@
|
||||
<Label For="function" HelpText="The function that was performed">Function: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="function" class="form-control" @bind="@_function" disabled />
|
||||
<input id="function" class="form-control" @bind="@_function" readonly />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -45,7 +45,7 @@
|
||||
<Label For="category" HelpText="The categories that were affected">Category: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="category" class="form-control" @bind="@_category" disabled />
|
||||
<input id="category" class="form-control" @bind="@_category" readonly />
|
||||
</td>
|
||||
</tr>
|
||||
@if (_pageName != string.Empty)
|
||||
@ -55,7 +55,7 @@
|
||||
<Label For="page" HelpText="The page that was affected">Page: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="page" class="form-control" @bind="@_pageName" disabled />
|
||||
<input id="page" class="form-control" @bind="@_pageName" readonly />
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@ -66,7 +66,7 @@
|
||||
<Label For="module" HelpText="The module that was affected">Module: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="module" class="form-control" @bind="@_moduleTitle" disabled />
|
||||
<input id="module" class="form-control" @bind="@_moduleTitle" readonly />
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@ -77,7 +77,7 @@
|
||||
<Label For="user" HelpText="The user that caused this log">User: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="user" class="form-control" @bind="@_username" disabled />
|
||||
<input id="user" class="form-control" @bind="@_username" readonly />
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@ -86,7 +86,7 @@
|
||||
<Label For="url" HelpText="The url the log comes from">Url: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="url" class="form-control" @bind="@_url" disabled />
|
||||
<input id="url" class="form-control" @bind="@_url" readonly />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -94,7 +94,7 @@
|
||||
<Label For="template" HelpText="What the log is about">Template: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="template" class="form-control" @bind="@_template" disabled />
|
||||
<input id="template" class="form-control" @bind="@_template" readonly />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -102,7 +102,7 @@
|
||||
<Label For="message" HelpText="The message that the system generated"class="control-label">Message: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<textarea id="message" class="form-control" @bind="@_message" rows="5" disabled></textarea>
|
||||
<textarea id="message" class="form-control" @bind="@_message" rows="5" readonly></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
@if (!string.IsNullOrEmpty(_exception))
|
||||
@ -112,7 +112,7 @@
|
||||
<Label For="exception" HelpText="The exceptions generated by the system">Exception: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<textarea id="exception" class="form-control" @bind="@_exception" rows="5" disabled></textarea>
|
||||
<textarea id="exception" class="form-control" @bind="@_exception" rows="5" readonly></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@ -121,7 +121,7 @@
|
||||
<Label For="properties" HelpText="The properties that were affected">Properties: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<textarea id="properties" class="form-control" @bind="@_properties" rows="5" disabled></textarea>
|
||||
<textarea id="properties" class="form-control" @bind="@_properties" rows="5" readonly></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -129,7 +129,7 @@
|
||||
<Label For="server" HelpText="The server that was affected">Server: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="server" class="form-control" @bind="@_server" disabled />
|
||||
<input id="server" class="form-control" @bind="@_server" readonly />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -43,7 +43,7 @@
|
||||
{
|
||||
try
|
||||
{
|
||||
[Module]Service = new [Module]Service(http, sitestate, NavigationManager);
|
||||
[Module]Service = new [Module]Service(http, sitestate);
|
||||
if (PageState.Action == "Edit")
|
||||
{
|
||||
_id = Int32.Parse(PageState.QueryString["id"]);
|
||||
|
@ -42,7 +42,7 @@ else
|
||||
<hr />
|
||||
[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 />
|
||||
- [Owner].[Module]s.Module.Client.csproj - client project<br />
|
||||
- [Owner].[Module]s.Client.csproj - client project<br />
|
||||
- _Imports.razor - global imports for module components<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 />
|
||||
@ -51,12 +51,12 @@ else
|
||||
- Services\I[Module]Service.cs - interface for defining service API methods<br />
|
||||
- Services\[Module]Service.cs - implements service API interface methods<br /><br />
|
||||
[RootPath]Package\<br />
|
||||
- [Owner].[Module]s.Module.nuspec - nuget manifest for packaging module<br />
|
||||
- [Owner].[Module]s.Module.Package.csproj - packaging project<br />
|
||||
- [Owner].[Module]s.nuspec - nuget manifest for packaging module<br />
|
||||
- [Owner].[Module]s.Package.csproj - packaging project<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 />
|
||||
[RootPath]Server\<br />
|
||||
- [Owner].[Module]s.Module.Server.csproj - server project<br />
|
||||
- [Owner].[Module]s.Server.csproj - server project<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 />
|
||||
- Repository\I[Module]Repository.cs - interface for defining repository methods<br />
|
||||
@ -65,7 +65,7 @@ else
|
||||
- Scripts\[Owner].[Module].1.0.0.sql - database schema definition script<br /><br />
|
||||
- Scripts\[Owner].[Module].Uninstall.sql - database uninstall script<br /><br />
|
||||
[RootPath]Shared\<br />
|
||||
- [Owner].[Module]s.Module.Shared.csproj - shared project<br />
|
||||
- [Owner].[Module]s.csproj - shared project<br />
|
||||
- Models\[Module].cs - model definition<br /><br />
|
||||
|
||||
<!-- The content above is for informational purposes only and can be safely removed -->
|
||||
@ -78,7 +78,7 @@ else
|
||||
{
|
||||
try
|
||||
{
|
||||
[Module]Service = new [Module]Service(http, sitestate, NavigationManager);
|
||||
[Module]Service = new [Module]Service(http, sitestate);
|
||||
_[Module]s = await [Module]Service.Get[Module]sAsync(ModuleState.ModuleId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -10,7 +10,7 @@ namespace [Owner].[Module]s.Modules
|
||||
Name = "[Module]",
|
||||
Description = "[Module]",
|
||||
Version = "1.0.0",
|
||||
Dependencies = "[Owner].[Module]s.Module.Shared",
|
||||
Dependencies = "[Owner].[Module]s.Shared.Oqtane",
|
||||
ServerManagerType = "[ServerManagerType]",
|
||||
ReleaseVersions = "1.0.0"
|
||||
};
|
||||
|
@ -2,7 +2,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Oqtane.Modules;
|
||||
using Oqtane.Services;
|
||||
using Oqtane.Shared;
|
||||
@ -12,44 +11,39 @@ namespace [Owner].[Module]s.Services
|
||||
{
|
||||
public class [Module]Service : ServiceBase, I[Module]Service, IService
|
||||
{
|
||||
private readonly NavigationManager _navigationManager;
|
||||
private readonly SiteState _siteState;
|
||||
|
||||
public [Module]Service(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http)
|
||||
public [Module]Service(HttpClient http, SiteState siteState) : base(http)
|
||||
{
|
||||
_siteState = siteState;
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "[Module]"); }
|
||||
}
|
||||
private string Apiurl=> CreateApiUrl(_siteState.Alias, "[Module]");
|
||||
|
||||
public async Task<List<[Module]>> Get[Module]sAsync(int ModuleId)
|
||||
{
|
||||
List<[Module]> [Module]s = await GetJsonAsync<List<[Module]>>(Apiurl + "?moduleid=" + ModuleId.ToString());
|
||||
List<[Module]> [Module]s = await GetJsonAsync<List<[Module]>>($"{Apiurl}?moduleid={ModuleId}");
|
||||
return [Module]s.OrderBy(item => item.Name).ToList();
|
||||
}
|
||||
|
||||
public async Task<[Module]> Get[Module]Async(int [Module]Id)
|
||||
{
|
||||
return await GetJsonAsync<[Module]>(Apiurl + "/" + [Module]Id.ToString());
|
||||
return await GetJsonAsync<[Module]>($"{Apiurl}/{[Module]Id}");
|
||||
}
|
||||
|
||||
public async Task<[Module]> Add[Module]Async([Module] [Module])
|
||||
{
|
||||
return await PostJsonAsync<[Module]>(Apiurl + "?entityid=" + [Module].ModuleId, [Module]);
|
||||
return await PostJsonAsync<[Module]>($"{Apiurl}?entityid={[Module].ModuleId}", [Module]);
|
||||
}
|
||||
|
||||
public async Task<[Module]> Update[Module]Async([Module] [Module])
|
||||
{
|
||||
return await PutJsonAsync<[Module]>(Apiurl + "/" + [Module].[Module]Id + "?entityid=" + [Module].ModuleId, [Module]);
|
||||
return await PutJsonAsync<[Module]>($"{Apiurl}/{[Module].[Module]Id}?entityid={[Module].ModuleId}", [Module]);
|
||||
}
|
||||
|
||||
public async Task Delete[Module]Async(int [Module]Id)
|
||||
{
|
||||
await DeleteAsync(Apiurl + "/" + [Module]Id.ToString());
|
||||
await DeleteAsync($"{Apiurl}/{[Module]Id}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,18 +7,19 @@
|
||||
<Authors>[Owner]</Authors>
|
||||
<Company>[Owner]</Company>
|
||||
<Description>[Description]</Description>
|
||||
<Product>[Owner].[Module]s.Module</Product>
|
||||
<Product>[Owner].[Module]s</Product>
|
||||
<Copyright>[Owner]</Copyright>
|
||||
<AssemblyName>[Owner].[Module]s.Client.Oqtane</AssemblyName>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<!-- <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="3.2.0-preview5.20216.8" />-->
|
||||
<!-- <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Build" Version="3.2.0-preview5.20216.8" PrivateAssets="all" />-->
|
||||
<PackageReference Include="System.Net.Http.Json" Version="3.2.0-preview5.20210.3" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="3.2.0-rc1.20223.4" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Build" Version="3.2.0-rc1.20223.4" PrivateAssets="all" />
|
||||
<PackageReference Include="System.Net.Http.Json" Version="3.2.0-rc1.20217.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Shared\[Owner].[Module]s.Module.Shared.csproj" />
|
||||
<ProjectReference Include="..\Shared\[Owner].[Module]s.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
@ -6,9 +6,9 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Client\[Owner].[Module]s.Module.Client.csproj" />
|
||||
<ProjectReference Include="..\Server\[Owner].[Module]s.Module.Server.csproj" />
|
||||
<ProjectReference Include="..\Shared\[Owner].[Module]s.Module.Shared.csproj" />
|
||||
<ProjectReference Include="..\Client\[Owner].[Module]s.Client.csproj" />
|
||||
<ProjectReference Include="..\Server\[Owner].[Module]s.Server.csproj" />
|
||||
<ProjectReference Include="..\Shared\[Owner].[Module]s.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>[Owner].[Module]s.Module</id>
|
||||
<id>[Owner].[Module]s</id>
|
||||
<version>1.0.0</version>
|
||||
<authors>[Owner]</authors>
|
||||
<owners>[Owner]</owners>
|
||||
@ -20,9 +20,12 @@
|
||||
</dependencies>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="..\Client\bin\Release\netstandard2.1\[Owner].[Module]s.Module.Client.dll" target="lib" />
|
||||
<file src="..\Server\bin\Release\netcoreapp3.1\[Owner].[Module]s.Module.Server.dll" target="lib" />
|
||||
<file src="..\Shared\bin\Release\netstandard2.1\[Owner].[Module]s.Module.Shared.dll" target="lib" />
|
||||
<file src="..\Client\bin\Release\netstandard2.1\[Owner].[Module]s.Client.Oqtane.dll" target="lib" />
|
||||
<file src="..\Client\bin\Release\netstandard2.1\[Owner].[Module]s.Client.Oqtane.pdb" target="lib" />
|
||||
<file src="..\Server\bin\Release\netcoreapp3.1\[Owner].[Module]s.Server.Oqtane.dll" target="lib" />
|
||||
<file src="..\Server\bin\Release\netcoreapp3.1\[Owner].[Module]s.Server.Oqtane.pdb" target="lib" />
|
||||
<file src="..\Shared\bin\Release\netstandard2.1\[Owner].[Module]s.Shared.Oqtane.dll" target="lib" />
|
||||
<file src="..\Shared\bin\Release\netstandard2.1\[Owner].[Module]s.Shared.Oqtane.pdb" target="lib" />
|
||||
<file src="..\wwwroot\**\*.*" target="wwwroot" />
|
||||
</files>
|
||||
</package>
|
@ -1,6 +1,6 @@
|
||||
XCOPY "..\Client\bin\Debug\netstandard2.1\[Owner].[Module]s.Module.Client.dll" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y
|
||||
XCOPY "..\Client\bin\Debug\netstandard2.1\[Owner].[Module]s.Module.Client.pdb" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y
|
||||
XCOPY "..\Server\bin\Debug\netcoreapp3.1\[Owner].[Module]s.Module.Server.dll" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y
|
||||
XCOPY "..\Server\bin\Debug\netcoreapp3.1\[Owner].[Module]s.Module.Server.pdb" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y
|
||||
XCOPY "..\Shared\bin\Debug\netstandard2.1\[Owner].[Module]s.Module.Shared.dll" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y
|
||||
XCOPY "..\Shared\bin\Debug\netstandard2.1\[Owner].[Module]s.Module.Shared.pdb" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y
|
||||
XCOPY "..\Client\bin\Debug\netstandard2.1\[Owner].[Module]s.Client.Oqtane.dll" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y
|
||||
XCOPY "..\Client\bin\Debug\netstandard2.1\[Owner].[Module]s.Client.Oqtane.pdb" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y
|
||||
XCOPY "..\Server\bin\Debug\netcoreapp3.1\[Owner].[Module]s.Server.Oqtane.dll" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y
|
||||
XCOPY "..\Server\bin\Debug\netcoreapp3.1\[Owner].[Module]s.Server.Oqtane.pdb" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y
|
||||
XCOPY "..\Shared\bin\Debug\netstandard2.1\[Owner].[Module]s.Shared.Oqtane.dll" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y
|
||||
XCOPY "..\Shared\bin\Debug\netstandard2.1\[Owner].[Module]s.Shared.Oqtane.pdb" "..\..\[RootFolder]\Oqtane.Server\bin\Debug\netcoreapp3.1\" /Y
|
||||
|
@ -1,2 +1,2 @@
|
||||
"..\..\[RootFolder]\oqtane.package\nuget.exe" pack [Owner].[Module]s.Module.nuspec
|
||||
"..\..\[RootFolder]\oqtane.package\nuget.exe" pack [Owner].[Module]s.nuspec
|
||||
XCOPY "*.nupkg" "..\..\[RootFolder]\Oqtane.Server\wwwroot\Modules\" /Y
|
||||
|
@ -5,11 +5,12 @@
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
|
||||
<Version>1.0.0</Version>
|
||||
<Product>[Owner].[Module]s.Module</Product>
|
||||
<Product>[Owner].[Module]s</Product>
|
||||
<Authors>[Owner]</Authors>
|
||||
<Company>[Owner]</Company>
|
||||
<Description>[Description]</Description>
|
||||
<Copyright>[Owner]</Copyright>
|
||||
<AssemblyName>[Owner].[Module]s.Server.Oqtane</AssemblyName>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@ -18,7 +19,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="3.2.0-preview5.20216.8" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="3.2.0-rc1.20223.4" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.1.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.2" />
|
||||
@ -26,7 +27,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Shared\[Owner].[Module]s.Module.Shared.csproj" />
|
||||
<ProjectReference Include="..\Shared\[Owner].[Module]s.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
@ -4,11 +4,12 @@
|
||||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<Version>1.0.0</Version>
|
||||
<Product>[Owner].[Module].Module</Product>
|
||||
<Product>[Owner].[Module]s</Product>
|
||||
<Authors>[Owner]</Authors>
|
||||
<Company>[Owner]</Company>
|
||||
<Description>[Description]</Description>
|
||||
<Copyright>[Owner]</Copyright>
|
||||
<AssemblyName>[Owner].[Module]s.Shared.Oqtane</AssemblyName>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
@ -3,13 +3,13 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.28621.142
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "[Owner].[Module]s.Module.Client", "Client\[Owner].[Module]s.Module.Client.csproj", "{AA8E58A1-CD09-4208-BF66-A8BB341FD669}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "[Owner].[Module]s.Client", "Client\[Owner].[Module]s.Client.csproj", "{AA8E58A1-CD09-4208-BF66-A8BB341FD669}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "[Owner].[Module]s.Module.Server", "Server\[Owner].[Module]s.Module.Server.csproj", "{04B05448-788F-433D-92C0-FED35122D45A}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "[Owner].[Module]s.Server", "Server\[Owner].[Module]s.Server.csproj", "{04B05448-788F-433D-92C0-FED35122D45A}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "[Owner].[Module]s.Module.Shared", "Shared\[Owner].[Module]s.Module.Shared.csproj", "{18D73F73-D7BE-4388-85BA-FBD9AC96FCA2}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "[Owner].[Module]s.Shared", "Shared\[Owner].[Module]s.Shared.csproj", "{18D73F73-D7BE-4388-85BA-FBD9AC96FCA2}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "[Owner].[Module]s.Module.Package", "Package\[Owner].[Module]s.Module.Package.csproj", "{C5CE512D-CBB7-4545-AF0F-9B6591A0C3A7}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "[Owner].[Module]s.Package", "Package\[Owner].[Module]s.Package.csproj", "{C5CE512D-CBB7-4545-AF0F-9B6591A0C3A7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
@ -43,7 +43,7 @@
|
||||
{
|
||||
try
|
||||
{
|
||||
[Module]Service = new [Module]Service(http, sitestate, NavigationManager);
|
||||
[Module]Service = new [Module]Service(http, sitestate);
|
||||
if (PageState.Action == "Edit")
|
||||
{
|
||||
_id = Int32.Parse(PageState.QueryString["id"]);
|
||||
|
@ -69,7 +69,7 @@ else
|
||||
{
|
||||
try
|
||||
{
|
||||
[Module]Service = new [Module]Service(http, sitestate, NavigationManager);
|
||||
[Module]Service = new [Module]Service(http, sitestate);
|
||||
_[Module]s = await [Module]Service.Get[Module]sAsync(ModuleState.ModuleId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -2,7 +2,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Oqtane.Modules;
|
||||
using Oqtane.Services;
|
||||
using Oqtane.Shared;
|
||||
@ -12,44 +11,39 @@ namespace [Owner].[Module]s.Services
|
||||
{
|
||||
public class [Module]Service : ServiceBase, I[Module]Service, IService
|
||||
{
|
||||
private readonly NavigationManager _navigationManager;
|
||||
private readonly SiteState _siteState;
|
||||
|
||||
public [Module]Service(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http)
|
||||
public [Module]Service(HttpClient http, SiteState siteState) : base(http)
|
||||
{
|
||||
_siteState = siteState;
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "[Module]"); }
|
||||
}
|
||||
private string Apiurl=> CreateApiUrl(_siteState.Alias, "[Module]");
|
||||
|
||||
public async Task<List<[Module]>> Get[Module]sAsync(int ModuleId)
|
||||
{
|
||||
List<[Module]> [Module]s = await GetJsonAsync<List<[Module]>>(Apiurl + "?moduleid=" + ModuleId.ToString());
|
||||
List<[Module]> [Module]s = await GetJsonAsync<List<[Module]>>($"{Apiurl}?moduleid={ModuleId}");
|
||||
return [Module]s.OrderBy(item => item.Name).ToList();
|
||||
}
|
||||
|
||||
public async Task<[Module]> Get[Module]Async(int [Module]Id)
|
||||
{
|
||||
return await GetJsonAsync<[Module]>(Apiurl + "/" + [Module]Id.ToString());
|
||||
return await GetJsonAsync<[Module]>($"{Apiurl}/{[Module]Id}");
|
||||
}
|
||||
|
||||
public async Task<[Module]> Add[Module]Async([Module] [Module])
|
||||
{
|
||||
return await PostJsonAsync<[Module]>(Apiurl + "?entityid=" + [Module].ModuleId, [Module]);
|
||||
return await PostJsonAsync<[Module]>($"{Apiurl}?entityid={[Module].ModuleId}", [Module]);
|
||||
}
|
||||
|
||||
public async Task<[Module]> Update[Module]Async([Module] [Module])
|
||||
{
|
||||
return await PutJsonAsync<[Module]>(Apiurl + "/" + [Module].[Module]Id + "?entityid=" + [Module].ModuleId, [Module]);
|
||||
return await PutJsonAsync<[Module]>($"{Apiurl}/{[Module].[Module]Id}?entityid={[Module].ModuleId}", [Module]);
|
||||
}
|
||||
|
||||
public async Task Delete[Module]Async(int [Module]Id)
|
||||
{
|
||||
await DeleteAsync(Apiurl + "/" + [Module]Id.ToString());
|
||||
await DeleteAsync($"{Apiurl}/{[Module]Id}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,17 @@
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="allpages" HelpText="Indicate if this module should be displayed on all pages">Display On All Pages? </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="allpages" class="form-control" @bind="@_allPages">
|
||||
<option value="True">Yes</option>
|
||||
<option value="False">No</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="page" HelpText="The page that the module is on">Page: </Label>
|
||||
@ -77,6 +88,7 @@
|
||||
private Dictionary<string, string> _containers;
|
||||
private string _title;
|
||||
private string _containerType;
|
||||
private string _allPages = "false";
|
||||
private string _permissionNames = "";
|
||||
private string _permissions;
|
||||
private string _pageId;
|
||||
@ -95,6 +107,7 @@
|
||||
_title = ModuleState.Title;
|
||||
_containers = ThemeService.GetContainerTypes(await ThemeService.GetThemesAsync());
|
||||
_containerType = ModuleState.ContainerType;
|
||||
_allPages = ModuleState.AllPages.ToString();
|
||||
_permissions = ModuleState.Permissions;
|
||||
_permissionNames = ModuleState.ModuleDefinition.PermissionNames;
|
||||
_pageId = ModuleState.PageId.ToString();
|
||||
@ -120,18 +133,18 @@
|
||||
|
||||
private async Task SaveModule()
|
||||
{
|
||||
var module = ModuleState;
|
||||
module.Permissions = _permissionGrid.GetPermissions();
|
||||
await ModuleService.UpdateModuleAsync(module);
|
||||
|
||||
var pagemodule = await PageModuleService.GetPageModuleAsync(ModuleState.PageModuleId);
|
||||
pagemodule.PageId = int.Parse(_pageId);
|
||||
pagemodule.Title = _title;
|
||||
pagemodule.ContainerType = _containerType;
|
||||
|
||||
await PageModuleService.UpdatePageModuleAsync(pagemodule);
|
||||
await PageModuleService.UpdatePageModuleOrderAsync(pagemodule.PageId, pagemodule.Pane);
|
||||
|
||||
var module = ModuleState;
|
||||
module.AllPages = bool.Parse(_allPages);
|
||||
module.Permissions = _permissionGrid.GetPermissions();
|
||||
await ModuleService.UpdateModuleAsync(module);
|
||||
|
||||
if (_settingsModuleType != null)
|
||||
{
|
||||
var moduleType = Type.GetType(ModuleState.ModuleType);
|
||||
|
@ -101,7 +101,7 @@
|
||||
</td>
|
||||
<td>
|
||||
<select id="Theme" class="form-control" @onchange="(e => ThemeChanged(e))">
|
||||
<option value=""><Select Theme></option>
|
||||
<option value="-"><Select Theme></option>
|
||||
@foreach (KeyValuePair<string, string> item in _themes)
|
||||
{
|
||||
if (item.Key == _themetype)
|
||||
@ -122,7 +122,7 @@
|
||||
</td>
|
||||
<td>
|
||||
<select id="Layout" class="form-control" @bind="@_layouttype">
|
||||
<option value=""><Select Layout></option>
|
||||
<option value="-"><Select Layout></option>
|
||||
@foreach (KeyValuePair<string, string> panelayout in _panelayouts)
|
||||
{
|
||||
if (panelayout.Key == _layouttype)
|
||||
@ -200,8 +200,8 @@
|
||||
private string _url;
|
||||
private string _ispersonalizable = "False";
|
||||
private string _mode = "view";
|
||||
private string _themetype = string.Empty;
|
||||
private string _layouttype = string.Empty;
|
||||
private string _themetype = "-";
|
||||
private string _layouttype = "-";
|
||||
private string _icon = string.Empty;
|
||||
private string _permissions = string.Empty;
|
||||
private PermissionGrid _permissionGrid;
|
||||
@ -271,7 +271,7 @@
|
||||
try
|
||||
{
|
||||
_themetype = (string)e.Value;
|
||||
if (_themetype != string.Empty)
|
||||
if (_themetype != "-")
|
||||
{
|
||||
_panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype);
|
||||
}
|
||||
@ -350,11 +350,8 @@
|
||||
page.IsNavigation = (_isnavigation == null ? true : Boolean.Parse(_isnavigation));
|
||||
page.Url = _url;
|
||||
page.EditMode = (_mode == "edit" ? true : false);
|
||||
page.ThemeType = _themetype;
|
||||
page.LayoutType = (_layouttype == null ? string.Empty : _layouttype);
|
||||
page.Icon = (_icon == null ? string.Empty : _icon);
|
||||
page.Permissions = _permissionGrid.GetPermissions();
|
||||
|
||||
page.ThemeType = (_themetype != "-") ? _themetype : string.Empty;
|
||||
page.LayoutType = (_layouttype != "-") ? _layouttype : string.Empty;
|
||||
if (page.ThemeType == PageState.Site.DefaultThemeType)
|
||||
{
|
||||
page.ThemeType = string.Empty;
|
||||
@ -364,7 +361,8 @@
|
||||
{
|
||||
page.LayoutType = string.Empty;
|
||||
}
|
||||
|
||||
page.Icon = (_icon == null ? string.Empty : _icon);
|
||||
page.Permissions = _permissionGrid.GetPermissions();
|
||||
page.IsPersonalizable = (_ispersonalizable == null ? false : Boolean.Parse(_ispersonalizable));
|
||||
page.UserId = null;
|
||||
|
||||
|
@ -112,7 +112,7 @@
|
||||
</td>
|
||||
<td>
|
||||
<select id="Theme" class="form-control" @onchange="(e => ThemeChanged(e))">
|
||||
<option value=""><Select Theme></option>
|
||||
<option value="-"><Select Theme></option>
|
||||
@foreach (KeyValuePair<string, string> item in _themes)
|
||||
{
|
||||
if (item.Key == _themetype)
|
||||
@ -133,7 +133,7 @@
|
||||
</td>
|
||||
<td>
|
||||
<select id="Layout" class="form-control" @bind="@_layouttype">
|
||||
<option value=""><Select Layout></option>
|
||||
<option value="-"><Select Layout></option>
|
||||
@foreach (KeyValuePair<string, string> panelayout in _panelayouts)
|
||||
{
|
||||
if (panelayout.Key == _layouttype)
|
||||
@ -215,8 +215,8 @@
|
||||
private string _url;
|
||||
private string _ispersonalizable;
|
||||
private string _mode;
|
||||
private string _themetype;
|
||||
private string _layouttype;
|
||||
private string _themetype = "-";
|
||||
private string _layouttype = "-";
|
||||
private string _icon;
|
||||
private string _permissions;
|
||||
private string _createdby;
|
||||
@ -272,6 +272,14 @@
|
||||
_themetype = page.ThemeType;
|
||||
_panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype);
|
||||
_layouttype = page.LayoutType;
|
||||
if (_themetype == PageState.Site.DefaultThemeType)
|
||||
{
|
||||
_themetype = "-";
|
||||
}
|
||||
if (_layouttype == PageState.Site.DefaultLayoutType)
|
||||
{
|
||||
_layouttype = "-";
|
||||
}
|
||||
_icon = page.Icon;
|
||||
_permissions = page.Permissions;
|
||||
_createdby = page.CreatedBy;
|
||||
@ -337,7 +345,7 @@
|
||||
try
|
||||
{
|
||||
_themetype = (string)e.Value;
|
||||
if (_themetype != string.Empty)
|
||||
if (_themetype != "-")
|
||||
{
|
||||
_panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype);
|
||||
}
|
||||
@ -417,11 +425,8 @@
|
||||
page.IsNavigation = (_isnavigation == null || Boolean.Parse(_isnavigation));
|
||||
page.Url = _url;
|
||||
page.EditMode = (_mode == "edit");
|
||||
page.ThemeType = _themetype;
|
||||
page.LayoutType = _layouttype ?? string.Empty;
|
||||
page.Icon = _icon ?? string.Empty;
|
||||
page.Permissions = _permissionGrid.GetPermissions();
|
||||
|
||||
page.ThemeType = (_themetype != "-") ? _themetype : string.Empty;
|
||||
page.LayoutType = (_layouttype != "-") ? _layouttype : string.Empty;
|
||||
if (page.ThemeType == PageState.Site.DefaultThemeType)
|
||||
{
|
||||
page.ThemeType = string.Empty;
|
||||
@ -430,6 +435,8 @@
|
||||
{
|
||||
page.LayoutType = string.Empty;
|
||||
}
|
||||
page.Icon = _icon ?? string.Empty;
|
||||
page.Permissions = _permissionGrid.GetPermissions();
|
||||
page.IsPersonalizable = (_ispersonalizable != null && Boolean.Parse(_ispersonalizable));
|
||||
page.UserId = null;
|
||||
|
||||
|
@ -171,7 +171,7 @@
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="isEnabled" HelpText="Select whether you would like this site to be avaiable as a proggressive web application">Is Enabled? </Label>
|
||||
<Label For="isEnabled" HelpText="Select whether you would like this site to be available as a Progressive Web Application (PWA)">Is Enabled? </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="isEnabled" class="form-control" @bind="@_pwaisenabled">
|
||||
@ -182,7 +182,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="appIcon" HelpText="Include an application icon for your PWA">App Icon: </Label>
|
||||
<Label For="appIcon" HelpText="Include an application icon for your PWA. It should be a PNG which is 192 X 192 pixels in dimension.">App Icon: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<FileManager FileId="@_pwaappiconfileid.ToString()" Filter="png" @ref="_pwaappiconfilemanager" />
|
||||
@ -190,7 +190,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="splashIcon" HelpText="Include a splash icon">Splash Icon: </Label>
|
||||
<Label For="splashIcon" HelpText="Include a splash icon for your PWA. It should be a PNG which is 512 X 512 pixels in dimension.">Splash Icon: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<FileManager FileId="@_pwasplashiconfileid.ToString()" Filter="png" @ref="_pwasplashiconfilemanager" />
|
||||
@ -251,7 +251,7 @@
|
||||
{
|
||||
_themeList = await ThemeService.GetThemesAsync();
|
||||
_aliasList = await AliasService.GetAliasesAsync();
|
||||
Site site = await SiteService.GetSiteAsync(PageState.Site.SiteId, PageState.Alias);
|
||||
Site site = await SiteService.GetSiteAsync(PageState.Site.SiteId);
|
||||
if (site != null)
|
||||
{
|
||||
_name = site.Name;
|
||||
@ -364,7 +364,7 @@
|
||||
|
||||
if (unique)
|
||||
{
|
||||
var site = await SiteService.GetSiteAsync(PageState.Site.SiteId, PageState.Alias);
|
||||
var site = await SiteService.GetSiteAsync(PageState.Site.SiteId);
|
||||
if (site != null)
|
||||
{
|
||||
site.Name = _name;
|
||||
@ -395,7 +395,7 @@
|
||||
site.PwaSplashIconFileId = pwasplashiconfileid;
|
||||
}
|
||||
|
||||
site = await SiteService.UpdateSiteAsync(site, PageState.Alias);
|
||||
site = await SiteService.UpdateSiteAsync(site);
|
||||
|
||||
_urls = _urls.Replace("\n", ",");
|
||||
var names = _urls.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
@ -134,18 +134,19 @@
|
||||
_aliasList = await AliasService.GetAliasesAsync();
|
||||
|
||||
_alias = _aliasList.Find(item => item.AliasId == Int32.Parse(PageState.QueryString["id"]));
|
||||
var site = await SiteService.GetSiteAsync(_alias.SiteId, _alias);
|
||||
SiteService.SetAlias(_alias);
|
||||
var site = await SiteService.GetSiteAsync(_alias.SiteId);
|
||||
if (site != null)
|
||||
{
|
||||
_name = site.Name;
|
||||
_tenantList = await TenantService.GetTenantsAsync();
|
||||
_tenant = _tenantList.Find(item => item.TenantId == site.TenantId).Name;
|
||||
|
||||
|
||||
foreach (Alias alias in _aliasList.Where(item => item.SiteId == site.SiteId && item.TenantId == site.TenantId).ToList())
|
||||
{
|
||||
_urls += alias.Name + "\n";
|
||||
}
|
||||
|
||||
|
||||
_themetype = site.DefaultThemeType;
|
||||
_panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype);
|
||||
_layouttype = site.DefaultLayoutType;
|
||||
@ -182,7 +183,7 @@
|
||||
{
|
||||
_panelayouts = new Dictionary<string, string>();
|
||||
}
|
||||
|
||||
|
||||
StateHasChanged();
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -206,10 +207,11 @@
|
||||
unique = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (unique)
|
||||
{
|
||||
var site = await SiteService.GetSiteAsync(_alias.SiteId, _alias);
|
||||
SiteService.SetAlias(_alias);
|
||||
var site = await SiteService.GetSiteAsync(_alias.SiteId);
|
||||
if (site != null)
|
||||
{
|
||||
site.Name = _name;
|
||||
@ -219,11 +221,11 @@
|
||||
site.DefaultContainerType = _containertype;
|
||||
site.IsDeleted = (_isdeleted == null || Boolean.Parse(_isdeleted));
|
||||
|
||||
site = await SiteService.UpdateSiteAsync(site, _alias);
|
||||
site = await SiteService.UpdateSiteAsync(site);
|
||||
|
||||
_urls = _urls.Replace("\n", ",");
|
||||
var names = _urls.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
|
||||
foreach (Alias alias in _aliasList.Where(item => item.SiteId == site.SiteId && item.TenantId == site.TenantId).ToList())
|
||||
{
|
||||
if (!names.Contains(alias.Name))
|
||||
@ -231,7 +233,7 @@
|
||||
await AliasService.DeleteAliasAsync(alias.AliasId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach (string name in names)
|
||||
{
|
||||
if (!_aliasList.Exists(item => item.Name == name))
|
||||
|
@ -54,7 +54,8 @@ else
|
||||
{
|
||||
if (alias.SiteId != PageState.Site.SiteId || alias.TenantId != PageState.Site.TenantId)
|
||||
{
|
||||
await SiteService.DeleteSiteAsync(alias.SiteId, alias);
|
||||
SiteService.SetAlias(alias);
|
||||
await SiteService.DeleteSiteAsync(alias.SiteId);
|
||||
await Log(alias, LogLevel.Information, "", null, "Site Deleted {SiteId}", alias.SiteId);
|
||||
|
||||
var aliases = await AliasService.GetAliasesAsync();
|
||||
|
@ -11,29 +11,27 @@
|
||||
<TabPanel Name="Download">
|
||||
@if (_upgradeavailable)
|
||||
{
|
||||
<ModuleMessage Type="MessageType.Info" Message="Download a new version of the framework. Once you are ready click Install to complete the installation."></ModuleMessage>
|
||||
@("Framework") @_package.Version <button type="button" class="btn btn-success" @onclick=@(async () => await Download(Constants.PackageId, Constants.Version))>Download</button>
|
||||
<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>
|
||||
}
|
||||
else
|
||||
{
|
||||
<ModuleMessage Type="MessageType.Info" Message="Framework Is Already Up To Date"></ModuleMessage>
|
||||
}
|
||||
</TabPanel>
|
||||
@if (_upgradeavailable)
|
||||
{
|
||||
<TabPanel Name="Upload">
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<Label HelpText="Upload a new framework package. Once it is uploaded click Install to complete the installation.">Framework: </Label>
|
||||
<Label HelpText="Upload a framework package and select Install to complete the installation">Framework: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<FileManager Filter="nupkg" ShowFiles="false" Folder="Framework" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<button type="button" class="btn btn-success" @onclick="Upgrade">Install</button>
|
||||
</TabPanel>
|
||||
}
|
||||
</TabStrip>
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
@namespace Oqtane.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
|
||||
@attribute [OqtaneIgnore]
|
||||
@if (_visible)
|
||||
{
|
||||
<div class="app-admin-modal">
|
||||
|
@ -1,5 +1,6 @@
|
||||
@namespace Oqtane.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
@inherits ModuleBase
|
||||
@attribute [OqtaneIgnore]
|
||||
@inject IUserService UserService
|
||||
|
||||
@if (_authorized)
|
||||
|
@ -1,5 +1,6 @@
|
||||
@namespace Oqtane.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
@inherits ModuleBase
|
||||
@attribute [OqtaneIgnore]
|
||||
|
||||
@if (_text != string.Empty)
|
||||
{
|
||||
|
@ -1,5 +1,6 @@
|
||||
@namespace Oqtane.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
@inherits ModuleBase
|
||||
@attribute [OqtaneIgnore]
|
||||
@inject IFolderService FolderService
|
||||
@inject IFileService FileService
|
||||
@inject IJSRuntime JsRuntime
|
||||
|
@ -1,5 +1,6 @@
|
||||
@namespace Oqtane.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
@inherits ModuleBase
|
||||
@attribute [OqtaneIgnore]
|
||||
|
||||
@if (!string.IsNullOrEmpty(HelpText))
|
||||
{
|
||||
@ -41,4 +42,4 @@ else
|
||||
|
||||
_openLabel += ">";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
@namespace Oqtane.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
@inherits ModuleBase
|
||||
@attribute [OqtaneIgnore]
|
||||
|
||||
@if (!string.IsNullOrEmpty(_message))
|
||||
{
|
||||
|
@ -1,6 +1,8 @@
|
||||
@namespace Oqtane.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
@typeparam TableItem
|
||||
@attribute [OqtaneIgnore]
|
||||
@typeparam TableItem
|
||||
|
||||
|
||||
<p>
|
||||
@if(Format == "Table")
|
||||
@ -209,4 +211,4 @@
|
||||
|
||||
UpdateList(_page);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
@namespace Oqtane.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
@inherits ModuleBase
|
||||
@attribute [OqtaneIgnore]
|
||||
@inject IRoleService RoleService
|
||||
@inject IUserService UserService
|
||||
|
||||
|
@ -1,28 +1,82 @@
|
||||
@namespace Oqtane.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
@attribute [OqtaneIgnore]
|
||||
@inject IJSRuntime JsRuntime
|
||||
|
||||
@if (_filemanagervisible)
|
||||
{
|
||||
<FileManager @ref="_fileManager" Filter="@Constants.ImageFiles" />
|
||||
@((MarkupString)_message)
|
||||
<br />
|
||||
}
|
||||
<div class="row justify-content-center">
|
||||
<button type="button" class="btn btn-success" @onclick="InsertImage">Insert Image</button>
|
||||
@if (_filemanagervisible)
|
||||
{
|
||||
@((MarkupString)" ")
|
||||
<button type="button" class="btn btn-secondary" @onclick="CloseFileManager">Close</button>
|
||||
}
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class ="col">
|
||||
<div @ref="@_toolBar">
|
||||
@ToolbarContent
|
||||
</div>
|
||||
<div @ref="@_editorElement">
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 50px;">
|
||||
<div class="col">
|
||||
<TabStrip>
|
||||
<TabPanel Name="Rich" Heading="Rich Text Editor">
|
||||
@if (_filemanagervisible)
|
||||
{
|
||||
<FileManager @ref="_fileManager" Filter="@Constants.ImageFiles" />
|
||||
@((MarkupString)_message)
|
||||
<br />
|
||||
}
|
||||
<div class="row justify-content-center" style="margin-bottom: 20px;">
|
||||
<button type="button" class="btn btn-secondary" @onclick="RefreshRichText">Synchronize Content</button>
|
||||
<button type="button" class="btn btn-primary" @onclick="InsertImage">Insert Image</button>
|
||||
@if (_filemanagervisible)
|
||||
{
|
||||
@((MarkupString)" ")
|
||||
<button type="button" class="btn btn-secondary" @onclick="CloseFileManager">Close</button>
|
||||
}
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div @ref="@_toolBar">
|
||||
@if (ToolbarContent != null)
|
||||
{
|
||||
@ToolbarContent
|
||||
}
|
||||
else
|
||||
{
|
||||
<select class="ql-header">
|
||||
<option selected=""></option>
|
||||
<option value="1"></option>
|
||||
<option value="2"></option>
|
||||
<option value="3"></option>
|
||||
<option value="4"></option>
|
||||
<option value="5"></option>
|
||||
</select>
|
||||
<span class="ql-formats">
|
||||
<button class="ql-bold"></button>
|
||||
<button class="ql-italic"></button>
|
||||
<button class="ql-underline"></button>
|
||||
<button class="ql-strike"></button>
|
||||
</span>
|
||||
<span class="ql-formats">
|
||||
<select class="ql-color"></select>
|
||||
<select class="ql-background"></select>
|
||||
</span>
|
||||
<span class="ql-formats">
|
||||
<button class="ql-list" value="ordered"></button>
|
||||
<button class="ql-list" value="bullet"></button>
|
||||
</span>
|
||||
<span class="ql-formats">
|
||||
<button class="ql-link"></button>
|
||||
</span>
|
||||
}
|
||||
</div>
|
||||
<div @ref="@_editorElement">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</TabPanel>
|
||||
<TabPanel Name="Raw" Heading="Raw HTML Editor">
|
||||
<div class="row justify-content-center" style="margin-bottom: 20px;">
|
||||
<button type="button" class="btn btn-secondary" @onclick="RefreshRawHtml">Synchronize Content</button>
|
||||
</div>
|
||||
@if (ReadOnly)
|
||||
{
|
||||
<textarea class="form-control" placeholder="@Placeholder" @bind="@_content" rows="10" readonly></textarea>
|
||||
}
|
||||
else
|
||||
{
|
||||
<textarea class="form-control" placeholder="@Placeholder" @bind="@_content" rows="10"></textarea>
|
||||
}
|
||||
</TabPanel>
|
||||
</TabStrip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -31,10 +85,12 @@
|
||||
private ElementReference _toolBar;
|
||||
private bool _filemanagervisible = false;
|
||||
private FileManager _fileManager;
|
||||
private string _content = string.Empty;
|
||||
private string _original = string.Empty;
|
||||
private string _message = string.Empty;
|
||||
|
||||
[Parameter]
|
||||
public RenderFragment ToolbarContent { get; set; }
|
||||
public string Content { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public bool ReadOnly { get; set; } = false;
|
||||
@ -42,12 +98,21 @@
|
||||
[Parameter]
|
||||
public string Placeholder { get; set; } = "Enter Your Content...";
|
||||
|
||||
// parameters only applicable to rich text editor
|
||||
[Parameter]
|
||||
public RenderFragment ToolbarContent { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public string Theme { get; set; } = "snow";
|
||||
|
||||
[Parameter]
|
||||
public string DebugLevel { get; set; } = "info";
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
_content = Content; // raw HTML
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
@ -60,42 +125,57 @@
|
||||
Placeholder,
|
||||
Theme,
|
||||
DebugLevel);
|
||||
|
||||
await RichTextEditorInterop.LoadEditorContent(
|
||||
JsRuntime,
|
||||
_editorElement, Content);
|
||||
|
||||
// preserve a copy of the rich text content ( Quill sanitizes content so we need to retrieve it from the editor )
|
||||
_original = await RichTextEditorInterop.GetHtml(
|
||||
JsRuntime,
|
||||
_editorElement);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<string> GetText()
|
||||
public void CloseFileManager()
|
||||
{
|
||||
return await RichTextEditorInterop.GetText(
|
||||
_filemanagervisible = false;
|
||||
_message = string.Empty;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
public async Task RefreshRichText()
|
||||
{
|
||||
await RichTextEditorInterop.LoadEditorContent(
|
||||
JsRuntime,
|
||||
_editorElement, _content);
|
||||
}
|
||||
|
||||
public async Task RefreshRawHtml()
|
||||
{
|
||||
_content = await RichTextEditorInterop.GetHtml(
|
||||
JsRuntime,
|
||||
_editorElement);
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
public async Task<string> GetHtml()
|
||||
{
|
||||
return await RichTextEditorInterop.GetHtml(
|
||||
JsRuntime,
|
||||
_editorElement);
|
||||
}
|
||||
// get rich text content
|
||||
string content = await RichTextEditorInterop.GetHtml(
|
||||
JsRuntime,
|
||||
_editorElement);
|
||||
|
||||
public async Task<string> GetContent()
|
||||
{
|
||||
return await RichTextEditorInterop.GetContent(
|
||||
JsRuntime,
|
||||
_editorElement);
|
||||
}
|
||||
|
||||
public async Task LoadContent(string content)
|
||||
{
|
||||
await RichTextEditorInterop.LoadEditorContent(
|
||||
JsRuntime,
|
||||
_editorElement, content);
|
||||
}
|
||||
|
||||
public async Task EnableEditor(bool mode)
|
||||
{
|
||||
await RichTextEditorInterop.EnableEditor(
|
||||
JsRuntime,
|
||||
_editorElement, mode);
|
||||
if (_original != content)
|
||||
{
|
||||
// rich text content has changed - return it
|
||||
return content;
|
||||
}
|
||||
else
|
||||
{
|
||||
// return raw html content
|
||||
return _content;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task InsertImage()
|
||||
@ -121,16 +201,28 @@
|
||||
_filemanagervisible = true;
|
||||
_message = string.Empty;
|
||||
}
|
||||
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
public void CloseFileManager()
|
||||
// other rich text editor methods which can be used by developers
|
||||
public async Task<string> GetText()
|
||||
{
|
||||
_filemanagervisible = false;
|
||||
_message = string.Empty;
|
||||
|
||||
StateHasChanged();
|
||||
return await RichTextEditorInterop.GetText(
|
||||
JsRuntime,
|
||||
_editorElement);
|
||||
}
|
||||
|
||||
public async Task<string> GetContent()
|
||||
{
|
||||
return await RichTextEditorInterop.GetContent(
|
||||
JsRuntime,
|
||||
_editorElement);
|
||||
}
|
||||
|
||||
public async Task EnableEditor(bool mode)
|
||||
{
|
||||
await RichTextEditorInterop.EnableEditor(
|
||||
JsRuntime,
|
||||
_editorElement, mode);
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
using Microsoft.JSInterop;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.UI
|
||||
namespace Oqtane.Modules.Controls
|
||||
{
|
||||
public static class RichTextEditorInterop
|
||||
{
|
@ -1,5 +1,6 @@
|
||||
@namespace Oqtane.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
@inherits ModuleBase
|
||||
@attribute [OqtaneIgnore]
|
||||
|
||||
<div class="d-flex">
|
||||
<div>
|
||||
|
@ -1,5 +1,6 @@
|
||||
@namespace Oqtane.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
@inherits ModuleBase
|
||||
@attribute [OqtaneIgnore]
|
||||
|
||||
@if (Name == Parent.ActiveTab)
|
||||
{
|
||||
|
@ -1,5 +1,6 @@
|
||||
@namespace Oqtane.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
@inherits ModuleBase
|
||||
@attribute [OqtaneIgnore]
|
||||
|
||||
<CascadingValue Value="this">
|
||||
<div class="container-fluid">
|
||||
|
@ -7,111 +7,48 @@
|
||||
@inject HttpClient http
|
||||
@inject SiteState sitestate
|
||||
|
||||
<div class="row" style="margin-bottom: 50px;">
|
||||
<div class="col @_visibleText">
|
||||
<textarea class="form-control" @bind="@content" rows="10"></textarea>
|
||||
</div>
|
||||
|
||||
<div class="col @_visibleRich">
|
||||
<RichTextEditor @ref="@RichTextEditorHtml">
|
||||
<ToolbarContent>
|
||||
<select class="ql-header">
|
||||
<option selected=string.Empty></option>
|
||||
<option value="1"></option>
|
||||
<option value="2"></option>
|
||||
<option value="3"></option>
|
||||
<option value="4"></option>
|
||||
<option value="5"></option>
|
||||
</select>
|
||||
<span class="ql-formats">
|
||||
<button class="ql-bold"></button>
|
||||
<button class="ql-italic"></button>
|
||||
<button class="ql-underline"></button>
|
||||
<button class="ql-strike"></button>
|
||||
</span>
|
||||
<span class="ql-formats">
|
||||
<select class="ql-color"></select>
|
||||
<select class="ql-background"></select>
|
||||
</span>
|
||||
<span class="ql-formats">
|
||||
<button class="ql-list" value="ordered"></button>
|
||||
<button class="ql-list" value="bullet"></button>
|
||||
</span>
|
||||
<span class="ql-formats">
|
||||
<button class="ql-link"></button>
|
||||
</span>
|
||||
</ToolbarContent>
|
||||
</RichTextEditor>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
@if (!RichTextEditorMode)
|
||||
{
|
||||
<button type="button" class="btn btn-secondary" @onclick="RichTextEditor">Rich Text Editor</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button type="button" class="btn btn-secondary" @onclick="RawHtmlEditor">Raw HTML Editor</button>
|
||||
}
|
||||
<button type="button" class="btn btn-success" @onclick="SaveContent">Save</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<AuditInfo CreatedBy="@createdby" CreatedOn="@createdon" ModifiedBy="@modifiedby" ModifiedOn="@modifiedon"></AuditInfo>
|
||||
</div>
|
||||
</div>
|
||||
@if (_content != null)
|
||||
{
|
||||
<RichTextEditor Content="@_content" @ref="@RichTextEditorHtml"></RichTextEditor>
|
||||
<button type="button" class="btn btn-success" @onclick="SaveContent">Save</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||
@if (!string.IsNullOrEmpty(_content))
|
||||
{
|
||||
<br /><br />
|
||||
<AuditInfo CreatedBy="@_createdby" CreatedOn="@_createdon" ModifiedBy="@_modifiedby" ModifiedOn="@_modifiedon"></AuditInfo>
|
||||
}
|
||||
}
|
||||
|
||||
@code {
|
||||
private string _visibleText = "d-none";
|
||||
private string _visibleRich;
|
||||
private bool _richTextEditorMode;
|
||||
private RichTextEditor RichTextEditorHtml;
|
||||
private string content;
|
||||
private string createdby;
|
||||
private DateTime createdon;
|
||||
private string modifiedby;
|
||||
private DateTime modifiedon;
|
||||
private string _content = null;
|
||||
private string _createdby;
|
||||
private DateTime _createdon;
|
||||
private string _modifiedby;
|
||||
private DateTime _modifiedon;
|
||||
|
||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Edit;
|
||||
|
||||
public override string Title => "Edit Html/Text";
|
||||
|
||||
public bool RichTextEditorMode
|
||||
{
|
||||
get => _richTextEditorMode;
|
||||
set
|
||||
{
|
||||
_richTextEditorMode = value;
|
||||
|
||||
if (_richTextEditorMode)
|
||||
{
|
||||
_visibleText = "d-none";
|
||||
_visibleRich = string.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
_visibleText = string.Empty;
|
||||
_visibleRich = "d-none";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (firstRender)
|
||||
var htmltextservice = new HtmlTextService(http, sitestate);
|
||||
var htmltext = await htmltextservice.GetHtmlTextAsync(ModuleState.ModuleId);
|
||||
if (htmltext != null)
|
||||
{
|
||||
if (content == null)
|
||||
{
|
||||
RichTextEditorMode = true;
|
||||
await LoadText();
|
||||
}
|
||||
_content = htmltext.Content;
|
||||
_content = _content.Replace(Constants.ContentUrl, "/" + PageState.Alias.AliasId.ToString() + Constants.ContentUrl);
|
||||
_createdby = htmltext.CreatedBy;
|
||||
_createdon = htmltext.CreatedOn;
|
||||
_modifiedby = htmltext.ModifiedBy;
|
||||
_modifiedon = htmltext.ModifiedOn;
|
||||
}
|
||||
else
|
||||
{
|
||||
_content = string.Empty;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -121,52 +58,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
private async Task LoadText()
|
||||
{
|
||||
var htmltextservice = new HtmlTextService(http, sitestate, NavigationManager);
|
||||
var htmltext = await htmltextservice.GetHtmlTextAsync(ModuleState.ModuleId);
|
||||
if (htmltext != null)
|
||||
{
|
||||
content = htmltext.Content;
|
||||
createdby = htmltext.CreatedBy;
|
||||
createdon = htmltext.CreatedOn;
|
||||
modifiedby = htmltext.ModifiedBy;
|
||||
modifiedon = htmltext.ModifiedOn;
|
||||
|
||||
if (RichTextEditorMode)
|
||||
{
|
||||
await RichTextEditorHtml.LoadContent(content);
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async Task RichTextEditor()
|
||||
{
|
||||
RichTextEditorMode = true;
|
||||
await RichTextEditorHtml.LoadContent(content);
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private async Task RawHtmlEditor()
|
||||
{
|
||||
content = await this.RichTextEditorHtml.GetHtml();
|
||||
RichTextEditorMode = false;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private async Task SaveContent()
|
||||
{
|
||||
if (RichTextEditorMode)
|
||||
{
|
||||
content = await RichTextEditorHtml.GetHtml();
|
||||
}
|
||||
|
||||
content = content.Replace(((PageState.Alias.Path == string.Empty) ? "/~" : PageState.Alias.Path) + Constants.ContentUrl, Constants.ContentUrl);
|
||||
string content = await RichTextEditorHtml.GetHtml();
|
||||
content = content.Replace("/" + PageState.Alias.AliasId.ToString() + Constants.ContentUrl, Constants.ContentUrl);
|
||||
|
||||
try
|
||||
{
|
||||
var htmltextservice = new HtmlTextService(http, sitestate, NavigationManager);
|
||||
var htmltextservice = new HtmlTextService(http, sitestate);
|
||||
var htmltext = await htmltextservice.GetHtmlTextAsync(ModuleState.ModuleId);
|
||||
if (htmltext != null)
|
||||
{
|
||||
@ -180,7 +79,7 @@
|
||||
htmltext.Content = content;
|
||||
await htmltextservice.AddHtmlTextAsync(htmltext);
|
||||
}
|
||||
|
||||
|
||||
await logger.LogInformation("Html/Text Content Saved {HtmlText}", htmltext);
|
||||
NavigationManager.NavigateTo(NavigateUrl());
|
||||
}
|
||||
@ -190,5 +89,4 @@
|
||||
AddModuleMessage("Error Saving Content", MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -25,12 +25,12 @@
|
||||
{
|
||||
try
|
||||
{
|
||||
var htmltextservice = new HtmlTextService(http, sitestate, NavigationManager);
|
||||
var htmltextservice = new HtmlTextService(http, sitestate);
|
||||
var htmltext = await htmltextservice.GetHtmlTextAsync(ModuleState.ModuleId);
|
||||
if (htmltext != null)
|
||||
{
|
||||
content = htmltext.Content;
|
||||
content = content.Replace(Constants.ContentUrl, ((PageState.Alias.Path == "") ? "/~" : PageState.Alias.Path) + Constants.ContentUrl);
|
||||
content = content.Replace(Constants.ContentUrl, "/" + PageState.Alias.AliasId.ToString() + Constants.ContentUrl);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -2,7 +2,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Oqtane.Modules.HtmlText.Models;
|
||||
using Oqtane.Services;
|
||||
using Oqtane.Shared;
|
||||
@ -10,52 +9,35 @@ using Oqtane.Shared;
|
||||
namespace Oqtane.Modules.HtmlText.Services
|
||||
{
|
||||
public class HtmlTextService : ServiceBase, IHtmlTextService
|
||||
{
|
||||
|
||||
private readonly NavigationManager _navigationManager;
|
||||
{
|
||||
private readonly SiteState _siteState;
|
||||
|
||||
public HtmlTextService(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http)
|
||||
public HtmlTextService(HttpClient http, SiteState siteState) : base(http)
|
||||
{
|
||||
|
||||
_siteState = siteState;
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string ApiUrl => CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "HtmlText");
|
||||
private string ApiUrl => CreateApiUrl(_siteState.Alias, "HtmlText");
|
||||
|
||||
public async Task<HtmlTextInfo> GetHtmlTextAsync(int moduleId)
|
||||
{
|
||||
HtmlTextInfo htmlText;
|
||||
try
|
||||
{
|
||||
//because GetJsonAsync() returns an error if no content exists for the ModuleId ( https://github.com/aspnet/AspNetCore/issues/14041 )
|
||||
//null value is transfered as empty list
|
||||
var htmlTextList = await GetJsonAsync<List<HtmlTextInfo>>(ApiUrl + "/" + moduleId + "?entityid=" + moduleId);
|
||||
htmlText = htmlTextList.FirstOrDefault();
|
||||
}
|
||||
catch
|
||||
{
|
||||
htmlText = null;
|
||||
}
|
||||
|
||||
return htmlText;
|
||||
var htmltext = await GetJsonAsync<List<HtmlTextInfo>>($"{ApiUrl}/{moduleId}?entityid={moduleId}");
|
||||
return htmltext.FirstOrDefault();
|
||||
}
|
||||
|
||||
public async Task AddHtmlTextAsync(HtmlTextInfo htmlText)
|
||||
{
|
||||
await PostJsonAsync(ApiUrl + "?entityid=" + htmlText.ModuleId, htmlText);
|
||||
await PostJsonAsync($"{ApiUrl}?entityid={htmlText.ModuleId}", htmlText);
|
||||
}
|
||||
|
||||
public async Task UpdateHtmlTextAsync(HtmlTextInfo htmlText)
|
||||
{
|
||||
await PutJsonAsync(ApiUrl + "/" + htmlText.HtmlTextId + "?entityid=" + htmlText.ModuleId, htmlText);
|
||||
await PutJsonAsync($"{ApiUrl}/{htmlText.HtmlTextId}?entityid={htmlText.ModuleId}", htmlText);
|
||||
}
|
||||
|
||||
|
||||
public async Task DeleteHtmlTextAsync(int moduleId)
|
||||
{
|
||||
await DeleteAsync(ApiUrl + "/" + moduleId + "?entityid=" + moduleId);
|
||||
await DeleteAsync($"{ApiUrl}/{moduleId}?entityid={moduleId}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ namespace Oqtane.Modules
|
||||
|
||||
public string ContentUrl(int fileid)
|
||||
{
|
||||
return Utilities.ContentUrl(PageState.Alias.Path, fileid);
|
||||
return Utilities.ContentUrl(PageState.Alias, fileid);
|
||||
}
|
||||
|
||||
// user feedback methods
|
||||
|
@ -6,7 +6,7 @@
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<RazorLangVersion>3.0</RazorLangVersion>
|
||||
<Configurations>Debug;Release</Configurations>
|
||||
<Version>0.9.0</Version>
|
||||
<Version>0.9.1</Version>
|
||||
<Product>Oqtane</Product>
|
||||
<Authors>Shaun Walker</Authors>
|
||||
<Company>.NET Foundation</Company>
|
||||
@ -27,10 +27,10 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="3.2.0-preview5.20216.8" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Build" Version="3.2.0-preview5.20216.8" PrivateAssets="all" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="3.2.0-rc1.20223.4" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Build" Version="3.2.0-rc1.20223.4" PrivateAssets="all" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="3.1.2" />
|
||||
<PackageReference Include="System.Net.Http.Json" Version="3.2.0-preview5.20210.3" />
|
||||
<PackageReference Include="System.Net.Http.Json" Version="3.2.0-rc1.20217.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -2,6 +2,7 @@
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Json;
|
||||
using System.Security.Claims;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
@ -29,7 +30,7 @@ namespace Oqtane.Providers
|
||||
{
|
||||
// get HttpClient lazily from IServiceProvider as you cannot use standard dependency injection due to the AuthenticationStateProvider being initialized prior to NavigationManager ( https://github.com/aspnet/AspNetCore/issues/11867 )
|
||||
var http = _serviceProvider.GetRequiredService<HttpClient>();
|
||||
string apiurl = ServiceBase.CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "User") + "/authenticate";
|
||||
string apiurl = "/~/api/User/authenticate";
|
||||
User user = await http.GetFromJsonAsync<User>(apiurl);
|
||||
|
||||
ClaimsIdentity identity = new ClaimsIdentity();
|
||||
|
@ -2,32 +2,19 @@
|
||||
using System.Threading.Tasks;
|
||||
using System.Net.Http;
|
||||
using System.Linq;
|
||||
//using Microsoft.AspNetCore.Components;
|
||||
using System.Collections.Generic;
|
||||
using Oqtane.Shared;
|
||||
using System.Net;
|
||||
using System;
|
||||
using System.Net.Http.Json;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
public class AliasService : ServiceBase, IAliasService
|
||||
{
|
||||
|
||||
private readonly SiteState _siteState;
|
||||
private readonly NavigationManager _navigationManager;
|
||||
public AliasService(HttpClient http) :base(http) { }
|
||||
|
||||
public AliasService(HttpClient http, SiteState siteState, NavigationManager navigationManager) :base(http)
|
||||
{
|
||||
_siteState = siteState;
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Alias"); }
|
||||
}
|
||||
private string Apiurl => CreateApiUrl("Alias");
|
||||
|
||||
public async Task<List<Alias>> GetAliasesAsync()
|
||||
{
|
||||
@ -37,22 +24,13 @@ namespace Oqtane.Services
|
||||
|
||||
public async Task<Alias> GetAliasAsync(int aliasId)
|
||||
{
|
||||
return await GetJsonAsync<Alias>($"{Apiurl}/{aliasId.ToString()}");
|
||||
return await GetJsonAsync<Alias>($"{Apiurl}/{aliasId}");
|
||||
}
|
||||
|
||||
public async Task<Alias> GetAliasAsync(string url, DateTime lastSyncDate)
|
||||
public async Task<Alias> GetAliasAsync(string name, DateTime lastSyncDate)
|
||||
{
|
||||
Uri uri = new Uri(url);
|
||||
string name = uri.Authority;
|
||||
if (uri.Segments.Count() > 1)
|
||||
{
|
||||
name += "/" + uri.Segments[1];
|
||||
}
|
||||
if (name.EndsWith("/"))
|
||||
{
|
||||
name = name.Substring(0, name.Length - 1);
|
||||
}
|
||||
return await GetJsonAsync<Alias>($"{Apiurl}/name/{WebUtility.UrlEncode(name)}?lastsyncdate={lastSyncDate.ToString("yyyyMMddHHmmssfff")}");
|
||||
name = (string.IsNullOrEmpty(name)) ? "~" : name;
|
||||
return await GetJsonAsync<Alias>($"{Apiurl}/name/{WebUtility.UrlEncode(name)}?sync={lastSyncDate.ToString("yyyyMMddHHmmssfff")}");
|
||||
}
|
||||
|
||||
public async Task<Alias> AddAliasAsync(Alias alias)
|
||||
@ -62,11 +40,11 @@ namespace Oqtane.Services
|
||||
|
||||
public async Task<Alias> UpdateAliasAsync(Alias alias)
|
||||
{
|
||||
return await PutJsonAsync<Alias>($"{Apiurl}/{alias.AliasId.ToString()}", alias);
|
||||
return await PutJsonAsync<Alias>($"{Apiurl}/{alias.AliasId}", alias);
|
||||
}
|
||||
public async Task DeleteAliasAsync(int aliasId)
|
||||
{
|
||||
await DeleteAsync($"{Apiurl}/{aliasId.ToString()}");
|
||||
await DeleteAsync($"{Apiurl}/{aliasId}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using Oqtane.Models;
|
||||
using Oqtane.Shared;
|
||||
@ -14,21 +13,15 @@ namespace Oqtane.Services
|
||||
public class FileService : ServiceBase, IFileService
|
||||
{
|
||||
private readonly SiteState _siteState;
|
||||
private readonly NavigationManager _navigationManager;
|
||||
private readonly IJSRuntime _jsRuntime;
|
||||
|
||||
public FileService(HttpClient http, SiteState siteState, NavigationManager navigationManager,
|
||||
IJSRuntime jsRuntime) : base(http)
|
||||
public FileService(HttpClient http, SiteState siteState, IJSRuntime jsRuntime) : base(http)
|
||||
{
|
||||
_siteState = siteState;
|
||||
_navigationManager = navigationManager;
|
||||
_jsRuntime = jsRuntime;
|
||||
}
|
||||
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "File"); }
|
||||
}
|
||||
private string Apiurl => CreateApiUrl(_siteState.Alias, "File");
|
||||
|
||||
public async Task<List<File>> GetFilesAsync(int folderId)
|
||||
{
|
||||
@ -54,7 +47,7 @@ namespace Oqtane.Services
|
||||
|
||||
public async Task<File> GetFileAsync(int fileId)
|
||||
{
|
||||
return await GetJsonAsync<File>($"{Apiurl}/{fileId.ToString()}");
|
||||
return await GetJsonAsync<File>($"{Apiurl}/{fileId}");
|
||||
}
|
||||
|
||||
public async Task<File> AddFileAsync(File file)
|
||||
@ -64,17 +57,17 @@ namespace Oqtane.Services
|
||||
|
||||
public async Task<File> UpdateFileAsync(File file)
|
||||
{
|
||||
return await PutJsonAsync<File>($"{Apiurl}/{file.FileId.ToString()}", file);
|
||||
return await PutJsonAsync<File>($"{Apiurl}/{file.FileId}", file);
|
||||
}
|
||||
|
||||
public async Task DeleteFileAsync(int fileId)
|
||||
{
|
||||
await DeleteAsync($"{Apiurl}/{fileId.ToString()}");
|
||||
await DeleteAsync($"{Apiurl}/{fileId}");
|
||||
}
|
||||
|
||||
public async Task<File> UploadFileAsync(string url, int folderId)
|
||||
{
|
||||
return await GetJsonAsync<File>($"{Apiurl}/upload?url={WebUtility.UrlEncode(url)}&folderid={folderId.ToString()}");
|
||||
return await GetJsonAsync<File>($"{Apiurl}/upload?url={WebUtility.UrlEncode(url)}&folderid={folderId}");
|
||||
}
|
||||
|
||||
public async Task<string> UploadFilesAsync(int folderId, string[] files, string id)
|
||||
@ -124,7 +117,7 @@ namespace Oqtane.Services
|
||||
|
||||
public async Task<byte[]> DownloadFileAsync(int fileId)
|
||||
{
|
||||
return await GetByteArrayAsync($"{Apiurl}/download/{fileId.ToString()}");
|
||||
return await GetByteArrayAsync($"{Apiurl}/download/{fileId}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System.Threading.Tasks;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System.Collections.Generic;
|
||||
using Oqtane.Shared;
|
||||
using System;
|
||||
@ -14,26 +13,24 @@ namespace Oqtane.Services
|
||||
public class FolderService : ServiceBase, IFolderService
|
||||
{
|
||||
private readonly SiteState _siteState;
|
||||
private readonly NavigationManager _navigationManager;
|
||||
|
||||
public FolderService(HttpClient http, SiteState siteState, NavigationManager navigationManager):base(http)
|
||||
public FolderService(HttpClient http, SiteState siteState) : base(http)
|
||||
{
|
||||
_siteState = siteState;
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string ApiUrl => CreateApiUrl(_siteState.Alias, _navigationManager.Uri, EntityNames.Folder);
|
||||
private string ApiUrl => CreateApiUrl(_siteState.Alias, "Folder");
|
||||
|
||||
public async Task<List<Folder>> GetFoldersAsync(int siteId)
|
||||
{
|
||||
List<Folder> folders = await GetJsonAsync<List<Folder>>($"{ApiUrl}?siteid={siteId.ToString()}");
|
||||
List<Folder> folders = await GetJsonAsync<List<Folder>>($"{ApiUrl}?siteid={siteId}");
|
||||
folders = GetFoldersHierarchy(folders);
|
||||
return folders;
|
||||
}
|
||||
|
||||
public async Task<Folder> GetFolderAsync(int folderId)
|
||||
{
|
||||
return await GetJsonAsync<Folder>($"{ApiUrl}/{folderId.ToString()}");
|
||||
return await GetJsonAsync<Folder>($"{ApiUrl}/{folderId}");
|
||||
}
|
||||
|
||||
public async Task<Folder> GetFolderAsync(int siteId, [NotNull] string folderPath)
|
||||
@ -55,7 +52,7 @@ namespace Oqtane.Services
|
||||
|
||||
public async Task<Folder> UpdateFolderAsync(Folder folder)
|
||||
{
|
||||
return await PutJsonAsync<Folder>($"{ApiUrl}/{folder.FolderId.ToString()}", folder);
|
||||
return await PutJsonAsync<Folder>($"{ApiUrl}/{folder.FolderId}", folder);
|
||||
}
|
||||
|
||||
public async Task UpdateFolderOrderAsync(int siteId, int folderId, int? parentId)
|
||||
@ -63,12 +60,12 @@ namespace Oqtane.Services
|
||||
var parent = parentId == null
|
||||
? string.Empty
|
||||
: parentId.ToString();
|
||||
await PutAsync($"{ApiUrl}/?siteid={siteId.ToString()}&folderid={folderId.ToString()}&parentid={parent}");
|
||||
await PutAsync($"{ApiUrl}/?siteid={siteId}&folderid={folderId}&parentid={parent}");
|
||||
}
|
||||
|
||||
public async Task DeleteFolderAsync(int folderId)
|
||||
{
|
||||
await DeleteAsync($"{ApiUrl}/{folderId.ToString()}");
|
||||
await DeleteAsync($"{ApiUrl}/{folderId}");
|
||||
}
|
||||
|
||||
private static List<Folder> GetFoldersHierarchy(List<Folder> folders)
|
||||
|
@ -1,23 +1,15 @@
|
||||
using Oqtane.Models;
|
||||
using System.Threading.Tasks;
|
||||
using System.Net.Http;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Oqtane.Shared;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
public class InstallationService : ServiceBase, IInstallationService
|
||||
{
|
||||
private readonly SiteState _siteState;
|
||||
private readonly NavigationManager _navigationManager;
|
||||
public InstallationService(HttpClient http):base(http) { }
|
||||
|
||||
public InstallationService(HttpClient http, SiteState siteState, NavigationManager navigationManager):base(http)
|
||||
{
|
||||
_siteState = siteState;
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string ApiUrl => CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Installation");
|
||||
private string ApiUrl => CreateApiUrl("Installation");
|
||||
|
||||
public async Task<Installation> IsInstalled()
|
||||
{
|
||||
|
@ -6,14 +6,16 @@ namespace Oqtane.Services
|
||||
{
|
||||
public interface ISiteService
|
||||
{
|
||||
Task<List<Site>> GetSitesAsync(Alias alias);
|
||||
void SetAlias(Alias alias);
|
||||
|
||||
Task<Site> GetSiteAsync(int siteId, Alias alias);
|
||||
Task<List<Site>> GetSitesAsync();
|
||||
|
||||
Task<Site> AddSiteAsync(Site site, Alias alias);
|
||||
Task<Site> GetSiteAsync(int siteId);
|
||||
|
||||
Task<Site> UpdateSiteAsync(Site site, Alias alias);
|
||||
Task<Site> AddSiteAsync(Site site);
|
||||
|
||||
Task DeleteSiteAsync(int siteId, Alias alias);
|
||||
Task<Site> UpdateSiteAsync(Site site);
|
||||
|
||||
Task DeleteSiteAsync(int siteId);
|
||||
}
|
||||
}
|
||||
|
@ -11,8 +11,6 @@ namespace Oqtane.Services
|
||||
|
||||
Task<User> AddUserAsync(User user);
|
||||
|
||||
Task<User> AddUserAsync(User user, Alias alias);
|
||||
|
||||
Task<User> UpdateUserAsync(User user);
|
||||
|
||||
Task DeleteUserAsync(int userId);
|
||||
|
@ -2,28 +2,15 @@
|
||||
using System.Threading.Tasks;
|
||||
using System.Net.Http;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System.Collections.Generic;
|
||||
using Oqtane.Shared;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
public class JobLogService : ServiceBase, IJobLogService
|
||||
{
|
||||
private readonly SiteState _siteState;
|
||||
private readonly NavigationManager _navigationManager;
|
||||
public JobLogService(HttpClient http) :base(http) { }
|
||||
|
||||
public JobLogService(HttpClient http, SiteState siteState, NavigationManager navigationManager) :base(http)
|
||||
|
||||
{
|
||||
_siteState = siteState;
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "JobLog"); }
|
||||
}
|
||||
private string Apiurl => CreateApiUrl("JobLog");
|
||||
|
||||
public async Task<List<JobLog>> GetJobLogsAsync()
|
||||
{
|
||||
@ -33,7 +20,7 @@ namespace Oqtane.Services
|
||||
|
||||
public async Task<JobLog> GetJobLogAsync(int jobLogId)
|
||||
{
|
||||
return await GetJsonAsync<JobLog>($"{Apiurl}/{jobLogId.ToString()}");
|
||||
return await GetJsonAsync<JobLog>($"{Apiurl}/{jobLogId}");
|
||||
}
|
||||
|
||||
public async Task<JobLog> AddJobLogAsync(JobLog joblog)
|
||||
@ -43,11 +30,11 @@ namespace Oqtane.Services
|
||||
|
||||
public async Task<JobLog> UpdateJobLogAsync(JobLog joblog)
|
||||
{
|
||||
return await PutJsonAsync<JobLog>($"{Apiurl}/{joblog.JobLogId.ToString()}", joblog);
|
||||
return await PutJsonAsync<JobLog>($"{Apiurl}/{joblog.JobLogId}", joblog);
|
||||
}
|
||||
public async Task DeleteJobLogAsync(int jobLogId)
|
||||
{
|
||||
await DeleteAsync($"{Apiurl}/{jobLogId.ToString()}");
|
||||
await DeleteAsync($"{Apiurl}/{jobLogId}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,29 +2,15 @@
|
||||
using System.Threading.Tasks;
|
||||
using System.Net.Http;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System.Collections.Generic;
|
||||
using Oqtane.Shared;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
public class JobService : ServiceBase, IJobService
|
||||
{
|
||||
|
||||
private readonly SiteState _siteState;
|
||||
private readonly NavigationManager _navigationManager;
|
||||
public JobService(HttpClient http) : base(http) { }
|
||||
|
||||
public JobService(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http)
|
||||
{
|
||||
|
||||
_siteState = siteState;
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Job"); }
|
||||
}
|
||||
private string Apiurl => CreateApiUrl("Job");
|
||||
|
||||
public async Task<List<Job>> GetJobsAsync()
|
||||
{
|
||||
@ -34,7 +20,7 @@ namespace Oqtane.Services
|
||||
|
||||
public async Task<Job> GetJobAsync(int jobId)
|
||||
{
|
||||
return await GetJsonAsync<Job>($"{Apiurl}/{jobId.ToString()}");
|
||||
return await GetJsonAsync<Job>($"{Apiurl}/{jobId}");
|
||||
}
|
||||
|
||||
public async Task<Job> AddJobAsync(Job job)
|
||||
@ -44,21 +30,21 @@ namespace Oqtane.Services
|
||||
|
||||
public async Task<Job> UpdateJobAsync(Job job)
|
||||
{
|
||||
return await PutJsonAsync<Job>($"{Apiurl}/{job.JobId.ToString()}", job);
|
||||
return await PutJsonAsync<Job>($"{Apiurl}/{job.JobId}", job);
|
||||
}
|
||||
public async Task DeleteJobAsync(int jobId)
|
||||
{
|
||||
await DeleteAsync($"{Apiurl}/{jobId.ToString()}");
|
||||
await DeleteAsync($"{Apiurl}/{jobId}");
|
||||
}
|
||||
|
||||
public async Task StartJobAsync(int jobId)
|
||||
{
|
||||
await GetAsync($"{Apiurl}/start/{jobId.ToString()}");
|
||||
await GetAsync($"{Apiurl}/start/{jobId}");
|
||||
}
|
||||
|
||||
public async Task StopJobAsync(int jobId)
|
||||
{
|
||||
await GetAsync($"{Apiurl}/stop/{jobId.ToString()}");
|
||||
await GetAsync($"{Apiurl}/stop/{jobId}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,19 +23,16 @@ namespace Oqtane.Services
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Log"); }
|
||||
}
|
||||
private string Apiurl => CreateApiUrl(_siteState.Alias, "Log");
|
||||
|
||||
public async Task<List<Log>> GetLogsAsync(int siteId, string level, string function, int rows)
|
||||
{
|
||||
return await GetJsonAsync<List<Log>>($"{Apiurl}?siteid={siteId.ToString()}&level={level}&function={function}&rows={rows.ToString()}");
|
||||
return await GetJsonAsync<List<Log>>($"{Apiurl}?siteid={siteId}&level={level}&function={function}&rows={rows}");
|
||||
}
|
||||
|
||||
public async Task<Log> GetLogAsync(int logId)
|
||||
{
|
||||
return await GetJsonAsync<Log>($"{Apiurl}/{logId.ToString()}");
|
||||
return await GetJsonAsync<Log>($"{Apiurl}/{logId}");
|
||||
}
|
||||
|
||||
public async Task Log(int? pageId, int? moduleId, int? userId, string category, string feature, LogFunction function, LogLevel level, Exception exception, string message, params object[] args)
|
||||
@ -52,6 +49,7 @@ namespace Oqtane.Services
|
||||
}
|
||||
else
|
||||
{
|
||||
base.Alias = alias;
|
||||
log.SiteId = alias.SiteId;
|
||||
}
|
||||
log.PageId = pageId;
|
||||
@ -69,7 +67,7 @@ namespace Oqtane.Services
|
||||
log.Message = message;
|
||||
log.MessageTemplate = "";
|
||||
log.Properties = JsonSerializer.Serialize(args);
|
||||
await PostJsonAsync(CreateCrossTenantUrl(Apiurl, alias), log);
|
||||
await PostJsonAsync(Apiurl, log);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using Oqtane.Shared;
|
||||
@ -15,34 +14,29 @@ namespace Oqtane.Services
|
||||
{
|
||||
private readonly HttpClient _http;
|
||||
private readonly SiteState _siteState;
|
||||
private readonly NavigationManager _navigationManager;
|
||||
|
||||
public ModuleDefinitionService(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http)
|
||||
public ModuleDefinitionService(HttpClient http, SiteState siteState) : base(http)
|
||||
{
|
||||
_http = http;
|
||||
_siteState = siteState;
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, EntityNames.ModuleDefinition); }
|
||||
}
|
||||
private string Apiurl => CreateApiUrl(_siteState.Alias, "ModuleDefinition");
|
||||
|
||||
public async Task<List<ModuleDefinition>> GetModuleDefinitionsAsync(int siteId)
|
||||
{
|
||||
List<ModuleDefinition> moduledefinitions = await GetJsonAsync<List<ModuleDefinition>>($"{Apiurl}?siteid={siteId.ToString()}");
|
||||
List<ModuleDefinition> moduledefinitions = await GetJsonAsync<List<ModuleDefinition>>($"{Apiurl}?siteid={siteId}");
|
||||
return moduledefinitions.OrderBy(item => item.Name).ToList();
|
||||
}
|
||||
|
||||
public async Task<ModuleDefinition> GetModuleDefinitionAsync(int moduleDefinitionId, int siteId)
|
||||
{
|
||||
return await GetJsonAsync<ModuleDefinition>($"{Apiurl}/{moduleDefinitionId.ToString()}?siteid={siteId.ToString()}");
|
||||
return await GetJsonAsync<ModuleDefinition>($"{Apiurl}/{moduleDefinitionId}?siteid={siteId}");
|
||||
}
|
||||
|
||||
public async Task UpdateModuleDefinitionAsync(ModuleDefinition moduleDefinition)
|
||||
{
|
||||
await PutJsonAsync($"{Apiurl}/{moduleDefinition.ModuleDefinitionId.ToString()}", moduleDefinition);
|
||||
await PutJsonAsync($"{Apiurl}/{moduleDefinition.ModuleDefinitionId}", moduleDefinition);
|
||||
}
|
||||
|
||||
public async Task InstallModuleDefinitionsAsync()
|
||||
@ -52,7 +46,7 @@ namespace Oqtane.Services
|
||||
|
||||
public async Task DeleteModuleDefinitionAsync(int moduleDefinitionId, int siteId)
|
||||
{
|
||||
await DeleteAsync($"{Apiurl}/{moduleDefinitionId.ToString()}?siteid={siteId.ToString()}");
|
||||
await DeleteAsync($"{Apiurl}/{moduleDefinitionId}?siteid={siteId}");
|
||||
}
|
||||
|
||||
public async Task LoadModuleDefinitionsAsync(int siteId, Runtime runtime)
|
||||
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Oqtane.Shared;
|
||||
|
||||
namespace Oqtane.Services
|
||||
@ -12,23 +11,17 @@ namespace Oqtane.Services
|
||||
{
|
||||
|
||||
private readonly SiteState _siteState;
|
||||
private readonly NavigationManager _navigationManager;
|
||||
|
||||
public ModuleService(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http)
|
||||
public ModuleService(HttpClient http, SiteState siteState) : base(http)
|
||||
{
|
||||
|
||||
_siteState = siteState;
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Module"); }
|
||||
}
|
||||
private string Apiurl => CreateApiUrl(_siteState.Alias, "Module");
|
||||
|
||||
public async Task<List<Module>> GetModulesAsync(int siteId)
|
||||
{
|
||||
List<Module> modules = await GetJsonAsync<List<Module>>($"{Apiurl}?siteid={siteId.ToString()}");
|
||||
List<Module> modules = await GetJsonAsync<List<Module>>($"{Apiurl}?siteid={siteId}");
|
||||
modules = modules
|
||||
.OrderBy(item => item.Order)
|
||||
.ToList();
|
||||
@ -37,7 +30,7 @@ namespace Oqtane.Services
|
||||
|
||||
public async Task<Module> GetModuleAsync(int moduleId)
|
||||
{
|
||||
return await GetJsonAsync<Module>($"{Apiurl}/{moduleId.ToString()}");
|
||||
return await GetJsonAsync<Module>($"{Apiurl}/{moduleId}");
|
||||
}
|
||||
|
||||
public async Task<Module> AddModuleAsync(Module module)
|
||||
@ -47,7 +40,7 @@ namespace Oqtane.Services
|
||||
|
||||
public async Task<Module> UpdateModuleAsync(Module module)
|
||||
{
|
||||
return await PutJsonAsync<Module>($"{Apiurl}/{module.ModuleId.ToString()}", module);
|
||||
return await PutJsonAsync<Module>($"{Apiurl}/{module.ModuleId}", module);
|
||||
}
|
||||
|
||||
public async Task DeleteModuleAsync(int moduleId)
|
||||
@ -62,7 +55,7 @@ namespace Oqtane.Services
|
||||
|
||||
public async Task<string> ExportModuleAsync(int moduleId)
|
||||
{
|
||||
return await GetStringAsync($"{Apiurl}/export?moduleid={moduleId.ToString()}");
|
||||
return await GetStringAsync($"{Apiurl}/export?moduleid={moduleId}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
using Oqtane.Models;
|
||||
using System.Threading.Tasks;
|
||||
using System.Net.Http;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Oqtane.Shared;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -11,29 +10,24 @@ namespace Oqtane.Services
|
||||
public class NotificationService : ServiceBase, INotificationService
|
||||
{
|
||||
private readonly SiteState _siteState;
|
||||
private readonly NavigationManager _navigationManager;
|
||||
|
||||
public NotificationService(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http)
|
||||
public NotificationService(HttpClient http, SiteState siteState) : base(http)
|
||||
{
|
||||
_siteState = siteState;
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Notification"); }
|
||||
}
|
||||
private string Apiurl => CreateApiUrl(_siteState.Alias, "Notification");
|
||||
|
||||
public async Task<List<Notification>> GetNotificationsAsync(int siteId, string direction, int userId)
|
||||
{
|
||||
var notifications = await GetJsonAsync<List<Notification>>($"{Apiurl}?siteid={siteId.ToString()}&direction={direction.ToLower()}&userid={userId.ToString()}");
|
||||
var notifications = await GetJsonAsync<List<Notification>>($"{Apiurl}?siteid={siteId}&direction={direction.ToLower()}&userid={userId}");
|
||||
|
||||
return notifications.OrderByDescending(item => item.CreatedOn).ToList();
|
||||
}
|
||||
|
||||
public async Task<Notification> GetNotificationAsync(int notificationId)
|
||||
{
|
||||
return await GetJsonAsync<Notification>($"{Apiurl}/{notificationId.ToString()}");
|
||||
return await GetJsonAsync<Notification>($"{Apiurl}/{notificationId}");
|
||||
}
|
||||
|
||||
public async Task<Notification> AddNotificationAsync(Notification notification)
|
||||
@ -43,12 +37,12 @@ namespace Oqtane.Services
|
||||
|
||||
public async Task<Notification> UpdateNotificationAsync(Notification notification)
|
||||
{
|
||||
return await PutJsonAsync<Notification>($"{Apiurl}/{notification.NotificationId.ToString()}", notification);
|
||||
return await PutJsonAsync<Notification>($"{Apiurl}/{notification.NotificationId}", notification);
|
||||
}
|
||||
|
||||
public async Task DeleteNotificationAsync(int notificationId)
|
||||
{
|
||||
await DeleteAsync($"{Apiurl}/{notificationId.ToString()}");
|
||||
await DeleteAsync($"{Apiurl}/{notificationId}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,29 +2,15 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Oqtane.Shared;
|
||||
using System.Linq;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
public class PackageService : ServiceBase, IPackageService
|
||||
{
|
||||
|
||||
private readonly SiteState _siteState;
|
||||
private readonly NavigationManager _navigationManager;
|
||||
{
|
||||
public PackageService(HttpClient http) : base(http) { }
|
||||
|
||||
public PackageService(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http)
|
||||
{
|
||||
|
||||
_siteState = siteState;
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Package"); }
|
||||
}
|
||||
private string Apiurl => CreateApiUrl("Package");
|
||||
|
||||
public async Task<List<Package>> GetPackagesAsync(string tag)
|
||||
{
|
||||
|
@ -1,7 +1,6 @@
|
||||
using Oqtane.Models;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Oqtane.Shared;
|
||||
|
||||
namespace Oqtane.Services
|
||||
@ -10,28 +9,22 @@ namespace Oqtane.Services
|
||||
{
|
||||
|
||||
private readonly SiteState _siteState;
|
||||
private readonly NavigationManager _navigationManager;
|
||||
|
||||
public PageModuleService(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http)
|
||||
{
|
||||
|
||||
public PageModuleService(HttpClient http, SiteState siteState) : base(http)
|
||||
{
|
||||
_siteState = siteState;
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "PageModule"); }
|
||||
}
|
||||
private string Apiurl => CreateApiUrl(_siteState.Alias, "PageModule");
|
||||
|
||||
public async Task<PageModule> GetPageModuleAsync(int pageModuleId)
|
||||
{
|
||||
return await GetJsonAsync<PageModule>($"{Apiurl}/{pageModuleId.ToString()}");
|
||||
return await GetJsonAsync<PageModule>($"{Apiurl}/{pageModuleId}");
|
||||
}
|
||||
|
||||
public async Task<PageModule> GetPageModuleAsync(int pageId, int moduleId)
|
||||
{
|
||||
return await GetJsonAsync<PageModule>($"{Apiurl}/{pageId.ToString()}/{moduleId.ToString()}");
|
||||
return await GetJsonAsync<PageModule>($"{Apiurl}/{pageId}/{moduleId}");
|
||||
}
|
||||
|
||||
public async Task<PageModule> AddPageModuleAsync(PageModule pageModule)
|
||||
@ -41,17 +34,17 @@ namespace Oqtane.Services
|
||||
|
||||
public async Task<PageModule> UpdatePageModuleAsync(PageModule pageModule)
|
||||
{
|
||||
return await PutJsonAsync<PageModule>($"{Apiurl}/{pageModule.PageModuleId.ToString()}", pageModule);
|
||||
return await PutJsonAsync<PageModule>($"{Apiurl}/{pageModule.PageModuleId}", pageModule);
|
||||
}
|
||||
|
||||
public async Task UpdatePageModuleOrderAsync(int pageId, string pane)
|
||||
{
|
||||
await PutAsync($"{Apiurl}/?pageid={pageId.ToString()}&pane={pane}");
|
||||
await PutAsync($"{Apiurl}/?pageid={pageId}&pane={pane}");
|
||||
}
|
||||
|
||||
public async Task DeletePageModuleAsync(int pageModuleId)
|
||||
{
|
||||
await DeleteAsync($"{Apiurl}/{pageModuleId.ToString()}");
|
||||
await DeleteAsync($"{Apiurl}/{pageModuleId}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System.Threading.Tasks;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System.Collections.Generic;
|
||||
using Oqtane.Shared;
|
||||
using System;
|
||||
@ -14,42 +13,37 @@ namespace Oqtane.Services
|
||||
{
|
||||
|
||||
private readonly SiteState _siteState;
|
||||
private readonly NavigationManager _navigationManager;
|
||||
|
||||
public PageService(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http)
|
||||
public PageService(HttpClient http, SiteState siteState) : base(http)
|
||||
{
|
||||
|
||||
_siteState = siteState;
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Page"); }
|
||||
}
|
||||
private string Apiurl => CreateApiUrl(_siteState.Alias, "Page");
|
||||
|
||||
public async Task<List<Page>> GetPagesAsync(int siteId)
|
||||
{
|
||||
List<Page> pages = await GetJsonAsync<List<Page>>($"{Apiurl}?siteid={siteId.ToString()}");
|
||||
List<Page> pages = await GetJsonAsync<List<Page>>($"{Apiurl}?siteid={siteId}");
|
||||
pages = GetPagesHierarchy(pages);
|
||||
return pages;
|
||||
}
|
||||
|
||||
public async Task<Page> GetPageAsync(int pageId)
|
||||
{
|
||||
return await GetJsonAsync<Page>($"{Apiurl}/{pageId.ToString()}");
|
||||
return await GetJsonAsync<Page>($"{Apiurl}/{pageId}");
|
||||
}
|
||||
|
||||
public async Task<Page> GetPageAsync(int pageId, int userId)
|
||||
{
|
||||
return await GetJsonAsync<Page>($"{Apiurl}/{pageId.ToString()}?userid={userId.ToString()}");
|
||||
return await GetJsonAsync<Page>($"{Apiurl}/{pageId}?userid={userId}");
|
||||
}
|
||||
|
||||
public async Task<Page> GetPageAsync(string path, int siteId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await GetJsonAsync<Page>($"{Apiurl}/path/{siteId.ToString()}?path={WebUtility.UrlEncode(path)}");
|
||||
return await GetJsonAsync<Page>($"{Apiurl}/path/{siteId}?path={WebUtility.UrlEncode(path)}");
|
||||
}
|
||||
catch
|
||||
{
|
||||
@ -64,12 +58,12 @@ namespace Oqtane.Services
|
||||
|
||||
public async Task<Page> AddPageAsync(int pageId, int userId)
|
||||
{
|
||||
return await PostJsonAsync<Page>($"{Apiurl}/{pageId.ToString()}?userid={userId.ToString()}", null);
|
||||
return await PostJsonAsync<Page>($"{Apiurl}/{pageId}?userid={userId}", null);
|
||||
}
|
||||
|
||||
public async Task<Page> UpdatePageAsync(Page page)
|
||||
{
|
||||
return await PutJsonAsync<Page>($"{Apiurl}/{page.PageId.ToString()}", page);
|
||||
return await PutJsonAsync<Page>($"{Apiurl}/{page.PageId}", page);
|
||||
}
|
||||
|
||||
public async Task UpdatePageOrderAsync(int siteId, int pageId, int? parentId)
|
||||
@ -77,12 +71,12 @@ namespace Oqtane.Services
|
||||
var parent = parentId == null
|
||||
? string.Empty
|
||||
: parentId.ToString();
|
||||
await PutAsync($"{Apiurl}/?siteid={siteId.ToString()}&pageid={pageId.ToString()}&parentid={parent}");
|
||||
await PutAsync($"{Apiurl}/?siteid={siteId}&pageid={pageId}&parentid={parent}");
|
||||
}
|
||||
|
||||
public async Task DeletePageAsync(int pageId)
|
||||
{
|
||||
await DeleteAsync($"{Apiurl}/{pageId.ToString()}");
|
||||
await DeleteAsync($"{Apiurl}/{pageId}");
|
||||
}
|
||||
|
||||
private static List<Page> GetPagesHierarchy(List<Page> pages)
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System.Threading.Tasks;
|
||||
using System.Net.Http;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System.Collections.Generic;
|
||||
using Oqtane.Shared;
|
||||
|
||||
@ -12,29 +11,23 @@ namespace Oqtane.Services
|
||||
{
|
||||
|
||||
private readonly SiteState _siteState;
|
||||
private readonly NavigationManager _navigationManager;
|
||||
|
||||
public ProfileService(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http)
|
||||
{
|
||||
|
||||
public ProfileService(HttpClient http, SiteState siteState) : base(http)
|
||||
{
|
||||
_siteState = siteState;
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Profile"); }
|
||||
}
|
||||
private string Apiurl => CreateApiUrl(_siteState.Alias, "Profile");
|
||||
|
||||
public async Task<List<Profile>> GetProfilesAsync(int siteId)
|
||||
{
|
||||
List<Profile> profiles = await GetJsonAsync<List<Profile>>($"{Apiurl}?siteid={siteId.ToString()}");
|
||||
List<Profile> profiles = await GetJsonAsync<List<Profile>>($"{Apiurl}?siteid={siteId}");
|
||||
return profiles.OrderBy(item => item.ViewOrder).ToList();
|
||||
}
|
||||
|
||||
public async Task<Profile> GetProfileAsync(int profileId)
|
||||
{
|
||||
return await GetJsonAsync<Profile>($"{Apiurl}/{profileId.ToString()}");
|
||||
return await GetJsonAsync<Profile>($"{Apiurl}/{profileId}");
|
||||
}
|
||||
|
||||
public async Task<Profile> AddProfileAsync(Profile profile)
|
||||
@ -44,11 +37,11 @@ namespace Oqtane.Services
|
||||
|
||||
public async Task<Profile> UpdateProfileAsync(Profile profile)
|
||||
{
|
||||
return await PutJsonAsync<Profile>($"{Apiurl}/{profile.SiteId.ToString()}", profile);
|
||||
return await PutJsonAsync<Profile>($"{Apiurl}/{profile.SiteId}", profile);
|
||||
}
|
||||
public async Task DeleteProfileAsync(int profileId)
|
||||
{
|
||||
await DeleteAsync($"{Apiurl}/{profileId.ToString()}");
|
||||
await DeleteAsync($"{Apiurl}/{profileId}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System.Threading.Tasks;
|
||||
using System.Net.Http;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System.Collections.Generic;
|
||||
using Oqtane.Shared;
|
||||
|
||||
@ -12,29 +11,24 @@ namespace Oqtane.Services
|
||||
{
|
||||
|
||||
private readonly SiteState _siteState;
|
||||
private readonly NavigationManager _navigationManager;
|
||||
|
||||
public RoleService(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http)
|
||||
public RoleService(HttpClient http, SiteState siteState) : base(http)
|
||||
{
|
||||
|
||||
_siteState = siteState;
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Role"); }
|
||||
}
|
||||
private string Apiurl => CreateApiUrl(_siteState.Alias, "Role");
|
||||
|
||||
public async Task<List<Role>> GetRolesAsync(int siteId)
|
||||
{
|
||||
List<Role> roles = await GetJsonAsync<List<Role>>($"{Apiurl}?siteid={siteId.ToString()}");
|
||||
List<Role> roles = await GetJsonAsync<List<Role>>($"{Apiurl}?siteid={siteId}");
|
||||
return roles.OrderBy(item => item.Name).ToList();
|
||||
}
|
||||
|
||||
public async Task<Role> GetRoleAsync(int roleId)
|
||||
{
|
||||
return await GetJsonAsync<Role>($"{Apiurl}/{roleId.ToString()}");
|
||||
return await GetJsonAsync<Role>($"{Apiurl}/{roleId}");
|
||||
}
|
||||
|
||||
public async Task<Role> AddRoleAsync(Role role)
|
||||
@ -44,11 +38,11 @@ namespace Oqtane.Services
|
||||
|
||||
public async Task<Role> UpdateRoleAsync(Role role)
|
||||
{
|
||||
return await PutJsonAsync<Role>($"{Apiurl}/{role.RoleId.ToString()}", role);
|
||||
return await PutJsonAsync<Role>($"{Apiurl}/{role.RoleId}", role);
|
||||
}
|
||||
public async Task DeleteRoleAsync(int roleId)
|
||||
{
|
||||
await DeleteAsync($"{Apiurl}/{roleId.ToString()}");
|
||||
await DeleteAsync($"{Apiurl}/{roleId}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,6 @@ namespace Oqtane.Services
|
||||
_http = client;
|
||||
}
|
||||
|
||||
|
||||
protected async Task GetAsync(string uri)
|
||||
{
|
||||
var response = await _http.GetAsync(uri);
|
||||
@ -83,7 +82,6 @@ namespace Oqtane.Services
|
||||
var result = await response.Content.ReadFromJsonAsync<TResult>();
|
||||
return result;
|
||||
}
|
||||
|
||||
return default;
|
||||
}
|
||||
|
||||
@ -122,6 +120,8 @@ namespace Oqtane.Services
|
||||
if (response.StatusCode != HttpStatusCode.NoContent && response.StatusCode != HttpStatusCode.NotFound)
|
||||
{
|
||||
//TODO: Log errors here
|
||||
|
||||
Console.WriteLine($"Request: {response.RequestMessage.RequestUri}");
|
||||
Console.WriteLine($"Response status: {response.StatusCode} {response.ReasonPhrase}");
|
||||
}
|
||||
|
||||
@ -135,24 +135,31 @@ namespace Oqtane.Services
|
||||
//TODO Missing content JSON validation
|
||||
}
|
||||
|
||||
public static string CreateApiUrl(Alias alias, string absoluteUri, string serviceName)
|
||||
// create an API Url which is tenant agnostic ( for use with entities in the MasterDB )
|
||||
public string CreateApiUrl(string serviceName)
|
||||
{
|
||||
Uri uri = new Uri(absoluteUri);
|
||||
return CreateApiUrl(null, serviceName);
|
||||
}
|
||||
|
||||
// create an API Url which is tenant aware ( for use with entities in the TenantDB )
|
||||
public string CreateApiUrl(Alias alias, string serviceName)
|
||||
{
|
||||
string apiurl = "/";
|
||||
|
||||
if (Alias != null)
|
||||
{
|
||||
alias = Alias; // override the default alias ( for cross-tenant service calls )
|
||||
}
|
||||
|
||||
string apiurl;
|
||||
if (alias != null)
|
||||
{
|
||||
// build a url which passes the alias that may include a subfolder for multi-tenancy
|
||||
apiurl = $"{uri.Scheme}://{alias.Name}/";
|
||||
if (alias.Path == string.Empty)
|
||||
{
|
||||
apiurl += "~/";
|
||||
}
|
||||
// include the alias for multi-tenant context
|
||||
apiurl += $"{alias.AliasId}/";
|
||||
}
|
||||
else
|
||||
{
|
||||
// build a url which ignores any subfolder for multi-tenancy
|
||||
apiurl = $"{uri.Scheme}://{uri.Authority}/~/";
|
||||
// tenant agnostic
|
||||
apiurl += "~/";
|
||||
}
|
||||
|
||||
apiurl += $"api/{serviceName}";
|
||||
@ -160,15 +167,14 @@ namespace Oqtane.Services
|
||||
return apiurl;
|
||||
}
|
||||
|
||||
public static string CreateCrossTenantUrl(string url, Alias alias)
|
||||
{
|
||||
if (alias != null)
|
||||
{
|
||||
url += (url.Contains("?")) ? "&" : "?";
|
||||
url += "aliasid=" + alias.AliasId.ToString();
|
||||
}
|
||||
// can be used to override the default alias
|
||||
public Alias Alias { get; set; }
|
||||
|
||||
return url;
|
||||
[Obsolete("This method is obsolete. Use CreateApiUrl(Alias alias, string serviceName) instead.", false)]
|
||||
public string CreateApiUrl(Alias alias, string absoluteUri, string serviceName)
|
||||
{
|
||||
// only retained for short term backward compatibility
|
||||
return CreateApiUrl(alias, serviceName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System.Threading.Tasks;
|
||||
using System.Net.Http;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System.Collections.Generic;
|
||||
using Oqtane.Shared;
|
||||
|
||||
@ -12,20 +11,13 @@ namespace Oqtane.Services
|
||||
{
|
||||
|
||||
private readonly SiteState _siteState;
|
||||
private readonly NavigationManager _navigationManager;
|
||||
|
||||
public SettingService(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http)
|
||||
{
|
||||
|
||||
public SettingService(HttpClient http, SiteState siteState) : base(http)
|
||||
{
|
||||
_siteState = siteState;
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Setting"); }
|
||||
}
|
||||
|
||||
private string Apiurl => CreateApiUrl(_siteState.Alias, "Setting");
|
||||
public async Task<Dictionary<string, string>> GetTenantSettingsAsync()
|
||||
{
|
||||
return await GetSettingsAsync(EntityNames.Tenant, -1);
|
||||
@ -99,7 +91,7 @@ namespace Oqtane.Services
|
||||
public async Task<Dictionary<string, string>> GetSettingsAsync(string entityName, int entityId)
|
||||
{
|
||||
var dictionary = new Dictionary<string, string>();
|
||||
var settings = await GetJsonAsync<List<Setting>>($"{Apiurl}?entityname={entityName}&entityid={entityId.ToString()}");
|
||||
var settings = await GetJsonAsync<List<Setting>>($"{Apiurl}?entityname={entityName}&entityid={entityId}");
|
||||
|
||||
foreach(Setting setting in settings.OrderBy(item => item.SettingName).ToList())
|
||||
{
|
||||
@ -110,7 +102,7 @@ namespace Oqtane.Services
|
||||
|
||||
public async Task UpdateSettingsAsync(Dictionary<string, string> settings, string entityName, int entityId)
|
||||
{
|
||||
var settingsList = await GetJsonAsync<List<Setting>>($"{Apiurl}?entityname={entityName}&entityid={entityId.ToString()}");
|
||||
var settingsList = await GetJsonAsync<List<Setting>>($"{Apiurl}?entityname={entityName}&entityid={entityId}");
|
||||
|
||||
foreach (KeyValuePair<string, string> kvp in settings)
|
||||
{
|
||||
@ -138,7 +130,7 @@ namespace Oqtane.Services
|
||||
|
||||
public async Task<Setting> GetSettingAsync(int settingId)
|
||||
{
|
||||
return await GetJsonAsync<Setting>($"{Apiurl}/{settingId.ToString()}");
|
||||
return await GetJsonAsync<Setting>($"{Apiurl}/{settingId}");
|
||||
}
|
||||
|
||||
public async Task<Setting> AddSettingAsync(Setting setting)
|
||||
@ -148,12 +140,12 @@ namespace Oqtane.Services
|
||||
|
||||
public async Task<Setting> UpdateSettingAsync(Setting setting)
|
||||
{
|
||||
return await PutJsonAsync<Setting>($"{Apiurl}/{setting.SettingId.ToString()}", setting);
|
||||
return await PutJsonAsync<Setting>($"{Apiurl}/{setting.SettingId}", setting);
|
||||
}
|
||||
|
||||
public async Task DeleteSettingAsync(int settingId)
|
||||
{
|
||||
await DeleteAsync($"{Apiurl}/{settingId.ToString()}");
|
||||
await DeleteAsync($"{Apiurl}/{settingId}");
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System.Threading.Tasks;
|
||||
using System.Net.Http;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System.Collections.Generic;
|
||||
using Oqtane.Shared;
|
||||
|
||||
@ -12,44 +11,44 @@ namespace Oqtane.Services
|
||||
{
|
||||
|
||||
private readonly SiteState _siteState;
|
||||
private readonly NavigationManager _navigationManager;
|
||||
|
||||
public SiteService(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http)
|
||||
public SiteService(HttpClient http, SiteState siteState) : base(http)
|
||||
{
|
||||
|
||||
_siteState = siteState;
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string Apiurl
|
||||
private string Apiurl => CreateApiUrl(_siteState.Alias, "Site");
|
||||
|
||||
public void SetAlias(Alias alias)
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Site"); }
|
||||
base.Alias = alias;
|
||||
}
|
||||
|
||||
public async Task<List<Site>> GetSitesAsync(Alias alias)
|
||||
public async Task<List<Site>> GetSitesAsync()
|
||||
{
|
||||
List<Site> sites = await GetJsonAsync<List<Site>>(CreateCrossTenantUrl(Apiurl, alias));
|
||||
List<Site> sites = await GetJsonAsync<List<Site>>(Apiurl);
|
||||
return sites.OrderBy(item => item.Name).ToList();
|
||||
}
|
||||
|
||||
public async Task<Site> GetSiteAsync(int siteId, Alias alias)
|
||||
public async Task<Site> GetSiteAsync(int siteId)
|
||||
{
|
||||
return await GetJsonAsync<Site>(CreateCrossTenantUrl($"{Apiurl}/{siteId.ToString()}", alias));
|
||||
return await GetJsonAsync<Site>($"{Apiurl}/{siteId}");
|
||||
}
|
||||
|
||||
public async Task<Site> AddSiteAsync(Site site, Alias alias)
|
||||
public async Task<Site> AddSiteAsync(Site site)
|
||||
{
|
||||
return await PostJsonAsync<Site>(CreateCrossTenantUrl(Apiurl, alias), site);
|
||||
return await PostJsonAsync<Site>(Apiurl, site);
|
||||
}
|
||||
|
||||
public async Task<Site> UpdateSiteAsync(Site site, Alias alias)
|
||||
public async Task<Site> UpdateSiteAsync(Site site)
|
||||
{
|
||||
return await PutJsonAsync<Site>(CreateCrossTenantUrl($"{Apiurl}/{site.SiteId.ToString()}", alias), site);
|
||||
return await PutJsonAsync<Site>($"{Apiurl}/{site.SiteId}", site);
|
||||
}
|
||||
|
||||
public async Task DeleteSiteAsync(int siteId, Alias alias)
|
||||
public async Task DeleteSiteAsync(int siteId)
|
||||
{
|
||||
await DeleteAsync(CreateCrossTenantUrl($"{Apiurl}/{siteId.ToString()}", alias));
|
||||
await DeleteAsync($"{Apiurl}/{siteId}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,28 +3,14 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Oqtane.Shared;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
public class SiteTemplateService : ServiceBase, ISiteTemplateService
|
||||
{
|
||||
|
||||
private readonly SiteState _siteState;
|
||||
private readonly NavigationManager _navigationManager;
|
||||
public SiteTemplateService(HttpClient http) : base(http) { }
|
||||
|
||||
public SiteTemplateService(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http)
|
||||
{
|
||||
|
||||
_siteState = siteState;
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "SiteTemplate"); }
|
||||
}
|
||||
private string Apiurl => CreateApiUrl("SiteTemplate");
|
||||
|
||||
public async Task<List<SiteTemplate>> GetSiteTemplatesAsync()
|
||||
{
|
||||
|
@ -1,30 +1,14 @@
|
||||
using Oqtane.Models;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Oqtane.Shared;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
public class SqlService : ServiceBase, ISqlService
|
||||
{
|
||||
|
||||
private readonly SiteState _siteState;
|
||||
private readonly NavigationManager _navigationManager;
|
||||
public SqlService(HttpClient http) : base(http) { }
|
||||
|
||||
public SqlService(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http)
|
||||
{
|
||||
|
||||
_siteState = siteState;
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Sql"); }
|
||||
}
|
||||
private string Apiurl => CreateApiUrl("Sql");
|
||||
|
||||
public async Task<SqlQuery> ExecuteQueryAsync(SqlQuery sqlquery)
|
||||
{
|
||||
|
@ -1,28 +1,14 @@
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Oqtane.Shared;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
public class SystemService : ServiceBase, ISystemService
|
||||
{
|
||||
|
||||
private readonly SiteState _siteState;
|
||||
private readonly NavigationManager _navigationManager;
|
||||
public SystemService(HttpClient http) : base(http) { }
|
||||
|
||||
public SystemService(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http)
|
||||
{
|
||||
|
||||
_siteState = siteState;
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "System"); }
|
||||
}
|
||||
private string Apiurl => CreateApiUrl("System");
|
||||
|
||||
public async Task<Dictionary<string, string>> GetSystemInfoAsync()
|
||||
{
|
||||
|
@ -1,8 +1,6 @@
|
||||
using Oqtane.Models;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Oqtane.Shared;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
@ -10,21 +8,9 @@ namespace Oqtane.Services
|
||||
{
|
||||
public class TenantService : ServiceBase, ITenantService
|
||||
{
|
||||
|
||||
private readonly SiteState _siteState;
|
||||
private readonly NavigationManager _navigationManager;
|
||||
public TenantService(HttpClient http) : base(http) { }
|
||||
|
||||
public TenantService(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http)
|
||||
{
|
||||
|
||||
_siteState = siteState;
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Tenant"); }
|
||||
}
|
||||
private string Apiurl => CreateApiUrl("Tenant");
|
||||
|
||||
public async Task<List<Tenant>> GetTenantsAsync()
|
||||
{
|
||||
@ -34,7 +20,7 @@ namespace Oqtane.Services
|
||||
|
||||
public async Task<Tenant> GetTenantAsync(int tenantId)
|
||||
{
|
||||
return await GetJsonAsync<Tenant>($"{Apiurl}/{tenantId.ToString()}");
|
||||
return await GetJsonAsync<Tenant>($"{Apiurl}/{tenantId}");
|
||||
}
|
||||
|
||||
public async Task<Tenant> AddTenantAsync(Tenant tenant)
|
||||
@ -44,12 +30,12 @@ namespace Oqtane.Services
|
||||
|
||||
public async Task<Tenant> UpdateTenantAsync(Tenant tenant)
|
||||
{
|
||||
return await PutJsonAsync<Tenant>($"{Apiurl}/{tenant.TenantId.ToString()}", tenant);
|
||||
return await PutJsonAsync<Tenant>($"{Apiurl}/{tenant.TenantId}", tenant);
|
||||
}
|
||||
|
||||
public async Task DeleteTenantAsync(int tenantId)
|
||||
{
|
||||
await DeleteAsync($"{Apiurl}/{tenantId.ToString()}");
|
||||
await DeleteAsync($"{Apiurl}/{tenantId}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System.Reflection;
|
||||
using System;
|
||||
using Oqtane.Shared;
|
||||
@ -13,20 +12,13 @@ namespace Oqtane.Services
|
||||
public class ThemeService : ServiceBase, IThemeService
|
||||
{
|
||||
private readonly HttpClient _http;
|
||||
private readonly SiteState _siteState;
|
||||
private readonly NavigationManager _navigationManager;
|
||||
|
||||
public ThemeService(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http)
|
||||
public ThemeService(HttpClient http) : base(http)
|
||||
{
|
||||
_http = http;
|
||||
_siteState = siteState;
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Theme"); }
|
||||
}
|
||||
private string Apiurl => CreateApiUrl("Theme");
|
||||
|
||||
public async Task<List<Theme>> GetThemesAsync()
|
||||
{
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Oqtane.Shared;
|
||||
|
||||
namespace Oqtane.Services
|
||||
@ -11,28 +10,22 @@ namespace Oqtane.Services
|
||||
{
|
||||
|
||||
private readonly SiteState _siteState;
|
||||
private readonly NavigationManager _navigationManager;
|
||||
|
||||
public UserRoleService(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http)
|
||||
{
|
||||
|
||||
public UserRoleService(HttpClient http, SiteState siteState) : base(http)
|
||||
{
|
||||
_siteState = siteState;
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "UserRole"); }
|
||||
}
|
||||
private string Apiurl => CreateApiUrl(_siteState.Alias, "UserRole");
|
||||
|
||||
public async Task<List<UserRole>> GetUserRolesAsync(int siteId)
|
||||
{
|
||||
return await GetJsonAsync<List<UserRole>>($"{Apiurl}?siteid={siteId.ToString()}");
|
||||
return await GetJsonAsync<List<UserRole>>($"{Apiurl}?siteid={siteId}");
|
||||
}
|
||||
|
||||
public async Task<UserRole> GetUserRoleAsync(int userRoleId)
|
||||
{
|
||||
return await GetJsonAsync<UserRole>($"{Apiurl}/{userRoleId.ToString()}");
|
||||
return await GetJsonAsync<UserRole>($"{Apiurl}/{userRoleId}");
|
||||
}
|
||||
|
||||
public async Task<UserRole> AddUserRoleAsync(UserRole userRole)
|
||||
@ -42,12 +35,12 @@ namespace Oqtane.Services
|
||||
|
||||
public async Task<UserRole> UpdateUserRoleAsync(UserRole userRole)
|
||||
{
|
||||
return await PutJsonAsync<UserRole>($"{Apiurl}/{userRole.UserRoleId.ToString()}", userRole);
|
||||
return await PutJsonAsync<UserRole>($"{Apiurl}/{userRole.UserRoleId}", userRole);
|
||||
}
|
||||
|
||||
public async Task DeleteUserRoleAsync(int userRoleId)
|
||||
{
|
||||
await DeleteAsync($"{Apiurl}/{userRoleId.ToString()}");
|
||||
await DeleteAsync($"{Apiurl}/{userRoleId}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
using Oqtane.Shared;
|
||||
using Oqtane.Models;
|
||||
using System.Net.Http;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Services
|
||||
@ -9,18 +8,13 @@ namespace Oqtane.Services
|
||||
public class UserService : ServiceBase, IUserService
|
||||
{
|
||||
private readonly SiteState _siteState;
|
||||
private readonly NavigationManager _navigationManager;
|
||||
|
||||
public UserService(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http)
|
||||
public UserService(HttpClient http, SiteState siteState) : base(http)
|
||||
{
|
||||
_siteState = siteState;
|
||||
_navigationManager = navigationManager;
|
||||
}
|
||||
|
||||
private string Apiurl
|
||||
{
|
||||
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "User"); }
|
||||
}
|
||||
private string Apiurl => CreateApiUrl(_siteState.Alias, "User");
|
||||
|
||||
public async Task<User> GetUserAsync(int userId, int siteId)
|
||||
{
|
||||
@ -37,11 +31,6 @@ namespace Oqtane.Services
|
||||
return await PostJsonAsync<User>(Apiurl, user);
|
||||
}
|
||||
|
||||
public async Task<User> AddUserAsync(User user, Alias alias)
|
||||
{
|
||||
return await PostJsonAsync<User>(CreateCrossTenantUrl(Apiurl, alias), user);
|
||||
}
|
||||
|
||||
public async Task<User> UpdateUserAsync(User user)
|
||||
{
|
||||
return await PutJsonAsync<User>($"{Apiurl}/{user.UserId}", user);
|
||||
|
@ -2,7 +2,9 @@
|
||||
@inherits ContainerBase
|
||||
<div class="container">
|
||||
<div class="row px-4">
|
||||
<ModuleActions /><h2><ModuleTitle /></h2>
|
||||
<div class="d-flex flex-nowrap">
|
||||
<ModuleActions /><h2><ModuleTitle /></h2>
|
||||
</div>
|
||||
<hr class="app-rule" />
|
||||
</div>
|
||||
<div class="row px-4">
|
||||
|
@ -7,15 +7,7 @@
|
||||
|
||||
<div class="sidebar">
|
||||
<nav class="navbar">
|
||||
<Logo />
|
||||
<button class="navbar-toggler" aria-expanded="false" aria-controls="navbarSupportedContent"
|
||||
aria-label="Toggle navigation" type="button" data-toggle="collapse"
|
||||
data-target="#navbarSupportedContent">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<Menu Orientation="Vertical" />
|
||||
</div>
|
||||
<Logo /><Menu Orientation="Vertical" />
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
|
@ -1,26 +1,33 @@
|
||||
@namespace Oqtane.Themes.Controls
|
||||
@inherits ThemeControlBase
|
||||
@inherits ThemeControlBase
|
||||
@attribute [OqtaneIgnore]
|
||||
|
||||
@if (BreadCrumbPages.Any())
|
||||
{
|
||||
<ol class="breadcrumb">
|
||||
@foreach (var p in BreadCrumbPages)
|
||||
{
|
||||
<li class="breadcrumb-item @ActiveClass(p)">
|
||||
<a href="@NavigateUrl(p.Path)">@p.Name</a>
|
||||
</li>
|
||||
}
|
||||
</ol>
|
||||
<span class="app-breadcrumbs">
|
||||
<ol class="breadcrumb">
|
||||
@foreach (var p in BreadCrumbPages)
|
||||
{
|
||||
if (p.PageId == PageState.Page.PageId)
|
||||
{
|
||||
<li class="breadcrumb-item active">
|
||||
<a href="@NavigateUrl(p.Path)">@p.Name</a>
|
||||
</li>
|
||||
}
|
||||
else
|
||||
{
|
||||
<li class="breadcrumb-item">
|
||||
<a href="@NavigateUrl(p.Path)">@p.Name</a>
|
||||
</li>
|
||||
}
|
||||
}
|
||||
</ol>
|
||||
</span>
|
||||
}
|
||||
|
||||
@code {
|
||||
|
||||
protected IEnumerable<Page> BreadCrumbPages => GetBreadCrumbPages().Reverse().ToList();
|
||||
|
||||
protected string ActiveClass(Page page)
|
||||
{
|
||||
return (page.PageId == PageState.Page.PageId) ? " active" : string.Empty;
|
||||
}
|
||||
|
||||
private IEnumerable<Page> GetBreadCrumbPages()
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
@namespace Oqtane.Themes.Controls
|
||||
@using Oqtane.Enums
|
||||
@inherits ThemeControlBase
|
||||
@inherits ThemeControlBase
|
||||
@attribute [OqtaneIgnore]
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IUserService UserService
|
||||
@inject IModuleDefinitionService ModuleDefinitionService
|
||||
@ -16,7 +16,7 @@
|
||||
|
||||
<div class="@CardClass">
|
||||
<div class="@HeaderClass">
|
||||
Control Panel
|
||||
<span class="font-weight-bold">Control Panel</span>
|
||||
<button type="button" class="close" @onclick="HideControlPanel" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
@ -245,17 +245,17 @@
|
||||
{
|
||||
if (string.IsNullOrEmpty(ButtonClass))
|
||||
{
|
||||
ButtonClass = "btn-outline-primary";
|
||||
ButtonClass = "btn-outline-secondary";
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(CardClass))
|
||||
{
|
||||
CardClass = "card bg-secondary mb-3";
|
||||
CardClass = "card border-secondary mb-3";
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(HeaderClass))
|
||||
{
|
||||
HeaderClass = "card-header text-white";
|
||||
HeaderClass = "card-header";
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(BodyClass))
|
||||
@ -361,6 +361,7 @@
|
||||
module.SiteId = PageState.Site.SiteId;
|
||||
module.PageId = PageState.Page.PageId;
|
||||
module.ModuleDefinitionName = _moduleDefinitionName;
|
||||
module.AllPages = false;
|
||||
module.Permissions = PageState.Page.Permissions;
|
||||
module = await ModuleService.AddModuleAsync(module);
|
||||
_moduleId = module.ModuleId.ToString();
|
||||
|
@ -1,14 +1,17 @@
|
||||
@namespace Oqtane.Themes.Controls
|
||||
@inherits LoginBase
|
||||
@inherits LoginBase
|
||||
@attribute [OqtaneIgnore]
|
||||
|
||||
<AuthorizeView>
|
||||
<Authorizing>
|
||||
<text>...</text>
|
||||
</Authorizing>
|
||||
<Authorized>
|
||||
<button type="button" class="btn btn-primary" @onclick="LogoutUser">Logout</button>
|
||||
</Authorized>
|
||||
<NotAuthorized>
|
||||
<button type="button" class="btn btn-primary" @onclick="LoginUser">Login</button>
|
||||
</NotAuthorized>
|
||||
</AuthorizeView>
|
||||
<span class="app-login">
|
||||
<AuthorizeView>
|
||||
<Authorizing>
|
||||
<text>...</text>
|
||||
</Authorizing>
|
||||
<Authorized>
|
||||
<button type="button" class="btn btn-primary" @onclick="LogoutUser">Logout</button>
|
||||
</Authorized>
|
||||
<NotAuthorized>
|
||||
<button type="button" class="btn btn-primary" @onclick="LoginUser">Login</button>
|
||||
</NotAuthorized>
|
||||
</AuthorizeView>
|
||||
</span>
|
@ -35,7 +35,7 @@ namespace Oqtane.Themes.Controls
|
||||
var interop = new Interop(jsRuntime);
|
||||
string antiforgerytoken = await interop.GetElementByName("__RequestVerificationToken");
|
||||
var fields = new { __RequestVerificationToken = antiforgerytoken, returnurl = (PageState.Alias.Path + "/" + PageState.Page.Path) };
|
||||
await interop.SubmitForm("/pages/logout/", fields);
|
||||
await interop.SubmitForm($"/{PageState.Alias.AliasId}/pages/logout/", fields);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1,21 +1,13 @@
|
||||
@namespace Oqtane.Themes.Controls
|
||||
@inherits ThemeControlBase
|
||||
@inject NavigationManager NavigationManager
|
||||
@inherits ThemeControlBase
|
||||
@attribute [OqtaneIgnore]
|
||||
|
||||
@if (PageState.Site.LogoFileId != null)
|
||||
{
|
||||
<a href="@Href">
|
||||
<img class="img-fluid" src="@ContentUrl(PageState.Site.LogoFileId.Value)" alt="@PageState.Site.Name"/>
|
||||
</a>
|
||||
<span class="app-logo">
|
||||
<a href="@PageState.Alias.Path">
|
||||
<img class="img-fluid" src="@ContentUrl(PageState.Site.LogoFileId.Value)" alt="@PageState.Site.Name" />
|
||||
</a>
|
||||
</span>
|
||||
}
|
||||
|
||||
@code {
|
||||
string Href
|
||||
{
|
||||
get
|
||||
{
|
||||
var uri = new Uri(NavigationManager.Uri);
|
||||
return $"{uri.Scheme}://{uri.Authority}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,14 @@
|
||||
@namespace Oqtane.Themes.Controls
|
||||
@inherits MenuBase
|
||||
@attribute [OqtaneIgnore]
|
||||
@if (MenuPages.Any())
|
||||
{
|
||||
<div class="app-menu">
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#Menu" aria-controls="Menu" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="app-menu-toggler">
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#Menu" aria-controls="Menu" aria-expanded="false" aria-label="Toggle Navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
</span>
|
||||
<div class="app-menu">
|
||||
<div class="collapse navbar-collapse" id="Menu">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
@foreach (var p in MenuPages)
|
||||
|
@ -1,27 +1,34 @@
|
||||
@namespace Oqtane.Themes.Controls
|
||||
@inherits MenuBase
|
||||
@attribute [OqtaneIgnore]
|
||||
@if (MenuPages.Any())
|
||||
{
|
||||
<span class="app-menu-toggler">
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#Menu" aria-controls="Menu" aria-expanded="false" aria-label="Toggle Navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
</span>
|
||||
<div class="app-menu">
|
||||
<ul class="nav flex-column">
|
||||
@foreach (var p in MenuPages)
|
||||
{
|
||||
<li class="nav-item px-3">
|
||||
<a href="@GetUrl(p)" class="nav-link" style="padding-left:@((p.Level + 1) * 15)px !important;" target="@GetTarget(p)">
|
||||
<div class="collapse navbar-collapse" id="Menu">
|
||||
<ul class="nav flex-column">
|
||||
@foreach (var p in MenuPages)
|
||||
{
|
||||
<li class="nav-item px-3">
|
||||
<a href="@GetUrl(p)" class="nav-link" style="padding-left:@((p.Level + 1) * 15)px !important;" target="@GetTarget(p)">
|
||||
|
||||
@if (p.HasChildren)
|
||||
{
|
||||
<i class="oi oi-chevron-right"></i>
|
||||
}
|
||||
@if (p.Icon != string.Empty)
|
||||
{
|
||||
<span class="oi oi-@p.Icon" aria-hidden="true"></span>
|
||||
}
|
||||
@p.Name
|
||||
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
@if (p.HasChildren)
|
||||
{
|
||||
<i class="oi oi-chevron-right"></i>
|
||||
}
|
||||
@if (p.Icon != string.Empty)
|
||||
{
|
||||
<span class="oi oi-@p.Icon" aria-hidden="true"></span>
|
||||
}
|
||||
@p.Name
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
@ -1,20 +1,23 @@
|
||||
@namespace Oqtane.Themes.Controls
|
||||
@inherits ModuleActionsBase
|
||||
@inherits ModuleActionsBase
|
||||
@attribute [OqtaneIgnore]
|
||||
|
||||
@if (PageState.EditMode && !PageState.Page.EditMode && UserSecurity.IsAuthorized(PageState.User,PermissionNames.Edit, ModuleState.Permissions))
|
||||
{
|
||||
<a class="nav-link dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"></a>
|
||||
<div class="dropdown-menu" x-placement="bottom-start" style="position: absolute; will-change: transform; top: 0px; left: 0px; transform: translate3d(0px, 37px, 0px);">
|
||||
@foreach (var action in Actions)
|
||||
{
|
||||
if (string.IsNullOrEmpty(action.Name))
|
||||
{
|
||||
<div class="dropdown-divider"></div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<a class="dropdown-item" @onclick="(async () => await ModuleAction(action))">@action.Name</a>
|
||||
}
|
||||
}
|
||||
<div class="app-moduleactions">
|
||||
<a class="nav-link dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"></a>
|
||||
<div class="dropdown-menu" x-placement="bottom-start" style="position: absolute; will-change: transform; top: 0px; left: 0px; transform: translate3d(0px, 37px, 0px);">
|
||||
@foreach (var action in Actions)
|
||||
{
|
||||
if (string.IsNullOrEmpty(action.Name))
|
||||
{
|
||||
<div class="dropdown-divider"></div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<a class="dropdown-item" @onclick="(async () => await ModuleAction(action))">@action.Name</a>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
@ -75,8 +75,7 @@ namespace Oqtane.Themes.Controls
|
||||
private async Task<string> EditUrlAsync(string url, int moduleId, string import)
|
||||
{
|
||||
await Task.Yield();
|
||||
EditUrl(moduleId, import);
|
||||
return url;
|
||||
return EditUrl(moduleId, import);
|
||||
}
|
||||
|
||||
protected async Task ModuleAction(ActionViewModel action)
|
||||
|
@ -1,7 +1,10 @@
|
||||
@namespace Oqtane.Themes.Controls
|
||||
@inherits ContainerBase
|
||||
@inherits ContainerBase
|
||||
@attribute [OqtaneIgnore]
|
||||
|
||||
@((MarkupString)title)
|
||||
<span class="app-moduletitle">
|
||||
@((MarkupString)title)
|
||||
</span>
|
||||
|
||||
@code {
|
||||
private string title = "";
|
||||
|
@ -1,22 +1,24 @@
|
||||
@namespace Oqtane.Themes.Controls
|
||||
@inherits ThemeControlBase
|
||||
@inherits ThemeControlBase
|
||||
@attribute [OqtaneIgnore]
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
<AuthorizeView>
|
||||
<Authorizing>
|
||||
<text>...</text>
|
||||
</Authorizing>
|
||||
<Authorized>
|
||||
<button type="button" class="btn btn-primary" @onclick="UpdateProfile">@context.User.Identity.Name</button>
|
||||
</Authorized>
|
||||
<NotAuthorized>
|
||||
@if (PageState.Site.AllowRegistration)
|
||||
{
|
||||
<button type="button" class="btn btn-primary" @onclick="RegisterUser">Register</button>
|
||||
}
|
||||
</NotAuthorized>
|
||||
</AuthorizeView>
|
||||
|
||||
<span class="app-profile">
|
||||
<AuthorizeView>
|
||||
<Authorizing>
|
||||
<text>...</text>
|
||||
</Authorizing>
|
||||
<Authorized>
|
||||
<button type="button" class="btn btn-primary" @onclick="UpdateProfile">@context.User.Identity.Name</button>
|
||||
</Authorized>
|
||||
<NotAuthorized>
|
||||
@if (PageState.Site.AllowRegistration)
|
||||
{
|
||||
<button type="button" class="btn btn-primary" @onclick="RegisterUser">Register</button>
|
||||
}
|
||||
</NotAuthorized>
|
||||
</AuthorizeView>
|
||||
</span>
|
||||
|
||||
@code {
|
||||
|
||||
|
@ -2,7 +2,9 @@
|
||||
@inherits ContainerBase
|
||||
<div class="container">
|
||||
<div class="row px-4">
|
||||
<ModuleActions /><h2><ModuleTitle /></h2>
|
||||
<div class="d-flex flex-nowrap">
|
||||
<ModuleActions /><h2><ModuleTitle /></h2>
|
||||
</div>
|
||||
<hr class="app-rule" />
|
||||
</div>
|
||||
<div class="row px-4">
|
||||
|
@ -3,9 +3,12 @@
|
||||
|
||||
<main role="main">
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-primary fixed-top">
|
||||
<Logo /><Menu Orientation="Horizontal" /><div class="ml-md-auto"><UserProfile /> <Login /> <ControlPanel ButtonClass="btn-outline-secondary" CardClass="bg-light" /></div>
|
||||
<Logo /><Menu Orientation="Horizontal" />
|
||||
<div class="controls ml-md-auto">
|
||||
<div class="controls-group"><UserProfile /> <Login /> <ControlPanel /></div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container">
|
||||
<div class="content container">
|
||||
<PaneLayout />
|
||||
<div class="row px-4">
|
||||
<Pane Name="Admin" />
|
||||
@ -18,6 +21,9 @@
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
// go to https://www.bootstrapcdn.com/bootswatch/ and take your favorite theme
|
||||
//<link href="https://stackpath.bootstrapcdn.com/bootswatch/4.4.1/cyborg/bootstrap.min.css" rel="stylesheet" integrity="sha384-l7xaoY0cJM4h9xh1RfazbgJVUZvdtyLWPueWNtLAphf/UbBgOVzqbOTogxPwYLHM" crossorigin="anonymous">
|
||||
await LoadBootstrapTheme("https://stackpath.bootstrapcdn.com/bootswatch/4.4.1/cyborg/bootstrap.min.css","sha384-l7xaoY0cJM4h9xh1RfazbgJVUZvdtyLWPueWNtLAphf/UbBgOVzqbOTogxPwYLHM");
|
||||
await IncludeCSS("Theme.css");
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using Oqtane.Shared;
|
||||
using Oqtane.UI;
|
||||
@ -30,6 +30,13 @@ namespace Oqtane.Themes
|
||||
await interop.IncludeCSS("Theme", Url);
|
||||
}
|
||||
|
||||
public async Task LoadBootstrapTheme(string url, string integrity = null)
|
||||
{
|
||||
var interop = new Interop(JSRuntime);
|
||||
string crossorigin = string.IsNullOrEmpty(integrity) ? string.Empty : "anonymous";
|
||||
await interop.IncludeLink("bootstrap", "stylesheet", url, "text/css", integrity, crossorigin);
|
||||
}
|
||||
|
||||
public string NavigateUrl()
|
||||
{
|
||||
return NavigateUrl(PageState.Page.Path);
|
||||
|
@ -41,7 +41,7 @@ namespace Oqtane.Themes
|
||||
|
||||
public string ContentUrl(int fileid)
|
||||
{
|
||||
return Utilities.ContentUrl(PageState.Alias.Path, fileid);
|
||||
return Utilities.ContentUrl(PageState.Alias, fileid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,6 @@
|
||||
@namespace Oqtane.UI
|
||||
@using System.Diagnostics.CodeAnalysis
|
||||
@using System.Runtime.InteropServices
|
||||
@namespace Oqtane.UI
|
||||
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||
@inject SiteState SiteState
|
||||
@inject NavigationManager NavigationManager
|
||||
@ -11,9 +13,6 @@
|
||||
@inject IModuleService ModuleService
|
||||
@inject IModuleDefinitionService ModuleDefinitionService
|
||||
@inject ILogService LogService
|
||||
@using System.Diagnostics.CodeAnalysis
|
||||
@using Oqtane.Enums
|
||||
@using System.Runtime.InteropServices
|
||||
@implements IHandleAfterRender
|
||||
|
||||
@DynamicComponent
|
||||
@ -84,20 +83,13 @@
|
||||
var lastsyncdate = DateTime.UtcNow;
|
||||
var runtime = GetRuntime();
|
||||
|
||||
// get Url path and querystring ( and remove anchors )
|
||||
var path = new Uri(_absoluteUri).PathAndQuery.Substring(1);
|
||||
if (path.IndexOf("#") != -1)
|
||||
{
|
||||
path = path.Substring(0, path.IndexOf("#"));
|
||||
}
|
||||
Uri uri = new Uri(_absoluteUri);
|
||||
|
||||
// parse querystring and remove
|
||||
var querystring = new Dictionary<string, string>();
|
||||
if (path.IndexOf("?") != -1)
|
||||
{
|
||||
querystring = ParseQueryString(path);
|
||||
path = path.Substring(0, path.IndexOf("?"));
|
||||
}
|
||||
// get path
|
||||
var path = uri.LocalPath.Substring(1);
|
||||
|
||||
// parse querystring
|
||||
var querystring = ParseQueryString(uri.Query);
|
||||
|
||||
// the reload parameter is used during user login/logout
|
||||
if (querystring.ContainsKey("reload"))
|
||||
@ -111,7 +103,7 @@
|
||||
lastsyncdate = PageState.LastSyncDate;
|
||||
}
|
||||
|
||||
alias = await AliasService.GetAliasAsync(_absoluteUri, lastsyncdate);
|
||||
alias = await AliasService.GetAliasAsync(path, lastsyncdate);
|
||||
SiteState.Alias = alias; // set state for services
|
||||
lastsyncdate = alias.SyncDate;
|
||||
|
||||
@ -130,14 +122,14 @@
|
||||
|
||||
if (reload == Reload.Site || PageState == null || alias.SiteId != PageState.Alias.SiteId)
|
||||
{
|
||||
site = await SiteService.GetSiteAsync(alias.SiteId, alias);
|
||||
site = await SiteService.GetSiteAsync(alias.SiteId);
|
||||
reload = Reload.Site;
|
||||
}
|
||||
else
|
||||
{
|
||||
site = PageState.Site;
|
||||
}
|
||||
|
||||
|
||||
if (site != null)
|
||||
{
|
||||
if (PageState == null || reload == Reload.Site)
|
||||
@ -175,9 +167,9 @@
|
||||
|
||||
// format path and remove alias
|
||||
path = path.Replace("//", "/");
|
||||
|
||||
|
||||
if (!path.EndsWith("/"))
|
||||
{
|
||||
{
|
||||
path += "/";
|
||||
}
|
||||
|
||||
@ -205,7 +197,7 @@
|
||||
path = path.Replace(moduleid.ToString() + "/", "");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// remove trailing slash so it can be used as a key for Pages
|
||||
if (path.EndsWith("/")) path = path.Substring(0, path.Length - 1);
|
||||
|
||||
@ -217,7 +209,7 @@
|
||||
{
|
||||
page = PageState.Page;
|
||||
}
|
||||
|
||||
|
||||
// failsafe in case router cannot locate the home page for the site
|
||||
if (page == null && path == "")
|
||||
{
|
||||
@ -244,7 +236,7 @@
|
||||
}
|
||||
|
||||
// check if user is authorized to view page
|
||||
if (UserSecurity.IsAuthorized(user,PermissionNames.View, page.Permissions))
|
||||
if (UserSecurity.IsAuthorized(user, PermissionNames.View, page.Permissions))
|
||||
{
|
||||
page = await ProcessPage(page, site, user);
|
||||
|
||||
@ -321,16 +313,17 @@
|
||||
_navigationInterceptionEnabled = true;
|
||||
return NavigationInterception.EnableNavigationInterceptionAsync();
|
||||
}
|
||||
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private Dictionary<string, string> ParseQueryString(string path)
|
||||
private Dictionary<string, string> ParseQueryString(string query)
|
||||
{
|
||||
Dictionary<string, string> querystring = new Dictionary<string, string>();
|
||||
if (path.IndexOf("?") != -1)
|
||||
if (!string.IsNullOrEmpty(query))
|
||||
{
|
||||
foreach (string kvp in path.Substring(path.IndexOf("?") + 1).Split(new[] { '&' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
query = query.Substring(1); // ignore "?"
|
||||
foreach (string kvp in query.Split(new[] { '&' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
if (kvp != "")
|
||||
{
|
||||
@ -341,12 +334,11 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
querystring.Add(kvp, "true"); // default querystring when no value is provided
|
||||
querystring.Add(kvp, "true"); // default parameter when no value is provided
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return querystring;
|
||||
}
|
||||
|
||||
@ -366,7 +358,7 @@
|
||||
page.LayoutType = site.DefaultLayoutType;
|
||||
}
|
||||
Type type;
|
||||
|
||||
|
||||
if (!string.IsNullOrEmpty(page.LayoutType))
|
||||
{
|
||||
type = Type.GetType(page.LayoutType);
|
||||
@ -375,7 +367,7 @@
|
||||
{
|
||||
type = Type.GetType(page.ThemeType);
|
||||
}
|
||||
|
||||
|
||||
var property = type.GetProperty("Panes");
|
||||
page.Panes = (string)property.GetValue(Activator.CreateInstance(type), null);
|
||||
}
|
||||
@ -383,7 +375,7 @@
|
||||
{
|
||||
// error loading theme or layout
|
||||
}
|
||||
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
@ -403,7 +395,7 @@
|
||||
{
|
||||
typename = Constants.ErrorModule;
|
||||
}
|
||||
|
||||
|
||||
if (module.ModuleId == moduleid && control != "")
|
||||
{
|
||||
// check if the module defines custom routes
|
||||
@ -459,7 +451,7 @@
|
||||
{
|
||||
paneindex.Add(module.Pane, 0);
|
||||
}
|
||||
|
||||
|
||||
module.PaneModuleIndex = paneindex[module.Pane];
|
||||
|
||||
if (string.IsNullOrEmpty(module.ContainerType))
|
||||
@ -473,12 +465,12 @@
|
||||
{
|
||||
module.PaneModuleCount = paneindex[module.Pane] + 1;
|
||||
}
|
||||
|
||||
|
||||
return modules;
|
||||
}
|
||||
|
||||
private Runtime GetRuntime()
|
||||
=> RuntimeInformation.IsOSPlatform(OSPlatform.Create("WEBASSEMBLY"))
|
||||
=> RuntimeInformation.IsOSPlatform(OSPlatform.Create("BROWSER"))
|
||||
? Runtime.WebAssembly
|
||||
: Runtime.Server;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
}
|
||||
if (PageState.Site.FaviconFileId != null)
|
||||
{
|
||||
await interop.IncludeLink("fav-icon", "shortcut icon", Utilities.ContentUrl(PageState.Alias.Path, PageState.Site.FaviconFileId.Value), "image/x-icon", "", "");
|
||||
await interop.IncludeLink("fav-icon", "shortcut icon", Utilities.ContentUrl(PageState.Alias, PageState.Site.FaviconFileId.Value), "image/x-icon", "", "");
|
||||
}
|
||||
if (PageState.Site.PwaIsEnabled)
|
||||
{
|
||||
@ -59,11 +59,11 @@
|
||||
"\"background_color\": \"#fff\", " +
|
||||
"\"description\": \"" + PageState.Site.Name + "\", " +
|
||||
"\"icons\": [{ " +
|
||||
"\"src\": \"" + Utilities.ContentUrl(PageState.Alias.Path, PageState.Site.PwaAppIconFileId.Value) + "\", " +
|
||||
"\"src\": \"" + Utilities.ContentUrl(PageState.Alias, PageState.Site.PwaAppIconFileId.Value) + "\", " +
|
||||
"\"sizes\": \"192x192\", " +
|
||||
"\"type\": \"image/png\" " +
|
||||
"}, { " +
|
||||
"\"src\": \"" + Utilities.ContentUrl(PageState.Alias.Path, PageState.Site.PwaSplashIconFileId.Value) + "\", " +
|
||||
"\"src\": \"" + Utilities.ContentUrl(PageState.Alias, PageState.Site.PwaSplashIconFileId.Value) + "\", " +
|
||||
"\"sizes\": \"512x512\", " +
|
||||
"\"type\": \"image/png\" " +
|
||||
"}] " +
|
||||
|
@ -17,4 +17,5 @@
|
||||
@using Oqtane.Shared
|
||||
@using Oqtane.Themes
|
||||
@using Oqtane.Themes.Controls
|
||||
@using Oqtane.UI
|
||||
@using Oqtane.UI
|
||||
@using Oqtane.Enums
|
||||
|
@ -2,7 +2,7 @@
|
||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>Oqtane.Framework</id>
|
||||
<version>0.9.0</version>
|
||||
<version>0.9.1</version>
|
||||
<authors>Shaun Walker</authors>
|
||||
<owners>.NET Foundation</owners>
|
||||
<title>Oqtane Framework</title>
|
||||
|
@ -10,19 +10,22 @@ using System.Globalization;
|
||||
using Oqtane.Enums;
|
||||
using Oqtane.Infrastructure;
|
||||
using Oqtane.Repository;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace Oqtane.Controllers
|
||||
{
|
||||
[Route("{site}/api/[controller]")]
|
||||
[Route("{alias}/api/[controller]")]
|
||||
public class AliasController : Controller
|
||||
{
|
||||
private readonly IAliasRepository _aliases;
|
||||
private readonly IHttpContextAccessor _accessor;
|
||||
private readonly ISyncManager _syncManager;
|
||||
private readonly ILogManager _logger;
|
||||
|
||||
public AliasController(IAliasRepository aliases, ISyncManager syncManager, ILogManager logger)
|
||||
public AliasController(IAliasRepository aliases, IHttpContextAccessor accessor, ISyncManager syncManager, ILogManager logger)
|
||||
{
|
||||
_aliases = aliases;
|
||||
_accessor = accessor;
|
||||
_syncManager = syncManager;
|
||||
_logger = logger;
|
||||
}
|
||||
@ -43,20 +46,30 @@ namespace Oqtane.Controllers
|
||||
return _aliases.GetAlias(id);
|
||||
}
|
||||
|
||||
// GET api/<controller>/name/localhost:12345?lastsyncdate=yyyyMMddHHmmssfff
|
||||
// GET api/<controller>/name/xxx?sync=yyyyMMddHHmmssfff
|
||||
[HttpGet("name/{name}")]
|
||||
public Alias Get(string name, string lastsyncdate)
|
||||
public Alias Get(string name, string sync)
|
||||
{
|
||||
name = WebUtility.UrlDecode(name);
|
||||
List<Alias> aliases = _aliases.GetAliases().ToList();
|
||||
List<Alias> aliases = _aliases.GetAliases().ToList(); // cached
|
||||
Alias alias = null;
|
||||
alias = aliases.FirstOrDefault(item => item.Name == name);
|
||||
if (name != null && (alias == null && name.Contains("/")))
|
||||
if (_accessor.HttpContext != null)
|
||||
{
|
||||
// lookup alias without folder name
|
||||
alias = aliases.Find(item => item.Name == name.Substring(0, name.IndexOf("/", StringComparison.Ordinal)));
|
||||
name = (name == "~") ? "" : name;
|
||||
name = _accessor.HttpContext.Request.Host.Value + "/" + WebUtility.UrlDecode(name);
|
||||
var segments = name.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
// iterate segments in reverse order
|
||||
for (int i = segments.Length; i > 0; i--)
|
||||
{
|
||||
name = string.Join("/", segments, 0, i);
|
||||
alias = aliases.Find(item => item.Name == name);
|
||||
if (alias != null)
|
||||
{
|
||||
break; // found a matching alias
|
||||
}
|
||||
}
|
||||
}
|
||||
if (alias == null && aliases.Count > 0)
|
||||
if (alias == null && aliases.Any())
|
||||
{
|
||||
// use first alias if name does not exist
|
||||
alias = aliases.FirstOrDefault();
|
||||
@ -66,7 +79,7 @@ namespace Oqtane.Controllers
|
||||
if (alias != null)
|
||||
{
|
||||
alias.SyncDate = DateTime.UtcNow;
|
||||
alias.SyncEvents = _syncManager.GetSyncEvents(DateTime.ParseExact(lastsyncdate, "yyyyMMddHHmmssfff", CultureInfo.InvariantCulture));
|
||||
alias.SyncEvents = _syncManager.GetSyncEvents(alias.TenantId, DateTime.ParseExact(sync, "yyyyMMddHHmmssfff", CultureInfo.InvariantCulture));
|
||||
}
|
||||
return alias;
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ using Oqtane.Repository;
|
||||
|
||||
namespace Oqtane.Controllers
|
||||
{
|
||||
[Route("{site}/api/[controller]")]
|
||||
[Route("{alias}/api/[controller]")]
|
||||
public class FileController : Controller
|
||||
{
|
||||
private readonly IWebHostEnvironment _environment;
|
||||
|
@ -14,7 +14,7 @@ using System.IO;
|
||||
|
||||
namespace Oqtane.Controllers
|
||||
{
|
||||
[Route("{site}/api/[controller]")]
|
||||
[Route("{alias}/api/[controller]")]
|
||||
public class FolderController : Controller
|
||||
{
|
||||
private readonly IFolderRepository _folders;
|
||||
|
@ -7,7 +7,7 @@ using Oqtane.Infrastructure;
|
||||
|
||||
namespace Oqtane.Controllers
|
||||
{
|
||||
[Route("{site}/api/[controller]")]
|
||||
[Route("{alias}/api/[controller]")]
|
||||
public class InstallationController : Controller
|
||||
{
|
||||
private readonly IConfigurationRoot _config;
|
||||
|
@ -12,7 +12,7 @@ using Oqtane.Repository;
|
||||
|
||||
namespace Oqtane.Controllers
|
||||
{
|
||||
[Route("{site}/api/[controller]")]
|
||||
[Route("{alias}/api/[controller]")]
|
||||
public class JobController : Controller
|
||||
{
|
||||
private readonly IJobRepository _jobs;
|
||||
|
@ -9,7 +9,7 @@ using Oqtane.Repository;
|
||||
|
||||
namespace Oqtane.Controllers
|
||||
{
|
||||
[Route("{site}/api/[controller]")]
|
||||
[Route("{alias}/api/[controller]")]
|
||||
public class JobLogController : Controller
|
||||
{
|
||||
private readonly IJobLogRepository _jobLogs;
|
||||
|
@ -9,7 +9,7 @@ using Oqtane.Shared;
|
||||
namespace Oqtane.Controllers
|
||||
{
|
||||
|
||||
[Route("{site}/api/[controller]")]
|
||||
[Route("{alias}/api/[controller]")]
|
||||
public class LogController : Controller
|
||||
{
|
||||
private readonly ILogManager _logger;
|
||||
|
@ -11,19 +11,21 @@ using Oqtane.Security;
|
||||
|
||||
namespace Oqtane.Controllers
|
||||
{
|
||||
[Route("{site}/api/[controller]")]
|
||||
[Route("{alias}/api/[controller]")]
|
||||
public class ModuleController : Controller
|
||||
{
|
||||
private readonly IModuleRepository _modules;
|
||||
private readonly IPageModuleRepository _pageModules;
|
||||
private readonly IPageRepository _pages;
|
||||
private readonly IModuleDefinitionRepository _moduleDefinitions;
|
||||
private readonly IUserPermissions _userPermissions;
|
||||
private readonly ILogManager _logger;
|
||||
|
||||
public ModuleController(IModuleRepository modules, IPageModuleRepository pageModules, IModuleDefinitionRepository moduleDefinitions, IUserPermissions userPermissions, ILogManager logger)
|
||||
public ModuleController(IModuleRepository modules, IPageModuleRepository pageModules, IPageRepository pages, IModuleDefinitionRepository moduleDefinitions, IUserPermissions userPermissions, ILogManager logger)
|
||||
{
|
||||
_modules = modules;
|
||||
_pageModules = pageModules;
|
||||
_pages = pages;
|
||||
_moduleDefinitions = moduleDefinitions;
|
||||
_userPermissions = userPermissions;
|
||||
_logger = logger;
|
||||
@ -42,6 +44,7 @@ namespace Oqtane.Controllers
|
||||
Module module = new Module();
|
||||
module.SiteId = pagemodule.Module.SiteId;
|
||||
module.ModuleDefinitionName = pagemodule.Module.ModuleDefinitionName;
|
||||
module.AllPages = pagemodule.Module.AllPages;
|
||||
module.Permissions = pagemodule.Module.Permissions;
|
||||
module.CreatedBy = pagemodule.Module.CreatedBy;
|
||||
module.CreatedOn = pagemodule.Module.CreatedOn;
|
||||
@ -111,7 +114,20 @@ namespace Oqtane.Controllers
|
||||
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, EntityNames.Module, module.ModuleId, PermissionNames.Edit))
|
||||
{
|
||||
module = _modules.UpdateModule(module);
|
||||
_logger.Log(LogLevel.Information, this, LogFunction.Update, "Module Updated {Module}", module);
|
||||
if (module.AllPages)
|
||||
{
|
||||
var pageModule = _pageModules.GetPageModules(module.SiteId).FirstOrDefault(item => item.ModuleId == module.ModuleId);
|
||||
_logger.Log(LogLevel.Information, this, LogFunction.Update, "Module Updated {Module}", module);
|
||||
|
||||
var pages = _pages.GetPages(module.SiteId).ToList();
|
||||
foreach (Page page in pages)
|
||||
{
|
||||
if (page.PageId != pageModule.PageId && !page.EditMode)
|
||||
{
|
||||
_pageModules.AddPageModule(new PageModule { PageId = page.PageId, ModuleId = pageModule.ModuleId, Title = pageModule.Title, Pane = pageModule.Pane, Order = pageModule.Order, ContainerType = pageModule.ContainerType });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -17,7 +17,7 @@ using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace Oqtane.Controllers
|
||||
{
|
||||
[Route("{site}/api/[controller]")]
|
||||
[Route("{alias}/api/[controller]")]
|
||||
public class ModuleDefinitionController : Controller
|
||||
{
|
||||
private readonly IModuleDefinitionRepository _moduleDefinitions;
|
||||
@ -190,9 +190,9 @@ namespace Oqtane.Controllers
|
||||
}
|
||||
else
|
||||
{
|
||||
rootPath = Utilities.PathCombine(rootFolder.Parent.FullName , moduleDefinition.Owner + "." + moduleDefinition.Name + "s.Module","\\");
|
||||
moduleDefinition.ModuleDefinitionName = moduleDefinition.Owner + "." + moduleDefinition.Name + "s.Modules, " + moduleDefinition.Owner + "." + moduleDefinition.Name + "s.Module.Client";
|
||||
moduleDefinition.ServerManagerType = moduleDefinition.Owner + "." + moduleDefinition.Name + "s.Manager." + moduleDefinition.Name + "Manager, " + moduleDefinition.Owner + "." + moduleDefinition.Name + "s.Module.Server";
|
||||
rootPath = Utilities.PathCombine(rootFolder.Parent.FullName , moduleDefinition.Owner + "." + moduleDefinition.Name + "s","\\");
|
||||
moduleDefinition.ModuleDefinitionName = moduleDefinition.Owner + "." + moduleDefinition.Name + "s.Modules, " + moduleDefinition.Owner + "." + moduleDefinition.Name + "s.Client.Oqtane";
|
||||
moduleDefinition.ServerManagerType = moduleDefinition.Owner + "." + moduleDefinition.Name + "s.Manager." + moduleDefinition.Name + "Manager, " + moduleDefinition.Owner + "." + moduleDefinition.Name + "s.Server.Oqtane";
|
||||
}
|
||||
|
||||
ProcessTemplatesRecursively(new DirectoryInfo(templatePath), rootPath, rootFolder.Name, templatePath, moduleDefinition);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user