diff --git a/ccm-ldn-types-esdservice/.svnignore b/ccm-ldn-types-esdservice/.svnignore new file mode 100755 index 000000000..378eac25d --- /dev/null +++ b/ccm-ldn-types-esdservice/.svnignore @@ -0,0 +1 @@ +build diff --git a/ccm-ldn-types-esdservice/application.xml b/ccm-ldn-types-esdservice/application.xml new file mode 100755 index 000000000..d6f030814 --- /dev/null +++ b/ccm-ldn-types-esdservice/application.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + The EsdService Content Type for created for Tameside project. + + diff --git a/ccm-ldn-types-esdservice/pdl/com/arsdigita/content-types/ESDService.pdl b/ccm-ldn-types-esdservice/pdl/com/arsdigita/content-types/ESDService.pdl new file mode 100755 index 000000000..6559ac778 --- /dev/null +++ b/ccm-ldn-types-esdservice/pdl/com/arsdigita/content-types/ESDService.pdl @@ -0,0 +1,36 @@ +// +// 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 + +model com.arsdigita.cms.contenttypes; + +import com.arsdigita.cms.TextPage; + +// object type to hold Contact content type +object type ESDService extends TextPage { + String[0..1] serviceTimes = ct_esdservice.servicetimes VARCHAR(500); + + reference key ( ct_esdservice.service_id ); + aggressive load (serviceContact.id); +} + +association { + Contact[0..1] serviceContact = join ct_esdservice.contact_id to + ct_contacts.contact_id; + ESDService[0..n] contactService = join ct_contacts.contact_id to + ct_esdservice.contact_id; +} + diff --git a/ccm-ldn-types-esdservice/sql/ccm-cms-types-esdservice/oracle-se-create.sql b/ccm-ldn-types-esdservice/sql/ccm-cms-types-esdservice/oracle-se-create.sql new file mode 100755 index 000000000..94811d48d --- /dev/null +++ b/ccm-ldn-types-esdservice/sql/ccm-cms-types-esdservice/oracle-se-create.sql @@ -0,0 +1,20 @@ +-- +-- 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 + +@@ ddl/oracle-se/create.sql +@@ ddl/oracle-se/deferred.sql + diff --git a/ccm-ldn-types-esdservice/sql/ccm-cms-types-esdservice/postgres-create.sql b/ccm-ldn-types-esdservice/sql/ccm-cms-types-esdservice/postgres-create.sql new file mode 100755 index 000000000..799d38bbb --- /dev/null +++ b/ccm-ldn-types-esdservice/sql/ccm-cms-types-esdservice/postgres-create.sql @@ -0,0 +1,20 @@ +-- +-- 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 + +\i ddl/postgres/create.sql +\i ddl/postgres/deferred.sql + diff --git a/ccm-ldn-types-esdservice/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/ESDService.xml b/ccm-ldn-types-esdservice/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/ESDService.xml new file mode 100755 index 000000000..96b62c016 --- /dev/null +++ b/ccm-ldn-types-esdservice/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/ESDService.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + diff --git a/ccm-ldn-types-esdservice/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/ESDService.xml b/ccm-ldn-types-esdservice/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/ESDService.xml new file mode 100755 index 000000000..17c49e6b1 --- /dev/null +++ b/ccm-ldn-types-esdservice/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/ESDService.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + diff --git a/ccm-ldn-types-esdservice/src/ccm-cms-types-esdservice.config b/ccm-ldn-types-esdservice/src/ccm-cms-types-esdservice.config new file mode 100755 index 000000000..adfdba100 --- /dev/null +++ b/ccm-ldn-types-esdservice/src/ccm-cms-types-esdservice.config @@ -0,0 +1,4 @@ + + + + diff --git a/ccm-ldn-types-esdservice/src/ccm-cms-types-esdservice.load b/ccm-ldn-types-esdservice/src/ccm-cms-types-esdservice.load new file mode 100755 index 000000000..695743f15 --- /dev/null +++ b/ccm-ldn-types-esdservice/src/ccm-cms-types-esdservice.load @@ -0,0 +1,17 @@ + + + +
+
+
+ + + +
+ + + + + + + diff --git a/ccm-ldn-types-esdservice/src/com/arsdigita/cms/contenttypes/ESDService.java b/ccm-ldn-types-esdservice/src/com/arsdigita/cms/contenttypes/ESDService.java new file mode 100755 index 000000000..c66b59103 --- /dev/null +++ b/ccm-ldn-types-esdservice/src/com/arsdigita/cms/contenttypes/ESDService.java @@ -0,0 +1,121 @@ +/* + * 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.cms.contenttypes; + +import com.arsdigita.cms.TextPage; +import com.arsdigita.cms.ContentType; +import com.arsdigita.domain.DataObjectNotFoundException; +import com.arsdigita.domain.DomainObjectFactory; +import com.arsdigita.persistence.DataObject; +import com.arsdigita.persistence.OID; +import com.arsdigita.util.Assert; + +import java.math.BigDecimal; + +/** + * Domain object class to represent ESDService content type. + * + * @author Shashin Shinde sshinde@redhat.com + * @version $Id: ESDService.java 287 2005-02-22 00:29:02Z sskracic $ + */ +public class ESDService extends TextPage { + + /** data object type for this domain object */ + public static final String BASE_DATA_OBJECT_TYPE = + "com.arsdigita.cms.contenttypes.ESDService"; + + public static final String SERVICE_CONTACT = "serviceContact"; + public static final String SERVICE_TIMES = "serviceTimes"; + + /** Default constructor. */ + public ESDService() { + super(BASE_DATA_OBJECT_TYPE); + } + + /** + * @param oid + * @throws DataObjectNotFoundException + */ + public ESDService(OID oid) throws DataObjectNotFoundException { + super(oid); + } + + /** + * @param id + * @throws DataObjectNotFoundException + */ + public ESDService(BigDecimal id) throws DataObjectNotFoundException { + this(new OID(BASE_DATA_OBJECT_TYPE , id)); + } + + /** + * @param obj + */ + public ESDService(DataObject obj) { + super(obj); + } + + /** + * @param type + */ + public ESDService(String type) { + super(type); + } + + public void beforeSave() { + super.beforeSave(); + Assert.exists(getContentType(), ContentType.class); + } + + /** + * Over-ride to return the proper type for this object. + */ + public String getBaseDataObjectType() { + return BASE_DATA_OBJECT_TYPE; + } + + /** + * Get the associated Contact object for this ESDService. + * @return null if no Contact is present. + */ + public Contact getContact() { + DataObject dobj = (DataObject) get(SERVICE_CONTACT); + if (dobj != null) { + return (Contact) DomainObjectFactory.newInstance(dobj); + } + return null; + } + + /** + * set the Contact object association. + * @pre ct != null + */ + public void setContact(Contact ct) { + Assert.exists(ct, Contact.class); + setAssociation(SERVICE_CONTACT , ct); + } + + public String getServiceTimes() { + return (String) get(SERVICE_TIMES); + } + + public void setServiceTimes(String st) { + set(SERVICE_TIMES , st); + } + +} diff --git a/ccm-ldn-types-esdservice/src/com/arsdigita/cms/contenttypes/ESDServiceInitializer.java b/ccm-ldn-types-esdservice/src/com/arsdigita/cms/contenttypes/ESDServiceInitializer.java new file mode 100755 index 000000000..ff85b2d3c --- /dev/null +++ b/ccm-ldn-types-esdservice/src/com/arsdigita/cms/contenttypes/ESDServiceInitializer.java @@ -0,0 +1,45 @@ +/* + * 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.cms.contenttypes; + +/** + * Initializer class to initialize ContentType ESDService. + * Defines the content type specific properties and just uses the super class + * methods to register the content type with the (transient) content type store + * (map). + * + * @author Shashin Shinde sshinde@redhat.com + * @version $Id: ESDServiceInitializer.java 287 2005-02-22 00:29:02Z sskracic $ + */ +public class ESDServiceInitializer extends ContentTypeInitializer { + + public ESDServiceInitializer() { + super("ccm-cms-types-esdservice.pdl.mf", ESDService.BASE_DATA_OBJECT_TYPE); + } + + public String[] getStylesheets() { + return new String [] { + "/static/content-types/com/arsdigita/cms/contenttypes/ESDService.xsl", + }; + } + + public String getTraversalXML() { + return "/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/ESDService.xml"; + } + +} diff --git a/ccm-ldn-types-esdservice/src/com/arsdigita/cms/contenttypes/ESDServiceLoader.java b/ccm-ldn-types-esdservice/src/com/arsdigita/cms/contenttypes/ESDServiceLoader.java new file mode 100755 index 000000000..083f67035 --- /dev/null +++ b/ccm-ldn-types-esdservice/src/com/arsdigita/cms/contenttypes/ESDServiceLoader.java @@ -0,0 +1,41 @@ +/* + * 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.cms.contenttypes; + +/** + * Loader for ContentType ESDService. + * + * @author Shashin Shinde sshinde@redhat.com + * + * @version $Id: ESDServiceLoader.java 287 2005-02-22 00:29:02Z sskracic $ + * + */ +public class ESDServiceLoader extends AbstractContentTypeLoader { + + private static final String[] TYPES = { + "/WEB-INF/content-types/com/arsdigita/cms/contenttypes/ESDService.xml" + }; + + /** + * @see com.arsdigita.cms.contenttypes.AbstractContentTypeLoader#getTypes() + */ + public String[] getTypes() { + return TYPES; + } + +} diff --git a/ccm-ldn-types-esdservice/src/com/arsdigita/cms/contenttypes/ESDServiceResources.properties b/ccm-ldn-types-esdservice/src/com/arsdigita/cms/contenttypes/ESDServiceResources.properties new file mode 100755 index 000000000..47f51cdc4 --- /dev/null +++ b/ccm-ldn-types-esdservice/src/com/arsdigita/cms/contenttypes/ESDServiceResources.properties @@ -0,0 +1 @@ +cms.contenttypes.ui.esdservice.servicetimes=Service Times diff --git a/ccm-ldn-types-esdservice/src/com/arsdigita/cms/contenttypes/package.html b/ccm-ldn-types-esdservice/src/com/arsdigita/cms/contenttypes/package.html new file mode 100644 index 000000000..4a12d2ae1 --- /dev/null +++ b/ccm-ldn-types-esdservice/src/com/arsdigita/cms/contenttypes/package.html @@ -0,0 +1,14 @@ + + + +ESD Service content type + + + +

+ +

+ + + + diff --git a/ccm-ldn-types-esdservice/src/com/arsdigita/cms/contenttypes/ui/ESDServiceChooseContactStep.java b/ccm-ldn-types-esdservice/src/com/arsdigita/cms/contenttypes/ui/ESDServiceChooseContactStep.java new file mode 100755 index 000000000..532fed4be --- /dev/null +++ b/ccm-ldn-types-esdservice/src/com/arsdigita/cms/contenttypes/ui/ESDServiceChooseContactStep.java @@ -0,0 +1,82 @@ +/* + * 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.cms.contenttypes.ui; + +import com.arsdigita.bebop.Component; +import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.contenttypes.util.ContactGlobalizationUtil; +import com.arsdigita.cms.ui.authoring.AuthoringKitWizard; +import com.arsdigita.cms.ui.authoring.SimpleEditStep; +import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess; +import com.arsdigita.toolbox.ui.DomainObjectPropertySheet; + +/** + * Authoring kit step to manipulate the associated Contact object for + * ESDService content type. + * + * @author Shashin Shinde sshinde@redhat.com + * + * @version $Id: ESDServiceChooseContactStep.java 287 2005-02-22 00:29:02Z sskracic $ + * + */ +public class ESDServiceChooseContactStep extends SimpleEditStep { + + /** The name of the editing sheet added to this step */ + private static String EDIT_SHEET_NAME = "edit"; + + /** + * @param itemModel + * @param parent + */ + public ESDServiceChooseContactStep(ItemSelectionModel itemModel, + AuthoringKitWizard parent) { + super(itemModel, parent); + + //Table to display the List of Contacts to choose from. + ESDServiceContactsTable table = new ESDServiceContactsTable(itemModel , this); + + addComponent(EDIT_SHEET_NAME, + "Select Contact", + new WorkflowLockedComponentAccess(table, itemModel)); + + setDisplayComponent(getContactPropertiesSheet(itemModel)); + } + + /** + * Create a Component to display the properties of Contact object.It only + * displays limited attributes at the moment, but can be extended to add + * addtional ones if needed. + */ + private Component getContactPropertiesSheet(ItemSelectionModel itemModel) { + DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel); + + sheet.add( + ContactGlobalizationUtil.globalize("cms.contenttypes.ui.contact_givenname"), + "serviceContact.givenName"); + + sheet.add( + ContactGlobalizationUtil.globalize("cms.contenttypes.ui.contact_familyname"), + "serviceContact.familyName"); + + sheet.add( + ContactGlobalizationUtil.globalize("cms.contenttypes.ui.contact_type"), + "serviceContact.contactType.typeName"); + + return sheet; + } +} diff --git a/ccm-ldn-types-esdservice/src/com/arsdigita/cms/contenttypes/ui/ESDServiceContactsTable.java b/ccm-ldn-types-esdservice/src/com/arsdigita/cms/contenttypes/ui/ESDServiceContactsTable.java new file mode 100755 index 000000000..cf413ab26 --- /dev/null +++ b/ccm-ldn-types-esdservice/src/com/arsdigita/cms/contenttypes/ui/ESDServiceContactsTable.java @@ -0,0 +1,209 @@ +/* + * 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.cms.contenttypes.ui; + +import com.arsdigita.cms.ContentItem; +import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.contenttypes.Contact; +import com.arsdigita.cms.contenttypes.ESDService; + +import com.arsdigita.bebop.Component; +import com.arsdigita.bebop.ControlLink; +import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.PageState; +import com.arsdigita.bebop.Table; +import com.arsdigita.bebop.event.TableActionEvent; +import com.arsdigita.bebop.event.TableActionListener; +import com.arsdigita.bebop.table.TableCellRenderer; +import com.arsdigita.bebop.table.TableColumn; +import com.arsdigita.bebop.table.TableColumnModel; +import com.arsdigita.bebop.table.TableModel; +import com.arsdigita.bebop.table.TableModelBuilder; +import com.arsdigita.domain.DomainObjectFactory; +import com.arsdigita.persistence.DataCollection; +import com.arsdigita.persistence.OID; +import com.arsdigita.persistence.SessionManager; +import com.arsdigita.util.LockableImpl; + +import java.math.BigDecimal; + +/** + * + * A table which displays a list of Contact objects to choose + * from for the ESDService content type. + * + * @author Shashin Shinde sshinde@redhat.com + * + * @version $Id: ESDServiceContactsTable.java 451 2005-03-20 23:11:22Z mbooth $ + * + */ +public class ESDServiceContactsTable extends Table implements TableActionListener{ + + private static final String COL_CONTACT_GIVENNAME = "Given Name"; + private static final String COL_CONTACT_FAMILYNAME = "Family Name"; + private static final String COL_CONTACT_TYPE = "Contact Type"; + private static final String COL_CHOOSE_CONTACT = "Select"; + + private ItemSelectionModel m_selService; + private ESDServiceChooseContactStep m_parent; + + /** + * Constructor. + * @param selService, selection model which will give the ESDService + * object that we are dealing with. + * @param parent, component whose display pane will be shown when the selection + * of desired contact is done. + */ + public ESDServiceContactsTable(ItemSelectionModel selService, + ESDServiceChooseContactStep parent) { + super(); + + m_parent = parent; + m_selService = selService; + + TableColumnModel model = getColumnModel(); + model.add( new TableColumn( 0, COL_CONTACT_GIVENNAME)); + model.add( new TableColumn( 1, COL_CONTACT_FAMILYNAME )); + model.add( new TableColumn( 2, COL_CONTACT_TYPE)); + model.add( new TableColumn( 3, COL_CHOOSE_CONTACT)); + + setEmptyView(new Label("No Contacts available.")); + setModelBuilder(new ContactsTableModelBuilder()); + + model.get(3).setCellRenderer(new SelectCellRenderer()); + + addTableActionListener(this); + + } + + /** + * Model Builder to build the required data for the table. + */ + private class ContactsTableModelBuilder extends LockableImpl implements TableModelBuilder { + + public TableModel makeModel ( Table table, PageState state ) { + table.getRowSelectionModel().clearSelection(state); + DataCollection m_contacts = SessionManager.getSession().retrieve(Contact.BASE_DATA_OBJECT_TYPE); + m_contacts.addEqualsFilter(ContentItem.VERSION, ContentItem.DRAFT); + return new ContactsTableModel(table, m_contacts); + } + } + + private class ContactsTableModel implements TableModel{ + + private Table m_table; + private DataCollection m_contacts; + private Contact m_contact; + + private ContactsTableModel(Table t , DataCollection cts){ + m_table = t; + m_contacts = cts; + } + + /** Return the no. of columns in column model we have constructed. */ + public int getColumnCount() { + return m_table.getColumnModel().size(); + } + + /** + * check collection for the existence of another row.If it has fetch the + * value of Contact object into m_contact class variable. + */ + public boolean nextRow() { + if(m_contacts.next()){ + m_contact = (Contact) DomainObjectFactory.newInstance(m_contacts.getDataObject()); + return true; + }else{ + return false; + } + } + + /** + * Return the attributes of Contact object in the current row. + * @see com.arsdigita.bebop.table.TableModel#getElementAt(int) + */ + public Object getElementAt(int columnIndex) { + + switch (columnIndex){ + case 0: + return m_contact.getGivenName(); + case 1: + return m_contact.getFamilyName(); + case 2: + return m_contact.getContactTypeName(); + case 3: + return COL_CHOOSE_CONTACT; + default: + return null; + } + } + + /** + * Always return the ID of Contact represented by current row. + * @see com.arsdigita.bebop.table.TableModel#getKeyAt(int) + */ + public Object getKeyAt(int columnIndex) { + return m_contact.getID(); + } + } + + /** + * TODO:Check for the permissions to EDIT item and put either a Lable or + * a ControlLink accordingly. + */ + private class SelectCellRenderer extends LockableImpl implements TableCellRenderer{ + + public Component getComponent(Table table,PageState state,Object value, + boolean isSelected,Object key, + int row,int column) { + + + ControlLink link = new ControlLink(value.toString()); + link.setConfirmation("Select this Contact ?"); + return link; + } + } + + /** + * Provide implementation to TableActionListener method. + * Code that comes into picture when select link in the table is clicked. + * Handles selection event. + */ + public void cellSelected(TableActionEvent evt) { + PageState state = evt.getPageState(); + TableColumn col = getColumnModel().get(evt.getColumn().intValue()); + String colName = (String) col.getHeaderValue(); + + if ( COL_CHOOSE_CONTACT.equals(colName) ) { + m_parent.showDisplayPane(state); + BigDecimal contactID = new BigDecimal(evt.getRowKey().toString()); + ESDService service = (ESDService) m_selService.getSelectedObject(state); + Contact ct = (Contact) DomainObjectFactory.newInstance(new OID(Contact.BASE_DATA_OBJECT_TYPE,contactID)); + service.setContact(ct); + } + } + + /** + * provide Implementation to TableActionListener method. + * Does nothing in our case. + */ + public void headSelected(TableActionEvent e) { + throw new UnsupportedOperationException("Not Implemented"); + } +} + diff --git a/ccm-ldn-types-esdservice/src/com/arsdigita/cms/contenttypes/ui/ESDServicePropertiesForm.java b/ccm-ldn-types-esdservice/src/com/arsdigita/cms/contenttypes/ui/ESDServicePropertiesForm.java new file mode 100755 index 000000000..957fcf61b --- /dev/null +++ b/ccm-ldn-types-esdservice/src/com/arsdigita/cms/contenttypes/ui/ESDServicePropertiesForm.java @@ -0,0 +1,87 @@ +/* + * 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.cms.contenttypes.ui; + +import com.arsdigita.bebop.FormData; +import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.event.FormSectionEvent; +import com.arsdigita.bebop.form.TextField; +import com.arsdigita.bebop.parameters.ParameterModel; +import com.arsdigita.bebop.parameters.StringParameter; +import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.contenttypes.ESDService; +import com.arsdigita.cms.contenttypes.util.ESDServiceGlobalizationUtil; +import com.arsdigita.cms.ui.authoring.BasicPageForm; + +/** + * Form to edit basic properties of ESDService content type object. + * + * @author Shashin Shinde sshinde@redhat.com + * + * @version $Id: ESDServicePropertiesForm.java 287 2005-02-22 00:29:02Z sskracic $ + * + */ +public class ESDServicePropertiesForm extends BasicPageForm { + + /** Name of this form */ + private static final String ID = "ESDService_edit"; + + + /** + * @param itemModel + */ + public ESDServicePropertiesForm(ItemSelectionModel itemModel) { + super(ID, itemModel); + } + + /** + * Adds widgets to the form. + **/ + protected void addWidgets() { + super.addWidgets(); + + add(new Label(ESDServiceGlobalizationUtil.globalize("cms.contenttypes.ui.esdservice.servicetimes"))); + ParameterModel serviceTimesParam = new StringParameter(ESDService.SERVICE_TIMES); + TextField serviceTimes = new TextField(serviceTimesParam); + add(serviceTimes); + } + + /** + * Initialize Form with values if already set. + */ + public void init(FormSectionEvent fse) { + FormData data = fse.getFormData(); + ESDService esdService = (ESDService) super.initBasicWidgets(fse); + data.put(ESDService.SERVICE_TIMES, esdService.getServiceTimes()); + } + + /** + * Process this form and set the values from form. + */ + public void process(FormSectionEvent fse) { + FormData data = fse.getFormData(); + ESDService esdService = (ESDService) super.processBasicWidgets(fse); + + // save only if save button was pressed + if (esdService != null + && getSaveCancelSection().getSaveButton().isSelected(fse.getPageState())) { + + esdService.setServiceTimes((String) data.get(ESDService.SERVICE_TIMES)); + } + } +} diff --git a/ccm-ldn-types-esdservice/src/com/arsdigita/cms/contenttypes/ui/ESDServicePropertiesStep.java b/ccm-ldn-types-esdservice/src/com/arsdigita/cms/contenttypes/ui/ESDServicePropertiesStep.java new file mode 100755 index 000000000..3b9588e33 --- /dev/null +++ b/ccm-ldn-types-esdservice/src/com/arsdigita/cms/contenttypes/ui/ESDServicePropertiesStep.java @@ -0,0 +1,87 @@ +/* + * 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.cms.contenttypes.ui; + +import com.arsdigita.bebop.Component; +import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.contenttypes.ESDService; +import com.arsdigita.cms.contenttypes.util.ESDServiceGlobalizationUtil; +import com.arsdigita.cms.ui.authoring.AuthoringKitWizard; +import com.arsdigita.cms.ui.authoring.SimpleEditStep; +import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess; +import com.arsdigita.toolbox.ui.DomainObjectPropertySheet; +import com.arsdigita.cms.util.GlobalizationUtil; + +/** + * Authoring kit step to edit the basic properties of ESDService + * content type object. + * + * @author Shashin Shinde sshinde@redhat.com + * + * @version $Id: ESDServicePropertiesStep.java 287 2005-02-22 00:29:02Z sskracic $ + * + */ +public class ESDServicePropertiesStep extends SimpleEditStep { + + /** The name of the editing sheet added to this step */ + private static String EDIT_SHEET_NAME = "edit"; + + /** + * @param itemModel + * @param parent + */ + public ESDServicePropertiesStep(ItemSelectionModel itemModel, + AuthoringKitWizard parent) { + super(itemModel, parent); + + ESDServicePropertiesForm editSheet; + + editSheet = new ESDServicePropertiesForm(itemModel); + add(EDIT_SHEET_NAME, + "Edit", + new WorkflowLockedComponentAccess(editSheet, itemModel), + editSheet.getSaveCancelSection().getCancelButton()); + + setDisplayComponent(getESDServicePropertySheet(itemModel)); + } + + /** + * Returns a component that displays the properties of the ESDService + * specified by the ItemSelectionModel passed in. + * + * @param itemModel The ItemSelectionModel to use + * @pre itemModel != null + * @return A component to display the state of the basic properties + * of the + **/ + public static Component getESDServicePropertySheet(ItemSelectionModel itemModel) { + DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel); + + sheet.add( + GlobalizationUtil.globalize("cms.contenttypes.ui.name"), + ESDService.NAME); + + sheet.add( + ESDServiceGlobalizationUtil.globalize("cms.contenttypes.ui.esdservice.servicetimes"), + ESDService.SERVICE_TIMES); + + return sheet; + + } + +} diff --git a/ccm-ldn-types-esdservice/src/com/arsdigita/cms/contenttypes/util/ESDServiceGlobalizationUtil.java b/ccm-ldn-types-esdservice/src/com/arsdigita/cms/contenttypes/util/ESDServiceGlobalizationUtil.java new file mode 100755 index 000000000..6f4ac1714 --- /dev/null +++ b/ccm-ldn-types-esdservice/src/com/arsdigita/cms/contenttypes/util/ESDServiceGlobalizationUtil.java @@ -0,0 +1,54 @@ +/* + * 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.cms.contenttypes.util; + +import com.arsdigita.globalization.GlobalizedMessage; + +/** + *

+ * Contains methods to simplify globalizing keys related to + * ESDService content type object. + *

+ + * @author Shashin Shinde sshinde@redhat.com + * + * @version $Id: ESDServiceGlobalizationUtil.java 287 2005-02-22 00:29:02Z sskracic $ + * + */ +public class ESDServiceGlobalizationUtil { + + final public static String BUNDLE_NAME = + "com.arsdigita.cms.contenttypes.util.ESDServiceResourceBundle"; + + /** + * This returns a globalized message using the type specific bundle, + * BUNDLE_NAME + */ + public static GlobalizedMessage globalize(String key) { + return new GlobalizedMessage(key, BUNDLE_NAME); + } + + /** + * This returns a globalized message using the type specific bundle, + * BUNDLE_NAME + */ + public static GlobalizedMessage globalize(String key, Object[] args) { + return new GlobalizedMessage(key, BUNDLE_NAME, args); + } + +} diff --git a/ccm-ldn-types-esdservice/src/com/arsdigita/cms/contenttypes/util/ESDServiceResourceBundle.java b/ccm-ldn-types-esdservice/src/com/arsdigita/cms/contenttypes/util/ESDServiceResourceBundle.java new file mode 100755 index 000000000..edfd254a6 --- /dev/null +++ b/ccm-ldn-types-esdservice/src/com/arsdigita/cms/contenttypes/util/ESDServiceResourceBundle.java @@ -0,0 +1,42 @@ +/* + * 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.cms.contenttypes.util; + +import com.arsdigita.cms.CMSGlobalized; +import com.arsdigita.globalization.ChainedResourceBundle; + +import java.util.PropertyResourceBundle; + +/** + * @author Shashin Shinde sshinde@redhat.com + * + * @version $Id: ESDServiceResourceBundle.java 287 2005-02-22 00:29:02Z sskracic $ + * + */ +public class ESDServiceResourceBundle extends ChainedResourceBundle implements CMSGlobalized { + + public final static String ESDSERVICE_BUNDLE_NAME = + "com.arsdigita.cms.contenttypes.ESDServiceResources"; + + public ESDServiceResourceBundle() { + super(); + addBundle((PropertyResourceBundle)getBundle(ESDSERVICE_BUNDLE_NAME)); + addBundle((PropertyResourceBundle)getBundle(BUNDLE_NAME)); + } + +} diff --git a/ccm-ldn-types-esdservice/web/static/content-types/com/arsdigita/cms/contenttypes/ESDService.xsl b/ccm-ldn-types-esdservice/web/static/content-types/com/arsdigita/cms/contenttypes/ESDService.xsl new file mode 100755 index 000000000..edbc03b06 --- /dev/null +++ b/ccm-ldn-types-esdservice/web/static/content-types/com/arsdigita/cms/contenttypes/ESDService.xsl @@ -0,0 +1,78 @@ + +]> + + + + +
+ + + + + + + + + +
+ + + + + + + +
+ +
+ + + + + +
Service Times:
+
+
+ + + + + + + +
+ Contact Information
+ + + + + + + + + +
Given Name:
Family Name:
+
+
+ + + + +
+ +
+
+ + + +

ESDSERVICE>

+ contact given name >
+
+ +