- Support for captions in the list of FileAttachments and RelatedLinks

- Some finetuning for the forms editing them in Content Centre


git-svn-id: https://svn.libreccm.org/ccm/trunk@3494 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2015-06-22 09:45:32 +00:00
parent c9db46ce01
commit fac695044f
6 changed files with 146 additions and 94 deletions

View File

@ -26,7 +26,7 @@ import com.arsdigita.bebop.event.FormProcessListener;
import com.arsdigita.bebop.event.FormSectionEvent;
import com.arsdigita.bebop.event.FormValidationListener;
import com.arsdigita.bebop.form.DHTMLEditor;
import com.arsdigita.bebop.parameters.NotNullValidationListener;
import com.arsdigita.bebop.form.TextField;
import com.arsdigita.bebop.parameters.StringInRangeValidationListener;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ItemSelectionModel;
@ -54,7 +54,8 @@ public class FileAttachmentCaptionForm extends Form
private FileUploadSection m_fileUploadSection;
private ItemSelectionModel m_itemModel;
private SaveCancelSection m_saveCancelSection;
private DHTMLEditor m_title;
//private DHTMLEditor m_title;
private TextField m_title;
private DHTMLEditor m_captionText;
private static final FileAttachmentConfig s_config = FileAttachmentConfig
@ -129,7 +130,9 @@ public class FileAttachmentCaptionForm extends Form
// Add the widgets
public void addWidgets() {
m_title = new DHTMLEditor("captiontitle");
//m_title = new DHTMLEditor("captiontitle");
m_title = new TextField("captiontitle");
m_title.setSize(32);
m_title.lock();
add(new Label(FileAttachmentGlobalizationUtil.globalize(

View File

@ -29,7 +29,7 @@ import com.arsdigita.bebop.event.FormValidationListener;
import com.arsdigita.bebop.form.DHTMLEditor;
import com.arsdigita.bebop.form.Submit;
import com.arsdigita.bebop.form.TextArea;
import com.arsdigita.bebop.parameters.NotNullValidationListener;
import com.arsdigita.bebop.form.TextField;
import com.arsdigita.bebop.parameters.StringInRangeValidationListener;
import com.arsdigita.cms.contentassets.FileAttachment;
import com.arsdigita.cms.contentassets.FileAttachmentConfig;
@ -49,7 +49,8 @@ public class FileDescriptionForm extends FormSection implements
private static final FileAttachmentConfig s_config = FileAttachmentConfig
.instanceOf();
private TextArea m_title;
//private TextArea m_title;
private TextField m_title;
private TextArea m_descriptionDHTML;
private TextArea m_description;
private FileAttachmentSelectionModel m_fileModel;
@ -84,7 +85,9 @@ public class FileDescriptionForm extends FormSection implements
*/
protected void addWidgets() {
m_title = new DHTMLEditor("title");
//m_title = new DHTMLEditor("title");
m_title = new TextField("title");
m_title.setSize(32);
titleLabel = new Label(FileAttachmentGlobalizationUtil
.globalize("cms.contentassets.file_attachment.title"));
add(titleLabel);
@ -175,6 +178,7 @@ public class FileDescriptionForm extends FormSection implements
m_descriptionDHTML.setVisible(state, true);
String name = file.getName();
m_title.setVisible(state, true);
titleLabel.setVisible(state, true);
if (name != null && name.equals("iscaption")) {
m_title.setValue(state, null);
} else {

View File

@ -9,7 +9,6 @@ import com.arsdigita.bebop.FormData;
import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.event.FormSectionEvent;
import com.arsdigita.bebop.parameters.NotNullValidationListener;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.contentassets.RelatedLink;
import com.arsdigita.cms.contenttypes.ui.LinkSelectionModel;

View File

@ -35,6 +35,7 @@ import com.arsdigita.bebop.event.FormSubmissionListener;
import com.arsdigita.bebop.form.DHTMLEditor;
import com.arsdigita.bebop.form.Submit;
import com.arsdigita.bebop.form.TextArea;
import com.arsdigita.bebop.form.TextField;
import com.arsdigita.bebop.parameters.NotNullValidationListener;
import com.arsdigita.bebop.parameters.StringLengthValidationListener;
import com.arsdigita.cms.CMSConfig;
@ -66,7 +67,8 @@ public class RelatedLinkCaptionForm extends FormSection
implements FormInitListener, FormProcessListener,
FormValidationListener, FormSubmissionListener {
private static final Logger s_log = Logger.getLogger(RelatedLinkCaptionForm.class);
private static final Logger s_log = Logger.getLogger(
RelatedLinkCaptionForm.class);
/**
* Name of this form
@ -75,7 +77,8 @@ public class RelatedLinkCaptionForm extends FormSection
public static final String SSL_PROTOCOL = "https://";
public static final String HTTP_PROTOCOL = "http://";
protected TextArea m_description;
protected TextArea m_title;
//protected TextArea m_title;
protected TextField m_title;
protected ItemSelectionModel m_itemModel;
protected LinkSelectionModel m_linkModel;
private SaveCancelSection m_saveCancelSection;
@ -87,9 +90,11 @@ public class RelatedLinkCaptionForm extends FormSection
* Constructor creates a new form to edit the Link object specified by the
* item selection model passed in.
*
* @param itemModel The ItemSelectionModel to use to obtain the ContentItem
* to which this link is (or will be) attached
* @param link The LinkSelectionModel to use to obtain the Link to work on
* @param itemModel The ItemSelectionModel to use to obtain the
* ContentItem to which this link is (or will be)
* attached
* @param link The LinkSelectionModel to use to obtain the Link to
* work on
* @param linkListName
*/
public RelatedLinkCaptionForm(ItemSelectionModel itemModel,
@ -131,17 +136,20 @@ public class RelatedLinkCaptionForm extends FormSection
* Adds widgets to the form.
*/
protected void addWidgets() {
m_title = new DHTMLEditor("captiontitle");
add(new Label(RelatedLinkGlobalizationUtil.globalize("cms.contentassets.ui.related_link.title")));
//m_title = new DHTMLEditor("captiontitle");
m_title = new TextField("captiontitle");
add(new Label(RelatedLinkGlobalizationUtil.globalize(
"cms.contentassets.ui.related_link.title")));
add(m_title);
/* Add the standard description field */
m_description = new DHTMLEditor("description");
// m_description.addValidationListener(new NotNullValidationListener());
m_description.addValidationListener(new StringLengthValidationListener(CMSConfig
m_description.addValidationListener(new StringLengthValidationListener(
CMSConfig
.getInstanceOf().getLinkDescMaxLength()));
add(new Label(RelatedLinkGlobalizationUtil.globalize("cms.contentassets.ui.related_link.Description")));
add(new Label(RelatedLinkGlobalizationUtil.globalize(
"cms.contentassets.ui.related_link.Description")));
add(m_description);
}

View File

@ -42,7 +42,8 @@
</xsl:template>
<xsl:template match="file-attachments//file-attachment">
<xsl:variable name="files-layout-tree" select="current()"/>
<xsl:variable name="caption-layout-tree" select="current()/caption-layout"/>
<xsl:variable name="file-layout-tree" select="current()/file-layout"/>
<!--<pre>
file-attachment
@ -69,7 +70,23 @@
<xsl:value-of select="concat('file-size = ', ./file-size)"/>
</pre>-->
<xsl:apply-templates select="$files-layout-tree/*">
<xsl:choose>
<xsl:when test="./mimeType/mimeType = 'text/plain'
and ./mimeType/label = 'caption'">
<xsl:apply-templates select="$caption-layout-tree/*">
<xsl:with-param name="file-name"
tunnel="yes"
select="./name"/>
<xsl:with-param name="description"
tunnel="yes"
select="./description"/>
<xsl:with-param name="class"
tunnel="yes"
select="'caption'"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="$file-layout-tree/*">
<xsl:with-param name="file-id"
tunnel="yes"
select="./id"/>
@ -88,11 +105,15 @@
<xsl:with-param name="href"
tunnel="yes"
select="concat($context-prefix,
'/ccm/cms-service/stream/asset/', ./name, '?asset_id=', ./id)"/>
'/ccm/cms-service/stream/asset/',
./name, '?asset_id=', ./id)"/>
<xsl:with-param name="class"
tunnel="yes"
select="concat('mime-type-', replace(./mimeType/mimeType, '/', '-'))"/>
select="concat('mime-type-',
replace(./mimeType/mimeType, '/', '-'))"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:template>
@ -143,7 +164,8 @@
<xsl:template match="file-attachment//file-description">
<xsl:param name="description" tunnel="yes"/>
<xsl:value-of select="$description"/>
<xsl:value-of disable-output-escaping="yes"
select="$description"/>
</xsl:template>
<xsl:template match="file-attachment//file-label">

View File

@ -81,11 +81,23 @@
<xsl:sort select="linkOrder"/>
<xsl:choose>
<xsl:when test="./targetType = 'externalLink'
and ./targetURI = 'caption'">
<xsl:apply-templates select="$links-layout-tree/caption/*">
<xsl:with-param name="link-title"
tunnel="yes"
select="./linkTitle"/>
<xsl:with-param name="link-desc"
tunnel="yes"
select="./linkDescription"/>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="./targetType = 'internalLink'">
<xsl:variable name="params">
<xsl:choose>
<xsl:when test="starts-with(./targetURI, '&amp;?')">
<xsl:value-of select="concat('&amp;', substring(./targetURI, 3))"/>
<xsl:value-of select="concat('&amp;',
substring(./targetURI, 3))"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="./targetURI"/>
@ -94,8 +106,12 @@
</xsl:variable>
<xsl:apply-templates select="$links-layout-tree/internal/*">
<xsl:with-param name="link-title" tunnel="yes" select="./linkTitle"/>
<xsl:with-param name="link-desc" tunnel="yes" select="./linkDescription"/>
<xsl:with-param name="link-title"
tunnel="yes"
select="./linkTitle"/>
<xsl:with-param name="link-desc"
tunnel="yes"
select="./linkDescription"/>
<xsl:with-param name="href"
tunnel="yes"
select="concat($context-prefix,
@ -145,7 +161,7 @@
<xsl:template match="related-link//related-link-desc">
<xsl:param name="link-desc" tunnel="yes"/>
<xsl:value-of select="$link-desc"/>
<xsl:value-of disable-output-escaping="yes" select="$link-desc"/>
</xsl:template>
<foundry:doc section="user" type="template-tag">