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 { public class PublicPersonalProfileXmlUtil {
private final com.arsdigita.cms.publicpersonalprofile.PublicPersonalProfileConfig config = private final com.arsdigita.cms.publicpersonalprofile.PublicPersonalProfileConfig config =
PublicPersonalProfileConfig.getConfig(); PublicPersonalProfileConfig.
getConfig();
public void createNavigation(final PublicPersonalProfile profile, public void createNavigation(final PublicPersonalProfile profile,
final Element root, final Element root,
@ -71,28 +72,31 @@ public class PublicPersonalProfileXmlUtil {
profile.getProfileUrl())); profile.getProfileUrl()));
} }
Element navHome = if (config.getShowHomeNavEntry()) {
navList.newChildElement("nav:category", Element navHome =
"http://ccm.redhat.com/london/navigation"); navList.newChildElement("nav:category",
navHome.addAttribute("AbstractTree", "AbstractTree"); "http://ccm.redhat.com/london/navigation");
navHome.addAttribute("description", ""); navHome.addAttribute("AbstractTree", "AbstractTree");
navHome.addAttribute("id", profile.getID().toString()); navHome.addAttribute("description", "");
if (navPath == null) { navHome.addAttribute("id", profile.getID().toString());
navHome.addAttribute("isSelected", "true"); if (navPath == null) {
} else { navHome.addAttribute("isSelected", "true");
navHome.addAttribute("isSelected", "false"); } 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 //Get the available Navigation items
PublicPersonalProfileNavItemCollection navItems = PublicPersonalProfileNavItemCollection navItems =
@ -107,6 +111,16 @@ public class PublicPersonalProfileXmlUtil {
navItemMap.put(navItem.getKey(), navItem); 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 //Get the related links of the profiles
DataCollection links = DataCollection links =
RelatedLink.getRelatedLinks(profile, RelatedLink.getRelatedLinks(profile,
@ -134,6 +148,15 @@ public class PublicPersonalProfileXmlUtil {
//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 =
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 { } else {
navElem.addAttribute("isSelected", "false"); navElem.addAttribute("isSelected", "false");
} }

View File

@ -15,6 +15,7 @@ public class PublicPersonalProfileConfig extends AbstractConfig {
private final static PublicPersonalProfileConfig config = new PublicPersonalProfileConfig(); private final static PublicPersonalProfileConfig config = new PublicPersonalProfileConfig();
private final Parameter personType; private final Parameter personType;
private final Parameter embedded; private final Parameter embedded;
private final Parameter showHomeNavEntry;
private final Parameter homeNavItemLabels; private final Parameter homeNavItemLabels;
private final Parameter showPersonInfoEverywhere; private final Parameter showPersonInfoEverywhere;
// private final Parameter contactType; // private final Parameter contactType;
@ -35,6 +36,11 @@ public class PublicPersonalProfileConfig extends AbstractConfig {
Parameter.REQUIRED, Parameter.REQUIRED,
false); false);
showHomeNavEntry = new BooleanParameter(
"com.arsdigita.cms.publicpersonalprofile.showHomeNavEntry",
Parameter.REQUIRED,
true);
homeNavItemLabels = new StringParameter( homeNavItemLabels = new StringParameter(
"com.arsdigita.cms.publicpersonalprofile.navitem.home.labels", "com.arsdigita.cms.publicpersonalprofile.navitem.home.labels",
Parameter.REQUIRED, Parameter.REQUIRED,
@ -53,6 +59,7 @@ public class PublicPersonalProfileConfig extends AbstractConfig {
register(personType); register(personType);
register(embedded); register(embedded);
register(showHomeNavEntry);
register(homeNavItemLabels); register(homeNavItemLabels);
register(showPersonInfoEverywhere); register(showPersonInfoEverywhere);
// register(contactType); // register(contactType);
@ -68,6 +75,10 @@ public class PublicPersonalProfileConfig extends AbstractConfig {
return (Boolean) get(embedded); return (Boolean) get(embedded);
} }
public final boolean getShowHomeNavEntry() {
return (Boolean) get(showHomeNavEntry);
}
public final String getHomeNavItemLabels() { public final String getHomeNavItemLabels() {
return (String) get(homeNavItemLabels); 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.example = false
com.arsdigita.cms.publicpersonalprofile.embedded.format = [Boolean] 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.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.purpose = The labels for the home link of a profile
com.arsdigita.cms.publicpersonalprofile.navitem.home.labels.example = en:Home,de:Start com.arsdigita.cms.publicpersonalprofile.navitem.home.labels.example = en:Home,de:Start