Kleinere Verbesserungen an PublicPersonalProfile:
- theme-Prefix und preview werden bei der Erzeugung der Navigationslink beachtet - SelectBox für die Auswahl der Person beim Create-Step wird jetzt aktualisert (Ticket 653) git-svn-id: https://svn.libreccm.org/ccm/trunk@1118 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
d0a7b174b5
commit
7adb99fadd
|
|
@ -38,7 +38,11 @@ public class PublicPersonalProfileExtraXmlGenerator implements ExtraXMLGenerator
|
|||
final Element navigation = element.newChildElement("profileNavigation");
|
||||
final PublicPersonalProfileXmlUtil util =
|
||||
new PublicPersonalProfileXmlUtil();
|
||||
util.createNavigation(profile, navigation, showItem);
|
||||
String prefix = DispatcherHelper.getDispatcherPrefix(state.getRequest());
|
||||
if (prefix == null) {
|
||||
prefix = "";
|
||||
}
|
||||
util.createNavigation(profile, navigation, showItem, prefix, "", false);
|
||||
|
||||
if ((showItem != null) && !showItem.trim().isEmpty()) {
|
||||
final Element profileContent = element.newChildElement(
|
||||
|
|
|
|||
|
|
@ -21,8 +21,11 @@ public class PublicPersonalProfileXmlUtil {
|
|||
getConfig();
|
||||
|
||||
public void createNavigation(final PublicPersonalProfile profile,
|
||||
final Element root,
|
||||
final String navPath) {
|
||||
final Element root,
|
||||
final String navPath,
|
||||
final String prefix,
|
||||
final String appPath,
|
||||
final boolean previewMode) {
|
||||
String homeLabelsStr = config.getHomeNavItemLabels();
|
||||
|
||||
Map<String, String> homeLabels = new HashMap<String, String>();
|
||||
|
|
@ -37,6 +40,13 @@ public class PublicPersonalProfileXmlUtil {
|
|||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
String appUrl = null;
|
||||
if (previewMode) {
|
||||
appUrl = String.format("%s/ccm%s/preview", prefix, appPath);
|
||||
} else {
|
||||
appUrl = String.format("%s/ccm%s", prefix, appPath);
|
||||
}
|
||||
|
||||
Element navRoot =
|
||||
root.newChildElement("nav:categoryMenu",
|
||||
|
|
@ -52,8 +62,15 @@ public class PublicPersonalProfileXmlUtil {
|
|||
navList.addAttribute("isSelected", "true");
|
||||
navList.addAttribute("sortKey", "");
|
||||
navList.addAttribute("title", "publicPersonalProfileNavList");
|
||||
navList.addAttribute("url", String.format("/ccm/%s",
|
||||
profile.getProfileUrl()));
|
||||
if (previewMode) {
|
||||
navList.addAttribute("url", String.format("%s/%s",
|
||||
appUrl,
|
||||
profile.getProfileUrl()));
|
||||
} else {
|
||||
navList.addAttribute("url", String.format("%s/%s",
|
||||
appUrl,
|
||||
profile.getProfileUrl()));
|
||||
}
|
||||
|
||||
Element navHome =
|
||||
navList.newChildElement("nav:category",
|
||||
|
|
@ -74,7 +91,8 @@ public class PublicPersonalProfileXmlUtil {
|
|||
} else {
|
||||
navHome.addAttribute("title", homeLabel);
|
||||
}
|
||||
navHome.addAttribute("url", String.format("/ccm/profiles/%s",
|
||||
navHome.addAttribute("url", String.format("%s/%s",
|
||||
appUrl,
|
||||
profile.getProfileUrl()));
|
||||
|
||||
//Get the available Navigation items
|
||||
|
|
@ -126,10 +144,11 @@ public class PublicPersonalProfileXmlUtil {
|
|||
} else {
|
||||
navElem.addAttribute("title", navItem.getLabel());
|
||||
}
|
||||
navElem.addAttribute("url", String.format("/ccm/profiles/%s/%s",
|
||||
navElem.addAttribute("url", String.format("%s/%s/%s",
|
||||
appUrl,
|
||||
profile.getProfileUrl(),
|
||||
navLinkKey));
|
||||
|
||||
|
||||
navElem.addAttribute("navItem", navLinkKey);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,9 +5,11 @@ import com.arsdigita.bebop.FormData;
|
|||
import com.arsdigita.bebop.FormProcessException;
|
||||
import com.arsdigita.bebop.Label;
|
||||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.bebop.event.PrintEvent;
|
||||
import com.arsdigita.bebop.form.Option;
|
||||
import com.arsdigita.bebop.form.SingleSelect;
|
||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||
import com.arsdigita.bebop.event.PrintListener;
|
||||
import com.arsdigita.bebop.parameters.DateParameter;
|
||||
import com.arsdigita.bebop.parameters.NotNullValidationListener;
|
||||
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||
|
|
@ -32,8 +34,10 @@ import com.arsdigita.domain.DomainObjectFactory;
|
|||
import com.arsdigita.persistence.DataCollection;
|
||||
import com.arsdigita.persistence.SessionManager;
|
||||
import com.arsdigita.util.Assert;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.TooManyListenersException;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -75,28 +79,47 @@ public class PublicPersonalProfileCreate extends PageCreate {
|
|||
SingleSelect ownerSelect = new SingleSelect(ownerModel);
|
||||
ownerSelect.addValidationListener(new NotNullValidationListener());
|
||||
|
||||
String personType = config.getPersonType();
|
||||
if ((personType == null) || (personType.isEmpty())) {
|
||||
personType = "com.arsdigita.cms.contenttypes.GenericPerson";
|
||||
try {
|
||||
ownerSelect.addPrintListener(new PrintListener() {
|
||||
|
||||
public void prepare(final PrintEvent event) {
|
||||
final SingleSelect ownerSelect = (SingleSelect) event.
|
||||
getTarget();
|
||||
|
||||
String personType = config.getPersonType();
|
||||
if ((personType == null) || (personType.isEmpty())) {
|
||||
personType =
|
||||
"com.arsdigita.cms.contenttypes.GenericPerson";
|
||||
}
|
||||
|
||||
ContentTypeCollection types =
|
||||
ContentType.getAllContentTypes();
|
||||
types.addFilter(
|
||||
String.format("className = '%s'", personType));
|
||||
if (types.size() == 0) {
|
||||
personType =
|
||||
"com.arsdigita.cms.contenttypes.GenericPerson";
|
||||
}
|
||||
DataCollection persons = SessionManager.getSession().
|
||||
retrieve(
|
||||
personType);
|
||||
persons.addFilter("profile is null");
|
||||
persons.addFilter(String.format("version = '%s'",
|
||||
ContentItem.DRAFT));
|
||||
ownerSelect.addOption(new Option("", ""));
|
||||
while (persons.next()) {
|
||||
GenericPerson person =
|
||||
(GenericPerson) DomainObjectFactory.
|
||||
newInstance(persons.getDataObject());
|
||||
ownerSelect.addOption(new Option(
|
||||
person.getID().toString(), person.getFullName()));
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (TooManyListenersException ex) {
|
||||
throw new UncheckedWrapperException(ex);
|
||||
}
|
||||
|
||||
ContentTypeCollection types = ContentType.getAllContentTypes();
|
||||
types.addFilter(String.format("className = '%s'", personType));
|
||||
if (types.size() == 0) {
|
||||
personType = "com.arsdigita.cms.contenttypes.GenericPerson";
|
||||
}
|
||||
DataCollection persons = SessionManager.getSession().retrieve(
|
||||
personType);
|
||||
persons.addFilter("profile is null");
|
||||
persons.addFilter(String.format("version = '%s'", ContentItem.DRAFT));
|
||||
ownerSelect.addOption(new Option("", ""));
|
||||
while (persons.next()) {
|
||||
GenericPerson person =
|
||||
(GenericPerson) DomainObjectFactory.newInstance(persons.
|
||||
getDataObject());
|
||||
ownerSelect.addOption(new Option(person.getID().toString(), person.
|
||||
getFullName()));
|
||||
}
|
||||
add(ownerSelect);
|
||||
|
||||
if (!ContentSection.getConfig().getHideLaunchDate()) {
|
||||
|
|
@ -199,7 +222,7 @@ public class PublicPersonalProfileCreate extends PageCreate {
|
|||
profiles.addFilter(
|
||||
String.format("version = '%s'", ContentItem.DRAFT));
|
||||
}
|
||||
|
||||
|
||||
return profileUrl;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -179,9 +179,19 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
|||
Element profileOwnerName = profileElem.newChildElement(
|
||||
"ppp:ownerName", PPP_NS);
|
||||
profileOwnerName.setText(owner.getFullName());
|
||||
|
||||
final PublicPersonalProfileXmlUtil util = new PublicPersonalProfileXmlUtil();
|
||||
util.createNavigation(profile, root, navPath);
|
||||
|
||||
final PublicPersonalProfileXmlUtil util =
|
||||
new PublicPersonalProfileXmlUtil();
|
||||
String prefix = DispatcherHelper.getDispatcherPrefix(request);
|
||||
if (prefix == null) {
|
||||
prefix = "";
|
||||
}
|
||||
util.createNavigation(profile,
|
||||
root,
|
||||
navPath,
|
||||
prefix,
|
||||
app.getPath(),
|
||||
preview);
|
||||
|
||||
if (navPath == null) {
|
||||
final PublicPersonalProfileXmlGenerator generator =
|
||||
|
|
@ -294,118 +304,117 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
|||
}
|
||||
|
||||
/*private void createNavigation(final PublicPersonalProfile profile,
|
||||
final Element root,
|
||||
final String navPath) {
|
||||
String homeLabelsStr = config.getHomeNavItemLabels();
|
||||
|
||||
Map<String, String> homeLabels = new HashMap<String, String>();
|
||||
String[] homeLabelsArry = homeLabelsStr.split(",");
|
||||
String[] homeLabelSplit;
|
||||
for (String homeLabelEntry : homeLabelsArry) {
|
||||
homeLabelSplit = homeLabelEntry.split(":");
|
||||
if (homeLabelSplit.length == 2) {
|
||||
homeLabels.put(homeLabelSplit[0].trim(),
|
||||
homeLabelSplit[1].trim());
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
Element navRoot =
|
||||
root.newChildElement("nav:categoryMenu",
|
||||
"http://ccm.redhat.com/london/navigation");
|
||||
navRoot.addAttribute("id", "categoryMenu");
|
||||
|
||||
Element navList =
|
||||
navRoot.newChildElement("nav:category",
|
||||
"http://ccm.redhat.com/london/navigation");
|
||||
navList.addAttribute("AbstractTree", "AbstractTree");
|
||||
navList.addAttribute("description", "");
|
||||
navList.addAttribute("id", "");
|
||||
navList.addAttribute("isSelected", "true");
|
||||
navList.addAttribute("sortKey", "");
|
||||
navList.addAttribute("title", "publicPersonalProfileNavList");
|
||||
navList.addAttribute("url", String.format("/ccm/%s",
|
||||
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");
|
||||
}
|
||||
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("/ccm/profiles/%s",
|
||||
profile.getProfileUrl()));
|
||||
|
||||
//Get the available Navigation items
|
||||
PublicPersonalProfileNavItemCollection navItems =
|
||||
new PublicPersonalProfileNavItemCollection();
|
||||
navItems.addLanguageFilter(DispatcherHelper.getNegotiatedLocale().
|
||||
getLanguage());
|
||||
final Map<String, PublicPersonalProfileNavItem> navItemMap =
|
||||
new HashMap<String, PublicPersonalProfileNavItem>();
|
||||
PublicPersonalProfileNavItem navItem;
|
||||
while (navItems.next()) {
|
||||
navItem = navItems.getNavItem();
|
||||
navItemMap.put(navItem.getKey(), navItem);
|
||||
}
|
||||
|
||||
//Get the related links of the profiles
|
||||
DataCollection links =
|
||||
RelatedLink.getRelatedLinks(profile,
|
||||
PublicPersonalProfile.LINK_LIST_NAME);
|
||||
links.addOrder(Link.ORDER);
|
||||
RelatedLink link;
|
||||
String navLinkKey;
|
||||
Element navElem;
|
||||
while (links.next()) {
|
||||
link = (RelatedLink) DomainObjectFactory.newInstance(links.
|
||||
getDataObject());
|
||||
|
||||
navLinkKey = link.getTitle();
|
||||
navItem = navItemMap.get(navLinkKey);
|
||||
|
||||
if (navItem == null) {
|
||||
//ToDo
|
||||
}
|
||||
|
||||
navElem =
|
||||
navList.newChildElement("nav:category",
|
||||
"http://ccm.redhat.com/london/navigation");
|
||||
navElem.addAttribute("AbstractTree", "AbstractTree");
|
||||
navElem.addAttribute("description", "");
|
||||
//navHome.addAttribute("id", "");
|
||||
if ((navPath != null) && navPath.equals(navLinkKey)) {
|
||||
navElem.addAttribute("isSelected", "true");
|
||||
} else {
|
||||
navElem.addAttribute("isSelected", "false");
|
||||
}
|
||||
navElem.addAttribute("sortKey", "");
|
||||
if (navItem == null) {
|
||||
navElem.addAttribute("title", navLinkKey);
|
||||
} else {
|
||||
navElem.addAttribute("title", navItem.getLabel());
|
||||
}
|
||||
navElem.addAttribute("url", String.format("/ccm/profiles/%s/%s",
|
||||
profile.getProfileUrl(),
|
||||
navLinkKey));
|
||||
|
||||
}
|
||||
final Element root,
|
||||
final String navPath) {
|
||||
String homeLabelsStr = config.getHomeNavItemLabels();
|
||||
|
||||
Map<String, String> homeLabels = new HashMap<String, String>();
|
||||
String[] homeLabelsArry = homeLabelsStr.split(",");
|
||||
String[] homeLabelSplit;
|
||||
for (String homeLabelEntry : homeLabelsArry) {
|
||||
homeLabelSplit = homeLabelEntry.split(":");
|
||||
if (homeLabelSplit.length == 2) {
|
||||
homeLabels.put(homeLabelSplit[0].trim(),
|
||||
homeLabelSplit[1].trim());
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
Element navRoot =
|
||||
root.newChildElement("nav:categoryMenu",
|
||||
"http://ccm.redhat.com/london/navigation");
|
||||
navRoot.addAttribute("id", "categoryMenu");
|
||||
|
||||
Element navList =
|
||||
navRoot.newChildElement("nav:category",
|
||||
"http://ccm.redhat.com/london/navigation");
|
||||
navList.addAttribute("AbstractTree", "AbstractTree");
|
||||
navList.addAttribute("description", "");
|
||||
navList.addAttribute("id", "");
|
||||
navList.addAttribute("isSelected", "true");
|
||||
navList.addAttribute("sortKey", "");
|
||||
navList.addAttribute("title", "publicPersonalProfileNavList");
|
||||
navList.addAttribute("url", String.format("/ccm/%s",
|
||||
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");
|
||||
}
|
||||
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("/ccm/profiles/%s",
|
||||
profile.getProfileUrl()));
|
||||
|
||||
//Get the available Navigation items
|
||||
PublicPersonalProfileNavItemCollection navItems =
|
||||
new PublicPersonalProfileNavItemCollection();
|
||||
navItems.addLanguageFilter(DispatcherHelper.getNegotiatedLocale().
|
||||
getLanguage());
|
||||
final Map<String, PublicPersonalProfileNavItem> navItemMap =
|
||||
new HashMap<String, PublicPersonalProfileNavItem>();
|
||||
PublicPersonalProfileNavItem navItem;
|
||||
while (navItems.next()) {
|
||||
navItem = navItems.getNavItem();
|
||||
navItemMap.put(navItem.getKey(), navItem);
|
||||
}
|
||||
|
||||
//Get the related links of the profiles
|
||||
DataCollection links =
|
||||
RelatedLink.getRelatedLinks(profile,
|
||||
PublicPersonalProfile.LINK_LIST_NAME);
|
||||
links.addOrder(Link.ORDER);
|
||||
RelatedLink link;
|
||||
String navLinkKey;
|
||||
Element navElem;
|
||||
while (links.next()) {
|
||||
link = (RelatedLink) DomainObjectFactory.newInstance(links.
|
||||
getDataObject());
|
||||
|
||||
navLinkKey = link.getTitle();
|
||||
navItem = navItemMap.get(navLinkKey);
|
||||
|
||||
if (navItem == null) {
|
||||
//ToDo
|
||||
}
|
||||
|
||||
navElem =
|
||||
navList.newChildElement("nav:category",
|
||||
"http://ccm.redhat.com/london/navigation");
|
||||
navElem.addAttribute("AbstractTree", "AbstractTree");
|
||||
navElem.addAttribute("description", "");
|
||||
//navHome.addAttribute("id", "");
|
||||
if ((navPath != null) && navPath.equals(navLinkKey)) {
|
||||
navElem.addAttribute("isSelected", "true");
|
||||
} else {
|
||||
navElem.addAttribute("isSelected", "false");
|
||||
}
|
||||
navElem.addAttribute("sortKey", "");
|
||||
if (navItem == null) {
|
||||
navElem.addAttribute("title", navLinkKey);
|
||||
} else {
|
||||
navElem.addAttribute("title", navItem.getLabel());
|
||||
}
|
||||
navElem.addAttribute("url", String.format("/ccm/profiles/%s/%s",
|
||||
profile.getProfileUrl(),
|
||||
navLinkKey));
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
private void generateProfileOwnerXml(final Element profileElem,
|
||||
final GenericPerson owner,
|
||||
final PageState state) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue