Korrekturen an PublicPersonalProfile
git-svn-id: https://svn.libreccm.org/ccm/trunk@1166 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
f796d6996d
commit
5428418dbc
|
|
@ -23,6 +23,7 @@ import com.arsdigita.cms.ContentPage;
|
||||||
import com.arsdigita.cms.ExtraXMLGenerator;
|
import com.arsdigita.cms.ExtraXMLGenerator;
|
||||||
import com.arsdigita.cms.publicpersonalprofile.ContentGenerator;
|
import com.arsdigita.cms.publicpersonalprofile.ContentGenerator;
|
||||||
import com.arsdigita.cms.publicpersonalprofile.PublicPersonalProfileConfig;
|
import com.arsdigita.cms.publicpersonalprofile.PublicPersonalProfileConfig;
|
||||||
|
import com.arsdigita.cms.publicpersonalprofile.PublicPersonalProfiles;
|
||||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import com.arsdigita.persistence.OID;
|
import com.arsdigita.persistence.OID;
|
||||||
|
|
@ -50,7 +51,7 @@ public class PublicPersonalProfile
|
||||||
extends ContentPage
|
extends ContentPage
|
||||||
implements CustomizedPreviewLink {
|
implements CustomizedPreviewLink {
|
||||||
|
|
||||||
private static final PublicPersonalProfileConfig config = PublicPersonalProfileConfig.getConfig();
|
private static final PublicPersonalProfileConfig config = PublicPersonalProfiles.getConfig();
|
||||||
public static final String OWNER = "owner";
|
public static final String OWNER = "owner";
|
||||||
public static final String PROFILE_URL = "profileUrl";
|
public static final String PROFILE_URL = "profileUrl";
|
||||||
public static final String LINK_LIST_NAME = "publicPersonalProfileNavItems";
|
public static final String LINK_LIST_NAME = "publicPersonalProfileNavItems";
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import com.arsdigita.cms.contentassets.RelatedLink;
|
||||||
import com.arsdigita.cms.publicpersonalprofile.ContentGenerator;
|
import com.arsdigita.cms.publicpersonalprofile.ContentGenerator;
|
||||||
import com.arsdigita.cms.publicpersonalprofile.PublicPersonalProfileConfig;
|
import com.arsdigita.cms.publicpersonalprofile.PublicPersonalProfileConfig;
|
||||||
import com.arsdigita.cms.publicpersonalprofile.PublicPersonalProfileXmlGenerator;
|
import com.arsdigita.cms.publicpersonalprofile.PublicPersonalProfileXmlGenerator;
|
||||||
|
import com.arsdigita.cms.publicpersonalprofile.PublicPersonalProfiles;
|
||||||
import com.arsdigita.dispatcher.DispatcherHelper;
|
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||||
import com.arsdigita.domain.DomainObjectFactory;
|
import com.arsdigita.domain.DomainObjectFactory;
|
||||||
import com.arsdigita.globalization.GlobalizationHelper;
|
import com.arsdigita.globalization.GlobalizationHelper;
|
||||||
|
|
@ -25,7 +26,7 @@ import java.lang.reflect.InvocationTargetException;
|
||||||
public class PublicPersonalProfileExtraXmlGenerator implements ExtraXMLGenerator {
|
public class PublicPersonalProfileExtraXmlGenerator implements ExtraXMLGenerator {
|
||||||
|
|
||||||
private static final PublicPersonalProfileConfig config =
|
private static final PublicPersonalProfileConfig config =
|
||||||
PublicPersonalProfileConfig.
|
PublicPersonalProfiles.
|
||||||
getConfig();
|
getConfig();
|
||||||
public static final String SHOW_ITEM_PARAM = "showItem";
|
public static final String SHOW_ITEM_PARAM = "showItem";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
package com.arsdigita.cms.contenttypes;
|
package com.arsdigita.cms.contenttypes;
|
||||||
|
|
||||||
import com.arsdigita.cms.contentassets.RelatedLink;
|
import com.arsdigita.cms.contentassets.RelatedLink;
|
||||||
import com.arsdigita.cms.publicpersonalprofile.PublicPersonalProfileConfig;
|
import com.arsdigita.cms.publicpersonalprofile.PublicPersonalProfiles;
|
||||||
import com.arsdigita.domain.DomainObjectFactory;
|
import com.arsdigita.domain.DomainObjectFactory;
|
||||||
import com.arsdigita.globalization.GlobalizationHelper;
|
import com.arsdigita.globalization.GlobalizationHelper;
|
||||||
import com.arsdigita.persistence.DataCollection;
|
import com.arsdigita.persistence.DataCollection;
|
||||||
|
import com.arsdigita.ui.UI;
|
||||||
import com.arsdigita.xml.Element;
|
import com.arsdigita.xml.Element;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
@ -17,15 +18,14 @@ import java.util.Map;
|
||||||
public class PublicPersonalProfileXmlUtil {
|
public class PublicPersonalProfileXmlUtil {
|
||||||
|
|
||||||
private final com.arsdigita.cms.publicpersonalprofile.PublicPersonalProfileConfig config =
|
private final com.arsdigita.cms.publicpersonalprofile.PublicPersonalProfileConfig config =
|
||||||
PublicPersonalProfileConfig.
|
PublicPersonalProfiles.getConfig();
|
||||||
getConfig();
|
|
||||||
|
|
||||||
public void createNavigation(final PublicPersonalProfile profile,
|
public void createNavigation(final PublicPersonalProfile profile,
|
||||||
final Element root,
|
final Element root,
|
||||||
final String navPath,
|
final String navPath,
|
||||||
final String prefix,
|
final String prefix,
|
||||||
final String appPath,
|
final String appPath,
|
||||||
final boolean previewMode) {
|
final boolean previewMode) {
|
||||||
String homeLabelsStr = config.getHomeNavItemLabels();
|
String homeLabelsStr = config.getHomeNavItemLabels();
|
||||||
|
|
||||||
Map<String, String> homeLabels = new HashMap<String, String>();
|
Map<String, String> homeLabels = new HashMap<String, String>();
|
||||||
|
|
@ -35,7 +35,7 @@ public class PublicPersonalProfileXmlUtil {
|
||||||
homeLabelSplit = homeLabelEntry.split(":");
|
homeLabelSplit = homeLabelEntry.split(":");
|
||||||
if (homeLabelSplit.length == 2) {
|
if (homeLabelSplit.length == 2) {
|
||||||
homeLabels.put(homeLabelSplit[0].trim(),
|
homeLabels.put(homeLabelSplit[0].trim(),
|
||||||
homeLabelSplit[1].trim());
|
homeLabelSplit[1].trim());
|
||||||
} else {
|
} else {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -50,12 +50,12 @@ public class PublicPersonalProfileXmlUtil {
|
||||||
|
|
||||||
Element navRoot =
|
Element navRoot =
|
||||||
root.newChildElement("nav:categoryMenu",
|
root.newChildElement("nav:categoryMenu",
|
||||||
"http://ccm.redhat.com/london/navigation");
|
"http://ccm.redhat.com/london/navigation");
|
||||||
navRoot.addAttribute("id", "categoryMenu");
|
navRoot.addAttribute("id", "categoryMenu");
|
||||||
|
|
||||||
Element navList =
|
Element navList =
|
||||||
navRoot.newChildElement("nav:category",
|
navRoot.newChildElement("nav:category",
|
||||||
"http://ccm.redhat.com/london/navigation");
|
"http://ccm.redhat.com/london/navigation");
|
||||||
navList.addAttribute("AbstractTree", "AbstractTree");
|
navList.addAttribute("AbstractTree", "AbstractTree");
|
||||||
navList.addAttribute("description", "");
|
navList.addAttribute("description", "");
|
||||||
navList.addAttribute("id", "");
|
navList.addAttribute("id", "");
|
||||||
|
|
@ -64,18 +64,18 @@ public class PublicPersonalProfileXmlUtil {
|
||||||
navList.addAttribute("title", "publicPersonalProfileNavList");
|
navList.addAttribute("title", "publicPersonalProfileNavList");
|
||||||
if (previewMode) {
|
if (previewMode) {
|
||||||
navList.addAttribute("url", String.format("%s/%s",
|
navList.addAttribute("url", String.format("%s/%s",
|
||||||
appUrl,
|
appUrl,
|
||||||
profile.getProfileUrl()));
|
profile.getProfileUrl()));
|
||||||
} else {
|
} else {
|
||||||
navList.addAttribute("url", String.format("%s/%s",
|
navList.addAttribute("url", String.format("%s/%s",
|
||||||
appUrl,
|
appUrl,
|
||||||
profile.getProfileUrl()));
|
profile.getProfileUrl()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.getShowHomeNavEntry()) {
|
if (config.getShowHomeNavEntry()) {
|
||||||
Element navHome =
|
Element navHome =
|
||||||
navList.newChildElement("nav:category",
|
navList.newChildElement("nav:category",
|
||||||
"http://ccm.redhat.com/london/navigation");
|
"http://ccm.redhat.com/london/navigation");
|
||||||
navHome.addAttribute("AbstractTree", "AbstractTree");
|
navHome.addAttribute("AbstractTree", "AbstractTree");
|
||||||
navHome.addAttribute("description", "");
|
navHome.addAttribute("description", "");
|
||||||
navHome.addAttribute("id", profile.getID().toString());
|
navHome.addAttribute("id", profile.getID().toString());
|
||||||
|
|
@ -85,26 +85,32 @@ public class PublicPersonalProfileXmlUtil {
|
||||||
navHome.addAttribute("isSelected", "false");
|
navHome.addAttribute("isSelected", "false");
|
||||||
}
|
}
|
||||||
navHome.addAttribute("sortKey", "");
|
navHome.addAttribute("sortKey", "");
|
||||||
|
<<<<<<< .mine
|
||||||
|
String homeLabel = homeLabels.get(DispatcherHelper.getNegotiatedLocale().
|
||||||
|
=======
|
||||||
String homeLabel = homeLabels.get(GlobalizationHelper.
|
String homeLabel = homeLabels.get(GlobalizationHelper.
|
||||||
getNegotiatedLocale().
|
getNegotiatedLocale().
|
||||||
|
>>>>>>> .r1165
|
||||||
getLanguage());
|
getLanguage());
|
||||||
if (homeLabel == null) {
|
if (homeLabel == null) {
|
||||||
navHome.addAttribute("title", "Home");
|
navHome.addAttribute("title", "Home");
|
||||||
} else {
|
} else {
|
||||||
navHome.addAttribute("title", homeLabel);
|
navHome.addAttribute("title", homeLabel);
|
||||||
}
|
}
|
||||||
navHome.addAttribute("url", String.format("%s/%s",
|
//navHome.addAttribute("url", String.format("%s/%s",
|
||||||
appUrl,
|
// appUrl,
|
||||||
profile.getProfileUrl()));
|
// profile.getProfileUrl()));
|
||||||
|
navHome.addAttribute("url", String.format("/ccm/%s",
|
||||||
|
UI.getConfig().getRootPage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Get the available Navigation items
|
//Get the available Navigation items
|
||||||
PublicPersonalProfileNavItemCollection navItems =
|
PublicPersonalProfileNavItemCollection navItems =
|
||||||
new PublicPersonalProfileNavItemCollection();
|
new PublicPersonalProfileNavItemCollection();
|
||||||
navItems.addLanguageFilter(GlobalizationHelper.getNegotiatedLocale().
|
navItems.addLanguageFilter(GlobalizationHelper.getNegotiatedLocale().
|
||||||
getLanguage());
|
getLanguage());
|
||||||
final Map<String, PublicPersonalProfileNavItem> navItemMap =
|
final Map<String, PublicPersonalProfileNavItem> navItemMap =
|
||||||
new HashMap<String, PublicPersonalProfileNavItem>();
|
new HashMap<String, PublicPersonalProfileNavItem>();
|
||||||
PublicPersonalProfileNavItem navItem;
|
PublicPersonalProfileNavItem navItem;
|
||||||
while (navItems.next()) {
|
while (navItems.next()) {
|
||||||
navItem = navItems.getNavItem();
|
navItem = navItems.getNavItem();
|
||||||
|
|
@ -112,26 +118,27 @@ public class PublicPersonalProfileXmlUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
final Element pathElem =
|
final Element pathElem =
|
||||||
root.newChildElement("nav:categoryPath",
|
root.newChildElement("nav:categoryPath",
|
||||||
"http://ccm.redhat.com/london/navigation");
|
"http://ccm.redhat.com/london/navigation");
|
||||||
final Element homeElem =
|
final Element homeElem =
|
||||||
pathElem.newChildElement("nav:category",
|
pathElem.newChildElement("nav:category",
|
||||||
"http://ccm.redhat.com/london/navigation");
|
"http://ccm.redhat.com/london/navigation");
|
||||||
homeElem.addAttribute("url", String.format("%s/%s",
|
//homeElem.addAttribute("url", String.format("%s/%s",
|
||||||
appUrl,
|
// appUrl,
|
||||||
profile.getProfileUrl()));
|
// profile.getProfileUrl()));
|
||||||
|
homeElem.addAttribute("url", String.format("/ccm/%s",
|
||||||
|
UI.getConfig().getRootPage()));
|
||||||
|
|
||||||
//Get the related links of the profiles
|
//Get the related links of the profiles
|
||||||
DataCollection links =
|
DataCollection links =
|
||||||
RelatedLink.getRelatedLinks(profile,
|
RelatedLink.getRelatedLinks(profile,
|
||||||
PublicPersonalProfile.LINK_LIST_NAME);
|
PublicPersonalProfile.LINK_LIST_NAME);
|
||||||
links.addOrder(Link.ORDER);
|
links.addOrder(Link.ORDER);
|
||||||
RelatedLink link;
|
RelatedLink link;
|
||||||
String navLinkKey;
|
String navLinkKey;
|
||||||
Element navElem;
|
Element navElem;
|
||||||
while (links.next()) {
|
while (links.next()) {
|
||||||
link = (RelatedLink) DomainObjectFactory.newInstance(links.
|
link = (RelatedLink) DomainObjectFactory.newInstance(links.getDataObject());
|
||||||
getDataObject());
|
|
||||||
|
|
||||||
navLinkKey = link.getTitle();
|
navLinkKey = link.getTitle();
|
||||||
navItem = navItemMap.get(navLinkKey);
|
navItem = navItemMap.get(navLinkKey);
|
||||||
|
|
@ -141,22 +148,22 @@ public class PublicPersonalProfileXmlUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
navElem =
|
navElem =
|
||||||
navList.newChildElement("nav:category",
|
navList.newChildElement("nav:category",
|
||||||
"http://ccm.redhat.com/london/navigation");
|
"http://ccm.redhat.com/london/navigation");
|
||||||
navElem.addAttribute("AbstractTree", "AbstractTree");
|
navElem.addAttribute("AbstractTree", "AbstractTree");
|
||||||
navElem.addAttribute("description", "");
|
navElem.addAttribute("description", "");
|
||||||
//navHome.addAttribute("id", "");
|
//navHome.addAttribute("id", "");
|
||||||
if ((navPath != null) && navPath.equals(navLinkKey)) {
|
if ((navPath != null) && navPath.equals(navLinkKey)) {
|
||||||
navElem.addAttribute("isSelected", "true");
|
navElem.addAttribute("isSelected", "true");
|
||||||
final Element currentPathElem =
|
final Element currentPathElem =
|
||||||
pathElem.newChildElement("nav:category",
|
pathElem.newChildElement("nav:category",
|
||||||
"http://ccm.redhat.com/london/navigation");
|
"http://ccm.redhat.com/london/navigation");
|
||||||
currentPathElem.addAttribute("title", navItem.getLabel());
|
currentPathElem.addAttribute("title", navItem.getLabel());
|
||||||
currentPathElem.addAttribute("url",
|
currentPathElem.addAttribute("url",
|
||||||
String.format("%s/%s/%s",
|
String.format("%s/%s/%s",
|
||||||
appUrl,
|
appUrl,
|
||||||
profile.getProfileUrl(),
|
profile.getProfileUrl(),
|
||||||
navLinkKey));
|
navLinkKey));
|
||||||
} else {
|
} else {
|
||||||
navElem.addAttribute("isSelected", "false");
|
navElem.addAttribute("isSelected", "false");
|
||||||
}
|
}
|
||||||
|
|
@ -167,9 +174,9 @@ public class PublicPersonalProfileXmlUtil {
|
||||||
navElem.addAttribute("title", navItem.getLabel());
|
navElem.addAttribute("title", navItem.getLabel());
|
||||||
}
|
}
|
||||||
navElem.addAttribute("url", String.format("%s/%s/%s",
|
navElem.addAttribute("url", String.format("%s/%s/%s",
|
||||||
appUrl,
|
appUrl,
|
||||||
profile.getProfileUrl(),
|
profile.getProfileUrl(),
|
||||||
navLinkKey));
|
navLinkKey));
|
||||||
|
|
||||||
navElem.addAttribute("navItem", navLinkKey);
|
navElem.addAttribute("navItem", navLinkKey);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ import com.arsdigita.cms.ItemSelectionModel;
|
||||||
import com.arsdigita.cms.contenttypes.GenericPerson;
|
import com.arsdigita.cms.contenttypes.GenericPerson;
|
||||||
import com.arsdigita.cms.contenttypes.PublicPersonalProfile;
|
import com.arsdigita.cms.contenttypes.PublicPersonalProfile;
|
||||||
import com.arsdigita.cms.publicpersonalprofile.PublicPersonalProfileConfig;
|
import com.arsdigita.cms.publicpersonalprofile.PublicPersonalProfileConfig;
|
||||||
|
import com.arsdigita.cms.publicpersonalprofile.PublicPersonalProfiles;
|
||||||
import com.arsdigita.cms.ui.authoring.ApplyWorkflowFormSection;
|
import com.arsdigita.cms.ui.authoring.ApplyWorkflowFormSection;
|
||||||
import com.arsdigita.cms.ui.authoring.CreationSelector;
|
import com.arsdigita.cms.ui.authoring.CreationSelector;
|
||||||
import com.arsdigita.cms.ui.authoring.LanguageWidget;
|
import com.arsdigita.cms.ui.authoring.LanguageWidget;
|
||||||
|
|
@ -48,7 +49,7 @@ public class PublicPersonalProfileCreate extends PageCreate {
|
||||||
|
|
||||||
private static final String SELECTED_PERSON = "selectedPerson";
|
private static final String SELECTED_PERSON = "selectedPerson";
|
||||||
private static final PublicPersonalProfileConfig config =
|
private static final PublicPersonalProfileConfig config =
|
||||||
PublicPersonalProfileConfig.getConfig();
|
PublicPersonalProfiles.getConfig();
|
||||||
|
|
||||||
public PublicPersonalProfileCreate(final ItemSelectionModel itemModel,
|
public PublicPersonalProfileCreate(final ItemSelectionModel itemModel,
|
||||||
final CreationSelector parent) {
|
final CreationSelector parent) {
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,9 @@ public class PublicPersonalProfileConfig extends AbstractConfig {
|
||||||
private final Parameter showPersonInfoEverywhere;
|
private final Parameter showPersonInfoEverywhere;
|
||||||
// private final Parameter contactType;
|
// private final Parameter contactType;
|
||||||
|
|
||||||
static {
|
/*static {
|
||||||
config.load();
|
config.load();
|
||||||
}
|
}*/
|
||||||
|
|
||||||
public PublicPersonalProfileConfig() {
|
public PublicPersonalProfileConfig() {
|
||||||
personType =
|
personType =
|
||||||
|
|
@ -90,7 +90,7 @@ public class PublicPersonalProfileConfig extends AbstractConfig {
|
||||||
return (String) get(contactType);
|
return (String) get(contactType);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
public static PublicPersonalProfileConfig getConfig() {
|
/*public static PublicPersonalProfileConfig getConfig() {
|
||||||
return config;
|
return config;
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,12 @@ import java.math.BigDecimal;
|
||||||
public class PublicPersonalProfiles extends Application {
|
public class PublicPersonalProfiles extends Application {
|
||||||
|
|
||||||
public static final String BASE_DATA_OBJECT_TYPE =
|
public static final String BASE_DATA_OBJECT_TYPE =
|
||||||
"com.arsdigita.cms.publicpersonalprofile.PublicPersonalProfile";
|
"com.arsdigita.cms.publicpersonalprofile.PublicPersonalProfile";
|
||||||
private final static PublicPersonalProfileConfig config = PublicPersonalProfileConfig.getConfig();
|
private final static PublicPersonalProfileConfig config = new PublicPersonalProfileConfig(); // PublicPersonalProfileConfig.getConfig();
|
||||||
|
|
||||||
|
static {
|
||||||
|
config.load();
|
||||||
|
}
|
||||||
|
|
||||||
public PublicPersonalProfiles(final DataObject dobj) {
|
public PublicPersonalProfiles(final DataObject dobj) {
|
||||||
super(dobj);
|
super(dobj);
|
||||||
|
|
@ -35,4 +39,8 @@ public class PublicPersonalProfiles extends Application {
|
||||||
public String getServletPath() {
|
public String getServletPath() {
|
||||||
return "/profiles/";
|
return "/profiles/";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static PublicPersonalProfileConfig getConfig() {
|
||||||
|
return config;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,34 +58,33 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
||||||
|
|
||||||
private static final long serialVersionUID = -1495852395804455609L;
|
private static final long serialVersionUID = -1495852395804455609L;
|
||||||
private static final Logger logger =
|
private static final Logger logger =
|
||||||
Logger.getLogger(
|
Logger.getLogger(
|
||||||
PublicPersonalProfilesServlet.class);
|
PublicPersonalProfilesServlet.class);
|
||||||
private static final String ADMIN = "admin";
|
private static final String ADMIN = "admin";
|
||||||
private static final String PREVIEW = "preview";
|
private static final String PREVIEW = "preview";
|
||||||
private static final String PPP_NS =
|
private static final String PPP_NS =
|
||||||
"http://www.arsdigita.com/PublicPersonalProfile/1.0";
|
"http://www.arsdigita.com/PublicPersonalProfile/1.0";
|
||||||
public static final String SELECTED_NAV_ITEM = "selectedNavItem";
|
public static final String SELECTED_NAV_ITEM = "selectedNavItem";
|
||||||
private final PublicPersonalProfileConfig config =
|
private final PublicPersonalProfileConfig config =
|
||||||
PublicPersonalProfileConfig.
|
PublicPersonalProfiles.getConfig();
|
||||||
getConfig();
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doService(final HttpServletRequest request,
|
protected void doService(final HttpServletRequest request,
|
||||||
final HttpServletResponse response,
|
final HttpServletResponse response,
|
||||||
final Application app) throws ServletException,
|
final Application app) throws ServletException,
|
||||||
IOException {
|
IOException {
|
||||||
String path = "";
|
String path = "";
|
||||||
|
|
||||||
logger.debug("PublicPersonalProfileServlet is starting...");
|
logger.debug("PublicPersonalProfileServlet is starting...");
|
||||||
logger.debug(String.format("pathInfo = '%s'", request.getPathInfo()));
|
logger.debug(String.format("pathInfo = '%s'", request.getPathInfo()));
|
||||||
|
|
||||||
logger.debug("Extracting path from pathInfo by removing leading and "
|
logger.debug("Extracting path from pathInfo by removing leading and "
|
||||||
+ "trailing slashes...");
|
+ "trailing slashes...");
|
||||||
if (request.getPathInfo() != null) {
|
if (request.getPathInfo() != null) {
|
||||||
if ("/".equals(request.getPathInfo())) {
|
if ("/".equals(request.getPathInfo())) {
|
||||||
path = "";
|
path = "";
|
||||||
} else if (request.getPathInfo().startsWith("/")
|
} else if (request.getPathInfo().startsWith("/")
|
||||||
&& request.getPathInfo().endsWith("/")) {
|
&& request.getPathInfo().endsWith("/")) {
|
||||||
path = request.getPathInfo().substring(1, request.getPathInfo().
|
path = request.getPathInfo().substring(1, request.getPathInfo().
|
||||||
length() - 1);
|
length() - 1);
|
||||||
} else if (request.getPathInfo().startsWith("/")) {
|
} else if (request.getPathInfo().startsWith("/")) {
|
||||||
|
|
@ -116,7 +115,7 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
||||||
|
|
||||||
|
|
||||||
page = PageFactory.buildPage("PublicPersonalProfile",
|
page = PageFactory.buildPage("PublicPersonalProfile",
|
||||||
"");
|
"");
|
||||||
|
|
||||||
if (pathTokens.length < 1) {
|
if (pathTokens.length < 1) {
|
||||||
//ToDo: Fehlerbehandlung?
|
//ToDo: Fehlerbehandlung?
|
||||||
|
|
@ -149,16 +148,16 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
||||||
final Session session = SessionManager.getSession();
|
final Session session = SessionManager.getSession();
|
||||||
|
|
||||||
DataCollection profiles =
|
DataCollection profiles =
|
||||||
session.retrieve(
|
session.retrieve(
|
||||||
com.arsdigita.cms.contenttypes.PublicPersonalProfile.BASE_DATA_OBJECT_TYPE);
|
com.arsdigita.cms.contenttypes.PublicPersonalProfile.BASE_DATA_OBJECT_TYPE);
|
||||||
profiles.addFilter(String.format("profileUrl = '%s'",
|
profiles.addFilter(String.format("profileUrl = '%s'",
|
||||||
profileOwner));
|
profileOwner));
|
||||||
if (preview) {
|
if (preview) {
|
||||||
profiles.addFilter(String.format("version = '%s'",
|
profiles.addFilter(String.format("version = '%s'",
|
||||||
ContentItem.DRAFT));
|
ContentItem.DRAFT));
|
||||||
} else {
|
} else {
|
||||||
profiles.addFilter(String.format("version = '%s'",
|
profiles.addFilter(String.format("version = '%s'",
|
||||||
ContentItem.LIVE));
|
ContentItem.LIVE));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (profiles.size() == 0) {
|
if (profiles.size() == 0) {
|
||||||
|
|
@ -169,18 +168,17 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
||||||
"More than one matching members found...");
|
"More than one matching members found...");
|
||||||
} else {
|
} else {
|
||||||
final PageState state = new PageState(page,
|
final PageState state = new PageState(page,
|
||||||
request,
|
request,
|
||||||
response);
|
response);
|
||||||
|
|
||||||
profiles.next();
|
profiles.next();
|
||||||
PublicPersonalProfile profile =
|
PublicPersonalProfile profile =
|
||||||
(PublicPersonalProfile) DomainObjectFactory.
|
(PublicPersonalProfile) DomainObjectFactory.newInstance(profiles.getDataObject());
|
||||||
newInstance(profiles.getDataObject());
|
|
||||||
profiles.close();
|
profiles.close();
|
||||||
|
|
||||||
if (config.getEmbedded()) {
|
if (config.getEmbedded()) {
|
||||||
final ContentSection section =
|
final ContentSection section =
|
||||||
profile.getContentSection();
|
profile.getContentSection();
|
||||||
final ItemResolver resolver = section.getItemResolver();
|
final ItemResolver resolver = section.getItemResolver();
|
||||||
|
|
||||||
String context;
|
String context;
|
||||||
|
|
@ -190,11 +188,10 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
||||||
context = ContentItem.LIVE;
|
context = ContentItem.LIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
final String url = String.format("/ccm%s", resolver.
|
final String url = String.format("/ccm%s", resolver.generateItemURL(state,
|
||||||
generateItemURL(state,
|
profile,
|
||||||
profile,
|
section,
|
||||||
section,
|
context));
|
||||||
context));
|
|
||||||
|
|
||||||
throw new RedirectSignal(url, false);
|
throw new RedirectSignal(url, false);
|
||||||
}
|
}
|
||||||
|
|
@ -213,7 +210,8 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
||||||
final DataCollection images = ItemImageAttachment.getImageAttachments(profile);
|
final DataCollection images = ItemImageAttachment.getImageAttachments(profile);
|
||||||
if (!images.isEmpty()) {
|
if (!images.isEmpty()) {
|
||||||
images.next();
|
images.next();
|
||||||
final Element profileImageElem = profileElem.newChildElement("profileImage");
|
final Element profileImageElem = profileElem.newChildElement("ppp:profileImage",
|
||||||
|
PPP_NS);
|
||||||
|
|
||||||
final Element attachmentElem = profileImageElem.newChildElement("imageAttachments");
|
final Element attachmentElem = profileImageElem.newChildElement("imageAttachments");
|
||||||
final ItemImageAttachment attachment = new ItemImageAttachment(images.getDataObject());
|
final ItemImageAttachment attachment = new ItemImageAttachment(images.getDataObject());
|
||||||
|
|
@ -240,31 +238,31 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
||||||
}
|
}
|
||||||
|
|
||||||
final PublicPersonalProfileXmlUtil util =
|
final PublicPersonalProfileXmlUtil util =
|
||||||
new PublicPersonalProfileXmlUtil();
|
new PublicPersonalProfileXmlUtil();
|
||||||
String prefix =
|
String prefix =
|
||||||
DispatcherHelper.getDispatcherPrefix(request);
|
DispatcherHelper.getDispatcherPrefix(request);
|
||||||
if (prefix == null) {
|
if (prefix == null) {
|
||||||
prefix = "";
|
prefix = "";
|
||||||
}
|
}
|
||||||
util.createNavigation(profile,
|
util.createNavigation(profile,
|
||||||
root,
|
root,
|
||||||
navPath,
|
navPath,
|
||||||
prefix,
|
prefix,
|
||||||
app.getPath(),
|
app.getPath(),
|
||||||
preview);
|
preview);
|
||||||
|
|
||||||
if (navPath == null) {
|
if (navPath == null) {
|
||||||
final PublicPersonalProfileXmlGenerator generator =
|
final PublicPersonalProfileXmlGenerator generator =
|
||||||
new PublicPersonalProfileXmlGenerator(
|
new PublicPersonalProfileXmlGenerator(
|
||||||
profile);
|
profile);
|
||||||
generator.generateXML(state, root, "");
|
generator.generateXML(state, root, "");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
final DataCollection links =
|
final DataCollection links =
|
||||||
RelatedLink.getRelatedLinks(profile,
|
RelatedLink.getRelatedLinks(profile,
|
||||||
PublicPersonalProfile.LINK_LIST_NAME);
|
PublicPersonalProfile.LINK_LIST_NAME);
|
||||||
links.addFilter(String.format("linkTitle = '%s'",
|
links.addFilter(String.format("linkTitle = '%s'",
|
||||||
navPath));
|
navPath));
|
||||||
|
|
||||||
if (links.size() == 0) {
|
if (links.size() == 0) {
|
||||||
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
|
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
|
||||||
|
|
@ -272,32 +270,31 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
||||||
} else {
|
} else {
|
||||||
if (config.getShowPersonInfoEverywhere()) {
|
if (config.getShowPersonInfoEverywhere()) {
|
||||||
generateProfileOwnerXml(profileElem, owner,
|
generateProfileOwnerXml(profileElem, owner,
|
||||||
state);
|
state);
|
||||||
}
|
}
|
||||||
|
|
||||||
PublicPersonalProfileNavItemCollection navItems =
|
PublicPersonalProfileNavItemCollection navItems =
|
||||||
new PublicPersonalProfileNavItemCollection();
|
new PublicPersonalProfileNavItemCollection();
|
||||||
navItems.addLanguageFilter(GlobalizationHelper.
|
navItems.addLanguageFilter(GlobalizationHelper.getNegotiatedLocale().
|
||||||
getNegotiatedLocale().
|
|
||||||
getLanguage());
|
getLanguage());
|
||||||
navItems.addKeyFilter(navPath);
|
navItems.addKeyFilter(navPath);
|
||||||
navItems.next();
|
navItems.next();
|
||||||
|
|
||||||
if (navItems.getNavItem().getGeneratorClass()
|
if (navItems.getNavItem().getGeneratorClass()
|
||||||
!= null) {
|
!= null) {
|
||||||
try {
|
try {
|
||||||
Object generatorObj =
|
Object generatorObj =
|
||||||
Class.forName(navItems.getNavItem().
|
Class.forName(navItems.getNavItem().
|
||||||
getGeneratorClass()).getConstructor().
|
getGeneratorClass()).getConstructor().
|
||||||
newInstance();
|
newInstance();
|
||||||
|
|
||||||
if (generatorObj instanceof ContentGenerator) {
|
if (generatorObj instanceof ContentGenerator) {
|
||||||
final ContentGenerator generator =
|
final ContentGenerator generator =
|
||||||
(ContentGenerator) generatorObj;
|
(ContentGenerator) generatorObj;
|
||||||
|
|
||||||
generator.generateContent(profileElem,
|
generator.generateContent(profileElem,
|
||||||
owner,
|
owner,
|
||||||
state);
|
state);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw new ServletException(String.format(
|
throw new ServletException(String.format(
|
||||||
|
|
@ -329,16 +326,15 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
||||||
|
|
||||||
links.next();
|
links.next();
|
||||||
final RelatedLink link =
|
final RelatedLink link =
|
||||||
(RelatedLink) DomainObjectFactory.
|
(RelatedLink) DomainObjectFactory.newInstance(links.getDataObject());
|
||||||
newInstance(links.getDataObject());
|
|
||||||
links.close();
|
links.close();
|
||||||
final ContentItem item = link.getTargetItem();
|
final ContentItem item = link.getTargetItem();
|
||||||
final PublicPersonalProfileXmlGenerator generator =
|
final PublicPersonalProfileXmlGenerator generator =
|
||||||
new PublicPersonalProfileXmlGenerator(
|
new PublicPersonalProfileXmlGenerator(
|
||||||
item);
|
item);
|
||||||
generator.generateXML(state,
|
generator.generateXML(state,
|
||||||
root,
|
root,
|
||||||
"");
|
"");
|
||||||
}
|
}
|
||||||
|
|
||||||
navItems.close();
|
navItems.close();
|
||||||
|
|
@ -346,8 +342,7 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PresentationManager presentationManager = Templating.
|
PresentationManager presentationManager = Templating.getPresentationManager();
|
||||||
getPresentationManager();
|
|
||||||
presentationManager.servePage(document, request, response);
|
presentationManager.servePage(document, request, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -356,29 +351,29 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateProfileOwnerXml(final Element profileElem,
|
private void generateProfileOwnerXml(final Element profileElem,
|
||||||
final GenericPerson owner,
|
final GenericPerson owner,
|
||||||
final PageState state) {
|
final PageState state) {
|
||||||
Element profileOwnerElem = profileElem.newChildElement(
|
Element profileOwnerElem = profileElem.newChildElement(
|
||||||
"profileOwner");
|
"profileOwner");
|
||||||
if ((owner.getSurname() != null)
|
if ((owner.getSurname() != null)
|
||||||
&& !owner.getSurname().trim().isEmpty()) {
|
&& !owner.getSurname().trim().isEmpty()) {
|
||||||
Element surname =
|
Element surname =
|
||||||
profileOwnerElem.newChildElement("surname");
|
profileOwnerElem.newChildElement("surname");
|
||||||
surname.setText(owner.getSurname());
|
surname.setText(owner.getSurname());
|
||||||
}
|
}
|
||||||
if ((owner.getGivenName() != null)
|
if ((owner.getGivenName() != null)
|
||||||
&& !owner.getGivenName().trim().isEmpty()) {
|
&& !owner.getGivenName().trim().isEmpty()) {
|
||||||
Element givenName = profileOwnerElem.newChildElement(
|
Element givenName = profileOwnerElem.newChildElement(
|
||||||
"givenName");
|
"givenName");
|
||||||
givenName.setText(owner.getGivenName());
|
givenName.setText(owner.getGivenName());
|
||||||
}
|
}
|
||||||
if ((owner.getTitlePre() != null)
|
if ((owner.getTitlePre() != null)
|
||||||
&& !owner.getTitlePre().trim().isEmpty()) {
|
&& !owner.getTitlePre().trim().isEmpty()) {
|
||||||
Element titlePre = profileOwnerElem.newChildElement("titlePre");
|
Element titlePre = profileOwnerElem.newChildElement("titlePre");
|
||||||
titlePre.setText(owner.getTitlePre());
|
titlePre.setText(owner.getTitlePre());
|
||||||
}
|
}
|
||||||
if ((owner.getTitlePost() != null)
|
if ((owner.getTitlePost() != null)
|
||||||
&& !owner.getTitlePost().trim().isEmpty()) {
|
&& !owner.getTitlePost().trim().isEmpty()) {
|
||||||
Element titlePost = profileOwnerElem.newChildElement(
|
Element titlePost = profileOwnerElem.newChildElement(
|
||||||
"titlePost");
|
"titlePost");
|
||||||
titlePost.setText(owner.getTitlePost());
|
titlePost.setText(owner.getTitlePost());
|
||||||
|
|
@ -390,8 +385,8 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
||||||
if (contacts.size() > 0) {
|
if (contacts.size() > 0) {
|
||||||
contacts.next();
|
contacts.next();
|
||||||
generateContactXml(profileOwnerElem,
|
generateContactXml(profileOwnerElem,
|
||||||
contacts.getContact(),
|
contacts.getContact(),
|
||||||
state);
|
state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -410,13 +405,13 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateContactXml(final Element profileOwnerElem,
|
private void generateContactXml(final Element profileOwnerElem,
|
||||||
final GenericContact contact,
|
final GenericContact contact,
|
||||||
final PageState state) {
|
final PageState state) {
|
||||||
final Element contactElem = profileOwnerElem.newChildElement("contact");
|
final Element contactElem = profileOwnerElem.newChildElement("contact");
|
||||||
final Element entriesElem = contactElem.newChildElement("entries");
|
final Element entriesElem = contactElem.newChildElement("entries");
|
||||||
|
|
||||||
final GenericContactEntryCollection entries =
|
final GenericContactEntryCollection entries =
|
||||||
contact.getContactEntries();
|
contact.getContactEntries();
|
||||||
Element entryElem;
|
Element entryElem;
|
||||||
GenericContactEntry entry;
|
GenericContactEntry entry;
|
||||||
while (entries.next()) {
|
while (entries.next()) {
|
||||||
|
|
@ -452,8 +447,8 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showAdminPage(final Page page,
|
private void showAdminPage(final Page page,
|
||||||
final HttpServletRequest request,
|
final HttpServletRequest request,
|
||||||
final HttpServletResponse response)
|
final HttpServletResponse response)
|
||||||
throws ServletException {
|
throws ServletException {
|
||||||
|
|
||||||
page.addRequestListener(new ApplicationAuthenticationListener());
|
page.addRequestListener(new ApplicationAuthenticationListener());
|
||||||
|
|
@ -465,7 +460,7 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
||||||
final StringParameter navItemKeyParam = new StringParameter(
|
final StringParameter navItemKeyParam = new StringParameter(
|
||||||
"selectedNavItem");
|
"selectedNavItem");
|
||||||
final ParameterSingleSelectionModel navItemSelect =
|
final ParameterSingleSelectionModel navItemSelect =
|
||||||
new ParameterSingleSelectionModel(
|
new ParameterSingleSelectionModel(
|
||||||
navItemKeyParam);
|
navItemKeyParam);
|
||||||
|
|
||||||
page.addGlobalStateParam(navItemKeyParam);
|
page.addGlobalStateParam(navItemKeyParam);
|
||||||
|
|
@ -474,10 +469,10 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
||||||
final FormSection tableSection = new FormSection(box);
|
final FormSection tableSection = new FormSection(box);
|
||||||
|
|
||||||
final PublicPersonalProfileNavItemsAddForm addForm =
|
final PublicPersonalProfileNavItemsAddForm addForm =
|
||||||
new PublicPersonalProfileNavItemsAddForm(
|
new PublicPersonalProfileNavItemsAddForm(
|
||||||
navItemSelect);
|
navItemSelect);
|
||||||
final PublicPersonalProfileNavItemsTable table =
|
final PublicPersonalProfileNavItemsTable table =
|
||||||
new PublicPersonalProfileNavItemsTable(
|
new PublicPersonalProfileNavItemsTable(
|
||||||
navItemSelect);
|
navItemSelect);
|
||||||
|
|
||||||
box.add(table);
|
box.add(table);
|
||||||
|
|
@ -490,8 +485,7 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
||||||
|
|
||||||
final Document document = page.buildDocument(request, response);
|
final Document document = page.buildDocument(request, response);
|
||||||
|
|
||||||
final PresentationManager presentationManager = Templating.
|
final PresentationManager presentationManager = Templating.getPresentationManager();
|
||||||
getPresentationManager();
|
|
||||||
presentationManager.servePage(document, request, response);
|
presentationManager.servePage(document, request, response);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue