[FEATURE]
Paket externalLink hinzugefügt. git-svn-id: https://svn.libreccm.org/ccm/trunk@3256 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
57f77d5944
commit
caa3137509
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0"?>
|
||||
<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project"
|
||||
name="ccm-cms-types-externallink"
|
||||
prettyName="Content Typ externalLink"
|
||||
version="6.6.0"
|
||||
release="1"
|
||||
webapp="ROOT">
|
||||
<ccm:dependencies>
|
||||
<ccm:requires name="ccm-core" version="6.1.1" relation="ge"/>
|
||||
<ccm:requires name="ccm-cms" version="6.1.1" relation="ge"/>
|
||||
</ccm:dependencies>
|
||||
<ccm:directories>
|
||||
<ccm:directory name="pdl"/>
|
||||
<ccm:directory name="sql"/>
|
||||
<ccm:directory name="src"/>
|
||||
</ccm:directories>
|
||||
<ccm:contacts>
|
||||
<ccm:contact uri="http://www.redhat.com/software/rhea" type="website"/>
|
||||
<ccm:contact uri="mailto:rhea@redhat.com" type="support"/>
|
||||
</ccm:contacts>
|
||||
<ccm:description>
|
||||
The Content Typ externalLink for the APLAWS+ CMS.
|
||||
</ccm:description>
|
||||
</ccm:application>
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
//
|
||||
// Copyright (C) 2005 Red Hat Inc. All Rights Reserved.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License
|
||||
// as published by the Free Software Foundation; either version 2.1 of
|
||||
// the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// $Id: EForm.pdl 1494 2007-03-19 14:58:34Z apevec $
|
||||
model com.arsdigita.cms.contenttypes;
|
||||
|
||||
import com.arsdigita.cms.ContentPage;
|
||||
|
||||
object type ExternalLink extends ContentPage {
|
||||
String [0..1] url = ct_extLinks.url VARCHAR(2000);
|
||||
String [0..1] description = ct_extLinks.description;
|
||||
|
||||
reference key (ct_extLinks.extLink_id);
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
--
|
||||
-- Copyright (C) 2005 Red Hat Inc. All Rights Reserved.
|
||||
--
|
||||
-- This library is free software; you can redistribute it and/or
|
||||
-- modify it under the terms of the GNU Lesser General Public License
|
||||
-- as published by the Free Software Foundation; either version 2.1 of
|
||||
-- the License, or (at your option) any later version.
|
||||
--
|
||||
-- This library is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
-- Lesser General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU Lesser General Public
|
||||
-- License along with this library; if not, write to the Free Software
|
||||
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
--
|
||||
-- $Id: oracle-se-create.sql 1494 2007-03-19 14:58:34Z apevec $
|
||||
@ ddl/oracle-se/create.sql
|
||||
@ ddl/oracle-se/deferred.sql
|
||||
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
--
|
||||
-- Copyright (C) 2005 Red Hat Inc. All Rights Reserved.
|
||||
--
|
||||
-- This library is free software; you can redistribute it and/or
|
||||
-- modify it under the terms of the GNU Lesser General Public License
|
||||
-- as published by the Free Software Foundation; either version 2.1 of
|
||||
-- the License, or (at your option) any later version.
|
||||
--
|
||||
-- This library is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
-- Lesser General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU Lesser General Public
|
||||
-- License along with this library; if not, write to the Free Software
|
||||
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
--
|
||||
-- $Id: postgres-create.sql 1494 2007-03-19 14:58:34Z apevec $
|
||||
begin;
|
||||
\i ddl/postgres/create.sql
|
||||
\i ddl/postgres/deferred.sql
|
||||
end;
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ctd:content-types xmlns:ctd="http://xmlns.redhat.com/cms/content-types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.redhat.com/cms/content-types content-types.xsd">
|
||||
|
||||
<ctd:content-type label="URL Redirect"
|
||||
description="An item representing an external web application"
|
||||
objectType="com.arsdigita.cms.contenttypes.ExternalLink"
|
||||
classname="com.arsdigita.cms.contenttypes.ExternalLink">
|
||||
|
||||
<ctd:authoring-kit createComponent="com.arsdigita.cms.ui.authoring.PageCreate">
|
||||
|
||||
<ctd:authoring-step labelKey="cms.contenttypes.shared.basic_properties.title"
|
||||
labelBundle="com.arsdigita.cms.CMSResources"
|
||||
descriptionKey="cms.contenttypes.shared.basic_properties.description"
|
||||
descriptionBundle="com.arsdigita.cms.CMSResources"
|
||||
component="com.arsdigita.cms.contenttypes.ui.ExternalLinkPropertiesStep"
|
||||
ordering="1"/>
|
||||
|
||||
<ctd:include href="/WEB-INF/content-types/assign-categories-step.xml"/>
|
||||
|
||||
<!-- Replaced by the include above
|
||||
<ctd:authoring-step label="Assign categories"
|
||||
description="Assign categories"
|
||||
component="com.arsdigita.cms.ui.authoring.ItemCategoryStep"
|
||||
ordering="2"/>-->
|
||||
|
||||
</ctd:authoring-kit>
|
||||
</ctd:content-type>
|
||||
</ctd:content-types>
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
|
||||
xmlns:define="/WEB-INF/bebop-define.tld"
|
||||
xmlns:show="/WEB-INF/bebop-show.tld"
|
||||
version="1.2">
|
||||
<jsp:directive.page import="com.arsdigita.camden.cms.contenttypes.EForm"/>
|
||||
<jsp:directive.page import="com.arsdigita.cms.CMS"/>
|
||||
<jsp:directive.page import="com.arsdigita.cms.CMSContext"/>
|
||||
<jsp:scriptlet>
|
||||
CMSContext ctx = CMS.getContext();
|
||||
if (ctx.hasContentItem()) {
|
||||
EForm eform = (EForm) ctx.getContentItem();
|
||||
String url = eform.getURL();
|
||||
if (url != null && url.length() > 0) {
|
||||
response.sendRedirect(url);
|
||||
}
|
||||
}
|
||||
</jsp:scriptlet>
|
||||
</jsp:root>
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
<%@page import="com.arsdigita.camden.cms.contenttypes.EForm,com.arsdigita.cms.CMS,com.arsdigita.cms.CMSContext" %>
|
||||
<%
|
||||
CMSContext ctx = CMS.getContext();
|
||||
if (ctx.hasContentItem()) {
|
||||
EForm eform = (EForm) ctx.getContentItem();
|
||||
String url = eform.getURL();
|
||||
String title = eform.getTitle();
|
||||
if (url != null && url.length() > 0) {
|
||||
%>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="1;url=<%= url %>"/>
|
||||
</head>
|
||||
<body>
|
||||
<a href="<%= url %>"><%= title %></a>
|
||||
</body>
|
||||
</html>
|
||||
<%
|
||||
}
|
||||
}
|
||||
%>
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<registry>
|
||||
<!-- nothing yet -->
|
||||
</registry>
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<load>
|
||||
<requires>
|
||||
<table name="inits"/>
|
||||
<table name="acs_objects"/>
|
||||
<table name="cms_items"/>
|
||||
<initializer class="com.arsdigita.cms.Initializer"/>
|
||||
</requires>
|
||||
<provides>
|
||||
<table name="ct_extLinks"/>
|
||||
<initializer class="com.arsdigita.cms.contenttypes.ExternalLinkInitializer"/>
|
||||
</provides>
|
||||
<scripts>
|
||||
<schema directory="ccm-cms-types-externallink"/>
|
||||
<data class="com.arsdigita.cms.contenttypes.ExternalLinkLoader"/>
|
||||
</scripts>
|
||||
</load>
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
<upgrade>
|
||||
</upgrade>
|
||||
|
|
@ -0,0 +1,147 @@
|
|||
/*
|
||||
* Copyright (C) 2005 Red Hat Inc. All Rights Reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
package com.arsdigita.camden.cms.contenttypes;
|
||||
|
||||
import com.arsdigita.cms.ContentPage;
|
||||
import com.arsdigita.cms.ContentType;
|
||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import com.arsdigita.persistence.OID;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
||||
/**
|
||||
* This content type represents an redirect to an external form or an other resource identified by
|
||||
* an URL.
|
||||
*
|
||||
* The item stores a description text about the form/resource and an URL.
|
||||
*
|
||||
* @version $Id: EForm.java 2570 2013-11-19 12:49:34Z jensp $
|
||||
*/
|
||||
public class EForm extends ContentPage {
|
||||
|
||||
/**
|
||||
* PDL property name for definition
|
||||
*/
|
||||
public static final String URL = "url";
|
||||
public static final String DESCRIPTION = "description";
|
||||
|
||||
/**
|
||||
* Data object type for this domain object
|
||||
*/
|
||||
public static final String BASE_DATA_OBJECT_TYPE
|
||||
= "com.arsdigita.camden.cms.contenttypes.EForm";
|
||||
/**
|
||||
* Data object type for this domain object (for CMS compatibility)
|
||||
*/
|
||||
public static final String TYPE = BASE_DATA_OBJECT_TYPE;
|
||||
|
||||
/**
|
||||
* Default Constructor. Creates a new eForm item.
|
||||
*/
|
||||
public EForm() {
|
||||
this(BASE_DATA_OBJECT_TYPE);
|
||||
try {
|
||||
setContentType(ContentType.findByAssociatedObjectType(BASE_DATA_OBJECT_TYPE));
|
||||
} catch (DataObjectNotFoundException ex) {
|
||||
throw new UncheckedWrapperException("EForm type not registered", ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an eForm object for an item in the database.
|
||||
*
|
||||
* @param id The id of the eForm to retrieve from the database.
|
||||
*
|
||||
* @throws DataObjectNotFoundException
|
||||
*/
|
||||
public EForm(final BigDecimal id) throws DataObjectNotFoundException {
|
||||
this(new OID(BASE_DATA_OBJECT_TYPE, id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an eForm object for an item in the database.
|
||||
*
|
||||
* @param oid The {@link OID} of the item to retrieve from the database.
|
||||
*
|
||||
* @throws DataObjectNotFoundException
|
||||
*/
|
||||
public EForm(final OID oid)
|
||||
throws DataObjectNotFoundException {
|
||||
super(oid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps an {@link DataObject} into an {@code EForm} domain object.
|
||||
*
|
||||
* @param obj
|
||||
*/
|
||||
public EForm(final DataObject obj) {
|
||||
super(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new domain object for an subtype of EForm.
|
||||
*
|
||||
* @param type
|
||||
*/
|
||||
public EForm(final String type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the target URL for this e-Form object.
|
||||
*
|
||||
* @return The URL to redirect to.
|
||||
*/
|
||||
public String getURL() {
|
||||
return (String) get(URL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the target URL for this e-Form object.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public void setURL(final String url) {
|
||||
set(URL, url);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the description for the resource the URL is pointing to.
|
||||
*
|
||||
*
|
||||
* @return Description about the URL this EForm is redirecting to.
|
||||
*/
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return (String) get(DESCRIPTION);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the description for this e-Form object.
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public void setDescription(final String description) {
|
||||
set(DESCRIPTION, description);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright (C) 2005 Red Hat Inc. All Rights Reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
package com.arsdigita.camden.cms.contenttypes;
|
||||
|
||||
import com.arsdigita.cms.contenttypes.ContentTypeInitializer;
|
||||
|
||||
/**
|
||||
* Runtime initialization for the eForm content type, executes at each
|
||||
* system startup.
|
||||
*
|
||||
* Just uses the super class methods.
|
||||
*
|
||||
* This is done by runtimeRuntime startup method which runs the init() methods
|
||||
* of all initializers (this one just using the parent implementation).
|
||||
*
|
||||
* @author Alan Pevec
|
||||
* @version $Id: EFormInitializer.java 2570 2013-11-19 12:49:34Z jensp $
|
||||
*/
|
||||
public class EFormInitializer extends ContentTypeInitializer {
|
||||
|
||||
/**
|
||||
* Constructor, just sets the PDL manifest file and object type string.
|
||||
*/
|
||||
public EFormInitializer() {
|
||||
super("ccm-lbc-eforms.pdl.mf",
|
||||
EForm.BASE_DATA_OBJECT_TYPE);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,105 @@
|
|||
/*
|
||||
* Copyright (C) 2005 Red Hat Inc. All Rights Reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
package com.arsdigita.camden.cms.contenttypes;
|
||||
|
||||
import com.arsdigita.cms.ContentSection;
|
||||
import com.arsdigita.cms.ContentType;
|
||||
import com.arsdigita.cms.contenttypes.AbstractContentTypeLoader;
|
||||
import com.arsdigita.cms.lifecycle.LifecycleDefinition;
|
||||
import com.arsdigita.util.parameter.Parameter;
|
||||
import com.arsdigita.util.parameter.ResourceParameter;
|
||||
import com.arsdigita.workflow.simple.WorkflowTemplate;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* Loader executes nonrecurring once at install time and loads the e-Form contenttype package
|
||||
* persistently into database.
|
||||
*
|
||||
* It uses the base class to create the database schema and the required table entries for the
|
||||
* contenttype.
|
||||
*
|
||||
* NOTE: Configuration parameters used at load time MUST be part of Loader class and can not
|
||||
* delegated to a Config object (derived from AbstractConfig). They will (and can) not be persisted
|
||||
* into an registry object (file).
|
||||
*
|
||||
* @author Alan Pevec
|
||||
* @version $Id: EFormLoader.java 2570 2013-11-19 12:49:34Z jensp $
|
||||
*/
|
||||
public class EFormLoader extends AbstractContentTypeLoader {
|
||||
|
||||
/**
|
||||
* Defines the xml file containing the EForm content types property definitions.
|
||||
*/
|
||||
private static final String[] TYPES = {
|
||||
"/WEB-INF/content-types/com/arsdigita/camden/cms/contenttypes/EForm.xml"
|
||||
};
|
||||
|
||||
/**
|
||||
* Configures a special default template to register at install time.
|
||||
*/
|
||||
private final Parameter m_template = new ResourceParameter(
|
||||
"com.arsdigita.camden.cms.contenttypes.eform.defaulttemplate",
|
||||
Parameter.REQUIRED,
|
||||
"/WEB-INF/content-types/com/arsdigita/camden/cms/contenttypes/eform-item.jsp");
|
||||
|
||||
/**
|
||||
* Constructor, just registers Loader parameter.
|
||||
*/
|
||||
public EFormLoader() {
|
||||
register(m_template);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides the of EForm contenttype property definitions.
|
||||
*
|
||||
* The file defines the types name as displayed in content center select box and the authoring
|
||||
* steps. These are loaded into database.
|
||||
*
|
||||
* Implements the method of the parent class.
|
||||
*
|
||||
* @return String array of fully qualified file names
|
||||
*/
|
||||
@Override
|
||||
public String[] getTypes() {
|
||||
return TYPES;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overwrites base class to register its own specific default template.
|
||||
*
|
||||
* @param section
|
||||
* @param type
|
||||
* @param ld
|
||||
* @param wf
|
||||
*/
|
||||
@Override
|
||||
protected void prepareSection(final ContentSection section,
|
||||
final ContentType type,
|
||||
final LifecycleDefinition ld,
|
||||
final WorkflowTemplate wf) {
|
||||
super.prepareSection(section, type, ld, wf);
|
||||
|
||||
setDefaultTemplate("EFormDefaultTemplate",
|
||||
"eform-item",
|
||||
(InputStream) get(m_template),
|
||||
section, type, ld, wf);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
# EventResources.properties
|
||||
#
|
||||
eform.authoring.basic_properties.description=Edit the title, name, location (URL), and description
|
||||
#
|
||||
camden.cms.contenttypes.eform.name=Name (URL):
|
||||
camden.cms.contenttypes.eform.title=Title:
|
||||
#
|
||||
camden.cms.contenttypes.eform.description=Form description:
|
||||
camden.cms.contenttypes.eform.location=Location (remote URL):
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
# EventResources_de.properties
|
||||
# Alle deutschem Umlaute muessen als UTF-8 eingetragen werden:
|
||||
eform.authoring.basic_properties.description=Bearbeitung des Titels, Namens, Ort (URL) und Beschreibung
|
||||
#
|
||||
# useless here, must be transferred to CMSResources
|
||||
#
|
||||
camden.cms.contenttypes.eform.name=Name (URL):
|
||||
camden.cms.contenttypes.eform.title=Titel:
|
||||
#
|
||||
camden.cms.contenttypes.eform.description=Formularbeschreibung:
|
||||
camden.cms.contenttypes.eform.location=Ort (Ziel URL):
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
# EventResources.properties
|
||||
#
|
||||
eform.authoring.basic_properties.description=Edit the title, name, location (URL), and description
|
||||
#
|
||||
camden.cms.contenttypes.eform.name=Name (URL):
|
||||
camden.cms.contenttypes.eform.title=Title:
|
||||
#
|
||||
camden.cms.contenttypes.eform.description=Additional date description:
|
||||
camden.cms.contenttypes.eform.location=Location (remote URL):
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* Copyright (C) 2005 Red Hat Inc. All Rights Reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
package com.arsdigita.camden.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.bebop.Component;
|
||||
import com.arsdigita.camden.cms.contenttypes.EForm;
|
||||
import com.arsdigita.camden.cms.contenttypes.util.EFormGlobalizedMsg;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
||||
import com.arsdigita.cms.ui.authoring.BasicPageForm;
|
||||
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
||||
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
||||
import com.arsdigita.cms.util.GlobalizationUtil;
|
||||
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
|
||||
|
||||
/**
|
||||
* Authoring step to view/edit the simple attributes of the EForm content type (and its subclasses).
|
||||
*/
|
||||
public class EFormPropertiesStep extends SimpleEditStep {
|
||||
|
||||
/**
|
||||
* The name of the editing sheet added to this step
|
||||
*/
|
||||
public static final String EDIT_SHEET_NAME = "edit";
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param itemModel
|
||||
* @param parent
|
||||
*/
|
||||
public EFormPropertiesStep(final ItemSelectionModel itemModel,
|
||||
final AuthoringKitWizard parent) {
|
||||
super(itemModel, parent);
|
||||
|
||||
final BasicPageForm editSheet = new EFormPropertyForm(itemModel);
|
||||
add(EDIT_SHEET_NAME,
|
||||
GlobalizationUtil.globalize("cms.ui.edit"),
|
||||
new WorkflowLockedComponentAccess(editSheet, itemModel),
|
||||
editSheet.getSaveCancelSection().getCancelButton());
|
||||
|
||||
setDisplayComponent(getEFormPropertySheet(itemModel));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a component that displays the properties of the EForm content item specified by the
|
||||
* ItemSelectionModel passed in.
|
||||
*
|
||||
* @param itemModel The ItemSelectionModel to use
|
||||
*
|
||||
* @pre itemModel != null
|
||||
* @return A component to display the state of the basic properties of the release
|
||||
*
|
||||
* Method add deprecated, use add(GlobalizedMessage label, String attribute) instead (but
|
||||
* probably Camden doesn't use globalized strings).
|
||||
*/
|
||||
public static Component getEFormPropertySheet(final ItemSelectionModel itemModel) {
|
||||
|
||||
final DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel);
|
||||
|
||||
sheet.add(EFormGlobalizedMsg.getName(), EForm.NAME);
|
||||
sheet.add(EFormGlobalizedMsg.getTitle(), EForm.TITLE);
|
||||
sheet.add(EFormGlobalizedMsg.getLocation(), EForm.URL);
|
||||
sheet.add(EFormGlobalizedMsg.getDescription(), EForm.DESCRIPTION);
|
||||
|
||||
return sheet;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
/*
|
||||
* Copyright (C) 2005 Red Hat Inc. All Rights Reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
package com.arsdigita.camden.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.bebop.Label;
|
||||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.bebop.event.FormInitListener;
|
||||
import com.arsdigita.bebop.event.FormProcessListener;
|
||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||
import com.arsdigita.bebop.form.TextArea;
|
||||
import com.arsdigita.bebop.form.TextField;
|
||||
import com.arsdigita.camden.cms.contenttypes.EForm;
|
||||
import com.arsdigita.camden.cms.contenttypes.util.EFormGlobalizedMsg;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.ui.authoring.BasicPageForm;
|
||||
|
||||
/**
|
||||
* Form to edit the basic properties of an EForm.
|
||||
*
|
||||
* Used by <code>EFormPropertiesStep</code> authoring kit step.
|
||||
* <br />
|
||||
* This form can be extended to create forms for EForm subclasses.
|
||||
*/
|
||||
public class EFormPropertyForm extends BasicPageForm
|
||||
implements FormProcessListener, FormInitListener {
|
||||
|
||||
/**
|
||||
* Name of this form
|
||||
*/
|
||||
public static final String ID = "eform_edit"; // formerly "eFormEdit"
|
||||
|
||||
private TextField url;
|
||||
private TextArea description;
|
||||
|
||||
/**
|
||||
* Creates a new form to edit the EForm object specified by the item selection model passed in.
|
||||
*
|
||||
* @param itemModel The ItemSelectionModel to use to obtain the EForm to work on
|
||||
*/
|
||||
public EFormPropertyForm(final ItemSelectionModel itemModel) {
|
||||
super(ID, itemModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds widgets to the forms basic properties (name and title).
|
||||
*/
|
||||
@Override
|
||||
protected void addWidgets() {
|
||||
super.addWidgets();
|
||||
|
||||
add(new Label(EFormGlobalizedMsg.getLocation()));
|
||||
url = new TextField(EForm.URL);
|
||||
url.setSize(40);
|
||||
add(url);
|
||||
|
||||
add(new Label(EFormGlobalizedMsg.getDescription()));
|
||||
description = new TextArea(EForm.DESCRIPTION, 5, 40, TextArea.SOFT);
|
||||
add(description);
|
||||
}
|
||||
|
||||
/**
|
||||
* Form initialisation hook. Fills widgets with data.
|
||||
*
|
||||
* @param fse FormSectionEvent provided by caller
|
||||
*/
|
||||
@Override
|
||||
public void init(final FormSectionEvent fse) {
|
||||
final EForm site = (EForm) super.initBasicWidgets(fse);
|
||||
|
||||
final PageState state = fse.getPageState();
|
||||
url.setValue(state, site.getURL());
|
||||
description.setValue(state, site.getDescription());
|
||||
}
|
||||
|
||||
/**
|
||||
* Form processing hook. Saves EForm object.
|
||||
*
|
||||
* @param fse
|
||||
*/
|
||||
@Override
|
||||
public void process(final FormSectionEvent fse) {
|
||||
final EForm site = (EForm) super.processBasicWidgets(fse);
|
||||
|
||||
final PageState state = fse.getPageState();
|
||||
// save only if save button was pressed
|
||||
if (site != null
|
||||
&& getSaveCancelSection().getSaveButton().isSelected(state)) {
|
||||
site.setURL((String) url.getValue(state));
|
||||
site.setDescription((String) description.getValue(state));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
* Copyright (C) 2013 University of Bremen. All Rights Reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
package com.arsdigita.camden.cms.contenttypes.util;
|
||||
|
||||
import com.arsdigita.globalization.Globalized;
|
||||
import com.arsdigita.globalization.GlobalizedMessage;
|
||||
|
||||
/**
|
||||
* Compilation of methods to simplify the handling of globalizing keys.
|
||||
* Basically it adds the name of package's resource bundle files to the
|
||||
* globalize methods and forwards to GlobalizedMessage, shortening the
|
||||
* method invocation in the various application classes.
|
||||
*
|
||||
* @author pb
|
||||
*/
|
||||
public class EFormGlobalizedMsg implements Globalized {
|
||||
|
||||
/** Name of Java resource files to handle CMS's globalisation. */
|
||||
final public static String BUNDLE_NAME =
|
||||
"com.arsdigita.camden.cms.contenttypes.EFormResources";
|
||||
|
||||
/**
|
||||
* This returns a localized globalized message for the NAME entry field
|
||||
* using the type specific bundle, BUNDLE_NAME
|
||||
*/
|
||||
public static GlobalizedMessage getTitle() {
|
||||
return new GlobalizedMessage(
|
||||
"camden.cms.contenttypes.eform.title",
|
||||
BUNDLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* This returns a localized globalized message for the NAME entry field
|
||||
* using the type specific bundle, BUNDLE_NAME
|
||||
*/
|
||||
public static GlobalizedMessage getLocation() {
|
||||
return new GlobalizedMessage(
|
||||
"camden.cms.contenttypes.eform.location",
|
||||
BUNDLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* This returns a localized globalized message for the NAME entry field
|
||||
* using the type specific bundle, BUNDLE_NAME
|
||||
*/
|
||||
public static GlobalizedMessage getDescription() {
|
||||
return new GlobalizedMessage(
|
||||
"camden.cms.contenttypes.eform.description",
|
||||
BUNDLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* This returns a localized globalized message for the NAME entry field
|
||||
* using the type specific bundle, BUNDLE_NAME
|
||||
*/
|
||||
public static GlobalizedMessage getName() {
|
||||
return new GlobalizedMessage(
|
||||
"camden.cms.contenttypes.eform.name",
|
||||
BUNDLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* This returns a localized globalized message based on its key and using
|
||||
* the type specific bundle, BUNDLE_NAME
|
||||
*/
|
||||
public static GlobalizedMessage get(String key) {
|
||||
|
||||
return new GlobalizedMessage(key, BUNDLE_NAME);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -243,7 +243,7 @@ public class ResourceTypeConfig {
|
|||
PageState state = e.getPageState();
|
||||
|
||||
if (m_buttons.getCancelButton().isSelected(state)) {
|
||||
fireCompletionEvent(state)
|
||||
fireCompletionEvent(state);
|
||||
throw new FormProcessException(KernelGlobalizationUtil.globalize(
|
||||
"kernel.cancelled"));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue