- Konfigurationen für PublicPersonalProfile zusammengefasst
- Vorschaulink im Content-Center angepasst, zeigt jetzt je nach Konfiguration auf das Content-Item (Embedded Mode) oder auf die Application URL von profiles git-svn-id: https://svn.libreccm.org/ccm/trunk@1150 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
2c2d02c64b
commit
11db7b8f05
|
|
@ -5,21 +5,22 @@
|
||||||
version="6.6.1"
|
version="6.6.1"
|
||||||
release="1"
|
release="1"
|
||||||
webapp="ROOT">
|
webapp="ROOT">
|
||||||
<ccm:dependencies>
|
<ccm:dependencies>
|
||||||
<ccm:requires name="ccm-core" version="6.6.0" release="ge"/>
|
<ccm:requires name="ccm-core" version="6.6.0" release="ge"/>
|
||||||
<ccm:requires name="ccm-cms" version="6.6.0" release="ge"/>
|
<ccm:requires name="ccm-cms" version="6.6.0" release="ge"/>
|
||||||
<ccm:requires name="ccm-cms-assets-relatedlink" version="6.6.0" release="ge"/>
|
<ccm:requires name="ccm-cms-assets-relatedlink" version="6.6.0" release="ge"/>
|
||||||
</ccm:dependencies>
|
<ccm:requires name="ccm-cms-assets-imagestep" version="6.6.0" release="ge"/>
|
||||||
<ccm:directories>
|
</ccm:dependencies>
|
||||||
<ccm:directory name="pdl"/>
|
<ccm:directories>
|
||||||
<ccm:directory name="sql"/>
|
<ccm:directory name="pdl"/>
|
||||||
<ccm:directory name="src"/>
|
<ccm:directory name="sql"/>
|
||||||
</ccm:directories>
|
<ccm:directory name="src"/>
|
||||||
<ccm:contacts>
|
</ccm:directories>
|
||||||
<ccm:contact uri="http://www.redhat.com/software/rhea" type="website"/>
|
<ccm:contacts>
|
||||||
<ccm:contact uri="mailto:rhea@redhat.com" type="support"/>
|
<ccm:contact uri="http://www.redhat.com/software/rhea" type="website"/>
|
||||||
</ccm:contacts>
|
<ccm:contact uri="mailto:rhea@redhat.com" type="support"/>
|
||||||
<ccm:description>
|
</ccm:contacts>
|
||||||
|
<ccm:description>
|
||||||
Aggreates informations about a SciMember item.
|
Aggreates informations about a SciMember item.
|
||||||
</ccm:description>
|
</ccm:description>
|
||||||
</ccm:application>
|
</ccm:application>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<registry>
|
<registry>
|
||||||
<config class="com.arsdigita.cms.contenttypes.PublicPersonalProfileConfig"
|
|
||||||
storage="ccm-cms-publicpersonalprofile/profile.properties"/>
|
|
||||||
<config class="com.arsdigita.cms.publicpersonalprofile.PublicPersonalProfileConfig"
|
<config class="com.arsdigita.cms.publicpersonalprofile.PublicPersonalProfileConfig"
|
||||||
storage="ccm-cms-publicpersonalprofile/navigation.properties"/>
|
storage="ccm-cms-publicpersonalprofile/profiles.properties"/>
|
||||||
</registry>
|
</registry>
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,11 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.cms.contenttypes;
|
package com.arsdigita.cms.contenttypes;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.cms.ContentPage;
|
import com.arsdigita.cms.ContentPage;
|
||||||
import com.arsdigita.cms.ExtraXMLGenerator;
|
import com.arsdigita.cms.ExtraXMLGenerator;
|
||||||
import com.arsdigita.cms.publicpersonalprofile.ContentGenerator;
|
import com.arsdigita.cms.publicpersonalprofile.ContentGenerator;
|
||||||
|
import com.arsdigita.cms.publicpersonalprofile.PublicPersonalProfileConfig;
|
||||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import com.arsdigita.persistence.OID;
|
import com.arsdigita.persistence.OID;
|
||||||
|
|
@ -44,8 +46,11 @@ import java.util.List;
|
||||||
* @author Jens Pelzetter
|
* @author Jens Pelzetter
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class PublicPersonalProfile extends ContentPage {
|
public class PublicPersonalProfile
|
||||||
|
extends ContentPage
|
||||||
|
implements CustomizedPreviewLink {
|
||||||
|
|
||||||
|
private static final PublicPersonalProfileConfig config = PublicPersonalProfileConfig.getConfig();
|
||||||
public static final String OWNER = "owner";
|
public static final String OWNER = "owner";
|
||||||
public static final String PROFILE_URL = "profileUrl";
|
public static final String PROFILE_URL = "profileUrl";
|
||||||
public static final String LINK_LIST_NAME = "publicPersonalProfileNavItems";
|
public static final String LINK_LIST_NAME = "publicPersonalProfileNavItems";
|
||||||
|
|
@ -141,4 +146,12 @@ public class PublicPersonalProfile extends ContentPage {
|
||||||
|
|
||||||
return generators;
|
return generators;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getPreviewUrl(final PageState state) {
|
||||||
|
if(config.getEmbedded()) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
return String.format("/profiles/preview/%s/", getProfileUrl());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,61 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2011 Jens Pelzetter
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
|
||||||
* as published by the Free Software Foundation; either version 2.1 of
|
|
||||||
* the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package com.arsdigita.cms.contenttypes;
|
|
||||||
|
|
||||||
import com.arsdigita.runtime.AbstractConfig;
|
|
||||||
import com.arsdigita.util.parameter.BooleanParameter;
|
|
||||||
import com.arsdigita.util.parameter.StringParameter;
|
|
||||||
import com.arsdigita.util.parameter.Parameter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Jens Pelzetter
|
|
||||||
* @version $Id$
|
|
||||||
*/
|
|
||||||
public class PublicPersonalProfileConfig extends AbstractConfig {
|
|
||||||
|
|
||||||
private final Parameter showUnfinishedParts;
|
|
||||||
private final Parameter personType;
|
|
||||||
|
|
||||||
public PublicPersonalProfileConfig() {
|
|
||||||
showUnfinishedParts =
|
|
||||||
new BooleanParameter(
|
|
||||||
"com.arsdigita.cms.contenttypes.PublicPersonalProfile.show_unfinished_parts",
|
|
||||||
Parameter.REQUIRED,
|
|
||||||
Boolean.FALSE);
|
|
||||||
personType =
|
|
||||||
new StringParameter(
|
|
||||||
"com.arsdigita.cms.contenttypes.PublicPersonalProfile.person_type",
|
|
||||||
Parameter.REQUIRED,
|
|
||||||
"com.arsdigita.cms.contenttypes.GenericPerson");
|
|
||||||
|
|
||||||
register(showUnfinishedParts);
|
|
||||||
register(personType);
|
|
||||||
|
|
||||||
loadInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
public final boolean getShowUnFinishedParts() {
|
|
||||||
return (Boolean) get(showUnfinishedParts);
|
|
||||||
}
|
|
||||||
|
|
||||||
public final String getPersonType() {
|
|
||||||
return (String) get(personType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
com.arsdigita.cms.contenttypes.PublicPersonalProfile.show_unfinished_parts.title = Show parts of the PublicPersonalProfile which do not work yet.
|
|
||||||
com.arsdigita.cms.contenttypes.PublicPersonalProfile.show_unfinished_parts.purpose = Show parts of the PublicPersonalProfile which do not work yet.
|
|
||||||
com.arsdigita.cms.contenttypes.PublicPersonalProfile.show_unfinished_parts.example = false
|
|
||||||
com.arsdigita.cms.contenttypes.PublicPersonalProfile.show_unfinished_parts.format = [boolean]
|
|
||||||
|
|
||||||
com.arsdigita.cms.contenttypes.PublicPersonalProfile.person_type.title = Class to restrict the selectable persons to.
|
|
||||||
com.arsdigita.cms.contenttypes.PublicPersonalProfile.person_type.purpose = Class to restrict the selectable persons to.
|
|
||||||
com.arsdigita.cms.contenttypes.PublicPersonalProfile.person_type.example = com.arsdigita.cms.contenttypes.GenericPerson
|
|
||||||
com.arsdigita.cms.contenttypes.PublicPersonalProfile.person_type.format = [string]
|
|
||||||
|
|
@ -6,6 +6,7 @@ import com.arsdigita.cms.ContentItem;
|
||||||
import com.arsdigita.cms.ExtraXMLGenerator;
|
import com.arsdigita.cms.ExtraXMLGenerator;
|
||||||
import com.arsdigita.cms.contentassets.RelatedLink;
|
import com.arsdigita.cms.contentassets.RelatedLink;
|
||||||
import com.arsdigita.cms.publicpersonalprofile.ContentGenerator;
|
import com.arsdigita.cms.publicpersonalprofile.ContentGenerator;
|
||||||
|
import com.arsdigita.cms.publicpersonalprofile.PublicPersonalProfileConfig;
|
||||||
import com.arsdigita.cms.publicpersonalprofile.PublicPersonalProfileXmlGenerator;
|
import com.arsdigita.cms.publicpersonalprofile.PublicPersonalProfileXmlGenerator;
|
||||||
import com.arsdigita.dispatcher.DispatcherHelper;
|
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||||
import com.arsdigita.domain.DomainObjectFactory;
|
import com.arsdigita.domain.DomainObjectFactory;
|
||||||
|
|
@ -22,6 +23,9 @@ import java.lang.reflect.InvocationTargetException;
|
||||||
*/
|
*/
|
||||||
public class PublicPersonalProfileExtraXmlGenerator implements ExtraXMLGenerator {
|
public class PublicPersonalProfileExtraXmlGenerator implements ExtraXMLGenerator {
|
||||||
|
|
||||||
|
private static final PublicPersonalProfileConfig config =
|
||||||
|
PublicPersonalProfileConfig.
|
||||||
|
getConfig();
|
||||||
public static final String SHOW_ITEM_PARAM = "showItem";
|
public static final String SHOW_ITEM_PARAM = "showItem";
|
||||||
|
|
||||||
public void generateXML(final ContentItem item,
|
public void generateXML(final ContentItem item,
|
||||||
|
|
@ -35,14 +39,19 @@ public class PublicPersonalProfileExtraXmlGenerator implements ExtraXMLGenerator
|
||||||
final PublicPersonalProfile profile = (PublicPersonalProfile) item;
|
final PublicPersonalProfile profile = (PublicPersonalProfile) item;
|
||||||
final String showItem = state.getRequest().getParameter(SHOW_ITEM_PARAM);
|
final String showItem = state.getRequest().getParameter(SHOW_ITEM_PARAM);
|
||||||
|
|
||||||
final Element navigation = element.newChildElement("profileNavigation");
|
if (config.getEmbedded()) {
|
||||||
final PublicPersonalProfileXmlUtil util =
|
final Element navigation = element.newChildElement(
|
||||||
new PublicPersonalProfileXmlUtil();
|
"profileNavigation");
|
||||||
String prefix = DispatcherHelper.getDispatcherPrefix(state.getRequest());
|
final PublicPersonalProfileXmlUtil util =
|
||||||
if (prefix == null) {
|
new PublicPersonalProfileXmlUtil();
|
||||||
prefix = "";
|
String prefix = DispatcherHelper.getDispatcherPrefix(state.
|
||||||
|
getRequest());
|
||||||
|
if (prefix == null) {
|
||||||
|
prefix = "";
|
||||||
|
}
|
||||||
|
util.createNavigation(profile, navigation, showItem, prefix, "",
|
||||||
|
false);
|
||||||
}
|
}
|
||||||
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(
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package com.arsdigita.cms.contenttypes;
|
package com.arsdigita.cms.contenttypes;
|
||||||
|
|
||||||
import com.arsdigita.cms.contentassets.RelatedLink;
|
import com.arsdigita.cms.contentassets.RelatedLink;
|
||||||
import com.arsdigita.cms.publicpersonalprofile.PublicPersonalProfiles;
|
import com.arsdigita.cms.publicpersonalprofile.PublicPersonalProfileConfig;
|
||||||
import com.arsdigita.dispatcher.DispatcherHelper;
|
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||||
import com.arsdigita.domain.DomainObjectFactory;
|
import com.arsdigita.domain.DomainObjectFactory;
|
||||||
import com.arsdigita.persistence.DataCollection;
|
import com.arsdigita.persistence.DataCollection;
|
||||||
|
|
@ -17,8 +17,7 @@ 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 =
|
||||||
PublicPersonalProfiles.
|
PublicPersonalProfileConfig.getConfig();
|
||||||
getConfig();
|
|
||||||
|
|
||||||
public void createNavigation(final PublicPersonalProfile profile,
|
public void createNavigation(final PublicPersonalProfile profile,
|
||||||
final Element root,
|
final Element root,
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ import com.arsdigita.cms.Folder;
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
import com.arsdigita.cms.contenttypes.GenericPerson;
|
import com.arsdigita.cms.contenttypes.GenericPerson;
|
||||||
import com.arsdigita.cms.contenttypes.PublicPersonalProfile;
|
import com.arsdigita.cms.contenttypes.PublicPersonalProfile;
|
||||||
import com.arsdigita.cms.contenttypes.PublicPersonalProfileConfig;
|
import com.arsdigita.cms.publicpersonalprofile.PublicPersonalProfileConfig;
|
||||||
import com.arsdigita.cms.ui.authoring.ApplyWorkflowFormSection;
|
import com.arsdigita.cms.ui.authoring.ApplyWorkflowFormSection;
|
||||||
import com.arsdigita.cms.ui.authoring.CreationSelector;
|
import com.arsdigita.cms.ui.authoring.CreationSelector;
|
||||||
import com.arsdigita.cms.ui.authoring.LanguageWidget;
|
import com.arsdigita.cms.ui.authoring.LanguageWidget;
|
||||||
|
|
@ -48,11 +48,7 @@ public class PublicPersonalProfileCreate extends PageCreate {
|
||||||
|
|
||||||
private static final String SELECTED_PERSON = "selectedPerson";
|
private static final String SELECTED_PERSON = "selectedPerson";
|
||||||
private static final PublicPersonalProfileConfig config =
|
private static final PublicPersonalProfileConfig config =
|
||||||
new PublicPersonalProfileConfig();
|
PublicPersonalProfileConfig.getConfig();
|
||||||
|
|
||||||
static {
|
|
||||||
config.load();
|
|
||||||
}
|
|
||||||
|
|
||||||
public PublicPersonalProfileCreate(final ItemSelectionModel itemModel,
|
public PublicPersonalProfileCreate(final ItemSelectionModel itemModel,
|
||||||
final CreationSelector parent) {
|
final CreationSelector parent) {
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,29 @@ import com.arsdigita.util.parameter.StringParameter;
|
||||||
*/
|
*/
|
||||||
public class PublicPersonalProfileConfig extends AbstractConfig {
|
public class PublicPersonalProfileConfig extends AbstractConfig {
|
||||||
|
|
||||||
|
private final static PublicPersonalProfileConfig config = new PublicPersonalProfileConfig();
|
||||||
|
private final Parameter personType;
|
||||||
|
private final Parameter embedded;
|
||||||
private final Parameter homeNavItemLabels;
|
private final Parameter homeNavItemLabels;
|
||||||
private final Parameter showPersonInfoEverywhere;
|
private final Parameter showPersonInfoEverywhere;
|
||||||
// private final Parameter contactType;
|
// private final Parameter contactType;
|
||||||
|
|
||||||
|
static {
|
||||||
|
config.load();
|
||||||
|
}
|
||||||
|
|
||||||
public PublicPersonalProfileConfig() {
|
public PublicPersonalProfileConfig() {
|
||||||
|
personType =
|
||||||
|
new StringParameter(
|
||||||
|
"com.arsdigita.cms.publicPersonalProfile.person_type",
|
||||||
|
Parameter.REQUIRED,
|
||||||
|
"com.arsdigita.cms.contenttypes.GenericPerson");
|
||||||
|
|
||||||
|
embedded = new BooleanParameter(
|
||||||
|
"com.arsdigita.cms.publicpersonalprofile.embedded",
|
||||||
|
Parameter.REQUIRED,
|
||||||
|
false);
|
||||||
|
|
||||||
homeNavItemLabels = new StringParameter(
|
homeNavItemLabels = new StringParameter(
|
||||||
"com.arsdigita.cms.publicpersonalprofile.navitem.home.labels",
|
"com.arsdigita.cms.publicpersonalprofile.navitem.home.labels",
|
||||||
Parameter.REQUIRED,
|
Parameter.REQUIRED,
|
||||||
|
|
@ -33,6 +51,8 @@ public class PublicPersonalProfileConfig extends AbstractConfig {
|
||||||
Parameter.REQUIRED,
|
Parameter.REQUIRED,
|
||||||
"commonContact");*/
|
"commonContact");*/
|
||||||
|
|
||||||
|
register(personType);
|
||||||
|
register(embedded);
|
||||||
register(homeNavItemLabels);
|
register(homeNavItemLabels);
|
||||||
register(showPersonInfoEverywhere);
|
register(showPersonInfoEverywhere);
|
||||||
// register(contactType);
|
// register(contactType);
|
||||||
|
|
@ -40,6 +60,14 @@ public class PublicPersonalProfileConfig extends AbstractConfig {
|
||||||
loadInfo();
|
loadInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final String getPersonType() {
|
||||||
|
return (String) get(personType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public final Boolean getEmbedded() {
|
||||||
|
return (Boolean) get(embedded);
|
||||||
|
}
|
||||||
|
|
||||||
public final String getHomeNavItemLabels() {
|
public final String getHomeNavItemLabels() {
|
||||||
return (String) get(homeNavItemLabels);
|
return (String) get(homeNavItemLabels);
|
||||||
}
|
}
|
||||||
|
|
@ -50,4 +78,8 @@ public class PublicPersonalProfileConfig extends AbstractConfig {
|
||||||
/* public final String getContactType() {
|
/* public final String getContactType() {
|
||||||
return (String) get(contactType);
|
return (String) get(contactType);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
public static PublicPersonalProfileConfig getConfig() {
|
||||||
|
return config;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,13 @@
|
||||||
|
com.arsdigita.cms.contenttypes.PublicPersonalProfile.person_type.title = Class to restrict the selectable persons to.
|
||||||
|
com.arsdigita.cms.contenttypes.PublicPersonalProfile.person_type.purpose = Class to restrict the selectable persons to.
|
||||||
|
com.arsdigita.cms.contenttypes.PublicPersonalProfile.person_type.example = com.arsdigita.cms.contenttypes.GenericPerson
|
||||||
|
com.arsdigita.cms.contenttypes.PublicPersonalProfile.person_type.format = [string]
|
||||||
|
|
||||||
|
com.arsdigita.cms.publicpersonalprofile.embedded.title = Embedded Mode
|
||||||
|
com.arsdigita.cms.publicpersonalprofile.embedded.purpose = If set the true the personal profiles are shown embedded into the normal web page.
|
||||||
|
com.arsdigita.cms.publicpersonalprofile.embedded.example = false
|
||||||
|
com.arsdigita.cms.publicpersonalprofile.embedded.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
|
||||||
|
|
|
||||||
|
|
@ -15,12 +15,7 @@ public class PublicPersonalProfiles extends Application {
|
||||||
|
|
||||||
public static final String BASE_DATA_OBJECT_TYPE =
|
public static final String BASE_DATA_OBJECT_TYPE =
|
||||||
"com.arsdigita.cms.publicpersonalprofile.PublicPersonalProfile";
|
"com.arsdigita.cms.publicpersonalprofile.PublicPersonalProfile";
|
||||||
private final static PublicPersonalProfileConfig config =
|
private final static PublicPersonalProfileConfig config = PublicPersonalProfileConfig.getConfig();
|
||||||
new PublicPersonalProfileConfig();
|
|
||||||
|
|
||||||
static {
|
|
||||||
config.load();
|
|
||||||
}
|
|
||||||
|
|
||||||
public PublicPersonalProfiles(final DataObject dobj) {
|
public PublicPersonalProfiles(final DataObject dobj) {
|
||||||
super(dobj);
|
super(dobj);
|
||||||
|
|
@ -36,10 +31,6 @@ public class PublicPersonalProfiles extends Application {
|
||||||
this(new OID(BASE_DATA_OBJECT_TYPE, id));
|
this(new OID(BASE_DATA_OBJECT_TYPE, id));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PublicPersonalProfileConfig getConfig() {
|
|
||||||
return config;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getServletPath() {
|
public String getServletPath() {
|
||||||
return "/profiles/";
|
return "/profiles/";
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,8 @@ import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.bebop.ParameterSingleSelectionModel;
|
import com.arsdigita.bebop.ParameterSingleSelectionModel;
|
||||||
import com.arsdigita.bebop.parameters.StringParameter;
|
import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
import com.arsdigita.cms.ContentItem;
|
import com.arsdigita.cms.ContentItem;
|
||||||
|
import com.arsdigita.cms.ContentSection;
|
||||||
|
import com.arsdigita.cms.contentassets.ItemImageAttachment;
|
||||||
import com.arsdigita.cms.contentassets.RelatedLink;
|
import com.arsdigita.cms.contentassets.RelatedLink;
|
||||||
import com.arsdigita.cms.contenttypes.GenericAddress;
|
import com.arsdigita.cms.contenttypes.GenericAddress;
|
||||||
import com.arsdigita.cms.contenttypes.GenericContact;
|
import com.arsdigita.cms.contenttypes.GenericContact;
|
||||||
|
|
@ -20,6 +22,8 @@ import com.arsdigita.cms.contenttypes.GenericPersonContactCollection;
|
||||||
import com.arsdigita.cms.contenttypes.PublicPersonalProfile;
|
import com.arsdigita.cms.contenttypes.PublicPersonalProfile;
|
||||||
import com.arsdigita.cms.contenttypes.PublicPersonalProfileNavItemCollection;
|
import com.arsdigita.cms.contenttypes.PublicPersonalProfileNavItemCollection;
|
||||||
import com.arsdigita.cms.contenttypes.PublicPersonalProfileXmlUtil;
|
import com.arsdigita.cms.contenttypes.PublicPersonalProfileXmlUtil;
|
||||||
|
import com.arsdigita.cms.dispatcher.CMSDispatcher;
|
||||||
|
import com.arsdigita.cms.dispatcher.ItemResolver;
|
||||||
import com.arsdigita.cms.publicpersonalprofile.ui.PublicPersonalProfileNavItemsAddForm;
|
import com.arsdigita.cms.publicpersonalprofile.ui.PublicPersonalProfileNavItemsAddForm;
|
||||||
import com.arsdigita.dispatcher.DispatcherHelper;
|
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||||
import com.arsdigita.domain.DomainObjectFactory;
|
import com.arsdigita.domain.DomainObjectFactory;
|
||||||
|
|
@ -32,6 +36,7 @@ import com.arsdigita.templating.Templating;
|
||||||
import com.arsdigita.toolbox.ui.ApplicationAuthenticationListener;
|
import com.arsdigita.toolbox.ui.ApplicationAuthenticationListener;
|
||||||
import com.arsdigita.web.Application;
|
import com.arsdigita.web.Application;
|
||||||
import com.arsdigita.web.BaseApplicationServlet;
|
import com.arsdigita.web.BaseApplicationServlet;
|
||||||
|
import com.arsdigita.web.RedirectSignal;
|
||||||
import com.arsdigita.xml.Document;
|
import com.arsdigita.xml.Document;
|
||||||
import com.arsdigita.xml.Element;
|
import com.arsdigita.xml.Element;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
@ -58,7 +63,8 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
||||||
private static final String PPP_NS =
|
private static final String PPP_NS =
|
||||||
"http://www.arsdigita.com/PublicPersonalProfile/1.0";
|
"http://www.arsdigita.com/PublicPersonalProfile/1.0";
|
||||||
public static final String SELECTED_NAV_ITEM = "selectedNavItem";
|
public static final String SELECTED_NAV_ITEM = "selectedNavItem";
|
||||||
private final PublicPersonalProfileConfig config = PublicPersonalProfiles.
|
private final PublicPersonalProfileConfig config =
|
||||||
|
PublicPersonalProfileConfig.
|
||||||
getConfig();
|
getConfig();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -168,6 +174,28 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
||||||
PublicPersonalProfile profile =
|
PublicPersonalProfile profile =
|
||||||
(PublicPersonalProfile) DomainObjectFactory.
|
(PublicPersonalProfile) DomainObjectFactory.
|
||||||
newInstance(profiles.getDataObject());
|
newInstance(profiles.getDataObject());
|
||||||
|
|
||||||
|
if (config.getEmbedded()) {
|
||||||
|
final ContentSection section =
|
||||||
|
profile.getContentSection();
|
||||||
|
final ItemResolver resolver = section.getItemResolver();
|
||||||
|
|
||||||
|
String context;
|
||||||
|
if (preview) {
|
||||||
|
context = CMSDispatcher.PREVIEW;
|
||||||
|
} else {
|
||||||
|
context = ContentItem.LIVE;
|
||||||
|
}
|
||||||
|
|
||||||
|
final String url = String.format("/ccm%s", resolver.
|
||||||
|
generateItemURL(state,
|
||||||
|
profile,
|
||||||
|
section,
|
||||||
|
context));
|
||||||
|
|
||||||
|
throw new RedirectSignal(url, false);
|
||||||
|
}
|
||||||
|
|
||||||
Element profileElem =
|
Element profileElem =
|
||||||
root.newChildElement("ppp:profile", PPP_NS);
|
root.newChildElement("ppp:profile", PPP_NS);
|
||||||
GenericPerson owner = profile.getOwner();
|
GenericPerson owner = profile.getOwner();
|
||||||
|
|
@ -179,6 +207,16 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
||||||
"ppp:ownerName", PPP_NS);
|
"ppp:ownerName", PPP_NS);
|
||||||
profileOwnerName.setText(owner.getFullName());
|
profileOwnerName.setText(owner.getFullName());
|
||||||
|
|
||||||
|
final DataCollection images = ItemImageAttachment.getImageAttachments(profile);
|
||||||
|
if (!images.isEmpty()) {
|
||||||
|
images.next();
|
||||||
|
final Element imageElem = profileElem.newChildElement("profileImage");
|
||||||
|
ItemImageAttachment attachment = new ItemImageAttachment(images.getDataObject());
|
||||||
|
//imageElem.addAttribute("oid", attachment.getImage().getOID().toString());
|
||||||
|
|
||||||
|
images.close();
|
||||||
|
}
|
||||||
|
|
||||||
final PublicPersonalProfileXmlUtil util =
|
final PublicPersonalProfileXmlUtil util =
|
||||||
new PublicPersonalProfileXmlUtil();
|
new PublicPersonalProfileXmlUtil();
|
||||||
String prefix =
|
String prefix =
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@ import com.arsdigita.cms.ContentType;
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
import com.arsdigita.cms.PageLocations;
|
import com.arsdigita.cms.PageLocations;
|
||||||
import com.arsdigita.cms.Template;
|
import com.arsdigita.cms.Template;
|
||||||
|
import com.arsdigita.cms.contenttypes.CustomizedPreviewLink;
|
||||||
import com.arsdigita.cms.dispatcher.CMSDispatcher;
|
import com.arsdigita.cms.dispatcher.CMSDispatcher;
|
||||||
import com.arsdigita.cms.dispatcher.CMSPage;
|
import com.arsdigita.cms.dispatcher.CMSPage;
|
||||||
import com.arsdigita.cms.dispatcher.ItemResolver;
|
import com.arsdigita.cms.dispatcher.ItemResolver;
|
||||||
|
|
@ -76,9 +77,7 @@ import org.apache.log4j.Logger;
|
||||||
*/
|
*/
|
||||||
public class ContentItemPage extends CMSPage implements ActionListener {
|
public class ContentItemPage extends CMSPage implements ActionListener {
|
||||||
|
|
||||||
private static final Logger s_log = Logger.getLogger
|
private static final Logger s_log = Logger.getLogger(ContentItemPage.class);
|
||||||
(ContentItemPage.class);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The URL parameter that must be passed in in order to set
|
* The URL parameter that must be passed in in order to set
|
||||||
* the current tab. This is a KLUDGE right now because the
|
* the current tab. This is a KLUDGE right now because the
|
||||||
|
|
@ -86,19 +85,16 @@ public class ContentItemPage extends CMSPage implements ActionListener {
|
||||||
* state parameter
|
* state parameter
|
||||||
*/
|
*/
|
||||||
public static final String SET_TAB = "set_tab";
|
public static final String SET_TAB = "set_tab";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of the global state parameter that holds
|
* The name of the global state parameter that holds
|
||||||
* the item id
|
* the item id
|
||||||
*/
|
*/
|
||||||
public static final String ITEM_ID = "item_id";
|
public static final String ITEM_ID = "item_id";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of the global state parameter which holds the
|
* The name of the global state parameter which holds the
|
||||||
* return URL
|
* return URL
|
||||||
*/
|
*/
|
||||||
public static final String RETURN_URL = "return_url";
|
public static final String RETURN_URL = "return_url";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of the global state parameter that determines whether
|
* The name of the global state parameter that determines whether
|
||||||
* or not to use the streamlined authoring process (assuming the
|
* or not to use the streamlined authoring process (assuming the
|
||||||
|
|
@ -109,12 +105,10 @@ public class ContentItemPage extends CMSPage implements ActionListener {
|
||||||
public static final String STREAMLINED_CREATION_ACTIVE = "active";
|
public static final String STREAMLINED_CREATION_ACTIVE = "active";
|
||||||
public static final String STREAMLINED_CREATION_INACTIVE = "active";
|
public static final String STREAMLINED_CREATION_INACTIVE = "active";
|
||||||
private static int s_tabOrder = 0;
|
private static int s_tabOrder = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Index of the summary tab
|
* Index of the summary tab
|
||||||
*/
|
*/
|
||||||
public static final int SUMMARY_TAB = s_tabOrder++;
|
public static final int SUMMARY_TAB = s_tabOrder++;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>The name of the state parameter which indicates the content
|
* <p>The name of the state parameter which indicates the content
|
||||||
* type of the item the user wishes to create. or edit.</p>
|
* type of the item the user wishes to create. or edit.</p>
|
||||||
|
|
@ -123,20 +117,17 @@ public class ContentItemPage extends CMSPage implements ActionListener {
|
||||||
* the id of the content type.</p>
|
* the id of the content type.</p>
|
||||||
*/
|
*/
|
||||||
public static final String CONTENT_TYPE = "content_type";
|
public static final String CONTENT_TYPE = "content_type";
|
||||||
|
|
||||||
public static final int AUTHORING_TAB = s_tabOrder++;
|
public static final int AUTHORING_TAB = s_tabOrder++;
|
||||||
public static final int LANGUAGE_TAB = s_tabOrder++;
|
public static final int LANGUAGE_TAB = s_tabOrder++;
|
||||||
public static final int WORKFLOW_TAB = s_tabOrder++;
|
public static final int WORKFLOW_TAB = s_tabOrder++;
|
||||||
public static final int PUBLISHING_TAB = s_tabOrder++;
|
public static final int PUBLISHING_TAB = s_tabOrder++;
|
||||||
public static final int HISTORY_TAB = s_tabOrder++;
|
public static final int HISTORY_TAB = s_tabOrder++;
|
||||||
public static final int TEMPLATES_TAB = s_tabOrder++;
|
public static final int TEMPLATES_TAB = s_tabOrder++;
|
||||||
|
|
||||||
private final TabbedPane m_tabbedPane;
|
private final TabbedPane m_tabbedPane;
|
||||||
private StringParameter m_returnURL;
|
private StringParameter m_returnURL;
|
||||||
private ItemSelectionModel m_itemModel;
|
private ItemSelectionModel m_itemModel;
|
||||||
private ACSObjectSelectionModel m_typeModel;
|
private ACSObjectSelectionModel m_typeModel;
|
||||||
private ContentItemRequestLocal m_item;
|
private ContentItemRequestLocal m_item;
|
||||||
|
|
||||||
private Summary m_summaryPane;
|
private Summary m_summaryPane;
|
||||||
private ItemWorkflowAdminPane m_workflowPane;
|
private ItemWorkflowAdminPane m_workflowPane;
|
||||||
private ItemLifecycleAdminPane m_lifecyclePane;
|
private ItemLifecycleAdminPane m_lifecyclePane;
|
||||||
|
|
@ -144,16 +135,17 @@ public class ContentItemPage extends CMSPage implements ActionListener {
|
||||||
private ItemLanguages m_languagesPane;
|
private ItemLanguages m_languagesPane;
|
||||||
private ItemRevisionAdminPane m_revisionsPane;
|
private ItemRevisionAdminPane m_revisionsPane;
|
||||||
private ItemTemplates m_templatesPane;
|
private ItemTemplates m_templatesPane;
|
||||||
|
|
||||||
private Link m_previewLink;
|
private Link m_previewLink;
|
||||||
|
|
||||||
private class ItemRequestLocal extends ContentItemRequestLocal {
|
private class ItemRequestLocal extends ContentItemRequestLocal {
|
||||||
|
|
||||||
protected final Object initialValue(final PageState state) {
|
protected final Object initialValue(final PageState state) {
|
||||||
return CMS.getContext().getContentItem();
|
return CMS.getContext().getContentItem();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TitlePrinter implements PrintListener {
|
private class TitlePrinter implements PrintListener {
|
||||||
|
|
||||||
public final void prepare(final PrintEvent e) {
|
public final void prepare(final PrintEvent e) {
|
||||||
final Label label = (Label) e.getTarget();
|
final Label label = (Label) e.getTarget();
|
||||||
final ContentItem item = m_item.getContentItem(e.getPageState());
|
final ContentItem item = m_item.getContentItem(e.getPageState());
|
||||||
|
|
@ -180,25 +172,26 @@ public class ContentItemPage extends CMSPage implements ActionListener {
|
||||||
m_itemModel = new ItemSelectionModel(itemId);
|
m_itemModel = new ItemSelectionModel(itemId);
|
||||||
|
|
||||||
// Add the content type global state parameter
|
// Add the content type global state parameter
|
||||||
BigDecimalParameter contentType = new BigDecimalParameter
|
BigDecimalParameter contentType = new BigDecimalParameter(CONTENT_TYPE);
|
||||||
(CONTENT_TYPE);
|
|
||||||
addGlobalStateParam(contentType);
|
addGlobalStateParam(contentType);
|
||||||
|
|
||||||
// Add the streamlined creation global state parameter
|
// Add the streamlined creation global state parameter
|
||||||
StringParameter streamlinedCreation = new StringParameter
|
StringParameter streamlinedCreation = new StringParameter(
|
||||||
(STREAMLINED_CREATION);
|
STREAMLINED_CREATION);
|
||||||
addGlobalStateParam(streamlinedCreation);
|
addGlobalStateParam(streamlinedCreation);
|
||||||
|
|
||||||
m_typeModel = new ACSObjectSelectionModel
|
m_typeModel = new ACSObjectSelectionModel(ContentType.class.getName(),
|
||||||
(ContentType.class.getName(), ContentType.BASE_DATA_OBJECT_TYPE, contentType);
|
ContentType.BASE_DATA_OBJECT_TYPE,
|
||||||
|
contentType);
|
||||||
|
|
||||||
// Validate the item ID parameter (caches the validation).
|
// Validate the item ID parameter (caches the validation).
|
||||||
getStateModel().addValidationListener(new FormValidationListener() {
|
getStateModel().addValidationListener(new FormValidationListener() {
|
||||||
public void validate(FormSectionEvent event)
|
|
||||||
throws FormProcessException {
|
public void validate(FormSectionEvent event)
|
||||||
validateItemID(event.getPageState());
|
throws FormProcessException {
|
||||||
}
|
validateItemID(event.getPageState());
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Add the return url global state parameter
|
// Add the return url global state parameter
|
||||||
m_returnURL = new StringParameter(RETURN_URL);
|
m_returnURL = new StringParameter(RETURN_URL);
|
||||||
|
|
@ -222,40 +215,41 @@ public class ContentItemPage extends CMSPage implements ActionListener {
|
||||||
|
|
||||||
m_tabbedPane.setIdAttr("page-body");
|
m_tabbedPane.setIdAttr("page-body");
|
||||||
|
|
||||||
m_tabbedPane.addTab
|
m_tabbedPane.addTab(new Label(gz("cms.ui.item.summary")), m_summaryPane);
|
||||||
(new Label(gz("cms.ui.item.summary")), m_summaryPane);
|
m_tabbedPane.addTab(new Label(gz("cms.ui.item.authoring")), m_wizardPane);
|
||||||
m_tabbedPane.addTab
|
m_tabbedPane.addTab(new Label(gz("cms.ui.item.languages")),
|
||||||
(new Label(gz("cms.ui.item.authoring")), m_wizardPane);
|
m_languagesPane);
|
||||||
m_tabbedPane.addTab
|
m_tabbedPane.addTab(new Label(gz("cms.ui.item.workflow")),
|
||||||
(new Label(gz("cms.ui.item.languages")), m_languagesPane);
|
m_workflowPane);
|
||||||
m_tabbedPane.addTab
|
m_tabbedPane.addTab(new Label(gz("cms.ui.item.lifecycles")),
|
||||||
(new Label(gz("cms.ui.item.workflow")), m_workflowPane);
|
m_lifecyclePane);
|
||||||
m_tabbedPane.addTab
|
m_tabbedPane.addTab(new Label(gz("cms.ui.item.history")),
|
||||||
(new Label(gz("cms.ui.item.lifecycles")), m_lifecyclePane);
|
m_revisionsPane);
|
||||||
m_tabbedPane.addTab
|
m_tabbedPane.addTab(new Label(gz("cms.ui.item.templates")),
|
||||||
(new Label(gz("cms.ui.item.history")), m_revisionsPane);
|
m_templatesPane);
|
||||||
m_tabbedPane.addTab
|
|
||||||
(new Label(gz("cms.ui.item.templates")), m_templatesPane);
|
|
||||||
|
|
||||||
m_tabbedPane.addActionListener(new ActionListener() {
|
m_tabbedPane.addActionListener(new ActionListener() {
|
||||||
public final void actionPerformed(final ActionEvent e) {
|
|
||||||
final PageState state = e.getPageState();
|
|
||||||
final Component pane = m_tabbedPane.getCurrentPane(state);
|
|
||||||
|
|
||||||
if (pane instanceof Resettable) {
|
public final void actionPerformed(final ActionEvent e) {
|
||||||
((Resettable) pane).reset(state);
|
final PageState state = e.getPageState();
|
||||||
}
|
final Component pane = m_tabbedPane.getCurrentPane(state);
|
||||||
|
|
||||||
|
if (pane instanceof Resettable) {
|
||||||
|
((Resettable) pane).reset(state);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Build the preview link.
|
// Build the preview link.
|
||||||
m_previewLink = new Link(new Label(gz("cms.ui.preview")), new PrintListener() {
|
m_previewLink = new Link(new Label(gz("cms.ui.preview")),
|
||||||
public final void prepare(final PrintEvent e) {
|
new PrintListener() {
|
||||||
final Link link = (Link) e.getTarget();
|
|
||||||
link.setTarget(getPreviewURL(e.getPageState()));
|
public final void prepare(final PrintEvent e) {
|
||||||
link.setTargetFrame(Link.NEW_FRAME);
|
final Link link = (Link) e.getTarget();
|
||||||
}
|
link.setTarget(getPreviewURL(e.getPageState()));
|
||||||
});
|
link.setTargetFrame(Link.NEW_FRAME);
|
||||||
|
}
|
||||||
|
});
|
||||||
m_previewLink.setIdAttr("preview_link");
|
m_previewLink.setIdAttr("preview_link");
|
||||||
add(m_previewLink);
|
add(m_previewLink);
|
||||||
|
|
||||||
|
|
@ -263,18 +257,19 @@ public class ContentItemPage extends CMSPage implements ActionListener {
|
||||||
|
|
||||||
// Add validation to make sure we are not attempting to edit a live item
|
// Add validation to make sure we are not attempting to edit a live item
|
||||||
getStateModel().addValidationListener(new FormValidationListener() {
|
getStateModel().addValidationListener(new FormValidationListener() {
|
||||||
public void validate(FormSectionEvent e) throws FormProcessException {
|
|
||||||
PageState s = e.getPageState();
|
public void validate(FormSectionEvent e) throws FormProcessException {
|
||||||
FormData data = e.getFormData();
|
PageState s = e.getPageState();
|
||||||
final ContentItem item = m_item.getContentItem(s);
|
FormData data = e.getFormData();
|
||||||
if(item != null && ContentItem.LIVE.equals(item.getVersion())) {
|
final ContentItem item = m_item.getContentItem(s);
|
||||||
String err = "The item " + item.getID() +
|
if (item != null && ContentItem.LIVE.equals(item.getVersion())) {
|
||||||
" is live and cannot be edited.";
|
String err = "The item " + item.getID()
|
||||||
// data.addError(err);
|
+ " is live and cannot be edited.";
|
||||||
throw new FormProcessException(err);
|
// data.addError(err);
|
||||||
}
|
throw new FormProcessException(err);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
|
||||||
add(new DebugPanel());
|
add(new DebugPanel());
|
||||||
}
|
}
|
||||||
|
|
@ -291,9 +286,8 @@ public class ContentItemPage extends CMSPage implements ActionListener {
|
||||||
final ContentItem item = m_item.getContentItem(state);
|
final ContentItem item = m_item.getContentItem(state);
|
||||||
|
|
||||||
if (item == null) {
|
if (item == null) {
|
||||||
throw new FormProcessException
|
throw new FormProcessException("The item_id supplied does not reference a valid "
|
||||||
("The item_id supplied does not reference a valid " +
|
+ "ContentItem.");
|
||||||
"ContentItem.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -340,8 +334,9 @@ public class ContentItemPage extends CMSPage implements ActionListener {
|
||||||
m_tabbedPane.setTabVisible(state, m_languagesPane, false);
|
m_tabbedPane.setTabVisible(state, m_languagesPane, false);
|
||||||
m_previewLink.setVisible(state, false);
|
m_previewLink.setVisible(state, false);
|
||||||
} else {
|
} else {
|
||||||
m_tabbedPane.setTabVisible(state, m_templatesPane, !ContentSection.getConfig().getHideTemplatesTab());
|
m_tabbedPane.setTabVisible(state, m_templatesPane, !ContentSection.
|
||||||
}
|
getConfig().getHideTemplatesTab());
|
||||||
|
}
|
||||||
|
|
||||||
// Set the current tab based on parameters
|
// Set the current tab based on parameters
|
||||||
if (setTab != null) {
|
if (setTab != null) {
|
||||||
|
|
@ -372,6 +367,7 @@ public class ContentItemPage extends CMSPage implements ActionListener {
|
||||||
int tab) {
|
int tab) {
|
||||||
return getItemURL(nodeURL, itemId, tab, false);
|
return getItemURL(nodeURL, itemId, tab, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a URL for displaying a certain item
|
* Construct a URL for displaying a certain item
|
||||||
*
|
*
|
||||||
|
|
@ -386,14 +382,14 @@ public class ContentItemPage extends CMSPage implements ActionListener {
|
||||||
boolean streamlinedCreation) {
|
boolean streamlinedCreation) {
|
||||||
StringBuffer url = new StringBuffer();
|
StringBuffer url = new StringBuffer();
|
||||||
|
|
||||||
url.append(nodeURL)
|
url.append(nodeURL).append(PageLocations.ITEM_PAGE).append("?").append(
|
||||||
.append(PageLocations.ITEM_PAGE)
|
ITEM_ID).append("=").append(itemId.toString()).append("&").
|
||||||
.append("?").append(ITEM_ID).append("=").append(itemId.toString())
|
append(SET_TAB).append("=").append(tab);
|
||||||
.append("&").append(SET_TAB).append("=").append(tab);
|
|
||||||
|
|
||||||
if (streamlinedCreation &&
|
if (streamlinedCreation && ContentSection.getConfig().
|
||||||
ContentSection.getConfig().getUseStreamlinedCreation()) {
|
getUseStreamlinedCreation()) {
|
||||||
url.append("&").append(STREAMLINED_CREATION).append("=").append(STREAMLINED_CREATION_ACTIVE);
|
url.append("&").append(STREAMLINED_CREATION).append("=").append(
|
||||||
|
STREAMLINED_CREATION_ACTIVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return url.toString();
|
return url.toString();
|
||||||
|
|
@ -401,9 +397,8 @@ public class ContentItemPage extends CMSPage implements ActionListener {
|
||||||
|
|
||||||
public static String getRelativeItemURL(BigDecimal itemId, int tab) {
|
public static String getRelativeItemURL(BigDecimal itemId, int tab) {
|
||||||
StringBuffer url = new StringBuffer();
|
StringBuffer url = new StringBuffer();
|
||||||
url.append("item.jsp")
|
url.append("item.jsp").append("?").append(ITEM_ID).append("=").append(itemId.
|
||||||
.append("?").append(ITEM_ID).append("=").append(itemId.toString())
|
toString()).append("&").append(SET_TAB).append("=").append(tab);
|
||||||
.append("&").append(SET_TAB).append("=").append(tab);
|
|
||||||
return url.toString();
|
return url.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -432,8 +427,9 @@ public class ContentItemPage extends CMSPage implements ActionListener {
|
||||||
* @param tab The index of the tab to display
|
* @param tab The index of the tab to display
|
||||||
*/
|
*/
|
||||||
public static String getItemURL(BigDecimal itemId, int tab) {
|
public static String getItemURL(BigDecimal itemId, int tab) {
|
||||||
final ContentItem item = (ContentItem) DomainObjectFactory.newInstance
|
final ContentItem item =
|
||||||
(new OID(ContentItem.BASE_DATA_OBJECT_TYPE, itemId));
|
(ContentItem) DomainObjectFactory.newInstance(new OID(
|
||||||
|
ContentItem.BASE_DATA_OBJECT_TYPE, itemId));
|
||||||
|
|
||||||
if (item == null) {
|
if (item == null) {
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -452,7 +448,7 @@ public class ContentItemPage extends CMSPage implements ActionListener {
|
||||||
try {
|
try {
|
||||||
String returnURL = (String) state.getValue(m_returnURL);
|
String returnURL = (String) state.getValue(m_returnURL);
|
||||||
state.getResponse().sendRedirect(returnURL);
|
state.getResponse().sendRedirect(returnURL);
|
||||||
} catch(IOException e) {
|
} catch (IOException e) {
|
||||||
s_log.error("IO Error redirecting back", e);
|
s_log.error("IO Error redirecting back", e);
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
@ -462,9 +458,27 @@ public class ContentItemPage extends CMSPage implements ActionListener {
|
||||||
* Fetch the preview URL.
|
* Fetch the preview URL.
|
||||||
*/
|
*/
|
||||||
private String getPreviewURL(PageState state) {
|
private String getPreviewURL(PageState state) {
|
||||||
ContentItem item = m_item.getContentItem(state);
|
final ContentItem item = m_item.getContentItem(state);
|
||||||
ContentSection section = getContentSection(state);
|
|
||||||
ItemResolver itemResolver = section.getItemResolver();
|
if (item instanceof CustomizedPreviewLink) {
|
||||||
|
final String previewLink = ((CustomizedPreviewLink) item).
|
||||||
|
getPreviewUrl(
|
||||||
|
state);
|
||||||
|
if ((previewLink == null) || previewLink.isEmpty()) {
|
||||||
|
return getDefaultPreviewLink(state, item);
|
||||||
|
} else {
|
||||||
|
return previewLink;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return getDefaultPreviewLink(state, item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getDefaultPreviewLink(final PageState state,
|
||||||
|
final ContentItem item) {
|
||||||
|
final ContentSection section = CMS.getContext().getContentSection();
|
||||||
|
//ContentSection section = getContentSection(state);
|
||||||
|
final ItemResolver itemResolver = section.getItemResolver();
|
||||||
|
|
||||||
// Pass in the "Live" context since we need it for the preview
|
// Pass in the "Live" context since we need it for the preview
|
||||||
return itemResolver.generateItemURL(state, item, section,
|
return itemResolver.generateItemURL(state, item, section,
|
||||||
|
|
@ -480,8 +494,8 @@ public class ContentItemPage extends CMSPage implements ActionListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isStreamlinedCreationActive(PageState state) {
|
public static boolean isStreamlinedCreationActive(PageState state) {
|
||||||
return ContentSection.getConfig().getUseStreamlinedCreation() &&
|
return ContentSection.getConfig().getUseStreamlinedCreation()
|
||||||
STREAMLINED_CREATION_ACTIVE.equals
|
&& STREAMLINED_CREATION_ACTIVE.equals(state.getRequest().
|
||||||
(state.getRequest().getParameter(STREAMLINED_CREATION));
|
getParameter(STREAMLINED_CREATION));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue