Merge remote-tracking branch 'oqtane/dev' into dev

This commit is contained in:
Leigh Pointer
2023-08-03 05:39:32 +02:00
9 changed files with 110 additions and 48 deletions

View File

@ -80,7 +80,7 @@ else
} }
</td> </td>
<td> <td>
@((MarkupString)SupportLink(context.PackageName)) @((MarkupString)SupportLink(context.PackageName, context.Version))
</td> </td>
<td> <td>
@((MarkupString)PurchaseLink(context.PackageName)) @((MarkupString)PurchaseLink(context.PackageName))
@ -145,7 +145,7 @@ else
return link; return link;
} }
private string SupportLink(string packagename) private string SupportLink(string packagename, string version)
{ {
string link = ""; string link = "";
if (!string.IsNullOrEmpty(packagename) && _packages != null) if (!string.IsNullOrEmpty(packagename) && _packages != null)
@ -153,7 +153,7 @@ else
var package = _packages.Where(item => item.PackageId == packagename).FirstOrDefault(); var package = _packages.Where(item => item.PackageId == packagename).FirstOrDefault();
if (package != null && !string.IsNullOrEmpty(package.SupportUrl)) if (package != null && !string.IsNullOrEmpty(package.SupportUrl))
{ {
link += "<a class=\"btn btn-success\" style=\"text-decoration: none !important\" href=\"" + package.SupportUrl + "\" target=\"_new\">" + SharedLocalizer["Help"] + "</a>"; link += "<a class=\"btn btn-success\" style=\"text-decoration: none !important\" href=\"" + package.SupportUrl.Replace("{Version}", version) + "\" target=\"_new\">" + SharedLocalizer["Help"] + "</a>";
} }
} }
return link; return link;

View File

@ -49,7 +49,7 @@ else
} }
</td> </td>
<td> <td>
@((MarkupString)SupportLink(context.PackageName)) @((MarkupString)SupportLink(context.PackageName, context.Version))
</td> </td>
<td> <td>
@((MarkupString)PurchaseLink(context.PackageName)) @((MarkupString)PurchaseLink(context.PackageName))
@ -112,7 +112,7 @@ else
return link; return link;
} }
private string SupportLink(string packagename) private string SupportLink(string packagename, string version)
{ {
string link = ""; string link = "";
if (!string.IsNullOrEmpty(packagename) && _packages != null) if (!string.IsNullOrEmpty(packagename) && _packages != null)
@ -120,7 +120,7 @@ else
var package = _packages.Where(item => item.PackageId == packagename).FirstOrDefault(); var package = _packages.Where(item => item.PackageId == packagename).FirstOrDefault();
if (package != null && !string.IsNullOrEmpty(package.SupportUrl)) if (package != null && !string.IsNullOrEmpty(package.SupportUrl))
{ {
link += "<a class=\"btn btn-success\" style=\"text-decoration: none !important\" href=\"" + package.SupportUrl + "\" target=\"_new\">" + SharedLocalizer["Help"] + "</a>"; link += "<a class=\"btn btn-success\" style=\"text-decoration: none !important\" href=\"" + package.SupportUrl.Replace("{Version}", version) + "\" target=\"_new\">" + SharedLocalizer["Help"] + "</a>";
} }
} }
return link; return link;

View File

