Kontakte im einem OrganizationPanel werden jetzt mit Hilfe des SimpleXMLGenerators gerendert, so dass hier exakt der gleiche XML-Output für die Kontakte entsteht wie für anderen Stellen.

git-svn-id: https://svn.libreccm.org/ccm/trunk@935 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2011-05-24 05:29:59 +00:00
parent 404804a6d9
commit 000f1dd782
1 changed files with 23 additions and 4 deletions

View File

@ -30,6 +30,7 @@ import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitContactCollection
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitPersonCollection;
import com.arsdigita.cms.contenttypes.GenericPerson;
import com.arsdigita.cms.contenttypes.GenericPersonContactCollection;
import com.arsdigita.cms.dispatcher.SimpleXMLGenerator;
import com.arsdigita.xml.Element;
/**
@ -40,7 +41,6 @@ public class GenericOrganizationalUnitPanel extends CompoundContentItemPanel {
public static final String SHOW_CONTACTS = "contacts";
public static final String SHOW_MEMBERS = "members";
private boolean displayContacts = true;
private boolean displayMembers = true;
@ -163,7 +163,11 @@ public class GenericOrganizationalUnitPanel extends CompoundContentItemPanel {
final PageState state,
final String order,
final boolean withPerson) {
Element contactElem = parent.newChildElement("contact");
ContactXmlLGenerator generator = new ContactXmlLGenerator(contact);
generator.generateXML(state, parent, order);
/*Element contactElem = parent.newChildElement("contact");
contactElem.addAttribute("order", order);
Element title = contactElem.newChildElement("title");
@ -230,7 +234,7 @@ public class GenericOrganizationalUnitPanel extends CompoundContentItemPanel {
Element addressElem = contactElem.newChildElement(
"address");
Element postalCode = addressElem.newChildElement(
"postalCode");
"postalCode");
postalCode.setText(address.getPostalCode());
Element city = addressElem.newChildElement("city");
city.setText(address.getCity());
@ -240,7 +244,7 @@ public class GenericOrganizationalUnitPanel extends CompoundContentItemPanel {
country.setText(address.getIsoCountryCode());
Element theState = addressElem.newChildElement("state");
theState.setText(address.getState());
}
}*/
}
@Override
@ -270,4 +274,19 @@ public class GenericOrganizationalUnitPanel extends CompoundContentItemPanel {
generateMembersXML(orga, content, state);
}
}
private class ContactXmlLGenerator extends SimpleXMLGenerator {
private GenericContact contact;
public ContactXmlLGenerator(final GenericContact contact) {
super();
this.contact = contact;
}
@Override
protected ContentItem getContentItem(PageState state) {
return contact;
}
}
}