Skip to content

Commit

Permalink
Introduce webpage templates & three collection pages (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
mukil committed Jan 3, 2021
1 parent 16c8806 commit cdd0f7e
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package de.mikromedia.webpages.migrations;


import de.mikromedia.webpages.WebpagePlugin;
import systems.dmx.accesscontrol.AccessControlService;
import systems.dmx.core.CompDef;
import static systems.dmx.core.Constants.ONE;
import systems.dmx.core.Topic;
import systems.dmx.core.TopicType;
import systems.dmx.core.ViewConfig;
import systems.dmx.core.service.Inject;
import systems.dmx.core.service.Migration;
import systems.dmx.workspaces.WorkspacesService;

public class Migration11 extends Migration {
/**
*
* @author MRG
*/
public class Migration10 extends Migration {

@Inject WorkspacesService workspaces;
@Inject AccessControlService accessControlService;
Expand All @@ -21,23 +23,8 @@ public class Migration11 extends Migration {
public void run () {

// Defunct: Hook in two custom webclient renderers (?)
// Assign new default pages
Topic webpagesWs = workspaces.getWorkspace(WebpagePlugin.WEBPAGES_WS_URI);
Topic bookmarksPage = dmx.getTopicByUri("de.mikromedia.bookmarks.page");
Topic contactsPage = dmx.getTopicByUri("de.mikromedia.contacts.page");
Topic notesPage = dmx.getTopicByUri("de.mikromedia.notes.page");
Topic promutCss = dmx.getTopicByUri("de.mikromedia.iass_promut_style");
workspaces.assignToWorkspace(bookmarksPage, webpagesWs.getId());
workspaces.assignToWorkspace(contactsPage, webpagesWs.getId());
workspaces.assignToWorkspace(notesPage, webpagesWs.getId());
workspaces.assignToWorkspace(promutCss, webpagesWs.getId());
// Add "Page Template" value to "Webpage"
TopicType webpage = dmx.getTopicType("de.mikromedia.page");
TopicType pageTemplate = dmx.getTopicType("de.mikromedia.page.template");
webpage.addCompDef(mf.newCompDefModel(webpage.getUri(), pageTemplate.getUri(), ONE));
workspaces.assignTypeToWorkspace(webpage, webpagesWs.getId());
// ### Todo: Migrate default "page" template into all existing "Webpage" topics
ViewConfig styleConfig = pageTemplate.getViewConfig();
/** ViewConfig styleConfig = pageTemplate.getViewConfig();
styleConfig.setConfigValueRef("dmx.webclient.view_config", "dmx.webclient.widget", "dmx.webclient.select");
webpage.removeCompDef("de.mikromedia.page.author_name");
// Removing "Author Name" from "Webpage" topic
Expand All @@ -47,7 +34,7 @@ public void run () {
Topic mapWidget = dmx.getTopicByUri("de.mikromedia.layout.map_widget");
mapWidget.delete();
Topic embed = dmx.getTopicByUri("de.mikromedia.layout.embed");
embed.delete();
embed.delete(); **/
// Authors/Contributors
// User Profile
// Rename Topics
Expand Down
39 changes: 39 additions & 0 deletions src/main/java/de/mikromedia/webpages/migrations/Migration9.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package de.mikromedia.webpages.migrations;


import de.mikromedia.webpages.WebpagePlugin;
import systems.dmx.accesscontrol.AccessControlService;
import static systems.dmx.core.Constants.ONE;
import systems.dmx.core.Topic;
import systems.dmx.core.TopicType;
import systems.dmx.core.service.Inject;
import systems.dmx.core.service.Migration;
import systems.dmx.workspaces.WorkspacesService;

public class Migration9 extends Migration {

@Inject WorkspacesService workspaces;
@Inject AccessControlService accessControlService;

@Override
public void run () {

// Assign new default pages
Topic webpagesWs = dmx.getPrivilegedAccess().getWorkspace(WebpagePlugin.WEBPAGES_WS_URI);
Topic bookmarksPage = dmx.getTopicByUri("de.mikromedia.bookmarks.page");
Topic contactsPage = dmx.getTopicByUri("de.mikromedia.contacts.page");
Topic notesPage = dmx.getTopicByUri("de.mikromedia.notes.page");
Topic promutCss = dmx.getTopicByUri("de.mikromedia.promut_style");
workspaces.assignToWorkspace(bookmarksPage, webpagesWs.getId());
workspaces.assignToWorkspace(contactsPage, webpagesWs.getId());
workspaces.assignToWorkspace(notesPage, webpagesWs.getId());
workspaces.assignToWorkspace(promutCss, webpagesWs.getId());
// Add "Page Template" value to "Webpage"
TopicType webpage = dmx.getTopicType("de.mikromedia.page");
TopicType pageTemplate = dmx.getTopicType("de.mikromedia.page.template");
webpage.addCompDef(mf.newCompDefModel(webpage.getUri(), pageTemplate.getUri(), ONE));
workspaces.assignTypeToWorkspace(webpage, webpagesWs.getId());

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@
}
],
"topics": [
{
"typeUri": "de.mikromedia.site.stylesheet",
"uri" : "de.mikromedia.iass_promut_style",
"value": "/de.mikromedia.webpages/static/css/promut.css"
},
{
"typeUri": "de.mikromedia.page.template",
"uri" : "de.mikromedia.template_page",
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
dmx.plugin.dependencies=systems.dmx.workspaces,systems.dmx.accesscontrol,systems.dmx.files,systems.dmx.bookmarks
dmx.plugin.model_version=7
dmx.plugin.model_version=9

0 comments on commit cdd0f7e

Please sign in to comment.