-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTestAdminMenuPlugin.cs
153 lines (140 loc) · 5.8 KB
/
TestAdminMenuPlugin.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
using Grand.Core.Plugins;
using Grand.Framework.Menu;
using Grand.Services.Common;
using Microsoft.AspNetCore.Routing;
using System.Collections.Generic;
using System.Linq;
namespace Grand.Plugin.Misc.TestAdminMenu
{
public class TestAdminMenuPlugin : BasePlugin, IMiscPlugin, IAdminMenuPlugin
{
#region Ctor
public TestAdminMenuPlugin() { }
#endregion
#region Methods
/// <summary>
/// Install plugin
/// </summary>
public override void Install()
{
base.Install();
}
/// <summary>
/// Uninstall plugin
/// </summary>
public override void Uninstall()
{
base.Uninstall();
}
public void ManageSiteMap(Framework.Menu.SiteMapNode rootNode)
{
//plugins
if (rootNode.ChildNodes.FirstOrDefault(x => x.SystemName == "Plugins") == null)
{
rootNode.ChildNodes.Add(new Framework.Menu.SiteMapNode()
{
SystemName = "Plugins",
Title = "Plugins",
Visible = true,
IconClass = "fa fa-plug",
});
}
var menus = new List<SiteMapNode>
{
new Grand.Framework.Menu.SiteMapNode
{
Title = "PLUGINS level 1",
Visible = true,
SystemName = "TestAdminMenu",
IconClass = "fa fa-spinner fa-spin fa-3x fa-fw",
ControllerName = "TestAdminMenu",
ActionName = "Configure",
RouteValues = new RouteValueDictionary() { { "area", null } },
},
new Grand.Framework.Menu.SiteMapNode
{
Title = "PLUGINS level 2",
Visible = true,
SystemName = "TestAdminMenu",
IconClass = "fa fa-circle-o-notch fa-spin fa-3x fa-fw",
ControllerName = "TestAdminMenu",
ActionName = "Configure",
RouteValues = new RouteValueDictionary() { { "area", null } },
ChildNodes = new List<SiteMapNode>{
new Grand.Framework.Menu.SiteMapNode
{
Title = "PLUGINS level 2.1",
Visible = true,
SystemName = "TestAdminMenu",
IconClass = "fa fa-refresh fa-spin fa-3x fa-fw",
ControllerName = "TestAdminMenu",
ActionName = "Configure",
RouteValues = new RouteValueDictionary() { { "area", null } },
},
new Grand.Framework.Menu.SiteMapNode
{
Title = "PLUGINS level 2.2",
Visible = true,
SystemName = "TestAdminMenu",
IconClass = "fa fa-refresh fa-spin fa-3x fa-fw",
ControllerName = "TestAdminMenu",
ActionName = "Configure",
RouteValues = new RouteValueDictionary() { { "area", null } },
}
}
}
};
foreach (var menu in menus)
rootNode.ChildNodes.FirstOrDefault(x => x.SystemName == "Plugins").ChildNodes.Add(menu);
//extensions
if (rootNode.ChildNodes.FirstOrDefault(x => x.SystemName == "Extensions") == null)
{
rootNode.ChildNodes.Add(new Framework.Menu.SiteMapNode()
{
SystemName = "Extensions",
Title = "Extensions",
Visible = true,
IconClass = "fa fa-plug",
});
}
var menus1 = new List<SiteMapNode>
{
new Grand.Framework.Menu.SiteMapNode
{
Title = "EXTENSIONS level 1",
Visible = true,
SystemName = "ExtensionsTestAdminMenu",
IconClass = "fa fa-spinner fa-spin fa-3x fa-fw",
ControllerName = "TestAdminMenu",
ActionName = "Configure",
RouteValues = new RouteValueDictionary() { { "area", null } },
},
new Grand.Framework.Menu.SiteMapNode
{
Title = "EXTENSIONS level 2",
Visible = true,
SystemName = "ExtensionsTestAdminMenu",
IconClass = "fa fa-circle-o-notch fa-spin fa-3x fa-fw",
ControllerName = "TestAdminMenu",
ActionName = "Configure",
RouteValues = new RouteValueDictionary() { { "area", null } },
ChildNodes = new List<SiteMapNode>{
new Grand.Framework.Menu.SiteMapNode
{
Title = "EXTENSIONS level 2.1",
Visible = true,
SystemName = "ExtensionsTestAdminMenu",
IconClass = "fa fa-refresh fa-spin fa-3x fa-fw",
ControllerName = "TestAdminMenu",
ActionName = "Configure",
RouteValues = new RouteValueDictionary() { { "area", null } },
}
}
}
};
foreach (var menu in menus1)
rootNode.ChildNodes.FirstOrDefault(x => x.SystemName == "Extensions").ChildNodes.Add(menu);
}
#endregion
}
}