@ -2,7 +2,7 @@
@inherits LocalizableComponent @inherits LocalizableComponent
<div class="app-autocomplete"> <div class="app-autocomplete">
<input class="form-control" value="@Value" @oninput="OnInput" @onkeyup="OnKeyUp" placeholder="@Placeholder" autocomplete="off" /> <input class="form-control" value="@Value" @oninput="OnInput" @onkeyup="OnKeyUp" placeholder="@Placeholder" autocomplete="off" @attributes="InputAttributes" />
@if (_results != null) @if (_results != null)
{ {
<select class="form-select" style="position: relative;" value="@Value" size="@Rows" @onkeyup="OnKeyUp" @onchange="(e => OnChange(e))"> <select class="form-select" style="position: relative;" value="@Value" size="@Rows" @onkeyup="OnKeyUp" @onchange="(e => OnChange(e))">
@ -30,6 +30,7 @@
@code { @code {
Dictionary<string, string> _results; Dictionary<string, string> _results;
Dictionary<string, object> InputAttributes { get; set; } = new();
[Parameter] [Parameter]
public Func<string, Task<Dictionary<string, string>>> OnSearch { get; set; } // required - an async delegate method which accepts a filter string parameter and returns a dictionary public Func<string, Task<Dictionary<string, string>>> OnSearch { get; set; } // required - an async delegate method which accepts a filter string parameter and returns a dictionary
@ -49,6 +50,26 @@
[Parameter] [Parameter]
public string Key { get; set; } // key of item selected public string Key { get; set; } // key of item selected
[Parameter]
public bool Required { get; set; } // optional - if the item is required
protected override void OnParametersSet()
{
if (Required)
{
if (!InputAttributes.ContainsKey(nameof(Required)))
{
InputAttributes.Add(nameof(Required), true);
}
}
else
{
if (InputAttributes.ContainsKey(nameof(Required)))
{
InputAttributes.Remove(nameof(Required));
}
}
}
private async Task OnInput(ChangeEventArgs e) private async Task OnInput(ChangeEventArgs e)
{ {
Value = e.Value?.ToString(); Value = e.Value?.ToString();

View File

@ -168,6 +168,21 @@
ShowSuccess = true; ShowSuccess = true;
} }
if (!string.IsNullOrEmpty(Folder) && Folder != Constants.PackagesFolder)
{
Folder folder = await FolderService.GetFolderAsync(ModuleState.SiteId, Folder);
if (folder != null)
{
FolderId = folder.FolderId;
}
else
{
FolderId = -1;
_message = "Folder Path " + Folder + "Does Not Exist";
_messagetype = MessageType.Error;
}
}
if (ShowFolders) if (ShowFolders)
{ {
_folders = await FolderService.GetFoldersAsync(ModuleState.SiteId); _folders = await FolderService.GetFoldersAsync(ModuleState.SiteId);
@ -184,21 +199,6 @@
} }
} }
if (!string.IsNullOrEmpty(Folder) && Folder != Constants.PackagesFolder)
{
Folder folder = await FolderService.GetFolderAsync(ModuleState.SiteId, Folder);
if (folder != null)
{
FolderId = folder.FolderId;
}
else
{
FolderId = -1;
_message = "Folder Path " + Folder + "Does Not Exist";
_messagetype = MessageType.Error;
}
}
if (FileId != -1) if (FileId != -1)
{ {
File file = await FileService.GetFileAsync(FileId); File file = await FileService.GetFileAsync(FileId);

View File

@ -7,15 +7,17 @@ using Oqtane.Services;
using System.Globalization; using System.Globalization;
using System.Text.Json; using System.Text.Json;
using Windows.Storage.Provider; using Windows.Storage.Provider;
using System.Text.Json.Nodes;
namespace Oqtane.Maui; namespace Oqtane.Maui;
public static class MauiProgram public static class MauiProgram
{ {
// the API service url // the API service url - can be overridden in an appsettings.json in AppDataDirectory
//static string apiurl = "https://www.dnfprojects.com/"; // for testing remote site
static string apiurl = "http://localhost:44357/"; // for local development (Oqtane.Server must be already running for MAUI client to connect) static string apiurl = "http://localhost:44357/"; // for local development (Oqtane.Server must be already running for MAUI client to connect)
//static string apiurl = "http://localhost:44357/sitename/"; // local microsite example //static string apiurl = "http://localhost:44357/sitename/"; // local microsite example
//static string apiurl = "https://www.dnfprojects.com/"; // for testing remote site
public static MauiApp CreateMauiApp() public static MauiApp CreateMauiApp()
{ {
@ -31,6 +33,8 @@ public static class MauiProgram
builder.Services.AddBlazorWebViewDeveloperTools(); builder.Services.AddBlazorWebViewDeveloperTools();
#endif #endif
LoadAppSettings();
var httpClient = new HttpClient { BaseAddress = new Uri(GetBaseUrl(apiurl)) }; var httpClient = new HttpClient { BaseAddress = new Uri(GetBaseUrl(apiurl)) };
httpClient.DefaultRequestHeaders.UserAgent.ParseAdd(Shared.Constants.MauiUserAgent); httpClient.DefaultRequestHeaders.UserAgent.ParseAdd(Shared.Constants.MauiUserAgent);
httpClient.DefaultRequestHeaders.Add(Shared.Constants.MauiAliasPath, GetUrlPath(apiurl).Replace("/", "")); httpClient.DefaultRequestHeaders.Add(Shared.Constants.MauiAliasPath, GetUrlPath(apiurl).Replace("/", ""));
@ -62,6 +66,28 @@ public static class MauiProgram
return builder.Build(); return builder.Build();
} }
private static void LoadAppSettings()
{
// appsettings.json file format
// {
// "Url": "http://localhost:44357/"
// }
string file = Path.Combine(FileSystem.Current.AppDataDirectory, "appsettings.json");
if (File.Exists(file))
{
using FileStream stream = File.OpenRead(file);
using StreamReader reader = new StreamReader(stream);
var content = reader.ReadToEnd();
var obj = JsonSerializer.Deserialize<JsonObject>(content)!;
if (!string.IsNullOrEmpty((string)obj["Url"]))
{
apiurl = (string)obj["Url"];
}
}
}
private static void LoadClientAssemblies(HttpClient http) private static void LoadClientAssemblies(HttpClient http)
{ {
try try

View File

@ -44,7 +44,7 @@
<ItemGroup> <ItemGroup>
<!-- App Icon --> <!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" /> <MauiIcon Include="Resources\AppIcon\appicon.svg" />
<!-- Splash Screen --> <!-- Splash Screen -->
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" /> <MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />

View File

@ -1,4 +1,19 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" standalone="no"?>
<svg width="456" height="456" viewBox="0 0 456 456" version="1.1" xmlns="http://www.w3.org/2000/svg"> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
<rect x="0" y="0" width="456" height="456" fill="#512BD4" /> "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
width="200.000000pt" height="200.000000pt" viewBox="0 0 200.000000 200.000000"
preserveAspectRatio="xMidYMid meet">
<g transform="translate(0.000000,200.000000) scale(0.100000,-0.100000)"
fill="#000000" stroke="none">
<path d="M994 1922 c-6 -4 -25 -50 -44 -102 -80 -218 -210 -455 -391 -712 -49
-70 -100 -151 -114 -180 -105 -226 -53 -507 126 -686 190 -188 468 -234 709
-116 104 51 223 170 274 274 84 172 86 367 7 532 -16 35 -72 122 -123 193 -52
72 -111 161 -133 198 -21 37 -42 67 -46 67 -3 0 -46 -61 -94 -136 l-88 -136
106 -156 c57 -87 110 -172 116 -191 16 -50 13 -150 -6 -207 -23 -69 -110 -155
-182 -179 -68 -22 -144 -22 -212 0 -74 25 -159 110 -183 183 -19 57 -22 148
-7 200 6 19 116 193 246 387 129 195 235 358 235 363 0 5 -22 56 -49 113 -27
57 -64 145 -81 196 -31 88 -46 109 -66 95z"/>
</g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 228 B

After

Width:  |  Height:  |  Size: 1008 B

View File

@ -214,9 +214,9 @@ namespace Oqtane.Repository
{ {
foreach (var assembly in moduledefinition.Dependencies.Replace(".dll", "").Split(',', StringSplitOptions.RemoveEmptyEntries).Reverse()) foreach (var assembly in moduledefinition.Dependencies.Replace(".dll", "").Split(',', StringSplitOptions.RemoveEmptyEntries).Reverse())
{ {
if (!serverState.Assemblies.Contains(assembly)) if (!serverState.Assemblies.Contains(assembly.Trim()))
{ {
serverState.Assemblies.Insert(0, assembly); serverState.Assemblies.Insert(0, assembly.Trim());
} }
} }
} }

View File

@ -189,9 +189,9 @@ namespace Oqtane.Repository
{ {
foreach (var assembly in theme.Dependencies.Replace(".dll", "").Split(',', StringSplitOptions.RemoveEmptyEntries).Reverse()) foreach (var assembly in theme.Dependencies.Replace(".dll", "").Split(',', StringSplitOptions.RemoveEmptyEntries).Reverse())
{ {
if (!serverState.Assemblies.Contains(assembly)) if (!serverState.Assemblies.Contains(assembly.Trim()))
{ {
serverState.Assemblies.Insert(0, assembly); serverState.Assemblies.Insert(0, assembly.Trim());
} }
} }
} }