public ModuleAction GetAction_RemovePermanent(PageDefinition page, ModuleDefinition mod, Guid moduleGuid, string pane) { if (mod != null && moduleGuid != Guid.Empty) { throw new InternalError("Can't use module definition and module guid at the same time to remove the module"); } if (page == null) { return(null); } if (pane == null) { return(null); } if (mod != null) { if (!mod.IsAuthorized(RoleDefinition.Remove)) { return(null); } moduleGuid = mod.ModuleGuid; } PageDefinition.ModuleList modList = page.ModuleDefinitions.GetModulesForPane(pane); int modIndex = modList.IndexInPane(moduleGuid, pane); return(new ModuleAction(this) { Url = Utility.UrlFor(typeof(ModuleControlModuleController), nameof(ModuleControlModuleController.RemovePermanent)), QueryArgs = new { PageGuid = page.PageGuid, ModuleGuid = moduleGuid, Pane = pane, ModuleIndex = modIndex }, QueryArgsDict = new QueryHelper(new QueryDictionary { { Basics.ModuleGuid, this.ModuleGuid }, // the module authorizing this }), Image = "#Remove", Style = ModuleAction.ActionStyleEnum.Post, LinkText = this.__ResStr("modRemovePermLink", "Remove PERMANENTLY"), MenuText = this.__ResStr("modRemovePermText", "Remove PERMANENTLY"), Tooltip = this.__ResStr("modRemovePermTooltip", "Remove the module permanently - The module and its data are PERMANENTLY deleted and can no longer be used on any pages"), Legend = this.__ResStr("modRemovePermLegend", "Removes the module permanently - The module and its data are PERMANENTLY deleted and can no longer be used on any pages"), Category = ModuleAction.ActionCategoryEnum.Update, Mode = ModuleAction.ActionModeEnum.Edit, Location = ModuleAction.ActionLocationEnum.ModuleMenu | ModuleAction.ActionLocationEnum.ModuleLinks, ConfirmationText = this.__ResStr("confirmPermRemove", "Are you sure you want to PERMANENTLY remove this module?"), }); }
public async Task <ModuleAction> GetAction_MoveBottomAsync(PageDefinition page, ModuleDefinition mod, string pane) { if (page == null) { return(null); } if (pane == null) { return(null); } if (!page.IsAuthorized_Edit()) { return(null); } PageDefinition.ModuleList modList = page.ModuleDefinitions.GetModulesForPane(pane); int modIndex = modList.IndexInPane(mod, pane); return(new ModuleAction(this) { Url = Utility.UrlFor(typeof(ModuleControlModuleController), nameof(ModuleControlModuleController.MoveBottom)), QueryArgs = new { PageGuid = page.PageGuid, ModuleGuid = mod.ModuleGuid, Pane = pane, ModuleIndex = modIndex }, QueryArgsDict = new QueryHelper(new QueryDictionary { { Basics.ModuleGuid, this.ModuleGuid }, // the module authorizing this }), Image = await CustomIconAsync("MoveBottom.png"), Style = ModuleAction.ActionStyleEnum.Post, LinkText = this.__ResStr("modMoveBottomLink", "Move To Bottom"), MenuText = this.__ResStr("modMoveBottomText", "Bottom"), Tooltip = this.__ResStr("modMoveBottomTooltip", "Move the module to the bottom of the pane"), Legend = this.__ResStr("modMoveBottomLegend", "Moves the module to the bottom of the pane"), Enabled = modIndex < modList.Count - 1, Category = ModuleAction.ActionCategoryEnum.Update, Mode = ModuleAction.ActionModeEnum.Edit, Location = ModuleAction.ActionLocationEnum.ModuleMenu, }); }