PublicPersonalProfile: Optimierungen am XML
git-svn-id: https://svn.libreccm.org/ccm/trunk@1063 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
a49000d94b
commit
618ff041d4
|
|
@ -14,7 +14,7 @@ public class PublicPersonalProfileConfig extends AbstractConfig {
|
|||
|
||||
private final Parameter homeNavItemLabels;
|
||||
private final Parameter showPersonInfoEverywhere;
|
||||
private final Parameter contactType;
|
||||
// private final Parameter contactType;
|
||||
|
||||
public PublicPersonalProfileConfig() {
|
||||
homeNavItemLabels = new StringParameter(
|
||||
|
|
@ -28,14 +28,14 @@ public class PublicPersonalProfileConfig extends AbstractConfig {
|
|||
Parameter.REQUIRED,
|
||||
false);
|
||||
|
||||
contactType = new StringParameter(
|
||||
/* contactType = new StringParameter(
|
||||
"com.arsdigita.cms.publicpersonalprofile.contactType",
|
||||
Parameter.REQUIRED,
|
||||
"commonContact");
|
||||
"commonContact");*/
|
||||
|
||||
register(homeNavItemLabels);
|
||||
register(showPersonInfoEverywhere);
|
||||
register(contactType);
|
||||
// register(contactType);
|
||||
|
||||
loadInfo();
|
||||
}
|
||||
|
|
@ -47,8 +47,7 @@ public class PublicPersonalProfileConfig extends AbstractConfig {
|
|||
public final Boolean getShowPersonInfoEverywhere() {
|
||||
return (Boolean) get(showPersonInfoEverywhere);
|
||||
}
|
||||
|
||||
public final String getContactType() {
|
||||
/* public final String getContactType() {
|
||||
return (String) get(contactType);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ com.arsdigita.cms.publicpersonalprofile.show_person_info_everywhere.purpose = If
|
|||
com.arsdigita.cms.publicpersonalprofile.show_person_info_everywhere.example = false
|
||||
com.arsdigita.cms.publicpersonalprofile.show_person_info_everywhere.format = [Boolean]
|
||||
|
||||
com.arsdigita.cms.publicpersonalprofile.contactType.title = Contact type to use
|
||||
com.arsdigita.cms.publicpersonalprofile.contactType.purpose = Determines the type of the contact to use in the profiles
|
||||
com.arsdigita.cms.publicpersonalprofile.contactType.title.example = commonContact
|
||||
com.arsdigita.cms.publicpersonalprofile.contactType.title.format = [String]
|
||||
#com.arsdigita.cms.publicpersonalprofile.contactType.title = Contact type to use
|
||||
# com.arsdigita.cms.publicpersonalprofile.contactType.purpose = Determines the type of the contact to use in the profiles
|
||||
#com.arsdigita.cms.publicpersonalprofile.contactType.title.example = commonContact
|
||||
#com.arsdigita.cms.publicpersonalprofile.contactType.title.format = [String]
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,10 @@ import com.arsdigita.bebop.PageFactory;
|
|||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.cms.ContentItem;
|
||||
import com.arsdigita.cms.contentassets.RelatedLink;
|
||||
import com.arsdigita.cms.contenttypes.GenericAddress;
|
||||
import com.arsdigita.cms.contenttypes.GenericContact;
|
||||
import com.arsdigita.cms.contenttypes.GenericContactEntry;
|
||||
import com.arsdigita.cms.contenttypes.GenericContactEntryCollection;
|
||||
import com.arsdigita.cms.contenttypes.GenericPerson;
|
||||
import com.arsdigita.cms.contenttypes.GenericPersonContactCollection;
|
||||
import com.arsdigita.cms.contenttypes.Link;
|
||||
|
|
@ -12,8 +16,10 @@ import com.arsdigita.cms.contenttypes.PublicPersonalProfile;
|
|||
import com.arsdigita.cms.contenttypes.PublicPersonalProfileNavItem;
|
||||
import com.arsdigita.cms.contenttypes.PublicPersonalProfileNavItemCollection;
|
||||
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||
import com.arsdigita.domain.DomainObject;
|
||||
import com.arsdigita.domain.DomainObjectFactory;
|
||||
import com.arsdigita.persistence.DataCollection;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import com.arsdigita.persistence.Session;
|
||||
import com.arsdigita.persistence.SessionManager;
|
||||
import com.arsdigita.templating.PresentationManager;
|
||||
|
|
@ -23,6 +29,7 @@ import com.arsdigita.web.BaseApplicationServlet;
|
|||
import com.arsdigita.xml.Document;
|
||||
import com.arsdigita.xml.Element;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.servlet.ServletException;
|
||||
|
|
@ -334,7 +341,7 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
|||
final PageState state) {
|
||||
Element profileOwnerElem = profileElem.newChildElement(
|
||||
"profileOwner");
|
||||
/*if ((owner.getSurname() != null)
|
||||
if ((owner.getSurname() != null)
|
||||
&& !owner.getSurname().trim().isEmpty()) {
|
||||
Element surname =
|
||||
profileOwnerElem.newChildElement("surname");
|
||||
|
|
@ -356,29 +363,86 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
|||
Element titlePost = profileOwnerElem.newChildElement(
|
||||
"titlePost");
|
||||
titlePost.setText(owner.getTitlePost());
|
||||
}*/
|
||||
}
|
||||
|
||||
PublicPersonalProfileXmlGenerator personXml =
|
||||
/*PublicPersonalProfileXmlGenerator personXml =
|
||||
new PublicPersonalProfileXmlGenerator(
|
||||
owner);
|
||||
personXml.generateXML(state,
|
||||
profileOwnerElem,
|
||||
"");
|
||||
"PublicPersonalProfile");*/
|
||||
|
||||
/*if (owner.hasContacts()) {
|
||||
if (owner.hasContacts()) {
|
||||
final GenericPersonContactCollection contacts = owner.getContacts();
|
||||
final String contactType = config.getContactType();
|
||||
//final String contactType = config.getContactType();
|
||||
|
||||
contacts.addFilter(String.format("link.link_key = '%s'",
|
||||
contactType));
|
||||
/*contacts.addFilter(String.format("link.link_key = '%s'",
|
||||
contactType));*/
|
||||
|
||||
if (contacts.size() > 0) {
|
||||
contacts.next();
|
||||
PublicPersonalProfileXmlGenerator contactXml =
|
||||
generateContactXml(profileOwnerElem,
|
||||
contacts.getContact(),
|
||||
state);
|
||||
/*PublicPersonalProfileXmlGenerator contactXml =
|
||||
new PublicPersonalProfileXmlGenerator(
|
||||
contacts.getContact());
|
||||
contactXml.generateXML(state, profileOwnerElem, "");
|
||||
contactXml.generateXML(state, profileOwnerElem, "");*/
|
||||
}
|
||||
}
|
||||
|
||||
DataCollection imgAttachments = (DataCollection) owner.get("imageAttachments");
|
||||
if (imgAttachments.size() > 0) {
|
||||
imgAttachments.next();
|
||||
final DataObject imgAttachment = imgAttachments.getDataObject();
|
||||
final DataObject image = (DataObject) imgAttachment.get("image");
|
||||
|
||||
final BigDecimal imageId = (BigDecimal) image.get("id");
|
||||
|
||||
Element imageElem = profileOwnerElem.newChildElement("image");
|
||||
imageElem.addAttribute("id", imageId.toString());
|
||||
}
|
||||
}
|
||||
|
||||
private void generateContactXml(final Element profileOwnerElem,
|
||||
final GenericContact contact,
|
||||
final PageState state) {
|
||||
final Element contactElem = profileOwnerElem.newChildElement("contact");
|
||||
final Element entriesElem = contactElem.newChildElement("entries");
|
||||
|
||||
final GenericContactEntryCollection entries =
|
||||
contact.getContactEntries();
|
||||
Element entryElem;
|
||||
GenericContactEntry entry;
|
||||
while (entries.next()) {
|
||||
entry = entries.getContactEntry();
|
||||
|
||||
entryElem = entriesElem.newChildElement("entry");
|
||||
entryElem.addAttribute("key", entry.getKey());
|
||||
entryElem.setText(entry.getValue());
|
||||
}
|
||||
|
||||
if (contact.hasAddress()) {
|
||||
final Element addressElem = contactElem.newChildElement("address");
|
||||
final GenericAddress address = contact.getAddress();
|
||||
|
||||
final Element addressTxtElem = addressElem.newChildElement(
|
||||
"addressTxt");
|
||||
addressTxtElem.setText(address.getAddress());
|
||||
|
||||
final Element postalCodeElem = addressElem.newChildElement(
|
||||
"postalCode");
|
||||
postalCodeElem.setText(address.getPostalCode());
|
||||
|
||||
final Element cityElem = addressElem.newChildElement("city");
|
||||
cityElem.setText(address.getCity());
|
||||
|
||||
final Element stateElem = addressElem.newChildElement("state");
|
||||
stateElem.setText(address.getState());
|
||||
|
||||
final Element isoCodeElem = addressElem.newChildElement(
|
||||
"isoCountryCode");
|
||||
isoCodeElem.setText(address.getIsoCountryCode());
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue