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: <ap...@vh...> - 2005-12-19 13:09:27
|
Author: apevec Date: 2005-12-19 14:06:32 +0100 (Mon, 19 Dec 2005) New Revision: 1067 Modified: trunk/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AtoZSiteProxyGenerator.java Log: use default Site Proxy element name to keep existing XSLT working with AtoZSiteProxyProvider Modified: trunk/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AtoZSiteProxyGenerator.java =================================================================== --- trunk/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AtoZSiteProxyGenerator.java 2005-12-18 20:15:30 UTC (rev 1066) +++ trunk/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AtoZSiteProxyGenerator.java 2005-12-19 13:06:32 UTC (rev 1067) @@ -80,7 +80,8 @@ } private class AtoZSiteProxyAtomicEntry implements AtoZAtomicEntry { - private static final String ATOZ_SITE_PROXY_CONTENT_NAME = "atoz:siteProxyContent"; + + private static final String SITE_PROXY_PANEL_NAME = "cms:siteProxyPanel"; private OID m_oid; @@ -110,8 +111,7 @@ if (m_url == null) return null; - Element child = new Element( - AtoZSiteProxyAtomicEntry.ATOZ_SITE_PROXY_CONTENT_NAME); + Element child = new Element(AtoZSiteProxyAtomicEntry.SITE_PROXY_PANEL_NAME); child.addAttribute("title", m_title); child.addAttribute("oid", m_oid.toString()); |
From: <ap...@vh...> - 2005-12-18 20:18:16
|
Author: apevec Date: 2005-12-18 21:15:30 +0100 (Sun, 18 Dec 2005) New Revision: 1066 Added: trunk/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AddAtoZ.java Log: command line class to add new AtoZ application instanace usage: ccm-run com.arsdigita.london.atoz.AddAtoZ [OPTION]... URL-FRAGMENT TITLE Added: trunk/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AddAtoZ.java =================================================================== --- trunk/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AddAtoZ.java 2005-12-18 19:20:50 UTC (rev 1065) +++ trunk/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AddAtoZ.java 2005-12-18 20:15:30 UTC (rev 1066) @@ -0,0 +1,81 @@ +package com.arsdigita.london.atoz; + +import org.apache.commons.cli.CommandLine; +import org.apache.log4j.Logger; + +import com.arsdigita.domain.DomainObject; +import com.arsdigita.domain.DomainObjectFactory; +import com.arsdigita.domain.DomainObjectInstantiator; +import com.arsdigita.kernel.ACSObjectInstantiator; +import com.arsdigita.kernel.Kernel; +import com.arsdigita.kernel.KernelExcursion; +import com.arsdigita.london.util.Program; +import com.arsdigita.london.util.Transaction; +import com.arsdigita.persistence.DataObject; +import com.arsdigita.web.Application; +import com.arsdigita.web.ApplicationSetup; +import com.arsdigita.web.ApplicationType; +import com.arsdigita.web.ApplicationTypeCollection; + +public class AddAtoZ extends Program { + + private static final Logger LOG = Logger.getLogger(AddAtoZ.class); + + public AddAtoZ() { + super("Add AtoZ instance", "1.0.0", "URL-FRAGMENT TITLE"); + } + + private void addAtoZ(String atozURL, String atozTitle) { + if (!Application.isInstalled(AtoZ.BASE_DATA_OBJECT_TYPE, "/"+atozURL+"/")) { + DomainObjectFactory.registerInstantiator( + AtoZ.BASE_DATA_OBJECT_TYPE, new DomainObjectInstantiator() { + public DomainObject doNewInstance(DataObject dataObject) { + return new AtoZ(dataObject); + } + }); + Application app = Application.createApplication( + AtoZ.BASE_DATA_OBJECT_TYPE, atozURL, atozTitle, null); + app.save(); + } else { + System.err.println(AtoZ.BASE_DATA_OBJECT_TYPE + + " already installed at " + atozURL); + System.exit(1); + } + } + + protected void doRun(final CommandLine cmdLine) { + new Transaction() { + public void doRun() { + new KernelExcursion() { + public void excurse() { + setEffectiveParty(Kernel.getSystemParty()); + String[] args = cmdLine.getArgs(); + if (args.length == 2) { + String atozURL = args[0]; + String atozTitle = args[1]; + if (atozURL != null && atozURL.length() != 0 + && atozTitle != null && atozTitle.length() != 0) { + addAtoZ(atozURL, atozTitle); + } else { + help(System.err); + System.exit(1); + } + } else { + help(System.err); + System.exit(1); + } + } + }.run(); + } + }.run(); + + } + + /** + * @param args + */ + public static void main(String[] args) { + new AddAtoZ().run(args); + } + +} |
From: <ap...@vh...> - 2005-12-18 19:23:29
|
Author: apevec Date: 2005-12-18 20:20:50 +0100 (Sun, 18 Dec 2005) New Revision: 1065 Modified: trunk/ccm-ldn-atoz/pdl/com/arsdigita/london/atoz/AtoZCategoryProvider.pdl Log: apply ContentType black-list to subsite AtoZ query Modified: trunk/ccm-ldn-atoz/pdl/com/arsdigita/london/atoz/AtoZCategoryProvider.pdl =================================================================== --- trunk/ccm-ldn-atoz/pdl/com/arsdigita/london/atoz/AtoZCategoryProvider.pdl 2005-12-18 19:19:32 UTC (rev 1064) +++ trunk/ccm-ldn-atoz/pdl/com/arsdigita/london/atoz/AtoZCategoryProvider.pdl 2005-12-18 19:20:50 UTC (rev 1065) @@ -182,6 +182,18 @@ where b.category_id = c.category_id and b.provider_id = :providerID ) + and not exists ( + select 1 + from atoz_cat_ct_blacklist_map b, cat_object_category_map m, + cms_bundles cb, cms_items ci + where b.type_id = ci.type_id + and ci.parent_id = cb.bundle_id + and ci.language = cb.default_language + and cb.bundle_id = m.object_id + and m.category_id = c.category_id + and m.index_p = '1' + and b.provider_id = :providerID + ) union select c.category_id as id, a.object_type as object_type, |
From: <ap...@vh...> - 2005-12-18 19:22:28
|
Author: apevec Date: 2005-12-18 20:19:32 +0100 (Sun, 18 Dec 2005) New Revision: 1064 Added: trunk/ccm-ldn-terms/doc/esd/xml-ipsv/mapping-ipsv-1.00-lgcl-1.04.xml trunk/ccm-ldn-terms/doc/esd/xml-ipsv/mapping-lgsl-2.01-ipsv-1.00.xml trunk/ccm-ldn-terms/doc/esd/xml-ipsv/related-ipsv-1.00.xml Log: IPSV mappings to/from LGSL and LGCL and related IPSV terms Added: trunk/ccm-ldn-terms/doc/esd/xml-ipsv/mapping-ipsv-1.00-lgcl-1.04.xml =================================================================== --- trunk/ccm-ldn-terms/doc/esd/xml-ipsv/mapping-ipsv-1.00-lgcl-1.04.xml 2005-12-16 18:38:17 UTC (rev 1063) +++ trunk/ccm-ldn-terms/doc/esd/xml-ipsv/mapping-ipsv-1.00-lgcl-1.04.xml 2005-12-18 19:19:32 UTC (rev 1064) @@ -0,0 +1,11273 @@ +<?xml version="1.0"?> +<terms:mapping xmlns:terms="http://xmlns.redhat.com/london/terms/1.0"> + <terms:source> + <terms:domain resource="http://www.esd.org.uk/standards/ipsv/1.00/ipsvtermslist.xml"/> + </terms:source> + <terms:destination> + <terms:domain resource="http://www.esd.org.uk/standards/lgcl/1.04/termslist.xml"/> + </terms:destination> + <terms:orderedPair> + <terms:source> + <terms:term id="692"/> + </terms:source> + <terms:destination> + <terms:term id="1"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="981"/> + </terms:source> + <terms:destination> + <terms:term id="1007"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="468"/> + </terms:source> + <terms:destination> + <terms:term id="1008"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="2173"/> + </terms:source> + <terms:destination> + <terms:term id="1010"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="6113"/> + </terms:source> + <terms:destination> + <terms:term id="1011"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="2183"/> + </terms:source> + <terms:destination> + <terms:term id="1017"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="6733"/> + </terms:source> + <terms:destination> + <terms:term id="1021"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="1041"/> + </terms:source> + <terms:destination> + <terms:term id="1025"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="1452"/> + </terms:source> + <terms:destination> + <terms:term id="1026"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="1452"/> + </terms:source> + <terms:destination> + <terms:term id="1027"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="1452"/> + </terms:source> + <terms:destination> + <terms:term id="1028"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="869"/> + </terms:source> + <terms:destination> + <terms:term id="1029"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="509"/> + </terms:source> + <terms:destination> + <terms:term id="103"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="390"/> + </terms:source> + <terms:destination> + <terms:term id="1030"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="391"/> + </terms:source> + <terms:destination> + <terms:term id="1031"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="393"/> + </terms:source> + <terms:destination> + <terms:term id="1032"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="1237"/> + </terms:source> + <terms:destination> + <terms:term id="1037"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="616"/> + </terms:source> + <terms:destination> + <terms:term id="1039"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4459"/> + </terms:source> + <terms:destination> + <terms:term id="104"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="5047"/> + </terms:source> + <terms:destination> + <terms:term id="1041"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="578"/> + </terms:source> + <terms:destination> + <terms:term id="1041"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4959"/> + </terms:source> + <terms:destination> + <terms:term id="1042"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4965"/> + </terms:source> + <terms:destination> + <terms:term id="1043"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="362"/> + </terms:source> + <terms:destination> + <terms:term id="1044"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="203"/> + </terms:source> + <terms:destination> + <terms:term id="1045"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="198"/> + </terms:source> + <terms:destination> + <terms:term id="1046"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4867"/> + </terms:source> + <terms:destination> + <terms:term id="1047"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4892"/> + </terms:source> + <terms:destination> + <terms:term id="1048"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4869"/> + </terms:source> + <terms:destination> + <terms:term id="1049"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4464"/> + </terms:source> + <terms:destination> + <terms:term id="105"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4870"/> + </terms:source> + <terms:destination> + <terms:term id="1050"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4869"/> + </terms:source> + <terms:destination> + <terms:term id="1051"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4902"/> + </terms:source> + <terms:destination> + <terms:term id="1052"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4877"/> + </terms:source> + <terms:destination> + <terms:term id="1053"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4894"/> + </terms:source> + <terms:destination> + <terms:term id="1054"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4872"/> + </terms:source> + <terms:destination> + <terms:term id="1055"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4891"/> + </terms:source> + <terms:destination> + <terms:term id="1056"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4893"/> + </terms:source> + <terms:destination> + <terms:term id="1057"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4868"/> + </terms:source> + <terms:destination> + <terms:term id="1058"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4398"/> + </terms:source> + <terms:destination> + <terms:term id="106"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4908"/> + </terms:source> + <terms:destination> + <terms:term id="1065"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="202"/> + </terms:source> + <terms:destination> + <terms:term id="1066"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="5748"/> + </terms:source> + <terms:destination> + <terms:term id="1067"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="5049"/> + </terms:source> + <terms:destination> + <terms:term id="1068"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4972"/> + </terms:source> + <terms:destination> + <terms:term id="1069"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4636"/> + </terms:source> + <terms:destination> + <terms:term id="107"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="5053"/> + </terms:source> + <terms:destination> + <terms:term id="1070"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="360"/> + </terms:source> + <terms:destination> + <terms:term id="1072"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="201"/> + </terms:source> + <terms:destination> + <terms:term id="1073"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4806"/> + </terms:source> + <terms:destination> + <terms:term id="1074"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4817"/> + </terms:source> + <terms:destination> + <terms:term id="1075"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4797"/> + </terms:source> + <terms:destination> + <terms:term id="1076"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4815"/> + </terms:source> + <terms:destination> + <terms:term id="1077"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4793"/> + </terms:source> + <terms:destination> + <terms:term id="1078"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4836"/> + </terms:source> + <terms:destination> + <terms:term id="1079"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="1195"/> + </terms:source> + <terms:destination> + <terms:term id="108"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4849"/> + </terms:source> + <terms:destination> + <terms:term id="1080"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4788"/> + </terms:source> + <terms:destination> + <terms:term id="1081"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4842"/> + </terms:source> + <terms:destination> + <terms:term id="1082"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4802"/> + </terms:source> + <terms:destination> + <terms:term id="1083"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4804"/> + </terms:source> + <terms:destination> + <terms:term id="1084"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4789"/> + </terms:source> + <terms:destination> + <terms:term id="1085"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4856"/> + </terms:source> + <terms:destination> + <terms:term id="1086"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="6970"/> + </terms:source> + <terms:destination> + <terms:term id="1087"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4808"/> + </terms:source> + <terms:destination> + <terms:term id="1088"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4786"/> + </terms:source> + <terms:destination> + <terms:term id="1089"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4640"/> + </terms:source> + <terms:destination> + <terms:term id="109"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4800"/> + </terms:source> + <terms:destination> + <terms:term id="1090"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4812"/> + </terms:source> + <terms:destination> + <terms:term id="1091"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="196"/> + </terms:source> + <terms:destination> + <terms:term id="1092"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4860"/> + </terms:source> + <terms:destination> + <terms:term id="1092"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="430"/> + </terms:source> + <terms:destination> + <terms:term id="1093"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4820"/> + </terms:source> + <terms:destination> + <terms:term id="1094"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4795"/> + </terms:source> + <terms:destination> + <terms:term id="1095"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4807"/> + </terms:source> + <terms:destination> + <terms:term id="1096"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4960"/> + </terms:source> + <terms:destination> + <terms:term id="1097"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4526"/> + </terms:source> + <terms:destination> + <terms:term id="1098"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="5949"/> + </terms:source> + <terms:destination> + <terms:term id="11"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="580"/> + </terms:source> + <terms:destination> + <terms:term id="1100"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="5727"/> + </terms:source> + <terms:destination> + <terms:term id="1101"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="581"/> + </terms:source> + <terms:destination> + <terms:term id="1102"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="5729"/> + </terms:source> + <terms:destination> + <terms:term id="1103"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="5725"/> + </terms:source> + <terms:destination> + <terms:term id="1104"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="5731"/> + </terms:source> + <terms:destination> + <terms:term id="1105"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="5164"/> + </terms:source> + <terms:destination> + <terms:term id="1106"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="534"/> + </terms:source> + <terms:destination> + <terms:term id="1106"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="1164"/> + </terms:source> + <terms:destination> + <terms:term id="1107"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="2673"/> + </terms:source> + <terms:destination> + <terms:term id="1108"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="533"/> + </terms:source> + <terms:destination> + <terms:term id="1109"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="1027"/> + </terms:source> + <terms:destination> + <terms:term id="111"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="580"/> + </terms:source> + <terms:destination> + <terms:term id="1110"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="5267"/> + </terms:source> + <terms:destination> + <terms:term id="1111"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="5070"/> + </terms:source> + <terms:destination> + <terms:term id="1113"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="5073"/> + </terms:source> + <terms:destination> + <terms:term id="1114"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="5083"/> + </terms:source> + <terms:destination> + <terms:term id="1116"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="829"/> + </terms:source> + <terms:destination> + <terms:term id="1118"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="628"/> + </terms:source> + <terms:destination> + <terms:term id="1120"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="5130"/> + </terms:source> + <terms:destination> + <terms:term id="1121"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="1119"/> + </terms:source> + <terms:destination> + <terms:term id="1122"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="5782"/> + </terms:source> + <terms:destination> + <terms:term id="1123"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="1755"/> + </terms:source> + <terms:destination> + <terms:term id="1124"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="911"/> + </terms:source> + <terms:destination> + <terms:term id="1125"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="5755"/> + </terms:source> + <terms:destination> + <terms:term id="1126"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="4927"/> + </terms:source> + <terms:destination> + <terms:term id="1127"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="5784"/> + </terms:source> + <terms:destination> + <terms:term id="1128"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="5180"/> + </terms:source> + <terms:destination> + <terms:term id="1129"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="1195"/> + </terms:source> + <terms:destination> + <terms:term id="113"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="5070"/> + </terms:source> + <terms:destination> + <terms:term id="1130"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="652"/> + </terms:source> + <terms:destination> + <terms:term id="1131"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="529"/> + </terms:source> + <terms:destination> + <terms:term id="1132"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="5274"/> + </terms:source> + <terms:destination> + <terms:term id="1134"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="528"/> + </terms:source> + <terms:destination> + <terms:term id="1135"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="2707"/> + </terms:source> + <terms:destination> + <terms:term id="1136"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="450"/> + </terms:source> + <terms:destination> + <terms:term id="1137"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="446"/> + </terms:source> + <terms:destination> + <terms:term id="1138"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="194"/> + </terms:source> + <terms:destination> + <terms:term id="1139"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="1464"/> + </terms:source> + <terms:destination> + <terms:term id="1140"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="2643"/> + </terms:source> + <terms:destination> + <terms:term id="1141"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="834"/> + </terms:source> + <terms:destination> + <terms:term id="1141"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="2643"/> + </terms:source> + <terms:destination> + <terms:term id="1142"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="2299"/> + </terms:source> + <terms:destination> + <terms:term id="1143"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="1120"/> + </terms:source> + <terms:destination> + <terms:term id="1145"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="504"/> + </terms:source> + <terms:destination> + <terms:term id="1146"/> + </terms:destination> + </terms:orderedPair> + <terms:orderedPair> + <terms:source> + <terms:term id="5663"/> .. |
From: <ssk...@vh...> - 2005-12-16 18:41:01
|
Author: sskracic Date: 2005-12-16 19:38:17 +0100 (Fri, 16 Dec 2005) New Revision: 1063 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/ConsultationUtil.java Log: Actually enabled SMS alerts. 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-12-16 18:37:04 UTC (rev 1062) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationInitializer.java 2005-12-16 18:38:17 UTC (rev 1063) @@ -45,8 +45,8 @@ 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 = 17; - public final static int ALERT_MINUTE = 41; + public final static int ALERT_HOUR = 5; + public final static int ALERT_MINUTE = 12; public final static int SMS_ALERT_HOUR = 9; public final static int SMS_ALERT_MINUTE = 1; @@ -106,7 +106,7 @@ TransactionContext txn = ssn.getTransactionContext(); txn.beginTxn(); setEffectiveParty(Kernel.getSystemParty()); - // ConsultationAlert.sendSMSAlerts(); + ConsultationAlert.sendSMSAlerts(); txn.commitTxn(); } }.run(); 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-12-16 18:37:04 UTC (rev 1062) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationUtil.java 2005-12-16 18:38:17 UTC (rev 1063) @@ -168,7 +168,7 @@ String siteURL = URL.root().getURL(); String[] args = { pin, siteURL }; String from = getConfig().getAlertsSenderEmail(); - String smsSubject = (String) globalize("sms.pin.body").localize(locale); + String smsSubject = (String) globalize("sms.pin.subject").localize(locale); String smsText = (String) globalize("sms.pin.text", args).localize(locale); String smsEmail = getConfig().getSMSProvider().getEmail(mobileNumber); try { |
From: <ssk...@vh...> - 2005-12-16 18:39:48
|
Author: sskracic Date: 2005-12-16 19:37:04 +0100 (Fri, 16 Dec 2005) New Revision: 1062 Added: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/VipSMSProvider.java Log: A class used only for testing, since I doubt that many Aplaws+ developers have a Vipnet mobile number. Added: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/VipSMSProvider.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/VipSMSProvider.java 2005-12-16 18:01:03 UTC (rev 1061) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/VipSMSProvider.java 2005-12-16 18:37:04 UTC (rev 1062) @@ -0,0 +1,52 @@ +package com.arsdigita.camden.cms.contenttypes; + +import com.arsdigita.bebop.parameters.ParameterData; +import com.arsdigita.util.Assert; + +/** + * Used for testing only, since it accepts only + * Vipnet customers in Croatia. + */ +public class VipSMSProvider implements SMSEmailProvider { + + // this will fail when number portability shows up :) + public static final String VIP_MOBILE_PREFIX = "38591"; + + /** + * Provides the email address that will be used as gateway + * to the SMS for the supplied mobile number. + */ + public String getEmail(String mobileNumber) { + // trim everything that is not a digit + String trimmedNumber = mobileNumber.replaceAll("[^0-9]", ""); + Assert.truth(trimmedNumber.startsWith(VIP_MOBILE_PREFIX), + "The number " + mobileNumber + " is not a VIP mobile number"); + return trimmedNumber + "@sms.vip.hr"; + } + + /** + * Performs a mobile number validation for the supplied number. + * Errors, if any, will be attached to the supplied ParameterData object. + * The number will be normalised, ie. will start with +385 + * @param data ParameterData for the mobile number UI widget + */ + public void validateNumber(ParameterData data) { + String number = data.getValue().toString().replaceAll("[^0-9]", ""); + // number is valid if it starts with VIP prefix + // First strip the leading country prefix, if exists + number = number.replaceFirst("^385", ""); + // then strip the leading zero + number = number.replaceFirst("^0", ""); + // We now have to have a number starting with 91 to denote Vipnet. + // It must be at least (or exactly?) 9 digits in length + // 91 xxx xx xx + if (!number.startsWith("91") || number.length() < 9) { + data.addError((String)ConsultationUtil. + globalize("invalid_mobile").localize()); + } else { + data.setValue("+385" + number); + } + } + +} + Property changes on: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/VipSMSProvider.java ___________________________________________________________________ Name: svn:keywords + Id Author URL |
From: <ssk...@vh...> - 2005-12-16 18:03:47
|
Author: sskracic Date: 2005-12-16 19:01:03 +0100 (Fri, 16 Dec 2005) New Revision: 1061 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/ConsultationUtil.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/MobifiSMSProvider.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/SMSEmailProvider.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAlertForm.java Log: Another interim commit ... 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-12-16 17:21:53 UTC (rev 1060) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationResources.properties 2005-12-16 18:01:03 UTC (rev 1061) @@ -313,6 +313,11 @@ \n\ {3} +sms.pin.subject=PIN +# {0}: PIN for mobile number verification +# {1}: public URL of the server +sms.pin.text=Your PIN is {0}. Used for mob. number verification for {1} + sms.alert.subject=New consultations # {0}: number of newly published consultations # {1}: public URL of the server 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-12-16 17:21:53 UTC (rev 1060) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationUtil.java 2005-12-16 18:01:03 UTC (rev 1061) @@ -18,15 +18,6 @@ */ 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; @@ -36,9 +27,19 @@ import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.kernel.Kernel; import com.arsdigita.london.rss.RSS; +import com.arsdigita.mail.Mail; import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.SessionManager; import com.arsdigita.web.Application; +import com.arsdigita.web.URL; +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 javax.mail.MessagingException; +import org.apache.log4j.Logger; /** * Miscellaneous utility methods for the Consultation content type. @@ -49,7 +50,7 @@ public class ConsultationUtil { private static final Logger s_log = - Logger.getLogger(ConsultationUtil.class.getName()); + Logger.getLogger(ConsultationUtil.class); public static final String APPLICATION_X_BINARY = "application/x-binary"; @@ -161,4 +162,23 @@ return m_rssCategoryID; } + + public static void sendPin(String mobileNumber, String pin) { + Locale locale = Locale.getDefault(); + String siteURL = URL.root().getURL(); + String[] args = { pin, siteURL }; + String from = getConfig().getAlertsSenderEmail(); + String smsSubject = (String) globalize("sms.pin.body").localize(locale); + String smsText = (String) globalize("sms.pin.text", args).localize(locale); + String smsEmail = getConfig().getSMSProvider().getEmail(mobileNumber); + try { + s_log.debug("About to send PIN to " + mobileNumber + " using email: " + smsEmail); + Mail.send(smsEmail, from, smsSubject, smsText); + } catch (MessagingException ex) { + s_log.warn("Exception while sending pin to " + + smsEmail + ": " + ex.getMessage()); + } + } + + } Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/MobifiSMSProvider.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/MobifiSMSProvider.java 2005-12-16 17:21:53 UTC (rev 1060) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/MobifiSMSProvider.java 2005-12-16 18:01:03 UTC (rev 1061) @@ -1,5 +1,6 @@ package com.arsdigita.camden.cms.contenttypes; +import com.arsdigita.bebop.parameters.ParameterData; import com.arsdigita.util.Assert; public class MobifiSMSProvider implements SMSEmailProvider { @@ -18,5 +19,29 @@ return trimmedNumber + "@sms.mobifi.com"; } + /** + * Performs a mobile number validation for the supplied number. + * Errors, if any, will be attached to the supplied ParameterData object. + * The number will be normalised, ie. will start with +44 + * @param data ParameterData for the mobile number UI widget + */ + public void validateNumber(ParameterData data) { + String number = data.getValue().toString().replaceAll("[^0-9]", ""); + // number is valid if it starts with 447 or 07 or 7 + // First strip the leading country prefix, if exists + number = number.replaceFirst("^44", ""); + // then strip the leading zero + number = number.replaceFirst("^0", ""); + // We now have to have a number starting with 7 to denote UK mobile networks. + // It must be at least (or exactly?) 10 digits in length + // 7789 xxx xxx + if (!number.startsWith("7") || number.length() < 10) { + data.addError((String)ConsultationUtil. + globalize("invalid_mobile").localize()); + } else { + data.setValue("+44" + number); + } + } + } Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/SMSEmailProvider.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/SMSEmailProvider.java 2005-12-16 17:21:53 UTC (rev 1060) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/SMSEmailProvider.java 2005-12-16 18:01:03 UTC (rev 1061) @@ -1,11 +1,23 @@ package com.arsdigita.camden.cms.contenttypes; -interface SMSEmailProvider { +import com.arsdigita.bebop.parameters.ParameterData; +public interface SMSEmailProvider { + /** * Provides the email address that will be used as gateway * to the SMS for the supplied mobile number. + * @param mobileNumber mobile number we want to send an SMS to + * @return the email address of a email2SMS gateway for that mobile */ String getEmail(String mobileNumber); + + /** + * Performs a mobile number validation for the supplied number. + * Errors, if any, will be attached to the supplied ParameterData object. + * @param data ParameterData for the mobile number UI widget + */ + void validateNumber(ParameterData data); + } 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-12-16 17:21:53 UTC (rev 1060) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAlertForm.java 2005-12-16 18:01:03 UTC (rev 1061) @@ -179,22 +179,7 @@ if (data == null || data.getValue().toString().trim().length() == 0) { return; } - // strip everything but digits - String number = data.getValue().toString().replaceAll("[^0-9]", ""); - // number is valid if it starts with 447 or 07 or 7 - // First strip the leading country prefix, if exists - number = number.replaceFirst("^44", ""); - // then strip the leading zero - number = number.replaceFirst("^0", ""); - // We now have to have a number starting with 7 to denote UK mobile network. - // It must be at least (or exactly?) 10 digits in length - // 7789 xxx xxx - if (!number.startsWith("7") || number.length() < 10) { - data.addError((String)ConsultationUtil. - globalize("invalid_mobile").localize()); - } else { - data.setValue("+44" + number); - } + ConsultationUtil.getConfig().getSMSProvider().validateNumber(data); } }); addField(ConsultationUtil.globalize("mobile"), m_mobile); @@ -282,10 +267,11 @@ if (mobile != null && mobile.trim().length() > 0) { alert.setMobileNumber(mobile); alert.randomizePin(4); + alert.setMobileConfirmed(Boolean.FALSE); alert.save(); m_pinLabel.setVisible(state, true); m_pin.setVisible(state, true); - fireInit(event); + ConsultationUtil.sendPin(mobile, alert.getMobilePin()); return; } else { // clear the mobile number that might have been submitted previously |
Author: sskracic Date: 2005-12-16 18:21:53 +0100 (Fri, 16 Dec 2005) New Revision: 1060 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/ConsultationAlert.pdl contrib/ccm-ldn-camden-consultation/trunk/sql/ccm-ldn-camden-consultation/upgrade/oracle-se-1.0.3-1.1.0.sql 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/ConsultationConfig.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: Another interim commit, work-in-progress ... 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-12-16 16:21:58 UTC (rev 1059) +++ contrib/ccm-ldn-camden-consultation/trunk/pdl/com/arsdigita/camden/cms/contenttypes/Consultation.pdl 2005-12-16 17:21:53 UTC (rev 1060) @@ -36,6 +36,7 @@ String[0..1] methodology = cam_consultations.methodology CLOB; String[0..1] feedback = cam_consultations.feedback CLOB; Boolean[1..1] alertSent = cam_consultations.alert_sent; + Boolean[1..1] smsAlertSent = cam_consultations.sms_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-12-16 16:21:58 UTC (rev 1059) +++ contrib/ccm-ldn-camden-consultation/trunk/pdl/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.pdl 2005-12-16 17:21:53 UTC (rev 1060) @@ -36,8 +36,37 @@ reference key (cam_consultation_alerts.alert_id); } +query newSMSConsultations { + BigDecimal id; + + do { + select + draft.consultation_id + from + cms_items ci, + cam_consultations draft, + cam_consultations live + where + ci.item_id = live.consultation_id + and ci.master_id = draft.consultation_id + and draft.sms_alert_sent = '0' + } map { + id = draft.consultation_id; + } +} + +data operation setSMSAlertSent { + do { + update cam_consultations + set sms_alert_sent = '1' + where consultation_id in :consultationIDs + } +} + + query newConsultations { BigDecimal id; + BigDecimal masterId; String purpose; String contact; String topic; @@ -53,7 +82,7 @@ String title; do { - select live.*, pa.* + select live.*, pa.*, i.master_id from cam_consultations live, cam_consultations draft, cms_pages pa, cms_items i where pa.item_id = live.consultation_id @@ -63,6 +92,7 @@ and draft.alert_sent = '0' } map { id = consultation_id; + masterId = master_id; purpose = purpose; contact = contact; topic = topic; @@ -83,13 +113,6 @@ 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) + where consultation_id in :consultationIDs } } Modified: contrib/ccm-ldn-camden-consultation/trunk/sql/ccm-ldn-camden-consultation/upgrade/oracle-se-1.0.3-1.1.0.sql =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/sql/ccm-ldn-camden-consultation/upgrade/oracle-se-1.0.3-1.1.0.sql 2005-12-16 16:21:58 UTC (rev 1059) +++ contrib/ccm-ldn-camden-consultation/trunk/sql/ccm-ldn-camden-consultation/upgrade/oracle-se-1.0.3-1.1.0.sql 2005-12-16 17:21:53 UTC (rev 1060) @@ -5,3 +5,12 @@ alter table cam_consultation_alerts add constraint cam_con_ale_mob_confir_c_3cz1u check(mobile_confirmed in ('0', '1')); +alter table cam_consultations add sms_alert_sent CHAR(1); + +update cam_consultations set + sms_alert_sent = alert_sent; + +alter table cam_consultations modify sms_alert_sent not null; +alter table cam_consultations + add constraint cam_consu_sms_ale_sent_c_ft8qe + check(sms_alert_sent in ('0', '1')) ; 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-12-16 16:21:58 UTC (rev 1059) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/Consultation.java 2005-12-16 17:21:53 UTC (rev 1060) @@ -73,6 +73,7 @@ public static final String FEEDBACK = "feedback"; public static final String FEEDBACK_DOCUMENTS = "feedbackDocuments"; public static final String ALERT_SENT = "alertSent"; + public static final String SMS_ALERT_SENT = "smsAlertSent"; private static final String SEPARATOR = "/"; @@ -284,6 +285,14 @@ set(ALERT_SENT, value); } + public Boolean getSMSAlertSent() { + return (Boolean) get(SMS_ALERT_SENT); + } + + public void setSMSAlertSent(Boolean value) { + set(SMS_ALERT_SENT, value); + } + public String[] getTargetAudience() { String value = (String) get(TARGET_AUDIENCE); if (value == null) { 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-12-16 16:21:58 UTC (rev 1059) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java 2005-12-16 17:21:53 UTC (rev 1060) @@ -5,7 +5,6 @@ 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; @@ -285,7 +284,67 @@ } } + /** + * <p>Sends alert SMS if there are newly published Consultation items + * since the last time SMS alerts have been sent. + * </p> + */ + + public static void sendSMSAlerts() { + Session dbSession = SessionManager.getSession(); + Locale locale = Locale.getDefault(); + + DataQuery items = + dbSession.retrieveQuery("com.arsdigita.camden.cms.contenttypes.newSMSConsultations"); + + Collection itemIDs = new LinkedList(); + while (items.next()) { + itemIDs.add( (BigDecimal) items.get(Consultation.ID)); + } + + int itemCount = itemIDs.size(); + if (itemCount == 0) { + return; + } + + // Compose the text of an SMS instance: + + DataCollection alerts = dbSession.retrieve(BASE_DATA_OBJECT_TYPE); + alerts.addEqualsFilter(EMAIL_CONFIRMED, Boolean.TRUE); + alerts.addEqualsFilter(MOBILE_CONFIRMED, Boolean.TRUE); + + String siteURL = URL.root().getURL(); + String from = ConsultationUtil.getConfig().getAlertsSenderEmail(); + + String[] args = { String.valueOf(itemCount), siteURL }; + String smsText = (String) ConsultationUtil.globalize("sms.alert.text", args).localize(locale); + // Not sure whether this gets through the gateway at all + String smsSubject = (String) ConsultationUtil.globalize("sms.alert.subject").localize(locale); + + while (alerts.next()) { + ConsultationAlert alert = new ConsultationAlert(alerts.getDataObject()); + String mobile = alert.getMobileNumber(); + // Convert mobile number to email2sms gateway address + String smsEmail = ConsultationUtil.getConfig().getSMSProvider().getEmail(mobile); + + try { + s_log.debug("About to send SMS alert to " + mobile + " using email: " + smsEmail + ", body: " + smsText); + Mail.send(smsEmail, from, smsSubject, smsText); + } catch (MessagingException ex) { + s_log.warn("Exception while sending consultation alert to " + + smsEmail + ": " + ex.getMessage()); + } + } + + DataOperation op = + dbSession.retrieveDataOperation("com.arsdigita.camden.cms.contenttypes.setSMSAlertSent"); + op.setParameter("consultationIDs", itemIDs); + op.execute(); + } + + + /** * <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 @@ -335,6 +394,7 @@ (String)ConsultationUtil.globalize("results_feedback").localize(locale); String siteURL = URL.root().getURL(); + URL rootURL = URL.root(); // Remove the trailing slash, if there is one. if (siteURL.endsWith("/")) @@ -348,11 +408,18 @@ 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); + BigDecimal id = (BigDecimal)items.get("masterId"); - String itemURL = - siteURL + - Navigation.redirectURL(new OID(Consultation.BASE_DATA_OBJECT_TYPE, id)); + OID oid = new OID(Consultation.BASE_DATA_OBJECT_TYPE, id); + ParameterMap map = new ParameterMap(); + map.setParameter("oid", oid.toString()); + map.setParameter("context", "live"); + String itemURL = siteURL + (new URL(rootURL.getScheme(), + rootURL.getServerName(), + rootURL.getServerPort(), + "", + "", + "/redirect/", map )).toString(); String topic = Consultation.internalGetPrettyTopics((String)items.get(Consultation.TOPIC)); String consultationType = Consultation.internalGetPrettyTypes((String)items.get(Consultation.CONSULTATION_TYPE)); 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-12-16 16:21:58 UTC (rev 1059) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationConfig.java 2005-12-16 17:21:53 UTC (rev 1060) @@ -73,7 +73,7 @@ return result; } - public SMSEmailProvider getSmsProvider() { + public SMSEmailProvider getSMSProvider() { return (SMSEmailProvider) get(m_smsProvider); } 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-12-16 16:21:58 UTC (rev 1059) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationInitializer.java 2005-12-16 17:21:53 UTC (rev 1060) @@ -18,16 +18,19 @@ */ package com.arsdigita.camden.cms.contenttypes; -import java.util.Calendar; -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.persistence.Session; +import com.arsdigita.persistence.SessionManager; +import com.arsdigita.persistence.TransactionContext; import com.arsdigita.runtime.LegacyInitEvent; import com.arsdigita.search.MetadataProviderRegistry; +import java.util.Calendar; +import java.util.Date; +import java.util.Timer; +import java.util.TimerTask; +import org.apache.log4j.Logger; /** * Runtime initialization for the Consultations content type. @@ -36,12 +39,18 @@ * @version $Id: ConsultationInitializer.java 24 2005-08-02 14:14:14Z clasohm $ */ public class ConsultationInitializer extends ContentTypeInitializer { + private static final Logger s_log = + Logger.getLogger(ConsultationInitializer.class); + 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 final static int ALERT_HOUR = 17; + public final static int ALERT_MINUTE = 41; + public final static int SMS_ALERT_HOUR = 9; + public final static int SMS_ALERT_MINUTE = 1; + public void init(LegacyInitEvent evt) { super.init(evt); @@ -59,19 +68,50 @@ cal.set(Calendar.HOUR_OF_DAY, ALERT_HOUR); cal.set(Calendar.MINUTE, ALERT_MINUTE); Date firstTime = cal.getTime(); + s_log.debug("First run for email alerts scheduled for " + firstTime); Timer timer = new Timer(true); timer.scheduleAtFixedRate(new TimerTask() { public void run() { new KernelExcursion() { protected void excurse() { + Session ssn = SessionManager.getSession(); + TransactionContext txn = ssn.getTransactionContext(); + txn.beginTxn(); setEffectiveParty(Kernel.getSystemParty()); ConsultationAlert.purgeUnconfirmed(); ConsultationAlert.sendAlerts(); + txn.commitTxn(); } }.run(); } }, firstTime, 24*60*60*1000); + + // Schedule SMS alerts which must go during working hours + Calendar cal2 = Calendar.getInstance(); + hourOfDay = cal2.get(Calendar.HOUR_OF_DAY); + minute = cal2.get(Calendar.MINUTE); + if (hourOfDay > SMS_ALERT_HOUR || hourOfDay == SMS_ALERT_HOUR && minute >= SMS_ALERT_MINUTE) + cal2.add(Calendar.DATE, 1); + cal2.set(Calendar.HOUR_OF_DAY, SMS_ALERT_HOUR); + cal2.set(Calendar.MINUTE, SMS_ALERT_MINUTE); + Date smsFirstTime = cal2.getTime(); + s_log.debug("First run for SMS alerts scheduled for " + smsFirstTime); + Timer timer2 = new Timer(true); + timer2.scheduleAtFixedRate(new TimerTask() { + public void run() { + new KernelExcursion() { + protected void excurse() { + Session ssn = SessionManager.getSession(); + TransactionContext txn = ssn.getTransactionContext(); + txn.beginTxn(); + setEffectiveParty(Kernel.getSystemParty()); + // ConsultationAlert.sendSMSAlerts(); + txn.commitTxn(); + } + }.run(); + } + }, smsFirstTime, 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-12-16 16:21:58 UTC (rev 1059) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationResources.properties 2005-12-16 17:21:53 UTC (rev 1060) @@ -188,13 +188,17 @@ first_names=First Names last_name=Last Name email=Email -mobile=Mobile Number +mobile=Mobile Number (optional) set_alert=Set Alert duplicate_alert=We already send alerts to the email address you entered. invalid_mobile=The number does not represent a valid UK mobile number. pin_verification=To verify your mobile number, enter the 4-digit PIN which should shortly \ arrive to your mobile phone. +pin_not_generated=A random PIN for your mobile number has not been generated. Please \ +redo the registration process. +pin_mismatch=Incorrect PIN. To reset your PIN, please reregister using the same email address. + confirm_token.invalid=\ <p>The URL contains a token for which we could not find \ any alert requests.</p>\ @@ -260,6 +264,23 @@ \n\ If you did not request alerts, you do not need to do anything. The request will be deleted automatically within the next 24 hours. +# The substitutions for confirm_request_with_sms 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 +# {3}: mobile number used for SMS alerts +confirm_request_with_sms.body=\ +We have received a request to alert {0} of new consultation information published on {1}consultations/\n\ +\n\ +To ensure that this request was made by you, alerts will only be sent after you confirm the request via the link below:\n\ +\n\ +{2}\n\ +\n\ +After confirmation, you will also receive SMS alerts on number {3}.\ +\n\ +\n\ +If you did not request alerts, you do not need to do anything. The request will be deleted automatically within the next 24 hours. + # {0}: site name alert.subject=New Consultations Published on {0} @@ -292,6 +313,11 @@ \n\ {3} +sms.alert.subject=New consultations +# {0}: number of newly published consultations +# {1}: public URL of the server +sms.alert.text=Check {0} new consultations at {1} + bulk_deletion=Bulk Deletion email_addresses=Email Addresses 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-12-16 16:21:58 UTC (rev 1059) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAlertForm.java 2005-12-16 17:21:53 UTC (rev 1060) @@ -81,6 +81,7 @@ public ConsultationAlertForm(String name, Label heading) { super(name, heading); + setRedirecting(false); try { addWidgets(); @@ -208,7 +209,7 @@ } }); - m_pinLabel = new Label(ConsultationUtil.globalize("pin_confirmation")); + m_pinLabel = new Label(ConsultationUtil.globalize("pin_verification")); m_pin = new Name(ConsultationAlert.MOBILE_PIN, 10, false); addField(m_pinLabel, m_pin); @@ -265,10 +266,16 @@ // Validate PIN here. String storedPin = alert.getMobilePin(); if (storedPin == null) { - throw new FormProcessException("PIN not generated."); + data.invalidate(); + data.addError(ConsultationAlert.MOBILE_PIN, (String)ConsultationUtil. + globalize("pin_not_generated").localize()); + return; } if (!storedPin.equals(data.getString(ConsultationAlert.MOBILE_PIN))) { - throw new FormProcessException("PIN mismatch."); + data.invalidate(); + data.addError(ConsultationAlert.MOBILE_PIN, (String)ConsultationUtil. + globalize("pin_mismatch").localize()); + return; } alert.setMobileConfirmed(Boolean.TRUE); } else { @@ -305,9 +312,13 @@ URL.here(Web.getRequest(), ConsultationAlert.CONFIRM_PATH, parameters).getURL(); - String[] args = {email, systemURL, confirmationURL}; - String body = (String)ConsultationUtil. - globalize("confirm_request.body", args).localize(); + String num = alert.getMobileNumber(); + String[] args = {email, systemURL, confirmationURL, num}; + String key = "confirm_request.body"; + if (Boolean.TRUE.equals(alert.getMobileConfirmed())) { + key = "confirm_request_with_sms.body"; + } + String body = (String)ConsultationUtil.globalize(key, args).localize(); try { Mail.send(email, from, subject, body); |
From: <ap...@vh...> - 2005-12-16 16:24:35
|
Author: apevec Date: 2005-12-16 17:21:58 +0100 (Fri, 16 Dec 2005) New Revision: 1059 Modified: releases/1.0.3/ccm-ldn-theme/application.xml Log: bump version for theme sync fix (r983) Modified: releases/1.0.3/ccm-ldn-theme/application.xml =================================================================== --- releases/1.0.3/ccm-ldn-theme/application.xml 2005-12-16 13:20:35 UTC (rev 1058) +++ releases/1.0.3/ccm-ldn-theme/application.xml 2005-12-16 16:21:58 UTC (rev 1059) @@ -3,7 +3,7 @@ name="ccm-ldn-theme" prettyName="Theme" version="6.2.0" - release="3"> + release="4"> <ccm:dependencies> <ccm:requires name="ccm-core" version="6.2.0" relation="ge"/> <ccm:requires name="ccm-ldn-subsite" version="6.2.0" relation="ge"/> |
Author: sskracic Date: 2005-12-16 14:20:35 +0100 (Fri, 16 Dec 2005) New Revision: 1058 Added: contrib/ccm-ldn-camden-consultation/trunk/sql/ccm-ldn-camden-consultation/upgrade/oracle-se-1.0.3-1.1.0.sql contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/MobifiSMSProvider.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/SMSEmailProvider.java Modified: contrib/ccm-ldn-camden-consultation/trunk/application.xml contrib/ccm-ldn-camden-consultation/trunk/pdl/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.pdl contrib/ccm-ldn-camden-consultation/trunk/src/ccm-ldn-camden-consultation.upgrade 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/ui/ConsultationAlertForm.java Log: Started working on SMS notifications. Work in progress. Modified: contrib/ccm-ldn-camden-consultation/trunk/application.xml =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/application.xml 2005-12-15 20:07:37 UTC (rev 1057) +++ contrib/ccm-ldn-camden-consultation/trunk/application.xml 2005-12-16 13:20:35 UTC (rev 1058) @@ -3,7 +3,7 @@ name="ccm-ldn-camden-consultation" prettyName="Red Hat CCM Content Types" version="1.1.0" - release="1" + release="0" 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/ConsultationAlert.pdl =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/pdl/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.pdl 2005-12-15 20:07:37 UTC (rev 1057) +++ contrib/ccm-ldn-camden-consultation/trunk/pdl/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.pdl 2005-12-16 13:20:35 UTC (rev 1058) @@ -29,6 +29,9 @@ String[1..1] confirmationToken = cam_consultation_alerts.confirmation_token VARCHAR(100); String[1..1] cancellationToken = cam_consultation_alerts.cancellation_token VARCHAR(100); Boolean[1..1] emailConfirmed = cam_consultation_alerts.email_confirmed; + String[0..1] mobileNumber = cam_consultation_alerts.mobile_number VARCHAR(100); + String[0..1] mobilePin = cam_consultation_alerts.mobile_pin VARCHAR(10); + Boolean[0..1] mobileConfirmed = cam_consultation_alerts.mobile_confirmed; reference key (cam_consultation_alerts.alert_id); } Added: contrib/ccm-ldn-camden-consultation/trunk/sql/ccm-ldn-camden-consultation/upgrade/oracle-se-1.0.3-1.1.0.sql =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/sql/ccm-ldn-camden-consultation/upgrade/oracle-se-1.0.3-1.1.0.sql 2005-12-15 20:07:37 UTC (rev 1057) +++ contrib/ccm-ldn-camden-consultation/trunk/sql/ccm-ldn-camden-consultation/upgrade/oracle-se-1.0.3-1.1.0.sql 2005-12-16 13:20:35 UTC (rev 1058) @@ -0,0 +1,7 @@ + +alter table cam_consultation_alerts add mobile_number VARCHAR(100); +alter table cam_consultation_alerts add mobile_pin VARCHAR(10); +alter table cam_consultation_alerts add mobile_confirmed CHAR(1); +alter table cam_consultation_alerts + add constraint cam_con_ale_mob_confir_c_3cz1u + check(mobile_confirmed in ('0', '1')); Property changes on: contrib/ccm-ldn-camden-consultation/trunk/sql/ccm-ldn-camden-consultation/upgrade/oracle-se-1.0.3-1.1.0.sql ___________________________________________________________________ Name: svn:keywords + Id Author URL 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-12-15 20:07:37 UTC (rev 1057) +++ contrib/ccm-ldn-camden-consultation/trunk/src/ccm-ldn-camden-consultation.upgrade 2005-12-16 13:20:35 UTC (rev 1058) @@ -8,4 +8,7 @@ <version from="1.0.2" to="1.0.3"> <script sql="ccm-ldn-camden-consultation/upgrade/::database::-1.0.2-1.0.3.sql"/> </version> + <version from="1.0.3" to="1.1.0"> + <script sql="ccm-ldn-camden-consultation/upgrade/::database::-1.0.3-1.1.0.sql"/> + </version> </upgrade> 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-12-15 20:07:37 UTC (rev 1057) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java 2005-12-16 13:20:35 UTC (rev 1058) @@ -1,17 +1,5 @@ package com.arsdigita.camden.cms.contenttypes; -import java.math.BigDecimal; -import java.security.GeneralSecurityException; -import java.util.Collection; -import java.util.Date; -import java.util.LinkedList; -import java.util.Locale; - -import javax.mail.MessagingException; - -import org.apache.commons.codec.binary.Base64; -import org.apache.log4j.Logger; - import com.arsdigita.cms.util.GlobalizationUtil; import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.globalization.GlobalizedMessage; @@ -32,6 +20,16 @@ import com.arsdigita.web.Web; import com.arsdigita.xml.Formatter; import com.arsdigita.xml.formatters.DateFormatter; +import java.math.BigDecimal; +import java.security.GeneralSecurityException; +import java.util.Collection; +import java.util.Date; +import java.util.LinkedList; +import java.util.Locale; +import java.util.Random; +import javax.mail.MessagingException; +import org.apache.commons.codec.binary.Base64; +import org.apache.log4j.Logger; /** * Alert requests for the Camden Consultation content type. @@ -56,6 +54,9 @@ public static final String CONFIRMATION_TOKEN = "confirmationToken"; public static final String CANCELLATION_TOKEN = "cancellationToken"; public static final String EMAIL_CONFIRMED = "emailConfirmed"; + public static final String MOBILE_NUMBER = "mobileNumber"; + public static final String MOBILE_PIN = "mobilePin"; + public static final String MOBILE_CONFIRMED = "mobileConfirmed"; public final static String CONFIRM_PATH = "/alert.jsp"; public final static String CONFIRM_PARAMETER = "co"; public final static String CANCEL_PARAMETER = "ca"; @@ -82,6 +83,7 @@ setConfirmationToken(getRandomString()); setCancellationToken(getRandomString()); setEmailConfirmed(Boolean.FALSE); + setMobileConfirmed(Boolean.FALSE); setCreationDate(new Date()); } @@ -149,6 +151,34 @@ set(EMAIL_CONFIRMED, value); } + public String getMobileNumber() { + return (String) get(MOBILE_NUMBER); + } + + public void setMobileNumber(String value) { + set(MOBILE_NUMBER, value); + } + + public String getMobilePin() { + return (String) get(MOBILE_PIN); + } + + public void randomizePin(int length) { + set(MOBILE_PIN, getRandomPin(length)); + } + + public void clearMobilePin() { + set(MOBILE_PIN, null); + } + + public Boolean getMobileConfirmed() { + return (Boolean) get(MOBILE_CONFIRMED); + } + + public void setMobileConfirmed(Boolean value) { + set(MOBILE_CONFIRMED, value); + } + private String getRandomString() { byte[] salt = new byte[8]; try { @@ -167,6 +197,21 @@ return result; } + private String getRandomPin(int length) { + StringBuffer pin = new StringBuffer(length); + Random random; + try { + random = Crypto.getRandom(); + } catch (GeneralSecurityException e) { + throw new RuntimeException(e); + } + for (int i=0; i<length; i++) { + pin.append(random.nextInt(10)); + } + return pin.toString(); + } + + public static String confirm(String token) { DataCollection alerts = SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE); 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-12-15 20:07:37 UTC (rev 1057) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationConfig.java 2005-12-16 13:20:35 UTC (rev 1058) @@ -22,6 +22,7 @@ import com.arsdigita.runtime.AbstractConfig; import com.arsdigita.util.parameter.Parameter; import com.arsdigita.util.parameter.StringParameter; +import com.arsdigita.util.parameter.SingletonParameter; /** * Defines the configuration parameters for the Camden Consultations @@ -40,11 +41,16 @@ "com.arsdigita.cms.camden.contenttypes.alerts_sender_email", Parameter.OPTIONAL, null); + private final Parameter m_smsProvider = new SingletonParameter + ("com.arsdigita.cms.camden.alerts_sms_provider", + Parameter.REQUIRED, new MobifiSMSProvider()); + private String m_adminEmail; public ConsultationConfig() { register(m_consultationsTermUrl); register(m_alertsSenderEmail); + register(m_smsProvider); loadInfo(); } @@ -67,4 +73,8 @@ return result; } + public SMSEmailProvider getSmsProvider() { + return (SMSEmailProvider) get(m_smsProvider); + } + } 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-12-15 20:07:37 UTC (rev 1057) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationConfig_parameter.properties 2005-12-16 13:20:35 UTC (rev 1058) @@ -1,8 +1,12 @@ -com.arsdigita.aplaws.consultations_term_url.title=The name of the Consultations Navigation Term -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] +com.arsdigita.cms.camden.consultations_term_url.title=The name of the Consultations Navigation Term +com.arsdigita.cms.camden.consultations_term_url.purpose=Used to display the right category menu and path in the Consultations UI. +com.arsdigita.cms.camden.consultations_term_url.example=Consultations +com.arsdigita.cms.camden.consultations_term_url.format=[string] +com.arsdigita.cms.camden.alerts_sender_email.title=The sender address for alert email +com.arsdigita.cms.camden.alerts_sender_email.purpose=This email address will receive bounces and user requests. +com.arsdigita.cms.camden.alerts_sender_email.example=bo...@ex... +com.arsdigita.cms.camden.alerts_sender_email.format=[string] +com.arsdigita.cms.camden.alerts_sms_provider.title=SMSEmailProvider implementation +com.arsdigita.cms.camden.alerts_sms_provider.purpose=A java class that implements the SMSEmailProvider interface +com.arsdigita.cms.camden.alerts_sms_provider.example=com.arsdigita.camden.cms.contenttypes.MobifiSMSProvider +com.arsdigita.cms.camden.alerts_sms_provider.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-12-15 20:07:37 UTC (rev 1057) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationResources.properties 2005-12-16 13:20:35 UTC (rev 1058) @@ -188,8 +188,12 @@ first_names=First Names last_name=Last Name email=Email +mobile=Mobile Number set_alert=Set Alert duplicate_alert=We already send alerts to the email address you entered. +invalid_mobile=The number does not represent a valid UK mobile number. +pin_verification=To verify your mobile number, enter the 4-digit PIN which should shortly \ +arrive to your mobile phone. confirm_token.invalid=\ <p>The URL contains a token for which we could not find \ Added: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/MobifiSMSProvider.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/MobifiSMSProvider.java 2005-12-15 20:07:37 UTC (rev 1057) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/MobifiSMSProvider.java 2005-12-16 13:20:35 UTC (rev 1058) @@ -0,0 +1,22 @@ +package com.arsdigita.camden.cms.contenttypes; + +import com.arsdigita.util.Assert; + +public class MobifiSMSProvider implements SMSEmailProvider { + + public static final String UK_MOBILE_PREFIX = "447"; + + /** + * Provides the email address that will be used as gateway + * to the SMS for the supplied mobile number. + */ + public String getEmail(String mobileNumber) { + // trim everything that is not a digit + String trimmedNumber = mobileNumber.replaceAll("[^0-9]", ""); + Assert.truth(trimmedNumber.startsWith(UK_MOBILE_PREFIX), + "The number " + mobileNumber + " is not a UK mobile number"); + return trimmedNumber + "@sms.mobifi.com"; + } + +} + Property changes on: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/MobifiSMSProvider.java ___________________________________________________________________ Name: svn:keywords + Id Author URL Added: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/SMSEmailProvider.java =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/SMSEmailProvider.java 2005-12-15 20:07:37 UTC (rev 1057) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/SMSEmailProvider.java 2005-12-16 13:20:35 UTC (rev 1058) @@ -0,0 +1,11 @@ +package com.arsdigita.camden.cms.contenttypes; + +interface SMSEmailProvider { + + /** + * Provides the email address that will be used as gateway + * to the SMS for the supplied mobile number. + */ + String getEmail(String mobileNumber); + +} Property changes on: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/SMSEmailProvider.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-12-15 20:07:37 UTC (rev 1057) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAlertForm.java 2005-12-16 13:20:35 UTC (rev 1058) @@ -18,19 +18,19 @@ */ package com.arsdigita.camden.cms.contenttypes.ui; -import java.util.Date; - -import javax.mail.MessagingException; - import com.arsdigita.bebop.FormData; import com.arsdigita.bebop.FormProcessException; import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.Page; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.event.FormProcessListener; import com.arsdigita.bebop.event.FormSectionEvent; import com.arsdigita.bebop.event.ParameterEvent; import com.arsdigita.bebop.event.ParameterListener; +import com.arsdigita.bebop.event.PrintEvent; +import com.arsdigita.bebop.event.PrintListener; import com.arsdigita.bebop.form.Submit; +import com.arsdigita.bebop.form.Widget; import com.arsdigita.bebop.parameters.EmailValidationListener; import com.arsdigita.bebop.parameters.ParameterData; import com.arsdigita.camden.cms.contenttypes.ConsultationAlert; @@ -44,6 +44,9 @@ import com.arsdigita.web.RedirectSignal; import com.arsdigita.web.URL; import com.arsdigita.web.Web; +import java.util.Date; +import java.util.TooManyListenersException; +import javax.mail.MessagingException; /** * <p>For for setting a new alert on the Camden Consultations @@ -60,36 +63,76 @@ public final static String FORM_NAME = "alert"; + private Name m_firstNames; + private Name m_lastName; + private Name m_email; + private Name m_mobile; + private Label m_pinLabel; + private Name m_pin; + + public ConsultationAlertForm() { this(FORM_NAME, ConsultationUtil.globalize("new_alert")); } public ConsultationAlertForm(String name, GlobalizedMessage heading) { - super(name, heading); - - addWidgets(); + this(name, new Label(heading)); } public ConsultationAlertForm(String name, Label heading) { super(name, heading); - addWidgets(); + try { + addWidgets(); + } catch (TooManyListenersException e) { + throw new RuntimeException(e); + } } - private void addWidgets() { - Name firstNames = + private void addWidgets() throws TooManyListenersException { + m_firstNames = new Name(ConsultationAlert.FIRST_NAMES, 100, false); - addField(ConsultationUtil.globalize("first_names"), firstNames); + addField(ConsultationUtil.globalize("first_names"), m_firstNames); - Name lastName = + m_firstNames.addPrintListener(new PrintListener() { + public void prepare(PrintEvent e) { + PageState state = e.getPageState(); + Widget widget = (Widget) e.getTarget(); + if (m_pin.isVisible(state)) { + widget.setReadOnly(); + } + } + }); + + m_lastName = new Name(ConsultationAlert.LAST_NAME, 100, false); - addField(ConsultationUtil.globalize("last_name"), lastName); + addField(ConsultationUtil.globalize("last_name"), m_lastName); - Name email = + m_lastName.addPrintListener(new PrintListener() { + public void prepare(PrintEvent e) { + PageState state = e.getPageState(); + Widget widget = (Widget) e.getTarget(); + if (m_pin.isVisible(state)) { + widget.setReadOnly(); + } + } + }); + + m_email = new Name(ConsultationAlert.EMAIL, 100, false); - email.addValidationListener(new ParameterListener() { + m_email.addPrintListener(new PrintListener() { + public void prepare(PrintEvent e) { + PageState state = e.getPageState(); + Widget widget = (Widget) e.getTarget(); + if (m_pin.isVisible(state)) { + widget.setReadOnly(); + } + } + }); + m_email.addValidationListener(new ParameterListener() { + private EmailValidationListener m_emailValidation = new EmailValidationListener(); @@ -113,6 +156,7 @@ alerts.addEqualsFilter(ConsultationAlert.EMAIL_CONFIRMED, Boolean.TRUE); if (alerts.next()) { + alerts.close(); data.invalidate(); data.addError((String)ConsultationUtil. globalize("duplicate_alert").localize()); @@ -120,14 +164,66 @@ } }); - addField(ConsultationUtil.globalize("email"), email); + addField(ConsultationUtil.globalize("email"), m_email); + m_mobile = + new Name(ConsultationAlert.MOBILE_NUMBER, 100, false); + m_mobile.addValidationListener(new ParameterListener() { + public void validate(ParameterEvent e) throws FormProcessException { + PageState state = e.getPageState(); + ParameterData data = e.getParameterData(); + if (isCancelled(state)) { + return; + } + if (data == null || data.getValue().toString().trim().length() == 0) { + return; + } + // strip everything but digits + String number = data.getValue().toString().replaceAll("[^0-9]", ""); + // number is valid if it starts with 447 or 07 or 7 + // First strip the leading country prefix, if exists + number = number.replaceFirst("^44", ""); + // then strip the leading zero + number = number.replaceFirst("^0", ""); + // We now have to have a number starting with 7 to denote UK mobile network. + // It must be at least (or exactly?) 10 digits in length + // 7789 xxx xxx + if (!number.startsWith("7") || number.length() < 10) { + data.addError((String)ConsultationUtil. + globalize("invalid_mobile").localize()); + } else { + data.setValue("+44" + number); + } + } + }); + addField(ConsultationUtil.globalize("mobile"), m_mobile); + + m_mobile.addPrintListener(new PrintListener() { + public void prepare(PrintEvent e) { + PageState state = e.getPageState(); + Widget widget = (Widget) e.getTarget(); + if (m_pin.isVisible(state)) { + widget.setReadOnly(); + } + } + }); + + m_pinLabel = new Label(ConsultationUtil.globalize("pin_confirmation")); + m_pin = new Name(ConsultationAlert.MOBILE_PIN, 10, false); + addField(m_pinLabel, m_pin); + addAction(new Submit(ConsultationUtil.globalize("set_alert"))); addAction(new Cancel()); addProcessListener(this); } + public void register(Page p) { + super.register(p); + p.setVisibleDefault(m_pinLabel, false); + p.setVisibleDefault(m_pin, false); + } + public void process(FormSectionEvent event) throws FormProcessException { FormData data = event.getFormData(); PageState state = event.getPageState(); @@ -164,6 +260,34 @@ alert.setFirstNames(data.getString(ConsultationAlert.FIRST_NAMES)); alert.setLastName(data.getString(ConsultationAlert.LAST_NAME)); alert.setEmail(email); + String mobile = data.getString(ConsultationAlert.MOBILE_NUMBER); + if (m_pin.isVisible(state)) { + // Validate PIN here. + String storedPin = alert.getMobilePin(); + if (storedPin == null) { + throw new FormProcessException("PIN not generated."); + } + if (!storedPin.equals(data.getString(ConsultationAlert.MOBILE_PIN))) { + throw new FormProcessException("PIN mismatch."); + } + alert.setMobileConfirmed(Boolean.TRUE); + } else { + if (mobile != null && mobile.trim().length() > 0) { + alert.setMobileNumber(mobile); + alert.randomizePin(4); + alert.save(); + m_pinLabel.setVisible(state, true); + m_pin.setVisible(state, true); + fireInit(event); + return; + } else { + // clear the mobile number that might have been submitted previously + alert.setMobileNumber(null); + alert.clearMobilePin(); + alert.setMobileConfirmed(Boolean.FALSE); + } + } + alert.save(); String from = |
From: <ssk...@vh...> - 2005-12-15 20:10:21
|
Author: sskracic Date: 2005-12-15 21:07:37 +0100 (Thu, 15 Dec 2005) New Revision: 1057 Modified: contrib/ccm-ldn-camden-consultation/trunk/application.xml Log: Bumping the version number in anticipation of major changes on trunk. Modified: contrib/ccm-ldn-camden-consultation/trunk/application.xml =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/application.xml 2005-12-15 20:05:06 UTC (rev 1056) +++ contrib/ccm-ldn-camden-consultation/trunk/application.xml 2005-12-15 20:07:37 UTC (rev 1057) @@ -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.3" + version="1.1.0" release="1" webapp="ROOT"> <ccm:dependencies> |
From: <ssk...@vh...> - 2005-12-15 20:07:44
|
Author: sskracic Date: 2005-12-15 21:05:06 +0100 (Thu, 15 Dec 2005) New Revision: 1056 Added: contrib/ccm-ldn-camden-consultation/release/ Log: Branching the consultations, so that we can continue to work massively on trunk. Copied: contrib/ccm-ldn-camden-consultation/release (from rev 1055, contrib/ccm-ldn-camden-consultation/trunk) |
Author: sskracic Date: 2005-12-15 20:47:35 +0100 (Thu, 15 Dec 2005) New Revision: 1055 Modified: contrib/ccm-ldn-camden-consultation/trunk/pdl/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.pdl 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/traversal-adapters/com/arsdigita/cms/contenttypes/Consultation.xml 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/ConsultationApp.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/ConsultationInitializer.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationLoader.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationMetadataProvider.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/ConsultationTextContentProvider.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/GeoAreaFormatter.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/TargetFormatter.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/TopicFormatter.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/TypeFormatter.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAboutForm.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationAboutStep.java 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 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/ConsultationHowForm.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationHowStep.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/ConsultationPropertiesStep.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationResultsForm.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationResultsStep.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationWhoForm.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationWhoStep.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationsFilter.java contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ui/ConsultationsList.java 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/ConsultationsTable.java 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/deleted.jsp contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/admin/index.jsp contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/alert-new.jsp contrib/ccm-ldn-camden-consultation/trunk/web/packages/consultations/www/alert-trigger.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 contrib/ccm-ldn-camden-consultation/trunk/web/static/content-types/com/arsdigita/camden/cms/contenttypes/Consultation.xsl Log: NFC: TABs expanded into spaces, removed trailing whitespace on the end of line. 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-12-14 12:04:29 UTC (rev 1054) +++ contrib/ccm-ldn-camden-consultation/trunk/pdl/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.pdl 2005-12-15 19:47:35 UTC (rev 1055) @@ -48,7 +48,7 @@ String methodology; String feedback; String title; - + do { select live.*, pa.* from cam_consultations live, cam_consultations draft, 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-12-14 12:04:29 UTC (rev 1054) +++ contrib/ccm-ldn-camden-consultation/trunk/src/WEB-INF/content-types/com/arsdigita/camden/cms/contenttypes/Consultation.xml 2005-12-15 19:47:35 UTC (rev 1055) @@ -2,38 +2,38 @@ <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.camden.cms.contenttypes.ui.ConsultationCreate"> - <ctd:authoring-step - labelKey="cms.contenttypes.shared.basic_properties.title" + <ctd:authoring-step + labelKey="cms.contenttypes.shared.basic_properties.title" labelBundle="com.arsdigita.cms.ui.CMSResources" - descriptionKey="cms.contenttypes.shared.basic_properties.description" + descriptionKey="cms.contenttypes.shared.basic_properties.description" descriptionBundle="com.arsdigita.cms.ui.CMSResources" component="com.arsdigita.camden.cms.contenttypes.ui.ConsultationPropertiesStep"/> - <ctd:authoring-step - labelKey="about.title" + <ctd:authoring-step + labelKey="about.title" labelBundle="com.arsdigita.camden.cms.contenttypes.ConsultationResources" - descriptionKey="about.description" + descriptionKey="about.description" descriptionBundle="com.arsdigita.camden.cms.contenttypes.ConsultationResources" component="com.arsdigita.camden.cms.contenttypes.ui.ConsultationAboutStep"/> - <ctd:authoring-step - labelKey="who.title" + <ctd:authoring-step + labelKey="who.title" labelBundle="com.arsdigita.camden.cms.contenttypes.ConsultationResources" - descriptionKey="who.description" + descriptionKey="who.description" descriptionBundle="com.arsdigita.camden.cms.contenttypes.ConsultationResources" component="com.arsdigita.camden.cms.contenttypes.ui.ConsultationWhoStep"/> - <ctd:authoring-step - labelKey="how.title" + <ctd:authoring-step + labelKey="how.title" labelBundle="com.arsdigita.camden.cms.contenttypes.ConsultationResources" - descriptionKey="how.description" + descriptionKey="how.description" descriptionBundle="com.arsdigita.camden.cms.contenttypes.ConsultationResources" component="com.arsdigita.camden.cms.contenttypes.ui.ConsultationHowStep"/> - <ctd:authoring-step - labelKey="results.title" + <ctd:authoring-step + labelKey="results.title" labelBundle="com.arsdigita.camden.cms.contenttypes.ConsultationResources" - descriptionKey="results.description" + descriptionKey="results.description" descriptionBundle="com.arsdigita.camden.cms.contenttypes.ConsultationResources" component="com.arsdigita.camden.cms.contenttypes.ui.ConsultationResultsStep"/> Modified: contrib/ccm-ldn-camden-consultation/trunk/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Consultation.xml =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Consultation.xml 2005-12-14 12:04:29 UTC (rev 1054) +++ contrib/ccm-ldn-camden-consultation/trunk/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Consultation.xml 2005-12-15 19:47:35 UTC (rev 1055) @@ -6,8 +6,8 @@ --> <xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator"> - <xrd:adapter objectType="com.arsdigita.camden.cms.contenttypes.Consultation" - extends="com.arsdigita.cms.ContentPage" + <xrd:adapter objectType="com.arsdigita.camden.cms.contenttypes.Consultation" + extends="com.arsdigita.cms.ContentPage" traversalClass="com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter"> <xrd:attributes rule="exclude"> <xrd:property name="/object/methodologyDocuments/ancestors"/> @@ -26,25 +26,25 @@ <xrd:property name="/object/feedbackDocuments"/> </xrd:associations> <xrd:formatter property="/object/startDate" - class="com.arsdigita.xml.formatters.DateFormatter"/> + class="com.arsdigita.xml.formatters.DateFormatter"/> <xrd:formatter property="/object/completionDate" - class="com.arsdigita.xml.formatters.DateFormatter"/> + class="com.arsdigita.xml.formatters.DateFormatter"/> <xrd:formatter property="/object/resultsDate" - class="com.arsdigita.xml.formatters.DateFormatter"/> - <xrd:formatter property="/object/topic" + class="com.arsdigita.xml.formatters.DateFormatter"/> + <xrd:formatter property="/object/topic" class="com.arsdigita.camden.cms.contenttypes.TopicFormatter"/> - <xrd:formatter property="/object/consultationType" + <xrd:formatter property="/object/consultationType" class="com.arsdigita.camden.cms.contenttypes.TypeFormatter"/> - <xrd:formatter property="/object/targetAudience" + <xrd:formatter property="/object/targetAudience" class="com.arsdigita.camden.cms.contenttypes.TargetFormatter"/> - <xrd:formatter property="/object/geoArea" + <xrd:formatter property="/object/geoArea" class="com.arsdigita.camden.cms.contenttypes.GeoAreaFormatter"/> </xrd:adapter> </xrd:context> <xrd:context name="com.arsdigita.camden.cms.contenttypes.ConsultationMetadataProvider"> - <xrd:adapter - objectType="com.arsdigita.camden.cms.contenttypes.Consultation" + <xrd:adapter + objectType="com.arsdigita.camden.cms.contenttypes.Consultation" traversalClass="com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter"> <xrd:attributes rule="exclude"> <xrd:property name="/object/startDate"/> 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-12-14 12:04:29 UTC (rev 1054) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/Consultation.java 2005-12-15 19:47:35 UTC (rev 1055) @@ -47,10 +47,10 @@ */ public class Consultation extends ContentPage { - private static final Logger s_log = + 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 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"; @@ -75,31 +75,31 @@ public static final String ALERT_SENT = "alertSent"; private static final String SEPARATOR = "/"; - + private boolean m_wasNew = true; public Consultation() { - this(BASE_DATA_OBJECT_TYPE); - } + this(BASE_DATA_OBJECT_TYPE); + } - public Consultation(OID oid) throws DataObjectNotFoundException { - super(oid); - } + public Consultation(OID oid) throws DataObjectNotFoundException { + super(oid); + } - public Consultation(BigDecimal id) throws DataObjectNotFoundException { - this(new OID(BASE_DATA_OBJECT_TYPE, id)); - } + public Consultation(BigDecimal id) throws DataObjectNotFoundException { + this(new OID(BASE_DATA_OBJECT_TYPE, id)); + } - public Consultation(DataObject obj) { - super(obj); - } + public Consultation(DataObject obj) { + super(obj); + } - public Consultation(String type) { - super(type); - - setAlertSent(Boolean.FALSE); - } + public Consultation(String type) { + super(type); + setAlertSent(Boolean.FALSE); + } + /** * @return the base PDL object type for this item. Child classes * should override this method to return the correct value. @@ -125,119 +125,119 @@ } public String[] getTopic() { - String value = (String) get(TOPIC); - if (value == null) { - return null; - } - List topics = new LinkedList(); - StringTokenizer tok = new StringTokenizer(value,SEPARATOR); + String value = (String) get(TOPIC); + if (value == null) { + return null; + } + List topics = new LinkedList(); + StringTokenizer tok = new StringTokenizer(value,SEPARATOR); while (tok.hasMoreTokens()) { - String topic = tok.nextToken(); - Integer.valueOf(topic); // integer check + String topic = tok.nextToken(); + Integer.valueOf(topic); // integer check topics.add(topic); } - return (String[]) topics.toArray(new String[0]); + return (String[]) topics.toArray(new String[0]); } - + public String getPrettyTopic() { - return internalGetPrettyTopics((String) get(TOPIC)); + return internalGetPrettyTopics((String) get(TOPIC)); } - + public static String internalGetPrettyTopics(String value) { - if (value == null) { - return " "; - } - StringTokenizer tok = new StringTokenizer(value,SEPARATOR); - if (tok.hasMoreTokens()) { - StringBuffer topics = new StringBuffer(); - topics.append(Consultation.getPrettyTopic(Integer.valueOf(tok.nextToken())).localize()); - while (tok.hasMoreTokens()) { - topics.append(", ").append(Consultation.getPrettyTopic(Integer.valueOf(tok.nextToken())).localize()); - } - return topics.toString(); - } else { - return " "; - } + if (value == null) { + return " "; + } + StringTokenizer tok = new StringTokenizer(value,SEPARATOR); + if (tok.hasMoreTokens()) { + StringBuffer topics = new StringBuffer(); + topics.append(Consultation.getPrettyTopic(Integer.valueOf(tok.nextToken())).localize()); + while (tok.hasMoreTokens()) { + topics.append(", ").append(Consultation.getPrettyTopic(Integer.valueOf(tok.nextToken())).localize()); + } + return topics.toString(); + } else { + return " "; + } } - + private static GlobalizedMessage getPrettyTopic(Integer i) { - return ConsultationUtil.globalize("topicOption" + i); + return ConsultationUtil.globalize("topicOption" + i); } - + public void setTopic(String[] topics) { - if (topics == null || topics.length == 0) { - set(TOPIC, null); - return; - } - StringBuffer value = new StringBuffer(); - int n=topics.length-1; - for (int i=0; i<n; i++) { - String topic = topics[i]; - Integer.valueOf(topic); // integer check - value.append(topic).append(SEPARATOR); - } - String topic = topics[n]; - Integer.valueOf(topic); // integer check - value.append(topic); - set(TOPIC,value.toString()); + if (topics == null || topics.length == 0) { + set(TOPIC, null); + return; + } + StringBuffer value = new StringBuffer(); + int n=topics.length-1; + for (int i=0; i<n; i++) { + String topic = topics[i]; + Integer.valueOf(topic); // integer check + value.append(topic).append(SEPARATOR); + } + String topic = topics[n]; + Integer.valueOf(topic); // integer check + value.append(topic); + set(TOPIC,value.toString()); } - + public String[] getConsultationType() { - String value = (String) get(CONSULTATION_TYPE); - if (value == null) { - return null; - } - List types = new LinkedList(); - StringTokenizer tok = new StringTokenizer(value,SEPARATOR); + String value = (String) get(CONSULTATION_TYPE); + if (value == null) { + return null; + } + List types = new LinkedList(); + StringTokenizer tok = new StringTokenizer(value,SEPARATOR); while (tok.hasMoreTokens()) { - String type = tok.nextToken(); - Integer.valueOf(type); // integer check - types.add(type); + String type = tok.nextToken(); + Integer.valueOf(type); // integer check + types.add(type); } - return (String[]) types.toArray(new String[0]); + return (String[]) types.toArray(new String[0]); } public String getPrettyType() { - return internalGetPrettyTypes((String) get(CONSULTATION_TYPE)); + return internalGetPrettyTypes((String) get(CONSULTATION_TYPE)); } - + public static String internalGetPrettyTypes(String value) { - if (value == null) { - return " "; - } - StringTokenizer tok = new StringTokenizer(value,SEPARATOR); - if (tok.hasMoreTokens()) { - StringBuffer types = new StringBuffer(); - types.append(Consultation.getPrettyType(Integer.valueOf(tok.nextToken())).localize()); - while (tok.hasMoreTokens()) { - types.append(", ").append(Consultation.getPrettyType(Integer.valueOf(tok.nextToken())).localize()); - } - return types.toString(); - } else { - return " "; - } + if (value == null) { + return " "; + } + StringTokenizer tok = new StringTokenizer(value,SEPARATOR); + if (tok.hasMoreTokens()) { + StringBuffer types = new StringBuffer(); + types.append(Consultation.getPrettyType(Integer.valueOf(tok.nextToken())).localize()); + while (tok.hasMoreTokens()) { + types.append(", ").append(Consultation.getPrettyType(Integer.valueOf(tok.nextToken())).localize()); + } + return types.toString(); + } else { + return " "; + } } - + private static GlobalizedMessage getPrettyType(Integer i) { - return ConsultationUtil.globalize("typeOption" + i); + return ConsultationUtil.globalize("typeOption" + i); } - + public void setConsultationType(String[] types) { - if (types == null || types.length == 0) { - set(CONSULTATION_TYPE, null); - return; - } - StringBuffer value = new StringBuffer(); - int n=types.length-1; - for (int i=0; i<n; i++) { - String type = types[i]; - Integer.valueOf(type); // integer check - value.append(type).append(SEPARATOR); - } - String type = types[n]; - Integer.valueOf(type); // integer check - value.append(type); - set(CONSULTATION_TYPE,value.toString()); + if (types == null || types.length == 0) { + set(CONSULTATION_TYPE, null); + return; + } + StringBuffer value = new StringBuffer(); + int n=types.length-1; + for (int i=0; i<n; i++) { + String type = types[i]; + Integer.valueOf(type); // integer check + value.append(type).append(SEPARATOR); + } + String type = types[n]; + Integer.valueOf(type); // integer check + value.append(type); + set(CONSULTATION_TYPE,value.toString()); } public Date getStartDate() { @@ -273,7 +273,7 @@ } public void setStatutory(boolean value) { - setStatutory(new Boolean(value)); + setStatutory(new Boolean(value)); } public Boolean getAlertSent() { @@ -285,119 +285,119 @@ } public String[] getTargetAudience() { - String value = (String) get(TARGET_AUDIENCE); - if (value == null) { - return null; - } - List targets = new LinkedList(); - StringTokenizer tok = new StringTokenizer(value,SEPARATOR); + String value = (String) get(TARGET_AUDIENCE); + if (value == null) { + return null; + } + List targets = new LinkedList(); + StringTokenizer tok = new StringTokenizer(value,SEPARATOR); while (tok.hasMoreTokens()) { - String target = tok.nextToken(); - Integer.valueOf(target); // integer check - targets.add(target); + String target = tok.nextToken(); + Integer.valueOf(target); // integer check + targets.add(target); } - return (String[]) targets.toArray(new String[0]); + return (String[]) targets.toArray(new String[0]); } public String getPrettyTarget() { - return internalGetPrettyTargets((String) get(TARGET_AUDIENCE)); + return internalGetPrettyTargets((String) get(TARGET_AUDIENCE)); } - + public static String internalGetPrettyTargets(String value) { - if (value == null) { - return " "; - } - StringTokenizer tok = new StringTokenizer(value,SEPARATOR); - if (tok.hasMoreTokens()) { - StringBuffer targets = new StringBuffer(); - targets.append(Consultation.getPrettyTarget(Integer.valueOf(tok.nextToken())).localize()); - while (tok.hasMoreTokens()) { - targets.append(", ").append(Consultation.getPrettyTarget(Integer.valueOf(tok.nextToken())).localize()); - } - return targets.toString(); - } else { - return " "; - } + if (value == null) { + return " "; + } + StringTokenizer tok = new StringTokenizer(value,SEPARATOR); + if (tok.hasMoreTokens()) { + StringBuffer targets = new StringBuffer(); + targets.append(Consultation.getPrettyTarget(Integer.valueOf(tok.nextToken())).localize()); + while (tok.hasMoreTokens()) { + targets.append(", ").append(Consultation.getPrettyTarget(Integer.valueOf(tok.nextToken())).localize()); + } + return targets.toString(); + } else { + return " "; + } } private static GlobalizedMessage getPrettyTarget(Integer i) { - return ConsultationUtil.globalize("targetOption" + i); + return ConsultationUtil.globalize("targetOption" + i); } public void setTargetAudience(String[] targets) { - if (targets == null || targets.length == 0) { - set(TARGET_AUDIENCE, null); - return; - } - StringBuffer value = new StringBuffer(); - int n=targets.length-1; - for (int i=0; i<n; i++) { - String target = targets[i]; - Integer.valueOf(target); // integer check - value.append(target).append(SEPARATOR); - } - String target = targets[n]; - Integer.valueOf(target); // integer check - value.append(target); - set(TARGET_AUDIENCE,value.toString()); + if (targets == null || targets.length == 0) { + set(TARGET_AUDIENCE, null); + return; + } + StringBuffer value = new StringBuffer(); + int n=targets.length-1; + for (int i=0; i<n; i++) { + String target = targets[i]; + Integer.valueOf(target); // integer check + value.append(target).append(SEPARATOR); + } + String target = targets[n]; + Integer.valueOf(target); // integer check + value.append(target); + set(TARGET_AUDIENCE,value.toString()); } public String[] getGeoArea() { - String value = (String) get(GEO_AREA); - if (value == null) { - return null; - } - List geos = new LinkedList(); - StringTokenizer tok = new StringTokenizer(value,SEPARATOR); + String value = (String) get(GEO_AREA); + if (value == null) { + return null; + } + List geos = new LinkedList(); + StringTokenizer tok = new StringTokenizer(value,SEPARATOR); while (tok.hasMoreTokens()) { - String geo = tok.nextToken(); - Integer.valueOf(geo); // integer check - geos.add(geo); + String geo = tok.nextToken(); + Integer.valueOf(geo); // integer check + geos.add(geo); } - return (String[]) geos.toArray(new String[0]); + return (String[]) geos.toArray(new String[0]); } public String getPrettyGeoArea() { - return internalGetPrettyGeoAreas((String) get(GEO_AREA)); + return internalGetPrettyGeoAreas((String) get(GEO_AREA)); } public static String internalGetPrettyGeoAreas(String value) { - if (value == null) { - return " "; - } - StringTokenizer tok = new StringTokenizer(value,SEPARATOR); - if (tok.hasMoreTokens()) { - StringBuffer geos = new StringBuffer(); - geos.append(Consultation.getPrettyGeoArea(Integer.valueOf(tok.nextToken())).localize()); - while (tok.hasMoreTokens()) { - geos.append(", ").append(Consultation.getPrettyGeoArea(Integer.valueOf(tok.nextToken())).localize()); - } - return geos.toString(); - } else { - return " "; - } + if (value == null) { + return " "; + } + StringTokenizer tok = new StringTokenizer(value,SEPARATOR); + if (tok.hasMoreTokens()) { + StringBuffer geos = new StringBuffer(); + geos.append(Consultation.getPrettyGeoArea(Integer.valueOf(tok.nextToken())).localize()); + while (tok.hasMoreTokens()) { + geos.append(", ").append(Consultation.getPrettyGeoArea(Integer.valueOf(tok.nextToken())).localize()); + } + return geos.toString(); + } else { + return " "; + } } - + private static GlobalizedMessage getPrettyGeoArea(Integer i) { - return ConsultationUtil.globalize("geoOption" + i); + return ConsultationUtil.globalize("geoOption" + i); } - + public void setGeoArea(String[] geoAreas) { - if (geoAreas == null || geoAreas.length == 0) { - set(GEO_AREA, null); - return; - } - StringBuffer value = new StringBuffer(); - int n=geoAreas.length-1; - for (int i=0; i<n; i++) { - String geoArea = geoAreas[i]; - Integer.valueOf(geoArea); // integer check - value.append(geoArea).append(SEPARATOR); - } - String geoArea = geoAreas[n]; - Integer.valueOf(geoArea); // integer check - value.append(geoArea); - set(GEO_AREA,value.toString()); + if (geoAreas == null || geoAreas.length == 0) { + set(GEO_AREA, null); + return; + } + StringBuffer value = new StringBuffer(); + int n=geoAreas.length-1; + for (int i=0; i<n; i++) { + String geoArea = geoAreas[i]; + Integer.valueOf(geoArea); // integer check + value.append(geoArea).append(SEPARATOR); + } + String geoArea = geoAreas[n]; + Integer.valueOf(geoArea); // integer check + value.append(geoArea); + set(GEO_AREA,value.toString()); } public String getMethodology() { @@ -409,24 +409,24 @@ } public FileAssetCollection getMethodologyDocuments() { - DataCollection dataCollection = - (DataCollection)get(METHODOLOGY_DOCUMENTS); - - if (dataCollection == null) - return null; - - dataCollection.addOrder("name"); - return new FileAssetCollection(dataCollection); + DataCollection dataCollection = + (DataCollection)get(METHODOLOGY_DOCUMENTS); + + if (dataCollection == null) + return null; + + dataCollection.addOrder("name"); + return new FileAssetCollection(dataCollection); } - + public void addMethodologyDocument(FileAsset fileAsset) { - add(METHODOLOGY_DOCUMENTS, fileAsset); + add(METHODOLOGY_DOCUMENTS, fileAsset); } - + public void removeMethodologyDocument(FileAsset fileAsset) { - remove(METHODOLOGY_DOCUMENTS, fileAsset); + remove(METHODOLOGY_DOCUMENTS, fileAsset); } - + public String getFeedback() { return (String) get(FEEDBACK); } @@ -436,57 +436,57 @@ } public FileAssetCollection getFeedbackDocuments() { - DataCollection dataCollection = - (DataCollection)get(FEEDBACK_DOCUMENTS); - - if (dataCollection == null) - return null; - - return new FileAssetCollection(dataCollection); + DataCollection dataCollection = + (DataCollection)get(FEEDBACK_DOCUMENTS); + + if (dataCollection == null) + return null; + + return new FileAssetCollection(dataCollection); } - + public void addFeedbackDocument(FileAsset fileAsset) { - add(FEEDBACK_DOCUMENTS, fileAsset); + add(FEEDBACK_DOCUMENTS, fileAsset); } public void removeFeedbackDocument(FileAsset fileAsset) { - remove(FEEDBACK_DOCUMENTS, fileAsset); + remove(FEEDBACK_DOCUMENTS, fileAsset); } public static GlobalizedMessage getStatus(Date startDate, Date completionDate) { - if (startDate == null || completionDate == null) - return null; + if (startDate == null || completionDate == null) + return null; - Date currentDate = new Date(); - - if (startDate.after(currentDate)) - return ConsultationUtil.globalize("status.forthcoming"); - else if (completionDate.before(currentDate)) - return ConsultationUtil.globalize("status.past"); - else - return ConsultationUtil.globalize("status.current"); + Date currentDate = new Date(); + + if (startDate.after(currentDate)) + return ConsultationUtil.globalize("status.forthcoming"); + else if (completionDate.before(currentDate)) + return ConsultationUtil.globalize("status.past"); + else + return ConsultationUtil.globalize("status.current"); } - + public GlobalizedMessage getStatus() { - return Consultation.getStatus(getStartDate(), getCompletionDate()); + return Consultation.getStatus(getStartDate(), getCompletionDate()); } - public String getSearchSummary() { - return StringUtils.truncateString(getPurpose(), 200); - } + 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); - } + /** + * 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-12-14 12:04:29 UTC (rev 1054) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationAlert.java 2005-12-15 19:47:35 UTC (rev 1055) @@ -36,19 +36,19 @@ /** * Alert requests for the Camden Consultation content type. * Requests must be confirmed via email before they become - * active. Old pending requests are deleted periodically. - * + * active. Old pending requests are deleted periodically. + * * @author Carsten Clasohm * @version $Id: ConsultationAlert.java 25 2005-08-03 16:01:08Z clasohm $ */ public class ConsultationAlert extends ACSObject { - private static final Logger s_log = + 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"; - + public static final String FIRST_NAMES = "firstNames"; public static final String LAST_NAME = "lastName"; public static final String EMAIL = "email"; @@ -56,35 +56,35 @@ 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 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); - } + public ConsultationAlert() { + this(BASE_DATA_OBJECT_TYPE); + } - public ConsultationAlert(OID oid) throws DataObjectNotFoundException { - super(oid); - } + public ConsultationAlert(OID oid) throws DataObjectNotFoundException { + super(oid); + } - public ConsultationAlert(BigDecimal id) throws DataObjectNotFoundException { - this(new OID(BASE_DATA_OBJECT_TYPE, id)); - } + public ConsultationAlert(BigDecimal id) throws DataObjectNotFoundException { + this(new OID(BASE_DATA_OBJECT_TYPE, id)); + } - public ConsultationAlert(DataObject obj) { - super(obj); - } + public ConsultationAlert(DataObject obj) { + super(obj); + } - public ConsultationAlert(String type) { - super(type); - - setConfirmationToken(getRandomString()); - setCancellationToken(getRandomString()); - setEmailConfirmed(Boolean.FALSE); - setCreationDate(new Date()); - } + public ConsultationAlert(String type) { + super(type); + setConfirmationToken(getRandomString()); + setCancellationToken(getRandomString()); + setEmailConfirmed(Boolean.FALSE); + setCreationDate(new Date()); + } + /** * @return the base PDL object type for this item. Child classes * should override this method to return the correct value. @@ -152,72 +152,72 @@ private String getRandomString() { byte[] salt = new byte[8]; try { - Crypto.getRandom().nextBytes(salt); + Crypto.getRandom().nextBytes(salt); } catch (GeneralSecurityException e) { - throw new RuntimeException(e); + throw new RuntimeException(e); } - + String result = new String((new Base64()).encode(salt)); - + // Convert characters which could be problematic in a URL. result = result.replace('+', 'p'). - replace('=', 'e'). - replace('/', 's'); + replace('=', 'e'). + replace('/', 's'); return result; } public static String confirm(String token) { - DataCollection alerts = - SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE); - alerts.addEqualsFilter(CONFIRMATION_TOKEN, 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(); + String result = null; + if (alerts.next()) { + ConsultationAlert alert = + new ConsultationAlert(alerts.getDataObject()); + alerts.close(); - result = alert.getEmail(); + result = alert.getEmail(); - alert.setEmailConfirmed(Boolean.TRUE); - alert.save(); - } + alert.setEmailConfirmed(Boolean.TRUE); + alert.save(); + } - return result; + return result; } public static String cancel(String token) { - DataCollection alerts = - SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE); - alerts.addEqualsFilter(CANCELLATION_TOKEN, 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(); + String result = null; + if (alerts.next()) { + ConsultationAlert alert = + new ConsultationAlert(alerts.getDataObject()); + alerts.close(); - result = alert.getEmail(); + result = alert.getEmail(); - alert.delete(); - } + alert.delete(); + } - return result; + 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; + 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; } /** @@ -225,222 +225,222 @@ * 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); - alerts.addFilter("creationDate < current_date - 1"); - - while (alerts.next()) { - ConsultationAlert alert = - new ConsultationAlert(alerts.getDataObject()); - alert.delete(); - } + Session dbSession = SessionManager.getSession(); + int dbType = dbSession.getDatabase(); + + DataCollection alerts = dbSession.retrieve(BASE_DATA_OBJECT_TYPE); + + alerts.addEqualsFilter(EMAIL_CONFIRMED, Boolean.FALSE); + alerts.addFilter("creationDate < current_date - 1"); + + while (alerts.next()) { + ConsultationAlert alert = + new ConsultationAlert(alerts.getDataObject()); + alert.delete(); + } } - + /** * <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 + * 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"); .. |
From: <ap...@vh...> - 2005-12-14 12:07:05
|
Author: apevec Date: 2005-12-14 13:04:29 +0100 (Wed, 14 Dec 2005) New Revision: 1054 Modified: contrib/ccm-ldn-camden-consultation/trunk/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Consultation.xml Log: revert experimental r1045 Modified: contrib/ccm-ldn-camden-consultation/trunk/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Consultation.xml =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Consultation.xml 2005-12-14 11:33:28 UTC (rev 1053) +++ contrib/ccm-ldn-camden-consultation/trunk/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Consultation.xml 2005-12-14 12:04:29 UTC (rev 1054) @@ -26,11 +26,11 @@ <xrd:property name="/object/feedbackDocuments"/> </xrd:associations> <xrd:formatter property="/object/startDate" - class="com.arsdigita.xml.formatters.FullDateFormatter"/> + class="com.arsdigita.xml.formatters.DateFormatter"/> <xrd:formatter property="/object/completionDate" - class="com.arsdigita.xml.formatters.FullDateFormatter"/> + class="com.arsdigita.xml.formatters.DateFormatter"/> <xrd:formatter property="/object/resultsDate" - class="com.arsdigita.xml.formatters.FullDateFormatter"/> + class="com.arsdigita.xml.formatters.DateFormatter"/> <xrd:formatter property="/object/topic" class="com.arsdigita.camden.cms.contenttypes.TopicFormatter"/> <xrd:formatter property="/object/consultationType" |
From: <ap...@vh...> - 2005-12-14 11:35:56
|
Author: apevec Date: 2005-12-14 12:33:28 +0100 (Wed, 14 Dec 2005) New Revision: 1053 Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationResources.properties Log: modifications to the consultation request confirmation email 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-12-14 11:19:21 UTC (rev 1052) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationResources.properties 2005-12-14 11:33:28 UTC (rev 1053) @@ -242,22 +242,19 @@ 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_request.subject=Confirmation of Consultation Alert +confirm_request.subject=Confirmation of Consultation Alert from Camden Consults # 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 confirm_request.body=\ -We have received a request to alert {0} of new consultation\n\ -information published on {1}\n\ +We have received a request to alert {0} of new consultation information published on {1}consultations/\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\ +To ensure that this request was made by you, alerts will only be sent 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. +If you did not request alerts, you do not need to do anything. The request will be deleted automatically within the next 24 hours. # {0}: site name alert.subject=New Consultations Published on {0} |
From: <ap...@vh...> - 2005-12-13 23:48:15
|
Author: apevec Date: 2005-12-14 00:45:39 +0100 (Wed, 14 Dec 2005) New Revision: 1051 Modified: trunk/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/SiteProxy.java Log: trim spaces, otherwise SiteProxyPanel.passParameters constructs wrong URL Modified: trunk/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/SiteProxy.java =================================================================== --- trunk/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/SiteProxy.java 2005-12-13 22:52:55 UTC (rev 1050) +++ trunk/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/SiteProxy.java 2005-12-13 23:45:39 UTC (rev 1051) @@ -78,7 +78,11 @@ } public String getURL() { - return (String) get(URL); + String url = (String) get(URL); + if (url != null) { + url.trim(); + } + return url; } public void setURL(String url) { |
Author: apevec Date: 2005-12-13 23:52:55 +0100 (Tue, 13 Dec 2005) New Revision: 1050 Added: trunk/ccm-ldn-atoz/pdl/com/arsdigita/london/atoz/AtoZSiteProxyProvider.pdl trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/default/ trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/default/upgrade/ trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/default/upgrade/add-ct_blacklist.sql trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/default/upgrade/add-item_provider.sql trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/default/upgrade/add-item_provider_alias.sql trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/default/upgrade/add-siteproxy_provider.sql trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/oracle-se-6.3.0-6.3.1.sql trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/postgres-6.3.0-6.3.1.sql trunk/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AtoZSiteProxyGenerator.java trunk/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AtoZSiteProxyProvider.java trunk/ccm-ldn-atoz/src/com/arsdigita/london/atoz/ui/admin/CategoryProviderContentTypeBlacklist.java trunk/ccm-ldn-atoz/src/com/arsdigita/london/atoz/ui/admin/CategoryProviderContentTypeBlockForm.java trunk/ccm-ldn-atoz/src/com/arsdigita/london/atoz/ui/admin/SiteProxyProviderAdmin.java trunk/ccm-ldn-atoz/src/com/arsdigita/london/atoz/ui/admin/SiteProxyProviderForm.java Removed: trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/oracle-se/upgrade/add-item_provider.sql trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/oracle-se/upgrade/add-item_provider_alias.sql Modified: trunk/ccm-ldn-atoz/application.xml trunk/ccm-ldn-atoz/doc/atoz.xsd trunk/ccm-ldn-atoz/pdl/com/arsdigita/london/atoz/AtoZCategoryProvider.pdl trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/oracle-se-1.0.0-1.0.1.sql trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/oracle-se-1.0.2-1.0.3.sql trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/postgres-1.0.0-1.0.1.sql trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/postgres-1.0.2-1.0.3.sql trunk/ccm-ldn-atoz/src/WEB-INF/resources/atoz-adapters.xml trunk/ccm-ldn-atoz/src/ccm-ldn-atoz.upgrade trunk/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AtoZAtomicEntry.java trunk/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AtoZCategoryGenerator.java trunk/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AtoZCategoryProvider.java trunk/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AtoZItemGenerator.java trunk/ccm-ldn-atoz/src/com/arsdigita/london/atoz/Initializer.java trunk/ccm-ldn-atoz/src/com/arsdigita/london/atoz/terms/DomainGenerator.java trunk/ccm-ldn-atoz/src/com/arsdigita/london/atoz/ui/AtoZPane.java trunk/ccm-ldn-atoz/src/com/arsdigita/london/atoz/ui/admin/CategoryProviderAdmin.java trunk/ccm-ldn-atoz/web/__ccm__/apps/atoz/xsl/index.xsl Log: AtoZ application modifications and additions: - content type black list (filter out categories which have given content type(s) as a category index item) - new AtoZ provider displaying SiteProxy items in selected categories (see previous r1049) NB data model change: ccm upgrade ccm-ldn-atoz --from-version 6.3.0 --to-version 6.3.1 Modified: trunk/ccm-ldn-atoz/application.xml =================================================================== --- trunk/ccm-ldn-atoz/application.xml 2005-12-13 22:39:04 UTC (rev 1049) +++ trunk/ccm-ldn-atoz/application.xml 2005-12-13 22:52:55 UTC (rev 1050) @@ -2,8 +2,8 @@ <ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project" name="ccm-ldn-atoz" prettyName="A-Z" - version="6.3.0" - release="4"> + version="6.3.1" + release="1"> <ccm:dependencies> <ccm:requires name="ccm-core" version="6.2.0" relation="ge"/> <ccm:requires name="ccm-cms" version="6.2.0" relation="ge"/> @@ -11,6 +11,7 @@ <ccm:requires name="ccm-ldn-terms" version="6.2.0" relation="ge"/> <ccm:requires name="ccm-ldn-navigation" version="6.2.0" relation="ge"/> <ccm:requires name="ccm-ldn-subsite" version="6.2.0" relation="ge"/> + <ccm:requires name="ccm-cms-types-siteproxy" version="6.2.0" relation="ge"/> </ccm:dependencies> <ccm:contacts> <ccm:contact uri="http://www.redhat.com/software/rhea" type="website"/> Modified: trunk/ccm-ldn-atoz/doc/atoz.xsd =================================================================== --- trunk/ccm-ldn-atoz/doc/atoz.xsd 2005-12-13 22:39:04 UTC (rev 1049) +++ trunk/ccm-ldn-atoz/doc/atoz.xsd 2005-12-13 22:52:55 UTC (rev 1050) @@ -70,6 +70,14 @@ <xs:attribute name="title" type="xs:string"/> <xs:attribute name="description" type="xs:string" use="optional"/> <xs:attribute name="url" type="xs:anyURI"/> + <xs:element name="siteProxyContent" minOccurs="0" maxOccurs="1"> + <xs:complexType> + <xs:attribute name="title" type="xs:string" use="required"/> + <xs:attribute name="dataType" type="xs:string"/> + <xs:attribute name="oid" type="xs:string"/> + <xs:any processContents="skip"/> + </xs:complexType> + </xs:element> </xs:complexType> <xs:complexType name="compoundEntry"> Modified: trunk/ccm-ldn-atoz/pdl/com/arsdigita/london/atoz/AtoZCategoryProvider.pdl =================================================================== --- trunk/ccm-ldn-atoz/pdl/com/arsdigita/london/atoz/AtoZCategoryProvider.pdl 2005-12-13 22:39:04 UTC (rev 1049) +++ trunk/ccm-ldn-atoz/pdl/com/arsdigita/london/atoz/AtoZCategoryProvider.pdl 2005-12-13 22:52:55 UTC (rev 1050) @@ -18,6 +18,7 @@ model com.arsdigita.london.atoz; import com.arsdigita.categorization.Category; +import com.arsdigita.cms.ContentType; object type AtoZCategoryProvider extends AtoZProvider { Boolean[1..1] isCompound = atoz_cat_provider.is_compound BIT; @@ -36,7 +37,6 @@ to cat_categories.category_id; } - association { AtoZCategoryProvider[0..n] atozProvider2 = join cat_categories.category_id to atoz_cat_alias_map.category_id, @@ -50,6 +50,17 @@ String[1..1] title = atoz_cat_alias_map.title VARCHAR(200); } +association { + AtoZCategoryProvider[0..n] atozProvider3 = join content_types.type_id + to atoz_cat_ct_blacklist_map.type_id, + join atoz_cat_ct_blacklist_map.provider_id + to atoz_cat_provider.provider_id; + + ContentType[0..n] atozContentTypeBlackList = join atoz_cat_provider.provider_id + to atoz_cat_ct_blacklist_map.provider_id, + join atoz_cat_ct_blacklist_map.type_id + to content_types.type_id; +} query getAtomicCategoryEntries { BigDecimal[1..1] id; @@ -94,6 +105,18 @@ where b.category_id = c.category_id and b.provider_id = :providerID ) + and not exists ( + select 1 + from atoz_cat_ct_blacklist_map b, cat_object_category_map m, + cms_bundles cb, cms_items ci + where b.type_id = ci.type_id + and ci.parent_id = cb.bundle_id + and ci.language = cb.default_language + and cb.bundle_id = m.object_id + and m.category_id = c.category_id + and m.index_p = '1' + and b.provider_id = :providerID + ) union select c.category_id as id, a.object_type as object_type, Added: trunk/ccm-ldn-atoz/pdl/com/arsdigita/london/atoz/AtoZSiteProxyProvider.pdl =================================================================== --- trunk/ccm-ldn-atoz/pdl/com/arsdigita/london/atoz/AtoZSiteProxyProvider.pdl 2005-12-13 22:39:04 UTC (rev 1049) +++ trunk/ccm-ldn-atoz/pdl/com/arsdigita/london/atoz/AtoZSiteProxyProvider.pdl 2005-12-13 22:52:55 UTC (rev 1050) @@ -0,0 +1,72 @@ +// +// 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 + +model com.arsdigita.london.atoz; + +import com.arsdigita.categorization.Category; + +object type AtoZSiteProxyProvider extends AtoZProvider { + Category[1..1] category = join atoz_siteproxy_provider.category_id to + cat_categories.category_id; + reference key (atoz_siteproxy_provider.provider_id); +} + +query getAtomicSiteProxyEntries { + BigDecimal[1..1] categoryId; + String[1..1] categoryTitle; + String[1..1] categoryDescription; + BigDecimal[1..1] id; + String[1..1] title; + String[1..1] url; + + do { + select c.category_id as cat_id, + c.name as cat_title, + c.description as cat_description, + i.master_id as id, + s.title_atoz as title, + s.url as url + from ct_siteproxy s, + cms_items i, + cat_categories c, + cat_object_category_map m, + cat_cat_subcat_trans_index ci, + atoz_siteproxy_provider p, + cms_bundles b + where s.site_id = i.item_id and + i.parent_id = m.object_id and + i.parent_id = b.bundle_id and + i.language = b.default_language and + m.category_id = c.category_id and + c.enabled_p=1 and + i.version = 'live' and + s.used_in_atoz='1' and + m.category_id = ci.subcategory_id and + ci.category_id = p.category_id and + p.provider_id = :providerID and + lower(c.name) like lower(:letter) + order by + lower(c.name), lower(s.title_atoz) + } map { + categoryId = cat_id; + categoryTitle = cat_title; + categoryDescription = cat_description; + id = id; + title = title; + url = url; + } +} Added: trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/default/upgrade/add-ct_blacklist.sql =================================================================== --- trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/default/upgrade/add-ct_blacklist.sql 2005-12-13 22:39:04 UTC (rev 1049) +++ trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/default/upgrade/add-ct_blacklist.sql 2005-12-13 22:52:55 UTC (rev 1050) @@ -0,0 +1,16 @@ +create table atoz_cat_ct_blacklist_map ( + provider_id INTEGER not null, + -- referential constraint for provider_id deferred due to circular dependencies + type_id INTEGER not null, + -- referential constraint for type_id deferred due to circular dependencies + constraint atoz_cat_ct_bla_map_pr_p_rqpg1 + primary key(type_id, provider_id) +); + +alter table atoz_cat_ct_blacklist_map add + constraint atoz_cat_ct_bla_map_pr_f_b2b9h foreign key (provider_id) + references atoz_cat_provider(provider_id); +alter table atoz_cat_ct_blacklist_map add + constraint atoz_cat_ct_bla_map_ty_f_lb9wc foreign key (type_id) + references content_types(type_id); + Copied: trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/default/upgrade/add-item_provider.sql (from rev 1046, trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/oracle-se/upgrade/add-item_provider.sql) Copied: trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/default/upgrade/add-item_provider_alias.sql (from rev 1046, trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/oracle-se/upgrade/add-item_provider_alias.sql) Added: trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/default/upgrade/add-siteproxy_provider.sql =================================================================== --- trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/default/upgrade/add-siteproxy_provider.sql 2005-12-13 22:39:04 UTC (rev 1049) +++ trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/default/upgrade/add-siteproxy_provider.sql 2005-12-13 22:52:55 UTC (rev 1050) @@ -0,0 +1,16 @@ +create table atoz_siteproxy_provider ( + provider_id INTEGER not null + constraint atoz_site_prov_prov_id_p_p1eu6 + primary key, + -- referential constraint for provider_id deferred due to circular dependencies + category_id INTEGER not null + -- referential constraint for category_id deferred due to circular dependencies +); + +alter table atoz_siteproxy_provider add + constraint atoz_site_prov_cate_id_f_ubcwg foreign key (category_id) + references cat_categories(category_id); +alter table atoz_siteproxy_provider add + constraint atoz_site_prov_prov_id_f_3n5mw foreign key (provider_id) + references atoz_provider(provider_id); + Deleted: trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/oracle-se/upgrade/add-item_provider.sql Deleted: trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/oracle-se/upgrade/add-item_provider_alias.sql Modified: trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/oracle-se-1.0.0-1.0.1.sql =================================================================== --- trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/oracle-se-1.0.0-1.0.1.sql 2005-12-13 22:39:04 UTC (rev 1049) +++ trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/oracle-se-1.0.0-1.0.1.sql 2005-12-13 22:52:55 UTC (rev 1050) @@ -1 +1 @@ -@@ ../oracle-se/upgrade/add-item_provider.sql +@@ ../default/upgrade/add-item_provider.sql Modified: trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/oracle-se-1.0.2-1.0.3.sql =================================================================== --- trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/oracle-se-1.0.2-1.0.3.sql 2005-12-13 22:39:04 UTC (rev 1049) +++ trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/oracle-se-1.0.2-1.0.3.sql 2005-12-13 22:52:55 UTC (rev 1050) @@ -1 +1 @@ -@@ ../oracle-se/upgrade/add-item_provider_alias.sql +@@ ../default/upgrade/add-item_provider_alias.sql Added: trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/oracle-se-6.3.0-6.3.1.sql =================================================================== --- trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/oracle-se-6.3.0-6.3.1.sql 2005-12-13 22:39:04 UTC (rev 1049) +++ trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/oracle-se-6.3.0-6.3.1.sql 2005-12-13 22:52:55 UTC (rev 1050) @@ -0,0 +1,2 @@ +@@ ../default/upgrade/add-siteproxy_provider.sql +@@ ../default/upgrade/add-ct_blacklist.sql Modified: trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/postgres-1.0.0-1.0.1.sql =================================================================== --- trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/postgres-1.0.0-1.0.1.sql 2005-12-13 22:39:04 UTC (rev 1049) +++ trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/postgres-1.0.0-1.0.1.sql 2005-12-13 22:52:55 UTC (rev 1050) @@ -1,3 +1,3 @@ begin; -\i ../postgres/upgrade/add-item_provider.sql +\i ../default/upgrade/add-item_provider.sql commit; Modified: trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/postgres-1.0.2-1.0.3.sql =================================================================== --- trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/postgres-1.0.2-1.0.3.sql 2005-12-13 22:39:04 UTC (rev 1049) +++ trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/postgres-1.0.2-1.0.3.sql 2005-12-13 22:52:55 UTC (rev 1050) @@ -1,3 +1,3 @@ begin; -\i ../postgres/upgrade/add-item_provider_alias.sql +\i ../default/upgrade/add-item_provider_alias.sql commit; Added: trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/postgres-6.3.0-6.3.1.sql =================================================================== --- trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/postgres-6.3.0-6.3.1.sql 2005-12-13 22:39:04 UTC (rev 1049) +++ trunk/ccm-ldn-atoz/sql/ccm-ldn-atoz/upgrade/postgres-6.3.0-6.3.1.sql 2005-12-13 22:52:55 UTC (rev 1050) @@ -0,0 +1,4 @@ +begin; +\i ../default/upgrade/add-siteproxy_provider.sql +\i ../default/upgrade/add-ct_blacklist.sql +commit; Modified: trunk/ccm-ldn-atoz/src/WEB-INF/resources/atoz-adapters.xml =================================================================== --- trunk/ccm-ldn-atoz/src/WEB-INF/resources/atoz-adapters.xml 2005-12-13 22:39:04 UTC (rev 1049) +++ trunk/ccm-ldn-atoz/src/WEB-INF/resources/atoz-adapters.xml 2005-12-13 22:52:55 UTC (rev 1050) @@ -57,6 +57,21 @@ </xrd:associations> </xrd:adapter> + <xrd:adapter objectType="com.arsdigita.london.atoz.AtoZSiteProxyProvider"> + <xrd:attributes rule="exclude"> + <xrd:property name="/object/id"/> + <xrd:property name="/object/defaultDomainClass"/> + <xrd:property name="/object/displayName"/> + <xrd:property name="/object/category/id"/> + <xrd:property name="/object/category/objectType"/> + <xrd:property name="/object/category/defaultDomainClass"/> + <xrd:property name="/object/category/defaultAncestors"/> + </xrd:attributes> + <xrd:associations rule="include"> + <xrd:property name="/object/category"/> + </xrd:associations> + </xrd:adapter> + </xrd:context> <xrd:context name="com.arsdigita.london.atoz.ui.admin.CategoryProviderBlackList"> @@ -70,6 +85,17 @@ </xrd:adapter> </xrd:context> + <xrd:context name="com.arsdigita.london.atoz.ui.admin.CategoryProviderContentTypeBlacklist"> + <xrd:adapter objectType="com.arsdigita.cms.ContentType"> + <xrd:attributes rule="exclude"> + <xrd:property name="/object/id"/> + <xrd:property name="/object/objectType"/> + <xrd:property name="/object/defaultDomainClass"/> + <xrd:property name="/object/displayName"/> + </xrd:attributes> + </xrd:adapter> + </xrd:context> + <xrd:context name="com.arsdigita.london.atoz.ui.admin.CategoryProviderAliasList"> <xrd:adapter objectType="com.arsdigita.categorization.Category"> <xrd:attributes rule="exclude"> Modified: trunk/ccm-ldn-atoz/src/ccm-ldn-atoz.upgrade =================================================================== --- trunk/ccm-ldn-atoz/src/ccm-ldn-atoz.upgrade 2005-12-13 22:39:04 UTC (rev 1049) +++ trunk/ccm-ldn-atoz/src/ccm-ldn-atoz.upgrade 2005-12-13 22:52:55 UTC (rev 1050) @@ -5,4 +5,7 @@ <version from="1.0.2" to="1.0.3"> <script sql="ccm-ldn-atoz/upgrade/::database::-1.0.2-1.0.3.sql"/> </version> + <version from="6.3.0" to="6.3.1"> + <script sql="ccm-ldn-atoz/upgrade/::database::-6.3.0-6.3.1.sql"/> + </version> </upgrade> Modified: trunk/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AtoZAtomicEntry.java =================================================================== --- trunk/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AtoZAtomicEntry.java 2005-12-13 22:39:04 UTC (rev 1049) +++ trunk/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AtoZAtomicEntry.java 2005-12-13 22:52:55 UTC (rev 1050) @@ -18,7 +18,10 @@ package com.arsdigita.london.atoz; +import com.arsdigita.xml.Element; + public interface AtoZAtomicEntry extends AtoZEntry { String getLink(); + Element getContent(); } Modified: trunk/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AtoZCategoryGenerator.java =================================================================== --- trunk/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AtoZCategoryGenerator.java 2005-12-13 22:39:04 UTC (rev 1049) +++ trunk/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AtoZCategoryGenerator.java 2005-12-13 22:52:55 UTC (rev 1050) @@ -18,8 +18,6 @@ package com.arsdigita.london.atoz; - - import com.arsdigita.persistence.DataQuery; import com.arsdigita.persistence.OID; import com.arsdigita.persistence.Filter; @@ -27,6 +25,7 @@ import com.arsdigita.web.ParameterMap; import com.arsdigita.web.URL; import com.arsdigita.web.Web; +import com.arsdigita.xml.Element; import java.util.List; import java.util.ArrayList; @@ -38,36 +37,31 @@ } public AtoZEntry[] getEntries(String letter) { - AtoZCategoryProvider provider = (AtoZCategoryProvider)getProvider(); - + AtoZCategoryProvider provider = (AtoZCategoryProvider) getProvider(); + DataQuery entries = provider.getAtomicEntries(); Filter f = entries.addFilter("sortKey like :sortKey"); f.set("sortKey", letter.toLowerCase() + "%"); entries.addOrder("sortKey"); - + List l = new ArrayList(); while (entries.next()) { - l.add(new AtoZCategoryAtomicEntry( - new OID( - (String)entries.get("objectType"), - entries.get("id") - ), - (String)entries.get("title"), - (String)entries.get("description") - )); + l.add(new AtoZCategoryAtomicEntry(new OID((String) entries + .get("objectType"), entries.get("id")), (String) entries + .get("title"), (String) entries.get("description"))); } - - return (AtoZEntry[])l.toArray(new AtoZEntry[l.size()]); + + return (AtoZEntry[]) l.toArray(new AtoZEntry[l.size()]); } - + private class AtoZCategoryAtomicEntry implements AtoZAtomicEntry { private OID m_oid; + private String m_title; + private String m_description; - - public AtoZCategoryAtomicEntry(OID oid, - String title, - String description) { + + public AtoZCategoryAtomicEntry(OID oid, String title, String description) { m_oid = oid; m_title = title; m_description = description; @@ -82,17 +76,18 @@ } public String getLink() { - ParameterMap map = new ParameterMap(); - map.setParameter("oid", m_oid.toString()); + ParameterMap map = new ParameterMap(); + map.setParameter("oid", m_oid.toString()); - URL here = Web.getContext().getRequestURL(); + URL here = Web.getContext().getRequestURL(); - return (new URL(here.getScheme(), - here.getServerName(), - here.getServerPort(), - "", - "", - "/redirect/", map)).toString(); + return (new URL(here.getScheme(), here.getServerName(), here + .getServerPort(), "", "", "/redirect/", map)).toString(); } + + public Element getContent() { + // empty + return null; + } } } Modified: trunk/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AtoZCategoryProvider.java =================================================================== --- trunk/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AtoZCategoryProvider.java 2005-12-13 22:39:04 UTC (rev 1049) +++ trunk/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AtoZCategoryProvider.java 2005-12-13 22:52:55 UTC (rev 1050) @@ -18,44 +18,41 @@ package com.arsdigita.london.atoz; +import com.arsdigita.categorization.Category; +import com.arsdigita.cms.ContentType; +import com.arsdigita.domain.DomainCollection; +import com.arsdigita.london.subsite.Site; +import com.arsdigita.london.subsite.Subsite; +import com.arsdigita.london.subsite.SubsiteContext; +import com.arsdigita.persistence.DataAssociation; +import com.arsdigita.persistence.DataAssociationCursor; import com.arsdigita.persistence.DataObject; +import com.arsdigita.persistence.DataQuery; import com.arsdigita.persistence.OID; -import com.arsdigita.persistence.DataAssociation; -import com.arsdigita.persistence.DataQuery; import com.arsdigita.persistence.SessionManager; -import com.arsdigita.domain.DomainCollection; -import com.arsdigita.categorization.Category; +public class AtoZCategoryProvider extends AtoZProvider { + public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.london.atoz.AtoZCategoryProvider"; -import com.arsdigita.london.subsite.SubsiteContext; -import com.arsdigita.london.subsite.Subsite; -import com.arsdigita.london.subsite.Site; + public static final String IS_COMPOUND = "isCompound"; + public static final String IS_VISIBLE = "isVisible"; -import org.apache.log4j.Logger; + public static final String BLACK_LIST = "atozBlackList"; -public class AtoZCategoryProvider extends AtoZProvider { - - private static final Logger s_log = Logger.getLogger(AtoZCategoryProvider.class); + public static final String CT_BLACK_LIST = "atozContentTypeBlackList"; - public static final String BASE_DATA_OBJECT_TYPE - = "com.arsdigita.london.atoz.AtoZCategoryProvider"; - - public static final String IS_COMPOUND = "isCompound"; - public static final String IS_VISIBLE = "isVisible"; - public static final String BLACK_LIST = "atozBlackList"; public static final String ALIASES = "atozAliases"; - public static final String ATOMIC_ENTRIES = - "com.arsdigita.london.atoz.getAtomicCategoryEntries"; + public static final String CT_TYPE_ID = "type_id"; - public static final String ATOMIC_ENTRIES_FOR_ROOT_CATEGORY = - "com.arsdigita.london.atoz.getAtomicCategoryEntriesForRootCategory"; + public static final String ATOMIC_ENTRIES = "com.arsdigita.london.atoz.getAtomicCategoryEntries"; - public static final String COMPOUND_ENTRIES = - "com.arsdigita.london.atoz.getCompoundCategoryEntries"; + public static final String ATOMIC_ENTRIES_FOR_ROOT_CATEGORY = "com.arsdigita.london.atoz.getAtomicCategoryEntriesForRootCategory"; + public static final String COMPOUND_ENTRIES = "com.arsdigita.london.atoz.getCompoundCategoryEntries"; + public AtoZCategoryProvider() { this(BASE_DATA_OBJECT_TYPE); } @@ -63,7 +60,7 @@ protected AtoZCategoryProvider(String type) { super(type); } - + public AtoZCategoryProvider(DataObject obj) { super(obj); } @@ -74,42 +71,31 @@ public void delete() { Category.clearRootForObject(this); - + super.delete(); } - public static AtoZCategoryProvider create(String title, - String description, - boolean isCompound) { + public static AtoZCategoryProvider create(String title, String description, + boolean isCompound) { AtoZCategoryProvider provider = new AtoZCategoryProvider(); - provider.setup(title, - description, - isCompound); + provider.setup(title, description, isCompound); return provider; } - - - - protected void setup(String title, - String description, - boolean isCompound) { - super.setup(title, - description); + protected void setup(String title, String description, boolean isCompound) { + super.setup(title, description); setCompound(isCompound); } public boolean isCompound() { return Boolean.TRUE.equals(get(IS_COMPOUND)); } - + public void setCompound(boolean isCompound) { set(IS_COMPOUND, new Boolean(isCompound)); } - public void addAlias(Category cat, - String letter, - String title) { + public void addAlias(Category cat, String letter, String title) { DataObject link = add(ALIASES, cat); link.set("letter", letter); link.set("title", title); @@ -122,39 +108,47 @@ public void addBlock(Category cat) { add(BLACK_LIST, cat); } - + public void removeBlock(Category cat) { remove(BLACK_LIST, cat); } public DomainCollection getAliases() { - DataAssociation entries = (DataAssociation)get(ALIASES); + DataAssociation entries = (DataAssociation) get(ALIASES); return new DomainCollection(entries); } - + public DomainCollection getBlackList() { - DataAssociation entries = (DataAssociation)get(BLACK_LIST); + DataAssociation entries = (DataAssociation) get(BLACK_LIST); return new DomainCollection(entries); } - + + public DomainCollection getContentTypeBlackList() { + DataAssociation entries = (DataAssociation) get(CT_BLACK_LIST); + return new DomainCollection(entries); + } + public DataQuery getAtomicEntries() { - DataQuery cats = null; - SubsiteContext subsiteContext = Subsite.getContext(); - boolean useSubsiteSpecificNavigationCategory = AtoZ.getConfig().useSubsiteSpecificNavigationCategory(); // configured using ccm set - boolean hasSite = subsiteContext.hasSite(); - if (hasSite && useSubsiteSpecificNavigationCategory) { - Site site = subsiteContext.getSite(); - Category root = site.getRootCategory(); - cats = SessionManager.getSession().retrieveQuery(ATOMIC_ENTRIES_FOR_ROOT_CATEGORY); - cats.setParameter("providerID", getID()); - cats.setParameter("rootCategoryID", root.getID()); - } else { - cats = SessionManager.getSession().retrieveQuery(ATOMIC_ENTRIES); - cats.setParameter("providerID", getID()); - } + DataQuery cats = null; + SubsiteContext subsiteContext = Subsite.getContext(); + boolean useSubsiteSpecificNavigationCategory = AtoZ.getConfig() + .useSubsiteSpecificNavigationCategory(); // configured using + // ccm set + boolean hasSite = subsiteContext.hasSite(); + if (hasSite && useSubsiteSpecificNavigationCategory) { + Site site = subsiteContext.getSite(); + Category root = site.getRootCategory(); + cats = SessionManager.getSession().retrieveQuery( + ATOMIC_ENTRIES_FOR_ROOT_CATEGORY); + cats.setParameter("providerID", getID()); + cats.setParameter("rootCategoryID", root.getID()); + } else { + cats = SessionManager.getSession().retrieveQuery(ATOMIC_ENTRIES); + cats.setParameter("providerID", getID()); + } return cats; } - + public Category getRootCategory() { return Category.getRootForObject(this); } @@ -162,9 +156,32 @@ public void setRootCategory(Category root) { Category.setRootForObject(this, root); } - + public AtoZGenerator getGenerator() { return new AtoZCategoryGenerator(this); } - + + public void addContentTypeBlock(ContentType contentType) { + if (!isBlocked(contentType)) + add(CT_BLACK_LIST, contentType); + } + + private boolean isBlocked(ContentType contentType) { + DataAssociation da = (DataAssociation) get(CT_BLACK_LIST); + DataAssociationCursor cursor = da.cursor(); + while (cursor.next()) { + if (cursor.getDataObject().getOID() == contentType.getOID()) { + cursor.close(); + return true; + } + } + cursor.close(); + return false; + } + + public void removeContentTypeBlock(ContentType contentType) { + if (isBlocked(contentType)) + remove(CT_BLACK_LIST, contentType); + } + } Modified: trunk/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AtoZItemGenerator.java =================================================================== --- trunk/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AtoZItemGenerator.java 2005-12-13 22:39:04 UTC (rev 1049) +++ trunk/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AtoZItemGenerator.java 2005-12-13 22:52:55 UTC (rev 1050) @@ -24,6 +24,7 @@ import com.arsdigita.persistence.DataQuery; import com.arsdigita.persistence.Filter; import com.arsdigita.persistence.OID; +import com.arsdigita.xml.Element; import java.math.BigDecimal; import java.util.ArrayList; @@ -36,13 +37,13 @@ } public AtoZEntry[] getEntries(String letter) { - AtoZItemProvider provider = (AtoZItemProvider)getProvider(); + AtoZItemProvider provider = (AtoZItemProvider) getProvider(); DataQuery entries = provider.getAtomicEntries(); Filter f = entries.addFilter("sortKey like :sortKey"); f.set("sortKey", letter.toLowerCase() + "%"); entries.addOrder("sortKey"); - + List l = new ArrayList(); ContentBundle bundle; ContentItem item; @@ -51,43 +52,46 @@ String title; while (entries.next()) { - bundle = new ContentBundle(new BigDecimal(entries.get("id").toString())); - if (bundle != null) { - item = bundle.getPrimaryInstance(); - if (item != null) { - // this is necessary because aliases refer to the non-live version, - // while straight items refer to the live-version (to avoid duplicates) - live = item.getLiveVersion(); - if (live != null) { - // should always be a ContentPage - description = (live instanceof ContentPage) ? - ((ContentPage) live).getSearchSummary() : live.getName(); - title = ""; - if (entries.get("aliasTitle") != null) { - title = entries.get("aliasTitle").toString(); - } - if (title.equals("")) { - title = live.getDisplayName(); - } - l.add(new AtoZItemAtomicEntry(live.getOID(), - title, - description)); - } - } - } + bundle = new ContentBundle(new BigDecimal(entries.get("id") + .toString())); + if (bundle != null) { + item = bundle.getPrimaryInstance(); + if (item != null) { + // this is necessary because aliases refer to the non-live + // version, + // while straight items refer to the live-version (to avoid + // duplicates) + live = item.getLiveVersion(); + if (live != null) { + // should always be a ContentPage + description = (live instanceof ContentPage) ? ((ContentPage) live) + .getSearchSummary() + : live.getName(); + title = ""; + if (entries.get("aliasTitle") != null) { + title = entries.get("aliasTitle").toString(); + } + if (title.equals("")) { + title = live.getDisplayName(); + } + l.add(new AtoZItemAtomicEntry(live.getOID(), title, + description)); + } + } + } } - return (AtoZEntry[])l.toArray(new AtoZEntry[l.size()]); + return (AtoZEntry[]) l.toArray(new AtoZEntry[l.size()]); } private class AtoZItemAtomicEntry implements AtoZAtomicEntry { private OID m_oid; + private String m_title; + private String m_description; - public AtoZItemAtomicEntry(OID oid, - String title, - String description) { + public AtoZItemAtomicEntry(OID oid, String title, String description) { m_oid = oid; m_title = title; m_description = description; @@ -104,5 +108,10 @@ public String getLink() { return "/redirect/?oid=" + m_oid; } + + public Element getContent() { + // empty + return null; + } } } Added: trunk/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AtoZSiteProxyGenerator.java =================================================================== --- trunk/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AtoZSiteProxyGenerator.java 2005-12-13 22:39:04 UTC (rev 1049) +++ trunk/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AtoZSiteProxyGenerator.java 2005-12-13 22:52:55 UTC (rev 1050) @@ -0,0 +1,176 @@ +/* + * 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.london.atoz; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +import com.arsdigita.cms.contenttypes.SiteProxy; +import com.arsdigita.cms.dispatcher.SiteProxyPanel; +import com.arsdigita.persistence.DataQuery; +import com.arsdigita.persistence.OID; +import com.arsdigita.util.url.URLData; +import com.arsdigita.xml.Element; + +public class AtoZSiteProxyGenerator extends AbstractAtoZGenerator { + + /** + * Compound Entry for mathched Categories + * + */ + private class AtoZCategoriesCompoundEntry implements AtoZCompoundEntry { + + private List entries = new ArrayList(); + + private String m_title; + + private String m_description; + + /** + * + */ + public AtoZCategoriesCompoundEntry(String title, String description) { + m_title = title; + m_description = description; + } + + /* + * (non-Javadoc) + * + * @see com.arsdigita.london.atoz.AtoZCompoundEntry#getEntries() + */ + public AtoZEntry[] getEntries() { + return (AtoZEntry[]) entries.toArray(new AtoZEntry[entries.size()]); + } + + /* + * (non-Javadoc) + * + * @see com.arsdigita.london.atoz.AtoZEntry#getTitle() + */ + public String getTitle() { + return m_title; + } + + /* + * (non-Javadoc) + * + * @see com.arsdigita.london.atoz.AtoZEntry#getDescription() + */ + public String getDescription() { + return m_description; + } + + } + + private class AtoZSiteProxyAtomicEntry implements AtoZAtomicEntry { + private static final String ATOZ_SITE_PROXY_CONTENT_NAME = "atoz:siteProxyContent"; + + private OID m_oid; + + private String m_title; + + private String m_url; + + public AtoZSiteProxyAtomicEntry(OID oid, String title, String url) { + m_oid = oid; + m_title = title; + m_url = url; + } + + public String getTitle() { + return m_title; + } + + public String getDescription() { + return null; + } + + public String getLink() { + return "/redirect?oid=" + m_oid.toString(); + } + + public Element getContent() { + if (m_url == null) + return null; + + Element child = new Element( + AtoZSiteProxyAtomicEntry.ATOZ_SITE_PROXY_CONTENT_NAME); + child.addAttribute("title", m_title); + child.addAttribute("oid", m_oid.toString()); + + URLData data = SiteProxyPanel.internalGetRemoteXML(child, + this.m_url); + + /* check for data and exception */ + if (data == null) + return null; + if (data.getException() != null) + return null; + + return child; + } + } + + public AtoZSiteProxyGenerator(AtoZProvider provider) { + super(provider); + } + + public AtoZEntry[] getEntries(String letter) { + AtoZSiteProxyProvider siteProxyProvider = (AtoZSiteProxyProvider) getProvider(); + + DataQuery entries = siteProxyProvider.getAtomicEntries(letter); + + List list = new ArrayList(); + /* init previousCatId */ + BigDecimal previousCatId = new BigDecimal(-1); + /* watch categoryID for changes */ + + AtoZCategoriesCompoundEntry compoundEntry = null; + while (entries.next()) { + /* on category change add previous compoundEntry and create new one */ + if (previousCatId.compareTo(entries.get("categoryId")) != 0) { + if ((compoundEntry != null) + && (compoundEntry.entries.size() > 0)) + list.add(compoundEntry); + + /* create compound entry */ + compoundEntry = new AtoZCategoriesCompoundEntry( + (String) entries.get("categoryTitle"), (String) entries + .get("categoryDescription")); + /* assign current categoryId to previousCatId */ + previousCatId = (BigDecimal) entries.get("categoryId"); + } + + /* create atomic entry */ + AtoZSiteProxyAtomicEntry atomicEntry = new AtoZSiteProxyAtomicEntry( + new OID(SiteProxy.BASE_DATA_OBJECT_TYPE, entries.get("id")), + (String) entries.get("title"), (String) entries.get("url")); + + /* add it to coumpoundEntry if siteProxy content is not null */ + if (atomicEntry.getContent() != null) + compoundEntry.entries.add(atomicEntry); + } + /* finally add compoundEntry if exist and not empty */ + if ((compoundEntry != null) && (compoundEntry.entries.size() > 0)) + list.add(compoundEntry); + + return (AtoZEntry[]) list.toArray(new AtoZEntry[list.size()]); + } +} Added: trunk/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AtoZSiteProxyProvider.java =================================================================== --- trunk/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AtoZSiteProxyProvider.java 2005-12-13 22:39:04 UTC (rev 1049) +++ trunk/ccm-ldn-atoz/src/com/arsdigita/london/atoz/AtoZSiteProxyProvider.java 2005-12-13 22:52:55 UTC (rev 1050) @@ -0,0 +1,71 @@ +package com.arsdigita.london.atoz; + +import com.arsdigita.categorization.Category; +import com.arsdigita.persistence.DataObject; +import com.arsdigita.persistence.DataQuery; .. |
Author: apevec Date: 2005-12-13 23:39:04 +0100 (Tue, 13 Dec 2005) New Revision: 1049 Added: trunk/ccm-cms-types-siteproxy/sql/ccm-cms-types-siteproxy/oracle-se/ trunk/ccm-cms-types-siteproxy/sql/ccm-cms-types-siteproxy/oracle-se/upgrade/ trunk/ccm-cms-types-siteproxy/sql/ccm-cms-types-siteproxy/oracle-se/upgrade/atoz-modification.sql trunk/ccm-cms-types-siteproxy/sql/ccm-cms-types-siteproxy/postgres/ trunk/ccm-cms-types-siteproxy/sql/ccm-cms-types-siteproxy/postgres/upgrade/ trunk/ccm-cms-types-siteproxy/sql/ccm-cms-types-siteproxy/postgres/upgrade/atoz-modification.sql trunk/ccm-cms-types-siteproxy/sql/ccm-cms-types-siteproxy/upgrade/ trunk/ccm-cms-types-siteproxy/sql/ccm-cms-types-siteproxy/upgrade/oracle-se-6.3.0-6.3.1.sql trunk/ccm-cms-types-siteproxy/sql/ccm-cms-types-siteproxy/upgrade/postgres-6.3.0-6.3.1.sql trunk/ccm-cms-types-siteproxy/src/ccm-cms-types-siteproxy.upgrade trunk/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/SiteProxyUpgrade630to631.java trunk/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/ui/Constants.java trunk/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/ui/SiteProxyAtoZPropertiesStep.java trunk/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/ui/SiteProxyAtoZPropertyForm.java Modified: trunk/ccm-cms-types-siteproxy/application.xml trunk/ccm-cms-types-siteproxy/pdl/com/arsdigita/cms/contenttypes/SiteProxy.pdl trunk/ccm-cms-types-siteproxy/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SiteProxy.xml trunk/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/SiteProxy.java trunk/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/SiteProxyResources.properties Log: SiteProxy content type modifications to enable its usage as a data source for AtoZ application NB data model change: ccm upgrade ccm-cms-types-siteproxy --from-version 6.3.0 --to-version 6.3.1 Modified: trunk/ccm-cms-types-siteproxy/application.xml =================================================================== --- trunk/ccm-cms-types-siteproxy/application.xml 2005-12-13 21:24:06 UTC (rev 1048) +++ trunk/ccm-cms-types-siteproxy/application.xml 2005-12-13 22:39:04 UTC (rev 1049) @@ -2,8 +2,8 @@ <ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project" name="ccm-cms-types-siteproxy" prettyName="Red Hat CCM Content Types" - version="6.3.0" - release="3" + version="6.3.1" + release="1" webapp="ROOT"> <ccm:dependencies> <ccm:requires name="ccm-core" version="6.2.0" relation="ge"/> Modified: trunk/ccm-cms-types-siteproxy/pdl/com/arsdigita/cms/contenttypes/SiteProxy.pdl =================================================================== --- trunk/ccm-cms-types-siteproxy/pdl/com/arsdigita/cms/contenttypes/SiteProxy.pdl 2005-12-13 21:24:06 UTC (rev 1048) +++ trunk/ccm-cms-types-siteproxy/pdl/com/arsdigita/cms/contenttypes/SiteProxy.pdl 2005-12-13 22:39:04 UTC (rev 1049) @@ -23,7 +23,8 @@ object type SiteProxy extends ContentPage { String [0..1] url = ct_siteproxy.url VARCHAR(250); - + String [0..1] titleAtoZ = ct_siteproxy.title_atoz VARCHAR(200); + Boolean[0..1] usedInAtoZ = ct_siteproxy.used_in_atoz BIT; reference key (ct_siteproxy.site_id); } Added: trunk/ccm-cms-types-siteproxy/sql/ccm-cms-types-siteproxy/oracle-se/upgrade/atoz-modification.sql =================================================================== --- trunk/ccm-cms-types-siteproxy/sql/ccm-cms-types-siteproxy/oracle-se/upgrade/atoz-modification.sql 2005-12-13 21:24:06 UTC (rev 1048) +++ trunk/ccm-cms-types-siteproxy/sql/ccm-cms-types-siteproxy/oracle-se/upgrade/atoz-modification.sql 2005-12-13 22:39:04 UTC (rev 1049) @@ -0,0 +1,8 @@ +alter table ct_siteproxy add ( + title_atoz VARCHAR(200) +); +alter table ct_siteproxy add ( + used_in_atoz CHAR(1) + constraint ct_sitepro_use_in_atoz_c_fitem + check(used_in_atoz in ('0', '1')) +); Added: trunk/ccm-cms-types-siteproxy/sql/ccm-cms-types-siteproxy/postgres/upgrade/atoz-modification.sql =================================================================== --- trunk/ccm-cms-types-siteproxy/sql/ccm-cms-types-siteproxy/postgres/upgrade/atoz-modification.sql 2005-12-13 21:24:06 UTC (rev 1048) +++ trunk/ccm-cms-types-siteproxy/sql/ccm-cms-types-siteproxy/postgres/upgrade/atoz-modification.sql 2005-12-13 22:39:04 UTC (rev 1049) @@ -0,0 +1,2 @@ +alter table ct_siteproxy add title_atoz VARCHAR(200); +alter table ct_siteproxy add used_in_atoz BOOLEAN; Added: trunk/ccm-cms-types-siteproxy/sql/ccm-cms-types-siteproxy/upgrade/oracle-se-6.3.0-6.3.1.sql =================================================================== --- trunk/ccm-cms-types-siteproxy/sql/ccm-cms-types-siteproxy/upgrade/oracle-se-6.3.0-6.3.1.sql 2005-12-13 21:24:06 UTC (rev 1048) +++ trunk/ccm-cms-types-siteproxy/sql/ccm-cms-types-siteproxy/upgrade/oracle-se-6.3.0-6.3.1.sql 2005-12-13 22:39:04 UTC (rev 1049) @@ -0,0 +1 @@ +@@ ../oracle-se/upgrade/atoz-modification.sql Added: trunk/ccm-cms-types-siteproxy/sql/ccm-cms-types-siteproxy/upgrade/postgres-6.3.0-6.3.1.sql =================================================================== --- trunk/ccm-cms-types-siteproxy/sql/ccm-cms-types-siteproxy/upgrade/postgres-6.3.0-6.3.1.sql 2005-12-13 21:24:06 UTC (rev 1048) +++ trunk/ccm-cms-types-siteproxy/sql/ccm-cms-types-siteproxy/upgrade/postgres-6.3.0-6.3.1.sql 2005-12-13 22:39:04 UTC (rev 1049) @@ -0,0 +1 @@ +\i ../postgres/upgrade/atoz-modification.sql Modified: trunk/ccm-cms-types-siteproxy/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SiteProxy.xml =================================================================== --- trunk/ccm-cms-types-siteproxy/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SiteProxy.xml 2005-12-13 21:24:06 UTC (rev 1048) +++ trunk/ccm-cms-types-siteproxy/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SiteProxy.xml 2005-12-13 22:39:04 UTC (rev 1049) @@ -1,24 +1,33 @@ <?xml version="1.0" encoding="utf-8"?> -<ctd:content-types xmlns:ctd="http://xmlns.redhat.com/cms/content-types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.redhat.com/cms/content-types content-types.xsd"> +<ctd:content-types xmlns:ctd="http://xmlns.redhat.com/cms/content-types" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://xmlns.redhat.com/cms/content-types content-types.xsd"> <ctd:content-type label="Site Proxy" - description="A Proxy item for a page on an external site" - objectType="com.arsdigita.cms.contenttypes.SiteProxy" - classname="com.arsdigita.cms.contenttypes.SiteProxy"> + description="A Proxy item for a page on an external site" + objectType="com.arsdigita.cms.contenttypes.SiteProxy" + classname="com.arsdigita.cms.contenttypes.SiteProxy"> - <ctd:authoring-kit createComponent="com.arsdigita.cms.ui.authoring.PageCreate"> + <ctd:authoring-kit + createComponent="com.arsdigita.cms.ui.authoring.PageCreate"> - <ctd:authoring-step label="Edit Basic Properties" - description="Edit basic properties" - component="com.arsdigita.cms.contenttypes.ui.SiteProxyPropertiesStep" - ordering="1"/> - - <ctd:authoring-step label="Assign categories" - description="Assign categories" - component="com.arsdigita.cms.ui.authoring.ItemCategoryStep" - ordering="2"/> - - </ctd:authoring-kit> + <ctd:authoring-step + labelKey="cms.contenttypes.shared.basic_properties.title" + labelBundle="com.arsdigita.cms.ui.CMSResources" + descriptionKey="cms.contenttypes.shared.basic_properties.description" + descriptionBundle="com.arsdigita.cms.ui.CMSResources" + component="com.arsdigita.cms.contenttypes.ui.SiteProxyPropertiesStep"/> + + <ctd:include href="/WEB-INF/content-types/assign-categories-step.xml"/> + + <ctd:authoring-step + labelKey="cms.contenttypes.ui.siteproxy.atozstep.label" + labelBundle="com.arsdigita.cms.contenttypes.SiteProxyResources" + descriptionKey="cms.contenttypes.ui.siteproxy.atozstep.description" + descriptionBundle="com.arsdigita.cms.contenttypes.SiteProxyResources" + component="com.arsdigita.cms.contenttypes.ui.SiteProxyAtoZPropertiesStep"/> + + </ctd:authoring-kit> </ctd:content-type> </ctd:content-types> Added: trunk/ccm-cms-types-siteproxy/src/ccm-cms-types-siteproxy.upgrade =================================================================== --- trunk/ccm-cms-types-siteproxy/src/ccm-cms-types-siteproxy.upgrade 2005-12-13 21:24:06 UTC (rev 1048) +++ trunk/ccm-cms-types-siteproxy/src/ccm-cms-types-siteproxy.upgrade 2005-12-13 22:39:04 UTC (rev 1049) @@ -0,0 +1,6 @@ +<upgrade> + <version from="6.3.0" to="6.3.1"> + <script sql="ccm-cms-types-siteproxy/upgrade/::database::-6.3.0-6.3.1.sql"/> + <script class="com.arsdigita.cms.contenttypes.SiteProxyUpgrade630to631"/> + </version> +</upgrade> Modified: trunk/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/SiteProxy.java =================================================================== --- trunk/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/SiteProxy.java 2005-12-13 21:24:06 UTC (rev 1048) +++ trunk/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/SiteProxy.java 2005-12-13 22:39:04 UTC (rev 1049) @@ -18,73 +18,94 @@ */ package com.arsdigita.cms.contenttypes; +import java.math.BigDecimal; + +import org.apache.log4j.Logger; + +import com.arsdigita.cms.ContentPage; import com.arsdigita.cms.ContentType; -import com.arsdigita.cms.ContentPage; -import com.arsdigita.cms.dispatcher.SiteProxyPanel; import com.arsdigita.domain.DataObjectNotFoundException; +import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.OID; -import com.arsdigita.persistence.DataObject; -import java.math.BigDecimal; - -import org.apache.log4j.Logger; - /** * This content type represents a SiteProxy. - * - * @version $Revision: #4 $ $Date: 2004/08/17 $ + * + * Remote XML document defined by "url" property is retrieved and + * included in CMS XML output. */ public class SiteProxy extends ContentPage { - private static final Logger s_log = Logger.getLogger(SiteProxy.class); - /** PDL property name for definition */ public static final String URL = "url"; + /** PDL property name for definition titleAtoZ */ + public static final String TITLE_ATOZ = "titleAtoZ"; + + /** PDL property name for definition usedInAtoZ */ + public static final String USED_IN_ATOZ = "usedInAtoZ"; + /** Data object type for this domain object */ - public static final String BASE_DATA_OBJECT_TYPE - = "com.arsdigita.cms.contenttypes.SiteProxy"; + public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.SiteProxy"; + /** Data object type for this domain object (for CMS compatibility) */ - public static final String TYPE - = BASE_DATA_OBJECT_TYPE; + public static final String TYPE = BASE_DATA_OBJECT_TYPE; public SiteProxy() { - this( BASE_DATA_OBJECT_TYPE ); + this(BASE_DATA_OBJECT_TYPE); try { - setContentType( - ContentType.findByAssociatedObjectType( - BASE_DATA_OBJECT_TYPE - ) - ); - } catch( DataObjectNotFoundException e ) { - throw new RuntimeException( "SiteProxy type not registered" ); + setContentType(ContentType + .findByAssociatedObjectType(BASE_DATA_OBJECT_TYPE)); + } catch (DataObjectNotFoundException e) { + throw new RuntimeException("SiteProxy type not registered"); } } - public SiteProxy( BigDecimal id ) - throws DataObjectNotFoundException { - this( new OID( BASE_DATA_OBJECT_TYPE, id ) ); + public SiteProxy(BigDecimal id) throws DataObjectNotFoundException { + this(new OID(BASE_DATA_OBJECT_TYPE, id)); } - public SiteProxy( OID id ) - throws DataObjectNotFoundException { - super( id ); + public SiteProxy(OID id) throws DataObjectNotFoundException { + super(id); } - public SiteProxy( DataObject obj ) { - super( obj ); + public SiteProxy(DataObject obj) { + super(obj); } - public SiteProxy( String type ) { - super( type ); + public SiteProxy(String type) { + super(type); } - public String getURL() { return (String) get(URL); } - public void setURL( String url ) { + public void setURL(String url) { set(URL, url); } + + public String getAtoZTitle() { + return (String) get(TITLE_ATOZ); + } + + public void setAtoZTitle(String atozTitle) { + set(TITLE_ATOZ, atozTitle); + } + + public boolean isUsedInAtoZ() { + return Boolean.TRUE.equals(get(USED_IN_ATOZ)); + } + + public void setUsedInAtoZ(boolean usedInAtoZ) { + set(USED_IN_ATOZ, new Boolean(usedInAtoZ)); + } + + protected void initialize() { + super.initialize(); + + if (isNew()) { + set(USED_IN_ATOZ, Boolean.FALSE); + } + } } Modified: trunk/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/SiteProxyResources.properties =================================================================== --- trunk/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/SiteProxyResources.properties 2005-12-13 21:24:06 UTC (rev 1048) +++ trunk/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/SiteProxyResources.properties 2005-12-13 22:39:04 UTC (rev 1049) @@ -1,3 +1,12 @@ cms.contenttypes.siteproxy.error_fetching_url=Error fetching URL: {0} cms.contenttypes.siteproxy.exception_fetching_url=Error fetching URL: {0} with exception of type " {1} " and message " {2} " -cms.contenttypes.siteproxy.empty_page_returned=Empty Page Returned for URL: {0} \ No newline at end of file +cms.contenttypes.siteproxy.empty_page_returned=Empty Page Returned for URL: {0} +cms.contenttypes.ui.siteproxy.kit.label=Site Proxy +cms.contenttypes.ui.siteproxy.kit.description=A Proxy item for a page on an external site +cms.contenttypes.ui.siteproxy.atozstep.label=Edit AtoZ properties +cms.contenttypes.ui.siteproxy.atozstep.description=Edit AtoZ properties +cms.contenttypes.ui.siteproxy.label.atoztitle=AtoZ Title +cms.contenttypes.ui.siteproxy.label.usedinatoz=Used in AtoZ +cms.contenttypes.ui.siteproxy.option.usedinatoz.yes=Yes +cms.contenttypes.ui.siteproxy.option.usedinatoz.no=No +cms.contenttypes.ui.siteproxy.link.editatoz=Edit Added: trunk/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/SiteProxyUpgrade630to631.java =================================================================== --- trunk/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/SiteProxyUpgrade630to631.java 2005-12-13 21:24:06 UTC (rev 1048) +++ trunk/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/SiteProxyUpgrade630to631.java 2005-12-13 22:39:04 UTC (rev 1049) @@ -0,0 +1,41 @@ +package com.arsdigita.cms.contenttypes; + +import com.arsdigita.cms.installer.xml.XMLContentTypeHandler; +import com.arsdigita.kernel.Kernel; +import com.arsdigita.kernel.KernelExcursion; +import com.arsdigita.persistence.Session; +import com.arsdigita.persistence.SessionManager; +import com.arsdigita.persistence.TransactionContext; +import com.arsdigita.runtime.Startup; +import com.arsdigita.xml.XML; + +public class SiteProxyUpgrade630to631 { + + private final static String SITE_PROXY = "/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SiteProxy.xml"; + + public static void main(String[] args) { + new Startup().run(); + final Session session = SessionManager.getSession(); + final TransactionContext tc = session.getTransactionContext(); + try { + tc.beginTxn(); + new KernelExcursion() { + public void excurse() { + setEffectiveParty(Kernel.getSystemParty()); + /* + * reload SiteProxy content type definition from XML config + * to add new authoring kit step + */ + XMLContentTypeHandler handler = new XMLContentTypeHandler(); + XML.parseResource(SITE_PROXY, handler); + } + }.run(); + session.flushAll(); + tc.commitTxn(); + } finally { + if (tc.inTxn()) { + tc.abortTxn(); + } + } + } +} Added: trunk/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/ui/Constants.java =================================================================== --- trunk/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/ui/Constants.java 2005-12-13 21:24:06 UTC (rev 1048) +++ trunk/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/ui/Constants.java 2005-12-13 22:39:04 UTC (rev 1049) @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2004 Red Hat Inc. All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +package com.arsdigita.cms.contenttypes.ui; + +interface Constants { + + /* Globalization constants */ + static final String LABEL_TITLE_ATOZ = "cms.contenttypes.ui.siteproxy.label.atoztitle"; + static final String LABEL_USED_IN_ATOZ = "cms.contenttypes.ui.siteproxy.label.usedinatoz"; + static final String OPTION_USED_IN_ATOZ_YES = "cms.contenttypes.ui.siteproxy.option.usedinatoz.yes"; + static final String OPTION_USED_IN_ATOZ_NO = "cms.contenttypes.ui.siteproxy.option.usedinatoz.no"; + +} Added: trunk/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/ui/SiteProxyAtoZPropertiesStep.java =================================================================== --- trunk/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/ui/SiteProxyAtoZPropertiesStep.java 2005-12-13 21:24:06 UTC (rev 1048) +++ trunk/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/ui/SiteProxyAtoZPropertiesStep.java 2005-12-13 22:39:04 UTC (rev 1049) @@ -0,0 +1,130 @@ +/* + * 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.cms.contenttypes.ui; + +import com.arsdigita.bebop.Component; +import com.arsdigita.bebop.PageState; +import com.arsdigita.cms.ContentItem; +import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.contenttypes.SiteProxy; +import com.arsdigita.cms.contenttypes.util.SiteProxyGlobalizationUtil; +import com.arsdigita.cms.ui.authoring.AuthoringKitWizard; +import com.arsdigita.cms.ui.authoring.BasicItemForm; +import com.arsdigita.cms.ui.authoring.SimpleEditStep; +import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess; +import com.arsdigita.domain.DomainObject; +import com.arsdigita.toolbox.ui.DomainObjectPropertySheet; + +/** + * Authoring step to edit the simple attributes for the SiteProxy content + * connection to new AtoZ + */ +public class SiteProxyAtoZPropertiesStep extends SimpleEditStep { + + /** The name of the editing sheet added to this step */ + public static final String EDIT_ATOZ_SHEET_NAME = "editAtoZ"; + + public static final String LINK_EDIT = "cms.contenttypes.ui.siteproxy.link.editatoz"; + + /** + * @param itemModel + * @param parent + */ + public SiteProxyAtoZPropertiesStep(ItemSelectionModel itemModel, + AuthoringKitWizard parent) { + super(itemModel, parent); + + BasicItemForm form; + + form = new SiteProxyAtoZPropertyForm(itemModel); + add(EDIT_ATOZ_SHEET_NAME, SiteProxyGlobalizationUtil.globalize( + LINK_EDIT).localize().toString(), + new WorkflowLockedComponentAccess(form, itemModel), form + .getSaveCancelSection().getCancelButton()); + + setDisplayComponent(getSiteProxyAtoZPropertySheet(itemModel)); + } + + /** + * Returns a component that displays AtoZ integration properties of the + * SiteProxy specified by the ItemSelectionModel passed in. + * + * @param itemModel + * The ItemSelectionModel to use + * @pre itemModel != null + * @return A component to display the state of the AtoZ integration + * properties of the release + */ + public static Component getSiteProxyAtoZPropertySheet( + ItemSelectionModel itemModel) { + DomainObjectPropertySheet sheet = new DomainObjectPropertySheet( + itemModel); + + sheet.add(SiteProxyGlobalizationUtil + .globalize(Constants.LABEL_TITLE_ATOZ), SiteProxy.TITLE_ATOZ); + + sheet.add(SiteProxyGlobalizationUtil + .globalize(Constants.LABEL_USED_IN_ATOZ), + SiteProxy.USED_IN_ATOZ, new BooleanAttributeFormater( + (String) SiteProxyGlobalizationUtil.globalize( + Constants.OPTION_USED_IN_ATOZ_YES).localize(), + (String) SiteProxyGlobalizationUtil.globalize( + Constants.OPTION_USED_IN_ATOZ_NO).localize())); + + return sheet; + } + + private static class BooleanAttributeFormater implements + DomainObjectPropertySheet.AttributeFormatter { + + private static final String DEFAULT = "-"; + + private String trueValue; + + private String falseValue; + + public BooleanAttributeFormater(String trueValue, String falseValue) { + this.trueValue = trueValue; + this.falseValue = falseValue; + } + + public String format(DomainObject obj, String attribute, PageState state) { + if (obj == null) + return BooleanAttributeFormater.DEFAULT; + + if ((obj instanceof ContentItem)) { + ContentItem contentItem = (ContentItem) obj; + Object field = contentItem.get(attribute); + if (field == null) + return BooleanAttributeFormater.DEFAULT; + + if (field instanceof Boolean) { + Boolean value = (Boolean) contentItem.get(attribute); + if (value.booleanValue()) + return trueValue; + else + return falseValue; + } + } + return BooleanAttributeFormater.DEFAULT; + } + + } + +} Added: trunk/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/ui/SiteProxyAtoZPropertyForm.java =================================================================== --- trunk/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/ui/SiteProxyAtoZPropertyForm.java 2005-12-13 21:24:06 UTC (rev 1048) +++ trunk/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/ui/SiteProxyAtoZPropertyForm.java 2005-12-13 22:39:04 UTC (rev 1049) @@ -0,0 +1,110 @@ +/* + * 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.cms.contenttypes.ui; + +import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.PageState; +import com.arsdigita.bebop.event.FormSectionEvent; +import com.arsdigita.bebop.form.Option; +import com.arsdigita.bebop.form.RadioGroup; +import com.arsdigita.bebop.form.TextField; +import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.contenttypes.SiteProxy; +import com.arsdigita.cms.contenttypes.util.SiteProxyGlobalizationUtil; +import com.arsdigita.cms.ui.authoring.BasicItemForm; + +/** + * Form to edit the basic properties of an SiteProxy. This form can be extended + * to create forms for SiteProxy subclasses. + */ +public class SiteProxyAtoZPropertyForm extends BasicItemForm { + + private TextField m_title_atoz; + + private RadioGroup m_radiogroupUsedInAtoZ; + + private ItemSelectionModel m_selectionModel; + + private SiteProxy siteProxy; + + /** + * Creates a new form to edit the SiteProxy object specified by the item + * selection model passed in. + * + * @param itemModel + * The ItemSelectionModel to use to obtain the SiteProxy to work + * on + */ + public SiteProxyAtoZPropertyForm(ItemSelectionModel itemModel) { + super("siteProxyAtoZEdit", itemModel); + m_selectionModel = itemModel; + } + + /** + * Adds widgets to the form. + */ + protected void addWidgets() { + add(new Label(SiteProxyGlobalizationUtil + .globalize(Constants.LABEL_TITLE_ATOZ))); + m_title_atoz = new TextField(SiteProxy.TITLE_ATOZ); + m_title_atoz.setSize(50); + add(m_title_atoz); + add(new Label(SiteProxyGlobalizationUtil + .globalize(Constants.LABEL_USED_IN_ATOZ))); + m_radiogroupUsedInAtoZ = new RadioGroup(SiteProxy.USED_IN_ATOZ); + m_radiogroupUsedInAtoZ.addOption(new Option(Boolean.TRUE.toString(), + SiteProxyGlobalizationUtil.globalize( + Constants.OPTION_USED_IN_ATOZ_YES).localize() + .toString())); + m_radiogroupUsedInAtoZ + .addOption(new Option(Boolean.FALSE.toString(), + SiteProxyGlobalizationUtil.globalize( + Constants.OPTION_USED_IN_ATOZ_NO).localize() + .toString())); + add(m_radiogroupUsedInAtoZ); + } + + /** Form initialisation hook. Fills widgets with data. */ + public void init(FormSectionEvent fse) { + PageState pageState = fse.getPageState(); + siteProxy = (SiteProxy) m_selectionModel.getSelectedObject(pageState); + if (siteProxy == null) + return; + + m_title_atoz.setValue(pageState, siteProxy.getAtoZTitle()); + m_radiogroupUsedInAtoZ.setValue(pageState, new Boolean(siteProxy + .isUsedInAtoZ()).toString()); + } + + /** Form processing hook. Saves SiteProxy object. */ + public void process(FormSectionEvent fse) { + PageState pageState = fse.getPageState(); + siteProxy = (SiteProxy) m_selectionModel.getSelectedObject(pageState); + /* proced only when siteProxy is present and save button was pressed */ + if ((siteProxy == null) + && !getSaveCancelSection().getSaveButton() + .isSelected(pageState)) + return; + + siteProxy.setAtoZTitle((String) m_title_atoz.getValue(pageState)); + siteProxy.setUsedInAtoZ(new Boolean((String) m_radiogroupUsedInAtoZ + .getValue(pageState)).booleanValue()); + siteProxy.save(); + } +} |
From: <ap...@vh...> - 2005-12-13 21:26:39
|
Author: apevec Date: 2005-12-13 22:24:06 +0100 (Tue, 13 Dec 2005) New Revision: 1048 Modified: contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationResources.properties Log: update consultation types as requested 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-12-13 20:44:36 UTC (rev 1047) +++ contrib/ccm-ldn-camden-consultation/trunk/src/com/arsdigita/camden/cms/contenttypes/ConsultationResources.properties 2005-12-13 21:24:06 UTC (rev 1048) @@ -65,10 +65,28 @@ topicOption24=Waste Management type=Type -typeOption0=Online Questionnaire -typeOption1=Postal Survey -typeOption2=Face to Face Interview -typeOption3=Meeting +#typeOption0=Online Questionnaire +typeOption0=Self-completion questionnaire (non-postal distribution) +#typeOption1=Postal Survey +typeOption1=Self-completion questionnaire (postal) +#typeOption2=Face to Face Interview +typeOption2=Structured interview face-to-face +#typeOption3=Meeting +typeOption3=Public meeting +# NEW from IT84714 +typeOption4=Camden website +typeOption5=Citizens jury +typeOption6=Community workshops +typeOption7=District management committees +typeOption8=Draft document distributed by post for comment +typeOption9=Exhibition +typeOption10=Focus groups +typeOption11=Inclusive forum +typeOption12=Letters +typeOption13=Presentations +typeOption14=Stakeholder meeting +typeOption15=Structured interview telephone +typeOption16=User or community involvement groups/panels target_audience=Target Audience #OLD targetOption0=Citizens Panel Members |
From: <ssk...@vh...> - 2005-12-13 20:47:18
|
Author: sskracic Date: 2005-12-13 21:44:36 +0100 (Tue, 13 Dec 2005) New Revision: 1047 Modified: contrib/ccm-ldn-camden-consultation/trunk/src/ccm-ldn-camden-consultation.load Log: Navigation initialised and loaded is prerequisit for Consultation. Modified: contrib/ccm-ldn-camden-consultation/trunk/src/ccm-ldn-camden-consultation.load =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/ccm-ldn-camden-consultation.load 2005-12-11 20:46:12 UTC (rev 1046) +++ contrib/ccm-ldn-camden-consultation/trunk/src/ccm-ldn-camden-consultation.load 2005-12-13 20:44:36 UTC (rev 1047) @@ -4,6 +4,7 @@ <table name="acs_objects"/> <table name="cms_items"/> <initializer class="com.arsdigita.cms.Initializer"/> + <initializer class="com.arsdigita.london.navigation.Initializer"/> </requires> <provides> <table name="cam_consultations"/> |
From: <ap...@vh...> - 2005-12-11 20:48:42
|
Author: apevec Date: 2005-12-11 21:46:12 +0100 (Sun, 11 Dec 2005) New Revision: 1046 Modified: trunk/ccm-cms-types-siteproxy/src/com/arsdigita/cms/dispatcher/SiteProxyPanel.java Log: expose SiteProxy remote XML document retrieval, used by AtoZSiteProxyProvider Modified: trunk/ccm-cms-types-siteproxy/src/com/arsdigita/cms/dispatcher/SiteProxyPanel.java =================================================================== --- trunk/ccm-cms-types-siteproxy/src/com/arsdigita/cms/dispatcher/SiteProxyPanel.java 2005-12-09 15:33:20 UTC (rev 1045) +++ trunk/ccm-cms-types-siteproxy/src/com/arsdigita/cms/dispatcher/SiteProxyPanel.java 2005-12-11 20:46:12 UTC (rev 1046) @@ -61,10 +61,9 @@ private static String s_cacheServiceKey = "SiteProxyPanel"; private static URLCache s_cache = new URLCache(1000000, 15*60*1000); private static URLPool s_pool = new URLPool(); - private static URLFetcher s_fetcher; static { - s_fetcher.registerService(s_cacheServiceKey, s_pool, s_cache); + URLFetcher.registerService(s_cacheServiceKey, s_pool, s_cache); }; public SiteProxyPanel() { @@ -84,6 +83,58 @@ } + /** + * Retrieve remote XML for SiteProxy item. + * + * @param child com.arsdigita.xml.Element where remote XML is placed + * @param url remote XML URL (text/xml) + */ + public static URLData internalGetRemoteXML(Element child, String url) { + URLData data = URLFetcher.fetchURLData(url, s_cacheServiceKey); + if (data == null || data.getException() != null || data.getContent().length == 0) { + return data; + } + + String contentType = data.getContentType(); + + boolean success = false; + if (contentType != null && + contentType.toLowerCase().indexOf("/xml") > -1) { + // we use the /xml intead of text/xml because + // things like application/xml are also valid + Document document = null; + try { + document = new Document(data.getContent()); + success = true; + } catch (Exception ex) { + s_log.info("The document is not proper XML, trying to " + + "add the property xml headers to the file " + + "retrieved from " + url, ex); + try { + String xmlString = data.getContentAsString(); + xmlString = "<?xml version=\"1.0\"?> \n" + xmlString; + document = new Document(xmlString); + success = true; + s_log.info("Adding the headers to " + url + + " allowed it to be properly parsed."); + } catch (Exception exception) { + s_log.info("The document found at " + url + + " is not correctly formed XML", exception); + } + } + if (success) { + child.addContent(document.getRootElement()); + child.addAttribute(DATA_TYPE, XML_DATA_TYPE); + } + } + if (!success) { + // just add the item as CDATA + child.setCDATASection(data.getContentAsString()); + child.addAttribute(DATA_TYPE, C_DATA_DATA_TYPE); + } + return data; + } + class SiteProxyXMLGenerator extends SimpleXMLGenerator { public void generateXML(PageState state, Element parent, String useContext) { @@ -92,13 +143,15 @@ SiteProxy item = (SiteProxy)getContentItem(state); String url = passParameters(state.getRequest(), item.getURL()); - URLData data = s_fetcher.fetchURLData(url, s_cacheServiceKey); + Element child = parent.newChildElement(SITE_PROXY_PANEL_NAME, + CMS.CMS_XML_NS); + URLData data = internalGetRemoteXML(child, url); + if (data == null) { String[] urlArray = {url}; (new Label(SiteProxyGlobalizationUtil.globalize ("cms.contenttypes.siteproxy.error_fetching_url", urlArray))).generateXML(state, parent); - return; } else if (data.getException() != null) { String[] urlArray = {url, data.getException().getClass().getName(), @@ -111,49 +164,7 @@ (new Label(SiteProxyGlobalizationUtil.globalize ("cms.contenttypes.siteproxy.empty_page_returned", urlArray))).generateXML(state, parent); - return; } - - String contentType = data.getContentType(); - - boolean success = false; - Element child = parent.newChildElement(SITE_PROXY_PANEL_NAME, - CMS.CMS_XML_NS); - if (contentType != null && - contentType.toLowerCase().indexOf("/xml") > -1) { - // we use the /xml intead of text/xml because - // things like application/xml are also valid - Document document = null; - try { - document = new Document(data.getContent()); - success = true; - } catch (Exception ex) { - s_log.info("The document is not proper XML, trying to " + - "add the property xml headers to the file " + - "retrieved from " + url, ex); - try { - String xmlString = data.getContentAsString(); - xmlString = "<?xml version=\"1.0\"?> \n" + xmlString; - document = new Document(xmlString); - success = true; - s_log.info("Adding the headers to " + url + - " allowed it to be properly parsed."); - } catch (Exception exception) { - s_log.info("The document found at " + url + - " is not correctly formed XML", exception); - } - } - if (success) { - child.addContent(document.getRootElement()); - child.addAttribute(DATA_TYPE, XML_DATA_TYPE); - } - } - - if (!success) { - // just add the item as CDATA - child.setCDATASection(data.getContentAsString()); - child.addAttribute(DATA_TYPE, C_DATA_DATA_TYPE); - } } } |
From: <ap...@vh...> - 2005-12-09 15:35:39
|
Author: apevec Date: 2005-12-09 16:33:20 +0100 (Fri, 09 Dec 2005) New Revision: 1045 Modified: contrib/ccm-ldn-camden-consultation/trunk/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Consultation.xml Log: experimental: use FullDateFormatter for Consultation dates Modified: contrib/ccm-ldn-camden-consultation/trunk/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Consultation.xml =================================================================== --- contrib/ccm-ldn-camden-consultation/trunk/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Consultation.xml 2005-12-09 13:50:14 UTC (rev 1044) +++ contrib/ccm-ldn-camden-consultation/trunk/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Consultation.xml 2005-12-09 15:33:20 UTC (rev 1045) @@ -26,11 +26,11 @@ <xrd:property name="/object/feedbackDocuments"/> </xrd:associations> <xrd:formatter property="/object/startDate" - class="com.arsdigita.xml.formatters.DateFormatter"/> + class="com.arsdigita.xml.formatters.FullDateFormatter"/> <xrd:formatter property="/object/completionDate" - class="com.arsdigita.xml.formatters.DateFormatter"/> + class="com.arsdigita.xml.formatters.FullDateFormatter"/> <xrd:formatter property="/object/resultsDate" - class="com.arsdigita.xml.formatters.DateFormatter"/> + class="com.arsdigita.xml.formatters.FullDateFormatter"/> <xrd:formatter property="/object/topic" class="com.arsdigita.camden.cms.contenttypes.TopicFormatter"/> <xrd:formatter property="/object/consultationType" |
From: <ssk...@vh...> - 2005-12-09 13:52:38
|
Author: sskracic Date: 2005-12-09 14:50:14 +0100 (Fri, 09 Dec 2005) New Revision: 1044 Modified: trunk/ccm-core/src/com/arsdigita/search/lucene/SqlFilter.java Log: Fetch the results as fast as possible. Modified: trunk/ccm-core/src/com/arsdigita/search/lucene/SqlFilter.java =================================================================== --- trunk/ccm-core/src/com/arsdigita/search/lucene/SqlFilter.java 2005-12-09 13:41:22 UTC (rev 1043) +++ trunk/ccm-core/src/com/arsdigita/search/lucene/SqlFilter.java 2005-12-09 13:50:14 UTC (rev 1044) @@ -112,6 +112,9 @@ s_log.debug("Created BitSet with " + bits.size() + " bits"); int i=0; + // Don't limit the size of the resultset window, so that we fetch + // rows as fast as possible. + m_query.setOption(RDBMSEngine.OPTION_WINDOW_SIZE, new Integer(0)); while (m_query.next()) { String ccmID = m_query.get("id").toString(); Integer luceneID = (Integer) luceneIds.get(ccmID); |
From: <ssk...@vh...> - 2005-12-09 13:43:55
|
Author: sskracic Date: 2005-12-09 14:41:22 +0100 (Fri, 09 Dec 2005) New Revision: 1043 Modified: trunk/ccm-core/src/com/arsdigita/domain/DomainQuery.java trunk/ccm-core/src/com/arsdigita/persistence/DataQuery.java trunk/ccm-core/src/com/arsdigita/persistence/DataQueryDecorator.java trunk/ccm-core/src/com/arsdigita/persistence/DataQueryImpl.java trunk/ccm-core/src/com/redhat/persistence/Cursor.java trunk/ccm-core/src/com/redhat/persistence/Engine.java trunk/ccm-core/src/com/redhat/persistence/engine/rdbms/RDBMSEngine.java Log: Somewhat hackish way to pass some additional parameters to persistence engine. This time, for performance reasons, I needed to override default result window size for a query. Added methods setOption() and getOption() to DataQeury interface, and changed few classes which are exposing this API to the com.redhat.persistence. Modified: trunk/ccm-core/src/com/arsdigita/domain/DomainQuery.java =================================================================== --- trunk/ccm-core/src/com/arsdigita/domain/DomainQuery.java 2005-12-09 13:21:16 UTC (rev 1042) +++ trunk/ccm-core/src/com/arsdigita/domain/DomainQuery.java 2005-12-09 13:41:22 UTC (rev 1043) @@ -700,4 +700,13 @@ public void alias(String fromPrefix, String toPrefix) { m_dataQuery.alias(fromPrefix, toPrefix); } + + + public void setOption(String name, Object value) { + m_dataQuery.setOption(name, value); + } + + public Object getOption(String name) { + return m_dataQuery.getOption(name); + } } Modified: trunk/ccm-core/src/com/arsdigita/persistence/DataQuery.java =================================================================== --- trunk/ccm-core/src/com/arsdigita/persistence/DataQuery.java 2005-12-09 13:21:16 UTC (rev 1042) +++ trunk/ccm-core/src/com/arsdigita/persistence/DataQuery.java 2005-12-09 13:41:22 UTC (rev 1043) @@ -499,6 +499,28 @@ /** + * Allows a user to pass arbitrary options to the underlying + * persistence engine. Currently, only one option is implemented + * "jdbc_resultset_windowsize" which, if set, overrides the + * default window size for the curreny query. This option must be + * set before a call to next() has been made. + * + * @param optionName The name of the option parameter + * @param value The value to assign to option parameter + */ + void setOption(String optionName, Object value); + + /** + * Examine the query configuration options. + * + * @param optionName The name of the query option parameter + * @return the object representing the value of the query + * option parameter or "null" if not set + */ + Object getOption(String optionName); + + + /** * Allows a caller to get a parameter value for a parameter that * has already been set * @@ -507,7 +529,7 @@ * parameter specified by the name or "null" if the parameter value * has not yet been set. */ - public Object getParameter(String parameterName); + Object getParameter(String parameterName); /** Modified: trunk/ccm-core/src/com/arsdigita/persistence/DataQueryDecorator.java =================================================================== --- trunk/ccm-core/src/com/arsdigita/persistence/DataQueryDecorator.java 2005-12-09 13:21:16 UTC (rev 1042) +++ trunk/ccm-core/src/com/arsdigita/persistence/DataQueryDecorator.java 2005-12-09 13:41:22 UTC (rev 1043) @@ -233,4 +233,12 @@ protected DataQuery getDataQuery() { return m_dq; } + + public void setOption(String name, Object value) { + m_dq.setOption(name, value); + } + + public Object getOption(String name) { + return m_dq.getOption(name); + } } Modified: trunk/ccm-core/src/com/arsdigita/persistence/DataQueryImpl.java =================================================================== --- trunk/ccm-core/src/com/arsdigita/persistence/DataQueryImpl.java 2005-12-09 13:21:16 UTC (rev 1042) +++ trunk/ccm-core/src/com/arsdigita/persistence/DataQueryImpl.java 2005-12-09 13:41:22 UTC (rev 1043) @@ -73,6 +73,8 @@ private static final String s_mapAndAddPath = "com.arsdigita.persistence.DataQueryImpl.mapAndAddPath"; + private Map m_options = new HashMap(); + private SQLParser getParser(String key, Reader reader, SQLParser.Mapper mapper) { TransactionContext ctx = m_ssn.getTransactionContext(); @@ -485,7 +487,15 @@ return m_bindings.get(parameterName); } + public void setOption(String optionName, Object value) { + m_options.put(optionName, value); + } + public Object getOption(String optionName) { + return m_options.get(optionName); + } + + public void setRange(Integer beginIndex) { setRange(beginIndex, null); } @@ -634,7 +644,9 @@ } protected Cursor execute(Signature sig, Expression expr) { - return new DataSet(m_pssn, sig, expr).getCursor(); + Cursor cursor = new DataSet(m_pssn, sig, expr).getCursor(); + cursor.setOptions(m_options); + return cursor; } public boolean next() { Modified: trunk/ccm-core/src/com/redhat/persistence/Cursor.java =================================================================== --- trunk/ccm-core/src/com/redhat/persistence/Cursor.java 2005-12-09 13:21:16 UTC (rev 1042) +++ trunk/ccm-core/src/com/redhat/persistence/Cursor.java 2005-12-09 13:41:22 UTC (rev 1043) @@ -20,6 +20,7 @@ import com.redhat.persistence.common.Path; import java.util.Map; +import java.util.HashMap; import org.apache.log4j.Logger; /** @@ -41,11 +42,17 @@ private Map m_values = null; private long m_position = 0; private boolean m_closed = false; + private Map m_options = new HashMap(); protected Cursor(DataSet ds) { m_ds = ds; } + public void setOptions(Map options) { + m_options.clear(); + m_options.putAll(options); + } + public DataSet getDataSet() { return m_ds; } @@ -55,26 +62,26 @@ } public boolean isClosed() { - return m_closed; + return m_closed; } private Object getInternal(Path path) { - if (m_values.containsKey(path)) { - return m_values.get(path); - } else { - Object o = getInternal(path.getParent()); + if (m_values.containsKey(path)) { + return m_values.get(path); + } else { + Object o = getInternal(path.getParent()); if (o == null) { return null; } - return getSession().get(o, Path.get(path.getName())); - } + return getSession().get(o, Path.get(path.getName())); + } } public Object get(Path path) { - if (m_closed) { - throw new ClosedException(this); - } + if (m_closed) { + throw new ClosedException(this); + } if (m_position <= 0) { - throw new NoRowException(this); + throw new NoRowException(this); } if (!m_rs.isFetched(path)) { @@ -89,29 +96,29 @@ } public Object get(String path) { - if (m_closed) { - throw new ClosedException(this); - } + if (m_closed) { + throw new ClosedException(this); + } return get(Path.get(path)); } public Object get() { - if (m_closed) { - throw new ClosedException(this); - } + if (m_closed) { + throw new ClosedException(this); + } return m_values.get(null); } public boolean next() { - if (m_closed) { - throw new ClosedException(this); - } + if (m_closed) { + throw new ClosedException(this); + } - if (m_position == -1) { - return false; - } + if (m_position == -1) { + return false; + } if (m_rs == null) { getSession().flush(); @@ -131,38 +138,39 @@ } protected RecordSet execute() { - return getSession().getEngine().execute(m_ds.getSignature(), - m_ds.getExpression()); + return getSession().getEngine().execute(m_ds.getSignature(), + m_ds.getExpression(), + m_options); } public boolean isBeforeFirst() { - if (m_closed) { - throw new ClosedException(this); - } + if (m_closed) { + throw new ClosedException(this); + } return m_position == 0; } public boolean isFirst() { - if (m_closed) { - throw new ClosedException(this); - } + if (m_closed) { + throw new ClosedException(this); + } return m_position == 1; } public boolean isAfterLast() { - if (m_closed) { - throw new ClosedException(this); - } + if (m_closed) { + throw new ClosedException(this); + } return m_position == -1; } public long getPosition() { - if (m_closed) { - throw new ClosedException(this); - } + if (m_closed) { + throw new ClosedException(this); + } if (m_position > 0) { return m_position; @@ -174,19 +182,19 @@ public void rewind() { close(); m_position = 0; - m_closed = false; + m_closed = false; } private void free() { if (m_rs != null) { m_rs.close(); - m_rs = null; + m_rs = null; } } public void close() { - free(); - m_closed = true; + free(); + m_closed = true; } } Modified: trunk/ccm-core/src/com/redhat/persistence/Engine.java =================================================================== --- trunk/ccm-core/src/com/redhat/persistence/Engine.java 2005-12-09 13:21:16 UTC (rev 1042) +++ trunk/ccm-core/src/com/redhat/persistence/Engine.java 2005-12-09 13:41:22 UTC (rev 1043) @@ -19,6 +19,7 @@ package com.redhat.persistence; import com.redhat.persistence.oql.Expression; +import java.util.Map; /** @@ -47,6 +48,7 @@ protected abstract void rollback(); protected abstract void commit(); protected abstract RecordSet execute(Signature sig, Expression expr); + protected abstract RecordSet execute(Signature sig, Expression expr, Map options); protected abstract long size(Expression expr); } Modified: trunk/ccm-core/src/com/redhat/persistence/engine/rdbms/RDBMSEngine.java =================================================================== --- trunk/ccm-core/src/com/redhat/persistence/engine/rdbms/RDBMSEngine.java 2005-12-09 13:21:16 UTC (rev 1042) +++ trunk/ccm-core/src/com/redhat/persistence/engine/rdbms/RDBMSEngine.java 2005-12-09 13:41:22 UTC (rev 1043) @@ -72,6 +72,7 @@ private static final Logger LOG = Logger.getLogger(RDBMSEngine.class); + public static final String OPTION_WINDOW_SIZE = "option:window_size"; private ArrayList m_operations = new ArrayList(); private HashMap m_operationMap = new HashMap(); @@ -91,6 +92,8 @@ private SQLWriter m_writer; private RDBMSProfiler m_profiler; + private Map m_options; + public RDBMSEngine(ConnectionSource source, SQLWriter writer) { this(source, writer, null); } @@ -260,6 +263,11 @@ } public RecordSet execute(Signature sig, Expression expr) { + return execute(sig, expr, Collections.EMPTY_MAP); + } + + public RecordSet execute(Signature sig, Expression expr, Map options) { + m_options = options; Select sel = new Select(this, sig, expr); if (LOG.isInfoEnabled()) { @@ -489,9 +497,17 @@ try { if (cycle != null) { cycle.beginExecute(); } - if (s_windowSize > 0) { + int windowSize = 0; + if (m_options != null + && m_options.containsKey(OPTION_WINDOW_SIZE)) { + windowSize = ( (Integer) m_options.get(OPTION_WINDOW_SIZE)).intValue(); + LOG.info("Overridden WINDOW_SIZE for query to: " + windowSize); + } else { + windowSize = s_windowSize; + } + if (windowSize > 0) { ps.setFetchDirection(ResultSet.FETCH_FORWARD); - ps.setFetchSize(s_windowSize); + ps.setFetchSize(windowSize); } if (ps.execute()) { if (cycle != null) { cycle.endExecute(0); } |
From: <ssk...@vh...> - 2005-12-09 13:23:58
|
Author: sskracic Date: 2005-12-09 14:21:16 +0100 (Fri, 09 Dec 2005) New Revision: 1042 Added: trunk/ccm-core/src/com/arsdigita/search/lucene/SqlFilter.java Removed: trunk/ccm-core/src/com/arsdigita/search/lucene/CategoryFilter.java Modified: trunk/ccm-cms/src/com/arsdigita/cms/Initializer.java trunk/ccm-cms/src/com/arsdigita/cms/search/LuceneQueryEngine.java trunk/ccm-cms/src/com/arsdigita/cms/ui/search/ItemQueryComponent.java trunk/ccm-core/pdl/com/arsdigita/search/Search.pdl trunk/ccm-core/src/com/arsdigita/search/lucene/BaseQueryEngine.java trunk/ccm-core/src/com/arsdigita/search/lucene/Initializer.java trunk/ccm-ldn-search/src/com/arsdigita/london/search/ui/AdvancedQueryComponent.java trunk/ccm-ldn-search/src/com/arsdigita/london/search/ui/SimpleQueryComponent.java Log: Implemented SqlFilter for Lucene search, which filters the search result against the arbitrary DataQuery. CategoryFilter has been obsoleted by this, so it's removed completely. Implemented PermissionFilter for Lucene using the SqlFilter and registered newly supported filter type in query engine registries. Finally, enabled new components in UI. Modified: trunk/ccm-cms/src/com/arsdigita/cms/Initializer.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/Initializer.java 2005-12-09 13:10:03 UTC (rev 1041) +++ trunk/ccm-cms/src/com/arsdigita/cms/Initializer.java 2005-12-09 13:21:16 UTC (rev 1042) @@ -251,6 +251,7 @@ new LastModifiedDateFilterType(), new LastModifiedUserFilterType(), new ObjectTypeFilterType(), + new PermissionFilterType(), new VersionFilterType() }, new LuceneQueryEngine()); Modified: trunk/ccm-cms/src/com/arsdigita/cms/search/LuceneQueryEngine.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/search/LuceneQueryEngine.java 2005-12-09 13:10:03 UTC (rev 1041) +++ trunk/ccm-cms/src/com/arsdigita/cms/search/LuceneQueryEngine.java 2005-12-09 13:21:16 UTC (rev 1042) @@ -18,23 +18,19 @@ */ package com.arsdigita.cms.search; -import com.arsdigita.categorization.Category; import com.arsdigita.cms.ContentType; import com.arsdigita.cms.search.ContentTypeFilterSpecification; import com.arsdigita.cms.search.ContentTypeFilterType; import com.arsdigita.kernel.PartyCollection; -import com.arsdigita.persistence.DataQuery; -import com.arsdigita.persistence.SessionManager; import com.arsdigita.search.FilterSpecification; import com.arsdigita.search.FilterType; -import com.arsdigita.search.filters.CategoryFilterSpecification; import com.arsdigita.search.filters.DateRangeFilterSpecification; import com.arsdigita.search.filters.PartyFilterSpecification; import com.arsdigita.search.lucene.BaseQueryEngine; -import com.arsdigita.search.lucene.CategoryFilter; import com.arsdigita.search.lucene.Document; import com.arsdigita.search.lucene.ObjectTypeFilter; import com.arsdigita.search.lucene.PartyFilter; +import com.arsdigita.search.lucene.SqlFilter; import com.arsdigita.search.lucene.TypeSpecificFilter; import com.arsdigita.search.lucene.UnionFilter; import java.util.ArrayList; @@ -46,9 +42,9 @@ public class LuceneQueryEngine extends BaseQueryEngine { - protected void addFilter(List list, + protected void addFilter(List list, SqlFilter sql, FilterSpecification filter) { - super.addFilter(list, filter); + super.addFilter(list, sql, filter); FilterType type = filter.getType(); @@ -124,23 +120,8 @@ list.add(new UnionFilter(filters)); } - protected void addCategoryFilter(List list, - CategoryFilterSpecification filterSpec) { - Category[] cats = filterSpec.getCategories(); - if (cats == null || cats.length == 0) { - return; - } - list.add(new CategoryFilter(cats, filterSpec.isDescending()) { - protected DataQuery getQuery(List catList, boolean descending) { - DataQuery dq = SessionManager.getSession() - .retrieveQuery("com.arsdigita.cms.searchCategoryObjects"); - dq.setParameter("ids", catList); - // 999999 - just need a number that is grater than max. category - // tree depth - dq.setParameter("pathLimit", new Integer(descending ? 999999 : 0)); - return dq; - } - }); - + protected String getCategorisationQuery() { + return "com.arsdigita.cms.searchCategoryObjects"; } + } Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/search/ItemQueryComponent.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ui/search/ItemQueryComponent.java 2005-12-09 13:10:03 UTC (rev 1041) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/search/ItemQueryComponent.java 2005-12-09 13:21:16 UTC (rev 1042) @@ -56,8 +56,6 @@ m_context = context; if (Search.getConfig().isIntermediaEnabled()) { - add(new PermissionFilterComponent( - SecurityManager.CMS_READ_ITEM)); add(new LaunchDateFilterWidget(new LaunchDateFilterType(), LaunchDateFilterType.KEY)); } @@ -65,6 +63,9 @@ if (Search.getConfig().isIntermediaEnabled() || Search.getConfig().isLuceneEnabled()) { + add(new PermissionFilterComponent( + SecurityManager.CMS_READ_ITEM)); + add(new SimpleCategoryFilterWidget() { protected Category[] getRoots(PageState state) { Category[] roots; Modified: trunk/ccm-core/pdl/com/arsdigita/search/Search.pdl =================================================================== --- trunk/ccm-core/pdl/com/arsdigita/search/Search.pdl 2005-12-09 13:10:03 UTC (rev 1041) +++ trunk/ccm-core/pdl/com/arsdigita/search/Search.pdl 2005-12-09 13:21:16 UTC (rev 1042) @@ -35,3 +35,32 @@ id = m.object_id; } } + +query getLuceneDocIDs { + BigDecimal id; + + do { + select ld.document_id + from lucene_docs ld + where ld.is_deleted = '0' + } map { + id = ld.document_id; + } +} + +query partyPermissionFilterStub { + BigDecimal id; + do { + select dogc.pd_object_id + from dnm_object_1_granted_context dogc, + dnm_granted_context dgc, + dnm_permissions dp, + dnm_group_membership dgm + where dogc.pd_context_id = dgc.pd_object_id + and dgc.pd_context_id = dp.pd_object_id + and dgm.pd_member_id in :partyID + and dp.pd_grantee_id = dgm.pd_group_id + } map { + id = dogc.pd_object_id; + } +} Modified: trunk/ccm-core/src/com/arsdigita/search/lucene/BaseQueryEngine.java =================================================================== --- trunk/ccm-core/src/com/arsdigita/search/lucene/BaseQueryEngine.java 2005-12-09 13:10:03 UTC (rev 1041) +++ trunk/ccm-core/src/com/arsdigita/search/lucene/BaseQueryEngine.java 2005-12-09 13:21:16 UTC (rev 1042) @@ -19,6 +19,11 @@ package com.arsdigita.search.lucene; import com.arsdigita.categorization.Category; +import com.arsdigita.kernel.permissions.PermissionManager; +import com.arsdigita.kernel.permissions.PermissionService; +import com.arsdigita.kernel.permissions.PrivilegeDescriptor; +import com.arsdigita.kernel.permissions.UniversalPermissionDescriptor; +import com.arsdigita.persistence.OID; import com.arsdigita.persistence.metadata.ObjectType; import com.arsdigita.search.FilterSpecification; import com.arsdigita.search.FilterType; @@ -32,6 +37,8 @@ import com.arsdigita.search.filters.ContentSectionFilterType; import com.arsdigita.search.filters.ObjectTypeFilterSpecification; import com.arsdigita.search.filters.ObjectTypeFilterType; +import com.arsdigita.search.filters.PermissionFilterSpecification; +import com.arsdigita.search.filters.PermissionFilterType; import java.util.ArrayList; import java.util.List; import org.apache.log4j.Logger; @@ -79,12 +86,16 @@ protected void addFilters(List list, FilterSpecification[] filters) { + SqlFilter sql = new SqlFilter(); for (int i = 0 ; i < filters.length ; i++) { - addFilter(list, filters[i]); + addFilter(list, sql, filters[i]); } + if (sql.getNumClauses() > 0) { + list.add(sql); + } } - protected void addFilter(List list, + protected void addFilter(List list, SqlFilter sql, FilterSpecification filter) { FilterType type = filter.getType(); @@ -93,19 +104,48 @@ } else if (ContentSectionFilterType.KEY.equals(type.getKey())) { addContentSectionFilter(list, (ContentSectionFilterSpecification)filter); } else if (CategoryFilterType.KEY.equals(type.getKey())) { - addCategoryFilter(list, (CategoryFilterSpecification)filter); + addCategoryFilter(sql, (CategoryFilterSpecification) filter); + } else if (PermissionFilterType.KEY.equals(type.getKey())) { + addPermissionFilter(sql, (PermissionFilterSpecification) filter); } } - protected void addCategoryFilter(List list, + protected String getCategorisationQuery() { + return "com.arsdigita.search.categoryObjects"; + } + + protected void addCategoryFilter(SqlFilter sql, CategoryFilterSpecification filterSpec) { Category[] cats = filterSpec.getCategories(); if (cats == null || cats.length == 0) { return; } - list.add(new CategoryFilter(cats)); + com.arsdigita.persistence.Filter f = sql.appendClause(getCategorisationQuery(), "id"); + List catList = new ArrayList(); + for (int i=0; i<cats.length; i++) { + catList.add(cats[i].getID()); + } + f.set("ids", catList); + // 999999 - just need a number that is grater than max. category + // tree depth + f.set("pathLimit", new Integer(filterSpec.isDescending() ? 999999 : 0)); } + protected void addPermissionFilter(SqlFilter sql, + PermissionFilterSpecification filterSpec) { + PrivilegeDescriptor privilege = filterSpec.getPrivilege(); + OID partyOID = filterSpec.getParty().getOID(); + UniversalPermissionDescriptor universalPermission = + new UniversalPermissionDescriptor(privilege, partyOID); + if (PermissionService.checkPermission(universalPermission)) { + return; + } + com.arsdigita.persistence.Filter f = sql.getFilterFactory().simple( + Document.ID + " in ( com.arsdigita.search.partyPermissionFilterStub " + + " and RAW[" + privilege.getColumnName() + " = 1 ])"); + f.set("partyID", PermissionManager.constructAccessList(partyOID)); + sql.appendClause(f); + } protected void addObjectTypeFilter(List list, ObjectTypeFilterSpecification filter) { @@ -147,7 +187,6 @@ // list.add(new UnionFilter(filters)); // } - - } } + Deleted: trunk/ccm-core/src/com/arsdigita/search/lucene/CategoryFilter.java Modified: trunk/ccm-core/src/com/arsdigita/search/lucene/Initializer.java =================================================================== --- trunk/ccm-core/src/com/arsdigita/search/lucene/Initializer.java 2005-12-09 13:10:03 UTC (rev 1041) +++ trunk/ccm-core/src/com/arsdigita/search/lucene/Initializer.java 2005-12-09 13:21:16 UTC (rev 1042) @@ -26,6 +26,7 @@ import com.arsdigita.search.Search; import com.arsdigita.search.filters.CategoryFilterType; import com.arsdigita.search.filters.ObjectTypeFilterType; +import com.arsdigita.search.filters.PermissionFilterType; import java.io.File; import java.io.IOException; import java.util.Date; @@ -100,7 +101,8 @@ QueryEngineRegistry.registerEngine (IndexerType.LUCENE, new FilterType[] { new CategoryFilterType(), - new ObjectTypeFilterType() + new ObjectTypeFilterType(), + new PermissionFilterType() }, new BaseQueryEngine()); } Added: trunk/ccm-core/src/com/arsdigita/search/lucene/SqlFilter.java =================================================================== --- trunk/ccm-core/src/com/arsdigita/search/lucene/SqlFilter.java 2005-12-09 13:10:03 UTC (rev 1041) +++ trunk/ccm-core/src/com/arsdigita/search/lucene/SqlFilter.java 2005-12-09 13:21:16 UTC (rev 1042) @@ -0,0 +1,137 @@ +/* + * 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.search.lucene; + +import com.arsdigita.persistence.DataQuery; +import com.arsdigita.persistence.FilterFactory; +import com.arsdigita.persistence.SessionManager; +import com.arsdigita.search.lucene.Document; +import com.redhat.persistence.engine.rdbms.RDBMSEngine; +import java.io.IOException; +import java.util.BitSet; +import java.util.HashMap; +import java.util.Map; +import org.apache.log4j.Logger; +import org.apache.lucene.index.IndexReader; +import org.apache.lucene.index.Term; +import org.apache.lucene.index.TermDocs; +import org.apache.lucene.index.TermEnum; +import org.apache.lucene.search.Filter; + +/** + * + * A filter based on the arbitrary SQL query that returns + * document IDs that are allowed in search results. + * + * @author Sebastian Skracic (ssk...@re...) + * @version $Id$ + * + **/ + +public class SqlFilter extends Filter { + + private static final Logger s_log = Logger.getLogger(SqlFilter.class); + + private DataQuery m_query; + + private int m_clauses; + + public SqlFilter() { + m_query = SessionManager.getSession().retrieveQuery("com.arsdigita.search.getLuceneDocIDs"); + m_clauses = 0; + } + + /** + * Appends a clause to the SqlFilter + * + * @param query PDL query that will be used to constraint the result set + * @param propertyName name of the query property that holds the document ID column + * + **/ + public com.arsdigita.persistence.Filter appendClause(String query, String propertyName) { + m_clauses++; + return m_query.addInSubqueryFilter("id", propertyName, query); + } + + /** + * Appends a (persistence) filter to the SqlFilter + * + * @param f PDL filter to be ANDed with all other clauses + * + **/ + public void appendClause(com.arsdigita.persistence.Filter f) { + m_clauses++; + m_query.addFilter(f); + } + + /** + * Returns a BitSet with true for documents which + * should be permitted in search results, and false + * for those that should not. + **/ + final public BitSet bits(IndexReader reader) throws IOException { + + // First build CCM ID <-> lucene ID mappings + long st = System.currentTimeMillis(); + Map luceneIds = new HashMap(); + TermDocs docs = reader.termDocs(); + TermEnum terms = reader.terms(new Term(Document.ID, "")); + while (terms.next()) { + Term t = terms.term(); + String field = t.field(); + String text = t.text(); + if (!Document.ID.equals(field)) { + break; + } + docs.seek(t); + if (docs.next()) { + luceneIds.put(text, new Integer(docs.doc())); + } + } + terms.close(); + docs.close(); + s_log.debug("Mapped " + luceneIds.size() + " IDs in " + (System.currentTimeMillis() - st) + "ms"); + st = System.currentTimeMillis(); + BitSet bits = new BitSet(reader.maxDoc()); + s_log.debug("Created BitSet with " + bits.size() + " bits"); + int i=0; + + while (m_query.next()) { + String ccmID = m_query.get("id").toString(); + Integer luceneID = (Integer) luceneIds.get(ccmID); + if (luceneID == null) { + s_log.info("Could not find document ID " + ccmID + " in Lucene index"); + } else { + i++; + bits.set(luceneID.intValue()); + } + } + s_log.debug("Created SQLFilter with " + m_clauses + " clause(s) matching " + i + " object(s)"); + s_log.debug("Time taken: " + (System.currentTimeMillis() - st) + "ms"); + return bits; + } + + public int getNumClauses() { + return m_clauses; + } + + public FilterFactory getFilterFactory() { + return m_query.getFilterFactory(); + } +} Property changes on: trunk/ccm-core/src/com/arsdigita/search/lucene/SqlFilter.java ___________________________________________________________________ Name: svn:keywords + Id Author URL Modified: trunk/ccm-ldn-search/src/com/arsdigita/london/search/ui/AdvancedQueryComponent.java =================================================================== --- trunk/ccm-ldn-search/src/com/arsdigita/london/search/ui/AdvancedQueryComponent.java 2005-12-09 13:10:03 UTC (rev 1041) +++ trunk/ccm-ldn-search/src/com/arsdigita/london/search/ui/AdvancedQueryComponent.java 2005-12-09 13:21:16 UTC (rev 1042) @@ -54,15 +54,12 @@ public AdvancedQueryComponent(String context) { - if (Search.getConfig().isIntermediaEnabled()) { - add(new PermissionFilterComponent( - PrivilegeDescriptor.READ)); - - } - if (Search.getConfig().isIntermediaEnabled() || Search.getConfig().isLuceneEnabled()) { + add(new PermissionFilterComponent( + PrivilegeDescriptor.READ)); + Application app = Web.getContext().getApplication(); Category root = Category.getRootForObject(app); add(new SimpleCategoryFilterWidget(root)); Modified: trunk/ccm-ldn-search/src/com/arsdigita/london/search/ui/SimpleQueryComponent.java =================================================================== --- trunk/ccm-ldn-search/src/com/arsdigita/london/search/ui/SimpleQueryComponent.java 2005-12-09 13:10:03 UTC (rev 1041) +++ trunk/ccm-ldn-search/src/com/arsdigita/london/search/ui/SimpleQueryComponent.java 2005-12-09 13:21:16 UTC (rev 1042) @@ -5,12 +5,12 @@ * 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 @@ -52,17 +52,13 @@ private Form m_form; public SimpleQueryComponent(String context) { - - // XXX READ instead of CMS_READ_ITEM - if (Search.getConfig().isIntermediaEnabled()) { - add(new PermissionFilterComponent(PrivilegeDescriptor.READ)); - } - + if (Search.getConfig().isIntermediaEnabled() || Search.getConfig().isLuceneEnabled()) { + add(new PermissionFilterComponent(PrivilegeDescriptor.READ)); add(new VersionFilterComponent(context)); } - + SearchConfig config = com.arsdigita.london.search.Search.getConfig(); s_log.debug("Array length : "+config.getSimpleRestrictToArray().length); if (config.getSimpleRestrictToArray().length > 0) { @@ -74,73 +70,73 @@ public void register(Form form, FormModel model) { - s_log.debug("Adding " + m_hiddenAllowedContentSectionsList.getName() + " to form model"); - m_hiddenAllowedContentSectionsList.setPassIn(true); - model.addFormParam(m_hiddenAllowedContentSectionsList); - super.register(form, model); - m_form = form; + s_log.debug("Adding " + m_hiddenAllowedContentSectionsList.getName() + " to form model"); + m_hiddenAllowedContentSectionsList.setPassIn(true); + model.addFormParam(m_hiddenAllowedContentSectionsList); + super.register(form, model); + m_form = form; } - + /** * Gets the hidden restrictToContentSections param. * The param is in the form of a comma seperated list of content section names. * If present the search will only return content items from these content sections. **/ protected String getContentSections(PageState state) { - FormData formData = m_form.getFormData(state); - if (formData != null) { - ParameterData contentSectionListParam = formData.getParameter(m_hiddenAllowedContentSectionsList.getName()); - String paramValue = (String)contentSectionListParam.getValue(); - m_paramValue = paramValue; - s_log.debug("content sections list is " + paramValue); - is_restricted = (m_paramValue != null && !"".equals(m_paramValue)); - return (String)contentSectionListParam.getValue(); - } - return null; + FormData formData = m_form.getFormData(state); + if (formData != null) { + ParameterData contentSectionListParam = formData.getParameter(m_hiddenAllowedContentSectionsList.getName()); + String paramValue = (String)contentSectionListParam.getValue(); + m_paramValue = paramValue; + s_log.debug("content sections list is " + paramValue); + is_restricted = (m_paramValue != null && !"".equals(m_paramValue)); + return (String)contentSectionListParam.getValue(); + } + return null; } /** * Gets an array of content section titles for creation of an inclusion filter. **/ public String[] getContentSectionsArray(PageState state) { - String contentSections = getContentSections(state); - if (contentSections == null) { return null; } - StringTokenizer st = new StringTokenizer(getContentSections(state), ","); - contentSectionTitles = new String[st.countTokens()]; - int index = 0; + String contentSections = getContentSections(state); + if (contentSections == null) { return null; } + StringTokenizer st = new StringTokenizer(getContentSections(state), ","); + contentSectionTitles = new String[st.countTokens()]; + int index = 0; while (st.hasMoreTokens()) { contentSectionTitles[index] = st.nextToken().trim(); s_log.info("Restricting to content section : "+contentSectionTitles[index]); index++; } - return contentSectionTitles; + return contentSectionTitles; } /** * Adds the content section filter to any existing filters. **/ protected FilterSpecification[] getFilters(PageState state) { - FilterSpecification[] existingfilters = super.getFilters(state); - List n = new ArrayList(); - try { - List filters = Arrays.asList(existingfilters); // this will throw a NullPointerException if there are no existing filters - n.addAll(filters); - } catch (NullPointerException e) { - // do we need to catch it if we're doing nothing with it? - } - String[] contentSections = getContentSectionsArray(state); - if (contentSections == null) { return existingfilters; } - ContentSectionFilterSpecification csfs = new ContentSectionFilterSpecification(contentSections); - n.add(csfs); - FilterSpecification[] newFilters = new FilterSpecification[n.size()]; - Iterator i = n.iterator(); - int c = 0; - while (i.hasNext()) { - newFilters[c] = (FilterSpecification)i.next(); - c++; - } + FilterSpecification[] existingfilters = super.getFilters(state); + List n = new ArrayList(); + try { + List filters = Arrays.asList(existingfilters); // this will throw a NullPointerException if there are no existing filters + n.addAll(filters); + } catch (NullPointerException e) { + // do we need to catch it if we're doing nothing with it? + } + String[] contentSections = getContentSectionsArray(state); + if (contentSections == null) { return existingfilters; } + ContentSectionFilterSpecification csfs = new ContentSectionFilterSpecification(contentSections); + n.add(csfs); + FilterSpecification[] newFilters = new FilterSpecification[n.size()]; + Iterator i = n.iterator(); + int c = 0; + while (i.hasNext()) { + newFilters[c] = (FilterSpecification)i.next(); + c++; + } - return newFilters; + return newFilters; } } |