added in GetUrlParameters route to Module Index action
This commit is contained in:
@ -17,7 +17,7 @@ namespace Oqtane.Modules
|
||||
private Logger _logger;
|
||||
|
||||
protected Logger logger => _logger ?? (_logger = new Logger(this));
|
||||
|
||||
|
||||
[Inject]
|
||||
protected ILogService LoggingService { get; set; }
|
||||
|
||||
@ -30,7 +30,7 @@ namespace Oqtane.Modules
|
||||
[CascadingParameter]
|
||||
protected Module ModuleState { get; set; }
|
||||
|
||||
[CascadingParameter]
|
||||
[CascadingParameter]
|
||||
protected ModuleInstance ModuleInstance { get; set; }
|
||||
|
||||
// optional interface properties
|
||||
@ -62,7 +62,7 @@ namespace Oqtane.Modules
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// path method
|
||||
|
||||
public string ModulePath()
|
||||
@ -116,6 +116,38 @@ namespace Oqtane.Modules
|
||||
return Utilities.ContentUrl(PageState.Alias, fileid);
|
||||
}
|
||||
|
||||
public Dictionary<string, string> GetUrlParameters(string parameterTemplate)
|
||||
{
|
||||
var urlParameters = new Dictionary<string, string>();
|
||||
|
||||
var templateSegments = parameterTemplate.Split('/', StringSplitOptions.RemoveEmptyEntries);
|
||||
var parameters = PageState.UrlParameters.Split('/', StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if (parameters.Length == templateSegments.Length)
|
||||
{
|
||||
for (int i = 0; i < parameters.Length; i++)
|
||||
{
|
||||
if (parameters.Length > i)
|
||||
{
|
||||
if (templateSegments[i] == parameters[i])
|
||||
{
|
||||
}
|
||||
else if (templateSegments[i].StartsWith("[") && templateSegments[i].EndsWith("]"))
|
||||
{
|
||||
var key = templateSegments[i].Replace("[", "");
|
||||
key = key.Replace("]", "");
|
||||
urlParameters.TryAdd(key, parameters[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
i = parameters.Length;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return urlParameters;
|
||||
}
|
||||
|
||||
// user feedback methods
|
||||
public void AddModuleMessage(string message, MessageType type)
|
||||
{
|
||||
@ -154,12 +186,15 @@ namespace Oqtane.Modules
|
||||
case "add":
|
||||
logFunction = LogFunction.Create;
|
||||
break;
|
||||
|
||||
case "edit":
|
||||
logFunction = LogFunction.Update;
|
||||
break;
|
||||
|
||||
case "delete":
|
||||
logFunction = LogFunction.Delete;
|
||||
break;
|
||||
|
||||
default:
|
||||
logFunction = LogFunction.Read;
|
||||
break;
|
||||
@ -241,4 +276,4 @@ namespace Oqtane.Modules
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user