RelatedLinks: title-column can be used for captions
git-svn-id: https://svn.libreccm.org/ccm/trunk@3454 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
88fb5966da
commit
9e7b5ad380
|
|
@ -7,3 +7,5 @@ cms.contentassets.ui.related_link.add_caption=Add a caption
|
|||
cms.contentassets.ui.related_link.add_link=Add a Link
|
||||
cms.contentassets.ui.related_link.caption=Caption:
|
||||
cms.contentassets.ui.related_link.Description=Description/Caption:
|
||||
cms.contentassets.ui.related_link.title=Title:
|
||||
cms.contentassets.ui.related_link.description=Description:
|
||||
|
|
|
|||
|
|
@ -7,3 +7,5 @@ cms.contentassets.ui.related_link.add_caption=Zwischentitel hinzuf\u00fcgen
|
|||
cms.contentassets.ui.related_link.add_link=Link hinzuf\u00fcgen
|
||||
cms.contentassets.ui.related_link.caption=Zwischentitel:
|
||||
cms.contentassets.ui.related_link.Description=Beschreibung/Zwischentitel:
|
||||
cms.contentassets.ui.related_link.title=Titel:
|
||||
cms.contentassets.ui.related_link.description=Beschreibung:
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ 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;
|
||||
|
|
@ -39,10 +40,11 @@ public class RelatedLinkCaptionEditForm extends RelatedLinkCaptionForm {
|
|||
RelatedLink link;
|
||||
if (m_linkModel.isSelected(state)) {
|
||||
link = (RelatedLink) m_linkModel.getSelectedLink(state);
|
||||
if (link.getTitle().equals("caption")) {
|
||||
if (link.getTargetURI().equals("caption")) {
|
||||
//make this form visible because we are editing and it is a caption not a link
|
||||
setVisible(state, true);
|
||||
}
|
||||
m_title.setValue(state, link.getTitle());
|
||||
m_description.setValue(state, link.getDescription());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,8 +32,10 @@ import com.arsdigita.bebop.event.FormProcessListener;
|
|||
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||
import com.arsdigita.bebop.event.FormValidationListener;
|
||||
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.parameters.NotNullValidationListener;
|
||||
import com.arsdigita.bebop.parameters.StringLengthValidationListener;
|
||||
import com.arsdigita.cms.CMSConfig;
|
||||
import com.arsdigita.util.Assert;
|
||||
|
|
@ -73,6 +75,7 @@ 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 ItemSelectionModel m_itemModel;
|
||||
protected LinkSelectionModel m_linkModel;
|
||||
private SaveCancelSection m_saveCancelSection;
|
||||
|
|
@ -128,14 +131,17 @@ 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")));
|
||||
add(m_title);
|
||||
|
||||
|
||||
/* Add the standard description field */
|
||||
m_description = new TextArea("description");
|
||||
m_description.setCols(40);
|
||||
m_description.setRows(5);
|
||||
m_description = new DHTMLEditor("description");
|
||||
m_description.addValidationListener(new NotNullValidationListener());
|
||||
m_description.addValidationListener(new StringLengthValidationListener(CMSConfig
|
||||
.getInstanceOf().getLinkDescMaxLength()));
|
||||
add(new Label(RelatedLinkGlobalizationUtil.globalize("cms.contentassets.ui.related_link.caption")));
|
||||
add(new Label(RelatedLinkGlobalizationUtil.globalize("cms.contentassets.ui.related_link.Description")));
|
||||
add(m_description);
|
||||
|
||||
}
|
||||
|
|
@ -231,6 +237,8 @@ public class RelatedLinkCaptionForm extends FormSection
|
|||
public void validate(FormSectionEvent event)
|
||||
throws FormProcessException {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -278,6 +286,7 @@ public class RelatedLinkCaptionForm extends FormSection
|
|||
s_log.debug("Init");
|
||||
s_log.debug("new link");
|
||||
m_description.setValue(state, null);
|
||||
m_title.setValue(state,null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -328,10 +337,17 @@ public class RelatedLinkCaptionForm extends FormSection
|
|||
protected void setLinkProperties(RelatedLink link, FormSectionEvent fse) {
|
||||
PageState state = fse.getPageState();
|
||||
FormData data = fse.getFormData();
|
||||
link.setTitle("caption");
|
||||
|
||||
String title = (String) m_title.getValue(state);
|
||||
if(!title.isEmpty()){
|
||||
link.setTitle(title);
|
||||
} else {
|
||||
//if user did not typed in a title
|
||||
link.setTitle(" ");
|
||||
}
|
||||
link.setDescription((String) m_description.getValue(state));
|
||||
link.setTargetType(RelatedLink.EXTERNAL_LINK);
|
||||
link.setTargetURI(null);
|
||||
link.setTargetURI("caption");
|
||||
link.setTargetWindow("");
|
||||
link.setResourceSize("");
|
||||
link.setResourceType(MimeType.loadMimeType("text/html"));
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ public class RelatedLinkEditForm extends RelatedLinkPropertyForm {
|
|||
if (getLinkSelectionModel().isSelected(ps)) {
|
||||
|
||||
rl = (RelatedLink) getLinkSelectionModel().getSelectedLink(ps);
|
||||
if (!rl.getTitle().equals("caption")) {
|
||||
if (!rl.getTargetURI().equals("caption")) {
|
||||
//make this form visible because we are editing and its not a caption
|
||||
setVisible(ps, true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,8 +62,8 @@ import java.net.URL;
|
|||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Form to edit the basic properties of an Link. This form can be extended to create forms for Link
|
||||
* subclasses.
|
||||
* Form to edit the basic properties of an Link. This form can be extended to
|
||||
* create forms for Link subclasses.
|
||||
*
|
||||
* @version $Revision: #5 $ $Date: 2004/08/17 $
|
||||
* @author Nobuko Asakai (nasakai@redhat.com)
|
||||
|
|
@ -95,11 +95,11 @@ public class LinkPropertyForm extends FormSection
|
|||
protected final String ITEM_SEARCH = "contentItem";
|
||||
|
||||
/**
|
||||
* Constructor creates a new form to edit the Link object specified by the item selection model
|
||||
* passed in.
|
||||
* 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 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
|
||||
*/
|
||||
public LinkPropertyForm(ItemSelectionModel itemModel,
|
||||
|
|
@ -108,8 +108,8 @@ public class LinkPropertyForm extends FormSection
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructor creates a new form to edit the Link object specified by the item selection model
|
||||
* passed in.
|
||||
* Constructor creates a new form to edit the Link object specified by the
|
||||
* item selection model passed in.
|
||||
*
|
||||
* @param itemModel
|
||||
* @param link
|
||||
|
|
@ -364,7 +364,8 @@ public class LinkPropertyForm extends FormSection
|
|||
}
|
||||
|
||||
/**
|
||||
* Validation listener. Ensures consistency of internal vs. external link data
|
||||
* Validation listener. Ensures consistency of internal vs. external link
|
||||
* data
|
||||
*
|
||||
* @param event the FormSectionEvent
|
||||
*
|
||||
|
|
@ -503,13 +504,15 @@ public class LinkPropertyForm extends FormSection
|
|||
s_log.debug("Edit");
|
||||
link = m_linkModel.getSelectedLink(state);
|
||||
|
||||
if(link.getTitle().equals("caption")){
|
||||
if (link.getTargetURI()!= null && link.getTargetURI().equals("caption")) {
|
||||
setVisible(state, false);
|
||||
}
|
||||
try {
|
||||
m_title.setValue(state, link.getTitle());
|
||||
if(link.getTitle()!=null){
|
||||
m_title.setValue(state, link.getTitle());}
|
||||
m_description.setValue(state, link.getDescription());
|
||||
if ((link.getTargetURI() != null)
|
||||
&& (!link.getTargetURI().equals("caption"))
|
||||
&& link.getTargetURI().startsWith("&")) {
|
||||
m_itemParams.setValue(state,
|
||||
link.getTargetURI().substring(1));
|
||||
|
|
@ -582,8 +585,8 @@ public class LinkPropertyForm extends FormSection
|
|||
}
|
||||
|
||||
/**
|
||||
* Set various properties of the Link.Child clases can over-ride this method to add additional
|
||||
* properties to Link.
|
||||
* Set various properties of the Link.Child clases can over-ride this method
|
||||
* to add additional properties to Link.
|
||||
*
|
||||
* @param link
|
||||
* @param fse
|
||||
|
|
|
|||
|
|
@ -204,16 +204,16 @@ public class LinkTable extends Table {
|
|||
boolean isLast = (row == ((Long) m_size.get(state)).intValue() - 1);
|
||||
|
||||
if (column == m_titleCol.getModelIndex()) {
|
||||
|
||||
if (link.getTargetURI()!=null && link.getTargetURI().equals("caption")) {
|
||||
Label label = new Label(link.getTitle());
|
||||
return label;
|
||||
}
|
||||
String url = link.getInternalOrExternalURI(state);
|
||||
if (link.getTitle().equals("caption")) {
|
||||
ExternalLink extLink = new ExternalLink("", url);
|
||||
extLink.setTargetFrame("_blank");
|
||||
return extLink;
|
||||
} else {
|
||||
ExternalLink extLink = new ExternalLink(link.getTitle(), url);
|
||||
extLink.setTargetFrame("_blank");
|
||||
return extLink;
|
||||
}
|
||||
|
||||
} else if (column == m_descCol.getModelIndex()) {
|
||||
if (isSelected) {
|
||||
return new Label(link.getDescription(), Label.BOLD);
|
||||
|
|
|
|||
Loading…
Reference in New Issue