Änderungen an ImageEditStep zur Unterstützung von Bildgallerien
git-svn-id: https://svn.libreccm.org/ccm/trunk@1701 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
fa56786e53
commit
9e5e1a7e20
|
|
@ -21,6 +21,8 @@ package com.arsdigita.cms.contentassets.ui;
|
||||||
import com.arsdigita.cms.contentassets.ItemImageAttachment;
|
import com.arsdigita.cms.contentassets.ItemImageAttachment;
|
||||||
|
|
||||||
import com.arsdigita.bebop.AbstractSingleSelectionModel;
|
import com.arsdigita.bebop.AbstractSingleSelectionModel;
|
||||||
|
import com.arsdigita.bebop.ActionLink;
|
||||||
|
import com.arsdigita.bebop.ColumnPanel;
|
||||||
import com.arsdigita.bebop.Page;
|
import com.arsdigita.bebop.Page;
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.bebop.RequestLocal;
|
import com.arsdigita.bebop.RequestLocal;
|
||||||
|
|
@ -29,6 +31,7 @@ import com.arsdigita.bebop.event.ActionListener;
|
||||||
import com.arsdigita.bebop.parameters.ParameterModel;
|
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||||
import com.arsdigita.cms.ContentItem;
|
import com.arsdigita.cms.ContentItem;
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
import com.arsdigita.cms.ui.ImageChooser;
|
||||||
import com.arsdigita.cms.ui.SecurityPropertyEditor;
|
import com.arsdigita.cms.ui.SecurityPropertyEditor;
|
||||||
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
||||||
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
||||||
|
|
@ -68,11 +71,13 @@ public class ImageStep extends SecurityPropertyEditor {
|
||||||
m_attachmentOID = new OIDParameter( "attachmentID" );
|
m_attachmentOID = new OIDParameter( "attachmentID" );
|
||||||
m_attachmentSelection = new AttachmentSelectionModel();
|
m_attachmentSelection = new AttachmentSelectionModel();
|
||||||
|
|
||||||
|
|
||||||
m_add = new ImageStepEdit( this );
|
m_add = new ImageStepEdit( this );
|
||||||
WorkflowLockedComponentAccess addCA =
|
WorkflowLockedComponentAccess addCA =
|
||||||
new WorkflowLockedComponentAccess( m_add, m_itemSelection );
|
new WorkflowLockedComponentAccess( m_add, m_itemSelection );
|
||||||
addComponent( "add", "Add Image", addCA );
|
addComponent( "add", "Add Image", addCA );
|
||||||
|
|
||||||
|
|
||||||
m_display = new ImageStepDisplay( this );
|
m_display = new ImageStepDisplay( this );
|
||||||
setDisplayComponent(m_display);
|
setDisplayComponent(m_display);
|
||||||
|
|
||||||
|
|
@ -93,6 +98,7 @@ public class ImageStep extends SecurityPropertyEditor {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void register( Page p ) {
|
public void register( Page p ) {
|
||||||
super.register( p );
|
super.register( p );
|
||||||
|
|
||||||
|
|
@ -132,9 +138,12 @@ public class ImageStep extends SecurityPropertyEditor {
|
||||||
extends AbstractSingleSelectionModel
|
extends AbstractSingleSelectionModel
|
||||||
{
|
{
|
||||||
private final RequestLocal m_attachment = new RequestLocal() {
|
private final RequestLocal m_attachment = new RequestLocal() {
|
||||||
|
@Override
|
||||||
protected Object initialValue( PageState ps ) {
|
protected Object initialValue( PageState ps ) {
|
||||||
OID oid = (OID) getSelectedKey( ps );
|
OID oid = (OID) getSelectedKey( ps );
|
||||||
if( null == oid ) return null;
|
if( null == oid ) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return DomainObjectFactory.newInstance( oid );
|
return DomainObjectFactory.newInstance( oid );
|
||||||
}
|
}
|
||||||
|
|
@ -142,7 +151,9 @@ public class ImageStep extends SecurityPropertyEditor {
|
||||||
|
|
||||||
public Object getSelectedKey( PageState ps ) {
|
public Object getSelectedKey( PageState ps ) {
|
||||||
OID oid = (OID) ps.getValue( m_attachmentOID );
|
OID oid = (OID) ps.getValue( m_attachmentOID );
|
||||||
if( null == oid ) return null;
|
if( null == oid ) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return oid;
|
return oid;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,6 @@
|
||||||
|
|
||||||
package com.arsdigita.cms.contentassets.ui;
|
package com.arsdigita.cms.contentassets.ui;
|
||||||
|
|
||||||
import com.arsdigita.cms.contentassets.ItemImageAttachment;
|
|
||||||
|
|
||||||
import com.arsdigita.bebop.ActionLink;
|
import com.arsdigita.bebop.ActionLink;
|
||||||
import com.arsdigita.bebop.ColumnPanel;
|
import com.arsdigita.bebop.ColumnPanel;
|
||||||
import com.arsdigita.bebop.Component;
|
import com.arsdigita.bebop.Component;
|
||||||
|
|
@ -39,33 +37,31 @@ import com.arsdigita.bebop.event.FormProcessListener;
|
||||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||||
import com.arsdigita.bebop.event.ParameterEvent;
|
import com.arsdigita.bebop.event.ParameterEvent;
|
||||||
import com.arsdigita.bebop.event.ParameterListener;
|
import com.arsdigita.bebop.event.ParameterListener;
|
||||||
import com.arsdigita.bebop.form.TextField;
|
|
||||||
import com.arsdigita.bebop.form.TextArea;
|
import com.arsdigita.bebop.form.TextArea;
|
||||||
|
import com.arsdigita.bebop.form.TextField;
|
||||||
import com.arsdigita.bebop.parameters.BigDecimalParameter;
|
import com.arsdigita.bebop.parameters.BigDecimalParameter;
|
||||||
import com.arsdigita.bebop.parameters.NotNullValidationListener;
|
import com.arsdigita.bebop.parameters.NotNullValidationListener;
|
||||||
import com.arsdigita.bebop.parameters.StringLengthValidationListener;
|
|
||||||
import com.arsdigita.bebop.parameters.ParameterData;
|
import com.arsdigita.bebop.parameters.ParameterData;
|
||||||
|
import com.arsdigita.bebop.parameters.StringLengthValidationListener;
|
||||||
import com.arsdigita.bebop.parameters.StringParameter;
|
import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
|
||||||
import com.arsdigita.persistence.DataCollection;
|
|
||||||
import com.arsdigita.util.Assert;
|
|
||||||
import com.arsdigita.util.StringUtils;
|
|
||||||
|
|
||||||
import com.arsdigita.cms.ContentItem;
|
import com.arsdigita.cms.ContentItem;
|
||||||
import com.arsdigita.cms.ImageAsset;
|
import com.arsdigita.cms.ImageAsset;
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
import com.arsdigita.cms.ReusableImageAsset;
|
import com.arsdigita.cms.ReusableImageAsset;
|
||||||
|
import com.arsdigita.cms.contentassets.ItemImageAttachment;
|
||||||
import com.arsdigita.cms.ui.FileUploadSection;
|
import com.arsdigita.cms.ui.FileUploadSection;
|
||||||
import com.arsdigita.cms.ui.ImageBrowser;
|
import com.arsdigita.cms.ui.ImageBrowser;
|
||||||
import com.arsdigita.cms.ui.ImageChooser;
|
import com.arsdigita.cms.ui.ImageChooser;
|
||||||
|
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
|
import com.arsdigita.persistence.DataCollection;
|
||||||
|
import com.arsdigita.util.Assert;
|
||||||
|
import com.arsdigita.util.StringUtils;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
public class ImageStepEdit extends SimpleContainer
|
public class ImageStepEdit extends SimpleContainer
|
||||||
|
|
@ -143,8 +139,9 @@ public class ImageStepEdit extends SimpleContainer
|
||||||
private void setImageComponent( PageState ps, final String activeKey ) {
|
private void setImageComponent( PageState ps, final String activeKey ) {
|
||||||
m_imageComponent.setSelectedKey( ps, activeKey );
|
m_imageComponent.setSelectedKey( ps, activeKey );
|
||||||
|
|
||||||
if( s_log.isDebugEnabled() )
|
if( s_log.isDebugEnabled() ) {
|
||||||
s_log.debug( "Selected component: " + activeKey );
|
s_log.debug( "Selected component: " + activeKey );
|
||||||
|
}
|
||||||
|
|
||||||
Map componentsMap = m_imageComponent.getComponentsMap();
|
Map componentsMap = m_imageComponent.getComponentsMap();
|
||||||
Iterator i = componentsMap.keySet().iterator();
|
Iterator i = componentsMap.keySet().iterator();
|
||||||
|
|
@ -167,17 +164,18 @@ public class ImageStepEdit extends SimpleContainer
|
||||||
PageState ps = event.getPageState();
|
PageState ps = event.getPageState();
|
||||||
|
|
||||||
ItemImageAttachment attachment = m_imageStep.getAttachment( ps );
|
ItemImageAttachment attachment = m_imageStep.getAttachment( ps );
|
||||||
if( null == attachment ) return;
|
if( null == attachment ) {
|
||||||
|
// XXX: Do something
|
||||||
// XXX: Do something
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void process( FormSectionEvent event ) throws FormProcessException {
|
public void process( FormSectionEvent event ) throws FormProcessException {
|
||||||
PageState ps = event.getPageState();
|
PageState ps = event.getPageState();
|
||||||
ImageComponent component = getImageComponent( ps );
|
ImageComponent component = getImageComponent( ps );
|
||||||
|
|
||||||
if( !component.getSaveCancelSection().getSaveButton().isSelected( ps ) )
|
if( !component.getSaveCancelSection().getSaveButton().isSelected( ps ) ) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ContentItem item = m_imageStep.getItem( ps );
|
ContentItem item = m_imageStep.getItem( ps );
|
||||||
if( null == item ) {
|
if( null == item ) {
|
||||||
|
|
@ -270,7 +268,8 @@ public class ImageStepEdit extends SimpleContainer
|
||||||
add(new Label("Use Context"));
|
add(new Label("Use Context"));
|
||||||
m_useContext = new TextField("useContext");
|
m_useContext = new TextField("useContext");
|
||||||
m_useContext.setSize(40);
|
m_useContext.setSize(40);
|
||||||
m_useContext.addValidationListener( new UniqueUseContextListener() );
|
// Removed to use multiple images with fancyBox
|
||||||
|
// m_useContext.addValidationListener( new UniqueUseContextListener() );
|
||||||
add(m_useContext);
|
add(m_useContext);
|
||||||
|
|
||||||
m_saveCancel = new SaveCancelSection();
|
m_saveCancel = new SaveCancelSection();
|
||||||
|
|
@ -417,7 +416,8 @@ public class ImageStepEdit extends SimpleContainer
|
||||||
m_form.add(new Label("Use Context"));
|
m_form.add(new Label("Use Context"));
|
||||||
m_useContext = new TextField("useContext");
|
m_useContext = new TextField("useContext");
|
||||||
m_useContext.setSize(40);
|
m_useContext.setSize(40);
|
||||||
m_useContext.addValidationListener( new UniqueUseContextListener() );
|
// Removed to use multiple images with fancyBox
|
||||||
|
// m_useContext.addValidationListener( new UniqueUseContextListener() );
|
||||||
m_form.add(m_useContext);
|
m_form.add(m_useContext);
|
||||||
|
|
||||||
m_saveCancel = new SaveCancelSection();
|
m_saveCancel = new SaveCancelSection();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue