PublicPersonalProfile:

- Breadcrumbs werden in den persönlichen Profilen jetzt ausgegeben
- Die Anzeige des Links auf die Startseite in der Navigation eines Profils kann jetzt per Konfiguration deaktiviert werden


git-svn-id: https://svn.libreccm.org/ccm/trunk@1152 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2011-10-08 14:29:58 +00:00
parent 2072ad4e9c
commit 2dcca10ec0
3 changed files with 63 additions and 24 deletions

View File

@ -17,7 +17,8 @@ import java.util.Map;
public class PublicPersonalProfileXmlUtil {
private final com.arsdigita.cms.publicpersonalprofile.PublicPersonalProfileConfig config =
PublicPersonalProfileConfig.getConfig();
PublicPersonalProfileConfig.
getConfig();
public void createNavigation(final PublicPersonalProfile profile,
final Element root,
@ -39,7 +40,7 @@ public class PublicPersonalProfileXmlUtil {
continue;
}
}
String appUrl = null;
if (previewMode) {
appUrl = String.format("%s/ccm%s/preview", prefix, appPath);
@ -71,28 +72,31 @@ public class PublicPersonalProfileXmlUtil {
profile.getProfileUrl()));
}
Element navHome =
navList.newChildElement("nav:category",
"http://ccm.redhat.com/london/navigation");
navHome.addAttribute("AbstractTree", "AbstractTree");
navHome.addAttribute("description", "");
navHome.addAttribute("id", profile.getID().toString());
if (navPath == null) {
navHome.addAttribute("isSelected", "true");
} else {
navHome.addAttribute("isSelected", "false");
if (config.getShowHomeNavEntry()) {
Element navHome =
navList.newChildElement("nav:category",
"http://ccm.redhat.com/london/navigation");
navHome.addAttribute("AbstractTree", "AbstractTree");
navHome.addAttribute("description", "");
navHome.addAttribute("id", profile.getID().toString());
if (navPath == null) {
navHome.addAttribute("isSelected", "true");
} else {
navHome.addAttribute("isSelected", "false");
}
navHome.addAttribute("sortKey", "");
String homeLabel = homeLabels.get(DispatcherHelper.
getNegotiatedLocale().
getLanguage());
if (homeLabel == null) {
navHome.addAttribute("title", "Home");
} else {
navHome.addAttribute("title", homeLabel);
}
navHome.addAttribute("url", String.format("%s/%s",
appUrl,
profile.getProfileUrl()));
}
navHome.addAttribute("sortKey", "");
String homeLabel = homeLabels.get(DispatcherHelper.getNegotiatedLocale().
getLanguage());
if (homeLabel == null) {
navHome.addAttribute("title", "Home");
} else {
navHome.addAttribute("title", homeLabel);
}
navHome.addAttribute("url", String.format("%s/%s",
appUrl,
profile.getProfileUrl()));
//Get the available Navigation items
PublicPersonalProfileNavItemCollection navItems =
@ -107,6 +111,16 @@ public class PublicPersonalProfileXmlUtil {
navItemMap.put(navItem.getKey(), navItem);
}
final Element pathElem =
root.newChildElement("nav:categoryPath",
"http://ccm.redhat.com/london/navigation");
final Element homeElem =
pathElem.newChildElement("nav:category",
"http://ccm.redhat.com/london/navigation");
homeElem.addAttribute("url", String.format("%s/%s",
appUrl,
profile.getProfileUrl()));
//Get the related links of the profiles
DataCollection links =
RelatedLink.getRelatedLinks(profile,
@ -134,6 +148,15 @@ public class PublicPersonalProfileXmlUtil {
//navHome.addAttribute("id", "");
if ((navPath != null) && navPath.equals(navLinkKey)) {
navElem.addAttribute("isSelected", "true");
final Element currentPathElem =
pathElem.newChildElement("nav:category",
"http://ccm.redhat.com/london/navigation");
currentPathElem.addAttribute("title", navItem.getLabel());
currentPathElem.addAttribute("url",
String.format("%s/%s/%s",
appUrl,
profile.getProfileUrl(),
navLinkKey));
} else {
navElem.addAttribute("isSelected", "false");
}

View File

@ -15,6 +15,7 @@ public class PublicPersonalProfileConfig extends AbstractConfig {
private final static PublicPersonalProfileConfig config = new PublicPersonalProfileConfig();
private final Parameter personType;
private final Parameter embedded;
private final Parameter showHomeNavEntry;
private final Parameter homeNavItemLabels;
private final Parameter showPersonInfoEverywhere;
// private final Parameter contactType;
@ -35,6 +36,11 @@ public class PublicPersonalProfileConfig extends AbstractConfig {
Parameter.REQUIRED,
false);
showHomeNavEntry = new BooleanParameter(
"com.arsdigita.cms.publicpersonalprofile.showHomeNavEntry",
Parameter.REQUIRED,
true);
homeNavItemLabels = new StringParameter(
"com.arsdigita.cms.publicpersonalprofile.navitem.home.labels",
Parameter.REQUIRED,
@ -50,9 +56,10 @@ public class PublicPersonalProfileConfig extends AbstractConfig {
"com.arsdigita.cms.publicpersonalprofile.contactType",
Parameter.REQUIRED,
"commonContact");*/
register(personType);
register(embedded);
register(showHomeNavEntry);
register(homeNavItemLabels);
register(showPersonInfoEverywhere);
// register(contactType);
@ -68,6 +75,10 @@ public class PublicPersonalProfileConfig extends AbstractConfig {
return (Boolean) get(embedded);
}
public final boolean getShowHomeNavEntry() {
return (Boolean) get(showHomeNavEntry);
}
public final String getHomeNavItemLabels() {
return (String) get(homeNavItemLabels);
}

View File

@ -8,6 +8,11 @@ com.arsdigita.cms.publicpersonalprofile.embedded.purpose = If set the true the p
com.arsdigita.cms.publicpersonalprofile.embedded.example = false
com.arsdigita.cms.publicpersonalprofile.embedded.format = [Boolean]
com.arsdigita.cms.publicpersonalprofile.showHomeNavEntry.title = Show home navigation entry
com.arsdigita.cms.publicpersonalprofile.showHomeNavEntry.purpose = Decides whether to show the home navigation entry.
com.arsdigita.cms.publicpersonalprofile.showHomeNavEntry.example = true
com.arsdigita.cms.publicpersonalprofile.showHomeNavEntry.format = [Boolean]
com.arsdigita.cms.publicpersonalprofile.navitem.home.labels.title = The labels for the home link of a profile
com.arsdigita.cms.publicpersonalprofile.navitem.home.labels.purpose = The labels for the home link of a profile
com.arsdigita.cms.publicpersonalprofile.navitem.home.labels.example = en:Home,de:Start