Verschiedene kleinere Änderungen an PublicPersonalProfile

git-svn-id: https://svn.libreccm.org/ccm/trunk@2130 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2013-04-17 07:18:05 +00:00
parent 3e07cb427e
commit bfe6e76882
4 changed files with 46 additions and 34 deletions

View File

@ -179,10 +179,10 @@ public class PublicPersonalProfileXmlUtil {
continue;
}
final ContentItem targetItem = link.getTargetItem();
System.out.printf("targetItem.getClass.getName: %s\n", targetItem.getClass().getName());
final ContentItem targetItem = link.getTargetItem();
//System.out.printf("targetItem.getClass.getName: %s\n", targetItem.getClass().getName());
if ((targetItem instanceof PublicPersonalProfile)
|| (targetItem instanceof ContentPage)) {
|| (targetItem instanceof ContentPage)) {
final ContentPage targetPage = (ContentPage) targetItem;
if (!(targetPage.getContentBundle().hasInstance(profile.getLanguage(),

View File

@ -106,6 +106,7 @@ public class PublicPersonalProfileNavigationTable
return new PublicPersonalProfileNavigationTableModel(
table, state, profile);
}
}
private class PublicPersonalProfileNavigationTableModel
@ -150,8 +151,7 @@ public class PublicPersonalProfileNavigationTable
getNegotiatedLocale().getLanguage());
navItems.reset();
if ((navItem == null) && (Kernel.getConfig().languageIndependentItems())) {
navItem = navItems.getNavItem(key, GlobalizationHelper.
LANG_INDEPENDENT);
navItem = navItems.getNavItem(key, GlobalizationHelper.LANG_INDEPENDENT);
}
navItems.reset();
@ -165,10 +165,10 @@ public class PublicPersonalProfileNavigationTable
}
case 1:
/*if (navItem.getGeneratorClass() == null) {
return targetItem;
} else {
return null;
}*/
return targetItem;
} else {
return null;
}*/
if (targetItem instanceof PublicPersonalProfile) {
return null;
} else {
@ -187,6 +187,7 @@ public class PublicPersonalProfileNavigationTable
RelatedLink link = new RelatedLink(linkCollection.getDataObject());
return link.getID();
}
}
private class EditCellRenderer
@ -205,6 +206,7 @@ public class PublicPersonalProfileNavigationTable
return new Label((String) value);
}
}
private class TargetCellRenderer
@ -232,8 +234,7 @@ public class PublicPersonalProfileNavigationTable
item);
if (canEdit) {
final ContentSection section = CMS.getContext().
getContentSection();
final ContentSection section = item.getContentSection();//CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver();
Link link = new Link(item.getTitle(),
@ -246,6 +247,7 @@ public class PublicPersonalProfileNavigationTable
}
}
}
}
private class DeleteCellRenderer
@ -282,6 +284,7 @@ public class PublicPersonalProfileNavigationTable
return label;
}
}
}
@Override
@ -306,4 +309,5 @@ public class PublicPersonalProfileNavigationTable
public void headSelected(TableActionEvent event) {
//Nothing to do here.
}
}

View File

@ -91,7 +91,9 @@ public class PublicPersonalProfilePropertyForm extends BasicPageForm implements
DataCollection persons = SessionManager.getSession().retrieve(personType);
//persons.addFilter("profile is null");
persons.addFilter(String.format("version = '%s'", ContentItem.DRAFT));
persons.addFilter(String.format("alias.id = '%s'", owner.getID().toString()));
if (owner != null) {
persons.addFilter(String.format("alias.id = '%s'", owner.getID().toString()));
}
persons.addOrder("surname asc");
persons.addOrder("givenname asc");
persons.addOrder("language asc");
@ -122,6 +124,7 @@ public class PublicPersonalProfilePropertyForm extends BasicPageForm implements
}
}
}
});
} catch (TooManyListenersException ex) {
throw new UncheckedWrapperException(ex);
@ -199,4 +202,5 @@ public class PublicPersonalProfilePropertyForm extends BasicPageForm implements
}
}
}
}

View File

@ -125,7 +125,7 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
final Element root = document.getRootElement();
final Session session = SessionManager.getSession();
PublicPersonalProfile profile = getProfile(
session,
path.getProfileOwner(),
@ -213,8 +213,7 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
}
if (config.getEmbedded()) {
final ContentSection section =
profile.getContentSection();
final ContentSection section = profile.getContentSection();
final ItemResolver resolver = section.getItemResolver();
String context;
@ -661,12 +660,13 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
if (item instanceof ContentPage) {
ContentPage contentPage =
(ContentPage) item;
logger.error("contentPage.getContentBundle().hasInstance(GlobalizationHelper.getNegotiatedLocale().getLanguage()) = "
+ contentPage.
getContentBundle().
hasInstance(GlobalizationHelper.
getNegotiatedLocale().
getLanguage()));
logger.
error("contentPage.getContentBundle().hasInstance(GlobalizationHelper.getNegotiatedLocale().getLanguage()) = "
+ contentPage.
getContentBundle().
hasInstance(GlobalizationHelper.
getNegotiatedLocale().
getLanguage()));
if (contentPage.getContentBundle().
hasInstance(GlobalizationHelper.
getNegotiatedLocale().
@ -680,7 +680,8 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
item = (ContentItem) contentPage;
} else {
logger.error(
String.format(
String.
format(
"Item '%s' not found in a suitable language variant. Negotiated langauge: %s, langugage independent items allowed is %s, language independent code is %s ",
itemPath,
GlobalizationHelper.
@ -723,10 +724,11 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
if (item instanceof ContentPage) {
ContentPage contentPage = (ContentPage) item;
logger.error("contentPage.getContentBundle().hasInstance(GlobalizationHelper.getNegotiatedLocale().getLanguage()) = "
+ contentPage.getContentBundle().
hasInstance(GlobalizationHelper.
getNegotiatedLocale().getLanguage()));
logger.
error("contentPage.getContentBundle().hasInstance(GlobalizationHelper.getNegotiatedLocale().getLanguage()) = "
+ contentPage.getContentBundle().
hasInstance(GlobalizationHelper.
getNegotiatedLocale().getLanguage()));
if (contentPage.getContentBundle().
hasInstance(GlobalizationHelper.
getNegotiatedLocale().getLanguage())) {
@ -737,7 +739,8 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
item = (ContentItem) contentPage;
} else {
logger.error(
String.format(
String.
format(
"Item '%s' not found in a suitable language variant. Negotiated langauge: %s, langugage independent items allowed is %s, language independent code is %s ",
itemPath,
GlobalizationHelper.
@ -1171,32 +1174,32 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
final DataCollection profiles =
session.retrieve(
com.arsdigita.cms.contenttypes.PublicPersonalProfile.BASE_DATA_OBJECT_TYPE);
final FilterFactory filterFactory = profiles.getFilterFactory();
final FilterFactory filterFactory = profiles.getFilterFactory();
final Filter urlFilter = filterFactory.simple(String.format(
"profileUrl = '%s'",
profileOwner));
final Filter versionFilter;
if (preview) {
versionFilter = filterFactory.simple(String.format("version = '%s'",
ContentItem.DRAFT));
ContentItem.DRAFT));
} else {
versionFilter = filterFactory.simple(String.format("version = '%s'",
ContentItem.LIVE));
ContentItem.LIVE));
}
final Filter langFilter = filterFactory.simple(String.format(
"language = '%s'", language));
profiles.addFilter(urlFilter);
profiles.addFilter(versionFilter);
profiles.addFilter(langFilter);
if (profiles.isEmpty()) {
profiles.reset();
profiles.addFilter(urlFilter);
profiles.addFilter(versionFilter);
profiles.addFilter(String.format("language = '%s'",
profiles.addFilter(String.format("language = '%s'",
GlobalizationHelper.LANG_INDEPENDENT));
}
@ -1345,5 +1348,6 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
public String getItemPath() {
return itemPath;
}
}
}