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: <cl...@vh...> - 2005-08-18 18:28:46
|
Author: clasohm Date: 2005-08-18 11:13:13 +0200 (Thu, 18 Aug 2005) New Revision: 713 Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationConfig.java Log: fixed for latest core version, where calling KernelHelper.getSystemAdministratorEmailAddress() failed with a persistence exception Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationConfig.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationConfig.java 2005-08-18 08:49:44 UTC (rev 712) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationConfig.java 2005-08-18 09:13:13 UTC (rev 713) @@ -35,13 +35,13 @@ private final Parameter m_consultationsTermUrl = new StringParameter( "com.arsdigita.cms.camden.contenttypes.consultations_term_url", - Parameter.OPTIONAL, - "consultations"); + Parameter.OPTIONAL, "consultations"); private final Parameter m_alertsSenderEmail = new StringParameter( "com.arsdigita.cms.camden.contenttypes.alerts_sender_email", - Parameter.OPTIONAL, - KernelHelper.getSystemAdministratorEmailAddress()); + Parameter.OPTIONAL, null); + + private String m_adminEmail; public ConsultationConfig() { register(m_consultationsTermUrl); @@ -49,12 +49,23 @@ loadInfo(); } - public String getConsultationsTermUrl() { + public String getConsultationsTermURL() { return (String) get(m_consultationsTermUrl); } public String getAlertsSenderEmail() { - return (String) get(m_alertsSenderEmail); + String result = (String)get(m_alertsSenderEmail); + + if (result == null) { + if (m_adminEmail == null) + // We cannot set this as the default for the parameter, + // because the persistence layer may not be available when + // this class is instantiated. + m_adminEmail = KernelHelper.getSystemAdministratorEmailAddress(); + return m_adminEmail; + } + + return result; } } |
From: <cl...@vh...> - 2005-08-18 18:27:28
|
Author: clasohm Date: 2005-08-18 11:14:04 +0200 (Thu, 18 Aug 2005) New Revision: 714 Added: contrib/ccm-ldn-camden-consultation/trunk/sql/ccm-ldn-camden-consultation/oracle-se/upgrade/1.0.1-1.0.2/ contrib/ccm-ldn-camden-consultation/trunk/sql/ccm-ldn-camden-consultation/oracle-se/upgrade/1.0.1-1.0.2/authoring_kits.sql contrib/ccm-ldn-camden-consultation/trunk/sql/ccm-ldn-camden-consultation/upgrade/oracle-se-1.0.1-1.0.2.sql contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationCreate.java Modified: contrib/ccm-ldn-camden-consultation/trunk/application.xml contrib/ccm-ldn-camden-consultation/trunk/src/WEB-INF/content-types/com/arsdigita/camden/cms/contenttypes/Consultation.xml contrib/ccm-ldn-camden-consultation/trunk/src/ccm-ldn-camden-consultation.upgrade contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/Consultation.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationUtil.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationPropertiesForm.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationsNavigationModel.java Log: added RSS support Modified: contrib/ccm-ldn-camden-consultation/trunk/application.xml =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/application.xml 2005-08-18 09:13:13 UTC (rev 713) +++ contrib/ccm-ldn-camden-consultation/trunk/application.xml 2005-08-18 09:14:04 UTC (rev 714) @@ -2,7 +2,7 @@ <ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project" name="ccm-ldn-camden-consultation" prettyName="Red Hat CCM Content Types" - version="1.0.1" + version="1.0.2" release="1" webapp="ROOT"> <ccm:dependencies> @@ -11,6 +11,7 @@ <ccm:requires name="ccm-ldn-aplaws" version="1.9.1" relation="ge"/> <ccm:requires name="ccm-ldn-navigation" version="1.4.4" relation="ge"/> <ccm:requires name="ccm-ldn-util" version="1.4.1" relation="ge"/> + <ccm:requires name="ccm-ldn-rss" version="1.4.2" relation="ge"/> </ccm:dependencies> <ccm:directories> <ccm:directory name="pdl"/> Added: contrib/ccm-ldn-camden-consultation/trunk/sql/ccm-ldn-camden-consultation/oracle-se/upgrade/1.0.1-1.0.2/authoring_kits.sql =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/sql/ccm-ldn-camden-consultation/oracle-se/upgrade/1.0.1-1.0.2/authoring_kits.sql 2005-08-18 09:13:13 UTC (rev 713) +++ contrib/ccm-ldn-camden-consultation/trunk/sql/ccm-ldn-camden-consultation/oracle-se/upgrade/1.0.1-1.0.2/authoring_kits.sql 2005-08-18 09:14:04 UTC (rev 714) @@ -0,0 +1,6 @@ +update authoring_kits +set create_component = 'com.arsdigita.camden.cms.contenttypes.ui.ConsultationCreate' +where type_id = + (select type_id + from content_types + where object_type = 'com.arsdigita.camden.cms.contenttypes.Consultation'); Added: contrib/ccm-ldn-camden-consultation/trunk/sql/ccm-ldn-camden-consultation/upgrade/oracle-se-1.0.1-1.0.2.sql =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/sql/ccm-ldn-camden-consultation/upgrade/oracle-se-1.0.1-1.0.2.sql 2005-08-18 09:13:13 UTC (rev 713) +++ contrib/ccm-ldn-camden-consultation/trunk/sql/ccm-ldn-camden-consultation/upgrade/oracle-se-1.0.1-1.0.2.sql 2005-08-18 09:14:04 UTC (rev 714) @@ -0,0 +1 @@ +@ ../oracle-se/upgrade/1.0.1-1.0.2/authoring_kits.sql Modified: contrib/ccm-ldn-camden-consultation/trunk/src/WEB-INF/content-types/com/arsdigita/camden/cms/contenttypes/Consultation.xml =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/WEB-INF/content-types/com/arsdigita/camden/cms/contenttypes/Consultation.xml 2005-08-18 09:13:13 UTC (rev 713) +++ contrib/ccm-ldn-camden-consultation/trunk/src/WEB-INF/content-types/com/arsdigita/camden/cms/contenttypes/Consultation.xml 2005-08-18 09:14:04 UTC (rev 714) @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <ctd:content-types xmlns:ctd="http://xmlns.redhat.com/cms/content-types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.redhat.com/cms/content-types content-types.xsd"> <ctd:content-type label="Consultation" description="An content type for Camden consultations." objectType="com.arsdigita.camden.cms.contenttypes.Consultation" classname="com.arsdigita.camden.cms.contenttypes.Consultation"> - <ctd:authoring-kit createComponent="com.arsdigita.cms.ui.authoring.PageCreate"> + <ctd:authoring-kit createComponent="com.arsdigita.camden.cms.contenttypes.ui.ConsultationCreate"> <ctd:authoring-step labelKey="cms.contenttypes.shared.basic_properties.title" labelBundle="com.arsdigita.cms.ui.CMSResources" Modified: contrib/ccm-ldn-camden-consultation/trunk/src/ccm-ldn-camden-consultation.upgrade =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/ccm-ldn-camden-consultation.upgrade 2005-08-18 09:13:13 UTC (rev 713) +++ contrib/ccm-ldn-camden-consultation/trunk/src/ccm-ldn-camden-consultation.upgrade 2005-08-18 09:14:04 UTC (rev 714) @@ -2,4 +2,7 @@ <version from="1.0.0" to="1.0.1"> <script sql="ccm-ldn-camden-consultation/upgrade/::database::-1.0.0-1.0.1.sql"/> </version> + <version from="1.0.1" to="1.0.2"> + <script sql="ccm-ldn-camden-consultation/upgrade/::database::-1.0.1-1.0.2.sql"/> + </version> </upgrade> Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/Consultation.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/Consultation.java 2005-08-18 09:13:13 UTC (rev 713) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/Consultation.java 2005-08-18 09:14:04 UTC (rev 714) @@ -21,6 +21,9 @@ import java.math.BigDecimal; import java.util.Date; +import org.apache.log4j.Logger; + +import com.arsdigita.categorization.Category; import com.arsdigita.cms.ContentPage; import com.arsdigita.cms.CustomCopy; import com.arsdigita.cms.FileAsset; @@ -28,7 +31,8 @@ import com.arsdigita.cms.ItemCopier; import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.globalization.GlobalizedMessage; -import com.arsdigita.persistence.DataAssociation; +import com.arsdigita.kernel.ACSObject; +import com.arsdigita.kernel.permissions.PermissionService; import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.OID; @@ -43,8 +47,11 @@ */ public class Consultation extends ContentPage { - public static final String versionId = "$Id: Consultation.java 25 2005-08-03 16:01:08Z clasohm $"; + private static final Logger s_log = + Logger.getLogger(Consultation.class.getName()); + public static final String versionId = "$Id: Consultation.java 25 2005-08-03 16:01:08Z clasohm $"; + public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.camden.cms.contenttypes.Consultation"; @@ -67,7 +74,9 @@ public static final String FEEDBACK_DOCUMENTS = "feedbackDocuments"; public static final String ALERT_SENT = "alertSent"; - public Consultation() { + private boolean m_wasNew = true; + + public Consultation() { this(BASE_DATA_OBJECT_TYPE); } @@ -325,4 +334,5 @@ return super.copyProperty(source, property, copier); } + } Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationUtil.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationUtil.java 2005-08-18 09:13:13 UTC (rev 713) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationUtil.java 2005-08-18 09:14:04 UTC (rev 714) @@ -18,18 +18,27 @@ */ package com.arsdigita.camden.cms.contenttypes; +import java.math.BigDecimal; import java.util.Iterator; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; import java.util.TreeMap; +import org.apache.log4j.Logger; + import com.arsdigita.bebop.Label; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.form.Option; import com.arsdigita.bebop.form.OptionGroup; +import com.arsdigita.categorization.Category; +import com.arsdigita.categorization.CategoryCollection; import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.kernel.Kernel; +import com.arsdigita.london.rss.RSS; +import com.arsdigita.persistence.DataCollection; +import com.arsdigita.persistence.SessionManager; +import com.arsdigita.web.Application; /** * Miscellaneous utility methods for the Consultation content type. @@ -38,11 +47,17 @@ * @version $Id: ConsultationUtil.java 31 2005-08-04 15:56:42Z clasohm $ */ public class ConsultationUtil { + + private static final Logger s_log = + Logger.getLogger(ConsultationUtil.class.getName()); + public static final String APPLICATION_X_BINARY = "application/x-binary"; public static final String BUNDLE_NAME = "com.arsdigita.camden.cms.contenttypes.ConsultationResources"; + + public static final BigDecimal m_rssCategoryID = initRSSCategory(); public static GlobalizedMessage globalize(String key) { return new GlobalizedMessage(key, BUNDLE_NAME); @@ -106,4 +121,44 @@ return m_config; } + /** + * Determine which category we have to use to get the Consultation items + * into our RSS channel. This only works if a root term has been created + * for the domain APLAWS RSS Feed List, and it is named "Consultations". + * The latter can be changed with the consultations_term_url parameter. + * + * @return the Category to which all Consultation items should be mapped + */ + private static BigDecimal initRSSCategory() { + DataCollection apps = + SessionManager.getSession().retrieve(RSS.BASE_DATA_OBJECT_TYPE); + + if (!apps.next()) + return null; + + Application app = Application.retrieveApplication(apps.getDataObject()); + apps.close(); + + BigDecimal result = null; + Category rootCategory = Category.getRootForObject(app); + + if (rootCategory == null) + return null; + + String consultationsTermURL = getConfig().getConsultationsTermURL(); + + CategoryCollection cats = rootCategory.getDescendants(); + cats.addEqualsFilter(Category.URL, consultationsTermURL); + if (cats.next()) { + result = cats.getID(); + cats.close(); + } + + return result; + } + + public static BigDecimal getRSSCategoryID() { + return m_rssCategoryID; + } + } Added: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationCreate.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationCreate.java 2005-08-18 09:13:13 UTC (rev 713) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationCreate.java 2005-08-18 09:14:04 UTC (rev 714) @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2005 Red Hat Inc. All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +package com.arsdigita.camden.cms.contenttypes.ui; + +import java.math.BigDecimal; +import java.util.Date; + +import com.arsdigita.bebop.FormData; +import com.arsdigita.bebop.FormProcessException; +import com.arsdigita.bebop.PageState; +import com.arsdigita.bebop.event.FormSectionEvent; +import com.arsdigita.camden.cms.contenttypes.ConsultationUtil; +import com.arsdigita.categorization.Category; +import com.arsdigita.cms.ContentBundle; +import com.arsdigita.cms.ContentPage; +import com.arsdigita.cms.ContentSection; +import com.arsdigita.cms.Folder; +import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.ui.authoring.ApplyWorkflowFormSection; +import com.arsdigita.cms.ui.authoring.CreationSelector; +import com.arsdigita.cms.ui.authoring.PageCreate; +import com.arsdigita.util.Assert; + +public class ConsultationCreate extends PageCreate { + + private final CreationSelector m_parent; + + public ConsultationCreate(final ItemSelectionModel itemModel, final CreationSelector parent) { + super(itemModel, parent); + + m_parent = parent; + } + + /** + * This is copied from PageCreate.process(), and adds a default categorization + * which we need to put all Consultation items in an RSS channel. + */ + public void process(final FormSectionEvent e) throws FormProcessException { + final FormData data = e.getFormData(); + final PageState state = e.getPageState(); + final ContentSection section = m_parent.getContentSection(state); + Folder folder = m_parent.getFolder(state); + + Assert.exists(section, ContentSection.class); + + final ContentPage item = createContentPage(state); + item.setLanguage((String) data.get(LANGUAGE)); + item.setName((String) data.get(NAME)); + item.setTitle((String) data.get(TITLE)); + if (!ContentSection.getConfig().getHideLaunchDate()) { + item.setLaunchDate((Date) data.get(LAUNCH_DATE)); + } + + final ContentBundle bundle = new ContentBundle(item); + bundle.setParent(folder); + bundle.setContentSection(m_parent.getContentSection(state)); + bundle.save(); + + BigDecimal rssCategoryID = ConsultationUtil.getRSSCategoryID(); + if (rssCategoryID != null) + item.addCategory(new Category(rssCategoryID)); + getWorkflowSection().applyWorkflow(state, item); + + m_parent.editItem(state, item); + } + +} Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationPropertiesForm.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationPropertiesForm.java 2005-08-18 09:13:13 UTC (rev 713) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationPropertiesForm.java 2005-08-18 09:14:04 UTC (rev 714) @@ -18,12 +18,18 @@ */ package com.arsdigita.camden.cms.contenttypes.ui; +import java.math.BigDecimal; + +import org.apache.log4j.Logger; + import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.event.FormInitListener; import com.arsdigita.bebop.event.FormProcessListener; import com.arsdigita.bebop.event.FormSectionEvent; import com.arsdigita.bebop.event.FormSubmissionListener; import com.arsdigita.camden.cms.contenttypes.Consultation; +import com.arsdigita.camden.cms.contenttypes.ConsultationUtil; +import com.arsdigita.categorization.Category; import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ui.authoring.BasicPageForm; Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationsNavigationModel.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationsNavigationModel.java 2005-08-18 09:13:13 UTC (rev 713) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationsNavigationModel.java 2005-08-18 09:14:04 UTC (rev 714) @@ -41,11 +41,11 @@ ConsultationApp app = ConsultationApp.retrieveApplication(); if (app != null) - m_rootCategory = Category.getRootForObject(app, null); + m_rootCategory = Category.getRootForObject(app); if (m_rootCategory != null) { String consultationsTermUrl = - ConsultationUtil.getConfig().getConsultationsTermUrl(); + ConsultationUtil.getConfig().getConsultationsTermURL(); CategoryCollection cats = m_rootCategory.getDescendants(); cats.addEqualsFilter(Category.URL, consultationsTermUrl); |
From: <ssk...@vh...> - 2005-08-18 18:27:05
|
Author: sskracic Date: 2005-08-18 10:49:44 +0200 (Thu, 18 Aug 2005) New Revision: 712 Modified: ccm-cms-assets-fileattachment/trunk/application.xml ccm-cms-assets-fileattachment/trunk/sql/ccm-cms-assets-fileattachment/postgres/upgrade/6.1.1-6.1.2/add-file_order.sql Log: The upgrade script was not addressing the draft fileattachments that have not yet been published. Modified: ccm-cms-assets-fileattachment/trunk/application.xml =================================================================== --- ccm-cms-assets-fileattachment/trunk/application.xml 2005-08-17 18:17:57 UTC (rev 711) +++ ccm-cms-assets-fileattachment/trunk/application.xml 2005-08-18 08:49:44 UTC (rev 712) @@ -3,7 +3,7 @@ name="ccm-cms-assets-fileattachment" prettyName="Red Hat CMS Content Asset File Attachment" version="6.1.2" - release="1" + release="2" webapp="ROOT"> <ccm:dependencies> <ccm:requires name="ccm-core" version="6.1.1" relation="ge"/> Modified: ccm-cms-assets-fileattachment/trunk/sql/ccm-cms-assets-fileattachment/postgres/upgrade/6.1.1-6.1.2/add-file_order.sql =================================================================== --- ccm-cms-assets-fileattachment/trunk/sql/ccm-cms-assets-fileattachment/postgres/upgrade/6.1.1-6.1.2/add-file_order.sql 2005-08-17 18:17:57 UTC (rev 711) +++ ccm-cms-assets-fileattachment/trunk/sql/ccm-cms-assets-fileattachment/postgres/upgrade/6.1.1-6.1.2/add-file_order.sql 2005-08-18 08:49:44 UTC (rev 712) @@ -3,7 +3,7 @@ -- update draft items first update ca_file_attachments set file_order = file_id - where file_id in (select master_id from cms_items); + where file_id in (select item_id from cms_items where version='draft'); -- now copy that ordering to the published items, so -- that we get no inconsistencies in already published pages. update ca_file_attachments set |
From: <cl...@vh...> - 2005-08-18 18:12:41
|
Author: clasohm Date: 2005-08-18 14:22:10 +0200 (Thu, 18 Aug 2005) New Revision: 715 Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java Log: fixed cancellation URL in alerts Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java 2005-08-18 09:14:04 UTC (rev 714) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java 2005-08-18 12:22:10 UTC (rev 715) @@ -421,7 +421,7 @@ String email = (String)alerts.get(EMAIL); String firstNames = (String)alerts.get(FIRST_NAMES); String lastName = (String)alerts.get(LAST_NAME); - String confirmationToken = (String)alerts.get(CONFIRMATION_TOKEN); + String cancelToken = (String)alerts.get(CANCELLATION_TOKEN); String recipientName = email; if (firstNames != null && !"".equals(firstNames)) { @@ -433,7 +433,7 @@ ConsultationApp app = ConsultationApp.retrieveApplication(); ParameterMap parameters = new ParameterMap(); parameters.setParameter(ConsultationAlert.CANCEL_PARAMETER, - confirmationToken); + cancelToken); String cancelURL = URL.there(app, ConsultationAlert.CONFIRM_PATH, parameters).getURL(); |
From: <ap...@vh...> - 2005-08-18 17:05:27
|
Author: apevec Date: 2005-08-18 17:56:21 +0200 (Thu, 18 Aug 2005) New Revision: 717 Modified: ccm-ldn-aplaws/trunk/bundles/camden/cfg/web.xml Log: add secure and profiler filter to the default Camden webapp deployment descriptor Modified: ccm-ldn-aplaws/trunk/bundles/camden/cfg/web.xml =================================================================== --- ccm-ldn-aplaws/trunk/bundles/camden/cfg/web.xml 2005-08-18 15:34:42 UTC (rev 716) +++ ccm-ldn-aplaws/trunk/bundles/camden/cfg/web.xml 2005-08-18 15:56:21 UTC (rev 717) @@ -5,6 +5,16 @@ <web-app> <filter> + <filter-name>secured</filter-name> + <filter-class>com.arsdigita.web.SecureFilter</filter-class> + </filter> + + <filter> + <filter-name>profiler</filter-name> + <filter-class>com.arsdigita.profiler.ProfilerFilter</filter-class> + </filter> + + <filter> <filter-name>shortcuts</filter-name> <filter-class>com.arsdigita.london.shortcuts.ShortcutFilter</filter-class> </filter> @@ -15,6 +25,16 @@ </filter> <filter-mapping> + <filter-name>secured</filter-name> + <url-pattern>/*</url-pattern> + </filter-mapping> + + <filter-mapping> + <filter-name>profiler</filter-name> + <url-pattern>/*</url-pattern> + </filter-mapping> + + <filter-mapping> <filter-name>subsite</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> |
From: <ssk...@vh...> - 2005-08-18 16:50:52
|
Author: sskracic Date: 2005-08-18 18:22:21 +0200 (Thu, 18 Aug 2005) New Revision: 718 Added: ccm-cms-assets-fileattachment/trunk/src/com/arsdigita/cms/contentassets/ui/FileAttachmentSelectionModel.java Modified: ccm-cms-assets-fileattachment/trunk/application.xml ccm-cms-assets-fileattachment/trunk/src/com/arsdigita/cms/contentassets/ui/FileAttachmentModelBuilder.java ccm-cms-assets-fileattachment/trunk/src/com/arsdigita/cms/contentassets/ui/FileAttachmentsStep.java ccm-cms-assets-fileattachment/trunk/src/com/arsdigita/cms/contentassets/ui/FileAttachmentsTable.java Log: Added link for editing the description of file attachments. Modified: ccm-cms-assets-fileattachment/trunk/application.xml =================================================================== --- ccm-cms-assets-fileattachment/trunk/application.xml 2005-08-18 15:56:21 UTC (rev 717) +++ ccm-cms-assets-fileattachment/trunk/application.xml 2005-08-18 16:22:21 UTC (rev 718) @@ -3,7 +3,7 @@ name="ccm-cms-assets-fileattachment" prettyName="Red Hat CMS Content Asset File Attachment" version="6.1.2" - release="2" + release="3" webapp="ROOT"> <ccm:dependencies> <ccm:requires name="ccm-core" version="6.1.1" relation="ge"/> Modified: ccm-cms-assets-fileattachment/trunk/src/com/arsdigita/cms/contentassets/ui/FileAttachmentModelBuilder.java =================================================================== --- ccm-cms-assets-fileattachment/trunk/src/com/arsdigita/cms/contentassets/ui/FileAttachmentModelBuilder.java 2005-08-18 15:56:21 UTC (rev 717) +++ ccm-cms-assets-fileattachment/trunk/src/com/arsdigita/cms/contentassets/ui/FileAttachmentModelBuilder.java 2005-08-18 16:22:21 UTC (rev 718) @@ -57,7 +57,7 @@ **/ public DataCollection getDataCollection(PageState state) { ContentItem item = (ContentItem) m_model.getSelectedObject(state); - + return FileAttachment.getAttachments(item); } @@ -110,16 +110,9 @@ * the current row **/ public Object getElementAt(int columnIndex) { - switch (columnIndex) { - case 0: - return ""; - case 1: + if (columnIndex == 4) { return _file.getDescription(); - - case 2: - return ""; - - default: + } else { return null; } } Added: ccm-cms-assets-fileattachment/trunk/src/com/arsdigita/cms/contentassets/ui/FileAttachmentSelectionModel.java =================================================================== --- ccm-cms-assets-fileattachment/trunk/src/com/arsdigita/cms/contentassets/ui/FileAttachmentSelectionModel.java 2005-08-18 15:56:21 UTC (rev 717) +++ ccm-cms-assets-fileattachment/trunk/src/com/arsdigita/cms/contentassets/ui/FileAttachmentSelectionModel.java 2005-08-18 16:22:21 UTC (rev 718) @@ -0,0 +1,63 @@ +/* + * 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 com.arsdigita.cms.contentassets.ui; + +import com.arsdigita.bebop.PageState; +import com.arsdigita.bebop.parameters.BigDecimalParameter; +import com.arsdigita.cms.contentassets.FileAttachment; +import com.arsdigita.kernel.ui.ACSObjectSelectionModel; + +/** + * SelectionModel to track the current Link object for view/edit purposes. + */ +public class FileAttachmentSelectionModel extends ACSObjectSelectionModel { + + public FileAttachmentSelectionModel(BigDecimalParameter param) { + super(FileAttachment.class.getName(), + FileAttachment.BASE_DATA_OBJECT_TYPE, + param); + } + + /** + * Construct a new <code>FileAttachmentSelectionModel</code> + * + * @param itemClass The name of the Java class which represents + * the content item. Must be a subclass of Link. In + * addition, the class must have a constructor with a single + * OID parameter. + * @param objectType The name of the persistence metadata object type + * which represents the content item. In practice, will often be + * the same as the itemClass. + * @param parameter The state parameter which should be used by this item + */ + public FileAttachmentSelectionModel(String itemClass, String objectType, + BigDecimalParameter parameter) { + super(itemClass, objectType, parameter); + } + + /** + * Returns the currently-selected Link + * + * @param state the PageState for the current request. + * @return The current Link + */ + public FileAttachment getSelectedFileAttachment(PageState state) { + return (FileAttachment)getSelectedObject(state); + } +} Property changes on: ccm-cms-assets-fileattachment/trunk/src/com/arsdigita/cms/contentassets/ui/FileAttachmentSelectionModel.java ___________________________________________________________________ Name: svn:keywords + Id Author URL Modified: ccm-cms-assets-fileattachment/trunk/src/com/arsdigita/cms/contentassets/ui/FileAttachmentsStep.java =================================================================== --- ccm-cms-assets-fileattachment/trunk/src/com/arsdigita/cms/contentassets/ui/FileAttachmentsStep.java 2005-08-18 15:56:21 UTC (rev 717) +++ ccm-cms-assets-fileattachment/trunk/src/com/arsdigita/cms/contentassets/ui/FileAttachmentsStep.java 2005-08-18 16:22:21 UTC (rev 718) @@ -14,12 +14,25 @@ */ package com.arsdigita.cms.contentassets.ui; +import com.arsdigita.bebop.ColumnPanel; +import com.arsdigita.bebop.Form; +import com.arsdigita.bebop.FormData; +import com.arsdigita.bebop.FormProcessException; +import com.arsdigita.bebop.FormSection; import com.arsdigita.bebop.Label; import com.arsdigita.bebop.PageState; +import com.arsdigita.bebop.SaveCancelSection; import com.arsdigita.bebop.event.ActionEvent; import com.arsdigita.bebop.event.ActionListener; +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.event.FormValidationListener; import com.arsdigita.bebop.event.PrintEvent; import com.arsdigita.bebop.event.PrintListener; +import com.arsdigita.bebop.form.TextArea; +import com.arsdigita.bebop.parameters.BigDecimalParameter; import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.contentassets.FileAttachment; @@ -27,6 +40,8 @@ import com.arsdigita.cms.ui.SecurityPropertyEditor; import com.arsdigita.cms.ui.authoring.AuthoringKitWizard; import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess; +import com.arsdigita.cms.ui.workflow.WorkflowLockedContainer; +import com.arsdigita.cms.util.GlobalizationUtil; import com.arsdigita.persistence.DataCollection; /** @@ -45,12 +60,15 @@ private FileAttachmentsTable m_fileList; private FileAttachmentUpload m_uploadForm; + private BigDecimalParameter m_fileParam = new BigDecimalParameter("fa"); + private FileAttachmentSelectionModel m_fileModel = new FileAttachmentSelectionModel(m_fileParam); + public FileAttachmentsStep(ItemSelectionModel itemModel,AuthoringKitWizard parent) { super(); m_parent = parent; m_item = itemModel; - m_fileList = new FileAttachmentsTable(m_item); + m_fileList = new FileAttachmentsTable(m_item, m_fileModel); m_display = new CMSContainer(); //Main label Label mainLabel = new Label("This item does not have any associated files."); @@ -78,8 +96,14 @@ add("upload", "Upload a new file", new WorkflowLockedComponentAccess(m_uploadForm, m_item), m_uploadForm.getSaveCancelSection().getCancelButton()); - - + + Form form = new Form("descriptionEdit"); + form.add(new FileDescriptionForm(m_item, m_fileModel)); + + WorkflowLockedContainer edit = new WorkflowLockedContainer(m_item); + edit.add(form); + add(edit); + // Reset the editing when this component becomes visible m_parent.getList().addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { @@ -102,4 +126,124 @@ public ItemSelectionModel getItemSelectionModel() { return m_item; } + + /** + * Form to edit the description of a file attachment. + */ + private class FileDescriptionForm extends FormSection + implements FormInitListener, FormProcessListener, FormValidationListener, FormSubmissionListener { + + private TextArea m_description; + private ItemSelectionModel m_itemModel; + private FileAttachmentSelectionModel m_fileModel; + private SaveCancelSection m_saveCancelSection; + + /** + * Creates a new form to edit the FileAttachment description + * by the item selection model passed in. + * @param itemModel The ItemSelectionModel to use to obtain the + * ContentItem to which this file is attached + * @param file The FileAttachmentSelectionModel to use to obtain the + * FileAttachment to work on + */ + public FileDescriptionForm(ItemSelectionModel itemModel, + FileAttachmentSelectionModel file ) { + super(new ColumnPanel(2)); + m_fileModel = file; + m_itemModel = itemModel; + + addWidgets(); + m_saveCancelSection = new SaveCancelSection(); + add(m_saveCancelSection, ColumnPanel.FULL_WIDTH); + + addInitListener(this); + addValidationListener(this); + addProcessListener(this); + addSubmissionListener(this); + } + + /** + * Adds widgets to the form. + */ + protected void addWidgets() { + m_description = new TextArea("description"); + m_description.setCols(40); + m_description.setRows(5); + add(new Label(GlobalizationUtil. + globalize("cms.contenttypes.ui.description"))); + + add(m_description); + } + + /** + * Submission listener. Handles cancel events. + * + * @param e the FormSectionEvent + */ + public void submitted(FormSectionEvent e) + throws FormProcessException { + if (m_saveCancelSection.getCancelButton().isSelected(e.getPageState())) { + m_fileModel.clearSelection(e.getPageState()); + init(e); + throw new FormProcessException("cancelled"); + } + } + + /** + * Validation listener. + * + * @param event the FormSectionEvent + */ + public void validate(FormSectionEvent event) + throws FormProcessException { + PageState state = event.getPageState(); + FormData data = event.getFormData(); + + String description = (String)m_description.getValue(state); + // not performing any check + } + + + /** + * Init listener. + * + * @param fse the FormSectionEvent + */ + public void init( FormSectionEvent fse ) throws FormProcessException { + FormData data = fse.getFormData(); + PageState state = fse.getPageState(); + if (m_fileModel.isSelected(state)) { + setVisible(state, true); + FileAttachment file = m_fileModel.getSelectedFileAttachment(state); + m_description.setValue(state, file.getDescription()); + } else { + setVisible(state, false); + } + } + + + /** + * Process listener. Edits the file description. + * + * @param fse the FormSectionEvent + */ + public void process( FormSectionEvent fse ) throws FormProcessException { + PageState state = fse.getPageState(); + + // save only if save button was pressed + if ( m_saveCancelSection.getCancelButton().isSelected(state) ) { + // cancel button is selected + m_fileModel.clearSelection(state); + } else { + if (m_fileModel.isSelected(state)) { + FileAttachment file = m_fileModel.getSelectedFileAttachment(state); + file.setDescription( (String) m_description.getValue(state)); + } + } + m_fileModel.clearSelection(state); + init(fse); + } + + } + } Modified: ccm-cms-assets-fileattachment/trunk/src/com/arsdigita/cms/contentassets/ui/FileAttachmentsTable.java =================================================================== --- ccm-cms-assets-fileattachment/trunk/src/com/arsdigita/cms/contentassets/ui/FileAttachmentsTable.java 2005-08-18 15:56:21 UTC (rev 717) +++ ccm-cms-assets-fileattachment/trunk/src/com/arsdigita/cms/contentassets/ui/FileAttachmentsTable.java 2005-08-18 16:22:21 UTC (rev 718) @@ -17,6 +17,7 @@ import com.arsdigita.bebop.Component; import com.arsdigita.bebop.ControlLink; import com.arsdigita.bebop.Link; +import com.arsdigita.bebop.Label; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.RequestLocal; import com.arsdigita.bebop.SimpleContainer; @@ -43,22 +44,27 @@ public class FileAttachmentsTable extends Table { private static final Logger s_log = Logger.getLogger(FileAttachmentsTable.class); - public static final String[] s_tableHeaders = {"File", "Description", " ", " ", " "}; + public static final String[] s_tableHeaders = {"File", " ", " ", " ", "Description", " "}; private static final String DELETE_EVENT = "delete"; private static final String UP_EVENT = "up"; private static final String DOWN_EVENT = "down"; + private static final String EDIT_EVENT = "edit"; private ItemSelectionModel m_model; + private FileAttachmentSelectionModel m_fileModel; private RequestLocal m_size; private RequestLocal m_editor; - public FileAttachmentsTable(ItemSelectionModel model) { + public FileAttachmentsTable(ItemSelectionModel model, FileAttachmentSelectionModel fileModel) { super(new FileAttachmentModelBuilder(model), s_tableHeaders); + m_model = model; + m_fileModel = fileModel; + setRowSelectionModel(m_fileModel); getColumn(0).setCellRenderer(new FileLinkCellRenderer()); - getColumn(2).setCellRenderer(new MyCellRenderer()); - getColumn(3).setCellRenderer(new MoveUpLinkCellRenderer()); - getColumn(4).setCellRenderer(new MoveDownLinkCellRenderer()); - m_model = model; + getColumn(1).setCellRenderer(new MoveUpLinkCellRenderer()); + getColumn(2).setCellRenderer(new MoveDownLinkCellRenderer()); + getColumn(3).setCellRenderer(new EditLinkCellRenderer()); + getColumn(5).setCellRenderer(new DeleteLinkCellRenderer()); m_size = new RequestLocal(); m_editor = new RequestLocal() { public Object initialValue(PageState state) { @@ -80,11 +86,11 @@ /* Code responding to events*/ public void respond(PageState state) throws ServletException { String event = state.getControlEventName(); + String value = state.getControlEventValue(); + m_fileModel.clearSelection(state); if (Boolean.TRUE.equals(m_editor.get(state))) { if (DELETE_EVENT.equals(event)) { - String value = state.getControlEventValue(); - try { FileAttachment attachment = new FileAttachment(new BigDecimal(value)); @@ -93,7 +99,6 @@ e.printStackTrace(); } } else if (UP_EVENT.equals(event)) { - String value = state.getControlEventValue(); try { FileAttachment attachment = new FileAttachment(new BigDecimal(value)); @@ -102,7 +107,6 @@ e.printStackTrace(); } } else if (DOWN_EVENT.equals(event)) { - String value = state.getControlEventValue(); try { FileAttachment attachment = new FileAttachment(new BigDecimal(value)); @@ -110,12 +114,19 @@ } catch (DataObjectNotFoundException e) { e.printStackTrace(); } + } else if (EDIT_EVENT.equals(event)) { + try { + // FileAttachment attachment = new FileAttachment(new BigDecimal(value)); + m_fileModel.setSelectedKey(state, new BigDecimal(value)); + } catch (DataObjectNotFoundException e) { + e.printStackTrace(); + } } } } - private class MyCellRenderer implements TableCellRenderer { + private class DeleteLinkCellRenderer implements TableCellRenderer { public Component getComponent(final Table table, PageState state, Object value, @@ -141,6 +152,37 @@ } + private class EditLinkCellRenderer implements TableCellRenderer { + public Component getComponent(final Table table, + PageState state, + Object value, + boolean isSelected, + Object key, + int row, + int column) { + SimpleContainer sc = new SimpleContainer(); + + final String modKey = (String)key; + + if (Boolean.TRUE.equals(m_editor.get(state))) { + if (isSelected) { + sc.add(new Label("edit", Label.BOLD)); + } else { + ControlLink delLink = new ControlLink("edit") { + public void setControlEvent(PageState s) { + s.setControlEvent(table, EDIT_EVENT, modKey); + } + }; + sc.add(delLink); + } + + } + return sc; + + } + } + + private class MoveUpLinkCellRenderer implements TableCellRenderer { public Component getComponent(final Table table, PageState state, |
From: <ap...@vh...> - 2005-08-18 16:47:30
|
Author: apevec Date: 2005-08-18 17:34:42 +0200 (Thu, 18 Aug 2005) New Revision: 716 Modified: ccm-core/trunk/src/com/arsdigita/kernel/KernelConfig.java ccm-core/trunk/src/com/arsdigita/kernel/KernelConfig_parameter.properties ccm-core/trunk/src/com/arsdigita/kernel/security/CredentialLoginModule.java Log: New bolean initialization parameter waf.kernel.secure_login, false by default. When set to true, credentials presented over insecure connection are ignored. Modified: ccm-core/trunk/src/com/arsdigita/kernel/KernelConfig.java =================================================================== --- ccm-core/trunk/src/com/arsdigita/kernel/KernelConfig.java 2005-08-18 12:22:10 UTC (rev 715) +++ ccm-core/trunk/src/com/arsdigita/kernel/KernelConfig.java 2005-08-18 15:34:42 UTC (rev 716) @@ -39,6 +39,7 @@ private final Parameter m_permissions; private final EnumerationParameter m_identifier; // email or "screenName"? private final Parameter m_remember; + private final Parameter m_secureLogin; public KernelConfig() { m_debug = new BooleanParameter @@ -56,11 +57,15 @@ m_remember = new BooleanParameter ("waf.kernel.remember_login", Parameter.REQUIRED, Boolean.TRUE); + + m_secureLogin = new BooleanParameter + ("waf.kernel.secure_login", Parameter.REQUIRED, Boolean.FALSE); register(m_debug); register(m_permissions); register(m_identifier); register(m_remember); + register(m_secureLogin); loadInfo(); } @@ -81,6 +86,10 @@ public final boolean isLoginRemembered() { return ((Boolean) get(m_remember)).booleanValue(); } + + public final boolean isSecureLoginRequired() { + return ((Boolean) get(m_secureLogin)).booleanValue(); + } /** * @deprecated Use Modified: ccm-core/trunk/src/com/arsdigita/kernel/KernelConfig_parameter.properties =================================================================== --- ccm-core/trunk/src/com/arsdigita/kernel/KernelConfig_parameter.properties 2005-08-18 12:22:10 UTC (rev 715) +++ ccm-core/trunk/src/com/arsdigita/kernel/KernelConfig_parameter.properties 2005-08-18 15:34:42 UTC (rev 716) @@ -14,3 +14,7 @@ waf.kernel.remember_login.purpose=Determines whether the "remember login" feature is enabled or disabled by default waf.kernel.remember_login.example=true waf.kernel.remember_login.format=true|false +waf.kernel.secure_login.title=Require secure login +waf.kernel.secure_login.purpose=Accept only credentials presented over secure connection +waf.kernel.secure_login.example=true +waf.kernel.secure_login.format=true|false Modified: ccm-core/trunk/src/com/arsdigita/kernel/security/CredentialLoginModule.java =================================================================== --- ccm-core/trunk/src/com/arsdigita/kernel/security/CredentialLoginModule.java 2005-08-18 12:22:10 UTC (rev 715) +++ ccm-core/trunk/src/com/arsdigita/kernel/security/CredentialLoginModule.java 2005-08-18 15:34:42 UTC (rev 716) @@ -18,14 +18,12 @@ */ package com.arsdigita.kernel.security; -import com.arsdigita.kernel.security.HTTPResponseCallback; -import com.arsdigita.kernel.security.LifetimeCallback; -import com.arsdigita.kernel.security.Credential; import java.io.IOException; import java.math.BigDecimal; import java.util.Map; import java.util.NoSuchElementException; import java.util.Set; + import javax.security.auth.Subject; import javax.security.auth.callback.Callback; import javax.security.auth.callback.CallbackHandler; @@ -33,10 +31,13 @@ import javax.security.auth.login.FailedLoginException; import javax.security.auth.login.LoginException; import javax.security.auth.spi.LoginModule; +import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpServletRequest; + import org.apache.log4j.Logger; +import com.arsdigita.kernel.Kernel; + /** * Loads an ID from a credential stored in the current HTTP request (for * example, cookie or URL parameter). If the credential is invalid but the @@ -130,6 +131,9 @@ **/ public boolean login() throws LoginException { s_log.debug("START login"); + if (Kernel.getConfig().isSecureLoginRequired() && !isSecure()) { + return false; + } loadCredential(); s_log.debug("END login"); return true; |
From: <ap...@vh...> - 2005-08-17 14:47:56
|
Author: apevec Date: 2005-08-17 16:39:50 +0200 (Wed, 17 Aug 2005) New Revision: 709 Modified: tools/trunk/tools/t/010-Util.t Log: version/release is not a number Modified: tools/trunk/tools/t/010-Util.t =================================================================== --- tools/trunk/tools/t/010-Util.t 2005-08-17 10:10:11 UTC (rev 708) +++ tools/trunk/tools/t/010-Util.t 2005-08-17 14:39:50 UTC (rev 709) @@ -32,10 +32,10 @@ my $expected = shift; my @result = CCM::Util::versionSort(@$input); - if ($#result == $#{$expected}) { + if ($#result eq $#{$expected}) { $good = 1; foreach (0..$#result) { - if ($result[$_] != $expected->[$_]) { + if ($result[$_] ne $expected->[$_]) { $good = 0; last; } |
From: <cl...@vh...> - 2005-08-17 10:18:15
|
Author: clasohm Date: 2005-08-17 12:10:11 +0200 (Wed, 17 Aug 2005) New Revision: 708 Added: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/admin/ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/admin/BulkDeletionConfirm.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/admin/BulkDeletionForm.java contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/admin/ contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/admin/deleted.jsp contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/admin/index.jsp Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationResources.properties contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAlertForm.java contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/alert-new.jsp contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/alert.jsp contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/index.jsp Log: added bulk deletion of email alerts Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java 2005-08-17 10:03:23 UTC (rev 707) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java 2005-08-17 10:10:11 UTC (rev 708) @@ -207,6 +207,20 @@ return result; } + public static ConsultationAlert findByEmail(String email) { + DataCollection alerts = + SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE); + alerts.addEqualsFilter(EMAIL, email); + + ConsultationAlert alert = null; + if (alerts.next()) { + alert = new ConsultationAlert(alerts.getDataObject()); + alerts.close(); + } + + return alert; + } + /** * Deletes alert requests which have not been confirmed, and which * are older than 24h. Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationResources.properties =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationResources.properties 2005-08-17 10:03:23 UTC (rev 707) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationResources.properties 2005-08-17 10:10:11 UTC (rev 708) @@ -191,3 +191,14 @@ To view other content on {2}, please visit us at\n\ \n\ {3} + +bulk_deletion=Bulk Deletion +email_addresses=Email Addresses + +# {0}: count of deleted Consultation alerts +alerts_bulk_deleted=<p>{0} alert(s) have been deleted.</p> + +count_missing=\ +<p>The URL does not contain the count of deleted alerts.</p>\ +\ +<p>This is most likely an internal error.</p> Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAlertForm.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAlertForm.java 2005-08-17 10:03:23 UTC (rev 707) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAlertForm.java 2005-08-17 10:10:11 UTC (rev 708) @@ -18,14 +18,10 @@ */ package com.arsdigita.camden.cms.contenttypes.ui; -import java.lang.reflect.Array; import java.util.Date; import javax.mail.MessagingException; -import javax.mail.SendFailedException; -import org.apache.log4j.Logger; - import com.arsdigita.bebop.FormData; import com.arsdigita.bebop.FormProcessException; import com.arsdigita.bebop.Label; @@ -38,7 +34,6 @@ import com.arsdigita.bebop.parameters.EmailValidationListener; import com.arsdigita.bebop.parameters.ParameterData; import com.arsdigita.camden.cms.contenttypes.ConsultationAlert; -import com.arsdigita.camden.cms.contenttypes.ConsultationConfig; import com.arsdigita.camden.cms.contenttypes.ConsultationUtil; import com.arsdigita.cms.ui.BaseForm; import com.arsdigita.globalization.GlobalizedMessage; @@ -66,8 +61,7 @@ public final static String FORM_NAME = "alert"; public ConsultationAlertForm() { - this(ConsultationAlertForm.FORM_NAME, - ConsultationUtil.globalize("new_alert")); + this(FORM_NAME, ConsultationUtil.globalize("new_alert")); } public ConsultationAlertForm(String name, GlobalizedMessage heading) { @@ -157,10 +151,13 @@ ConsultationAlert alert; if (alerts.next()) { - // Update the creation date of the request, so our - // database cleanup doesn't delete it too soon. + // Update the creation date of the request, so + // ConsultationAlert.purgeUnconfirmed() does not delete it + // too soon. alert = new ConsultationAlert(alerts.getDataObject()); alert.setCreationDate(new Date()); + + alerts.close(); } else alert = new ConsultationAlert(); Added: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/admin/BulkDeletionConfirm.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/admin/BulkDeletionConfirm.java 2005-08-17 10:03:23 UTC (rev 707) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/admin/BulkDeletionConfirm.java 2005-08-17 10:10:11 UTC (rev 708) @@ -0,0 +1,39 @@ +package com.arsdigita.camden.cms.contenttypes.ui.admin; + +import java.math.BigDecimal; +import java.util.Map; + +import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.PageState; +import com.arsdigita.bebop.event.PrintEvent; +import com.arsdigita.bebop.event.PrintListener; +import com.arsdigita.camden.cms.contenttypes.ConsultationAlert; +import com.arsdigita.camden.cms.contenttypes.ConsultationUtil; +import com.arsdigita.domain.DataObjectNotFoundException; + +public class BulkDeletionConfirm extends Label { + + public BulkDeletionConfirm() { + setOutputEscaping(false); + + addPrintListener(new PrintListener() { + public void prepare(PrintEvent e) { + PageState state = e.getPageState(); + Label target = (Label)e.getTarget(); + + Map parameters = state.getRequest().getParameterMap(); + String[] counts = + (String[])parameters.get(BulkDeletionForm.DELETION_COUNT); + + if (counts != null && counts.length > 0) { + String[] args = {counts[0]}; + target.setLabel(ConsultationUtil.globalize("alerts_bulk_deleted", args)); + return; + } + + target.setLabel(ConsultationUtil.globalize("count_missing")); + } + }); + } + +} Added: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/admin/BulkDeletionForm.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/admin/BulkDeletionForm.java 2005-08-17 10:03:23 UTC (rev 707) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/admin/BulkDeletionForm.java 2005-08-17 10:10:11 UTC (rev 708) @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2005 Red Hat Inc. All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +package com.arsdigita.camden.cms.contenttypes.ui.admin; + +import org.apache.oro.text.perl.Perl5Util; + +import com.arsdigita.bebop.FormData; +import com.arsdigita.bebop.FormProcessException; +import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.PageState; +import com.arsdigita.bebop.event.FormProcessListener; +import com.arsdigita.bebop.event.FormSectionEvent; +import com.arsdigita.bebop.form.Submit; +import com.arsdigita.bebop.form.TextArea; +import com.arsdigita.bebop.parameters.TrimmedStringParameter; +import com.arsdigita.camden.cms.contenttypes.ConsultationAlert; +import com.arsdigita.camden.cms.contenttypes.ConsultationUtil; +import com.arsdigita.cms.ui.BaseForm; +import com.arsdigita.cms.util.GlobalizationUtil; +import com.arsdigita.globalization.GlobalizedMessage; +import com.arsdigita.web.ParameterMap; +import com.arsdigita.web.RedirectSignal; +import com.arsdigita.web.URL; + +public class BulkDeletionForm + extends BaseForm implements FormProcessListener { + + public final static String FORM_NAME = "bulkDeletion"; + public final static String EMAIL_ADDRESSES = "emailAddresses"; + public final static String DELETION_COUNT = "deletionCount"; + public final static String DELETED_PATH = "/admin/deleted.jsp"; + + public BulkDeletionForm() { + this(FORM_NAME, ConsultationUtil.globalize("bulk_deletion")); + } + + public BulkDeletionForm(String name, GlobalizedMessage heading) { + super(name, heading); + + addWidgets(); + } + + public BulkDeletionForm(String name, Label heading) { + super(name, heading); + + addWidgets(); + } + + private void addWidgets() { + Label label = new Label(ConsultationUtil.globalize("email_addresses")); + TextArea emailAddressesWidget = new TextArea(new TrimmedStringParameter(EMAIL_ADDRESSES)); + emailAddressesWidget.setCols(72); + emailAddressesWidget.setRows(10); + addField(label, emailAddressesWidget); + + addAction(new Submit(GlobalizationUtil.globalize("cms.ui.delete"))); + addAction(new Cancel()); + + addProcessListener(this); + } + + public void process(FormSectionEvent fse) throws FormProcessException { + FormData data = fse.getFormData(); + PageState state = fse.getPageState(); + + if (isCancelled(state)) { + URL target = URL.here(state.getRequest(), null); + throw new RedirectSignal(target, false); + } + + Perl5Util re = new Perl5Util(); + String[] emails = data.getString(EMAIL_ADDRESSES).split("\\s+"); + int deletionCount = 0; + for (int i = 0; i < emails.length; i++) { + if (!re.match("/^[^@<>\"\\t ]+@[^@<>\".\\t]+([.][^@<>\".\\n ]+)+$/", emails[i])) + continue; + + ConsultationAlert alert = ConsultationAlert.findByEmail(emails[i]); + if (alert == null) + continue; + + alert.delete(); + deletionCount++; + } + + ParameterMap parameters = new ParameterMap(); + parameters.setParameter(DELETION_COUNT, String.valueOf(deletionCount)); + URL target = + URL.here(state.getRequest(), DELETED_PATH, parameters); + throw new RedirectSignal(target, true); + } + +} Added: contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/admin/deleted.jsp =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/admin/deleted.jsp 2005-08-17 10:03:23 UTC (rev 707) +++ contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/admin/deleted.jsp 2005-08-17 10:10:11 UTC (rev 708) @@ -0,0 +1,36 @@ +<jsp:root + xmlns:jsp="http://java.sun.com/JSP/Page" + xmlns:define="/WEB-INF/bebop-define.tld" + xmlns:show="/WEB-INF/bebop-show.tld" + version="1.2"> + + <jsp:directive.page import="com.arsdigita.dispatcher.DispatcherHelper"/> + <jsp:directive.page import="com.arsdigita.camden.cms.contenttypes.ui.ConsultationsNavigationModel" /> + <jsp:directive.page import="com.arsdigita.camden.cms.contenttypes.ui.admin.BulkDeletionConfirm" /> + <jsp:directive.page import="com.arsdigita.london.navigation.Navigation"/> + <jsp:directive.page import="com.arsdigita.london.navigation.NavigationModel"/> + + <jsp:scriptlet> + DispatcherHelper.cacheDisable(response); + </jsp:scriptlet> + + <define:page name="alertConfirmPage" application="navigation" title="Confirm Consultation Alert" cache="false"> + <define:component name="greetingItem" + classname="com.arsdigita.london.navigation.ui.GreetingItem"/> + <define:component name="categoryPath" + classname="com.arsdigita.london.navigation.ui.category.Path"/> + <define:component name="categoryMenu" + classname="com.arsdigita.london.navigation.ui.category.Menu"/> + <define:component name="alertConfirm" + classname="com.arsdigita.camden.cms.contenttypes.ui.admin.BulkDeletionConfirm"/> + + <jsp:scriptlet> + NavigationModel navModel = ConsultationsNavigationModel.retrieve(); + ((com.arsdigita.london.navigation.ui.GreetingItem)greetingItem).setModel(navModel); + ((com.arsdigita.london.navigation.ui.category.Path)categoryPath).setModel(navModel); + ((com.arsdigita.london.navigation.ui.category.Menu)categoryMenu).setModel(navModel); + </jsp:scriptlet> + </define:page> + + <show:all/> +</jsp:root> Added: contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/admin/index.jsp =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/admin/index.jsp 2005-08-17 10:03:23 UTC (rev 707) +++ contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/admin/index.jsp 2005-08-17 10:10:11 UTC (rev 708) @@ -0,0 +1,44 @@ +<jsp:root + xmlns:jsp="http://java.sun.com/JSP/Page" + xmlns:define="/WEB-INF/bebop-define.tld" + xmlns:show="/WEB-INF/bebop-show.tld" + version="1.2"> + + <jsp:directive.page import="com.arsdigita.dispatcher.DispatcherHelper"/> + <jsp:directive.page import="com.arsdigita.toolbox.ui.ApplicationAuthenticationListener"/> + <jsp:directive.page import="com.arsdigita.camden.cms.contenttypes.ui.ConsultationsNavigationModel" /> + <jsp:directive.page import="com.arsdigita.camden.cms.contenttypes.ui.admin.BulkDeletionForm" /> + <jsp:directive.page import="com.arsdigita.london.navigation.Navigation"/> + <jsp:directive.page import="com.arsdigita.london.navigation.NavigationModel"/> + + <jsp:scriptlet> + long age = Navigation.getConfig().getIndexPageCacheLifetime(); + if (age == 0) { + DispatcherHelper.cacheDisable(response); + } else { + DispatcherHelper.cacheForWorld(response, (int)age); + } + </jsp:scriptlet> + + <define:page name="bulkDeletionPage" application="navigation" title="Bulk Delete Email Alerts" cache="false"> + <define:component name="greetingItem" + classname="com.arsdigita.london.navigation.ui.GreetingItem"/> + <define:component name="categoryPath" + classname="com.arsdigita.london.navigation.ui.category.Path"/> + <define:component name="categoryMenu" + classname="com.arsdigita.london.navigation.ui.category.Menu"/> + <define:component name="alertConfirm" + classname="com.arsdigita.camden.cms.contenttypes.ui.admin.BulkDeletionForm"/> + + <jsp:scriptlet> + bulkDeletionPage.addRequestListener(new ApplicationAuthenticationListener()); + + NavigationModel navModel = ConsultationsNavigationModel.retrieve(); + ((com.arsdigita.london.navigation.ui.GreetingItem)greetingItem).setModel(navModel); + ((com.arsdigita.london.navigation.ui.category.Path)categoryPath).setModel(navModel); + ((com.arsdigita.london.navigation.ui.category.Menu)categoryMenu).setModel(navModel); + </jsp:scriptlet> + </define:page> + + <show:all/> +</jsp:root> Modified: contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/alert-new.jsp =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/alert-new.jsp 2005-08-17 10:03:23 UTC (rev 707) +++ contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/alert-new.jsp 2005-08-17 10:10:11 UTC (rev 708) @@ -18,7 +18,7 @@ } </jsp:scriptlet> - <define:page name="alertNewPage" application="navigation" title="Set Consultation Alert" cache="false"> + <define:page name="alertNewPage" application="navigation" title="Set Consultation Alert" cache="true"> <define:component name="greetingItem" classname="com.arsdigita.london.navigation.ui.GreetingItem"/> <define:component name="categoryPath" Modified: contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/alert.jsp =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/alert.jsp 2005-08-17 10:03:23 UTC (rev 707) +++ contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/alert.jsp 2005-08-17 10:10:11 UTC (rev 708) @@ -11,15 +11,10 @@ <jsp:directive.page import="com.arsdigita.london.navigation.NavigationModel"/> <jsp:scriptlet> - long age = Navigation.getConfig().getIndexPageCacheLifetime(); - if (age == 0) { - DispatcherHelper.cacheDisable(response); - } else { - DispatcherHelper.cacheForWorld(response, (int)age); - } + DispatcherHelper.cacheDisable(response); </jsp:scriptlet> - <define:page name="alertConfirmPage" application="navigation" title="Confirm Consultation Alert" cache="false"> + <define:page name="alertConfirmPage" application="navigation" title="Confirm Consultation Alert" cache="true"> <define:component name="greetingItem" classname="com.arsdigita.london.navigation.ui.GreetingItem"/> <define:component name="categoryPath" Modified: contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/index.jsp =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/index.jsp 2005-08-17 10:03:23 UTC (rev 707) +++ contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/index.jsp 2005-08-17 10:10:11 UTC (rev 708) @@ -22,7 +22,7 @@ } </jsp:scriptlet> - <define:page name="consultationsIndexPage" application="navigation" title="Consultations" cache="false"> + <define:page name="consultationsIndexPage" application="navigation" title="Consultations" cache="true"> <define:component name="greetingItem" classname="com.arsdigita.london.navigation.ui.GreetingItem"/> <define:component name="categoryPath" |
From: <ap...@vh...> - 2005-08-17 10:11:32
|
Author: apevec Date: 2005-08-17 12:03:23 +0200 (Wed, 17 Aug 2005) New Revision: 707 Modified: ccm-core/trunk/src/com/arsdigita/kernel/security/DefaultSecurityHelper.java Log: workaround to avoid redirect loop when accessing /ccm/register via SSL Modified: ccm-core/trunk/src/com/arsdigita/kernel/security/DefaultSecurityHelper.java =================================================================== --- ccm-core/trunk/src/com/arsdigita/kernel/security/DefaultSecurityHelper.java 2005-08-17 00:02:29 UTC (rev 706) +++ ccm-core/trunk/src/com/arsdigita/kernel/security/DefaultSecurityHelper.java 2005-08-17 10:03:23 UTC (rev 707) @@ -57,19 +57,24 @@ * bad-password page), <code>false</code> otherwise. **/ public boolean requiresLogin(HttpServletRequest req) { - // don't require login if request not secure - if (!isSecure(req)) { - return false; - } - // don't require login if page on allowed list - String url = req.getRequestURI(); - for (int i = 0; i < allowedPages.length; i++) { - if (url.equals(Initializer.getFullURL(allowedPages[i], req))) { - return false; - } - } - // otherwise require login - return true; + // XXX workaround, code below is broken anyway, + // it doesn't take into account dispatcher prefix ( /ccm ) + return false; +// +// // don't require login if request not secure +// if (!isSecure(req)) { +// return false; +// } +// // don't require login if page on allowed list +// String url = req.getRequestURI(); +// for (int i = 0; i < allowedPages.length; i++) { +// String allowed = Initializer.getFullURL(allowedPages[i], req); +// if (url.equals(allowed)) { +// return false; +// } +// } +// // otherwise require login +// return true; } /** |
From: <ap...@vh...> - 2005-08-17 00:10:43
|
Author: apevec Date: 2005-08-17 02:02:29 +0200 (Wed, 17 Aug 2005) New Revision: 706 Added: ccm-core/trunk/src/com/arsdigita/web/SecureFilter.java Modified: ccm-core/trunk/src/com/arsdigita/web/WebConfig.java ccm-core/trunk/src/com/arsdigita/web/WebConfig_parameter.properties Log: Require SSL for a list of URLs. Similar to <transport-guarantee> in web.xml - only as ccm parameter, (also redirect to secure doesn't work with Resin2 when using non-default SSL port) Two new CCM parameters are added: waf.web.secure_server=localhost:8443 - HttpHost type, like waf.web.server, only for SSL port waf.web.secure_required=/ccm/register/,/ccm/admin/ - list of URLs to be accessed only via SSL Added: ccm-core/trunk/src/com/arsdigita/web/SecureFilter.java =================================================================== --- ccm-core/trunk/src/com/arsdigita/web/SecureFilter.java 2005-08-16 15:58:45 UTC (rev 705) +++ ccm-core/trunk/src/com/arsdigita/web/SecureFilter.java 2005-08-17 00:02:29 UTC (rev 706) @@ -0,0 +1,61 @@ +package com.arsdigita.web; + +import java.io.IOException; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import com.arsdigita.util.servlet.HttpHost; + +/** + * Require secure connection for a set of URLs. + * Redirect to the same path but take the host:port part from "waf.web.secure_server". + * + * @author Alan Pevec + */ +public class SecureFilter implements Filter { + + public void init(FilterConfig filterConfig) throws ServletException { + } + + public void doFilter(ServletRequest request, ServletResponse response, + FilterChain filterChain) throws IOException, ServletException { + + HttpServletRequest hreq = (HttpServletRequest) request; + HttpServletResponse hresp = (HttpServletResponse) response; + String uri = hreq.getRequestURI(); + WebConfig conf = Web.getConfig(); + if (conf.isSecureRequired(uri) && !request.isSecure()) { + StringBuffer secureEquivalent = new StringBuffer("https://"); + HttpHost secureServer = conf.getSecureServer(); + secureEquivalent.append(secureServer.getName()); + int securePort = secureServer.getPort(); + if (securePort != 443) { + secureEquivalent + .append(':') + .append(securePort); + } + if (uri != null) { + secureEquivalent.append(uri); + } + String queryString = hreq.getQueryString(); + if (queryString != null) { + secureEquivalent.append('?') + .append(queryString); + } + hresp.sendRedirect(secureEquivalent.toString()); + } else { + filterChain.doFilter(request, response); + } + } + + public void destroy() { + } + +} Modified: ccm-core/trunk/src/com/arsdigita/web/WebConfig.java =================================================================== --- ccm-core/trunk/src/com/arsdigita/web/WebConfig.java 2005-08-16 15:58:45 UTC (rev 705) +++ ccm-core/trunk/src/com/arsdigita/web/WebConfig.java 2005-08-17 00:02:29 UTC (rev 706) @@ -25,6 +25,7 @@ import com.arsdigita.util.parameter.Parameter; import com.arsdigita.util.parameter.ParameterError; import com.arsdigita.util.parameter.SingletonParameter; +import com.arsdigita.util.parameter.StringArrayParameter; import com.arsdigita.util.parameter.StringParameter; import com.arsdigita.util.servlet.HttpHost; import com.arsdigita.util.servlet.HttpHostParameter; @@ -52,12 +53,14 @@ private final Parameter m_scheme; private final Parameter m_server; + private final Parameter m_secureServer; private final Parameter m_host; private final Parameter m_site; private final Parameter m_context; private final Parameter m_servlet; private final Parameter m_policy; private final Parameter m_resolver; + private final Parameter m_secureRequired; public WebConfig() { m_scheme = new DefaultSchemeParameter @@ -65,6 +68,9 @@ m_server = new HttpHostParameter("waf.web.server"); + m_secureServer = new HttpHostParameter + ("waf.web.secure_server", Parameter.OPTIONAL, null); + m_host = new HttpHostParameter ("waf.web.host", Parameter.OPTIONAL, null) { public final Object getDefaultValue() { @@ -99,14 +105,19 @@ Parameter.OPTIONAL, new DefaultApplicationFileResolver()); + m_secureRequired = new StringArrayParameter( + "waf.web.secure_required", Parameter.OPTIONAL, null); + register(m_scheme); register(m_server); + register(m_secureServer); register(m_host); register(m_site); register(m_context); register(m_servlet); register(m_policy); register(m_resolver); + register(m_secureRequired); loadInfo(); } @@ -119,6 +130,22 @@ return (HttpHost) get(m_server); } + public final HttpHost getSecureServer() { + return (HttpHost) get(m_secureServer); + } + + public final boolean isSecureRequired(String uri) { + String[] secured = (String[])get(m_secureRequired); + if (secured != null) { + for (int i=0, n=secured.length; i<n; i++) { + if (uri.startsWith(secured[i])) { + return true; + } + } + } + return false; + } + public final HttpHost getHost() { return (HttpHost) get(m_host); } Modified: ccm-core/trunk/src/com/arsdigita/web/WebConfig_parameter.properties =================================================================== --- ccm-core/trunk/src/com/arsdigita/web/WebConfig_parameter.properties 2005-08-16 15:58:45 UTC (rev 705) +++ ccm-core/trunk/src/com/arsdigita/web/WebConfig_parameter.properties 2005-08-17 00:02:29 UTC (rev 706) @@ -26,7 +26,15 @@ waf.web.server.purpose=Sets the hostname and port that users of a site will see in URLs generated by WAF waf.web.server.example=example.com:80 waf.web.server.format=[server hostname]:[port number] +waf.web.secure_server.title=Secure server virtual host +waf.web.secure_server.purpose=Sets the hostname and port that users of a site will see in secure URLs generated by WAF +waf.web.secure_server.example=example.com:443 +waf.web.secure_server.format=[server hostname]:[port number] +waf.web.secure_required.title=List of URLs where HTTPS is required +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.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 -waf.web.site_name.format=[string] \ No newline at end of file +waf.web.site_name.format=[string] |
From: <ssk...@vh...> - 2005-08-16 16:06:48
|
Author: sskracic Date: 2005-08-16 17:58:45 +0200 (Tue, 16 Aug 2005) New Revision: 705 Modified: releases/1.0.2/ccm-cms/application.xml releases/1.0.2/ccm-cms/src/com/arsdigita/cms/lifecycle/Scheduler.java releases/1.0.2/ccm-cms/src/com/arsdigita/cms/lifecycle/SchedulerTask.java Log: Backported r704 from trunk, lifecycle timer task should survive database reconnects. Modified: releases/1.0.2/ccm-cms/application.xml =================================================================== --- releases/1.0.2/ccm-cms/application.xml 2005-08-16 15:57:15 UTC (rev 704) +++ releases/1.0.2/ccm-cms/application.xml 2005-08-16 15:58:45 UTC (rev 705) @@ -3,7 +3,7 @@ name="ccm-cms" prettyName="Red Hat CCM Content Management System" version="6.1.1" - release="10" + release="11" webapp="ROOT"> <ccm:dependencies> <ccm:requires name="ccm-core" version="6.1.1" relation="ge"/> Modified: releases/1.0.2/ccm-cms/src/com/arsdigita/cms/lifecycle/Scheduler.java =================================================================== --- releases/1.0.2/ccm-cms/src/com/arsdigita/cms/lifecycle/Scheduler.java 2005-08-16 15:57:15 UTC (rev 704) +++ releases/1.0.2/ccm-cms/src/com/arsdigita/cms/lifecycle/Scheduler.java 2005-08-16 15:58:45 UTC (rev 705) @@ -112,52 +112,59 @@ * Check which begin/end events to fire and then fire them. */ protected static synchronized void checkAndFire() { - Iterator i; - s_running = true; + TransactionContext txn = null; + try { + Iterator i; + s_running = true; - TransactionContext txn = - SessionManager.getSession().getTransactionContext(); + txn = SessionManager.getSession().getTransactionContext(); - // Notes: loop through the query and add the objects to the LinkedList - // then for each object in the LinkedList: - // begin the transaction, - // perform any operations from the listener, - // update the hasBegun or hasEnded column, and - // close the transaction (or abort if there are any errors) + // Notes: loop through the query and add the objects to the LinkedList + // then for each object in the LinkedList: + // begin the transaction, + // perform any operations from the listener, + // update the hasBegun or hasEnded column, and + // close the transaction (or abort if there are any errors) - // Lifecycle Start Events - txn.beginTxn(); - i = getPendingEvents(getLifecycleStart(), - LifecycleEvent.LIFECYCLE, - CYCLE_ID); - txn.commitTxn(); - fireCycleEvents(i, true); + // Lifecycle Start Events + txn.beginTxn(); + i = getPendingEvents(getLifecycleStart(), + LifecycleEvent.LIFECYCLE, + CYCLE_ID); + txn.commitTxn(); + fireCycleEvents(i, true); - // Phase Start Events - txn.beginTxn(); - i = getPendingEvents(getPhaseStart(), - LifecycleEvent.PHASE, - PHASE_ID); - txn.commitTxn(); - firePhaseEvents(i, true); + // Phase Start Events + txn.beginTxn(); + i = getPendingEvents(getPhaseStart(), + LifecycleEvent.PHASE, + PHASE_ID); + txn.commitTxn(); + firePhaseEvents(i, true); - // Phase End Events - txn.beginTxn(); - i = getPendingEvents(getPhaseEnd(), - LifecycleEvent.PHASE, - PHASE_ID); - txn.commitTxn(); - firePhaseEvents(i, false); + // Phase End Events + txn.beginTxn(); + i = getPendingEvents(getPhaseEnd(), + LifecycleEvent.PHASE, + PHASE_ID); + txn.commitTxn(); + firePhaseEvents(i, false); - // Lifecycle End Events - txn.beginTxn(); - i = getPendingEvents(getLifecycleEnd(), - LifecycleEvent.LIFECYCLE, - CYCLE_ID); - txn.commitTxn(); - fireCycleEvents(i, false); + // Lifecycle End Events + txn.beginTxn(); + i = getPendingEvents(getLifecycleEnd(), + LifecycleEvent.LIFECYCLE, + CYCLE_ID); + txn.commitTxn(); + fireCycleEvents(i, false); - s_running = false; + } catch (Throwable t) { + if (txn != null) { + txn.abortTxn(); + } + } finally { + s_running = false; + } } Modified: releases/1.0.2/ccm-cms/src/com/arsdigita/cms/lifecycle/SchedulerTask.java =================================================================== --- releases/1.0.2/ccm-cms/src/com/arsdigita/cms/lifecycle/SchedulerTask.java 2005-08-16 15:57:15 UTC (rev 704) +++ releases/1.0.2/ccm-cms/src/com/arsdigita/cms/lifecycle/SchedulerTask.java 2005-08-16 15:58:45 UTC (rev 705) @@ -41,8 +41,9 @@ try { Scheduler.run(); } catch (Throwable t) { - s_log.error("Unknown error occured. SchedulerTask disabled.", t); - throw new UncheckedWrapperException(t); + s_log.error("Unknown error occured.", t); + // We don't want to rethrow, since the disruption might be temporarily + // (eg. connection to database lost). } } |
From: <ssk...@vh...> - 2005-08-16 16:05:30
|
Author: sskracic Date: 2005-08-16 17:57:15 +0200 (Tue, 16 Aug 2005) New Revision: 704 Modified: ccm-cms/trunk/src/com/arsdigita/cms/lifecycle/Scheduler.java ccm-cms/trunk/src/com/arsdigita/cms/lifecycle/SchedulerTask.java Log: The lifecycle timer task should be able to survive temporary disruptions like eg. database connection lost. Modified: ccm-cms/trunk/src/com/arsdigita/cms/lifecycle/Scheduler.java =================================================================== --- ccm-cms/trunk/src/com/arsdigita/cms/lifecycle/Scheduler.java 2005-08-16 08:51:30 UTC (rev 703) +++ ccm-cms/trunk/src/com/arsdigita/cms/lifecycle/Scheduler.java 2005-08-16 15:57:15 UTC (rev 704) @@ -112,52 +112,59 @@ * Check which begin/end events to fire and then fire them. */ protected static synchronized void checkAndFire() { - Iterator i; - s_running = true; + TransactionContext txn = null; + try { + Iterator i; + s_running = true; - TransactionContext txn = - SessionManager.getSession().getTransactionContext(); + txn = SessionManager.getSession().getTransactionContext(); - // Notes: loop through the query and add the objects to the LinkedList - // then for each object in the LinkedList: - // begin the transaction, - // perform any operations from the listener, - // update the hasBegun or hasEnded column, and - // close the transaction (or abort if there are any errors) + // Notes: loop through the query and add the objects to the LinkedList + // then for each object in the LinkedList: + // begin the transaction, + // perform any operations from the listener, + // update the hasBegun or hasEnded column, and + // close the transaction (or abort if there are any errors) - // Lifecycle Start Events - txn.beginTxn(); - i = getPendingEvents(getLifecycleStart(), - LifecycleEvent.LIFECYCLE, - CYCLE_ID); - txn.commitTxn(); - fireCycleEvents(i, true); + // Lifecycle Start Events + txn.beginTxn(); + i = getPendingEvents(getLifecycleStart(), + LifecycleEvent.LIFECYCLE, + CYCLE_ID); + txn.commitTxn(); + fireCycleEvents(i, true); - // Phase Start Events - txn.beginTxn(); - i = getPendingEvents(getPhaseStart(), - LifecycleEvent.PHASE, - PHASE_ID); - txn.commitTxn(); - firePhaseEvents(i, true); + // Phase Start Events + txn.beginTxn(); + i = getPendingEvents(getPhaseStart(), + LifecycleEvent.PHASE, + PHASE_ID); + txn.commitTxn(); + firePhaseEvents(i, true); - // Phase End Events - txn.beginTxn(); - i = getPendingEvents(getPhaseEnd(), - LifecycleEvent.PHASE, - PHASE_ID); - txn.commitTxn(); - firePhaseEvents(i, false); + // Phase End Events + txn.beginTxn(); + i = getPendingEvents(getPhaseEnd(), + LifecycleEvent.PHASE, + PHASE_ID); + txn.commitTxn(); + firePhaseEvents(i, false); - // Lifecycle End Events - txn.beginTxn(); - i = getPendingEvents(getLifecycleEnd(), - LifecycleEvent.LIFECYCLE, - CYCLE_ID); - txn.commitTxn(); - fireCycleEvents(i, false); + // Lifecycle End Events + txn.beginTxn(); + i = getPendingEvents(getLifecycleEnd(), + LifecycleEvent.LIFECYCLE, + CYCLE_ID); + txn.commitTxn(); + fireCycleEvents(i, false); - s_running = false; + } catch (Throwable t) { + if (txn != null) { + txn.abortTxn(); + } + } finally { + s_running = false; + } } Modified: ccm-cms/trunk/src/com/arsdigita/cms/lifecycle/SchedulerTask.java =================================================================== --- ccm-cms/trunk/src/com/arsdigita/cms/lifecycle/SchedulerTask.java 2005-08-16 08:51:30 UTC (rev 703) +++ ccm-cms/trunk/src/com/arsdigita/cms/lifecycle/SchedulerTask.java 2005-08-16 15:57:15 UTC (rev 704) @@ -41,8 +41,9 @@ try { Scheduler.run(); } catch (Throwable t) { - s_log.error("Unknown error occured. SchedulerTask disabled.", t); - throw new UncheckedWrapperException(t); + s_log.error("Unknown error occured.", t); + // We don't want to rethrow, since the disruption might be temporarily + // (eg. connection to database lost). } } |
From: <cl...@vh...> - 2005-08-16 08:59:29
|
Author: clasohm Date: 2005-08-16 10:51:30 +0200 (Tue, 16 Aug 2005) New Revision: 703 Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java Log: removed debugging code; fixed feedback label; improved email layout Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java 2005-08-15 14:00:23 UTC (rev 702) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java 2005-08-16 08:51:30 UTC (rev 703) @@ -242,8 +242,6 @@ DataQuery items = dbSession.retrieveQuery("com.arsdigita.camden.cms.contenttypes.newConsultations"); - s_log.fatal("catch2"); - if (items.isEmpty()) return; @@ -276,7 +274,7 @@ String methodologyLabel = (String)ConsultationUtil.globalize("methodology").localize(locale); String feedbackLabel = - (String)ConsultationUtil.globalize("feedback").localize(locale); + (String)ConsultationUtil.globalize("results_feedback").localize(locale); String siteURL = URL.root().getURL(); @@ -356,17 +354,19 @@ itemList += "----------\n\n" + urlLabel + ": " + itemURL + "\n\n" + - titleLabel + ": " + title + "\n\n"; + titleLabel + ": " + title + "\n"; if (status != null) - itemList += statusLabel + ": " + status + "\n\n"; + itemList += statusLabel + ": " + status + "\n"; if (!"".equals(purpose)) - itemList += purposeLabel + ":\n" + purpose.trim() + "\n\n"; + itemList += "\n" + purposeLabel + ":\n" + purpose.trim() + "\n"; if (!"".equals(contact)) - itemList += contactLabel + ":\n" + contact.trim() + "\n\n"; + itemList += "\n" + contactLabel + ":\n" + contact.trim() + "\n"; + itemList += "\n"; + if (topic != null) itemList += topicLabel + ": " + topic + "\n"; if (consultationType != null) @@ -387,6 +387,7 @@ itemList += "\n" + methodologyLabel + ":\n" + methodology.trim() + "\n"; if (feedback != null && !"".equals(feedback)) itemList += "\n" + feedbackLabel + ":\n" + feedback.trim() + "\n"; + itemList += "\n"; itemIDs[i++] = id; @@ -435,7 +436,7 @@ String body = header + "\n\n" + itemList + "----------\n\n" + footer; try { - s_log.fatal("About to send mail to " + email + "\nSubject: " + subject + "\nBody:\n" + body); + s_log.debug("About to send mail to " + email + "\nSubject: " + subject + "\nBody:\n" + body); Mail.send(email, from, subject, body); } catch (MessagingException ex) { s_log.warn("Exception while sending consultation alert to " + |
From: <cl...@vh...> - 2005-08-15 14:08:33
|
Author: clasohm Date: 2005-08-15 16:00:23 +0200 (Mon, 15 Aug 2005) New Revision: 702 Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/Consultation.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationResources.properties Log: fixed email alert bugs Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/Consultation.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/Consultation.java 2005-08-15 07:38:17 UTC (rev 701) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/Consultation.java 2005-08-15 14:00:23 UTC (rev 702) @@ -22,14 +22,17 @@ import java.util.Date; import com.arsdigita.cms.ContentPage; +import com.arsdigita.cms.CustomCopy; import com.arsdigita.cms.FileAsset; import com.arsdigita.cms.FileAssetCollection; +import com.arsdigita.cms.ItemCopier; import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.persistence.DataAssociation; import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.OID; +import com.arsdigita.persistence.metadata.Property; import com.arsdigita.util.StringUtils; /** @@ -308,4 +311,18 @@ public String getSearchSummary() { return StringUtils.truncateString(getPurpose(), 200); } + + /** + * Prevent copying of the ALERT_SENT field. We do not need it for live objects, + * and we must not copy it when a draft item is copied. Otherwise, no alerts would + * be sent when the copy is published. + */ + public boolean copyProperty(CustomCopy source, Property property, ItemCopier copier) { + if (property.getName().equals(ALERT_SENT)) { + setAlertSent(Boolean.FALSE); + return true; + } + + return super.copyProperty(source, property, copier); + } } Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java 2005-08-15 07:38:17 UTC (rev 701) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java 2005-08-15 14:00:23 UTC (rev 702) @@ -18,6 +18,7 @@ import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.kernel.ACSObject; import com.arsdigita.kernel.security.Crypto; +import com.arsdigita.london.navigation.Navigation; import com.arsdigita.mail.Mail; import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.DataObject; @@ -240,12 +241,16 @@ // and build the text common to all alerts. DataQuery items = dbSession.retrieveQuery("com.arsdigita.camden.cms.contenttypes.newConsultations"); + + s_log.fatal("catch2"); if (items.isEmpty()) return; String titleLabel = (String)ConsultationUtil.globalize("title").localize(locale); + String urlLabel = + (String)ConsultationUtil.globalize("url").localize(locale); String statusLabel = (String)ConsultationUtil.globalize("status").localize(locale); String purposeLabel = @@ -273,16 +278,27 @@ String feedbackLabel = (String)ConsultationUtil.globalize("feedback").localize(locale); - Formatter dateFormatter = new DateFormatter(); + String siteURL = URL.root().getURL(); + + // Remove the trailing slash, if there is one. + if (siteURL.endsWith("/")) + siteURL = siteURL.substring(0, siteURL.length()-1); + + Formatter dateFormatter = new DateFormatter(); String itemList = ""; BigDecimal[] itemIDs = (BigDecimal[])Array.newInstance(BigDecimal.class, (int)items.size()); int i = 0; while (items.next()) { - String title = (String)items.get(Consultation.TITLE); + String title = (String)items.get(Consultation.TITLE); String purpose = StringUtils.htmlToText((String)items.get(Consultation.PURPOSE)); String contact = StringUtils.htmlToText((String)items.get(Consultation.CONTACT)); + BigDecimal id = (BigDecimal)items.get(Consultation.ID); + String itemURL = + siteURL + + Navigation.redirectURL(new OID(Consultation.BASE_DATA_OBJECT_TYPE, id)); + Integer topicId = (Integer)items.get(Consultation.TOPIC); String topic = null; if (topicId != null) @@ -305,7 +321,7 @@ String geoArea = null; if (geoId != null) geoArea = - (String)Consultation.getPrettyTarget(geoId).localize(locale); + (String)Consultation.getPrettyGeoArea(geoId).localize(locale); Date startDateDate = (Date)items.get(Consultation.START_DATE); String startDate = null; @@ -339,8 +355,9 @@ itemList += "----------\n\n" + + urlLabel + ": " + itemURL + "\n\n" + titleLabel + ": " + title + "\n\n"; - + if (status != null) itemList += statusLabel + ": " + status + "\n\n"; @@ -372,14 +389,13 @@ itemList += "\n" + feedbackLabel + ":\n" + feedback.trim() + "\n"; itemList += "\n"; - itemIDs[i++] = (BigDecimal)items.get(Consultation.ID); + itemIDs[i++] = id; } DataCollection alerts = dbSession.retrieve(BASE_DATA_OBJECT_TYPE); alerts.addEqualsFilter(EMAIL_CONFIRMED, Boolean.TRUE); String siteName = Web.getConfig().getSiteName(); - String siteURL = URL.root().getURL(); String from = ConsultationUtil.getConfig().getAlertsSenderEmail(); String[] args1 = { siteName }; @@ -419,6 +435,7 @@ String body = header + "\n\n" + itemList + "----------\n\n" + footer; try { + s_log.fatal("About to send mail to " + email + "\nSubject: " + subject + "\nBody:\n" + body); Mail.send(email, from, subject, body); } catch (MessagingException ex) { s_log.warn("Exception while sending consultation alert to " + Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationResources.properties =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationResources.properties 2005-08-15 07:38:17 UTC (rev 701) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationResources.properties 2005-08-15 14:00:23 UTC (rev 702) @@ -81,6 +81,7 @@ results_feedback=Results Feedback feedback_documents=Feedback Documents +url=URL title=Title consultations=Consultations |
From: <cl...@vh...> - 2005-08-15 07:46:23
|
Author: clasohm Date: 2005-08-15 09:38:17 +0200 (Mon, 15 Aug 2005) New Revision: 701 Modified: contrib/ccm-ldn-camden-consultation/trunk/sql/ccm-ldn-camden-consultation/oracle-se/upgrade/1.0.0-1.0.1/cam_consultations.sql Log: fixed upgrade script Modified: contrib/ccm-ldn-camden-consultation/trunk/sql/ccm-ldn-camden-consultation/oracle-se/upgrade/1.0.0-1.0.1/cam_consultations.sql =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/sql/ccm-ldn-camden-consultation/oracle-se/upgrade/1.0.0-1.0.1/cam_consultations.sql 2005-08-14 13:50:23 UTC (rev 700) +++ contrib/ccm-ldn-camden-consultation/trunk/sql/ccm-ldn-camden-consultation/oracle-se/upgrade/1.0.0-1.0.1/cam_consultations.sql 2005-08-15 07:38:17 UTC (rev 701) @@ -5,9 +5,9 @@ add constraint cam_consultat_ale_sent_c_eri9a check (alert_sent in ('0', '1')); +update cam_consultations +set alert_sent = '0'; + alter table cam_consultations add constraint cam_consultat_ale_sent_c_nn check (alert_sent is not null); - -update cam_consultations -set alert_sent = '0'; |
Author: clasohm Date: 2005-08-14 15:50:23 +0200 (Sun, 14 Aug 2005) New Revision: 700 Added: contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/alert-trigger.jsp Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/Consultation.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationInitializer.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationResources.properties contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAlertForm.java Log: worked on email alerts Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/Consultation.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/Consultation.java 2005-08-14 10:10:16 UTC (rev 699) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/Consultation.java 2005-08-14 13:50:23 UTC (rev 700) @@ -65,7 +65,7 @@ public static final String ALERT_SENT = "alertSent"; public Consultation() { - super(BASE_DATA_OBJECT_TYPE); + this(BASE_DATA_OBJECT_TYPE); } public Consultation(OID oid) throws DataObjectNotFoundException { Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java 2005-08-14 10:10:16 UTC (rev 699) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java 2005-08-14 13:50:23 UTC (rev 700) @@ -217,12 +217,7 @@ DataCollection alerts = dbSession.retrieve(BASE_DATA_OBJECT_TYPE); alerts.addEqualsFilter(EMAIL_CONFIRMED, Boolean.FALSE); - if (dbType == DbHelper.DB_ORACLE) - alerts.addFilter("creationDate < sysdate - 1"); - else if (dbType == DbHelper.DB_POSTGRES) - alerts.addFilter("creationDate < current_date - 1"); - else - throw new RuntimeException("Unsupported database type"); + alerts.addFilter("creationDate < current_date - 1"); while (alerts.next()) { ConsultationAlert alert = @@ -335,13 +330,15 @@ Boolean statutoryFlag = (Boolean)items.get(Consultation.STATUTORY); String statutory = - (String)GlobalizationUtil.globalize(statutoryFlag.booleanValue() ? "yes" : "no").localize(locale); + (String)GlobalizationUtil. + globalize(statutoryFlag != null && statutoryFlag.booleanValue() ? "yes" : "no"). + localize(locale); String methodology = (String)items.get(Consultation.METHODOLOGY); String feedback = (String)items.get(Consultation.FEEDBACK); itemList += - "\n----------\n\n" + + "----------\n\n" + titleLabel + ": " + title + "\n\n"; if (status != null) @@ -419,7 +416,7 @@ String footer = (String)ConsultationUtil.globalize("alert.footer", args3).localize(locale); - String body = header + "\n" + itemList + "\n" + footer; + String body = header + "\n\n" + itemList + "----------\n\n" + footer; try { Mail.send(email, from, subject, body); Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationInitializer.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationInitializer.java 2005-08-14 10:10:16 UTC (rev 699) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationInitializer.java 2005-08-14 13:50:23 UTC (rev 700) @@ -18,6 +18,7 @@ */ package com.arsdigita.camden.cms.contenttypes; +import java.util.Calendar; import java.util.Date; import java.util.Timer; import java.util.TimerTask; @@ -36,6 +37,10 @@ */ public class ConsultationInitializer extends ContentTypeInitializer { public final static String versionId = "$Id: ConsultationInitializer.java 24 2005-08-02 14:14:14Z clasohm $"; + + // The time at which alerts are sent each day. + public final static int ALERT_HOUR = 5; + public final static int ALERT_MINUTE = 12; public void init(LegacyInitEvent evt) { super.init(evt); @@ -44,8 +49,18 @@ Consultation.BASE_DATA_OBJECT_TYPE, new ConsultationMetadataProvider()); + // Schedule our timer at the given alert time. If we are already past this time, + // the first run is scheduled for tomorrow morning. + Calendar cal = Calendar.getInstance(); + int hourOfDay = cal.get(Calendar.HOUR_OF_DAY); + int minute = cal.get(Calendar.MINUTE); + if (hourOfDay > ALERT_HOUR || hourOfDay == ALERT_HOUR && minute > ALERT_MINUTE) + cal.add(Calendar.DATE, 1); + cal.set(Calendar.HOUR_OF_DAY, ALERT_HOUR); + cal.set(Calendar.MINUTE, ALERT_MINUTE); + Date firstTime = cal.getTime(); + Timer timer = new Timer(true); - Date firstTime = new Date(); timer.scheduleAtFixedRate(new TimerTask() { public void run() { new KernelExcursion() { Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationResources.properties =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationResources.properties 2005-08-14 10:10:16 UTC (rev 699) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationResources.properties 2005-08-14 13:50:23 UTC (rev 700) @@ -182,7 +182,7 @@ You are receiving this email because you asked us to send alerts about\n\ new consultation information on {2} to {0}\n\ \n\ -If you do not want to receive these alerts any more, you can cancel +If you do not want to receive these alerts any more, you can cancel\n\ them with the link below:\n\ \n\ {1}\n\ Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAlertForm.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAlertForm.java 2005-08-14 10:10:16 UTC (rev 699) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAlertForm.java 2005-08-14 13:50:23 UTC (rev 700) @@ -172,7 +172,7 @@ String from = ConsultationUtil.getConfig().getAlertsSenderEmail(); String subject = (String)ConsultationUtil. - globalize("email.subject.confirm_request").localize(); + globalize("confirm_request.subject").localize(); String systemURL = URL.root().getURL(); @@ -186,7 +186,7 @@ String[] args = {email, systemURL, confirmationURL}; String body = (String)ConsultationUtil. - globalize("email.body.confirm_request", args).localize(); + globalize("confirm_request.body", args).localize(); try { Mail.send(email, from, subject, body); Added: contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/alert-trigger.jsp =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/alert-trigger.jsp 2005-08-14 10:10:16 UTC (rev 699) +++ contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/alert-trigger.jsp 2005-08-14 13:50:23 UTC (rev 700) @@ -0,0 +1,17 @@ +<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="1.2"> + + <jsp:directive.page extends="com.arsdigita.web.BaseJSP"/> + + <jsp:directive.page import="com.arsdigita.kernel.*"/> + <jsp:directive.page import="com.arsdigita.camden.cms.contenttypes.*"/> + <jsp:directive.page import="com.arsdigita.web.*"/> + + <jsp:scriptlet> + ConsultationAlert.sendAlerts(); + </jsp:scriptlet> + + <p> + "<%= "success" %>"<br /> + </p> + +</jsp:root> |
Author: clasohm Date: 2005-08-14 12:10:16 +0200 (Sun, 14 Aug 2005) New Revision: 699 Added: contrib/ccm-ldn-camden-consultation/trunk/sql/ccm-ldn-camden-consultation/oracle-se/ contrib/ccm-ldn-camden-consultation/trunk/sql/ccm-ldn-camden-consultation/oracle-se/upgrade/ contrib/ccm-ldn-camden-consultation/trunk/sql/ccm-ldn-camden-consultation/oracle-se/upgrade/1.0.0-1.0.1/ contrib/ccm-ldn-camden-consultation/trunk/sql/ccm-ldn-camden-consultation/oracle-se/upgrade/1.0.0-1.0.1/cam_consultations.sql contrib/ccm-ldn-camden-consultation/trunk/sql/ccm-ldn-camden-consultation/upgrade/ contrib/ccm-ldn-camden-consultation/trunk/sql/ccm-ldn-camden-consultation/upgrade/oracle-se-1.0.0-1.0.1.sql contrib/ccm-ldn-camden-consultation/trunk/src/ccm-ldn-camden-consultation.upgrade Modified: contrib/ccm-ldn-camden-consultation/trunk/application.xml contrib/ccm-ldn-camden-consultation/trunk/pdl/com/arsdigita/camden/cms/contenttypes/Consultation.pdl contrib/ccm-ldn-camden-consultation/trunk/pdl/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.pdl contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/Consultation.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationInitializer.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationResources.properties Log: worked on email alerts Modified: contrib/ccm-ldn-camden-consultation/trunk/application.xml =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/application.xml 2005-08-12 12:38:05 UTC (rev 698) +++ contrib/ccm-ldn-camden-consultation/trunk/application.xml 2005-08-14 10:10:16 UTC (rev 699) @@ -2,8 +2,8 @@ <ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project" name="ccm-ldn-camden-consultation" prettyName="Red Hat CCM Content Types" - version="1.0.0" - release="2" + version="1.0.1" + release="1" webapp="ROOT"> <ccm:dependencies> <ccm:requires name="ccm-core" version="6.1.1" relation="ge"/> Modified: contrib/ccm-ldn-camden-consultation/trunk/pdl/com/arsdigita/camden/cms/contenttypes/Consultation.pdl =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/pdl/com/arsdigita/camden/cms/contenttypes/Consultation.pdl 2005-08-12 12:38:05 UTC (rev 698) +++ contrib/ccm-ldn-camden-consultation/trunk/pdl/com/arsdigita/camden/cms/contenttypes/Consultation.pdl 2005-08-14 10:10:16 UTC (rev 699) @@ -25,7 +25,7 @@ String[0..1] purpose = cam_consultations.purpose CLOB; String[0..1] contact = cam_consultations.contact CLOB; - Integer[0..1] topic = cam_consultations.topic; + Integer[0..1] topic = cam_consultations.topic; Integer[0..1] consultationType = cam_consultations.consultation_type; Date[0..1] startDate = cam_consultations.start_date; Date[0..1] completionDate = cam_consultations.completion_date; @@ -35,6 +35,7 @@ Integer[0..1] geoArea = cam_consultations.geo_area; String[0..1] methodology = cam_consultations.methodology CLOB; String[0..1] feedback = cam_consultations.feedback CLOB; + Boolean[1..1] alertSent = cam_consultations.alert_sent; reference key (cam_consultations.consultation_id); } Modified: contrib/ccm-ldn-camden-consultation/trunk/pdl/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.pdl =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/pdl/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.pdl 2005-08-12 12:38:05 UTC (rev 698) +++ contrib/ccm-ldn-camden-consultation/trunk/pdl/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.pdl 2005-08-14 10:10:16 UTC (rev 699) @@ -32,3 +32,61 @@ reference key (cam_consultation_alerts.alert_id); } + +query newConsultations { + BigDecimal id; + String purpose; + String contact; + Integer topic; + Integer consultationType; + Date startDate; + Date completionDate; + Date resultsDate; + Boolean statutory; + Integer targetAudience; + Integer geoArea; + String methodology; + String feedback; + String title; + + do { + select live.*, pa.* + from cam_consultations live, cam_consultations draft, + cms_pages pa, cms_items i + where pa.item_id = live.consultation_id + and i.item_id = pa.item_id + and i.version = 'live' + and draft.consultation_id = i.master_id + and draft.alert_sent = '0' + } map { + id = consultation_id; + purpose = purpose; + contact = contact; + topic = topic; + consultationType = consultation_type; + startDate = start_date; + completionDate = completion_date; + resultsDate = results_date; + statutory = statutory; + targetAudience = target_audience; + geoArea = geo_area; + methodology = methodology; + feedback = feedback; + title = title; + } +} + +data operation setAlertSent { + do { + update cam_consultations + set alert_sent = '1' + where exists + (select 1 + from cam_consultations live, cam_consultations draft, cms_items i + where i.item_id = live.consultation_id + and i.version = 'live' + and draft.consultation_id = i.master_id + and draft.alert_sent = '0' + and draft.consultation_id = cam_consultations.consultation_id) + } +} Added: contrib/ccm-ldn-camden-consultation/trunk/sql/ccm-ldn-camden-consultation/oracle-se/upgrade/1.0.0-1.0.1/cam_consultations.sql =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/sql/ccm-ldn-camden-consultation/oracle-se/upgrade/1.0.0-1.0.1/cam_consultations.sql 2005-08-12 12:38:05 UTC (rev 698) +++ contrib/ccm-ldn-camden-consultation/trunk/sql/ccm-ldn-camden-consultation/oracle-se/upgrade/1.0.0-1.0.1/cam_consultations.sql 2005-08-14 10:10:16 UTC (rev 699) @@ -0,0 +1,13 @@ +alter table cam_consultations +add (alert_sent char(1)); + +alter table cam_consultations +add constraint cam_consultat_ale_sent_c_eri9a +check (alert_sent in ('0', '1')); + +alter table cam_consultations +add constraint cam_consultat_ale_sent_c_nn +check (alert_sent is not null); + +update cam_consultations +set alert_sent = '0'; Property changes on: contrib/ccm-ldn-camden-consultation/trunk/sql/ccm-ldn-camden-consultation/oracle-se/upgrade/1.0.0-1.0.1/cam_consultations.sql ___________________________________________________________________ Name: svn:keywords + Id Author URL Added: contrib/ccm-ldn-camden-consultation/trunk/sql/ccm-ldn-camden-consultation/upgrade/oracle-se-1.0.0-1.0.1.sql =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/sql/ccm-ldn-camden-consultation/upgrade/oracle-se-1.0.0-1.0.1.sql 2005-08-12 12:38:05 UTC (rev 698) +++ contrib/ccm-ldn-camden-consultation/trunk/sql/ccm-ldn-camden-consultation/upgrade/oracle-se-1.0.0-1.0.1.sql 2005-08-14 10:10:16 UTC (rev 699) @@ -0,0 +1 @@ +@ ../oracle-se/upgrade/1.0.0-1.0.1/cam_consultations.sql Property changes on: contrib/ccm-ldn-camden-consultation/trunk/sql/ccm-ldn-camden-consultation/upgrade/oracle-se-1.0.0-1.0.1.sql ___________________________________________________________________ Name: svn:keywords + Id Author URL Added: contrib/ccm-ldn-camden-consultation/trunk/src/ccm-ldn-camden-consultation.upgrade =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/ccm-ldn-camden-consultation.upgrade 2005-08-12 12:38:05 UTC (rev 698) +++ contrib/ccm-ldn-camden-consultation/trunk/src/ccm-ldn-camden-consultation.upgrade 2005-08-14 10:10:16 UTC (rev 699) @@ -0,0 +1,5 @@ +<upgrade> + <version from="1.0.0" to="1.0.1"> + <script sql="ccm-ldn-camden-consultation/upgrade/::database::-1.0.0-1.0.1.sql"/> + </version> +</upgrade> Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/Consultation.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/Consultation.java 2005-08-12 12:38:05 UTC (rev 698) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/Consultation.java 2005-08-14 10:10:16 UTC (rev 699) @@ -62,6 +62,7 @@ public static final String METHODOLOGY_DOCUMENTS = "methodologyDocuments"; public static final String FEEDBACK = "feedback"; public static final String FEEDBACK_DOCUMENTS = "feedbackDocuments"; + public static final String ALERT_SENT = "alertSent"; public Consultation() { super(BASE_DATA_OBJECT_TYPE); @@ -81,6 +82,8 @@ public Consultation(String type) { super(type); + + setAlertSent(Boolean.FALSE); } /** @@ -183,6 +186,14 @@ setStatutory(new Boolean(value)); } + public Boolean getAlertSent() { + return (Boolean) get(ALERT_SENT); + } + + public void setAlertSent(Boolean value) { + set(ALERT_SENT, value); + } + public Integer getTargetAudience() { return (Integer) get(TARGET_AUDIENCE); } @@ -275,11 +286,8 @@ public void removeFeedbackDocument(FileAsset fileAsset) { remove(FEEDBACK_DOCUMENTS, fileAsset); } - - public GlobalizedMessage getStatus() { - Date startDate = getStartDate(); - Date completionDate = getCompletionDate(); - + + public static GlobalizedMessage getStatus(Date startDate, Date completionDate) { if (startDate == null || completionDate == null) return null; @@ -292,6 +300,10 @@ else return ConsultationUtil.globalize("status.current"); } + + public GlobalizedMessage getStatus() { + return Consultation.getStatus(getStartDate(), getCompletionDate()); + } public String getSearchSummary() { return StringUtils.truncateString(getPurpose(), 200); Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java 2005-08-12 12:38:05 UTC (rev 698) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java 2005-08-14 10:10:16 UTC (rev 699) @@ -1,21 +1,37 @@ package com.arsdigita.camden.cms.contenttypes; +import java.lang.reflect.Array; import java.math.BigDecimal; import java.security.GeneralSecurityException; import java.util.Date; +import java.util.Locale; +import javax.mail.MessagingException; + import org.apache.commons.codec.binary.Base64; +import org.apache.log4j.Logger; +import com.arsdigita.bebop.FormProcessException; +import com.arsdigita.cms.util.GlobalizationUtil; import com.arsdigita.db.DbHelper; import com.arsdigita.domain.DataObjectNotFoundException; +import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.kernel.ACSObject; import com.arsdigita.kernel.security.Crypto; +import com.arsdigita.mail.Mail; import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.DataObject; +import com.arsdigita.persistence.DataOperation; +import com.arsdigita.persistence.DataQuery; import com.arsdigita.persistence.OID; import com.arsdigita.persistence.Session; import com.arsdigita.persistence.SessionManager; -import com.arsdigita.persistence.metadata.ObjectType; +import com.arsdigita.util.StringUtils; +import com.arsdigita.web.ParameterMap; +import com.arsdigita.web.URL; +import com.arsdigita.web.Web; +import com.arsdigita.xml.Formatter; +import com.arsdigita.xml.formatters.DateFormatter; /** * Alert requests for the Camden Consultation content type. @@ -27,6 +43,9 @@ */ public class ConsultationAlert extends ACSObject { + private static final Logger s_log = + Logger.getLogger(ConsultationAlert.class.getName()); + public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.camden.cms.contenttypes.ConsultationAlert"; @@ -212,4 +231,208 @@ } } + /** + * <p>Sends alert emails for all published Consultation items + * for which no alerts have been sent yet. Only sends an alert + * if the item has never been published before. This should be run + * once a day.</p> + */ + public static void sendAlerts() { + Session dbSession = SessionManager.getSession(); + Locale locale = Locale.getDefault(); + + // First get the list of consultations for which we should send alerts, + // and build the text common to all alerts. + DataQuery items = + dbSession.retrieveQuery("com.arsdigita.camden.cms.contenttypes.newConsultations"); + + if (items.isEmpty()) + return; + + String titleLabel = + (String)ConsultationUtil.globalize("title").localize(locale); + String statusLabel = + (String)ConsultationUtil.globalize("status").localize(locale); + String purposeLabel = + (String)ConsultationUtil.globalize("purpose").localize(locale); + String contactLabel = + (String)ConsultationUtil.globalize("contact").localize(locale); + String topicLabel = + (String)ConsultationUtil.globalize("topic").localize(locale); + String typeLabel = + (String)ConsultationUtil.globalize("type").localize(locale); + String startDateLabel = + (String)ConsultationUtil.globalize("start_date").localize(locale); + String completionDateLabel = + (String)ConsultationUtil.globalize("completion_date").localize(locale); + String resultsDateLabel = + (String)ConsultationUtil.globalize("results_date").localize(locale); + String statutoryLabel = + (String)ConsultationUtil.globalize("statutory").localize(locale); + String targetAudienceLabel = + (String)ConsultationUtil.globalize("target_audience").localize(locale); + String geoAreaLabel = + (String)ConsultationUtil.globalize("geo_area").localize(locale); + String methodologyLabel = + (String)ConsultationUtil.globalize("methodology").localize(locale); + String feedbackLabel = + (String)ConsultationUtil.globalize("feedback").localize(locale); + + Formatter dateFormatter = new DateFormatter(); + String itemList = ""; + BigDecimal[] itemIDs = + (BigDecimal[])Array.newInstance(BigDecimal.class, (int)items.size()); + int i = 0; + while (items.next()) { + String title = (String)items.get(Consultation.TITLE); + String purpose = StringUtils.htmlToText((String)items.get(Consultation.PURPOSE)); + String contact = StringUtils.htmlToText((String)items.get(Consultation.CONTACT)); + + Integer topicId = (Integer)items.get(Consultation.TOPIC); + String topic = null; + if (topicId != null) + topic = + (String)Consultation.getPrettyTopic(topicId).localize(locale); + + Integer typeId = (Integer)items.get(Consultation.CONSULTATION_TYPE); + String consultationType = null; + if (typeId != null) + consultationType = + (String)Consultation.getPrettyType(typeId).localize(locale); + + Integer targetId = (Integer)items.get(Consultation.TARGET_AUDIENCE); + String targetAudience = null; + if (targetId != null) + targetAudience = + (String)Consultation.getPrettyTarget(targetId).localize(locale); + + Integer geoId = (Integer)items.get(Consultation.GEO_AREA); + String geoArea = null; + if (geoId != null) + geoArea = + (String)Consultation.getPrettyTarget(geoId).localize(locale); + + Date startDateDate = (Date)items.get(Consultation.START_DATE); + String startDate = null; + if (startDateDate != null) + startDate = dateFormatter.format(startDateDate); + + Date completionDateDate = (Date)items.get(Consultation.COMPLETION_DATE); + String completionDate = null; + if (completionDateDate != null) + completionDate = dateFormatter.format(completionDateDate); + + Date resultsDateDate = (Date)items.get(Consultation.RESULTS_DATE); + String resultsDate = null; + if (resultsDateDate != null) + resultsDate = dateFormatter.format(resultsDateDate); + + GlobalizedMessage statusMsg = + Consultation.getStatus(startDateDate, completionDateDate); + String status = null; + if (statusMsg != null) + status = (String)statusMsg.localize(locale); + + Boolean statutoryFlag = (Boolean)items.get(Consultation.STATUTORY); + String statutory = + (String)GlobalizationUtil.globalize(statutoryFlag.booleanValue() ? "yes" : "no").localize(locale); + + String methodology = (String)items.get(Consultation.METHODOLOGY); + String feedback = (String)items.get(Consultation.FEEDBACK); + + itemList += + "\n----------\n\n" + + titleLabel + ": " + title + "\n\n"; + + if (status != null) + itemList += statusLabel + ": " + status + "\n\n"; + + if (!"".equals(purpose)) + itemList += purposeLabel + ":\n" + purpose.trim() + "\n\n"; + + if (!"".equals(contact)) + itemList += contactLabel + ":\n" + contact.trim() + "\n\n"; + + if (topic != null) + itemList += topicLabel + ": " + topic + "\n"; + if (consultationType != null) + itemList += typeLabel + ": " + consultationType + "\n"; + if (startDate != null) + itemList += startDateLabel + ": " + startDate + "\n"; + if (completionDate != null) + itemList += completionDateLabel + ": " + completionDate + "\n"; + if (resultsDate != null) + itemList += resultsDateLabel + ": " + resultsDate + "\n"; + itemList += statutoryLabel + ": " + statutory + "\n"; + if (targetAudience != null) + itemList += targetAudienceLabel + ": " + targetAudience + "\n"; + if (geoArea != null) + itemList += geoAreaLabel + ": " + geoArea + "\n"; + + if (methodology != null && !"".equals(methodology)) + itemList += "\n" + methodologyLabel + ":\n" + methodology.trim() + "\n"; + if (feedback != null && !"".equals(feedback)) + itemList += "\n" + feedbackLabel + ":\n" + feedback.trim() + "\n"; + itemList += "\n"; + + itemIDs[i++] = (BigDecimal)items.get(Consultation.ID); + } + + DataCollection alerts = dbSession.retrieve(BASE_DATA_OBJECT_TYPE); + alerts.addEqualsFilter(EMAIL_CONFIRMED, Boolean.TRUE); + + String siteName = Web.getConfig().getSiteName(); + String siteURL = URL.root().getURL(); + String from = ConsultationUtil.getConfig().getAlertsSenderEmail(); + + String[] args1 = { siteName }; + String subject = + (String)ConsultationUtil.globalize("alert.subject", args1).localize(locale); + + while (alerts.next()) { + String email = (String)alerts.get(EMAIL); + String firstNames = (String)alerts.get(FIRST_NAMES); + String lastName = (String)alerts.get(LAST_NAME); + String confirmationToken = (String)alerts.get(CONFIRMATION_TOKEN); + + String recipientName = email; + if (firstNames != null && !"".equals(firstNames)) { + recipientName = firstNames; + if (lastName == null && !"".equals(lastName)) + recipientName += " " + lastName; + } + + ConsultationApp app = ConsultationApp.retrieveApplication(); + ParameterMap parameters = new ParameterMap(); + parameters.setParameter(ConsultationAlert.CANCEL_PARAMETER, + confirmationToken); + String cancelURL = + URL.there(app, ConsultationAlert.CONFIRM_PATH, parameters).getURL(); + + String[] args2 = + { recipientName, email, siteName, siteURL }; + String header = + (String)ConsultationUtil.globalize("alert.header", args2).localize(locale); + + String[] args3 = + { email, cancelURL, siteName, siteURL }; + String footer = + (String)ConsultationUtil.globalize("alert.footer", args3).localize(locale); + + String body = header + "\n" + itemList + "\n" + footer; + + try { + Mail.send(email, from, subject, body); + } catch (MessagingException ex) { + s_log.warn("Exception while sending consultation alert to " + + email + ": " + ex.getMessage()); + } + } + + DataOperation op = + dbSession.retrieveDataOperation("com.arsdigita.camden.cms.contenttypes.setAlertSent"); + op.setParameter("consultationIDs", itemIDs); + op.execute(); + } + } Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationInitializer.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationInitializer.java 2005-08-12 12:38:05 UTC (rev 698) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationInitializer.java 2005-08-14 10:10:16 UTC (rev 699) @@ -18,7 +18,13 @@ */ package com.arsdigita.camden.cms.contenttypes; +import java.util.Date; +import java.util.Timer; +import java.util.TimerTask; + import com.arsdigita.cms.contenttypes.ContentTypeInitializer; +import com.arsdigita.kernel.Kernel; +import com.arsdigita.kernel.KernelExcursion; import com.arsdigita.runtime.LegacyInitEvent; import com.arsdigita.search.MetadataProviderRegistry; @@ -37,6 +43,20 @@ MetadataProviderRegistry.registerAdapter( Consultation.BASE_DATA_OBJECT_TYPE, new ConsultationMetadataProvider()); + + Timer timer = new Timer(true); + Date firstTime = new Date(); + timer.scheduleAtFixedRate(new TimerTask() { + public void run() { + new KernelExcursion() { + protected void excurse() { + setEffectiveParty(Kernel.getSystemParty()); + ConsultationAlert.purgeUnconfirmed(); + ConsultationAlert.sendAlerts(); + } + }.run(); + } + }, firstTime, 24*60*60*1000); } public ConsultationInitializer() { Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationResources.properties =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationResources.properties 2005-08-12 12:38:05 UTC (rev 698) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationResources.properties 2005-08-14 10:10:16 UTC (rev 699) @@ -142,12 +142,12 @@ and that it is not split across multiple lines. You might have to copy \ and paste it to a text editor and then to your Web browser to fix it.</p> -email.subject.confirm_request=Confirmation of Consultation Alert +confirm_request.subject=Confirmation of Consultation Alert # The substitutions for confirm_request body are as follows: # {0}: email for which the alert was requested # {1}: public URL of the server # {2}: URL which the user has to click to confirm the request -email.body.confirm_request=\ +confirm_request.body=\ We have received a request to alert {0} of new consultation\n\ information published on {1}\n\ \n\ @@ -158,3 +158,35 @@ \n\ If you did not request alerts, you do not need to do anything. The\n\ request will be deleted automatically within the next 24 hours. + +# {0}: site name +alert.subject=New Consultations Published on {0} + +# {0}: name of the alert recipient; may be "first_names last_name", +# "first_names" or "email", depending on which information +# we have for the recipient +# {1}: email of the alert recipient +# {2}: site name +# {3}: public URL of the server +alert.header=\ +Dear {0},\n\ +\n\ +the following consultation information has been published recently on\n\ +{2} at {3} + +# {0}: email of the alert recipient +# {1}: cancel URL +# {2}: site name +# {3}: public URL of the server +alert.footer=\ +You are receiving this email because you asked us to send alerts about\n\ +new consultation information on {2} to {0}\n\ +\n\ +If you do not want to receive these alerts any more, you can cancel +them with the link below:\n\ +\n\ +{1}\n\ +\n\ +To view other content on {2}, please visit us at\n\ +\n\ +{3} |
From: <ssk...@vh...> - 2005-08-12 12:46:09
|
Author: sskracic Date: 2005-08-12 14:38:05 +0200 (Fri, 12 Aug 2005) New Revision: 698 Modified: releases/1.0.2/ccm-core/application.xml releases/1.0.2/ccm-core/src/com/arsdigita/kernel/KernelHelper.java releases/1.0.2/ccm-core/src/com/arsdigita/kernel/security/SecurityConfig.java releases/1.0.2/ccm-core/src/com/arsdigita/kernel/security/SecurityConfig_parameter.properties releases/1.0.2/ccm-core/src/com/arsdigita/ui/SiteBanner.java releases/1.0.2/ccm-core/src/com/arsdigita/ui/login/ChangePasswordForm.java Log: Integrated r697 from trunk: configurable email address for sender of system generated emails and on mailto: links from admin and register pages. Modified: releases/1.0.2/ccm-core/application.xml =================================================================== --- releases/1.0.2/ccm-core/application.xml 2005-08-12 12:35:18 UTC (rev 697) +++ releases/1.0.2/ccm-core/application.xml 2005-08-12 12:38:05 UTC (rev 698) @@ -3,7 +3,7 @@ name="ccm-core" prettyName="Core" version="6.1.1" - release="9" + release="10" webapp="ROOT" buildHooks="build-hooks.xml"> <ccm:dependencies> Modified: releases/1.0.2/ccm-core/src/com/arsdigita/kernel/KernelHelper.java =================================================================== --- releases/1.0.2/ccm-core/src/com/arsdigita/kernel/KernelHelper.java 2005-08-12 12:35:18 UTC (rev 697) +++ releases/1.0.2/ccm-core/src/com/arsdigita/kernel/KernelHelper.java 2005-08-12 12:38:05 UTC (rev 698) @@ -20,8 +20,6 @@ import com.arsdigita.dispatcher.RequestContext; import com.arsdigita.dispatcher.DispatcherHelper; -import com.arsdigita.kernel.permissions.ObjectPermissionCollection; -import com.arsdigita.kernel.permissions.PermissionService; import com.arsdigita.web.Web; import javax.servlet.http.HttpServletRequest; @@ -32,14 +30,6 @@ */ public class KernelHelper { - private static String s_siteName = ""; - private static String s_hostName = ""; - - private static String s_serverName = ""; - private static String s_serverPort = ""; - - private static String s_systemAdministratorEmailAddress = null; - /** * Extracts the KernelRequestContext from the given request. * @@ -203,24 +193,10 @@ * help. * * @return email address suitable for reply-to in system notifications + * @deprecated Use <code>Kernel.getSecurityConfig().getAdminContactEmail()</code> */ public static synchronized String getSystemAdministratorEmailAddress() { - if (s_systemAdministratorEmailAddress == null) { - ObjectPermissionCollection perms = PermissionService.getGrantedUniversalPermissions(); - perms.addEqualsFilter("granteeIsUser", Boolean.TRUE); - perms.clearOrder(); - perms.addOrder("granteeID"); - if (perms.next()) { - s_systemAdministratorEmailAddress = perms.getGranteeEmail().toString(); - perms.close(); - } else { - // Haven't found anything. We don't want to repeat this query - // over and over again. - s_systemAdministratorEmailAddress = ""; - } - } - - return s_systemAdministratorEmailAddress; + return Kernel.getSecurityConfig().getAdminContactEmail(); } /** Modified: releases/1.0.2/ccm-core/src/com/arsdigita/kernel/security/SecurityConfig.java =================================================================== --- releases/1.0.2/ccm-core/src/com/arsdigita/kernel/security/SecurityConfig.java 2005-08-12 12:35:18 UTC (rev 697) +++ releases/1.0.2/ccm-core/src/com/arsdigita/kernel/security/SecurityConfig.java 2005-08-12 12:38:05 UTC (rev 698) @@ -18,12 +18,14 @@ */ package com.arsdigita.kernel.security; +import com.arsdigita.kernel.KernelHelper; +import com.arsdigita.kernel.permissions.ObjectPermissionCollection; +import com.arsdigita.kernel.permissions.PermissionService; import com.arsdigita.runtime.AbstractConfig; import com.arsdigita.util.parameter.IntegerParameter; import com.arsdigita.util.parameter.Parameter; +import com.arsdigita.util.parameter.StringArrayParameter; import com.arsdigita.util.parameter.StringParameter; -import com.arsdigita.util.parameter.StringArrayParameter; -import java.io.File; /** * SecurityConfig @@ -34,6 +36,8 @@ public class SecurityConfig extends AbstractConfig { + private static String s_systemAdministratorEmailAddress = null; + public final static String versionId = "$Id$ by $Author$, $DateTime: 2004/08/16 18:10:38 $"; private final Parameter m_rootPage = new StringParameter @@ -74,6 +78,8 @@ "Register:com.arsdigita.kernel.security.CookieLoginModule:optional" } ); + private final Parameter m_adminEmail = new StringParameter + ("waf.admin.contact_email", Parameter.OPTIONAL, null); public SecurityConfig() { @@ -92,6 +98,7 @@ register(m_cookieDomain); register(m_loginConfig); register(m_cookieDurationMinutes); + register(m_adminEmail); loadInfo(); } @@ -140,4 +147,30 @@ Integer getCookieDurationMinutes() { return (Integer) get(m_cookieDurationMinutes); } + public String getAdminContactEmail() { + String email = (String) get(m_adminEmail); + if (email == null || email.trim().length() == 0) { + email = getSystemAdministratorEmailAddress(); + } + return email; + } + + private static synchronized String getSystemAdministratorEmailAddress() { + if (s_systemAdministratorEmailAddress == null) { + ObjectPermissionCollection perms = PermissionService.getGrantedUniversalPermissions(); + perms.addEqualsFilter("granteeIsUser", Boolean.TRUE); + perms.clearOrder(); + perms.addOrder("granteeID"); + if (perms.next()) { + s_systemAdministratorEmailAddress = perms.getGranteeEmail().toString(); + perms.close(); + } else { + // Haven't found anything. We don't want to repeat this query + // over and over again. + s_systemAdministratorEmailAddress = ""; + } + } + return s_systemAdministratorEmailAddress; + } + } Modified: releases/1.0.2/ccm-core/src/com/arsdigita/kernel/security/SecurityConfig_parameter.properties =================================================================== --- releases/1.0.2/ccm-core/src/com/arsdigita/kernel/security/SecurityConfig_parameter.properties 2005-08-12 12:35:18 UTC (rev 697) +++ releases/1.0.2/ccm-core/src/com/arsdigita/kernel/security/SecurityConfig_parameter.properties 2005-08-12 12:38:05 UTC (rev 698) @@ -54,3 +54,7 @@ waf.cookie_domain.purpose=Enter the domain to which the Aplaws authentication cookie is presented waf.cookie_domain.example=.example.com waf.cookie_domain.format=[string] +waf.admin.contact_email.title=System administrator email address +waf.admin.contact_email.purpose=Email address that will be displayed on footer of login/admin pages, if empty then site-wide admin email will be substituted +waf.admin.contact_email.example=ccm...@ex... +waf.admin.contact_email.format=[string] Modified: releases/1.0.2/ccm-core/src/com/arsdigita/ui/SiteBanner.java =================================================================== --- releases/1.0.2/ccm-core/src/com/arsdigita/ui/SiteBanner.java 2005-08-12 12:35:18 UTC (rev 697) +++ releases/1.0.2/ccm-core/src/com/arsdigita/ui/SiteBanner.java 2005-08-12 12:38:05 UTC (rev 698) @@ -18,11 +18,11 @@ */ package com.arsdigita.ui; +import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.SimpleComponent; -import com.arsdigita.bebop.PageState; -import com.arsdigita.kernel.KernelHelper; +import com.arsdigita.kernel.Kernel; +import com.arsdigita.web.Web; import com.arsdigita.xml.Element; -import com.arsdigita.web.Web; public class SiteBanner extends SimpleComponent { @@ -37,6 +37,6 @@ content.addAttribute("sitename", Web.getConfig().getSiteName()); content.addAttribute("admin", - KernelHelper.getSystemAdministratorEmailAddress()); + Kernel.getSecurityConfig().getAdminContactEmail()); } } Modified: releases/1.0.2/ccm-core/src/com/arsdigita/ui/login/ChangePasswordForm.java =================================================================== --- releases/1.0.2/ccm-core/src/com/arsdigita/ui/login/ChangePasswordForm.java 2005-08-12 12:35:18 UTC (rev 697) +++ releases/1.0.2/ccm-core/src/com/arsdigita/ui/login/ChangePasswordForm.java 2005-08-12 12:38:05 UTC (rev 698) @@ -42,7 +42,7 @@ import com.arsdigita.web.Web; import com.arsdigita.web.URL; import com.arsdigita.web.ReturnSignal; -import com.arsdigita.kernel.KernelHelper; +import com.arsdigita.kernel.Kernel; import com.arsdigita.kernel.User; import com.arsdigita.kernel.UserAuthentication; import com.arsdigita.kernel.security.Initializer; @@ -270,7 +270,7 @@ String to = user.getPrimaryEmail().toString(); String from = - KernelHelper.getSystemAdministratorEmailAddress(); + Kernel.getSecurityConfig().getAdminContactEmail(); String name = user.getPersonName().getGivenName(); String subject = |
From: <ssk...@vh...> - 2005-08-12 12:43:23
|
Author: sskracic Date: 2005-08-12 14:35:18 +0200 (Fri, 12 Aug 2005) New Revision: 697 Modified: ccm-core/trunk/src/com/arsdigita/kernel/KernelHelper.java ccm-core/trunk/src/com/arsdigita/kernel/security/SecurityConfig.java ccm-core/trunk/src/com/arsdigita/kernel/security/SecurityConfig_parameter.properties ccm-core/trunk/src/com/arsdigita/ui/SiteBanner.java ccm-core/trunk/src/com/arsdigita/ui/login/ChangePasswordForm.java Log: Introducing waf.admin.contact_email configuration parameter that will be used in From: field of autogenerated emails and also in mailto: URLs on /ccm/register and /ccm/admin pages. If not defined, its accessor Kernel.getSecurityConfig().getAdminContactEmail() will default to the email address of the user with lowest userID that has 'admin' privilege on object with ID=0. Modified: ccm-core/trunk/src/com/arsdigita/kernel/KernelHelper.java =================================================================== --- ccm-core/trunk/src/com/arsdigita/kernel/KernelHelper.java 2005-08-12 06:32:41 UTC (rev 696) +++ ccm-core/trunk/src/com/arsdigita/kernel/KernelHelper.java 2005-08-12 12:35:18 UTC (rev 697) @@ -20,8 +20,6 @@ import com.arsdigita.dispatcher.RequestContext; import com.arsdigita.dispatcher.DispatcherHelper; -import com.arsdigita.kernel.permissions.ObjectPermissionCollection; -import com.arsdigita.kernel.permissions.PermissionService; import com.arsdigita.web.Web; import javax.servlet.http.HttpServletRequest; @@ -32,14 +30,6 @@ */ public class KernelHelper { - private static String s_siteName = ""; - private static String s_hostName = ""; - - private static String s_serverName = ""; - private static String s_serverPort = ""; - - private static String s_systemAdministratorEmailAddress = null; - /** * Extracts the KernelRequestContext from the given request. * @@ -203,24 +193,10 @@ * help. * * @return email address suitable for reply-to in system notifications + * @deprecated Use <code>Kernel.getSecurityConfig().getAdminContactEmail()</code> */ public static synchronized String getSystemAdministratorEmailAddress() { - if (s_systemAdministratorEmailAddress == null) { - ObjectPermissionCollection perms = PermissionService.getGrantedUniversalPermissions(); - perms.addEqualsFilter("granteeIsUser", Boolean.TRUE); - perms.clearOrder(); - perms.addOrder("granteeID"); - if (perms.next()) { - s_systemAdministratorEmailAddress = perms.getGranteeEmail().toString(); - perms.close(); - } else { - // Haven't found anything. We don't want to repeat this query - // over and over again. - s_systemAdministratorEmailAddress = ""; - } - } - - return s_systemAdministratorEmailAddress; + return Kernel.getSecurityConfig().getAdminContactEmail(); } /** Modified: ccm-core/trunk/src/com/arsdigita/kernel/security/SecurityConfig.java =================================================================== --- ccm-core/trunk/src/com/arsdigita/kernel/security/SecurityConfig.java 2005-08-12 06:32:41 UTC (rev 696) +++ ccm-core/trunk/src/com/arsdigita/kernel/security/SecurityConfig.java 2005-08-12 12:35:18 UTC (rev 697) @@ -18,12 +18,14 @@ */ package com.arsdigita.kernel.security; +import com.arsdigita.kernel.KernelHelper; +import com.arsdigita.kernel.permissions.ObjectPermissionCollection; +import com.arsdigita.kernel.permissions.PermissionService; import com.arsdigita.runtime.AbstractConfig; import com.arsdigita.util.parameter.IntegerParameter; import com.arsdigita.util.parameter.Parameter; +import com.arsdigita.util.parameter.StringArrayParameter; import com.arsdigita.util.parameter.StringParameter; -import com.arsdigita.util.parameter.StringArrayParameter; -import java.io.File; /** * SecurityConfig @@ -34,6 +36,8 @@ public class SecurityConfig extends AbstractConfig { + private static String s_systemAdministratorEmailAddress = null; + public final static String versionId = "$Id$ by $Author$, $DateTime: 2004/08/16 18:10:38 $"; private final Parameter m_rootPage = new StringParameter @@ -74,6 +78,8 @@ "Register:com.arsdigita.kernel.security.CookieLoginModule:optional" } ); + private final Parameter m_adminEmail = new StringParameter + ("waf.admin.contact_email", Parameter.OPTIONAL, null); public SecurityConfig() { @@ -92,6 +98,7 @@ register(m_cookieDomain); register(m_loginConfig); register(m_cookieDurationMinutes); + register(m_adminEmail); loadInfo(); } @@ -140,4 +147,30 @@ Integer getCookieDurationMinutes() { return (Integer) get(m_cookieDurationMinutes); } + public String getAdminContactEmail() { + String email = (String) get(m_adminEmail); + if (email == null || email.trim().length() == 0) { + email = getSystemAdministratorEmailAddress(); + } + return email; + } + + private static synchronized String getSystemAdministratorEmailAddress() { + if (s_systemAdministratorEmailAddress == null) { + ObjectPermissionCollection perms = PermissionService.getGrantedUniversalPermissions(); + perms.addEqualsFilter("granteeIsUser", Boolean.TRUE); + perms.clearOrder(); + perms.addOrder("granteeID"); + if (perms.next()) { + s_systemAdministratorEmailAddress = perms.getGranteeEmail().toString(); + perms.close(); + } else { + // Haven't found anything. We don't want to repeat this query + // over and over again. + s_systemAdministratorEmailAddress = ""; + } + } + return s_systemAdministratorEmailAddress; + } + } Modified: ccm-core/trunk/src/com/arsdigita/kernel/security/SecurityConfig_parameter.properties =================================================================== --- ccm-core/trunk/src/com/arsdigita/kernel/security/SecurityConfig_parameter.properties 2005-08-12 06:32:41 UTC (rev 696) +++ ccm-core/trunk/src/com/arsdigita/kernel/security/SecurityConfig_parameter.properties 2005-08-12 12:35:18 UTC (rev 697) @@ -54,3 +54,7 @@ waf.cookie_domain.purpose=Enter the domain to which the Aplaws authentication cookie is presented waf.cookie_domain.example=.example.com waf.cookie_domain.format=[string] +waf.admin.contact_email.title=System administrator email address +waf.admin.contact_email.purpose=Email address that will be displayed on footer of login/admin pages, if empty then site-wide admin email will be substituted +waf.admin.contact_email.example=ccm...@ex... +waf.admin.contact_email.format=[string] Modified: ccm-core/trunk/src/com/arsdigita/ui/SiteBanner.java =================================================================== --- ccm-core/trunk/src/com/arsdigita/ui/SiteBanner.java 2005-08-12 06:32:41 UTC (rev 696) +++ ccm-core/trunk/src/com/arsdigita/ui/SiteBanner.java 2005-08-12 12:35:18 UTC (rev 697) @@ -18,11 +18,11 @@ */ package com.arsdigita.ui; +import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.SimpleComponent; -import com.arsdigita.bebop.PageState; -import com.arsdigita.kernel.KernelHelper; +import com.arsdigita.kernel.Kernel; +import com.arsdigita.web.Web; import com.arsdigita.xml.Element; -import com.arsdigita.web.Web; public class SiteBanner extends SimpleComponent { @@ -37,6 +37,6 @@ content.addAttribute("sitename", Web.getConfig().getSiteName()); content.addAttribute("admin", - KernelHelper.getSystemAdministratorEmailAddress()); + Kernel.getSecurityConfig().getAdminContactEmail()); } } Modified: ccm-core/trunk/src/com/arsdigita/ui/login/ChangePasswordForm.java =================================================================== --- ccm-core/trunk/src/com/arsdigita/ui/login/ChangePasswordForm.java 2005-08-12 06:32:41 UTC (rev 696) +++ ccm-core/trunk/src/com/arsdigita/ui/login/ChangePasswordForm.java 2005-08-12 12:35:18 UTC (rev 697) @@ -42,7 +42,7 @@ import com.arsdigita.web.Web; import com.arsdigita.web.URL; import com.arsdigita.web.ReturnSignal; -import com.arsdigita.kernel.KernelHelper; +import com.arsdigita.kernel.Kernel; import com.arsdigita.kernel.User; import com.arsdigita.kernel.UserAuthentication; import com.arsdigita.kernel.security.Initializer; @@ -270,7 +270,7 @@ String to = user.getPrimaryEmail().toString(); String from = - KernelHelper.getSystemAdministratorEmailAddress(); + Kernel.getSecurityConfig().getAdminContactEmail(); String name = user.getPersonName().getGivenName(); String subject = |
Author: clasohm Date: 2005-08-12 08:32:41 +0200 (Fri, 12 Aug 2005) New Revision: 696 Added: contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/alert.jsp Removed: contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/aconfirm.jsp Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationResources.properties contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAlertConfirm.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAlertForm.java Log: worked on email alerts Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java 2005-08-10 16:18:33 UTC (rev 695) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java 2005-08-12 06:32:41 UTC (rev 696) @@ -6,12 +6,14 @@ import org.apache.commons.codec.binary.Base64; +import com.arsdigita.db.DbHelper; import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.kernel.ACSObject; import com.arsdigita.kernel.security.Crypto; 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.persistence.metadata.ObjectType; @@ -35,6 +37,9 @@ public static final String CONFIRMATION_TOKEN = "confirmationToken"; public static final String CANCELLATION_TOKEN = "cancellationToken"; public static final String EMAIL_CONFIRMED = "emailConfirmed"; + public final static String CONFIRM_PATH = "/alert.jsp"; + public final static String CONFIRM_PARAMETER = "co"; + public final static String CANCEL_PARAMETER = "ca"; public ConsultationAlert() { this(BASE_DATA_OBJECT_TYPE); @@ -163,4 +168,48 @@ return result; } + public static String cancel(String token) { + DataCollection alerts = + SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE); + alerts.addEqualsFilter(CANCELLATION_TOKEN, token); + + String result = null; + if (alerts.next()) { + ConsultationAlert alert = + new ConsultationAlert(alerts.getDataObject()); + alerts.close(); + + result = alert.getEmail(); + + alert.delete(); + } + + return result; + } + + /** + * Deletes alert requests which have not been confirmed, and which + * are older than 24h. + */ + public static void purgeUnconfirmed() { + Session dbSession = SessionManager.getSession(); + int dbType = dbSession.getDatabase(); + + DataCollection alerts = dbSession.retrieve(BASE_DATA_OBJECT_TYPE); + + alerts.addEqualsFilter(EMAIL_CONFIRMED, Boolean.FALSE); + if (dbType == DbHelper.DB_ORACLE) + alerts.addFilter("creationDate < sysdate - 1"); + else if (dbType == DbHelper.DB_POSTGRES) + alerts.addFilter("creationDate < current_date - 1"); + else + throw new RuntimeException("Unsupported database type"); + + while (alerts.next()) { + ConsultationAlert alert = + new ConsultationAlert(alerts.getDataObject()); + alert.delete(); + } + } + } Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationResources.properties =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationResources.properties 2005-08-10 16:18:33 UTC (rev 695) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationResources.properties 2005-08-12 06:32:41 UTC (rev 696) @@ -89,15 +89,8 @@ last_name=Last Name email=Email set_alert=Set Alert -duplicate_alert=There already is an alert for the email address you entered. +duplicate_alert=We already send alerts to the email address you entered. -confirm_token.missing=\ -<p>The URL does not contain a confirmation token.</p>\ -\ -<p>Please check that the complete URL is highlighted in your mail program, \ -and that it is not split across multiple lines. You might have to copy \ -and paste it to a text editor and then to your Web browser to fix it.</p> - confirm_token.invalid=\ <p>The URL contains a token for which we could not find \ any alert requests.</p>\ @@ -110,6 +103,7 @@ and that it is not split across multiple lines. You might have to copy \ and paste it to a text editor and then to your Web browser to fix it.</p> +# {0}: email for which the alert was requested confirm_token.success=\ <p>The alert request for {0} has been confirmed.</p>\ \ @@ -117,6 +111,37 @@ during that day. These emails also contain a link for cancelling \ the alert.</p> +cancel_token.invalid=\ +<p>The URL contains a token for which we could not find \ +any alert requests.</p>\ +\ +<p>Either you already cancelled the alert, or the URL is incomplete.</p>\ +\ +<p>Please check that the complete URL is highlighted in your mail program, \ +and that it is not split across multiple lines. You might have to copy \ +and paste it to a text editor and then to your Web browser to fix it.</p> + +# {0}: email for which the alert was requested +cancel_token.success=\ +<p>The alert for {0} has been removed.</p>\ +\ +<p>You will no longer receive emails about new consultation items.</p> + +verify_token.success=\ +<p>Your request to alert {0} of newly published consultation \ +items has been stored.</p>\ +\ +<p>To ensure that this request was made by you, alerts will only be sent \ +after you confirm the request. You will receive an email with a link to \ +do so shortly.</p> + +token.missing=\ +<p>The URL does not contain a confirmation or cancellation token.</p>\ +\ +<p>Please check that the complete URL is highlighted in your mail program, \ +and that it is not split across multiple lines. You might have to copy \ +and paste it to a text editor and then to your Web browser to fix it.</p> + email.subject.confirm_request=Confirmation of Consultation Alert # The substitutions for confirm_request body are as follows: # {0}: email for which the alert was requested Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAlertConfirm.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAlertConfirm.java 2005-08-10 16:18:33 UTC (rev 695) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAlertConfirm.java 2005-08-12 06:32:41 UTC (rev 696) @@ -18,6 +18,7 @@ */ package com.arsdigita.camden.cms.contenttypes.ui; +import java.math.BigDecimal; import java.util.Map; import com.arsdigita.bebop.Label; @@ -27,6 +28,7 @@ import com.arsdigita.bebop.event.PrintListener; import com.arsdigita.camden.cms.contenttypes.ConsultationAlert; import com.arsdigita.camden.cms.contenttypes.ConsultationUtil; +import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.web.ParameterMap; public class ConsultationAlertConfirm extends Label { @@ -41,21 +43,49 @@ Map parameters = state.getRequest().getParameterMap(); String[] tokens = - (String[])parameters.get(ConsultationAlertForm.CONFIRM_PARAMETER); + (String[])parameters.get(ConsultationAlert.CONFIRM_PARAMETER); - if (tokens == null || tokens.length == 0) { - target.setLabel(ConsultationUtil.globalize("confirm_token.missing")); + if (tokens != null && tokens.length > 0) { + String email = ConsultationAlert.confirm(tokens[0]); + if (email == null) { + target.setLabel(ConsultationUtil.globalize("confirm_token.invalid")); + return; + } + + String[] args = {email}; + target.setLabel(ConsultationUtil.globalize("confirm_token.success", args)); return; } + + tokens = (String[])parameters.get(ConsultationAlert.CANCEL_PARAMETER); + if (tokens != null && tokens.length > 0) { + String email = ConsultationAlert.cancel(tokens[0]); + if (email == null) { + target.setLabel(ConsultationUtil.globalize("cancel_token.invalid")); + return; + } + + String[] args = {email}; + target.setLabel(ConsultationUtil.globalize("cancel_token.success", args)); + return; + } + + tokens = (String[])parameters.get(ConsultationAlert.ID); + if (tokens != null && tokens.length > 0) { + ConsultationAlert alert; + try { + alert = new ConsultationAlert(new BigDecimal(tokens[0])); + } catch (DataObjectNotFoundException ex) { + // This should not happen. + throw new RuntimeException(ex); + } - String email = ConsultationAlert.confirm(tokens[0]); - if (email == null) { - target.setLabel(ConsultationUtil.globalize("confirm_token.invalid")); + String[] args = {alert.getEmail()}; + target.setLabel(ConsultationUtil.globalize("verify_token.success", args)); return; } - String[] args = {email}; - target.setLabel(ConsultationUtil.globalize("confirm_token.success", args)); + target.setLabel(ConsultationUtil.globalize("token.missing")); } }); } Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAlertForm.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAlertForm.java 2005-08-10 16:18:33 UTC (rev 695) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAlertForm.java 2005-08-12 06:32:41 UTC (rev 696) @@ -46,6 +46,7 @@ import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.SessionManager; import com.arsdigita.web.ParameterMap; +import com.arsdigita.web.RedirectSignal; import com.arsdigita.web.URL; import com.arsdigita.web.Web; @@ -63,8 +64,6 @@ extends BaseForm implements FormProcessListener { public final static String FORM_NAME = "alert"; - public final static String CONFIRM_PATH = "/aconfirm.jsp"; - public final static String CONFIRM_PARAMETER = "t"; public ConsultationAlertForm() { this(ConsultationAlertForm.FORM_NAME, @@ -94,11 +93,23 @@ Name email = new Name(ConsultationAlert.EMAIL, 100, false); - email.addValidationListener(new EmailValidationListener()); + email.addValidationListener(new ParameterListener() { + private EmailValidationListener m_emailValidation = + new EmailValidationListener(); + public void validate(ParameterEvent e) throws FormProcessException { + PageState state = e.getPageState(); ParameterData data = e.getParameterData(); + + if (isCancelled(state)) + return; + + m_emailValidation.validate(e); + if (!data.isValid()) + return; + String email = ((String)data.getValue()).toLowerCase(); DataCollection alerts = @@ -127,8 +138,10 @@ FormData data = event.getFormData(); PageState state = event.getPageState(); - if (isCancelled(state)) - return; + if (isCancelled(state)) { + URL target = URL.here(state.getRequest(), null); + throw new RedirectSignal(target, false); + } String email = data.getString(ConsultationAlert.EMAIL).toLowerCase(); @@ -164,9 +177,12 @@ String systemURL = URL.root().getURL(); ParameterMap parameters = new ParameterMap(); - parameters.setParameter(CONFIRM_PARAMETER, alert.getConfirmationToken()); + parameters.setParameter(ConsultationAlert.CONFIRM_PARAMETER, + alert.getConfirmationToken()); + String confirmationURL = - URL.here(Web.getRequest(), CONFIRM_PATH, parameters).getURL(); + URL.here(Web.getRequest(), + ConsultationAlert.CONFIRM_PATH, parameters).getURL(); String[] args = {email, systemURL, confirmationURL}; String body = (String)ConsultationUtil. @@ -177,5 +193,12 @@ } catch (MessagingException ex) { throw new FormProcessException(ex); } + + parameters = new ParameterMap(); + parameters.setParameter(ConsultationAlert.ID, alert.getID()); + URL target = + URL.here(state.getRequest(), ConsultationAlert.CONFIRM_PATH, parameters); + throw new RedirectSignal(target, true); + } } Deleted: contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/aconfirm.jsp Copied: contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/alert.jsp (from rev 695, contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/aconfirm.jsp) |
Author: clasohm Date: 2005-08-10 18:18:33 +0200 (Wed, 10 Aug 2005) New Revision: 695 Added: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAlertConfirm.java contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/aconfirm.jsp Removed: contrib/ccm-ldn-camden-consultation/trunk/web/__ccm__/apps/consultations/xsl/index.xsl Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationConfig.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationConfig_parameter.properties contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationResources.properties contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationUtil.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAlertForm.java contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/alert-new.jsp Log: worked on alert confirmation Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java 2005-08-10 16:18:14 UTC (rev 694) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java 2005-08-10 16:18:33 UTC (rev 695) @@ -9,8 +9,10 @@ import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.kernel.ACSObject; import com.arsdigita.kernel.security.Crypto; +import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.OID; +import com.arsdigita.persistence.SessionManager; import com.arsdigita.persistence.metadata.ObjectType; /** @@ -124,7 +126,7 @@ } private String getRandomString() { - byte[] salt = new byte[16]; + byte[] salt = new byte[8]; try { Crypto.getRandom().nextBytes(salt); } catch (GeneralSecurityException e) { @@ -141,4 +143,24 @@ return result; } + public static String confirm(String token) { + DataCollection alerts = + SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE); + alerts.addEqualsFilter(CONFIRMATION_TOKEN, token); + + String result = null; + if (alerts.next()) { + ConsultationAlert alert = + new ConsultationAlert(alerts.getDataObject()); + alerts.close(); + + result = alert.getEmail(); + + alert.setEmailConfirmed(Boolean.TRUE); + alert.save(); + } + + return result; + } + } Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationConfig.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationConfig.java 2005-08-10 16:18:14 UTC (rev 694) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationConfig.java 2005-08-10 16:18:33 UTC (rev 695) @@ -18,6 +18,7 @@ */ package com.arsdigita.camden.cms.contenttypes; +import com.arsdigita.kernel.KernelHelper; import com.arsdigita.runtime.AbstractConfig; import com.arsdigita.util.parameter.BooleanParameter; import com.arsdigita.util.parameter.Parameter; @@ -37,8 +38,14 @@ Parameter.OPTIONAL, "consultations"); + private final Parameter m_alertsSenderEmail = new StringParameter( + "com.arsdigita.cms.camden.contenttypes.alerts_sender_email", + Parameter.OPTIONAL, + KernelHelper.getSystemAdministratorEmailAddress()); + public ConsultationConfig() { register(m_consultationsTermUrl); + register(m_alertsSenderEmail); loadInfo(); } @@ -46,4 +53,8 @@ return (String) get(m_consultationsTermUrl); } + public String getAlertsSenderEmail() { + return (String) get(m_alertsSenderEmail); + } + } Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationConfig_parameter.properties =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationConfig_parameter.properties 2005-08-10 16:18:14 UTC (rev 694) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationConfig_parameter.properties 2005-08-10 16:18:33 UTC (rev 695) @@ -2,3 +2,7 @@ com.arsdigita.aplaws.consultations_term_url.purpose=Used to display the right category menu and path in the Consultations UI. com.arsdigita.aplaws.consultations_term_url.example=Consultations com.arsdigita.aplaws.consultations_term_url.format=[string] +com.arsdigita.aplaws.alerts_sender_email.title=The sender address for alert email +com.arsdigita.aplaws.alerts_sender_email.purpose=This email address will receive bounces and user requests. +com.arsdigita.aplaws.alerts_sender_email.example=bo...@ex... +com.arsdigita.aplaws.alerts_sender_email.format=[string] Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationResources.properties =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationResources.properties 2005-08-10 16:18:14 UTC (rev 694) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationResources.properties 2005-08-10 16:18:33 UTC (rev 695) @@ -90,3 +90,46 @@ email=Email set_alert=Set Alert duplicate_alert=There already is an alert for the email address you entered. + +confirm_token.missing=\ +<p>The URL does not contain a confirmation token.</p>\ +\ +<p>Please check that the complete URL is highlighted in your mail program, \ +and that it is not split across multiple lines. You might have to copy \ +and paste it to a text editor and then to your Web browser to fix it.</p> + +confirm_token.invalid=\ +<p>The URL contains a token for which we could not find \ +any alert requests.</p>\ +\ +<p>Requests are deleted automatically when they are \ +not confirmed within 24 hours. It is also possible that the URL +is incomplete.</p>\ +\ +<p>Please check that the complete URL is highlighted in your mail program, \ +and that it is not split across multiple lines. You might have to copy \ +and paste it to a text editor and then to your Web browser to fix it.</p> + +confirm_token.success=\ +<p>The alert request for {0} has been confirmed.</p>\ +\ +<p>You will receive a daily email with the consultation items published \ +during that day. These emails also contain a link for cancelling \ +the alert.</p> + +email.subject.confirm_request=Confirmation of Consultation Alert +# The substitutions for confirm_request body are as follows: +# {0}: email for which the alert was requested +# {1}: public URL of the server +# {2}: URL which the user has to click to confirm the request +email.body.confirm_request=\ +We have received a request to alert {0} of new consultation\n\ +information published on {1}\n\ +\n\ +To ensure that this request was made by you, alerts will only be sent\n\ +after you confirm the request via the link below:\n\ +\n\ +{2}\n\ +\n\ +If you did not request alerts, you do not need to do anything. The\n\ +request will be deleted automatically within the next 24 hours. Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationUtil.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationUtil.java 2005-08-10 16:18:14 UTC (rev 694) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationUtil.java 2005-08-10 16:18:33 UTC (rev 695) @@ -47,7 +47,11 @@ public static GlobalizedMessage globalize(String key) { return new GlobalizedMessage(key, BUNDLE_NAME); } - + + public static GlobalizedMessage globalize(String key, Object[] args) { + return new GlobalizedMessage(key, BUNDLE_NAME, args); + } + private static ConsultationConfig m_config; /** @@ -94,8 +98,11 @@ } public static ConsultationConfig getConfig() { - if (m_config == null) + if (m_config == null) { m_config = new ConsultationConfig(); + m_config.load(); + } + return m_config; } Added: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAlertConfirm.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAlertConfirm.java 2005-08-10 16:18:14 UTC (rev 694) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAlertConfirm.java 2005-08-10 16:18:33 UTC (rev 695) @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2005 Red Hat Inc. All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +package com.arsdigita.camden.cms.contenttypes.ui; + +import java.util.Map; + +import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.Page; +import com.arsdigita.bebop.PageState; +import com.arsdigita.bebop.event.PrintEvent; +import com.arsdigita.bebop.event.PrintListener; +import com.arsdigita.camden.cms.contenttypes.ConsultationAlert; +import com.arsdigita.camden.cms.contenttypes.ConsultationUtil; +import com.arsdigita.web.ParameterMap; + +public class ConsultationAlertConfirm extends Label { + + public ConsultationAlertConfirm() { + setOutputEscaping(false); + + addPrintListener(new PrintListener() { + public void prepare(PrintEvent e) { + PageState state = e.getPageState(); + Label target = (Label)e.getTarget(); + + Map parameters = state.getRequest().getParameterMap(); + String[] tokens = + (String[])parameters.get(ConsultationAlertForm.CONFIRM_PARAMETER); + + if (tokens == null || tokens.length == 0) { + target.setLabel(ConsultationUtil.globalize("confirm_token.missing")); + return; + } + + String email = ConsultationAlert.confirm(tokens[0]); + if (email == null) { + target.setLabel(ConsultationUtil.globalize("confirm_token.invalid")); + return; + } + + String[] args = {email}; + target.setLabel(ConsultationUtil.globalize("confirm_token.success", args)); + } + }); + } + +} Property changes on: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAlertConfirm.java ___________________________________________________________________ Name: svn:keywords + Id Author URL Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAlertForm.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAlertForm.java 2005-08-10 16:18:14 UTC (rev 694) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAlertForm.java 2005-08-10 16:18:33 UTC (rev 695) @@ -1,7 +1,29 @@ +/* + * Copyright (C) 2005 Red Hat Inc. All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ package com.arsdigita.camden.cms.contenttypes.ui; +import java.lang.reflect.Array; import java.util.Date; +import javax.mail.MessagingException; +import javax.mail.SendFailedException; + import org.apache.log4j.Logger; import com.arsdigita.bebop.FormData; @@ -16,11 +38,16 @@ import com.arsdigita.bebop.parameters.EmailValidationListener; import com.arsdigita.bebop.parameters.ParameterData; import com.arsdigita.camden.cms.contenttypes.ConsultationAlert; +import com.arsdigita.camden.cms.contenttypes.ConsultationConfig; import com.arsdigita.camden.cms.contenttypes.ConsultationUtil; import com.arsdigita.cms.ui.BaseForm; import com.arsdigita.globalization.GlobalizedMessage; +import com.arsdigita.mail.Mail; import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.SessionManager; +import com.arsdigita.web.ParameterMap; +import com.arsdigita.web.URL; +import com.arsdigita.web.Web; /** * <p>For for setting a new alert on the Camden Consultations @@ -36,6 +63,8 @@ extends BaseForm implements FormProcessListener { public final static String FORM_NAME = "alert"; + public final static String CONFIRM_PATH = "/aconfirm.jsp"; + public final static String CONFIRM_PARAMETER = "t"; public ConsultationAlertForm() { this(ConsultationAlertForm.FORM_NAME, @@ -94,9 +123,9 @@ addProcessListener(this); } - public void process(FormSectionEvent e) throws FormProcessException { - FormData data = e.getFormData(); - PageState state = e.getPageState(); + public void process(FormSectionEvent event) throws FormProcessException { + FormData data = event.getFormData(); + PageState state = event.getPageState(); if (isCancelled(state)) return; @@ -105,8 +134,8 @@ data.getString(ConsultationAlert.EMAIL).toLowerCase(); // Check if we already have a pending request for this email - // address. The form validation listener has taken care that - // we don't have a confirmed request. + // address. The form validation listener has made sure that + // we do not have a confirmed request. DataCollection alerts = SessionManager.getSession(). retrieve(ConsultationAlert.BASE_DATA_OBJECT_TYPE); @@ -125,6 +154,28 @@ alert.setFirstNames(data.getString(ConsultationAlert.FIRST_NAMES)); alert.setLastName(data.getString(ConsultationAlert.LAST_NAME)); alert.setEmail(email); - alert.save(); + alert.save(); + + String from = + ConsultationUtil.getConfig().getAlertsSenderEmail(); + String subject = (String)ConsultationUtil. + globalize("email.subject.confirm_request").localize(); + + String systemURL = URL.root().getURL(); + + ParameterMap parameters = new ParameterMap(); + parameters.setParameter(CONFIRM_PARAMETER, alert.getConfirmationToken()); + String confirmationURL = + URL.here(Web.getRequest(), CONFIRM_PATH, parameters).getURL(); + + String[] args = {email, systemURL, confirmationURL}; + String body = (String)ConsultationUtil. + globalize("email.body.confirm_request", args).localize(); + + try { + Mail.send(email, from, subject, body); + } catch (MessagingException ex) { + throw new FormProcessException(ex); + } } } Deleted: contrib/ccm-ldn-camden-consultation/trunk/web/__ccm__/apps/consultations/xsl/index.xsl Added: contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/aconfirm.jsp =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/aconfirm.jsp 2005-08-10 16:18:14 UTC (rev 694) +++ contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/aconfirm.jsp 2005-08-10 16:18:33 UTC (rev 695) @@ -0,0 +1,41 @@ +<jsp:root + xmlns:jsp="http://java.sun.com/JSP/Page" + xmlns:define="/WEB-INF/bebop-define.tld" + xmlns:show="/WEB-INF/bebop-show.tld" + version="1.2"> + + <jsp:directive.page import="com.arsdigita.dispatcher.DispatcherHelper"/> + <jsp:directive.page import="com.arsdigita.camden.cms.contenttypes.ui.ConsultationsNavigationModel" /> + <jsp:directive.page import="com.arsdigita.camden.cms.contenttypes.ui.ConsultationAlertConfirm" /> + <jsp:directive.page import="com.arsdigita.london.navigation.Navigation"/> + <jsp:directive.page import="com.arsdigita.london.navigation.NavigationModel"/> + + <jsp:scriptlet> + long age = Navigation.getConfig().getIndexPageCacheLifetime(); + if (age == 0) { + DispatcherHelper.cacheDisable(response); + } else { + DispatcherHelper.cacheForWorld(response, (int)age); + } + </jsp:scriptlet> + + <define:page name="alertConfirmPage" application="navigation" title="Confirm Consultation Alert" cache="false"> + <define:component name="greetingItem" + classname="com.arsdigita.london.navigation.ui.GreetingItem"/> + <define:component name="categoryPath" + classname="com.arsdigita.london.navigation.ui.category.Path"/> + <define:component name="categoryMenu" + classname="com.arsdigita.london.navigation.ui.category.Menu"/> + <define:component name="alertConfirm" + classname="com.arsdigita.camden.cms.contenttypes.ui.ConsultationAlertConfirm"/> + + <jsp:scriptlet> + NavigationModel navModel = ConsultationsNavigationModel.retrieve(); + ((com.arsdigita.london.navigation.ui.GreetingItem)greetingItem).setModel(navModel); + ((com.arsdigita.london.navigation.ui.category.Path)categoryPath).setModel(navModel); + ((com.arsdigita.london.navigation.ui.category.Menu)categoryMenu).setModel(navModel); + </jsp:scriptlet> + </define:page> + + <show:all/> +</jsp:root> Modified: contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/alert-new.jsp =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/alert-new.jsp 2005-08-10 16:18:14 UTC (rev 694) +++ contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/alert-new.jsp 2005-08-10 16:18:33 UTC (rev 695) @@ -18,7 +18,7 @@ } </jsp:scriptlet> - <define:page name="consultationsIndexPage" application="navigation" title="Consultations" cache="false"> + <define:page name="alertNewPage" application="navigation" title="Set Consultation Alert" cache="false"> <define:component name="greetingItem" classname="com.arsdigita.london.navigation.ui.GreetingItem"/> <define:component name="categoryPath" |
From: <cl...@vh...> - 2005-08-10 16:25:58
|
Author: clasohm Date: 2005-08-10 18:18:14 +0200 (Wed, 10 Aug 2005) New Revision: 694 Modified: ccm-ldn-aplaws/trunk/web/__ccm__/themes/aplaws/consultations-index.xsl Log: added Bebop Labels Modified: ccm-ldn-aplaws/trunk/web/__ccm__/themes/aplaws/consultations-index.xsl =================================================================== --- ccm-ldn-aplaws/trunk/web/__ccm__/themes/aplaws/consultations-index.xsl 2005-08-10 12:34:10 UTC (rev 693) +++ ccm-ldn-aplaws/trunk/web/__ccm__/themes/aplaws/consultations-index.xsl 2005-08-10 16:18:14 UTC (rev 694) @@ -18,6 +18,7 @@ <xsl:call-template name="dataTables" /> <xsl:call-template name="boxPanels1" /> <xsl:call-template name="forms" /> + <xsl:call-template name="labels" /> </xsl:template> <!-- Copied from ccm-core/web/packages/bebop/xsl/DataTable.xsl --> @@ -109,5 +110,15 @@ </xsl:for-each> </xsl:template> + <!-- Copied from ccm-core/web/packages/bebop/xsl/Label.xsl --> + <xsl:template name="labels"> + <xsl:for-each select="bebop:label"> + <xsl:call-template name="bebop-label-text"> + <xsl:with-param name="text" select="text()"/> + <xsl:with-param name="escape" select="@escape"/> + </xsl:call-template> + </xsl:for-each> + </xsl:template> + <xsl:output method="html"/> </xsl:stylesheet> |
From: <ssk...@vh...> - 2005-08-10 12:42:06
|
Author: sskracic Date: 2005-08-10 14:34:10 +0200 (Wed, 10 Aug 2005) New Revision: 693 Modified: releases/1.0.2/ccm-ldn-portal/application.xml releases/1.0.2/ccm-ldn-portal/src/com/arsdigita/london/portal/ui/portlet/ContentDirectoryPortletRenderer.java Log: Backport of r692: content directory portlet should order categories by the order specified. Modified: releases/1.0.2/ccm-ldn-portal/application.xml =================================================================== --- releases/1.0.2/ccm-ldn-portal/application.xml 2005-08-10 12:32:16 UTC (rev 692) +++ releases/1.0.2/ccm-ldn-portal/application.xml 2005-08-10 12:34:10 UTC (rev 693) @@ -3,7 +3,7 @@ name="ccm-ldn-portal" prettyName="Portal" version="1.4.2" - release="7" + release="8" webapp="ROOT"> <ccm:dependencies> <ccm:requires name="ccm-core" version="6.1.1"/> Modified: releases/1.0.2/ccm-ldn-portal/src/com/arsdigita/london/portal/ui/portlet/ContentDirectoryPortletRenderer.java =================================================================== --- releases/1.0.2/ccm-ldn-portal/src/com/arsdigita/london/portal/ui/portlet/ContentDirectoryPortletRenderer.java 2005-08-10 12:32:16 UTC (rev 692) +++ releases/1.0.2/ccm-ldn-portal/src/com/arsdigita/london/portal/ui/portlet/ContentDirectoryPortletRenderer.java 2005-08-10 12:34:10 UTC (rev 693) @@ -74,6 +74,7 @@ CategoryCollection cats = root.getDescendants(); cats.addEqualsFilter("parents.link.relationType", "child"); cats.addPath("parents.id"); + cats.addOrder("parents.link.sortKey"); Map children = new HashMap(); while (cats.next()) { |
From: <ssk...@vh...> - 2005-08-10 12:40:07
|
Author: sskracic Date: 2005-08-10 14:32:16 +0200 (Wed, 10 Aug 2005) New Revision: 692 Modified: ccm-ldn-portal/trunk/src/com/arsdigita/london/portal/ui/portlet/ContentDirectoryPortletRenderer.java Log: Display the categories respecting the order imposed through content admin UI. Modified: ccm-ldn-portal/trunk/src/com/arsdigita/london/portal/ui/portlet/ContentDirectoryPortletRenderer.java =================================================================== --- ccm-ldn-portal/trunk/src/com/arsdigita/london/portal/ui/portlet/ContentDirectoryPortletRenderer.java 2005-08-09 14:25:17 UTC (rev 691) +++ ccm-ldn-portal/trunk/src/com/arsdigita/london/portal/ui/portlet/ContentDirectoryPortletRenderer.java 2005-08-10 12:32:16 UTC (rev 692) @@ -74,6 +74,7 @@ CategoryCollection cats = root.getDescendants(); cats.addEqualsFilter("parents.link.relationType", "child"); cats.addPath("parents.id"); + cats.addOrder("parents.link.sortKey"); Map children = new HashMap(); while (cats.next()) { |