Ticket #1184: Sprache-Tab funktioniert nur mit JavaScript
Geändert: * getRelativeItemURL als deprecated markiert. Die beiden Aufrufe in ContentSoonExpiredPane und ItemLanguagesTable ersetzt durch getItemURL git-svn-id: https://svn.libreccm.org/ccm/trunk@2186 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
59dde5434e
commit
528508b556
|
|
@ -68,35 +68,33 @@ import org.apache.log4j.Logger;
|
||||||
* @author Stanislav Freidin <sfreidin@redhat.com>
|
* @author Stanislav Freidin <sfreidin@redhat.com>
|
||||||
* @author Jack Chung
|
* @author Jack Chung
|
||||||
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de>
|
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de>
|
||||||
*
|
*
|
||||||
* @version $Id: ContentItemPage.java 2245 2011-11-15 08:03:57Z pboy $
|
* @version $Id: ContentItemPage.java 2245 2011-11-15 08:03:57Z pboy $
|
||||||
*/
|
*/
|
||||||
public class ContentItemPage extends CMSPage implements ActionListener {
|
public class ContentItemPage extends CMSPage implements ActionListener {
|
||||||
|
|
||||||
/** Private Logger instance for debugging purpose. */
|
/**
|
||||||
|
* Private Logger instance for debugging purpose.
|
||||||
|
*/
|
||||||
private static final Logger s_log = Logger.getLogger(ContentItemPage.class);
|
private static final Logger s_log = Logger.getLogger(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.
|
||||||
* the current tab. This is a KLUDGE right now because the
|
* This is a KLUDGE right now because the TabbedDialog's current tab is
|
||||||
* TabbedDialog's current tab is selected with a local
|
* selected with a local 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
|
||||||
* or not to use the streamlined authoring process (assuming the
|
* use the streamlined authoring process (assuming the option is turned on).
|
||||||
* option is turned on).
|
*
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public static final String STREAMLINED_CREATION = "streamlined_creation";
|
public static final String STREAMLINED_CREATION = "streamlined_creation";
|
||||||
public static final String STREAMLINED_CREATION_ACTIVE = "active";
|
public static final String STREAMLINED_CREATION_ACTIVE = "active";
|
||||||
|
|
@ -107,11 +105,11 @@ public class ContentItemPage extends CMSPage implements ActionListener {
|
||||||
*/
|
*/
|
||||||
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
|
||||||
* type of the item the user wishes to create. or edit.</p>
|
* the item the user wishes to create. or edit.</p>
|
||||||
*
|
*
|
||||||
* <p>The parameter must be a BigDecimalParameter which encodes
|
* <p>The parameter must be a BigDecimalParameter which encodes the id of
|
||||||
* the id of the content type.</p>
|
* 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++;
|
||||||
|
|
@ -180,12 +178,11 @@ public class ContentItemPage extends CMSPage implements ActionListener {
|
||||||
addGlobalStateParam(streamlinedCreation);
|
addGlobalStateParam(streamlinedCreation);
|
||||||
|
|
||||||
m_typeModel = new ACSObjectSelectionModel(ContentType.class.getName(),
|
m_typeModel = new ACSObjectSelectionModel(ContentType.class.getName(),
|
||||||
ContentType.BASE_DATA_OBJECT_TYPE,
|
ContentType.BASE_DATA_OBJECT_TYPE,
|
||||||
contentType);
|
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)
|
public void validate(FormSectionEvent event)
|
||||||
throws FormProcessException {
|
throws FormProcessException {
|
||||||
validateItemID(event.getPageState());
|
validateItemID(event.getPageState());
|
||||||
|
|
@ -198,7 +195,7 @@ public class ContentItemPage extends CMSPage implements ActionListener {
|
||||||
|
|
||||||
m_globalNavigation = new GlobalNavigation();
|
m_globalNavigation = new GlobalNavigation();
|
||||||
add(m_globalNavigation);
|
add(m_globalNavigation);
|
||||||
|
|
||||||
m_contextBar = new ContentItemContextBar(m_itemModel);
|
m_contextBar = new ContentItemContextBar(m_itemModel);
|
||||||
add(m_contextBar);
|
add(m_contextBar);
|
||||||
|
|
||||||
|
|
@ -220,18 +217,17 @@ public class ContentItemPage extends CMSPage implements ActionListener {
|
||||||
m_tabbedPane.addTab(new Label(gz("cms.ui.item.summary")), m_summaryPane);
|
m_tabbedPane.addTab(new Label(gz("cms.ui.item.summary")), m_summaryPane);
|
||||||
m_tabbedPane.addTab(new Label(gz("cms.ui.item.authoring")), m_wizardPane);
|
m_tabbedPane.addTab(new Label(gz("cms.ui.item.authoring")), m_wizardPane);
|
||||||
m_tabbedPane.addTab(new Label(gz("cms.ui.item.languages")),
|
m_tabbedPane.addTab(new Label(gz("cms.ui.item.languages")),
|
||||||
m_languagesPane);
|
m_languagesPane);
|
||||||
m_tabbedPane.addTab(new Label(gz("cms.ui.item.workflow")),
|
m_tabbedPane.addTab(new Label(gz("cms.ui.item.workflow")),
|
||||||
m_workflowPane);
|
m_workflowPane);
|
||||||
m_tabbedPane.addTab(new Label(gz("cms.ui.item.lifecycles")),
|
m_tabbedPane.addTab(new Label(gz("cms.ui.item.lifecycles")),
|
||||||
m_lifecyclePane);
|
m_lifecyclePane);
|
||||||
m_tabbedPane.addTab(new Label(gz("cms.ui.item.history")),
|
m_tabbedPane.addTab(new Label(gz("cms.ui.item.history")),
|
||||||
m_revisionsPane);
|
m_revisionsPane);
|
||||||
m_tabbedPane.addTab(new Label(gz("cms.ui.item.templates")),
|
m_tabbedPane.addTab(new Label(gz("cms.ui.item.templates")),
|
||||||
m_templatesPane);
|
m_templatesPane);
|
||||||
|
|
||||||
m_tabbedPane.addActionListener(new ActionListener() {
|
m_tabbedPane.addActionListener(new ActionListener() {
|
||||||
|
|
||||||
public final void actionPerformed(final ActionEvent e) {
|
public final void actionPerformed(final ActionEvent e) {
|
||||||
final PageState state = e.getPageState();
|
final PageState state = e.getPageState();
|
||||||
final Component pane = m_tabbedPane.getCurrentPane(state);
|
final Component pane = m_tabbedPane.getCurrentPane(state);
|
||||||
|
|
@ -244,14 +240,13 @@ public class ContentItemPage extends CMSPage implements ActionListener {
|
||||||
|
|
||||||
// Build the preview link.
|
// Build the preview link.
|
||||||
m_previewLink = new Link(new Label(gz("cms.ui.preview")),
|
m_previewLink = new Link(new Label(gz("cms.ui.preview")),
|
||||||
new PrintListener() {
|
new PrintListener() {
|
||||||
|
public final void prepare(final PrintEvent e) {
|
||||||
public final void prepare(final PrintEvent e) {
|
final Link link = (Link) e.getTarget();
|
||||||
final Link link = (Link) e.getTarget();
|
link.setTarget(getPreviewURL(e.getPageState()));
|
||||||
link.setTarget(getPreviewURL(e.getPageState()));
|
link.setTargetFrame(Link.NEW_FRAME);
|
||||||
link.setTargetFrame(Link.NEW_FRAME);
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
m_previewLink.setIdAttr("preview_link");
|
m_previewLink.setIdAttr("preview_link");
|
||||||
add(m_previewLink);
|
add(m_previewLink);
|
||||||
|
|
||||||
|
|
@ -259,14 +254,13 @@ 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 {
|
public void validate(FormSectionEvent e) throws FormProcessException {
|
||||||
PageState s = e.getPageState();
|
PageState s = e.getPageState();
|
||||||
FormData data = e.getFormData();
|
FormData data = e.getFormData();
|
||||||
final ContentItem item = m_item.getContentItem(s);
|
final ContentItem item = m_item.getContentItem(s);
|
||||||
if (item != null && ContentItem.LIVE.equals(item.getVersion())) {
|
if (item != null && ContentItem.LIVE.equals(item.getVersion())) {
|
||||||
String err = "The item " + item.getID()
|
String err = "The item " + item.getID()
|
||||||
+ " is live and cannot be edited.";
|
+ " is live and cannot be edited.";
|
||||||
// data.addError(err);
|
// data.addError(err);
|
||||||
throw new FormProcessException(err);
|
throw new FormProcessException(err);
|
||||||
}
|
}
|
||||||
|
|
@ -289,14 +283,15 @@ public class ContentItemPage extends CMSPage implements ActionListener {
|
||||||
|
|
||||||
if (item == null) {
|
if (item == null) {
|
||||||
throw new FormProcessException("The item_id supplied does not "
|
throw new FormProcessException("The item_id supplied does not "
|
||||||
+ "reference a valid ContentItem.");
|
+ "reference a valid ContentItem.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch the request-local content section.
|
* Fetch the request-local content section.
|
||||||
*
|
*
|
||||||
* @deprecated use com.arsdigita.cms.CMS.getContext().getContentSection() instead
|
* @deprecated use com.arsdigita.cms.CMS.getContext().getContentSection()
|
||||||
|
* instead
|
||||||
* @param request The HTTP request
|
* @param request The HTTP request
|
||||||
* @return The current content section
|
* @return The current content section
|
||||||
*/
|
*/
|
||||||
|
|
@ -341,13 +336,13 @@ public class ContentItemPage extends CMSPage implements ActionListener {
|
||||||
m_tabbedPane.setTabVisible(state, m_templatesPane, !ContentSection.
|
m_tabbedPane.setTabVisible(state, m_templatesPane, !ContentSection.
|
||||||
getConfig().getHideTemplatesTab());
|
getConfig().getHideTemplatesTab());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Added by: Sören Bernstein <sbernstein@zes.uni-bremen.de>
|
// Added by: Sören Bernstein <sbernstein@zes.uni-bremen.de>
|
||||||
// If the content item is a language invariant content item, don't show
|
// If the content item is a language invariant content item, don't show
|
||||||
// the language pane
|
// the language pane
|
||||||
if (item instanceof LanguageInvariantContentItem) {
|
if (item instanceof LanguageInvariantContentItem) {
|
||||||
LanguageInvariantContentItem li_item = (LanguageInvariantContentItem) item;
|
LanguageInvariantContentItem li_item = (LanguageInvariantContentItem) item;
|
||||||
if(li_item.isLanguageInvariant()) {
|
if (li_item.isLanguageInvariant()) {
|
||||||
m_tabbedPane.setTabVisible(state, m_languagesPane, false);
|
m_tabbedPane.setTabVisible(state, m_languagesPane, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -377,8 +372,8 @@ 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(String nodeURL,
|
public static String getItemURL(String nodeURL,
|
||||||
BigDecimal itemId,
|
BigDecimal itemId,
|
||||||
int tab) {
|
int tab) {
|
||||||
return getItemURL(nodeURL, itemId, tab, false);
|
return getItemURL(nodeURL, itemId, tab, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -391,9 +386,9 @@ public class ContentItemPage extends CMSPage implements ActionListener {
|
||||||
* @param streamlinedCreation Whether to activate Streamlined item authoring
|
* @param streamlinedCreation Whether to activate Streamlined item authoring
|
||||||
*/
|
*/
|
||||||
public static String getItemURL(String nodeURL,
|
public static String getItemURL(String nodeURL,
|
||||||
BigDecimal itemId,
|
BigDecimal itemId,
|
||||||
int tab,
|
int tab,
|
||||||
boolean streamlinedCreation) {
|
boolean streamlinedCreation) {
|
||||||
StringBuffer url = new StringBuffer();
|
StringBuffer url = new StringBuffer();
|
||||||
|
|
||||||
url.append(nodeURL).append(PageLocations.ITEM_PAGE).append("?").append(
|
url.append(nodeURL).append(PageLocations.ITEM_PAGE).append("?").append(
|
||||||
|
|
@ -409,6 +404,7 @@ public class ContentItemPage extends CMSPage implements ActionListener {
|
||||||
return url.toString();
|
return url.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@deprecated use getItemURL(BigDecimal itemId, int tab) instead
|
||||||
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(PageLocations.ITEM_PAGE).append("?").append(ITEM_ID).append("=").append(itemId.
|
url.append(PageLocations.ITEM_PAGE).append("?").append(ITEM_ID).append("=").append(itemId.
|
||||||
|
|
@ -442,7 +438,7 @@ public class ContentItemPage extends CMSPage implements ActionListener {
|
||||||
*/
|
*/
|
||||||
public static String getItemURL(BigDecimal itemId, int tab) {
|
public static String getItemURL(BigDecimal itemId, int tab) {
|
||||||
final ContentItem item =
|
final ContentItem item =
|
||||||
(ContentItem) DomainObjectFactory.newInstance(new OID(
|
(ContentItem) DomainObjectFactory.newInstance(new OID(
|
||||||
ContentItem.BASE_DATA_OBJECT_TYPE, itemId));
|
ContentItem.BASE_DATA_OBJECT_TYPE, itemId));
|
||||||
|
|
||||||
if (item == null) {
|
if (item == null) {
|
||||||
|
|
@ -453,8 +449,8 @@ public class ContentItemPage extends CMSPage implements ActionListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Redirect back to wherever the user came from, using the value
|
* Redirect back to wherever the user came from, using the value of the
|
||||||
* of the return_url parameter.
|
* return_url parameter.
|
||||||
*
|
*
|
||||||
* @param state The current page state
|
* @param state The current page state
|
||||||
*/
|
*/
|
||||||
|
|
@ -489,20 +485,20 @@ public class ContentItemPage extends CMSPage implements ActionListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param state
|
* @param state
|
||||||
* @param item
|
* @param item
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private String getDefaultPreviewLink(final PageState state,
|
private String getDefaultPreviewLink(final PageState state,
|
||||||
final ContentItem item) {
|
final ContentItem item) {
|
||||||
final ContentSection section = CMS.getContext().getContentSection();
|
final ContentSection section = CMS.getContext().getContentSection();
|
||||||
//ContentSection section = getContentSection(state);
|
//ContentSection section = getContentSection(state);
|
||||||
final ItemResolver itemResolver = section.getItemResolver();
|
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,
|
||||||
CMSDispatcher.PREVIEW);
|
CMSDispatcher.PREVIEW);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final static GlobalizedMessage gz(final String key) {
|
protected final static GlobalizedMessage gz(final String key) {
|
||||||
|
|
@ -515,14 +511,14 @@ 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(state.getRequest().
|
&& STREAMLINED_CREATION_ACTIVE.equals(state.getRequest().
|
||||||
getParameter(STREAMLINED_CREATION));
|
getParameter(STREAMLINED_CREATION));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected TabbedPane getTabbedPane() {
|
protected TabbedPane getTabbedPane() {
|
||||||
return m_tabbedPane;
|
return m_tabbedPane;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected WizardSelector getWizardPane() {
|
protected WizardSelector getWizardPane() {
|
||||||
return m_wizardPane;
|
return m_wizardPane;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -214,7 +214,8 @@ public class ContentSoonExpiredPane extends SimpleContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
Link l = (Link) threadLocal.get();
|
Link l = (Link) threadLocal.get();
|
||||||
l.setTarget(ContentItemPage.getRelativeItemURL(ContentSoonExpiredPane.getItemDraft(id.toString()), ContentItemPage.AUTHORING_TAB));
|
// l.setTarget(ContentItemPage.getRelativeItemURL(ContentSoonExpiredPane.getItemDraft(id.toString()), ContentItemPage.AUTHORING_TAB));
|
||||||
|
l.setTarget(ContentItemPage.getItemURL(ContentSoonExpiredPane.getItemFromIdString(id.toString()), ContentItemPage.AUTHORING_TAB));
|
||||||
((Label) l.getChild()).setLabel(GlobalizationUtil.globalize("cms.ui.cse.editLink"));
|
((Label) l.getChild()).setLabel(GlobalizationUtil.globalize("cms.ui.cse.editLink"));
|
||||||
|
|
||||||
return l;
|
return l;
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,7 @@ public class ItemLanguagesTable extends DataTable {
|
||||||
classes.append("primaryInstance");
|
classes.append("primaryInstance");
|
||||||
}
|
}
|
||||||
|
|
||||||
String target = ContentItemPage.getRelativeItemURL(id, ContentItemPage.AUTHORING_TAB);
|
String target = ContentItemPage.getItemURL(cp, ContentItemPage.AUTHORING_TAB);
|
||||||
Label langLabel = new Label(LanguageUtil.getLangFull((String) value));
|
Label langLabel = new Label(LanguageUtil.getLangFull((String) value));
|
||||||
|
|
||||||
langLabel.setFontWeight(fontWeight.toString().trim());
|
langLabel.setFontWeight(fontWeight.toString().trim());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue