You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(48) |
Dec
(31) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(22) |
Feb
(68) |
Mar
(185) |
Apr
(11) |
May
(21) |
Jun
(23) |
Jul
(46) |
Aug
(69) |
Sep
(211) |
Oct
(26) |
Nov
(51) |
Dec
(52) |
2006 |
Jan
(13) |
Feb
(13) |
Mar
(8) |
Apr
(21) |
May
(17) |
Jun
(100) |
Jul
(34) |
Aug
(23) |
Sep
(26) |
Oct
(16) |
Nov
|
Dec
|
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(66) |
Oct
(10) |
Nov
(1) |
Dec
|
2008 |
Jan
|
Feb
|
Mar
(1) |
Apr
(3) |
May
(8) |
Jun
(5) |
Jul
(31) |
Aug
(8) |
Sep
(11) |
Oct
(6) |
Nov
|
Dec
|
2012 |
Jan
(13) |
Feb
(2) |
Mar
(9) |
Apr
(6) |
May
(24) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(120) |
2013 |
Jan
(6) |
Feb
(35) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <chr...@fe...> - 2007-09-19 09:00:35
|
Author: chrisg23 Date: 2007-09-19 11:00:30 +0200 (Wed, 19 Sep 2007) New Revision: 1663 Added: aplaws/trunk/ccm-ldn-image-step/sql/ccm-ldn-image-step/default/ aplaws/trunk/ccm-ldn-image-step/sql/ccm-ldn-image-step/default/upgrade/ aplaws/trunk/ccm-ldn-image-step/sql/ccm-ldn-image-step/default/upgrade/6.5.0-6.5.1/ aplaws/trunk/ccm-ldn-image-step/sql/ccm-ldn-image-step/default/upgrade/6.5.0-6.5.1/add_link_column.sql aplaws/trunk/ccm-ldn-image-step/sql/ccm-ldn-image-step/upgrade/oracle-se-6.5.0-6.5.1.sql aplaws/trunk/ccm-ldn-image-step/sql/ccm-ldn-image-step/upgrade/postgres-6.5.0-6.5.1.sql Modified: aplaws/trunk/ccm-ldn-image-step/application.xml aplaws/trunk/ccm-ldn-image-step/pdl/com/arsdigita/cms/contenttypes/ItemImageAttachment.pdl aplaws/trunk/ccm-ldn-image-step/src/ccm-ldn-image-step.upgrade aplaws/trunk/ccm-ldn-image-step/src/com/arsdigita/cms/contenttypes/ItemImageAttachment.java Log: Add association between image and link. Changes have no effect by themselves, but if the ccm-wsx-image-link-step module in contrib is loaded then the default image step is replaced with an asset step UI for associating the article image with one of the related links defined for the article. This change requires upgrade script to be run: ccm upgrade ccm-ldn-image-step --from-version 6.5.0 --to-version 6.5.1 Modified: aplaws/trunk/ccm-ldn-image-step/application.xml =================================================================== --- aplaws/trunk/ccm-ldn-image-step/application.xml 2007-09-19 07:51:34 UTC (rev 1662) +++ aplaws/trunk/ccm-ldn-image-step/application.xml 2007-09-19 09:00:30 UTC (rev 1663) @@ -2,7 +2,7 @@ <ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project" name="ccm-ldn-image-step" prettyName="Image step" - version="6.5.0" + version="6.5.1" release="1" webapp="ROOT"> <ccm:dependencies> Modified: aplaws/trunk/ccm-ldn-image-step/pdl/com/arsdigita/cms/contenttypes/ItemImageAttachment.pdl =================================================================== --- aplaws/trunk/ccm-ldn-image-step/pdl/com/arsdigita/cms/contenttypes/ItemImageAttachment.pdl 2007-09-19 07:51:34 UTC (rev 1662) +++ aplaws/trunk/ccm-ldn-image-step/pdl/com/arsdigita/cms/contenttypes/ItemImageAttachment.pdl 2007-09-19 09:00:30 UTC (rev 1663) @@ -9,6 +9,7 @@ String[0..1] caption = cms_item_image_attachment.caption VARCHAR( 100 ); String[0..1] title = cms_item_image_attachment.title VARCHAR( 200 ); String[0..1] description = cms_item_image_attachment.description VARCHAR( 4000 ); + component Link[0..1] imageLink = join cms_item_image_attachment.link_id to cms_links.link_id; composite ReusableImageAsset[0..1] image = join cms_item_image_attachment.image_id to cms_images.image_id; Added: aplaws/trunk/ccm-ldn-image-step/sql/ccm-ldn-image-step/default/upgrade/6.5.0-6.5.1/add_link_column.sql =================================================================== --- aplaws/trunk/ccm-ldn-image-step/sql/ccm-ldn-image-step/default/upgrade/6.5.0-6.5.1/add_link_column.sql (rev 0) +++ aplaws/trunk/ccm-ldn-image-step/sql/ccm-ldn-image-step/default/upgrade/6.5.0-6.5.1/add_link_column.sql 2007-09-19 09:00:30 UTC (rev 1663) @@ -0,0 +1,25 @@ +-- +-- Copyright (C) 2005 Chris Gilbert. 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 +-- + +alter table cms_item_image_attachment add (link_id NUMBER); + +alter table cms_item_image_attachment add + constraint cms_ite_ima_att_lin_id_f_eeymm foreign key (link_id) + references cms_links(link_id); + + Added: aplaws/trunk/ccm-ldn-image-step/sql/ccm-ldn-image-step/upgrade/oracle-se-6.5.0-6.5.1.sql =================================================================== --- aplaws/trunk/ccm-ldn-image-step/sql/ccm-ldn-image-step/upgrade/oracle-se-6.5.0-6.5.1.sql (rev 0) +++ aplaws/trunk/ccm-ldn-image-step/sql/ccm-ldn-image-step/upgrade/oracle-se-6.5.0-6.5.1.sql 2007-09-19 09:00:30 UTC (rev 1663) @@ -0,0 +1,4 @@ + +PROMPT ImageStep 6.5.0 -> 6.5.1 Upgrade Script (Oracle) + +@@ ../default/upgrade/6.5.0-6.5.1/add_link_column.sql Added: aplaws/trunk/ccm-ldn-image-step/sql/ccm-ldn-image-step/upgrade/postgres-6.5.0-6.5.1.sql =================================================================== --- aplaws/trunk/ccm-ldn-image-step/sql/ccm-ldn-image-step/upgrade/postgres-6.5.0-6.5.1.sql (rev 0) +++ aplaws/trunk/ccm-ldn-image-step/sql/ccm-ldn-image-step/upgrade/postgres-6.5.0-6.5.1.sql 2007-09-19 09:00:30 UTC (rev 1663) @@ -0,0 +1,7 @@ +\echo ImageStep 6.5.0 -> 6.5.1 Upgrade Script (PostgreSQL) + +begin; + +\i ../default/upgrade/6.5.0-6.5.1/add_link_column.sql + +commit; Modified: aplaws/trunk/ccm-ldn-image-step/src/ccm-ldn-image-step.upgrade =================================================================== --- aplaws/trunk/ccm-ldn-image-step/src/ccm-ldn-image-step.upgrade 2007-09-19 07:51:34 UTC (rev 1662) +++ aplaws/trunk/ccm-ldn-image-step/src/ccm-ldn-image-step.upgrade 2007-09-19 09:00:30 UTC (rev 1663) @@ -5,4 +5,7 @@ <version from="6.2.0" to="6.2.1"> <script sql="ccm-ldn-image-step/upgrade/::database::-6.2.0-6.2.1.sql"/> </version> + <version from="6.5.0" to="6.5.1"> + <script sql="ccm-ldn-image-step/upgrade/::database::-6.5.0-6.5.1.sql"/> + </version> </upgrade> Modified: aplaws/trunk/ccm-ldn-image-step/src/com/arsdigita/cms/contenttypes/ItemImageAttachment.java =================================================================== --- aplaws/trunk/ccm-ldn-image-step/src/com/arsdigita/cms/contenttypes/ItemImageAttachment.java 2007-09-19 07:51:34 UTC (rev 1662) +++ aplaws/trunk/ccm-ldn-image-step/src/com/arsdigita/cms/contenttypes/ItemImageAttachment.java 2007-09-19 09:00:30 UTC (rev 1663) @@ -23,8 +23,10 @@ import com.arsdigita.cms.ItemImageAttachmentConfig; import com.arsdigita.cms.ItemCopier; import com.arsdigita.cms.ReusableImageAsset; +import com.arsdigita.domain.DomainObject; import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.kernel.ACSObject; +import com.arsdigita.persistence.DataAssociation; import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.OID; @@ -47,6 +49,7 @@ public static final String TITLE = "title"; public static final String IMAGE_ATTACHMENTS = "imageAttachments"; public static final String ITEM_ATTACHMENTS = "itemAttachments"; + public static final String IMAGE_LINK = "imageLink"; /** Data object type for this domain object */ public static final String BASE_DATA_OBJECT_TYPE @@ -191,4 +194,33 @@ return false; } + + // chris gilbert - optional link + + public Link getLink() { + Link link = null; + DataObject dobj = (DataObject) get( IMAGE_LINK ); + if (dobj != null) { + + link = (Link) DomainObjectFactory.newInstance( dobj ); + } + return link; + } + + public void setLink( Link link ) { + Assert.exists( link, Link.class ); + set( IMAGE_LINK, link ); + } + + public void removeLink() { + // when we delete the link, the image still references it in DB + // can't make it composite because then image is deleted if we delete + // link. Have to set link to null first (I think) + DomainObject link = DomainObjectFactory.newInstance((DataObject)get(IMAGE_LINK)); + set (IMAGE_LINK, null); + save(); + link.delete(); + + } + } |
Author: chrisg23 Date: 2007-09-19 10:00:41 +0200 (Wed, 19 Sep 2007) New Revision: 1662 Added: aplaws/contrib/wsx/ccm-wsx-image-link-step/application.xml aplaws/contrib/wsx/ccm-wsx-image-link-step/src/ aplaws/contrib/wsx/ccm-wsx-image-link-step/src/ccm-wsx-image-link-step.load aplaws/contrib/wsx/ccm-wsx-image-link-step/src/com/ aplaws/contrib/wsx/ccm-wsx-image-link-step/src/com/arsdigita/ aplaws/contrib/wsx/ccm-wsx-image-link-step/src/com/arsdigita/cms/ aplaws/contrib/wsx/ccm-wsx-image-link-step/src/com/arsdigita/cms/contentassets/ aplaws/contrib/wsx/ccm-wsx-image-link-step/src/com/arsdigita/cms/contentassets/ItemImageLinkInitializer.java aplaws/contrib/wsx/ccm-wsx-image-link-step/src/com/arsdigita/cms/contentassets/ui/ aplaws/contrib/wsx/ccm-wsx-image-link-step/src/com/arsdigita/cms/contentassets/ui/ImageLinkStep.java aplaws/contrib/wsx/ccm-wsx-image-link-step/src/com/arsdigita/cms/contentassets/ui/ImageLinkStepDisplay.java aplaws/contrib/wsx/ccm-wsx-image-link-step/src/com/arsdigita/cms/contentassets/ui/ImageLinkTable.java aplaws/contrib/wsx/ccm-wsx-image-link-step/src/com/arsdigita/cms/contentassets/ui/ImageLinkTableModelBuilder.java Log: Image Link Step - if loaded, this step overrides the default ccm-ldn-image-link-step asset step interface and replaces it with one that allows you to associate one of the related links defined in the related link step with the image - with the intention that the article image is used as a link Added: aplaws/contrib/wsx/ccm-wsx-image-link-step/application.xml =================================================================== --- aplaws/contrib/wsx/ccm-wsx-image-link-step/application.xml (rev 0) +++ aplaws/contrib/wsx/ccm-wsx-image-link-step/application.xml 2007-09-19 08:00:41 UTC (rev 1662) @@ -0,0 +1,26 @@ +<?xml version="1.0"?> +<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project" + name="ccm-wsx-image-link-step" + prettyName="Image step" + version="6.3.0" + release="1" + webapp="ROOT"> + <ccm:dependencies> + <ccm:requires name="ccm-ldn-image-step" version="6.3.0" relation="ge"/> + <ccm:requires name="ccm-cms-assets-relatedlink" version="6.1.0" relation="ge"/> + + </ccm:dependencies> + + + <ccm:directories> + <ccm:directory name="src"/> + </ccm:directories> + + <ccm:contacts> + <ccm:contact uri="http://www.redhat.com/software/rhea" type="website"/> + <ccm:contact uri="mailto:rh...@re..." type="support"/> + </ccm:contacts> + <ccm:description> + UI step for attaching an image to article (or other content types) together with an optional link. + </ccm:description> +</ccm:application> Added: aplaws/contrib/wsx/ccm-wsx-image-link-step/src/ccm-wsx-image-link-step.load =================================================================== --- aplaws/contrib/wsx/ccm-wsx-image-link-step/src/ccm-wsx-image-link-step.load (rev 0) +++ aplaws/contrib/wsx/ccm-wsx-image-link-step/src/ccm-wsx-image-link-step.load 2007-09-19 08:00:41 UTC (rev 1662) @@ -0,0 +1,12 @@ +<load> + <requires> + <table name="cms_items"/> + <initializer class="com.arsdigita.cms.ItemImageAttachmentInitializer"/> + </requires> + <provides> + <initializer class="com.arsdigita.cms.contentassets.ItemImageLinkInitializer"/> + </provides> + <scripts> + + </scripts> +</load> Added: aplaws/contrib/wsx/ccm-wsx-image-link-step/src/com/arsdigita/cms/contentassets/ItemImageLinkInitializer.java =================================================================== --- aplaws/contrib/wsx/ccm-wsx-image-link-step/src/com/arsdigita/cms/contentassets/ItemImageLinkInitializer.java (rev 0) +++ aplaws/contrib/wsx/ccm-wsx-image-link-step/src/com/arsdigita/cms/contentassets/ItemImageLinkInitializer.java 2007-09-19 08:00:41 UTC (rev 1662) @@ -0,0 +1,68 @@ +/* + * 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.contentassets; + +import com.arsdigita.cms.ItemImageAttachmentInitializer; +import com.arsdigita.cms.contenttypes.ContentAssetInitializer; +import com.arsdigita.cms.contenttypes.ItemImageAttachment; +import com.arsdigita.cms.contentassets.ui.ImageLinkStep; +import com.arsdigita.db.DbHelper; +import com.arsdigita.domain.DomainObject; +import com.arsdigita.domain.DomainObjectFactory; +import com.arsdigita.domain.DomainObjectInstantiator; +import com.arsdigita.globalization.GlobalizedMessage; +import com.arsdigita.persistence.DataCollection; +import com.arsdigita.persistence.DataObject; +import com.arsdigita.persistence.PersistenceException; +import com.arsdigita.persistence.SessionManager; +import com.arsdigita.persistence.metadata.ObjectType; +import com.arsdigita.persistence.pdl.ManifestSource; +import com.arsdigita.persistence.pdl.NameFilter; +import com.arsdigita.runtime.DomainInitEvent; +import com.arsdigita.runtime.PDLInitializer; +import com.arsdigita.runtime.RuntimeConfig; + +/** + * @version $Id: ItemImageLinkInitializer.java,v 1.1 2006/06/27 15:12:31 cgyg9330 Exp $ + * + * Must be run in addition to and after ItemImageAttachmentInitializer (from + * ccm-ldn-image-step). This initializer registers the additional pdl manifest + * and also overrides the image step registered with AuthoringKitWizard by + * ccm-ldn-image-step + */ +public class ItemImageLinkInitializer extends ItemImageAttachmentInitializer { + + public ItemImageLinkInitializer() { + + + // register PDL Initializer for ldn-image step and one for this + // step, in order + super("ccm-wsx-image-link-step.pdl.mf"); + + + + + } + + public Class getAuthoringStep() { + return ImageLinkStep.class; + } + + +} Added: aplaws/contrib/wsx/ccm-wsx-image-link-step/src/com/arsdigita/cms/contentassets/ui/ImageLinkStep.java =================================================================== --- aplaws/contrib/wsx/ccm-wsx-image-link-step/src/com/arsdigita/cms/contentassets/ui/ImageLinkStep.java (rev 0) +++ aplaws/contrib/wsx/ccm-wsx-image-link-step/src/com/arsdigita/cms/contentassets/ui/ImageLinkStep.java 2007-09-19 08:00:41 UTC (rev 1662) @@ -0,0 +1,70 @@ +/* + * 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.contentassets.ui; + +import java.util.Iterator; + +import org.apache.log4j.Logger; + +import com.arsdigita.bebop.AbstractSingleSelectionModel; +import com.arsdigita.bebop.Component; +import com.arsdigita.bebop.Page; +import com.arsdigita.bebop.PageState; +import com.arsdigita.bebop.RequestLocal; +import com.arsdigita.bebop.event.ActionEvent; +import com.arsdigita.bebop.event.ActionListener; +import com.arsdigita.bebop.parameters.ParameterModel; +import com.arsdigita.cms.ContentItem; +import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.contenttypes.ItemImageAttachment; +import com.arsdigita.cms.contenttypes.ui.ImageStep; +import com.arsdigita.cms.contenttypes.ui.ImageStepDisplay; +import com.arsdigita.cms.contenttypes.ui.ImageStepEdit; +import com.arsdigita.cms.ui.authoring.AuthoringKitWizard; +import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess; +import com.arsdigita.domain.DomainObjectFactory; +import com.arsdigita.persistence.OID; +import com.arsdigita.toolbox.ui.OIDParameter; + +/** + * Wizard step that uses a display component which allows addition of related links to + * images + */ + +public class ImageLinkStep extends ImageStep { + + + + + + public ImageLinkStep( ItemSelectionModel itemModel, + AuthoringKitWizard parent ) { + super(itemModel, parent); + + + } + + protected Component getImageDisplayComponent() { + return new ImageLinkStepDisplay( this ); + } + + + + +} Added: aplaws/contrib/wsx/ccm-wsx-image-link-step/src/com/arsdigita/cms/contentassets/ui/ImageLinkStepDisplay.java =================================================================== --- aplaws/contrib/wsx/ccm-wsx-image-link-step/src/com/arsdigita/cms/contentassets/ui/ImageLinkStepDisplay.java (rev 0) +++ aplaws/contrib/wsx/ccm-wsx-image-link-step/src/com/arsdigita/cms/contentassets/ui/ImageLinkStepDisplay.java 2007-09-19 08:00:41 UTC (rev 1662) @@ -0,0 +1,208 @@ +/* + * 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.contentassets.ui; + +import javax.servlet.ServletException; + +import org.apache.log4j.Logger; + +import com.arsdigita.bebop.BoxPanel; +import com.arsdigita.bebop.Component; +import com.arsdigita.bebop.ControlLink; +import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.List; +import com.arsdigita.bebop.Page; +import com.arsdigita.bebop.PageState; +import com.arsdigita.bebop.event.ActionEvent; +import com.arsdigita.bebop.event.ActionListener; +import com.arsdigita.bebop.event.PrintEvent; +import com.arsdigita.bebop.event.PrintListener; +import com.arsdigita.bebop.list.ListCellRenderer; +import com.arsdigita.bebop.list.ListModel; +import com.arsdigita.bebop.list.ListModelBuilder; +import com.arsdigita.cms.ContentItem; +import com.arsdigita.cms.ImageAsset; +import com.arsdigita.cms.ReusableImageAsset; +import com.arsdigita.cms.contentassets.RelatedLink; +import com.arsdigita.cms.contenttypes.ItemImageAttachment; +import com.arsdigita.cms.contenttypes.Link; +import com.arsdigita.cms.contenttypes.ui.ImageStep; +import com.arsdigita.cms.contenttypes.ui.ImageStepDisplay; +import com.arsdigita.cms.ui.ImageDisplay; +import com.arsdigita.domain.DomainObjectFactory; +import com.arsdigita.persistence.DataCollection; +import com.arsdigita.persistence.OID; +import com.arsdigita.util.LockableImpl; +import com.arsdigita.xml.Element; + +/** + * Pluggable authoring step to add an ImageAsset to a content item + * Currently only supports adding one image though the PDL has + * association for multiple. + */ + +public class ImageLinkStepDisplay + extends ImageStepDisplay + implements ActionListener { + private static final Logger s_log = + Logger.getLogger(ImageLinkStepDisplay.class); + + private ImageLinkTable m_link; + private List m_imageList; + private ImageStep m_step; + + private final static String ADD_LINK = "addLink"; + private final static String REMOVE_LINK = "removeLink"; + + public ImageLinkStepDisplay(ImageStep step) { + super(step); + m_step = step; + m_link = new ImageLinkTable(step, m_imageList); + m_link.addCompletionListener(this); + add(m_link); + } + + public List getList() { + Label mainLabel = + new Label("This item does not have any associated images."); + mainLabel.setFontWeight(Label.ITALIC); + + ImageLinkList imageList = new ImageLinkList(); + + imageList.setCellRenderer(new ImageLinkListCellRenderer()); + imageList.setEmptyView(mainLabel); + m_imageList = imageList; + return imageList; + } + + private class ImageLinkList extends ImageStepDisplay.ImageList { + + public void respond(PageState ps) throws ServletException { + if (DELETE.equals(ps.getControlEventName())) { + String attachment = ps.getControlEventValue(); + + OID oid = OID.valueOf(attachment); + DomainObjectFactory.newInstance(oid).delete(); + } else if (ADD_LINK.equals(ps.getControlEventName())) { + String attachment = ps.getControlEventValue(); + OID oid = OID.valueOf(attachment); + m_link.setImage( + ps, + (ItemImageAttachment) DomainObjectFactory.newInstance(oid)); + ps.setVisible(m_link, true); + } else if (REMOVE_LINK.equals(ps.getControlEventName())) { + String attachment = ps.getControlEventValue(); + ContentItem item = m_step.getItem(ps); + OID oid = OID.valueOf(attachment); + ItemImageAttachment imageAttachment = + (ItemImageAttachment) DomainObjectFactory.newInstance(oid); + Link link = imageAttachment.getLink(); + // because Related link extends link rather than + // containing a link, we cannot just move the link + // from the image to the item. Instead we have to + // create a new related link and delete the link asociated + // eith the image + RelatedLink rLink = new RelatedLink(); + rLink.setDescription(link.getDescription()); + rLink.setOrder(link.getOrder()); + rLink.setTargetItem(link.getTargetItem()); + rLink.setTargetType(link.getTargetType()); + rLink.setTargetURI(link.getTargetURI()); + rLink.setTargetWindow(link.getTargetWindow()); + rLink.setTitle(link.getTitle()); + rLink.setLinkOwner(item); + imageAttachment.removeLink(); + + + } else { + super.respond(ps); + } + ps.clearControlEvent(); + } + + } + + public class ImageLinkListCellRenderer + extends ImageStepDisplay.ImageListCellRenderer { + + public Component getComponent( + final List list, + PageState state, + Object value, + String key, + int index, + boolean isSelected) { + + s_log.debug("getting cell component for image link list cell"); + BoxPanel container = + (BoxPanel) super.getComponent( + list, + state, + value, + key, + index, + isSelected); + final ItemImageAttachment attachment = (ItemImageAttachment) value; + + ControlLink addLink = new ControlLink("Add Link") { + public void setControlEvent(PageState ps) { + ps.setControlEvent( + list, + ADD_LINK, + attachment.getOID().toString()); + } + }; + + ControlLink removeLink = new ControlLink("Remove Link") { + public void setControlEvent(PageState ps) { + ps.setControlEvent( + list, + REMOVE_LINK, + attachment.getOID().toString()); + } + }; + Link link = attachment.getLink(); + if (link != null) { + container.add( + new Label( + "Links to " + link.getInternalOrExternalURI(state))); + container.add(removeLink); + } else { + container.add(addLink); + } + + return container; + } + } + + public void register(Page p) { + super.register(p); + p.setVisibleDefault(m_link, false); + + } + + /* (non-Javadoc) + * @see com.arsdigita.bebop.event.ActionListener#actionPerformed(com.arsdigita.bebop.event.ActionEvent) + */ + public void actionPerformed(ActionEvent e) { + m_link.setVisible(e.getPageState(), false); + + } + +} Added: aplaws/contrib/wsx/ccm-wsx-image-link-step/src/com/arsdigita/cms/contentassets/ui/ImageLinkTable.java =================================================================== --- aplaws/contrib/wsx/ccm-wsx-image-link-step/src/com/arsdigita/cms/contentassets/ui/ImageLinkTable.java (rev 0) +++ aplaws/contrib/wsx/ccm-wsx-image-link-step/src/com/arsdigita/cms/contentassets/ui/ImageLinkTable.java 2007-09-19 08:00:41 UTC (rev 1662) @@ -0,0 +1,119 @@ +/* + * Created on 27-Jun-06 + * + * To change the template for this generated file go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +package com.arsdigita.cms.contentassets.ui; + +import com.arsdigita.cms.contentassets.RelatedLink; +import com.arsdigita.cms.contenttypes.ui.ImageStep; +import com.arsdigita.cms.contenttypes.ui.LinkTableModelBuilder; +import java.awt.Container; +import java.math.BigDecimal; + +import com.arsdigita.bebop.ActionLink; +import com.arsdigita.bebop.ControlLink; +import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.List; +import com.arsdigita.bebop.Page; +import com.arsdigita.bebop.PageState; +import com.arsdigita.bebop.SimpleContainer; +import com.arsdigita.bebop.Table; +import com.arsdigita.bebop.event.ActionEvent; +import com.arsdigita.bebop.event.ActionListener; +import com.arsdigita.bebop.event.TableActionEvent; +import com.arsdigita.bebop.event.TableActionListener; +import com.arsdigita.bebop.table.AbstractTableModelBuilder; +import com.arsdigita.bebop.table.TableHeader; +import com.arsdigita.bebop.table.TableModel; +import com.arsdigita.bebop.table.TableModelBuilder; +import com.arsdigita.cms.ContentItem; +import com.arsdigita.cms.ImageAsset; +import com.arsdigita.cms.contenttypes.ItemImageAttachment; +import com.arsdigita.cms.contenttypes.Link; +import com.arsdigita.domain.DomainObjectFactory; +import com.arsdigita.kernel.ui.ACSObjectSelectionModel; +import com.arsdigita.kernel.ui.DomainObjectSelectionModel; +import com.arsdigita.persistence.DataCollection; +import com.arsdigita.persistence.DataObject; +import com.arsdigita.util.LockableImpl; + +/** + * @author cgyg9330 + * + * Displays a table of links + */ +public class ImageLinkTable + extends Table + implements TableActionListener { + + private List m_imageList; + private ACSObjectSelectionModel m_image = + new ACSObjectSelectionModel("linkImage"); + + /** + * + */ + public ImageLinkTable(ImageStep step, List imageList) { + super(new ImageLinkTableModelBuilder(step),new String[] { "Link", "" }); + m_imageList = imageList; + + setEmptyView( + new Label("Define links in the related links step first")); + addTableActionListener(this); + + + } + + public void register(Page p) { + super.register(p); + p.addComponentStateParam(this, m_image.getStateParameter()); + + } + + + + + + + + // used by the list of images to set the target image for adding a link + public void setImage(PageState state, ItemImageAttachment attachment) { + m_image.setSelectedObject(state, attachment); + + } + + /* (non-Javadoc) + * @see com.arsdigita.bebop.event.TableActionListener#cellSelected(com.arsdigita.bebop.event.TableActionEvent) + */ + + // unfortunately can't setLinkOwner as image because image may be shared + public void cellSelected(TableActionEvent e) { + PageState state = e.getPageState(); + BigDecimal key = new BigDecimal((String) e.getRowKey()); + RelatedLink rLink = new RelatedLink(key); + Link link = new Link(); + link.setDescription(rLink.getDescription()); + link.setOrder(rLink.getOrder()); + link.setTargetItem(rLink.getTargetItem()); + link.setTargetType(rLink.getTargetType()); + link.setTargetURI(rLink.getTargetURI()); + link.setTargetWindow(rLink.getTargetWindow()); + link.setTitle(rLink.getTitle()); + rLink.delete(); + ItemImageAttachment attachment = (ItemImageAttachment)m_image.getSelectedObject(state); + attachment.setLink(link); + fireCompletionEvent(state); + + } + + /* (non-Javadoc) + * @see com.arsdigita.bebop.event.TableActionListener#headSelected(com.arsdigita.bebop.event.TableActionEvent) + */ + public void headSelected(TableActionEvent e) { + // TODO Auto-generated method stub + + } + +} Added: aplaws/contrib/wsx/ccm-wsx-image-link-step/src/com/arsdigita/cms/contentassets/ui/ImageLinkTableModelBuilder.java =================================================================== --- aplaws/contrib/wsx/ccm-wsx-image-link-step/src/com/arsdigita/cms/contentassets/ui/ImageLinkTableModelBuilder.java (rev 0) +++ aplaws/contrib/wsx/ccm-wsx-image-link-step/src/com/arsdigita/cms/contentassets/ui/ImageLinkTableModelBuilder.java 2007-09-19 08:00:41 UTC (rev 1662) @@ -0,0 +1,111 @@ +/* + * Created on 29-Jun-06 + * + * To change the template for this generated file go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +package com.arsdigita.cms.contentassets.ui; + +import com.arsdigita.bebop.ControlLink; +import com.arsdigita.bebop.PageState; +import com.arsdigita.bebop.Table; +import com.arsdigita.bebop.table.TableModel; +import com.arsdigita.bebop.table.TableModelBuilder; +import com.arsdigita.cms.ContentItem; +import com.arsdigita.cms.contentassets.RelatedLink; +import com.arsdigita.cms.contenttypes.Link; +import com.arsdigita.cms.contenttypes.ui.ImageStep; +import com.arsdigita.domain.DomainObjectFactory; +import com.arsdigita.persistence.DataCollection; +import com.arsdigita.util.LockableImpl; + +/** + * @author cgyg9330 + * + * To change the template for this generated type comment go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +public class ImageLinkTableModelBuilder + extends LockableImpl + implements TableModelBuilder { + + private ImageStep m_step; + + public ImageLinkTableModelBuilder(ImageStep step) { + super(); + m_step = step; + + } + public TableModel makeModel(Table t, PageState state) { + TableModel tableModel = + new ImageLinkTableModel(m_step.getItem(state)); + + return tableModel; + } + + + +private class ImageLinkTableModel implements TableModel { + + private static final int URL_COLUMN = 0; + private static final int SELECT_COLUMN = 1; + + private DataCollection m_links; + private Link m_link; + + + public ImageLinkTableModel(ContentItem item) { + m_links = + RelatedLink.getRelatedLinks(item); + } + + /* (non-Javadoc) + * @see com.arsdigita.bebop.table.TableModel#getColumnCount() + */ + public int getColumnCount() { + return 2; + } + + /* (non-Javadoc) + * @see com.arsdigita.bebop.table.TableModel#nextRow() + */ + public boolean nextRow() { + if (m_links.next()) { + m_link = (Link)DomainObjectFactory.newInstance(m_links.getDataObject()); + return true; + } else { + return false; + } + } + + /* (non-Javadoc) + * @see com.arsdigita.bebop.table.TableModel#getElementAt(int) + */ + public Object getElementAt(int columnIndex) { + switch (columnIndex) { + case URL_COLUMN : + String linkString; + if (m_link.getTargetType().equals(Link.INTERNAL_LINK)) { + linkString = m_link.getTargetItem().getPath(); + } else { + linkString = m_link.getTargetURI(); + } + return linkString; + case SELECT_COLUMN : + return new ControlLink("Select"); + default : + throw new IndexOutOfBoundsException( + "Column index " + columnIndex + " not in table model."); + } + } + + /* (non-Javadoc) + * @see com.arsdigita.bebop.table.TableModel#getKeyAt(int) + */ + public Object getKeyAt(int columnIndex) { + return m_link.getID(); + } + + + } + } \ No newline at end of file |
From: <chr...@fe...> - 2007-09-19 08:00:41
|
Author: chrisg23 Date: 2007-09-19 10:00:34 +0200 (Wed, 19 Sep 2007) New Revision: 1661 Modified: aplaws/trunk/ccm-ldn-aplaws/web/__ccm__/themes/aplaws/lib/lib.xsl aplaws/trunk/ccm-ldn-navigation/web/packages/navigation/templates/default.jsp Log: Include applications on navigation pages where they have been assigned to navigation categories (currently possible for forums if the optional ccm-categorised-forum module in contrib/wsx is loaded. Modified: aplaws/trunk/ccm-ldn-aplaws/web/__ccm__/themes/aplaws/lib/lib.xsl =================================================================== --- aplaws/trunk/ccm-ldn-aplaws/web/__ccm__/themes/aplaws/lib/lib.xsl 2007-09-18 13:05:43 UTC (rev 1660) +++ aplaws/trunk/ccm-ldn-aplaws/web/__ccm__/themes/aplaws/lib/lib.xsl 2007-09-19 08:00:34 UTC (rev 1661) @@ -258,8 +258,8 @@ <xsl:for-each select="nav:item"> <a> <xsl:attribute name="href"><xsl:value-of select="nav:path" /></xsl:attribute> - <xsl:attribute name="title"><xsl:value-of select="nav:attribute[@name='title']" /></xsl:attribute> - <xsl:value-of select="nav:attribute[@name='title']" /> + <xsl:attribute name="displayName"><xsl:value-of select="nav:attribute[@name='displayName']" /></xsl:attribute> + <xsl:value-of select="nav:attribute[@name='displayName']" /> </a> <span class="hide">|</span> </xsl:for-each> @@ -282,10 +282,10 @@ <xsl:sort select="nav:attribute[@name='launchDate']/@hour" order = "{$order}" data-type="number"/> <xsl:sort select="nav:attribute[@name='launchDate']/@minute" order = "{$order}" data-type="number"/> <xsl:sort select="nav:attribute[@name='launchDate']/@second" order = "{$order}" data-type="number"/> - <xsl:sort select="nav:attribute[@name='title']"/> + <xsl:sort select="nav:attribute[@name='displayName']"/> <a> <xsl:attribute name="href"><xsl:value-of select="nav:path" /></xsl:attribute> - <xsl:attribute name="title"><xsl:value-of select="nav:attribute[@name='title']" /></xsl:attribute> + <xsl:attribute name="title"><xsl:value-of select="nav:attribute[@name='displayName']" /></xsl:attribute> <!-- if there is a launch date, prepend title with date, so that the order of entries makes sense --> <xsl:if test="nav:attribute[@name='launchDate']"> @@ -300,7 +300,7 @@ <xsl:value-of select="nav:attribute[@name='launchDate']/@month"/>/ <xsl:value-of select="nav:attribute[@name='launchDate']/@year"/> - --> </xsl:if> - <xsl:value-of select="nav:attribute[@name='title']" /> + <xsl:value-of select="nav:attribute[@name='displayName']" /> </a> <span class="hide">|</span> </xsl:for-each> Modified: aplaws/trunk/ccm-ldn-navigation/web/packages/navigation/templates/default.jsp =================================================================== --- aplaws/trunk/ccm-ldn-navigation/web/packages/navigation/templates/default.jsp 2007-09-18 13:05:43 UTC (rev 1660) +++ aplaws/trunk/ccm-ldn-navigation/web/packages/navigation/templates/default.jsp 2007-09-19 08:00:34 UTC (rev 1661) @@ -9,6 +9,9 @@ <jsp:directive.page import="com.arsdigita.london.navigation.Navigation"/> <jsp:directive.page import="com.arsdigita.london.navigation.cms.CMSDataCollectionDefinition"/> <jsp:directive.page import="com.arsdigita.london.navigation.cms.CMSDataCollectionRenderer"/> + <jsp:directive.page import="com.arsdigita.london.navigation.DataCollectionDefinition"/> + <jsp:directive.page import="com.arsdigita.london.navigation.DataCollectionRenderer"/> + <jsp:scriptlet> long age = Navigation.getConfig().getIndexPageCacheLifetime(); @@ -32,6 +35,9 @@ classname="com.arsdigita.london.navigation.ui.category.Menu"/> <define:component name="itemList" classname="com.arsdigita.london.navigation.ui.object.SimpleObjectList"/> + <define:component name="applicationList" + classname="com.arsdigita.london.navigation.ui.object.SimpleObjectList"/> + <jsp:scriptlet> ((com.arsdigita.london.navigation.ui.object.SimpleObjectList) itemList).setDefinition(new CMSDataCollectionDefinition()); ((com.arsdigita.london.navigation.ui.object.SimpleObjectList) itemList).setRenderer(new CMSDataCollectionRenderer()); @@ -43,7 +49,19 @@ ((com.arsdigita.london.navigation.ui.object.SimpleObjectList) itemList).getRenderer().setPageSize(30); ((com.arsdigita.london.navigation.ui.object.SimpleObjectList) itemList).getRenderer().addAttribute("objectType"); ((com.arsdigita.london.navigation.ui.object.SimpleObjectList) itemList).getRenderer().addAttribute("title"); + ((com.arsdigita.london.navigation.ui.object.SimpleObjectList) itemList).getRenderer().addAttribute("displayName"); ((com.arsdigita.london.navigation.ui.object.SimpleObjectList) itemList).getRenderer().addAttribute("launchDate"); + + ((com.arsdigita.london.navigation.ui.object.SimpleObjectList) applicationList).setDefinition(new DataCollectionDefinition()); + ((com.arsdigita.london.navigation.ui.object.SimpleObjectList) applicationList).setRenderer(new DataCollectionRenderer()); + ((com.arsdigita.london.navigation.ui.object.SimpleObjectList) applicationList).getDefinition().setObjectType("com.arsdigita.web.Application"); + + ((com.arsdigita.london.navigation.ui.object.SimpleObjectList) applicationList).getDefinition().setDescendCategories(false); + ((com.arsdigita.london.navigation.ui.object.SimpleObjectList) applicationList).getDefinition().addOrder("categories.link.sortKey"); + + ((com.arsdigita.london.navigation.ui.object.SimpleObjectList) applicationList).getRenderer().setPageSize(30); + ((com.arsdigita.london.navigation.ui.object.SimpleObjectList) applicationList).getRenderer().addAttribute("displayName"); + </jsp:scriptlet> <define:component name="assignedTerms" |
From: <chr...@fe...> - 2007-09-18 14:15:54
|
Author: chrisg23 Date: 2007-09-18 16:00:19 +0200 (Tue, 18 Sep 2007) New Revision: 1660 Modified: aplaws/trunk/ccm-core/web/packages/bebop/xsl/Select.xsl Log: Sourceforge patch 1793021 - output id attribute on bebop selects if it has been set in the java code Modified: aplaws/trunk/ccm-core/web/packages/bebop/xsl/Select.xsl =================================================================== --- aplaws/trunk/ccm-core/web/packages/bebop/xsl/Select.xsl 2007-09-18 12:52:36 UTC (rev 1659) +++ aplaws/trunk/ccm-core/web/packages/bebop/xsl/Select.xsl 2007-09-18 14:00:19 UTC (rev 1660) @@ -35,7 +35,7 @@ <xsl:template match="bebop:select" xmlns:bebop="http://www.arsdigita.com/bebop/1.0"> <select name="{@name}"> - <xsl:for-each select="@disabled|@size|@title|@*[starts-with(name(), 'on')]"> + <xsl:for-each select="@disabled|@size|@title|@id|@*[starts-with(name(), 'on')]"> <xsl:attribute name="{name()}"> <xsl:value-of select="."/> </xsl:attribute> |
From: <chr...@fe...> - 2007-09-18 13:01:13
|
Author: chrisg23 Date: 2007-09-18 15:01:12 +0200 (Tue, 18 Sep 2007) New Revision: 1658 Added: aplaws/trunk/ccm-core/src/com/arsdigita/web/Util.java Log: Sourceforge patch 1793018 - utility to get stable urls programatically Added: aplaws/trunk/ccm-core/src/com/arsdigita/web/Util.java =================================================================== --- aplaws/trunk/ccm-core/src/com/arsdigita/web/Util.java (rev 0) +++ aplaws/trunk/ccm-core/src/com/arsdigita/web/Util.java 2007-09-18 13:01:12 UTC (rev 1658) @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2007 Chris Gilbert. 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.web; + +import com.arsdigita.domain.DomainObject; +import com.arsdigita.util.Assert; + +public class Util { + + /** + * retrieve a fully qualified stable url for the specified + * domain object without any context + * + * Full qualification is required in order to avoid getting + * redirect urls within the context of ccm + */ + public static String getRedirectURL(DomainObject object) { + return getRedirectURL(object,null); + } + + + /** + * retrieve a fully qualified stable url for the specified + * domain object in the given context + * + * Full qualification is required in order to avoid getting + * redirect urls within the context of ccm + */ + public static String getRedirectURL(DomainObject object, String context) { + Assert.exists(object); + + ParameterMap params = new ParameterMap(); + params.setParameter("oid", object.getOID()); + if (context != null) { + params.setParameter("context", context); + } + URL url = URL.there("/redirect", params); + + return url.getServerURI() + url.getPathInfo() + "?" + url.getQueryString(); + + } + +} |
From: <chr...@fe...> - 2007-09-18 13:01:13
|
Author: chrisg23 Date: 2007-09-18 15:00:55 +0200 (Tue, 18 Sep 2007) New Revision: 1657 Modified: aplaws/trunk/ccm-core/src/com/arsdigita/ui/admin/Utilities.java Log: Make the static prepare utility method public Modified: aplaws/trunk/ccm-core/src/com/arsdigita/ui/admin/Utilities.java =================================================================== --- aplaws/trunk/ccm-core/src/com/arsdigita/ui/admin/Utilities.java 2007-09-18 12:40:39 UTC (rev 1656) +++ aplaws/trunk/ccm-core/src/com/arsdigita/ui/admin/Utilities.java 2007-09-18 13:00:55 UTC (rev 1657) @@ -44,7 +44,7 @@ * more general */ - static final String prepare(String input) { + public static final String prepare(String input) { Perl5Compiler compiler = new Perl5Compiler(); Perl5Matcher matcher = new Perl5Matcher(); |
From: <chr...@fe...> - 2007-09-18 13:01:13
|
Author: chrisg23 Date: 2007-09-18 15:01:13 +0200 (Tue, 18 Sep 2007) New Revision: 1659 Modified: aplaws/trunk/ccm-core/src/com/arsdigita/workflow/simple/UserTask.java Log: Make pdl attribute name constants public so they may be referenced elsewhere in persistence API calls Modified: aplaws/trunk/ccm-core/src/com/arsdigita/workflow/simple/UserTask.java =================================================================== --- aplaws/trunk/ccm-core/src/com/arsdigita/workflow/simple/UserTask.java 2007-09-18 12:46:04 UTC (rev 1658) +++ aplaws/trunk/ccm-core/src/com/arsdigita/workflow/simple/UserTask.java 2007-09-18 13:01:13 UTC (rev 1659) @@ -73,12 +73,12 @@ public static final String ASSIGNED_USERS = "assignedUsers"; public static final String ASSIGNED_GROUPS = "assignedGroups"; - private static final String LOCKING_USER_ID = "lockingUserId"; - private static final String IS_LOCKED = "isLocked"; - private static final String DUE_DATE = "dueDate"; - private static final String START_DATE = "startDate"; - private static final String DURATION_MINUTES = "durationMinutes"; - private static final String NOTIFICATION_SENDER_ID = "notificationSenderID"; + public static final String LOCKING_USER_ID = "lockingUserId"; + public static final String IS_LOCKED = "isLocked"; + public static final String DUE_DATE = "dueDate"; + public static final String START_DATE = "startDate"; + public static final String DURATION_MINUTES = "durationMinutes"; + public static final String NOTIFICATION_SENDER_ID = "notificationSenderID"; public static final int DEFAULT_DURATION = 1440; |
From: <chr...@fe...> - 2007-09-18 13:00:52
|
Author: chrisg23 Date: 2007-09-18 15:00:26 +0200 (Tue, 18 Sep 2007) New Revision: 1656 Modified: aplaws/trunk/ccm-core/src/com/arsdigita/search/BaseDocument.java Log: Undo change in r1370 - BaseDocument doesn't need to implement comparable as it is implemented in SearchResult (part of ccm-ldn-search) to enable merged results to be sorted Modified: aplaws/trunk/ccm-core/src/com/arsdigita/search/BaseDocument.java =================================================================== --- aplaws/trunk/ccm-core/src/com/arsdigita/search/BaseDocument.java 2007-09-18 11:16:54 UTC (rev 1655) +++ aplaws/trunk/ccm-core/src/com/arsdigita/search/BaseDocument.java 2007-09-18 13:00:26 UTC (rev 1656) @@ -32,8 +32,6 @@ import java.util.Date; import java.util.Locale; -import org.apache.log4j.Logger; - /** * A BaseDocument provides a base implementation of the * Document interface. Query engine implementations should @@ -43,7 +41,7 @@ * * @see com.arsdigita.search.Document */ -public class BaseDocument implements Document, Comparable { +public class BaseDocument implements Document { private URL m_url; private OID m_oid; @@ -59,8 +57,6 @@ private BigDecimal m_score; - static Logger s_log = Logger.getLogger(BaseDocument.class); - /** * Creates a new document; * @@ -308,30 +304,4 @@ return m_contentSection; } - /** - * Implements Comparable interface to allow ordering of search results - * by score descending where database ordering is not used - * (e.g. merged remote searches). - * - * @param obj - * @return int - * @throws java.lang.NullPointerException - * @throws java.lang.ClassCastException - */ - public int compareTo(Object obj) { - if (obj == null) { - throw new NullPointerException(); - } - - BaseDocument otherDocument = (BaseDocument) obj; - - s_log.debug("This score: " + getScore() + ", other score: " - + otherDocument.getScore() + ", result: " - + otherDocument.getScore().compareTo(getScore()) - + " (old result: " - + getScore().compareTo(otherDocument.getScore()) + ")"); - - - return otherDocument.getScore().compareTo(getScore()); - } } |
From: <chr...@fe...> - 2007-09-18 12:00:52
|
Author: chrisg23 Date: 2007-09-18 14:00:48 +0200 (Tue, 18 Sep 2007) New Revision: 1655 Modified: aplaws/trunk/ccm-core/src/com/arsdigita/bebop/page/PageTransformer.java Log: Sourceforge patch 1793047 - prevent attempt to transform xml if we java code has put an error in the response before generating any xml Modified: aplaws/trunk/ccm-core/src/com/arsdigita/bebop/page/PageTransformer.java =================================================================== --- aplaws/trunk/ccm-core/src/com/arsdigita/bebop/page/PageTransformer.java 2007-09-18 11:11:32 UTC (rev 1654) +++ aplaws/trunk/ccm-core/src/com/arsdigita/bebop/page/PageTransformer.java 2007-09-18 12:00:48 UTC (rev 1655) @@ -278,6 +278,9 @@ final HttpServletRequest req, final HttpServletResponse resp, final Map params) { + if (resp.isCommitted()) { + return; + } if (Assert.isEnabled()) { Assert.exists(doc, Document.class); Assert.exists(req, HttpServletRequest.class); |
From: <chr...@fe...> - 2007-09-18 12:00:51
|
Author: chrisg23 Date: 2007-09-18 14:00:41 +0200 (Tue, 18 Sep 2007) New Revision: 1654 Modified: aplaws/trunk/ccm-cms-types-mparticle/src/com/arsdigita/cms/contenttypes/ui/mparticle/MultiPartArticleForm.java Log: Sourceforge patch 1796980 - check with cms config parameter when deciding whether summary is mandatory in multipart article Modified: aplaws/trunk/ccm-cms-types-mparticle/src/com/arsdigita/cms/contenttypes/ui/mparticle/MultiPartArticleForm.java =================================================================== --- aplaws/trunk/ccm-cms-types-mparticle/src/com/arsdigita/cms/contenttypes/ui/mparticle/MultiPartArticleForm.java 2007-09-18 10:58:34 UTC (rev 1653) +++ aplaws/trunk/ccm-cms-types-mparticle/src/com/arsdigita/cms/contenttypes/ui/mparticle/MultiPartArticleForm.java 2007-09-18 12:00:41 UTC (rev 1654) @@ -152,7 +152,9 @@ add(new Label(MPArticleGlobalizationUtil.globalize("cms.contenttypes.ui.mparticle.summary"))); TextArea summaryWidget = new TextArea(new TrimmedStringParameter(SUMMARY)); - summaryWidget.addValidationListener(new NotNullValidationListener()); + if (ContentSection.getConfig().mandatoryDescriptions()) { + summaryWidget.addValidationListener(new NotEmptyValidationListener(GlobalizationUtil.globalize("cms.contenttypes.ui.description_missing"))); + } summaryWidget.setRows(5); summaryWidget.setCols(30); add(summaryWidget); |
From: <chr...@fe...> - 2007-09-18 11:01:02
|
Author: chrisg23 Date: 2007-09-18 13:00:57 +0200 (Tue, 18 Sep 2007) New Revision: 1652 Modified: aplaws/trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/NewItemForm.java Log: Sourceforge patch 1793108 - allow specific content types to be hidden from some users when creating a new item Modified: aplaws/trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/NewItemForm.java =================================================================== --- aplaws/trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/NewItemForm.java 2007-09-18 10:30:06 UTC (rev 1651) +++ aplaws/trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/NewItemForm.java 2007-09-18 11:00:57 UTC (rev 1652) @@ -33,7 +33,14 @@ import com.arsdigita.cms.ContentSection; import com.arsdigita.cms.ContentType; import com.arsdigita.cms.ContentTypeCollection; +import com.arsdigita.cms.SecurityManager; import com.arsdigita.globalization.GlobalizedMessage; +import com.arsdigita.kernel.Kernel; +import com.arsdigita.kernel.Party; +import com.arsdigita.kernel.permissions.PermissionDescriptor; +import com.arsdigita.kernel.permissions.PermissionManager; +import com.arsdigita.kernel.permissions.PermissionService; +import com.arsdigita.kernel.permissions.PrivilegeDescriptor; import com.arsdigita.util.UncheckedWrapperException; import com.arsdigita.xml.Element; @@ -104,7 +111,27 @@ if(!c.isEmpty()) { // Add content types while(c.next()) { + boolean list = true; ContentType type = c.getContentType(); + if (PermissionService.getDirectGrantedPermissions(type.getOID()).size() > 0) { + // chris gilbert - allow restriction of some types to certain + // users/groups. No interface to do this, but group could be + // created and permission granted in a content type loader + // + // can't permission filter the collection because most types + // will have no permissions granted. This approach involves + // a small overhead getting the count of granted permissions for + // each type (mitigated by only checking DIRECT permissions) + + Party party = Kernel.getContext().getParty(); + if (party == null) { + party = Kernel.getPublicUser(); + } + PermissionDescriptor create = new PermissionDescriptor(PrivilegeDescriptor.get(SecurityManager.CMS_NEW_ITEM), type, party ); + list = PermissionService.checkPermission(create); + + } + if (list) { //for dp content type label localization //String t = type.getAssociatedObjectType(); String cn = type.getClassName(); @@ -118,6 +145,8 @@ (type.getID().toString(), type.getLabel())); } } + + } c.reset(); } } |
From: <chr...@fe...> - 2007-09-18 11:01:02
|
Author: chrisg23 Date: 2007-09-18 13:00:53 +0200 (Tue, 18 Sep 2007) New Revision: 1650 Modified: aplaws/trunk/ccm-core/src/com/arsdigita/web/SecureFilter.java aplaws/trunk/ccm-core/src/com/arsdigita/web/WebConfig.java aplaws/trunk/ccm-core/src/com/arsdigita/web/WebConfig_parameter.properties Log: Sourceforge patch 1793009 - allow requests to switch back from https to http (eg when user logs out) Modified: aplaws/trunk/ccm-core/src/com/arsdigita/web/SecureFilter.java =================================================================== --- aplaws/trunk/ccm-core/src/com/arsdigita/web/SecureFilter.java 2007-09-18 09:57:51 UTC (rev 1649) +++ aplaws/trunk/ccm-core/src/com/arsdigita/web/SecureFilter.java 2007-09-18 11:00:53 UTC (rev 1650) @@ -10,6 +10,7 @@ import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.apache.log4j.Logger; import com.arsdigita.util.servlet.HttpHost; @@ -21,6 +22,8 @@ */ public class SecureFilter implements Filter { + private static Logger s_log = Logger.getLogger(SecureFilter.class); + public void init(FilterConfig filterConfig) throws ServletException { } @@ -31,7 +34,8 @@ HttpServletResponse hresp = (HttpServletResponse) response; String uri = hreq.getRequestURI(); WebConfig conf = Web.getConfig(); - if (conf.isSecureRequired(uri) && !request.isSecure()) { + if (conf.isSecureRequired(uri) && !request.isSecure() && !conf.isNonSecureSwitchRequired(uri)) { + s_log.debug("uri - " + uri + " should be accessed via https - redirecting"); StringBuffer secureEquivalent = new StringBuffer("https://"); HttpHost secureServer = conf.getSecureServer(); secureEquivalent.append(secureServer.getName()); @@ -50,6 +54,27 @@ .append(queryString); } hresp.sendRedirect(secureEquivalent.toString()); + } else if (conf.isNonSecureSwitchRequired(uri) && request.isSecure()) { + s_log.debug("uri - " + uri + " triggers a return to http from https - redirecting"); + StringBuffer nonSecureEquivalent = new StringBuffer("http://"); + HttpHost standardServer = conf.getServer(); + nonSecureEquivalent.append(standardServer.getName()); + int securePort = standardServer.getPort(); + if (securePort != 80) { + nonSecureEquivalent + .append(':') + .append(securePort); + } + if (uri != null) { + nonSecureEquivalent.append(uri); + } + String queryString = hreq.getQueryString(); + if (queryString != null) { + nonSecureEquivalent.append('?') + .append(queryString); + } + hresp.sendRedirect(nonSecureEquivalent.toString()); + } else { filterChain.doFilter(request, response); } Modified: aplaws/trunk/ccm-core/src/com/arsdigita/web/WebConfig.java =================================================================== --- aplaws/trunk/ccm-core/src/com/arsdigita/web/WebConfig.java 2007-09-18 09:57:51 UTC (rev 1649) +++ aplaws/trunk/ccm-core/src/com/arsdigita/web/WebConfig.java 2007-09-18 11:00:53 UTC (rev 1650) @@ -66,6 +66,7 @@ private final Parameter m_dynamic_host_provider; private final Parameter m_deactivate_cache_host_notifications; private final Parameter m_secureRequired; + private final Parameter m_secureSwitchBack; public WebConfig() { m_scheme = new DefaultSchemeParameter @@ -113,6 +114,9 @@ m_secureRequired = new StringArrayParameter( "waf.web.secure_required", Parameter.OPTIONAL, null); + m_secureSwitchBack = new StringArrayParameter ( + "waf.web.secure_switchback", Parameter.OPTIONAL, null); + m_dynamic_host_provider = new StringParameter ("waf.web.dynamic_host_provider", Parameter.OPTIONAL, ""); @@ -131,6 +135,7 @@ register(m_dynamic_host_provider); register(m_deactivate_cache_host_notifications); register(m_secureRequired); + register(m_secureSwitchBack); loadInfo(); } @@ -159,6 +164,18 @@ return false; } + public final boolean isNonSecureSwitchRequired(String uri) { + String[] switchBack = (String[])get(m_secureSwitchBack); + if (switchBack != null) { + for (int i=0, n=switchBack.length; i<n; i++) { + if (uri.startsWith(switchBack[i])) { + return true; + } + } + } + return false; + } + public final HttpHost getHost() { return (HttpHost) get(m_host); } Modified: aplaws/trunk/ccm-core/src/com/arsdigita/web/WebConfig_parameter.properties =================================================================== --- aplaws/trunk/ccm-core/src/com/arsdigita/web/WebConfig_parameter.properties 2007-09-18 09:57:51 UTC (rev 1649) +++ aplaws/trunk/ccm-core/src/com/arsdigita/web/WebConfig_parameter.properties 2007-09-18 11:00:53 UTC (rev 1650) @@ -34,6 +34,10 @@ waf.web.secure_required.purpose=List of URLs which accessed by insecure (normal HTTP) connection produce a redirect to a HTTPS equivalent waf.web.secure_required.example=/ccm/register/,/ccm/admin/ waf.web.secure_required.format=url1,url2,... +waf.web.secure_switchback.title=List of URLs that switch back to unsecure +waf.web.secure_switchback.purpose=List of URLs which accessed by secure (HTTPS) connection produce a redirect to a HTTP equivalent +waf.web.secure_switchback.example=/ccm/register/logout +waf.web.secure_switchback.format=url1,url2,... waf.web.site_name.title=Site name waf.web.site_name.purpose=The name of your website, for use in page footers for example waf.web.site_name.example=Joe's House of HTML |
From: <chr...@fe...> - 2007-09-18 11:00:57
|
Author: chrisg23 Date: 2007-09-18 13:00:59 +0200 (Tue, 18 Sep 2007) New Revision: 1653 Modified: aplaws/trunk/ccm-cms-types-mparticle/src/com/arsdigita/cms/contenttypes/ArticleSectionMetadataProvider.java Log: Small bugfix - if you have com.arsdigita.cms.types.mparticle.search.result_format=page_top then one page mparticles may have the word null added to the end of the title. This fixes the problem Modified: aplaws/trunk/ccm-cms-types-mparticle/src/com/arsdigita/cms/contenttypes/ArticleSectionMetadataProvider.java =================================================================== --- aplaws/trunk/ccm-cms-types-mparticle/src/com/arsdigita/cms/contenttypes/ArticleSectionMetadataProvider.java 2007-09-18 10:35:42 UTC (rev 1652) +++ aplaws/trunk/ccm-cms-types-mparticle/src/com/arsdigita/cms/contenttypes/ArticleSectionMetadataProvider.java 2007-09-18 11:00:59 UTC (rev 1653) @@ -20,10 +20,8 @@ import org.apache.log4j.Logger; -import com.arsdigita.cms.ContentPage; import com.arsdigita.cms.search.ContentPageMetadataProvider; import com.arsdigita.domain.DomainObject; -import com.arsdigita.util.StringUtils; /** * This class is an implementation of the Search metadata provider that @@ -51,9 +49,10 @@ title.append(": "); } } + if (pageTitle != null) { title.append(pageTitle); + } - return title.toString(); } } |
From: <chr...@fe...> - 2007-09-18 11:00:55
|
Author: chrisg23 Date: 2007-09-18 13:00:55 +0200 (Tue, 18 Sep 2007) New Revision: 1651 Modified: aplaws/trunk/ccm-cms/src/com/arsdigita/cms/dispatcher/SimpleXMLGenerator.java Log: Extension of Sourceforge patch 1679071 - add a flag to xml if user has publish privilege on the current page (only useful for non-caching sites) Modified: aplaws/trunk/ccm-cms/src/com/arsdigita/cms/dispatcher/SimpleXMLGenerator.java =================================================================== --- aplaws/trunk/ccm-cms/src/com/arsdigita/cms/dispatcher/SimpleXMLGenerator.java 2007-09-18 10:01:35 UTC (rev 1650) +++ aplaws/trunk/ccm-cms/src/com/arsdigita/cms/dispatcher/SimpleXMLGenerator.java 2007-09-18 11:00:55 UTC (rev 1651) @@ -106,6 +106,10 @@ if (PermissionService.checkPermission(edit)) { parent.addAttribute("canEdit", "true"); } + PermissionDescriptor publish = new PermissionDescriptor(PrivilegeDescriptor.get(SecurityManager.CMS_PUBLISH), item, currentParty); + if (PermissionService.checkPermission(publish)) { + parent.addAttribute("canPublish", "true"); + } String className = item.getDefaultDomainClass(); // Ensure correct subtype of ContentItem is instantiated |
From: <chr...@fe...> - 2007-09-18 10:00:46
|
Author: chrisg23 Date: 2007-09-18 12:00:40 +0200 (Tue, 18 Sep 2007) New Revision: 1649 Modified: aplaws/trunk/ccm-core/src/com/arsdigita/ui/admin/GroupSearchForm.java Log: Sourceforge patch 1793030 - small fix to prevent possibility of creating infinite group hierarchy Modified: aplaws/trunk/ccm-core/src/com/arsdigita/ui/admin/GroupSearchForm.java =================================================================== --- aplaws/trunk/ccm-core/src/com/arsdigita/ui/admin/GroupSearchForm.java 2007-09-18 09:38:53 UTC (rev 1648) +++ aplaws/trunk/ccm-core/src/com/arsdigita/ui/admin/GroupSearchForm.java 2007-09-18 10:00:40 UTC (rev 1649) @@ -101,10 +101,11 @@ excludedList.add(subgroups.getGroup().getID()); } GroupCollection supergroups = parent.getAllSupergroups(); - List supergroupsList = new ArrayList(); while (supergroups.next()) { excludedList.add(supergroups.getGroup().getID()); } + // make sure we can't add current group as child of itself!!! + excludedList.add(parent.getID()); if (!excludedList.isEmpty()) { |
From: <cl...@fe...> - 2007-09-18 10:00:44
|
Author: clasohm Date: 2007-09-18 12:00:37 +0200 (Tue, 18 Sep 2007) New Revision: 1648 Modified: aplaws/contrib/camden/ccm-ldn-camden-consultation/trunk/.classpath Log: changed Eclipse output directory Modified: aplaws/contrib/camden/ccm-ldn-camden-consultation/trunk/.classpath =================================================================== --- aplaws/contrib/camden/ccm-ldn-camden-consultation/trunk/.classpath 2007-09-18 09:37:12 UTC (rev 1647) +++ aplaws/contrib/camden/ccm-ldn-camden-consultation/trunk/.classpath 2007-09-18 10:00:37 UTC (rev 1648) @@ -4,8 +4,8 @@ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry combineaccessrules="false" kind="src" path="/ccm-cms"/> <classpathentry combineaccessrules="false" kind="src" path="/ccm-core"/> + <classpathentry combineaccessrules="false" kind="src" path="/ccm-ldn-navigation"/> <classpathentry combineaccessrules="false" kind="src" path="/ccm-ldn-rss"/> <classpathentry combineaccessrules="false" kind="src" path="/ccm-ldn-util"/> - <classpathentry combineaccessrules="false" kind="src" path="/ccm-ldn-navigation"/> - <classpathentry kind="output" path="bin"/> + <classpathentry kind="output" path="build/Eclipse"/> </classpath> |
From: <cl...@fe...> - 2007-09-18 10:00:43
|
Author: clasohm Date: 2007-09-18 12:00:35 +0200 (Tue, 18 Sep 2007) New Revision: 1647 Added: aplaws/trunk/ccm-cms-types-newsitem/.classpath aplaws/trunk/ccm-cms-types-newsitem/.project Log: added Eclipse project files Added: aplaws/trunk/ccm-cms-types-newsitem/.classpath =================================================================== --- aplaws/trunk/ccm-cms-types-newsitem/.classpath (rev 0) +++ aplaws/trunk/ccm-cms-types-newsitem/.classpath 2007-09-18 10:00:35 UTC (rev 1647) @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src"/> + <classpathentry kind="lib" path="build/ccm-cms-types-newsitem-6.5.0-pdl.jar"/> + <classpathentry kind="lib" path="build/ccm-cms-types-newsitem-6.5.0-sql.jar"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry combineaccessrules="false" kind="src" path="/ccm-cms"/> + <classpathentry combineaccessrules="false" kind="src" path="/ccm-core"/> + <classpathentry kind="output" path="build/classes"/> +</classpath> Added: aplaws/trunk/ccm-cms-types-newsitem/.project =================================================================== --- aplaws/trunk/ccm-cms-types-newsitem/.project (rev 0) +++ aplaws/trunk/ccm-cms-types-newsitem/.project 2007-09-18 10:00:35 UTC (rev 1647) @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>ccm-cms-types-newsitem</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> |
From: <cl...@fe...> - 2007-09-17 16:01:23
|
Author: clasohm Date: 2007-09-17 18:01:07 +0200 (Mon, 17 Sep 2007) New Revision: 1646 Added: aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/DecisionTreeTraversalAdapter.java aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/web/decisiontree/ aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/web/decisiontree/form-handler.jsp Modified: aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/pdl/com/arsdigita/camden/cms/contenttypes/DecisionTree.pdl aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/DecisionTree.xml aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/DecisionTree.java aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/DecisionTreeLoader.java aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/SectionOptionCollection.java aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/SectionTargetCollection.java aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/TreeSection.java aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/TreeSectionCollection.java aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/DecisionTreeViewOptions.java aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/DecisionTreeViewSections.java aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/DecisionTreeViewTargets.java aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/OptionDeleteForm.java aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/OptionEditForm.java aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/OptionTable.java aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/SectionTable.java aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/TargetDeleteForm.java aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/TargetEditForm.java aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/web/static/content-types/com/arsdigita/camden/cms/contenttypes/DecisionTree.xsl Log: worked on content item template and form handler Modified: aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/pdl/com/arsdigita/camden/cms/contenttypes/DecisionTree.pdl =================================================================== --- aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/pdl/com/arsdigita/camden/cms/contenttypes/DecisionTree.pdl 2007-09-17 15:14:20 UTC (rev 1645) +++ aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/pdl/com/arsdigita/camden/cms/contenttypes/DecisionTree.pdl 2007-09-17 16:01:07 UTC (rev 1646) @@ -19,7 +19,6 @@ model com.arsdigita.camden.cms.contenttypes; -import com.arsdigita.kernel.ACSObject; import com.arsdigita.cms.*; object type DecisionTree extends ContentPage { @@ -81,11 +80,11 @@ } association { - // Association between an option and its targets + // Association between an option and its target composite SectionOption[1..1] matchOption = join cam_section_targets.match_option to cam_section_options.option_id; - component SectionTarget[0..n] sectionOptions = + component SectionTarget[0..1] optionTarget = join cam_section_options.option_id to cam_section_targets.match_option; } Modified: aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/DecisionTree.xml =================================================================== --- aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/DecisionTree.xml 2007-09-17 15:14:20 UTC (rev 1645) +++ aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/DecisionTree.xml 2007-09-17 16:01:07 UTC (rev 1646) @@ -8,7 +8,57 @@ <xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator"> <xrd:adapter objectType="com.arsdigita.camden.cms.contenttypes.DecisionTree" extends="com.arsdigita.cms.ContentPage" - traversalClass="com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter"> + traversalClass="com.arsdigita.camden.cms.contenttypes.DecisionTreeTraversalAdapter"> + <xrd:associations rule="include"> + <xrd:property name="/object/sections"></xrd:property> + <xrd:property name="/object/sections/instructions"></xrd:property> + <xrd:property name="/object/sections/sectionOptions"></xrd:property> + <xrd:property name="/object/sections/sectionOptions/optionTarget"></xrd:property> + </xrd:associations> + <xrd:attributes rule="exclude"> + <xrd:property name="/object/version"/> + <xrd:property name="/object/name"/> + <xrd:property name="/object/language"/> + <xrd:property name="/object/ancestors"/> + <xrd:property name="/object/isDeleted"/> + <xrd:property name="/object/id"/> + <xrd:property name="/object/displayName"/> + <xrd:property name="/object/defaultDomainClass"/> + <xrd:property name="/object/sections/version"/> + <xrd:property name="/object/sections/name"/> + <xrd:property name="/object/sections/language"/> + <xrd:property name="/object/sections/ancestors"/> + <xrd:property name="/object/sections/isDeleted"/> + <xrd:property name="/object/sections/id"/> + <xrd:property name="/object/sections/objectType"/> + <xrd:property name="/object/sections/displayName"/> + <xrd:property name="/object/sections/defaultDomainClass"/> + <xrd:property name="/object/sections/instructions/version"/> + <xrd:property name="/object/sections/instructions/name"/> + <xrd:property name="/object/sections/instructions/language"/> + <xrd:property name="/object/sections/instructions/ancestors"/> + <xrd:property name="/object/sections/instructions/isDeleted"/> + <xrd:property name="/object/sections/instructions/id"/> + <xrd:property name="/object/sections/instructions/objectType"/> + <xrd:property name="/object/sections/instructions/displayName"/> + <xrd:property name="/object/sections/instructions/defaultDomainClass"/> + <xrd:property name="/object/sections/sectionOptions/version"/> + <xrd:property name="/object/sections/sectionOptions/name"/> + <xrd:property name="/object/sections/sectionOptions/ancestors"/> + <xrd:property name="/object/sections/sectionOptions/isDeleted"/> + <xrd:property name="/object/sections/sectionOptions/id"/> + <xrd:property name="/object/sections/sectionOptions/objectType"/> + <xrd:property name="/object/sections/sectionOptions/displayName"/> + <xrd:property name="/object/sections/sectionOptions/defaultDomainClass"/> + <xrd:property name="/object/sections/sectionOptions/optionTarget/version"/> + <xrd:property name="/object/sections/sectionOptions/optionTarget/name"/> + <xrd:property name="/object/sections/sectionOptions/optionTarget/ancestors"/> + <xrd:property name="/object/sections/sectionOptions/optionTarget/isDeleted"/> + <xrd:property name="/object/sections/sectionOptions/optionTarget/id"/> + <xrd:property name="/object/sections/sectionOptions/optionTarget/objectType"/> + <xrd:property name="/object/sections/sectionOptions/optionTarget/displayName"/> + <xrd:property name="/object/sections/sectionOptions/optionTarget/defaultDomainClass"/> + </xrd:attributes> </xrd:adapter> </xrd:context> @@ -26,7 +76,43 @@ <xrd:property name="/object/objectType"/> <xrd:property name="/object/displayName"/> <xrd:property name="/object/defaultDomainClass"/> + <xrd:property name="/object/sections/version"/> + <xrd:property name="/object/sections/name"/> + <xrd:property name="/object/sections/language"/> + <xrd:property name="/object/sections/ancestors"/> + <xrd:property name="/object/sections/isDeleted"/> + <xrd:property name="/object/sections/id"/> + <xrd:property name="/object/sections/objectType"/> + <xrd:property name="/object/sections/displayName"/> + <xrd:property name="/object/sections/defaultDomainClass"/> + <xrd:property name="/object/sections/instructions/version"/> + <xrd:property name="/object/sections/instructions/name"/> + <xrd:property name="/object/sections/instructions/language"/> + <xrd:property name="/object/sections/instructions/ancestors"/> + <xrd:property name="/object/sections/instructions/isDeleted"/> + <xrd:property name="/object/sections/instructions/id"/> + <xrd:property name="/object/sections/instructions/objectType"/> + <xrd:property name="/object/sections/instructions/displayName"/> + <xrd:property name="/object/sections/instructions/defaultDomainClass"/> + <xrd:property name="/object/sections/sectionOptions/version"/> + <xrd:property name="/object/sections/sectionOptions/name"/> + <xrd:property name="/object/sections/sectionOptions/ancestors"/> + <xrd:property name="/object/sections/sectionOptions/isDeleted"/> + <xrd:property name="/object/sections/sectionOptions/id"/> + <xrd:property name="/object/sections/sectionOptions/objectType"/> + <xrd:property name="/object/sections/sectionOptions/displayName"/> + <xrd:property name="/object/sections/sectionOptions/defaultDomainClass"/> + <xrd:property name="/object/sections/sectionOptions/optionTarget/version"/> + <xrd:property name="/object/sections/sectionOptions/optionTarget/name"/> + <xrd:property name="/object/sections/sectionOptions/optionTarget/ancestors"/> + <xrd:property name="/object/sections/sectionOptions/optionTarget/isDeleted"/> + <xrd:property name="/object/sections/sectionOptions/optionTarget/id"/> + <xrd:property name="/object/sections/sectionOptions/optionTarget/objectType"/> + <xrd:property name="/object/sections/sectionOptions/optionTarget/displayName"/> + <xrd:property name="/object/sections/sectionOptions/optionTarget/defaultDomainClass"/> </xrd:attributes> + <xrd:attributes rule="include"> + <xrd:property name="/object/sections"></xrd:property></xrd:attributes> </xrd:adapter> </xrd:context> </xrd:adapters> Modified: aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/DecisionTree.java =================================================================== --- aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/DecisionTree.java 2007-09-17 15:14:20 UTC (rev 1645) +++ aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/DecisionTree.java 2007-09-17 16:01:07 UTC (rev 1646) @@ -20,13 +20,23 @@ import java.math.BigDecimal; +import javax.servlet.http.HttpServletRequest; + +import com.arsdigita.bebop.PageState; +import com.arsdigita.cms.CMS; +import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ContentPage; +import com.arsdigita.cms.dispatcher.CMSPage; +import com.arsdigita.cms.dispatcher.SimpleXMLGenerator; +import com.arsdigita.cms.dispatcher.XMLGenerator; import com.arsdigita.domain.DataObjectNotFoundException; +import com.arsdigita.domain.DomainObjectXMLRenderer; import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.OID; import com.arsdigita.persistence.Session; import com.arsdigita.persistence.SessionManager; +import com.arsdigita.xml.Element; /** * The Camden Decision Tree content type. @@ -34,10 +44,12 @@ * @author Carsten Clasohm * @version $Id$ */ -public class DecisionTree extends ContentPage { +public class DecisionTree extends ContentPage implements XMLGenerator { public static final String versionId = "$Id$"; + public static final String ADAPTER_CONTEXT = SimpleXMLGenerator.class.getName(); + public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.camden.cms.contenttypes.DecisionTree"; @@ -131,7 +143,6 @@ return options; } - public SectionTargetCollection getTargets() { Session ssn = SessionManager.getSession(); DataCollection collection = ssn.retrieve(SectionTarget.BASE_DATA_OBJECT_TYPE); @@ -141,4 +152,41 @@ options.addOrder("matchOption.treeSection.title, matchOption.label"); return options; } + + /** + * Generate the XML for a DecisionTree. In addition to what SimpleXMLGenerator does, + * this also stores information about the current request in an XML element. + */ + public void generateXML(PageState state, Element parent, String useContext) { + ContentItem item; + if (CMS.getContext().hasContentItem()) { + item = CMS.getContext().getContentItem(); + } else { + CMSPage page = (CMSPage) state.getPage(); + item = page.getContentItem(state); + } + + Element content = new Element("cms:item", CMS.CMS_XML_NS); + if (useContext != null) + content.addAttribute("useContext", useContext); + + // TODO: determine the current URL from the original HTTP request. + // Or use some OID redirector? + HttpServletRequest request = state.getRequest(); + Element currentURL = new Element("customInfo"); + currentURL.addAttribute("currentURL", request.getPathInfo()); + content.addContent(currentURL); + + DomainObjectXMLRenderer renderer = + new DomainObjectXMLRenderer(content); + + renderer.setWrapAttributes(true); + renderer.setWrapRoot(false); + renderer.setWrapObjects(false); + renderer.setRevisitFullObject(true); + + renderer.walk(item, ADAPTER_CONTEXT); + + parent.addContent(content); + } } Modified: aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/DecisionTreeLoader.java =================================================================== --- aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/DecisionTreeLoader.java 2007-09-17 15:14:20 UTC (rev 1645) +++ aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/DecisionTreeLoader.java 2007-09-17 16:01:07 UTC (rev 1646) @@ -37,5 +37,5 @@ public String[] getTypes() { return TYPES; } - + } Added: aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/DecisionTreeTraversalAdapter.java =================================================================== --- aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/DecisionTreeTraversalAdapter.java (rev 0) +++ aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/DecisionTreeTraversalAdapter.java 2007-09-17 16:01:07 UTC (rev 1646) @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2007 Red Hat Inc. All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +package com.arsdigita.camden.cms.contenttypes; + +import java.math.BigDecimal; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.log4j.Logger; + +import com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter; +import com.arsdigita.dispatcher.DispatcherHelper; +import com.arsdigita.domain.DataObjectNotFoundException; +import com.arsdigita.domain.DomainObject; +import com.arsdigita.domain.SimpleDomainObjectTraversalAdapter; +import com.arsdigita.persistence.metadata.Property; + +public class DecisionTreeTraversalAdapter extends + ContentItemTraversalAdapter { + + private static final Logger s_log = Logger.getLogger(DecisionTreeTraversalAdapter.class); + + public DecisionTreeTraversalAdapter() {} + + public DecisionTreeTraversalAdapter(SimpleDomainObjectTraversalAdapter adapter) { + super(adapter); + } + + public boolean processProperty(DomainObject obj, String path, + Property prop, String context) { + // TODO Auto-generated method stub + + HttpServletRequest request = DispatcherHelper.getRequest(); + + if ("/object/sections/title".equals(path) || + "/object/sections/instructions".equals(path) || + "/object/sections/sectionOptions".equals(path)) { + // Only include one TreeSection in the output. + // Which one depends on the section_id parameter. + + TreeSection section = (TreeSection) obj; + TreeSection selectedSection = null; + String sectionID = request.getParameter("section_id"); + if (sectionID == null || "".equals(sectionID)) { + DecisionTree tree = section.getTree(); + selectedSection = tree.getFirstSection(); + + if (selectedSection == null) { + throw new RuntimeException("The first section has not been set for tree " + tree); + } + } else { + try { + selectedSection = new TreeSection(new BigDecimal(sectionID)); + } catch (DataObjectNotFoundException e) { + throw new RuntimeException("Cannot find section for section_id parameter " + sectionID); + } + } + + return section.equals(selectedSection); + } else + return super.processProperty(obj, path, prop, context); + } +} Modified: aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/SectionOptionCollection.java =================================================================== --- aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/SectionOptionCollection.java 2007-09-17 15:14:20 UTC (rev 1645) +++ aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/SectionOptionCollection.java 2007-09-17 16:01:07 UTC (rev 1646) @@ -21,8 +21,6 @@ import com.arsdigita.domain.DomainCollection; import com.arsdigita.domain.DomainObject; import com.arsdigita.persistence.DataCollection; -import com.arsdigita.persistence.Filter; -import com.arsdigita.persistence.PersistenceException; /** * This class contains a collection of SectionOption objects. Modified: aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/SectionTargetCollection.java =================================================================== --- aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/SectionTargetCollection.java 2007-09-17 15:14:20 UTC (rev 1645) +++ aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/SectionTargetCollection.java 2007-09-17 16:01:07 UTC (rev 1646) @@ -21,8 +21,6 @@ import com.arsdigita.domain.DomainCollection; import com.arsdigita.domain.DomainObject; import com.arsdigita.persistence.DataCollection; -import com.arsdigita.persistence.Filter; -import com.arsdigita.persistence.PersistenceException; /** * This class contains a collection of TreeSection objects. Modified: aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/TreeSection.java =================================================================== --- aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/TreeSection.java 2007-09-17 15:14:20 UTC (rev 1645) +++ aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/TreeSection.java 2007-09-17 16:01:07 UTC (rev 1646) @@ -100,10 +100,6 @@ add(SECTION_TARGETS, target); } - public SectionTargetCollection getTargets() { - return new SectionTargetCollection((DataCollection)get(SECTION_TARGETS)); - } - public void removeTarget(SectionTarget target) { target.delete(); } Modified: aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/TreeSectionCollection.java =================================================================== --- aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/TreeSectionCollection.java 2007-09-17 15:14:20 UTC (rev 1645) +++ aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/TreeSectionCollection.java 2007-09-17 16:01:07 UTC (rev 1646) @@ -21,8 +21,6 @@ import com.arsdigita.domain.DomainCollection; import com.arsdigita.domain.DomainObject; import com.arsdigita.persistence.DataCollection; -import com.arsdigita.persistence.Filter; -import com.arsdigita.persistence.PersistenceException; /** * This class contains a collection of TreeSection objects. Modified: aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/DecisionTreeViewOptions.java =================================================================== --- aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/DecisionTreeViewOptions.java 2007-09-17 15:14:20 UTC (rev 1645) +++ aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/DecisionTreeViewOptions.java 2007-09-17 16:01:07 UTC (rev 1646) @@ -19,10 +19,7 @@ package com.arsdigita.camden.cms.contenttypes.ui; -import org.apache.log4j.Logger; - import com.arsdigita.bebop.ActionLink; -import com.arsdigita.bebop.BoxPanel; import com.arsdigita.bebop.ColumnPanel; import com.arsdigita.bebop.Container; import com.arsdigita.bebop.Label; Modified: aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/DecisionTreeViewSections.java =================================================================== --- aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/DecisionTreeViewSections.java 2007-09-17 15:14:20 UTC (rev 1645) +++ aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/DecisionTreeViewSections.java 2007-09-17 16:01:07 UTC (rev 1646) @@ -19,10 +19,7 @@ package com.arsdigita.camden.cms.contenttypes.ui; -import org.apache.log4j.Logger; - import com.arsdigita.bebop.ActionLink; -import com.arsdigita.bebop.BoxPanel; import com.arsdigita.bebop.ColumnPanel; import com.arsdigita.bebop.Container; import com.arsdigita.bebop.Label; Modified: aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/DecisionTreeViewTargets.java =================================================================== --- aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/DecisionTreeViewTargets.java 2007-09-17 15:14:20 UTC (rev 1645) +++ aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/DecisionTreeViewTargets.java 2007-09-17 16:01:07 UTC (rev 1646) @@ -19,10 +19,7 @@ package com.arsdigita.camden.cms.contenttypes.ui; -import org.apache.log4j.Logger; - import com.arsdigita.bebop.ActionLink; -import com.arsdigita.bebop.BoxPanel; import com.arsdigita.bebop.ColumnPanel; import com.arsdigita.bebop.Container; import com.arsdigita.bebop.Label; Modified: aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/OptionDeleteForm.java =================================================================== --- aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/OptionDeleteForm.java 2007-09-17 15:14:20 UTC (rev 1645) +++ aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/OptionDeleteForm.java 2007-09-17 16:01:07 UTC (rev 1646) @@ -33,13 +33,9 @@ import com.arsdigita.bebop.event.FormProcessListener; import com.arsdigita.bebop.event.FormSectionEvent; import com.arsdigita.bebop.event.FormSubmissionListener; -import com.arsdigita.camden.cms.contenttypes.DecisionTree; import com.arsdigita.camden.cms.contenttypes.DecisionTreeUtil; import com.arsdigita.camden.cms.contenttypes.SectionOption; -import com.arsdigita.camden.cms.contenttypes.TreeSection; import com.arsdigita.cms.ItemSelectionModel; -import com.arsdigita.domain.DataObjectNotFoundException; -import com.arsdigita.util.Assert; /** * A form to confirm deletion of a single section of a DecisionTree. Modified: aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/OptionEditForm.java =================================================================== --- aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/OptionEditForm.java 2007-09-17 15:14:20 UTC (rev 1645) +++ aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/OptionEditForm.java 2007-09-17 16:01:07 UTC (rev 1646) @@ -40,7 +40,6 @@ import com.arsdigita.bebop.form.Option; import com.arsdigita.bebop.form.SingleSelect; import com.arsdigita.bebop.form.TextField; -import com.arsdigita.bebop.parameters.BigDecimalParameter; import com.arsdigita.bebop.parameters.NotNullValidationListener; import com.arsdigita.bebop.parameters.TrimmedStringParameter; import com.arsdigita.camden.cms.contenttypes.DecisionTree; @@ -49,8 +48,6 @@ import com.arsdigita.camden.cms.contenttypes.TreeSection; import com.arsdigita.camden.cms.contenttypes.TreeSectionCollection; import com.arsdigita.cms.ItemSelectionModel; -import com.arsdigita.domain.DataObjectNotFoundException; -import com.arsdigita.util.Assert; /** * Form to edit a SectionOption for a DecisionTree. @@ -152,6 +149,7 @@ Option option = new Option(section.getID().toString(), section.getTitle()); target.addOption(option, state); } + sections.close(); } } } Modified: aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/OptionTable.java =================================================================== --- aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/OptionTable.java 2007-09-17 15:14:20 UTC (rev 1645) +++ aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/OptionTable.java 2007-09-17 16:01:07 UTC (rev 1646) @@ -34,7 +34,6 @@ import com.arsdigita.camden.cms.contenttypes.DecisionTree; import com.arsdigita.camden.cms.contenttypes.SectionOption; import com.arsdigita.camden.cms.contenttypes.SectionOptionCollection; -import com.arsdigita.camden.cms.contenttypes.TreeSectionCollection; import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.SecurityManager; Modified: aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/SectionTable.java =================================================================== --- aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/SectionTable.java 2007-09-17 15:14:20 UTC (rev 1645) +++ aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/SectionTable.java 2007-09-17 16:01:07 UTC (rev 1646) @@ -26,8 +26,6 @@ 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; Modified: aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/TargetDeleteForm.java =================================================================== --- aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/TargetDeleteForm.java 2007-09-17 15:14:20 UTC (rev 1645) +++ aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/TargetDeleteForm.java 2007-09-17 16:01:07 UTC (rev 1646) @@ -33,7 +33,6 @@ import com.arsdigita.bebop.event.FormSectionEvent; import com.arsdigita.bebop.event.FormSubmissionListener; import com.arsdigita.camden.cms.contenttypes.DecisionTreeUtil; -import com.arsdigita.camden.cms.contenttypes.SectionOption; import com.arsdigita.camden.cms.contenttypes.SectionTarget; import com.arsdigita.cms.ItemSelectionModel; Modified: aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/TargetEditForm.java =================================================================== --- aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/TargetEditForm.java 2007-09-17 15:14:20 UTC (rev 1645) +++ aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/TargetEditForm.java 2007-09-17 16:01:07 UTC (rev 1646) @@ -50,7 +50,6 @@ import com.arsdigita.camden.cms.contenttypes.TreeSection; import com.arsdigita.camden.cms.contenttypes.TreeSectionCollection; import com.arsdigita.cms.ItemSelectionModel; -import com.arsdigita.domain.DataObjectNotFoundException; /** * Form to edit a SectionTarget for a DecisionTree. @@ -154,6 +153,7 @@ Option option = new Option(section.getID().toString(), section.getTitle()); target.addOption(option, state); } + sections.close(); } } } @@ -174,6 +174,7 @@ Option option = new Option(section.getID().toString(), section.getTitle()); target.addOption(option, state); } + sections.close(); } } } @@ -195,6 +196,7 @@ Option option = new Option(sectionOption.getID().toString(), label); target.addOption(option, state); } + sectionOptions.close(); } } } Added: aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/web/decisiontree/form-handler.jsp =================================================================== --- aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/web/decisiontree/form-handler.jsp (rev 0) +++ aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/web/decisiontree/form-handler.jsp 2007-09-17 16:01:07 UTC (rev 1646) @@ -0,0 +1,54 @@ +<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="1.2"> + + <jsp:directive.page import="com.arsdigita.persistence.OID"/> + <jsp:directive.page import="com.arsdigita.camden.cms.contenttypes.DecisionTree"/> + <jsp:directive.page import="com.arsdigita.camden.cms.contenttypes.SectionTarget"/> + <jsp:directive.page import="com.arsdigita.camden.cms.contenttypes.SectionTargetCollection"/> + <jsp:directive.page import="com.arsdigita.camden.cms.contenttypes.TreeSection"/> + <jsp:directive.page import="com.arsdigita.kernel.URLService"/> + <jsp:directive.page import="com.arsdigita.web.RedirectSignal"/> + <jsp:directive.page import="com.arsdigita.web.URL"/> + <jsp:directive.page import="org.apache.log4j.Logger"/> + + <jsp:directive.page extends="com.arsdigita.web.BaseJSP"/> + + <jsp:directive.page contentType="text/html"/> + + <jsp:scriptlet> + Logger s_log = Logger.getLogger("form-handler"); + + String sectionOID = request.getParameter("section_oid"); + String selectedOption = request.getParameter("option"); + String returnURL = request.getParameter("return_url"); + + TreeSection section = new TreeSection(OID.valueOf(sectionOID)); + DecisionTree tree = section.getTree(); + + // Find out which option has been selected. + SectionTargetCollection targets = tree.getTargets(); + targets.addEqualsFilter("matchOption.value", selectedOption); + + if (targets.next()) { + SectionTarget target = targets.getTarget(); + String targetURL = target.getTargetURL(); + if (targetURL == null || "".equals(targetURL)) { + targetURL = URLService.locate(tree.getOID()) + + "?section_id=" + target.getTargetSection().getID(); + } + + throw new RedirectSignal(targetURL, false); + } else { + </jsp:scriptlet> + + <html> + <body> + <p>Error: No target found for selected option.</p> + </body> + </html> + + <jsp:scriptlet> + } + + targets.close(); + </jsp:scriptlet> +</jsp:root> Modified: aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/web/static/content-types/com/arsdigita/camden/cms/contenttypes/DecisionTree.xsl =================================================================== --- aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/web/static/content-types/com/arsdigita/camden/cms/contenttypes/DecisionTree.xsl 2007-09-17 15:14:20 UTC (rev 1645) +++ aplaws/contrib/camden/ccm-ldn-camden-decisiontree/trunk/web/static/content-types/com/arsdigita/camden/cms/contenttypes/DecisionTree.xsl 2007-09-17 16:01:07 UTC (rev 1646) @@ -8,20 +8,48 @@ <xsl:template match="cms:item[objectType='com.arsdigita.camden.cms.contenttypes.DecisionTree']" mode="cms:CT_graphics" name="cms:CT_graphics_com_arsdigita_camden_cms_contenttypes_DecisionTree"> - <table width="435" border="0" cellspacing="0" cellpadding="0"> - <tr> - <td width="285" align="left" valign="top"> - <table width="285" border="0" cellspacing="1" cellpadding="0"> - <tr> - <th>Title</th> - <td class="contentTitle" align="left" valign="top"> - <xsl:value-of select="./title"/> - </td> - </tr> - </table> - </td> - </tr> - </table> + <h1><xsl:value-of select="./title"/></h1> + + <h2><xsl:value-of select="./sections/title"/></h2> + + <div><xsl:value-of select="./sections/instructions/content" disable-output-escaping="yes"/></div> + + <form action="/decisiontree/form-handler.jsp" method="GET"> + <input type="hidden" name="section_oid"> + <xsl:attribute name="value"> + <xsl:value-of select="./sections[title]/@oid"/> + </xsl:attribute> + </input> + <input type="hidden" name="return_url"> + <xsl:attribute name="value"> + <xsl:value-of select="./customInfo/@currentURL"/> + </xsl:attribute> + </input> + + <xsl:for-each select="./sections/sectionOptions"> + <xsl:sort select="./label" data-type="text"/> + + <div> + <input type="radio" name="option"> + <xsl:attribute name="value"> + <xsl:value-of select="./value"/> + </xsl:attribute> + <xsl:attribute name="id"> + <xsl:value-of select="@oid"/> + </xsl:attribute> + </input> + <label> + <xsl:attribute name="for"> + <xsl:value-of select="@oid"/> + </xsl:attribute> + <xsl:value-of select="./label"/> + </label> + </div> + </xsl:for-each> + + <input type="submit" name="cancel" value="Cancel"/> + <input type="submit" name="next" value="Next >"/> + </form> </xsl:template> <xsl:template match="cms:item[objectType='com.arsdigita.camden.cms.contenttypes.DecisionTree']" mode="cms:CT_text" |
Author: chrisg23 Date: 2007-09-17 18:00:33 +0200 (Mon, 17 Sep 2007) New Revision: 1644 Added: aplaws/contrib/wsx/ccm-categorised-forum/ aplaws/contrib/wsx/ccm-categorised-forum/application.xml aplaws/contrib/wsx/ccm-categorised-forum/src/ aplaws/contrib/wsx/ccm-categorised-forum/src/ccm-categorised-forum.load aplaws/contrib/wsx/ccm-categorised-forum/src/ccm-forum.upgrade aplaws/contrib/wsx/ccm-categorised-forum/src/com/ aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/ aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/ aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/AssignCategoryView.java aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/CategorisedForumComponent.java aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/CategorisedForumPageBuilder.java aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/CategorisedThreadPageBuilder.java aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/CategorySubtreePageBuilder.java aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/ForumCategorySummary.java aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/ForumNavigationModel.java aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/ForumTermForm.java aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/ForumTermPicker.java aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/ForumURLFinder.java aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/Initializer.java aplaws/contrib/wsx/ccm-categorised-forum/web/ aplaws/contrib/wsx/ccm-categorised-forum/web/__ccm__/ aplaws/contrib/wsx/ccm-categorised-forum/web/__ccm__/apps/ aplaws/contrib/wsx/ccm-categorised-forum/web/__ccm__/apps/categorised-forum/ aplaws/contrib/wsx/ccm-categorised-forum/web/__ccm__/apps/categorised-forum/xsl/ aplaws/contrib/wsx/ccm-categorised-forum/web/__ccm__/apps/categorised-forum/xsl/forum-categories.xsl Log: Extension to Forum application that allows forums to be easily placed in site navigation Added: aplaws/contrib/wsx/ccm-categorised-forum/application.xml =================================================================== --- aplaws/contrib/wsx/ccm-categorised-forum/application.xml (rev 0) +++ aplaws/contrib/wsx/ccm-categorised-forum/application.xml 2007-09-17 16:00:33 UTC (rev 1644) @@ -0,0 +1,25 @@ +<?xml version="1.0"?> +<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project" + name="ccm-categorised-forum" + prettyName="Categorised Forum" + version="6.5.0" + webapp="ccm-forum" + release="1"> + <ccm:dependencies> + <ccm:requires name="ccm-forum" version="6.4.0" relation="ge"/> + <ccm:requires name="ccm-ldn-aplaws" version="6.4.0" relation="ge"/> + </ccm:dependencies> + + <ccm:directories> + <ccm:directory name="src"/> + </ccm:directories> + + <ccm:contacts> + <ccm:contact uri="http://www.redhat.com/software/rhea" type="website"/> + <ccm:contact uri="mailto:rh...@re..." type="support"/> + </ccm:contacts> + <ccm:description> + The Red Hat Web Application Framework is a platform for writing + database-backed web applications in Java. + </ccm:description> +</ccm:application> Added: aplaws/contrib/wsx/ccm-categorised-forum/src/ccm-categorised-forum.load =================================================================== --- aplaws/contrib/wsx/ccm-categorised-forum/src/ccm-categorised-forum.load (rev 0) +++ aplaws/contrib/wsx/ccm-categorised-forum/src/ccm-categorised-forum.load 2007-09-17 16:00:33 UTC (rev 1644) @@ -0,0 +1,10 @@ +<load> + <requires> + <table name="inits"/> + <table name="acs_objects"/> + </requires> + <provides> + <initializer class="com.arsdigita.categorisedforum.Initializer"/> + </provides> + +</load> Added: aplaws/contrib/wsx/ccm-categorised-forum/src/ccm-forum.upgrade =================================================================== --- aplaws/contrib/wsx/ccm-categorised-forum/src/ccm-forum.upgrade (rev 0) +++ aplaws/contrib/wsx/ccm-categorised-forum/src/ccm-forum.upgrade 2007-09-17 16:00:33 UTC (rev 1644) @@ -0,0 +1,12 @@ +<upgrade> + <version from="1.4.2" to="1.4.3"> + <script sql="ccm-forum/upgrade/::database::-1.4.2-1.4.3.sql"/> + </version> + <version from="1.4.3" to="1.4.4"> + <script sql="ccm-forum/upgrade/::database::-1.4.3-1.4.4.sql"/> + </version> + <version from="1.4.4" to="1.4.5"> + <script sql="ccm-forum/upgrade/::database::-1.4.4-1.4.5.sql"/> + </version> + +</upgrade> Added: aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/AssignCategoryView.java =================================================================== --- aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/AssignCategoryView.java (rev 0) +++ aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/AssignCategoryView.java 2007-09-17 16:00:33 UTC (rev 1644) @@ -0,0 +1,113 @@ +/* + * Created on 09-Feb-06 + * + * To change the template for this generated file go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +package com.arsdigita.categorisedforum; + +import java.math.BigDecimal; + +import org.apache.log4j.Logger; + +import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.Page; +import com.arsdigita.bebop.PageState; +import com.arsdigita.bebop.SimpleComponent; +import com.arsdigita.bebop.SimpleContainer; +import com.arsdigita.bebop.event.ActionEvent; +import com.arsdigita.bebop.event.ActionListener; +import com.arsdigita.bebop.parameters.BigDecimalParameter; +import com.arsdigita.bebop.parameters.StringParameter; +import com.arsdigita.categorization.ui.ACSObjectCategoryForm; +import com.arsdigita.categorization.ui.ACSObjectCategorySummary; +import com.arsdigita.forum.ui.Constants; +import com.arsdigita.web.RedirectSignal; + +/** + * @author cgyg9330 + * + * To change the template for this generated type comment go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +public class AssignCategoryView extends SimpleContainer implements Constants { + + private ACSObjectCategorySummary m_summary; + private SimpleComponent m_add; + private BigDecimalParameter m_root; + private StringParameter m_mode; + Logger s_log = Logger.getLogger(AssignCategoryView.class); + + public AssignCategoryView() { + super(); + + m_root = new BigDecimalParameter("root"); + m_mode = new StringParameter("mode"); + + m_summary = new ForumCategorySummary(); + s_log.debug("m_summary in the constructor is : " + m_summary.toString()); + + m_summary.registerAction(ACSObjectCategorySummary.ACTION_ADD, + new AddActionListener("plain")); + m_summary.registerAction(ACSObjectCategorySummary.ACTION_ADD_JS, + new AddActionListener("javascript")); + m_add = new ForumTermPicker(m_root, m_mode); + + m_add.addCompletionListener(new ResetListener()); + + add(m_summary); + add(m_add); + } + + public void register(Page p) { + super.register(p); + + p.setVisibleDefault(m_add, false); + + p.addGlobalStateParam(m_root); + p.addGlobalStateParam(m_mode); + } + + public void reset(PageState state) { + state.setValue(m_root, null); + state.setValue(m_mode, null); + + m_summary.setVisible(state, true); + m_add.setVisible(state, false); + } + + private class AddActionListener implements ActionListener { + private String m_mode; + + public AddActionListener(String mode) { + m_mode = mode; + } + + public void actionPerformed(ActionEvent e) { + PageState state = e.getPageState(); + + state.setValue(m_root, + new BigDecimal(state.getControlEventValue())); + + state.setValue(AssignCategoryView.this.m_mode, + m_mode); + s_log.debug("m_summary in the action perform is : " + m_summary.toString()); + m_summary.setVisible(state, false); + m_add.setVisible(state, true); + } + } + + private class ResetListener implements ActionListener { + public void actionPerformed(ActionEvent e) { + PageState state = e.getPageState(); + reset(state); + throw new RedirectSignal(state.toURL(), true); + } + }/** + * + */ + + + + +} Added: aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/CategorisedForumComponent.java =================================================================== --- aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/CategorisedForumComponent.java (rev 0) +++ aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/CategorisedForumComponent.java 2007-09-17 16:00:33 UTC (rev 1644) @@ -0,0 +1,80 @@ +/* + * Created on 09-Feb-06 + * + * To change the template for this generated file go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +package com.arsdigita.categorisedforum; + +import javax.servlet.ServletException; + +import com.arsdigita.bebop.PageState; +import com.arsdigita.forum.Forum; +import com.arsdigita.forum.ForumContext; +import com.arsdigita.forum.ui.ForumComponent; +import com.arsdigita.kernel.Kernel; +import com.arsdigita.kernel.Party; +import com.arsdigita.kernel.permissions.PermissionDescriptor; +import com.arsdigita.kernel.permissions.PermissionService; +import com.arsdigita.kernel.permissions.PrivilegeDescriptor; +import com.arsdigita.kernel.security.UserContext; +import com.arsdigita.xml.Element; + +/** + * @author cgyg9330 + * + * To change the template for this generated type comment go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +public class CategorisedForumComponent extends ForumComponent { + + public static final String MODE_CATEGORIES = "categories"; + + private AssignCategoryView m_categoryView; + + /** + * + */ + public CategorisedForumComponent() { + super(); + m_categoryView = new AssignCategoryView(); + add(m_categoryView); + + // TODO Auto-generated constructor stub + } + + protected void setVisible( + PageState state, + Party party, + Forum forum, + String mode) { + + PermissionDescriptor forumAdmin = + new PermissionDescriptor(PrivilegeDescriptor.ADMIN, forum, party); + + if (MODE_CATEGORIES.equals(mode)) { + if (party == null) { + UserContext.redirectToLoginPage(state.getRequest()); + } + PermissionService.assertPermission(forumAdmin); + setVisibleComponent(state, m_categoryView); + } else { + super.setVisible(state, party, forum, mode); + } + } + + protected void generateModes( + PageState state, + Element content, + Party party, + Forum forum) { + super.generateModes(state, content, party, forum); + PermissionDescriptor permission = + new PermissionDescriptor(PrivilegeDescriptor.ADMIN, forum, party); + + if (PermissionService.checkPermission(permission)) { + generateModeXML(state, content, MODE_CATEGORIES); + } + } + +} Added: aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/CategorisedForumPageBuilder.java =================================================================== --- aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/CategorisedForumPageBuilder.java (rev 0) +++ aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/CategorisedForumPageBuilder.java 2007-09-17 16:00:33 UTC (rev 1644) @@ -0,0 +1,46 @@ +/* + * Created on 09-Feb-06 + * + * To change the template for this generated file go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +package com.arsdigita.categorisedforum; + +import com.arsdigita.bebop.Page; +import com.arsdigita.bebop.parameters.ParameterModel; +import com.arsdigita.forum.Forum; +import com.arsdigita.forum.ForumContext; +import com.arsdigita.forum.ForumPageBuilder; +import com.arsdigita.forum.ui.ForumComponent; +import com.arsdigita.kernel.ACSObject; +import com.arsdigita.london.navigation.ui.category.Menu; +import com.arsdigita.london.navigation.ui.category.Path; + +/** + * @author cgyg9330 + * + * To change the template for this generated type comment go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +public class CategorisedForumPageBuilder extends ForumPageBuilder { + + public Page buildPage() { + + Page page = super.buildPage(); + Path path = new Path(); + path.setModel(new ForumNavigationModel()); + + page.add(path); + page.add(new Menu()); + return page; + + } + + protected ForumComponent getForumComponent() { + return new CategorisedForumComponent(); + } + + + + +} Added: aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/CategorisedThreadPageBuilder.java =================================================================== --- aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/CategorisedThreadPageBuilder.java (rev 0) +++ aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/CategorisedThreadPageBuilder.java 2007-09-17 16:00:33 UTC (rev 1644) @@ -0,0 +1,38 @@ +/* + * Created on 09-Feb-06 + * + * To change the template for this generated file go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +package com.arsdigita.categorisedforum; + +import com.arsdigita.bebop.Page; +import com.arsdigita.bebop.parameters.ParameterModel; +import com.arsdigita.forum.ForumPageBuilder; +import com.arsdigita.forum.ThreadPageBuilder; +import com.arsdigita.london.navigation.ui.category.Menu; +import com.arsdigita.london.navigation.ui.category.Path; + +/** + * @author cgyg9330 + * + * To change the template for this generated type comment go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +public class CategorisedThreadPageBuilder extends ThreadPageBuilder { + + public Page buildPage() { + + Page page = super.buildPage(); + Path path = new Path(); + path.setModel(new ForumNavigationModel()); + page.add(path); + page.add(new Menu()); + return page; + + } + + + + +} Added: aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/CategorySubtreePageBuilder.java =================================================================== --- aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/CategorySubtreePageBuilder.java (rev 0) +++ aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/CategorySubtreePageBuilder.java 2007-09-17 16:00:33 UTC (rev 1644) @@ -0,0 +1,44 @@ +/* + * Created on 09-Feb-06 + * + * To change the template for this generated file go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +package com.arsdigita.categorisedforum; + +import com.arsdigita.aplaws.ui.CategorySubtree; +import com.arsdigita.bebop.Page; +import com.arsdigita.bebop.parameters.ParameterModel; +import com.arsdigita.cms.ui.authoring.EmptyPage; +import com.arsdigita.forum.ForumPageBuilder; +import com.arsdigita.forum.PageBuilder; +import com.arsdigita.forum.ThreadPageBuilder; +import com.arsdigita.london.navigation.ui.category.Menu; +import com.arsdigita.london.navigation.ui.category.Path; + +/** + * @author cgyg9330 + * + * Used by Ajax to generate branch of tree + */ +public class CategorySubtreePageBuilder implements PageBuilder { + + public Page buildPage() { + + // + // the title of the page is important because we use the xsl in ccm-ldn-aplaws + // web/__ccm__/themes/aplaws/category-step.xsl that refers to it. This + // matches the page defined in ccm-ldn-aplaws/web/packages/content-section/www/admin/load-cat.jsp + + Page page = new EmptyPage(); + page.setTitle("childCategories"); + page.add(new CategorySubtree()); + + return page; + + } + + + + +} Added: aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/ForumCategorySummary.java =================================================================== --- aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/ForumCategorySummary.java (rev 0) +++ aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/ForumCategorySummary.java 2007-09-17 16:00:33 UTC (rev 1644) @@ -0,0 +1,60 @@ +/* + * Created on 22-Feb-06 + * + * To change the template for this generated file go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +package com.arsdigita.categorisedforum; + +import com.arsdigita.bebop.PageState; +import com.arsdigita.categorization.Category; +import com.arsdigita.categorization.RootCategoryCollection; +import com.arsdigita.categorization.ui.ACSObjectCategorySummary; +import com.arsdigita.forum.Forum; +import com.arsdigita.forum.ForumContext; +import com.arsdigita.forum.ui.Constants; +import com.arsdigita.kernel.ACSObject; + +/** + * @author cgyg9330 + * + * To change the template for this generated type comment go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +public class ForumCategorySummary extends ACSObjectCategorySummary implements Constants { + + + protected ACSObject getObject(PageState state) { + return ForumContext.getContext(state).getForum(); + } + + /* (non-Javadoc) + * @see com.arsdigita.categorization.ui.ACSObjectCategorySummary#getXMLPrefix() + */ + protected String getXMLPrefix() { + return "forum"; + } + + /* (non-Javadoc) + * @see com.arsdigita.categorization.ui.ACSObjectCategorySummary#getXMLNameSpace() + */ + protected String getXMLNameSpace() { + return FORUM_XML_NS; + } + + /** + * retrieve any domains that are mapped to this forum. If there are none, + * retrieve domains mapped to the parent application (eg ccm/portal) + * @see com.arsdigita.categorization.ui.ACSObjectCategorySummary#getRootCategories() + */ + protected RootCategoryCollection getRootCategories(PageState state) { + Forum forum = ForumContext.getContext(state).getForum(); + RootCategoryCollection roots = Category.getRootCategories(forum); + if (roots.size() == 0) { + // forum has no domains - check if parent application has, and use those + roots = Category.getRootCategories(forum.getParentApplication()); + } + return roots; + } + +} Added: aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/ForumNavigationModel.java =================================================================== --- aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/ForumNavigationModel.java (rev 0) +++ aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/ForumNavigationModel.java 2007-09-17 16:00:33 UTC (rev 1644) @@ -0,0 +1,66 @@ +/* + * Created on 04-Aug-05 + * + * To change the template for this generated file go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +package com.arsdigita.categorisedforum; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; + + +import com.arsdigita.categorization.CategorizedObject; +import com.arsdigita.categorization.Category; +import com.arsdigita.categorization.CategoryCollection; +import com.arsdigita.domain.DomainCollection; +import com.arsdigita.kernel.ACSObject; +import com.arsdigita.kernel.Kernel; +import com.arsdigita.london.navigation.CookieNavigationModel; +import com.arsdigita.london.navigation.GenericNavigationModel; +import com.arsdigita.london.terms.Domain; +import com.arsdigita.london.terms.Term; +import com.arsdigita.london.terms.Util; +import com.arsdigita.web.Application; + +/** + * @author cgyg9330 + * + * Navigation model that retrieves the path to one navigation category that the forum is allocated to + * if there is no cookie available + */ +public class ForumNavigationModel extends CookieNavigationModel { + + protected ACSObject getCategorisedObject() { + return Kernel.getContext().getResource(); + + } + protected Category[] getAlternativePath(boolean cookieExists) { + Application forum = (Application)Kernel.getContext().getResource(); + //Category defaultCat = new CategorizedObject(forum).getDefaultParentCategory(); + Domain navigation = Util.getApplicationDomain(Application.retrieveApplicationForPath("/navigation/")); + DomainCollection forumNavigationTerms = navigation.getDirectTerms(forum); + Category cat = null; + if (forumNavigationTerms.next()) { + cat = ((Term) forumNavigationTerms.getDomainObject()).getModel(); + forumNavigationTerms.close(); + } + if (cat == null) { + return new Category[]{ getRootCategory() }; + } + List path = new ArrayList(); + CategoryCollection cats = cat.getDefaultAscendants(); + cats.addOrder("defaultAncestors"); + while (cats.next()) { + path.add(cats.getDomainObject()); + } + return (Category[]) path.toArray(new Category[(int) path.size()]); + } + + + + + +} Added: aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/ForumTermForm.java =================================================================== --- aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/ForumTermForm.java (rev 0) +++ aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/ForumTermForm.java 2007-09-17 16:00:33 UTC (rev 1644) @@ -0,0 +1,54 @@ +/* + * 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.categorisedforum; + +import org.apache.log4j.Logger; + +import com.arsdigita.bebop.PageState; +import com.arsdigita.bebop.form.Widget; +import com.arsdigita.bebop.parameters.BigDecimalParameter; +import com.arsdigita.bebop.parameters.StringParameter; +import com.arsdigita.categorization.ui.ACSObjectCategoryForm; +import com.arsdigita.forum.ForumContext; +import com.arsdigita.kernel.ACSObject; + +public class ForumTermForm extends ACSObjectCategoryForm { + + private static Logger s_log = Logger.getLogger(ForumTermForm.class); + + + public ForumTermForm(BigDecimalParameter root, StringParameter mode, Widget widget) { + super(root, mode, widget); + s_log.debug("creating new ForumTerm Form with widget " + widget); + + + + } + + + /* (non-Javadoc) + * @see com.arsdigita.categorization.ui.ACSObjectCategoryForm#getObject() + */ + protected ACSObject getObject(PageState state) { + + return ForumContext.getContext(state).getForum(); + + } + +} Added: aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/ForumTermPicker.java =================================================================== --- aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/ForumTermPicker.java (rev 0) +++ aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/ForumTermPicker.java 2007-09-17 16:00:33 UTC (rev 1644) @@ -0,0 +1,64 @@ +/* + * 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.categorisedforum; + +import org.apache.log4j.Logger; + +import com.arsdigita.aplaws.ui.ACSObjectCategoryPicker; +import com.arsdigita.aplaws.ui.TermWidget; +import com.arsdigita.bebop.PageState; +import com.arsdigita.bebop.parameters.BigDecimalParameter; +import com.arsdigita.bebop.parameters.StringParameter; +import com.arsdigita.categorization.ui.ACSObjectCategoryForm; +import com.arsdigita.forum.ForumContext; +import com.arsdigita.kernel.ACSObject; + +public class ForumTermPicker extends ACSObjectCategoryPicker { + private static final Logger s_log = Logger.getLogger(ForumTermPicker.class); + + + public ForumTermPicker(BigDecimalParameter root, + StringParameter mode) { + super(root, mode); + s_log.debug("instantiating ForumCategoryPicker"); + + } + + + /* (non-Javadoc) + * @see com.arsdigita.aplaws.ui.ACSObjectCategoryPicker#getForm(com.arsdigita.bebop.parameters.BigDecimalParameter, com.arsdigita.bebop.parameters.StringParameter) + */ + protected ACSObjectCategoryForm getForm(BigDecimalParameter root, StringParameter mode) { + s_log.debug("getForm"); + return new ForumTermForm(root, mode, new TermWidget(mode, this)); + } + + + /* (non-Javadoc) + * @see com.arsdigita.aplaws.ui.ACSObjectCategoryPicker#getObject() + */ + protected ACSObject getObject(PageState state) { + return ForumContext.getContext(state).getForum(); + + + + } + + +} Added: aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/ForumURLFinder.java =================================================================== --- aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/ForumURLFinder.java (rev 0) +++ aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/ForumURLFinder.java 2007-09-17 16:00:33 UTC (rev 1644) @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2003-2004 Red Hat Inc. All Rights Reserved. + * + * The contents of this file are subject to the CCM Public + * License (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the + * License at http://www.redhat.com/licenses/ccmpl.html. + * + * Software distributed under the License is distributed on an + * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express + * or implied. See the License for the specific language + * governing rights and limitations under the License. + * + */ +package com.arsdigita.categorisedforum; + +import org.apache.log4j.Logger; + +import com.arsdigita.domain.DataObjectNotFoundException; +import com.arsdigita.domain.DomainObjectFactory; +import com.arsdigita.forum.Forum; +import com.arsdigita.kernel.Kernel; +import com.arsdigita.kernel.NoValidURLException; +import com.arsdigita.kernel.URLFinder; +import com.arsdigita.persistence.OID; +import com.arsdigita.web.Application; +import com.arsdigita.web.URL; + +public class ForumURLFinder implements URLFinder { + + private static final Logger s_log = Logger.getLogger(ForumURLFinder.class); + + public String find(OID oid,String context) throws NoValidURLException { + + + return find(oid); + + + } + + /* (non-Javadoc) + * @see com.arsdigita.kernel.URLFinder#find(com.arsdigita.persistence.OID) + */ + public String find(OID oid) throws NoValidURLException { + Application forum; + + try { + forum = (Forum)DomainObjectFactory.newInstance(oid); + + + } catch (DataObjectNotFoundException ex) { + throw new NoValidURLException( + "cannot instantiate application " + oid + + " message: " + ex.getMessage() + ); + } + + return URL.getDispatcherPath() + forum.getPath(); + } + + +} Added: aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/Initializer.java =================================================================== --- aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/Initializer.java (rev 0) +++ aplaws/contrib/wsx/ccm-categorised-forum/src/com/arsdigita/categorisedforum/Initializer.java 2007-09-17 16:00:33 UTC (rev 1644) @@ -0,0 +1,89 @@ +/* + * 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.categorisedforum; +import com.arsdigita.db.DbHelper; +import com.arsdigita.bebop.RequestLocal; + +import com.arsdigita.domain.xml.TraversalHandler; + +import com.arsdigita.persistence.pdl.ManifestSource; +import com.arsdigita.persistence.pdl.NameFilter; + +import com.arsdigita.runtime.CompoundInitializer; +import com.arsdigita.runtime.LegacyInitEvent; +import com.arsdigita.runtime.RuntimeConfig; +import com.arsdigita.runtime.PDLInitializer; +import com.arsdigita.runtime.DomainInitEvent; + +import com.arsdigita.xml.XML; + +import com.arsdigita.kernel.Group; +import com.arsdigita.kernel.URLFinder; +import com.arsdigita.kernel.URLService; +import com.arsdigita.kernel.NoValidURLException; +import com.arsdigita.kernel.ACSObjectInstantiator; +import com.arsdigita.kernel.ResourceTypeConfig; +import com.arsdigita.kernel.ResourceType; +import com.arsdigita.kernel.ui.ResourceConfigFormSection; + +import com.arsdigita.domain.DomainObject; +import com.arsdigita.domain.DataObjectNotFoundException; +import com.arsdigita.domain.DomainObjectFactory; + +import com.arsdigita.persistence.DataCollection; +import com.arsdigita.persistence.DataObject; +import com.arsdigita.persistence.OID; +import com.arsdigita.persistence.SessionManager; +import com.arsdigita.web.Application; +import com.arsdigita.messaging.ThreadedMessage; + +import com.arsdigita.forum.Forum; +import com.arsdigita.forum.ForumPageFactory; +import com.arsdigita.forum.portlet.RecentPostingsPortlet; +import com.arsdigita.forum.ui.portlet.RecentPostingsPortletEditor; +import com.arsdigita.web.ui.ApplicationConfigFormSection; + +import org.apache.log4j.Logger; + +/** + * The forum initializer. + * + * @author Justin Ross <jr...@re...> + * @version $Id: Initializer.java,v 1.1 2006/03/03 10:54:45 cgyg9330 Exp $ + */ +public class Initializer extends CompoundInitializer { + public final static String versionId = + "$Id: Initializer.java,v 1.1 2006/03/03 10:54:45 cgyg9330 Exp $" + + "$Author: cgyg9330 $" + + "$DateTime: 2004/08/17 23:26:27 $"; + + private static final Logger s_log = Logger.getLogger(Initializer.class); + + + public void init(LegacyInitEvent e) { + super.init(e); + ForumPageFactory.registerPageBuilder(ForumPageFactory.FORUM_PAGE, new CategorisedForumPageBuilder()); + ForumPageFactory.registerPageBuilder(ForumPageFactory.THREAD_PAGE, new CategorisedThreadPageBuilder()); + ForumPageFactory.registerPageBuilder("load-cat.jsp", new CategorySubtreePageBuilder()); + URLService.registerFinder(Forum.BASE_DATA_OBJECT_TYPE, new ForumURLFinder()); + + + } + +} Added: aplaws/contrib/wsx/ccm-categorised-forum/web/__ccm__/apps/categorised-forum/xsl/forum-categories.xsl =================================================================== --- aplaws/contrib/wsx/ccm-categorised-forum/web/__ccm__/apps/categorised-forum/xsl/forum-categories.xsl (rev 0) +++ aplaws/contrib/wsx/ccm-categorised-forum/web/__ccm__/apps/categorised-forum/xsl/forum-categories.xsl 2007-09-17 16:00:33 UTC (rev 1644) @@ -0,0 +1,298 @@ +<xsl:stylesheet xmlns:forum="http://www.arsdigita.com/forum/1.0" + xmlns:bebop="http://www.arsdigita.com/bebop/1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:nav="http://ccm.redhat.com/london/navigation" + xmlns:search="http://rhea.redhat.com/search/1.0" + xmlns:portal="http://www.uk.arsdigita.com/portal/1.0" + xmlns:cms="http://www.arsdigita.com/cms/1.0" + exclude-result-prefixes="xsl bebop nav search portal forum cms" + version="1.0"> + + <xsl:output method="html" indent="yes"/> + <xsl:import href="../../../../../ROOT/__ccm__/themes/aplaws/category-step.xsl"/> + <xsl:import href="../../../../../ROOT/__ccm__/static/cms/admin/category-step/category-step.xsl"/> + + <xsl:template match="forum:categoryStepSummary"> + <div class="content"> + + <h3>Assign Categories</h3> + <br/> + <xsl:for-each select="forum:categoryRoots/forum:categoryRoot"> + <xsl:sort select="@name"/> + <xsl:variable name="name"> + <xsl:value-of select="@name"/> + </xsl:variable> + <h5><xsl:value-of select="$name"/></h5> + <br/> + <xsl:if test="@addAction"> + <script LANGUAGE="JavaScript"> + <![CDATA[ <!-- begin script ]]> + <![CDATA[ document.write('<a href="]]><xsl:value-of select="@addJSAction"/><![CDATA["><img src="/assets/action-add.png" border="0"/></a>')]]> + <![CDATA[ document.write("\<!--") ]]> + <![CDATA[ // end script --> ]]> + </script> + <a href="{@addAction}"> + <img src="/assets/action-add.png" border="0"/> + </a> + <script LANGUAGE="JavaScript"> + <![CDATA[ <!-- begin script ]]> + <![CDATA[ document.write("--\>") ]]> + <![CDATA[ // end script --> ]]> + </script> + + <script LANGUAGE="JavaScript"> + <![CDATA[ <!-- begin script ]]> + <![CDATA[ document.write('<a href="]]><xsl:value-of select="@addJSAction"/><![CDATA[">Add Categories</a>')]]> + <![CDATA[ document.write("\<!--") ]]> + <![CDATA[ // end script --> ]]> + </script> + <xsl:text> </xsl:text> + <a href="{@addAction}"> + <xsl:text>Add categories</xsl:text> + </a> + <script LANGUAGE="JavaScript"> + <![CDATA[ <!-- begin script ]]> + <![CDATA[ document.write("--\>") ]]> + <![CDATA[ // end script --> ]]> + </script> + </xsl:if> + + <xsl:choose> + <xsl:when test="count(../../forum:itemCategories/forum:itemCategory[starts-with(@path, $name)]) = 0"> + <div> + There are no categories assigned in this context + </div> + </xsl:when> + <xsl:otherwise> + <ul> + <xsl:for-each select="../../forum:itemCategories/forum:itemCategory[starts-with(@path, $name)]"> + <xsl:sort select="@path"/> + <li> + <xsl:value-of select="substring(@path, string-length($name) + 5)"/>  + <xsl:if test="@deleteAction"> + <a href="{@deleteAction}"><img src="/assets/action-delete.png" border="0"/></a> + <xsl:text> </xsl:text> + <a href="{@deleteAction}">Remove</a> + </xsl:if> + </li> + </xsl:for-each> + </ul> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </div> + </xsl:template> + + <xsl:template match="forum:categoryWidget"> + <xsl:choose> + <xsl:when test="@mode = 'javascript'"> + <xsl:apply-templates select="." mode="forum:javascript"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="." mode="forum:plain"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="forum:categoryWidget" mode="forum:javascript"> + <script language="JavaScript"> + <![CDATA[ + <!-- Begin hiding + function catToggle(id) { + var elImg = document.getElementById("catTog"+id); + var elChildren = document.getElementById("catCh"+id); + + if (elChildren.style.display != "block") { + elChildren.style.display = "block"; + elImg.src = "/assets/action-delete.png"; + } else { + elChildren.style.display = "none"; + elImg.src = "/assets/action-add.png"; + } + return true; + } + function catSelect(id, name, node) { + var elWidget = document.getElementById("catWd"); + var elWidgetHidden = document.getElementById("catWdHd"); + var found = 0; + for (var i = 0 ; i < elWidget.options.length ; i++) { + if (elWidget.options[i].value == id) { + found = 1; + } + } + if (!found) { + var opt = new Option(name, id); + elWidget.options[elWidget.options.length] = opt; + + var optHidden = new Option(node, id, false, true); + elWidgetHidden.options[elWidgetHidden.options.length] = optHidden; + } + + var elLink = document.getElementById("catLn"+node); + var elName = document.getElementById("catNm"+node); + elLink.style.display="none"; + elName.style.display="inline"; + return true; + } + function catDeselect() { + var elWidget = document.getElementById("catWd"); + var elWidgetHidden = document.getElementById("catWdHd"); + var idx = elWidget.selectedIndex; + if (idx != -1) { + //var id = elWidget.options[idx].value; + var node = elWidgetHidden.options[idx].text; + var elLink = document.getElementById("catLn"+node); + var elName = document.getElementById("catNm"+node); + elLink.style.display="inline"; + elName.style.display="none"; + + elWidget.options[idx] = null; + elWidgetHidden.options[idx] = null; + } + return true; + } + // End hiding --> + ]]> + </script> + <div> + <xsl:apply-templates select="forum:category[@isEnabled = '1']" mode="forum:javascriptCat"> + <xsl:with-param name="expand" select="'block'"/> + </xsl:apply-templates> + </div> + <br/> + <div class="content"> + <h4>Selected Categories</h4> + <select id="catWd" size="5" onClick="catDeselect()" style="width: 400px; height=200px"> + </select> + <select id="catWdHd" name="{@name}" size="5" multiple="multiple" style="display: none"> + </select> + </div> + </xsl:template> + + <xsl:template match="forum:category" mode="forum:javascriptCat"> + <xsl:param name="expand" select="'none'"/> + <xsl:variable name="linkStyle"> + <xsl:choose> + <xsl:when test="@isAbstract != '1' and @isSelected != '1'"> + <xsl:value-of select="'inline'"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="'none'"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="nameStyle"> + <xsl:choose> + <xsl:when test="@isAbstract != '1' and @isSelected != '1'"> + <xsl:value-of select="'none'"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="'inline'"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <div id="catSelf{@pid}"> + <div class="content"> + <xsl:choose> + <xsl:when test="count(forum:category[@isEnabled = '1']) > 0 and $expand='none'"> + <a href="#" onClick="catToggle('{@nodeID}');"><img id="catTog{@nodeID}" src="/assets/action-add.png" width="14" height="14" border="0"/></a> + </xsl:when> + <xsl:when test="count(forum:category[@isEnabled = '1']) > 0 and $expand!='none'"> + <a href="#" onClick="catToggle('{@nodeID}');"><img id="catTog{@nodeID}" src="/assets/action-delete.png" width="14" height="14" border="0"/></a> + </xsl:when> + <xsl:otherwise> + <img src="/assets/action-generic.png" width="14" height="14" border="0"/> + </xsl:otherwise> + </xsl:choose> + <a id="catLn{@nodeID}" href="#" style="padding-left: 6px; display: {$linkStyle}"> + <xsl:attribute name="onclick">catSelect('<xsl:value-of select="@id"/>', '<xsl:call-template name="escape-apostrophes"> + <xsl:with-param name="text" select="@fullname"/> + </xsl:call-template>', '<xsl:value-of select="@nodeID"/>')</xsl:attribute> + + <xsl:if test="@description"> + <xsl:attribute name="title"> + <xsl:value-of select="@description"/> + </xsl:attribute> + </xsl:if> + <xsl:value-of select="@name"/> + </a> + <span id="catNm{@nodeID}" style="padding-left: 6px; display: {$nameStyle}"> + <xsl:if test="@description"> + <xsl:attribute name="title"> + <xsl:value-of select="@description"/> + </xsl:attribute> + </xsl:if> + <xsl:value-of select="@name"/> + </span> + </div> + </div> + <div id="catCh{@nodeID}" style="margin-left: 20px; display: {$expand}"> + <xsl:apply-templates select="forum:category[@isEnabled = '1']" mode="forum:javascriptCat"> + <xsl:sort data-type="number" select="@sortKey"/> + </xsl:apply-templates> + </div> + </xsl:template> + + <xsl:template match="forum:categoryWidget" mode="forum:plain"> + <select name="{@name}" size="30" multiple="multiple"> + <xsl:apply-templates select="forum:category[position() = 1]/forum:category[@isEnabled = '1' and @isAbstract = '0']" mode="forum:plainCat"/> + </select> + </xsl:template> + + <xsl:template match="forum:category" mode="forum:plainCat"> + <xsl:if test="@isSelected != '1' and @isAbstract != '1'"> + <option value="{@sortKey}"><xsl:value-of select="@fullname"/></option> + </xsl:if> + + <xsl:apply-templates select="forum:category[@isEnabled = '1' and @isAbstract = '0']" mode="forum:plainCat"> + <xsl:sort data-type="number" select="@sortKey"/> + </xsl:apply-templates> + </xsl:template> + + <xsl:template name="escape-apostrophes"> + <xsl:param name="text"/> + <xsl:variable name="apostrophe">'</xsl:variable> + <xsl:variable name="escaped-apostrophe">\'</xsl:variable> + <xsl:call-template name="do-replace"> + <xsl:with-param name="text" select="$text"/> + <xsl:with-param name="replace" select="$apostrophe"/> + <xsl:with-param name="by" select="$escaped-apostrophe"/> + </xsl:call-template> + </xsl:template> + + <xsl:template name="do-replace"> + <xsl:param name="text"/> + <xsl:param name="replace"/> + <xsl:param name="by"/> + <xsl:choose> + <xsl:when test="contains($text, $replace)"> + <xsl:value-of select="substring-before($text, $replace)"/> + <xsl:value-of select="$by"/> + <xsl:call-template name="do-replace"> + <xsl:with-param name="text" select="substring-after($text, $replace)"/> + <xsl:with-param name="replace" select="$replace"/> + <xsl:with-param name="by" select="$by"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$text"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!--<xsl:template match="bebop:formAction[@name='category'] "> + <div class="content"> + <form action="{@action}" name="{@name}" method="get"> + <xsl:apply-templates select="bebop:gridPanel/bebop:formWidget[@type='hidden']" /> + <xsl:apply-templates select="bebop:pageState" /> + <xsl:apply-templates /> + <div class="forumButton"> + <xsl:apply-templates select="bebop:boxPanel/bebop:cell/bebop:boxPanel/bebop:cell/bebop:formWidget" /> + <br/> + </div> + </form> + </div> + </xsl:template>--> + +</xsl:stylesheet> |
From: <chr...@fe...> - 2007-09-17 16:01:09
|
Author: chrisg23 Date: 2007-09-17 18:01:04 +0200 (Mon, 17 Sep 2007) New Revision: 1645 Added: aplaws/trunk/ccm-ldn-aplaws/web/__ccm__/themes/aplaws/forum-example/categorised-forum/ aplaws/trunk/ccm-ldn-aplaws/web/__ccm__/themes/aplaws/forum-example/categorised-forum/forum-categories.xsl aplaws/trunk/ccm-ldn-aplaws/web/__ccm__/themes/aplaws/forum-example/categorised-forum/forum-index.xsl Log: Example theme files for optional extension to forum application that allows forum instances to be easily placed in site navigation. ccm-categorised-forum is in contrib area under wsx Added: aplaws/trunk/ccm-ldn-aplaws/web/__ccm__/themes/aplaws/forum-example/categorised-forum/forum-categories.xsl =================================================================== --- aplaws/trunk/ccm-ldn-aplaws/web/__ccm__/themes/aplaws/forum-example/categorised-forum/forum-categories.xsl (rev 0) +++ aplaws/trunk/ccm-ldn-aplaws/web/__ccm__/themes/aplaws/forum-example/categorised-forum/forum-categories.xsl 2007-09-17 16:01:04 UTC (rev 1645) @@ -0,0 +1,300 @@ +<xsl:stylesheet xmlns:forum="http://www.arsdigita.com/forum/1.0" + xmlns:bebop="http://www.arsdigita.com/bebop/1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:nav="http://ccm.redhat.com/london/navigation" + xmlns:search="http://rhea.redhat.com/search/1.0" + xmlns:portal="http://www.uk.arsdigita.com/portal/1.0" + xmlns:cms="http://www.arsdigita.com/cms/1.0" + exclude-result-prefixes="xsl bebop nav search portal forum cms" + version="1.0"> + + <xsl:import href="../../../../ROOT/__ccm__/themes/aplaws/category-step.xsl"/> + <xsl:import href="../../../../ROOT/__ccm__/static/cms/admin/category-step/category-step.xsl"/> + + <xsl:output method="html" indent="yes"/> + + + <xsl:template match="forum:categoryStepSummary"> + <div class="content"> + + <h3>Assign Categories</h3> + <br/> + <xsl:for-each select="forum:categoryRoots/forum:categoryRoot"> + <xsl:sort select="@name"/> + <xsl:variable name="name"> + <xsl:value-of select="@name"/> + </xsl:variable> + <h5><xsl:value-of select="$name"/></h5> + <br/> + <xsl:if test="@addAction"> + <script LANGUAGE="JavaScript"> + <![CDATA[ <!-- begin script ]]> + <![CDATA[ document.write('<a href="]]><xsl:value-of select="@addJSAction"/><![CDATA["><img src="/assets/action-add.png" border="0"/></a>')]]> + <![CDATA[ document.write("\<!--") ]]> + <![CDATA[ // end script --> ]]> + </script> + <a href="{@addAction}"> + <img src="/assets/action-add.png" border="0"/> + </a> + <script LANGUAGE="JavaScript"> + <![CDATA[ <!-- begin script ]]> + <![CDATA[ document.write("--\>") ]]> + <![CDATA[ // end script --> ]]> + </script> + + <script LANGUAGE="JavaScript"> + <![CDATA[ <!-- begin script ]]> + <![CDATA[ document.write('<a href="]]><xsl:value-of select="@addJSAction"/><![CDATA[">Add Categories</a>')]]> + <![CDATA[ document.write("\<!--") ]]> + <![CDATA[ // end script --> ]]> + </script> + <xsl:text> </xsl:text> + <a href="{@addAction}"> + <xsl:text>Add categories</xsl:text> + </a> + <script LANGUAGE="JavaScript"> + <![CDATA[ <!-- begin script ]]> + <![CDATA[ document.write("--\>") ]]> + <![CDATA[ // end script --> ]]> + </script> + </xsl:if> + + <xsl:choose> + <xsl:when test="count(../../forum:itemCategories/forum:itemCategory[starts-with(@path, $name)]) = 0"> + <div> + There are no categories assigned in this context + </div> + </xsl:when> + <xsl:otherwise> + <ul> + <xsl:for-each select="../../forum:itemCategories/forum:itemCategory[starts-with(@path, $name)]"> + <xsl:sort select="@path"/> + <li> + <xsl:value-of select="substring(@path, string-length($name) + 5)"/>  + <xsl:if test="@deleteAction"> + <a href="{@deleteAction}"><img src="/assets/action-delete.png" border="0"/></a> + <xsl:text> </xsl:text> + <a href="{@deleteAction}">Remove</a> + </xsl:if> + </li> + </xsl:for-each> + </ul> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </div> + </xsl:template> + + <xsl:template match="forum:categoryWidget"> + <xsl:choose> + <xsl:when test="@mode = 'javascript'"> + <xsl:apply-templates select="." mode="forum:javascript"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="." mode="forum:plain"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="forum:categoryWidget" mode="forum:javascript"> + <script language="JavaScript"> + <![CDATA[ + <!-- Begin hiding + function catToggle(id) { + var elImg = document.getElementById("catTog"+id); + var elChildren = document.getElementById("catCh"+id); + + if (elChildren.style.display != "block") { + elChildren.style.display = "block"; + elImg.src = "/assets/action-delete.png"; + } else { + elChildren.style.display = "none"; + elImg.src = "/assets/action-add.png"; + } + return true; + } + function catSelect(id, name, node) { + var elWidget = document.getElementById("catWd"); + var elWidgetHidden = document.getElementById("catWdHd"); + var found = 0; + for (var i = 0 ; i < elWidget.options.length ; i++) { + if (elWidget.options[i].value == id) { + found = 1; + } + } + if (!found) { + var opt = new Option(name, id); + elWidget.options[elWidget.options.length] = opt; + + var optHidden = new Option(node, id, false, true); + elWidgetHidden.options[elWidgetHidden.options.length] = optHidden; + } + + var elLink = document.getElementById("catLn"+node); + var elName = document.getElementById("catNm"+node); + elLink.style.display="none"; + elName.style.display="inline"; + return true; + } + function catDeselect() { + var elWidget = document.getElementById("catWd"); + var elWidgetHidden = document.getElementById("catWdHd"); + var idx = elWidget.selectedIndex; + if (idx != -1) { + //var id = elWidget.options[idx].value; + var node = elWidgetHidden.options[idx].text; + var elLink = document.getElementById("catLn"+node); + var elName = document.getElementById("catNm"+node); + elLink.style.display="inline"; + elName.style.display="none"; + + elWidget.options[idx] = null; + elWidgetHidden.options[idx] = null; + } + return true; + } + // End hiding --> + ]]> + </script> + <div> + <xsl:apply-templates select="forum:category[@isEnabled = '1']" mode="forum:javascriptCat"> + <xsl:with-param name="expand" select="'block'"/> + </xsl:apply-templates> + </div> + <br/> + <div class="content"> + <h4>Selected Categories</h4> + <select id="catWd" size="5" onClick="catDeselect()" style="width: 400px; height=200px"> + </select> + <select id="catWdHd" name="{@name}" size="5" multiple="multiple" style="display: none"> + </select> + </div> + </xsl:template> + + <xsl:template match="forum:category" mode="forum:javascriptCat"> + <xsl:param name="expand" select="'none'"/> + <xsl:variable name="linkStyle"> + <xsl:choose> + <xsl:when test="@isAbstract != '1' and @isSelected != '1'"> + <xsl:value-of select="'inline'"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="'none'"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="nameStyle"> + <xsl:choose> + <xsl:when test="@isAbstract != '1' and @isSelected != '1'"> + <xsl:value-of select="'none'"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="'inline'"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <div id="catSelf{@pid}"> + <div class="content"> + <xsl:choose> + <xsl:when test="count(forum:category[@isEnabled = '1']) > 0 and $expand='none'"> + <a href="#" onClick="catToggle('{@nodeID}');"><img id="catTog{@nodeID}" src="/assets/action-add.png" width="14" height="14" border="0"/></a> + </xsl:when> + <xsl:when test="count(forum:category[@isEnabled = '1']) > 0 and $expand!='none'"> + <a href="#" onClick="catToggle('{@nodeID}');"><img id="catTog{@nodeID}" src="/assets/action-delete.png" width="14" height="14" border="0"/></a> + </xsl:when> + <xsl:otherwise> + <img src="/assets/action-generic.png" width="14" height="14" border="0"/> + </xsl:otherwise> + </xsl:choose> + <a id="catLn{@nodeID}" href="#" style="padding-left: 6px; display: {$linkStyle}"> + <xsl:attribute name="onclick">catSelect('<xsl:value-of select="@id"/>', '<xsl:call-template name="escape-apostrophes"> + <xsl:with-param name="text" select="@fullname"/> + </xsl:call-template>', '<xsl:value-of select="@nodeID"/>')</xsl:attribute> + + <xsl:if test="@description"> + <xsl:attribute name="title"> + <xsl:value-of select="@description"/> + </xsl:attribute> + </xsl:if> + <xsl:value-of select="@name"/> + </a> + <span id="catNm{@nodeID}" style="padding-left: 6px; display: {$nameStyle}"> + <xsl:if test="@description"> + <xsl:attribute name="title"> + <xsl:value-of select="@description"/> + </xsl:attribute> + </xsl:if> + <xsl:value-of select="@name"/> + </span> + </div> + </div> + <div id="catCh{@nodeID}" style="margin-left: 20px; display: {$expand}"> + <xsl:apply-templates select="forum:category[@isEnabled = '1']" mode="forum:javascriptCat"> + <xsl:sort data-type="number" select="@sortKey"/> + </xsl:apply-templates> + </div> + </xsl:template> + + <xsl:template match="forum:categoryWidget" mode="forum:plain"> + <select name="{@name}" size="30" multiple="multiple"> + <xsl:apply-templates select="forum:category[position() = 1]/forum:category[@isEnabled = '1' and @isAbstract = '0']" mode="forum:plainCat"/> + </select> + </xsl:template> + + <xsl:template match="forum:category" mode="forum:plainCat"> + <xsl:if test="@isSelected != '1' and @isAbstract != '1'"> + <option value="{@sortKey}"><xsl:value-of select="@fullname"/></option> + </xsl:if> + + <xsl:apply-templates select="forum:category[@isEnabled = '1' and @isAbstract = '0']" mode="forum:plainCat"> + <xsl:sort data-type="number" select="@sortKey"/> + </xsl:apply-templates> + </xsl:template> + + <xsl:template name="escape-apostrophes"> + <xsl:param name="text"/> + <xsl:variable name="apostrophe">'</xsl:variable> + <xsl:variable name="escaped-apostrophe">\'</xsl:variable> + <xsl:call-template name="do-replace"> + <xsl:with-param name="text" select="$text"/> + <xsl:with-param name="replace" select="$apostrophe"/> + <xsl:with-param name="by" select="$escaped-apostrophe"/> + </xsl:call-template> + </xsl:template> + + <xsl:template name="do-replace"> + <xsl:param name="text"/> + <xsl:param name="replace"/> + <xsl:param name="by"/> + <xsl:choose> + <xsl:when test="contains($text, $replace)"> + <xsl:value-of select="substring-before($text, $replace)"/> + <xsl:value-of select="$by"/> + <xsl:call-template name="do-replace"> + <xsl:with-param name="text" select="substring-after($text, $replace)"/> + <xsl:with-param name="replace" select="$replace"/> + <xsl:with-param name="by" select="$by"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$text"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!--<xsl:template match="bebop:formAction[@name='category'] "> + <div class="content"> + <form action="{@action}" name="{@name}" method="get"> + <xsl:apply-templates select="bebop:gridPanel/bebop:formWidget[@type='hidden']" /> + <xsl:apply-templates select="bebop:pageState" /> + <xsl:apply-templates /> + <div class="forumButton"> + <xsl:apply-templates select="bebop:boxPanel/bebop:cell/bebop:boxPanel/bebop:cell/bebop:formWidget" /> + <br/> + </div> + </form> + </div> + </xsl:template>--> + +</xsl:stylesheet> Added: aplaws/trunk/ccm-ldn-aplaws/web/__ccm__/themes/aplaws/forum-example/categorised-forum/forum-index.xsl =================================================================== --- aplaws/trunk/ccm-ldn-aplaws/web/__ccm__/themes/aplaws/forum-example/categorised-forum/forum-index.xsl (rev 0) +++ aplaws/trunk/ccm-ldn-aplaws/web/__ccm__/themes/aplaws/forum-example/categorised-forum/forum-index.xsl 2007-09-17 16:01:04 UTC (rev 1645) @@ -0,0 +1,1301 @@ +<xsl:stylesheet xmlns:forum="http://www.arsdigita.com/forum/1.0" + xmlns:bebop="http://www.arsdigita.com/bebop/1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:nav="http://ccm.redhat.com/london/navigation" + xmlns:search="http://rhea.redhat.com/search/1.0" + xmlns:portal="http://www.uk.arsdigita.com/portal/1.0" + xmlns:cms="http://www.arsdigita.com/cms/1.0" + exclude-result-prefixes="xsl bebop nav search portal forum cms" + version="1.0"> + + <xsl:import href="../../../../ROOT/packages/bebop/xsl/bebop.xsl" /> + <xsl:import href="../../../../ROOT/packages/ui/xsl/ui.xsl" /> + <xsl:import href="../../../../ROOT/packages/bebop/xsl/bebop.xsl" /> + <xsl:import href="lib/header.xsl" /> + <xsl:import href="lib/lib.xsl" /> + <xsl:import href="lib/leftNav.xsl" /> + <xsl:import href="forum-categories.xsl"/> + <xsl:import href="../../../../ROOT/packages/bebop/xsl/dcp.xsl"/> + + + + + <xsl:param name="theme-prefix" /> + <xsl:param name="context-prefix" /> + <xsl:param name="dispatcher-prefix" /> + + <xsl:output method="html" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" doctype-system="http://www.w3.org/TR/html4/loose.dtd" indent="yes" /> + +<!-- ********************* MAIN PAGE LAYOUT TEMPLATES ********************* --> + + <xsl:template match="bebop:page[@class='simplePage']"> + <html lang="en"> + <head> + <xsl:call-template name="metaData" /> + <title> + Forum + </title> + <link rel="stylesheet" href="{$theme-prefix}/forum-index.css" type="text/css" media="screen" /> + <link rel="stylesheet" href="{$theme-prefix}/css/print.css" type="text/css" media="print" /> + <script type="text/javascript" src="{$theme-prefix}/css/date.js"></script> + <xsl:call-template name="bebop:dcpJavascript"/> + </head> + + <body> + <!-- <xsl:if test="/bebop:page/forum:forum/bebop:form[@name='newPostForm']"> + <xsl:attribute name="onload"> + <xsl:text>document.newPostForm.subject.focus();</xsl:text> + </xsl:attribute> + </xsl:if> --> + <a name="Ptop"></a> + <a class="navHide" href="#startcontent" title="Go directly to main content" accesskey="S">Skip over navigation</a> + <span class="hide">|</span> + <xsl:call-template name="header" /> + <xsl:call-template name="mainContent" /> + + <xsl:call-template name="footer" /> + + </body> + </html> + </xsl:template> + + + <xsl:template name="mainContent"> + + <table id="mainLayout" border="0" cellspacing="0" cellpadding="0" summary="navigation and content"> + <tr> + <td> + <img class="lSpacer" src="{$theme-prefix}/images/spacer.gif" alt="" /> + </td> + <td> + <img class="rSpacer" src="{$theme-prefix}/images/spacer.gif" alt="" /> + </td> + </tr> + <tr> + <td id="leftNav" align="left" valign="top"> + <!--LHS NAVIGATION --> + + <xsl:call-template name="leftNav" /> + + </td> + + <td valign="top"> + <span class="hide">|</span> + + <!--CONTENT --> + <a id="startcontent" class="navHide" title="Start of content"></a> + <span class="hide">|</span> + <!--<xsl:call-template name="pageContent" />--> + <div class="pageTitle"> + <h1><xsl:value-of select="/bebop:page/forum:name"/></h1> + </div> + <div class="forum"> + <xsl:apply-templates select="//forum:forum | //forum:threadDisplay | /bebop:page/bebop:form " /> + </div> + </td> + </tr> + </table> + </xsl:template> + +<!-- ******************** POST TEMPLATES ******************************* --> + + <xsl:template name="displayPost"> + <xsl:param name="preview" /> + + <xsl:variable name="class"> + <xsl:choose> + <xsl:when test="position() mod 2"> + <xsl:text>postOdd</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>postEven</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <xsl:variable name="indent"> + <xsl:choose> + <xsl:when test="$preview='true'"> + <xsl:value-of select="'0'" /> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="count(sortKey) = 0"> + <xsl:value-of select="'0'" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="string-length(sortKey) div 3" /> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <xsl:if test="count(sortKey) = 0 and $preview='false'"> + <div id="topic" style="margin-left: {$indent}em;">Thread: <xsl:value-of select="subject" /></div> + + <xsl:apply-templates select="../../forum:threadOptions" /> + </xsl:if> + + <div class="post" style="margin-left: {$indent}em;"> + <fieldset class="{$class}"> + <div class="clearGroup"> + <div class="header"> + <xsl:value-of select="subject" /> + <xsl:if test="status != 'approved' and $preview = 'false'"> + ( + <xsl:value-of select="status" /> + ) + </xsl:if> + </div> + + <xsl:if test="$preview = 'false'"> + <div class="actions"> + <xsl:if test="@approveURL"> + <a href="{@approveURL}"> + <img alt="Approve" border="0" src="{$theme-prefix}/images/forum/reward-16x16.gif" /> + </a> + <!--<xsl:text> </xsl:text> + <a href="{@approveURL}">Approve</a>--> + <xsl:text> </xsl:text> + + </xsl:if> + <xsl:if test="@rejectURL"> + <a href="{@rejectURL}" > + <img alt="Reject" border="0" src="{$theme-prefix}/images/forum/delete-16x16.gif" /> + </a> + <!--<xsl:text> </xsl:text> + <a href="{@rejectURL}">Reject</a>--> + <xsl:text> </xsl:text> + </xsl:if> + <xsl:if test="@editURL"> + <a href="{@editURL}"> + <img alt="Edit" border="0" src="{$theme-prefix}/images/forum/edit-16x16.gif" /> + </a> + <!--<xsl:text> </xsl:text> + <a href="{@editURL}">Edit</a>--> + <xsl:text> </xsl:text> + </xsl:if> + <xsl:if test="@deleteURL"> + <a href="{@deleteURL}"> + <img alt="Delete" border="0" src="{$theme-prefix}/images/forum/archived-16x16.gif" /> + </a> + <!--<xsl:text> </xsl:text> + <a href="{@deleteURL}">Delete</a>--> + <xsl:text> </xsl:text> + </xsl:if> + <xsl:if test="@replyURL"> + <xsl:text> </xsl:text> + <xsl:text> </xsl:text> + <xsl:text> </xsl:text> + <a href="{@replyURL}"> + <img alt="Reply" border="0" src="{$theme-prefix}/images/forum/reply-16x16.gif" /> + </a> + <xsl:text> </xsl:text> + <a href="{@replyURL}">Reply</a> + <xsl:text> </xsl:text> + </xsl:if> + </div> + </xsl:if> + </div> + + <div class="postDetails"> + <xsl:text>Posted: </xsl:text> + <xsl:value-of select="sent" /> + <xsl:text> by </xsl:text> + <a href="mailto:{sender/primaryEmail}"> + <xsl:value-of select="sender/displayName" /> + </a> + </div> + + <div class="clearGroup"> + <xsl:for-each select="files"> + <xsl:sort select="fileOrder"/> + <div class="fileLink"> + <xsl:variable name="encodedFileName"> + <xsl:call-template name="url-encode"> + <xsl:with-param name="str" select="./name"/> + </xsl:call-template> + </xsl:variable> + <a href="{$dispatcher-prefix}/cms-service/stream/asset/?asset_id={./id}&file=/{$encodedFileName}"> + <!-- show file in new window for preview to avoid losing the form --> + <xsl:if test="$preview='true'"> + <xsl:attribute name="target">_blank</xsl:attribute> + </xsl:if> + + <xsl:value-of select="name"/></a> + </div> + <div class="fileDescription"> + + </div> + </xsl:for-each> + </div> + + <div class="bar"> + <hr/> + </div> + + <div class="message"> + <xsl:value-of select="body" disable-output-escaping="yes" /> + </div> + + <div id="images"> + <xsl:for-each select="images"> + <xsl:sort select="link/imageOrder"/> + <div class="clearGroup"> + <img src="{$dispatcher-prefix}/cms-service/stream/image/?image_id={./id}" alt="{./description}"/> + </div> + </xsl:for-each> + </div> + </fieldset> + </div> + <table class="data"> + <tfoot> + <tr> + <th colspan="5"> + <xsl:apply-templates select="forum:paginator" mode="page-links" /> + </th> + </tr> + </tfoot> + </table> + </xsl:template> + + <xsl:template match="forum:paginator" mode="page-links"> + <xsl:if test="@pageCount > 1"> + <div class="clearGroup"> + <br/> + <xsl:if test="@pageNumber > 1"> + <a> + <xsl:attribute name="href"> + <xsl:call-template name="make-url"> + <xsl:with-param name="base-url" select="@baseURL" /> + <xsl:with-param name="name" select="@param" /> + <xsl:with-param name="value" select="@pageNumber - 1" /> + </xsl:call-template> + </xsl:attribute> + <xsl:text><<< Previous</xsl:text> + </a> + <xsl:text> </xsl:text> + <xsl:text> </xsl:text> + </xsl:if> + <xsl:text>Page </xsl:text> + <xsl:value-of select="@pageNumber" /><xsl:text> </xsl:text> + <xsl:text>of </xsl:text> + <xsl:value-of select="@pageCount" /><xsl:text> </xsl:text> + <xsl:if test="@pageNumber < @pageCount"> + <xsl:text> </xsl:text> + <xsl:text> </xsl:text> + <a> + <xsl:attribute name="href"> + <xsl:call-template name="make-url"> + <xsl:with-param name="base-url" select="@baseURL" /> + <xsl:with-param name="name" select="@param" /> + <xsl:with-param name="value" select="@pageNumber + 1" /> + </xsl:call-template> + </xsl:attribute> + <xsl:text>Next >>></xsl:text> + </a> + </xsl:if> + </div> + </xsl:if> + </xsl:template> + + <xsl:template match="forum:topicSelector"> + <xsl:if test="count(forum:topic) > 0"> + <div class="content"> + <form action="{@baseURL}" method="get"> + + <div id="selectCategory"> + <div id="selectLabel">Filter by topic:</div> + <select name="{@param}" class="forumSelect"> + <option value="{@anyTopicID}"> + <xsl:if test="@anyTopicID = @currentTopicID"> + <xsl:attribute name="selected"> + <xsl:text>selected</xsl:text> + </xsl:attribute> + </xsl:if> + <xsl:text>All topics</xsl:text> + </option> + <xsl:for-each select="forum:topic"> + <option value="{id}"> + <xsl:if test="id = ../@currentTopicID"> + <xsl:attribute name="selected"> + <xsl:text>selected</xsl:text> + </xsl:attribute> + </xsl:if> + <xsl:value-of select="name" /> + </option> + </xsl:for-each> + <option value="{@noTopicID}"> + <xsl:if test="@noTopicID = @currentTopicID"> + <xsl:attribute name="selected"> + <xsl:text>selected</xsl:text> + </xsl:attribute> + </xsl:if> + <xsl:text>No topic</xsl:text> + </option> + </select> + <div class="forumButton"> + <input type="submit" value="Apply" /> + </div> + </div> + </form> + </div> + </xsl:if> + </xsl:template> + + <xsl:template match="forum:threadList"> + <div class="content"> + <div id="threadHead"> + <div class="topic">Thread</div> + <div class="author">Author</div> + <div class="replies">Replies</div> + <div class="lastPost">Last Post</div> + </div> + <xsl:if test="count(forum:thread) = 0"> + <div id="noMessages">No messages have been posted yet</div> + </xsl:if> + <xsl:for-each select="forum:thread"> + + <div> + <xsl:variable name="class"> + <xsl:choose> + <xsl:when test="position() mod 2"> + <xsl:text>odd</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>even</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + + <div class="subject"> + <a href="{@url}"> + <xsl:value-of select="root/subject" /> + </a> + </div> + <div class="author"> + <xsl:value-of select="author/displayName" /> + </div> + <div class="replies"> + <xsl:value-of select="numReplies" /> + </div> + <div class="lastPost"> + <xsl:value-of select="lastUpdate" /> + </div> + + </div> + </xsl:for-each> + </div> + + <xsl:apply-templates select="forum:paginator" mode="page-links" /> + + </xsl:template> + + <xsl:template match="forum:threadAlertList"> + <div class="clearGroup"> + <div id="threadHead"> + <div class="threadSubject">Subject</div> + <div class="replies">Replies</div> + <div class="author">Author</div> + <div class="lastPost">Last Post</div> + <div class="status">Status</div> + <div class="delete">Delete</div> + </div> + </div> + <xsl:if test="count(forum:threadAlert) = 0"> + <div> + <em>You are not subscribed to any threads</em> + </div> + </xsl:if> + <xsl:for-each select="forum:threadAlert"> + <xsl:variable name="class"> + <xsl:choose> + <xsl:when test="position() mod 2"> + <xsl:text>postOdd</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>postEven</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <div class="{$class}"> + <div class="threadSubject"> + <a href="{@url}"><xsl:value-of select="thread/root/subject" /></a> + </div> + <div class="replies"> + <xsl:value-of select="thread/numReplies" /> + </div> + <div class="author"> + <xsl:value-of select="thread/author/displayName" /> + </div> + <div class="lastPost"> + <xsl:value-of select="thread/lastUpdate" /> + </div> + <div class="status"> + <xsl:value-of select="thread/root/status" /> + </div> + <div class="delete"> + <input type="checkbox" name="{@param}" value="{id}" /> + </div> + </div> + </xsl:for-each> + </xsl:template> + + <xsl:template match="forum:threadDisplay"> + <div class="content"> + <xsl:for-each select="forum:message"> + <xsl:call-template name="displayPost"> + <xsl:with-param name="preview"> + <xsl:text>false</xsl:text> + </xsl:with-param> + </xsl:call-template> + </xsl:for-each> + </div> + </xsl:template> + + + + <xsl:template match="forum:topicList"> + <div class="content"> + <div id="threadHead"> + <div class="threadSubject">Topic</div> + <div class="threads">Threads</div> + <div class="lastPost">Last Post</div> + </div> + + <xsl:for-each select="forum:topicSummary"> + <xsl:variable name="class"> + <xsl:choose> + <xsl:when test="position() mod 2"> + <xsl:text>postOdd</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>postEven</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <div class="{$class}"> + <div class="threadSubject"> + <xsl:choose> + <xsl:when test="numThreads > 0"> + <a> + <xsl:attribute name="href"> + <xsl:call-template name="make-url"> + <xsl:with-param name="base-url" select="../@baseURL" /> + <xsl:with-param name="name" select="../@param" /> + <xsl:with-param name="value" select="id" /> + </xsl:call-template> + </xsl:attribute> + <xsl:value-of select="name" /> + </a> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="name" /> + </xsl:otherwise> + </xsl:choose> + </div> + <div class="threads"> + <xsl:value-of select="numThreads" /> + </div> + <div class="lastPost"> + <xsl:choose> + <xsl:when test="numThreads > 0"> + <xsl:value-of select="latestPost" /> + </xsl:when> + <xsl:otherwise> + <em><xsl:text>n/a</xsl:text></em> + </xsl:otherwise> + </xsl:choose> + </div> + </div> + </xsl:for-each> + <xsl:for-each select="forum:noTopicSummary"> + <xsl:variable name="class"> + <xsl:choose> + <xsl:when test="count(../forumTopicSummary) mod 2"> + <xsl:text>postOdd</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>postEven</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <div class="{$class}"> + <div class="threadSubject"> + <xsl:choose> + <xsl:when test="numThreads > 0"> + <a> + <xsl:attribute name="href"> + <xsl:call-template name="make-url"> + <xsl:with-param name="base-url" select="../@baseURL" /> + <xsl:with-param name="name" select="../@param" /> + <xsl:with-param name="value" select="id" /> + </xsl:call-template> + </xsl:attribute> + <em><xsl:text>None</xsl:text></em> + </a> + </xsl:when> + <xsl:otherwise> + <em><xsl:text>None</xsl:text></em> + </xsl:otherwise> + </xsl:choose> + </div> + <div class="threads"> + <xsl:value-of select="numThreads" /> + </div> + <div class="lastPost"> + <xsl:choose> + <xsl:when test="numThreads > 0"> + <xsl:value-of select="latestPost" /> + </xsl:when> + <xsl:otherwise> + <em><xsl:text>n/a</xsl:text></em> + </xsl:otherwise> + </xsl:choose> + </div> + </div> + </xsl:for-each> + </div> + </xsl:template> + + <xsl:template match="forum:forumAlerts"> + <div class="content"> + <h5>Forum Alerts</h5> + <br/> + <xsl:apply-templates select="*" /> + </div> + </xsl:template> + +<!-- <xsl:template match="bebop:form[@name='instantAlerts' or @name='dailyAlerts']//bebop:panelRow"> + <xsl:for-each select="bebop:cell[not(bebop:formWidget)]"> + <xsl:apply-templates /> + </xsl:for-each> + <div class="forumButton"> + <xsl:apply-templates select="bebop:cell/bebop:formWidget[@name='Save' or @name='forum.ui.delete']" /> + </div> + </xsl:template>--> + + <xsl:template match="forum:threadAlerts"> + <div class="content"> + <h5>Thread Alerts</h5> + <br/> + <xsl:apply-templates select="*" /> + </div> + </xsl:template> + + <xsl:template match="forum:forum"> + <xsl:if test="not(descendant::bebop:form/@name = 'newPostForm')"> + <div class="tabbed-pane"> + <table class="tab-set"> + <tr> + <xsl:apply-templates select="forum:forumMode" /> + </tr> + </table> + <table class="rule"> + <tr> + <td></td> + </tr> + </table> + </div> + <div> + <xsl:text> </xsl:text> + </div> + </xsl:if> + <div class="clearGroup"> + <div class="content"> + <xsl:if test="forum:forumMode[@mode = 'threads' and @selected='1'] and not(bebop:form/@name='newPostForm')"> + <xsl:call-template name="br-replace"> + <xsl:with-param name="text" select="/bebop:page/forum:introduction"/> + + </xsl:call-template> + </xsl:if> + </div> + </div> + <xsl:apply-templates select="*[not(name() = 'forum:forumMode')]" /> + </xsl:template> + + <xsl:template match="forum:forumMode"> + <xsl:variable name="title"> + <xsl:choose> + <xsl:when test="@mode = 'threads'"> + <xsl:value-of select="'Threads'" /> + </xsl:when> + <xsl:when test="@mode = 'topics'"> + <xsl:value-of select="'Topics'" /> + </xsl:when> + <xsl:when test="@mode = 'alerts'"> + <xsl:value-of select="'Alerts'" /> + </xsl:when> + <xsl:when test="@mode = 'moderation'"> + <xsl:value-of select="'Moderation'" /> + </xsl:when> + <xsl:when test="@mode = 'permissions'"> + <xsl:value-of select="'Permissions'" /> + </xsl:when> + <xsl:when test="@mode = 'setup'"> + <xsl:value-of select="'Setup'"/> + </xsl:when> + <xsl:when test="@mode = 'categories'"> + <xsl:value-of select="'Categories'"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <xsl:when test="@selected = 1"> + <td class="current-tab-label"> + <xsl:value-of select="$title" /> + </td> + <td class="current-tab-end" /> + </xsl:when> + <xsl:otherwise> + <td class="tab-label"> + <a href="{@url}"> + <xsl:value-of select="$title" /> + </a> + </td> + <td class="tab-end" /> + </xsl:otherwise> + </xsl:choose> + <td class="tab-spacer" /> + </xsl:template> + + <xsl:template match="forum:memberList"> + <xsl:comment>forum member list</xsl:comment> + <div class="content"> + <fieldset> + <legend><xsl:value-of select="@group" /></legend> + <xsl:apply-templates /> + <xsl:apply-templates select="following-sibling::bebop:form[1]" mode="show"/> + </fieldset> + <br/> + </div> + </xsl:template> + + + <xsl:template match="forum:forumOptions"> + <div class="content"> + <xsl:apply-templates select="*" /> + </div> + <div> + <xsl:text> </xsl:text> + </div> + </xsl:template> + + <xsl:template match="forum:topicOptions"> + <div class="content"> + <xsl:apply-templates select="*" /> + </div> + <div> + <xsl:text> </xsl:text> + </div> + </xsl:template> + + <xsl:template name="make-url"> + <xsl:param name="base-url" /> + <xsl:param name="name" /> + <xsl:param name="value" /> + + <xsl:choose> + <xsl:when test="contains($base-url, '?')"> + <xsl:value-of select="concat($base-url, '&', $name, '=', $value)" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat($base-url, '?', $name, '=', $value)" /> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + +<!-- ********************** FORM TEMPLATES ********************** --> + + + <xsl:template name="ForumPostForm"> + <xsl:param name="title" select="'Post message'" /> + + <!--<form action="{@action}" name="{@name}" method="get">--> + <form action="{@action}" name="{@name}" enctype="{@enctype}"> + <xsl:attribute name="method"> + <xsl:choose> + <xsl:when test="string-length(@method)=0">post</xsl:when> + <xsl:otherwise><xsl:value-of select="@method"/></xsl:otherwise> + </xsl:choose> + </xsl:attribute> + + <xsl:apply-templates select="bebop:formWidget[@type='hidden']" /> + <xsl:apply-templates select="bebop:pageState" /> + + <div id="title"> + <h2 class="pageSubTitle"><xsl:value-of select="$title" /></h2> + <!--<xsl:if test="@name = 'newPostForm'">--> + <br/> + <!--</xsl:if>--> + </div> + <div class="content"> + <xsl:apply-templates select="forum:postForm" /> + <xsl:apply-templates select="forum:postConfirm" /> + <xsl:apply-templates select="forum:postFormImages" /> + <xsl:apply-templates select="forum:postFormFiles" /> + + <div class="clearGroup"> + <div class="validationError"> + <xsl:apply-templates select="bebop:formErrors" /> + </div> + </div> + + <div class="clearGroup"> + <div class="forumButton"> + <br/> + <xsl:apply-templates select="bebop:boxPanel/bebop:cell/bebop:formWidget[@name = 'Cancel']" /> + <xsl:apply-templates select="bebop:boxPanel/bebop:cell/bebop:formWidget[@name = '<<_Back']" /> + <xsl:apply-templates select="bebop:boxPanel/bebop:cell/bebop:formWidget[@name = 'Next_>>']" /> + <xsl:apply-templates select="bebop:boxPanel/bebop:cell/bebop:formWidget[@name = 'Finish']" /> + <br/> + </div> + </div> + <br/> + </div> + </form> + </xsl:template> + + <xsl:template match="forum:postForm"> + <xsl:apply-templates select="bebop:formWidget[@type='hidden']" /> + + <div class="clearGroup"> + <div class="columnOne">Subject:</div> + <div class="columnTwo"> + <xsl:apply-templates select="bebop:formWidget[@name='subject']" /> + <div class="validationError"> + <xsl:apply-templates select="bebop:formErrors[@id='subject']" /> + </div> + </div> + </div> + <div class="clearGroup"> + <div class="columnOne">Message:</div> + <div class="columnTwo"> + <xsl:apply-templates select="bebop:*[@name='message']" /> + <div class="validationError"> + <xsl:value-of select="bebop:formErrors[@id='message']/@message" disable-output-escaping="yes"/> + </div> + </div> + </div> + <!--<div class="clearGroup"> + <div class="columnOne">Format:</div> + <div class="columnTwo"> + <xsl:apply-templates select="bebop:select[@name='bodyType']" /> + </div> + </div>--> + <xsl:choose> + <xsl:when test="bebop:select[@name='postTopic']"> + <div class="clearGroup"> + <div class="columnOne">Topic:</div> + <div class="columnTwo"> + <xsl:apply-templates select="bebop:select[@name='postTopic']" /> + </div> + </div> + </xsl:when> + <xsl:when test="forum:message"> + <div id="plainText"> + Original Message: + </div> + <div class="postOdd"> + <fieldset> + <xsl:apply-templates select="forum:message" /> + </fieldset> + </div> + </xsl:when> + </xsl:choose> + + </xsl:template> + + <xsl:template match="bebop:formErrors"> + <xsl:value-of select="@message" /> + </xsl:template> + + <xsl:template match="forum:message"> + <div class="clearGroup"> + <div class="columnOneWide"> + <a href="mailto:{sender/primaryEmail}"> + <xsl:value-of select="sender/displayName" /> + </a> + </div> + <div class="columnTwo"> + <xsl:value-of select="subject" /> + <br/> + <xsl:text>Posted</xsl:text> + <xsl:value-of select="sent" /> + <div class="replyBar"> + <hr/> + </div> + <xsl:value-of select="body" disable-output-escaping="yes" /> + </div> + </div> + </xsl:template> + + <xsl:template match="forum:postConfirm"> + <xsl:call-template name="displayPost"> + <xsl:with-param name="preview" select="'true'" /> + </xsl:call-template> + </xsl:template> + + <xsl:template match="forum:postFormImages"> + <xsl:apply-templates select="bebop:formWidget[@type='hidden']" /> + <xsl:apply-templates select="forum:attachedImages" /> + + + <div class="clearGroup"> + <div class="columnOne">Image:</div> + <div class="columnTwo"> + <xsl:apply-templates select="bebop:formWidget[@name='image']" /> + <div class="validationError"> + <xsl:apply-templates select="bebop:formErrors[@id='image']" /> + </div> + </div> + </div> + <div class="clearGroup"> + <div class="columnOne">Description:</div> + <div class="columnTwo"> + <xsl:apply-templates select="bebop:textarea" /> + <div class="validationError"> + <xsl:apply-templates select="bebop:formErrors[@id='imageDescription']" /> + </div> + </div> + </div> + <div class="submit"> + <div class="forumButton"> + <xsl:apply-templates select="bebop:formWidget[@name='Add_Image']" /> + </div> + </div> + </xsl:template> + + <xsl:template match="forum:attachedImages"> + + + <xsl:choose> + <xsl:when test="not(forum:image)"> + <div id="plainText"> + No images attached to this post + </div> + </xsl:when> + <xsl:otherwise> + + <xsl:for-each select="forum:image"> + <xsl:variable name="class"> + <xsl:choose> + <xsl:when test="position() mod 2"> + <xsl:text>postOdd</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>postEven</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <div class="clearGroup"> + <fieldset class="{$class}"> + <div class="image"> + <img src="{$dispatcher-prefix}{@src}" alt="{@caption}" /> + </div> + <div class="imageName"> + <xsl:value-of select="@name"/> + </div> + <div class="imageDelete"> + <a href="{@deleteLink}">Remove</a> + </div> + </fieldset> + </div> + </xsl:for-each> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="forum:postFormFiles"> + <xsl:apply-templates select="bebop:formWidget[@type='hidden']" /> + + <xsl:apply-templates select="forum:attachedFiles" /> + + <div id="plainText"> + <xsl:apply-templates select="bebop:label " /> + </div> + + <div class="clearGroup"> + <div class="columnOne">File:</div> + <div class="columnTwo"> + <xsl:apply-templates select="bebop:formWidget[@name='file']" /> + <div class="validationError"> + <xsl:apply-templates select="bebop:formErrors[@id='file']" /> + </div> + </div> + </div> + <div class="clearGroup"> + <div class="columnOne">Description:</div> + <div class="columnTwo"> + <xsl:apply-templates select="bebop:textarea" /> + <div class="validationError"> + <xsl:apply-templates select="bebop:formErrors[@id='fileDescription']" /> + </div> + </div> + </div> + <div class="submit"> + <div class="forumButton"> + <xsl:apply-templates select="bebop:formWidget[@name='Add_File']" /> + </div> + </div> + </xsl:template> + + <xsl:template match="forum:attachedFiles" > + <xsl:choose> + <xsl:when test="not(forum:file)"> + <div id="plainText"> + No files attached to this post + </div> + </xsl:when> + <xsl:otherwise> + <div class="clearGroup"> + <table class="fileTable"> + <tr> + <td><h5>File</h5></td> + <td><h5>Description</h5></td> + <td/> + </tr> + <xsl:for-each select="forum:file"> + <tr> + <td> + <xsl:variable name="encodedFileName"> + <xsl:call-template name="url-encode"> + <xsl:with-param name="str" select="@name"/> + </xsl:call-template> + </xsl:variable> + + <a href="{$dispatcher-prefix}{@url}&file=/{$encodedFileName}" target = "_blank"><xsl:value-of select="@name"/></a></td> + <td> + <xsl:if test="not(contains(@description, 'nbsp'))"> + <xsl:value-of select="@description"/> + </xsl:if> + </td> + <td><a href="{@deleteLink}">Remove</a></td> + </tr> + </xsl:for-each> + </table> + <br/> + </div> + </xsl:otherwise> + + </xsl:choose> + + </xsl:template> + + <xsl:template match="threadOptions"> + <div id="threadOptions"> + <xsl:apply-templates /> + </div> + </xsl:template> + + <xsl:template match="bebop:form[@name='newPostForm']"> + <xsl:call-template name="ForumPostForm"> + <xsl:with-param name="title"> + <xsl:choose> + <xsl:when test="forum:postForm"> + <xsl:text>Post New Message</xsl:text> + </xsl:when> + <xsl:when test="forum:postFormImages"> + <xsl:text>Add Images (optional)</xsl:text> + </xsl:when> + <xsl:when test="forum:postFormFiles"> + <xsl:text>Add Files (optional)</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>Preview New Message</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:with-param> + </xsl:call-template> + </xsl:template> + + <xsl:template match="bebop:form[@name='editPostForm']"> + <xsl:call-template name="ForumPostForm"> + <xsl:with-param name="title"> + <xsl:choose> + <xsl:when test="forum:postForm"> + <xsl:text>Edit Message</xsl:text> + </xsl:when> + <xsl:when test="forum:postFormImages"> + <xsl:text>Edit Images</xsl:text> + </xsl:when> + <xsl:when test="forum:postFormFiles"> + <xsl:text>Edit Files</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>Preview Changes</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:with-param> + </xsl:call-template> + </xsl:template> + + <xsl:template match="bebop:form[@name='replyPostForm']"> + <xsl:call-template name="ForumPostForm"> + <xsl:with-param name="title"> + <xsl:choose> + <xsl:when test="forum:postForm"> + <xsl:text>Post reply</xsl:text> + </xsl:when> + <xsl:when test="forum:postFormImages"> + <xsl:text>Add Images (optional)</xsl:text> + </xsl:when> + <xsl:when test="forum:postFormFiles"> + <xsl:text>Add Files (optional)</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>Preview Reply</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:with-param> + </xsl:call-template> + </xsl:template> + + <xsl:template match="bebop:form[@name='categoryAdd']"> + <xsl:param name="title" select="'Create New Topic'" /> + <div class="content"> + <form action="{@action}" name="{@name}" method="get"> + <xsl:apply-templates select="bebop:gridPanel/bebop:formWidget[@type='hidden']" /> + <xsl:apply-templates select="bebop:pageState" /> + + <div id="title"> + <h2 class="pageSubTitle"><xsl:value-of select="$title" /></h2> + <br/> + </div> + + <div class="clearGroup"> + <div class="columnOne">Name:</div> + <div class="columnTwo"> + <xsl:apply-templates select="bebop:gridPanel/bebop:panelRow/bebop:cell/bebop:formWidget[@name='name']" /> + <div class="validationError"> + <xsl:apply-templates select="bebop:gridPanel/bebop:panelRow/bebop:cell/bebop:formErrors[@id='name']" /> + </div> + </div> + </div> + <div class="clearGroup"> + <div class="columnOne">Description:</div> + <div class="columnTwo"> + <xsl:apply-templates select="bebop:gridPanel/bebop:panelRow/bebop:cell/bebop:textarea" /> + <div class="validationError"> + <xsl:apply-templates select="bebop:gridPanel/bebop:panelRow/bebop:cell/bebop:formErrors[@id='description']" /> + </div> + </div> + </div> + <div class="submit"> + <div class="forumButton"> + <xsl:apply-templates select="bebop:gridPanel/bebop:panelRow/bebop:cell/bebop:formWidget[@type='submit']" /> + <br/> + </div> + </div> + </form> + </div> + </xsl:template> + + <xsl:template match="bebop:form[@name='postRejectionForm']"> + <xsl:param name="title" select="'Reject Post'" /> + + <form action="{@action}" name="{@name}" method="get"> + <xsl:apply-templates select="bebop:gridPanel/bebop:formWidget[@type='hidden']" /> + <xsl:apply-templates select="bebop:formWidget[@type='hidden']" /> + <xsl:apply-templates select="bebop:gridPanel/bebop:panelRow/bebop:cell/bebop:formWidget[@type='hidden']" /> + <xsl:apply-templates select="bebop:pageState" /> + + <div id="title"> + <h2 class="pageSubTitle"><xsl:value-of select="$title" /></h2> + <br/> + </div> + <div class="content"> + <xsl:choose> + <xsl:when test="bebop:gridPanel/bebop:panelRow/bebop:cell/bebop:boxPanel/bebop:cell/bebop:textarea" > + <div class="clearGroup"> + <div class="columnOne"><xsl:value-of select="bebop:gridPanel/bebop:panelRow/bebop:cell/bebop:boxPanel/bebop:cell/bebop:formWidget[@name='recipient']/@metadata.label" /></div> + <div class="columnTwo"> + <xsl:apply-templates select="bebop:gridPanel/bebop:panelRow/bebop:cell/bebop:boxPanel/bebop:cell/bebop:formWidget[@name='recipient']" /> + <div class="validationError"> + <xsl:apply-templates select="bebop:gridPanel/bebop:panelRow/bebop:cell/bebop:boxPanel/bebop:cell/bebop:formErrors[@id='recipient']" /> + </div> + </div> + </div> + <div class="clearGroup"> + <div class="columnOne"><xsl:value-of select="bebop:gridPanel/bebop:panelRow/bebop:cell/bebop:boxPanel/bebop:cell/bebop:textarea[@name='bodyText']/@metadata.label" /></div> + <div class="columnTwo"> + <xsl:apply-templates select="bebop:gridPanel/bebop:panelRow/bebop:cell/bebop:boxPanel/bebop:cell/bebop:textarea[@name='bodyText']" /> + <div class="validationError"> + <xsl:apply-templates select="bebop:gridPanel/bebop:panelRow/bebop:cell/bebop:boxPanel/bebop:cell/bebop:formErrors[@id='bodyText']" /> + </div> + </div> + </div> + </xsl:when> + <xsl:otherwise> + <xsl:for-each select="bebop:gridPanel/bebop:panelRow/bebop:cell/bebop:boxPanel/bebop:cell/bebop:label" > + <div class="clearGroup"> + <xsl:call-template name="br-replace" > + <xsl:with-param name="text" select="."> + </xsl:with-param> + </xsl:call-template> + + </div> + </xsl:for-each> + </xsl:otherwise> + </xsl:choose> + + <div class="clearGroup"> + <div class="forumButton"> + <br/> + <xsl:apply-templates select="bebop:gridPanel/bebop:panelRow/bebop:cell/bebop:boxPanel/bebop:cell/bebop:formWidget[@type='submit']" /> + <br/> + </div> + </div> + </div> + </form> + </xsl:template> + + <xsl:template match="bebop:form[@name='setupForm']"> + <div class="content"> + <form action="{@action}" name="{@name}" method="get"> + <xsl:apply-templates select="forum:setup/bebop:formWidget[@type='hidden']" /> + <xsl:apply-templates select="bebop:pageState" /> + + <div class="clearGroup"> + <xsl:value-of select="forum:setup/bebop:formWidget[@name='title']/@metadata.label"/> + </div> + <div class="clearGroup"> + <xsl:apply-templates select="forum:setup/bebop:formWidget[@name='title']"/> + </div> + <div class="clearGroup"> + <xsl:value-of select="forum:setup/bebop:textarea/@metadata.label"/> + </div> + <div class="clearGroup"> + <xsl:apply-templates select="forum:setup/bebop:textarea"/> + </div> + <div class="clearGroup"> + <xsl:apply-templates select="descendant::bebop:checkbox" /> + + <div class="expiry"> + <xsl:apply-templates select="descendant::bebop:formWidget[@name='expiry']" /> + <xsl:value-of select="descendant::bebop:formWidget[@name='expiry']/@metadata.label"/> + </div> + </div> + + <div class="clearGroup"> + <div class="forumButton"> + <xsl:apply-templates select="forum:setup/bebop:boxPanel/bebop:cell/bebop:formWidget[@name='save']" /> + <br/> + </div> + </div> + </form> + </div> + </xsl:template> + + <xsl:template match="bebop:form[@id = 'adminMemberUserPicker']" mode="show"> + <xsl:call-template name="permissionForm" /> + </xsl:template> + + <xsl:template match="bebop:form[@id = 'adminMemberUserPicker']"> + </xsl:template> + + <xsl:template match="bebop:form[@id = 'memberUserPicker']" mode="show"> + <xsl:call-template name="permissionForm" /> + </xsl:template> + + <xsl:template match="bebop:form[@id = 'memberUserPicker']"> + </xsl:template> + + <xsl:template match="bebop:form[@id = 'threadCreateMemberUserPicker']" mode="show"> + <xsl:call-template name="permissionForm" /> + </xsl:template> + + <xsl:template match="bebop:form[@id = 'threadCreateMemberUserPicker']"> + </xsl:template> + + <xsl:template match="bebop:form[@id = 'threadReplyMemberUserPicker']" mode="show"> + <xsl:call-template name="permissionForm" /> + </xsl:template> + + <xsl:template match="bebop:form[@id = 'threadReplyMemberUserPicker']"> + </xsl:template> + + <xsl:template match="bebop:form[@id = 'readerMemberUserPicker']" mode="show"> + <xsl:call-template name="permissionForm" /> + </xsl:template> + + <xsl:template match="bebop:form[@id = 'readerMemberUserPicker']"> + </xsl:template> + + <xsl:template name="permissionForm"> + <form action="{@action}" name="{@name}" method="get"> + <xsl:apply-templates select="bebop:formWidget[@type='hidden']" /> + <xsl:apply-templates select="bebop:pageState" /> + <xsl:apply-templates /> + </form> + </xsl:template> + + +<!-- *********************** LINK TEMPLATES ******************** --> + + + <xsl:template match="bebop:link[bebop:label/text() = 'New thread']"> + <br/> + <div id="newTopicLink"> + <a href="{@href}">Start New Thread</a> + </div> + </xsl:template> + + <xsl:template match="bebop:link[bebop:label/text() = 'New topic']"> + <div id="newTopicLink"> + <a href="{@href}">Create New Topic</a> + </div> + </xsl:template> + + <xsl:template match="bebop:link[bebop:label/text() = 'View all threads']"> + <div id="viewAllTopicsLink"> + <a href="{@href}">Back to Thread List</a> + </div> + </xsl:template> + + <xsl:template match="bebop:link[bebop:label/text() = 'Subscribe to thread']"> + <div id="watchTopicLink"> + <a href="{@href}">Watch this Thread</a> + </div> + </xsl:template> + + <xsl:template match="bebop:link[bebop:label/text() = 'Unsubscribe to thread']"> + <div id="info"> + <xsl:text>You are watching this thread. To stop watching this thread, click "Stop Watching Thread" below.</xsl:text> + </div> + <div id="watchTopicLink"> + <a href="{@href}">Stop Watching Thread</a> + </div> + </xsl:template> + + +<xsl:template name="br-replace"> + <xsl:param name="text"/> + <xsl:variable name="cr" select="'
'"/> + <xsl:choose> + <!-- If the value of the $text parameter contains a carriage return... --> + <xsl:when test="contains($text,$cr)"> + <!-- Return the substring of $text before the carriage return --> + <xsl:value-of select="substring-before($text,$cr)" disable-output-escaping="yes"/> + <!-- And construct a <br/> element --> + <br/> + <!-- + | Then invoke this same br-replace template again, passing the + | substring *after* the carriage return as the new "$text" to + | consider for replacement + +--> + <xsl:call-template name="br-replace"> + <xsl:with-param name="text" select="substring-after($text,$cr)"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$text" disable-output-escaping="yes"/> + </xsl:otherwise> + </xsl:choose> +</xsl:template> +</xsl:stylesheet> + + |
From: <chr...@fe...> - 2007-09-17 15:00:55
|
Author: chrisg23 Date: 2007-09-17 17:00:39 +0200 (Mon, 17 Sep 2007) New Revision: 1643 Modified: aplaws/trunk/ccm-cms/src/com/arsdigita/cms/ui/lifecycle/ItemLifecycleSelectForm.java Log: Sourceforge patch 1783195 - IMPORTANT BUGFIX - if you use fixed length lifecycles with expiry notifications then you are probably affected by this - notifications are not created and sent if you have relied on the default end date set by the lifecycle, only if you explicitly entered a date on the publish form. To fix the timebomb of items that are due to expire without notification, there is a command line program in package uk.gov.westsussex.wsgfl.jobs called CreateMissingNotificationPhases. Package is in ccm-wsx-wsgfl-custom module in contrib area of the repository. To use this, it is best to copy the job class and the accompanying pdl file query-missing-notification-phases to your own custom application, or else install ccm-wsx-wsgfl-custom but strip away everything except those 2 files and the initialiser - removing all bits of the initialiser except the data init. Do not add ccm-wsx-wsgfl-custom to your instance as it is, at it overrides some files in the default Aplaw! s installation Modified: aplaws/trunk/ccm-cms/src/com/arsdigita/cms/ui/lifecycle/ItemLifecycleSelectForm.java =================================================================== --- aplaws/trunk/ccm-cms/src/com/arsdigita/cms/ui/lifecycle/ItemLifecycleSelectForm.java 2007-09-17 14:05:26 UTC (rev 1642) +++ aplaws/trunk/ccm-cms/src/com/arsdigita/cms/ui/lifecycle/ItemLifecycleSelectForm.java 2007-09-17 15:00:39 UTC (rev 1643) @@ -452,25 +452,36 @@ // Apply the new lifecycle. ContentItem pending = item.publish(cycleDef, startDate); + final Lifecycle lifecycle = pending.getLifecycle(); // XXX domlay Whoa. This must be broken for multiphase // lifecycles. if (endDate != null) { - final Lifecycle lifecycle = pending.getLifecycle(); - + // update individual phases final PhaseCollection phases = lifecycle.getPhases(); while (phases.next()) { final Phase phase = phases.getPhase(); java.util.Date thisEnd = phase.getEndDate(); + java.util.Date thisStart = phase.getStartDate(); + if (thisStart.compareTo(endDate) > 0) { + phase.setStartDate(endDate); + phase.save(); + } if (thisEnd == null || thisEnd.compareTo(endDate) > 0) { phase.setEndDate(endDate); phase.save(); } } + } + + // endOfCycle may be the original date according to lifecycle phase definitions, or endDate if that was before + // natural end of lifecycle + java.util.Date endOfCycle = lifecycle.getEndDate(); + if (endOfCycle != null) { // if advance notification is requested (!= 0) // add another phase at the start of which the user is notified @@ -487,15 +498,15 @@ if (notificationHours != null) { notificationPeriod += notificationHours.intValue(); } - + if (notificationPeriod > 0) { notificationDate = - computeNotificationDate(endDate, notificationPeriod); - + computeNotificationDate(endOfCycle, notificationPeriod); + s_log.debug("adding custom phase"); Phase expirationImminentPhase = lifecycle.addCustomPhase("expirationImminent", new Long(notificationDate.getTime()), - new Long(endDate.getTime())); + new Long(endOfCycle.getTime())); expirationImminentPhase. setListenerClassName("com.arsdigita.cms.lifecycle.NotifyLifecycleListener"); expirationImminentPhase.save(); @@ -510,7 +521,7 @@ item.save(); final Workflow workflow = m_workflow.getWorkflow(state); - try { + try { finish(workflow, item, Web.getContext().getUser()); } catch (TaskException te) { throw new FormProcessException(te); @@ -524,7 +535,7 @@ } } } - + static void finish(Workflow workflow, ContentItem item, User user) throws TaskException { if (workflow != null) { final Engine engine = Engine.getInstance(CMSEngine.CMS_ENGINE_TYPE); |
From: <chr...@fe...> - 2007-09-17 15:00:42
|
Author: chrisg23 Date: 2007-09-17 17:00:37 +0200 (Mon, 17 Sep 2007) New Revision: 1642 Modified: aplaws/trunk/ccm-cms/src/com/arsdigita/cms/ui/folder/FolderBrowser.java Log: Sourceforge patch 1727634 - retain specified ordering when paging through folder contents (previously every time you changed to a new page it reverted to default name ordering) Modified: aplaws/trunk/ccm-cms/src/com/arsdigita/cms/ui/folder/FolderBrowser.java =================================================================== --- aplaws/trunk/ccm-cms/src/com/arsdigita/cms/ui/folder/FolderBrowser.java 2007-09-17 13:46:27 UTC (rev 1641) +++ aplaws/trunk/ccm-cms/src/com/arsdigita/cms/ui/folder/FolderBrowser.java 2007-09-17 15:00:37 UTC (rev 1642) @@ -32,9 +32,12 @@ import com.arsdigita.bebop.Table; import com.arsdigita.bebop.event.ActionEvent; import com.arsdigita.bebop.event.ActionListener; +import com.arsdigita.bebop.event.ChangeEvent; +import com.arsdigita.bebop.event.ChangeListener; import com.arsdigita.bebop.event.TableActionAdapter; import com.arsdigita.bebop.event.TableActionEvent; import com.arsdigita.bebop.event.TableActionListener; +import com.arsdigita.bebop.parameters.StringParameter; import com.arsdigita.bebop.table.AbstractTableModelBuilder; import com.arsdigita.bebop.table.DefaultTableCellRenderer; import com.arsdigita.bebop.table.DefaultTableColumnModel; @@ -114,21 +117,15 @@ private final static String SORT_KEY_LAST_MODIFIED_DATE = "lastModified"; private final static String SORT_KEY_CREATION_DATE = "creationDate"; - private RequestLocal m_sortType = new RequestLocal() { - public Object initialValue(PageState state) { - return SORT_KEY_NAME; - } - }; - - private final RequestLocal m_sortDirection = new RequestLocal() { - public Object initialValue(PageState state) { - return SORT_ACTION_UP; - } - }; - + private StringParameter m_sortType = new StringParameter("sortType"); + private StringParameter m_sortDirection = new StringParameter("sortDirn"); + public FolderBrowser(FolderSelectionModel currentFolder) { //super(new FolderTableModelBuilder(), s_headers); super(); + m_sortType.setDefaultValue(SORT_KEY_NAME); + m_sortDirection.setDefaultValue(SORT_ACTION_UP); + setModelBuilder(new FolderTableModelBuilder(currentFolder)); setColumnModel(new DefaultTableColumnModel(hideIndexColumn() ? s_noIndexHeaders : s_headers)); setHeader(new TableHeader(getColumnModel())); @@ -144,7 +141,25 @@ ((FolderTableModelBuilder)getModelBuilder()).setFolderBrowser(this); m_currentFolder = currentFolder; + + /* + + This code should be uncommented if the desired behaviour is for a change + of folder to cause reversion to default ordering of contained items + (by name ascending). Our feeling is that the user selected ordering + should be retained for the duration of the folder browsing session. If + anyone wants this alternative behaviour it should be brought in under + the control of a config parameter. + + m_currentFolder.addChangeListener(new ChangeListener() { + public void stateChanged(ChangeEvent e) { + PageState state = e.getPageState(); + state.setValue(m_sortType, m_sortType.getDefaultValue()); + state.setValue(m_sortDirection, m_sortDirection.getDefaultValue()); + + }}); + */ setClassAttr("dataTable"); getHeader().setDefaultRenderer(new com.arsdigita.cms.ui.util.DefaultTableCellRenderer()); @@ -182,7 +197,8 @@ super.register(p); p.addComponentStateParam(this, m_currentFolder.getStateParameter()); - + p.addComponentStateParam(this, m_sortType); + p.addComponentStateParam(this, m_sortDirection); p.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { final PageState state = e.getPageState(); @@ -209,11 +225,11 @@ String key = state.getControlEventName(); String value = state.getControlEventValue(); if ( SORT_ACTION_UP.equals(key) ) { - m_sortType.set(state, value); - m_sortDirection.set(state, SORT_ACTION_UP); + state.setValue(m_sortType, value); + state.setValue(m_sortDirection, SORT_ACTION_UP); } else if ( SORT_ACTION_DOWN.equals(key) ) { - m_sortType.set(state, value); - m_sortDirection.set(state, SORT_ACTION_DOWN); + state.setValue(m_sortType, value); + state.setValue(m_sortDirection, SORT_ACTION_DOWN); } else { super.respond(state); //throw new ServletException("Unknown control event: " + key); @@ -282,9 +298,9 @@ itemColl.setRange(new Integer(paginator.getFirst(state)), new Integer(paginator.getLast(state) + 1)); - String sortKey = (String)m_sortType.get(state); + String sortKey = (String)state.getValue(m_sortType); String direction = "asc"; - if (SORT_ACTION_DOWN.equals((String)m_sortDirection.get(state))) { + if (SORT_ACTION_DOWN.equals((String)state.getValue(m_sortDirection))) { direction = "desc"; } @@ -342,9 +358,9 @@ boolean isSelected, Object key, int row, int column) { String headerName = (String)((GlobalizedMessage)value).localize(); - String sortKey = (String)m_sortType.get(state); + String sortKey = (String)state.getValue(m_sortType); final boolean isCurrentKey = sortKey.equals(m_key); - final String currentSortDirection = (String)m_sortDirection.get(state); + final String currentSortDirection = (String)state.getValue(m_sortDirection); String imageURLStub = null; if (SORT_ACTION_UP.equals(currentSortDirection)) { |
From: <chr...@fe...> - 2007-09-17 14:01:00
|
Author: chrisg23 Date: 2007-09-17 16:00:37 +0200 (Mon, 17 Sep 2007) New Revision: 1639 Modified: aplaws/trunk/ccm-cms/src/com/arsdigita/cms/Folder.java Log: Sourceforge patch 1781131 - workaround to bypass query filtering bug if permission filtering folder contents Modified: aplaws/trunk/ccm-cms/src/com/arsdigita/cms/Folder.java =================================================================== --- aplaws/trunk/ccm-cms/src/com/arsdigita/cms/Folder.java 2007-09-17 11:48:34 UTC (rev 1638) +++ aplaws/trunk/ccm-cms/src/com/arsdigita/cms/Folder.java 2007-09-17 14:00:37 UTC (rev 1639) @@ -26,8 +26,10 @@ import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.domain.DomainCollectionIterator; import com.arsdigita.kernel.ACSObject; +import com.arsdigita.kernel.Party; import com.arsdigita.kernel.User; import com.arsdigita.kernel.permissions.PermissionService; +import com.arsdigita.kernel.permissions.PrivilegeDescriptor; import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.DataQuery; @@ -235,14 +237,13 @@ * @return child items of this folder */ public ItemCollection getItems(boolean bSort) { - final DataQuery query = SessionManager.getSession().retrieveQuery - (ITEMS_QUERY); - query.setParameter(PARENT, getID()); + DataQueryDataCollectionAdapter adapter = new DataQueryDataCollectionAdapter(ITEMS_QUERY, ITEM); + adapter.setParameter(PARENT, getID()); Assert.unequal(PENDING, getVersion()); - query.setParameter(VERSION, getVersion()); + adapter.setParameter(VERSION, getVersion()); - return new ItemCollection(query, bSort); + return new ItemCollection(adapter, bSort); } /** @@ -595,10 +596,28 @@ /** * Constructor + * @param adapter an adapter constructed using the query name rather than a + * DataQuery object. This constructor must be used if there is any + * intention to permission filter the results as only a DataQueryDataCollectionAdapter + * constructed using query name has the bug fix to allow permission filtering + * + * @param bSort whether to sort the collection by isFolder and ID + */ + public ItemCollection (DataQueryDataCollectionAdapter adapter, boolean bSort) { + super(adapter); + doAlias(adapter); + init(adapter, bSort); + } + + public ItemCollection (DataQueryDataCollectionAdapter adapter) { + this(adapter, true); + } + + /** + * Constructor * @param query the Data Query to use to retrieve the collection * @param bSort whether to sort the collection by isFolder and ID */ - //ideally, we wouldn't sort the collection by default and only provide //one constructor. But, that would break the existing API public ItemCollection(DataQuery query, boolean bSort) { |
From: <chr...@fe...> - 2007-09-17 14:01:00
|
Author: chrisg23 Date: 2007-09-17 16:00:59 +0200 (Mon, 17 Sep 2007) New Revision: 1641 Modified: aplaws/trunk/ccm-core/src/com/arsdigita/notification/Notification.java Log: Sourceforge patch 1714842 - if message delete has been specified for a notification, only delete it when the last referring notification is deleted (several notification records may refer to the same message) Modified: aplaws/trunk/ccm-core/src/com/arsdigita/notification/Notification.java =================================================================== --- aplaws/trunk/ccm-core/src/com/arsdigita/notification/Notification.java 2007-09-17 13:29:54 UTC (rev 1640) +++ aplaws/trunk/ccm-core/src/com/arsdigita/notification/Notification.java 2007-09-17 14:00:59 UTC (rev 1641) @@ -22,7 +22,9 @@ import com.arsdigita.kernel.ACSObject; import com.arsdigita.kernel.Party; import com.arsdigita.messaging.Message; +import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.OID; +import com.arsdigita.persistence.SessionManager; import java.math.BigDecimal; import java.util.Date; @@ -468,6 +470,17 @@ if (msg == null) { msgDelete = false; } + // find if there are other referring notifications. If so msgdelete = false + // so only the last notification tries to delete the message + DataCollection notifications = SessionManager.getSession().retrieve(Notification.BASE_DATA_OBJECT_TYPE); + notifications.addEqualsFilter(MESSAGE_ID, msg.getID()); + notifications.addNotEqualsFilter(ID, this.getID()); + if (notifications.size() > 0) { + // other notifications that still refer to the message. Let + // the last one out delete the message else foreign key breach + // brings down the whole request queue process + msgDelete = false; + } } else { msg = null; } |
Author: chrisg23 Date: 2007-09-17 16:00:39 +0200 (Mon, 17 Sep 2007) New Revision: 1640 Added: aplaws/contrib/wsx/ccm-wsx-message-of-the-day/application.xml aplaws/contrib/wsx/ccm-wsx-message-of-the-day/pdl/ aplaws/contrib/wsx/ccm-wsx-message-of-the-day/pdl/uk/ aplaws/contrib/wsx/ccm-wsx-message-of-the-day/pdl/uk/gov/ aplaws/contrib/wsx/ccm-wsx-message-of-the-day/pdl/uk/gov/westsussex/ aplaws/contrib/wsx/ccm-wsx-message-of-the-day/pdl/uk/gov/westsussex/mod/ aplaws/contrib/wsx/ccm-wsx-message-of-the-day/pdl/uk/gov/westsussex/mod/MODApplication.pdl aplaws/contrib/wsx/ccm-wsx-message-of-the-day/sql/ aplaws/contrib/wsx/ccm-wsx-message-of-the-day/sql/ccm-wsx-message-of-the-day/ aplaws/contrib/wsx/ccm-wsx-message-of-the-day/sql/ccm-wsx-message-of-the-day/oracle-se-create.sql aplaws/contrib/wsx/ccm-wsx-message-of-the-day/sql/ccm-wsx-message-of-the-day/postgres-create.sql aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/ aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/ccm-wsx-message-of-the-day.load aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/ aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/ aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/ aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/ aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/Initializer.java aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/Loader.java aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/MODApplication.java aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/MODConstants.java aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/Message.java aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/portlet/ aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/portlet/MessageOfTheDayPortlet.java aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/ui/ aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/ui/MODResources.properties aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/ui/MainPanel.java aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/ui/MessageForm.java aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/ui/MessageList.java aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/ui/portlet/ aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/ui/portlet/MessageOfTheDayPortletEditor.java aplaws/contrib/wsx/ccm-wsx-message-of-the-day/web/ aplaws/contrib/wsx/ccm-wsx-message-of-the-day/web/WEB-INF/ aplaws/contrib/wsx/ccm-wsx-message-of-the-day/web/WEB-INF/bebop-define.tld aplaws/contrib/wsx/ccm-wsx-message-of-the-day/web/WEB-INF/bebop-show.tld aplaws/contrib/wsx/ccm-wsx-message-of-the-day/web/WEB-INF/web.xml aplaws/contrib/wsx/ccm-wsx-message-of-the-day/web/__ccm__/ aplaws/contrib/wsx/ccm-wsx-message-of-the-day/web/__ccm__/apps/ aplaws/contrib/wsx/ccm-wsx-message-of-the-day/web/__ccm__/apps/message-of-the-day/ aplaws/contrib/wsx/ccm-wsx-message-of-the-day/web/__ccm__/apps/message-of-the-day/lib/ aplaws/contrib/wsx/ccm-wsx-message-of-the-day/web/__ccm__/apps/message-of-the-day/lib/main-panel.xsl aplaws/contrib/wsx/ccm-wsx-message-of-the-day/web/__ccm__/apps/message-of-the-day/lib/mod-application-form.xsl aplaws/contrib/wsx/ccm-wsx-message-of-the-day/web/__ccm__/apps/message-of-the-day/lib/mod-list.xsl aplaws/contrib/wsx/ccm-wsx-message-of-the-day/web/__ccm__/apps/message-of-the-day/xsl/ aplaws/contrib/wsx/ccm-wsx-message-of-the-day/web/__ccm__/apps/message-of-the-day/xsl/index.css aplaws/contrib/wsx/ccm-wsx-message-of-the-day/web/__ccm__/apps/message-of-the-day/xsl/index.xsl aplaws/contrib/wsx/ccm-wsx-message-of-the-day/web/templates/ aplaws/contrib/wsx/ccm-wsx-message-of-the-day/web/templates/ccm-wsx-message-of-the-day/ aplaws/contrib/wsx/ccm-wsx-message-of-the-day/web/templates/ccm-wsx-message-of-the-day/index.jsp Log: Message of the day application type - separate instances have separate lists of messages - eg thought for the day, tip of the day etc. Portlet tied to a specific instance and picks a message at random each day from its list. See http://wsgfl.westsussex.gov.uk/ccm/portal below main picture for example implementation (revisit every day to see more education related gems of wisdom) Added: aplaws/contrib/wsx/ccm-wsx-message-of-the-day/application.xml =================================================================== --- aplaws/contrib/wsx/ccm-wsx-message-of-the-day/application.xml (rev 0) +++ aplaws/contrib/wsx/ccm-wsx-message-of-the-day/application.xml 2007-09-17 14:00:39 UTC (rev 1640) @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> + +<ccm:application name="ccm-wsx-message-of-the-day" + prettyName="Message of the Day" + version="1.0.1" + release="1" + xmlns:ccm="http://ccm.redhat.com/ccm-project"> + + <ccm:dependencies> + <ccm:requires name="ccm-ldn-portal" version="1.4.2" /> + </ccm:dependencies> + + <ccm:contacts> + <ccm:contact uri="http://wsgfl.westsussex.gov.uk" type="website" /> + <ccm:contact uri="mailto:chr...@we..." type="support" /> + </ccm:contacts> + + <ccm:description>Message of the Day</ccm:description> + +</ccm:application> Added: aplaws/contrib/wsx/ccm-wsx-message-of-the-day/pdl/uk/gov/westsussex/mod/MODApplication.pdl =================================================================== --- aplaws/contrib/wsx/ccm-wsx-message-of-the-day/pdl/uk/gov/westsussex/mod/MODApplication.pdl (rev 0) +++ aplaws/contrib/wsx/ccm-wsx-message-of-the-day/pdl/uk/gov/westsussex/mod/MODApplication.pdl 2007-09-17 14:00:39 UTC (rev 1640) @@ -0,0 +1,32 @@ +model uk.gov.westsussex.mod; + +import com.arsdigita.web.Application; +import com.arsdigita.kernel.Group; +import com.arsdigita.portal.Portlet; + +object type MODApplication extends Application { + component Group [0..1] readerGroup = join mod_app.reader_group_id to groups.group_id; + component Group [0..1] adminGroup = join mod_app.admin_group_id to groups.group_id; + component Message [0..n] messages = join mod_app.app_id to mod_messages.app_id; + + reference key (mod_app.app_id); +} + +object type Message { + Integer id = mod_messages.message_id INTEGER; + String messageText = mod_messages.message_text VARCHAR(4000); + + object key (id); +} + +object type MODPortlet extends Portlet { + + +} + + + + + + + Added: aplaws/contrib/wsx/ccm-wsx-message-of-the-day/sql/ccm-wsx-message-of-the-day/oracle-se-create.sql =================================================================== --- aplaws/contrib/wsx/ccm-wsx-message-of-the-day/sql/ccm-wsx-message-of-the-day/oracle-se-create.sql (rev 0) +++ aplaws/contrib/wsx/ccm-wsx-message-of-the-day/sql/ccm-wsx-message-of-the-day/oracle-se-create.sql 2007-09-17 14:00:39 UTC (rev 1640) @@ -0,0 +1 @@ +@ ddl/oracle-se/create.sql Added: aplaws/contrib/wsx/ccm-wsx-message-of-the-day/sql/ccm-wsx-message-of-the-day/postgres-create.sql =================================================================== --- aplaws/contrib/wsx/ccm-wsx-message-of-the-day/sql/ccm-wsx-message-of-the-day/postgres-create.sql (rev 0) +++ aplaws/contrib/wsx/ccm-wsx-message-of-the-day/sql/ccm-wsx-message-of-the-day/postgres-create.sql 2007-09-17 14:00:39 UTC (rev 1640) @@ -0,0 +1,3 @@ +begin; +\i ddl/postgres/create.sql +end; Added: aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/ccm-wsx-message-of-the-day.load =================================================================== --- aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/ccm-wsx-message-of-the-day.load (rev 0) +++ aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/ccm-wsx-message-of-the-day.load 2007-09-17 14:00:39 UTC (rev 1640) @@ -0,0 +1,13 @@ +<load> + <requires> + <table name="inits"/> + <initializer class="com.arsdigita.core.Initializer"/> + </requires> + <provides> + <initializer class="uk.gov.westsussex.mod.Initializer"/> + </provides> + <scripts> + <schema directory="ccm-wsx-message-of-the-day"/> + <data class="uk.gov.westsussex.mod.Loader"/> + </scripts> +</load> Added: aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/Initializer.java =================================================================== --- aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/Initializer.java (rev 0) +++ aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/Initializer.java 2007-09-17 14:00:39 UTC (rev 1640) @@ -0,0 +1,134 @@ +/* + * Created on 28-Jun-05 + * + * To change the template for this generated file go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +package uk.gov.westsussex.mod; + +import org.apache.log4j.Logger; + +import uk.gov.westsussex.mod.portlet.MessageOfTheDayPortlet; + +import com.arsdigita.bebop.portal.PortletConfigFormSection; +import com.arsdigita.db.DbHelper; +import com.arsdigita.domain.DomainObject; +import com.arsdigita.domain.DomainObjectInstantiator; +import com.arsdigita.kernel.ACSObjectInstantiator; +import com.arsdigita.kernel.ResourceType; +import com.arsdigita.kernel.ResourceTypeConfig; +import com.arsdigita.kernel.permissions.PrivilegeDescriptor; +import com.arsdigita.kernel.ui.ResourceConfigFormSection; +import com.arsdigita.persistence.DataObject; +import com.arsdigita.persistence.pdl.ManifestSource; +import com.arsdigita.persistence.pdl.NameFilter; +import com.arsdigita.portal.PortletType; +import com.arsdigita.portal.apportlet.AppPortletType; +import com.arsdigita.runtime.CompoundInitializer; +import com.arsdigita.runtime.DomainInitEvent; +import com.arsdigita.runtime.LegacyInitEvent; +import com.arsdigita.runtime.PDLInitializer; +import com.arsdigita.runtime.RuntimeConfig; +import com.arsdigita.web.ui.ApplicationConfigFormSection; +import com.arsdigita.bebop.RequestLocal; + +/** + * @author cgyg9330 + * + * To change the template for this generated type comment go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +public class Initializer extends CompoundInitializer implements MODConstants { + + private Logger s_log = Logger.getLogger(Initializer.class); + public Initializer() { + final String url = RuntimeConfig.getConfig().getJDBCURL(); + final int database = DbHelper.getDatabaseFromURL(url); + + add( + new PDLInitializer( + new ManifestSource( + "ccm-wsx-message-of-the-day.pdl.mf", + new NameFilter( + DbHelper.getDatabaseSuffix(database), + "pdl")))); + } + + public void init(DomainInitEvent e) { + super.init(e); + + e + .getFactory() + .registerInstantiator( + MODApplication.BASE_DATA_OBJECT_TYPE, + new ACSObjectInstantiator() { + public DomainObject doNewInstance(DataObject dataObject) { + return new MODApplication(dataObject); + } + }); + + e + .getFactory() + .registerInstantiator( + MessageOfTheDayPortlet.BASE_DATA_OBJECT_TYPE, + new ACSObjectInstantiator() { + public DomainObject doNewInstance(DataObject dataObject) { + return new MessageOfTheDayPortlet(dataObject); + } + }); + + e + .getFactory() + .registerInstantiator( + Message.BASE_DATA_OBJECT_TYPE, + new DomainObjectInstantiator() { + public DomainObject doNewInstance(DataObject dataObject) { + return new Message(dataObject); + } + }); + + new ResourceTypeConfig(MessageOfTheDayPortlet.BASE_DATA_OBJECT_TYPE) { + public ResourceConfigFormSection getCreateFormSection( + final ResourceType resType, + final RequestLocal parentAppRL) { + final ResourceConfigFormSection config = + new PortletConfigFormSection(resType, parentAppRL); + + return config; + } + + public ResourceConfigFormSection getModifyFormSection(final RequestLocal application) { + final PortletConfigFormSection config = + new PortletConfigFormSection(application); + + return config; + } + }; + + // chr...@we... use new constructor that allows create form to be hidden from users other than those + // with admin rights on parent app. Particularly appropriate for portlet where users + // customising their own homepage should NOT be allowed to create new forums + new ResourceTypeConfig( + MODApplication.BASE_DATA_OBJECT_TYPE, + PrivilegeDescriptor.ADMIN, + PrivilegeDescriptor.READ) { + public ResourceConfigFormSection getCreateFormSection( + final ResourceType resType, + final RequestLocal parentAppRL) { + final ResourceConfigFormSection config = + new ApplicationConfigFormSection(resType, parentAppRL); + + return config; + } + + public ResourceConfigFormSection getModifyFormSection(final RequestLocal application) { + final ResourceConfigFormSection config = + new ApplicationConfigFormSection(application); + + return config; + } + }; + + } + +} \ No newline at end of file Added: aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/Loader.java =================================================================== --- aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/Loader.java (rev 0) +++ aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/Loader.java 2007-09-17 14:00:39 UTC (rev 1640) @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2004 Red Hat Inc. All Rights Reserved. + * + * The contents of this file are subject to the CCM Public + * License (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of + * the License at http://www.redhat.com/licenses/ccmpl.html + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + */ +package uk.gov.westsussex.mod; + +import org.apache.log4j.Logger; + +import uk.gov.westsussex.mod.portlet.MessageOfTheDayPortlet; + +import com.arsdigita.domain.DomainObject; +import com.arsdigita.kernel.ACSObjectInstantiator; +import com.arsdigita.kernel.Group; +import com.arsdigita.kernel.Kernel; +import com.arsdigita.kernel.KernelExcursion; +import com.arsdigita.kernel.permissions.PermissionDescriptor; +import com.arsdigita.kernel.permissions.PermissionService; +import com.arsdigita.kernel.permissions.PrivilegeDescriptor; +import com.arsdigita.loader.PackageLoader; +import com.arsdigita.persistence.DataObject; +import com.arsdigita.portal.PortletType; +import com.arsdigita.portal.apportlet.AppPortletType; +import com.arsdigita.runtime.ScriptContext; +import com.arsdigita.web.Application; +import com.arsdigita.web.ApplicationSetup; +import com.arsdigita.web.ApplicationType; + +/** + * Loader. + * + * @author Justin Ross <jr...@re...> + * @version $Id: Loader.java,v 1.2 2006/04/12 13:54:35 cdeg9850 Exp $ + */ +public class Loader extends PackageLoader implements MODConstants { + public final static String versionId = + "$Id: Loader.java,v 1.2 2006/04/12 13:54:35 cdeg9850 Exp $" + + "$Author: cdeg9850 $" + + "$DateTime: 2004/03/17 08:31:10 $"; + + private static final Logger s_log = Logger.getLogger(Loader.class); + + public void run(final ScriptContext ctx) { + new KernelExcursion() { + public void excurse() { + setEffectiveParty(Kernel.getSystemParty()); + setupApplicationType(); + setupMessageOfTheDayPortletType(); + } + } + .run(); + } + + private void setupApplicationType() { + + ApplicationType type = + ApplicationType.createApplicationType( + APPLICATION_KEY, + "Message of the Day", + MODApplication.BASE_DATA_OBJECT_TYPE); + type.setDescription( + "Allow daily messages, tips and thoughts to be displayed"); + } + + public void setupMessageOfTheDayPortletType() { + AppPortletType type = AppPortletType + .createAppPortletType("Message of the Day", + PortletType.WIDE_PROFILE, + MessageOfTheDayPortlet.BASE_DATA_OBJECT_TYPE); + type.setProviderApplicationType(MODApplication.BASE_DATA_OBJECT_TYPE); + type.setPortalApplication(true); + type.setDescription("Allow daily messages, tips and thoughts to be displayed"); + } + +} Added: aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/MODApplication.java =================================================================== --- aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/MODApplication.java (rev 0) +++ aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/MODApplication.java 2007-09-17 14:00:39 UTC (rev 1640) @@ -0,0 +1,224 @@ +/* + * Created on 27-Jun-05 + * + * To change the template for this generated file go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ + +package uk.gov.westsussex.mod; + +import java.util.Calendar; +import java.util.GregorianCalendar; +import java.util.Random; + +import org.apache.commons.lang.StringUtils; +import org.apache.log4j.Logger; + +import com.arsdigita.domain.DomainObjectFactory; +import com.arsdigita.kernel.Group; +import com.arsdigita.kernel.permissions.PermissionDescriptor; +import com.arsdigita.kernel.permissions.PermissionService; +import com.arsdigita.kernel.permissions.PrivilegeDescriptor; +import com.arsdigita.persistence.DataAssociation; +import com.arsdigita.persistence.DataAssociationCursor; +import com.arsdigita.persistence.DataObject; +import com.arsdigita.persistence.OID; +import com.arsdigita.util.Assert; +import com.arsdigita.web.Application; +/** + * @author claire.day at westsussex.gov.uk + * @author chris.gilbert at westsussex.gov.uk + * + * Discrete instances of this application may be created for different + * types of message eg thought for the day, tip of the day etc + * Portlet picks out a message using random number seeded by today's date + * + */ +public class MODApplication extends Application { + + public static final String BASE_DATA_OBJECT_TYPE = + "uk.gov.westsussex.mod.MODApplication"; + public static final String MESSAGES = "messages"; + /** + * NOTE reader group is not currently relevant, as no permission check is + * carried out on read privilege. It has been included in case we wanted to include + * a restricted instance in the future. If so, there would need to be a boolean + * attribute on the application that decides whether to carry out a permission check + */ + public static final String READER_GROUP = "readerGroup"; + /** + * When first created, only site wide admin may manage messages. Add users to this group + * under ccm admin to allow others to manage messages + */ + public static final String ADMIN_GROUP = "adminGroup"; + + private static Logger s_log = Logger.getLogger(MODApplication.class); + + public MODApplication(DataObject obj) { + super(obj); + } + + public MODApplication(OID oid) { + super(oid); + } + + public String getContextPath() { + return "/ccm-wsx-message-of-the-day"; + } + + public String getServletPath() { + return "/files"; + } + + public static MODApplication create( + String urlName, + String title, + Application parent) { + + MODApplication app = + (MODApplication) Application.createApplication( + BASE_DATA_OBJECT_TYPE, + urlName, + title, + parent); + s_log.debug("creating a new message of the day instance"); + Group readers = new Group(); + readers.setName(title + " Readers"); + s_log.debug("created reader group"); + Group admin = new Group(); + admin.setName(title + " Admin"); + s_log.debug("created admin group"); + app.setReaderGroup(readers); + app.setAdminGroup(admin); + + return app; + } + + /** + * + */ + public void initialize() { + super.initialize(); + s_log.debug("initialising new mod app"); + if (isNew()) { + Group readers = new Group(); + readers.setName(getTitle() + " Readers"); + s_log.debug("created reader group"); + Group admin = new Group(); + admin.setName(getTitle() + " Admin"); + s_log.debug("created admin group"); + setReaderGroup(readers); + setAdminGroup(admin); + } + } + + /** + * Ensure we don't attempt to grant permissions until the + * application has been created in DB (code blagged from ccm-forum) + * + */ + private boolean m_wasNew; + + protected void beforeSave() { + m_wasNew = isNew(); + super.beforeSave(); + } + + protected void afterSave() { + if (m_wasNew) { + + Group readerGroup = getReaderGroup(); + if (readerGroup != null) { + + PermissionDescriptor read = + new PermissionDescriptor( + PrivilegeDescriptor.READ, + this, + readerGroup); + PermissionService.grantPermission(read); + + } + + Group adminGroup = getAdminGroup(); + if (adminGroup != null) { + } + PermissionDescriptor admin = + new PermissionDescriptor( + PrivilegeDescriptor.ADMIN, + this, + adminGroup); + PermissionService.grantPermission(admin); + } + } + + + public Message getTodaysMessage() { + + DataAssociationCursor messages = getAllMessages(); + Calendar calendar = new GregorianCalendar(); + + int day = calendar.get(Calendar.DAY_OF_MONTH); + int month = calendar.get(Calendar.MONTH); + int year = calendar.get(Calendar.YEAR); + // pad dates, so that 11 Feb (11 2 2006) isn't the same as 1 Dec (1 12 2006) + String total = year + StringUtils.leftPad(Integer.toString(month).toString(), 2, '0') + StringUtils.leftPad(Integer.toString(day), 2, '0'); + s_log.debug("Total of today's date as a string " + total); + + Random generator = new Random(Long.parseLong(total)); + int messageCount = (int) messages.size(); + if (messageCount > 0) { + + int randomNumber = generator.nextInt((int) messages.size()); + messages.setRange( + new Integer(randomNumber + 1), + new Integer(randomNumber + 2)); + } + Message message = null; + + while (messages.next()) { + message = + (Message) DomainObjectFactory.newInstance( + messages.getDataObject()); + + } + return message; + + } + + public DataAssociationCursor getAllMessages() { + DataAssociationCursor allMessages = + ((DataAssociation) get(MESSAGES)).cursor(); + // no order imposed, so client can decide whether to order alphabetically or by id + return allMessages; + } + + private void setReaderGroup(Group group) { + setAssociation(READER_GROUP, group); + + } + + private Group getReaderGroup() { + DataObject dObj = (DataObject) get(READER_GROUP); + Assert.exists(dObj, DataObject.class); + return (Group) DomainObjectFactory.newInstance(dObj); + } + + private void setAdminGroup(Group group) { + setAssociation(ADMIN_GROUP, group); + + } + private Group getAdminGroup() { + DataObject dObj = (DataObject) get(ADMIN_GROUP); + Assert.exists(dObj, DataObject.class); + return (Group) DomainObjectFactory.newInstance(dObj); + } + + public void addMessage(Message message) { + add(MESSAGES, message); + } + + public void removeMessage(Message message) { + message.removeFromAssociation((DataAssociation) get(MESSAGES)); + } + +} Added: aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/MODConstants.java =================================================================== --- aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/MODConstants.java (rev 0) +++ aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/MODConstants.java 2007-09-17 14:00:39 UTC (rev 1640) @@ -0,0 +1,43 @@ +/* + * Created on 27-Jun-05 + * + * To change the template for this generated file go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +package uk.gov.westsussex.mod; + +import com.arsdigita.globalization.GlobalizedMessage; + +/** + * @author cgyg9330 + * + * To change the template for this generated type comment go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +public interface MODConstants { + + public static final String XML_NS = + "http://wsgfl.westsussex.gov.uk/message-of-the-day/1.0"; + public static final String XML_PREFIX = "message-of-the-day"; + + public static final String APPLICATION_KEY = "message-of-the-day"; + + //form field names + public static final String MESSAGE_FIELD = "message"; + public static final String MESSAGE_FORM_NAME = "messageForm"; + + + //globalised text + public static final String BUNDLE_NAME = "uk.gov.westsussex.mod.ui.MODResources"; + + public static final String MESSAGE_LABEL = (String)new GlobalizedMessage("mod.label.message", BUNDLE_NAME).localize(); + public static final String MESSAGE_HINT = (String)new GlobalizedMessage("mod.hint.message", BUNDLE_NAME).localize(); + public static final GlobalizedMessage MESSAGE_NULL = new GlobalizedMessage("mod.validation.message.null", BUNDLE_NAME); + + + + + + + +} Added: aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/Message.java =================================================================== --- aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/Message.java (rev 0) +++ aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/Message.java 2007-09-17 14:00:39 UTC (rev 1640) @@ -0,0 +1,80 @@ +/* + * Created on 07-Apr-06 + * + * To change the template for this generated file go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +package uk.gov.westsussex.mod; + +import com.arsdigita.domain.DataObjectNotFoundException; +import com.arsdigita.domain.DomainObject; +import com.arsdigita.domain.DomainObjectFactory; +import com.arsdigita.kernel.Kernel; +import com.arsdigita.persistence.DataCollection; +import com.arsdigita.persistence.DataObject; +import com.arsdigita.persistence.OID; +import com.arsdigita.persistence.SessionManager; + +/** + * @author cdeg9850 + * + * To change the template for this generated type comment go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +public class Message extends DomainObject { + + public static final String BASE_DATA_OBJECT_TYPE = + "uk.gov.westsussex.mod.Message"; + //PDL references + public static final String ID = "id"; + public static final String TEXT = "messageText"; + + + public Message (Integer id) { + super(new OID(BASE_DATA_OBJECT_TYPE, id)); + } + + /** + * Construct a new <code>Message</code> from the given {@link DataObject}. + * All subclasses must implement this constructor. + */ + public Message(DataObject obj) { + super(obj); + } + + public Message() { + super (BASE_DATA_OBJECT_TYPE); + setID(); + MODApplication app = (MODApplication)Kernel.getContext().getResource(); + app.addMessage(this); + + + } + + private void setID(){ + DataCollection allMessages = SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE); + allMessages.addOrder(ID + " desc"); + Integer id = new Integer(1); + if (allMessages.next()){ + Message message = (Message)DomainObjectFactory.newInstance(allMessages.getDataObject()); + int currentMaxID = message.getID(); + id = new Integer(currentMaxID + 1); + allMessages.close(); + } + set(ID, id); + } + + public int getID(){ + return ((Integer)get(ID)).intValue(); + } + + + public void setText(String text){ + set(TEXT, text); + } + + public String getText(){ + return (String)get(TEXT); + } + +} Added: aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/portlet/MessageOfTheDayPortlet.java =================================================================== --- aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/portlet/MessageOfTheDayPortlet.java (rev 0) +++ aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/portlet/MessageOfTheDayPortlet.java 2007-09-17 14:00:39 UTC (rev 1640) @@ -0,0 +1,121 @@ +/* + * Copyright (C) 2003-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 uk.gov.westsussex.mod.portlet; + +import org.apache.log4j.Logger; + +import uk.gov.westsussex.mod.MODApplication; +import uk.gov.westsussex.mod.Message; + +import com.arsdigita.bebop.Link; +import com.arsdigita.bebop.PageState; +import com.arsdigita.bebop.event.PrintEvent; +import com.arsdigita.bebop.event.PrintListener; +import com.arsdigita.bebop.portal.AbstractPortletRenderer; +import com.arsdigita.kernel.Kernel; +import com.arsdigita.kernel.Party; +import com.arsdigita.kernel.permissions.PermissionDescriptor; +import com.arsdigita.kernel.permissions.PermissionService; +import com.arsdigita.kernel.permissions.PrivilegeDescriptor; +import com.arsdigita.london.portal.ui.PortalConstants; +import com.arsdigita.persistence.DataAssociation; +import com.arsdigita.persistence.DataAssociationCursor; +import com.arsdigita.persistence.DataObject; +import com.arsdigita.portal.apportlet.AppPortlet; +import com.arsdigita.toolbox.ui.SecurityContainer; +import com.arsdigita.web.URL; +import com.arsdigita.xml.Element; + +public class MessageOfTheDayPortlet extends AppPortlet { + public static final String versionId = + "$Id: MessageOfTheDayPortlet.java,v 1.1 2006/04/12 13:54:35 cdeg9850 Exp $ by $Author: cdeg9850 $, $DateTime: 2004/08/17 23:26:27 $"; + + public static final String BASE_DATA_OBJECT_TYPE = + "uk.gov.westsussex.mod.MODPortlet"; + + + protected String getBaseDataObjectType() { + return BASE_DATA_OBJECT_TYPE; + } + + public MessageOfTheDayPortlet(DataObject dataObject) { + super(dataObject); + } + + protected AbstractPortletRenderer doGetPortletRenderer() { + return new MessageOfTheDayPortletRenderer(this); + } + +} + +class MessageOfTheDayPortletRenderer extends AbstractPortletRenderer { + + private MessageOfTheDayPortlet m_portlet; + private SecurityContainer sc; + + private static Logger s_log = Logger.getLogger(MessageOfTheDayPortletRenderer.class); + + public MessageOfTheDayPortletRenderer(MessageOfTheDayPortlet portlet) { + m_portlet = portlet; + Link newMessageLink = new Link("Edit Messages", new PrintListener() { + public void prepare(PrintEvent e) { + //URL url = URL.there(m_portlet.getParentApplication(), "", null); + //URL url = URL.there(m_portlet.getParentApplication(), "/", null); + Link link = (Link)e.getTarget(); + link.setTarget(m_portlet.getParentApplication().getPath()); + } + }); + sc = new SecurityContainer(newMessageLink) { + protected boolean canAccess(Party party, PageState state) { + if (party == null){ + party = Kernel.getPublicUser(); + } + PermissionDescriptor admin = new PermissionDescriptor(PrivilegeDescriptor.ADMIN, m_portlet.getParentApplication(), party); + + return PermissionService.checkPermission(admin); + } + }; + add(sc); + } + + protected void generateBodyXML(PageState pageState, Element parent) { + Element content = + parent.newChildElement( + "portlet:messageOfTheDayPortlet", + PortalConstants.PORTLET_XML_NS); + + + + MODApplication app = (MODApplication) m_portlet.getParentApplication(); + + content.addAttribute("title", app.getTitle()); + + try{ + Message message = app.getTodaysMessage(); + if (message != null){ + content.addAttribute("message", message.getText()); + } + } catch (Throwable t) { + s_log.error("Problem generating XML for Today's Message", t); + } + + //sc.generateXML(pageState, content); + } + +} Added: aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/ui/MODResources.properties =================================================================== --- aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/ui/MODResources.properties (rev 0) +++ aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/ui/MODResources.properties 2007-09-17 14:00:39 UTC (rev 1640) @@ -0,0 +1,3 @@ +mod.validation.message.null=Please enter a message +mod.label.message=New Message +mod.hint.message=Enter an interesting, informative or inspiring message Added: aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/ui/MainPanel.java =================================================================== --- aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/ui/MainPanel.java (rev 0) +++ aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/ui/MainPanel.java 2007-09-17 14:00:39 UTC (rev 1640) @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2004 Red Hat Inc. All Rights Reserved. + * + * The contents of this file are subject to the CCM Public + * License (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of + * the License at http://www.redhat.com/licenses/ccmpl.html + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + */ + +package uk.gov.westsussex.mod.ui; + +import org.apache.log4j.Logger; + +import uk.gov.westsussex.mod.MODConstants; +import uk.gov.westsussex.mod.Message; + +import com.arsdigita.bebop.Component; +import com.arsdigita.bebop.Page; +import com.arsdigita.bebop.PageState; +import com.arsdigita.bebop.SimpleComponent; +import com.arsdigita.bebop.SimpleContainer; +import com.arsdigita.bebop.event.ActionEvent; +import com.arsdigita.bebop.event.ActionListener; +import com.arsdigita.bebop.parameters.IntegerParameter; +import com.arsdigita.bebop.parameters.StringParameter; +import com.arsdigita.kernel.Kernel; +import com.arsdigita.london.util.ui.ModalContainer; +import com.arsdigita.london.util.ui.parameters.DomainObjectParameter; +import com.arsdigita.xml.Element; + +public class MainPanel extends SimpleContainer { + + private MessageForm messageForm; + private MessageList messageList; + private IntegerParameter message; + + + private static Logger s_log = Logger.getLogger(MainPanel.class); + + public MainPanel() { + + super( + MODConstants.XML_PREFIX + ":main-panel", + MODConstants.XML_NS); + + SimpleComponent appTitle = new SimpleComponent() { + public void generateXML(PageState state, Element p) { + Element titleElement = p.newChildElement(MODConstants.XML_PREFIX + ":applicationTitle", + MODConstants.XML_NS); + titleElement.setText(Kernel.getContext().getResource().getTitle()); + } + }; + + message = + new IntegerParameter( + "messageID"); + messageForm = new MessageForm(message); + messageList = new MessageList(message); + + add(appTitle); + add(messageForm); + add(messageList); + + } + + public void register(Page p) { + super.register(p); + + p.addGlobalStateParam(message); + + } +} Added: aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/ui/MessageForm.java =================================================================== --- aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/ui/MessageForm.java (rev 0) +++ aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/ui/MessageForm.java 2007-09-17 14:00:39 UTC (rev 1640) @@ -0,0 +1,119 @@ +/* + * Created on 29-Mar-06 + * + * To change the template for this generated file go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +package uk.gov.westsussex.mod.ui; + +import org.apache.log4j.Logger; + +import uk.gov.westsussex.mod.MODConstants; +import uk.gov.westsussex.mod.Message; + +import com.arsdigita.bebop.Form; +import com.arsdigita.bebop.FormProcessException; +import com.arsdigita.bebop.PageState; +import com.arsdigita.bebop.SaveCancelSection; +import com.arsdigita.bebop.SimpleContainer; +import com.arsdigita.bebop.event.FormInitListener; +import com.arsdigita.bebop.event.FormProcessListener; +import com.arsdigita.bebop.event.FormSectionEvent; +import com.arsdigita.bebop.event.FormSubmissionListener; +import com.arsdigita.bebop.form.TextField; +import com.arsdigita.bebop.parameters.IntegerParameter; +import com.arsdigita.bebop.parameters.NotEmptyValidationListener; + +/** + * @author claire.day at westsussex.gov.uk + * + */ +public class MessageForm + extends Form + implements FormInitListener, FormProcessListener, FormSubmissionListener { + + private TextField messageText; + private SaveCancelSection saveCancel; + + private IntegerParameter selectedMessage; + private Logger s_log = Logger.getLogger(MessageForm.class); + + + + /** + * + */ + public MessageForm(IntegerParameter message) { + super( + MODConstants.MESSAGE_FORM_NAME, + new SimpleContainer( + MODConstants.XML_PREFIX + ":messageOfTheDayForm", + MODConstants.XML_NS)); + + setRedirecting(true); + selectedMessage = message; + addWidgets(); + addInitListener(this); + addSubmissionListener(this); + addProcessListener(this); + } + + private void addWidgets() { + messageText = new TextField(MODConstants.MESSAGE_FIELD); + messageText.setMetaDataAttribute("label", MODConstants.MESSAGE_LABEL); + messageText.setHint( + MODConstants.MESSAGE_HINT); + messageText.addValidationListener(new NotEmptyValidationListener(MODConstants.MESSAGE_NULL)); + saveCancel = new SaveCancelSection(); + saveCancel.getCancelButton().setClassAttr("linkButton"); + saveCancel.getSaveButton().setClassAttr("linkButton"); + + add(messageText); + add(saveCancel); + } + + /* (non-Javadoc) + * @see com.arsdigita.bebop.event.FormProcessListener#process(com.arsdigita.bebop.event.FormSectionEvent) + */ + public void process(FormSectionEvent e) throws FormProcessException { + PageState state = e.getPageState(); + Message message; + Integer messageID = (Integer)state.getValue(selectedMessage); + if (messageID == null) { + message = new Message(); + } else { + message = new Message(messageID); + } + + message.setText((String)messageText.getValue(state)); + s_log.debug( + "message saved is: " + + message.getText()); + state.setValue(selectedMessage, null); + } + + + public void submitted(FormSectionEvent e) throws FormProcessException { + PageState state = e.getPageState(); + if (saveCancel.getCancelButton().isSelected(state)){ + state.setValue(selectedMessage, null); + throw new FormProcessException("Cancelled"); + } + } + + /* (non-Javadoc) + * @see com.arsdigita.bebop.event.FormInitListener#init(com.arsdigita.bebop.event.FormSectionEvent) + */ + public void init(FormSectionEvent e) throws FormProcessException { + PageState state = e.getPageState(); + Integer messageID = (Integer)state.getValue(selectedMessage); + if (messageID != null) { + + Message message = new Message(messageID); + messageText.setValue(state, message.getText()); + } + + + } + +} Added: aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/ui/MessageList.java =================================================================== --- aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/ui/MessageList.java (rev 0) +++ aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/ui/MessageList.java 2007-09-17 14:00:39 UTC (rev 1640) @@ -0,0 +1,133 @@ +/* + * Created on 29-Mar-06 + * + * To change the template for this generated file go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +package uk.gov.westsussex.mod.ui; + +import java.io.IOException; +import java.math.BigDecimal; +import java.text.DateFormat; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import java.util.Iterator; + +import javax.mail.MessagingException; +import javax.mail.SendFailedException; +import javax.naming.NamingException; +import javax.naming.SizeLimitExceededException; + +import org.apache.log4j.Logger; + +import uk.gov.westsussex.mod.MODApplication; +import uk.gov.westsussex.mod.MODConstants; +import uk.gov.westsussex.mod.Message; + +import com.arsdigita.bebop.PageState; +import com.arsdigita.bebop.RequestLocal; +import com.arsdigita.bebop.SimpleComponent; +import com.arsdigita.bebop.parameters.IntegerParameter; +import com.arsdigita.bebop.parameters.StringParameter; +import com.arsdigita.domain.DataObjectNotFoundException; +import com.arsdigita.domain.DomainObject; +import com.arsdigita.domain.DomainObjectFactory; +import com.arsdigita.kernel.Kernel; +import com.arsdigita.london.util.ui.parameters.DomainObjectParameter; +import com.arsdigita.mail.Mail; +import com.arsdigita.persistence.DataAssociationCursor; +import com.arsdigita.persistence.DataCollection; +import com.arsdigita.persistence.OID; +import com.arsdigita.persistence.SessionManager; +import com.arsdigita.util.UncheckedWrapperException; +import com.arsdigita.xml.Element; + +/** + * @author cdeg9850 + * + * To change the template for this generated type comment go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +public class MessageList extends SimpleComponent { + + private static Logger s_log = Logger.getLogger(MessageList.class); + private static final String ACTION_DELETE = "Delete"; + private static final String ACTION_EDIT = "Edit"; + + private IntegerParameter selectedMessage; + + + public MessageList (IntegerParameter message) { + super(); + selectedMessage = message; + } + + public void generateXML(PageState state, Element p) { + Element main = + p.newChildElement( + MODConstants.XML_PREFIX + ":messageList", + MODConstants.XML_NS); + + DataAssociationCursor messages = + ((MODApplication) Kernel.getContext().getResource()) + .getAllMessages(); + messages.addOrder(Message.TEXT); + while (messages.next()) { + Message message = + (Message) DomainObjectFactory.newInstance( + messages.getDataObject()); + Element messageElement = + main.newChildElement( + MODConstants.XML_PREFIX + ":message", + MODConstants.XML_NS); + messageElement.addAttribute("text", message.getText()); + messageElement.addAttribute( + "deleteLink", + makeURL(state, ACTION_DELETE, message)); + messageElement.addAttribute( + "editLink", + makeURL(state, ACTION_EDIT, message)); + } + + } + + protected String makeURL(PageState state, String action, Message message) { + state.setControlEvent(this, action, String.valueOf(message.getID())); + + String url = null; + try { + url = state.stateAsURL(); + } catch (IOException ex) { + throw new UncheckedWrapperException("cannot create url", ex); + } + state.clearControlEvent(); + return url; + } + + public void respond(PageState state) + throws javax.servlet.ServletException { + super.respond(state); + + String key = state.getControlEventName(); + Integer value = new Integer(state.getControlEventValue()); + + if (key.equals(ACTION_DELETE)) { + + + try { + Message message = new Message(value); + ((MODApplication)Kernel.getContext().getResource()).removeMessage(message); + // in case we have elected to edit a message, but then we delete it using the link below. + // This save a domainobjectnotfoundexception + state.setValue(selectedMessage, null); + } catch (DataObjectNotFoundException d) { + //Caused by double click or page refresh. The message specified has already been deleted. + } + } else { + state.setValue(selectedMessage, value); + } + state.clearControlEvent(); + } + +} \ No newline at end of file Added: aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/ui/portlet/MessageOfTheDayPortletEditor.java =================================================================== --- aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/ui/portlet/MessageOfTheDayPortletEditor.java (rev 0) +++ aplaws/contrib/wsx/ccm-wsx-message-of-the-day/src/uk/gov/westsussex/mod/ui/portlet/MessageOfTheDayPortletEditor.java 2007-09-17 14:00:39 UTC (rev 1640) @@ -0,0 +1,38 @@ +/* + * 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 uk.gov.westsussex.mod.ui.portlet; + +import com.arsdigita.bebop.RequestLocal; +import com.arsdigita.bebop.portal.PortletConfigFormSection; +import com.arsdigita.kernel.ResourceType; + + +public class MessageOfTheDayPortletEditor extends PortletConfigFormSection { + + public MessageOfTheDayPortletEditor(ResourceType resType, + RequestLocal parentAppRL) { + super(resType, parentAppRL); + } + + public MessageOfTheDayPortletEditor(RequestLocal application) { + super(application); + } + + +} Added: aplaws/contrib/wsx/ccm-wsx-message-of-the-day/web/WEB-INF/bebop-define.tld =================================================================== --- aplaws/contrib/wsx/ccm-wsx-message-of-the-day/web/WEB-INF/bebop-define.tld (rev 0) +++ aplaws/contrib/wsx/ccm-wsx-message-of-the-day/web/WEB-INF/bebop-define.tld 2007-09-17 14:00:39 UTC (rev 1640) @@ -0,0 +1,395 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd"> + +<taglib> + <tlibversion>1.0</tlibversion> + <jspversion>1.1</jspversion> + <shortname>bebop-define</shortname> + <uri>http://www.arsdigita.com/bebop-define/tld/1.0</uri> + + <info>this is a tag library for defining Bebop pages via JSP.</info> + + <tag> + <name>page</name> + <tagclass>com.arsdigita.bebop.jsp.DefinePage</tagclass> + <teiclass>com.arsdigita.bebop.jsp.DefinePageExtraInfo</teiclass> + <bodycontent>JSP</bodycontent> + <attribute> + <name>title</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>name</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>application</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>master</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>pageClass</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>cache</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>component</name> + <tagclass>com.arsdigita.bebop.jsp.DefineComponentImpl</tagclass> + <teiclass>com.arsdigita.bebop.jsp.DefineComponentExtraInfo</teiclass> + <bodycontent>JSP</bodycontent> + <attribute> + <name>name</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>classname</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>form</name> + <tagclass>com.arsdigita.bebop.jsp.DefineForm</tagclass> + <teiclass>com.arsdigita.bebop.jsp.DefineFormExtraInfo</teiclass> + <bodycontent>JSP</bodycontent> + <attribute> + <name>name</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>encType</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>method</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>action</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>onSubmit</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>onReset</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>link</name> + <tagclass>com.arsdigita.bebop.jsp.DefineLink</tagclass> + <bodycontent>JSP</bodycontent> + <attribute> + <name>url</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>name</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>image</name> + <tagclass>com.arsdigita.bebop.jsp.DefineImage</tagclass> + <bodycontent>JSP</bodycontent> + <attribute> + <name>src</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>alt</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>width</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>height</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>border</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>name</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>tabbedPane</name> + <tagclass>com.arsdigita.bebop.jsp.DefineTabbedPane</tagclass> + <bodycontent>JSP</bodycontent> + <attribute> + <name>name</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>tab</name> + <tagclass>com.arsdigita.bebop.jsp.DefineTab</tagclass> + <bodycontent>JSP</bodycontent> + <attribute> + <name>name</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>label</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>text</name> + <tagclass>com.arsdigita.bebop.jsp.DefineText</tagclass> + <teiclass>com.arsdigita.bebop.jsp.DefineWidgetExtraInfo</teiclass> + <bodycontent>JSP</bodycontent> + <attribute> + <name>name</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>type</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>size</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>maxlength</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>password</name> + <tagclass>com.arsdigita.bebop.jsp.DefinePassword</tagclass> + <teiclass>com.arsdigita.bebop.jsp.DefineWidgetExtraInfo</teiclass> + <bodycontent>JSP</bodycontent> + <attribute> + <name>name</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>size</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>maxlength</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>textArea</name> + <tagclass>com.arsdigita.bebop.jsp.DefineTextArea</tagclass> + <teiclass>com.arsdigita.bebop.jsp.DefineWidgetExtraInfo</teiclass> + <bodycontent>JSP</bodycontent> + <attribute> + <name>name</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>type</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>rows</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>cols</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>wrap</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>submit</name> + <tagclass>com.arsdigita.bebop.jsp.DefineSubmit</tagclass> + <bodycontent>JSP</bodycontent> + <attribute> + <name>name</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>label</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>bundle</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>option</name> + <tagclass>com.arsdigita.bebop.jsp.DefineOption</tagclass> + <bodycontent>JSP</bodycontent> + <attribute> + <name>name</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>value</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>selected</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>bundle</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>radioGroup</name> + <tagclass>com.arsdigita.bebop.jsp.DefineRadioGroup</tagclass> + <bodycontent>JSP</bodycontent> + <attribute> + <name>name</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>checkboxGroup</name> + <tagclass>com.arsdigita.bebop.jsp.DefineCheckboxGroup</tagclass> + <bodycontent>JSP</bodycontent> + <attribute> + <name>name</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>vertical</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>select</name> + <tagclass>com.arsdigita.bebop.jsp.DefineSelect</tagclass> + <bodycontent>JSP</bodycontent> + <attribute> + <name>name</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>onChange</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>multipleSelect</name> + <tagclass>com.arsdigita.bebop.jsp.DefineMultipleSelect</tagclass> + <bodycontent>JSP</bodycontent> + <attribute> + <name>name</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>slave</name> + <tagclass>com.arsdigita.bebop.jsp.DefineSlave</tagclass> + <bodycontent>empty</bodycontent> + </tag> + + <tag> + <name>list</name> + <tagclass>com.arsdigita.bebop.jsp.DefineList</tagclass> + <teiclass>com.arsdigita.bebop.jsp.DefineListExtraInfo</teiclass> + <bodycontent>JSP</bodycontent> + <attribute> + <name>name</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>table</name> + <tagclass>com.arsdigita.bebop.jsp.DefineTable</tagclass> + <teiclass>com.arsdigita.bebop.jsp.DefineTableExtraInfo</teiclass> + <bodycontent>JSP</bodycontent> + <attribute> + <name>name</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> +</taglib> + Added: aplaws/contrib/wsx/ccm-wsx-message-of-the-day/web/WEB-INF/bebop-show.tld =================================================================== --- aplaws/contrib/wsx/ccm-wsx-message-of-the-day/web/WEB-INF/bebop-show.tld (rev 0) +++ aplaws/contrib/wsx/ccm-wsx-message-of-the-day/web/WEB-INF/bebop-show.tld 2007-09-17 14:00:39 UTC (rev 1640) @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd"> + +<taglib> + <tlibversion>1.0</tlibversion> + <jspversion>1.1</jspversion> + <shortname>bebop-define</shortname> + <uri>http://www.arsdigita.com/bebop-define/tld/1.0</uri> + + <info>this is a tag library for showing components from Bebop pages + inside of a JSP.</info> + + <tag> + <name>page</name> + <tagclass>com.arsdigita.bebop.jsp.ShowPage</tagclass> + <teiclass>com.arsdigita.bebop.jsp.ShowPageExtraInfo</teiclass> + <bodycontent>JSP</bodycontent> + <attribute> + <name>pageClass</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>master</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>all</name> + <tagclass>com.arsdigita.bebop.jsp... [truncated message content] |