Output navigation for public personal profile as nav:hierarchy

git-svn-id: https://svn.libreccm.org/ccm/trunk@5339 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2018-03-09 07:51:19 +00:00
parent d2cb5336e6
commit 43f97e1ad3
1 changed files with 73 additions and 4 deletions

View File

@ -85,7 +85,17 @@ public class PublicPersonalProfileXmlUtil {
"http://ccm.redhat.com/navigation");
navRoot.addAttribute("id", "categoryMenu");
final Element navList = navRoot.newChildElement("nav:category",
final Element navHierarchyRoot = root
.newChildElement("nav:categoryHierarchy",
"http://ccm.redhat.com/navigation");
navHierarchyRoot
.addAttribute("bebop:classname",
"com.arsdigita.navigation.ui.category.Hierarchy",
"http://www.arsdigita.com/bebop/1.0");
navHierarchyRoot.addAttribute("id", "categoryNav");
final Element navList = navRoot
.newChildElement("nav:category",
"http://ccm.redhat.com/navigation");
navList.addAttribute("AbstractTree", "AbstractTree");
navList.addAttribute("description", "");
@ -100,7 +110,8 @@ public class PublicPersonalProfileXmlUtil {
UI.getConfig().getRootPage()));
if (config.getShowHomeNavEntry()) {
final Element navHome = navList.newChildElement("nav:category",
final Element navHome = navList
.newChildElement("nav:category",
"http://ccm.redhat.com/navigation");
navHome.addAttribute("AbstractTree", "AbstractTree");
navHome.addAttribute("description", "");
@ -112,13 +123,28 @@ public class PublicPersonalProfileXmlUtil {
}
navHome.addAttribute("sortKey", "");
final Element navHierarchyHome = navHierarchyRoot
.newChildElement("nav:category",
"http://ccm.redhat.com/navigation");
navHierarchyHome.addAttribute("AbstractTree", "AbstractTree");
navHierarchyHome.addAttribute("description", "");
navHierarchyHome.addAttribute("id", profile.getID().toString());
if (navPath == null) {
navHierarchyHome.addAttribute("isSelected", "true");
} else {
navHierarchyHome.addAttribute("isSelected", "false");
}
navHierarchyHome.addAttribute("sortKey", "");
/*String homeLabel = homeLabels.get(GlobalizationHelper.
getNegotiatedLocale().getLanguage());*/
final String homeLabel = homeLabels.get(profile.getLanguage());
if (homeLabel == null) {
navHome.addAttribute("title", "Home");
navHierarchyHome.addAttribute("title", "Home");
} else {
navHome.addAttribute("title", homeLabel);
navHierarchyHome.addAttribute("title", homeLabel);
}
if (CMSConfig.getInstanceOf().getUseLanguageExtension()) {
navHome
@ -129,11 +155,24 @@ public class PublicPersonalProfileXmlUtil {
GlobalizationHelper
.getNegotiatedLocale()
.getLanguage()));
navHierarchyHome
.addAttribute("url",
String.format("%s/%s/index.%s",
appUrl,
profile.getProfileUrl(),
GlobalizationHelper
.getNegotiatedLocale()
.getLanguage()));
} else {
navHome.addAttribute("url", String.format("%s/%s",
appUrl,
profile
.getProfileUrl()));
navHierarchyHome.addAttribute("url", String.format("%s/%s",
appUrl,
profile
.getProfileUrl()));
}
}
@ -181,6 +220,7 @@ public class PublicPersonalProfileXmlUtil {
RelatedLink link;
String navLinkKey;
Element navElem;
Element navHierarchyElem;
final List<NavLink> navLinks = new ArrayList<NavLink>();
while (links.next()) {
link = (RelatedLink) DomainObjectFactory.newInstance(links.
@ -218,10 +258,19 @@ public class PublicPersonalProfileXmlUtil {
Collections.sort(navLinks);
for (NavLink navLink : navLinks) {
navElem = navList.newChildElement("nav:category",
"http://ccm.redhat.com/navigation");
navElem.addAttribute("AbstractTree", "AbstractTree");
navElem.addAttribute("description", "");
navHierarchyElem = navHierarchyRoot
.newChildElement("nav:category",
"http://ccm.redhat.com/navigation");
navHierarchyElem.addAttribute("AbstractTree", "AbstractTree");
navHierarchyElem.addAttribute("depth", "0");
navHierarchyElem.addAttribute("description", "");
//navHome.addAttribute("id", "");
if ((navPath != null) && navPath.equals(navLink.getKey())) {
navElem.addAttribute("isSelected", "true");
@ -252,10 +301,14 @@ public class PublicPersonalProfileXmlUtil {
navElem.addAttribute("isSelected", "false");
}
navElem.addAttribute("sortKey", "");
navHierarchyElem.addAttribute("sortKey", "");
if (navLink.getTarget() == null) {
navElem.addAttribute("title", navLink.getKey());
navHierarchyElem.addAttribute("title", navLink.getKey());
} else {
navElem.addAttribute("title", navLink.getNavItem().getLabel());
navHierarchyElem
.addAttribute("title", navLink.getNavItem().getLabel());
}
if (CMSConfig.getInstanceOf().getUseLanguageExtension()) {
navElem.addAttribute(
@ -267,6 +320,15 @@ public class PublicPersonalProfileXmlUtil {
GlobalizationHelper
.getNegotiatedLocale()
.getLanguage()));
navHierarchyElem.addAttribute(
"url",
String.format("%s/%s/%s/index.%s",
appUrl,
profile.getProfileUrl(),
navLink.getKey(),
GlobalizationHelper
.getNegotiatedLocale()
.getLanguage()));
} else {
navElem.addAttribute(
"url",
@ -274,9 +336,16 @@ public class PublicPersonalProfileXmlUtil {
appUrl,
profile.getProfileUrl(),
navLink.getKey()));
navHierarchyElem.addAttribute(
"url",
String.format("%s/%s/%s",
appUrl,
profile.getProfileUrl(),
navLink.getKey()));
}
navElem.addAttribute("navItem", navLink.getKey());
navHierarchyElem.addAttribute("navItem", navLink.getKey());
}
}