New authoring kit annotiation for MVC based authoring steps

Former-commit-id: 6c76578621c2f384d699f2eb3b7bf476f3db2591
pull/10/head
Jens Pelzetter 2021-03-09 20:47:07 +01:00
parent 69f246f8a1
commit faf1ce622a
9 changed files with 139 additions and 1 deletions

View File

@ -39,6 +39,10 @@ import org.librecms.CmsConstants;
import static org.librecms.CmsConstants.*; import static org.librecms.CmsConstants.*;
import org.librecms.contentsection.ContentItem; import org.librecms.contentsection.ContentItem;
import org.librecms.ui.contentsections.documents.MvcArticleCreateStep;
import org.librecms.ui.contentsections.documents.MvcArticlePropertiesStep;
import org.librecms.ui.contentsections.documents.MvcArticleTextBodyStep;
import org.librecms.ui.contentsections.documents.MvcAuthoringKit;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@ -71,6 +75,13 @@ import javax.xml.bind.annotation.XmlRootElement;
order = 2 order = 2
) )
}) })
@MvcAuthoringKit(
createStep = MvcArticleCreateStep.class,
authoringSteps = {
MvcArticlePropertiesStep.class,
MvcArticleTextBodyStep.class
}
)
@XmlRootElement(name = "article", namespace = CMS_XML_NS) @XmlRootElement(name = "article", namespace = CMS_XML_NS)
public class Article extends ContentItem implements Serializable { public class Article extends ContentItem implements Serializable {

View File

@ -624,6 +624,7 @@ public class DocumentFolderController {
); );
row.setDeletable(!itemManager.isLive(contentItem)); row.setDeletable(!itemManager.isLive(contentItem));
row.setFolder(false); row.setFolder(false);
row.setFolderPath(itemManager.getItemPath(contentItem));
row.setLanguages( row.setLanguages(
new TreeSet<>( new TreeSet<>(
itemL10NManager itemL10NManager

View File

@ -0,0 +1,14 @@
/*
* 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 org.librecms.ui.contentsections.documents;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public class MvcArticleCreateStep implements MvcDocumentCreateStep {
}

View File

@ -0,0 +1,21 @@
/*
* 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 org.librecms.ui.contentsections.documents;
import javax.enterprise.context.RequestScoped;
import javax.mvc.Controller;
import javax.ws.rs.Path;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@RequestScoped
@Controller
@Path("/")
public class MvcArticlePropertiesStep implements MvcAuthoringStep {
}

View File

@ -0,0 +1,21 @@
/*
* 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 org.librecms.ui.contentsections.documents;
import javax.enterprise.context.RequestScoped;
import javax.mvc.Controller;
import javax.ws.rs.Path;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@RequestScoped
@Controller
@Path("/")
public class MvcArticleTextBodyStep implements MvcAuthoringStep {
}

View File

@ -0,0 +1,42 @@
/*
* 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 org.librecms.ui.contentsections.documents;
import org.librecms.contentsection.ContentItem;
import javax.mvc.Controller;
/**
* Provides the steps for creating and viewing and editing a document (content
* item). The classes provided for {@link #createStep()} and
* {@link #authoringSteps() } must MVC controllers (see {@link Controller}) and
* implement a specific interface.
*
* This annotation can only be used on classes extending the {@link ContentItem}
* class.
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public @interface MvcAuthoringKit {
/**
* Controller of the create step for a document type.
*
* @return The controller of the create step for the annotated document
* type..
*/
Class<? extends MvcDocumentCreateStep> createStep();
/**
* The authoring steps for editing the properties of the document. They are
* used in the same order as they are provided here.
*
* @return The controllers of the authoring steps for the annotated document
* type.
*/
Class<? extends MvcAuthoringStep>[] authoringSteps();
}

View File

@ -0,0 +1,14 @@
/*
* 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 org.librecms.ui.contentsections.documents;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public interface MvcAuthoringStep {
}

View File

@ -0,0 +1,14 @@
/*
* 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 org.librecms.ui.contentsections.documents;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public interface MvcDocumentCreateStep {
}

View File

@ -241,7 +241,7 @@
<a href="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documentfolders/#{row.folderPath}">#{row.name}</a> <a href="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documentfolders/#{row.folderPath}">#{row.name}</a>
</c:when> </c:when>
<c:when test="#{row.permissions.grantedApprove or row.permissions.grantedCategorize or row.permissions.grantedEdit or row.permissions.grantedPreview or row.permissions.grantedPublish}"> <c:when test="#{row.permissions.grantedApprove or row.permissions.grantedCategorize or row.permissions.grantedEdit or row.permissions.grantedPreview or row.permissions.grantedPublish}">
<a href="#">#{row.name}</a> <a href="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{row.folderPath}/#{row.name}">#{row.name}</a>
</c:when> </c:when>
<c:otherwise> <c:otherwise>
<span>#{row.name}</span> <span>#{row.name}</span>