Weitere Korrekturen in Zusammenhang mit Sprachunabhängigen Items und Validerung
git-svn-id: https://svn.libreccm.org/ccm/trunk@1216 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
2f4e7b1a50
commit
373769cf44
|
|
@ -25,6 +25,7 @@ import com.arsdigita.cms.contenttypes.ui.GenericOrganizationalUnitSubordinateOrg
|
|||
import com.arsdigita.cms.contenttypes.ui.GenericOrganizationalUnitSubordinateOrgaUnitsTable;
|
||||
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import com.arsdigita.persistence.DataCollection;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import com.arsdigita.persistence.OID;
|
||||
|
|
@ -77,7 +78,7 @@ public class GenericOrganizationalUnit extends ContentPage {
|
|||
public GenericOrganizationalUnit(final String type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
|
||||
public String getAddendum() {
|
||||
return (String) get(ADDENDUM);
|
||||
}
|
||||
|
|
@ -131,9 +132,11 @@ public class GenericOrganizationalUnit extends ContentPage {
|
|||
GenericPerson personToLink = person;
|
||||
|
||||
final ContentBundle bundle = person.getContentBundle();
|
||||
if ((bundle != null) && (bundle.hasInstance(this.getLanguage(), true))) {
|
||||
if ((bundle != null) && (bundle.hasInstance(this.getLanguage(), Kernel.
|
||||
getConfig().
|
||||
languageIndependentItems()))) {
|
||||
personToLink =
|
||||
(GenericPerson) bundle.getInstance(this.getLanguage(), true);
|
||||
(GenericPerson) bundle.getInstance(this.getLanguage());
|
||||
}
|
||||
|
||||
Assert.exists(personToLink, GenericPerson.class);
|
||||
|
|
@ -221,11 +224,12 @@ public class GenericOrganizationalUnit extends ContentPage {
|
|||
|
||||
final DataObject link = add(SUBORDINATE_ORGAUNITS, orgaunit);
|
||||
link.set(GenericOrganizationalUnitSubordinateCollection.ASSOCTYPE,
|
||||
assocType);
|
||||
assocType);
|
||||
link.set(
|
||||
GenericOrganizationalUnitSubordinateCollection.SUBORDINATE_ORGAUNIT_ORDER,
|
||||
(int) getSubordinateOrgaUnits().size());
|
||||
link.set(GenericOrganizationalUnitSuperiorCollection.SUPERIOR_ORGAUNIT_ORDER,
|
||||
link.set(
|
||||
GenericOrganizationalUnitSuperiorCollection.SUPERIOR_ORGAUNIT_ORDER,
|
||||
((int) getSuperiorOrgaUnits().size()) + 1);
|
||||
link.save();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import com.arsdigita.cms.contenttypes.GenericContact;
|
|||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||
import com.arsdigita.cms.ContentType;
|
||||
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
|
@ -162,7 +163,9 @@ public class GenericContactAttachAddressPropertyForm extends BasicPageForm
|
|||
|
||||
GenericAddress address = (GenericAddress) data.get(ITEM_SEARCH);
|
||||
|
||||
if (!(address.getContentBundle().hasInstance(contact.getLanguage(), true))) {
|
||||
if (!(address.getContentBundle().hasInstance(contact.getLanguage(),
|
||||
Kernel.getConfig().
|
||||
languageIndependentItems()))) {
|
||||
data.addError( ContenttypesGlobalizationUtil.globalize(
|
||||
"cms.contenttypes.ui.contact.select_address.no_suitable_language_variant"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import com.arsdigita.cms.contenttypes.GenericContactTypeCollection;
|
|||
import com.arsdigita.cms.contenttypes.GenericPersonContactCollection;
|
||||
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
|
||||
import com.arsdigita.globalization.GlobalizationHelper;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
|
@ -38,7 +39,7 @@ import org.apache.log4j.Logger;
|
|||
*/
|
||||
public class GenericContactAttachPersonPropertyForm extends BasicPageForm
|
||||
implements FormProcessListener, FormInitListener, FormSubmissionListener {
|
||||
|
||||
|
||||
private static final Logger logger =
|
||||
Logger.getLogger(
|
||||
GenericContactPropertyForm.class);
|
||||
|
|
@ -72,14 +73,14 @@ public class GenericContactAttachPersonPropertyForm extends BasicPageForm
|
|||
GenericContactPersonPropertiesStep step) {
|
||||
super(ID, itemModel);
|
||||
addSubmissionListener(this);
|
||||
|
||||
|
||||
addSaveCancelSection();
|
||||
|
||||
|
||||
addInitListener(this);
|
||||
addSubmissionListener(this);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addWidgets() {
|
||||
add(new Label((String) ContenttypesGlobalizationUtil.globalize(
|
||||
|
|
@ -104,41 +105,41 @@ public class GenericContactAttachPersonPropertyForm extends BasicPageForm
|
|||
new GenericContactTypeCollection();
|
||||
contacttypes.addLanguageFilter(GlobalizationHelper.getNegotiatedLocale().
|
||||
getLanguage());
|
||||
|
||||
|
||||
while (contacttypes.next()) {
|
||||
RelationAttribute ct = contacttypes.getRelationAttribute();
|
||||
contactType.addOption(new Option(ct.getKey(), ct.getName()));
|
||||
}
|
||||
|
||||
|
||||
add(contactType);
|
||||
}
|
||||
|
||||
|
||||
public void init(FormSectionEvent fse) {
|
||||
FormData data = fse.getFormData();
|
||||
PageState state = fse.getPageState();
|
||||
GenericContact contact = (GenericContact) getItemSelectionModel().
|
||||
getSelectedObject(state);
|
||||
|
||||
|
||||
setVisible(state, true);
|
||||
|
||||
|
||||
if (contact != null) {
|
||||
data.put(ITEM_SEARCH, contact.getPerson());
|
||||
data.put(CONTACTS_KEY, contact.getContactType());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void process(FormSectionEvent fse) {
|
||||
FormData data = fse.getFormData();
|
||||
PageState state = fse.getPageState();
|
||||
GenericContact contact = (GenericContact) getItemSelectionModel().
|
||||
getSelectedObject(state);
|
||||
|
||||
|
||||
if (!this.getSaveCancelSection().getCancelButton().isSelected(state)) {
|
||||
GenericPerson person = (GenericPerson) data.get(ITEM_SEARCH);
|
||||
|
||||
|
||||
person = (GenericPerson) person.getContentBundle().getInstance(contact.
|
||||
getLanguage());
|
||||
|
||||
|
||||
contact.setPerson(person, (String) data.get(CONTACTS_KEY));
|
||||
}
|
||||
init(fse);
|
||||
|
|
@ -151,13 +152,13 @@ public class GenericContactAttachPersonPropertyForm extends BasicPageForm
|
|||
public void addSaveCancelSection() {
|
||||
try {
|
||||
getSaveCancelSection().getSaveButton().addPrintListener(new PrintListener() {
|
||||
|
||||
|
||||
public void prepare(PrintEvent e) {
|
||||
GenericContact contact =
|
||||
(GenericContact) getItemSelectionModel().
|
||||
getSelectedObject(e.getPageState());
|
||||
Submit target = (Submit) e.getTarget();
|
||||
|
||||
|
||||
if (contact.getPerson() != null) {
|
||||
target.setButtonLabel((String) ContenttypesGlobalizationUtil.
|
||||
globalize(
|
||||
|
|
@ -175,29 +176,32 @@ public class GenericContactAttachPersonPropertyForm extends BasicPageForm
|
|||
throw new UncheckedWrapperException("this cannot happen", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void validate(FormSectionEvent e) throws FormProcessException {
|
||||
final PageState state = e.getPageState();
|
||||
final FormData data = e.getFormData();
|
||||
|
||||
|
||||
if (data.get(ITEM_SEARCH) == null) {
|
||||
throw new FormProcessException((String) ContenttypesGlobalizationUtil.
|
||||
globalize(
|
||||
"cms.contenttypes.ui.contact.select_person.wrong_type").
|
||||
localize());
|
||||
localize());
|
||||
}
|
||||
|
||||
|
||||
GenericContact contact = (GenericContact) getItemSelectionModel().
|
||||
getSelectedObject(state);
|
||||
GenericPerson person = (GenericPerson) data.get(ITEM_SEARCH);
|
||||
|
||||
if (!(person.getContentBundle().hasInstance(contact.getLanguage(), true))) {
|
||||
data.addError("cms.contenttypes.ui.contact.select_person.no_suitable_language_variant");
|
||||
|
||||
if (!(person.getContentBundle().hasInstance(contact.getLanguage(),
|
||||
Kernel.getConfig().
|
||||
languageIndependentItems()))) {
|
||||
data.addError(
|
||||
"cms.contenttypes.ui.contact.select_person.no_suitable_language_variant");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void submitted(FormSectionEvent e) throws FormProcessException {
|
||||
if (getSaveCancelSection().getCancelButton().isSelected(e.getPageState())) {
|
||||
init(e);
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
|
|||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||
import com.arsdigita.globalization.GlobalizationHelper;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
|
|
@ -202,7 +203,9 @@ public class GenericOrganizationalUnitContactAddForm
|
|||
|
||||
GenericContact contact = (GenericContact) data.get(ITEM_SEARCH);
|
||||
|
||||
if (!(contact.getContentBundle().hasInstance(orgaunit.getLanguage(), true))) {
|
||||
if (!(contact.getContentBundle().hasInstance(orgaunit.getLanguage(),
|
||||
Kernel.getConfig().
|
||||
languageIndependentItems()))) {
|
||||
data.addError(
|
||||
ContenttypesGlobalizationUtil.globalize(
|
||||
"cms.contenttypes.ui.genericorgaunit.select_contact.no_suitable_language_variant"));
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
|
|||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||
import com.arsdigita.globalization.GlobalizationHelper;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
|
|
@ -245,11 +246,13 @@ public class GenericOrganizationalUnitPersonAddForm
|
|||
|
||||
GenericPerson person = (GenericPerson) data.get(ITEM_SEARCH);
|
||||
|
||||
if (!(person.getContentBundle().hasInstance(orga.getLanguage(), true))) {
|
||||
if (!(person.getContentBundle().hasInstance(orga.getLanguage(),
|
||||
Kernel.getConfig().
|
||||
languageIndependentItems()))) {
|
||||
data.addError(
|
||||
ContenttypesGlobalizationUtil.globalize(
|
||||
"cms.contenttypes.ui.genericorgaunit.person.no_suitable_language_variant"));
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -265,7 +268,7 @@ public class GenericOrganizationalUnitPersonAddForm
|
|||
ContenttypesGlobalizationUtil.globalize(
|
||||
"cms.contenttypes.ui.genericorgaunit.person.already_added"));
|
||||
}
|
||||
|
||||
|
||||
persons.close();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
|||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitSubordinateCollection;
|
||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
|
||||
/**
|
||||
* Form for adding a subordinate organizational unit to a organizational unit.
|
||||
|
|
@ -35,29 +36,29 @@ public class GenericOrganizationalUnitSubordinateOrgaUnitAddForm
|
|||
final GenericOrgaUnitSubordinateOrgaUnitAddFormCustomizer customizer) {
|
||||
super("SubordinateOrgaUnitsAddForm", itemModel);
|
||||
this.customizer = customizer;
|
||||
|
||||
|
||||
add(new Label(customizer.getSelectSubordinateOrgaUnitLabel()));
|
||||
itemSearch = new ItemSearchWidget(
|
||||
ITEM_SEARCH,
|
||||
ContentType.findByAssociatedObjectType(
|
||||
customizer.getSubordinateOrgaUnitType()));
|
||||
add(itemSearch);
|
||||
add(itemSearch);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addWidgets() {
|
||||
/*add(new Label(customizer.getSelectSubordinateOrgaUnitLabel()));
|
||||
itemSearch = new ItemSearchWidget(
|
||||
ITEM_SEARCH,
|
||||
ContentType.findByAssociatedObjectType(
|
||||
customizer.getSubordinateOrgaUnitType()));
|
||||
ITEM_SEARCH,
|
||||
ContentType.findByAssociatedObjectType(
|
||||
customizer.getSubordinateOrgaUnitType()));
|
||||
add(itemSearch); */
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(final FormSectionEvent fse) throws FormProcessException {
|
||||
final PageState state = fse.getPageState();
|
||||
|
||||
|
||||
setVisible(state, true);
|
||||
}
|
||||
|
||||
|
|
@ -76,7 +77,8 @@ public class GenericOrganizationalUnitSubordinateOrgaUnitAddForm
|
|||
subOrgaUnit = (GenericOrganizationalUnit) subOrgaUnit.
|
||||
getContentBundle().getInstance(orgaunit.getLanguage(), true);
|
||||
|
||||
orgaunit.addSubordinateOrgaUnit(subOrgaUnit, customizer.getAssocType());
|
||||
orgaunit.addSubordinateOrgaUnit(subOrgaUnit,
|
||||
customizer.getAssocType());
|
||||
}
|
||||
|
||||
init(fse);
|
||||
|
|
@ -97,26 +99,31 @@ public class GenericOrganizationalUnitSubordinateOrgaUnitAddForm
|
|||
(GenericOrganizationalUnit) getItemSelectionModel().
|
||||
getSelectedObject(state);
|
||||
GenericOrganizationalUnit subOrgaUnit =
|
||||
(GenericOrganizationalUnit) data.get(
|
||||
(GenericOrganizationalUnit) data.get(
|
||||
ITEM_SEARCH);
|
||||
if (!(subOrgaUnit.getContentBundle().hasInstance(orgaunit.getLanguage(),
|
||||
true))) {
|
||||
Kernel.getConfig().
|
||||
languageIndependentItems()))) {
|
||||
data.addError(customizer.getNoSuitableLanguageVariantMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
subOrgaUnit = (GenericOrganizationalUnit) subOrgaUnit.getContentBundle().getInstance(orgaunit.getLanguage(), true);
|
||||
|
||||
|
||||
subOrgaUnit = (GenericOrganizationalUnit) subOrgaUnit.getContentBundle().
|
||||
getInstance(orgaunit.getLanguage(), true);
|
||||
|
||||
if (orgaunit.getID().equals(subOrgaUnit.getID())) {
|
||||
data.addError(customizer.getAddingToItselfMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
final GenericOrganizationalUnitSubordinateCollection subOrgaUnits = orgaunit.getSubordinateOrgaUnits();
|
||||
subOrgaUnits.addFilter(String.format("id = %s", subOrgaUnit.getID().toString()));
|
||||
|
||||
final GenericOrganizationalUnitSubordinateCollection subOrgaUnits =
|
||||
orgaunit.
|
||||
getSubordinateOrgaUnits();
|
||||
subOrgaUnits.addFilter(String.format("id = %s", subOrgaUnit.getID().
|
||||
toString()));
|
||||
if (subOrgaUnits.size() > 0) {
|
||||
data.addError(customizer.getAlreadyAddedMessage());
|
||||
}
|
||||
subOrgaUnits.close();
|
||||
}
|
||||
subOrgaUnits.close();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ 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.PageState;
|
||||
import com.arsdigita.bebop.event.FormInitListener;
|
||||
|
|
@ -14,6 +13,7 @@ import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
|||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitSuperiorCollection;
|
||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -23,7 +23,7 @@ import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
|||
public class GenericOrganizationalUnitSuperiorOrgaUnitAddForm
|
||||
extends BasicItemForm
|
||||
implements FormProcessListener,
|
||||
FormInitListener {
|
||||
FormInitListener {
|
||||
|
||||
private ItemSearchWidget itemSearch;
|
||||
private final String ITEM_SEARCH = "superiorOrgaUnits";
|
||||
|
|
@ -58,14 +58,15 @@ public class GenericOrganizationalUnitSuperiorOrgaUnitAddForm
|
|||
final FormData data = fse.getFormData();
|
||||
final PageState state = fse.getPageState();
|
||||
final GenericOrganizationalUnit orgaunit =
|
||||
(GenericOrganizationalUnit) getItemSelectionModel().
|
||||
(GenericOrganizationalUnit) getItemSelectionModel().
|
||||
getSelectedObject(state);
|
||||
|
||||
if (getSaveCancelSection().getSaveButton().isSelected(state)) {
|
||||
GenericOrganizationalUnit supOrgaUnit =
|
||||
(GenericOrganizationalUnit) data.get(
|
||||
(GenericOrganizationalUnit) data.get(
|
||||
ITEM_SEARCH);
|
||||
supOrgaUnit = (GenericOrganizationalUnit) supOrgaUnit.getContentBundle().getInstance(orgaunit.getLanguage(), true);
|
||||
supOrgaUnit = (GenericOrganizationalUnit) supOrgaUnit.
|
||||
getContentBundle().getInstance(orgaunit.getLanguage(), true);
|
||||
|
||||
orgaunit.addSuperiorOrgaUnit(supOrgaUnit, customizer.getAssocType());
|
||||
}
|
||||
|
|
@ -84,26 +85,31 @@ public class GenericOrganizationalUnitSuperiorOrgaUnitAddForm
|
|||
}
|
||||
|
||||
final GenericOrganizationalUnit orgaunit =
|
||||
(GenericOrganizationalUnit) getItemSelectionModel().
|
||||
(GenericOrganizationalUnit) getItemSelectionModel().
|
||||
getSelectedObject(state);
|
||||
GenericOrganizationalUnit supOrgaUnit =
|
||||
(GenericOrganizationalUnit) data.get(
|
||||
(GenericOrganizationalUnit) data.get(
|
||||
ITEM_SEARCH);
|
||||
if (!(supOrgaUnit.getContentBundle().hasInstance(orgaunit.getLanguage(),
|
||||
true))) {
|
||||
Kernel.getConfig().
|
||||
languageIndependentItems()))) {
|
||||
data.addError(customizer.getNoSuitableLanguageVariantMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
supOrgaUnit = (GenericOrganizationalUnit) supOrgaUnit.getContentBundle().getInstance(orgaunit.getLanguage(), true);
|
||||
supOrgaUnit = (GenericOrganizationalUnit) supOrgaUnit.getContentBundle().
|
||||
getInstance(orgaunit.getLanguage(), true);
|
||||
|
||||
if (orgaunit.getID().equals(supOrgaUnit.getID())) {
|
||||
data.addError(customizer.getAddingToItselfMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
final GenericOrganizationalUnitSuperiorCollection supOrgaUnits = orgaunit.getSuperiorOrgaUnits();
|
||||
supOrgaUnits.addFilter(String.format("id = %s", supOrgaUnit.getID().toString()));
|
||||
final GenericOrganizationalUnitSuperiorCollection supOrgaUnits =
|
||||
orgaunit.
|
||||
getSuperiorOrgaUnits();
|
||||
supOrgaUnits.addFilter(String.format("id = %s", supOrgaUnit.getID().
|
||||
toString()));
|
||||
if (supOrgaUnits.size() > 0) {
|
||||
data.addError(customizer.getAlreadyAddedMessage());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import com.arsdigita.cms.contenttypes.GenericPerson;
|
|||
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
|
||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||
import com.arsdigita.cms.ui.authoring.BasicPageForm;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
||||
/**
|
||||
|
|
@ -137,7 +138,9 @@ public class GenericPersonAliasSetForm
|
|||
} else if (person.equals(data.get(ITEM_SEARCH))) {
|
||||
data.addError(ContenttypesGlobalizationUtil.globalize(
|
||||
"cms.contenttypes.person.alias.select.same_as_person"));
|
||||
} else if (!alias.getContentBundle().hasInstance(person.getLanguage(), true)) {
|
||||
} else if (!alias.getContentBundle().hasInstance(person.getLanguage(),
|
||||
Kernel.getConfig().
|
||||
languageIndependentItems())) {
|
||||
data.addError(
|
||||
ContenttypesGlobalizationUtil.globalize(
|
||||
"cms.contenttypes.person.alias.select.no_suitable_language_variant"));
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ import com.arsdigita.cms.ui.ItemSearchWidget;
|
|||
|
||||
import com.arsdigita.globalization.GlobalizationHelper;
|
||||
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
|
|
@ -156,24 +157,27 @@ public class GenericPersonContactAddForm extends BasicItemForm {
|
|||
|
||||
GenericContact contact = (GenericContact) data.get(ITEM_SEARCH);
|
||||
|
||||
if (!(contact.getContentBundle().hasInstance(person.getLanguage(), true))) {
|
||||
if (!(contact.getContentBundle().hasInstance(person.getLanguage(),
|
||||
Kernel.getConfig().
|
||||
languageIndependentItems()))) {
|
||||
data.addError(
|
||||
ContenttypesGlobalizationUtil.globalize(
|
||||
"cms.contenttypes.ui.person.select_contact.no_suitable_language_variant"));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
contact = (GenericContact) contact.getContentBundle().getInstance(person.getLanguage());
|
||||
|
||||
contact = (GenericContact) contact.getContentBundle().getInstance(person.
|
||||
getLanguage());
|
||||
GenericPersonContactCollection contacts = person.getContacts();
|
||||
|
||||
|
||||
contacts.addFilter(String.format("id = %s", contact.getID().toString()));
|
||||
if (contacts.size() > 0) {
|
||||
data.addError(
|
||||
data.addError(
|
||||
ContenttypesGlobalizationUtil.globalize(
|
||||
"cms.contenttypes.ui.person.select_contact.already_added"));
|
||||
}
|
||||
|
||||
contacts.close();
|
||||
}
|
||||
|
||||
contacts.close();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import com.arsdigita.cms.contenttypes.ArticleInCollectedVolume;
|
|||
import com.arsdigita.cms.contenttypes.CollectedVolume;
|
||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
|
||||
/**
|
||||
* Form for adding an association between an ArticleInCollectedVolume and a
|
||||
|
|
@ -102,16 +103,22 @@ public class ArticleInCollectedVolumeCollectedVolumeForm
|
|||
"publications.ui.articleInCollectedVolume.selectCollectedVolume.no_collected_volume_selected"));
|
||||
return;
|
||||
}
|
||||
|
||||
ArticleInCollectedVolume article = (ArticleInCollectedVolume) getItemSelectionModel().getSelectedObject(state);
|
||||
|
||||
CollectedVolume collectedVolume = (CollectedVolume) data.get(ITEM_SEARCH);
|
||||
|
||||
if (!(collectedVolume.getContentBundle().hasInstance(article.getLanguage(), true))) {
|
||||
data.addError(
|
||||
|
||||
ArticleInCollectedVolume article =
|
||||
(ArticleInCollectedVolume) getItemSelectionModel().
|
||||
getSelectedObject(state);
|
||||
|
||||
CollectedVolume collectedVolume =
|
||||
(CollectedVolume) data.get(ITEM_SEARCH);
|
||||
|
||||
if (!(collectedVolume.getContentBundle().hasInstance(
|
||||
article.getLanguage(),
|
||||
Kernel.getConfig().
|
||||
languageIndependentItems()))) {
|
||||
data.addError(
|
||||
PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.articleInCollectedVolume.selectCollectedVolume.no_suitable_language_variant"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import com.arsdigita.cms.contenttypes.ArticleInJournal;
|
|||
import com.arsdigita.cms.contenttypes.Journal;
|
||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
|
||||
/**
|
||||
* Form for adding an associatio between an article in a journal and a journal.
|
||||
|
|
@ -87,23 +88,28 @@ public class ArticleInJournalJournalForm
|
|||
|
||||
@Override
|
||||
public void validate(FormSectionEvent fse) throws FormProcessException {
|
||||
final PageState state= fse.getPageState();
|
||||
final PageState state = fse.getPageState();
|
||||
final FormData data = fse.getFormData();
|
||||
|
||||
|
||||
if (data.get(ITEM_SEARCH) == null) {
|
||||
data.addError(PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.articleInJournal.selectJournal.no_journal_selected"));
|
||||
data.addError(
|
||||
PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.articleInJournal.selectJournal.no_journal_selected"));
|
||||
return;
|
||||
}
|
||||
|
||||
ArticleInJournal article = (ArticleInJournal) getItemSelectionModel().getSelectedObject(
|
||||
|
||||
ArticleInJournal article = (ArticleInJournal) getItemSelectionModel().
|
||||
getSelectedObject(
|
||||
state);
|
||||
Journal journal = (Journal) data.get(ITEM_SEARCH);
|
||||
|
||||
if (!(journal.getContentBundle().hasInstance(article.getLanguage(), true))) {
|
||||
data.addError(PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.articleInJournal.selectJournal.no_suitable_language_variant"));
|
||||
|
||||
if (!(journal.getContentBundle().hasInstance(article.getLanguage(),
|
||||
Kernel.getConfig().
|
||||
languageIndependentItems()))) {
|
||||
data.addError(
|
||||
PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.articleInJournal.selectJournal.no_suitable_language_variant"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ import com.arsdigita.cms.contenttypes.ArticleInCollectedVolumeCollection;
|
|||
import com.arsdigita.cms.contenttypes.CollectedVolume;
|
||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
|
|
@ -102,32 +103,42 @@ public class CollectedVolumeArticleAddForm
|
|||
public void validate(FormSectionEvent fse) throws FormProcessException {
|
||||
final PageState state = fse.getPageState();
|
||||
final FormData data = fse.getFormData();
|
||||
|
||||
|
||||
if (data.get(ITEM_SEARCH) == null) {
|
||||
data.addError(PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.collected_volume.articles.select_article.no_article_selected"));
|
||||
data.addError(
|
||||
PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.collected_volume.articles.select_article.no_article_selected"));
|
||||
return;
|
||||
}
|
||||
|
||||
CollectedVolume collectedVolume = (CollectedVolume) getItemSelectionModel().getSelectedObject(state);
|
||||
ArticleInCollectedVolume article = (ArticleInCollectedVolume) data.get(ITEM_SEARCH);
|
||||
|
||||
if (!(article.getContentBundle().hasInstance(collectedVolume.getLanguage(), true))) {
|
||||
data.addError(PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.collected_volume.articles.select_article.no_suitable_language_variant"));
|
||||
|
||||
CollectedVolume collectedVolume =
|
||||
(CollectedVolume) getItemSelectionModel().
|
||||
getSelectedObject(state);
|
||||
ArticleInCollectedVolume article = (ArticleInCollectedVolume) data.get(
|
||||
ITEM_SEARCH);
|
||||
|
||||
if (!(article.getContentBundle().hasInstance(
|
||||
collectedVolume.getLanguage(), Kernel.getConfig().
|
||||
languageIndependentItems()))) {
|
||||
data.addError(
|
||||
PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.collected_volume.articles.select_article.no_suitable_language_variant"));
|
||||
return;
|
||||
}
|
||||
|
||||
article = (ArticleInCollectedVolume) article.getContentBundle().getInstance(collectedVolume.getLanguage());
|
||||
ArticleInCollectedVolumeCollection articles = collectedVolume.getArticles();
|
||||
|
||||
|
||||
article = (ArticleInCollectedVolume) article.getContentBundle().
|
||||
getInstance(collectedVolume.getLanguage());
|
||||
ArticleInCollectedVolumeCollection articles = collectedVolume.
|
||||
getArticles();
|
||||
|
||||
articles.addFilter(String.format("id = %s", article.getID().toString()));
|
||||
if (articles.size() > 0) {
|
||||
data.addError(PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.collected_volume.articles.select_article.already_added"));
|
||||
data.addError(
|
||||
PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.collected_volume.articles.select_article.already_added"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
articles.close();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import com.arsdigita.cms.contenttypes.Expertise;
|
|||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -66,24 +67,31 @@ public class ExpertiseOrdererForm
|
|||
|
||||
init(fse);
|
||||
}
|
||||
|
||||
@Override public void validate(FormSectionEvent fse) throws FormProcessException {
|
||||
|
||||
@Override
|
||||
public void validate(FormSectionEvent fse) throws FormProcessException {
|
||||
final PageState state = fse.getPageState();
|
||||
final FormData data = fse.getFormData();
|
||||
|
||||
|
||||
if (data.get(ITEM_SEARCH) == null) {
|
||||
data.addError(PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.expertise.orderer.no_orderer_selected"));
|
||||
|
||||
"publications.ui.expertise.orderer.no_orderer_selected"));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Expertise expertise = (Expertise) getItemSelectionModel().getSelectedObject(state);
|
||||
GenericOrganizationalUnit orderer = (GenericOrganizationalUnit) data.get(ITEM_SEARCH);
|
||||
if (!(orderer.getContentBundle().hasInstance(expertise.getLanguage(), true))) {
|
||||
data.addError(PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.expertise.orderer.no_suitable_langauge_variant"));
|
||||
|
||||
}
|
||||
|
||||
Expertise expertise = (Expertise) getItemSelectionModel().
|
||||
getSelectedObject(state);
|
||||
GenericOrganizationalUnit orderer =
|
||||
(GenericOrganizationalUnit) data.get(
|
||||
ITEM_SEARCH);
|
||||
if (!(orderer.getContentBundle().hasInstance(expertise.getLanguage(),
|
||||
Kernel.getConfig().
|
||||
languageIndependentItems()))) {
|
||||
data.addError(
|
||||
PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.expertise.orderer.no_suitable_langauge_variant"));
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import com.arsdigita.cms.contenttypes.Expertise;
|
|||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -77,11 +78,16 @@ public class ExpertiseOrganizationForm
|
|||
"publications.ui.expertise.organization.no_orga_selected"));
|
||||
return;
|
||||
}
|
||||
|
||||
Expertise expertise = (Expertise) getItemSelectionModel().getSelectedObject(state);
|
||||
GenericOrganizationalUnit orga = (GenericOrganizationalUnit) data.get(ITEM_SEARCH);
|
||||
if (!(orga.getContentBundle().hasInstance(expertise.getLanguage(), true))) {
|
||||
data.addError(PublicationGlobalizationUtil.globalize(
|
||||
|
||||
Expertise expertise = (Expertise) getItemSelectionModel().
|
||||
getSelectedObject(state);
|
||||
GenericOrganizationalUnit orga = (GenericOrganizationalUnit) data.get(
|
||||
ITEM_SEARCH);
|
||||
if (!(orga.getContentBundle().hasInstance(expertise.getLanguage(),
|
||||
Kernel.getConfig().
|
||||
languageIndependentItems()))) {
|
||||
data.addError(
|
||||
PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.expertise.organization.no_suitable_language_variant"));
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitPublicationsColle
|
|||
import com.arsdigita.cms.contenttypes.Publication;
|
||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -86,7 +87,8 @@ public class GenericOrganizationalUnitPublicationAddForm
|
|||
getSelectedObject(state);
|
||||
Publication publication = (Publication) data.get(ITEM_SEARCH);
|
||||
if (!(publication.getContentBundle().hasInstance(orgaunit.getLanguage(),
|
||||
true))) {
|
||||
Kernel.getConfig().
|
||||
languageIndependentItems()))) {
|
||||
data.addError(
|
||||
PublicationGlobalizationUtil.globalize(
|
||||
"genericorganizationalunit.ui.publication.no_suitable_language_variant"));
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import com.arsdigita.cms.contenttypes.InProceedings;
|
|||
import com.arsdigita.cms.contenttypes.Proceedings;
|
||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
|
||||
/**
|
||||
* Form for adding an association between a InProceedings publication and
|
||||
|
|
@ -103,7 +104,7 @@ public class InProceedingsProceedingsForm
|
|||
getSelectedObject(state);
|
||||
Proceedings proceedings = (Proceedings) data.get(ITEM_SEARCH);
|
||||
if (!(proceedings.getContentBundle().hasInstance(inProceedings.
|
||||
getLanguage(), true))) {
|
||||
getLanguage(), Kernel.getConfig().languageIndependentItems()))) {
|
||||
data.addError(
|
||||
PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.inProceedings.selectProceedings.no_suitable_language_variant"));
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
|||
import com.arsdigita.cms.contenttypes.InternetArticle;
|
||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -82,7 +83,8 @@ public class InternetArticleOrganizationForm
|
|||
getSelectedObject(state);
|
||||
GenericOrganizationalUnit orga = (GenericOrganizationalUnit) data.get(
|
||||
ITEM_SEARCH);
|
||||
if (!(orga.getContentBundle().hasInstance(article.getLanguage(), true))) {
|
||||
if (!(orga.getContentBundle().hasInstance(article.getLanguage(), Kernel.
|
||||
getConfig().languageIndependentItems()))) {
|
||||
data.addError(
|
||||
PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.internetarticle.select_organization.no_suitable_language_variant"));
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ import com.arsdigita.cms.contenttypes.ArticleInJournalCollection;
|
|||
import com.arsdigita.cms.contenttypes.Journal;
|
||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
|
|
@ -109,7 +110,9 @@ public class JournalArticleAddForm
|
|||
Journal journal = (Journal) getItemSelectionModel().getSelectedObject(
|
||||
state);
|
||||
ArticleInJournal article = (ArticleInJournal) data.get(ITEM_SEARCH);
|
||||
if (!(article.getContentBundle().hasInstance(journal.getLanguage(), true))) {
|
||||
if (!(article.getContentBundle().hasInstance(journal.getLanguage(),
|
||||
Kernel.getConfig().
|
||||
languageIndependentItems()))) {
|
||||
data.addError(
|
||||
PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.journal.articles.select_article.no_suitable_language_variant"));
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
|||
import com.arsdigita.cms.contenttypes.Proceedings;
|
||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -83,8 +84,11 @@ public class ProceedingsOrganizerForm
|
|||
getSelectedObject(state);
|
||||
GenericOrganizationalUnit organizer = (GenericOrganizationalUnit) data.
|
||||
get(ITEM_SEARCH);
|
||||
if (!(organizer.getContentBundle().hasInstance(proceedings.getLanguage(), true))) {
|
||||
data.addError(PublicationGlobalizationUtil.globalize(
|
||||
if (!(organizer.getContentBundle().hasInstance(proceedings.getLanguage(),
|
||||
Kernel.getConfig().
|
||||
languageIndependentItems()))) {
|
||||
data.addError(
|
||||
PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.proceedings.organizer.no_suitable_language_variant"));
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ import com.arsdigita.cms.contenttypes.InProceedingsCollection;
|
|||
import com.arsdigita.cms.contenttypes.Proceedings;
|
||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -105,14 +106,17 @@ public class ProceedingsPapersAddForm
|
|||
Proceedings proceedings = (Proceedings) getItemSelectionModel().
|
||||
getSelectedObject(state);
|
||||
InProceedings paper = (InProceedings) data.get(ITEM_SEARCH);
|
||||
if (!(paper.getContentBundle().hasInstance(proceedings.getLanguage(), true))) {
|
||||
if (!(paper.getContentBundle().hasInstance(proceedings.getLanguage(),
|
||||
Kernel.getConfig().
|
||||
languageIndependentItems()))) {
|
||||
data.addError(
|
||||
PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.proceedings.select_paper.no_suitable_language_variant"));
|
||||
return;
|
||||
}
|
||||
|
||||
paper = (InProceedings) paper.getContentBundle().getInstance(proceedings.getLanguage());
|
||||
|
||||
paper = (InProceedings) paper.getContentBundle().getInstance(proceedings.
|
||||
getLanguage());
|
||||
InProceedingsCollection papers = proceedings.getPapers();
|
||||
papers.addFilter(String.format("id = %s", paper.getID().toString()));
|
||||
if (papers.size() > 0) {
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ import com.arsdigita.cms.contenttypes.Publication;
|
|||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
|
|
@ -211,7 +212,9 @@ public class PublicationAuthorAddForm
|
|||
getSelectedAuthor();
|
||||
editing = true;
|
||||
}
|
||||
if (!(author.getContentBundle().hasInstance(publication.getLanguage(), true))) {
|
||||
if (!(author.getContentBundle().hasInstance(publication.getLanguage(),
|
||||
Kernel.getConfig().
|
||||
languageIndependentItems()))) {
|
||||
data.addError(
|
||||
PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.authors.selectAuthor.no_suitable_language_variant"));
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import com.arsdigita.cms.contenttypes.Publication;
|
|||
import com.arsdigita.cms.contenttypes.PublicationGenericOrganizationalsUnitCollection;
|
||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||
import com.arsdigita.persistence.DataCollection;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -86,7 +86,8 @@ public class PublicationGenericOrganizationalUnitAddForm
|
|||
GenericOrganizationalUnit orgaunit = (GenericOrganizationalUnit) data.
|
||||
get(ITEM_SEARCH);
|
||||
if (!(orgaunit.getContentBundle().hasInstance(publication.getLanguage(),
|
||||
true))) {
|
||||
Kernel.getConfig().
|
||||
languageIndependentItems()))) {
|
||||
data.addError(PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.orgaunit.no_suitable_language_variant"));
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ import com.arsdigita.cms.contenttypes.Series;
|
|||
import com.arsdigita.cms.contenttypes.SeriesCollection;
|
||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -108,7 +109,9 @@ public class PublicationSeriesAddForm
|
|||
Publication publication = (Publication) getItemSelectionModel().
|
||||
getSelectedObject(state);
|
||||
Series series = (Series) data.get(ITEM_SEARCH);
|
||||
if (!(series.getContentBundle().hasInstance(publication.getLanguage(), true))) {
|
||||
if (!(series.getContentBundle().hasInstance(publication.getLanguage(),
|
||||
Kernel.getConfig().
|
||||
languageIndependentItems()))) {
|
||||
data.addError(
|
||||
PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.series.select_series.no_suitable_language_variant"));
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import com.arsdigita.cms.contenttypes.PublicationWithPublisher;
|
|||
import com.arsdigita.cms.contenttypes.Publisher;
|
||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -85,7 +86,9 @@ public class PublicationWithPublisherSetPublisherForm
|
|||
(PublicationWithPublisher) getItemSelectionModel().
|
||||
getSelectedObject(state);
|
||||
Publisher publisher = (Publisher) data.get(ITEM_SEARCH);
|
||||
if (!(publisher.getContentBundle().hasInstance(publication.getLanguage(), true))) {
|
||||
if (!(publisher.getContentBundle().hasInstance(publication.getLanguage(),
|
||||
Kernel.getConfig().
|
||||
languageIndependentItems()))) {
|
||||
data.addError(
|
||||
PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.with_publisher.publisher.no_suitable_language_variant"));
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ import com.arsdigita.cms.contenttypes.GenericPerson;
|
|||
import com.arsdigita.cms.contenttypes.Series;
|
||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
|
|
@ -177,39 +178,44 @@ public class SeriesEditshipAddForm
|
|||
fse.getPageState())) {
|
||||
editStep.setSelectedEditor(null);
|
||||
editStep.setSelectedEditorDateFrom(null);
|
||||
editStep.setSelectedEditorDateTo(null);
|
||||
editStep.setSelectedEditorDateTo(null);
|
||||
}
|
||||
|
||||
|
||||
init(fse);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void validate(FormSectionEvent fse) throws FormProcessException {
|
||||
final PageState state = fse.getPageState();
|
||||
final FormData data = fse.getFormData();
|
||||
|
||||
|
||||
if (data.get(ITEM_SEARCH) == null) {
|
||||
data.addError(PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.series.editship.no_editor_selected"));
|
||||
"publications.ui.series.editship.no_editor_selected"));
|
||||
return;
|
||||
}
|
||||
|
||||
Series series = (Series) getItemSelectionModel().getSelectedObject(state);
|
||||
|
||||
Series series =
|
||||
(Series) getItemSelectionModel().getSelectedObject(state);
|
||||
GenericPerson editor = (GenericPerson) data.get(ITEM_SEARCH);
|
||||
if (!(editor.getContentBundle().hasInstance(series.getLanguage(), true))) {
|
||||
data.addError(PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.series.editship.no_suitable_language_variant"));
|
||||
if (!(editor.getContentBundle().hasInstance(series.getLanguage(),
|
||||
Kernel.getConfig().
|
||||
languageIndependentItems()))) {
|
||||
data.addError(
|
||||
PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.series.editship.no_suitable_language_variant"));
|
||||
return;
|
||||
}
|
||||
|
||||
editor = (GenericPerson) editor.getContentBundle().getInstance(series.getLanguage());
|
||||
|
||||
editor = (GenericPerson) editor.getContentBundle().getInstance(series.
|
||||
getLanguage());
|
||||
EditshipCollection editors = series.getEditors();
|
||||
editors.addFilter(String.format("id = %s", editor.getID().toString()));
|
||||
if (editors.size() > 0) {
|
||||
data.addError(PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.series.editship.already_added"));
|
||||
"publications.ui.series.editship.already_added"));
|
||||
}
|
||||
|
||||
|
||||
editors.close();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ import com.arsdigita.cms.contenttypes.Series;
|
|||
import com.arsdigita.cms.contenttypes.VolumeInSeriesCollection;
|
||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
|
|
@ -119,7 +120,9 @@ public class SeriesVolumeAddForm extends BasicItemForm {
|
|||
Series series = (Series) getItemSelectionModel().
|
||||
getSelectedObject(state);
|
||||
Publication volume = (Publication) data.get(ITEM_SEARCH);
|
||||
if (!(volume.getContentBundle().hasInstance(series.getLanguage(), true))) {
|
||||
if (!(volume.getContentBundle().hasInstance(series.getLanguage(),
|
||||
Kernel.getConfig().
|
||||
languageIndependentItems()))) {
|
||||
data.addError(
|
||||
PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.series.volume_of_series.no_suitable_language_variant"));
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
|||
import com.arsdigita.cms.contenttypes.UnPublished;
|
||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -82,8 +83,11 @@ public class UnPublishedOrganizationForm
|
|||
getSelectedObject(state);
|
||||
GenericOrganizationalUnit orga = (GenericOrganizationalUnit) data.get(
|
||||
ITEM_SEARCH);
|
||||
if (!(orga.getContentBundle().hasInstance(unPublished.getLanguage(), true))) {
|
||||
data.addError(PublicationGlobalizationUtil.globalize(
|
||||
if (!(orga.getContentBundle().hasInstance(unPublished.getLanguage(),
|
||||
Kernel.getConfig().
|
||||
languageIndependentItems()))) {
|
||||
data.addError(
|
||||
PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.unpublished.organization.no_suitable_language_variant"));
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue