private void AppendFolderManagementActions(string websiteFolderPath, IEnumerable <IFolderWhiteList> manageableFolderWhiteLists, IList <ElementAction> folderActions) { for (int i = 0; i < _manageableKeyNames.Count; i++) { string keyName = _manageableKeyNames[i]; string itemLabel = StringResourceSystemFacade.ParseString(_manageableKeyNameLabels[i]); ResourceHandle icon = null; string label = null; string tooltip = null; WorkflowActionToken workflowActionToken = null; ActionCheckedStatus checkedStatus = ActionCheckedStatus.Uncheckable; if (manageableFolderWhiteLists.Where(f => f.KeyName == keyName && f.TildeBasedPath == IFolderWhiteListExtensions.GetTildePath(websiteFolderPath)).Any()) { workflowActionToken = new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider.RemoveWebsiteFolderFromWhiteListWorkflow"), _changeWhiteListPermissionTypes); label = StringResourceSystemFacade.GetString("Composite.Plugins.WebsiteFileElementProvider", "RemoveFolderFromWhiteListTitle"); tooltip = StringResourceSystemFacade.GetString("Composite.Plugins.WebsiteFileElementProvider", "RemoveFolderFromWhiteListToolTip"); icon = WebsiteFileElementProvider.RemoveFolderFromWhiteList; checkedStatus = ActionCheckedStatus.Checked; } else { workflowActionToken = new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.Plugins.Elements.ElementProviders.WebsiteFileElementProvider.AddWebsiteFolderToWhiteListWorkflow"), _changeWhiteListPermissionTypes); label = StringResourceSystemFacade.GetString("Composite.Plugins.WebsiteFileElementProvider", "AddFolderToWhiteListTitle"); tooltip = StringResourceSystemFacade.GetString("Composite.Plugins.WebsiteFileElementProvider", "AddFolderToWhiteListToolTip"); icon = WebsiteFileElementProvider.AddFolderToWhiteList; checkedStatus = ActionCheckedStatus.Unchecked; } label = string.Format(label, itemLabel); tooltip = string.Format(tooltip, itemLabel); workflowActionToken.Payload = keyName; folderActions.Add( new ElementAction(new ActionHandle(workflowActionToken)) { VisualData = new ActionVisualizedData { Label = label, ToolTip = tooltip, Icon = icon, Disabled = false, ActionLocation = new ActionLocation { ActionType = ActionType.Other, IsInFolder = false, IsInToolbar = false, ActionGroup = PrimaryFolderToolsActionGroup }, ActionCheckedStatus = checkedStatus } }); } }
private static string GetCheckboxStatusString(ActionCheckedStatus actionCheckedStatus) { switch (actionCheckedStatus) { case ActionCheckedStatus.Uncheckable: return null; case ActionCheckedStatus.Unchecked: return "Unchecked"; case ActionCheckedStatus.Checked: return "Checked"; default: throw new InvalidOperationException("Unexpected ActionCheckedStatus value"); } }
private static string GetCheckboxStatusString(ActionCheckedStatus actionCheckedStatus) { switch (actionCheckedStatus) { case ActionCheckedStatus.Uncheckable: return(null); case ActionCheckedStatus.Unchecked: return("Unchecked"); case ActionCheckedStatus.Checked: return("Checked"); default: throw new InvalidOperationException("Unexpected ActionCheckedStatus value"); } }