Compare commits

...

35 Commits

Author SHA1 Message Date
8516e328f7 Merge pull request #457 from sbwalker/master
more responsive design adjustments
2020-05-09 12:15:41 -04:00
f6f895b516 more responsive design adjustments 2020-05-09 12:16:39 -04:00
043f8d07de Merge pull request #18 from oqtane/master
sync
2020-05-08 17:30:44 -04:00
c2ed71ab0d added classes to all theme controls, added mobile support to Oqtane theme 2020-05-08 17:30:35 -04:00
552df0c9fc Merge pull request #455 from chlupac/NewVersion
Ignore abstract classes at loading
2020-05-08 17:30:06 -04:00
c5d12d0430 Merge pull request #456 from sbwalker/master
added classes to all theme controls, added mobile support to Oqtane theme
2020-05-08 17:29:51 -04:00
1e270e6423 Ignore abstract classes at loading 2020-05-08 21:30:31 +02:00
aaf2c96374 minor fix for placeholder content 2020-05-08 12:25:37 -04:00
86309dc264 Merge pull request #453 from sbwalker/master
minor fix for placeholder content
2020-05-08 12:24:46 -04:00
051534b80c resolved #270 - migrated raw html entry into richtexteditor control 2020-05-08 12:17:06 -04:00
d3ce5bc17c Merge pull request #452 from sbwalker/master
resolved #270 - migrated raw html entry into richtexteditor control
2020-05-08 12:16:17 -04:00
97354a9525 Update README.md 2020-05-08 08:34:31 -04:00
f07146fd50 updated external module template to support new assembly loading criteria, fixed minor issue in assembky loading logic 2020-05-07 16:24:36 -04:00
5b08cac48d Merge pull request #451 from sbwalker/master
updated external module template to support new assembly loading criteria, fixed minor issue in assembky loading logic
2020-05-07 16:23:56 -04:00
d53bdc5bb6 Merge pull request #17 from oqtane/master
sync with upstream
2020-05-07 15:28:39 -04:00
a63a659888 Merge pull request #419 from chlupac/BootswatchCdn
Bootswatch themes in Oqtane.Themes.OqtaneTheme CDN version
2020-05-07 15:25:03 -04:00
d6f3fd108b Merge pull request #449 from chlupac/LoadOptimalization
Simplified loading of oqtane assemblies
2020-05-07 15:09:32 -04:00
47f17a589f implementation of [OqtaneIgnore] class attribute in controls 2020-05-07 21:02:43 +02:00
d7ad175cd7 fixes for framework upgrade, fixes for control panel CSS styles, added AllPages attrubute for Modules, bumped version to 0.9.1 to test upgrades 2020-05-07 14:38:24 -04:00
d58b6e5d83 Merge pull request #450 from sbwalker/master
fixes for framework upgrade, fixes for control panel CSS styles, added AllPages attrubute for Modules, bumped version to 0.9.1 to test upgrades
2020-05-07 14:37:49 -04:00
e78a5e090d Bootswatch themes in Oqtane.Themes.OqtaneTheme
Theme is set in Oqtane.Client\Themes\OqtaneTheme\Default.razor
```
    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");
    }
```
2020-05-07 12:17:44 +02:00
c394c6ea7a Resolved authentication issue #441 related to alias refactoring #439, fixed breaking change in .NET Core 3.2 related to Blazor WebAssembly identification 2020-05-05 16:28:50 -04:00
6586883979 Merge pull request #445 from sbwalker/master
Resolved authentication issue #441 related to alias refactoring #439, fixed breaking change in .NET Core 3.2 related to Blazor WebAssembly identification
2020-05-05 16:27:52 -04:00
e09fcd7e42 added CreateApiUrl method back for backward compatibility 2020-05-05 09:47:23 -04:00
b5aa6c5a48 Merge pull request #440 from sbwalker/master
added CreateApiUrl method back for backward compatibility
2020-05-05 09:46:48 -04:00
00bf917f6c Merge pull request #435 from thabaum/patch-1
Log details displayed from disabled to readonly
2020-05-05 09:15:48 -04:00
a02cfea6c9 improve performance of alias handling and allow aliases to be an unlimited number of subfolders in depth 2020-05-05 09:15:36 -04:00
db33a91c4b Merge pull request #439 from sbwalker/master
improve performance of alias handling and allow aliases to be an unlimited number of subfolders in depth
2020-05-05 09:15:01 -04:00
8f1a3c99c3 changed displayed input to readonly
Fixes issue of unable to select information displayed from input and textarea changing the select property from disabled to readonly
2020-05-04 12:14:51 -07:00
bf84f12471 fixed theme/layout handling in Add/Edit Page 2020-05-03 11:39:34 -04:00
979680f46d Merge pull request #431 from sbwalker/master
fixed theme/layout handling in Add/Edit Page
2020-05-03 11:38:52 -04:00
922c7796f2 Merge pull request #429 from sbwalker/master
fixed module action import/export, improved module installation
2020-05-01 15:58:54 -04:00
45aeb17020 fixed module action import/export, improved module installation 2020-05-01 15:58:34 -04:00
3afa489f22 upgrade to .NET Core 3.2 RC 2020-05-01 11:32:41 -04:00
a34e2521c6 Merge pull request #428 from sbwalker/master
Upgrade to .NET Core 3.2 RC
2020-05-01 11:32:04 -04:00
146 changed files with 1196 additions and 12111 deletions

View File

@ -99,7 +99,7 @@
var interop = new Interop(JsRuntime); var interop = new Interop(JsRuntime);
string antiforgerytoken = await interop.GetElementByName("__RequestVerificationToken"); string antiforgerytoken = await interop.GetElementByName("__RequestVerificationToken");
var fields = new { __RequestVerificationToken = antiforgerytoken, username = _username, password = _password, remember = _remember, returnurl = _returnUrl }; var fields = new { __RequestVerificationToken = antiforgerytoken, username = _username, password = _password, remember = _remember, returnurl = _returnUrl };
await interop.SubmitForm("/pages/login/", fields); await interop.SubmitForm($"/{PageState.Alias.AliasId}/pages/login/", fields);
} }
else else
{ {

View File

@ -13,7 +13,7 @@
<Label For="dateTime" HelpText="The date and time of this log">Date/Time: </Label> <Label For="dateTime" HelpText="The date and time of this log">Date/Time: </Label>
</td> </td>
<td> <td>
<input id="dateTime" class="form-control" @bind="@_logDate" disabled /> <input id="dateTime" class="form-control" @bind="@_logDate" readonly />
</td> </td>
</tr> </tr>
<tr> <tr>
@ -21,7 +21,7 @@
<Label For="level" HelpText="The level of this log">Level: </Label> <Label For="level" HelpText="The level of this log">Level: </Label>
</td> </td>
<td> <td>
<input id="level" class="form-control" @bind="@_level" disabled /> <input id="level" class="form-control" @bind="@_level" readonly />
</td> </td>
</tr> </tr>
<tr> <tr>
@ -29,7 +29,7 @@
<Label For="feature" HelpText="The feature that was affected">Feature: </Label> <Label For="feature" HelpText="The feature that was affected">Feature: </Label>
</td> </td>
<td> <td>
<input id="feature" class="form-control" @bind="@_feature" disabled /> <input id="feature" class="form-control" @bind="@_feature" readonly />
</td> </td>
</tr> </tr>
<tr> <tr>
@ -37,7 +37,7 @@
<Label For="function" HelpText="The function that was performed">Function: </Label> <Label For="function" HelpText="The function that was performed">Function: </Label>
</td> </td>
<td> <td>
<input id="function" class="form-control" @bind="@_function" disabled /> <input id="function" class="form-control" @bind="@_function" readonly />
</td> </td>
</tr> </tr>
<tr> <tr>
@ -45,7 +45,7 @@
<Label For="category" HelpText="The categories that were affected">Category: </Label> <Label For="category" HelpText="The categories that were affected">Category: </Label>
</td> </td>
<td> <td>
<input id="category" class="form-control" @bind="@_category" disabled /> <input id="category" class="form-control" @bind="@_category" readonly />
</td> </td>
</tr> </tr>
@if (_pageName != string.Empty) @if (_pageName != string.Empty)
@ -55,7 +55,7 @@
<Label For="page" HelpText="The page that was affected">Page: </Label> <Label For="page" HelpText="The page that was affected">Page: </Label>
</td> </td>
<td> <td>
<input id="page" class="form-control" @bind="@_pageName" disabled /> <input id="page" class="form-control" @bind="@_pageName" readonly />
</td> </td>
</tr> </tr>
} }
@ -66,7 +66,7 @@
<Label For="module" HelpText="The module that was affected">Module: </Label> <Label For="module" HelpText="The module that was affected">Module: </Label>
</td> </td>
<td> <td>
<input id="module" class="form-control" @bind="@_moduleTitle" disabled /> <input id="module" class="form-control" @bind="@_moduleTitle" readonly />
</td> </td>
</tr> </tr>
} }
@ -77,7 +77,7 @@
<Label For="user" HelpText="The user that caused this log">User: </Label> <Label For="user" HelpText="The user that caused this log">User: </Label>
</td> </td>
<td> <td>
<input id="user" class="form-control" @bind="@_username" disabled /> <input id="user" class="form-control" @bind="@_username" readonly />
</td> </td>
</tr> </tr>
} }
@ -86,7 +86,7 @@
<Label For="url" HelpText="The url the log comes from">Url: </Label> <Label For="url" HelpText="The url the log comes from">Url: </Label>
</td> </td>
<td> <td>
<input id="url" class="form-control" @bind="@_url" disabled /> <input id="url" class="form-control" @bind="@_url" readonly />
</td> </td>
</tr> </tr>
<tr> <tr>
@ -94,7 +94,7 @@
<Label For="template" HelpText="What the log is about">Template: </Label> <Label For="template" HelpText="What the log is about">Template: </Label>
</td> </td>
<td> <td>
<input id="template" class="form-control" @bind="@_template" disabled /> <input id="template" class="form-control" @bind="@_template" readonly />
</td> </td>
</tr> </tr>
<tr> <tr>
@ -102,7 +102,7 @@
<Label For="message" HelpText="The message that the system generated"class="control-label">Message: </Label> <Label For="message" HelpText="The message that the system generated"class="control-label">Message: </Label>
</td> </td>
<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> </td>
</tr> </tr>
@if (!string.IsNullOrEmpty(_exception)) @if (!string.IsNullOrEmpty(_exception))
@ -112,7 +112,7 @@
<Label For="exception" HelpText="The exceptions generated by the system">Exception: </Label> <Label For="exception" HelpText="The exceptions generated by the system">Exception: </Label>
</td> </td>
<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> </td>
</tr> </tr>
} }
@ -121,7 +121,7 @@
<Label For="properties" HelpText="The properties that were affected">Properties: </Label> <Label For="properties" HelpText="The properties that were affected">Properties: </Label>
</td> </td>
<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> </td>
</tr> </tr>
<tr> <tr>
@ -129,7 +129,7 @@
<Label For="server" HelpText="The server that was affected">Server: </Label> <Label For="server" HelpText="The server that was affected">Server: </Label>
</td> </td>
<td> <td>
<input id="server" class="form-control" @bind="@_server" disabled /> <input id="server" class="form-control" @bind="@_server" readonly />
</td> </td>
</tr> </tr>
</table> </table>

View File

@ -43,7 +43,7 @@
{ {
try try
{ {
[Module]Service = new [Module]Service(http, sitestate, NavigationManager); [Module]Service = new [Module]Service(http, sitestate);
if (PageState.Action == "Edit") if (PageState.Action == "Edit")
{ {
_id = Int32.Parse(PageState.QueryString["id"]); _id = Int32.Parse(PageState.QueryString["id"]);

View File

@ -42,7 +42,7 @@ else
<hr /> <hr />
[Module] Module Created Successfully. Use Edit Mode To Add A [Module]. You Can Access The Files At The Following Locations:<br /><br /> [Module] Module Created Successfully. Use Edit Mode To Add A [Module]. You Can Access The Files At The Following Locations:<br /><br />
[RootPath]Client\<br /> [RootPath]Client\<br />
- [Owner].[Module]s.Module.Client.csproj - client project<br /> - [Owner].[Module]s.Client.csproj - client project<br />
- _Imports.razor - global imports for module components<br /> - _Imports.razor - global imports for module components<br />
- Edit.razor - component for adding or editing content<br /> - Edit.razor - component for adding or editing content<br />
- Index.razor - main component for your module **the content you are reading is in this file**<br /> - Index.razor - main component for your module **the content you are reading is in this file**<br />
@ -51,12 +51,12 @@ else
- Services\I[Module]Service.cs - interface for defining service API methods<br /> - Services\I[Module]Service.cs - interface for defining service API methods<br />
- Services\[Module]Service.cs - implements service API interface methods<br /><br /> - Services\[Module]Service.cs - implements service API interface methods<br /><br />
[RootPath]Package\<br /> [RootPath]Package\<br />
- [Owner].[Module]s.Module.nuspec - nuget manifest for packaging module<br /> - [Owner].[Module]s.nuspec - nuget manifest for packaging module<br />
- [Owner].[Module]s.Module.Package.csproj - packaging project<br /> - [Owner].[Module]s.Package.csproj - packaging project<br />
- debug.cmd - copies assemblies to Oqtane bin folder when in Debug mode<br /> - debug.cmd - copies assemblies to Oqtane bin folder when in Debug mode<br />
- release.cmd - creates nuget package and deploys to Oqtane wwwroot/modules folder when in Release mode<br /><br /> - release.cmd - creates nuget package and deploys to Oqtane wwwroot/modules folder when in Release mode<br /><br />
[RootPath]Server\<br /> [RootPath]Server\<br />
- [Owner].[Module]s.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 /> - Controllers\[Module]Controller.cs - API methods implemented using a REST pattern<br />
- Manager\[Module]Manager.cs - implements optional module interfaces for features such as import/export of content<br /> - Manager\[Module]Manager.cs - implements optional module interfaces for features such as import/export of content<br />
- Repository\I[Module]Repository.cs - interface for defining repository methods<br /> - Repository\I[Module]Repository.cs - interface for defining repository methods<br />
@ -65,7 +65,7 @@ else
- Scripts\[Owner].[Module].1.0.0.sql - database schema definition script<br /><br /> - Scripts\[Owner].[Module].1.0.0.sql - database schema definition script<br /><br />
- Scripts\[Owner].[Module].Uninstall.sql - database uninstall script<br /><br /> - Scripts\[Owner].[Module].Uninstall.sql - database uninstall script<br /><br />
[RootPath]Shared\<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 /> - Models\[Module].cs - model definition<br /><br />
<!-- The content above is for informational purposes only and can be safely removed --> <!-- The content above is for informational purposes only and can be safely removed -->
@ -78,7 +78,7 @@ else
{ {
try 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); _[Module]s = await [Module]Service.Get[Module]sAsync(ModuleState.ModuleId);
} }
catch (Exception ex) catch (Exception ex)

View File

@ -10,7 +10,7 @@ namespace [Owner].[Module]s.Modules
Name = "[Module]", Name = "[Module]",
Description = "[Module]", Description = "[Module]",
Version = "1.0.0", Version = "1.0.0",
Dependencies = "[Owner].[Module]s.Module.Shared", Dependencies = "[Owner].[Module]s.Shared.Oqtane",
ServerManagerType = "[ServerManagerType]", ServerManagerType = "[ServerManagerType]",
ReleaseVersions = "1.0.0" ReleaseVersions = "1.0.0"
}; };

View File

@ -2,7 +2,6 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using Oqtane.Modules; using Oqtane.Modules;
using Oqtane.Services; using Oqtane.Services;
using Oqtane.Shared; using Oqtane.Shared;
@ -12,44 +11,39 @@ namespace [Owner].[Module]s.Services
{ {
public class [Module]Service : ServiceBase, I[Module]Service, IService public class [Module]Service : ServiceBase, I[Module]Service, IService
{ {
private readonly NavigationManager _navigationManager;
private readonly SiteState _siteState; 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; _siteState = siteState;
_navigationManager = navigationManager;
} }
private string Apiurl private string Apiurl=> CreateApiUrl(_siteState.Alias, "[Module]");
{
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "[Module]"); }
}
public async Task<List<[Module]>> Get[Module]sAsync(int ModuleId) 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(); return [Module]s.OrderBy(item => item.Name).ToList();
} }
public async Task<[Module]> Get[Module]Async(int [Module]Id) 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]) 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]) 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) public async Task Delete[Module]Async(int [Module]Id)
{ {
await DeleteAsync(Apiurl + "/" + [Module]Id.ToString()); await DeleteAsync($"{Apiurl}/{[Module]Id}");
} }
} }
} }

View File

@ -7,18 +7,19 @@
<Authors>[Owner]</Authors> <Authors>[Owner]</Authors>
<Company>[Owner]</Company> <Company>[Owner]</Company>
<Description>[Description]</Description> <Description>[Description]</Description>
<Product>[Owner].[Module]s.Module</Product> <Product>[Owner].[Module]s</Product>
<Copyright>[Owner]</Copyright> <Copyright>[Owner]</Copyright>
<AssemblyName>[Owner].[Module]s.Client.Oqtane</AssemblyName>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<!-- <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="3.2.0-preview5.20216.8" />--> <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="3.2.0-rc1.20223.4" />
<!-- <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Build" Version="3.2.0-preview5.20216.8" PrivateAssets="all" />--> <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-preview5.20210.3" /> <PackageReference Include="System.Net.Http.Json" Version="3.2.0-rc1.20217.1" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Shared\[Owner].[Module]s.Module.Shared.csproj" /> <ProjectReference Include="..\Shared\[Owner].[Module]s.Shared.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -6,9 +6,9 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Client\[Owner].[Module]s.Module.Client.csproj" /> <ProjectReference Include="..\Client\[Owner].[Module]s.Client.csproj" />
<ProjectReference Include="..\Server\[Owner].[Module]s.Module.Server.csproj" /> <ProjectReference Include="..\Server\[Owner].[Module]s.Server.csproj" />
<ProjectReference Include="..\Shared\[Owner].[Module]s.Module.Shared.csproj" /> <ProjectReference Include="..\Shared\[Owner].[Module]s.Shared.csproj" />
</ItemGroup> </ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> <Target Name="PostBuild" AfterTargets="PostBuildEvent">

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata> <metadata>
<id>[Owner].[Module]s.Module</id> <id>[Owner].[Module]s</id>
<version>1.0.0</version> <version>1.0.0</version>
<authors>[Owner]</authors> <authors>[Owner]</authors>
<owners>[Owner]</owners> <owners>[Owner]</owners>
@ -20,9 +20,12 @@
</dependencies> </dependencies>
</metadata> </metadata>
<files> <files>
<file src="..\Client\bin\Release\netstandard2.1\[Owner].[Module]s.Module.Client.dll" target="lib" /> <file src="..\Client\bin\Release\netstandard2.1\[Owner].[Module]s.Client.Oqtane.dll" target="lib" />
<file src="..\Server\bin\Release\netcoreapp3.1\[Owner].[Module]s.Module.Server.dll" target="lib" /> <file src="..\Client\bin\Release\netstandard2.1\[Owner].[Module]s.Client.Oqtane.pdb" target="lib" />
<file src="..\Shared\bin\Release\netstandard2.1\[Owner].[Module]s.Module.Shared.dll" 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" /> <file src="..\wwwroot\**\*.*" target="wwwroot" />
</files> </files>
</package> </package>

View File

@ -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.Client.Oqtane.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 "..\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.Module.Server.dll" "..\..\[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.Module.Server.pdb" "..\..\[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.Module.Shared.dll" "..\..\[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.Module.Shared.pdb" "..\..\[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

View File

@ -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 XCOPY "*.nupkg" "..\..\[RootFolder]\Oqtane.Server\wwwroot\Modules\" /Y

View File

@ -5,11 +5,12 @@
<LangVersion>7.3</LangVersion> <LangVersion>7.3</LangVersion>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc> <AddRazorSupportForMvc>true</AddRazorSupportForMvc>
<Version>1.0.0</Version> <Version>1.0.0</Version>
<Product>[Owner].[Module]s.Module</Product> <Product>[Owner].[Module]s</Product>
<Authors>[Owner]</Authors> <Authors>[Owner]</Authors>
<Company>[Owner]</Company> <Company>[Owner]</Company>
<Description>[Description]</Description> <Description>[Description]</Description>
<Copyright>[Owner]</Copyright> <Copyright>[Owner]</Copyright>
<AssemblyName>[Owner].[Module]s.Server.Oqtane</AssemblyName>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@ -18,7 +19,7 @@
</ItemGroup> </ItemGroup>
<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.Mvc.NewtonsoftJson" Version="3.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.1.2" /> <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.1.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.2" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.2" />
@ -26,7 +27,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Shared\[Owner].[Module]s.Module.Shared.csproj" /> <ProjectReference Include="..\Shared\[Owner].[Module]s.Shared.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -4,11 +4,12 @@
<TargetFramework>netstandard2.1</TargetFramework> <TargetFramework>netstandard2.1</TargetFramework>
<LangVersion>7.3</LangVersion> <LangVersion>7.3</LangVersion>
<Version>1.0.0</Version> <Version>1.0.0</Version>
<Product>[Owner].[Module].Module</Product> <Product>[Owner].[Module]s</Product>
<Authors>[Owner]</Authors> <Authors>[Owner]</Authors>
<Company>[Owner]</Company> <Company>[Owner]</Company>
<Description>[Description]</Description> <Description>[Description]</Description>
<Copyright>[Owner]</Copyright> <Copyright>[Owner]</Copyright>
<AssemblyName>[Owner].[Module]s.Shared.Oqtane</AssemblyName>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -3,13 +3,13 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16 # Visual Studio Version 16
VisualStudioVersion = 16.0.28621.142 VisualStudioVersion = 16.0.28621.142
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "[Owner].[Module]s.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 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 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 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 EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution

View File

@ -43,7 +43,7 @@
{ {
try try
{ {
[Module]Service = new [Module]Service(http, sitestate, NavigationManager); [Module]Service = new [Module]Service(http, sitestate);
if (PageState.Action == "Edit") if (PageState.Action == "Edit")
{ {
_id = Int32.Parse(PageState.QueryString["id"]); _id = Int32.Parse(PageState.QueryString["id"]);

View File

@ -69,7 +69,7 @@ else
{ {
try 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); _[Module]s = await [Module]Service.Get[Module]sAsync(ModuleState.ModuleId);
} }
catch (Exception ex) catch (Exception ex)

View File

@ -2,7 +2,6 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using Oqtane.Modules; using Oqtane.Modules;
using Oqtane.Services; using Oqtane.Services;
using Oqtane.Shared; using Oqtane.Shared;
@ -12,44 +11,39 @@ namespace [Owner].[Module]s.Services
{ {
public class [Module]Service : ServiceBase, I[Module]Service, IService public class [Module]Service : ServiceBase, I[Module]Service, IService
{ {
private readonly NavigationManager _navigationManager;
private readonly SiteState _siteState; 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; _siteState = siteState;
_navigationManager = navigationManager;
} }
private string Apiurl private string Apiurl=> CreateApiUrl(_siteState.Alias, "[Module]");
{
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "[Module]"); }
}
public async Task<List<[Module]>> Get[Module]sAsync(int ModuleId) 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(); return [Module]s.OrderBy(item => item.Name).ToList();
} }
public async Task<[Module]> Get[Module]Async(int [Module]Id) 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]) 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]) 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) public async Task Delete[Module]Async(int [Module]Id)
{ {
await DeleteAsync(Apiurl + "/" + [Module]Id.ToString()); await DeleteAsync($"{Apiurl}/{[Module]Id}");
} }
} }
} }

View File

