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.jcr.nodebuilder.Ops.*;
37 import static info.magnolia.module.templatingkit.setup.InstallSTKResourcesTask.*;
38
39 import info.magnolia.cms.core.Content;
40 import info.magnolia.cms.util.ContentUtil;
41 import info.magnolia.context.MgnlContext;
42 import info.magnolia.dam.jcr.JcrAssetProvider;
43 import info.magnolia.dam.templating.functions.DamTemplatingFunctions;
44 import info.magnolia.jcr.nodebuilder.task.ErrorHandling;
45 import info.magnolia.jcr.nodebuilder.task.NodeBuilderTask;
46 import info.magnolia.jcr.util.NodeTypes;
47 import info.magnolia.module.DefaultModuleVersionHandler;
48 import info.magnolia.module.InstallContext;
49 import info.magnolia.module.delta.AbstractRepositoryTask;
50 import info.magnolia.module.delta.ArrayDelegateTask;
51 import info.magnolia.module.delta.BootstrapSingleModuleResource;
52 import info.magnolia.module.delta.BootstrapSingleResource;
53 import info.magnolia.module.delta.CheckAndModifyPropertyValueTask;
54 import info.magnolia.module.delta.CheckOrCreatePropertyTask;
55 import info.magnolia.module.delta.CopyNodeTask;
56 import info.magnolia.module.delta.CreateNodePathTask;
57 import info.magnolia.module.delta.CreateNodeTask;
58 import info.magnolia.module.delta.DeltaBuilder;
59 import info.magnolia.module.delta.IsModuleInstalledOrRegistered;
60 import info.magnolia.module.delta.ModuleDependencyBootstrapTask;
61 import info.magnolia.module.delta.MoveNodeTask;
62 import info.magnolia.module.delta.NewPropertyTask;
63 import info.magnolia.module.delta.NodeExistsDelegateTask;
64 import info.magnolia.module.delta.OrderNodeAfterTask;
65 import info.magnolia.module.delta.PartialBootstrapTask;
66 import info.magnolia.module.delta.PathExistenceDelegateTask;
67 import info.magnolia.module.delta.PropertyExistsDelegateTask;
68 import info.magnolia.module.delta.RemoveNodeTask;
69 import info.magnolia.module.delta.RemovePropertiesTask;
70 import info.magnolia.module.delta.RemovePropertyTask;
71 import info.magnolia.module.delta.RenameNodeTask;
72 import info.magnolia.module.delta.SetPropertyTask;
73 import info.magnolia.module.delta.Task;
74 import info.magnolia.module.delta.TaskExecutionException;
75 import info.magnolia.module.delta.WarnTask;
76 import info.magnolia.module.form.setup.ChangeValidationToMultiValuedPropertyTask;
77 import info.magnolia.module.form.setup.migration.AddMissingDefaultValuesToFieldsTask;
78 import info.magnolia.module.model.Version;
79 import info.magnolia.module.resources.ResourceTypes;
80 import info.magnolia.module.resources.setup.InstallBinaryResourceTask;
81 import info.magnolia.module.resources.setup.InstallResourcesTask;
82 import info.magnolia.module.resources.setup.InstallTextResourceTask;
83 import info.magnolia.module.resources.setup.ResourceCleanUpTask;
84 import info.magnolia.module.resources.setup.UpdateResourceReferencesTask;
85 import info.magnolia.module.site.setup.DefaultSiteExistsDelegateTask;
86 import info.magnolia.module.templatingkit.dam.STKAssetRenderer;
87 import info.magnolia.module.templatingkit.setup.for2_7.MigrationTasks;
88 import info.magnolia.module.templatingkit.setup.for2_7.ReorderSTKAppsTask;
89 import info.magnolia.module.templatingkit.setup.for2_9.MigrateTemplateTypesTask;
90 import info.magnolia.module.templatingkit.setup.for2_9.RemoveTreeTemplatesTask;
91 import info.magnolia.repository.RepositoryConstants;
92 import info.magnolia.resourceloader.jcr.JcrResourceOrigin;
93 import info.magnolia.ui.admincentral.setup.ConvertListAclToAppPermissionsTask;
94 import info.magnolia.ui.dialog.setup.DialogMigrationTask;
95 import info.magnolia.ui.form.field.definition.LinkFieldDefinition;
96 import info.magnolia.ui.form.field.definition.TextFieldDefinition;
97
98 import java.util.ArrayList;
99 import java.util.Arrays;
100 import java.util.HashMap;
101 import java.util.List;
102 import java.util.Map;
103 import java.util.Set;
104 import java.util.regex.Pattern;
105
106 import javax.jcr.ImportUUIDBehavior;
107 import javax.jcr.Node;
108 import javax.jcr.RepositoryException;
109 import javax.jcr.Session;
110 import javax.jcr.ValueFormatException;
111
112 import com.google.common.base.Function;
113 import com.google.common.collect.Lists;
114 import com.google.common.collect.Sets;
115
116
117
118
119 public class STKModuleVersionHandler extends DefaultModuleVersionHandler {
120
121 protected static final String STK_TEASER_OPENER = "/modules/standard-templating-kit/dialogs/components/teasers/stkTeaserOpener";
122 protected static final String STK_LOGOUT_TEXT_FIELD = "/modules/standard-templating-kit/dialogs/components/pur/stkPURLink/form/tabs/tabPURLink/fields/logoutText";
123 private static final String I18N_BASENAME = "info.magnolia.module.templatingkit.messages";
124 private static final String AREAS_PROTOTYPE_PATH = "/modules/standard-templating-kit/config/site/templates/prototype/areas/";
125 final Task changeMaxImagesPropertyTypeToLong = new AbstractRepositoryTask("Set right maxImages property type", "Change maxImages property type of stkImageGallery template to Long .") {
126
127 final String path = "/modules/standard-templating-kit/templates/pages/stkImageGallery/areas/main/areas/content/autoGeneration/content/singleton";
128 final String property = "maxImages";
129
130 @Override
131 protected void doExecute(InstallContext installContext) throws RepositoryException, TaskExecutionException {
132 Session session = MgnlContext.getJCRSession(RepositoryConstants.CONFIG);
133 if (session.nodeExists(path)) {
134 Node node = session.getNode(path);
135 if (node.hasProperty(property)) {
136 Long valueNewType;
137 try {
138 valueNewType = node.getProperty(property).getLong();
139 } catch (ValueFormatException e) {
140
141 valueNewType = 9L;
142 }
143 node.setProperty(property, valueNewType);
144 }
145 }
146 }
147 };
148 private final String contactField = "/modules/standard-templating-kit/dialogs/components/teasers/stkTeaserContact/form/tabs/tabTeaser/fields/contact";
149 private final Task fixContactField = new NodeExistsDelegateTask("Fix 'stkTeaserContact' field", String.format("Fix '%s' field", contactField),
150 RepositoryConstants.CONFIG, contactField, new ArrayDelegateTask("",
151 new CheckAndModifyPropertyValueTask("", "", RepositoryConstants.CONFIG, contactField, "appName", "pages", "contacts"),
152 new SetPropertyTask(RepositoryConstants.CONFIG, contactField, "tree", "Contact"))
153 );
154 private final Task reconfigureLogoutTextField = new NodeExistsDelegateTask("Change class and delete properties", STK_LOGOUT_TEXT_FIELD, new ArrayDelegateTask("",
155 new CheckAndModifyPropertyValueTask(STK_LOGOUT_TEXT_FIELD, "class", LinkFieldDefinition.class.getName(), TextFieldDefinition.class.getName()),
156 new RemovePropertyTask("", STK_LOGOUT_TEXT_FIELD, "appName"),
157 new RemovePropertyTask("", STK_LOGOUT_TEXT_FIELD, "targetWorkspace"),
158 new RemoveNodeTask("", STK_LOGOUT_TEXT_FIELD + "/identifierToPathConverter")));
159
160 private final Task setStkSiteAsActiveInSiteModule = new NodeExistsDelegateTask("Set STK site as an active site if possible", "/modules/standard-templating-kit/config/site",
161 new ArrayDelegateTask("",
162 new NodeExistsDelegateTask("Check if any site already exists", "/modules/site/config/site",
163 new PropertyExistsDelegateTask("Check extends property and update or create it", "/modules/site/config/site", "extends",
164 new CheckAndModifyPropertyValueTask("/modules/site/config/site", "extends", "/modules/travel-demo/config/travel", "/modules/standard-templating-kit/config/site"),
165 new DefaultSiteExistsDelegateTask("", "",
166 new SetPropertyTask(RepositoryConstants.CONFIG, "/modules/site/config/site", "extends", "/modules/standard-templating-kit/config/site"))),
167 new ArrayDelegateTask("",
168 new CreateNodeTask("Create site node", "/modules/site/config", "site", NodeTypes.ContentNode.NAME),
169 new SetPropertyTask(RepositoryConstants.CONFIG, "/modules/site/config/site", "extends", "/modules/standard-templating-kit/config/site"))),
170 new CheckOrCreatePropertyTask("Set correct site class for stk site", "/modules/standard-templating-kit/config/site", "class", "info.magnolia.module.templatingkit.sites.Site"),
171 new CheckOrCreatePropertyTask("Set correct class for stk prototype", "/modules/standard-templating-kit/config/site/templates/prototype", "class", "info.magnolia.module.templatingkit.templates.pages.STKPage")));
172
173 private final Task stkForumMigrationTask = new PathExistenceDelegateTask("Migrate 'stkForum' template if necessary", "If required this task will migrate 'stkForum' to the default site definition of MultiSite",
174 new String[]{"/modules/multisite/config/sites/default/templates/availability/templates/stkForum"},
175 new String[]{"/modules/standard-templating-kit/config/site/templates/availability/templates/stkForum", "/modules/multisite/config/sites/default/templates/availability/templates"},
176 new CopyNodeTask("", "/modules/standard-templating-kit/config/site/templates/availability/templates/stkForum",
177 "/modules/multisite/config/sites/default/templates/availability/templates/stkForum", false)
178 );
179
180 public STKModuleVersionHandler() {
181
182 register(DeltaBuilder.checkPrecondition("2.0", "2.5"));
183
184 register(DeltaBuilder.update("2.0.1", "")
185 .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",
186 getNode("sectionHeader").then(
187 addProperty("editable", Boolean.TRUE.toString())
188 )
189 ))
190 .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",
191 getNode("sectionHeader").then(
192 addProperty("editable", Boolean.FALSE.toString())
193 )
194 ))
195 );
196
197 register(DeltaBuilder.update("2.0.2", "")
198 .addTask(new IsModuleInstalledOrRegistered("Use of commenting module", "Use of commenting module by default in STK", "commenting",
199 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")))
200 );
201
202 register(DeltaBuilder.update("2.0.3", "")
203 .addTask(changeMaxImagesPropertyTypeToLong)
204 );
205
206 register(DeltaBuilder.update("2.0.4", "")
207 .addTask(new NodeExistsDelegateTask("Check and used correct templateScript for stkFAQ", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkFAQ/areas/main",
208 new PropertyExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkFAQ/areas/main", "templateScript", null,
209 new CheckOrCreatePropertyTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkFAQ/areas/main", "templateScript", "/templating-kit/pages/content/mainArea.ftl"))))
210 .addTask(new NodeExistsDelegateTask("Check and used correct templateScript for stkImageGallery", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkImageGallery/areas/main",
211 new PropertyExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkImageGallery/areas/main", "templateScript", null,
212 new CheckOrCreatePropertyTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkImageGallery/areas/main", "templateScript", "/templating-kit/pages/content/mainArea.ftl"))))
213 );
214
215 register(DeltaBuilder.update("2.0.7", "")
216 .addTask(new ArrayDelegateTask("New PUR demo component", "Hides input field while logged in",
217 new BootstrapSingleModuleResource("Component definition", "", "templates/components/pur/config.modules.standard-templating-kit.templates.components.pur.stkPUREdit.xml"),
218 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))
219 )
220 .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"))
221 .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"))
222 .addTask(new InstallResourcesTask("/templating-kit/js/mediaplayer/.*.swf", "resources:binary", true))
223 .addTask(new RemoveNodeTask("Remove FlashCanvasPro from resources", "Remove FlashCanvasPro from resources", "resources", "/templating-kit/js/shims/FlashCanvasPro/"))
224 .addTask(new InstallResourcesTask("/templating-kit/js/.*.", "resources:js", false, true))
225 .addTask(new InstallResourcesTask("/templating-kit/js/shims/swf/JarisFLVPlayer.swf", "resources:binary", true))
226 );
227
228 register(DeltaBuilder.update("2.0.9", "")
229 .addTask(new FixAggregatedJavascriptsTask())
230 .addTask(new InstallResourcesTask("/templating-kit/js/shims/swf/JarisFLVPlayer.swf", "resources:binary", true))
231 );
232
233 register(DeltaBuilder.update("2.0.11", "")
234 .addTask(new NodeExistsDelegateTask("Move node", "Move contentFeeds node to stk module under virtualURIMapping", "config", "/modules/standard-templating-kit/virtualURIMapping",
235 new MoveNodeTask("Move contentFeeds node.", "Move contentFeeds node to stk module", "config", "/modules/adminInterface/virtualURIMapping/contentFeeds", "/modules/standard-templating-kit/virtualURIMapping/contentFeeds", false),
236 new ArrayDelegateTask("Move contentFeeds node.", "Move contentFeeds node to stk module",
237 new CreateNodeTask("Create node", "Create virtualURIMapping node in stk module", "config", "/modules/standard-templating-kit", "virtualURIMapping", NodeTypes.Content.NAME),
238 new MoveNodeTask("Move contentFeeds node.", "Move contentFeeds node to stk module", "config", "/modules/adminInterface/virtualURIMapping/contentFeeds", "/modules/standard-templating-kit/virtualURIMapping/contentFeeds", false))))
239 );
240
241 register(DeltaBuilder.update("2.5", "")
242 .addTask(new DialogMigrationTask("standard-templating-kit"))
243
244 .addTask(new NodeExistsDelegateTask("Remove damSupport", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/config/damSupport",
245 new RemoveNodeTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/config/damSupport")))
246
247 .addTask(new NodeExistsDelegateTask("Remove old DMS controls", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/controls",
248 new RemoveNodeTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/controls")))
249
250 .addTask(new BootstrapSingleResource("Config", "Add contextAttribute damfn", "/mgnl-bootstrap/standard-templating-kit/config.modules.standard-templating-kit.renderers.stk.contextAttributes.damfn.xml"))
251
252 .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."))
253
254 .addTask(new NodeExistsDelegateTask("Install STK asset renderer", "/modules/dam/config/mediaTypes/image",
255 new CheckAndModifyPropertyValueTask("Install STK asset renderer", "Installs STKAssetRenderer", RepositoryConstants.CONFIG, "/modules/dam/config/mediaTypes/image",
256 "rendererClass", "info.magnolia.dam.providers.jcr.JcrAssetRenderer", STKAssetRenderer.class.getName())))
257 .addTask(new BootstrapSingleModuleResource("STK add DamTemplatingFunction.", "Renderers are now defined in the renderer folder.",
258 "config.modules.standard-templating-kit.renderers.stk.contextAttributes.damfn.xml"))
259 .addTask(new ConvertListAclToAppPermissionsTask("Convert permissions for 'ui-admincentral' apps", "Convert ACL permissions to old menus to new admincentral apps permission", this.getAclsToAppsPermissionsMap(), true))
260 );
261
262 register(DeltaBuilder.update("2.5.1", "")
263 .addTask(new NodeExistsDelegateTask("Update stkContact", "Update stkContact content component definition", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/components/content/stkContact",
264 new ArrayDelegateTask("", "",
265 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"),
266 new ArrayDelegateTask("Update stkContact component definition", "Update parameters of stkContact content component definition",
267 new CheckOrCreatePropertyTask("Add new divIDPrefix property to parameters", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/components/content/stkContact/parameters", "divIDPrefix", "content"),
268 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")))))
269 );
270
271 register(DeltaBuilder.update("2.5.2", "")
272 .addTask(new NodeExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkPublicUserRegistration/areas/main/areas/intro",
273 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")))
274 .addTask(new BootstrapSingleModuleResource("Password change form", "Add new password change component", "templates/components/pur/config.modules.standard-templating-kit.templates.components.pur.stkPURPasswordChangeForm.xml"))
275 .addTask(new NodeExistsDelegateTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkPublicUserRegistration/areas/main/areas/content/availableComponents",
276 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))))
277 .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")))
278 .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")))
279 .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")))
280 .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")))
281 .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")))
282 .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")))
283 );
284
285 register(DeltaBuilder.update("2.5.4", "")
286 .addTask(new NodeExistsDelegateTask("Remove obsolete component", "Remove stkFooter component", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/components/footer/stkFooter",
287 new RemoveNodeTask("", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/components/footer/stkFooter")))
288 );
289
290 register(DeltaBuilder.update("2.6.2", "")
291 .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"))
292 .addTask(new RemovePropertyTask("Remove hardcoded label", "Remove hardcoded label of STK Site app", RepositoryConstants.CONFIG, "/modules/ui-admincentral/apps/stkSiteApp", "label"))
293 .addTask(new RemovePropertyTask("Remove hardcoded icon", "Remove hardcoded icon of STK Site app", RepositoryConstants.CONFIG, "/modules/ui-admincentral/apps/stkSiteApp", "icon"))
294 .addTask(new RemovePropertyTask("Remove hardcoded label", "Remove hardcoded label of STK Themes app", RepositoryConstants.CONFIG, "/modules/ui-admincentral/apps/stkThemesApp", "label"))
295 .addTask(new RemovePropertyTask("Remove hardcoded icon", "Remove hardcoded icon of STK Themes app", RepositoryConstants.CONFIG, "/modules/ui-admincentral/apps/stkThemesApp", "icon"))
296 .addTask(new RemovePropertyTask("Remove hardcoded label", "Remove hardcoded label of STK Dialogs app", RepositoryConstants.CONFIG, "/modules/ui-admincentral/apps/stkDialogsApp", "label"))
297 .addTask(new RemovePropertyTask("Remove hardcoded icon", "Remove hardcoded icon of STK Dialogs app", RepositoryConstants.CONFIG, "/modules/ui-admincentral/apps/stkDialogsApp", "icon"))
298 .addTask(new RemovePropertyTask("Remove hardcoded label", "Remove hardcoded label of STK Channels app", RepositoryConstants.CONFIG, "/modules/ui-admincentral/apps/stkChannelsApp", "label"))
299 .addTask(new RemovePropertyTask("Remove hardcoded icon", "Remove hardcoded icon of STK Channels app", RepositoryConstants.CONFIG, "/modules/ui-admincentral/apps/stkChannelsApp", "icon"))
300 .addTask(new RemovePropertyTask("Remove hardcoded label", "Remove hardcoded label of STK Template Def app", RepositoryConstants.CONFIG, "/modules/ui-admincentral/apps/stkTemplateDefsApp", "label"))
301 .addTask(new RemovePropertyTask("Remove hardcoded icon", "Remove hardcoded icon of STK Template Def app", RepositoryConstants.CONFIG, "/modules/ui-admincentral/apps/stkTemplateDefsApp", "icon"))
302 );
303
304 register(DeltaBuilder.update("2.7", "")
305 .addTask(new MigrationTasks("STK Migration", "A collection of update tasks to help migrating to STK 2.7."))
306 .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",
307 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")))
308 .addTask(new ReorderSTKAppsTask())
309 );
310
311 register(DeltaBuilder.update("2.7.1", "")
312 .addTask(new RemoveNodeTask("Remove obsolete tab", "Remove obsolete 'dependencies' tab", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/dialogs/generic/pages/tabDependencies"))
313 .addTask(new RemoveNodeTask("Remove redundant form configuration", "Remove redundant form configuration", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/dialogs/pages/article/stkArticleProperties/form"))
314 .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",
315 new SetPropertyTask(RepositoryConstants.CONFIG, "/modules/standard-templating-kit/dialogs/components/content/stkDownloadList/form/tabs/tabQuery/fields/link", "type", "String")))
316 );
317
318 register(DeltaBuilder.update("2.7.2", "")
319 .addTask(new NodeExistsDelegateTask("Remove redundant extras areas if exist", "Remove redundant extras areas if exist", RepositoryConstants.CONFIG,
320 "/modules/standard-templating-kit/templates/pages/demo-features/stkSectionWithTwoExtras/areas/extras/areas",
321 new RemoveNodeTask("Remove redundant extras areas", "Remove redundant extras areas", RepositoryConstants.CONFIG,
322 "/modules/standard-templating-kit/templates/pages/demo-features/stkSectionWithTwoExtras/areas/extras/areas")))
323 .addTask(new NodeExistsDelegateTask("Remove obsolete stkFooter component if exists", "Remove obsolete stkFooter component if exists", RepositoryConstants.CONFIG,
324 "/modules/standard-templating-kit/templates/components/footer/stkFooter",
325 new RemoveNodeTask("Remove obsolete stkFooter component", "Remove obsolete stkFooter component", RepositoryConstants.CONFIG,
326 "/modules/standard-templating-kit/templates/components/footer/stkFooter")))
327 );
328
329 register(DeltaBuilder.update("2.7.3", "")
330
331 .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))
332 .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))
333 .addTask(new BootstrapSingleModuleResource("Bootstrap the availability of the forum-page-template.", "Bootstraping the availability of the forum-page-template.", "config/site/config.modules.standard-templating-kit.config.site.templates.availability.templates.stkForum.xml", ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW))
334 .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))
335 .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))
336 .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))
337
338 .addTask(new AddMissingDefaultValuesToFieldsTask(Arrays.asList(
339 "/modules/standard-templating-kit/dialogs/components/features/stkEventsOverview/form/tabs/tabTeaser/fields/showAbstract",
340 "/modules/standard-templating-kit/dialogs/components/features/stkSiteMap/form/tabs/tabMain/fields/showSiteMapRoot",
341 "/modules/standard-templating-kit/dialogs/components/teasers/stkTeaserEventsList/form/tabs/tabTeaser/fields/showAbstract",
342 "/modules/standard-templating-kit/dialogs/functional/stkRedirect/form/tabs/tabRedirect/fields/hideInNav"
343 ), "defaultValue", "true"))
344
345 .addTask(new AddMissingDefaultValuesToFieldsTask(Arrays.asList(
346 "/modules/standard-templating-kit/dialogs/components/features/stkFAQ/form/tabs/tabMain/fields/useIndex",
347 "/modules/standard-templating-kit/dialogs/components/features/stkNewsOverview/form/tabs/tabTeaser/fields/hideTeaserImage",
348 "/modules/standard-templating-kit/dialogs/components/pur/stkPURLoginForm/form/tabs/tabTitleText/fields/showInfoText",
349 "/modules/standard-templating-kit/dialogs/components/teasers/stkTeaserNewsList/form/tabs/tabTeaser/fields/hideTeaserImage",
350 "/modules/standard-templating-kit/dialogs/generic/controls/hideInNav",
351 "/modules/standard-templating-kit/dialogs/generic/controls/inheritable",
352 "/modules/standard-templating-kit/dialogs/generic/teasers/hideTeaserImage",
353 "/modules/standard-templating-kit/dialogs/generic/teasers/highlighted"
354 ), "defaultValue", "false"))
355
356 .addTask(fixContactField)
357 );
358
359 register(DeltaBuilder.update("2.7.4", "")
360 .addTask(new NodeExistsDelegateTask("Add createAreaNode property with value false to htmlHeader area", AREAS_PROTOTYPE_PATH + "htmlHeader",
361 new SetPropertyTask("Add createAreaNode property with value false to htmlHeader area", RepositoryConstants.CONFIG, AREAS_PROTOTYPE_PATH + "htmlHeader", "createAreaNode", false)))
362 .addTask(new NodeExistsDelegateTask("Add createAreaNode property with value false to main area", AREAS_PROTOTYPE_PATH + "main",
363 new SetPropertyTask("Add createAreaNode property with value false to main area", RepositoryConstants.CONFIG, AREAS_PROTOTYPE_PATH + "main", "createAreaNode", false)))
364 .addTask(new NodeExistsDelegateTask("Add createAreaNode property with value false to intro area", AREAS_PROTOTYPE_PATH + "main/areas/intro",
365 new SetPropertyTask("Add createAreaNode property with value false to intro area", RepositoryConstants.CONFIG, AREAS_PROTOTYPE_PATH + "main/areas/intro", "createAreaNode", false)))
366 .addTask(new NodeExistsDelegateTask("Add createAreaNode property with value false to infoBlock area", AREAS_PROTOTYPE_PATH + "main/areas/intro/areas/infoBlock",
367 new SetPropertyTask("Add createAreaNode property with value false to infoBlock area", RepositoryConstants.CONFIG, AREAS_PROTOTYPE_PATH + "main/areas/intro/areas/infoBlock", "createAreaNode", false)))
368 .addTask(new NodeExistsDelegateTask("Add createAreaNode property with value false to breadcrumb area", AREAS_PROTOTYPE_PATH + "main/areas/breadcrumb",
369 new SetPropertyTask("Add createAreaNode property with value false to breadcrumb area", RepositoryConstants.CONFIG, AREAS_PROTOTYPE_PATH + "main/areas/breadcrumb", "createAreaNode", false)))
370 .addTask(new NodeExistsDelegateTask("Add createAreaNode property with value false to contentNavigation area", AREAS_PROTOTYPE_PATH + "main/areas/contentNavigation",
371 new SetPropertyTask("Add createAreaNode property with value false to contentNavigation area", RepositoryConstants.CONFIG, AREAS_PROTOTYPE_PATH + "main/areas/contentNavigation", "createAreaNode", false)))
372 .addTask(new NodeExistsDelegateTask("Add createAreaNode property with value false to branding area", AREAS_PROTOTYPE_PATH + "branding",
373 new SetPropertyTask("Add createAreaNode property with value false to branding area", RepositoryConstants.CONFIG, AREAS_PROTOTYPE_PATH + "branding", "createAreaNode", false)))
374 .addTask(new NodeExistsDelegateTask("Add createAreaNode property with value false to logo area", AREAS_PROTOTYPE_PATH + "branding/areas/logo",
375 new SetPropertyTask("Add createAreaNode property with value false to logo area", RepositoryConstants.CONFIG, AREAS_PROTOTYPE_PATH + "branding/areas/logo", "createAreaNode", false)))
376 .addTask(new NodeExistsDelegateTask("Add createAreaNode property with value false to search area", AREAS_PROTOTYPE_PATH + "branding/areas/search",
377 new SetPropertyTask("Add createAreaNode property with value false to search area", RepositoryConstants.CONFIG, AREAS_PROTOTYPE_PATH + "branding/areas/search", "createAreaNode", false)))
378 .addTask(new NodeExistsDelegateTask("Add createAreaNode property with value false to sectionHeader area", AREAS_PROTOTYPE_PATH + "sectionHeader",
379 new SetPropertyTask("Add createAreaNode property with value false to sectionHeader area", RepositoryConstants.CONFIG, AREAS_PROTOTYPE_PATH + "sectionHeader", "createAreaNode", false)))
380 );
381
382 register(DeltaBuilder.update("2.8", "")
383 .addTask(new NodeExistsDelegateTask("Change the path of DamTemplatingFunctions", "/modules/standard-templating-kit/renderers/stk/contextAttributes/damfn",
384 new CheckAndModifyPropertyValueTask("/modules/standard-templating-kit/renderers/stk/contextAttributes/damfn", "componentClass", "info.magnolia.dam.asset.functions.DamTemplatingFunctions", DamTemplatingFunctions.class.getName())))
385 .addTask(new NodeExistsDelegateTask("STK applauncher group", "This task updates ordering and color of the STK group in the applauncher.", RepositoryConstants.CONFIG, "/modules/ui-admincentral/config/appLauncherLayout/groups/stk",
386 new ArrayDelegateTask("",
387 new OrderNodeAfterTask("STK applauncher group ordering", "Moves the stk app group after the tools group", RepositoryConstants.CONFIG, "/modules/ui-admincentral/config/appLauncherLayout/groups/stk", "tools"),
388 new SetPropertyTask(RepositoryConstants.CONFIG, "/modules/ui-admincentral/config/appLauncherLayout/groups/stk", "color", "#ccd882"))))
389 .addTask(new ArrayDelegateTask("Modify prototype to include areas to insert scripts", "Modify prototype to include areas to insert scripts such as marketing tags",
390 new BootstrapSingleResource("Add area to contain scripts in prototype", "Add area to contain scripts in prototype, specifically in the header", "/mgnl-bootstrap/standard-templating-kit/config/site/config.modules.standard-templating-kit.config.site.templates.prototype.areas.headerScripts.xml"),
391 new BootstrapSingleResource("Add area to contain scripts in prototype", "Add area to contain scripts in prototype, specifically at the beginning of the body", "/mgnl-bootstrap/standard-templating-kit/config/site/config.modules.standard-templating-kit.config.site.templates.prototype.areas.bodyBeginScripts.xml"),
392 new BootstrapSingleResource("Add area to contain scripts in prototype", "Add area to contain scripts in prototype, specifically at the end of the body", "/mgnl-bootstrap/standard-templating-kit/config/site/config.modules.standard-templating-kit.config.site.templates.prototype.areas.bodyEndScripts.xml")))
393 .addTask(reconfigureLogoutTextField)
394 .addTask(new NodeExistsDelegateTask("Create new property i18nBasename at /modules/standard-templating-kit/dialogs/components/teasers/stkTeaserOpener with value info.magnolia.module.templatingkit.messages", STK_TEASER_OPENER,
395 new CheckOrCreatePropertyTask("Create new property i18nBasename at /modules/standard-templating-kit/dialogs/components/teasers/stkTeaserOpener with value info.magnolia.module.templatingkit.messages", STK_TEASER_OPENER, "i18nBasename", "info.magnolia.module.templatingkit.messages")))
396
397 .addTask(new NodeExistsDelegateTask("Remove the preview component of the Image gallery link field definition", "/modules/standard-templating-kit/dialogs/components/features/stkImageGallery/form/tabs/tabMain/fields/link/contentPreviewDefinition",
398 new RemoveNodeTask("", "/modules/standard-templating-kit/dialogs/components/features/stkImageGallery/form/tabs/tabMain/fields/link/contentPreviewDefinition")))
399 );
400
401 register(DeltaBuilder.update("2.8.2", "")
402 .addTask(new MoveIntenseDebateIdTask())
403 );
404
405 register(DeltaBuilder.update("2.8.3", "")
406 .addTask(new PartialBootstrapTask("Makes the stkPURAuthSubmit component available in groupFields", "Makes the stkPURAuthSubmit component which allows updating of a logged in user's profile available in groupFields", "/mgnl-bootstrap/standard-templating-kit/templates/components/pur/config.modules.standard-templating-kit.templates.components.pur.groupFields.xml", "/groupFields/areas/fields/availableComponents/stkPURAuthSubmit", ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW))
407 .addTask(new ChangeValidationToMultiValuedPropertyTask("Change validation fields of form field 'stkPUREdit' to multi-valued property", Arrays.asList("standard-templating-kit:components/pur/stkPUREdit")))
408 );
409
410 register(DeltaBuilder.update("2.8.6", "")
411 .addTask(new PartialBootstrapTask("Create a new field (form/tabs/tabQuery/fields/excludeDescendants)", "Creates a new field (form/tabs/tabQuery/fields/excludeDescendants) in stkDownloadList dialog.", "/mgnl-bootstrap/standard-templating-kit/dialogs/components/content/config.modules.standard-templating-kit.dialogs.components.content.stkDownloadList.xml", "/stkDownloadList/form/tabs/tabQuery/fields/excludeDescendants"))
412 .addTask(new NewPropertyTask("Create an i18nBasename property", "/modules/standard-templating-kit/dialogs/components/content/stkDownloadList", "i18nBasename", "info.magnolia.module.templatingkit.messages"))
413 );
414
415 register(DeltaBuilder.update("2.8.9", "")
416 .addTask(new NodeExistsDelegateTask("Add a validator to the field 'path' for the stkRedirect dialog.", "/modules/standard-templating-kit/dialogs/functional/stkRedirect/form/tabs/tabRedirect/fields/path",
417 new ArrayDelegateTask("", "",
418 new NodeExistsDelegateTask("", "/modules/standard-templating-kit/dialogs/functional/stkRedirect/form/tabs/tabRedirect/fields/path/validators", null,
419 new NodeBuilderTask("", "", ErrorHandling.logging, RepositoryConstants.CONFIG, "/modules/standard-templating-kit/dialogs/functional/stkRedirect/form/tabs/tabRedirect/fields/path",
420 addNode("validators", NodeTypes.ContentNode.NAME))
421 ),
422 new NodeExistsDelegateTask("", "/modules/standard-templating-kit/dialogs/functional/stkRedirect/form/tabs/tabRedirect/fields/path/validators/redirectTargetValidator", null,
423 new PartialBootstrapTask("", "/mgnl-bootstrap/standard-templating-kit/dialogs/functional/config.modules.standard-templating-kit.dialogs.functional.stkRedirect.xml", "/stkRedirect/form/tabs/tabRedirect/fields/path/validators/redirectTargetValidator")
424 )
425 )))
426 );
427
428 register(DeltaBuilder.update("2.9", "")
429 .addTask(new PropertyExistsDelegateTask("Remove deprecated AutoGeneratedExtrasArea from templates", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/stkEventsOverview/areas/extras", "class",
430 new RemovePropertyTask("Remove deprecated AutoGeneratedExtrasArea from templates", "/modules/standard-templating-kit/templates/pages/stkEventsOverview/areas/extras", "class")))
431 .addTask(new NodeExistsDelegateTask("Remove deprecated stkSectionNoIntroWithHeader from demo-features templates", "", RepositoryConstants.CONFIG, "/modules/standard-templating-kit/templates/pages/demo-features/stkSectionNoIntroWithHeader",
432 new RemoveNodeTask("Remove deprecated stkSectionNoIntroWithHeader from demo-features templates", "/modules/standard-templating-kit/templates/pages/demo-features/stkSectionNoIntroWithHeader")))
433 .addTask(new RemoveTreeTemplatesTask())
434 .addTask(new NodeExistsDelegateTask("Re-Bootstrap stkCategoryOverview component if it exists", "/modules/standard-templating-kit/templates/components/features/stkCategoryOverview",
435 new BootstrapSingleResource("", "", "/info/magnolia/module/standard-templating-kit/setup/categorization/config.modules.standard-templating-kit.templates.components.features.stkCategoryOverview.xml", ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING)))
436 .addTask(new NodeExistsDelegateTask("Re-Bootstrap stkRelatedCategoriesLinkList component if it exists", "/modules/standard-templating-kit/templates/components/features/stkRelatedCategoriesLinkList",
437 new BootstrapSingleResource("", "", "/info/magnolia/module/standard-templating-kit/setup/categorization/config.modules.standard-templating-kit.templates.components.features.stkRelatedCategoriesLinkList.xml", ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING)))
438 .addTask(new NodeExistsDelegateTask("Re-Bootstrap stkCategoryOverview page if it exists", "/modules/standard-templating-kit/templates/pages/stkCategoryOverview",
439 new BootstrapSingleResource("", "", "/info/magnolia/module/standard-templating-kit/setup/categorization/config.modules.standard-templating-kit.templates.pages.stkCategoryOverview.xml", ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING)))
440 .addTask(new NodeExistsDelegateTask("Bootstrap stkTemplateContent feed generator if it doesn't exists", "/modules/rssaggregator/config/feedGenerators/stkTemplateContent", null,
441 new BootstrapSingleResource("", "", "/mgnl-bootstrap/standard-templating-kit/config.modules.rssaggregator.config.feedGenerators.stkTemplateContent.xml", ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW)))
442 .addTask(new MigrateTemplateTypesTask())
443 .addTask(new NodeExistsDelegateTask("Remove stkCategoryOverview dialog", "/modules/standard-templating-kit/dialogs/components/features/stkCategoryOverview",
444 new RemoveNodeTask("", "/modules/standard-templating-kit/dialogs/components/features/stkCategoryOverview")))
445 .addTask(new NodeExistsDelegateTask("Remove stkRelatedCategoriesLinkList dialog", "/modules/standard-templating-kit/dialogs/components/features/stkRelatedCategoriesLinkList",
446 new RemoveNodeTask("", "/modules/standard-templating-kit/dialogs/components/features/stkRelatedCategoriesLinkList")))
447 .addTask(new NodeExistsDelegateTask("Remove relatedCategoriesLinkList template", "Removes relatedCategoriesLinkList template from templates workspace", "templates", "/templating-kit/components/features/relatedCategoriesLinkList",
448 new RemoveNodeTask("", "", "templates", "/templating-kit/components/features/relatedCategoriesLinkList")))
449 .addTask(new NodeExistsDelegateTask("Re-Bootstrap stkCategoryOverviewProperties", "/modules/standard-templating-kit/dialogs/pages/categoryOverview/stkCategoryOverviewProperties",
450 new BootstrapSingleResource("", "", "/info/magnolia/module/standard-templating-kit/setup/categorization/config.modules.standard-templating-kit.dialogs.pages.categoryOverview.stkCategoryOverviewProperties.xml", ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING)))
451 .addTask(setStkSiteAsActiveInSiteModule)
452 .addTask(new NodeExistsDelegateTask("Re-Configure asset provider from DAM", "", RepositoryConstants.CONFIG, "/modules/dam/config/providers/jcrProvider",
453 new CheckAndModifyPropertyValueTask("", "", RepositoryConstants.CONFIG, "/modules/dam/config/providers/jcrProvider", "class", "info.magnolia.module.templatingkit.dam.RenditionAwareJcrAssetProvider", JcrAssetProvider.class.getName())))
454 .addTask(new NodeExistsDelegateTask("Remove STKAssetRenderer", "", RepositoryConstants.CONFIG, "/modules/dam/config/renderers/stkJcrRenderer",
455 new RemoveNodeTask("", "/modules/dam/config/renderers/stkJcrRenderer")))
456 .addTask(new NodeExistsDelegateTask("Remove migrated STKAssetRenderer", "When dam-imaging is installed stkJcrRenderer is not required anymore",
457 RepositoryConstants.CONFIG, "/modules/dam/config/providers/jcrProvider/renderers/stkJcrRenderer",
458 new IsModuleInstalledOrRegistered("", "dam-imaging", new RemoveNodeTask("", "/modules/dam/config/providers/jcrProvider/renderers/stkJcrRenderer"))))
459 .addTask(new MigrateResourcesTask(
460 "/modules/standard-templating-kit/config/site/templates/prototype/jsFiles",
461 "/modules/standard-templating-kit/config/site/templates/prototype/cssFiles",
462 "/modules/standard-templating-kit/templates/pages/stkForum/cssFiles"))
463 );
464
465 register(DeltaBuilder.update("2.9.1", "")
466 .addTask(new AddSTKRolesToRelevantAppsTask())
467 .addTask(new NodeExistsDelegateTask("Bootstrap i18n configuration", "/modules/standard-templating-kit/config/site/i18n", null,
468 new BootstrapSingleModuleResource("config/site/config.modules.standard-templating-kit.config.site.i18n.xml")))
469 .addTask(new IsModuleInstalledOrRegistered("Set STK as a fallback site if possible", "multisite",
470 new ArrayDelegateTask("",
471 new NodeExistsDelegateTask("", "/modules/multisite/config/sites/default",
472 new ArrayDelegateTask("",
473 new NodeExistsDelegateTask("", "/modules/multisite/config/sites/fallback",
474 new PropertyExistsDelegateTask("name", "/modules/multisite/config/sites/fallback", "extends",
475 new CheckAndModifyPropertyValueTask("/modules/multisite/config/sites/fallback", "extends", "../travel", "../default"),
476 new SetPropertyTask(RepositoryConstants.CONFIG, "/modules/multisite/config/sites/fallback", "extends", "../default"))),
477 new CheckOrCreatePropertyTask("", "/modules/multisite/config/sites/default/templates/prototype", "class", "info.magnolia.module.templatingkit.templates.pages.STKPage"),
478 new CheckOrCreatePropertyTask("", "/modules/multisite/config/sites/default", "class", "info.magnolia.module.templatingkit.sites.Site"))),
479 new NodeExistsDelegateTask("stkSiteApp might have been removed in the meantime", "/modules/ui-admincentral/apps/stkSiteApp/subApps/browser/contentConnector",
480 new CheckAndModifyPropertyValueTask("/modules/ui-admincentral/apps/stkSiteApp/subApps/browser/contentConnector", "rootPath", "/modules/standard-templating-kit/config/site", "/modules/multisite/config/sites")),
481 stkForumMigrationTask)))
482 );
483
484 register(DeltaBuilder.update("2.9.2", "")
485 .addTask(new CheckOrCreatePropertyTask("Set class property for prototype in stk site", "/modules/standard-templating-kit/config/site/templates/prototype", "class", "info.magnolia.module.templatingkit.templates.pages.STKPage"))
486 .addTask(new CheckOrCreatePropertyTask("Set class property for site in stk", "/modules/standard-templating-kit/config/site", "class", "info.magnolia.module.templatingkit.sites.Site"))
487 .addTask(new RemoveSTKSiteFromSiteModule())
488 .addTask(new NodeExistsDelegateTask("Only set the extends property for the site when it was previously removed", "/modules/site/config/site", null,
489 new ArrayDelegateTask("",
490 new CreateNodeTask("", "/modules/site/config", "site", NodeTypes.ContentNode.NAME),
491 new CheckOrCreatePropertyTask("", "/modules/site/config/site", "extends", "/modules/standard-templating-kit/config/site"))))
492 );
493
494 register(DeltaBuilder.update("2.9.3", "")
495 .addTask(new ArrayDelegateTask("Fix mismatches in FlashCanvas resources",
496 new NodeExistsDelegateTask("", "", JcrResourceOrigin.RESOURCES_WORKSPACE, "/templating-kit/js/shims/FlashCanvas/flashcanvas",
497 new ArrayDelegateTask("",
498 new RemoveNodeTask("", "", JcrResourceOrigin.RESOURCES_WORKSPACE, "/templating-kit/js/shims/FlashCanvas/flashcanvas"),
499 new InstallBinaryResourceTask("/templating-kit/js/shims/FlashCanvas/flashcanvas.swf", null, null, null, false, false),
500 new InstallTextResourceTask("/templating-kit/js/shims/FlashCanvas/flashcanvas.js", ResourceTypes.JS, InstallTextResourceTask.DEFAULT_ENCODING, null, null, null, null, false, false)
501 )),
502 new NodeExistsDelegateTask("", "", JcrResourceOrigin.RESOURCES_WORKSPACE, "/templating-kit/js/shims/FlashCanvas/canvas2png",
503 new ArrayDelegateTask("",
504 new RemoveNodeTask("", "", JcrResourceOrigin.RESOURCES_WORKSPACE, "/templating-kit/js/shims/FlashCanvas/canvas2png"),
505 new InstallTextResourceTask("/templating-kit/js/shims/FlashCanvas/canvas2png.js", ResourceTypes.JS, InstallTextResourceTask.DEFAULT_ENCODING, null, null, null, null, false, false)
506 ))
507 ))
508 .addTask(new ArrayDelegateTask("Restore extensions for STK resources",
509 new ResourceCleanUpTask("", "/templating-kit/js/*.swf", Pattern.compile(DEFAULT_JS_PATH + SWF_PATTERN), new UpdateResourceReferencesTask("")),
510 new ResourceCleanUpTask("", "/templating-kit/js/*.js", Pattern.compile(DEFAULT_JS_PATH + JS_PATTERN), new UpdateResourceReferencesTask("")),
511 new ResourceCleanUpTask("", "InstallSTKResourcesTask#specialResources", getFullSpecialResourcesPaths(), new UpdateResourceReferencesTask("")),
512 new ResourceCleanUpTask("", "InstallSTKResourcesTask#processedScripts", getFullProcessedScriptsPaths(), new UpdateResourceReferencesTask(""))
513 )
514 )
515 .addTask(new IsModuleInstalledOrRegistered("Check site app module has been installed", "site-app",
516 new NodeExistsDelegateTask("Check if site app has been configured in launcher", "/modules/ui-admincentral/config/appLauncherLayout/groups/stk/apps/site",
517 new ArrayDelegateTask("Remove legacy theme app and site definition app from launcher",
518 new RemoveNodeTask("Remove stkSiteApp out of launcher", "/modules/ui-admincentral/config/appLauncherLayout/groups/stk/apps/stkSiteApp"),
519 new RemoveNodeTask("Remove stkThemesApp out of launcher", "/modules/ui-admincentral/config/appLauncherLayout/groups/stk/apps/stkThemesApp")))))
520 );
521
522 register(DeltaBuilder.update("3.0", "")
523 .addTask(new NodeExistsDelegateTask("Remove unused legacy property 'saveHandler'", "/modules/standard-templating-kit/dialogs/generic/pages/tabChannels/fields/excludeChannels",
524 new RemovePropertyTask("", "/modules/standard-templating-kit/dialogs/generic/pages/tabChannels/fields/excludeChannels", "saveHandler"))));
525
526 register(DeltaBuilder.update("3.0.1", "")
527 .addTask(new NodeExistsDelegateTask("Update 'tabLogin' in dialog 'stkPURLoginForm'", "/modules/standard-templating-kit/dialogs/components/pur/stkPURLoginForm",
528 new BootstrapSingleResource("", "", "/mgnl-bootstrap/standard-templating-kit/dialogs/components/pur/config.modules.standard-templating-kit.dialogs.components.pur.stkPURLoginForm.xml", ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING)))
529
530 .addTask(new PropertyExistsDelegateTask("Update template 'stkPURAuthSubmit'", "/modules/standard-templating-kit/templates/components/pur/stkPURAuthSubmit", "modelClass",
531 new RemovePropertyTask("", "/modules/standard-templating-kit/templates/components/pur/stkPURAuthSubmit", "modelClass")))
532 .addTask(new PropertyExistsDelegateTask("Update template 'stkPURNotAuthSubmit'", "/modules/standard-templating-kit/templates/components/pur/stkPURNotAuthSubmit", "modelClass",
533 new RemovePropertyTask("", "/modules/standard-templating-kit/templates/components/pur/stkPURNotAuthSubmit", "modelClass")))
534 .addTask(new PropertyExistsDelegateTask("Update template 'stkPURIntranet'", "/modules/standard-templating-kit/templates/components/pur/stkPURIntranet", "modelClass",
535 new RemovePropertyTask("", "/modules/standard-templating-kit/templates/components/pur/stkPURIntranet", "modelClass")))
536
537 .addTask(new PropertyExistsDelegateTask("Update template 'stkPURLoginForm'", "/modules/standard-templating-kit/templates/components/pur/stkPURLoginForm", "modelClass",
538 new RemovePropertyTask("", "/modules/standard-templating-kit/templates/components/pur/stkPURLoginForm", "modelClass")))
539
540 .addTask(new NodeExistsDelegateTask("Update template 'stkPURPasswordChangeForm'", "/modules/standard-templating-kit/templates/components/pur/stkPURPasswordChangeForm",
541 new CheckAndModifyPropertyValueTask("/modules/standard-templating-kit/templates/components/pur/stkPURPasswordChangeForm", "modelClass",
542 "info.magnolia.module.publicuserregistration.frontend.action.RegistrationModel", "info.magnolia.module.form.templates.components.FormModel")))
543 .addTask(new NodeExistsDelegateTask("Update template 'stkPURPasswordForm'", "/modules/standard-templating-kit/templates/components/pur/stkPURPasswordForm",
544 new CheckAndModifyPropertyValueTask("/modules/standard-templating-kit/templates/components/pur/stkPURPasswordForm", "modelClass",
545 "info.magnolia.module.publicuserregistration.frontend.action.RegistrationModel", "info.magnolia.module.form.templates.components.FormModel")))
546 .addTask(new NodeExistsDelegateTask("Update template 'stkPURRegistrationForm'", "/modules/standard-templating-kit/templates/components/pur/stkPURRegistrationForm",
547 new CheckAndModifyPropertyValueTask("/modules/standard-templating-kit/templates/components/pur/stkPURRegistrationForm", "modelClass",
548 "info.magnolia.module.publicuserregistration.frontend.action.RegistrationModel", "info.magnolia.module.form.templates.components.FormModel")))
549 .addTask(new NodeExistsDelegateTask("Update template 'stkPURUpdateForm'", "/modules/standard-templating-kit/templates/components/pur/stkPURUpdateForm",
550 new CheckAndModifyPropertyValueTask("/modules/standard-templating-kit/templates/components/pur/stkPURUpdateForm", "modelClass",
551 "info.magnolia.module.publicuserregistration.frontend.action.RegistrationModel", "info.magnolia.module.form.templates.components.FormModel")))
552
553 .addTask(new NodeExistsDelegateTask("Add new double-opt-in form template", "/modules/standard-templating-kit/templates/components/pur/stkPURDoubleOptInForm", null,
554 new BootstrapSingleResource("", "", "/mgnl-bootstrap/standard-templating-kit/templates/components/pur/config.modules.standard-templating-kit.templates.components.pur.stkPURDoubleOptInForm.xml")))
555 .addTask(new NodeExistsDelegateTask("Add new double-opt-in form dialog", "/modules/standard-templating-kit/dialogs/components/pur/stkPURDoubleOptInForm", null,
556 new BootstrapSingleResource("", "", "/mgnl-bootstrap/standard-templating-kit/dialogs/components/pur/config.modules.standard-templating-kit.dialogs.components.pur.stkPURDoubleOptInForm.xml")))
557 .addTask(new NodeExistsDelegateTask("Add new double-opt-in form to component availability of PUR page template", "/modules/standard-templating-kit/templates/pages/stkPublicUserRegistration/areas/main/areas/content/availableComponents/stkPURDoubleOptInForm", null,
558 new PartialBootstrapTask("", "/mgnl-bootstrap/standard-templating-kit/templates/pages/config.modules.standard-templating-kit.templates.pages.stkPublicUserRegistration.xml",
559 "/stkPublicUserRegistration/areas/main/areas/content/availableComponents/stkPURDoubleOptInForm")))
560
561 .addTask(new RemovePropertiesTask("Remove legacy properties from configuration", RepositoryConstants.CONFIG, Arrays.asList(
562 "/modules/standard-templating-kit/dialogs/generic/controls/inheritable/selected",
563 "/modules/standard-templating-kit/dialogs/generic/controls/hideInNav/selected",
564 "/modules/standard-templating-kit/dialogs/generic/teasers/hideTeaserImage/selected",
565 "/modules/standard-templating-kit/dialogs/generic/teasers/highlighted/selected",
566 "/modules/standard-templating-kit/dialogs/functional/stkRedirect/form/tabs/tabRedirect/fields/hideInNav/selected",
567 "/modules/standard-templating-kit/dialogs/components/teasers/stkTeaserEventsList/form/tabs/tabTeaser/fields/showAbstract/selected",
568 "/modules/standard-templating-kit/dialogs/components/teasers/stkTeaserNewsList/form/tabs/tabTeaser/fields/hideTeaserImage/selected",
569 "/modules/standard-templating-kit/dialogs/components/features/stkEventsOverview/form/tabs/tabTeaser/fields/showAbstract/selected",
570 "/modules/standard-templating-kit/dialogs/components/features/stkFAQ/form/tabs/tabMain/fields/useIndex/selected",
571 "/modules/standard-templating-kit/dialogs/components/features/stkNewsOverview/form/tabs/tabTeaser/fields/hideTeaserImage/selected",
572 "/modules/standard-templating-kit/dialogs/components/features/stkSiteMap/form/tabs/tabMain/fields/showSiteMapRoot/selected",
573
574 "/modules/standard-templating-kit/dialogs/components/features/stkFAQ/form/tabs/tabMain/fields/indexString/lineSemi",
575 "/modules/standard-templating-kit/dialogs/components/features/stkSiteMap/form/tabs/tabMain/fields/link/lineSemi",
576
577 "/modules/standard-templating-kit/dialogs/pages/home/stkHomeProperties/form/tabs/tabMain/fields/searchUUID/labelDescription",
578 "/modules/standard-templating-kit/dialogs/components/features/stkSiteMap/form/tabs/tabMain/fields/link/labelDescription",
579 "/modules/standard-templating-kit/dialogs/components/features/stkSiteMap/form/tabs/tabMain/fields/showSiteMapRoot/labelDescription",
580 "/modules/standard-templating-kit/dialogs/components/features/stkFAQ/form/tabs/tabMain/fields/indexString/labelDescription",
581 "/modules/standard-templating-kit/dialogs/components/features/stkFAQ/form/tabs/tabMain/fields/useIndex/labelDescription",
582
583 "/modules/standard-templating-kit/dialogs/components/teasers/stkTeaserContact/form/tabs/tabTeaser/fields/contact/tree",
584
585 "/modules/standard-templating-kit/dialogs/pages/home/stkHomeProperties/form/tabs/tabMain/fields/searchUUID/path",
586
587 "/modules/standard-templating-kit/dialogs/components/features/stkSiteMap/form/tabs/tabMain/fields/titleToUse/cols"
588 ), true))
589 );
590
591 final UpdateResourceReferencesTask updateResourceReferencesTask = new UpdateResourceReferencesTask("Migrate references to /templating-kit/js/libs/swfobject.js");
592 updateResourceReferencesTask.setChangedPaths(new HashMap<String, String>() {{
593 put("/templating-kit/js/libs/swfobject", "/templating-kit/js/libs/swfobject.js");
594 }});
595
596 register(DeltaBuilder.update("3.0.3", "")
597 .addTask(new ArrayDelegateTask("Fix XSS issue in /resources/templating-kit/js/scriptloader-plugin.js", "Fix XSS issue in /resources/templating-kit/js/scriptloader-plugin.js",
598 new NodeExistsDelegateTask("", "", JcrResourceOrigin.RESOURCES_WORKSPACE, "/templating-kit/js/libs/swfobject", new ArrayDelegateTask("",
599 new RenameNodeTask("", JcrResourceOrigin.RESOURCES_WORKSPACE, "/templating-kit/js/libs/", "swfobject", "swfobject.js", false),
600 updateResourceReferencesTask
601 )),
602 new InstallTextResourceTask("/templating-kit/js/libs/swfobject.js", ResourceTypes.JS, InstallTextResourceTask.DEFAULT_ENCODING, null, null, null, null, true, false),
603 new RemovePropertyTask("", "", JcrResourceOrigin.RESOURCES_WORKSPACE, "/templating-kit/js/libs/swfobject.js", "extension"),
604 new AddVersionToResourceTask("/modules", "/resources/templating-kit/js/scriptloader-plugin.js", "2.0"),
605 new AddVersionToResourceTask("/modules", "/resources/templating-kit/js/mobile-scriptloader-plugin.js", "2.0")
606 ))
607 );
608 }
609
610 private Map<String, String[]> getAclsToAppsPermissionsMap() {
611 Map<String, String[]> permissionsMap = new HashMap<String, String[]>();
612
613 permissionsMap.put("/modules/adminInterface/config/menu/templating-kit/etkSites", new String[]{"/modules/ui-admincentral/apps/stkSiteApp"});
614 permissionsMap.put("/modules/adminInterface/config/menu/templating-kit/stkThemes", new String[]{"/modules/ui-admincentral/apps/stkThemesApp"});
615 permissionsMap.put("/modules/adminInterface/config/menu/templating-kit/stkDialogs", new String[]{"/modules/ui-admincentral/apps/stkDialogsApp"});
616 permissionsMap.put("/modules/adminInterface/config/menu/templating-kit/stkChannels", new String[]{"/modules/ui-admincentral/apps/stkChannelsApp"});
617 permissionsMap.put("/modules/adminInterface/config/menu/templating-kit/stkTemplateDefs", new String[]{"/modules/ui-admincentral/apps/stkTemplateDefsApp"});
618
619 return permissionsMap;
620 }
621
622 @Override
623 protected List<Task> getExtraInstallTasks(InstallContext ctx) {
624 final List<Task> tasks = new ArrayList<Task>();
625 tasks.addAll(super.getExtraInstallTasks(ctx));
626 tasks.add(new InstallSTKResourcesTask());
627
628
629 tasks.add(new AbstractRepositoryTask("Order templates", "") {
630 @Override
631 protected void doExecute(InstallContext ctx) throws RepositoryException, TaskExecutionException {
632 Content templatesNodes = ctx.getConfigHierarchyManager().getContent("/modules/standard-templating-kit/templates/pages");
633 ContentUtil.orderNodes(templatesNodes, new String[]{"stkHome", "stkSection", "stkArticle", "stkLargeArticle", "stkNews", "stkEvent", "stkImageGallery", "stkFAQ", "stkForm", "stkSearchResult", "stkSiteMap", "stkRedirect"});
634 }
635 });
636
637 tasks.add(new RemoveETKParagraphs());
638
639 tasks.add(new WarnTask("SMTP Configuration", "Please set the config: /modules/mail/config/smtp to a valid smtp configuration"));
640 tasks.add(new IsModuleInstalledOrRegistered("Use of commenting module", "Use of commenting module by default in STK", "commenting",
641 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")));
642 tasks.add(new STKLegacyUiToMagnolia5AppProviderTask("Provide STK with a Magnolia 5 UI", "Turns legacy UI into a Magnolia 5 browser app."));
643 tasks.add(new OrderNodeAfterTask("STK AppLauncher group ordering", "Moves the stk app group after the tools group", RepositoryConstants.CONFIG, "/modules/ui-admincentral/config/appLauncherLayout/groups/stk", "tools"));
644 tasks.add(new ReorderSTKAppsTask());
645 tasks.add(new ModuleDependencyBootstrapTask("contacts"));
646 tasks.add(new ModuleDependencyBootstrapTask("categorization"));
647 tasks.add(setStkSiteAsActiveInSiteModule);
648 tasks.add(new IsModuleInstalledOrRegistered("Configure STK site for multisite", "multisite",
649 new NodeExistsDelegateTask("Check if stk can be moved to the multisite", "/modules/standard-templating-kit/config/site",
650 new ArrayDelegateTask("", "",
651 new NodeExistsDelegateTask("Check for default site", "Check whether default site already exists or not - if no, site from stk will be copied to multisite", RepositoryConstants.CONFIG, "/modules/multisite/config/sites/default",
652 new WarnTask("Default already site exists", "Default site already exists. No actions will be taken."),
653 new ArrayDelegateTask("", "",
654 new CreateNodePathTask("", "/modules/multisite/config/sites/", NodeTypes.ContentNode.NAME),
655 new CopyNodeTask("Default site configuration", "Copy the configuration of the STK site", "config", "/modules/standard-templating-kit/config/site", "/modules/multisite/config/sites/default", false),
656 new ModuleDependencyBootstrapTask("multisite"),
657 new CheckOrCreatePropertyTask("Add class property to legacy site", "/modules/multisite/config/sites/default", "class", "info.magnolia.module.templatingkit.sites.Site"),
658 new SetPropertyTask("config", "/modules/multisite/config/sites/default", "label", "Default"))),
659 new NodeExistsDelegateTask("", "/modules/multisite/config/sites/fallback",
660 new NodeExistsDelegateTask("", "/modules/multisite/config/sites/default",
661 new PropertyExistsDelegateTask("name", "/modules/multisite/config/sites/fallback", "extends",
662 new CheckAndModifyPropertyValueTask("/modules/multisite/config/sites/fallback", "extends", "../travel", "../default"),
663 new SetPropertyTask(RepositoryConstants.CONFIG, "/modules/multisite/config/sites/fallback", "extends", "../default"))))))));
664 tasks.add(new AddSTKRolesToRelevantAppsTask());
665 return tasks;
666 }
667
668 @Override
669 protected List<Task> getDefaultUpdateTasks(Version forVersion) {
670 final List<Task> tasks = new ArrayList<Task>();
671 tasks.addAll(super.getDefaultUpdateTasks(forVersion));
672 return tasks;
673 }
674
675 private Set<String> getFullSpecialResourcesPaths() {
676 List<String> keys = Lists.transform(Arrays.asList(InstallSTKResourcesTask.specialResources), new Function<String[], String>() {
677 @Override
678 public String apply(String[] input) {
679 return DEFAULT_JS_PATH + input[0];
680 }
681 });
682 return Sets.newHashSet(keys);
683 }
684
685 private Set<String> getFullProcessedScriptsPaths() {
686 List<String> keys = Lists.transform(Arrays.asList(InstallSTKResourcesTask.processedScripts), new Function<String, String>() {
687 @Override
688 public String apply(String input) {
689 return DEFAULT_JS_PATH + input;
690 }
691 });
692 return Sets.newHashSet(keys);
693 }
694 }