Module Router Enhancement

Allows for PageVariables through the URL
This commit is contained in:
Michael Atwood
2020-06-27 11:49:24 -07:00
parent 4960e2c668
commit fdc39d57fb
5 changed files with 99 additions and 37 deletions

View File

@ -19,6 +19,7 @@ namespace Oqtane.Shared
public const string ActionToken = "{Action}";
public const string DefaultAction = "Index";
public const string AdminPane = "Admin";
public const string ModuleSegment = "module";
// Default Module Actions are reserved and should not be used by modules
public static readonly string[] DefaultModuleActions = new[] { "Settings", "Import", "Export" };
@ -46,6 +47,7 @@ namespace Oqtane.Shared
public const string ImageFiles = "jpg,jpeg,jpe,gif,bmp,png";
public const string UploadableFiles = "jpg,jpeg,jpe,gif,bmp,png,mov,wmv,avi,mp4,mp3,doc,docx,xls,xlsx,ppt,pptx,pdf,txt,zip,nupkg";
public const string ReservedDevices = "CON,NUL,PRN,COM0,COM1,COM2,COM3,COM4,COM5,COM6,COM7,COM8,COM9,LPT0,LPT1,LPT2,LPT3,LPT4,LPT5,LPT6,LPT7,LPT8,LPT9,CONIN$,CONOUT$";
public static readonly char[] InvalidFileNameChars =
{
'\"', '<', '>', '|', '\0', (Char) 1, (Char) 2, (Char) 3, (Char) 4, (Char) 5, (Char) 6, (Char) 7, (Char) 8,
@ -55,4 +57,4 @@ namespace Oqtane.Shared
};
public static readonly string[] InvalidFileNameEndingChars = { ".", " " };
}
}
}

View File

@ -39,7 +39,7 @@ namespace Oqtane.Shared
{
if (moduleid != -1)
{
path += $"/{moduleid}";
path += $"/{Constants.ModuleSegment}/{moduleid}";
if (!string.IsNullOrEmpty(action))
{
path += $"/{action}";
@ -136,6 +136,7 @@ namespace Oqtane.Shared
stringBuilder.Append(RemapInternationalCharToAscii(c));
prevdash = false;
break;
case UnicodeCategory.SpaceSeparator:
case UnicodeCategory.ConnectorPunctuation:
case UnicodeCategory.DashPunctuation:
@ -250,7 +251,7 @@ namespace Oqtane.Shared
public static string PathCombine(params string[] segments)
{
var separators = new char[] {Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar};
var separators = new char[] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar };
for (int i = 1; i < segments.Length; i++)
{
@ -284,7 +285,6 @@ namespace Oqtane.Shared
!Constants.ReservedDevices.Split(',').Contains(name.ToUpper().Split('.')[0]));
}
public static bool TryGetQueryValue(
this Uri uri,
string key,
@ -304,7 +304,7 @@ namespace Oqtane.Shared
{
value = defaultValue;
string s;
return uri.TryGetQueryValue(key, out s, (string) null) && int.TryParse(s, out value);
return uri.TryGetQueryValue(key, out s, (string)null) && int.TryParse(s, out value);
}
public static Dictionary<string, string> ParseQueryString(string query)
@ -314,7 +314,7 @@ namespace Oqtane.Shared
{
query = query.Substring(1);
string str = query;
char[] separator = new char[1] {'&'};
char[] separator = new char[1] { '&' };
foreach (string key in str.Split(separator, StringSplitOptions.RemoveEmptyEntries))
{
if (key != "")
@ -333,4 +333,4 @@ namespace Oqtane.Shared
return dictionary;
}
}
}
}