@ -32,6 +32,17 @@
</select> </select>
</td> </td>
</tr> </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> <tr>
<td> <td>
<Label For="page" HelpText="The page that the module is on">Page: </Label> <Label For="page" HelpText="The page that the module is on">Page: </Label>
@ -77,6 +88,7 @@
private Dictionary<string, string> _containers; private Dictionary<string, string> _containers;
private string _title; private string _title;
private string _containerType; private string _containerType;
private string _allPages = "false";
private string _permissionNames = ""; private string _permissionNames = "";
private string _permissions; private string _permissions;
private string _pageId; private string _pageId;
@ -95,6 +107,7 @@
_title = ModuleState.Title; _title = ModuleState.Title;
_containers = ThemeService.GetContainerTypes(await ThemeService.GetThemesAsync()); _containers = ThemeService.GetContainerTypes(await ThemeService.GetThemesAsync());
_containerType = ModuleState.ContainerType; _containerType = ModuleState.ContainerType;
_allPages = ModuleState.AllPages.ToString();
_permissions = ModuleState.Permissions; _permissions = ModuleState.Permissions;
_permissionNames = ModuleState.ModuleDefinition.PermissionNames; _permissionNames = ModuleState.ModuleDefinition.PermissionNames;
_pageId = ModuleState.PageId.ToString(); _pageId = ModuleState.PageId.ToString();
@ -120,18 +133,18 @@
private async Task SaveModule() private async Task SaveModule()
{ {
var module = ModuleState;
module.Permissions = _permissionGrid.GetPermissions();
await ModuleService.UpdateModuleAsync(module);
var pagemodule = await PageModuleService.GetPageModuleAsync(ModuleState.PageModuleId); var pagemodule = await PageModuleService.GetPageModuleAsync(ModuleState.PageModuleId);
pagemodule.PageId = int.Parse(_pageId); pagemodule.PageId = int.Parse(_pageId);
pagemodule.Title = _title; pagemodule.Title = _title;
pagemodule.ContainerType = _containerType; pagemodule.ContainerType = _containerType;
await PageModuleService.UpdatePageModuleAsync(pagemodule); await PageModuleService.UpdatePageModuleAsync(pagemodule);
await PageModuleService.UpdatePageModuleOrderAsync(pagemodule.PageId, pagemodule.Pane); 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) if (_settingsModuleType != null)
{ {
var moduleType = Type.GetType(ModuleState.ModuleType); var moduleType = Type.GetType(ModuleState.ModuleType);

View File

@ -101,7 +101,7 @@
</td> </td>
<td> <td>
<select id="Theme" class="form-control" @onchange="(e => ThemeChanged(e))"> <select id="Theme" class="form-control" @onchange="(e => ThemeChanged(e))">
<option value="">&lt;Select Theme&gt;</option> <option value="-">&lt;Select Theme&gt;</option>
@foreach (KeyValuePair<string, string> item in _themes) @foreach (KeyValuePair<string, string> item in _themes)
{ {
if (item.Key == _themetype) if (item.Key == _themetype)
@ -122,7 +122,7 @@
</td> </td>
<td> <td>
<select id="Layout" class="form-control" @bind="@_layouttype"> <select id="Layout" class="form-control" @bind="@_layouttype">
<option value="">&lt;Select Layout&gt;</option> <option value="-">&lt;Select Layout&gt;</option>
@foreach (KeyValuePair<string, string> panelayout in _panelayouts) @foreach (KeyValuePair<string, string> panelayout in _panelayouts)
{ {
if (panelayout.Key == _layouttype) if (panelayout.Key == _layouttype)
@ -200,8 +200,8 @@
private string _url; private string _url;
private string _ispersonalizable = "False"; private string _ispersonalizable = "False";
private string _mode = "view"; private string _mode = "view";
private string _themetype = string.Empty; private string _themetype = "-";
private string _layouttype = string.Empty; private string _layouttype = "-";
private string _icon = string.Empty; private string _icon = string.Empty;
private string _permissions = string.Empty; private string _permissions = string.Empty;
private PermissionGrid _permissionGrid; private PermissionGrid _permissionGrid;
@ -271,7 +271,7 @@
try try
{ {
_themetype = (string)e.Value; _themetype = (string)e.Value;
if (_themetype != string.Empty) if (_themetype != "-")
{ {
_panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype); _panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype);
} }
@ -350,11 +350,8 @@
page.IsNavigation = (_isnavigation == null ? true : Boolean.Parse(_isnavigation)); page.IsNavigation = (_isnavigation == null ? true : Boolean.Parse(_isnavigation));
page.Url = _url; page.Url = _url;
page.EditMode = (_mode == "edit" ? true : false); page.EditMode = (_mode == "edit" ? true : false);
page.ThemeType = _themetype; page.ThemeType = (_themetype != "-") ? _themetype : string.Empty;
page.LayoutType = (_layouttype == null ? string.Empty : _layouttype); page.LayoutType = (_layouttype != "-") ? _layouttype : string.Empty;
page.Icon = (_icon == null ? string.Empty : _icon);
page.Permissions = _permissionGrid.GetPermissions();
if (page.ThemeType == PageState.Site.DefaultThemeType) if (page.ThemeType == PageState.Site.DefaultThemeType)
{ {
page.ThemeType = string.Empty; page.ThemeType = string.Empty;
@ -364,7 +361,8 @@
{ {
page.LayoutType = string.Empty; page.LayoutType = string.Empty;
} }
page.Icon = (_icon == null ? string.Empty : _icon);
page.Permissions = _permissionGrid.GetPermissions();
page.IsPersonalizable = (_ispersonalizable == null ? false : Boolean.Parse(_ispersonalizable)); page.IsPersonalizable = (_ispersonalizable == null ? false : Boolean.Parse(_ispersonalizable));
page.UserId = null; page.UserId = null;

View File

@ -112,7 +112,7 @@
</td> </td>
<td> <td>
<select id="Theme" class="form-control" @onchange="(e => ThemeChanged(e))"> <select id="Theme" class="form-control" @onchange="(e => ThemeChanged(e))">
<option value="">&lt;Select Theme&gt;</option> <option value="-">&lt;Select Theme&gt;</option>
@foreach (KeyValuePair<string, string> item in _themes) @foreach (KeyValuePair<string, string> item in _themes)
{ {
if (item.Key == _themetype) if (item.Key == _themetype)
@ -133,7 +133,7 @@
</td> </td>
<td> <td>
<select id="Layout" class="form-control" @bind="@_layouttype"> <select id="Layout" class="form-control" @bind="@_layouttype">
<option value="">&lt;Select Layout&gt;</option> <option value="-">&lt;Select Layout&gt;</option>
@foreach (KeyValuePair<string, string> panelayout in _panelayouts) @foreach (KeyValuePair<string, string> panelayout in _panelayouts)
{ {
if (panelayout.Key == _layouttype) if (panelayout.Key == _layouttype)
@ -215,8 +215,8 @@
private string _url; private string _url;
private string _ispersonalizable; private string _ispersonalizable;
private string _mode; private string _mode;
private string _themetype; private string _themetype = "-";
private string _layouttype; private string _layouttype = "-";
private string _icon; private string _icon;
private string _permissions; private string _permissions;
private string _createdby; private string _createdby;
@ -272,6 +272,14 @@
_themetype = page.ThemeType; _themetype = page.ThemeType;
_panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype); _panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype);
_layouttype = page.LayoutType; _layouttype = page.LayoutType;
if (_themetype == PageState.Site.DefaultThemeType)
{
_themetype = "-";
}
if (_layouttype == PageState.Site.DefaultLayoutType)
{
_layouttype = "-";
}
_icon = page.Icon; _icon = page.Icon;
_permissions = page.Permissions; _permissions = page.Permissions;
_createdby = page.CreatedBy; _createdby = page.CreatedBy;
@ -337,7 +345,7 @@
try try
{ {
_themetype = (string)e.Value; _themetype = (string)e.Value;
if (_themetype != string.Empty) if (_themetype != "-")
{ {
_panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype); _panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype);
} }
@ -417,11 +425,8 @@
page.IsNavigation = (_isnavigation == null || Boolean.Parse(_isnavigation)); page.IsNavigation = (_isnavigation == null || Boolean.Parse(_isnavigation));
page.Url = _url; page.Url = _url;
page.EditMode = (_mode == "edit"); page.EditMode = (_mode == "edit");
page.ThemeType = _themetype; page.ThemeType = (_themetype != "-") ? _themetype : string.Empty;
page.LayoutType = _layouttype ?? string.Empty; page.LayoutType = (_layouttype != "-") ? _layouttype : string.Empty;
page.Icon = _icon ?? string.Empty;
page.Permissions = _permissionGrid.GetPermissions();
if (page.ThemeType == PageState.Site.DefaultThemeType) if (page.ThemeType == PageState.Site.DefaultThemeType)
{ {
page.ThemeType = string.Empty; page.ThemeType = string.Empty;
@ -430,6 +435,8 @@
{ {
page.LayoutType = string.Empty; page.LayoutType = string.Empty;
} }
page.Icon = _icon ?? string.Empty;
page.Permissions = _permissionGrid.GetPermissions();
page.IsPersonalizable = (_ispersonalizable != null && Boolean.Parse(_ispersonalizable)); page.IsPersonalizable = (_ispersonalizable != null && Boolean.Parse(_ispersonalizable));
page.UserId = null; page.UserId = null;

View File

@ -171,7 +171,7 @@
<table class="table table-borderless"> <table class="table table-borderless">
<tr> <tr>
<td> <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>
<td> <td>
<select id="isEnabled" class="form-control" @bind="@_pwaisenabled"> <select id="isEnabled" class="form-control" @bind="@_pwaisenabled">
@ -182,7 +182,7 @@
</tr> </tr>
<tr> <tr>
<td> <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>
<td> <td>
<FileManager FileId="@_pwaappiconfileid.ToString()" Filter="png" @ref="_pwaappiconfilemanager" /> <FileManager FileId="@_pwaappiconfileid.ToString()" Filter="png" @ref="_pwaappiconfilemanager" />
@ -190,7 +190,7 @@
</tr> </tr>
<tr> <tr>
<td> <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>
<td> <td>
<FileManager FileId="@_pwasplashiconfileid.ToString()" Filter="png" @ref="_pwasplashiconfilemanager" /> <FileManager FileId="@_pwasplashiconfileid.ToString()" Filter="png" @ref="_pwasplashiconfilemanager" />
@ -251,7 +251,7 @@
{ {
_themeList = await ThemeService.GetThemesAsync(); _themeList = await ThemeService.GetThemesAsync();
_aliasList = await AliasService.GetAliasesAsync(); _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) if (site != null)
{ {
_name = site.Name; _name = site.Name;
@ -364,7 +364,7 @@
if (unique) if (unique)
{ {
var site = await SiteService.GetSiteAsync(PageState.Site.SiteId, PageState.Alias); var site = await SiteService.GetSiteAsync(PageState.Site.SiteId);
if (site != null) if (site != null)
{ {
site.Name = _name; site.Name = _name;
@ -395,7 +395,7 @@
site.PwaSplashIconFileId = pwasplashiconfileid; site.PwaSplashIconFileId = pwasplashiconfileid;
} }
site = await SiteService.UpdateSiteAsync(site, PageState.Alias); site = await SiteService.UpdateSiteAsync(site);
_urls = _urls.Replace("\n", ","); _urls = _urls.Replace("\n", ",");
var names = _urls.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); var names = _urls.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

View File

@ -134,7 +134,8 @@
_aliasList = await AliasService.GetAliasesAsync(); _aliasList = await AliasService.GetAliasesAsync();
_alias = _aliasList.Find(item => item.AliasId == Int32.Parse(PageState.QueryString["id"])); _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) if (site != null)
{ {
_name = site.Name; _name = site.Name;
@ -209,7 +210,8 @@
if (unique) if (unique)
{ {
var site = await SiteService.GetSiteAsync(_alias.SiteId, _alias); SiteService.SetAlias(_alias);
var site = await SiteService.GetSiteAsync(_alias.SiteId);
if (site != null) if (site != null)
{ {
site.Name = _name; site.Name = _name;
@ -219,7 +221,7 @@
site.DefaultContainerType = _containertype; site.DefaultContainerType = _containertype;
site.IsDeleted = (_isdeleted == null || Boolean.Parse(_isdeleted)); site.IsDeleted = (_isdeleted == null || Boolean.Parse(_isdeleted));
site = await SiteService.UpdateSiteAsync(site, _alias); site = await SiteService.UpdateSiteAsync(site);
_urls = _urls.Replace("\n", ","); _urls = _urls.Replace("\n", ",");
var names = _urls.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); var names = _urls.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

View File

@ -54,7 +54,8 @@ else
{ {
if (alias.SiteId != PageState.Site.SiteId || alias.TenantId != PageState.Site.TenantId) 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); await Log(alias, LogLevel.Information, "", null, "Site Deleted {SiteId}", alias.SiteId);
var aliases = await AliasService.GetAliasesAsync(); var aliases = await AliasService.GetAliasesAsync();

View File

@ -11,29 +11,27 @@
<TabPanel Name="Download"> <TabPanel Name="Download">
@if (_upgradeavailable) @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> <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))>Download</button> @("Framework") @_package.Version <button type="button" class="btn btn-success" @onclick=@(async () => await Download(Constants.PackageId, Constants.Version))>Upgrade</button>
} }
else else
{ {
<ModuleMessage Type="MessageType.Info" Message="Framework Is Already Up To Date"></ModuleMessage> <ModuleMessage Type="MessageType.Info" Message="Framework Is Already Up To Date"></ModuleMessage>
} }
</TabPanel> </TabPanel>
@if (_upgradeavailable)
{
<TabPanel Name="Upload"> <TabPanel Name="Upload">
<table class="table table-borderless"> <table class="table table-borderless">
<tr> <tr>
<td> <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>
<td> <td>
<FileManager Filter="nupkg" ShowFiles="false" Folder="Framework" /> <FileManager Filter="nupkg" ShowFiles="false" Folder="Framework" />
</td> </td>
</tr> </tr>
</table> </table>
<button type="button" class="btn btn-success" @onclick="Upgrade">Install</button>
</TabPanel> </TabPanel>
}
</TabStrip> </TabStrip>
} }

View File

@ -1,6 +1,6 @@
@namespace Oqtane.Modules.Controls @namespace Oqtane.Modules.Controls
@inherits ModuleBase @inherits ModuleBase
@attribute [OqtaneIgnore]
@if (_visible) @if (_visible)
{ {
<div class="app-admin-modal"> <div class="app-admin-modal">

View File

@ -1,5 +1,6 @@
@namespace Oqtane.Modules.Controls @namespace Oqtane.Modules.Controls
@inherits ModuleBase @inherits ModuleBase
@attribute [OqtaneIgnore]
@inject IUserService UserService @inject IUserService UserService
@if (_authorized) @if (_authorized)

View File

@ -1,5 +1,6 @@
@namespace Oqtane.Modules.Controls @namespace Oqtane.Modules.Controls
@inherits ModuleBase @inherits ModuleBase
@attribute [OqtaneIgnore]
@if (_text != string.Empty) @if (_text != string.Empty)
{ {

View File

@ -1,5 +1,6 @@
@namespace Oqtane.Modules.Controls @namespace Oqtane.Modules.Controls
@inherits ModuleBase @inherits ModuleBase
@attribute [OqtaneIgnore]
@inject IFolderService FolderService @inject IFolderService FolderService
@inject IFileService FileService @inject IFileService FileService
@inject IJSRuntime JsRuntime @inject IJSRuntime JsRuntime

View File

@ -1,5 +1,6 @@
@namespace Oqtane.Modules.Controls @namespace Oqtane.Modules.Controls
@inherits ModuleBase @inherits ModuleBase
@attribute [OqtaneIgnore]
@if (!string.IsNullOrEmpty(HelpText)) @if (!string.IsNullOrEmpty(HelpText))
{ {

View File

@ -1,5 +1,6 @@
@namespace Oqtane.Modules.Controls @namespace Oqtane.Modules.Controls
@inherits ModuleBase @inherits ModuleBase
@attribute [OqtaneIgnore]
@if (!string.IsNullOrEmpty(_message)) @if (!string.IsNullOrEmpty(_message))
{ {

View File

@ -1,7 +1,9 @@
@namespace Oqtane.Modules.Controls @namespace Oqtane.Modules.Controls
@inherits ModuleBase @inherits ModuleBase
@attribute [OqtaneIgnore]
@typeparam TableItem @typeparam TableItem
<p> <p>
@if(Format == "Table") @if(Format == "Table")
{ {

View File

@ -1,5 +1,6 @@
@namespace Oqtane.Modules.Controls @namespace Oqtane.Modules.Controls
@inherits ModuleBase @inherits ModuleBase
@attribute [OqtaneIgnore]
@inject IRoleService RoleService @inject IRoleService RoleService
@inject IUserService UserService @inject IUserService UserService

View File

@ -1,28 +1,82 @@
@namespace Oqtane.Modules.Controls @namespace Oqtane.Modules.Controls
@inherits ModuleBase @inherits ModuleBase
@attribute [OqtaneIgnore]
@inject IJSRuntime JsRuntime @inject IJSRuntime JsRuntime
@if (_filemanagervisible) <div class="row" style="margin-bottom: 50px;">
{ <div class="col">
<FileManager @ref="_fileManager" Filter="@Constants.ImageFiles" /> <TabStrip>
@((MarkupString)_message) <TabPanel Name="Rich" Heading="Rich Text Editor">
<br /> @if (_filemanagervisible)
} {
<div class="row justify-content-center"> <FileManager @ref="_fileManager" Filter="@Constants.ImageFiles" />
<button type="button" class="btn btn-success" @onclick="InsertImage">Insert Image</button> @((MarkupString)_message)
@if (_filemanagervisible) <br />
{ }
@((MarkupString)"&nbsp;&nbsp;") <div class="row justify-content-center" style="margin-bottom: 20px;">
<button type="button" class="btn btn-secondary" @onclick="CloseFileManager">Close</button> <button type="button" class="btn btn-secondary" @onclick="RefreshRichText">Synchronize Content</button>&nbsp;&nbsp;
} <button type="button" class="btn btn-primary" @onclick="InsertImage">Insert Image</button>
</div> @if (_filemanagervisible)
<div class="row"> {
<div class ="col"> @((MarkupString)"&nbsp;&nbsp;")
<div @ref="@_toolBar"> <button type="button" class="btn btn-secondary" @onclick="CloseFileManager">Close</button>
@ToolbarContent }
</div> </div>
<div @ref="@_editorElement"> <div class="row">
</div> <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>
</div> </div>
@ -31,10 +85,12 @@
private ElementReference _toolBar; private ElementReference _toolBar;
private bool _filemanagervisible = false; private bool _filemanagervisible = false;
private FileManager _fileManager; private FileManager _fileManager;
private string _content = string.Empty;
private string _original = string.Empty;
private string _message = string.Empty; private string _message = string.Empty;
[Parameter] [Parameter]
public RenderFragment ToolbarContent { get; set; } public string Content { get; set; }
[Parameter] [Parameter]
public bool ReadOnly { get; set; } = false; public bool ReadOnly { get; set; } = false;
@ -42,12 +98,21 @@
[Parameter] [Parameter]
public string Placeholder { get; set; } = "Enter Your Content..."; public string Placeholder { get; set; } = "Enter Your Content...";
// parameters only applicable to rich text editor
[Parameter]
public RenderFragment ToolbarContent { get; set; }
[Parameter] [Parameter]
public string Theme { get; set; } = "snow"; public string Theme { get; set; } = "snow";
[Parameter] [Parameter]
public string DebugLevel { get; set; } = "info"; public string DebugLevel { get; set; } = "info";
protected override void OnInitialized()
{
_content = Content; // raw HTML
}
protected override async Task OnAfterRenderAsync(bool firstRender) protected override async Task OnAfterRenderAsync(bool firstRender)
{ {
if (firstRender) if (firstRender)
@ -60,42 +125,57 @@
Placeholder, Placeholder,
Theme, Theme,
DebugLevel); 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, JsRuntime,
_editorElement); _editorElement);
StateHasChanged();
} }
public async Task<string> GetHtml() public async Task<string> GetHtml()
{ {
return await RichTextEditorInterop.GetHtml( // get rich text content
JsRuntime, string content = await RichTextEditorInterop.GetHtml(
_editorElement); JsRuntime,
} _editorElement);
public async Task<string> GetContent() if (_original != content)
{ {
return await RichTextEditorInterop.GetContent( // rich text content has changed - return it
JsRuntime, return content;
_editorElement); }
} else
{
public async Task LoadContent(string content) // return raw html content
{ return _content;
await RichTextEditorInterop.LoadEditorContent( }
JsRuntime,
_editorElement, content);
}
public async Task EnableEditor(bool mode)
{
await RichTextEditorInterop.EnableEditor(
JsRuntime,
_editorElement, mode);
} }
public async Task InsertImage() public async Task InsertImage()
@ -121,16 +201,28 @@
_filemanagervisible = true; _filemanagervisible = true;
_message = string.Empty; _message = string.Empty;
} }
StateHasChanged(); StateHasChanged();
} }
public void CloseFileManager() // other rich text editor methods which can be used by developers
public async Task<string> GetText()
{ {
_filemanagervisible = false; return await RichTextEditorInterop.GetText(
_message = string.Empty; JsRuntime,
_editorElement);
StateHasChanged();
} }
public async Task<string> GetContent()
{
return await RichTextEditorInterop.GetContent(
JsRuntime,
_editorElement);
}
public async Task EnableEditor(bool mode)
{
await RichTextEditorInterop.EnableEditor(
JsRuntime,
_editorElement, mode);
}
} }

View File

@ -2,7 +2,7 @@
using Microsoft.JSInterop; using Microsoft.JSInterop;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Oqtane.UI namespace Oqtane.Modules.Controls
{ {
public static class RichTextEditorInterop public static class RichTextEditorInterop
{ {

View File

@ -1,5 +1,6 @@
@namespace Oqtane.Modules.Controls @namespace Oqtane.Modules.Controls
@inherits ModuleBase @inherits ModuleBase
@attribute [OqtaneIgnore]
<div class="d-flex"> <div class="d-flex">
<div> <div>

View File

@ -1,5 +1,6 @@
@namespace Oqtane.Modules.Controls @namespace Oqtane.Modules.Controls
@inherits ModuleBase @inherits ModuleBase
@attribute [OqtaneIgnore]
@if (Name == Parent.ActiveTab) @if (Name == Parent.ActiveTab)
{ {

View File

@ -1,5 +1,6 @@
@namespace Oqtane.Modules.Controls @namespace Oqtane.Modules.Controls
@inherits ModuleBase @inherits ModuleBase
@attribute [OqtaneIgnore]
<CascadingValue Value="this"> <CascadingValue Value="this">
<div class="container-fluid"> <div class="container-fluid">

View File

@ -7,111 +7,48 @@
@inject HttpClient http @inject HttpClient http
@inject SiteState sitestate @inject SiteState sitestate
<div class="row" style="margin-bottom: 50px;"> @if (_content != null)
<div class="col @_visibleText"> {
<textarea class="form-control" @bind="@content" rows="10"></textarea> <RichTextEditor Content="@_content" @ref="@RichTextEditorHtml"></RichTextEditor>
</div> <button type="button" class="btn btn-success" @onclick="SaveContent">Save</button>
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
<div class="col @_visibleRich"> @if (!string.IsNullOrEmpty(_content))
<RichTextEditor @ref="@RichTextEditorHtml"> {
<ToolbarContent> <br /><br />
<select class="ql-header"> <AuditInfo CreatedBy="@_createdby" CreatedOn="@_createdon" ModifiedBy="@_modifiedby" ModifiedOn="@_modifiedon"></AuditInfo>
<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>
@code { @code {
private string _visibleText = "d-none";
private string _visibleRich;
private bool _richTextEditorMode;
private RichTextEditor RichTextEditorHtml; private RichTextEditor RichTextEditorHtml;
private string content; private string _content = null;
private string createdby; private string _createdby;
private DateTime createdon; private DateTime _createdon;
private string modifiedby; private string _modifiedby;
private DateTime modifiedon; private DateTime _modifiedon;
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Edit; public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Edit;
public override string Title => "Edit Html/Text"; public override string Title => "Edit Html/Text";
public bool RichTextEditorMode protected override async Task OnInitializedAsync()
{
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)
{ {
try try
{ {
if (firstRender) var htmltextservice = new HtmlTextService(http, sitestate);
var htmltext = await htmltextservice.GetHtmlTextAsync(ModuleState.ModuleId);
if (htmltext != null)
{ {
if (content == null) _content = htmltext.Content;
{ _content = _content.Replace(Constants.ContentUrl, "/" + PageState.Alias.AliasId.ToString() + Constants.ContentUrl);
RichTextEditorMode = true; _createdby = htmltext.CreatedBy;
await LoadText(); _createdon = htmltext.CreatedOn;
} _modifiedby = htmltext.ModifiedBy;
_modifiedon = htmltext.ModifiedOn;
}
else
{
_content = string.Empty;
} }
} }
catch (Exception ex) 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() private async Task SaveContent()
{ {
if (RichTextEditorMode) string content = await RichTextEditorHtml.GetHtml();
{ content = content.Replace("/" + PageState.Alias.AliasId.ToString() + Constants.ContentUrl, Constants.ContentUrl);
content = await RichTextEditorHtml.GetHtml();
}
content = content.Replace(((PageState.Alias.Path == string.Empty) ? "/~" : PageState.Alias.Path) + Constants.ContentUrl, Constants.ContentUrl);
try try
{ {
var htmltextservice = new HtmlTextService(http, sitestate, NavigationManager); var htmltextservice = new HtmlTextService(http, sitestate);
var htmltext = await htmltextservice.GetHtmlTextAsync(ModuleState.ModuleId); var htmltext = await htmltextservice.GetHtmlTextAsync(ModuleState.ModuleId);
if (htmltext != null) if (htmltext != null)
{ {
@ -190,5 +89,4 @@
AddModuleMessage("Error Saving Content", MessageType.Error); AddModuleMessage("Error Saving Content", MessageType.Error);
} }
} }
} }

View File

@ -25,12 +25,12 @@
{ {
try try
{ {
var htmltextservice = new HtmlTextService(http, sitestate, NavigationManager); var htmltextservice = new HtmlTextService(http, sitestate);
var htmltext = await htmltextservice.GetHtmlTextAsync(ModuleState.ModuleId); var htmltext = await htmltextservice.GetHtmlTextAsync(ModuleState.ModuleId);
if (htmltext != null) if (htmltext != null)
{ {
content = htmltext.Content; 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) catch (Exception ex)

View File

@ -2,7 +2,6 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using Oqtane.Modules.HtmlText.Models; using Oqtane.Modules.HtmlText.Models;
using Oqtane.Services; using Oqtane.Services;
using Oqtane.Shared; using Oqtane.Shared;
@ -11,51 +10,34 @@ namespace Oqtane.Modules.HtmlText.Services
{ {
public class HtmlTextService : ServiceBase, IHtmlTextService public class HtmlTextService : ServiceBase, IHtmlTextService
{ {
private readonly NavigationManager _navigationManager;
private readonly SiteState _siteState; private readonly SiteState _siteState;
public HtmlTextService(HttpClient http, SiteState siteState, NavigationManager navigationManager) : base(http) public HtmlTextService(HttpClient http, SiteState siteState) : base(http)
{ {
_siteState = siteState; _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) public async Task<HtmlTextInfo> GetHtmlTextAsync(int moduleId)
{ {
HtmlTextInfo htmlText; var htmltext = await GetJsonAsync<List<HtmlTextInfo>>($"{ApiUrl}/{moduleId}?entityid={moduleId}");
try return htmltext.FirstOrDefault();
{
//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;
} }
public async Task AddHtmlTextAsync(HtmlTextInfo htmlText) 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) 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) public async Task DeleteHtmlTextAsync(int moduleId)
{ {
await DeleteAsync(ApiUrl + "/" + moduleId + "?entityid=" + moduleId); await DeleteAsync($"{ApiUrl}/{moduleId}?entityid={moduleId}");
} }
} }
} }

View File

@ -87,7 +87,7 @@ namespace Oqtane.Modules
public string ContentUrl(int fileid) public string ContentUrl(int fileid)
{ {
return Utilities.ContentUrl(PageState.Alias.Path, fileid); return Utilities.ContentUrl(PageState.Alias, fileid);
} }
// user feedback methods // user feedback methods

View File

@ -6,7 +6,7 @@
<LangVersion>7.3</LangVersion> <LangVersion>7.3</LangVersion>
<RazorLangVersion>3.0</RazorLangVersion> <RazorLangVersion>3.0</RazorLangVersion>
<Configurations>Debug;Release</Configurations> <Configurations>Debug;Release</Configurations>
<Version>0.9.0</Version> <Version>0.9.1</Version>
<Product>Oqtane</Product> <Product>Oqtane</Product>
<Authors>Shaun Walker</Authors> <Authors>Shaun Walker</Authors>
<Company>.NET Foundation</Company> <Company>.NET Foundation</Company>
@ -27,10 +27,10 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="3.2.0-preview5.20216.8" /> <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="3.2.0-rc1.20223.4" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Build" Version="3.2.0-preview5.20216.8" PrivateAssets="all" /> <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="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>
<ItemGroup> <ItemGroup>

View File

@ -2,6 +2,7 @@
using System.Net.Http; using System.Net.Http;
using System.Net.Http.Json; using System.Net.Http.Json;
using System.Security.Claims; using System.Security.Claims;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Authorization; 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 ) // 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>(); 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); User user = await http.GetFromJsonAsync<User>(apiurl);
ClaimsIdentity identity = new ClaimsIdentity(); ClaimsIdentity identity = new ClaimsIdentity();

View File

@ -2,32 +2,19 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Net.Http; using System.Net.Http;
using System.Linq; using System.Linq;
//using Microsoft.AspNetCore.Components;
using System.Collections.Generic; using System.Collections.Generic;
using Oqtane.Shared;
using System.Net; using System.Net;
using System; using System;
using System.Net.Http.Json;
using Microsoft.AspNetCore.Components;
namespace Oqtane.Services namespace Oqtane.Services
{ {
public class AliasService : ServiceBase, IAliasService public class AliasService : ServiceBase, IAliasService
{ {
private readonly SiteState _siteState; public AliasService(HttpClient http) :base(http) { }
private readonly NavigationManager _navigationManager;
public AliasService(HttpClient http, SiteState siteState, NavigationManager navigationManager) :base(http) private string Apiurl => CreateApiUrl("Alias");
{
_siteState = siteState;
_navigationManager = navigationManager;
}
private string Apiurl
{
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Alias"); }
}
public async Task<List<Alias>> GetAliasesAsync() public async Task<List<Alias>> GetAliasesAsync()
{ {
@ -37,22 +24,13 @@ namespace Oqtane.Services
public async Task<Alias> GetAliasAsync(int aliasId) 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); name = (string.IsNullOrEmpty(name)) ? "~" : name;
string name = uri.Authority; return await GetJsonAsync<Alias>($"{Apiurl}/name/{WebUtility.UrlEncode(name)}?sync={lastSyncDate.ToString("yyyyMMddHHmmssfff")}");
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")}");
} }
public async Task<Alias> AddAliasAsync(Alias alias) public async Task<Alias> AddAliasAsync(Alias alias)
@ -62,11 +40,11 @@ namespace Oqtane.Services
public async Task<Alias> UpdateAliasAsync(Alias alias) 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) public async Task DeleteAliasAsync(int aliasId)
{ {
await DeleteAsync($"{Apiurl}/{aliasId.ToString()}"); await DeleteAsync($"{Apiurl}/{aliasId}");
} }
} }
} }

View File

@ -3,7 +3,6 @@ using System.Net;
using System.Net.Http; using System.Net.Http;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop; using Microsoft.JSInterop;
using Oqtane.Models; using Oqtane.Models;
using Oqtane.Shared; using Oqtane.Shared;
@ -14,21 +13,15 @@ namespace Oqtane.Services
public class FileService : ServiceBase, IFileService public class FileService : ServiceBase, IFileService
{ {
private readonly SiteState _siteState; private readonly SiteState _siteState;
private readonly NavigationManager _navigationManager;
private readonly IJSRuntime _jsRuntime; private readonly IJSRuntime _jsRuntime;
public FileService(HttpClient http, SiteState siteState, NavigationManager navigationManager, public FileService(HttpClient http, SiteState siteState, IJSRuntime jsRuntime) : base(http)
IJSRuntime jsRuntime) : base(http)
{ {
_siteState = siteState; _siteState = siteState;
_navigationManager = navigationManager;
_jsRuntime = jsRuntime; _jsRuntime = jsRuntime;
} }
private string Apiurl private string Apiurl => CreateApiUrl(_siteState.Alias, "File");
{
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "File"); }
}
public async Task<List<File>> GetFilesAsync(int folderId) public async Task<List<File>> GetFilesAsync(int folderId)
{ {
@ -54,7 +47,7 @@ namespace Oqtane.Services
public async Task<File> GetFileAsync(int fileId) 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) public async Task<File> AddFileAsync(File file)
@ -64,17 +57,17 @@ namespace Oqtane.Services
public async Task<File> UpdateFileAsync(File file) 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) public async Task DeleteFileAsync(int fileId)
{ {
await DeleteAsync($"{Apiurl}/{fileId.ToString()}"); await DeleteAsync($"{Apiurl}/{fileId}");
} }
public async Task<File> UploadFileAsync(string url, int folderId) 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) 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) public async Task<byte[]> DownloadFileAsync(int fileId)
{ {
return await GetByteArrayAsync($"{Apiurl}/download/{fileId.ToString()}"); return await GetByteArrayAsync($"{Apiurl}/download/{fileId}");
} }
} }
} }

View File

@ -2,7 +2,6 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Linq; using System.Linq;
using System.Net.Http; using System.Net.Http;
using Microsoft.AspNetCore.Components;
using System.Collections.Generic; using System.Collections.Generic;
using Oqtane.Shared; using Oqtane.Shared;
using System; using System;
@ -14,26 +13,24 @@ namespace Oqtane.Services
public class FolderService : ServiceBase, IFolderService public class FolderService : ServiceBase, IFolderService
{ {
private readonly SiteState _siteState; 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; _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) 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); folders = GetFoldersHierarchy(folders);
return folders; return folders;
} }
public async Task<Folder> GetFolderAsync(int folderId) 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) public async Task<Folder> GetFolderAsync(int siteId, [NotNull] string folderPath)
@ -55,7 +52,7 @@ namespace Oqtane.Services
public async Task<Folder> UpdateFolderAsync(Folder folder) 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) public async Task UpdateFolderOrderAsync(int siteId, int folderId, int? parentId)
@ -63,12 +60,12 @@ namespace Oqtane.Services
var parent = parentId == null var parent = parentId == null
? string.Empty ? string.Empty
: parentId.ToString(); : 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) public async Task DeleteFolderAsync(int folderId)
{ {
await DeleteAsync($"{ApiUrl}/{folderId.ToString()}"); await DeleteAsync($"{ApiUrl}/{folderId}");
} }
private static List<Folder> GetFoldersHierarchy(List<Folder> folders) private static List<Folder> GetFoldersHierarchy(List<Folder> folders)

View File

@ -1,23 +1,15 @@
using Oqtane.Models; using Oqtane.Models;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Net.Http; using System.Net.Http;
using Microsoft.AspNetCore.Components;
using Oqtane.Shared; using Oqtane.Shared;
namespace Oqtane.Services namespace Oqtane.Services
{ {
public class InstallationService : ServiceBase, IInstallationService public class InstallationService : ServiceBase, IInstallationService
{ {
private readonly SiteState _siteState; public InstallationService(HttpClient http):base(http) { }
private readonly NavigationManager _navigationManager;
public InstallationService(HttpClient http, SiteState siteState, NavigationManager navigationManager):base(http) private string ApiUrl => CreateApiUrl("Installation");
{
_siteState = siteState;
_navigationManager = navigationManager;
}
private string ApiUrl => CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Installation");
public async Task<Installation> IsInstalled() public async Task<Installation> IsInstalled()
{ {

View File

@ -6,14 +6,16 @@ namespace Oqtane.Services
{ {
public interface ISiteService 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);
} }
} }

View File

@ -11,8 +11,6 @@ namespace Oqtane.Services
Task<User> AddUserAsync(User user); Task<User> AddUserAsync(User user);
Task<User> AddUserAsync(User user, Alias alias);
Task<User> UpdateUserAsync(User user); Task<User> UpdateUserAsync(User user);
Task DeleteUserAsync(int userId); Task DeleteUserAsync(int userId);

View File

@ -2,28 +2,15 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Net.Http; using System.Net.Http;
using System.Linq; using System.Linq;
using Microsoft.AspNetCore.Components;
using System.Collections.Generic; using System.Collections.Generic;
using Oqtane.Shared;
namespace Oqtane.Services namespace Oqtane.Services
{ {
public class JobLogService : ServiceBase, IJobLogService public class JobLogService : ServiceBase, IJobLogService
{ {
private readonly SiteState _siteState; public JobLogService(HttpClient http) :base(http) { }
private readonly NavigationManager _navigationManager;
public JobLogService(HttpClient http, SiteState siteState, NavigationManager navigationManager) :base(http) private string Apiurl => CreateApiUrl("JobLog");
{
_siteState = siteState;
_navigationManager = navigationManager;
}
private string Apiurl
{
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "JobLog"); }
}
public async Task<List<JobLog>> GetJobLogsAsync() public async Task<List<JobLog>> GetJobLogsAsync()
{ {
@ -33,7 +20,7 @@ namespace Oqtane.Services
public async Task<JobLog> GetJobLogAsync(int jobLogId) 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) public async Task<JobLog> AddJobLogAsync(JobLog joblog)
@ -43,11 +30,11 @@ namespace Oqtane.Services
public async Task<JobLog> UpdateJobLogAsync(JobLog joblog) 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) public async Task DeleteJobLogAsync(int jobLogId)
{ {
await DeleteAsync($"{Apiurl}/{jobLogId.ToString()}"); await DeleteAsync($"{Apiurl}/{jobLogId}");
} }
} }
} }

View File

@ -2,29 +2,15 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Net.Http; using System.Net.Http;
using System.Linq; using System.Linq;
using Microsoft.AspNetCore.Components;
using System.Collections.Generic; using System.Collections.Generic;
using Oqtane.Shared;
namespace Oqtane.Services namespace Oqtane.Services
{ {
public class JobService : ServiceBase, IJobService public class JobService : ServiceBase, IJobService
{ {
public JobService(HttpClient http) : base(http) { }
private readonly SiteState _siteState; private string Apiurl => CreateApiUrl("Job");
private readonly NavigationManager _navigationManager;
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"); }
}
public async Task<List<Job>> GetJobsAsync() public async Task<List<Job>> GetJobsAsync()
{ {
@ -34,7 +20,7 @@ namespace Oqtane.Services
public async Task<Job> GetJobAsync(int jobId) 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) public async Task<Job> AddJobAsync(Job job)
@ -44,21 +30,21 @@ namespace Oqtane.Services
public async Task<Job> UpdateJobAsync(Job job) 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) public async Task DeleteJobAsync(int jobId)
{ {
await DeleteAsync($"{Apiurl}/{jobId.ToString()}"); await DeleteAsync($"{Apiurl}/{jobId}");
} }
public async Task StartJobAsync(int jobId) public async Task StartJobAsync(int jobId)
{ {
await GetAsync($"{Apiurl}/start/{jobId.ToString()}"); await GetAsync($"{Apiurl}/start/{jobId}");
} }
public async Task StopJobAsync(int jobId) public async Task StopJobAsync(int jobId)
{ {
await GetAsync($"{Apiurl}/stop/{jobId.ToString()}"); await GetAsync($"{Apiurl}/stop/{jobId}");
} }
} }
} }

View File

@ -23,19 +23,16 @@ namespace Oqtane.Services
_navigationManager = navigationManager; _navigationManager = navigationManager;
} }
private string Apiurl private string Apiurl => CreateApiUrl(_siteState.Alias, "Log");
{
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Log"); }
}
public async Task<List<Log>> GetLogsAsync(int siteId, string level, string function, int rows) 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) 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) 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 else
{ {
base.Alias = alias;
log.SiteId = alias.SiteId; log.SiteId = alias.SiteId;
} }
log.PageId = pageId; log.PageId = pageId;
@ -69,7 +67,7 @@ namespace Oqtane.Services
log.Message = message; log.Message = message;
log.MessageTemplate = ""; log.MessageTemplate = "";
log.Properties = JsonSerializer.Serialize(args); log.Properties = JsonSerializer.Serialize(args);
await PostJsonAsync(CreateCrossTenantUrl(Apiurl, alias), log); await PostJsonAsync(Apiurl, log);
} }
} }
} }

View File

@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using System; using System;
using System.Reflection; using System.Reflection;
using Oqtane.Shared; using Oqtane.Shared;
@ -15,34 +14,29 @@ namespace Oqtane.Services
{ {
private readonly HttpClient _http; private readonly HttpClient _http;
private readonly SiteState _siteState; 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; _http = http;
_siteState = siteState; _siteState = siteState;
_navigationManager = navigationManager;
} }
private string Apiurl private string Apiurl => CreateApiUrl(_siteState.Alias, "ModuleDefinition");
{
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, EntityNames.ModuleDefinition); }
}
public async Task<List<ModuleDefinition>> GetModuleDefinitionsAsync(int siteId) 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(); return moduledefinitions.OrderBy(item => item.Name).ToList();
} }
public async Task<ModuleDefinition> GetModuleDefinitionAsync(int moduleDefinitionId, int siteId) 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) public async Task UpdateModuleDefinitionAsync(ModuleDefinition moduleDefinition)
{ {
await PutJsonAsync($"{Apiurl}/{moduleDefinition.ModuleDefinitionId.ToString()}", moduleDefinition); await PutJsonAsync($"{Apiurl}/{moduleDefinition.ModuleDefinitionId}", moduleDefinition);
} }
public async Task InstallModuleDefinitionsAsync() public async Task InstallModuleDefinitionsAsync()
@ -52,7 +46,7 @@ namespace Oqtane.Services
public async Task DeleteModuleDefinitionAsync(int moduleDefinitionId, int siteId) 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) public async Task LoadModuleDefinitionsAsync(int siteId, Runtime runtime)

View File

@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using Oqtane.Shared; using Oqtane.Shared;
namespace Oqtane.Services namespace Oqtane.Services
@ -12,23 +11,17 @@ namespace Oqtane.Services
{ {
private readonly SiteState _siteState; 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; _siteState = siteState;
_navigationManager = navigationManager;
} }
private string Apiurl private string Apiurl => CreateApiUrl(_siteState.Alias, "Module");
{
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Module"); }
}
public async Task<List<Module>> GetModulesAsync(int siteId) 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 modules = modules
.OrderBy(item => item.Order) .OrderBy(item => item.Order)
.ToList(); .ToList();
@ -37,7 +30,7 @@ namespace Oqtane.Services
public async Task<Module> GetModuleAsync(int moduleId) 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) public async Task<Module> AddModuleAsync(Module module)
@ -47,7 +40,7 @@ namespace Oqtane.Services
public async Task<Module> UpdateModuleAsync(Module module) 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) public async Task DeleteModuleAsync(int moduleId)
@ -62,7 +55,7 @@ namespace Oqtane.Services
public async Task<string> ExportModuleAsync(int moduleId) public async Task<string> ExportModuleAsync(int moduleId)
{ {
return await GetStringAsync($"{Apiurl}/export?moduleid={moduleId.ToString()}"); return await GetStringAsync($"{Apiurl}/export?moduleid={moduleId}");
} }
} }
} }

View File

@ -1,7 +1,6 @@
using Oqtane.Models; using Oqtane.Models;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Net.Http; using System.Net.Http;
using Microsoft.AspNetCore.Components;
using Oqtane.Shared; using Oqtane.Shared;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -11,29 +10,24 @@ namespace Oqtane.Services
public class NotificationService : ServiceBase, INotificationService public class NotificationService : ServiceBase, INotificationService
{ {
private readonly SiteState _siteState; 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; _siteState = siteState;
_navigationManager = navigationManager;
} }
private string Apiurl private string Apiurl => CreateApiUrl(_siteState.Alias, "Notification");
{
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Notification"); }
}
public async Task<List<Notification>> GetNotificationsAsync(int siteId, string direction, int userId) 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(); return notifications.OrderByDescending(item => item.CreatedOn).ToList();
} }
public async Task<Notification> GetNotificationAsync(int notificationId) 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) public async Task<Notification> AddNotificationAsync(Notification notification)
@ -43,12 +37,12 @@ namespace Oqtane.Services
public async Task<Notification> UpdateNotificationAsync(Notification notification) 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) public async Task DeleteNotificationAsync(int notificationId)
{ {
await DeleteAsync($"{Apiurl}/{notificationId.ToString()}"); await DeleteAsync($"{Apiurl}/{notificationId}");
} }
} }
} }

