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.templatingkit.setup;
35
36 import static info.magnolia.nodebuilder.Ops.*;
37
38 import info.magnolia.cms.core.Content;
39 import info.magnolia.cms.util.ContentUtil;
40 import info.magnolia.context.MgnlContext;
41 import info.magnolia.dam.providers.jcr.JcrAssetRenderer;
42 import info.magnolia.jcr.util.NodeTypes;
43 import info.magnolia.module.InstallContext;
44 import info.magnolia.module.admininterface.setup.SimpleContentVersionHandler;
45 import info.magnolia.module.data.setup.RegisterNodeTypeTask;
46 import info.magnolia.module.delta.AbstractRepositoryTask;
47 import info.magnolia.module.delta.ArrayDelegateTask;
48 import info.magnolia.module.delta.BootstrapSingleModuleResource;
49 import info.magnolia.module.delta.BootstrapSingleResource;
50 import info.magnolia.module.delta.CheckAndModifyPropertyValueTask;
51 import info.magnolia.module.delta.CheckOrCreatePropertyTask;
52 import info.magnolia.module.delta.CreateNodeTask;
53 import info.magnolia.module.delta.DeltaBuilder;
54 import info.magnolia.module.delta.FilterOrderingTask;
55 import info.magnolia.module.delta.IsModuleInstalledOrRegistered;
56 import info.magnolia.module.delta.MoveNodeTask;
57 import info.magnolia.module.delta.NewPropertyTask;
58 import info.magnolia.module.delta.NodeExistsDelegateTask;
59 import info.magnolia.module.delta.OrderNodeAfterTask;
60 import info.magnolia.module.delta.OrderNodeBeforeTask;
61 import info.magnolia.module.delta.PartialBootstrapTask;
62 import info.magnolia.module.delta.PropertyExistsDelegateTask;
63 import info.magnolia.module.delta.RemoveNodeTask;
64 import info.magnolia.module.delta.RemovePropertyTask;
65 import info.magnolia.module.delta.SetPropertyTask;
66 import info.magnolia.module.delta.Task;
67 import info.magnolia.module.delta.TaskExecutionException;
68 import info.magnolia.module.delta.WarnTask;
69 import info.magnolia.module.form.setup.migration.AddMissingDefaultValuesToFieldsTask;
70 import info.magnolia.module.inplacetemplating.setup.TemplatesInstallTask;
71 import info.magnolia.module.model.Version;
72 import info.magnolia.module.resources.setup.InstallResourcesTask;
73 import info.magnolia.module.templatingkit.dam.STKAssetRenderer;
74 import info.magnolia.module.templatingkit.setup.for1_1.AddContactUserRoleTask;
75 import info.magnolia.module.templatingkit.setup.for2_7.ConfigureSTKAppGroupTask;
76 import info.magnolia.module.templatingkit.setup.for2_7.MigrationTasks;
77 import info.magnolia.module.templatingkit.setup.for2_7.ReorderSTKAppsTask;
78 import info.magnolia.nodebuilder.task.ErrorHandling;
79 import info.magnolia.nodebuilder.task.NodeBuilderTask;
80 import info.magnolia.repository.RepositoryConstants;
81 import info.magnolia.ui.admincentral.setup.ConvertListAclToAppPermissionsTask;
82 import info.magnolia.ui.dialog.setup.DialogMigrationTask;
83 import info.magnolia.ui.form.field.definition.LinkFieldDefinition;
84 import info.magnolia.ui.form.field.definition.TextFieldDefinition;
85
86 import java.util.ArrayList;
87 import java.util.Arrays;
88 import java.util.HashMap;
89 import java.util.List;
90 import java.util.Map;
91
92 import javax.jcr.ImportUUIDBehavior;
93 import javax.jcr.Node;
94 import javax.jcr.RepositoryException;
95 import javax.jcr.Session;
96 import javax.jcr.ValueFormatException;
97
98
99
100
101 public class STKModuleVersionHandler extends SimpleContentVersionHandler {
102 protected static final String STK_LOGOUT_TEXT_FIELD = "/modules/standard-templating-kit/dialogs/components/pur/stkPURLink/form/tabs/tabPURLink/fields/logoutText";
103
104 private static final String I18N_BASENAME = "info.magnolia.module.templatingkit.messages";
105
106 private static final String AREAS_PROTOTYPE_PATH = "/modules/standard-templating-kit/config/site/templates/prototype/areas/";
107
108 private final OrderNodeBeforeTask orderThemesBrowserCachePolicy = new OrderNodeBeforeTask("Browser cache policy", "Move the theme images configuration in front of the", RepositoryConstants.CONFIG, "/modules/cache/config/configurations/default/browserCachePolicy/policies/stkThemeImages", "default");
109 private final FilterOrderingTask orderSiteMergeFilter = new FilterOrderingTask("siteMerge", new String[] { "channel" });
110
111 final Task changeMaxImagesPropertyTypeToLong = new AbstractRepositoryTask("Set right maxImages property type", "Change maxImages property type of stkImageGallery template to Long .") {
112
113 final String path = "/modules/standard-templating-kit/templates/pages/stkImageGallery/areas/main/areas/content/autoGeneration/content/singleton";
114 final String property = "maxImages";
115
116 @Override
117 protected void doExecute(InstallContext installContext) throws RepositoryException, TaskExecutionException {
118 Session session = MgnlContext.getJCRSession(RepositoryConstants.CONFIG);
119 if (session.nodeExists(path)) {
120 Node node = session.getNode(path);
121 if (node.hasProperty(property)) {
122 Long valueNewType;
123 try {
124 valueNewType = node.getProperty(property).getLong();
125 } catch (ValueFormatException e) {
126
127 valueNewType = 9L;
128 }
129 node.setProperty(property, valueNewType);
130 }
131 }
132 }
133 };
134
135 private final String contactField = "/modules/standard-templating-kit/dialogs/components/teasers/stkTeaserContact/form/tabs/tabTeaser/fields/contact";
136 private final Task fixContactField = new NodeExistsDelegateTask("Fix 'stkTeaserContact' field", String.format("Fix '%s' field", contactField),
137 RepositoryConstants.CONFIG, contactField, new ArrayDelegateTask("",
138 new CheckAndModifyPropertyValueTask("", "", RepositoryConstants.CONFIG, contactField, "appName", "pages", "contacts"),
139 new SetPropertyTask(RepositoryConstants.CONFIG, contactField, "tree", "Contact"))
140 );
141 private final Task reconfigureLogoutTextField = new NodeExistsDelegateTask("Change class and delete properties", STK_LOGOUT_TEXT_FIELD, new ArrayDelegateTask("",
142 new CheckAndModifyPropertyValueTask(STK_LOGOUT_TEXT_FIELD, "class", LinkFieldDefinition.class.getName(), TextFieldDefinition.class.getName()),
143 new RemovePropertyTask("", STK_LOGOUT_TEXT_FIELD, "appName"),
144 new RemovePropertyTask("", STK_LOGOUT_TEXT_FIELD, "targetWorkspace"),
145 new RemoveNodeTask("", STK_LOGOUT_TEXT_FIELD + "/identifierToPathConverter")));
146
147 public STKModuleVersionHandler() {
148
149 register(DeltaBuilder.checkPrecondition("2.0", "2.5"));
150
151 register(DeltaBuilder.update("2.0.1", "")
152 .addTask(new NodeBuilderTask("Add editable property to stkSection page", "Adds and sets editable property to true for sectionHeader area on stkSection pages.", ErrorHandling.logging, RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkSection/areas",
153 getNode("sectionHeader").then(
154 addProperty("editable", Boolean.TRUE)
155 )
156 ))
157 .addTask(new NodeBuilderTask("Add editable property to areas", "Adds and sets editable property to false on sectionHeader, footer and metaNavigation.", ErrorHandling.logging, RepositoryConstants.CONFIG, "/modules/standard-templating-kit/config/site/templates/prototype/areas",
158 getNode("sectionHeader").then(
159 addProperty("editable", Boolean.FALSE)
160 )
161 )));
162
163 register(DeltaBuilder.update("2.0.2", "")
164 .addTask(new IsModuleInstalledOrRegistered("Use of commenting module", "Use of commenting module by default in STK", "commenting",
165 new CheckAndModifyPropertyValueTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/config/site/templates/prototype/areas/main/areas/comments/availableComponents/stkComments", "id", "standard-templating-kit:components/features/stkComments", "commenting:components/comments"))));
166 register(DeltaBuilder.update("2.0.3", "")
167 .addTask(changeMaxImagesPropertyTypeToLong));
168 register(DeltaBuilder.update("2.0.4", "")
169 .addTask(new NodeExistsDelegateTask("Check and used correct templateScript for stkFAQ", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkFAQ/areas/main",
170 new PropertyExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkFAQ/areas/main", "templateScript", null,
171 new CheckOrCreatePropertyTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkFAQ/areas/main", "templateScript", "/templating-kit/pages/content/mainArea.ftl"))))
172 .addTask(new NodeExistsDelegateTask("Check and used correct templateScript for stkImageGallery", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkImageGallery/areas/main",
173 new PropertyExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkImageGallery/areas/main", "templateScript", null,
174 new CheckOrCreatePropertyTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkImageGallery/areas/main", "templateScript", "/templating-kit/pages/content/mainArea.ftl"))))
175
176 );
177 register(DeltaBuilder.update("2.0.7", "")
178 .addTask(new ArrayDelegateTask("New PUR demo component", "Hides input field while logged in",
179 new BootstrapSingleModuleResource("Component definition", "", "templates/components/pur/config.modules.standard-templating-kit.templates.components.pur.stkPUREdit.xml"),
180 new PartialBootstrapTask("Register the component to fields set", "Makes the component available while authoring", "/mgnl-bootstrap/standard-templating-kit/templates/components/pur/config.modules.standard-templating-kit.templates.components.pur.groupFields.xml", "/groupFields/areas/fields/availableComponents/stkPUREdit", ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW))
181 )
182 .addTask(new RemoveNodeTask("Remove old flowplayer from resources", "Remove flowplayer version 3.2.7 from resources", "resources", "/templating-kit/js/mediaplayer/flowplayer-3-2-7"))
183 .addTask(new RemoveNodeTask("Remove old flowplayer controls from resources", "Remove flowplayer controls version 3.2.5 from resources", "resources", "/templating-kit/js/mediaplayer/flowplayer.controls-3-2-5"))
184 .addTask(new InstallResourcesTask("/templating-kit/js/mediaplayer/.*.swf", "resources:binary", true))
185 .addTask(new RemoveNodeTask("Remove FlashCanvasPro from resources", "Remove FlashCanvasPro from resources", "resources", "/templating-kit/js/shims/FlashCanvasPro/"))
186 .addTask(new InstallResourcesTask("/templating-kit/js/.*.", "resources:js", false, true))
187 .addTask(new InstallResourcesTask("/templating-kit/js/shims/swf/JarisFLVPlayer.swf", "resources:binary", true)));
188 register(DeltaBuilder.update("2.0.9", "")
189 .addTask(new FixAggregatedJavascriptsTask())
190 .addTask(new InstallResourcesTask("/templating-kit/js/shims/swf/JarisFLVPlayer.swf", "resources:binary", true))
191 );
192 register(DeltaBuilder.update("2.0.11", "")
193 .addTask(new NodeExistsDelegateTask("Move node", "Move contentFeeds node to stk module under virtualURIMapping", "config", "/modules/standard-templating-kit/virtualURIMapping",
194 new MoveNodeTask("Move contentFeeds node.", "Move contentFeeds node to stk module", "config", "/modules/adminInterface/virtualURIMapping/contentFeeds", "/modules/standard-templating-kit/virtualURIMapping/contentFeeds", false),
195 new ArrayDelegateTask("Move contentFeeds node.", "Move contentFeeds node to stk module",
196 new CreateNodeTask("Create node", "Create virtualURIMapping node in stk module", "config", "/modules/standard-templating-kit", "virtualURIMapping", NodeTypes.Content.NAME),
197 new MoveNodeTask("Move contentFeeds node.", "Move contentFeeds node to stk module", "config", "/modules/adminInterface/virtualURIMapping/contentFeeds", "/modules/standard-templating-kit/virtualURIMapping/contentFeeds", false)))));
198
199 register(DeltaBuilder.update("2.5", "")
200
201 .addTask(new DialogMigrationTask("standard-templating-kit"))
202
203 .addTask(new NodeExistsDelegateTask("Remove damSupport", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/config/damSupport",
204 new RemoveNodeTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/config/damSupport")))
205
206 .addTask(new NodeExistsDelegateTask("Remove old DMS controls", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/controls",
207 new RemoveNodeTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/controls")))
208
209 .addTask(new BootstrapSingleResource("Config", "Add contextAttribute damfn", "/mgnl-bootstrap/standard-templating-kit/config.modules.standard-templating-kit.renderers.stk.contextAttributes.damfn.xml"))
210
211 .addTask(new STKLegacyUiToMagnolia5AppProviderTask("Provide STK with a Magnolia 5 UI", "Turns most of the legacy UI into a Magnolia 5 browser app. Wraps the remaining old UI as Magnolia 5 legacy apps. Legacy apps will be soon replaced with actual M5 apps."))
212
213 .addTask(
214 new CheckAndModifyPropertyValueTask("Install STK asset renderer", "Installs STKAssetRenderer", RepositoryConstants.CONFIG, "/modules/dam/config/mediaTypes/image",
215 "rendererClass", JcrAssetRenderer.class.getName(), STKAssetRenderer.class.getName()))
216 .addTask(
217 new BootstrapSingleModuleResource("STK add DamTemplatingFunction.", "Renderers are now defined in the renderer folder.",
218 "config.modules.standard-templating-kit.renderers.stk.contextAttributes.damfn.xml"))
219 .addTask(new ConvertListAclToAppPermissionsTask("Convert permissions for 'ui-admincentral' apps", "Convert ACL permissions to old menus to new admincentral apps permission", this.getAclsToAppsPermissionsMap(), true)));
220
221 register(DeltaBuilder.update("2.5.1", "")
222 .addTask(new NodeExistsDelegateTask("Update stkContact", "Update stkContact content component definition", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/components/content/stkContact",
223 new ArrayDelegateTask("", "",
224 new RemovePropertyTask("Remove templateScript property of stkContact", "Remove templateScript of stkContact component as it should use/inherit the standard template of features", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/components/content/stkContact", "templateScript"),
225 new ArrayDelegateTask("Update stkContact component definition", "Update parameters of stkContact content component definition",
226 new CheckOrCreatePropertyTask("Add new divIDPrefix property to parameters", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/components/content/stkContact/parameters", "divIDPrefix", "content"),
227 new CheckAndModifyPropertyValueTask("Update divClass property of parameters", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/components/content/stkContact/parameters", "divClass", "text-section", "text-section box vcard")
228 )
229 )
230 )
231 ));
232
233 register(DeltaBuilder.update("2.5.2", "")
234 .addTask(new NodeExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkPublicUserRegistration/areas/main/areas/intro",
235 new CheckOrCreatePropertyTask("Set property", "Disable intro area in stkPublicUserRegistration page", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkPublicUserRegistration/areas/main/areas/intro", "enabled", "false")
236 )
237 )
238 .addTask(new BootstrapSingleModuleResource("Password change form", "Add new password change component", "templates/components/pur/config.modules.standard-templating-kit.templates.components.pur.stkPURPasswordChangeForm.xml"))
239 .addTask(new NodeExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkPublicUserRegistration/areas/main/areas/content/availableComponents",
240 new NodeExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkPublicUserRegistration/areas/main/areas/content/availableComponents/stkPURPasswordChangeForm", null, new CreateNodeTask("Add pass form", "Add new password change form to allowed componets list", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkPublicUserRegistration/areas/main/areas/content/availableComponents", "stkPURPasswordChangeForm", NodeTypes.ContentNode.NAME))))
241 .addTask(new NodeExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkPublicUserRegistration/areas/main/areas/content/availableComponents/stkPURPasswordChangeForm", new NewPropertyTask("Add form id", "Set ID for newly added form", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkPublicUserRegistration/areas/main/areas/content/availableComponents/stkPURPasswordChangeForm", "id", "standard-templating-kit:components/pur/stkPURPasswordChangeForm")))
242 .addTask(new NodeExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkPublicUserRegistration/areas/main/areas/intro", new CheckOrCreatePropertyTask("Set property", "Disable intro area in stkPublicUserRegistration page", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkPublicUserRegistration/areas/main/areas/intro", "enabled", "false")))
243 .addTask(new NodeExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkGlossary/areas/main/areas/content", new CheckOrCreatePropertyTask("Set property", "Set type of main area of stkGlossary to single", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkGlossary/areas/main/areas/content", "type", "single")))
244 .addTask(new NodeExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/demo-features/stkSectionNoExtras/areas/promos", new RemoveNodeTask("Remove node", "Remove idle node promos in stkSectionNoExtras. Area is inherited.", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/demo-features/stkSectionNoExtras/areas/promos")))
245 .addTask(new NodeExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/demo-features/stkSectionWithTwoExtras/areas/extras/areas", new RemoveNodeTask("Remove node", "Remove idle extras area in stkSectionWithTwoExtras. Area is inherited.", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/demo-features/stkSectionNoExtras/areas/extras/areas")))
246 .addTask(new NodeExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/dialogs/pages/largeArticle/stkLargeArticleIntro/tabMain/abstract", new CheckAndModifyPropertyValueTask("Set property", "Change property value from 'flase' to 'false' in stkLargeArticleIntro dialog.", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/dialogs/pages/largeArticle/stkLargeArticleIntro/tabMain/abstract", "required", "flase", "false"))));
247
248 register(DeltaBuilder.update("2.5.4", "")
249 .addTask(new NodeExistsDelegateTask("Remove obsolete component", "Remove stkFooter component", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/components/footer/stkFooter",
250 new RemoveNodeTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/components/footer/stkFooter"))
251 ));
252
253 register(DeltaBuilder.update("2.6.2", "")
254 .addTask(new RemovePropertyTask("Remove hardcoded label", "Remove hardcoded label of STK app group on the app launcher", RepositoryConstants.CONFIG, "/modules/ui-admincentral/config/appLauncherLayout/groups/stk", "label"))
255
256 .addTask(new RemovePropertyTask("Remove hardcoded label", "Remove hardcoded label of STK Site app", RepositoryConstants.CONFIG, "/modules/ui-admincentral/apps/stkSiteApp", "label"))
257 .addTask(new RemovePropertyTask("Remove hardcoded icon", "Remove hardcoded icon of STK Site app", RepositoryConstants.CONFIG, "/modules/ui-admincentral/apps/stkSiteApp", "icon"))
258 .addTask(new RemovePropertyTask("Remove hardcoded label", "Remove hardcoded label of STK Themes app", RepositoryConstants.CONFIG, "/modules/ui-admincentral/apps/stkThemesApp", "label"))
259 .addTask(new RemovePropertyTask("Remove hardcoded icon", "Remove hardcoded icon of STK Themes app", RepositoryConstants.CONFIG, "/modules/ui-admincentral/apps/stkThemesApp", "icon"))
260 .addTask(new RemovePropertyTask("Remove hardcoded label", "Remove hardcoded label of STK Dialogs app", RepositoryConstants.CONFIG, "/modules/ui-admincentral/apps/stkDialogsApp", "label"))
261 .addTask(new RemovePropertyTask("Remove hardcoded icon", "Remove hardcoded icon of STK Dialogs app", RepositoryConstants.CONFIG, "/modules/ui-admincentral/apps/stkDialogsApp", "icon"))
262 .addTask(new RemovePropertyTask("Remove hardcoded label", "Remove hardcoded label of STK Channels app", RepositoryConstants.CONFIG, "/modules/ui-admincentral/apps/stkChannelsApp", "label"))
263 .addTask(new RemovePropertyTask("Remove hardcoded icon", "Remove hardcoded icon of STK Channels app", RepositoryConstants.CONFIG, "/modules/ui-admincentral/apps/stkChannelsApp", "icon"))
264 .addTask(new RemovePropertyTask("Remove hardcoded label", "Remove hardcoded label of STK Template Def app", RepositoryConstants.CONFIG, "/modules/ui-admincentral/apps/stkTemplateDefsApp", "label"))
265 .addTask(new RemovePropertyTask("Remove hardcoded icon", "Remove hardcoded icon of STK Template Def app", RepositoryConstants.CONFIG, "/modules/ui-admincentral/apps/stkTemplateDefsApp", "icon")));
266
267 register(DeltaBuilder.update("2.7", "")
268 .addTask(new MigrationTasks("STK Migration", "A collection of update tasks to help migrating to STK 2.7."))
269 .addTask(new NodeExistsDelegateTask("Check applauncher layout group order", "Checks whether manage group is already installed, so that we insert stk group right after it.", RepositoryConstants.CONFIG, "/modules/ui-admincentral/config/appLauncherLayout/groups/manage",
270 new OrderNodeAfterTask("STK AppLauncher group ordering", "Moves the stk app group as first closable group", RepositoryConstants.CONFIG, "/modules/ui-admincentral/config/appLauncherLayout/groups/stk", "manage")))
271 .addTask(new ReorderSTKAppsTask())
272 );
273
274 register(DeltaBuilder.update("2.7.1", "")
275 .addTask(new RemoveNodeTask("Remove obsolete tab", "Remove obsolete 'dependencies' tab", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/dialogs/generic/pages/tabDependencies"))
276 .addTask(new RemoveNodeTask("Remove redundant form configuration", "Remove redundant form configuration", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/dialogs/pages/article/stkArticleProperties/form"))
277 .addTask(new NodeExistsDelegateTask("Set property value", "Set property [type] to value [String] in the stkDownloadList dialog.", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/dialogs/components/content/stkDownloadList/form/tabs/tabQuery/fields/link",
278 new SetPropertyTask(RepositoryConstants.CONFIG, "/modules/standard-templating-kit/dialogs/components/content/stkDownloadList/form/tabs/tabQuery/fields/link", "type", "String")))
279 );
280
281 register(DeltaBuilder.update("2.7.2", "")
282 .addTask(new NodeExistsDelegateTask("Remove redundant extras areas if exist", "Remove redundant extras areas if exist", RepositoryConstants.CONFIG,
283 "/modules/standard-templating-kit/templates/pages/demo-features/stkSectionWithTwoExtras/areas/extras/areas",
284 new RemoveNodeTask("Remove redundant extras areas", "Remove redundant extras areas", RepositoryConstants.CONFIG,
285 "/modules/standard-templating-kit/templates/pages/demo-features/stkSectionWithTwoExtras/areas/extras/areas")))
286 .addTask(new NodeExistsDelegateTask("Remove obsolete stkFooter component if exists", "Remove obsolete stkFooter component if exists", RepositoryConstants.CONFIG,
287 "/modules/standard-templating-kit/templates/components/footer/stkFooter",
288 new RemoveNodeTask("Remove obsolete stkFooter component", "Remove obsolete stkFooter component", RepositoryConstants.CONFIG,
289 "/modules/standard-templating-kit/templates/components/footer/stkFooter"))));
290
291
292 register(DeltaBuilder.update("2.7.3", "")
293
294 .addTask(new BootstrapSingleModuleResource("Bootstrap the forum page-template.", "Bootstraping the forum page-template.", "templates/pages/config.modules.standard-templating-kit.templates.pages.stkForum.xml", ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW))
295 .addTask(new BootstrapSingleModuleResource("Bootstrap the forum login-component.", "Bootstraping the forum login-component.", "templates/components/forum/config.modules.standard-templating-kit.templates.components.forum.xml", ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW))
296 .addTask(new BootstrapSingleModuleResource("Bootstrap the availability of the forum-page-template.", "Bootstraping the availability of the forum-page-template.", "site/config.modules.standard-templating-kit.config.site.templates.availability.templates.stkForum.xml", ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW))
297 .addTask(new BootstrapSingleModuleResource("Bootstrap a folder node for the dialogs of the forum template.", "Bootstraping a folder node for the dialogs of the forum template.", "dialogs/pages/forum/config.modules.standard-templating-kit.dialogs.pages.forum.xml", ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW))
298 .addTask(new BootstrapSingleModuleResource("Bootstrap page-properties dialog for the forum-template.", "Bootstraping page-properties dialog for the forum-template.", "dialogs/pages/forum/config.modules.standard-templating-kit.dialogs.pages.forum.stkForumProperties.xml", ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW))
299 .addTask(new BootstrapSingleModuleResource("Bootstrap the dialog for the header of the forum-template.", "Bootstraping the dialog for the header of the forum-template.", "dialogs/pages/forum/config.modules.standard-templating-kit.dialogs.pages.forum.stkForumHeader.xml", ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW))
300
301 .addTask(new AddMissingDefaultValuesToFieldsTask(Arrays.asList(
302 "/modules/standard-templating-kit/dialogs/components/features/stkEventsOverview/form/tabs/tabTeaser/fields/showAbstract",
303 "/modules/standard-templating-kit/dialogs/components/features/stkSiteMap/form/tabs/tabMain/fields/showSiteMapRoot",
304 "/modules/standard-templating-kit/dialogs/components/teasers/stkTeaserEventsList/form/tabs/tabTeaser/fields/showAbstract",
305 "/modules/standard-templating-kit/dialogs/functional/stkRedirect/form/tabs/tabRedirect/fields/hideInNav"
306 ), "defaultValue", "true"))
307
308 .addTask(new AddMissingDefaultValuesToFieldsTask(Arrays.asList(
309 "/modules/standard-templating-kit/dialogs/components/features/stkFAQ/form/tabs/tabMain/fields/useIndex",
310 "/modules/standard-templating-kit/dialogs/components/features/stkNewsOverview/form/tabs/tabTeaser/fields/hideTeaserImage",
311 "/modules/standard-templating-kit/dialogs/components/pur/stkPURLoginForm/form/tabs/tabTitleText/fields/showInfoText",
312 "/modules/standard-templating-kit/dialogs/components/teasers/stkTeaserNewsList/form/tabs/tabTeaser/fields/hideTeaserImage",
313 "/modules/standard-templating-kit/dialogs/generic/controls/hideInNav",
314 "/modules/standard-templating-kit/dialogs/generic/controls/inheritable",
315 "/modules/standard-templating-kit/dialogs/generic/teasers/hideTeaserImage",
316 "/modules/standard-templating-kit/dialogs/generic/teasers/highlighted"
317 ), "defaultValue", "false"))
318
319 .addTask(fixContactField)
320 );
321
322 register(DeltaBuilder.update("2.7.4", "")
323 .addTask(new NodeExistsDelegateTask("Add createAreaNode property with value false to htmlHeader area", AREAS_PROTOTYPE_PATH + "htmlHeader",
324 new SetPropertyTask("Add createAreaNode property with value false to htmlHeader area", RepositoryConstants.CONFIG, AREAS_PROTOTYPE_PATH + "htmlHeader", "createAreaNode", false)))
325 .addTask(new NodeExistsDelegateTask("Add createAreaNode property with value false to main area", AREAS_PROTOTYPE_PATH + "main",
326 new SetPropertyTask("Add createAreaNode property with value false to main area", RepositoryConstants.CONFIG, AREAS_PROTOTYPE_PATH + "main", "createAreaNode", false)))
327 .addTask(new NodeExistsDelegateTask("Add createAreaNode property with value false to intro area", AREAS_PROTOTYPE_PATH + "main/areas/intro",
328 new SetPropertyTask("Add createAreaNode property with value false to intro area", RepositoryConstants.CONFIG, AREAS_PROTOTYPE_PATH + "main/areas/intro", "createAreaNode", false)))
329 .addTask(new NodeExistsDelegateTask("Add createAreaNode property with value false to infoBlock area", AREAS_PROTOTYPE_PATH + "main/areas/intro/areas/infoBlock",
330 new SetPropertyTask("Add createAreaNode property with value false to infoBlock area", RepositoryConstants.CONFIG, AREAS_PROTOTYPE_PATH + "main/areas/intro/areas/infoBlock", "createAreaNode", false)))
331 .addTask(new NodeExistsDelegateTask("Add createAreaNode property with value false to breadcrumb area", AREAS_PROTOTYPE_PATH + "main/areas/breadcrumb",
332 new SetPropertyTask("Add createAreaNode property with value false to breadcrumb area", RepositoryConstants.CONFIG, AREAS_PROTOTYPE_PATH + "main/areas/breadcrumb", "createAreaNode", false)))
333 .addTask(new NodeExistsDelegateTask("Add createAreaNode property with value false to contentNavigation area", AREAS_PROTOTYPE_PATH + "main/areas/contentNavigation",
334 new SetPropertyTask("Add createAreaNode property with value false to contentNavigation area", RepositoryConstants.CONFIG, AREAS_PROTOTYPE_PATH + "main/areas/contentNavigation", "createAreaNode", false)))
335 .addTask(new NodeExistsDelegateTask("Add createAreaNode property with value false to branding area", AREAS_PROTOTYPE_PATH + "branding",
336 new SetPropertyTask("Add createAreaNode property with value false to branding area", RepositoryConstants.CONFIG, AREAS_PROTOTYPE_PATH + "branding", "createAreaNode", false)))
337 .addTask(new NodeExistsDelegateTask("Add createAreaNode property with value false to logo area", AREAS_PROTOTYPE_PATH + "branding/areas/logo",
338 new SetPropertyTask("Add createAreaNode property with value false to logo area", RepositoryConstants.CONFIG, AREAS_PROTOTYPE_PATH + "branding/areas/logo", "createAreaNode", false)))
339 .addTask(new NodeExistsDelegateTask("Add createAreaNode property with value false to search area", AREAS_PROTOTYPE_PATH + "branding/areas/search",
340 new SetPropertyTask("Add createAreaNode property with value false to search area", RepositoryConstants.CONFIG, AREAS_PROTOTYPE_PATH + "branding/areas/search", "createAreaNode", false)))
341 .addTask(new NodeExistsDelegateTask("Add createAreaNode property with value false to sectionHeader area", AREAS_PROTOTYPE_PATH + "sectionHeader",
342 new SetPropertyTask("Add createAreaNode property with value false to sectionHeader area", RepositoryConstants.CONFIG, AREAS_PROTOTYPE_PATH + "sectionHeader", "createAreaNode", false)))
343 );
344
345 register(DeltaBuilder.update("2.7.6", "")
346 .addTask(reconfigureLogoutTextField));
347
348 register(DeltaBuilder.update("2.7.7", "")
349 .addTask(new MoveIntenseDebateIdTask()));
350
351 }
352
353 private Map<String, String[]> getAclsToAppsPermissionsMap() {
354 Map<String, String[]> permissionsMap = new HashMap<String, String[]>();
355
356 permissionsMap.put("/modules/adminInterface/config/menu/templating-kit/etkSites", new String[] { "/modules/ui-admincentral/apps/stkSiteApp" });
357 permissionsMap.put("/modules/adminInterface/config/menu/templating-kit/stkThemes", new String[] { "/modules/ui-admincentral/apps/stkThemesApp" });
358 permissionsMap.put("/modules/adminInterface/config/menu/templating-kit/stkDialogs", new String[] { "/modules/ui-admincentral/apps/dialogs" });
359 permissionsMap.put("/modules/adminInterface/config/menu/templating-kit/stkChannels", new String[] { "/modules/ui-admincentral/apps/channels" });
360 permissionsMap.put("/modules/adminInterface/config/menu/templating-kit/stkTemplateDefs", new String[] { "/modules/ui-admincentral/apps/stkTemplateDefsApp" });
361
362 return permissionsMap;
363 }
364
365 @Override
366 protected List<Task> getExtraInstallTasks(InstallContext ctx) {
367 final List<Task> tasks = new ArrayList<Task>();
368 tasks.addAll(super.getExtraInstallTasks(ctx));
369 tasks.add(new TemplatesInstallTask("/templating-kit/.*\\.ftl", true));
370 tasks.add(new InstallSTKResourcesTask());
371
372
373 tasks.add(new AbstractRepositoryTask("Order templates", "") {
374 @Override
375 protected void doExecute(InstallContext ctx) throws RepositoryException, TaskExecutionException {
376 Content templatesNodes = ctx.getConfigHierarchyManager().getContent("/modules/standard-templating-kit/templates/pages");
377 ContentUtil.orderNodes(templatesNodes, new String[] { "stkHome", "stkSection", "stkArticle", "stkLargeArticle", "stkNews", "stkEvent", "stkImageGallery", "stkFAQ", "stkForm", "stkSearchResult", "stkSiteMap", "stkRedirect" });
378 }
379 });
380
381 tasks.add(new RemoveETKParagraphs());
382 tasks.add(new AddContactUserRoleTask());
383
384 tasks.add(orderThemesBrowserCachePolicy);
385 tasks.add(new WarnTask("SMTP Configuration", "Please set the config: /modules/mail/config/smtp to a valid smtp configuration"));
386 tasks.add(orderSiteMergeFilter);
387 tasks.add(new IsModuleInstalledOrRegistered("Use of commenting module", "Use of commenting module by default in STK", "commenting",
388 new CheckAndModifyPropertyValueTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/config/site/templates/prototype/areas/main/areas/comments/availableComponents/stkComments", "id", "standard-templating-kit:components/features/stkComments", "commenting:components/comments")));
389 tasks.add(new CheckAndModifyPropertyValueTask("Install STK asset renderer", "Installs STKAssetRenderer", RepositoryConstants.CONFIG, "/modules/dam/config/mediaTypes/image", "rendererClass",
390 JcrAssetRenderer.class.getName(), STKAssetRenderer.class.getName()));
391 tasks.add(new STKLegacyUiToMagnolia5AppProviderTask("Provide STK with a Magnolia 5 UI", "Turns legacy UI into a Magnolia 5 browser app."));
392 tasks.add(new ConfigureSTKAppGroupTask());
393 tasks.add(new OrderNodeAfterTask("STK AppLauncher group ordering", "Moves the stk app group as first closable group", RepositoryConstants.CONFIG, "/modules/ui-admincentral/config/appLauncherLayout/groups/stk", "manage"));
394 tasks.add(new ReorderSTKAppsTask());
395
396 return tasks;
397 }
398
399 @Override
400 protected List<Task> getDefaultUpdateTasks(Version forVersion) {
401 final List<Task> tasks = new ArrayList<Task>();
402 tasks.addAll(super.getDefaultUpdateTasks(forVersion));
403 tasks.add(new TemplatesInstallTask("/templating-kit/.*\\.ftl", true));
404 return tasks;
405 }
406
407 @Override
408 protected List<Task> getBasicInstallTasks(InstallContext ctx) {
409 final List<Task> installTasks = new ArrayList<Task>();
410
411 installTasks.add(new RegisterNodeTypeTask("Contact"));
412 installTasks.addAll(super.getBasicInstallTasks(ctx));
413 return installTasks;
414 }
415
416 }