Verbesserung Lokalisierung bei formitem/formsection. Teil von Ticket #1736.

git-svn-id: https://svn.libreccm.org/ccm/trunk@2237 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2013-07-01 06:38:30 +00:00
parent 2d926e350f
commit 43c5f627d1
54 changed files with 989 additions and 868 deletions

View File

@ -1,7 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?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-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="Form" description="Dynamically constructed data entry forms" objectType="com.arsdigita.cms.formbuilder.FormItem" classname="com.arsdigita.cms.formbuilder.FormItem"> <ctd:content-type label="Form" description="Dynamically constructed data entry forms" objectType="com.arsdigita.cms.formbuilder.FormItem" classname="com.arsdigita.cms.formbuilder.FormItem">
<ctd:authoring-kit createComponent="com.arsdigita.cms.ui.authoring.PageCreate">
<ctd:authoring-kit createComponent="com.arsdigita.cms.ui.authoring.PageCreate">
<ctd:authoring-step <ctd:authoring-step
labelKey="cms.contenttypes.shared.basic_properties.title" labelKey="cms.contenttypes.shared.basic_properties.title"
labelBundle="com.arsdigita.cms.CMSResources" labelBundle="com.arsdigita.cms.CMSResources"
@ -25,5 +28,6 @@
<ctd:include href="/WEB-INF/content-types/shared.xml"/> <ctd:include href="/WEB-INF/content-types/shared.xml"/>
</ctd:authoring-kit> </ctd:authoring-kit>
</ctd:content-type> </ctd:content-type>
</ctd:content-types> </ctd:content-types>

View File

@ -0,0 +1,55 @@
/*
* Copyright (C) 2004 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.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 <a href="mailto:randyg@arsdigita.com">randyg@arsdigita.com</a>
* @version $Revision: #4 $ $Date: 2004/08/17 $
*/
public class FormItemGlobalizationUtil implements Globalized {
/** Name of Java resource files to handle FormItem's globalisation. */
final public static String BUNDLE_NAME =
"com.arsdigita.cms.formbuilder.FormItemResources";
/**
* This returns a globalized message using the package specific bundle,
* provided by BUNDLE_NAME.
*/
public static GlobalizedMessage globalize(String key) {
return new GlobalizedMessage(key, BUNDLE_NAME);
}
/**
* Returns a globalized message object, using the package specific bundle,
* as specified by BUNDLE_NAME. Also takes in an Object[] of arguments to
* interpolate into the retrieved message using the MessageFormat class.
*/
public static GlobalizedMessage globalize(String key, Object[] args) {
return new GlobalizedMessage(key, BUNDLE_NAME, args);
}
}

View File

@ -1,4 +1,11 @@
form_item.authoring.controls.description=Edit the controls present on the form form_item.authoring.controls.description=Edit the controls present on the form
form_item.authoring.controls.title=Controls form_item.authoring.controls.title=Edit Form Controls
form_item.authoring.actions.description=Edit the form submission actions form_item.authoring.actions.description=Edit the form submission actions
form_item.authoring.actions.title=Actions form_item.authoring.actions.title=Edit Form Actions
cms.contenttypes.ui.form_item.form_mode_label=Form mode:
cms.contenttypes.ui.form_item.form_mode_local=Local
cms.contenttypes.ui.form_item.form_mode_remote=Remote
cms.contenttypes.ui.form_item.remote_url_label=Remote URL:
cms.contenttypes.ui.form_item.empty=(empty)
cms.contenttypes.ui.form_item.submit_label=Submit
cms.contenttypes.ui.form_item.oh_no_you_dont=Oh no you don't

View File

@ -1,4 +1,11 @@
form_item.authoring.controls.description=Elemente des Formulars editieren form_item.authoring.controls.description=Kontrollelemente des Formulars bearbeiten
form_item.authoring.controls.title=Controls form_item.authoring.controls.title=Formularelemente bearbeiten
form_item.authoring.actions.description=Editieren der Aktionen des Formulars form_item.authoring.actions.description=Editieren der Aktionen des Formulars
form_item.authoring.actions.title=Aktionen form_item.authoring.actions.title=Formular Aktionen bearbeiten
cms.contenttypes.ui.form_item.form_mode_label=Formularmodus:
cms.contenttypes.ui.form_item.form_mode_local=Lokal
cms.contenttypes.ui.form_item.form_mode_remote=Entfernt
cms.contenttypes.ui.form_item.remote_url_label=Entfernte URL:
cms.contenttypes.ui.form_item.empty=(leer)
cms.contenttypes.ui.form_item.submit_label=Ausf\u00fchren
cms.contenttypes.ui.form_item.oh_no_you_dont=Nein, das wollen sie nicht

View File

@ -0,0 +1,11 @@
form_item.authoring.controls.description=Edit the controls present on the form
form_item.authoring.controls.title=Edit Form Controls
form_item.authoring.actions.description=Edit the form submission actions
form_item.authoring.actions.title=Edit Form Actions
cms.contenttypes.ui.form_item.form_mode_label=Form mode:
cms.contenttypes.ui.form_item.form_mode_local=Local
cms.contenttypes.ui.form_item.form_mode_remote=Remote
cms.contenttypes.ui.form_item.remote_url_label=Remote URL:
cms.contenttypes.ui.form_item.empty=(empty)
cms.contenttypes.ui.form_item.submit_label=Submit
cms.contenttypes.ui.form_item.oh_no_you_dont=non, vous ne pouvez pas

View File

