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 Element navigation = element.newChildElement("profileNavigation");
|
||||||
final PublicPersonalProfileXmlUtil util =
|
final PublicPersonalProfileXmlUtil util =
|
||||||
new PublicPersonalProfileXmlUtil();
|
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()) {
|
if ((showItem != null) && !showItem.trim().isEmpty()) {
|
||||||
final Element profileContent = element.newChildElement(
|
final Element profileContent = element.newChildElement(
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,10 @@ public class PublicPersonalProfileXmlUtil {
|
||||||
|
|
||||||
public void createNavigation(final PublicPersonalProfile profile,
|
public void createNavigation(final PublicPersonalProfile profile,
|
||||||
final Element root,
|
final Element root,
|
||||||
final String navPath) {
|
final String navPath,
|
||||||
|
final String prefix,
|
||||||
|
final String appPath,
|
||||||
|
final boolean previewMode) {
|
||||||
String homeLabelsStr = config.getHomeNavItemLabels();
|
String homeLabelsStr = config.getHomeNavItemLabels();
|
||||||
|
|
||||||
Map<String, String> homeLabels = new HashMap<String, String>();
|
Map<String, String> homeLabels = new HashMap<String, String>();
|
||||||
|
|
@ -38,6 +41,13 @@ public class PublicPersonalProfileXmlUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 =
|
Element navRoot =
|
||||||
root.newChildElement("nav:categoryMenu",
|
root.newChildElement("nav:categoryMenu",
|
||||||
"http://ccm.redhat.com/london/navigation");
|
"http://ccm.redhat.com/london/navigation");
|
||||||
|
|
@ -52,8 +62,15 @@ public class PublicPersonalProfileXmlUtil {
|
||||||
navList.addAttribute("isSelected", "true");
|
navList.addAttribute("isSelected", "true");
|
||||||
navList.addAttribute("sortKey", "");
|
navList.addAttribute("sortKey", "");
|
||||||
navList.addAttribute("title", "publicPersonalProfileNavList");
|
navList.addAttribute("title", "publicPersonalProfileNavList");
|
||||||
navList.addAttribute("url", String.format("/ccm/%s",
|
if (previewMode) {
|
||||||
|
navList.addAttribute("url", String.format("%s/%s",
|
||||||
|
appUrl,
|
||||||
profile.getProfileUrl()));
|
profile.getProfileUrl()));
|
||||||
|
} else {
|
||||||
|
navList.addAttribute("url", String.format("%s/%s",
|
||||||
|
appUrl,
|
||||||
|
profile.getProfileUrl()));
|
||||||
|
}
|
||||||
|
|
||||||
Element navHome =
|
Element navHome =
|
||||||
navList.newChildElement("nav:category",
|
navList.newChildElement("nav:category",
|
||||||
|
|
@ -74,7 +91,8 @@ public class PublicPersonalProfileXmlUtil {
|
||||||
} else {
|
} else {
|
||||||
navHome.addAttribute("title", homeLabel);
|
navHome.addAttribute("title", homeLabel);
|
||||||
}
|
}
|
||||||
navHome.addAttribute("url", String.format("/ccm/profiles/%s",
|
navHome.addAttribute("url", String.format("%s/%s",
|
||||||
|
appUrl,
|
||||||
profile.getProfileUrl()));
|
profile.getProfileUrl()));
|
||||||
|
|
||||||
//Get the available Navigation items
|
//Get the available Navigation items
|
||||||
|
|
@ -126,7 +144,8 @@ public class PublicPersonalProfileXmlUtil {
|
||||||
} else {
|
} else {
|
||||||
navElem.addAttribute("title", navItem.getLabel());
|
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(),
|
profile.getProfileUrl(),
|
||||||
navLinkKey));
|
navLinkKey));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,11 @@ import com.arsdigita.bebop.FormData;
|
||||||
import com.arsdigita.bebop.FormProcessException;
|
import com.arsdigita.bebop.FormProcessException;
|
||||||
import com.arsdigita.bebop.Label;
|
import com.arsdigita.bebop.Label;
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.event.PrintEvent;
|
||||||
import com.arsdigita.bebop.form.Option;
|
import com.arsdigita.bebop.form.Option;
|
||||||
import com.arsdigita.bebop.form.SingleSelect;
|
import com.arsdigita.bebop.form.SingleSelect;
|
||||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||||
|
import com.arsdigita.bebop.event.PrintListener;
|
||||||
import com.arsdigita.bebop.parameters.DateParameter;
|
import com.arsdigita.bebop.parameters.DateParameter;
|
||||||
import com.arsdigita.bebop.parameters.NotNullValidationListener;
|
import com.arsdigita.bebop.parameters.NotNullValidationListener;
|
||||||
import com.arsdigita.bebop.parameters.ParameterModel;
|
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||||
|
|
@ -32,8 +34,10 @@ import com.arsdigita.domain.DomainObjectFactory;
|
||||||
import com.arsdigita.persistence.DataCollection;
|
import com.arsdigita.persistence.DataCollection;
|
||||||
import com.arsdigita.persistence.SessionManager;
|
import com.arsdigita.persistence.SessionManager;
|
||||||
import com.arsdigita.util.Assert;
|
import com.arsdigita.util.Assert;
|
||||||
|
import com.arsdigita.util.UncheckedWrapperException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.TooManyListenersException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -75,28 +79,47 @@ public class PublicPersonalProfileCreate extends PageCreate {
|
||||||
SingleSelect ownerSelect = new SingleSelect(ownerModel);
|
SingleSelect ownerSelect = new SingleSelect(ownerModel);
|
||||||
ownerSelect.addValidationListener(new NotNullValidationListener());
|
ownerSelect.addValidationListener(new NotNullValidationListener());
|
||||||
|
|
||||||
|
try {
|
||||||
|
ownerSelect.addPrintListener(new PrintListener() {
|
||||||
|
|
||||||
|
public void prepare(final PrintEvent event) {
|
||||||
|
final SingleSelect ownerSelect = (SingleSelect) event.
|
||||||
|
getTarget();
|
||||||
|
|
||||||
String personType = config.getPersonType();
|
String personType = config.getPersonType();
|
||||||
if ((personType == null) || (personType.isEmpty())) {
|
if ((personType == null) || (personType.isEmpty())) {
|
||||||
personType = "com.arsdigita.cms.contenttypes.GenericPerson";
|
personType =
|
||||||
|
"com.arsdigita.cms.contenttypes.GenericPerson";
|
||||||
}
|
}
|
||||||
|
|
||||||
ContentTypeCollection types = ContentType.getAllContentTypes();
|
ContentTypeCollection types =
|
||||||
types.addFilter(String.format("className = '%s'", personType));
|
ContentType.getAllContentTypes();
|
||||||
|
types.addFilter(
|
||||||
|
String.format("className = '%s'", personType));
|
||||||
if (types.size() == 0) {
|
if (types.size() == 0) {
|
||||||
personType = "com.arsdigita.cms.contenttypes.GenericPerson";
|
personType =
|
||||||
|
"com.arsdigita.cms.contenttypes.GenericPerson";
|
||||||
}
|
}
|
||||||
DataCollection persons = SessionManager.getSession().retrieve(
|
DataCollection persons = SessionManager.getSession().
|
||||||
|
retrieve(
|
||||||
personType);
|
personType);
|
||||||
persons.addFilter("profile is null");
|
persons.addFilter("profile is null");
|
||||||
persons.addFilter(String.format("version = '%s'", ContentItem.DRAFT));
|
persons.addFilter(String.format("version = '%s'",
|
||||||
|
ContentItem.DRAFT));
|
||||||
ownerSelect.addOption(new Option("", ""));
|
ownerSelect.addOption(new Option("", ""));
|
||||||
while (persons.next()) {
|
while (persons.next()) {
|
||||||
GenericPerson person =
|
GenericPerson person =
|
||||||
(GenericPerson) DomainObjectFactory.newInstance(persons.
|
(GenericPerson) DomainObjectFactory.
|
||||||
getDataObject());
|
newInstance(persons.getDataObject());
|
||||||
ownerSelect.addOption(new Option(person.getID().toString(), person.
|
ownerSelect.addOption(new Option(
|
||||||
getFullName()));
|
person.getID().toString(), person.getFullName()));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (TooManyListenersException ex) {
|
||||||
|
throw new UncheckedWrapperException(ex);
|
||||||
|
}
|
||||||
|
|
||||||
add(ownerSelect);
|
add(ownerSelect);
|
||||||
|
|
||||||
if (!ContentSection.getConfig().getHideLaunchDate()) {
|
if (!ContentSection.getConfig().getHideLaunchDate()) {
|
||||||
|
|
|
||||||
|
|
@ -180,8 +180,18 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
||||||
"ppp:ownerName", PPP_NS);
|
"ppp:ownerName", PPP_NS);
|
||||||
profileOwnerName.setText(owner.getFullName());
|
profileOwnerName.setText(owner.getFullName());
|
||||||
|
|
||||||
final PublicPersonalProfileXmlUtil util = new PublicPersonalProfileXmlUtil();
|
final PublicPersonalProfileXmlUtil util =
|
||||||
util.createNavigation(profile, root, navPath);
|
new PublicPersonalProfileXmlUtil();
|
||||||
|
String prefix = DispatcherHelper.getDispatcherPrefix(request);
|
||||||
|
if (prefix == null) {
|
||||||
|
prefix = "";
|
||||||
|
}
|
||||||
|
util.createNavigation(profile,
|
||||||
|
root,
|
||||||
|
navPath,
|
||||||
|
prefix,
|
||||||
|
app.getPath(),
|
||||||
|
preview);
|
||||||
|
|
||||||
if (navPath == null) {
|
if (navPath == null) {
|
||||||
final PublicPersonalProfileXmlGenerator generator =
|
final PublicPersonalProfileXmlGenerator generator =
|
||||||
|
|
@ -405,7 +415,6 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
||||||
|
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
private void generateProfileOwnerXml(final Element profileElem,
|
private void generateProfileOwnerXml(final Element profileElem,
|
||||||
final GenericPerson owner,
|
final GenericPerson owner,
|
||||||
final PageState state) {
|
final PageState state) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue