- Weitere Ergänzungen an den Übersetzungen
- Parameterisierbarer (Related)Link git-svn-id: https://svn.libreccm.org/ccm/trunk@632 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
7bcd95ef54
commit
9d4315b042
|
|
@ -90,14 +90,12 @@ public class RelatedLinkPropertyForm extends LinkPropertyForm {
|
|||
add(new Label(
|
||||
new GlobalizedMessage("com.arsdigita.cms.contentassets.related_link_resourceSize",
|
||||
"com.arsdigita.cms.contentassets.RelatedLinkResources")));
|
||||
|
||||
TextField resSize = new TextField(new StringParameter(RelatedLink.RESOURCE_SIZE));
|
||||
add(resSize);
|
||||
|
||||
add(new Label(
|
||||
new GlobalizedMessage("com.arsdigita.cms.contentassets.related_link_resourceType",
|
||||
"com.arsdigita.cms.contentassets.RelatedLinkResources")));
|
||||
|
||||
SingleSelect resType = new SingleSelect(new StringParameter(RelatedLink.RESOURCE_TYPE));
|
||||
addMimeOptions(resType);
|
||||
add(resType);
|
||||
|
|
|
|||
|
|
@ -1058,3 +1058,6 @@ cms.ui.workflow.task=Task
|
|||
cms.ui.workflow.you_are_assigned_to_this_item=Assigned to you
|
||||
cms.ui.workflow.roles=Roles
|
||||
cms.ui.workflow.approve_this_content=Approve
|
||||
cms.ui.unknownRole=Unknown role
|
||||
cms.ui.unknownStatus=Unknown status
|
||||
cms.contenttypes.ui.genericorgaunit.persons.status=Status
|
||||
|
|
|
|||
|
|
@ -1051,3 +1051,6 @@ cms.ui.workflow.your_active_tasks=Ihre aktiven Aufgaben
|
|||
cms.ui.workflow.you_are_assigned_to_this_item=Zugewiesen an Sie
|
||||
cms.ui.workflow.roles=Rollen
|
||||
cms.ui.workflow.approve_this_content=Aktzeptieren
|
||||
cms.ui.unknownRole=Unbekannte Rolle
|
||||
cms.ui.unknownStatus=Unbekannter status
|
||||
cms.contenttypes.ui.genericorgaunit.persons.status=Status
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
cms.tasks.ui.content_center=Content Centre
|
||||
cms.ui.content_center=Content Centre
|
||||
cms.ui.lifecycles=Lifecycles
|
||||
cms.ui.unknownRole=
|
||||
cms.ui.unknownStatus=Unknown status
|
||||
cms.contenttypes.ui.genericorgaunit.persons.status=Status
|
||||
|
|
|
|||
|
|
@ -114,3 +114,6 @@ cms.contenttypes.ui.contact.contactEntry.none=No contact information yet
|
|||
cms.contenttypes.ui.genericorgaunit.person.role=Role
|
||||
cms.ui.delete=Remove
|
||||
sciorganization.ui.department.project.confirm_remove=Are you sure to remove this project?
|
||||
cms.ui.unknownRole=Unknown role
|
||||
cms.ui.unknownStatus=Unknown status
|
||||
Status=Status
|
||||
|
|
|
|||
|
|
@ -116,3 +116,15 @@ cms.contenttypes.ui.genericorgaunit.select_person=Person ausw\u00e4hlen
|
|||
cms.contenttypes.ui.genericorgaunit.person.role=Rolle
|
||||
cms.ui.delete=Entfernen
|
||||
sciorganization.ui.department.project.confirm_remove=Wollen Sie dieses Projekt wirklich entfernen?
|
||||
cms.ui.unknownRole=Unbekannte Rolle
|
||||
cms.contenttypes.ui.contact.contactEntry.key.contact_type=Kontakttyp
|
||||
cms.contenttypes.ui.contact.contactEntry.key.office_hours=Sprechzeiten
|
||||
cms.contenttypes.ui.contact.contactEntry.key.phone_office=Telefon (B\u00fcro)
|
||||
cms.contenttypes.ui.contact.contactEntry.key.phone_private=Telefon (Privat)
|
||||
cms.contenttypes.ui.contact.contactEntry.key.phone_mobile=Telefon (mobil)
|
||||
cms.contenttypes.ui.contact.contactEntry.key.email=E-Mail
|
||||
cms.contenttypes.ui.contact.contactEntry.key.fax=sFax
|
||||
cms.contenttypes.ui.contact.contactEntry.key.im=Instant Messanger
|
||||
cms.contenttypes.ui.contact.contactEntry.key.www=Homepage
|
||||
cms.ui.unknownStatus=Unkannter Status
|
||||
Status=Status
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
package com.arsdigita.cms.contenttypes;
|
||||
|
||||
|
||||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.cms.ContentBundle;
|
||||
import com.arsdigita.cms.ContentItem;
|
||||
|
|
@ -37,10 +36,13 @@ import com.arsdigita.persistence.DataCollection;
|
|||
import com.arsdigita.persistence.Session;
|
||||
import com.arsdigita.persistence.SessionManager;
|
||||
import com.arsdigita.util.Assert;
|
||||
import com.arsdigita.web.ParameterMap;
|
||||
import com.arsdigita.web.URL;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* This content type represents a Link content type for linking
|
||||
* ContentItems and external links.
|
||||
|
|
@ -49,7 +51,8 @@ import org.apache.log4j.Logger;
|
|||
* @author Nobuko Asakai (nasakai@redhat.com)
|
||||
* @author Sören Bernstein (Quasimodo)
|
||||
*/
|
||||
public class Link extends ACSObject {
|
||||
public class Link extends ACSObject {
|
||||
|
||||
private static final Logger s_log = Logger.getLogger(Link.class);
|
||||
/** PDL properties
|
||||
* cms_links.title */
|
||||
|
|
@ -60,7 +63,7 @@ public class Link extends ACSObject {
|
|||
public static final String EXTERNAL_LINK = "externalLink";
|
||||
public static final String INTERNAL_LINK = "internalLink";
|
||||
/** PDL property "targetURI" */
|
||||
public static final String TARGET_URI ="targetURI";
|
||||
public static final String TARGET_URI = "targetURI";
|
||||
/** PDL property "targetItem" */
|
||||
public static final String TARGET_ITEM = "targetItem";
|
||||
/** PDL property "targetWindow" */
|
||||
|
|
@ -69,16 +72,15 @@ public class Link extends ACSObject {
|
|||
public static final String DESCRIPTION = "linkDescription";
|
||||
/** PDL property "order" */
|
||||
public static final String ORDER = "linkOrder";
|
||||
|
||||
/** Data object type for this domain object */
|
||||
public static final String BASE_DATA_OBJECT_TYPE
|
||||
= "com.arsdigita.cms.contenttypes.Link";
|
||||
public static final String BASE_DATA_OBJECT_TYPE =
|
||||
"com.arsdigita.cms.contenttypes.Link";
|
||||
|
||||
/**
|
||||
* Default constructor. This creates a new Link.
|
||||
*/
|
||||
public Link() {
|
||||
this( BASE_DATA_OBJECT_TYPE );
|
||||
this(BASE_DATA_OBJECT_TYPE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -89,9 +91,9 @@ public class Link extends ACSObject {
|
|||
* @param id The <code>id</code> for the retrieved
|
||||
* <code>DataObject</code>
|
||||
*/
|
||||
public Link( BigDecimal id )
|
||||
throws DataObjectNotFoundException {
|
||||
this( new OID( BASE_DATA_OBJECT_TYPE, id ) );
|
||||
public Link(BigDecimal id)
|
||||
throws DataObjectNotFoundException {
|
||||
this(new OID(BASE_DATA_OBJECT_TYPE, id));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -102,9 +104,9 @@ public class Link extends ACSObject {
|
|||
* @param oid The <code>OID</code> for the retrieved
|
||||
* <code>DataObject</code>
|
||||
*/
|
||||
public Link( OID id )
|
||||
throws DataObjectNotFoundException {
|
||||
super( id );
|
||||
public Link(OID id)
|
||||
throws DataObjectNotFoundException {
|
||||
super(id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -114,8 +116,8 @@ public class Link extends ACSObject {
|
|||
* @param obj The <code>DataObject</code> with which to create or
|
||||
* load a content item
|
||||
*/
|
||||
public Link( DataObject obj ) {
|
||||
super( obj );
|
||||
public Link(DataObject obj) {
|
||||
super(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -125,29 +127,26 @@ public class Link extends ACSObject {
|
|||
* @param type The <code>String</code> data object type of the
|
||||
* item to create
|
||||
*/
|
||||
public Link( String type ) {
|
||||
super( type );
|
||||
public Link(String type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the title of this <code>Link</code>
|
||||
*
|
||||
* @return The Link title
|
||||
*/
|
||||
public String getTitle() {
|
||||
return (String) get( TITLE );
|
||||
return (String) get(TITLE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the title of this <code>Link</code>
|
||||
*
|
||||
* @param title The Link title
|
||||
*/
|
||||
public void setTitle( String title ) {
|
||||
set( TITLE, title );
|
||||
public void setTitle(String title) {
|
||||
set(TITLE, title);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -166,8 +165,8 @@ public class Link extends ACSObject {
|
|||
* Link.INTERNAL_LINK
|
||||
*/
|
||||
public void setTargetType(String type) {
|
||||
Assert.isTrue(type != null &&
|
||||
(type.equals(EXTERNAL_LINK)||type.equals(INTERNAL_LINK)));
|
||||
Assert.isTrue(type != null && (type.equals(EXTERNAL_LINK) || type.equals(
|
||||
INTERNAL_LINK)));
|
||||
set(TARGET_TYPE, type);
|
||||
}
|
||||
|
||||
|
|
@ -177,7 +176,7 @@ public class Link extends ACSObject {
|
|||
* @return The Target Type
|
||||
*/
|
||||
public String getTargetURI() {
|
||||
return (String) get( TARGET_URI );
|
||||
return (String) get(TARGET_URI);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -185,8 +184,8 @@ public class Link extends ACSObject {
|
|||
*
|
||||
* @param uri The Target URI
|
||||
*/
|
||||
public void setTargetURI( String uri ) {
|
||||
set( TARGET_URI, uri );
|
||||
public void setTargetURI(String uri) {
|
||||
set(TARGET_URI, uri);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -195,8 +194,9 @@ public class Link extends ACSObject {
|
|||
* @return The Target Type
|
||||
*/
|
||||
public ContentItem getTargetItem() {
|
||||
DataObject object = (DataObject)get(TARGET_ITEM);
|
||||
ACSObject acsObject = (ACSObject) DomainObjectFactory.newInstance(object);
|
||||
DataObject object = (DataObject) get(TARGET_ITEM);
|
||||
ACSObject acsObject =
|
||||
(ACSObject) DomainObjectFactory.newInstance(object);
|
||||
|
||||
// Quasimodo: BEGIN
|
||||
// This is part of the patch to make RelatedLink (and Link) multilanguage compatible
|
||||
|
|
@ -205,12 +205,13 @@ public class Link extends ACSObject {
|
|||
// content type
|
||||
ContentItem ci;
|
||||
// If acsObject is instance of ContentBundle
|
||||
if(acsObject instanceof ContentBundle) {
|
||||
if (acsObject instanceof ContentBundle) {
|
||||
// get the negotiated language version of this ContentBundle
|
||||
ci = ((ContentBundle) acsObject).negotiate(DispatcherHelper.getRequest().getLocales());
|
||||
ci = ((ContentBundle) acsObject).negotiate(DispatcherHelper.
|
||||
getRequest().getLocales());
|
||||
} else {
|
||||
// else there are no language versions so just use the acsObject
|
||||
ci = (ContentItem) acsObject;
|
||||
ci = (ContentItem) acsObject;
|
||||
}
|
||||
// Quasimodo: END
|
||||
return ci;
|
||||
|
|
@ -257,11 +258,10 @@ public class Link extends ACSObject {
|
|||
*
|
||||
* @param description the description
|
||||
*/
|
||||
public void setDescription(String description ) {
|
||||
public void setDescription(String description) {
|
||||
set(DESCRIPTION, description);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the link order for this <code>Link</code>
|
||||
*
|
||||
|
|
@ -300,22 +300,47 @@ public class Link extends ACSObject {
|
|||
* @return the Link URI
|
||||
*/
|
||||
public String getInternalOrExternalURI(PageState state) {
|
||||
if (EXTERNAL_LINK.equals(getTargetType()) ) {
|
||||
if (EXTERNAL_LINK.equals(getTargetType())) {
|
||||
return getTargetURI();
|
||||
} else {
|
||||
ContentItem item = getTargetItem();
|
||||
|
||||
if ( item == null ) {
|
||||
s_log.error(getOID() + " is internal link, but has null target item" );
|
||||
return "";
|
||||
if (item == null) {
|
||||
s_log.error(getOID()
|
||||
+ " is internal link, but has null target item");
|
||||
return "";
|
||||
}
|
||||
|
||||
ContentSection section = item.getContentSection();
|
||||
ItemResolver resolver = section.getItemResolver();
|
||||
String url = resolver.generateItemURL(
|
||||
state, item, section, item.getVersion()
|
||||
);
|
||||
return URL.there(state.getRequest(), url).toString();
|
||||
state, item, section, item.getVersion());
|
||||
|
||||
if (getTargetURI().startsWith("&")) {
|
||||
ParameterMap parameters;
|
||||
StringTokenizer tokenizer;
|
||||
|
||||
parameters = new ParameterMap();
|
||||
tokenizer = new StringTokenizer(getTargetURI().substring(
|
||||
1), "&");
|
||||
while (tokenizer.hasMoreTokens()) {
|
||||
String param[] = tokenizer.nextToken().split("=");
|
||||
if (param.length >= 2) {
|
||||
parameters.setParameter(param[0], param[1]);
|
||||
}
|
||||
}
|
||||
|
||||
s_log.debug(
|
||||
String.format(
|
||||
"Internal link with parameters found. Generated URL is: %s",
|
||||
URL.there(state.getRequest(), url,
|
||||
parameters).
|
||||
toString()));
|
||||
return URL.there(state.getRequest(), url, parameters).
|
||||
toString();
|
||||
} else {
|
||||
return URL.there(state.getRequest(), url).toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -331,7 +356,9 @@ public class Link extends ACSObject {
|
|||
public static DataCollection getReferringLinks(ContentItem item) {
|
||||
Session session = SessionManager.getSession();
|
||||
DataCollection links = session.retrieve(BASE_DATA_OBJECT_TYPE);
|
||||
Filter filter = links.addInSubqueryFilter("id", "com.arsdigita.cms.contenttypes.getReferringLinks");
|
||||
Filter filter =
|
||||
links.addInSubqueryFilter("id",
|
||||
"com.arsdigita.cms.contenttypes.getReferringLinks");
|
||||
filter.set("itemID", item.getID());
|
||||
|
||||
return links;
|
||||
|
|
@ -345,8 +372,8 @@ public class Link extends ACSObject {
|
|||
* @throws UnsupportedOperationException
|
||||
*/
|
||||
public void swapWithNext() {
|
||||
throw new UnsupportedOperationException
|
||||
("Not implemented on base Link class. Subclass Link to support this for a specific role");
|
||||
throw new UnsupportedOperationException(
|
||||
"Not implemented on base Link class. Subclass Link to support this for a specific role");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -357,8 +384,8 @@ public class Link extends ACSObject {
|
|||
* @throws UnsupportedOperationException
|
||||
*/
|
||||
public void swapWithPrevious() {
|
||||
throw new UnsupportedOperationException
|
||||
("Not implemented on base Link class. Subclass Link to support this for a specific role");
|
||||
throw new UnsupportedOperationException(
|
||||
"Not implemented on base Link class. Subclass Link to support this for a specific role");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -388,7 +415,6 @@ public class Link extends ACSObject {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Given a dataquery name, returns the (possibly filtered)
|
||||
* DataQuery for use in swapKeys. This implementation does no
|
||||
|
|
@ -413,9 +439,8 @@ public class Link extends ACSObject {
|
|||
* @return the DataOperation
|
||||
*/
|
||||
protected DataOperation getSwapOperation(String operationName) {
|
||||
DataOperation operation = SessionManager.getSession()
|
||||
.retrieveDataOperation
|
||||
(operationName);
|
||||
DataOperation operation = SessionManager.getSession().
|
||||
retrieveDataOperation(operationName);
|
||||
return operation;
|
||||
}
|
||||
|
||||
|
|
@ -425,7 +450,8 @@ public class Link extends ACSObject {
|
|||
* or the previous
|
||||
* @param queryName This is used to find the key with which to swap
|
||||
*/
|
||||
protected void swapKeys(boolean swapNext, String queryName, String operationName) {
|
||||
protected void swapKeys(boolean swapNext, String queryName,
|
||||
String operationName) {
|
||||
|
||||
String methodName = null;
|
||||
if (swapNext) {
|
||||
|
|
@ -434,10 +460,10 @@ public class Link extends ACSObject {
|
|||
methodName = "swapWithPrevious";
|
||||
}
|
||||
|
||||
Assert.isTrue(!isNew(), methodName + " cannot be called on an " +
|
||||
"object that is new");
|
||||
Assert.isTrue(!isNew(), methodName + " cannot be called on an "
|
||||
+ "object that is new");
|
||||
|
||||
Integer currentKey = (Integer)get(ORDER);
|
||||
Integer currentKey = (Integer) get(ORDER);
|
||||
// if the current item is not already ordered, alphabetize
|
||||
// instead the first time. This is instead of having to deal
|
||||
// with an upgrade script.
|
||||
|
|
@ -445,9 +471,9 @@ public class Link extends ACSObject {
|
|||
alphabetize();
|
||||
return;
|
||||
}
|
||||
Assert.isTrue(currentKey != null, methodName + " cannot be " +
|
||||
"called on an object that is not currently in the " +
|
||||
"list");
|
||||
Assert.isTrue(currentKey != null, methodName + " cannot be "
|
||||
+ "called on an object that is not currently in the "
|
||||
+ "list");
|
||||
|
||||
int key = currentKey.intValue();
|
||||
|
||||
|
|
@ -458,17 +484,18 @@ public class Link extends ACSObject {
|
|||
if (swapNext) {
|
||||
otherKey = key + 1;
|
||||
query.addOrder("linkOrder ASC");
|
||||
query.addFilter(query.getFilterFactory()
|
||||
.greaterThan("linkOrder", currentKey, true));
|
||||
query.addFilter(query.getFilterFactory().greaterThan("linkOrder",
|
||||
currentKey,
|
||||
true));
|
||||
} else {
|
||||
otherKey = key - 1;
|
||||
query.addOrder("linkOrder DESC");
|
||||
query.addFilter(query.getFilterFactory()
|
||||
.lessThan("linkOrder", currentKey, true));
|
||||
query.addFilter(query.getFilterFactory().lessThan("linkOrder",
|
||||
currentKey, true));
|
||||
}
|
||||
|
||||
if (query.next()) {
|
||||
otherKey = ((Integer)query.get("linkOrder")).intValue();
|
||||
otherKey = ((Integer) query.get("linkOrder")).intValue();
|
||||
query.close();
|
||||
}
|
||||
|
||||
|
|
@ -489,8 +516,6 @@ public class Link extends ACSObject {
|
|||
* without doing anything useful.
|
||||
*/
|
||||
protected void alphabetize() {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,7 +64,8 @@ import org.apache.log4j.Logger;
|
|||
* @author Nobuko Asakai (nasakai@redhat.com)
|
||||
*/
|
||||
public class LinkPropertyForm extends FormSection
|
||||
implements FormInitListener, FormProcessListener, FormValidationListener, FormSubmissionListener {
|
||||
implements FormInitListener, FormProcessListener, FormValidationListener,
|
||||
FormSubmissionListener {
|
||||
|
||||
private static final Logger s_log = Logger.getLogger(LinkPropertyForm.class);
|
||||
/** Name of this form */
|
||||
|
|
@ -80,6 +81,7 @@ public class LinkPropertyForm extends FormSection
|
|||
private LinkSelectionModel m_linkModel;
|
||||
private SaveCancelSection m_saveCancelSection;
|
||||
private ItemSearchWidget m_itemSearch;
|
||||
private TextField m_itemParams;
|
||||
private ContentType m_contentType;
|
||||
private final String ITEM_SEARCH = "contentItem";
|
||||
|
||||
|
|
@ -92,12 +94,12 @@ public class LinkPropertyForm extends FormSection
|
|||
* Link to work on
|
||||
*/
|
||||
public LinkPropertyForm(ItemSelectionModel itemModel,
|
||||
LinkSelectionModel link) {
|
||||
LinkSelectionModel link) {
|
||||
this(itemModel, link, null);
|
||||
}
|
||||
|
||||
public LinkPropertyForm(ItemSelectionModel itemModel,
|
||||
LinkSelectionModel link, ContentType contentType) {
|
||||
LinkSelectionModel link, ContentType contentType) {
|
||||
super(new ColumnPanel(2));
|
||||
s_log.debug("property form constructor");
|
||||
m_linkModel = link;
|
||||
|
|
@ -127,7 +129,8 @@ public class LinkPropertyForm extends FormSection
|
|||
m_description = new TextArea("description");
|
||||
m_description.setCols(40);
|
||||
m_description.setRows(5);
|
||||
add(new Label(GlobalizationUtil.globalize("cms.contenttypes.ui.description")));
|
||||
add(new Label(GlobalizationUtil.globalize(
|
||||
"cms.contenttypes.ui.description")));
|
||||
|
||||
add(m_description);
|
||||
|
||||
|
|
@ -135,26 +138,46 @@ public class LinkPropertyForm extends FormSection
|
|||
"<script language=\"javascript\">\n"
|
||||
+ "<!-- \n"
|
||||
+ "function toggle_link_fields(status) { \n"
|
||||
+ " document.forms['linkEditForm'].targetURI.disabled = status; \n"
|
||||
+ " document.forms['linkEditForm'].openOption.disabled = status; \n"
|
||||
+ " document.forms['linkEditForm'].contentItem.disabled = !status; \n"
|
||||
+ " document.forms['linkEditForm'].contentItem_search.disabled = !status; \n"
|
||||
+ " document.forms['linkEditForm'].contentItem_clear.disabled = !status; \n"
|
||||
+ "// document.forms['linkEditForm'].targetURI.disabled = status; \n"
|
||||
+ "// document.forms['linkEditForm'].openOption.disabled = status; \n"
|
||||
+ "// document.forms['linkEditForm'].contentItem.disabled = !status; \n"
|
||||
+ "// document.forms['linkEditForm'].contentItem_search.disabled = !status; \n"
|
||||
+ "// document.forms['linkEditForm'].contentItem_clear.disabled = !status; \n"
|
||||
+ "// document.forms['linkEditForm'].itemParams.disabled = !status; \n"
|
||||
+ "}\n"
|
||||
+ "function enableUrlFields() { \n"
|
||||
+ " document.forms['linkEditForm'].targetURI.disabled = false; \n"
|
||||
+ " document.forms['linkEditForm'].openOption.disabled = false; \n"
|
||||
+ " document.forms['linkEditForm'].contentItem.disabled = true; \n"
|
||||
+ " document.forms['linkEditForm'].contentItem_search.disabled = true; \n"
|
||||
+ " //document.forms['linkEditForm'].contentItem_clear.disabled = true; \n"
|
||||
+ " document.forms['linkEditForm'].itemParams.disabled = true; \n"
|
||||
+ "} \n"
|
||||
+ "function enableItemFields() { \n"
|
||||
+ " document.forms['linkEditForm'].targetURI.disabled = true; \n"
|
||||
+ " document.forms['linkEditForm'].openOption.disabled = true; \n"
|
||||
+ " document.forms['linkEditForm'].contentItem.disabled = false; \n"
|
||||
+ " document.forms['linkEditForm'].contentItem_search.disabled = false; \n"
|
||||
+ " //document.forms['linkEditForm'].contentItem_clear.disabled = false; \n"
|
||||
+ " document.forms['linkEditForm'].itemParams.disabled = false; \n"
|
||||
+ "} \n"
|
||||
+ "// -->\n"
|
||||
+ "</script>\n",
|
||||
false));
|
||||
|
||||
add(new Label("Choose either a URL or a Content Item", Label.BOLD),
|
||||
ColumnPanel.FULL_WIDTH);
|
||||
ColumnPanel.FULL_WIDTH);
|
||||
m_linkType = new RadioGroup("linkType");
|
||||
Option m_external = new Option(Link.EXTERNAL_LINK, "URL");
|
||||
m_external.setOnClick("toggle_link_fields(false)");
|
||||
//m_external.setOnClick("toggle_link_fields(false)");
|
||||
m_external.setOnClick("enableUrlFields()");
|
||||
|
||||
Option m_internal = new Option(Link.INTERNAL_LINK, "Content Item");
|
||||
m_internal.setOnClick("toggle_link_fields(true)");
|
||||
//m_internal.setOnClick("toggle_link_fields(true)");
|
||||
m_internal.setOnClick("enableItemFields()");
|
||||
|
||||
Option m_selectWindow = new Option(Link.TARGET_WINDOW, "Open URL in new window");
|
||||
Option m_selectWindow = new Option(Link.TARGET_WINDOW,
|
||||
"Open URL in new window");
|
||||
m_URIOption = new CheckboxGroup("openOption");
|
||||
m_URIOption.addOption(m_selectWindow);
|
||||
|
||||
|
|
@ -168,7 +191,8 @@ public class LinkPropertyForm extends FormSection
|
|||
|
||||
m_targetURI = new TextField("targetURI");
|
||||
m_targetURI.setOnFocus("toggle_link_fields(false)");
|
||||
m_targetURI.setHint("Enter a URL such as http://www.example.com/ or /ccm/forum/");
|
||||
m_targetURI.setHint(
|
||||
"Enter a URL such as http://www.example.com/ or /ccm/forum/");
|
||||
add(new Label("URL: "));
|
||||
add(m_targetURI);
|
||||
|
||||
|
|
@ -178,13 +202,22 @@ public class LinkPropertyForm extends FormSection
|
|||
m_itemSearch.getClearButton().setOnFocus("toggle_link_fields(true)");
|
||||
add(m_itemSearch);
|
||||
|
||||
add(new Label("Parameters"));
|
||||
m_itemParams = new TextField("itemParams");
|
||||
m_itemParams.setOnFocus("toggle_link_fields(true)");
|
||||
m_itemParams.setHint(
|
||||
"Enter parameters for the item URL. Separate items with '&'.");
|
||||
add(m_itemParams);
|
||||
|
||||
add(new Label(
|
||||
"<script language=\"javascript\">\n"
|
||||
+ "<!-- \n"
|
||||
+ "if (document.forms['linkEditForm'].linkType[0].checked) { \n"
|
||||
+ " toggle_link_fields(false); \n"
|
||||
+ " //toggle_link_fields(false); \n"
|
||||
+ " enableUrlFields(); \n"
|
||||
+ "} else { \n"
|
||||
+ " toggle_link_fields(true); \n"
|
||||
+ " //toggle_link_fields(true); \n"
|
||||
+ " enableItemFields(); \n"
|
||||
+ "} \n"
|
||||
+ "// -->\n"
|
||||
+ "</script>\n",
|
||||
|
|
@ -264,7 +297,8 @@ public class LinkPropertyForm extends FormSection
|
|||
// The link is external, the URL must be valid and not null
|
||||
String externalURI = (String) m_targetURI.getValue(state);
|
||||
if (externalURI == null || externalURI.length() == 0) {
|
||||
throw new FormProcessException("The URI field is required for an external link.");
|
||||
throw new FormProcessException(
|
||||
"The URI field is required for an external link.");
|
||||
}
|
||||
|
||||
String url = (String) m_targetURI.getValue(state);
|
||||
|
|
@ -282,7 +316,7 @@ public class LinkPropertyForm extends FormSection
|
|||
// "http://servername" on the front
|
||||
|
||||
newURL = HTTP_PROTOCOL + Web.getConfig().getHost()
|
||||
+ url;
|
||||
+ url;
|
||||
} else if (!hasProtocol) {
|
||||
// There's no protocol. See if it would be ok if we
|
||||
// put one on the beginning
|
||||
|
|
@ -291,7 +325,8 @@ public class LinkPropertyForm extends FormSection
|
|||
} else {
|
||||
// No idea, just throw the error
|
||||
|
||||
throw new FormProcessException("URL is not valid: " + ex.getMessage());
|
||||
throw new FormProcessException("URL is not valid: " + ex.
|
||||
getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
@ -320,13 +355,16 @@ public class LinkPropertyForm extends FormSection
|
|||
// check that's what they intended
|
||||
if (!localLink && !hasProtocol) {
|
||||
m_targetURI.setValue(state, newURL);
|
||||
throw new FormProcessException("A valid URL starts with a protocol, eg http://");
|
||||
throw new FormProcessException(
|
||||
"A valid URL starts with a protocol, eg http://");
|
||||
}
|
||||
}
|
||||
} else if (Link.INTERNAL_LINK.equals((String) m_linkType.getValue(state))) {
|
||||
} else if (Link.INTERNAL_LINK.equals((String) m_linkType.getValue(
|
||||
state))) {
|
||||
// The link is internal, the item selected must be not null
|
||||
if (data.get(ITEM_SEARCH) == null) {
|
||||
throw new FormProcessException("Item selection is required for internal link.");
|
||||
throw new FormProcessException(
|
||||
"Item selection is required for internal link.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -371,8 +409,14 @@ public class LinkPropertyForm extends FormSection
|
|||
try {
|
||||
m_title.setValue(state, link.getTitle());
|
||||
m_description.setValue(state, link.getDescription());
|
||||
m_targetURI.setValue(state, link.getTargetURI());
|
||||
if (com.arsdigita.bebop.Link.NEW_FRAME.equals(link.getTargetWindow())) {
|
||||
if (link.getTargetURI().startsWith("&")) {
|
||||
m_itemParams.setValue(state,
|
||||
link.getTargetURI().substring(1));
|
||||
} else {
|
||||
m_targetURI.setValue(state, link.getTargetURI());
|
||||
}
|
||||
if (com.arsdigita.bebop.Link.NEW_FRAME.equals(link.
|
||||
getTargetWindow())) {
|
||||
m_URIOption.setValue(state, Link.TARGET_WINDOW);
|
||||
} else {
|
||||
m_URIOption.setValue(state, null);
|
||||
|
|
@ -427,7 +471,7 @@ public class LinkPropertyForm extends FormSection
|
|||
//call to set various properties of Link.
|
||||
setLinkProperties(link, fse);
|
||||
s_log.debug("Created Link with ID: " + link.getOID().toString()
|
||||
+ "Title " + link.getTitle());
|
||||
+ "Title " + link.getTitle());
|
||||
}
|
||||
// XXX Initialize the form
|
||||
m_linkModel.clearSelection(state);
|
||||
|
|
@ -453,7 +497,12 @@ public class LinkPropertyForm extends FormSection
|
|||
link.setTargetItem(null);
|
||||
} else {
|
||||
// Internal
|
||||
link.setTargetURI(null);
|
||||
if (((String) m_itemParams.getValue(state)).isEmpty()) {
|
||||
link.setTargetURI(null);
|
||||
} else {
|
||||
link.setTargetURI(String.format("&%s", m_itemParams.getValue(
|
||||
state)));
|
||||
}
|
||||
|
||||
// Quasimodo: BEGIN
|
||||
// This is part of the patch to make RelatedLink (and Link) multilanguage compatible
|
||||
|
|
|
|||
Loading…
Reference in New Issue