View File

@ -2,29 +2,15 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using Oqtane.Shared;
using System.Linq; using System.Linq;
namespace Oqtane.Services namespace Oqtane.Services
{ {
public class PackageService : ServiceBase, IPackageService public class PackageService : ServiceBase, IPackageService
{ {
public PackageService(HttpClient http) : base(http) { }
private readonly SiteState _siteState; private string Apiurl => CreateApiUrl("Package");
private readonly NavigationManager _navigationManager;
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"); }
}
public async Task<List<Package>> GetPackagesAsync(string tag) public async Task<List<Package>> GetPackagesAsync(string tag)
{ {

View File

@ -1,7 +1,6 @@
using Oqtane.Models; using Oqtane.Models;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using Oqtane.Shared; using Oqtane.Shared;
namespace Oqtane.Services namespace Oqtane.Services
@ -10,28 +9,22 @@ namespace Oqtane.Services
{ {
private readonly SiteState _siteState; 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; _siteState = siteState;
_navigationManager = navigationManager;
} }
private string Apiurl private string Apiurl => CreateApiUrl(_siteState.Alias, "PageModule");
{
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "PageModule"); }
}
public async Task<PageModule> GetPageModuleAsync(int pageModuleId) 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) 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) public async Task<PageModule> AddPageModuleAsync(PageModule pageModule)
@ -41,17 +34,17 @@ namespace Oqtane.Services
public async Task<PageModule> UpdatePageModuleAsync(PageModule pageModule) 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) 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) public async Task DeletePageModuleAsync(int pageModuleId)
{ {
await DeleteAsync($"{Apiurl}/{pageModuleId.ToString()}"); await DeleteAsync($"{Apiurl}/{pageModuleId}");
} }
} }
} }