@ -37,15 +37,24 @@ import com.arsdigita.bebop.form.Option;
import com.arsdigita.bebop.form.RadioGroup; import com.arsdigita.bebop.form.RadioGroup;
import com.arsdigita.bebop.form.Submit; import com.arsdigita.bebop.form.Submit;
import com.arsdigita.bebop.form.TextField; import com.arsdigita.bebop.form.TextField;
import com.arsdigita.cms.contenttypes.util.FormItemGlobalizationUtil;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.formbuilder.FormItem; import com.arsdigita.cms.formbuilder.FormItem;
import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard; import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
import com.arsdigita.formbuilder.ui.ProcessListenerEditor; import com.arsdigita.formbuilder.ui.ProcessListenerEditor;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/**
*
*
*/
public class FormActions extends ProcessListenerEditor { public class FormActions extends ProcessListenerEditor {
private Form m_lrForm; private Form m_lrForm;
@ -60,17 +69,32 @@ public class FormActions extends ProcessListenerEditor {
private static final Logger s_log = private static final Logger s_log =
Logger.getLogger(FormActions.class); Logger.getLogger(FormActions.class);
/**
* Constructor.
*
* @param model
* @param parent
*/
public FormActions(ItemSelectionModel model, public FormActions(ItemSelectionModel model,
AuthoringKitWizard parent) { AuthoringKitWizard parent) {
super("forms-cms", super("forms-cms", new FormItemSingleSelectionModel(model));
new FormSingleSelectionModel(model));
} }
/**
*
* @param ps
* @return
*/
private FormItem getFormItem(PageState ps) { private FormItem getFormItem(PageState ps) {
return (FormItem) ((FormSingleSelectionModel) m_form).getItemModel().getSelectedItem(ps); return (FormItem) ((FormItemSingleSelectionModel)
m_form).getItemModel().getSelectedItem(ps);
} }
/**
*
*/
@Override
protected void addComponents() { protected void addComponents() {
m_lrForm = new Form("locateRemoteForm", new ColumnPanel(2)); m_lrForm = new Form("locateRemoteForm", new ColumnPanel(2));
@ -81,25 +105,32 @@ public class FormActions extends ProcessListenerEditor {
panel.setColumnWidth(2, "80%"); panel.setColumnWidth(2, "80%");
panel.setWidth("100%"); panel.setWidth("100%");
m_lrForm.add(new Label("Form mode:")); m_lrForm.add(new Label(FormItemGlobalizationUtil.globalize(
"cms.contenttypes.ui.form_item.form_mode_label")) );
m_localRemote = new RadioGroup("remote"); m_localRemote = new RadioGroup("remote");
Option local = new Option(Boolean.FALSE.toString(), "Local"); Option local = new Option(Boolean.FALSE.toString(),
Option remote = new Option(Boolean.TRUE.toString(), "Remote"); new Label(FormItemGlobalizationUtil.globalize(
"cms.contenttypes.ui.form_item.form_mode_local") )
);
Option remote = new Option(Boolean.TRUE.toString(),
new Label(FormItemGlobalizationUtil.globalize(
"cms.contenttypes.ui.form_item.form_mode_remote")) );
m_localRemote.addOption(local); m_localRemote.addOption(local);
m_localRemote.addOption(remote); m_localRemote.addOption(remote);
m_localRemote.setLayout(RadioGroup.VERTICAL); m_localRemote.setLayout(RadioGroup.VERTICAL);
m_lrForm.add(m_localRemote); m_lrForm.add(m_localRemote);
m_remoteLabel = new Label("Remote URL"); m_remoteLabel = new Label(FormItemGlobalizationUtil.globalize(
"cms.contenttypes.ui.form_item.remote_url_label"));
m_lrForm.add(m_remoteLabel); m_lrForm.add(m_remoteLabel);
m_urlEditLink = new SimpleContainer(); m_urlEditLink = new SimpleContainer();
m_urlValue = new Label(); m_urlValue = new Label();
m_urlValue.setOutputEscaping(false); m_urlValue.setOutputEscaping(false);
m_urlEditLink.add(m_urlValue); m_urlEditLink.add(m_urlValue);
m_urlEditLink.add(new Label("&nbsp;", false)); ActionLink edit = new ActionLink(GlobalizationUtil
ActionLink edit = new ActionLink("edit"); .globalize("cms.ui.edit") );
edit.addActionListener(new ActionListener() { edit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
PageState state = e.getPageState(); PageState state = e.getPageState();
@ -114,14 +145,11 @@ public class FormActions extends ProcessListenerEditor {
m_remoteUrl = new TextField("remoteUrl"); m_remoteUrl = new TextField("remoteUrl");
m_lrForm.add(m_remoteUrl); m_lrForm.add(m_remoteUrl);
m_switch = new Submit("submit", "Submit"); m_switch = new Submit("submit",
FormItemGlobalizationUtil.globalize(
"cms.contenttypes.ui.form_item.submit_label") );
m_lrForm.add(m_switch); m_lrForm.add(m_switch);
m_lrForm.add(new Label());
m_lrForm.add(new Label("&nbsp;", false), ColumnPanel.FULL_WIDTH);
m_lrForm.addInitListener(new FormInitListener() { m_lrForm.addInitListener(new FormInitListener() {
public void init(FormSectionEvent e) { public void init(FormSectionEvent e) {
initWidgets(e); initWidgets(e);
@ -138,7 +166,8 @@ public class FormActions extends ProcessListenerEditor {
try { try {
new URL(value); new URL(value);
} catch (MalformedURLException ex) { } catch (MalformedURLException ex) {
data.addError(m_remoteUrl.getName(), "Please enter a valid URL"); data.addError(m_remoteUrl.getName(),
"Please enter a valid URL");
} }
} }
} }
@ -157,6 +186,7 @@ public class FormActions extends ProcessListenerEditor {
super.addComponents(); super.addComponents();
} }
@Override
public void register(Page page) { public void register(Page page) {
super.register(page); super.register(page);
page.setVisibleDefault(m_remoteUrl, false); page.setVisibleDefault(m_remoteUrl, false);
@ -177,6 +207,10 @@ public class FormActions extends ProcessListenerEditor {
initWidgets(e); initWidgets(e);
} }
/**
*
* @param e
*/
protected void initWidgets(FormSectionEvent e) { protected void initWidgets(FormSectionEvent e) {
s_log.debug("initWidgets"); s_log.debug("initWidgets");
PageState state = e.getPageState(); PageState state = e.getPageState();

View File

@ -22,10 +22,10 @@ package com.arsdigita.cms.ui.formbuilder;
import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.Container; import com.arsdigita.bebop.Container;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.SecurityManager; import com.arsdigita.cms.SecurityManager;
import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.cms.formbuilder.FormSectionItem; import com.arsdigita.cms.formbuilder.FormSectionItem;
import com.arsdigita.cms.formbuilder.FormSectionWrapper; import com.arsdigita.cms.formbuilder.FormSectionWrapper;
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard; import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
@ -39,33 +39,65 @@ import com.arsdigita.util.UncheckedWrapperException;
import java.math.BigDecimal; import java.math.BigDecimal;
/**
* Authoring step to edit the formular item's control elements of the FormItem
* content type (and its subclasses).
*
* It delegates completely to formsection and core form service to build and
* process the widgets.
*
*/
public class FormControls extends ControlEditor { public class FormControls extends ControlEditor {
/** */
private ItemSelectionModel m_itemModel; private ItemSelectionModel m_itemModel;
/**
* Constructor.
*
* @param item
* @param parent
*/
public FormControls(ItemSelectionModel item, public FormControls(ItemSelectionModel item,
AuthoringKitWizard parent) { AuthoringKitWizard parent) {
// Create a EditorForm not a formSection
super("forms-cms", super("forms-cms",
new FormSingleSelectionModel(item), true); new FormItemSingleSelectionModel(item), true);
m_itemModel = item; m_itemModel = item;
// Using FormSection capabilities!
setFormSectionModelBuilder(new FormSectionModelBuilder(item)); setFormSectionModelBuilder(new FormSectionModelBuilder(item));
} }
/**
*
* @param container
* @param child
*/
@Override
protected void addEditableComponent(Container container, protected void addEditableComponent(Container container,
Component child) { Component child) {
WorkflowLockedContainer lock = new WorkflowLockedContainer(((FormSingleSelectionModel)getFormModel()).getItemModel()); WorkflowLockedContainer lock = new
WorkflowLockedContainer(((FormItemSingleSelectionModel)getFormModel())
.getItemModel());
lock.add(child); lock.add(child);
super.addEditableComponent(container, lock); super.addEditableComponent(container, lock);
} }
/**
*
* @param state
* @param sectionID
* @return
*/
@Override
protected PersistentComponent getFormSection(PageState state, protected PersistentComponent getFormSection(PageState state,
BigDecimal sectionID) { BigDecimal sectionID) {
FormSectionItem section = null; FormSectionItem section = null;
try { try {
section = (FormSectionItem)DomainObjectFactory.newInstance( section = (FormSectionItem)DomainObjectFactory.newInstance(
new OID(FormSectionItem.BASE_DATA_OBJECT_TYPE, new OID(FormSectionItem.BASE_DATA_OBJECT_TYPE,
sectionID)); sectionID));
} catch (DataObjectNotFoundException ex) { } catch (DataObjectNotFoundException ex) {
throw new UncheckedWrapperException("cannot load section", ex); throw new UncheckedWrapperException("cannot load section", ex);
} }
@ -76,11 +108,16 @@ public class FormControls extends ControlEditor {
return wrapper; return wrapper;
} }
/**
*
* @param state
* @return
*/
@Override
protected boolean addItemEditObserver(PageState state) { protected boolean addItemEditObserver(PageState state) {
return Utilities.getSecurityManager(state).canAccess( return CMS.getSecurityManager(state).canAccess(
state.getRequest(), state.getRequest(),
SecurityManager.EDIT_ITEM, SecurityManager.EDIT_ITEM,
(ContentItem) m_itemModel.getSelectedObject(state)); (ContentItem) m_itemModel.getSelectedObject(state));
} }
} }

View File

@ -25,14 +25,14 @@ import com.arsdigita.bebop.event.ChangeListener;
import com.arsdigita.bebop.parameters.ParameterModel; import com.arsdigita.bebop.parameters.ParameterModel;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.formbuilder.FormItem; import com.arsdigita.cms.formbuilder.FormItem;
import com.arsdigita.cms.util.GlobalizationUtil; import com.arsdigita.cms.contenttypes.util.FormItemGlobalizationUtil;
public class FormSingleSelectionModel extends AbstractSingleSelectionModel { public class FormItemSingleSelectionModel extends AbstractSingleSelectionModel {
private ItemSelectionModel m_item; private ItemSelectionModel m_item;
public FormSingleSelectionModel(ItemSelectionModel item) { public FormItemSingleSelectionModel(ItemSelectionModel item) {
m_item = item; m_item = item;
} }
@ -40,6 +40,7 @@ public class FormSingleSelectionModel extends AbstractSingleSelectionModel {
return m_item; return m_item;
} }
@Override
public boolean isSelected(PageState state) { public boolean isSelected(PageState state) {
return m_item.isSelected(state); return m_item.isSelected(state);
} }
@ -51,22 +52,35 @@ public class FormSingleSelectionModel extends AbstractSingleSelectionModel {
public void setSelectedKey(PageState state, public void setSelectedKey(PageState state,
Object key) { Object key) {
throw new RuntimeException( (String) GlobalizationUtil.globalize("cms.ui.formbuilder.oh_no_you_dont").localize()); throw new RuntimeException( (String) FormItemGlobalizationUtil.globalize(
"cms.contenttypes.ui.form_item.oh_no_you_dont")
.localize());
} }
@Override
public void clearSelection(PageState state) { public void clearSelection(PageState state) {
throw new RuntimeException( (String) GlobalizationUtil.globalize("cms.ui.formbuilder.oh_no_you_dont").localize()); throw new RuntimeException( (String)
FormItemGlobalizationUtil
.globalize("cms.contenttypes.ui.form_item.oh_no_you_dont").localize());
} }
@Override
public void addChangeListener(ChangeListener l) { public void addChangeListener(ChangeListener l) {
throw new RuntimeException( (String) GlobalizationUtil.globalize("cms.ui.formbuilder.oh_no_you_dont").localize()); throw new RuntimeException( (String)
FormItemGlobalizationUtil
.globalize("cms.contenttypes.ui.form_item.oh_no_you_dont").localize());
} }
@Override
public void removeChangeListener(ChangeListener l) { public void removeChangeListener(ChangeListener l) {
throw new RuntimeException( (String) GlobalizationUtil.globalize("cms.ui.formbuilder.oh_no_you_dont").localize()); throw new RuntimeException( (String) FormItemGlobalizationUtil.globalize(
"cms.contenttypes.ui.form_item.oh_no_you_dont")
.localize());
} }
public ParameterModel getStateParameter() { public ParameterModel getStateParameter() {
throw new RuntimeException( (String) GlobalizationUtil.globalize("cms.ui.formbuilder.oh_no_you_dont").localize()); throw new RuntimeException( (String) FormItemGlobalizationUtil.globalize(
"cms.contenttypes.ui.form_item.oh_no_you_dont")
.localize());
} }
} }

View File

@ -42,44 +42,83 @@ import com.arsdigita.domain.DomainObject;
import com.arsdigita.formbuilder.PersistentForm; import com.arsdigita.formbuilder.PersistentForm;
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet; import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
/**
* Authoring step to edit the simple attributes of the FormItem content type
* (and its subclasses). The attributes edited are 'title', 'name', optionally
* 'launchDate' (if configured as active), and 'desciption' / summary.
*
*/
public class FormProperties extends SimpleEditStep { public class FormProperties extends SimpleEditStep {
/** The name of the editing sheet added to this step */ /** The name of the editing sheet for this step */
public static String EDIT_SHEET_NAME = "edit"; public static String EDIT_SHEET_NAME = "edit";
public FormProperties(ItemSelectionModel model, /**
* FormProperties Constructor, creates an empty property step sheet.
*
* @param model
* @param parent
*/
public FormProperties(ItemSelectionModel itemModel,
AuthoringKitWizard parent) { AuthoringKitWizard parent) {
super(model, parent); super(itemModel, parent);
setDefaultEditKey(EDIT_SHEET_NAME); setDefaultEditKey(EDIT_SHEET_NAME);
BasicPageForm editForm = buildEditForm(model); BasicPageForm editForm = buildEditForm(itemModel);
add(EDIT_SHEET_NAME, "Edit", new WorkflowLockedComponentAccess(editForm, model), add(EDIT_SHEET_NAME,
GlobalizationUtil.globalize("cms.ui.edit"),
new WorkflowLockedComponentAccess(editForm, itemModel),
editForm.getSaveCancelSection().getCancelButton()); editForm.getSaveCancelSection().getCancelButton());
setDisplayComponent(buildDisplayComponent(model));
setDisplayComponent(buildDisplayComponent(itemModel));
} }
/**
*
* @param model
* @return
*/
protected BasicPageForm buildEditForm(ItemSelectionModel model) { protected BasicPageForm buildEditForm(ItemSelectionModel model) {
return new FormPropertyEditForm(model, this); return new FormPropertyEditForm(model, this);
} }
/**
*
* @param model
* @return
*/
protected Component buildDisplayComponent(ItemSelectionModel model) { protected Component buildDisplayComponent(ItemSelectionModel model) {
return new FormPropertySheet(model); return new FormPropertySheet(model);
} }
/**
* Internal class to implement an edit form for properties. For most other
* content types this is implemented as a separate (external) public class.
* FormItem just uses the standard properties and relays complete on
* classes of the AP (i.e. specifically CMS and CORE).
*/
protected class FormPropertyEditForm extends BasicPageForm protected class FormPropertyEditForm extends BasicPageForm
implements FormProcessListener, FormInitListener, implements FormProcessListener,
FormSubmissionListener { FormInitListener,
FormSubmissionListener {
private TextArea m_desc; private TextArea m_desc;
private TextField m_css; private TextField m_css;
private FormProperties m_step; private FormProperties m_step;
/**
* Internal class constructor, just creates an empty form.
* @param itemModel
*/
public FormPropertyEditForm(ItemSelectionModel itemModel) { public FormPropertyEditForm(ItemSelectionModel itemModel) {
this(itemModel, null); this(itemModel, null);
} }
/** /**
* Internal class constructor, just creates a form using passed in
* form properties.
*
* @param itemModel the ItemSelectionModel that controls which form * @param itemModel the ItemSelectionModel that controls which form
* to work on * to work on
* @param formProperties The properties step that controls this form. * @param formProperties The properties step that controls this form.
@ -91,29 +130,41 @@ public class FormProperties extends SimpleEditStep {
addSubmissionListener(this); addSubmissionListener(this);
} }
/**
* Fills the (empty) form as created by the constructor with widgets.
*/
@Override
protected void addWidgets() { protected void addWidgets() {
super.addWidgets(); super.addWidgets(); // adds standard properties title,name,launchdate
// add editing the description property
m_desc = new TextArea(new StringParameter("description")); m_desc = new TextArea(new StringParameter("description"));
m_desc.setRows(5); m_desc.setRows(5);
m_desc.setCols(50); m_desc.setCols(50);
add(new Label(GlobalizationUtil add(new Label(GlobalizationUtil
.globalize("cms.ui.formbuilder.description"))); .globalize("cms.contenttypes.ui.description")));
add(m_desc); add(m_desc);
//Css control hidden
/*add(new Label(GlobalizationUtil.globalize("cms.formbuilder.css")));
m_css = new TextField(new StringParameter("css"));
add(m_css);*/
} }
/**
*
* @param e
* @throws FormProcessException
*/
public void init(FormSectionEvent e) public void init(FormSectionEvent e)
throws FormProcessException { throws FormProcessException {
FormItem item = (FormItem)initBasicWidgets(e); FormItem item = (FormItem)initBasicWidgets(e);
} }
/**
* Process the FORM after submit.
*
* @param e
* @throws FormProcessException
*/
public void process(FormSectionEvent e) public void process(FormSectionEvent e)
throws FormProcessException { throws FormProcessException {
FormItem item = (FormItem)processBasicWidgets(e); FormItem item = (FormItem)processBasicWidgets(e);
item.save(); item.save();
@ -122,25 +173,34 @@ public class FormProperties extends SimpleEditStep {
} }
} }
/**
*
* @param e
* @return
*/
@Override
public ContentPage initBasicWidgets(FormSectionEvent e) { public ContentPage initBasicWidgets(FormSectionEvent e) {
FormItem item = (FormItem)super.initBasicWidgets(e); FormItem item = (FormItem)super.initBasicWidgets(e);
PersistentForm form = item.getForm(); PersistentForm form = item.getForm();
m_desc.setValue(e.getPageState(), form.getDescription()); m_desc.setValue(e.getPageState(), form.getDescription());
//Css hidden
//m_css.setValue(e.getPageState(), item.getCSS());
return item; return item;
} }
/**
*
* @param e
* @return
*/
@Override
public ContentPage processBasicWidgets(FormSectionEvent e) { public ContentPage processBasicWidgets(FormSectionEvent e) {
FormItem item = (FormItem)super.processBasicWidgets(e); FormItem item = (FormItem)super.processBasicWidgets(e);
PersistentForm form = item.getForm(); PersistentForm form = item.getForm();
//Css hidden
//item.setCSS((String)m_css.getValue(e.getPageState()));
item.save(); item.save();
form.setAdminName(item.getName()); form.setAdminName(item.getName());
form.setHTMLName(item.getName()); form.setHTMLName(item.getName());
@ -160,24 +220,31 @@ public class FormProperties extends SimpleEditStep {
} }
} }
/**
* Internal class implents a DomainObjectProertySheet containent the
* required widgets for the editin FORM (i.e. title, name, description)
*/
protected class FormPropertySheet extends DomainObjectPropertySheet { protected class FormPropertySheet extends DomainObjectPropertySheet {
public FormPropertySheet(ItemSelectionModel model) { public FormPropertySheet(ItemSelectionModel model) {
super(model); super(model);
add(GlobalizationUtil.globalize("cms.ui.formbuilder.name"), add(GlobalizationUtil.globalize("cms.contenttypes.ui.title"),
ContentPage.NAME);
add(GlobalizationUtil.globalize("cms.ui.formbuilder.title"),
ContentPage.TITLE); ContentPage.TITLE);
add(GlobalizationUtil.globalize("cms.ui.formbuilder.description"), add(GlobalizationUtil.globalize("cms.contenttypes.ui.name"),
"form", new FormFormatter()); ContentPage.NAME);
//Css hidden temporarily add(GlobalizationUtil.globalize("cms.contenttypes.ui.description"),
"form",
//add(GlobalizationUtil.globalize("cms.formbuilder.css"), new FormFormatter());
// FormItem.CSS);
} }
} }
/**
* Provides an AttributeFormatter for the 'description' property to be
* displayed in the property step.
*/
private class FormFormatter implements DomainObjectPropertySheet.AttributeFormatter { private class FormFormatter implements DomainObjectPropertySheet.AttributeFormatter {
ItemSelectionModel m_item; ItemSelectionModel m_item;
public String format(DomainObject item, String attribute, PageState state) { public String format(DomainObject item, String attribute, PageState state) {

View File

@ -1,6 +1,12 @@
<?xml version="1.0" encoding="utf-8"?> <?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-types xmlns:ctd="http://xmlns.redhat.com/cms/content-types"
<ctd:content-type label="Form Section" description="Dynamically constructed data entry forms" objectType="com.arsdigita.cms.formbuilder.FormSectionItem" classname="com.arsdigita.cms.formbuilder.FormSectionItem"> 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="Form Section"
description="Dynamically constructed data entry forms"
objectType="com.arsdigita.cms.formbuilder.FormSectionItem"
classname="com.arsdigita.cms.formbuilder.FormSectionItem">
<ctd:authoring-kit createComponent="com.arsdigita.cms.ui.authoring.PageCreate"> <ctd:authoring-kit createComponent="com.arsdigita.cms.ui.authoring.PageCreate">
<ctd:authoring-step <ctd:authoring-step
@ -25,6 +31,8 @@
component="com.arsdigita.cms.ui.formbuilder.FormSectionActions"/> component="com.arsdigita.cms.ui.formbuilder.FormSectionActions"/>
<ctd:include href="/WEB-INF/content-types/shared.xml"/> <ctd:include href="/WEB-INF/content-types/shared.xml"/>
</ctd:authoring-kit> </ctd:authoring-kit>
</ctd:content-type> </ctd:content-type>
</ctd:content-types> </ctd:content-types>

View File

@ -0,0 +1,55 @@
/*
* Copyright (C) 2004 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.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 <a href="mailto:randyg@arsdigita.com">randyg@arsdigita.com</a>
* @version $Revision: #4 $ $Date: 2004/08/17 $
*/
public class FormSectionGlobalizationUtil implements Globalized {
/** Name of Java resource files to handle FormItem's globalisation. */
final public static String BUNDLE_NAME =
"com.arsdigita.cms.formbuilder.FormSectionItemResources";
/**
* This returns a globalized message using the package specific bundle,
* provided by BUNDLE_NAME.
*/
public static GlobalizedMessage globalize(String key) {
return new GlobalizedMessage(key, BUNDLE_NAME);
}
/**
* Returns a globalized message object, using the package specific bundle,
* as specified by BUNDLE_NAME. Also takes in an Object[] of arguments to
* interpolate into the retrieved message using the MessageFormat class.
*/
public static GlobalizedMessage globalize(String key, Object[] args) {
return new GlobalizedMessage(key, BUNDLE_NAME, args);
}
}

View File

@ -1,4 +1,5 @@
form_section_item.authoring.controls.description=Edit the controls present on the form form_section_item.authoring.controls.description=Edit the controls present on the form
form_section_item.authoring.controls.title=Controls form_section_item.authoring.controls.title=Edit Form Controls
form_section_item.authoring.actions.description=Editieren der Aktionen des Formulars form_section_item.authoring.actions.description=Edit the form actions present on the form
form_section_item.authoring.actions.title=Actions form_section_item.authoring.actions.title=Edit Form Actions
cms.contenttypes.ui.form_section.oh_no_you_dont=Oh no you don't

View File

@ -1,4 +1,5 @@
form_section_item.authoring.controls.description=Elemente des Formulars editieren form_section_item.authoring.controls.description=Elemente des Formulars editieren
form_section_item.authoring.controls.title=Controls form_section_item.authoring.controls.title=Formularelemente bearbeiten
form_section_item.authoring.actions.description=Edit the form submission actions form_section_item.authoring.actions.description=Editieren der Aktionen des Formulars
form_section_item.authoring.actions.title=Aktionen form_section_item.authoring.actions.title=Formularaktionen bearbeiten
cms.contenttypes.ui.form_section.oh_no_you_dont=Nein, das wollen sie nicht

View File

@ -0,0 +1,5 @@
form_section_item.authoring.controls.description=Edit the controls present on the form
form_section_item.authoring.controls.title=Edit Form Controls
form_section_item.authoring.actions.description=Edit the form actions present on the form
form_section_item.authoring.actions.title=Edit Form Actions
cms.contenttypes.ui.form_section.oh_no_you_dont=non, vous ne pouvez pas

View File

@ -23,7 +23,17 @@ import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
import com.arsdigita.formbuilder.ui.ProcessListenerEditor; import com.arsdigita.formbuilder.ui.ProcessListenerEditor;
/**
*
*
*/
public class FormSectionActions extends ProcessListenerEditor { public class FormSectionActions extends ProcessListenerEditor {
/**
* Constructor.
* @param model
* @param parent
*/
public FormSectionActions(ItemSelectionModel model, public FormSectionActions(ItemSelectionModel model,
AuthoringKitWizard parent) { AuthoringKitWizard parent) {
super("forms-cms", super("forms-cms",

View File

@ -22,19 +22,29 @@ package com.arsdigita.cms.ui.formbuilder;
import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.Container; import com.arsdigita.bebop.Container;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.SecurityManager; import com.arsdigita.cms.SecurityManager;
import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard; import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
import com.arsdigita.cms.ui.workflow.WorkflowLockedContainer; import com.arsdigita.cms.ui.workflow.WorkflowLockedContainer;
import com.arsdigita.formbuilder.ui.ControlEditor; import com.arsdigita.formbuilder.ui.ControlEditor;
/**
*
*
*/
public class FormSectionControls extends ControlEditor { public class FormSectionControls extends ControlEditor {
private ItemSelectionModel m_itemModel; private ItemSelectionModel m_itemModel;
/**
* Constructor.
*
* @param item
* @param parent
*/
public FormSectionControls(ItemSelectionModel item, public FormSectionControls(ItemSelectionModel item,
AuthoringKitWizard parent) { AuthoringKitWizard parent) {
@ -44,15 +54,29 @@ public class FormSectionControls extends ControlEditor {
m_itemModel = item; m_itemModel = item;
} }
/**
*
* @param container
* @param child
*/
@Override
protected void addEditableComponent(Container container, protected void addEditableComponent(Container container,
Component child) { Component child) {
WorkflowLockedContainer lock = new WorkflowLockedContainer(((FormSectionSingleSelectionModel)getFormModel()).getItemModel()); WorkflowLockedContainer lock = new
WorkflowLockedContainer(((FormSectionSingleSelectionModel)getFormModel())
.getItemModel());
lock.add(child); lock.add(child);
super.addEditableComponent(container, lock); super.addEditableComponent(container, lock);
} }
/**
*
* @param state
* @return
*/
@Override
protected boolean addItemEditObserver(PageState state) { protected boolean addItemEditObserver(PageState state) {
return Utilities.getSecurityManager(state).canAccess( return CMS.getSecurityManager(state).canAccess(
state.getRequest(), state.getRequest(),
SecurityManager.EDIT_ITEM, SecurityManager.EDIT_ITEM,
(ContentItem) m_itemModel.getSelectedObject(state)); (ContentItem) m_itemModel.getSelectedObject(state));

View File

@ -35,13 +35,27 @@ import com.arsdigita.persistence.SessionManager;
/**
*
*
*/
public class FormSectionModelBuilder implements PrintListener { public class FormSectionModelBuilder implements PrintListener {
/** */
private ItemSelectionModel m_item; private ItemSelectionModel m_item;
/**
* Constructor.
* @param item
*/
public FormSectionModelBuilder(ItemSelectionModel item) { public FormSectionModelBuilder(ItemSelectionModel item) {
m_item = item; m_item = item;
} }
/**
*
* @param e
*/
public void prepare(PrintEvent e) { public void prepare(PrintEvent e) {
ContentItem item = (ContentItem)m_item.getSelectedObject(e.getPageState()); ContentItem item = (ContentItem)m_item.getSelectedObject(e.getPageState());
ContentSection section = item.getContentSection(); ContentSection section = item.getContentSection();

View File

@ -54,7 +54,8 @@ public class FormSectionProperties extends SimpleEditStep {
setDefaultEditKey(EDIT_SHEET_NAME); setDefaultEditKey(EDIT_SHEET_NAME);
BasicPageForm edit = new FormSectionPropertyEditForm(model, this); BasicPageForm edit = new FormSectionPropertyEditForm(model, this);
add(EDIT_SHEET_NAME, "Edit", add(EDIT_SHEET_NAME,
GlobalizationUtil.globalize("cms.ui.edit"),
new WorkflowLockedComponentAccess(edit, model), new WorkflowLockedComponentAccess(edit, model),
edit.getSaveCancelSection().getCancelButton()); edit.getSaveCancelSection().getCancelButton());
setDisplayComponent(buildDisplayComponent(model)); setDisplayComponent(buildDisplayComponent(model));
@ -89,7 +90,8 @@ public class FormSectionProperties extends SimpleEditStep {
m_desc = new TextArea(new StringParameter("description")); m_desc = new TextArea(new StringParameter("description"));
m_desc.setRows(5); m_desc.setRows(5);
m_desc.setCols(50); m_desc.setCols(50);
add(new Label(GlobalizationUtil.globalize("cms.ui.formbuilder.description"))); add(new Label(GlobalizationUtil
.globalize("cms.contenttypes.ui.description")));
add(m_desc); add(m_desc);
} }
@ -133,17 +135,19 @@ public class FormSectionProperties extends SimpleEditStep {
private Component buildDisplayComponent(ItemSelectionModel itemModel) { private Component buildDisplayComponent(ItemSelectionModel itemModel) {
DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel); DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel);
sheet.add(GlobalizationUtil.globalize("cms.ui.formbuilder.name"), sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.title"),
ContentPage.NAME);
sheet.add(GlobalizationUtil.globalize("cms.ui.formbuilder.title"),
ContentPage.TITLE); ContentPage.TITLE);
sheet.add(GlobalizationUtil.globalize("cms.ui.formbuilder.description"), sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.name"),
ContentPage.NAME);
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.description"),
"form", new FormSectionFormatter()); "form", new FormSectionFormatter());
return sheet; return sheet;
} }
private class FormSectionFormatter implements DomainObjectPropertySheet.AttributeFormatter { private class FormSectionFormatter
implements DomainObjectPropertySheet.AttributeFormatter {
ItemSelectionModel m_item; ItemSelectionModel m_item;
public String format(DomainObject item, String attribute, PageState state) { public String format(DomainObject item, String attribute, PageState state) {

View File

@ -24,8 +24,8 @@ import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.event.ChangeListener; import com.arsdigita.bebop.event.ChangeListener;
import com.arsdigita.bebop.parameters.ParameterModel; import com.arsdigita.bebop.parameters.ParameterModel;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.contenttypes.util.FormSectionGlobalizationUtil;
import com.arsdigita.cms.formbuilder.FormSectionItem; import com.arsdigita.cms.formbuilder.FormSectionItem;
import com.arsdigita.cms.util.GlobalizationUtil;
public class FormSectionSingleSelectionModel extends AbstractSingleSelectionModel { public class FormSectionSingleSelectionModel extends AbstractSingleSelectionModel {
@ -40,6 +40,7 @@ public class FormSectionSingleSelectionModel extends AbstractSingleSelectionMode
return m_item; return m_item;
} }
@Override
public boolean isSelected(PageState state) { public boolean isSelected(PageState state) {
return m_item.isSelected(state); return m_item.isSelected(state);
} }
@ -51,22 +52,32 @@ public class FormSectionSingleSelectionModel extends AbstractSingleSelectionMode
public void setSelectedKey(PageState state, public void setSelectedKey(PageState state,
Object key) { Object key) {
throw new RuntimeException( (String) GlobalizationUtil.globalize("cms.ui.formbuilder.oh_no_you_dont").localize()); throw new RuntimeException( (String) FormSectionGlobalizationUtil.globalize(
"cms.contenttypes.ui.form_section.oh_no_you_dont")
.localize());
} }
public void clearSelection(PageState state) { public void clearSelection(PageState state) {
throw new RuntimeException( (String) GlobalizationUtil.globalize("cms.ui.formbuilder.oh_no_you_dont").localize()); throw new RuntimeException( (String) FormSectionGlobalizationUtil.globalize(
"cms.contenttypes.ui.form_section.oh_no_you_dont")
.localize());
} }
public void addChangeListener(ChangeListener l) { public void addChangeListener(ChangeListener l) {
throw new RuntimeException( (String) GlobalizationUtil.globalize("cms.ui.formbuilder.oh_no_you_dont").localize()); throw new RuntimeException( (String) FormSectionGlobalizationUtil.globalize(
"cms.contenttypes.ui.form_section.oh_no_you_dont")
.localize());
} }
public void removeChangeListener(ChangeListener l) { public void removeChangeListener(ChangeListener l) {
throw new RuntimeException( (String) GlobalizationUtil.globalize("cms.ui.formbuilder.oh_no_you_dont").localize()); throw new RuntimeException( (String) FormSectionGlobalizationUtil.globalize(
"cms.contenttypes.ui.form_section.oh_no_you_dont")
.localize());
} }
public ParameterModel getStateParameter() { public ParameterModel getStateParameter() {
throw new RuntimeException( (String) GlobalizationUtil.globalize("cms.ui.formbuilder.oh_no_you_dont").localize()); throw new RuntimeException( (String) FormSectionGlobalizationUtil.globalize(
"cms.contenttypes.ui.form_section.oh_no_you_dont")
.localize());
} }
} }

View File

@ -24,7 +24,7 @@ cms.contenttypes.template.body_text.description=Edit the body text
cms.contenttypes.shared.assign_categories.title=Assign Categories cms.contenttypes.shared.assign_categories.title=Assign Categories
cms.contenttypes.shared.assign_categories.description=Assign Categories cms.contenttypes.shared.assign_categories.description=Assign Categories
cms.contenttypes.shared.basic_properties.description=Edit Basic Properties cms.contenttypes.shared.basic_properties.description=Edit Basic Properties
cms.contenttypes.shared.basic_properties.title=Basic Properties cms.contenttypes.shared.basic_properties.title=Edit Basic Properties
cms.contenttypes.shared.body_text.title=Body Text cms.contenttypes.shared.body_text.title=Body Text
cms.contenttypes.shared.body_text.description=Edit the Body Text cms.contenttypes.shared.body_text.description=Edit the Body Text
cms.contenttypes.ui.content_group_current_items=Current Items: cms.contenttypes.ui.content_group_current_items=Current Items:
@ -409,14 +409,7 @@ cms.ui.folder.na=N/A
cms.ui.folder.no_source_items_specified=No source items specified. cms.ui.folder.no_source_items_specified=No source items specified.
cms.ui.folder.parent=Parent Folder cms.ui.folder.parent=Parent Folder
cms.ui.folder.rename=Rename folder cms.ui.folder.rename=Rename folder
# Package com.arsdigita.cms.ui.formbuilder
# ========================================
cms.ui.formbuilder.description=Description:
cms.ui.formbuilder.name=Name:
cms.ui.formbuilder.oh_no_you_dont=Oh no you don't cms.ui.formbuilder.oh_no_you_dont=Oh no you don't
cms.ui.formbuilder.title=Title:
# Package com.arsdigita.cms.ui.item # Package com.arsdigita.cms.ui.item

View File

@ -24,7 +24,7 @@ cms.contenttypes.template.body_text.description=Haupttext bearbeiten
cms.contenttypes.shared.assign_categories.title=Kategorien zuweisen cms.contenttypes.shared.assign_categories.title=Kategorien zuweisen
cms.contenttypes.shared.assign_categories.description=Kategorien zuweisen cms.contenttypes.shared.assign_categories.description=Kategorien zuweisen
cms.contenttypes.shared.basic_properties.description=Basiseigenschaften bearbeiten cms.contenttypes.shared.basic_properties.description=Basiseigenschaften bearbeiten
cms.contenttypes.shared.basic_properties.title=Basiseigenschaften cms.contenttypes.shared.basic_properties.title=Basiseigenschaften bearbeiten
cms.contenttypes.shared.body_text.title=Haupttext cms.contenttypes.shared.body_text.title=Haupttext
cms.contenttypes.shared.body_text.description=Haupttext bearbeiten cms.contenttypes.shared.body_text.description=Haupttext bearbeiten
cms.contenttypes.ui.content_group_current_items=Aktuelle Items: cms.contenttypes.ui.content_group_current_items=Aktuelle Items:
@ -406,13 +406,7 @@ cms.ui.folder.na=k.A.
cms.ui.folder.no_source_items_specified=Kein Quelldokument angegeben. cms.ui.folder.no_source_items_specified=Kein Quelldokument angegeben.
cms.ui.folder.parent=\u00dcbergeordneter Ordner cms.ui.folder.parent=\u00dcbergeordneter Ordner
cms.ui.folder.rename=Ordner umbenennen cms.ui.folder.rename=Ordner umbenennen
# Package com.arsdigita.cms.ui.formbuilder
# ========================================
cms.ui.formbuilder.description=Beschreibung:
cms.ui.formbuilder.name=Name:
cms.ui.formbuilder.oh_no_you_dont=Nein, das wollen sie nicht cms.ui.formbuilder.oh_no_you_dont=Nein, das wollen sie nicht
cms.ui.formbuilder.title=Titel\:
# Package com.arsdigita.cms.ui.item # Package com.arsdigita.cms.ui.item

View File

@ -4,7 +4,7 @@ cms.ui.lifecycles=Lifecycles
cms.ui.unknownRole=Unknown role cms.ui.unknownRole=Unknown role
cms.ui.unknownStatus=Unknown status cms.ui.unknownStatus=Unknown status
cms.contenttypes.ui.genericorgaunit.persons.status=Status cms.contenttypes.ui.genericorgaunit.persons.status=Status
cms.contenttypes.shared.basic_properties.title=Basic Properties cms.contenttypes.shared.basic_properties.title=Edit Basic Properties
cms.ui.edit_assoc=Edit association cms.ui.edit_assoc=Edit association
cms.ui.type.permissions=Permissions (Create new items of this type) cms.ui.type.permissions=Permissions (Create new items of this type)
cms.ui.type.permissions.role=Role cms.ui.type.permissions.role=Role

View File

@ -268,14 +268,7 @@ cms.ui.folder.na=N/A
cms.ui.folder.no_source_items_specified=Pas d'\u00e9l\u00e9ment source sp\u00e9cifi\u00e9 cms.ui.folder.no_source_items_specified=Pas d'\u00e9l\u00e9ment source sp\u00e9cifi\u00e9
cms.ui.folder.parent=Parent Folder cms.ui.folder.parent=Parent Folder
cms.ui.folder.rename=Rename folder cms.ui.folder.rename=Rename folder
# Package com.arsdigita.cms.ui.formbuilder
# ========================================
cms.ui.formbuilder.description=Description
cms.ui.formbuilder.name=Nom
cms.ui.formbuilder.oh_no_you_dont=non, vous ne pouvez pas cms.ui.formbuilder.oh_no_you_dont=non, vous ne pouvez pas
cms.ui.formbuilder.title=Titre
# Package com.arsdigita.cms.ui.item # Package com.arsdigita.cms.ui.item
@ -484,7 +477,7 @@ cms.ui.workflow.you_are_assigned_to_this_item=Vous \u00eates assign\u00e9 \u00e0
cms.ui.workflow.your_active_tasks=Vos t\u00e2ches actives cms.ui.workflow.your_active_tasks=Vos t\u00e2ches actives
cms.ui.workflows=Workflows cms.ui.workflows=Workflows
cms.ui.you_do_not_have_sufficient_privileges_to_access_this_page=Vous n'\u00eates pas autoris\u00e9 \u00e0 voir cette page. cms.ui.you_do_not_have_sufficient_privileges_to_access_this_page=Vous n'\u00eates pas autoris\u00e9 \u00e0 voir cette page.
cms.contenttypes.shared.basic_properties.title=Basic Properties cms.contenttypes.shared.basic_properties.title=Edit Basic Properties
cms.ui.edit_assoc= cms.ui.edit_assoc=
cms.ui.type.permissions=Permissions (Create new items of this type) cms.ui.type.permissions=Permissions (Create new items of this type)
cms.ui.type.permissions.role=Role cms.ui.type.permissions.role=Role

View File

@ -1,10 +1,20 @@
/* /*
* GenericContactEditAddressPropertyForm.java * Copyright (C) 2009 Sören Bernstein, Universität Bremen
* *
* Created on 8. Juli 2009, 10:27 * 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
* *
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/ */
package com.arsdigita.cms.contenttypes.ui; package com.arsdigita.cms.contenttypes.ui;
@ -39,20 +49,25 @@ import org.apache.log4j.Logger;
/** /**
* *
* @author quasi * @author quasi, Created on 8. Juli 2009, 10:27
*/ */
public class GenericContactEditAddressPropertyForm extends BasicPageForm implements FormProcessListener, FormInitListener, FormSubmissionListener { public class GenericContactEditAddressPropertyForm extends BasicPageForm
implements FormProcessListener,
FormInitListener,
FormSubmissionListener {
private static final Logger logger = Logger.getLogger(
GenericContactPropertyForm.class);
private static final Logger logger = Logger.getLogger(GenericContactPropertyForm.class);
private GenericContactAddressPropertiesStep m_step;
public static final String ADDRESS = GenericAddress.ADDRESS; public static final String ADDRESS = GenericAddress.ADDRESS;
public static final String POSTAL_CODE = GenericAddress.POSTAL_CODE; public static final String POSTAL_CODE = GenericAddress.POSTAL_CODE;
public static final String CITY = GenericAddress.CITY; public static final String CITY = GenericAddress.CITY;
public static final String STATE = GenericAddress.STATE; public static final String STATE = GenericAddress.STATE;
public static final String ISO_COUNTRY_CODE = GenericAddress.ISO_COUNTRY_CODE; public static final String ISO_COUNTRY_CODE = GenericAddress.ISO_COUNTRY_CODE;
/**
* ID of the form private GenericContactAddressPropertiesStep m_step;
*/
/** ID of the form */
public static final String ID = "ContactEditAddress"; public static final String ID = "ContactEditAddress";
/** /**
@ -70,7 +85,8 @@ public class GenericContactEditAddressPropertyForm extends BasicPageForm impleme
* @param itemModel * @param itemModel
* @param step * @param step
*/ */
public GenericContactEditAddressPropertyForm(ItemSelectionModel itemModel, GenericContactAddressPropertiesStep step) { public GenericContactEditAddressPropertyForm(ItemSelectionModel itemModel,
GenericContactAddressPropertiesStep step) {
super(ID, itemModel); super(ID, itemModel);
m_step = step; m_step = step;
addSubmissionListener(this); addSubmissionListener(this);
@ -112,10 +128,11 @@ public class GenericContactEditAddressPropertyForm extends BasicPageForm impleme
} }
if (!GenericContact.getConfig().getHideAddressCountry()) { if (!GenericContact.getConfig().getHideAddressCountry()) {
add(new Label(ContenttypesGlobalizationUtil add(new Label(ContenttypesGlobalizationUtil.globalize(
.globalize("cms.contenttypes.ui.address.iso_country_code"))); "cms.contenttypes.ui.address.iso_country_code")));
ParameterModel countryParam = new StringParameter(ISO_COUNTRY_CODE); ParameterModel countryParam = new StringParameter(ISO_COUNTRY_CODE);
countryParam.addParameterListener(new StringInRangeValidationListener(0, 2)); countryParam.addParameterListener(new
StringInRangeValidationListener(0, 2));
SingleSelect country = new SingleSelect(countryParam); SingleSelect country = new SingleSelect(countryParam);
@ -124,10 +141,13 @@ public class GenericContactEditAddressPropertyForm extends BasicPageForm impleme
new Label(ContenttypesGlobalizationUtil new Label(ContenttypesGlobalizationUtil
.globalize("cms.ui.select_one")))); .globalize("cms.ui.select_one"))));
Iterator countries = GenericAddress.getSortedListOfCountries(null).entrySet().iterator(); Iterator countries = GenericAddress.getSortedListOfCountries(null)
.entrySet().iterator();
while (countries.hasNext()) { while (countries.hasNext()) {
Map.Entry<String, String> elem = (Map.Entry<String, String>) countries.next(); Map.Entry<String, String> elem = (Map.Entry<String, String>)
country.addOption(new Option(elem.getValue().toString(), elem.getKey().toString())); countries.next();
country.addOption(new Option(elem.getValue().toString(),
elem.getKey().toString()));
} }
country.addValidationListener( country.addValidationListener(
@ -139,7 +159,8 @@ public class GenericContactEditAddressPropertyForm extends BasicPageForm impleme
String isoCode = (String) data.getValue(); String isoCode = (String) data.getValue();
if (isoCode == null || isoCode.length() == 0) { if (isoCode == null || isoCode.length() == 0) {
data.addError((String) ContenttypesGlobalizationUtil data.addError((String) ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.address.error_iso_country") .globalize(
"cms.contenttypes.ui.address.error_iso_country")
.localize()); .localize());
} }
} }

View File

@ -89,22 +89,34 @@ public class LinkPropertyForm extends FormSection
private ContentType m_contentType; private ContentType m_contentType;
protected final String ITEM_SEARCH = "contentItem"; protected final String ITEM_SEARCH = "contentItem";
/** /**
* Creates a new form to edit the Link object specified by the item * Constructor creates a new form to edit the Link object specified by the
* selection model passed in. * item selection model passed in.
* *
* @param itemModel The ItemSelectionModel to use to obtain the ContentItem * @param itemModel The ItemSelectionModel to use to obtain the ContentItem
* to which this link is (or will be) attached * to which this link is (or will be) attached
* @param link The LinkSelectionModel to use to obtain the Link to work on * @param link The LinkSelectionModel to use to obtain the Link to work on
*/ */
public LinkPropertyForm(ItemSelectionModel itemModel, public LinkPropertyForm(ItemSelectionModel itemModel,
LinkSelectionModel link) { LinkSelectionModel link) {
this(itemModel, link, null); this(itemModel, link, null);
} }
/**
* Constructor creates a new form to edit the Link object specified by the
* item selection model passed in.
*
* @param itemModel
* @param link
* @param contentType *
*/
public LinkPropertyForm(ItemSelectionModel itemModel, public LinkPropertyForm(ItemSelectionModel itemModel,
LinkSelectionModel link, ContentType contentType) { LinkSelectionModel link,
ContentType contentType) {
super(new ColumnPanel(2)); super(new ColumnPanel(2));
s_log.debug("property form constructor"); s_log.debug("property form constructor");
m_linkModel = link; m_linkModel = link;
m_itemModel = itemModel; m_itemModel = itemModel;

View File

@ -8,7 +8,7 @@
storage="ccm-core/dispatcher.properties"/> storage="ccm-core/dispatcher.properties"/>
<config class="com.arsdigita.domain.DomainConfig" <config class="com.arsdigita.domain.DomainConfig"
storage="ccm-core/domain.properties"/> storage="ccm-core/domain.properties"/>
<config class="com.arsdigita.formbuilder.util.FormBuilderConfig" <config class="com.arsdigita.formbuilder.FormBuilderConfig"
storage="ccm-core/formbuilder.properties"/> storage="ccm-core/formbuilder.properties"/>
<config class="com.arsdigita.globalization.GlobalizationConfig" <config class="com.arsdigita.globalization.GlobalizationConfig"
storage="ccm-core/globalization.properties"/> storage="ccm-core/globalization.properties"/>

View File

@ -30,7 +30,7 @@ import java.util.Iterator;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
* Completable * Completable.
* *
* @author <a href="mailto:rhs@mit.edu">rhs@mit.edu</a> * @author <a href="mailto:rhs@mit.edu">rhs@mit.edu</a>
* @version $Revision: #10 $ $Date: 2004/08/16 $ * @version $Revision: #10 $ $Date: 2004/08/16 $

View File

@ -38,13 +38,13 @@ import com.arsdigita.xml.Element;
* @version $Id: SimpleComponent.java 1498 2007-03-19 16:22:15Z apevec $ * @version $Id: SimpleComponent.java 1498 2007-03-19 16:22:15Z apevec $
*/ */
public class SimpleComponent extends Completable public class SimpleComponent extends Completable
implements Component, Cloneable { implements Component, Cloneable {
private boolean m_locked; private boolean m_locked;
/** /**
* The Attribute object is protected to make * The Attribute object is protected to make it easier for the Form Builder
* it easier for the Form Builder service to persist the SimpleComponent. * service to persist the SimpleComponent.
* Locking violation is not a problem since if the SimpleComponent is locked * Locking violation is not a problem since if the SimpleComponent is locked
* then the Attribute object will also be locked. * then the Attribute object will also be locked.
*/ */

View File

@ -70,7 +70,8 @@ import com.arsdigita.xml.Element;
* @author Rory Solomon * @author Rory Solomon
* @version $Id: Widget.java 1537 2007-03-23 15:33:34Z chrisgilbert23 $ * @version $Id: Widget.java 1537 2007-03-23 15:33:34Z chrisgilbert23 $
*/ */
public abstract class Widget extends BlockStylable implements Cloneable, BebopConstants { public abstract class Widget extends BlockStylable implements Cloneable,
BebopConstants {
private static final Logger s_log = Logger.getLogger(Widget.class); private static final Logger s_log = Logger.getLogger(Widget.class);
@ -98,7 +99,8 @@ public abstract class Widget extends BlockStylable implements Cloneable, BebopCo
public abstract boolean isCompound(); public abstract boolean isCompound();
/** /**
* Returns a string naming the type of this widget. Must be implemented by subclasses * Returns a string naming the type of this widget. Must be implemented by
* subclasses
*/ */
protected abstract String getType(); protected abstract String getType();
@ -362,11 +364,10 @@ public abstract class Widget extends BlockStylable implements Cloneable, BebopCo
} }
/** /**
* Marks this widget as disabled, which has the effect of * Marks this widget as disabled, which has the effect of preventing the
* preventing the widget's value being submitted with * widget's value being submitted with the form, and will typically cause
* the form, and will typically cause the widget to be * the widget to be 'grayed out' on the form. This method can only be
* 'grayed out' on the form. This method can only be called * called on unlocked widgets.
* on unlocked widgets.
*/ */
public void setDisabled() { public void setDisabled() {
Assert.isUnlocked(this); Assert.isUnlocked(this);
@ -374,7 +375,7 @@ public abstract class Widget extends BlockStylable implements Cloneable, BebopCo
} }
/** /**
* Sets a popup hint for the widget * Sets a popup hint for the widget.
*/ */
public void setHint(String hint) { public void setHint(String hint) {
Assert.isUnlocked(this); Assert.isUnlocked(this);
@ -383,7 +384,8 @@ public abstract class Widget extends BlockStylable implements Cloneable, BebopCo
/** /**
* Gets the default value in the parameter model for this element. */ * Gets the default value in the parameter model for this element.
*/
public String getDefaultValue() { public String getDefaultValue() {
Object o = m_parameterModel.getDefaultValue(); Object o = m_parameterModel.getDefaultValue();
if (o==null) { if (o==null) {

View File

@ -100,7 +100,9 @@ public class Loader extends PackageLoader {
// Parameter Section // Parameter Section
// ///////////////////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////////////////
private EmailParameter m_email = new EmailParameter("waf.admin.email"); private EmailParameter m_email = new EmailParameter("waf.admin.email");
private StringParameter m_screen = new StringParameter("waf.admin.name.screen", Parameter.OPTIONAL, null) { private StringParameter m_screen = new StringParameter("waf.admin.name.screen",
Parameter.OPTIONAL,
null) {
@Override @Override
public Object getDefaultValue() { public Object getDefaultValue() {
String email = getEmail(); String email = getEmail();
@ -334,63 +336,6 @@ public class Loader extends PackageLoader {
} }
/**
* .
* Note: Loading of Subsite is currently required by Login
* module otherwise Login doesn't work!
*
* @param rootNode
// * @deprecated will be removed without replacement. Naot needed anymore
*/
/* private void loadSubsite(SiteNode rootNode) {
s_log.debug("CoreLoader: Going to execute method loadSubsite().");
String sDispatcher = "";
PackageInstance packageInstance = rootNode.getPackageInstance();
if (packageInstance == null) {
throw new IllegalStateException
("No package instance mounted at the root node");
}
PackageType subsite = packageInstance.getType();
// getType() returns a disconnected object. To get a connected object
// we do a findByKey(key).
String packageKey = subsite.getKey();
try {
subsite = PackageType.findByKey(packageKey);
} catch (DataObjectNotFoundException e) {
throw new IllegalStateException
("Package Type with key \"" + packageKey + "\" was not found.\n");
}
// Set subsite dispatcher class.
subsite.setDispatcherClass(getDispatcher());
} */
// /**
// * Create Root Site Node for loadSubsite()
// * @return root node
// * @deprecated will be removed without replacement. Naot needed anymore
// */
/* private SiteNode loadKernel() {
// Create Root Site Node
s_log.debug("CoreLoader: Going to execute method loadKernel().");
final SiteNode rootNode = SiteNode.createSiteNode(null, null);
// Create Package Types and Instances
s_log.debug("loadKernel: creating Package Types and Instances.");
PackageType subsite = PackageType.create
("acs-subsite", "ACS Subsite", "ACS Subsites",
"http://arsdigita.com/acs-subsite/");
PackageInstance subsiteInstance = subsite.createInstance("Main Site");
// Mount instances.
s_log.debug("loadKernel: mount Instances.");
rootNode.mountPackage(subsiteInstance);
s_log.debug("CoreLoader: Going to complete method loadKernel().");
return rootNode;
} */
/** /**
* Ensure that at least one User with universal "admin" permission exists * Ensure that at least one User with universal "admin" permission exists
* after installation. * after installation.

View File

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
*/ */
package com.arsdigita.formbuilder.util; package com.arsdigita.formbuilder;
import com.arsdigita.runtime.AbstractConfig; import com.arsdigita.runtime.AbstractConfig;
import com.arsdigita.util.parameter.BooleanParameter; import com.arsdigita.util.parameter.BooleanParameter;
@ -61,19 +61,26 @@ public final class FormBuilderConfig extends AbstractConfig {
* point to the help page. If it starts with "/" then it is * point to the help page. If it starts with "/" then it is
* assumed to be located on this server. If it starts with * assumed to be located on this server. If it starts with
* anything else, it is assumed to be a link to a foreign site. * anything else, it is assumed to be a link to a foreign site.
* This can be null is no help link should appear * This can be null if no help link should appear.
*
* NOTE: As of version 6.6 and earlier the help function is not working.
* Returns null to deactivate the help link.
*/ */
public String getActionsHelpLink() { public String getActionsHelpLink() {
return (String) get(m_actionsHelp); // return (String) get(m_actionsHelp);
return null;
} }
/** /**
* This returns the string that can be used to create the URL to * This returns the string that can be used to create the URL to
* point to the help page. * point to the help page.
* This can be null is no help link should appear * This can be null is no help link should appear
*
* NOTE: See deactivated help system above.
*/ */
public String getControlsHelpLink() { public String getControlsHelpLink() {
return (String)get(m_controlsHelp); // return (String)get(m_controlsHelp);
return null;
} }
public boolean getInterpolateEmailActionsToAddress() { public boolean getInterpolateEmailActionsToAddress() {

View File

@ -35,11 +35,11 @@ formbuilder.ui.you_are_about_to_delete_a_question=You are about to delete a ques
formbuilder.ui.form_properties=Form Properties formbuilder.ui.form_properties=Form Properties
formbuilder.ui.view_persisted_form=View Persisted Form formbuilder.ui.view_persisted_form=View Persisted Form
formbuilder.ui.move_it_here=[move it here] formbuilder.ui.move_it_here=[move it here]
formbuilder.ui.add_new=Add new formbuilder.ui.form_widget.add_new_label=Select a form widget to add:
formbuilder.ui.action= action formbuilder.ui.form_action.add_new_label=Add new form action:
formbuilder.ui.form_widget= form widget formbuilder.ui.form_widget= form widget
formbuilder.ui.form_section= form section formbuilder.ui.form_section= form section
formbuilder.ui.form_section_null_error= No form sections currently available formbuilder.ui.form_section.null_error=No form sections currently available
formbuilder.ui.specify_options=Specify Options formbuilder.ui.specify_options=Specify Options
formbuilder.ui.default_selection=Default selection formbuilder.ui.default_selection=Default selection
formbuilder.ui.value=Value formbuilder.ui.value=Value
@ -54,3 +54,13 @@ formbuilder.ui.add_a_question_for_parameter=Add a Question for Parameter
formbuilder.ui.move_question_to_position_1=Move question to position (1- formbuilder.ui.move_question_to_position_1=Move question to position (1-
formbuilder.ui.edit=edit formbuilder.ui.edit=edit
formbuilder.ui.delete=delete formbuilder.ui.delete=delete
formbuilder.ui.form_widget.create_button=Create selected form control widget
formbuilder.ui.form_section.add_new_label=Select a form section to add:
formbuilder.ui.form_section.add_button=Add selected form section
formbuilder.ui.form_section.select_one=-- Select a form section --
formbuilder.ui.form_widget.select_one=-- Select a form control element --
formbuilder.ui.form_widget.null_error=No widget selected.
formbuilder.ui.form_action.add_button=Add Form Action
formbuilder.ui.form_action.delete_confirm=Are you sure you wish to delete this action?
formbuilder.ui.move=move
formbuilder.ui.delete_confirm=Are you sure you wish to delete this widget?

View File

@ -10,20 +10,20 @@ formbuilder.ui.editors.default_value=Default Wert\:
formbuilder.ui.editors.start_year=Beginn (Jahr) formbuilder.ui.editors.start_year=Beginn (Jahr)
formbuilder.ui.editors.end_year=Ende (Jahr) formbuilder.ui.editors.end_year=Ende (Jahr)
formbuilder.ui.editors.value=Wert\: formbuilder.ui.editors.value=Wert\:
formbuilder.ui.editors.add_option=Option hinzuf\u00FCgen formbuilder.ui.editors.add_option=Option hinzuf\u00fcgen
formbuilder.ui.editors.option_label=Option Label: formbuilder.ui.editors.option_label=Option Label:
formbuilder.ui.editors.max_length=Max. L\u00E4nge\: formbuilder.ui.editors.max_length=Max. L\u00e4nge\:
formbuilder.ui.editors.width=Breite\: formbuilder.ui.editors.width=Breite\:
formbuilder.ui.editors.name=Widget Variablen Name\: formbuilder.ui.editors.name=Widget Variablen Name\:
formbuilder.ui.editors.description=Beschreibung\: formbuilder.ui.editors.description=Beschreibung\:
formbuilder.ui.editors.to=An\: formbuilder.ui.editors.to=An\:
formbuilder.ui.editors.label=Widget Variable Label: formbuilder.ui.editors.label=Widget Variable Label:
formbuilder.ui.editors.UserEmailLabel=Widget Label: formbuilder.ui.editors.UserEmailLabel=Widget Label:
formbuilder.ui.editors.height=H\u00F6he\: formbuilder.ui.editors.height=H\u00f6he\:
formbuilder.ui.editors.data_type=Datentyp\: formbuilder.ui.editors.data_type=Datentyp\:
formbuilder.ui.editors.answer_required=Antwort erforderlich\: formbuilder.ui.editors.answer_required=Antwort erforderlich\:
formbuilder.ui.editors.textfieldmsg=Dieses Feld bleibt leer, au\u00DFer es soll eine H\u00F6chzahl an Zeichen festgelegt werden, die eingetragen werden k\u00F6nnen. Wenn mehr als 3 Zeilen f\u00FCr eine Antwort ben\u00F6tigt werden, wird die Zahl in der Box "Breite" eingetragen. formbuilder.ui.editors.textfieldmsg=Dieses Feld bleibt leer, au\u00dfer es soll eine H\u00f6chzahl an Zeichen festgelegt werden, die eingetragen werden k\u00f6nnen. Wenn mehr als 3 Zeilen f\u00fcr eine Antwort ben\u00f6tigt werden, wird die Zahl in der Box "Breite" eingetragen.
formbuilder.ui.editors.textareamsg=Diese Felder bleiben leer, au\u00DFer es soll eine H\u00F6chzahl an Zeichen festgelegt werden, die eingetragen werden k\u00F6nnen.\t formbuilder.ui.editors.textareamsg=Diese Felder bleiben leer, au\u00dfer es soll eine H\u00f6chzahl an Zeichen festgelegt werden, die eingetragen werden k\u00f6nnen.\t
formbuilder.ui.manage_questions_of_a_form=Manage Questions of a Form formbuilder.ui.manage_questions_of_a_form=Manage Questions of a Form
formbuilder.ui.label_to_be_ignored=label to be ignored formbuilder.ui.label_to_be_ignored=label to be ignored
formbuilder.ui.select_widget=Select Widget formbuilder.ui.select_widget=Select Widget
@ -31,26 +31,36 @@ formbuilder.ui.move_question_to_position=Move question to position
formbuilder.ui.editors.text_form_title=Text Body: formbuilder.ui.editors.text_form_title=Text Body:
formbuilder.ui.help=Hilfe formbuilder.ui.help=Hilfe
formbuilder.ui.editors.heading_form_title=Heading: formbuilder.ui.editors.heading_form_title=Heading:
formbuilder.ui.you_are_about_to_delete_a_question=Sie sind im Begriff, eine Frage zu l\u00F6schen formbuilder.ui.you_are_about_to_delete_a_question=Sie sind im Begriff, eine Frage zu l\u00f6schen
formbuilder.ui.form_properties=Formulareigenschaften formbuilder.ui.form_properties=Formulareigenschaften
formbuilder.ui.view_persisted_form=View Persisted Form formbuilder.ui.view_persisted_form=View Persisted Form
formbuilder.ui.move_it_here=[hierhere verschieben] formbuilder.ui.move_it_here=[hierhere verschieben]
formbuilder.ui.add_new=Neu Hinzuf\u00FCgen formbuilder.ui.form_widget.add_new_label=Auswahl eines neuen Formularelements:
formbuilder.ui.action= action formbuilder.ui.form_action.add_new_label=Eine neue Formularaktion hinzuf\u00fcgen:
formbuilder.ui.form_widget= form widget formbuilder.ui.form_widget= form widget
formbuilder.ui.form_section= form section formbuilder.ui.form_section= form section
formbuilder.ui.form_section_null_error= No form sections currently available formbuilder.ui.form_section.null_error=Aktuell sind keine Formularsektionen verf\u00fcgbar.
formbuilder.ui.specify_options=Specify Options formbuilder.ui.specify_options=Specify Options
formbuilder.ui.default_selection=Default Auswahl formbuilder.ui.default_selection=Default Auswahl
formbuilder.ui.value=Value formbuilder.ui.value=Value
formbuilder.ui.is_answer_required=Ist Anwort notwendig formbuilder.ui.is_answer_required=Ist Anwort notwendig
formbuilder.ui.what_is_the_datatype_of_the_answer=Was ist der Datentyp der Antwort formbuilder.ui.what_is_the_datatype_of_the_answer=Was ist der Datentyp der Antwort
formbuilder.ui.number_of_options_150_required=Anzahl Optionen (1-50, erforderlich) formbuilder.ui.number_of_options_150_required=Anzahl Optionen (1-50, erforderlich)
formbuilder.util.return_to_index_page=Zur\u00FCck zur Index Seite formbuilder.util.return_to_index_page=Zur\u00fcck zur Index Seite
formbuilder.ui.editors.edit=editieren formbuilder.ui.editors.edit=editieren
formbuilder.ui.editors.delete=l\u00F6schen formbuilder.ui.editors.delete=l\u00f6schen
formbuilder.ui.add_a_question_at_position=Add a Question at Position formbuilder.ui.add_a_question_at_position=Add a Question at Position
formbuilder.ui.add_a_question_for_parameter=Add a Question for Parameter formbuilder.ui.add_a_question_for_parameter=Add a Question for Parameter
formbuilder.ui.move_question_to_position_1=Move question to position (1- formbuilder.ui.move_question_to_position_1=Move question to position (1-
formbuilder.ui.edit=edit formbuilder.ui.edit=bearbeiten
formbuilder.ui.delete=l\u00F6schen formbuilder.ui.delete=l\u00f6schen
formbuilder.ui.form_widget.create_button=Formularelement erstellen
formbuilder.ui.form_section.add_new_label=Auswahl einer Formularsektion:
formbuilder.ui.form_section.add_button=Formularsektion hinzuf\u00fcgen
formbuilder.ui.form_section.select_one=-- Eine Formularsektion ausw\u00e4hlen --
formbuilder.ui.form_widget.select_one=-- Ein Formularelement ausw\u00e4hlen --
formbuilder.ui.form_widget.null_error=Es wurde kein Formularelement ausgew\u00e4hlt.
formbuilder.ui.form_action.add_button=Formularaktion hinzuf\u00fcgen
formbuilder.ui.form_action.delete_confirm=Sind sie sicher, diese Aktion zu l\u00f6schen?
formbuilder.ui.move=verschieben
formbuilder.ui.delete_confirm=Sind Sie sicher, dieses Element zu l\u00f6schen?

View File

@ -0,0 +1,58 @@
formbuilder.ui.hidden_field=Champ cach\u00e9:
formbuilder.ui.editors.from=De:
formbuilder.ui.editors.subject=Objet:
formbuilder.ui.editors.body=Contenu:
formbuilder.ui.editors.url=URL:
formbuilder.ui.editors.query=Requ\u00e8te
formbuilder.ui.editors.multiselect=S\u00e9lection multiple
formbuilder.ui.editors.default_value=Valeur par d\u00e9faut:
formbuilder.ui.editors.start_year=Ann\u00e9e de d\u00e9but
formbuilder.ui.editors.end_year=Ann\u00e9e de fin
formbuilder.ui.editors.value=Valeur:
formbuilder.ui.editors.add_option=Ajouter une option
formbuilder.ui.editors.option_label=Libell\u00e9 de l'option
formbuilder.ui.editors.max_length=Longueur maximum
formbuilder.ui.editors.width=Largeur
formbuilder.ui.editors.name=Nom:
formbuilder.ui.editors.description=Description:
formbuilder.ui.editors.to=A:
formbuilder.ui.editors.label=Libell\u00e9:
formbuilder.ui.editors.height=Hauteur:
formbuilder.ui.editors.data_type=Type de donn\u00e9e
formbuilder.ui.editors.answer_required=R\u00e9ponse obligatoire:
formbuilder.ui.manage_questions_of_a_form=Gestion des questions d'un formulaire
formbuilder.ui.label_to_be_ignored=libell\u00e9 \u00e0 ignorer
formbuilder.ui.select_widget=S\u00e9lectionner le Widget
formbuilder.ui.move_question_to_position=D\u00e9placer la question \u00e0 la position
formbuilder.ui.you_are_about_to_delete_a_question=Vous \u00eates sur le point d'effacer une question
formbuilder.ui.form_properties=Propri\u00e9t\u00e9 du formulaire
formbuilder.ui.view_persisted_form=Formulaire de vue persistante
formbuilder.ui.move_it_here=[d\u00e9placer ici]
formbuilder.ui.form_widget.add_new_label=Ajouter un(e) nouveau(elle):
formbuilder.ui.form_action.add_new_label=Add new form action:
formbuilder.ui.form_widget= formulaire widget
formbuilder.ui.form_section= formulaire section
formbuilder.ui.specify_options=Sp\u00e9cifier les options
formbuilder.ui.default_selection=S\u00e9lection par d\u00e9faut
formbuilder.ui.value=Valeur
formbuilder.ui.is_answer_required=Est-ce que la r\u00e9ponse est obligatoire
formbuilder.ui.what_is_the_datatype_of_the_answer=Quel est le type de donn\u00e9es de la r\u00e9ponse
formbuilder.ui.number_of_options_150_required=Nombre d'option (1-50, obligatoire)
formbuilder.util.return_to_index_page=Retour \u00e0 la page d'index
formbuilder.ui.editors.edit=modifier
formbuilder.ui.editors.delete=effacer
formbuilder.ui.add_a_question_at_position=Ajouter une question \u00e0 la position
formbuilder.ui.add_a_question_for_parameter=ajouter une question pour le param\u00e8tre
formbuilder.ui.move_question_to_position_1=D\u00e9placer la question \u00e0 la position (1-
formbuilder.ui.edit=modifier
formbuilder.ui.delete=effacer
formbuilder.ui.form_widget.create_button=Create selected form control widget
formbuilder.ui.form_section.add_new_label=Select a form section to add:
formbuilder.ui.form_section.add_button=Add selected form section
formbuilder.ui.form_section.select_one=-- Select a form section --
formbuilder.ui.form_widget.select_one=-- Select a form control element --
formbuilder.ui.form_widget.null_error=No widget selected.
formbuilder.ui.form_action.add_button=Add Form Action
formbuilder.ui.form_action.delete_confirm=Are you sure you wish to delete this action?
formbuilder.ui.move=move
formbuilder.ui.delete_confirm=Are you sure you wish to delete this widget?

View File

@ -1,172 +0,0 @@
/*
* Copyright (C) 2001-2004 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.formbuilder;
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.kernel.PackageType;
import com.arsdigita.kernel.PackageInstance;
import com.arsdigita.kernel.SiteNode;
// import com.arsdigita.kernel.Stylesheet;
import com.arsdigita.persistence.SessionManager;
import com.arsdigita.persistence.TransactionContext;
import com.arsdigita.initializer.Configuration;
import com.arsdigita.initializer.InitializationException;
import org.apache.log4j.Logger;
// ////////////////////////////////////////////////////////////////////////
//
// This old style Initializer is obviously no longer used (for a long time
// and several releases. Formbuilder as an own application is deprecated and
// replaced by content type forms.
//
// Removed.
//
// It is a loader task (loading package type and instance) and should be
// handled there it required in the future.
//
// ////////////////////////////////////////////////////////////////////////
/**
* Registers the formbuilder package type and creates an instance
* that is mounted under formbuilder (this is done only once).
*
* @author Peter Marklund
* @version $Id: Initializer.java 287 2005-02-22 00:29:02Z sskracic $
*/
public class Initializer
implements com.arsdigita.initializer.Initializer {
private Configuration m_conf = new Configuration();
private static final Logger log =
Logger.getLogger(Initializer.class);
/**
* Constructor
*
* @throws InitializationException
*/
public Initializer() throws InitializationException {
}
/**
* Returns the configuration object used by this initializer.
*/
public Configuration getConfiguration() {
return m_conf;
}
/**
* Called on startup. Note. As you can not find a call
* to this method in enterprise.ini, this method
* may appear to execute mysteriously.
* However, the process that runs through enterprise.ini
* automitically calls the startup() method of any
* class that implements com.arsdigita.util.initializer.Initializer
* present in enterprise.ini
*/
public void startup() {
log.info("FormBuilder Initializer starting.");
TransactionContext txn = SessionManager.getSession()
.getTransactionContext();
txn.beginTxn();
checkFormBuilderSetup();
txn.commitTxn();
}
private void checkFormBuilderSetup() {
/* This checks to see if a package by this name
* is present. If it isn't, setupFormBuilder
* will do the necessary setup such as add the
* package type, package instance, site node
* and style sheet.
*/
try {
log.debug("FormBuilder Initializer - verifying setup.");
PackageType.findByKey("formbuilder");
} catch (DataObjectNotFoundException e) {
setupFormBuilder();
}
}
private void setupFormBuilder() {
log.debug("FormBuilder Initializer - setting up new package");
/** Adding the package type to the installation
*/
PackageType FormBuilderType = PackageType.create
("formbuilder", "Form Builder", "Form Builders",
"http://arsdigita.com/formbuilder");
log.debug("Just added package type FormBuilder");
/** Adding the node and the package instance
* on that node.
*/
SiteNode FormBuilderTypeNode = SiteNode.createSiteNode("formbuilder");
PackageInstance formBuilder = FormBuilderType.createInstance("FormBuilderType");
/** Specifying the URL stub for this package instance.
*/
FormBuilderTypeNode.mountPackage(formBuilder);
FormBuilderTypeNode.save();
/** Adding a style sheet
*/
// Stylesheet FormBuilderSheet = Stylesheet.createStylesheet ("/packages/formbuilder/xsl/formbuilder.xsl");
// FormBuilderType.addStylesheet(FormBuilderSheet);
/** Mapping the package type to a dispatcher
* class
*/
FormBuilderType.setDispatcherClass("com.arsdigita.formbuilder.FormBuilderDispatcher");
/** Saving changes
*/
FormBuilderType.save();
}
/**
* Called on shutdown. It's probably not a good idea to depend on this
* being called.
**/
public void shutdown() {
}
}

View File

@ -1,235 +0,0 @@
/*
* Copyright (C) 2002-2004 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.formbuilder.installer;
import com.arsdigita.formbuilder.BebopObjectType;
import com.arsdigita.formbuilder.MetaObject;
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.persistence.SessionManager;
import com.arsdigita.persistence.TransactionContext;
import com.arsdigita.initializer.Configuration;
import com.arsdigita.initializer.InitializationException;
import com.arsdigita.formbuilder.PersistentProcessListener;
import com.arsdigita.kernel.BaseInitializer;
import java.util.Iterator;
import java.util.List;
import com.arsdigita.formbuilder.PersistentDataQuery;
import com.arsdigita.formbuilder.PersistentComponent;
// /////////////////////////////////////////////////////////////////
//
// REPLACED by formbuilder.util.FormbuilderSetup
// Not a initializer tast bud a loader task
//
// /////////////////////////////////////////////////////////////////
/**
* Initializer
*
* @author <a href="mailto:berrange@redhat.com">Daniel Berrange</a>
* @version $Revision: #10 $ $Date: 2004/08/16 $
*/
public class Initializer extends BaseInitializer {
public static String WIDGET_TYPES = "widgetTypes";
public static String PROCESS_LISTENER_TYPES = "processListenerTypes";
public static String DATA_QUERIES = "dataQueries";
private Configuration m_conf = new Configuration();
public Initializer() throws InitializationException {
m_conf.initParameter(WIDGET_TYPES,
"The persistent widget types",
List.class);
m_conf.initParameter(PROCESS_LISTENER_TYPES,
"The persistent process listener types",
List.class);
m_conf.initParameter(DATA_QUERIES,
"The queries for the data driven select box",
List.class);
}
/* Quasimodo: BEGIN */
/**
* Initializer
*
* A new Initializer, which doesn't use the Configuration and the enterprise
* init. This initializer can be called during DomainInitEvents, so it is
* ready for the new Initializer framework. Configuration will be read from
* parameters (for now - maybe there's wil be a better way in the future).
*
* @throws InitializationException
*/
public Initializer(List widgets, List processListeners, List dataQueries) throws InitializationException {
TransactionContext txn = SessionManager.getSession().getTransactionContext();
txn.beginTxn();
// Load widgets, processListeners and dataQueries from parameters
loadMetaObjects(widgets, PersistentComponent.class);
loadMetaObjects(processListeners, PersistentProcessListener.class);
loadDataQueries(dataQueries);
txn.commitTxn();
}
/**
* Returns the configuration object used by this initializer.
**/
public Configuration getConfiguration() {
return m_conf;
}
/**
* Called on startup. Note. As you can not find a call
* to this method in enterprise.ini, this method
* may appear to execute mysteriously.
* However, the process that runs through enterprise.ini
* automitically calls the startup() method of any
* class that implements com.arsdigita.util.initializer.Initializer
* present in enterprise.ini
*
**/
protected void doStartup() {
TransactionContext txn = SessionManager.getSession().getTransactionContext();
txn.beginTxn();
List widgets = (List) m_conf.getParameter(WIDGET_TYPES);
loadMetaObjects(widgets, PersistentComponent.class);
List listeners = (List) m_conf.getParameter(PROCESS_LISTENER_TYPES);
loadMetaObjects(listeners, PersistentProcessListener.class);
List queries = (List) m_conf.getParameter(DATA_QUERIES);
loadDataQueries(queries);
txn.commitTxn();
}
/**
* Called on shutdown. It's probably not a good idea to depend on this
* being called.
**/
protected void doShutdown() {
}
public BebopObjectType getObjectType(String name,
Class type) {
BebopObjectType objectType = null;
try {
objectType = BebopObjectType.findByClass(name,
type);
} catch (DataObjectNotFoundException ex) {
objectType = BebopObjectType.create(name,
type);
objectType.save();
}
return objectType;
}
protected void loadMetaObjects(List objects, Class type)
throws InitializationException {
// If the objects list is not null, load the object list into the database
// pboy: Obviously, this is a Loader task.
if (objects != null) {
// XXX we don't yet delete types which are no longer in the list
Iterator objects_i = objects.iterator();
while (objects_i.hasNext()) {
List object = (List) objects_i.next();
String appName = (String) object.get(0);
String prettyName = (String) object.get(1);
String prettyPlural = (String) object.get(2);
String className = (String) object.get(3);
String propertiesForm = (String) object.get(4);
try {
Class.forName(className);
} catch (ClassNotFoundException ex) {
throw new InitializationException("cannot find class " + className);
}
try {
Class.forName(propertiesForm);
} catch (ClassNotFoundException ex) {
throw new InitializationException("cannot find class " + propertiesForm);
}
try {
MetaObject mo = MetaObject.findByClassName(getObjectType(appName,
type),
className);
mo.setPrettyName(prettyName);
mo.setPrettyPlural(prettyPlural);
mo.setWidgetClassName(className);
mo.setPropertiesFormName(propertiesForm);
mo.save();
} catch (DataObjectNotFoundException ex) {
MetaObject mo = MetaObject.create(getObjectType(appName,
type),
prettyName,
prettyPlural,
className,
propertiesForm);
mo.save();
}
}
}
}
protected void loadDataQueries(List objects)
throws InitializationException {
// If the objects list is not null, load the object list into the database
if (objects != null) {
// XXX we don't yet delete types which are no longer in the list
Iterator objects_i = objects.iterator();
while (objects_i.hasNext()) {
List object = (List) objects_i.next();
String appName = (String) object.get(0);
String name = (String) object.get(1);
String description = (String) object.get(2);
try {
PersistentDataQuery q = PersistentDataQuery.findByName(getObjectType(appName,
PersistentDataQuery.class),
name);
q.setName(name);
q.setDescription(description);
q.save();
} catch (DataObjectNotFoundException ex) {
PersistentDataQuery q = PersistentDataQuery.create(getObjectType(appName,
PersistentDataQuery.class),
description, name);
q.save();
}
}
}
}
}

View File

@ -1,11 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title>Package com.arsdigita. formbuilder.installer</title>
</head>
<body>
<p>
Installer for formbuilder service.
</p>
</body>
</html>

View File

@ -18,47 +18,49 @@
*/ */
package com.arsdigita.formbuilder.ui; package com.arsdigita.formbuilder.ui;
import com.arsdigita.formbuilder.CompoundComponent;
import com.arsdigita.formbuilder.PersistentComponent;
import com.arsdigita.formbuilder.PersistentHidden;
import com.arsdigita.formbuilder.PersistentLabel;
import com.arsdigita.formbuilder.util.GlobalizationUtil ;
import com.arsdigita.bebop.BaseLink; import com.arsdigita.bebop.BaseLink;
import com.arsdigita.bebop.BoxPanel; import com.arsdigita.bebop.BoxPanel;
import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.FormSection; import com.arsdigita.bebop.FormSection;
import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Label;
import com.arsdigita.formbuilder.CompoundComponent;
import com.arsdigita.formbuilder.PersistentComponent;
import com.arsdigita.formbuilder.PersistentHidden;
import com.arsdigita.formbuilder.PersistentLabel;
import com.arsdigita.formbuilder.util.GlobalizationUtil ;
import com.arsdigita.globalization.GlobalizedMessage;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
* This is an extension of the BaseAddObserver which * This is an extension of the BaseAddObserver which handles the editing of
* handles the editing of controls on a form by * controls on a form by adding additional links on each row.
* adding additional links on each row.
*/ */
public abstract class BaseEditAddObserver extends BaseAddObserver { public abstract class BaseEditAddObserver extends BaseAddObserver {
private static final Logger s_log = private static final Logger s_log =
Logger.getLogger(BaseEditAddObserver.class); Logger.getLogger(BaseEditAddObserver.class);
/**
*
* @param formSection
* @param component
* @param componentPosition
*/
public void beforeAddingComponent(FormSection formSection, public void beforeAddingComponent(FormSection formSection,
PersistentComponent component, PersistentComponent component,
int componentPosition) { int componentPosition) {
super.beforeAddingComponent(formSection, super.beforeAddingComponent(formSection,
component, component,
componentPosition); componentPosition);
// Propagate the 3 column layout to form sections
/*
try {
CompoundComponent fs = (CompoundComponent)componentFactory;
fs.setContainer(new ColumnPanel(3, true));
} catch (ClassCastException ex) {
// Nada
}
*/
} }
/**
*
* @param persistentComponent
* @param componentPosition
* @param component
*/
public void addingComponent(PersistentComponent persistentComponent, public void addingComponent(PersistentComponent persistentComponent,
int componentPosition, int componentPosition,
Component component) { Component component) {
@ -67,15 +69,23 @@ public abstract class BaseEditAddObserver extends BaseAddObserver {
component); component);
} }
/**
*
* @param formSection
* @param component
* @param componentPosition
*/
public void afterAddingComponent(FormSection formSection, public void afterAddingComponent(FormSection formSection,
PersistentComponent component, PersistentComponent component,
int componentPosition) { int componentPosition) {
super.afterAddingComponent(formSection, super.afterAddingComponent(formSection,
component, component,
componentPosition); componentPosition);
if (component instanceof PersistentHidden) { if (component instanceof PersistentHidden) {
PersistentHidden hidden = (PersistentHidden)component; PersistentHidden hidden = (PersistentHidden)component;
formSection.add(new Label(GlobalizationUtil.globalize("formbuilder.ui.hidden_field"))); formSection.add(new Label(GlobalizationUtil.globalize(
"formbuilder.ui.hidden_field")));
formSection.add(new Label(hidden.getParameterName())); formSection.add(new Label(hidden.getParameterName()));
} }
@ -86,15 +96,19 @@ public abstract class BaseEditAddObserver extends BaseAddObserver {
s_log.debug("Adding widget " + component.getClass().getName()); s_log.debug("Adding widget " + component.getClass().getName());
if (component.isEditable()) { if (component.isEditable()) {
// createLink implementation creates the name and the GlobMsg
BaseLink edit = createLink("edit", component); BaseLink edit = createLink("edit", component);
b.add(edit); b.add(edit);
} }
// createLink implementation creates the name and the GlobMsg
BaseLink move = createLink("move", component); BaseLink move = createLink("move", component);
b.add(move); b.add(move);
// createLink implementation creates the name and the GlobMsg
BaseLink delete = createLink("delete", component); BaseLink delete = createLink("delete", component);
delete.setConfirmation("Are you sure you wish to delete this widget?"); delete.setConfirmation(GlobalizationUtil.globalize(
"formbuilder.ui.delete_confirm"));
b.add(delete); b.add(delete);
if (component instanceof CompoundComponent) { if (component instanceof CompoundComponent) {
@ -108,7 +122,10 @@ public abstract class BaseEditAddObserver extends BaseAddObserver {
/** /**
* This method is use to create a link for editing * This method is use to create a link for editing
* a component. * a component.
* It is the respnsibility of the implementation to provide a
* corresponding GlobalizedMessage for the label of the component name.
*/ */
protected abstract BaseLink createLink(String label, protected abstract BaseLink createLink(String name,
PersistentComponent component); PersistentComponent component);
} }

View File

@ -18,13 +18,6 @@
*/ */
package com.arsdigita.formbuilder.ui; package com.arsdigita.formbuilder.ui;
import com.arsdigita.formbuilder.PersistentComponent;
import com.arsdigita.formbuilder.PersistentForm;
import com.arsdigita.formbuilder.PersistentFormSection;
import com.arsdigita.formbuilder.PersistentWidget;
import com.arsdigita.formbuilder.WidgetLabel;
import com.arsdigita.formbuilder.util.FormBuilderUtil;
import com.arsdigita.formbuilder.util.GlobalizationUtil;
import com.arsdigita.bebop.BaseLink; import com.arsdigita.bebop.BaseLink;
import com.arsdigita.bebop.BoxPanel; import com.arsdigita.bebop.BoxPanel;
@ -52,6 +45,14 @@ import com.arsdigita.bebop.form.Widget;
import com.arsdigita.bebop.parameters.BigDecimalParameter; import com.arsdigita.bebop.parameters.BigDecimalParameter;
import com.arsdigita.bebop.util.Traversal; import com.arsdigita.bebop.util.Traversal;
import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.formbuilder.PersistentComponent;
import com.arsdigita.formbuilder.PersistentForm;
import com.arsdigita.formbuilder.PersistentFormSection;
import com.arsdigita.formbuilder.PersistentWidget;
import com.arsdigita.formbuilder.WidgetLabel;
import com.arsdigita.formbuilder.util.FormBuilderUtil;
import com.arsdigita.formbuilder.util.GlobalizationUtil;
import com.arsdigita.globalization.GlobalizedMessage;
import com.arsdigita.persistence.OID; import com.arsdigita.persistence.OID;
import com.arsdigita.util.UncheckedWrapperException; import com.arsdigita.util.UncheckedWrapperException;
import com.arsdigita.web.RedirectSignal; import com.arsdigita.web.RedirectSignal;
@ -62,10 +63,11 @@ import java.math.BigDecimal;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
* This class provides a basic UI component for editing the * This class provides a basic UI component for editing the controls on a
* controls on a persistent form. It is designed to be dropped * persistent form.
* into any page without requiring any significant additional *
* infrasructure * It is designed to be dropped into any page without requiring any significant
* additional infrasructure
*/ */
public class ControlEditor extends SimpleContainer { public class ControlEditor extends SimpleContainer {
private static final Logger s_log = Logger.getLogger( ControlEditor.class ); private static final Logger s_log = Logger.getLogger( ControlEditor.class );
@ -81,9 +83,8 @@ public class ControlEditor extends SimpleContainer {
private MoveControl m_move_control; private MoveControl m_move_control;
/** /**
* Constructor. Creates a new control editor widget, * Constructor creates a new control editor widget, for editing the form
* for editing the form specified in the single * specified in the single selection model. The key returned by the single
* selection model. The key returned by the single
* selection model should be an instance of the * selection model should be an instance of the
* {@link java.math.BigDecimal} class. * {@link java.math.BigDecimal} class.
* *
@ -96,15 +97,13 @@ public class ControlEditor extends SimpleContainer {
} }
/** /**
* Constructor. Creates a new control editor widget, * Constructor creates a new control editor widget, for editing the form
* for editing the form specified in the single * specified in the single selection model. The key returned by the single
* selection model. The key returned by the single
* selection model should be an instance of the * selection model should be an instance of the
* {@link java.math.BigDecimal} class. * {@link java.math.BigDecimal} class.
* *
* This constructor also allows the programmer * This constructor also allows the programmer to turn on the use of
* to turn on the use of form sections, although * form sections, although they must also call the setFormSectionModelBuilder
* they must also call the setFormSectionModelBuilder
* method to populate the list box. * method to populate the list box.
* *
* @param app the application type * @param app the application type
@ -120,6 +119,8 @@ public class ControlEditor extends SimpleContainer {
m_new_control = new NewControl(app); m_new_control = new NewControl(app);
m_new_section = new NewSection(form); m_new_section = new NewSection(form);
// NOTE: as of version 6.6 (including earlier versions) the help
// system doesn't work at all. Config should return null constant.
String helpURL = FormBuilderUtil.getConfig().getControlsHelpLink(); String helpURL = FormBuilderUtil.getConfig().getControlsHelpLink();
if (helpURL != null) { if (helpURL != null) {
add(new Link(new Label(GlobalizationUtil.globalize add(new Link(new Label(GlobalizationUtil.globalize
@ -185,7 +186,7 @@ public class ControlEditor extends SimpleContainer {
} }
public void respond(PageState state) public void respond(PageState state)
throws javax.servlet.ServletException { throws javax.servlet.ServletException {
super.respond(state); super.respond(state);
String name = state.getControlEventName(); String name = state.getControlEventName();
@ -327,7 +328,8 @@ public class ControlEditor extends SimpleContainer {
DomainObjectFactory.newInstance( formOID ); DomainObjectFactory.newInstance( formOID );
if (addItemEditObserver(state)) { if (addItemEditObserver(state)) {
section.setComponentAddObserver(new ItemEditAddObserver(ControlEditor.this, state)); section.setComponentAddObserver(new
ItemEditAddObserver(ControlEditor.this, state));
section.setFormContainer(new ColumnPanel(3)); section.setFormContainer(new ColumnPanel(3));
} else { } else {
section.setFormContainer(new ColumnPanel(2)); section.setFormContainer(new ColumnPanel(2));
@ -369,15 +371,37 @@ public class ControlEditor extends SimpleContainer {
m_state = state; m_state = state;
} }
/**
*
* @param dest
* @param component
* @return
* @deprecated
*/
protected BaseLink createLink(String dest, protected BaseLink createLink(String dest,
PersistentComponent component) { PersistentComponent component) {
GlobalizedMessage label;
if (dest == "delete") {
label = GlobalizationUtil.globalize("formbuilder.ui.delete");
} else if (dest == "move") {
label = GlobalizationUtil.globalize("formbuilder.ui.move");
} else {
label = GlobalizationUtil.globalize("formbuilder.ui.edit");
}
return new CallbackLink(m_handler, return new CallbackLink(m_handler,
"[" + dest + "]", // "[" + dest + "]",
label,
dest, dest,
component.getID().toString()); component.getID().toString());
} }
/**
*
*/
private class CallbackLink extends ControlLink { private class CallbackLink extends ControlLink {
Component m_handler; Component m_handler;
String m_action; String m_action;
String m_component; String m_component;
@ -393,6 +417,17 @@ public class ControlEditor extends SimpleContainer {
m_component = component; m_component = component;
} }
public CallbackLink(Component handler,
GlobalizedMessage label,
String action,
String component) {
super(new Label(label));
m_handler = handler;
m_action = action;
m_component = component;
}
public void setControlEvent(PageState state) { public void setControlEvent(PageState state) {
state.setControlEvent(m_handler, m_action, m_component); state.setControlEvent(m_handler, m_action, m_component);
} }

View File

@ -34,12 +34,25 @@ import com.arsdigita.formbuilder.PersistentComponent;
import com.arsdigita.util.UncheckedWrapperException; import com.arsdigita.util.UncheckedWrapperException;
/**
*
*
*/
public class ControlProperties extends MetaObjectProperties { public class ControlProperties extends MetaObjectProperties {
private SingleSelectionModel m_form; private SingleSelectionModel m_form;
private SingleSelectionModel m_type; private SingleSelectionModel m_type;
private SingleSelectionModel m_control; private SingleSelectionModel m_control;
/**
* Constructor.
*
* @param form
* @param type
* @param control
* @param app
*/
public ControlProperties(SingleSelectionModel form, public ControlProperties(SingleSelectionModel form,
SingleSelectionModel type, SingleSelectionModel type,
SingleSelectionModel control, SingleSelectionModel control,
@ -54,6 +67,11 @@ public class ControlProperties extends MetaObjectProperties {
} }
/**
*
* @param state
* @param visible
*/
public void setVisible(PageState state, public void setVisible(PageState state,
boolean visible) { boolean visible) {
super.setVisible(state, visible); super.setVisible(state, visible);
@ -73,7 +91,8 @@ public class ControlProperties extends MetaObjectProperties {
} else if (type != null) { } else if (type != null) {
setFormVisible(state, type); setFormVisible(state, type);
} else { } else {
throw new RuntimeException("Neither control or type parameters are set"); throw new RuntimeException(
"Neither control or type parameters are set");
} }
} }
} }
@ -101,7 +120,9 @@ public class ControlProperties extends MetaObjectProperties {
PropertiesEditor e = new PropertiesEditor(f); PropertiesEditor e = new PropertiesEditor(f);
return e; return e;
} catch (ClassCastException ex2) { } catch (ClassCastException ex2) {
throw new UncheckedWrapperException("Editor must be a PropertiesEditor or PropertiesForm", ex2); throw new UncheckedWrapperException(
"Editor must be a PropertiesEditor or PropertiesForm",
ex2);
} }
} }
} }

View File

@ -1,48 +0,0 @@
formbuilder.ui.hidden_field=Champ caché:
formbuilder.ui.editors.from=De:
formbuilder.ui.editors.subject=Objet:
formbuilder.ui.editors.body=Contenu:
formbuilder.ui.editors.url=URL:
formbuilder.ui.editors.query=Requète
formbuilder.ui.editors.multiselect=Sélection multiple
formbuilder.ui.editors.default_value=Valeur par défaut:
formbuilder.ui.editors.start_year=Année de début
formbuilder.ui.editors.end_year=Année de fin
formbuilder.ui.editors.value=Valeur:
formbuilder.ui.editors.add_option=Ajouter une option
formbuilder.ui.editors.option_label=Libellé de l'option
formbuilder.ui.editors.max_length=Longueur maximum
formbuilder.ui.editors.width=Largeur
formbuilder.ui.editors.name=Nom:
formbuilder.ui.editors.description=Description:
formbuilder.ui.editors.to=A:
formbuilder.ui.editors.label=Libellé:
formbuilder.ui.editors.height=Hauteur:
formbuilder.ui.editors.data_type=Type de donnée
formbuilder.ui.editors.answer_required=Réponse obligatoire:
formbuilder.ui.manage_questions_of_a_form=Gestion des questions d'un formulaire
formbuilder.ui.label_to_be_ignored=libellé à ignorer
formbuilder.ui.select_widget=Sélectionner le Widget
formbuilder.ui.move_question_to_position=Déplacer la question à la position
formbuilder.ui.you_are_about_to_delete_a_question=Vous êtes sur le point d'effacer une question
formbuilder.ui.form_properties=Propriété du formulaire
formbuilder.ui.view_persisted_form=Formulaire de vue persistante
formbuilder.ui.move_it_here=[déplacer ici]
formbuilder.ui.add_new=Ajouter un(e) nouveau(elle)
formbuilder.ui.action= action
formbuilder.ui.form_widget= formulaire widget
formbuilder.ui.form_section= formulaire section
formbuilder.ui.specify_options=Spécifier les options
formbuilder.ui.default_selection=Sélection par défaut
formbuilder.ui.value=Valeur
formbuilder.ui.is_answer_required=Est-ce que la réponse est obligatoire
formbuilder.ui.what_is_the_datatype_of_the_answer=Quel est le type de données de la réponse
formbuilder.ui.number_of_options_150_required=Nombre d'option (1-50, obligatoire)
formbuilder.util.return_to_index_page=Retour à la page d'index
formbuilder.ui.editors.edit=modifier
formbuilder.ui.editors.delete=effacer
formbuilder.ui.add_a_question_at_position=Ajouter une question à la position
formbuilder.ui.add_a_question_for_parameter=ajouter une question pour le paramètre
formbuilder.ui.move_question_to_position_1=Déplacer la question à la position (1-
formbuilder.ui.edit=modifier
formbuilder.ui.delete=effacer

View File

@ -16,15 +16,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
*/ */
package com.arsdigita.formbuilder.ui;
import com.arsdigita.formbuilder.PersistentComponent; package com.arsdigita.formbuilder.ui;
import com.arsdigita.formbuilder.PersistentForm;
import com.arsdigita.formbuilder.PersistentFormSection;
import com.arsdigita.formbuilder.PersistentWidget;
import com.arsdigita.formbuilder.WidgetLabel;
import com.arsdigita.formbuilder.ui.BaseAddObserver;
import com.arsdigita.formbuilder.util.GlobalizationUtil ;
import com.arsdigita.bebop.ColumnPanel; import com.arsdigita.bebop.ColumnPanel;
import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Component;
@ -39,6 +32,15 @@ import com.arsdigita.bebop.MetaForm;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.SingleSelectionModel; import com.arsdigita.bebop.SingleSelectionModel;
import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.formbuilder.PersistentComponent;
import com.arsdigita.formbuilder.PersistentForm;
import com.arsdigita.formbuilder.PersistentFormSection;
import com.arsdigita.formbuilder.PersistentWidget;
import com.arsdigita.formbuilder.WidgetLabel;
import com.arsdigita.formbuilder.ui.BaseAddObserver;
import com.arsdigita.formbuilder.util.GlobalizationUtil ;
import com.arsdigita.globalization.Globalized;
import com.arsdigita.globalization.GlobalizedMessage;
import com.arsdigita.persistence.OID; import com.arsdigita.persistence.OID;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -148,7 +150,7 @@ public class MoveControl extends MetaForm {
PersistentForm form = (PersistentForm)section; PersistentForm form = (PersistentForm)section;
return (Form)form.createComponent(); return (Form)form.createComponent();
} catch (ClassCastException ex) { } catch (ClassCastException ex) {
Form form = new Form("view_form", new ColumnPanel(1));//, new BoxPanel(BoxPanel.HORIZONTAL)); Form form = new Form("view_form", new ColumnPanel(1));
form.add((FormSection)section.createComponent()); form.add((FormSection)section.createComponent());
return form; return form;
} }
@ -245,16 +247,22 @@ public class MoveControl extends MetaForm {
} }
protected void addLabel(FormSection form) { protected void addLabel(FormSection form) {
Label l = new Label(GlobalizationUtil.globalize("formbuilder.ui.move_it_here")); Label l = new Label(GlobalizationUtil
.globalize("formbuilder.ui.move_it_here"));
form.add(l, GridPanel.FULL_WIDTH); form.add(l, GridPanel.FULL_WIDTH);
} }
protected void addLink(FormSection form, protected void addLink(FormSection form,
int row) { int row) {
ControlLink l = new MoveLink("[move it here]", row); ControlLink l = new MoveLink(GlobalizationUtil.globalize(
"formbuilder.ui.move_it_here"),
row);
form.add(l, GridPanel.FULL_WIDTH); form.add(l, GridPanel.FULL_WIDTH);
} }
/**
* Private classMoveLink extends ControlLonk to handle the row.
*/
private class MoveLink extends ControlLink { private class MoveLink extends ControlLink {
int m_row; int m_row;
@ -264,8 +272,16 @@ public class MoveControl extends MetaForm {
m_row = row; m_row = row;
} }
public MoveLink(GlobalizedMessage label,
int row) {
super(new Label(label));
m_row = row;
}
public void setControlEvent(PageState state) { public void setControlEvent(PageState state) {
state.setControlEvent(m_handler, "move", (new Integer(m_row)).toString()); state.setControlEvent(m_handler,
"move",
(new Integer(m_row)).toString());
} }
} }
} }

View File

@ -48,7 +48,8 @@ public class NewAction extends Form {
FormSection fs = new FormSection(new BoxPanel(BoxPanel.HORIZONTAL)); FormSection fs = new FormSection(new BoxPanel(BoxPanel.HORIZONTAL));
fs.add(new Label(GlobalizationUtil.globalize("formbuilder.ui.add_new"))); fs.add(new Label(GlobalizationUtil.globalize(
"formbuilder.ui.form_action.add_new_label")));
m_selection = new ParameterSingleSelectionModel(new BigDecimalParameter("type")); m_selection = new ParameterSingleSelectionModel(new BigDecimalParameter("type"));
@ -56,12 +57,13 @@ public class NewAction extends Form {
loadComponents(app); loadComponents(app);
fs.add(m_type); fs.add(m_type);
fs.add(new Label(GlobalizationUtil.globalize("formbuilder.ui.action"))); fs.add(new Submit(GlobalizationUtil.globalize(
fs.add(new Submit("Add")); "formbuilder.ui.form_action.add_button")));
add(fs); add(fs);
} }
@Override
public void register(Page page) { public void register(Page page) {
super.register(page); super.register(page);
page.addComponentStateParam(this, page.addComponentStateParam(this,
@ -74,8 +76,9 @@ public class NewAction extends Form {
*/ */
protected void loadComponents(String app) { protected void loadComponents(String app) {
try { try {
MetaObjectCollection objects = MetaObject.getWidgets(app, MetaObjectCollection objects = MetaObject
PersistentProcessListener.class); .getWidgets(app,
PersistentProcessListener.class);
objects.addOrder(MetaObject.PRETTY_NAME); objects.addOrder(MetaObject.PRETTY_NAME);
while (objects.next()) { while (objects.next()) {

View File

@ -16,73 +16,107 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
*/ */
package com.arsdigita.formbuilder.ui; package com.arsdigita.formbuilder.ui;
import com.arsdigita.formbuilder.util.GlobalizationUtil ;
import com.arsdigita.formbuilder.MetaObject;
import com.arsdigita.formbuilder.MetaObjectCollection;
import com.arsdigita.bebop.BoxPanel; import com.arsdigita.bebop.BoxPanel;
import com.arsdigita.bebop.Form;
import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.event.FormInitListener; import com.arsdigita.bebop.event.FormInitListener;
import com.arsdigita.bebop.event.FormSectionEvent; import com.arsdigita.bebop.event.FormSectionEvent;
import com.arsdigita.bebop.Form;
import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.FormSection;
import com.arsdigita.bebop.form.Option; import com.arsdigita.bebop.form.Option;
import com.arsdigita.bebop.form.SingleSelect; import com.arsdigita.bebop.form.SingleSelect;
import com.arsdigita.bebop.form.Submit; import com.arsdigita.bebop.form.Submit;
import com.arsdigita.bebop.Label;
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.util.UncheckedWrapperException;
import com.arsdigita.bebop.ParameterSingleSelectionModel; import com.arsdigita.bebop.ParameterSingleSelectionModel;
import com.arsdigita.bebop.parameters.BigDecimalParameter; import com.arsdigita.bebop.parameters.BigDecimalParameter;
import com.arsdigita.bebop.SingleSelectionModel; import com.arsdigita.bebop.SingleSelectionModel;
import com.arsdigita.bebop.FormSection;
import com.arsdigita.bebop.Page; import com.arsdigita.bebop.Page;
import com.arsdigita.bebop.parameters.NotNullValidationListener;
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.formbuilder.MetaObject;
import com.arsdigita.formbuilder.MetaObjectCollection;
import com.arsdigita.formbuilder.PersistentComponent; import com.arsdigita.formbuilder.PersistentComponent;
import com.arsdigita.formbuilder.util.GlobalizationUtil ;
import com.arsdigita.util.UncheckedWrapperException;
/**
* Class to create and manage a new control widget selected from a list of
* available form widets.
*
*
*/
public class NewControl extends Form { public class NewControl extends Form {
/** */
ParameterSingleSelectionModel m_selection; ParameterSingleSelectionModel m_selection;
/** */
SingleSelect m_type; SingleSelect m_type;
/**
* NewControl constructor, creates a form to select from a list of
* available form widgets and creates one upon request. Typically it is
* used by pachages which interactively create user input forms, e.g. the
* form item content type.
*
* @param app
*/
public NewControl(String app) { public NewControl(String app) {
super("new_control"); super("new_control");
/* Create a form to select and add a form control widget */
FormSection fs = new FormSection(new BoxPanel(BoxPanel.HORIZONTAL)); FormSection fs = new FormSection(new BoxPanel(BoxPanel.HORIZONTAL));
fs.add(new Label(GlobalizationUtil.globalize(
"formbuilder.ui.form_widget.add_new_label")));
fs.add(new Label(GlobalizationUtil.globalize("formbuilder.ui.add_new"))); m_selection = new ParameterSingleSelectionModel(
new BigDecimalParameter("type"));
m_selection = new ParameterSingleSelectionModel(new BigDecimalParameter("type"));
m_type = new SingleSelect(m_selection.getStateParameter()); m_type = new SingleSelect(m_selection.getStateParameter());
// Doesn't work. Checks for null right at the construction of the form.
// m_type.addOption(new
// Option("",
// new Label(GlobalizationUtil.globalize(
// "formbuilder.ui.form_widget.select_one"))
// ));
// Compare to NewSection.java
// m_type.addValidationListener(new NotNullValidationListener(
// GlobalizationUtil.globalize(
// "formbuilder.ui.form_widget.null_error")
// ));
loadComponents(app); loadComponents(app);
fs.add(m_type); fs.add(m_type);
fs.add(new Label(GlobalizationUtil.globalize("formbuilder.ui.form_widget"))); fs.add(new Submit( GlobalizationUtil.globalize(
fs.add(new Submit("Create")); "formbuilder.ui.form_widget.create_button") ));
addInitListener(new NewControlInitListener()); addInitListener(new NewControlInitListener());
add(fs); add(fs);
} }
/**
*
* @param page
*/
@Override
public void register(Page page) { public void register(Page page) {
super.register(page); super.register(page);
page.addComponentStateParam(this, page.addComponentStateParam(this,
m_selection.getStateParameter()); m_selection.getStateParameter());
} }
/**
*
* @param app
*/
protected void loadComponents(String app) { protected void loadComponents(String app) {
try { try {
MetaObjectCollection objects = MetaObject.getWidgets(app, MetaObjectCollection objects = MetaObject
PersistentComponent.class); .getWidgets(app,PersistentComponent.class);
objects.addOrder(MetaObject.PRETTY_NAME); objects.addOrder(MetaObject.PRETTY_NAME);
while (objects.next()) { while (objects.next()) {
@ -96,10 +130,17 @@ public class NewControl extends Form {
} }
} }
/**
*
* @return
*/
public SingleSelectionModel getSelection() { public SingleSelectionModel getSelection() {
return m_selection; return m_selection;
} }
/**
*
*/
private class NewControlInitListener implements FormInitListener { private class NewControlInitListener implements FormInitListener {
public void init(FormSectionEvent e) public void init(FormSectionEvent e)
throws FormProcessException { throws FormProcessException {
@ -107,7 +148,6 @@ public class NewControl extends Form {
// FIXME: what is the point of this method? -- 2002-11-26 // FIXME: what is the point of this method? -- 2002-11-26
// BigDecimal type = (BigDecimal)m_selection.getSelectedKey(e.getPageState()); // BigDecimal type = (BigDecimal)m_selection.getSelectedKey(e.getPageState());
//m_type.setOptionSelected(type.toString()); //m_type.setOptionSelected(type.toString());
} }
} }

View File

@ -18,10 +18,6 @@
*/ */
package com.arsdigita.formbuilder.ui; package com.arsdigita.formbuilder.ui;
import com.arsdigita.formbuilder.PersistentForm;
import com.arsdigita.formbuilder.PersistentFormSection;
import com.arsdigita.formbuilder.util.GlobalizationUtil ;
import com.arsdigita.bebop.BoxPanel; import com.arsdigita.bebop.BoxPanel;
import com.arsdigita.bebop.Form; import com.arsdigita.bebop.Form;
import com.arsdigita.bebop.FormSection; import com.arsdigita.bebop.FormSection;
@ -29,10 +25,14 @@ import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.SingleSelectionModel; import com.arsdigita.bebop.SingleSelectionModel;
import com.arsdigita.bebop.event.PrintListener; import com.arsdigita.bebop.event.PrintListener;
import com.arsdigita.bebop.form.Option;
import com.arsdigita.bebop.form.SingleSelect; import com.arsdigita.bebop.form.SingleSelect;
import com.arsdigita.bebop.form.Submit; import com.arsdigita.bebop.form.Submit;
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.formbuilder.PersistentForm;
import com.arsdigita.formbuilder.PersistentFormSection;
import com.arsdigita.formbuilder.util.GlobalizationUtil ;
import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.persistence.OID; import com.arsdigita.persistence.OID;
import com.arsdigita.util.UncheckedWrapperException; import com.arsdigita.util.UncheckedWrapperException;
@ -41,25 +41,47 @@ import com.arsdigita.xml.Element;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.TooManyListenersException; import java.util.TooManyListenersException;
/**
* Class to create and add a FormSection to a form item.
*
*/
public class NewSection extends Form { public class NewSection extends Form {
private SingleSelectionModel m_form; private SingleSelectionModel m_form;
private SingleSelect m_sections; private SingleSelect m_sections;
/**
* NewSection constructor, creates a form to select from a list of
* existing form sections and add it to a form item beeing edited.
* Typically it is used by packages which interactively create user input
* forms, e.g. the form item content type.
*
* @param form
*/
public NewSection(SingleSelectionModel form) { public NewSection(SingleSelectionModel form) {
super("new_section");
super("new_section");
m_form = form; m_form = form;
/* Create a form to select and add a form section */
FormSection fs = new FormSection(new BoxPanel(BoxPanel.HORIZONTAL)); FormSection fs = new FormSection(new BoxPanel(BoxPanel.HORIZONTAL));
fs.add(new Label(GlobalizationUtil.globalize(
"formbuilder.ui.form_section.add_new_label")));
m_sections = new SingleSelect(new BigDecimalParameter("section")); m_sections = new SingleSelect(new BigDecimalParameter("section"));
m_sections.addValidationListener m_sections.addOption(new
(new NotNullValidationListener Option("",
(GlobalizationUtil.globalize("formbuilder.ui.form_section_null_error"))); new Label(GlobalizationUtil.globalize(
fs.add(new Label(GlobalizationUtil.globalize("formbuilder.ui.add_new"))); "formbuilder.ui.form_section.select_one"))
));
m_sections.addValidationListener(new NotNullValidationListener(
GlobalizationUtil.globalize(
"formbuilder.ui.form_section.null_error")
));
fs.add(m_sections); fs.add(m_sections);
fs.add(new Label(GlobalizationUtil.globalize("formbuilder.ui.form_section"))); // fs.add(new Label(GlobalizationUtil.globalize("formbuilder.ui.form_section")));
fs.add(new Submit("Add")); fs.add(new Submit(GlobalizationUtil.globalize(
"formbuilder.ui.form_section.add_button") ));
add(fs); add(fs);
} }
@ -78,6 +100,7 @@ public class NewSection extends Form {
} }
} }
@Override
public void generateXML(PageState state, Element parent) { public void generateXML(PageState state, Element parent) {
OID formOID = new OID( PersistentFormSection.BASE_DATA_OBJECT_TYPE, OID formOID = new OID( PersistentFormSection.BASE_DATA_OBJECT_TYPE,
m_form.getSelectedKey(state) ); m_form.getSelectedKey(state) );

View File

@ -16,15 +16,9 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
*/ */
package com.arsdigita.formbuilder.ui; package com.arsdigita.formbuilder.ui;
import com.arsdigita.formbuilder.util.GlobalizationUtil ;
import com.arsdigita.formbuilder.PersistentFormSection;
import com.arsdigita.formbuilder.PersistentProcessListener;
import com.arsdigita.formbuilder.util.FormBuilderUtil;
import com.arsdigita.bebop.BoxPanel; import com.arsdigita.bebop.BoxPanel;
import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.ControlLink; import com.arsdigita.bebop.ControlLink;
@ -43,6 +37,10 @@ import com.arsdigita.bebop.event.TableActionListener;
import com.arsdigita.bebop.table.TableCellRenderer; import com.arsdigita.bebop.table.TableCellRenderer;
import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.formbuilder.PersistentFormSection;
import com.arsdigita.formbuilder.PersistentProcessListener;
import com.arsdigita.formbuilder.util.FormBuilderUtil;
import com.arsdigita.formbuilder.util.GlobalizationUtil ;
import com.arsdigita.persistence.OID; import com.arsdigita.persistence.OID;
import com.arsdigita.util.UncheckedWrapperException; import com.arsdigita.util.UncheckedWrapperException;
import com.arsdigita.web.RedirectSignal; import com.arsdigita.web.RedirectSignal;
@ -51,12 +49,13 @@ import java.io.IOException;
import java.math.BigDecimal; import java.math.BigDecimal;
/** /**
* This class provides a pluggable widget for editing the * This class provides a pluggable widget for editing the persistent process
* persistent process listeners for a persistent form. It * listeners for a persistent form.
* is designed to be used without requiring any significant * It is designed to be used without requiring any significant
* infrastructure on a page. * infrastructure on a page.
*/ */
public class ProcessListenerEditor extends SimpleContainer { public class ProcessListenerEditor extends SimpleContainer {
protected SingleSelectionModel m_form; protected SingleSelectionModel m_form;
protected SingleSelectionModel m_action; protected SingleSelectionModel m_action;
protected NewAction m_newAction; protected NewAction m_newAction;
@ -65,9 +64,8 @@ public class ProcessListenerEditor extends SimpleContainer {
protected ProcessListenerProperties m_edit_action; protected ProcessListenerProperties m_edit_action;
/** /**
* Constructor. Creates a new control editor widget, * Constructor, creates a new control editor widget for editing the form
* for editing the form specified in the single * specified in the single selection model. The key returned by the single
* selection model. The key returned by the single
* selection model should be an instance of the * selection model should be an instance of the
* {@link java.math.BigDecimal} class. * {@link java.math.BigDecimal} class.
* *
@ -77,11 +75,11 @@ public class ProcessListenerEditor extends SimpleContainer {
SingleSelectionModel form) { SingleSelectionModel form) {
m_form = form; m_form = form;
// Help system is currently not workable
String helpURL = FormBuilderUtil.getConfig().getActionsHelpLink(); String helpURL = FormBuilderUtil.getConfig().getActionsHelpLink();
if (helpURL != null) { if (helpURL != null) {
add(new Link(new Label(GlobalizationUtil.globalize add(new Link(new Label(GlobalizationUtil.globalize
("formbuilder.ui.help")), helpURL)); ("formbuilder.ui.help")), helpURL));
add(new Label("")); // spacer
} }
m_newAction = new NewAction(app); m_newAction = new NewAction(app);
@ -98,11 +96,14 @@ public class ProcessListenerEditor extends SimpleContainer {
if (column == 0) { if (column == 0) {
return new Label(l.getDescription()); return new Label(l.getDescription());
} else if (column == 1) { } else if (column == 1) {
ControlLink lk = new ControlLink( (String) GlobalizationUtil.globalize("formbuilder.ui.edit").localize()); ControlLink lk = new ControlLink( new Label(GlobalizationUtil
.globalize("formbuilder.ui.edit") ));
return lk; return lk;
} else if (column == 2) { } else if (column == 2) {
ControlLink lk = new ControlLink( (String) GlobalizationUtil.globalize("formbuilder.ui.delete").localize()); ControlLink lk = new ControlLink( new Label(GlobalizationUtil
lk.setConfirmation("Are you sure you wish to delete this action?"); .globalize("formbuilder.ui.delete") ));
lk.setConfirmation(GlobalizationUtil.globalize(
"formbuilder.ui.form_action.delete_confirm"));
return lk; return lk;
} }

View File

@ -102,7 +102,9 @@ public class ProcessListenerProperties extends MetaObjectProperties {
PropertiesEditor e = new PropertiesEditor(f); PropertiesEditor e = new PropertiesEditor(f);
return e; return e;
} catch (ClassCastException ex2) { } catch (ClassCastException ex2) {
throw new UncheckedWrapperException("Editor must be a PropertiesEditor or PropertiesForm", ex2); throw new UncheckedWrapperException(
"Editor must be a PropertiesEditor or PropertiesForm",
ex2);
} }
} }
} }

View File

@ -151,7 +151,9 @@ public abstract class WidgetForm extends PropertiesForm {
description.setCols(50); description.setCols(50);
description.setRows(5); description.setRows(5);
description.addValidationListener(new StringInRangeValidationListener(0, 200)); description.addValidationListener(new StringInRangeValidationListener(0, 200));
section.add(new Label(GlobalizationUtil.globalize("formbuilder.ui.editors.description")), ColumnPanel.RIGHT); section.add(new Label(GlobalizationUtil.globalize(
"formbuilder.ui.editors.description")),
ColumnPanel.RIGHT);
section.add(description); section.add(description);
m_description = description; m_description = description;
@ -159,7 +161,9 @@ public abstract class WidgetForm extends PropertiesForm {
protected void addRequiredRadioGroup(FormSection section) { protected void addRequiredRadioGroup(FormSection section) {
m_required = new RadioGroup( new BooleanParameter( "required" ) ); m_required = new RadioGroup( new BooleanParameter( "required" ) );
section.add(new Label(GlobalizationUtil.globalize("formbuilder.ui.editors.answer_required")), ColumnPanel.RIGHT); section.add(new Label(GlobalizationUtil.globalize(
"formbuilder.ui.editors.answer_required")),
ColumnPanel.RIGHT);
section.add(m_required); section.add(m_required);
m_required.addOption(new Option(Boolean.TRUE.toString(), "Yes")); m_required.addOption(new Option(Boolean.TRUE.toString(), "Yes"));
@ -360,7 +364,8 @@ public abstract class WidgetForm extends PropertiesForm {
try { try {
widget = getWidget(action); widget = getWidget(action);
} catch (DataObjectNotFoundException ex) { } catch (DataObjectNotFoundException ex) {
throw new FormProcessException("cannot find persistent widget " + action, ex); throw new FormProcessException("cannot find persistent widget "
+ action, ex);
} }
initWidgets(e, widget); initWidgets(e, widget);
} }

View File

@ -105,9 +105,11 @@ public abstract class WidgetLabelForm extends WidgetForm {
// Revision by CS Gupta // Revision by CS Gupta
if(!isEmailFormField()) if(!isEmailFormField())
return GlobalizationUtil.globalize("formbuilder.ui.editors.UserEmailLabel"); return GlobalizationUtil
.globalize("formbuilder.ui.editors.UserEmailLabel");
else else
return GlobalizationUtil.globalize("formbuilder.ui.editors.label"); return GlobalizationUtil
.globalize("formbuilder.ui.editors.label");
} }
@ -126,7 +128,8 @@ public abstract class WidgetLabelForm extends WidgetForm {
if (widget != null) { if (widget != null) {
WidgetLabel l = WidgetLabel.findByWidget(widget); WidgetLabel l = WidgetLabel.findByWidget(widget);
if( null == l ) if( null == l )
throw new FormProcessException("cannot find WidgetLabel for " + widget.getOID()); throw new FormProcessException("cannot find WidgetLabel for "
+ widget.getOID());
m_label.setValue(state, l.getLabel()); m_label.setValue(state, l.getLabel());
} else { } else {
@ -151,7 +154,8 @@ public abstract class WidgetLabelForm extends WidgetForm {
try { try {
l = WidgetLabel.findByWidget(widget); l = WidgetLabel.findByWidget(widget);
} catch (DataObjectNotFoundException ex) { } catch (DataObjectNotFoundException ex) {
throw new FormProcessException("cannot find WidgetLabel for " + widget.getOID()); throw new FormProcessException("cannot find WidgetLabel for "
+ widget.getOID());
} }
l.setLabel(label); l.setLabel(label);
@ -166,7 +170,8 @@ public abstract class WidgetLabelForm extends WidgetForm {
String label = (String)data.get("label"); String label = (String)data.get("label");
BigDecimal form_id = (BigDecimal)getSelection().getSelectedKey(e.getPageState()); BigDecimal form_id = (BigDecimal)getSelection()
.getSelectedKey(e.getPageState());
PersistentFormSection form = null; PersistentFormSection form = null;
try { try {

View File

@ -1,32 +0,0 @@
/*
* Copyright (C) 2001-2004 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.formbuilder.util;
/**
* @deprecated The functionality provided by this class is
* now part of the base com.arsdigita.xml.Element class
*/
public class ExtendedElement extends com.arsdigita.xml.Element {
public ExtendedElement( String name, String uri ) {
super(name, uri);
}
}

View File

@ -26,6 +26,7 @@ import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.form.TextField; import com.arsdigita.bebop.form.TextField;
import com.arsdigita.bebop.form.TextArea; import com.arsdigita.bebop.form.TextArea;
import com.arsdigita.bebop.FormData; import com.arsdigita.bebop.FormData;
import com.arsdigita.formbuilder.FormBuilderConfig;
import com.arsdigita.formbuilder.PersistentWidget; import com.arsdigita.formbuilder.PersistentWidget;
import com.arsdigita.formbuilder.parameters.PersistentParameterListener; import com.arsdigita.formbuilder.parameters.PersistentParameterListener;
import com.arsdigita.util.UncheckedWrapperException; import com.arsdigita.util.UncheckedWrapperException;
@ -56,6 +57,10 @@ public class FormBuilderUtil {
private static FormBuilderConfig s_config; private static FormBuilderConfig s_config;
/**
*
* @return
*/
public static FormBuilderConfig getConfig() { public static FormBuilderConfig getConfig() {
if (s_config == null) { if (s_config == null) {
s_config = new FormBuilderConfig(); s_config = new FormBuilderConfig();
@ -65,12 +70,22 @@ public class FormBuilderUtil {
} }
public static void addTextFieldToForm(FormSection form, String name, String label) { /**
*
* @param form
* @param name
* @param label
*/
public static void addTextFieldToForm(FormSection form,
String name,
String label) {
form.add(new Label(label)); form.add(new Label(label));
form.add(new TextField(name)); form.add(new TextField(name));
} }
public static void addTextAreaToForm(FormSection form, String name, String label) { public static void addTextAreaToForm(FormSection form,
String name,
String label) {
form.add(new Label(label)); form.add(new Label(label));
form.add(new TextArea(name)); form.add(new TextArea(name));
} }
@ -88,9 +103,16 @@ public class FormBuilderUtil {
} }
/**
*
* @param className
* @param arg
* @return
*/
public static Object instantiateObjectOneArg(String className, public static Object instantiateObjectOneArg(String className,
Object arg) { Object arg) {
s_log.info("instantiate object class " + className + " arg class " + arg.getClass()); s_log.info("instantiate object class " + className +
" arg class " + arg.getClass());
Class argClass = arg.getClass(); Class argClass = arg.getClass();
RuntimeException exn = null; RuntimeException exn = null;
while (argClass != null) { while (argClass != null) {
@ -109,10 +131,22 @@ public class FormBuilderUtil {
throw exn; throw exn;
} }
/**
*
* @param className
* @return
*/
public static Object instantiateObject(String className) { public static Object instantiateObject(String className) {
return instantiateObject(className, new Class[] {}, new Object[] {}); return instantiateObject(className, new Class[] {}, new Object[] {});
} }
/**
*
* @param className
* @param argumentTypes
* @param arguments
* @return
*/
public static Object instantiateObject(String className, public static Object instantiateObject(String className,
Class[] argumentTypes, Class[] argumentTypes,
Object[] arguments) { Object[] arguments) {
@ -137,6 +171,11 @@ public class FormBuilderUtil {
return object; return object;
} }
/**
*
* @param className
* @return
*/
public static Class loadClass(String className) { public static Class loadClass(String className) {
Class returnClass = null; Class returnClass = null;
@ -168,7 +207,8 @@ public class FormBuilderUtil {
} }
if (!argumentIsValid) { if (!argumentIsValid) {
throw new IllegalArgumentException("Integer argument with value " + argument + throw new IllegalArgumentException("Integer argument with value " +
argument +
" is out of range. Should be between " + " is out of range. Should be between " +
lowerLimit + " and " + upperLimit); lowerLimit + " and " + upperLimit);
} }

View File

@ -26,13 +26,9 @@ import com.arsdigita.formbuilder.MetaObject;
import com.arsdigita.formbuilder.PersistentProcessListener; import com.arsdigita.formbuilder.PersistentProcessListener;
import com.arsdigita.formbuilder.PersistentDataQuery; import com.arsdigita.formbuilder.PersistentDataQuery;
import com.arsdigita.formbuilder.PersistentComponent; import com.arsdigita.formbuilder.PersistentComponent;
//__import com.arsdigita.kernel.BaseInitializer;
// import com.arsdigita.persistence.SessionManager;
// import com.arsdigita.persistence.TransactionContext;
import com.arsdigita.runtime.ConfigError; import com.arsdigita.runtime.ConfigError;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;

View File

@ -32,7 +32,8 @@ import com.arsdigita.globalization.GlobalizedMessage;
public class GlobalizationUtil implements Globalized { public class GlobalizationUtil implements Globalized {
private static final String BUNDLE_NAME = "com.arsdigita.formbuilder/ui/FormbuilderResources"; private static final String BUNDLE_NAME =
"com.arsdigita.formbuilder.FormbuilderResources";
public static GlobalizedMessage globalize(String key) { public static GlobalizedMessage globalize(String key) {
return new GlobalizedMessage(key, BUNDLE_NAME); return new GlobalizedMessage(key, BUNDLE_NAME);