Several bugfixes.
parent
afdbc72240
commit
4ef2b9ac8a
|
|
@ -74,7 +74,7 @@ import static org.librecms.CmsConstants.*;
|
|||
@AuthoringStep(
|
||||
component = MultiPartArticleSectionsStep.class,
|
||||
labelBundle = CmsConstants.CMS_BUNDLE,
|
||||
labelKey = "cms.contenttypes.shared.body_text.title",
|
||||
labelKey = "mparticle.authoring.body_text.label",
|
||||
descriptionBundle = CmsConstants.CMS_BUNDLE,
|
||||
descriptionKey = "mparticle.authoring.body_text.description",
|
||||
order = 2
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
package org.librecms.ui.contenttypes.article;
|
||||
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.nodes.Document;
|
||||
import org.libreccm.configuration.ConfigurationManager;
|
||||
|
|
@ -139,31 +138,39 @@ public class MvcArticleTextBodyStep extends AbstractMvcAuthoringStep {
|
|||
}
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Get all localized values of the main text.
|
||||
// *
|
||||
// * @return The localized values of the main text.
|
||||
// */
|
||||
// public Map<String, String> getTextValues() {
|
||||
// return Collections.unmodifiableMap(textValues);
|
||||
// }
|
||||
//
|
||||
// public List<CmsEditorLocaleVariantRow> getVariants() {
|
||||
// return Collections.unmodifiableList(variants);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Gets the locales for which the main text has not been defined yet.
|
||||
// *
|
||||
// * @return The locales for which the main text has not been defined yet.
|
||||
// */
|
||||
// public List<String> getUnusedLocales() {
|
||||
// return Collections.unmodifiableList(unusedLocales);
|
||||
// }
|
||||
//
|
||||
// public String getSelectedLocale() {
|
||||
// return selectedLocale;
|
||||
// }
|
||||
/**
|
||||
* View a preview of the text.
|
||||
*
|
||||
* @param sectionIdentifier
|
||||
* @param documentPath
|
||||
* @param localeParam
|
||||
* @return The template for showing a preview of the text.
|
||||
*/
|
||||
@GET
|
||||
@Path("/view/{locale}")
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public String viewText(
|
||||
@PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM)
|
||||
final String sectionIdentifier,
|
||||
@PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME)
|
||||
final String documentPath,
|
||||
@PathParam("locale") final String localeParam
|
||||
) {
|
||||
try {
|
||||
init();
|
||||
} catch (ContentSectionNotFoundException ex) {
|
||||
return ex.showErrorMessage();
|
||||
} catch (DocumentNotFoundException ex) {
|
||||
return ex.showErrorMessage();
|
||||
}
|
||||
|
||||
articleTextBodyStepModel.setSelectedLocale(
|
||||
new Locale(localeParam).toString()
|
||||
);
|
||||
|
||||
return "org/librecms/ui/contenttypes/article/article-text/view.xhtml";
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a localized main text.
|
||||
*
|
||||
|
|
@ -301,7 +308,6 @@ public class MvcArticleTextBodyStep extends AbstractMvcAuthoringStep {
|
|||
* @return A redirect to this authoring step.
|
||||
*/
|
||||
@POST
|
||||
// @Path("/{locale}/@remove")
|
||||
@Path("/remove/{locale}")
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public String removeTextValue(
|
||||
|
|
@ -343,6 +349,19 @@ public class MvcArticleTextBodyStep extends AbstractMvcAuthoringStep {
|
|||
articleTextBodyStepModel.setCanEdit(
|
||||
itemPermissionChecker.canEditItem(getArticle())
|
||||
);
|
||||
articleTextBodyStepModel.setTitleValues(
|
||||
getArticle()
|
||||
.getTitle()
|
||||
.getValues()
|
||||
.entrySet()
|
||||
.stream()
|
||||
.collect(
|
||||
Collectors.toMap(
|
||||
entry -> entry.getKey().toString(),
|
||||
Map.Entry::getValue
|
||||
)
|
||||
)
|
||||
);
|
||||
articleTextBodyStepModel.setTextValues(
|
||||
getArticle()
|
||||
.getText()
|
||||
|
|
@ -352,7 +371,7 @@ public class MvcArticleTextBodyStep extends AbstractMvcAuthoringStep {
|
|||
.collect(
|
||||
Collectors.toMap(
|
||||
entry -> entry.getKey().toString(),
|
||||
entry -> entry.getValue()
|
||||
Map.Entry::getValue
|
||||
)
|
||||
)
|
||||
);
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@ public class MvcArticleTextBodyStepModel {
|
|||
|
||||
private boolean canEdit;
|
||||
|
||||
private Map<String, String> titleValues;
|
||||
|
||||
private Map<String, String> textValues;
|
||||
|
||||
private List<CmsEditorLocaleVariantRow> variants;
|
||||
|
|
@ -47,6 +49,18 @@ public class MvcArticleTextBodyStepModel {
|
|||
|
||||
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.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -32,6 +32,6 @@ public final class MpaStepsConstants {
|
|||
}
|
||||
|
||||
public static final String BUNDLE
|
||||
= "org.librecms.ui.contenttypes.MpaBundle";
|
||||
= "org.librecms.ui.contenttypes.MpaStepsBundle";
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -264,18 +264,18 @@ public class MvcMpaCreateStep
|
|||
return showCreateStep();
|
||||
}
|
||||
|
||||
final Article article = itemManager.createContentItem(
|
||||
final MultiPartArticle multiPartArticle = itemManager.createContentItem(
|
||||
name,
|
||||
getContentSection(),
|
||||
getFolder(),
|
||||
workflowResult.get(),
|
||||
Article.class,
|
||||
MultiPartArticle.class,
|
||||
locale
|
||||
);
|
||||
|
||||
article.getTitle().putValue(locale, title);
|
||||
article.getDescription().putValue(locale, summary);
|
||||
itemRepo.save(article);
|
||||
multiPartArticle.getTitle().putValue(locale, title);
|
||||
multiPartArticle.getDescription().putValue(locale, summary);
|
||||
itemRepo.save(multiPartArticle);
|
||||
|
||||
return String.format(
|
||||
"redirect:/%s/documents/%s/%s/@article-basicproperties",
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ import javax.ws.rs.PathParam;
|
|||
@MvcAuthoringStepDef(
|
||||
bundle = MpaStepsConstants.BUNDLE,
|
||||
descriptionKey = "authoringsteps.sections.description",
|
||||
labelKey = "authoringsteps.sections.description",
|
||||
labelKey = "authoringsteps.sections.label",
|
||||
supportedDocumentType = MultiPartArticle.class
|
||||
)
|
||||
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.header.edit=Edit text for locale {2} of section {1} of multipart article {0}
|
||||
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.header.edit=Text f\u00fcr Sprache {2} des Abschnitts {1} des mehrteiligen Artikels {0} bearbeiten
|
||||
sectionstep.textstep.text.editor.header=Text
|
||||
authoringsteps.sections.label=Abschnitte
|
||||
|
|
|
|||
|
|
@ -89,10 +89,10 @@ public class EqualsAndHashCodeTest extends EqualsVerifier {
|
|||
user2.setName("user2");
|
||||
|
||||
final Workflow workflow1 = new Workflow();
|
||||
workflow1.getName().addValue(Locale.ENGLISH, "Workflow 1");
|
||||
workflow1.getName().putValue(Locale.ENGLISH, "Workflow 1");
|
||||
|
||||
final Workflow workflow2 = new Workflow();
|
||||
workflow2.getName().addValue(Locale.ENGLISH, "Workflow 2");
|
||||
workflow2.getName().putValue(Locale.ENGLISH, "Workflow 2");
|
||||
|
||||
final CcmObject object1 = new CcmObject();
|
||||
object1.setDisplayName("Object 1");
|
||||
|
|
|
|||
Loading…
Reference in New Issue