View File

@ -2,7 +2,6 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Linq; using System.Linq;
using System.Net.Http; using System.Net.Http;
using Microsoft.AspNetCore.Components;
using System.Collections.Generic; using System.Collections.Generic;
using Oqtane.Shared; using Oqtane.Shared;
using System; using System;
@ -14,42 +13,37 @@ namespace Oqtane.Services
{ {
private readonly SiteState _siteState; 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; _siteState = siteState;
_navigationManager = navigationManager;
} }
private string Apiurl private string Apiurl => CreateApiUrl(_siteState.Alias, "Page");
{
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Page"); }
}
public async Task<List<Page>> GetPagesAsync(int siteId) 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); pages = GetPagesHierarchy(pages);
return pages; return pages;
} }
public async Task<Page> GetPageAsync(int pageId) 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) 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) public async Task<Page> GetPageAsync(string path, int siteId)
{ {
try 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 catch
{ {
@ -64,12 +58,12 @@ namespace Oqtane.Services
public async Task<Page> AddPageAsync(int pageId, int userId) 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) 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) public async Task UpdatePageOrderAsync(int siteId, int pageId, int? parentId)
@ -77,12 +71,12 @@ namespace Oqtane.Services
var parent = parentId == null var parent = parentId == null
? string.Empty ? string.Empty
: parentId.ToString(); : 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) public async Task DeletePageAsync(int pageId)
{ {
await DeleteAsync($"{Apiurl}/{pageId.ToString()}"); await DeleteAsync($"{Apiurl}/{pageId}");
} }
private static List<Page> GetPagesHierarchy(List<Page> pages) private static List<Page> GetPagesHierarchy(List<Page> pages)

View File

@ -2,7 +2,6 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Net.Http; using System.Net.Http;
using System.Linq; using System.Linq;
using Microsoft.AspNetCore.Components;
using System.Collections.Generic; using System.Collections.Generic;
using Oqtane.Shared; using Oqtane.Shared;
@ -12,29 +11,23 @@ namespace Oqtane.Services
{ {
private readonly SiteState _siteState; 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; _siteState = siteState;
_navigationManager = navigationManager;
} }
private string Apiurl private string Apiurl => CreateApiUrl(_siteState.Alias, "Profile");
{
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Profile"); }
}
public async Task<List<Profile>> GetProfilesAsync(int siteId) 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(); return profiles.OrderBy(item => item.ViewOrder).ToList();
} }
public async Task<Profile> GetProfileAsync(int profileId) 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) public async Task<Profile> AddProfileAsync(Profile profile)
@ -44,11 +37,11 @@ namespace Oqtane.Services
public async Task<Profile> UpdateProfileAsync(Profile profile) 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) public async Task DeleteProfileAsync(int profileId)
{ {
await DeleteAsync($"{Apiurl}/{profileId.ToString()}"); await DeleteAsync($"{Apiurl}/{profileId}");
} }
} }
} }

View File

@ -2,7 +2,6 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Net.Http; using System.Net.Http;
using System.Linq; using System.Linq;
using Microsoft.AspNetCore.Components;
using System.Collections.Generic; using System.Collections.Generic;
using Oqtane.Shared; using Oqtane.Shared;
@ -12,29 +11,24 @@ namespace Oqtane.Services
{ {
private readonly SiteState _siteState; 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; _siteState = siteState;
_navigationManager = navigationManager;
} }
private string Apiurl private string Apiurl => CreateApiUrl(_siteState.Alias, "Role");
{
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Role"); }
}
public async Task<List<Role>> GetRolesAsync(int siteId) 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(); return roles.OrderBy(item => item.Name).ToList();
} }
public async Task<Role> GetRoleAsync(int roleId) 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) public async Task<Role> AddRoleAsync(Role role)
@ -44,11 +38,11 @@ namespace Oqtane.Services
public async Task<Role> UpdateRoleAsync(Role role) 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) public async Task DeleteRoleAsync(int roleId)
{ {
await DeleteAsync($"{Apiurl}/{roleId.ToString()}"); await DeleteAsync($"{Apiurl}/{roleId}");
} }
} }
} }

View File

@ -17,7 +17,6 @@ namespace Oqtane.Services
_http = client; _http = client;
} }
protected async Task GetAsync(string uri) protected async Task GetAsync(string uri)
{ {
var response = await _http.GetAsync(uri); var response = await _http.GetAsync(uri);
@ -83,7 +82,6 @@ namespace Oqtane.Services
var result = await response.Content.ReadFromJsonAsync<TResult>(); var result = await response.Content.ReadFromJsonAsync<TResult>();
return result; return result;
} }
return default; return default;
} }
@ -122,6 +120,8 @@ namespace Oqtane.Services
if (response.StatusCode != HttpStatusCode.NoContent && response.StatusCode != HttpStatusCode.NotFound) if (response.StatusCode != HttpStatusCode.NoContent && response.StatusCode != HttpStatusCode.NotFound)
{ {
//TODO: Log errors here //TODO: Log errors here
Console.WriteLine($"Request: {response.RequestMessage.RequestUri}");
Console.WriteLine($"Response status: {response.StatusCode} {response.ReasonPhrase}"); Console.WriteLine($"Response status: {response.StatusCode} {response.ReasonPhrase}");
} }
@ -135,24 +135,31 @@ namespace Oqtane.Services
//TODO Missing content JSON validation //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) if (alias != null)
{ {
// build a url which passes the alias that may include a subfolder for multi-tenancy // include the alias for multi-tenant context
apiurl = $"{uri.Scheme}://{alias.Name}/"; apiurl += $"{alias.AliasId}/";
if (alias.Path == string.Empty)
{
apiurl += "~/";
}
} }
else else
{ {
// build a url which ignores any subfolder for multi-tenancy // tenant agnostic
apiurl = $"{uri.Scheme}://{uri.Authority}/~/"; apiurl += "~/";
} }
apiurl += $"api/{serviceName}"; apiurl += $"api/{serviceName}";
@ -160,15 +167,14 @@ namespace Oqtane.Services
return apiurl; return apiurl;
} }
public static string CreateCrossTenantUrl(string url, Alias alias) // can be used to override the default alias
{ public Alias Alias { get; set; }
if (alias != null)
{
url += (url.Contains("?")) ? "&" : "?";
url += "aliasid=" + alias.AliasId.ToString();
}
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);
} }
} }
} }

View File

@ -2,7 +2,6 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Net.Http; using System.Net.Http;
using System.Linq; using System.Linq;
using Microsoft.AspNetCore.Components;
using System.Collections.Generic; using System.Collections.Generic;
using Oqtane.Shared; using Oqtane.Shared;
@ -12,20 +11,13 @@ namespace Oqtane.Services
{ {
private readonly SiteState _siteState; 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; _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() public async Task<Dictionary<string, string>> GetTenantSettingsAsync()
{ {
return await GetSettingsAsync(EntityNames.Tenant, -1); return await GetSettingsAsync(EntityNames.Tenant, -1);
@ -99,7 +91,7 @@ namespace Oqtane.Services
public async Task<Dictionary<string, string>> GetSettingsAsync(string entityName, int entityId) public async Task<Dictionary<string, string>> GetSettingsAsync(string entityName, int entityId)
{ {
var dictionary = new Dictionary<string, string>(); 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()) 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) 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) foreach (KeyValuePair<string, string> kvp in settings)
{ {
@ -138,7 +130,7 @@ namespace Oqtane.Services
public async Task<Setting> GetSettingAsync(int settingId) 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) public async Task<Setting> AddSettingAsync(Setting setting)
@ -148,12 +140,12 @@ namespace Oqtane.Services
public async Task<Setting> UpdateSettingAsync(Setting setting) 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) public async Task DeleteSettingAsync(int settingId)
{ {
await DeleteAsync($"{Apiurl}/{settingId.ToString()}"); await DeleteAsync($"{Apiurl}/{settingId}");
} }

View File

@ -2,7 +2,6 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Net.Http; using System.Net.Http;
using System.Linq; using System.Linq;
using Microsoft.AspNetCore.Components;
using System.Collections.Generic; using System.Collections.Generic;
using Oqtane.Shared; using Oqtane.Shared;
@ -12,44 +11,44 @@ namespace Oqtane.Services
{ {
private readonly SiteState _siteState; 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; _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(); 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}");
} }
} }
} }

View File

@ -3,28 +3,14 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using Oqtane.Shared;
namespace Oqtane.Services namespace Oqtane.Services
{ {
public class SiteTemplateService : ServiceBase, ISiteTemplateService public class SiteTemplateService : ServiceBase, ISiteTemplateService
{ {
public SiteTemplateService(HttpClient http) : base(http) { }
private readonly SiteState _siteState; private string Apiurl => CreateApiUrl("SiteTemplate");
private readonly NavigationManager _navigationManager;
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"); }
}
public async Task<List<SiteTemplate>> GetSiteTemplatesAsync() public async Task<List<SiteTemplate>> GetSiteTemplatesAsync()
{ {

View File

@ -1,30 +1,14 @@
using Oqtane.Models; using Oqtane.Models;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using Oqtane.Shared;
using System.Collections.Generic;
using System.Linq;
namespace Oqtane.Services namespace Oqtane.Services
{ {
public class SqlService : ServiceBase, ISqlService public class SqlService : ServiceBase, ISqlService
{ {
public SqlService(HttpClient http) : base(http) { }
private readonly SiteState _siteState; private string Apiurl => CreateApiUrl("Sql");
private readonly NavigationManager _navigationManager;
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"); }
}
public async Task<SqlQuery> ExecuteQueryAsync(SqlQuery sqlquery) public async Task<SqlQuery> ExecuteQueryAsync(SqlQuery sqlquery)
{ {

View File

@ -1,28 +1,14 @@
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using Oqtane.Shared;
using System.Collections.Generic; using System.Collections.Generic;
namespace Oqtane.Services namespace Oqtane.Services
{ {
public class SystemService : ServiceBase, ISystemService public class SystemService : ServiceBase, ISystemService
{ {
public SystemService(HttpClient http) : base(http) { }
private readonly SiteState _siteState; private string Apiurl => CreateApiUrl("System");
private readonly NavigationManager _navigationManager;
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"); }
}
public async Task<Dictionary<string, string>> GetSystemInfoAsync() public async Task<Dictionary<string, string>> GetSystemInfoAsync()
{ {

View File

@ -1,8 +1,6 @@
using Oqtane.Models; using Oqtane.Models;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using Oqtane.Shared;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -10,21 +8,9 @@ namespace Oqtane.Services
{ {
public class TenantService : ServiceBase, ITenantService public class TenantService : ServiceBase, ITenantService
{ {
public TenantService(HttpClient http) : base(http) { }
private readonly SiteState _siteState; private string Apiurl => CreateApiUrl("Tenant");
private readonly NavigationManager _navigationManager;
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"); }
}
public async Task<List<Tenant>> GetTenantsAsync() public async Task<List<Tenant>> GetTenantsAsync()
{ {
@ -34,7 +20,7 @@ namespace Oqtane.Services
public async Task<Tenant> GetTenantAsync(int tenantId) 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) public async Task<Tenant> AddTenantAsync(Tenant tenant)
@ -44,12 +30,12 @@ namespace Oqtane.Services
public async Task<Tenant> UpdateTenantAsync(Tenant tenant) 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) public async Task DeleteTenantAsync(int tenantId)
{ {
await DeleteAsync($"{Apiurl}/{tenantId.ToString()}"); await DeleteAsync($"{Apiurl}/{tenantId}");
} }
} }
} }

View File

@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using System.Reflection; using System.Reflection;
using System; using System;
using Oqtane.Shared; using Oqtane.Shared;
@ -13,20 +12,13 @@ namespace Oqtane.Services
public class ThemeService : ServiceBase, IThemeService public class ThemeService : ServiceBase, IThemeService
{ {
private readonly HttpClient _http; 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; _http = http;
_siteState = siteState;
_navigationManager = navigationManager;
} }
private string Apiurl private string Apiurl => CreateApiUrl("Theme");
{
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Theme"); }
}
public async Task<List<Theme>> GetThemesAsync() public async Task<List<Theme>> GetThemesAsync()
{ {

View File

@ -2,7 +2,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using Oqtane.Shared; using Oqtane.Shared;
namespace Oqtane.Services namespace Oqtane.Services
@ -11,28 +10,22 @@ namespace Oqtane.Services
{ {
private readonly SiteState _siteState; 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; _siteState = siteState;
_navigationManager = navigationManager;
} }
private string Apiurl private string Apiurl => CreateApiUrl(_siteState.Alias, "UserRole");
{
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "UserRole"); }
}
public async Task<List<UserRole>> GetUserRolesAsync(int siteId) 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) 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) public async Task<UserRole> AddUserRoleAsync(UserRole userRole)
@ -42,12 +35,12 @@ namespace Oqtane.Services
public async Task<UserRole> UpdateUserRoleAsync(UserRole userRole) 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) public async Task DeleteUserRoleAsync(int userRoleId)
{ {
await DeleteAsync($"{Apiurl}/{userRoleId.ToString()}"); await DeleteAsync($"{Apiurl}/{userRoleId}");
} }
} }
} }

View File

@ -1,7 +1,6 @@
using Oqtane.Shared; using Oqtane.Shared;
using Oqtane.Models; using Oqtane.Models;
using System.Net.Http; using System.Net.Http;
using Microsoft.AspNetCore.Components;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Oqtane.Services namespace Oqtane.Services
@ -9,18 +8,13 @@ namespace Oqtane.Services
public class UserService : ServiceBase, IUserService public class UserService : ServiceBase, IUserService
{ {
private readonly SiteState _siteState; 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; _siteState = siteState;
_navigationManager = navigationManager;
} }
private string Apiurl private string Apiurl => CreateApiUrl(_siteState.Alias, "User");
{
get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "User"); }
}
public async Task<User> GetUserAsync(int userId, int siteId) public async Task<User> GetUserAsync(int userId, int siteId)
{ {
@ -37,11 +31,6 @@ namespace Oqtane.Services
return await PostJsonAsync<User>(Apiurl, user); 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) public async Task<User> UpdateUserAsync(User user)
{ {
return await PutJsonAsync<User>($"{Apiurl}/{user.UserId}", user); return await PutJsonAsync<User>($"{Apiurl}/{user.UserId}", user);

View File

@ -2,7 +2,9 @@
@inherits ContainerBase @inherits ContainerBase
<div class="container"> <div class="container">
<div class="row px-4"> <div class="row px-4">
<ModuleActions /><h2><ModuleTitle /></h2> <div class="d-flex flex-nowrap">
<ModuleActions /><h2><ModuleTitle /></h2>
</div>
<hr class="app-rule" /> <hr class="app-rule" />
</div> </div>
<div class="row px-4"> <div class="row px-4">

View File

@ -7,15 +7,7 @@
<div class="sidebar"> <div class="sidebar">
<nav class="navbar"> <nav class="navbar">
<Logo /> <Logo /><Menu Orientation="Vertical" />
<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>
</nav> </nav>
</div> </div>

View File

@ -1,27 +1,34 @@
@namespace Oqtane.Themes.Controls @namespace Oqtane.Themes.Controls
@inherits ThemeControlBase @inherits ThemeControlBase
@attribute [OqtaneIgnore]
@if (BreadCrumbPages.Any()) @if (BreadCrumbPages.Any())
{ {
<ol class="breadcrumb"> <span class="app-breadcrumbs">
@foreach (var p in BreadCrumbPages) <ol class="breadcrumb">
{ @foreach (var p in BreadCrumbPages)
<li class="breadcrumb-item @ActiveClass(p)"> {
<a href="@NavigateUrl(p.Path)">@p.Name</a> if (p.PageId == PageState.Page.PageId)
</li> {
} <li class="breadcrumb-item active">
</ol> <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 { @code {
protected IEnumerable<Page> BreadCrumbPages => GetBreadCrumbPages().Reverse().ToList(); 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() private IEnumerable<Page> GetBreadCrumbPages()
{ {
var page = PageState.Page; var page = PageState.Page;

View File

@ -1,6 +1,6 @@
@namespace Oqtane.Themes.Controls @namespace Oqtane.Themes.Controls
@using Oqtane.Enums
@inherits ThemeControlBase @inherits ThemeControlBase
@attribute [OqtaneIgnore]
@inject NavigationManager NavigationManager @inject NavigationManager NavigationManager
@inject IUserService UserService @inject IUserService UserService
@inject IModuleDefinitionService ModuleDefinitionService @inject IModuleDefinitionService ModuleDefinitionService
@ -16,7 +16,7 @@
<div class="@CardClass"> <div class="@CardClass">
<div class="@HeaderClass"> <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"> <button type="button" class="close" @onclick="HideControlPanel" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
@ -245,17 +245,17 @@
{ {
if (string.IsNullOrEmpty(ButtonClass)) if (string.IsNullOrEmpty(ButtonClass))
{ {
ButtonClass = "btn-outline-primary"; ButtonClass = "btn-outline-secondary";
} }
if (string.IsNullOrEmpty(CardClass)) if (string.IsNullOrEmpty(CardClass))
{ {
CardClass = "card bg-secondary mb-3"; CardClass = "card border-secondary mb-3";
} }
if (string.IsNullOrEmpty(HeaderClass)) if (string.IsNullOrEmpty(HeaderClass))
{ {
HeaderClass = "card-header text-white"; HeaderClass = "card-header";
} }
if (string.IsNullOrEmpty(BodyClass)) if (string.IsNullOrEmpty(BodyClass))
@ -361,6 +361,7 @@
module.SiteId = PageState.Site.SiteId; module.SiteId = PageState.Site.SiteId;
module.PageId = PageState.Page.PageId; module.PageId = PageState.Page.PageId;
module.ModuleDefinitionName = _moduleDefinitionName; module.ModuleDefinitionName = _moduleDefinitionName;
module.AllPages = false;
module.Permissions = PageState.Page.Permissions; module.Permissions = PageState.Page.Permissions;
module = await ModuleService.AddModuleAsync(module); module = await ModuleService.AddModuleAsync(module);
_moduleId = module.ModuleId.ToString(); _moduleId = module.ModuleId.ToString();

View File

@ -1,14 +1,17 @@
@namespace Oqtane.Themes.Controls @namespace Oqtane.Themes.Controls
@inherits LoginBase @inherits LoginBase
@attribute [OqtaneIgnore]
<AuthorizeView> <span class="app-login">
<Authorizing> <AuthorizeView>
<text>...</text> <Authorizing>
</Authorizing> <text>...</text>
<Authorized> </Authorizing>
<button type="button" class="btn btn-primary" @onclick="LogoutUser">Logout</button> <Authorized>
</Authorized> <button type="button" class="btn btn-primary" @onclick="LogoutUser">Logout</button>
<NotAuthorized> </Authorized>
<button type="button" class="btn btn-primary" @onclick="LoginUser">Login</button> <NotAuthorized>
</NotAuthorized> <button type="button" class="btn btn-primary" @onclick="LoginUser">Login</button>
</AuthorizeView> </NotAuthorized>
</AuthorizeView>
</span>

View File

@ -35,7 +35,7 @@ namespace Oqtane.Themes.Controls
var interop = new Interop(jsRuntime); var interop = new Interop(jsRuntime);
string antiforgerytoken = await interop.GetElementByName("__RequestVerificationToken"); string antiforgerytoken = await interop.GetElementByName("__RequestVerificationToken");
var fields = new { __RequestVerificationToken = antiforgerytoken, returnurl = (PageState.Alias.Path + "/" + PageState.Page.Path) }; 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 else
{ {

View File

@ -1,21 +1,13 @@
@namespace Oqtane.Themes.Controls @namespace Oqtane.Themes.Controls
@inherits ThemeControlBase @inherits ThemeControlBase
@inject NavigationManager NavigationManager @attribute [OqtaneIgnore]
@if (PageState.Site.LogoFileId != null) @if (PageState.Site.LogoFileId != null)
{ {
<a href="@Href"> <span class="app-logo">
<img class="img-fluid" src="@ContentUrl(PageState.Site.LogoFileId.Value)" alt="@PageState.Site.Name"/> <a href="@PageState.Alias.Path">
</a> <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}";
}
}
}

View File

@ -1,12 +1,14 @@
@namespace Oqtane.Themes.Controls @namespace Oqtane.Themes.Controls
@inherits MenuBase @inherits MenuBase
@attribute [OqtaneIgnore]
@if (MenuPages.Any()) @if (MenuPages.Any())
{ {
<div class="app-menu"> <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"> <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> <span class="navbar-toggler-icon"></span>
</button> </button>
</span>
<div class="app-menu">
<div class="collapse navbar-collapse" id="Menu"> <div class="collapse navbar-collapse" id="Menu">
<ul class="navbar-nav mr-auto"> <ul class="navbar-nav mr-auto">
@foreach (var p in MenuPages) @foreach (var p in MenuPages)

View File

@ -1,27 +1,34 @@
@namespace Oqtane.Themes.Controls @namespace Oqtane.Themes.Controls
@inherits MenuBase @inherits MenuBase
@attribute [OqtaneIgnore]
@if (MenuPages.Any()) @if (MenuPages.Any())
{ {
<span class="app-menu-toggler">
<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="app-menu">
<ul class="nav flex-column"> <div class="collapse navbar-collapse" id="Menu">
@foreach (var p in MenuPages) <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)"> <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) @if (p.HasChildren)
{ {
<i class="oi oi-chevron-right"></i> <i class="oi oi-chevron-right"></i>
} }
@if (p.Icon != string.Empty) @if (p.Icon != string.Empty)
{ {
<span class="oi oi-@p.Icon" aria-hidden="true"></span> <span class="oi oi-@p.Icon" aria-hidden="true"></span>
} }
@p.Name @p.Name
</a>
</a> </li>
</li> }
} </ul>
</ul> </div>
</div> </div>
} }

View File

@ -1,20 +1,23 @@
@namespace Oqtane.Themes.Controls @namespace Oqtane.Themes.Controls
@inherits ModuleActionsBase @inherits ModuleActionsBase
@attribute [OqtaneIgnore]
@if (PageState.EditMode && !PageState.Page.EditMode && UserSecurity.IsAuthorized(PageState.User,PermissionNames.Edit, ModuleState.Permissions)) @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="app-moduleactions">
<div class="dropdown-menu" x-placement="bottom-start" style="position: absolute; will-change: transform; top: 0px; left: 0px; transform: translate3d(0px, 37px, 0px);"> <a class="nav-link dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"></a>
@foreach (var action in Actions) <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)) {
{ if (string.IsNullOrEmpty(action.Name))
<div class="dropdown-divider"></div> {
} <div class="dropdown-divider"></div>
else }
{ else
<a class="dropdown-item" @onclick="(async () => await ModuleAction(action))">@action.Name</a> {
} <a class="dropdown-item" @onclick="(async () => await ModuleAction(action))">@action.Name</a>
} }
}
</div>
</div> </div>
} }

View File

@ -75,8 +75,7 @@ namespace Oqtane.Themes.Controls
private async Task<string> EditUrlAsync(string url, int moduleId, string import) private async Task<string> EditUrlAsync(string url, int moduleId, string import)
{ {
await Task.Yield(); await Task.Yield();
EditUrl(moduleId, import); return EditUrl(moduleId, import);
return url;
} }
protected async Task ModuleAction(ActionViewModel action) protected async Task ModuleAction(ActionViewModel action)

View File

@ -1,7 +1,10 @@
@namespace Oqtane.Themes.Controls @namespace Oqtane.Themes.Controls
@inherits ContainerBase @inherits ContainerBase
@attribute [OqtaneIgnore]
@((MarkupString)title) <span class="app-moduletitle">
@((MarkupString)title)
</span>
@code { @code {
private string title = ""; private string title = "";

View File

@ -1,22 +1,24 @@
@namespace Oqtane.Themes.Controls @namespace Oqtane.Themes.Controls
@inherits ThemeControlBase @inherits ThemeControlBase
@attribute [OqtaneIgnore]
@inject NavigationManager NavigationManager @inject NavigationManager NavigationManager
<AuthorizeView> <span class="app-profile">
<Authorizing> <AuthorizeView>
<text>...</text> <Authorizing>
</Authorizing> <text>...</text>
<Authorized> </Authorizing>
<button type="button" class="btn btn-primary" @onclick="UpdateProfile">@context.User.Identity.Name</button> <Authorized>
</Authorized> <button type="button" class="btn btn-primary" @onclick="UpdateProfile">@context.User.Identity.Name</button>
<NotAuthorized> </Authorized>
@if (PageState.Site.AllowRegistration) <NotAuthorized>
{ @if (PageState.Site.AllowRegistration)
<button type="button" class="btn btn-primary" @onclick="RegisterUser">Register</button> {
} <button type="button" class="btn btn-primary" @onclick="RegisterUser">Register</button>
</NotAuthorized> }
</AuthorizeView> </NotAuthorized>
</AuthorizeView>
</span>
@code { @code {

View File

@ -2,7 +2,9 @@
@inherits ContainerBase @inherits ContainerBase
<div class="container"> <div class="container">
<div class="row px-4"> <div class="row px-4">
<ModuleActions /><h2><ModuleTitle /></h2> <div class="d-flex flex-nowrap">
<ModuleActions /><h2><ModuleTitle /></h2>
</div>
<hr class="app-rule" /> <hr class="app-rule" />
</div> </div>
<div class="row px-4"> <div class="row px-4">

View File

@ -3,9 +3,12 @@
<main role="main"> <main role="main">
<nav class="navbar navbar-expand-md navbar-dark bg-primary fixed-top"> <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> </nav>
<div class="container"> <div class="content container">
<PaneLayout /> <PaneLayout />
<div class="row px-4"> <div class="row px-4">
<Pane Name="Admin" /> <Pane Name="Admin" />
@ -18,6 +21,9 @@
protected override async Task OnParametersSetAsync() 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"); await IncludeCSS("Theme.css");
} }
} }

View File

@ -1,4 +1,4 @@
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop; using Microsoft.JSInterop;
using Oqtane.Shared; using Oqtane.Shared;
using Oqtane.UI; using Oqtane.UI;
@ -30,6 +30,13 @@ namespace Oqtane.Themes
await interop.IncludeCSS("Theme", Url); 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() public string NavigateUrl()
{ {
return NavigateUrl(PageState.Page.Path); return NavigateUrl(PageState.Page.Path);

View File

@ -41,7 +41,7 @@ namespace Oqtane.Themes
public string ContentUrl(int fileid) public string ContentUrl(int fileid)
{ {
return Utilities.ContentUrl(PageState.Alias.Path, fileid); return Utilities.ContentUrl(PageState.Alias, fileid);
} }
} }
} }

View File

@ -1,4 +1,6 @@
@namespace Oqtane.UI @using System.Diagnostics.CodeAnalysis
@using System.Runtime.InteropServices
@namespace Oqtane.UI
@inject AuthenticationStateProvider AuthenticationStateProvider @inject AuthenticationStateProvider AuthenticationStateProvider
@inject SiteState SiteState @inject SiteState SiteState
@inject NavigationManager NavigationManager @inject NavigationManager NavigationManager
@ -11,9 +13,6 @@
@inject IModuleService ModuleService @inject IModuleService ModuleService
@inject IModuleDefinitionService ModuleDefinitionService @inject IModuleDefinitionService ModuleDefinitionService
@inject ILogService LogService @inject ILogService LogService
@using System.Diagnostics.CodeAnalysis
@using Oqtane.Enums
@using System.Runtime.InteropServices
@implements IHandleAfterRender @implements IHandleAfterRender
@DynamicComponent @DynamicComponent
@ -84,20 +83,13 @@
var lastsyncdate = DateTime.UtcNow; var lastsyncdate = DateTime.UtcNow;
var runtime = GetRuntime(); var runtime = GetRuntime();
// get Url path and querystring ( and remove anchors ) Uri uri = new Uri(_absoluteUri);
var path = new Uri(_absoluteUri).PathAndQuery.Substring(1);
if (path.IndexOf("#") != -1)
{
path = path.Substring(0, path.IndexOf("#"));
}
// parse querystring and remove // get path
var querystring = new Dictionary<string, string>(); var path = uri.LocalPath.Substring(1);
if (path.IndexOf("?") != -1)
{ // parse querystring
querystring = ParseQueryString(path); var querystring = ParseQueryString(uri.Query);
path = path.Substring(0, path.IndexOf("?"));
}
// the reload parameter is used during user login/logout // the reload parameter is used during user login/logout
if (querystring.ContainsKey("reload")) if (querystring.ContainsKey("reload"))
@ -111,7 +103,7 @@
lastsyncdate = PageState.LastSyncDate; lastsyncdate = PageState.LastSyncDate;
} }
alias = await AliasService.GetAliasAsync(_absoluteUri, lastsyncdate); alias = await AliasService.GetAliasAsync(path, lastsyncdate);
SiteState.Alias = alias; // set state for services SiteState.Alias = alias; // set state for services
lastsyncdate = alias.SyncDate; lastsyncdate = alias.SyncDate;
@ -130,7 +122,7 @@
if (reload == Reload.Site || PageState == null || alias.SiteId != PageState.Alias.SiteId) 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; reload = Reload.Site;
} }
else else
@ -244,7 +236,7 @@
} }
// check if user is authorized to view page // 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); page = await ProcessPage(page, site, user);
@ -325,12 +317,13 @@
return Task.CompletedTask; 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>(); 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 != "") if (kvp != "")
{ {
@ -341,12 +334,11 @@
} }
else 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; return querystring;
} }
@ -478,7 +470,7 @@
} }
private Runtime GetRuntime() private Runtime GetRuntime()
=> RuntimeInformation.IsOSPlatform(OSPlatform.Create("WEBASSEMBLY")) => RuntimeInformation.IsOSPlatform(OSPlatform.Create("BROWSER"))
? Runtime.WebAssembly ? Runtime.WebAssembly
: Runtime.Server; : Runtime.Server;
} }

