renamed control to action to reflect its purpose and be more consistent with asp.net conventions

This commit is contained in:
Shaun Walker
2019-10-19 11:09:10 -04:00
parent f6e70036b1
commit ce25967633
18 changed files with 401 additions and 30 deletions

View File

@ -19,7 +19,7 @@
{
ModuleState = Module; // passed in from Pane component
string container = ModuleState.ContainerType;
if (PageState.ModuleId != -1 && PageState.Control != "" && ModuleState.UseAdminContainer)
if (PageState.ModuleId != -1 && PageState.Action != "" && ModuleState.UseAdminContainer)
{
container = Constants.DefaultAdminContainer;
}
@ -35,7 +35,7 @@
else
{
// container does not exist with type specified
builder.OpenComponent(0, Type.GetType(Constants.ModuleMessageControl));
builder.OpenComponent(0, Type.GetType(Constants.ModuleMessageComponent));
builder.AddAttribute(1, "Message", "Error Loading Module Container " + container);
builder.CloseComponent();
}

View File

@ -30,9 +30,9 @@
{
string typename = ModuleState.ModuleType;
// check for core module actions component
if (Constants.DefaultModuleActions.Contains(PageState.Control))
if (Constants.DefaultModuleActions.Contains(PageState.Action))
{
typename = Constants.DefaultModuleActionsTemplate.Replace("{Control}", PageState.Control);
typename = Constants.DefaultModuleActionsTemplate.Replace(Constants.ActionToken, PageState.Action);
}
Type moduleType = null;

View File

@ -18,7 +18,7 @@ namespace Oqtane.Shared
public Uri Uri { get; set; }
public Dictionary<string, string> QueryString { get; set; }
public int ModuleId { get; set; }
public string Control { get; set; }
public string Action { get; set; }
public bool EditMode { get; set; }
public bool DesignMode { get; set; }
}

View File

@ -38,7 +38,7 @@
DynamicComponent = builder =>
{
if (PageState.ModuleId != -1 && PageState.Control != "")
if (PageState.ModuleId != -1 && PageState.Action != "")
{
if (Name.ToLower() == Constants.AdminPane.ToLower())
{
@ -47,15 +47,15 @@
{
string typename = module.ModuleType;
// check for core module actions component
if (Constants.DefaultModuleActions.Contains(PageState.Control))
if (Constants.DefaultModuleActions.Contains(PageState.Action))
{
typename = Constants.DefaultModuleActionsTemplate.Replace("{Control}", PageState.Control);
typename = Constants.DefaultModuleActionsTemplate.Replace(Constants.ActionToken, PageState.Action);
}
Type moduleType = Type.GetType(typename);
if (moduleType != null)
{
bool authorized = false;
if (Constants.DefaultModuleActions.Contains(PageState.Control))
if (Constants.DefaultModuleActions.Contains(PageState.Action))
{
authorized = UserSecurity.IsAuthorized(PageState.User, "Edit", PageState.Page.Permissions);
}
@ -83,7 +83,7 @@
}
if (authorized)
{
if (!Constants.DefaultModuleActions.Contains(PageState.Control) && module.ControlTitle != "")
if (!Constants.DefaultModuleActions.Contains(PageState.Action) && module.ControlTitle != "")
{
module.Title = module.ControlTitle;
}

View File

@ -77,7 +77,7 @@
User user;
List<Module> modules;
int moduleid = -1;
string control = "";
string action = "";
bool editmode = false;
bool designmode = false;
Reload reload = Reload.None;
@ -162,9 +162,9 @@
// check if path has moduleid and control specification ie. page/moduleid/control/
if (segments.Length >= 2 && int.TryParse(segments[segments.Length - 2], out result))
{
control = segments[segments.Length - 1];
action = segments[segments.Length - 1];
moduleid = result;
path = path.Replace(moduleid.ToString() + "/" + control + "/", "");
path = path.Replace(moduleid.ToString() + "/" + action + "/", "");
}
else
{
@ -235,9 +235,9 @@
pagestate.Uri = new Uri(_absoluteUri, UriKind.Absolute);
pagestate.QueryString = querystring;
pagestate.ModuleId = moduleid;
pagestate.Control = control;
pagestate.Action = action;
if (PageState != null && (PageState.ModuleId != pagestate.ModuleId || PageState.Control != pagestate.Control))
if (PageState != null && (PageState.ModuleId != pagestate.ModuleId || PageState.Action != pagestate.Action))
{
reload = Reload.Page;
}
@ -245,7 +245,7 @@
if (PageState == null || reload >= Reload.Page)
{
modules = await ModuleService.GetModulesAsync(site.SiteId);
modules = ProcessModules(modules, moduledefinitions, page.PageId, pagestate.ModuleId, pagestate.Control, page.Panes, site.DefaultContainerType);
modules = ProcessModules(modules, moduledefinitions, page.PageId, pagestate.ModuleId, pagestate.Action, page.Panes, site.DefaultContainerType);
}
else
{
@ -365,7 +365,7 @@
}
}
}
module.ModuleType = typename.Replace("{Control}", control);
module.ModuleType = typename.Replace(Constants.ActionToken, control);
// admin controls need to load additional metadata from the IModuleControl interface
if (moduleid == module.ModuleId)
@ -374,7 +374,7 @@
// check for core module actions component
if (Constants.DefaultModuleActions.Contains(control))
{
typename = Constants.DefaultModuleActionsTemplate.Replace("{Control}", control);
typename = Constants.DefaultModuleActionsTemplate.Replace(Constants.ActionToken, control);
}
Type moduletype = Type.GetType(typename);
if (moduletype != null)
@ -389,7 +389,7 @@
}
else
{
module.ModuleType = typename.Replace("{Control}", Constants.DefaultControl);
module.ModuleType = typename.Replace(Constants.ActionToken, Constants.DefaultAction);
}
}

View File

@ -21,7 +21,7 @@
else
{
// theme does not exist with type specified
builder.OpenComponent(0, Type.GetType(Constants.ModuleMessageControl));
builder.OpenComponent(0, Type.GetType(Constants.ModuleMessageComponent));
builder.AddAttribute(1, "Message", "Error Loading Page Theme " + PageState.Page.ThemeType);
builder.CloseComponent();
}

View File

@ -10,9 +10,9 @@
{
title = ModuleState.Title;
// check for core module actions component
if (Constants.DefaultModuleActions.Contains(PageState.Control))
if (Constants.DefaultModuleActions.Contains(PageState.Action))
{
title = PageState.Control;
title = PageState.Action;
}
return Task.CompletedTask;
}