Several bugfixes.
parent
afdbc72240
commit
4ef2b9ac8a
|
|
@ -74,7 +74,7 @@ import static org.librecms.CmsConstants.*;
|
||||||
@AuthoringStep(
|
@AuthoringStep(
|
||||||
component = MultiPartArticleSectionsStep.class,
|
component = MultiPartArticleSectionsStep.class,
|
||||||
labelBundle = CmsConstants.CMS_BUNDLE,
|
labelBundle = CmsConstants.CMS_BUNDLE,
|
||||||
labelKey = "cms.contenttypes.shared.body_text.title",
|
labelKey = "mparticle.authoring.body_text.label",
|
||||||
descriptionBundle = CmsConstants.CMS_BUNDLE,
|
descriptionBundle = CmsConstants.CMS_BUNDLE,
|
||||||
descriptionKey = "mparticle.authoring.body_text.description",
|
descriptionKey = "mparticle.authoring.body_text.description",
|
||||||
order = 2
|
order = 2
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.librecms.ui.contenttypes.article;
|
package org.librecms.ui.contenttypes.article;
|
||||||
|
|
||||||
|
|
||||||
import org.jsoup.Jsoup;
|
import org.jsoup.Jsoup;
|
||||||
import org.jsoup.nodes.Document;
|
import org.jsoup.nodes.Document;
|
||||||
import org.libreccm.configuration.ConfigurationManager;
|
import org.libreccm.configuration.ConfigurationManager;
|
||||||
|
|
@ -139,31 +138,39 @@ public class MvcArticleTextBodyStep extends AbstractMvcAuthoringStep {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * Get all localized values of the main text.
|
* View a preview of the text.
|
||||||
// *
|
*
|
||||||
// * @return The localized values of the main text.
|
* @param sectionIdentifier
|
||||||
// */
|
* @param documentPath
|
||||||
// public Map<String, String> getTextValues() {
|
* @param localeParam
|
||||||
// return Collections.unmodifiableMap(textValues);
|
* @return The template for showing a preview of the text.
|
||||||
// }
|
*/
|
||||||
//
|
@GET
|
||||||
// public List<CmsEditorLocaleVariantRow> getVariants() {
|
@Path("/view/{locale}")
|
||||||
// return Collections.unmodifiableList(variants);
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
// }
|
public String viewText(
|
||||||
//
|
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
|
||||||
// /**
|
final String sectionIdentifier,
|
||||||
// * Gets the locales for which the main text has not been defined yet.
|
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
|
||||||
// *
|
final String documentPath,
|
||||||
// * @return The locales for which the main text has not been defined yet.
|
@PathParam("locale") final String localeParam
|
||||||
// */
|
) {
|
||||||
// public List<String> getUnusedLocales() {
|
try {
|
||||||
// return Collections.unmodifiableList(unusedLocales);
|
init();
|
||||||
// }
|
} catch (ContentSectionNotFoundException ex) {
|
||||||
//
|
return ex.showErrorMessage();
|
||||||
// public String getSelectedLocale() {
|
} catch (DocumentNotFoundException ex) {
|
||||||
// return selectedLocale;
|
return ex.showErrorMessage();
|
||||||
// }
|
}
|
||||||
|
|
||||||
|
articleTextBodyStepModel.setSelectedLocale(
|
||||||
|
new Locale(localeParam).toString()
|
||||||
|
);
|
||||||
|
|
||||||
|
return "org/librecms/ui/contenttypes/article/article-text/view.xhtml";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a localized main text.
|
* Adds a localized main text.
|
||||||
*
|
*
|
||||||
|
|
@ -301,7 +308,6 @@ public class MvcArticleTextBodyStep extends AbstractMvcAuthoringStep {
|
||||||
* @return A redirect to this authoring step.
|
* @return A redirect to this authoring step.
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
// @Path("/{locale}/@remove")
|
|
||||||
@Path("/remove/{locale}")
|
@Path("/remove/{locale}")
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public String removeTextValue(
|
public String removeTextValue(
|
||||||
|
|
@ -343,6 +349,19 @@ public class MvcArticleTextBodyStep extends AbstractMvcAuthoringStep {
|
||||||
articleTextBodyStepModel.setCanEdit(
|
articleTextBodyStepModel.setCanEdit(
|
||||||
itemPermissionChecker.canEditItem(getArticle())
|
itemPermissionChecker.canEditItem(getArticle())
|
||||||
);
|
);
|
||||||
|
articleTextBodyStepModel.setTitleValues(
|
||||||
|
getArticle()
|
||||||
|
.getTitle()
|
||||||
|
.getValues()
|
||||||
|
.entrySet()
|
||||||
|
.stream()
|
||||||
|
.collect(
|
||||||
|
Collectors.toMap(
|
||||||
|
entry -> entry.getKey().toString(),
|
||||||
|
Map.Entry::getValue
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
articleTextBodyStepModel.setTextValues(
|
articleTextBodyStepModel.setTextValues(
|
||||||
getArticle()
|
getArticle()
|
||||||
.getText()
|
.getText()
|
||||||
|
|
@ -352,7 +371,7 @@ public class MvcArticleTextBodyStep extends AbstractMvcAuthoringStep {
|
||||||
.collect(
|
.collect(
|
||||||
Collectors.toMap(
|
Collectors.toMap(
|
||||||
entry -> entry.getKey().toString(),
|
entry -> entry.getKey().toString(),
|
||||||
entry -> entry.getValue()
|
Map.Entry::getValue
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,8 @@ public class MvcArticleTextBodyStepModel {
|
||||||
|
|
||||||
private boolean canEdit;
|
private boolean canEdit;
|
||||||
|
|
||||||
|
private Map<String, String> titleValues;
|
||||||
|
|
||||||
private Map<String, String> textValues;
|
private Map<String, String> textValues;
|
||||||
|
|
||||||
private List<CmsEditorLocaleVariantRow> variants;
|
private List<CmsEditorLocaleVariantRow> variants;
|
||||||
|
|
@ -46,7 +48,19 @@ public class MvcArticleTextBodyStepModel {
|
||||||
private List<String> unusedLocales;
|
private List<String> unusedLocales;
|
||||||
|
|
||||||
private String selectedLocale;
|
private String selectedLocale;
|
||||||
|
|
||||||
|
public Map<String, String> getTitleValues() {
|
||||||
|
return Collections.unmodifiableMap(titleValues);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setTitleValues(final Map<String, String> titleValues) {
|
||||||
|
this.titleValues = new HashMap<>(titleValues);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return titleValues.get(selectedLocale);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all localized values of the main text.
|
* Get all localized values of the main text.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,6 @@ public final class MpaStepsConstants {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String BUNDLE
|
public static final String BUNDLE
|
||||||
= "org.librecms.ui.contenttypes.MpaBundle";
|
= "org.librecms.ui.contenttypes.MpaStepsBundle";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -264,18 +264,18 @@ public class MvcMpaCreateStep
|
||||||
return showCreateStep();
|
return showCreateStep();
|
||||||
}
|
}
|
||||||
|
|
||||||
final Article article = itemManager.createContentItem(
|
final MultiPartArticle multiPartArticle = itemManager.createContentItem(
|
||||||
name,
|
name,
|
||||||
getContentSection(),
|
getContentSection(),
|
||||||
getFolder(),
|
getFolder(),
|
||||||
workflowResult.get(),
|
workflowResult.get(),
|
||||||
Article.class,
|
MultiPartArticle.class,
|
||||||
locale
|
locale
|
||||||
);
|
);
|
||||||
|
|
||||||
article.getTitle().putValue(locale, title);
|
multiPartArticle.getTitle().putValue(locale, title);
|
||||||
article.getDescription().putValue(locale, summary);
|
multiPartArticle.getDescription().putValue(locale, summary);
|
||||||
itemRepo.save(article);
|
itemRepo.save(multiPartArticle);
|
||||||
|
|
||||||
return String.format(
|
return String.format(
|
||||||
"redirect:/%s/documents/%s/%s/@article-basicproperties",
|
"redirect:/%s/documents/%s/%s/@article-basicproperties",
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ import javax.ws.rs.PathParam;
|
||||||
@MvcAuthoringStepDef(
|
@MvcAuthoringStepDef(
|
||||||
bundle = MpaStepsConstants.BUNDLE,
|
bundle = MpaStepsConstants.BUNDLE,
|
||||||
descriptionKey = "authoringsteps.sections.description",
|
descriptionKey = "authoringsteps.sections.description",
|
||||||
labelKey = "authoringsteps.sections.description",
|
labelKey = "authoringsteps.sections.label",
|
||||||
supportedDocumentType = MultiPartArticle.class
|
supportedDocumentType = MultiPartArticle.class
|
||||||
)
|
)
|
||||||
public class MvcMpaSectionsStep extends AbstractMvcAuthoringStep {
|
public class MvcMpaSectionsStep extends AbstractMvcAuthoringStep {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
<!DOCTYPE html [<!ENTITY times '×'>]>
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:bootstrap="http://xmlns.jcp.org/jsf/composite/components/bootstrap"
|
||||||
|
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
|
||||||
|
xmlns:h="http://xmlns.jcp.org/jsf/html"
|
||||||
|
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
|
||||||
|
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
|
||||||
|
<ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/documents/authoringstep.xhtml">
|
||||||
|
|
||||||
|
<ui:define name="authoringStep">
|
||||||
|
<div class="d-flex">
|
||||||
|
<a class="btn btn-secondary btn-sm algin-self-center mr-2"
|
||||||
|
href="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@article-text">
|
||||||
|
<bootstrap:svgIcon icon="caret-left-fill" />
|
||||||
|
<span class="sr-only">#{CmsArticleMessageBundle['textstep.back']}</span>
|
||||||
|
</a>
|
||||||
|
<h2>#{CmsArticleMessageBundle.getMessage('textstep.header.view',[CmsArticleTextBodyStep.title, CmsArticleTextBodyStep.selectedLocale])}</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<c:if test="#{CmsArticleTextBodyStep.canEdit}">
|
||||||
|
<div class="text-right">
|
||||||
|
<a class="btn btn-secondary"
|
||||||
|
href="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@article-text/#{CmsArticleTextBodyStep.selectedLocale}/@edit">
|
||||||
|
<bootstrap:svgIcon icon="pen" />
|
||||||
|
<span class="sr-only">#{CmsArticleMessageBundle['textstep.languages.edit']}</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</c:if>
|
||||||
|
<div class="cms-text-preview article-text border p-2">
|
||||||
|
<h:outputText escape="false"
|
||||||
|
value="#{CmsArticleTextBodyStep.textValues.get(CmsArticleTextBodyStep.selectedLocale)}" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</ui:define>
|
||||||
|
</ui:composition>
|
||||||
|
</html>
|
||||||
|
|
@ -112,3 +112,4 @@ text.editor.header=Text
|
||||||
sectionstep.textstep.back=Back
|
sectionstep.textstep.back=Back
|
||||||
sectionstep.textstep.header.edit=Edit text for locale {2} of section {1} of multipart article {0}
|
sectionstep.textstep.header.edit=Edit text for locale {2} of section {1} of multipart article {0}
|
||||||
sectionstep.textstep.text.editor.header=Text
|
sectionstep.textstep.text.editor.header=Text
|
||||||
|
authoringsteps.sections.label=Sections
|
||||||
|
|
|
||||||
|
|
@ -112,3 +112,4 @@ text.editor.header=Text
|
||||||
sectionstep.textstep.back=Zur\u00fcck
|
sectionstep.textstep.back=Zur\u00fcck
|
||||||
sectionstep.textstep.header.edit=Text f\u00fcr Sprache {2} des Abschnitts {1} des mehrteiligen Artikels {0} bearbeiten
|
sectionstep.textstep.header.edit=Text f\u00fcr Sprache {2} des Abschnitts {1} des mehrteiligen Artikels {0} bearbeiten
|
||||||
sectionstep.textstep.text.editor.header=Text
|
sectionstep.textstep.text.editor.header=Text
|
||||||
|
authoringsteps.sections.label=Abschnitte
|
||||||
|
|
|
||||||
|
|
@ -89,10 +89,10 @@ public class EqualsAndHashCodeTest extends EqualsVerifier {
|
||||||
user2.setName("user2");
|
user2.setName("user2");
|
||||||
|
|
||||||
final Workflow workflow1 = new Workflow();
|
final Workflow workflow1 = new Workflow();
|
||||||
workflow1.getName().addValue(Locale.ENGLISH, "Workflow 1");
|
workflow1.getName().putValue(Locale.ENGLISH, "Workflow 1");
|
||||||
|
|
||||||
final Workflow workflow2 = new Workflow();
|
final Workflow workflow2 = new Workflow();
|
||||||
workflow2.getName().addValue(Locale.ENGLISH, "Workflow 2");
|
workflow2.getName().putValue(Locale.ENGLISH, "Workflow 2");
|
||||||
|
|
||||||
final CcmObject object1 = new CcmObject();
|
final CcmObject object1 = new CcmObject();
|
||||||
object1.setDisplayName("Object 1");
|
object1.setDisplayName("Object 1");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue