MVC Controllers should be named beans
parent
8d674ac140
commit
83e65415de
|
|
@ -88,6 +88,9 @@ public abstract class AbstractMvcAssetEditStep implements MvcAssetEditStep {
|
|||
@Inject
|
||||
private Models models;
|
||||
|
||||
@Inject
|
||||
private MvcAssetEditStepModel mvcAssetEditStepModel;
|
||||
|
||||
@Inject
|
||||
private SelectedAssetModel assetModel;
|
||||
|
||||
|
|
@ -105,10 +108,9 @@ public abstract class AbstractMvcAssetEditStep implements MvcAssetEditStep {
|
|||
|
||||
private String stepPath;
|
||||
|
||||
private Map<String, String> titleValues;
|
||||
|
||||
private List<String> unusedTitleLocales;
|
||||
|
||||
// private Map<String, String> titleValues;
|
||||
//
|
||||
// private List<String> unusedTitleLocales;
|
||||
protected void init() throws ContentSectionNotFoundException,
|
||||
AssetNotFoundException {
|
||||
contentSection = sectionsUi
|
||||
|
|
@ -162,28 +164,35 @@ public abstract class AbstractMvcAssetEditStep implements MvcAssetEditStep {
|
|||
)
|
||||
.orElse("");
|
||||
|
||||
titleValues = getAsset()
|
||||
.getTitle()
|
||||
.getValues()
|
||||
.entrySet()
|
||||
.stream()
|
||||
.collect(
|
||||
Collectors.toMap(
|
||||
entry -> entry.getKey().toString(),
|
||||
entry -> entry.getValue()
|
||||
mvcAssetEditStepModel.setName(getName());
|
||||
mvcAssetEditStepModel.setCanEdit(getCanEdit());
|
||||
|
||||
mvcAssetEditStepModel.setTitleValues(
|
||||
getAsset()
|
||||
.getTitle()
|
||||
.getValues()
|
||||
.entrySet()
|
||||
.stream()
|
||||
.collect(
|
||||
Collectors.toMap(
|
||||
entry -> entry.getKey().toString(),
|
||||
entry -> entry.getValue()
|
||||
)
|
||||
)
|
||||
);
|
||||
);
|
||||
|
||||
final Set<Locale> titleLocales = getAsset()
|
||||
.getTitle()
|
||||
.getAvailableLocales();
|
||||
|
||||
unusedTitleLocales = globalizationHelper
|
||||
.getAvailableLocales()
|
||||
.stream()
|
||||
.filter(locale -> !titleLocales.contains(locale))
|
||||
.map(Locale::toString)
|
||||
.collect(Collectors.toList());
|
||||
mvcAssetEditStepModel.setUnusedTitleLocales(
|
||||
globalizationHelper
|
||||
.getAvailableLocales()
|
||||
.stream()
|
||||
.filter(locale -> !titleLocales.contains(locale))
|
||||
.map(Locale::toString)
|
||||
.collect(Collectors.toList())
|
||||
);
|
||||
|
||||
models.put("activeAssetTab", "editTab");
|
||||
models.put("stepPath", stepPath);
|
||||
|
|
@ -397,14 +406,13 @@ public abstract class AbstractMvcAssetEditStep implements MvcAssetEditStep {
|
|||
}
|
||||
}
|
||||
|
||||
public Map<String, String> getTitleValues() {
|
||||
return Collections.unmodifiableMap(titleValues);
|
||||
}
|
||||
|
||||
public List<String> getUnusedTitleLocales() {
|
||||
return Collections.unmodifiableList(unusedTitleLocales);
|
||||
}
|
||||
|
||||
// public Map<String, String> getTitleValues() {
|
||||
// return Collections.unmodifiableMap(titleValues);
|
||||
// }
|
||||
//
|
||||
// public List<String> getUnusedTitleLocales() {
|
||||
// return Collections.unmodifiableList(unusedTitleLocales);
|
||||
// }
|
||||
@POST
|
||||
@Path("/title/@add")
|
||||
@AuthorizationRequired
|
||||
|
|
|
|||
|
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* Copyright (C) 2021 LibreCCM Foundation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
package org.librecms.ui.contentsections.assets;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Named;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@RequestScoped
|
||||
@Named("MvcAssetEditStepModel")
|
||||
public class MvcAssetEditStepModel {
|
||||
|
||||
private boolean canEdit;
|
||||
|
||||
private String name;
|
||||
|
||||
private Map<String, String> titleValues;
|
||||
|
||||
private List<String> unusedTitleLocales;
|
||||
|
||||
public boolean getCanEdit() {
|
||||
return canEdit;
|
||||
}
|
||||
|
||||
protected void setCanEdit(final boolean canEdit) {
|
||||
this.canEdit = canEdit;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
protected void setName(final String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Map<String, String> getTitleValues() {
|
||||
return Collections.unmodifiableMap(titleValues);
|
||||
}
|
||||
|
||||
protected void setTitleValues(final Map<String, String> titleValues) {
|
||||
this.titleValues = new HashMap<>(titleValues);
|
||||
}
|
||||
|
||||
public List<String> getUnusedTitleLocales() {
|
||||
return Collections.unmodifiableList(unusedTitleLocales);
|
||||
}
|
||||
|
||||
protected void setUnusedTitleLocales(
|
||||
final List<String> unusedTitleLocales
|
||||
) {
|
||||
this.unusedTitleLocales = new ArrayList<>(unusedTitleLocales);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -30,12 +30,12 @@ import java.util.LinkedHashMap;
|
|||
import java.util.LinkedHashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.mvc.Controller;
|
||||
import javax.mvc.Models;
|
||||
import javax.transaction.Transactional;
|
||||
|
|
@ -52,7 +52,6 @@ import javax.ws.rs.PathParam;
|
|||
@RequestScoped
|
||||
@Path(MvcAssetEditSteps.PATH_PREFIX + "postaladdress-edit")
|
||||
@Controller
|
||||
@Named("CmsPostalAddressEditStep")
|
||||
@MvcAssetEditStepDef(
|
||||
bundle = MvcAssetStepsConstants.BUNDLE,
|
||||
descriptionKey = "postaladdress.editstep.description",
|
||||
|
|
@ -76,11 +75,13 @@ public class PostalAddressEditStep extends AbstractMvcAssetEditStep {
|
|||
@Inject
|
||||
private AssetPermissionsChecker assetPermissionsChecker;
|
||||
|
||||
@Inject
|
||||
private PostalAddressEditStepModel postalAddressEditStepModel;
|
||||
|
||||
@Inject
|
||||
private Models models;
|
||||
|
||||
private Map<String, String> countries;
|
||||
|
||||
// private Map<String, String> countries;
|
||||
@Override
|
||||
public Class<? extends MvcAssetEditStep> getStepClass() {
|
||||
return PostalAddressEditStep.class;
|
||||
|
|
@ -118,9 +119,32 @@ public class PostalAddressEditStep extends AbstractMvcAssetEditStep {
|
|||
)
|
||||
);
|
||||
|
||||
countries = new LinkedHashMap<>();
|
||||
final Map<String, String> countries = new LinkedHashMap<>();
|
||||
countries.put("", "");
|
||||
countries.putAll(countriesMap);
|
||||
postalAddressEditStepModel.setCountries(countries);
|
||||
|
||||
postalAddressEditStepModel.setAddress(getPostalAddress().getAddress());
|
||||
postalAddressEditStepModel.setPostalCode(
|
||||
getPostalAddress().getPostalCode()
|
||||
);
|
||||
postalAddressEditStepModel.setCity(getPostalAddress().getCity());
|
||||
postalAddressEditStepModel.setState(postalAddressEditStepModel
|
||||
.getState()
|
||||
);
|
||||
postalAddressEditStepModel.setIsoCountryCode(
|
||||
getPostalAddress().getIsoCountryCode()
|
||||
);
|
||||
postalAddressEditStepModel.setCountry(
|
||||
Optional
|
||||
.ofNullable(getPostalAddress().getIsoCountryCode())
|
||||
.map(code -> new Locale("", code))
|
||||
.map(
|
||||
locale -> locale.getDisplayCountry(
|
||||
globalizationHelper.getNegotiatedLocale()
|
||||
)
|
||||
).orElse("")
|
||||
);
|
||||
}
|
||||
|
||||
@GET
|
||||
|
|
@ -160,34 +184,34 @@ public class PostalAddressEditStep extends AbstractMvcAssetEditStep {
|
|||
return (PostalAddress) getAsset();
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return getPostalAddress().getAddress();
|
||||
}
|
||||
|
||||
public String getPostalCode() {
|
||||
return getPostalAddress().getPostalCode();
|
||||
}
|
||||
|
||||
public String getCity() {
|
||||
return getPostalAddress().getCity();
|
||||
}
|
||||
|
||||
public String getState() {
|
||||
return getPostalAddress().getState();
|
||||
}
|
||||
|
||||
public String getIsoCountryCode() {
|
||||
return getPostalAddress().getIsoCountryCode();
|
||||
}
|
||||
|
||||
public String getCountry() {
|
||||
if (getPostalAddress().getIsoCountryCode() == null) {
|
||||
return "";
|
||||
} else {
|
||||
return new Locale("", getPostalAddress().getIsoCountryCode())
|
||||
.getDisplayCountry(globalizationHelper.getNegotiatedLocale());
|
||||
}
|
||||
}
|
||||
// public String getAddress() {
|
||||
// return getPostalAddress().getAddress();
|
||||
// }
|
||||
//
|
||||
// public String getPostalCode() {
|
||||
// return getPostalAddress().getPostalCode();
|
||||
// }
|
||||
//
|
||||
// public String getCity() {
|
||||
// return getPostalAddress().getCity();
|
||||
// }
|
||||
//
|
||||
// public String getState() {
|
||||
// return getPostalAddress().getState();
|
||||
// }
|
||||
//
|
||||
// public String getIsoCountryCode() {
|
||||
// return getPostalAddress().getIsoCountryCode();
|
||||
// }
|
||||
//
|
||||
// public String getCountry() {
|
||||
// if (getPostalAddress().getIsoCountryCode() == null) {
|
||||
// return "";
|
||||
// } else {
|
||||
// return new Locale("", getPostalAddress().getIsoCountryCode())
|
||||
// .getDisplayCountry(globalizationHelper.getNegotiatedLocale());
|
||||
// }
|
||||
// }
|
||||
|
||||
@POST
|
||||
@Path("/properties")
|
||||
|
|
@ -231,10 +255,10 @@ public class PostalAddressEditStep extends AbstractMvcAssetEditStep {
|
|||
}
|
||||
}
|
||||
|
||||
public Map<String, String> getCountries() {
|
||||
final LinkedHashMap<String, String> result = new LinkedHashMap<>();
|
||||
result.putAll(countries);
|
||||
return result;
|
||||
}
|
||||
// public Map<String, String> getCountries() {
|
||||
// final LinkedHashMap<String, String> result = new LinkedHashMap<>();
|
||||
// result.putAll(countries);
|
||||
// return result;
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,106 @@
|
|||
/*
|
||||
* Copyright (C) 2021 LibreCCM Foundation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
package org.librecms.ui.contentsections.assets;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Named;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@RequestScoped
|
||||
@Named("CmsPostalAddressEditStep")
|
||||
public class PostalAddressEditStepModel {
|
||||
|
||||
private String address;
|
||||
|
||||
private String postalCode;
|
||||
|
||||
private String city;
|
||||
|
||||
private String state;
|
||||
|
||||
private String isoCountryCode;
|
||||
|
||||
private String country;
|
||||
|
||||
private Map<String, String> countries;
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
protected void setAddress(final String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public String getPostalCode() {
|
||||
return postalCode;
|
||||
}
|
||||
|
||||
protected void setPostalCode(final String postalCode) {
|
||||
this.postalCode = postalCode;
|
||||
}
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
protected void setCity(final String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public String getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
protected void setState(final String state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public String getIsoCountryCode() {
|
||||
return isoCountryCode;
|
||||
}
|
||||
|
||||
protected void setIsoCountryCode(final String isoCountryCode) {
|
||||
this.isoCountryCode = isoCountryCode;
|
||||
}
|
||||
|
||||
public String getCountry() {
|
||||
return country;
|
||||
}
|
||||
|
||||
protected void setCountry(final String country) {
|
||||
this.country = country;
|
||||
}
|
||||
|
||||
public Map<String, String> getCountries() {
|
||||
return Collections.unmodifiableMap(countries);
|
||||
}
|
||||
|
||||
public void setCountries(final Map<String, String> countries) {
|
||||
this.countries = new HashMap<>(countries);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -38,7 +38,6 @@ import java.util.stream.Collectors;
|
|||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.mvc.Controller;
|
||||
import javax.transaction.Transactional;
|
||||
import javax.ws.rs.FormParam;
|
||||
|
|
@ -54,7 +53,6 @@ import javax.ws.rs.PathParam;
|
|||
@RequestScoped
|
||||
@Path(MvcAssetEditSteps.PATH_PREFIX + "sidenote-edit")
|
||||
@Controller
|
||||
@Named("CmsSideNoteEditStep")
|
||||
@MvcAssetEditStepDef(
|
||||
bundle = MvcAssetStepsConstants.BUNDLE,
|
||||
descriptionKey = "postaladdress.editstep.description",
|
||||
|
|
@ -78,17 +76,61 @@ public class SideNoteEditStep extends AbstractMvcAssetEditStep {
|
|||
@Inject
|
||||
private AssetPermissionsChecker assetPermissionsChecker;
|
||||
|
||||
private Map<String, String> textValues;
|
||||
|
||||
private List<CmsEditorLocaleVariantRow> variants;
|
||||
|
||||
private List<String> unusedTextLocales;
|
||||
@Inject
|
||||
private SideNoteEditStepModel sideNoteEditStepModel;
|
||||
|
||||
// private Map<String, String> textValues;
|
||||
//
|
||||
// private List<CmsEditorLocaleVariantRow> variants;
|
||||
//
|
||||
// private List<String> unusedTextLocales;
|
||||
@Override
|
||||
public Class<? extends MvcAssetEditStep> getStepClass() {
|
||||
return SideNoteEditStep.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() throws ContentSectionNotFoundException,
|
||||
AssetNotFoundException {
|
||||
super.init();
|
||||
|
||||
sideNoteEditStepModel.setTextValues(
|
||||
getSideNote()
|
||||
.getText()
|
||||
.getValues()
|
||||
.entrySet()
|
||||
.stream()
|
||||
.collect(
|
||||
Collectors.toMap(
|
||||
entry -> entry.getKey().toString(),
|
||||
entry -> entry.getValue()
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
final Set<Locale> textLocales = getSideNote()
|
||||
.getText()
|
||||
.getAvailableLocales();
|
||||
sideNoteEditStepModel.setUnusedTextLocales(
|
||||
globalizationHelper
|
||||
.getAvailableLocales()
|
||||
.stream()
|
||||
.filter(locale -> !textLocales.contains(locale))
|
||||
.map(Locale::toString)
|
||||
.collect(Collectors.toList())
|
||||
);
|
||||
|
||||
sideNoteEditStepModel.setVariants(
|
||||
getSideNote()
|
||||
.getText()
|
||||
.getValues()
|
||||
.entrySet()
|
||||
.stream()
|
||||
.map(this::buildVariantRow)
|
||||
.collect(Collectors.toList())
|
||||
);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/")
|
||||
@AuthorizationRequired
|
||||
|
|
@ -109,35 +151,6 @@ public class SideNoteEditStep extends AbstractMvcAssetEditStep {
|
|||
}
|
||||
|
||||
if (assetPermissionsChecker.canEditAsset(getAsset())) {
|
||||
textValues = getSideNote()
|
||||
.getText()
|
||||
.getValues()
|
||||
.entrySet()
|
||||
.stream()
|
||||
.collect(
|
||||
Collectors.toMap(
|
||||
entry -> entry.getKey().toString(),
|
||||
entry -> entry.getValue()
|
||||
)
|
||||
);
|
||||
|
||||
final Set<Locale> textLocales = getSideNote()
|
||||
.getText()
|
||||
.getAvailableLocales();
|
||||
unusedTextLocales = globalizationHelper
|
||||
.getAvailableLocales()
|
||||
.stream()
|
||||
.filter(locale -> !textLocales.contains(locale))
|
||||
.map(Locale::toString)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
variants = getSideNote()
|
||||
.getText()
|
||||
.getValues()
|
||||
.entrySet()
|
||||
.stream()
|
||||
.map(this::buildVariantRow)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
return "org/librecms/ui/contentsection/assets/sidenote/edit-sidenote.xhtml";
|
||||
} else {
|
||||
|
|
@ -151,18 +164,18 @@ public class SideNoteEditStep extends AbstractMvcAssetEditStep {
|
|||
public SideNote getSideNote() {
|
||||
return (SideNote) getAsset();
|
||||
}
|
||||
|
||||
public Map<String, String> getTextValues() {
|
||||
return Collections.unmodifiableMap(textValues);
|
||||
}
|
||||
|
||||
public List<CmsEditorLocaleVariantRow> getVariants() {
|
||||
return Collections.unmodifiableList(variants);
|
||||
}
|
||||
|
||||
public List<String> getUnusedTextLocales() {
|
||||
return Collections.unmodifiableList(unusedTextLocales);
|
||||
}
|
||||
//
|
||||
// public Map<String, String> getTextValues() {
|
||||
// return Collections.unmodifiableMap(textValues);
|
||||
// }
|
||||
//
|
||||
// public List<CmsEditorLocaleVariantRow> getVariants() {
|
||||
// return Collections.unmodifiableList(variants);
|
||||
// }
|
||||
//
|
||||
// public List<String> getUnusedTextLocales() {
|
||||
// return Collections.unmodifiableList(unusedTextLocales);
|
||||
// }
|
||||
|
||||
@POST
|
||||
@Path("/text/add")
|
||||
|
|
|
|||
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* Copyright (C) 2021 LibreCCM Foundation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
package org.librecms.ui.contentsections.assets;
|
||||
|
||||
import org.librecms.ui.contentsections.documents.CmsEditorLocaleVariantRow;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Named;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@RequestScoped
|
||||
@Named("CmsSideNoteEditStep")
|
||||
public class SideNoteEditStepModel {
|
||||
|
||||
private Map<String, String> textValues;
|
||||
|
||||
private List<CmsEditorLocaleVariantRow> variants;
|
||||
|
||||
private List<String> unusedTextLocales;
|
||||
|
||||
public Map<String, String> getTextValues() {
|
||||
return Collections.unmodifiableMap(textValues);
|
||||
}
|
||||
|
||||
protected void setTextValues(final Map<String, String> textValues) {
|
||||
this.textValues = new HashMap<>(textValues);
|
||||
}
|
||||
|
||||
public List<CmsEditorLocaleVariantRow> getVariants() {
|
||||
return Collections.unmodifiableList(variants);
|
||||
}
|
||||
|
||||
protected void setVariants(final List<CmsEditorLocaleVariantRow> variants) {
|
||||
this.variants = new ArrayList<>(variants);
|
||||
}
|
||||
|
||||
public List<String> getUnusedTextLocales() {
|
||||
return Collections.unmodifiableList(unusedTextLocales);
|
||||
}
|
||||
|
||||
protected void setUnusedTextLocales(final List<String> unusedTextLocales) {
|
||||
this.unusedTextLocales = new ArrayList<>(unusedTextLocales);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -92,7 +92,7 @@ public class PublishStepModel {
|
|||
return assignedLifecycleDescription;
|
||||
}
|
||||
|
||||
protected void setAssignedLifecylceDescription(
|
||||
protected void setAssignedLifecycleDescription(
|
||||
final String assignedLifecycleDescription
|
||||
) {
|
||||
this.assignedLifecycleDescription = assignedLifecycleDescription;
|
||||
|
|
|
|||
|
|
@ -33,15 +33,11 @@ import org.librecms.ui.contentsections.documents.DocumentUi;
|
|||
import org.librecms.ui.contentsections.documents.MvcAuthoringStepDef;
|
||||
import org.librecms.ui.contentsections.documents.MvcAuthoringSteps;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
|
@ -63,7 +59,6 @@ import javax.ws.rs.PathParam;
|
|||
@RequestScoped
|
||||
@Path(MvcAuthoringSteps.PATH_PREFIX + "article-basicproperties")
|
||||
@Controller
|
||||
@Named("CmsArticlePropertiesStep")
|
||||
@MvcAuthoringStepDef(
|
||||
bundle = ArticleStepsConstants.BUNDLE,
|
||||
descriptionKey = "authoringsteps.basicproperties.description",
|
||||
|
|
@ -105,22 +100,90 @@ public class MvcArticlePropertiesStep extends AbstractMvcAuthoringStep {
|
|||
@Inject
|
||||
private ItemPermissionChecker itemPermissionChecker;
|
||||
|
||||
@Inject
|
||||
private MvcArticlePropertiesStepModel articlePropertiesStepModel;
|
||||
|
||||
@Inject
|
||||
private Models models;
|
||||
|
||||
private Map<String, String> titleValues;
|
||||
|
||||
private List<String> unusedTitleLocales;
|
||||
|
||||
private Map<String, String> descriptionValues;
|
||||
|
||||
private List<String> unusedDescriptionLocales;
|
||||
// private Map<String, String> titleValues;
|
||||
//
|
||||
// private List<String> unusedTitleLocales;
|
||||
//
|
||||
// private Map<String, String> descriptionValues;
|
||||
//
|
||||
// private List<String> unusedDescriptionLocales;
|
||||
|
||||
@Override
|
||||
public Class<MvcArticlePropertiesStep> getStepClass() {
|
||||
return MvcArticlePropertiesStep.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
protected void init() throws ContentSectionNotFoundException,
|
||||
DocumentNotFoundException {
|
||||
super.init();
|
||||
|
||||
articlePropertiesStepModel.setName(getDocument().getDisplayName());
|
||||
|
||||
articlePropertiesStepModel.setCanEdit(getCanEdit());
|
||||
|
||||
final Set<Locale> titleLocales = getDocument()
|
||||
.getTitle()
|
||||
.getAvailableLocales();
|
||||
|
||||
articlePropertiesStepModel.setTitleValues(
|
||||
getDocument()
|
||||
.getTitle()
|
||||
.getValues()
|
||||
.entrySet()
|
||||
.stream()
|
||||
.collect(
|
||||
Collectors.toMap(
|
||||
entry -> entry.getKey().toString(),
|
||||
entry -> entry.getValue()
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
articlePropertiesStepModel.setUnusedTitleLocales(
|
||||
globalizationHelper
|
||||
.getAvailableLocales()
|
||||
.stream()
|
||||
.filter(locale -> !titleLocales.contains(locale))
|
||||
.map(Locale::toString)
|
||||
.collect(Collectors.toList())
|
||||
);
|
||||
|
||||
articlePropertiesStepModel.setDescriptionValues(
|
||||
getDocument()
|
||||
.getDescription()
|
||||
.getValues()
|
||||
.entrySet()
|
||||
.stream()
|
||||
.collect(
|
||||
Collectors.toMap(
|
||||
entry -> entry.getKey().toString(),
|
||||
entry -> entry.getValue()
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
final Set<Locale> descriptionLocales = getDocument()
|
||||
.getDescription()
|
||||
.getAvailableLocales();
|
||||
|
||||
articlePropertiesStepModel.setUnusedDescriptionLocales(
|
||||
globalizationHelper
|
||||
.getAvailableLocales()
|
||||
.stream()
|
||||
.filter(locale -> !descriptionLocales.contains(locale))
|
||||
.map(Locale::toString)
|
||||
.collect(Collectors.toList())
|
||||
);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/")
|
||||
@AuthorizationRequired
|
||||
|
|
@ -140,52 +203,51 @@ public class MvcArticlePropertiesStep extends AbstractMvcAuthoringStep {
|
|||
}
|
||||
|
||||
if (itemPermissionChecker.canEditItem(getDocument())) {
|
||||
titleValues = getDocument()
|
||||
.getTitle()
|
||||
.getValues()
|
||||
.entrySet()
|
||||
.stream()
|
||||
.collect(
|
||||
Collectors.toMap(
|
||||
entry -> entry.getKey().toString(),
|
||||
entry -> entry.getValue()
|
||||
)
|
||||
);
|
||||
|
||||
final Set<Locale> titleLocales = getDocument()
|
||||
.getTitle()
|
||||
.getAvailableLocales();
|
||||
|
||||
unusedTitleLocales = globalizationHelper
|
||||
.getAvailableLocales()
|
||||
.stream()
|
||||
.filter(locale -> !titleLocales.contains(locale))
|
||||
.map(Locale::toString)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
descriptionValues = getDocument()
|
||||
.getDescription()
|
||||
.getValues()
|
||||
.entrySet()
|
||||
.stream()
|
||||
.collect(
|
||||
Collectors.toMap(
|
||||
entry -> entry.getKey().toString(),
|
||||
entry -> entry.getValue()
|
||||
)
|
||||
);
|
||||
|
||||
final Set<Locale> descriptionLocales = getDocument()
|
||||
.getDescription()
|
||||
.getAvailableLocales();
|
||||
|
||||
unusedDescriptionLocales = globalizationHelper
|
||||
.getAvailableLocales()
|
||||
.stream()
|
||||
.filter(locale -> !descriptionLocales.contains(locale))
|
||||
.map(Locale::toString)
|
||||
.collect(Collectors.toList());
|
||||
// titleValues = getDocument()
|
||||
// .getTitle()
|
||||
// .getValues()
|
||||
// .entrySet()
|
||||
// .stream()
|
||||
// .collect(
|
||||
// Collectors.toMap(
|
||||
// entry -> entry.getKey().toString(),
|
||||
// entry -> entry.getValue()
|
||||
// )
|
||||
// );
|
||||
|
||||
// final Set<Locale> titleLocales = getDocument()
|
||||
// .getTitle()
|
||||
// .getAvailableLocales();
|
||||
//
|
||||
// unusedTitleLocales = globalizationHelper
|
||||
// .getAvailableLocales()
|
||||
// .stream()
|
||||
// .filter(locale -> !titleLocales.contains(locale))
|
||||
// .map(Locale::toString)
|
||||
// .collect(Collectors.toList());
|
||||
//
|
||||
// descriptionValues = getDocument()
|
||||
// .getDescription()
|
||||
// .getValues()
|
||||
// .entrySet()
|
||||
// .stream()
|
||||
// .collect(
|
||||
// Collectors.toMap(
|
||||
// entry -> entry.getKey().toString(),
|
||||
// entry -> entry.getValue()
|
||||
// )
|
||||
// );
|
||||
//
|
||||
// final Set<Locale> descriptionLocales = getDocument()
|
||||
// .getDescription()
|
||||
// .getAvailableLocales();
|
||||
//
|
||||
// unusedDescriptionLocales = globalizationHelper
|
||||
// .getAvailableLocales()
|
||||
// .stream()
|
||||
// .filter(locale -> !descriptionLocales.contains(locale))
|
||||
// .map(Locale::toString)
|
||||
// .collect(Collectors.toList());
|
||||
return "org/librecms/ui/contenttypes/article/article-basic-properties.xhtml";
|
||||
} else {
|
||||
return documentUi.showAccessDenied(
|
||||
|
|
@ -197,14 +259,14 @@ public class MvcArticlePropertiesStep extends AbstractMvcAuthoringStep {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the display name of the current article.
|
||||
*
|
||||
* @return The display name of the current article.
|
||||
*/
|
||||
public String getName() {
|
||||
return getDocument().getDisplayName();
|
||||
}
|
||||
// /**
|
||||
// * Gets the display name of the current article.
|
||||
// *
|
||||
// * @return The display name of the current article.
|
||||
// */
|
||||
// public String getName() {
|
||||
// return getDocument().getDisplayName();
|
||||
// }
|
||||
|
||||
/**
|
||||
* Updates the name of the current article.
|
||||
|
|
@ -256,23 +318,7 @@ public class MvcArticlePropertiesStep extends AbstractMvcAuthoringStep {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the values of the localized title of the article.
|
||||
*
|
||||
* @return The values of the localized title of the article.
|
||||
*/
|
||||
public Map<String, String> getTitleValues() {
|
||||
return Collections.unmodifiableMap(titleValues);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the locales for which no localized title has been defined yet.
|
||||
*
|
||||
* @return The locales for which no localized title has been defined yet.
|
||||
*/
|
||||
public List<String> getUnusedTitleLocales() {
|
||||
return Collections.unmodifiableList(unusedTitleLocales);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Updates a localized title of the article.
|
||||
|
|
@ -407,24 +453,7 @@ public class MvcArticlePropertiesStep extends AbstractMvcAuthoringStep {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the locales for which no localized description has been defined yet.
|
||||
*
|
||||
* @return The locales for which no localized description has been defined
|
||||
* yet.
|
||||
*/
|
||||
public List<String> getUnusedDescriptionLocales() {
|
||||
return Collections.unmodifiableList(unusedDescriptionLocales);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the values of the localized decrription of the article.
|
||||
*
|
||||
* @return The values of the localized description of the article.
|
||||
*/
|
||||
public Map<String, String> getDescriptionValues() {
|
||||
return Collections.unmodifiableMap(descriptionValues);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds a localized description to the article.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,104 @@
|
|||
/*
|
||||
* Copyright (C) 2021 LibreCCM Foundation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
package org.librecms.ui.contenttypes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Named;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@RequestScoped
|
||||
@Named("CmsArticlePropertiesStep")
|
||||
public class MvcArticlePropertiesStepModel {
|
||||
|
||||
private String name;
|
||||
|
||||
private boolean canEdit;
|
||||
|
||||
private Map<String, String> titleValues;
|
||||
|
||||
private List<String> unusedTitleLocales;
|
||||
|
||||
private Map<String, String> descriptionValues;
|
||||
|
||||
private List<String> unusedDescriptionLocales;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(final String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public boolean getCanEdit() {
|
||||
return canEdit;
|
||||
}
|
||||
|
||||
public void setCanEdit(final boolean canEdit) {
|
||||
this.canEdit = canEdit;
|
||||
}
|
||||
|
||||
public Map<String, String> getTitleValues() {
|
||||
return Collections.unmodifiableMap(titleValues);
|
||||
}
|
||||
|
||||
public void setTitleValues(final Map<String, String> titleValues) {
|
||||
this.titleValues = new HashMap<>(titleValues);
|
||||
}
|
||||
|
||||
public List<String> getUnusedTitleLocales() {
|
||||
return Collections.unmodifiableList(unusedTitleLocales);
|
||||
}
|
||||
|
||||
public void setUnusedTitleLocales(List<String> unusedTitleLocales) {
|
||||
this.unusedTitleLocales = new ArrayList<>(unusedTitleLocales);
|
||||
}
|
||||
|
||||
public Map<String, String> getDescriptionValues() {
|
||||
return Collections.unmodifiableMap(descriptionValues);
|
||||
}
|
||||
|
||||
public void setDescriptionValues(
|
||||
final Map<String, String> descriptionValues
|
||||
) {
|
||||
this.descriptionValues = new HashMap<>(descriptionValues);
|
||||
}
|
||||
|
||||
public List<String> getUnusedDescriptionLocales() {
|
||||
return Collections.unmodifiableList(unusedDescriptionLocales);
|
||||
}
|
||||
|
||||
public void setUnusedDescriptionLocales(
|
||||
final List<String> unusedDescriptionLocales
|
||||
) {
|
||||
this.unusedDescriptionLocales = new ArrayList<>(
|
||||
unusedDescriptionLocales
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -39,7 +39,6 @@ import javax.ws.rs.Path;
|
|||
|
||||
import org.librecms.ui.contentsections.documents.MvcAuthoringSteps;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
|
@ -47,7 +46,6 @@ import java.util.stream.Collectors;
|
|||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.transaction.Transactional;
|
||||
import javax.ws.rs.FormParam;
|
||||
import javax.ws.rs.GET;
|
||||
|
|
@ -56,7 +54,6 @@ import javax.ws.rs.PathParam;
|
|||
|
||||
import org.librecms.ui.contentsections.documents.MvcAuthoringStepDef;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
/**
|
||||
|
|
@ -67,7 +64,6 @@ import java.util.StringTokenizer;
|
|||
@RequestScoped
|
||||
@Path(MvcAuthoringSteps.PATH_PREFIX + "article-text")
|
||||
@Controller
|
||||
@Named("CmsArticleTextBodyStep")
|
||||
@MvcAuthoringStepDef(
|
||||
bundle = ArticleStepsConstants.BUNDLE,
|
||||
descriptionKey = "authoringsteps.text.description",
|
||||
|
|
@ -100,14 +96,16 @@ public class MvcArticleTextBodyStep extends AbstractMvcAuthoringStep {
|
|||
@Inject
|
||||
private ItemPermissionChecker itemPermissionChecker;
|
||||
|
||||
private Map<String, String> textValues;
|
||||
|
||||
private List<CmsEditorLocaleVariantRow> variants;
|
||||
|
||||
private List<String> unusedLocales;
|
||||
|
||||
private String selectedLocale;
|
||||
@Inject
|
||||
private MvcArticleTextBodyStepModel articleTextBodyStepModel;
|
||||
|
||||
// private Map<String, String> textValues;
|
||||
//
|
||||
// private List<CmsEditorLocaleVariantRow> variants;
|
||||
//
|
||||
// private List<String> unusedLocales;
|
||||
//
|
||||
// private String selectedLocale;
|
||||
@Override
|
||||
public Class<MvcArticleTextBodyStep> getStepClass() {
|
||||
return MvcArticleTextBodyStep.class;
|
||||
|
|
@ -142,31 +140,31 @@ 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;
|
||||
}
|
||||
// /**
|
||||
// * 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;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Adds a localized main text.
|
||||
|
|
@ -274,7 +272,9 @@ public class MvcArticleTextBodyStep extends AbstractMvcAuthoringStep {
|
|||
}
|
||||
|
||||
if (itemPermissionChecker.canEditItem(getArticle())) {
|
||||
selectedLocale = new Locale(localeParam).toString();
|
||||
articleTextBodyStepModel.setSelectedLocale(
|
||||
new Locale(localeParam).toString()
|
||||
);
|
||||
|
||||
return "org/librecms/ui/contenttypes/article/article-text/edit.xhtml";
|
||||
} else {
|
||||
|
|
@ -379,35 +379,44 @@ public class MvcArticleTextBodyStep extends AbstractMvcAuthoringStep {
|
|||
super.init();
|
||||
|
||||
if (itemPermissionChecker.canEditItem(getArticle())) {
|
||||
textValues = getArticle()
|
||||
.getText()
|
||||
.getValues()
|
||||
.entrySet()
|
||||
.stream()
|
||||
.collect(
|
||||
Collectors.toMap(
|
||||
entry -> entry.getKey().toString(),
|
||||
entry -> entry.getValue()
|
||||
articleTextBodyStepModel.setCanEdit(
|
||||
itemPermissionChecker.canEditItem(getArticle())
|
||||
);
|
||||
articleTextBodyStepModel.setTextValues(
|
||||
getArticle()
|
||||
.getText()
|
||||
.getValues()
|
||||
.entrySet()
|
||||
.stream()
|
||||
.collect(
|
||||
Collectors.toMap(
|
||||
entry -> entry.getKey().toString(),
|
||||
entry -> entry.getValue()
|
||||
)
|
||||
)
|
||||
);
|
||||
);
|
||||
|
||||
variants = getArticle()
|
||||
.getText()
|
||||
.getValues()
|
||||
.entrySet()
|
||||
.stream()
|
||||
.map(this::buildVariantRow)
|
||||
.collect(Collectors.toList());
|
||||
articleTextBodyStepModel.setVariants(
|
||||
getArticle()
|
||||
.getText()
|
||||
.getValues()
|
||||
.entrySet()
|
||||
.stream()
|
||||
.map(this::buildVariantRow)
|
||||
.collect(Collectors.toList())
|
||||
);
|
||||
|
||||
final Set<Locale> locales = getArticle()
|
||||
.getText()
|
||||
.getAvailableLocales();
|
||||
unusedLocales = globalizationHelper
|
||||
.getAvailableLocales()
|
||||
.stream()
|
||||
.filter(locale -> !locales.contains(locale))
|
||||
.map(Locale::toString)
|
||||
.collect(Collectors.toList());
|
||||
articleTextBodyStepModel.setUnusedLocales(
|
||||
globalizationHelper
|
||||
.getAvailableLocales()
|
||||
.stream()
|
||||
.filter(locale -> !locales.contains(locale))
|
||||
.map(Locale::toString)
|
||||
.collect(Collectors.toList())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,102 @@
|
|||
/*
|
||||
* Copyright (C) 2021 LibreCCM Foundation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
package org.librecms.ui.contenttypes;
|
||||
|
||||
import org.librecms.ui.contentsections.documents.CmsEditorLocaleVariantRow;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Named;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@RequestScoped
|
||||
@Named("CmsArticleTextBodyStep")
|
||||
public class MvcArticleTextBodyStepModel {
|
||||
|
||||
private boolean canEdit;
|
||||
|
||||
private Map<String, String> textValues;
|
||||
|
||||
private List<CmsEditorLocaleVariantRow> variants;
|
||||
|
||||
private List<String> unusedLocales;
|
||||
|
||||
private String selectedLocale;
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
|
||||
protected void setTextValues(final Map<String, String> textValues) {
|
||||
this.textValues = new HashMap<>(textValues);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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<CmsEditorLocaleVariantRow> getVariants() {
|
||||
return Collections.unmodifiableList(variants);
|
||||
}
|
||||
|
||||
protected void setVariants(final List<CmsEditorLocaleVariantRow> variants) {
|
||||
this.variants = new ArrayList<>(variants);
|
||||
}
|
||||
|
||||
public List<String> getUnusedLocales() {
|
||||
return Collections.unmodifiableList(unusedLocales);
|
||||
}
|
||||
|
||||
protected void setUnusedLocales(final List<String> unusedLocales) {
|
||||
this.unusedLocales = new ArrayList<>(unusedLocales);
|
||||
}
|
||||
|
||||
public String getSelectedLocale() {
|
||||
return selectedLocale;
|
||||
}
|
||||
|
||||
protected void setSelectedLocale(final String selectedLocale) {
|
||||
this.selectedLocale = selectedLocale;
|
||||
}
|
||||
|
||||
public boolean getCanEdit() {
|
||||
return canEdit;
|
||||
}
|
||||
|
||||
protected void setCanEdit(final boolean canEdit) {
|
||||
this.canEdit = canEdit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -9,12 +9,12 @@
|
|||
|
||||
<ui:define name="editStep">
|
||||
<div class="container">
|
||||
<h2>#{CmsAssetsStepsDefaultMessagesBundle.getMessage('postaladdress.editstep.header', [CmsPostalAddressEditStep.name])}</h2>
|
||||
<h2>#{CmsAssetsStepsDefaultMessagesBundle.getMessage('postaladdress.editstep.header', [MvcAssetEditStepModel.name])}</h2>
|
||||
|
||||
<h3>#{CmsAssetsStepsDefaultMessagesBundle['editstep.name.header']}</h3>
|
||||
<div class="d-flex">
|
||||
<pre class="mr-2">#{CmsPostalAddressEditStep.name}</pre>
|
||||
<c:if test="#{CmsPostalAddressEditStep.canEdit}">
|
||||
<pre class="mr-2">#{MvcAssetEditStepModel.name}</pre>
|
||||
<c:if test="#{MvcAssetEditStepModel.canEdit}">
|
||||
<button class="btn btn-primary btn-sm"
|
||||
data-toggle="modal"
|
||||
data-target="#name-edit-dialog"
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
</c:if>
|
||||
</div>
|
||||
|
||||
<c:if test="#{CmsPostalAddressEditStep.canEdit}">
|
||||
<c:if test="#{MvcAssetEditStepModel.canEdit}">
|
||||
<div aria-hidden="true"
|
||||
aria-labelledby="name-edit-dialog-title"
|
||||
class="modal fade"
|
||||
|
|
@ -57,7 +57,7 @@
|
|||
name="name"
|
||||
pattern="^([a-zA-Z0-9_-]*)$"
|
||||
required="true"
|
||||
value="#{CmsPostalAddressEditStep.name}"
|
||||
value="#{MvcAssetEditStepModel.name}"
|
||||
/>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
|
|
@ -94,10 +94,10 @@
|
|||
editDialogValueLabel="#{CmsAssetsStepsDefaultMessagesBundle['editstep.title.edit.value.label']}"
|
||||
editMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/assets/#{CmsSelectedAssetModel.assetPath}/@postaladdress-edit/title/@edit"
|
||||
editorId="title-editor"
|
||||
hasUnusedLocales="#{!CmsPostalAddressEditStep.unusedTitleLocales.isEmpty()}"
|
||||
hasUnusedLocales="#{!MvcAssetEditStepModel.unusedTitleLocales.isEmpty()}"
|
||||
headingLevel="3"
|
||||
objectIdentifier="#{CmsSelectedAssetModel.assetPath}"
|
||||
readOnly="#{!CmsPostalAddressEditStep.canEdit}"
|
||||
readOnly="#{!MvcAssetEditStepModel.canEdit}"
|
||||
removeButtonLabel="#{CmsAssetsStepsDefaultMessagesBundle['editstep.title.remove']}"
|
||||
removeDialogCancelLabel="#{CmsAssetsStepsDefaultMessagesBundle['editstep.title.remove.cancel']}"
|
||||
removeDialogSubmitLabel="#{CmsAssetsStepsDefaultMessagesBundle['editstep.title.remove.submit']}"
|
||||
|
|
@ -105,13 +105,13 @@
|
|||
removeDialogTitle="#{CmsAssetsStepsDefaultMessagesBundle['editstep.title.remove.title']}"
|
||||
removeMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/assets/#{CmsSelectedAssetModel.assetPath}/@postaladdress-edit/title/@remove"
|
||||
title="#{CmsAssetsStepsDefaultMessagesBundle['editstep.title.header']}"
|
||||
unusedLocales="#{CmsPostalAddressEditStep.unusedTitleLocales}"
|
||||
values="#{CmsPostalAddressEditStep.titleValues}"
|
||||
unusedLocales="#{MvcAssetEditStepModel.unusedTitleLocales}"
|
||||
values="#{MvcAssetEditStepModel.titleValues}"
|
||||
/>
|
||||
|
||||
<h3>#{CmsAssetsStepsDefaultMessagesBundle['postaladdress.editstep.properties.header']}</h3>
|
||||
|
||||
<c:if test="#{CmsPostalAddressEditStep.canEdit}">
|
||||
<c:if test="#{MvcAssetEditStepModel.canEdit}">
|
||||
<div class="text-right">
|
||||
<button class="btn btn-primary"
|
||||
data-toggle="modal"
|
||||
|
|
|
|||
|
|
@ -10,13 +10,13 @@
|
|||
|
||||
<ui:define name="editStep">
|
||||
<div class="container">
|
||||
<h2>#{CmsAssetsStepsDefaultMessagesBundle.getMessage('sidenote.editstep.header', [CmsSideNoteEditStep.name])}</h2>
|
||||
<h2>#{CmsAssetsStepsDefaultMessagesBundle.getMessage('sidenote.editstep.header', [MvcAssetEditStepModel.name])}</h2>
|
||||
|
||||
|
||||
<h3>#{CmsAssetsStepsDefaultMessagesBundle['editstep.name.header']}</h3>
|
||||
<div class="d-flex">
|
||||
<pre class="mr-2">#{CmsSideNoteEditStep.name}</pre>
|
||||
<c:if test="#{CmsSideNoteEditStep.canEdit}">
|
||||
<pre class="mr-2">#{MvcAssetEditStepModel.name}</pre>
|
||||
<c:if test="#{MvcAssetEditStepModel.canEdit}">
|
||||
<button class="btn btn-primary btn-sm"
|
||||
data-toggle="modal"
|
||||
data-target="#name-edit-dialog"
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
</c:if>
|
||||
</div>
|
||||
|
||||
<c:if test="#{CmsSideNoteEditStep.canEdit}">
|
||||
<c:if test="#{MvcAssetEditStepModel.canEdit}">
|
||||
<div aria-hidden="true"
|
||||
aria-labelledby="name-edit-dialog-title"
|
||||
class="modal fade"
|
||||
|
|
@ -59,7 +59,7 @@
|
|||
name="name"
|
||||
pattern="^([a-zA-Z0-9_-]*)$"
|
||||
required="true"
|
||||
value="#{CmsSideNoteEditStep.name}"
|
||||
value="#{MvcAssetEditStepModel.name}"
|
||||
/>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
|
|
@ -96,10 +96,10 @@
|
|||
editDialogValueLabel="#{CmsAssetsStepsDefaultMessagesBundle['editstep.title.edit.value.label']}"
|
||||
editMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/assets/#{CmsSelectedAssetModel.assetPath}/@sidenote-edit/title/@edit"
|
||||
editorId="title-editor"
|
||||
hasUnusedLocales="#{!CmsSideNoteEditStep.unusedTitleLocales.isEmpty()}"
|
||||
hasUnusedLocales="#{!MvcAssetEditStepModel.unusedTitleLocales.isEmpty()}"
|
||||
headingLevel="3"
|
||||
objectIdentifier="#{CmsSelectedAssetModel.assetPath}"
|
||||
readOnly="#{!CmsSideNoteEditStep.canEdit}"
|
||||
readOnly="#{!MvcAssetEditStepModel.canEdit}"
|
||||
removeButtonLabel="#{CmsAssetsStepsDefaultMessagesBundle['editstep.title.remove']}"
|
||||
removeDialogCancelLabel="#{CmsAssetsStepsDefaultMessagesBundle['editstep.title.remove.cancel']}"
|
||||
removeDialogSubmitLabel="#{CmsAssetsStepsDefaultMessagesBundle['editstep.title.remove.submit']}"
|
||||
|
|
@ -107,29 +107,29 @@
|
|||
removeDialogTitle="#{CmsAssetsStepsDefaultMessagesBundle['editstep.title.remove.title']}"
|
||||
removeMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/assets/#{CmsSelectedAssetModel.assetPath}/@sidenote-edit/title/@remove"
|
||||
title="#{CmsAssetsStepsDefaultMessagesBundle['editstep.title.header']}"
|
||||
unusedLocales="#{CmsSideNoteEditStep.unusedTitleLocales}"
|
||||
values="#{CmsSideNoteEditStep.titleValues}"
|
||||
unusedLocales="#{MvcAssetEditStepModel.unusedTitleLocales}"
|
||||
values="#{MvcAssetEditStepModel.titleValues}"
|
||||
/>
|
||||
|
||||
<c:if test="#{CmsSideNoteEditStep.canEdit}">
|
||||
<c:if test="#{MvcAssetEditStepModel.canEdit}">
|
||||
<librecms:cmsEditor
|
||||
addButtonLabel="#{CmsAssetsStepsDefaultMessagesBundle['sidenote.sidenote.text.editor.add_variant']}"
|
||||
addDialogLocaleSelectHelp="#{CmsAssetsStepsDefaultMessagesBundle['sidenote.text.editor.add.locale.help']}"
|
||||
addDialogLocaleSelectLabel="#{CmsAssetsStepsDefaultMessagesBundle['sidenote.text.editor.add.locale.label']}"
|
||||
addMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/assets/#{CmsSideNoteEditStep.assetPath}/@sidenote-edit/text/add"
|
||||
addMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/assets/#{CmsSelectedAssetModel.assetPath}/@sidenote-edit/text/add"
|
||||
editDialogValueHelp="#{CmsAssetsStepsDefaultMessagesBundle['sidenote.text.editor.edit.value.help']}"
|
||||
editDialogValueLabel="#{CmsAssetsStepsDefaultMessagesBundle['sidenote.text.editor.edit.value.label']}"
|
||||
editMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/assets/#{CmsSideNoteEditStep.assetPath}/@sidenote-edit/text/edit"
|
||||
editMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/assets/#{CmsSelectedAssetModel.assetPath}/@sidenote-edit/text/edit"
|
||||
editorId="sidenote-text-editor"
|
||||
hasUnusedLocales="#{!CmsSideNoteEditStep.unusedTextLocales.isEmpty()}"
|
||||
headingLevel="3"
|
||||
objectIdentifier="#{CmsSelectedDocumentModel.itemPath}"
|
||||
removeMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/assets/#{CmsSideNoteEditStep.assetPath}/@sidenote-edit/text/remove"
|
||||
removeMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/assets/#{CmsSelectedAssetModel.assetPath}/@sidenote-edit/text/remove"
|
||||
title="#{CmsAssetsStepsDefaultMessagesBundle['sidenote.editstep.text.header']}"
|
||||
unusedLocales="#{CmsSideNoteEditStep.unusedTextLocales}"
|
||||
variantUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/assets/#{CmsSideNoteEditStep.assetPath}/@sidenote-edit-resources/text/variants"
|
||||
variantUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/assets/#{CmsSelectedAssetModel.assetPath}/@sidenote-edit-resources/text/variants"
|
||||
variants="#{CmsSideNoteEditStep.variants}"
|
||||
wordCountUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/assets/#{CmsSideNoteEditStep.assetPath}/@sidenote-edit-resources/text/variants/wordcount"
|
||||
wordCountUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/assets/#{CmsSelectedAssetModel.assetPath}/@sidenote-edit-resources/text/variants/wordcount"
|
||||
/>
|
||||
</c:if>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue