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 package info.magnolia.module.admininterface.setup;
35
36 import info.magnolia.cms.beans.config.ContentRepository;
37 import info.magnolia.module.DefaultModuleVersionHandler;
38 import info.magnolia.module.InstallContext;
39 import info.magnolia.module.admininterface.setup.for4_0.UpdatedDefaultPublicURIWarning;
40 import info.magnolia.module.admininterface.setup.for4_3.ReplaceWrongDialogNodeTypeTask;
41 import info.magnolia.module.admininterface.setup.for4_4.ContentDeletionTasks;
42 import info.magnolia.module.admininterface.setup.for4_4.RegisterMgnlDeletedType;
43 import info.magnolia.module.admininterface.trees.WebsiteTreeHandler;
44 import info.magnolia.module.delta.ArrayDelegateTask;
45 import info.magnolia.module.delta.BootstrapConditionally;
46 import info.magnolia.module.delta.BootstrapSingleModuleResource;
47 import info.magnolia.module.delta.BootstrapSingleResource;
48 import info.magnolia.module.delta.CheckAndModifyPropertyValueTask;
49 import info.magnolia.module.delta.ChildrenExistsDelegateTask;
50 import info.magnolia.module.delta.DeltaBuilder;
51 import info.magnolia.module.delta.MoveNodeTask;
52 import info.magnolia.module.delta.NodeExistsDelegateTask;
53 import info.magnolia.module.delta.PropertyValueDelegateTask;
54 import info.magnolia.module.delta.RegisterModuleServletsTask;
55 import info.magnolia.module.delta.RemoveNodeTask;
56 import info.magnolia.module.delta.RemovePropertyTask;
57 import info.magnolia.module.delta.SetPropertyTask;
58 import info.magnolia.module.delta.Task;
59
60 import java.util.ArrayList;
61 import java.util.List;
62
63
64
65
66
67 public class AdminModuleVersionHandler extends DefaultModuleVersionHandler {
68 private final AddSubMenuItemTask sysUsersSubMenu = new AddSubMenuItemTask("security", "usersSystem", "menu.security.usersSystem", null, "MgnlAdminCentral.showTree('usersSystem')", "/.resources/icons/16/pawn_glass_red.gif", "groups");
69 private final AddSubMenuItemTask adminUsersSubMenu = new AddSubMenuItemTask("security", "usersAdmin", "menu.security.usersAdmin", null, "MgnlAdminCentral.showTree('usersAdmin')", "/.resources/icons/16/pawn_glass_yellow.gif", "groups");
70 private final AddSubMenuItemTask subscribersMenu = new AddSubMenuItemTask("config", "subscribers", "menu.config.subscribers", "info.magnolia.module.admininterface.messages", "MgnlAdminCentral.showTree('config','/server/activation/subscribers')", "/.resources/icons/16/dot.gif", "cache");
71
72 public AdminModuleVersionHandler() {
73 final String pathToRestartPage = "/modules/adminInterface/pages/restart";
74 register(DeltaBuilder.update("3.5", "")
75
76 .addTask(new BootstrapConditionally("Install VirtualURI mappings", "Installs new configuration of virtualURI mappings.", "/mgnl-bootstrap/adminInterface/config.modules.adminInterface.virtualURIMapping.default.xml"))
77
78 .addTask(new BootstrapSingleResource("New ACL configuration", "Bootstraps the new configuration for the ACL dialogs.", "/mgnl-bootstrap/adminInterface/config.modules.adminInterface.config.securityConfiguration.xml"))
79 .addTask(new RemoveNodeTask("New ACL Dialog", "Deletes the old ACL page.", ContentRepository.CONFIG, "/modules/adminInterface/pages/rolesACL"))
80 .addTask(new RemovePropertyTask("New ACL Dialog", "Removes the include property.", ContentRepository.CONFIG, "/modules/adminInterface/dialogs/roleedit", "file"))
81 .addTask(new CheckAndModifyPropertyValueTask("New ACL Dialog", "Changes the control type for the ACL.", ContentRepository.CONFIG, "/modules/adminInterface/dialogs/roleedit/tabACL/aCL", "controlType", "include", "info.magnolia.module.admininterface.dialogs.ACLSDialogControl"))
82 .addTask(new ArrayDelegateTask("Users menu", "System and admin users are now differentiated, creating two sub menus.", new Task[]{
83 new RemoveNodeTask(null, null, ContentRepository.CONFIG, "/modules/adminInterface/config/menu/security/users"),
84 adminUsersSubMenu,
85 sysUsersSubMenu}))
86 .addTask(new ArrayDelegateTask("Menu", "Updates subscriber menu item in config menu", new Task[]{
87 new RemoveNodeTask(null, null, ContentRepository.CONFIG, "/modules/adminInterface/config/menu/config/subscriber"),
88 subscribersMenu}))
89 .addTask(new NodeExistsDelegateTask("Remove Kupu richEdit control", "Checks for previous Kupu editor installation and removes richEdit control if existent.", ContentRepository.CONFIG, "/modules/adminInterface/controls/richEdit",
90 new RemoveNodeTask("Remove Kupu richEdit control", "Removes the richEdit control from Admin Interface since the Kupu Module is not delivered anymore.", ContentRepository.CONFIG, "/modules/adminInterface/controls/richEdit")))
91 .addTask(new PropertyValueDelegateTask("Unused page", "Removes the now unused \"restart\" page.", ContentRepository.CONFIG, pathToRestartPage, "class", "info.magnolia.module.admininterface.pages.RestartPage", false,
92 new RemoveNodeTask(null, null, ContentRepository.CONFIG, pathToRestartPage)))
93 .addTask(new RegisterModuleServletsTask())
94 );
95
96 register(DeltaBuilder.update("3.5.9", "")
97 .addTask(new RemoveNodeTask("Remove Secured URIs menu item", "Removes deprecated menu iten, since secured URIs are now handled through the anonymous user's permissions.", ContentRepository.CONFIG, "/modules/adminInterface/config/menu/config/secureURIs"))
98 );
99
100 register(DeltaBuilder.update("3.6", "")
101 .addTask(new SetPropertyTask(ContentRepository.CONFIG, "/modules/adminInterface/trees/website", "class", WebsiteTreeHandler.class.getName()))
102 .addTask(new BootstrapSingleResource("JavaScript messages", "Adds dynamic virtual url.", "/mgnl-bootstrap/adminInterface/config.modules.adminInterface.virtualURIMapping.messages.xml"))
103 .addTask(new BootstrapSingleResource("JavaScript messages", "Adds page to provide i18n messages in JavaScript.", "/mgnl-bootstrap/adminInterface/config.modules.adminInterface.pages.messages.xml"))
104 );
105
106 register(DeltaBuilder.update("3.6.4", "")
107 .addTask(new ArrayDelegateTask("Update groups tree",new MoveNodeTask("Update groups tree", "Updates incorrectly named usergroup tree",ContentRepository.CONFIG, "/modules/adminInterface/trees/groups", "/modules/adminInterface/trees/usergroups", false),
108 new CheckAndModifyPropertyValueTask("Update Group tree reference", "Updates reference to new usergroups tree name.", ContentRepository.CONFIG, "/modules/adminInterface/config/menu/security/groups", "onclick", "MgnlAdminCentral.showTree('groups')", "MgnlAdminCentral.showTree('usergroups')"),
109 new CheckAndModifyPropertyValueTask("Update User dialog", "Updates reference to new usergroups tree name.", ContentRepository.CONFIG, "/modules/adminInterface/dialogs/useredit/tabUser/groups", "chooseOnclick", "mgnlOpenTreeBrowserWithControl($('${prefix}'), 'groups');", "mgnlOpenTreeBrowserWithControl($('${prefix}'), 'usergroups');"),
110 new CheckAndModifyPropertyValueTask("Update Group dialog", "Updates reference to new usergroups tree name.", ContentRepository.CONFIG, "/modules/adminInterface/dialogs/groupedit/tabGroup/groups", "chooseOnclick", "mgnlOpenTreeBrowserWithControl($('${prefix}'), 'groups');", "mgnlOpenTreeBrowserWithControl($('${prefix}'), 'usergroups');")))
111 );
112
113 final String pathToDeploymentUtilsPage = "/modules/adminInterface/pages/deploymentUtils";
114 register(DeltaBuilder.update("4.0", "")
115 .addTask(new PropertyValueDelegateTask("Unused page", "Removes the now unused \"deployment\" page.", ContentRepository.CONFIG,
116
117 pathToDeploymentUtilsPage, "class", "info.magnolia.module.admininterface.pages.DeploymentUtilsPage", false,
118 new ArrayDelegateTask(null,
119 new RemoveNodeTask(null, null, ContentRepository.CONFIG, pathToDeploymentUtilsPage),
120 new RemoveNodeTask(null, null, ContentRepository.CONFIG, "/modules/adminInterface/config/menu/tools/deployment"))))
121
122 .addTask(new BootstrapSingleResource("Paragraph edit dialog", "The paragraph edition dialog is now a regular dialog.", "/mgnl-bootstrap/adminInterface/config.modules.adminInterface.dialogs.editParagraph.xml"))
123 .addTask(new BootstrapSingleResource("Quickstart page", "Registers the page to be displayed as default in case there are no templates defined yet.", "/mgnl-bootstrap/adminInterface/config.modules.adminInterface.pages.quickstart.xml"))
124 .addTask(new BootstrapSingleResource("User preferences dialog", "The user preferences dialog is not the user edit dialog anymore.", "/mgnl-bootstrap/adminInterface/config.modules.adminInterface.dialogs.userpreferences.xml"))
125 );
126
127 register(DeltaBuilder.update("4.1.1", "")
128
129
130
131 .addTask(new UpdatedDefaultPublicURIWarning())
132 );
133
134 register(DeltaBuilder.update("4.3", "")
135 .addTask(new BootstrapSingleModuleResource("New i18n authoring support", "Adds i18n authoring configuration to /server/i18n.", "config.server.i18n.authoring.xml"))
136 .addTask(new ReplaceWrongDialogNodeTypeTask())
137 .addTask(new BootstrapSingleModuleResource("Folders in users tree", "Adds a new tree configuration with the correct root path.", "config.modules.adminInterface.trees.usersAdmin.xml"))
138 .addTask(new BootstrapSingleModuleResource("Folders in users tree", "Adds a new tree configuration with the correct root path.", "config.modules.adminInterface.trees.usersSystem.xml"))
139
140 .addTask(new CheckAndModifyPropertyValueTask("Folders in users tree","Change JavaScript of the system users menu point.", "config", "/modules/adminInterface/config/menu/security/usersSystem", "onclick", "MgnlAdminCentral.showTree('users', '/system', true)", "MgnlAdminCentral.showTree('usersSystem')"))
141 .addTask(new CheckAndModifyPropertyValueTask("Folders in users tree","Change JavaScript of the users menu point.","config", "/modules/adminInterface/config/menu/security/usersAdmin", "onclick", "MgnlAdminCentral.showTree('users', '/admin', true)", "MgnlAdminCentral.showTree('usersAdmin')"))
142 .addTask(new PropertyValueDelegateTask("Security", "Updates users tree configuration.", ContentRepository.CONFIG, "/modules/adminInterface/trees/users", "class", "info.magnolia.module.admininterface.AdminTreeMVCHandler", true, null, new CheckAndModifyPropertyValueTask("Security", "Updates users tree configuration.", ContentRepository.CONFIG, "/modules/adminInterface/trees/users", "class", "info.magnolia.module.admininterface.AdminTreeMVCHandler", "info.magnolia.module.admininterface.trees.UsersTreeHandler")))
143 );
144 register(DeltaBuilder.update("4.3.2", "")
145 .addTask(new PropertyValueDelegateTask("Security", "Updates users tree configuration.", ContentRepository.CONFIG, "/modules/adminInterface/trees/usersAdmin", "class", "info.magnolia.module.admininterface.AdminTreeMVCHandler", true, null, new CheckAndModifyPropertyValueTask("", "", ContentRepository.CONFIG, "/modules/adminInterface/trees/usersAdmin", "class", "info.magnolia.module.admininterface.AdminTreeMVCHandler", "info.magnolia.module.admininterface.trees.UsersTreeHandler")))
146 .addTask(new PropertyValueDelegateTask("Security", "Updates users tree configuration.", ContentRepository.CONFIG, "/modules/adminInterface/trees/usersSystem", "class", "info.magnolia.module.admininterface.AdminTreeMVCHandler", true, null, new CheckAndModifyPropertyValueTask("", "", ContentRepository.CONFIG, "/modules/adminInterface/trees/usersSystem", "class", "info.magnolia.module.admininterface.AdminTreeMVCHandler", "info.magnolia.module.admininterface.trees.UsersTreeHandler")))
147 );
148
149 register(DeltaBuilder.update("4.3.3", "")
150 .addTask(new NodeExistsDelegateTask("Intercept","Checks if intercept node exists", ContentRepository.CONFIG, "/modules/adminInterface/filters/intercept", new RemoveNodeTask("Remove intercept", "Removes unneeded intercept node", ContentRepository.CONFIG, "/modules/adminInterface/filters/intercept")))
151 .addTask(new NodeExistsDelegateTask("Filters","Checks if filters node exists", ContentRepository.CONFIG, "/modules/adminInterface/filters", new ChildrenExistsDelegateTask("Filters","Checks if filters node has children", ContentRepository.CONFIG, "/modules/adminInterface/filters", null, null, new RemoveNodeTask("Removes filters","Remove unneeded filters node", ContentRepository.CONFIG, "/modules/adminInterface/filters"))))
152 );
153 register(DeltaBuilder.update("4.4","")
154 .addTask(new BootstrapSingleResource("Messages bundles for js", "Bundles here will be used to generate i18n messages available in javascript.", "/mgnl-bootstrap/adminInterface/config.modules.adminInterface.pages.messages.bundles.xml"))
155 .addTask(new ContentDeletionTasks()));
156
157 register(DeltaBuilder.update("4.4.4", "")
158 .addTask(new ReplaceWrongDialogNodeTypeTask())
159 );
160 }
161
162 protected List<Task> getExtraInstallTasks(InstallContext installContext) {
163 final List<Task> tasks = new ArrayList<Task>();
164 tasks.add(new AddMainMenuItemTask("security", "menu.security", "info.magnolia.modules.admininterface.messages", "", "/.resources/icons/24/key1.gif", "config"));
165 tasks.add(new AddSubMenuItemTask("security", "groups", "menu.groups", "MgnlAdminCentral.showTree('usergroups')", "/.resources/icons/16/group.gif"));
166 tasks.add(new AddSubMenuItemTask("security", "roles", "menu.roles", "MgnlAdminCentral.showTree('userroles')", "/.resources/icons/16/hat_white.gif"));
167 tasks.add(adminUsersSubMenu);
168 tasks.add(sysUsersSubMenu);
169 tasks.add(subscribersMenu);
170
171
172 tasks.add(new SetDefaultPublicURI("defaultPublicURI"));
173
174 return tasks;
175 }
176
177 @Override
178 protected List<Task> getBasicInstallTasks(InstallContext installContext) {
179 List<Task> tasks = new ArrayList<Task>();
180 tasks.add(new RegisterMgnlDeletedType());
181 tasks.addAll(super.getBasicInstallTasks(installContext));
182 return tasks;
183 }
184 }