protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings) { var menu = new MenuItemCollection(); if (id == Constants.System.Root.ToInvariantString()) { //set the default to create menu.DefaultMenuAlias = ActionNew.Instance.Alias; // root actions menu.Items.Add <ActionNew>(Services.TextService.Localize(string.Format("actions/{0}", ActionNew.Instance.Alias))) .ConvertLegacyMenuItem(null, Constants.Trees.Macros, queryStrings.GetValue <string>("application")); menu.Items.Add <RefreshNode, ActionRefresh>(ui.Text("actions", ActionRefresh.Instance.Alias), true); return(menu); } //TODO: This is all hacky ... don't have time to convert the tree, views and dialogs over properly so we'll keep using the legacy dialogs var menuItem = menu.Items.Add(ActionDelete.Instance, Services.TextService.Localize(string.Format("actions/{0}", ActionDelete.Instance.Alias))); var legacyConfirmView = LegacyTreeDataConverter.GetLegacyConfirmView(ActionDelete.Instance); if (legacyConfirmView == false) { throw new InvalidOperationException("Could not resolve the confirmation view for the legacy action " + ActionDelete.Instance.Alias); } menuItem.LaunchDialogView( legacyConfirmView.Result, Services.TextService.Localize(string.Format("general/{0}", ActionDelete.Instance.Alias))); return(menu); }
internal static Attempt <TreeNodeCollection> TryLoadFromLegacyTree(this ApplicationTree appTree, string id, FormDataCollection formCollection, UrlHelper urlHelper, string currentSection) { var xTreeAttempt = appTree.TryGetXmlTree(id, formCollection); if (xTreeAttempt.Success == false) { return(Attempt <TreeNodeCollection> .Fail(xTreeAttempt.Exception)); } return(Attempt.Succeed(LegacyTreeDataConverter.ConvertFromLegacy(id, xTreeAttempt.Result, urlHelper, currentSection, formCollection))); }
protected override TreeNode CreateRootNode(FormDataCollection queryStrings) { return(LegacyTreeDataConverter.ConvertFromLegacy( _xmlTreeNode.NodeID, _xmlTreeNode, Url, _currentSection, queryStrings, isRoot: true)); }
internal static Attempt <MenuItemCollection> TryGetMenuFromLegacyTreeRootNode(this ApplicationTree appTree, FormDataCollection formCollection, UrlHelper urlHelper) { var rootAttempt = appTree.TryGetRootXmlNodeFromLegacyTree(formCollection, urlHelper); if (rootAttempt.Success == false) { return(Attempt <MenuItemCollection> .Fail(rootAttempt.Exception)); } var currentSection = formCollection.GetRequiredString("section"); var result = LegacyTreeDataConverter.ConvertFromLegacyMenu(rootAttempt.Result, currentSection); return(Attempt.Succeed(result)); }
protected override MenuItemCollection GetMenuForFile(string path, FormDataCollection queryStrings) { var menu = new MenuItemCollection(); //TODO: This is all hacky ... don't have time to convert the tree, views and dialogs over properly so we'll keep using the legacy dialogs var menuItem = menu.Items.Add(ActionDelete.Instance, Services.TextService.Localize(string.Format("actions/{0}", ActionDelete.Instance.Alias))); var legacyConfirmView = LegacyTreeDataConverter.GetLegacyConfirmView(ActionDelete.Instance); if (legacyConfirmView == false) { throw new InvalidOperationException("Could not resolve the confirmation view for the legacy action " + ActionDelete.Instance.Alias); } menuItem.LaunchDialogView( legacyConfirmView.Result, Services.TextService.Localize("general/delete")); return(menu); }
internal static Attempt <MenuItemCollection> TryGetMenuFromLegacyTreeNode(this ApplicationTree appTree, string parentId, string nodeId, FormDataCollection formCollection, UrlHelper urlHelper) { var xTreeAttempt = appTree.TryGetXmlTree(parentId, formCollection); if (xTreeAttempt.Success == false) { return(Attempt <MenuItemCollection> .Fail(xTreeAttempt.Exception)); } var currentSection = formCollection.GetRequiredString("section"); var result = LegacyTreeDataConverter.ConvertFromLegacyMenu(nodeId, xTreeAttempt.Result, currentSection); if (result == null) { return(Attempt <MenuItemCollection> .Fail(new ApplicationException("Could not find the node with id " + nodeId + " in the collection of nodes contained with parent id " + parentId))); } return(Attempt.Succeed(result)); }