View File

@ -22,7 +22,7 @@
} }
if (PageState.Site.FaviconFileId != null) 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) if (PageState.Site.PwaIsEnabled)
{ {
@ -59,11 +59,11 @@
"\"background_color\": \"#fff\", " + "\"background_color\": \"#fff\", " +
"\"description\": \"" + PageState.Site.Name + "\", " + "\"description\": \"" + PageState.Site.Name + "\", " +
"\"icons\": [{ " + "\"icons\": [{ " +
"\"src\": \"" + Utilities.ContentUrl(PageState.Alias.Path, PageState.Site.PwaAppIconFileId.Value) + "\", " + "\"src\": \"" + Utilities.ContentUrl(PageState.Alias, PageState.Site.PwaAppIconFileId.Value) + "\", " +
"\"sizes\": \"192x192\", " + "\"sizes\": \"192x192\", " +
"\"type\": \"image/png\" " + "\"type\": \"image/png\" " +
"}, { " + "}, { " +
"\"src\": \"" + Utilities.ContentUrl(PageState.Alias.Path, PageState.Site.PwaSplashIconFileId.Value) + "\", " + "\"src\": \"" + Utilities.ContentUrl(PageState.Alias, PageState.Site.PwaSplashIconFileId.Value) + "\", " +
"\"sizes\": \"512x512\", " + "\"sizes\": \"512x512\", " +
"\"type\": \"image/png\" " + "\"type\": \"image/png\" " +
"}] " + "}] " +

View File

@ -18,3 +18,4 @@
@using Oqtane.Themes @using Oqtane.Themes
@using Oqtane.Themes.Controls @using Oqtane.Themes.Controls
@using Oqtane.UI @using Oqtane.UI
@using Oqtane.Enums

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata> <metadata>
<id>Oqtane.Framework</id> <id>Oqtane.Framework</id>
<version>0.9.0</version> <version>0.9.1</version>
<authors>Shaun Walker</authors> <authors>Shaun Walker</authors>
<owners>.NET Foundation</owners> <owners>.NET Foundation</owners>
<title>Oqtane Framework</title> <title>Oqtane Framework</title>

View File

@ -10,19 +10,22 @@ using System.Globalization;
using Oqtane.Enums; using Oqtane.Enums;
using Oqtane.Infrastructure; using Oqtane.Infrastructure;
using Oqtane.Repository; using Oqtane.Repository;
using Microsoft.AspNetCore.Http;
namespace Oqtane.Controllers namespace Oqtane.Controllers
{ {
[Route("{site}/api/[controller]")] [Route("{alias}/api/[controller]")]
public class AliasController : Controller public class AliasController : Controller
{ {
private readonly IAliasRepository _aliases; private readonly IAliasRepository _aliases;
private readonly IHttpContextAccessor _accessor;
private readonly ISyncManager _syncManager; private readonly ISyncManager _syncManager;
private readonly ILogManager _logger; private readonly ILogManager _logger;
public AliasController(IAliasRepository aliases, ISyncManager syncManager, ILogManager logger) public AliasController(IAliasRepository aliases, IHttpContextAccessor accessor, ISyncManager syncManager, ILogManager logger)
{ {
_aliases = aliases; _aliases = aliases;
_accessor = accessor;
_syncManager = syncManager; _syncManager = syncManager;
_logger = logger; _logger = logger;
} }
@ -43,20 +46,30 @@ namespace Oqtane.Controllers
return _aliases.GetAlias(id); return _aliases.GetAlias(id);
} }
// GET api/<controller>/name/localhost:12345?lastsyncdate=yyyyMMddHHmmssfff // GET api/<controller>/name/xxx?sync=yyyyMMddHHmmssfff
[HttpGet("name/{name}")] [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(); // cached
List<Alias> aliases = _aliases.GetAliases().ToList();
Alias alias = null; Alias alias = null;
alias = aliases.FirstOrDefault(item => item.Name == name); if (_accessor.HttpContext != null)
if (name != null && (alias == null && name.Contains("/")))
{ {
// lookup alias without folder name name = (name == "~") ? "" : name;
alias = aliases.Find(item => item.Name == name.Substring(0, name.IndexOf("/", StringComparison.Ordinal))); 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 // use first alias if name does not exist
alias = aliases.FirstOrDefault(); alias = aliases.FirstOrDefault();
@ -66,7 +79,7 @@ namespace Oqtane.Controllers
if (alias != null) if (alias != null)
{ {
alias.SyncDate = DateTime.UtcNow; 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; return alias;
} }

View File

@ -21,7 +21,7 @@ using Oqtane.Repository;
namespace Oqtane.Controllers namespace Oqtane.Controllers
{ {
[Route("{site}/api/[controller]")] [Route("{alias}/api/[controller]")]
public class FileController : Controller public class FileController : Controller
{ {
private readonly IWebHostEnvironment _environment; private readonly IWebHostEnvironment _environment;

View File

@ -14,7 +14,7 @@ using System.IO;
namespace Oqtane.Controllers namespace Oqtane.Controllers
{ {
[Route("{site}/api/[controller]")] [Route("{alias}/api/[controller]")]
public class FolderController : Controller public class FolderController : Controller
{ {
private readonly IFolderRepository _folders; private readonly IFolderRepository _folders;

View File

@ -7,7 +7,7 @@ using Oqtane.Infrastructure;
namespace Oqtane.Controllers namespace Oqtane.Controllers
{ {
[Route("{site}/api/[controller]")] [Route("{alias}/api/[controller]")]
public class InstallationController : Controller public class InstallationController : Controller
{ {
private readonly IConfigurationRoot _config; private readonly IConfigurationRoot _config;

View File

@ -12,7 +12,7 @@ using Oqtane.Repository;
namespace Oqtane.Controllers namespace Oqtane.Controllers
{ {
[Route("{site}/api/[controller]")] [Route("{alias}/api/[controller]")]
public class JobController : Controller public class JobController : Controller
{ {
private readonly IJobRepository _jobs; private readonly IJobRepository _jobs;

View File

@ -9,7 +9,7 @@ using Oqtane.Repository;
namespace Oqtane.Controllers namespace Oqtane.Controllers
{ {
[Route("{site}/api/[controller]")] [Route("{alias}/api/[controller]")]
public class JobLogController : Controller public class JobLogController : Controller
{ {
private readonly IJobLogRepository _jobLogs; private readonly IJobLogRepository _jobLogs;

View File

@ -9,7 +9,7 @@ using Oqtane.Shared;
namespace Oqtane.Controllers namespace Oqtane.Controllers
{ {
[Route("{site}/api/[controller]")] [Route("{alias}/api/[controller]")]
public class LogController : Controller public class LogController : Controller
{ {
private readonly ILogManager _logger; private readonly ILogManager _logger;

View File

@ -11,19 +11,21 @@ using Oqtane.Security;
namespace Oqtane.Controllers namespace Oqtane.Controllers
{ {
[Route("{site}/api/[controller]")] [Route("{alias}/api/[controller]")]
public class ModuleController : Controller public class ModuleController : Controller
{ {
private readonly IModuleRepository _modules; private readonly IModuleRepository _modules;
private readonly IPageModuleRepository _pageModules; private readonly IPageModuleRepository _pageModules;
private readonly IPageRepository _pages;
private readonly IModuleDefinitionRepository _moduleDefinitions; private readonly IModuleDefinitionRepository _moduleDefinitions;
private readonly IUserPermissions _userPermissions; private readonly IUserPermissions _userPermissions;
private readonly ILogManager _logger; 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; _modules = modules;
_pageModules = pageModules; _pageModules = pageModules;
_pages = pages;
_moduleDefinitions = moduleDefinitions; _moduleDefinitions = moduleDefinitions;
_userPermissions = userPermissions; _userPermissions = userPermissions;
_logger = logger; _logger = logger;
@ -42,6 +44,7 @@ namespace Oqtane.Controllers
Module module = new Module(); Module module = new Module();
module.SiteId = pagemodule.Module.SiteId; module.SiteId = pagemodule.Module.SiteId;
module.ModuleDefinitionName = pagemodule.Module.ModuleDefinitionName; module.ModuleDefinitionName = pagemodule.Module.ModuleDefinitionName;
module.AllPages = pagemodule.Module.AllPages;
module.Permissions = pagemodule.Module.Permissions; module.Permissions = pagemodule.Module.Permissions;
module.CreatedBy = pagemodule.Module.CreatedBy; module.CreatedBy = pagemodule.Module.CreatedBy;
module.CreatedOn = pagemodule.Module.CreatedOn; module.CreatedOn = pagemodule.Module.CreatedOn;
@ -111,7 +114,20 @@ namespace Oqtane.Controllers
if (ModelState.IsValid && _userPermissions.IsAuthorized(User, EntityNames.Module, module.ModuleId, PermissionNames.Edit)) if (ModelState.IsValid && _userPermissions.IsAuthorized(User, EntityNames.Module, module.ModuleId, PermissionNames.Edit))
{ {
module = _modules.UpdateModule(module); 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 else
{ {

View File

@ -17,7 +17,7 @@ using Microsoft.Extensions.DependencyInjection;
namespace Oqtane.Controllers namespace Oqtane.Controllers
{ {
[Route("{site}/api/[controller]")] [Route("{alias}/api/[controller]")]
public class ModuleDefinitionController : Controller public class ModuleDefinitionController : Controller
{ {
private readonly IModuleDefinitionRepository _moduleDefinitions; private readonly IModuleDefinitionRepository _moduleDefinitions;
@ -190,9 +190,9 @@ namespace Oqtane.Controllers
} }
else else
{ {
rootPath = Utilities.PathCombine(rootFolder.Parent.FullName , moduleDefinition.Owner + "." + moduleDefinition.Name + "s.Module","\\"); rootPath = Utilities.PathCombine(rootFolder.Parent.FullName , moduleDefinition.Owner + "." + moduleDefinition.Name + "s","\\");
moduleDefinition.ModuleDefinitionName = moduleDefinition.Owner + "." + moduleDefinition.Name + "s.Modules, " + moduleDefinition.Owner + "." + moduleDefinition.Name + "s.Module.Client"; 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.Module.Server"; 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); 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