BugFix für Anzeige nicht publizierter Inhalte im PPP (Ticket #1361).

git-svn-id: https://svn.libreccm.org/ccm/trunk@1845 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2012-09-01 11:21:57 +00:00
parent 4afbf64b16
commit 0f59c71dc5
1 changed files with 31 additions and 37 deletions

View File

@ -17,12 +17,10 @@
*/ */
package com.arsdigita.cms.contenttypes; package com.arsdigita.cms.contenttypes;
// import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentPage; import com.arsdigita.cms.ContentPage;
import com.arsdigita.cms.contentassets.RelatedLink; import com.arsdigita.cms.contentassets.RelatedLink;
import com.arsdigita.cms.publicpersonalprofile.PublicPersonalProfiles; import com.arsdigita.cms.publicpersonalprofile.PublicPersonalProfiles;
// import com.arsdigita.dispatcher.DispatcherHelper;
import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.DataCollection;
import com.arsdigita.ui.UI; import com.arsdigita.ui.UI;
@ -74,13 +72,13 @@ public class PublicPersonalProfileXmlUtil {
} }
final Element navRoot = final Element navRoot =
root.newChildElement("nav:categoryMenu", root.newChildElement("nav:categoryMenu",
"http://ccm.redhat.com/navigation"); "http://ccm.redhat.com/navigation");
navRoot.addAttribute("id", "categoryMenu"); navRoot.addAttribute("id", "categoryMenu");
final Element navList = final Element navList =
navRoot.newChildElement("nav:category", navRoot.newChildElement("nav:category",
"http://ccm.redhat.com/navigation"); "http://ccm.redhat.com/navigation");
navList.addAttribute("AbstractTree", "AbstractTree"); navList.addAttribute("AbstractTree", "AbstractTree");
navList.addAttribute("description", ""); navList.addAttribute("description", "");
navList.addAttribute("id", ""); navList.addAttribute("id", "");
@ -88,16 +86,16 @@ public class PublicPersonalProfileXmlUtil {
navList.addAttribute("sortKey", ""); navList.addAttribute("sortKey", "");
navList.addAttribute("title", "publicPersonalProfileNavList"); navList.addAttribute("title", "publicPersonalProfileNavList");
/*navList.addAttribute("url", String.format("%s/%s", /*navList.addAttribute("url", String.format("%s/%s",
appUrl, appUrl,
profile.getProfileUrl()));*/ profile.getProfileUrl()));*/
navList.addAttribute("url", String.format("/ccm%s", navList.addAttribute("url", String.format("/ccm%s",
UI.getConfig().getRootPage())); UI.getConfig().getRootPage()));
if (config.getShowHomeNavEntry()) { if (config.getShowHomeNavEntry()) {
final Element navHome = final Element navHome =
navList.newChildElement("nav:category", navList.newChildElement("nav:category",
"http://ccm.redhat.com/navigation"); "http://ccm.redhat.com/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());
@ -109,7 +107,7 @@ public class PublicPersonalProfileXmlUtil {
navHome.addAttribute("sortKey", ""); navHome.addAttribute("sortKey", "");
/*String homeLabel = homeLabels.get(GlobalizationHelper. /*String homeLabel = homeLabels.get(GlobalizationHelper.
getNegotiatedLocale().getLanguage());*/ getNegotiatedLocale().getLanguage());*/
final String homeLabel = homeLabels.get(profile.getLanguage()); final String homeLabel = homeLabels.get(profile.getLanguage());
if (homeLabel == null) { if (homeLabel == null) {
navHome.addAttribute("title", "Home"); navHome.addAttribute("title", "Home");
@ -125,9 +123,9 @@ public class PublicPersonalProfileXmlUtil {
//Get the available Navigation items //Get the available Navigation items
final PublicPersonalProfileNavItemCollection navItems = final PublicPersonalProfileNavItemCollection navItems =
new PublicPersonalProfileNavItemCollection(); new PublicPersonalProfileNavItemCollection();
/*navItems.addLanguageFilter(GlobalizationHelper.getNegotiatedLocale(). /*navItems.addLanguageFilter(GlobalizationHelper.getNegotiatedLocale().
getLanguage());*/ getLanguage());*/
navItems.addLanguageFilter(profile.getLanguage()); navItems.addLanguageFilter(profile.getLanguage());
final Map<String, PublicPersonalProfileNavItem> navItemMap = final Map<String, PublicPersonalProfileNavItem> navItemMap =
new LinkedHashMap<String, PublicPersonalProfileNavItem>(); new LinkedHashMap<String, PublicPersonalProfileNavItem>();
@ -159,8 +157,8 @@ public class PublicPersonalProfileXmlUtil {
//Get the related links of the profile //Get the related links of the profile
final DataCollection links = final 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;
@ -174,31 +172,26 @@ public class PublicPersonalProfileXmlUtil {
navItem = navItemMap.get(navLinkKey); navItem = navItemMap.get(navLinkKey);
if (navItem == null) { if (navItem == null) {
//ToDo continue;
} }
final ContentItem targetItem = link.getTargetItem(); final ContentItem targetItem = link.getTargetItem();
if (!(targetItem instanceof PublicPersonalProfile) if (!(targetItem instanceof PublicPersonalProfile)
&& (targetItem instanceof ContentPage)) { && (targetItem instanceof ContentPage)) {
final ContentPage targetPage = (ContentPage) targetItem; final ContentPage targetPage = (ContentPage) targetItem;
/*if (!(targetPage.getContentBundle().hasInstance(GlobalizationHelper.
getNegotiatedLocale().getLanguage(), if (!(targetPage.getContentBundle().hasInstance(profile.getLanguage(),
false))) {
continue;
}*/
if (!(targetPage.getContentBundle().hasInstance(profile.
getLanguage(),
false))) { false))) {
continue; continue;
} }
}
navLinks.add(createNavLink(navItem, navLinkKey, targetItem)); navLinks.add(createNavLink(navItem, navLinkKey, targetItem));
}
} }
Collections.sort(navLinks); Collections.sort(navLinks);
for(NavLink navLink : navLinks) { for (NavLink navLink : navLinks) {
navElem = navElem =
navList.newChildElement("nav:category", navList.newChildElement("nav:category",
"http://ccm.redhat.com/navigation"); "http://ccm.redhat.com/navigation");
@ -246,6 +239,7 @@ public class PublicPersonalProfileXmlUtil {
} }
private class NavLink implements Comparable<NavLink> { private class NavLink implements Comparable<NavLink> {
private PublicPersonalProfileNavItem navItem; private PublicPersonalProfileNavItem navItem;
private String key; private String key;
private ContentItem target; private ContentItem target;