Zusätzliches Feld für Namen eines Verlages eingefügt, um Konflikte mit dem Titel des ContentItems zu vermeiden. Zusätzlichen einen speziellen CreateStep für Publisher hinzugefügt, der den Title aus dem Namen und dem Sitz (Erscheinungsort) des Verlages generiert.
git-svn-id: https://svn.libreccm.org/ccm/trunk@861 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
f463201043
commit
bfef7db7b6
|
|
@ -99,7 +99,7 @@ public class DaBInImporter extends Program {
|
|||
private static final Logger logger = Logger.getLogger(DaBInImporter.class);
|
||||
private Properties config;
|
||||
private String timestamp = null;
|
||||
private ContentSection section;
|
||||
private ContentSection section;
|
||||
private ContentSection personsSection;
|
||||
private ContentSection projectsSection;
|
||||
private ContentSection publicationsSection;
|
||||
|
|
@ -203,7 +203,7 @@ public class DaBInImporter extends Program {
|
|||
section = getContentSection(config.getProperty("ccm.contentsection"));
|
||||
personsSection = getContentSection(config.getProperty(
|
||||
"ccm.personsContentSection"));
|
||||
|
||||
|
||||
projectsSection = getContentSection(config.getProperty(
|
||||
"ccm.projectsContentSection"));
|
||||
publicationsSection = getContentSection(config.getProperty(
|
||||
|
|
@ -2738,13 +2738,15 @@ public class DaBInImporter extends Program {
|
|||
//bundle.save();
|
||||
|
||||
RelatedLink download = new RelatedLink();
|
||||
download.setTitle(config.getProperty("workingpaper.download.de"));
|
||||
download.setTitle(config.getProperty(
|
||||
"workingpaper.download.de"));
|
||||
download.setTargetType(Link.INTERNAL_LINK);
|
||||
download.setTargetItem(fsi);
|
||||
download.setLinkOwner(workingPaperDe);
|
||||
|
||||
download = new RelatedLink();
|
||||
download.setTitle(config.getProperty("workingpaper.download.en"));
|
||||
download.setTitle(config.getProperty(
|
||||
"workingpaper.download.en"));
|
||||
download.setTargetType(Link.INTERNAL_LINK);
|
||||
download.setTargetItem(fsi);
|
||||
download.setLinkOwner(workingPaperEn);
|
||||
|
|
@ -2882,14 +2884,16 @@ public class DaBInImporter extends Program {
|
|||
getName()));
|
||||
} else {
|
||||
/*publisherDe.setTitle(String.format("%s, %s", publisherData.
|
||||
getName(), publisherData.getPlace()));*/
|
||||
publisherDe.setTitle(String.format("%s", publisherData.
|
||||
getName()));
|
||||
getName(), publisherData.getPlace()));*/
|
||||
publisherDe.setTitle(String.format("%s %s",
|
||||
publisherData.getName(),
|
||||
publisherData.getPlace()));
|
||||
publisherDe.setName(DaBInImporter.normalizeString(String.
|
||||
format(
|
||||
"%s, %s", publisherData.getName(), publisherData.
|
||||
"%s %s", publisherData.getName(), publisherData.
|
||||
getPlace())));
|
||||
}
|
||||
publisherDe.setPublisherName(publisherData.getName());
|
||||
publisherDe.setPlace(publisherData.getPlace());
|
||||
publisherDe.setLanguage("de");
|
||||
publisherDe.setLifecycle(createLifecycle(publicationsLifecycle));
|
||||
|
|
@ -2906,13 +2910,14 @@ public class DaBInImporter extends Program {
|
|||
publisherEn.setName(DaBInImporter.normalizeString(publisherData.
|
||||
getName()));
|
||||
} else {
|
||||
publisherEn.setTitle(String.format("%s, %s", publisherData.
|
||||
publisherEn.setTitle(String.format("%s %s", publisherData.
|
||||
getName(), publisherData.getPlace()));
|
||||
publisherEn.setName(DaBInImporter.normalizeString(String.
|
||||
format(
|
||||
"%s, %s", publisherData.getName(), publisherData.
|
||||
"%s %s", publisherData.getName(), publisherData.
|
||||
getPlace())));
|
||||
}
|
||||
publisherEn.setPublisherName(publisherData.getName());
|
||||
publisherEn.setPlace(publisherData.getPlace());
|
||||
publisherEn.setLanguage("en");
|
||||
publisherEn.setLifecycle(createLifecycle(publicationsLifecycle));
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@
|
|||
//
|
||||
//
|
||||
|
||||
// version: $Id$
|
||||
|
||||
model com.arsdigita.cms.contenttypes;
|
||||
|
||||
import com.arsdigita.cms.*;
|
||||
|
|
@ -25,6 +27,7 @@ import com.arsdigita.cms.*;
|
|||
// PDL definition for a publisher
|
||||
object type Publisher extends GenericOrganizationalUnit {
|
||||
|
||||
String[0..1] publisherName = ct_publisher.publishername VARCHAR(512);
|
||||
String[0..1] place = ct_publisher.place VARCHAR(256);
|
||||
|
||||
reference key (ct_publisher.publisher_id);
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
objectType="com.arsdigita.cms.contenttypes.Publisher"
|
||||
classname="com.arsdigita.cms.contenttypes.Publisher">
|
||||
|
||||
<ctd:authoring-kit createComponent="com.arsdigita.cms.ui.authoring.PageCreate">
|
||||
<ctd:authoring-kit createComponent="com.arsdigita.cms.contenttypes.ui.PublisherCreate">
|
||||
|
||||
<ctd:authoring-step
|
||||
labelKey="publications.ui.publisher_properties.title"
|
||||
|
|
|
|||
|
|
@ -29,9 +29,11 @@ import java.math.BigDecimal;
|
|||
* {@link GenericOrganizationalUnit} class as base.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @version $Id$
|
||||
*/
|
||||
public class Publisher extends GenericOrganizationalUnit {
|
||||
|
||||
public static final String PUBLISHER_NAME = "publisherName";
|
||||
public static final String PLACE = "place";
|
||||
public static final String BASE_DATA_OBJECT_TYPE =
|
||||
"com.arsdigita.cms.contenttypes.Publisher";
|
||||
|
|
@ -56,6 +58,14 @@ public class Publisher extends GenericOrganizationalUnit {
|
|||
super(type);
|
||||
}
|
||||
|
||||
public String getPublisherName() {
|
||||
return (String) get(PUBLISHER_NAME);
|
||||
}
|
||||
|
||||
public void setPublisherName(String publisherName) {
|
||||
set(PUBLISHER_NAME, publisherName);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return The place of the publisher.
|
||||
|
|
@ -71,4 +81,30 @@ public class Publisher extends GenericOrganizationalUnit {
|
|||
public void setPlace(String place) {
|
||||
set(PLACE, place);
|
||||
}
|
||||
|
||||
// Create a ulr save version of the full name
|
||||
public static String urlSave(String in) {
|
||||
|
||||
if (in != null && !in.isEmpty()) {
|
||||
|
||||
// Replacement map
|
||||
String[][] replacements = {{"ä", "ae"}, {"Ä", "Ae"}, {"ö", "oe"}, {
|
||||
"Ö", "Oe"}, {"ü", "ue"}, {"Ü", "Ue"}, {"ß", "ss"}, {".", ""}};
|
||||
|
||||
// Replace all spaces with dash
|
||||
String out = in.replace(" ", "-");
|
||||
|
||||
// Replace all special chars defined in replacement map
|
||||
for (int i = 0; i < replacements.length; i++) {
|
||||
out = out.replace(replacements[i][0], replacements[i][1]);
|
||||
}
|
||||
|
||||
// Replace all special chars that are not yet replaced with a dash
|
||||
return out.replaceAll("[^A-Za-z0-9-]", "_").toLowerCase();
|
||||
}
|
||||
|
||||
return in;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -318,3 +318,5 @@ publications.ui.articleinjournal.reviewed.no=No
|
|||
publications.ui.workingpaper.reviewed=Reviewed?
|
||||
publications.ui.workingpaper.reviewed.yes=Yes
|
||||
publications.ui.workingpaper.reviewed.no=No
|
||||
publication.ui.publisher.name=Name of publisher
|
||||
publications.ui.publisher.name=Name of publisher
|
||||
|
|
|
|||
|
|
@ -317,3 +317,5 @@ publications.ui.articleinjournal.reviewed.no=Nein
|
|||
publications.ui.workingpaper.reviewed=Begutachtet?
|
||||
publications.ui.workingpaper.reviewed.yes=Ja
|
||||
publications.ui.workingpaper.reviewed.no=Nein
|
||||
publication.ui.publisher.name=Name des Verlages
|
||||
publications.ui.publisher.name=Name des Verlages
|
||||
|
|
|
|||
|
|
@ -0,0 +1,121 @@
|
|||
package com.arsdigita.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.bebop.ColumnPanel;
|
||||
import com.arsdigita.bebop.FormData;
|
||||
import com.arsdigita.bebop.FormProcessException;
|
||||
import com.arsdigita.bebop.Label;
|
||||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||
import com.arsdigita.bebop.parameters.DateParameter;
|
||||
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||
import com.arsdigita.bebop.util.GlobalizationUtil;
|
||||
import com.arsdigita.cms.ContentBundle;
|
||||
import com.arsdigita.cms.ContentPage;
|
||||
import com.arsdigita.cms.ContentSection;
|
||||
import com.arsdigita.cms.ContentType;
|
||||
import com.arsdigita.cms.Folder;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.contenttypes.Publisher;
|
||||
import com.arsdigita.cms.ui.authoring.ApplyWorkflowFormSection;
|
||||
import com.arsdigita.cms.ui.authoring.CreationSelector;
|
||||
import com.arsdigita.cms.ui.authoring.LanguageWidget;
|
||||
import com.arsdigita.cms.ui.authoring.PageCreate;
|
||||
import com.arsdigita.util.Assert;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @version $Id$
|
||||
*/
|
||||
public class PublisherCreate extends PageCreate {
|
||||
|
||||
public static final String PUBLISHER_NAME = Publisher.PUBLISHER_NAME;
|
||||
public static final String PLACE = Publisher.PLACE;
|
||||
|
||||
public PublisherCreate(final ItemSelectionModel itemModel,
|
||||
final CreationSelector parent) {
|
||||
super(itemModel, parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addWidgets() {
|
||||
ContentType type = getItemSelectionModel().getContentType();
|
||||
m_workflowSection = new ApplyWorkflowFormSection(type);
|
||||
add(m_workflowSection, ColumnPanel.INSERT);
|
||||
add(new Label(GlobalizationUtil.globalize(
|
||||
"cms.ui.authoring.content_type")));
|
||||
add(new Label(type.getLabel()));
|
||||
add(new Label(GlobalizationUtil.globalize("cms.ui.language.field")));
|
||||
add(new LanguageWidget(LANGUAGE));
|
||||
|
||||
PublisherPropertyForm.addMandatoryFieldWidgets(this);
|
||||
|
||||
if (!ContentSection.getConfig().getHideLaunchDate()) {
|
||||
add(new Label(GlobalizationUtil.globalize(
|
||||
"cms.ui.authoring.page_launch_date")));
|
||||
ParameterModel launchDateParam = new DateParameter(LAUNCH_DATE);
|
||||
com.arsdigita.bebop.form.Date launchDate = new com.arsdigita.bebop.form.Date(
|
||||
launchDateParam);
|
||||
if (ContentSection.getConfig().getRequireLaunchDate()) {
|
||||
launchDate.addValidationListener(
|
||||
new LaunchDateValidationListener());
|
||||
// if launch date is required, help user by suggesting today's date
|
||||
launchDateParam.setDefaultValue(new Date());
|
||||
}
|
||||
add(launchDate);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate(FormSectionEvent fse) throws FormProcessException {
|
||||
Folder folder = m_parent.getFolder(fse.getPageState());
|
||||
Assert.exists(folder);
|
||||
validateNameUniqueness(folder, fse, Publisher.urlSave(getFullName(fse)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(final FormSectionEvent fse) throws FormProcessException {
|
||||
final FormData data = fse.getFormData();
|
||||
final PageState state = fse.getPageState();
|
||||
final ContentSection section = m_parent.getContentSection(state);
|
||||
Folder folder = m_parent.getFolder(state);
|
||||
|
||||
String fullName = getFullName(fse);
|
||||
Assert.exists(section, ContentSection.class);
|
||||
|
||||
final ContentPage item = createContentPage(state);
|
||||
item.setLanguage((String) data.get(LANGUAGE));
|
||||
item.setName(Publisher.urlSave(fullName));
|
||||
item.setTitle(fullName);
|
||||
if (!ContentSection.getConfig().getHideLaunchDate()) {
|
||||
item.setLaunchDate((Date) data.get(LAUNCH_DATE));
|
||||
}
|
||||
|
||||
final ContentBundle bundle = new ContentBundle(item);
|
||||
bundle.setParent(folder);
|
||||
bundle.setContentSection(section);
|
||||
bundle.save();
|
||||
|
||||
m_workflowSection.applyWorkflow(state, item);
|
||||
|
||||
Publisher publisher = new Publisher(item.getOID());
|
||||
publisher.setPublisherName(data.getString(PUBLISHER_NAME));
|
||||
publisher.setPlace(data.getString(PLACE));
|
||||
publisher.save();
|
||||
|
||||
m_parent.editItem(state, item);
|
||||
}
|
||||
|
||||
private String getFullName(FormSectionEvent fse) {
|
||||
final FormData data = fse.getFormData();
|
||||
String publisherName = data.getString(PUBLISHER_NAME);
|
||||
String place = data.getString(PLACE);
|
||||
|
||||
if (place == null) {
|
||||
place = "";
|
||||
}
|
||||
|
||||
return String.format("%s %s", publisherName, place).trim();
|
||||
}
|
||||
}
|
||||
|
|
@ -32,6 +32,7 @@ import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
|
|||
/**
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @version $Id$
|
||||
*/
|
||||
public class PublisherPropertiesStep
|
||||
extends GenericOrganizationalUnitPropertiesStep {
|
||||
|
|
@ -46,6 +47,10 @@ public class PublisherPropertiesStep
|
|||
DomainObjectPropertySheet sheet = (DomainObjectPropertySheet) getGenericOrganizationalUnitPropertySheet(
|
||||
itemModel);
|
||||
|
||||
sheet.add(PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.publisher.name"),
|
||||
Publisher.PUBLISHER_NAME);
|
||||
|
||||
sheet.add(PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.publisher.place"),
|
||||
Publisher.PLACE);
|
||||
|
|
|
|||
|
|
@ -21,12 +21,15 @@ package com.arsdigita.cms.contenttypes.ui;
|
|||
|
||||
import com.arsdigita.bebop.FormData;
|
||||
import com.arsdigita.bebop.FormProcessException;
|
||||
import com.arsdigita.bebop.FormSection;
|
||||
import com.arsdigita.bebop.Label;
|
||||
import com.arsdigita.bebop.event.FormInitListener;
|
||||
import com.arsdigita.bebop.event.FormProcessListener;
|
||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||
import com.arsdigita.bebop.event.FormSubmissionListener;
|
||||
import com.arsdigita.bebop.form.TextField;
|
||||
import com.arsdigita.bebop.parameters.NotEmptyValidationListener;
|
||||
import com.arsdigita.bebop.parameters.NotNullValidationListener;
|
||||
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
|
|
@ -35,6 +38,7 @@ import com.arsdigita.cms.contenttypes.Publisher;
|
|||
/**
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @version $Id$
|
||||
*/
|
||||
public class PublisherPropertyForm
|
||||
extends GenericOrganizationalUnitPropertyForm
|
||||
|
|
@ -43,7 +47,8 @@ public class PublisherPropertyForm
|
|||
FormSubmissionListener {
|
||||
|
||||
private PublisherPropertiesStep m_step;
|
||||
public static final String PLACE = "place";
|
||||
public static final String PUBLISHER_NAME = Publisher.PUBLISHER_NAME;
|
||||
public static final String PLACE = Publisher.PLACE;
|
||||
public static final String ID = "Publisher_edit";
|
||||
|
||||
public PublisherPropertyForm(ItemSelectionModel itemModel) {
|
||||
|
|
@ -61,11 +66,23 @@ public class PublisherPropertyForm
|
|||
protected void addWidgets() {
|
||||
super.addWidgets();
|
||||
|
||||
add(new Label((String) PublicationGlobalizationUtil.globalize(
|
||||
addMandatoryFieldWidgets(this);
|
||||
}
|
||||
|
||||
public static void addMandatoryFieldWidgets(FormSection form) {
|
||||
form.add(new Label((String) PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.publisher.name").localize()));
|
||||
ParameterModel nameParam = new StringParameter(PUBLISHER_NAME);
|
||||
TextField name = new TextField(nameParam);
|
||||
name.addValidationListener(new NotNullValidationListener());
|
||||
name.addValidationListener(new NotEmptyValidationListener());
|
||||
form.add(name);
|
||||
|
||||
form.add(new Label((String) PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.publisher.place").localize()));
|
||||
ParameterModel placeParam = new StringParameter(PLACE);
|
||||
TextField place = new TextField(placeParam);
|
||||
add(place);
|
||||
form.add(place);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -75,6 +92,7 @@ public class PublisherPropertyForm
|
|||
FormData data = fse.getFormData();
|
||||
Publisher publisher = (Publisher) super.initBasicWidgets(fse);
|
||||
|
||||
data.put(PUBLISHER_NAME, publisher.getPublisherName());
|
||||
data.put(PLACE, publisher.getPlace());
|
||||
}
|
||||
|
||||
|
|
@ -87,9 +105,10 @@ public class PublisherPropertyForm
|
|||
|
||||
if ((publisher != null) && getSaveCancelSection().getSaveButton().
|
||||
isSelected(fse.getPageState())) {
|
||||
publisher.setPublisherName((String) data.get(PUBLISHER_NAME));
|
||||
publisher.setPlace((String) data.get(PLACE));
|
||||
}
|
||||
|
||||
publisher.save();
|
||||
publisher.save();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue