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: <ssk...@vh...> - 2006-07-18 13:20:33
|
Author: sskracic Date: 2006-07-18 15:14:45 +0200 (Tue, 18 Jul 2006) New Revision: 1267 Modified: releases/1.0.3/ccm-ldn-theme/application.xml releases/1.0.3/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemePublishedFileManager.java Log: Integrated r1266 from trunk (excessive theme caching fix). Modified: releases/1.0.3/ccm-ldn-theme/application.xml =================================================================== --- releases/1.0.3/ccm-ldn-theme/application.xml 2006-07-18 12:18:48 UTC (rev 1266) +++ releases/1.0.3/ccm-ldn-theme/application.xml 2006-07-18 13:14:45 UTC (rev 1267) @@ -3,11 +3,10 @@ name="ccm-ldn-theme" prettyName="Theme" version="6.2.0" - release="4"> + release="5"> <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"/> - </ccm:dependencies> <ccm:contacts> <ccm:contact uri="http://www.redhat.com/software/rhea" type="website"/> Modified: releases/1.0.3/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemePublishedFileManager.java =================================================================== --- releases/1.0.3/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemePublishedFileManager.java 2006-07-18 12:18:48 UTC (rev 1266) +++ releases/1.0.3/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemePublishedFileManager.java 2006-07-18 13:14:45 UTC (rev 1267) @@ -17,17 +17,17 @@ import com.arsdigita.london.theme.Theme; import com.arsdigita.london.theme.ThemeFileCollection; +import com.arsdigita.templating.Templating; import java.io.File; import org.apache.log4j.Logger; -import java.io.File; /** - * Class for polling the database to look for new/updated published files in - * the ThemeFile table. - * + * Class for polling the database to look for new/updated published files in + * the ThemeFile table. + * * For "published" files, It goes through each Theme and looks at the - * last time it was published. If the last time published > last + * last time it was published. If the last time published > last * time thread was run then it examines those files. When the thread * runs for the first time, it examines all themes. * @@ -40,13 +40,13 @@ private static Logger s_log = Logger.getLogger(ThemePublishedFileManager.class); - // The code in this class borrows heavily from + // The code in this class borrows heavily from // com.arsdigita.cms.publishToFile.FileManager static private ThemeFileManager s_manager = null; - protected ThemePublishedFileManager(int startupDelay, int pollDelay, + protected ThemePublishedFileManager(int startupDelay, int pollDelay, String baseDirectory) { super(startupDelay, pollDelay, baseDirectory); } @@ -54,12 +54,12 @@ // is there a way to move this code up in to the parent class? /** * Start watching the files. This method spawns a - * background thread that looks for changes in files in the database + * background thread that looks for changes in files in the database * if there is not already a thread that has been spawned. If there * is already a running thread then this is a no-op that returns a * reference to the running thread. * - * The thread starts processing after <code>startupDelay</code> seconds. + * The thread starts processing after <code>startupDelay</code> seconds. * The db is checked for new/updated * files every <code>pollDelay</code> seconds. * @@ -77,8 +77,8 @@ s_log.info("Starting Theme File Manager Thread with the base " + "directory of " + baseDirectory); if ( startupDelay > 0 ) { - s_manager = new ThemePublishedFileManager(startupDelay, - pollDelay, + s_manager = new ThemePublishedFileManager(startupDelay, + pollDelay, baseDirectory); s_manager.setDaemon(true); s_manager.setName("theme-pub-files"); @@ -88,7 +88,7 @@ "because the startup delay is <= 0"); } } - return s_manager; + return s_manager; } /** @@ -115,11 +115,14 @@ * last published then this is a no-op */ protected void updateTheme(Theme theme) { - if (getLastRunDate() == null || + if (getLastRunDate() == null || !(new File(getManagerSpecificDirectory() + theme.getURL())).exists() || (theme.getLastPublishedDate() != null && getLastRunDate().before(theme.getLastPublishedDate()))) { super.updateTheme(theme); + // purge the templating cache -- we want newly published themes + // to be visible immediately, and not after a server restart. + Templating.purgeTemplates(); } } |
From: <ssk...@vh...> - 2006-07-18 12:25:06
|
Author: sskracic Date: 2006-07-18 14:18:48 +0200 (Tue, 18 Jul 2006) New Revision: 1266 Modified: trunk/ccm-ldn-theme/application.xml trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemePublishedFileManager.java Log: A fix for the longstanding bug: a newly republished theme is not visible until the server is restarted. The template cache needs to be purged once the republish takes place. The reason why this bug was hard to reproduce consistently in development environment is the code in Templating.java which is run if waf.debug is set to true (very likely in development env). The said code checks every file the XSL templated is consisted of (through xsl:import), and invalidates the cached template if any is modified. This potentially expensive operation is skipped if waf.debug==false. Modified: trunk/ccm-ldn-theme/application.xml =================================================================== --- trunk/ccm-ldn-theme/application.xml 2006-07-18 08:30:06 UTC (rev 1265) +++ trunk/ccm-ldn-theme/application.xml 2006-07-18 12:18:48 UTC (rev 1266) @@ -3,7 +3,7 @@ name="ccm-ldn-theme" prettyName="Theme" version="6.3.1" - release="3"> + release="4"> <ccm:dependencies> <ccm:requires name="ccm-core" version="6.2.0" relation="ge"/> <ccm:requires name="ccm-cms" version="6.2.0" relation="ge"/> Modified: trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemePublishedFileManager.java =================================================================== --- trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemePublishedFileManager.java 2006-07-18 08:30:06 UTC (rev 1265) +++ trunk/ccm-ldn-theme/src/com/arsdigita/london/theme/util/ThemePublishedFileManager.java 2006-07-18 12:18:48 UTC (rev 1266) @@ -17,17 +17,17 @@ import com.arsdigita.london.theme.Theme; import com.arsdigita.london.theme.ThemeFileCollection; +import com.arsdigita.templating.Templating; import java.io.File; import org.apache.log4j.Logger; -import java.io.File; /** - * Class for polling the database to look for new/updated published files in - * the ThemeFile table. - * + * Class for polling the database to look for new/updated published files in + * the ThemeFile table. + * * For "published" files, It goes through each Theme and looks at the - * last time it was published. If the last time published > last + * last time it was published. If the last time published > last * time thread was run then it examines those files. When the thread * runs for the first time, it examines all themes. * @@ -40,13 +40,13 @@ private static Logger s_log = Logger.getLogger(ThemePublishedFileManager.class); - // The code in this class borrows heavily from + // The code in this class borrows heavily from // com.arsdigita.cms.publishToFile.FileManager static private ThemeFileManager s_manager = null; - protected ThemePublishedFileManager(int startupDelay, int pollDelay, + protected ThemePublishedFileManager(int startupDelay, int pollDelay, String baseDirectory) { super(s_log, startupDelay, pollDelay, baseDirectory); } @@ -54,12 +54,12 @@ // is there a way to move this code up in to the parent class? /** * Start watching the files. This method spawns a - * background thread that looks for changes in files in the database + * background thread that looks for changes in files in the database * if there is not already a thread that has been spawned. If there * is already a running thread then this is a no-op that returns a * reference to the running thread. * - * The thread starts processing after <code>startupDelay</code> seconds. + * The thread starts processing after <code>startupDelay</code> seconds. * The db is checked for new/updated * files every <code>pollDelay</code> seconds. * @@ -77,8 +77,8 @@ s_log.info("Starting Theme File Manager Thread with the base " + "directory of " + baseDirectory); if ( startupDelay > 0 ) { - s_manager = new ThemePublishedFileManager(startupDelay, - pollDelay, + s_manager = new ThemePublishedFileManager(startupDelay, + pollDelay, baseDirectory); s_manager.setDaemon(true); s_manager.setName("theme-pub-files"); @@ -88,7 +88,7 @@ "because the startup delay is <= 0"); } } - return s_manager; + return s_manager; } /** @@ -115,11 +115,14 @@ * last published then this is a no-op */ protected void updateTheme(Theme theme) { - if (getLastRunDate() == null || + if (getLastRunDate() == null || !(new File(getManagerSpecificDirectory() + theme.getURL())).exists() || (theme.getLastPublishedDate() != null && getLastRunDate().before(theme.getLastPublishedDate()))) { super.updateTheme(theme); + // purge the templating cache -- we want newly published themes + // to be visible immediately, and not after a server restart. + Templating.purgeTemplates(); } } |
From: <ssk...@vh...> - 2006-07-18 08:35:57
|
Author: sskracic Date: 2006-07-18 10:30:06 +0200 (Tue, 18 Jul 2006) New Revision: 1265 Modified: trunk/ccm-core/sql/ccm-core/default/categorization/table-cat_purposes.sql Log: Making the table definition work for both Oracle and Postgres. Modified: trunk/ccm-core/sql/ccm-core/default/categorization/table-cat_purposes.sql =================================================================== --- trunk/ccm-core/sql/ccm-core/default/categorization/table-cat_purposes.sql 2006-07-18 07:46:59 UTC (rev 1264) +++ trunk/ccm-core/sql/ccm-core/default/categorization/table-cat_purposes.sql 2006-07-18 08:30:06 UTC (rev 1265) @@ -27,8 +27,7 @@ key varchar(40) not null, name varchar(200) not null, description varchar(4000), - language char(2) not null + language char(2) default 'en' not null, + constraint cat_purposes_lang_un unique (key, language) ); -alter table cat_purposes modify language default 'en'; -alter table cat_purposes add constraint cat_purposes_lang_un unique (key, language); |
From: <ssk...@vh...> - 2006-07-18 07:52:49
|
Author: sskracic Date: 2006-07-18 09:46:59 +0200 (Tue, 18 Jul 2006) New Revision: 1264 Modified: trunk/ccm-cms/application.xml Log: Version number increment due to the data model change. Modified: trunk/ccm-cms/application.xml =================================================================== --- trunk/ccm-cms/application.xml 2006-07-17 10:20:39 UTC (rev 1263) +++ trunk/ccm-cms/application.xml 2006-07-18 07:46:59 UTC (rev 1264) @@ -2,7 +2,7 @@ <ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project" name="ccm-cms" prettyName="Red Hat CCM Content Management System" - version="6.3.1" + version="6.3.2" release="1" webapp="ROOT"> <ccm:dependencies> |
From: <cgy...@vh...> - 2006-07-17 10:26:20
|
Author: cgyg9330 Date: 2006-07-17 12:20:39 +0200 (Mon, 17 Jul 2006) New Revision: 1263 Modified: trunk/ccm-cms/src/WEB-INF/resources/cms-item-adapters.xml Log: Don't exclude so many attributes from auditing - we need master version id Modified: trunk/ccm-cms/src/WEB-INF/resources/cms-item-adapters.xml =================================================================== --- trunk/ccm-cms/src/WEB-INF/resources/cms-item-adapters.xml 2006-07-17 08:19:53 UTC (rev 1262) +++ trunk/ccm-cms/src/WEB-INF/resources/cms-item-adapters.xml 2006-07-17 10:20:39 UTC (rev 1263) @@ -33,34 +33,9 @@ </xrd:adapter> <xrd:adapter objectType="com.arsdigita.cms.ContentPage" extends="com.arsdigita.cms.ContentItem" traversalClass="com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter"> - <xrd:formatter property="/object/masterVersion/auditing/creationDate" - class="com.arsdigita.xml.formatters.DateFormatter"/> - <xrd:formatter property="/object/masterVersion/auditing/lastModifiedDate" - class="com.arsdigita.xml.formatters.DateFormatter"/> <xrd:attributes rule="exclude"> - <xrd:property name="/object/masterVersion/id"/> - <xrd:property name="/object/masterVersion/defaultDomainClass"/> - <xrd:property name="/object/masterVersion/displayName"/> - <xrd:property name="/object/masterVersion/ancestors"/> - <xrd:property name="/object/masterVersion/version"/> - <xrd:property name="/object/masterVersion/isDeleted"/> - <xrd:property name="/object/masterVersion/lead"/> - <xrd:property name="/object/masterVersion/title"/> - <xrd:property name="/object/masterVersion/launchDate"/> - <xrd:property name="/object/masterVersion/name"/> - <xrd:property name="/object/masterVersion/language"/> - <xrd:property name="/object/masterVersion/objectType"/> - <xrd:property name="/object/masterVersion/auditing/id"/> - <xrd:property name="/object/masterVersion/auditing/creationIP"/> - <xrd:property name="/object/masterVersion/auditing/lastModifiedIP"/> - <xrd:property name="/object/masterVersion/auditing/creationUser/id"/> - <xrd:property name="/object/masterVersion/auditing/creationUser/objectType"/> - <xrd:property name="/object/masterVersion/auditing/creationUser/defaultDomainClass"/> - <xrd:property name="/object/masterVersion/auditing/lastModifiedUser/id"/> - <xrd:property name="/object/masterVersion/auditing/lastModifiedUser/objectType"/> - <xrd:property name="/object/masterVersion/auditing/lastModifiedUser/defaultDomainClass"/> </xrd:attributes> <xrd:associations rule="include"> |
From: <cgy...@vh...> - 2006-07-17 08:25:34
|
Author: cgyg9330 Date: 2006-07-17 10:19:53 +0200 (Mon, 17 Jul 2006) New Revision: 1262 Modified: trunk/ccm-core/src/com/arsdigita/search/MetadataProvider.java trunk/ccm-core/src/com/arsdigita/search/intermedia/DocumentObserver.java trunk/ccm-core/src/com/arsdigita/search/lucene/DocumentObserver.java Log: See patch from SF [1465604] - support for conditional indexing of objects Modified: trunk/ccm-core/src/com/arsdigita/search/MetadataProvider.java =================================================================== --- trunk/ccm-core/src/com/arsdigita/search/MetadataProvider.java 2006-07-17 08:18:47 UTC (rev 1261) +++ trunk/ccm-core/src/com/arsdigita/search/MetadataProvider.java 2006-07-17 08:19:53 UTC (rev 1262) @@ -18,12 +18,13 @@ */ package com.arsdigita.search; -import com.arsdigita.domain.DomainObject; -import com.arsdigita.kernel.Party; import java.util.Date; import java.util.Locale; +import com.arsdigita.domain.DomainObject; +import com.arsdigita.kernel.Party; + /** * The interface defining an adapter between a domain object * and the search index metadata. Any domain object which @@ -129,4 +130,12 @@ **/ String getContentSection(DomainObject dobj); + /** + * Allow searchable objects to decide at runtime whether they should + * be indexed or not. Normally should return true + * @param dobj + * @return + */ + boolean isIndexable(DomainObject dobj); + } Modified: trunk/ccm-core/src/com/arsdigita/search/intermedia/DocumentObserver.java =================================================================== --- trunk/ccm-core/src/com/arsdigita/search/intermedia/DocumentObserver.java 2006-07-17 08:18:47 UTC (rev 1261) +++ trunk/ccm-core/src/com/arsdigita/search/intermedia/DocumentObserver.java 2006-07-17 08:19:53 UTC (rev 1262) @@ -18,18 +18,20 @@ */ package com.arsdigita.search.intermedia; +import java.math.BigDecimal; +import java.util.Locale; + +import org.apache.log4j.Logger; + import com.arsdigita.domain.DomainObject; +import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.OID; import com.arsdigita.search.ContentProvider; import com.arsdigita.search.ContentType; import com.arsdigita.search.MetadataProvider; import com.arsdigita.search.MetadataProviderRegistry; -import java.math.BigDecimal; -import java.util.Locale; -import org.apache.log4j.Logger; - public class DocumentObserver implements com.arsdigita.search.DocumentObserver { private static final Logger s_log = @@ -48,6 +50,7 @@ s_log.debug("adapter is " + adapter); s_log.debug("dobj is " + dobj); if (adapter != null) { + if (s_log.isDebugEnabled()) { s_log.debug("Processing object " + dobj.getOID() + " using new adapters"); @@ -64,7 +67,8 @@ String contentSection = adapter.getContentSection(dobj); - doOnSave(dobj.getOID(), + doOnSave(dobj, + adapter.isIndexable(dobj), adapter.getTitle(dobj), adapter.getSummary(dobj), locale == null ? "en" : locale.getLanguage(), @@ -104,8 +108,9 @@ raw = sh.rawContent(); } } - - doOnSave(dobj.getOID(), + // nb - conditional indexing not supported for legacy adapter + doOnSave(dobj, + true, searchable.getSearchLinkText(), searchable.getSearchSummary(), searchable.getSearchLanguage(), @@ -128,20 +133,35 @@ } - private void doOnSave(OID oid, + private void doOnSave(DomainObject object, + boolean shouldBeIndexed, String title, String summary, String language, String xml, byte[] raw) { + + OID oid = object.getOID(); SearchContent sc = SearchContent.retrieveForObject(oid); if (sc == null) { + if (shouldBeIndexed) { + // create new SearchContent object (but don't save in database yet). sc = new SearchContent(); BigDecimal id = (BigDecimal)oid.get("id"); sc.setObjectId(id); sc.setContentObjectType(oid.getObjectType().getQualifiedName()); } else { + // no search content and we don't want any + return; + } + } else { + if (!shouldBeIndexed) { + // search content exists, but we don't want it now + sc.delete(); + return; + } else { + // Object already indexed. Don't save again if there were no changes if (stringMatch(sc.getSummary(), summary) && stringMatch(sc.getLinkText(), title) && @@ -151,6 +171,7 @@ return; // no changes to object, don't save again. } } + } sc.setSummary(summary); sc.setLinkText(title); @@ -163,22 +184,34 @@ ContentChangeTime.flagChange(); } - private void doOnSave(OID oid, + private void doOnSave(DomainObject object, + boolean shouldBeIndexed, String title, String summary, String language, String xml, byte[] raw, - String contentSection - ) { + String contentSection) { + OID oid = object.getOID(); SearchContent sc = SearchContent.retrieveForObject(oid); if (sc == null) { + if (shouldBeIndexed) { + // create new SearchContent object (but don't save in database yet). sc = new SearchContent(); BigDecimal id = (BigDecimal)oid.get("id"); sc.setObjectId(id); sc.setContentObjectType(oid.getObjectType().getQualifiedName()); } else { + // no search content and we don't want any + return; + } + } else { + if (!shouldBeIndexed) { + // search content exists, but we don't want it now + sc.delete(); + return; + } else { // Object already indexed. Don't save again if there were no changes if (stringMatch(sc.getSummary(), summary) && stringMatch(sc.getLinkText(), title) && @@ -189,6 +222,7 @@ return; // no changes to object, don't save again. } } + } sc.setSummary(summary); sc.setLinkText(title); Modified: trunk/ccm-core/src/com/arsdigita/search/lucene/DocumentObserver.java =================================================================== --- trunk/ccm-core/src/com/arsdigita/search/lucene/DocumentObserver.java 2006-07-17 08:18:47 UTC (rev 1261) +++ trunk/ccm-core/src/com/arsdigita/search/lucene/DocumentObserver.java 2006-07-17 08:19:53 UTC (rev 1262) @@ -18,6 +18,10 @@ */ package com.arsdigita.search.lucene; +import java.math.BigDecimal; + +import org.apache.log4j.Logger; + import com.arsdigita.domain.DomainObject; import com.arsdigita.kernel.Party; import com.arsdigita.search.ContentProvider; @@ -26,11 +30,7 @@ import com.arsdigita.search.MetadataProviderRegistry; import com.arsdigita.util.Assert; -import java.math.BigDecimal; -import org.apache.log4j.Logger; - - public class DocumentObserver implements com.arsdigita.search.DocumentObserver { private static final Logger s_log = @@ -48,17 +48,24 @@ s_log.debug("using adapter " + adapter); + // retrieve document & if it doesn't exist, create one if required by this DomainObject + BigDecimal id = (BigDecimal)dobj.getOID().get("id"); Assert.exists(id, BigDecimal.class); Document doc = Document.retrieve(id); if (doc == null) { + if ((adapter == null) || (adapter!= null && adapter.isIndexable(dobj))) { + if (s_log.isDebugEnabled()) { s_log.debug("Creating new document"); } doc = Document.create(id); doc.setType(dobj.getObjectType().getQualifiedName()); } + } if (adapter != null) { + if (adapter.isIndexable(dobj)) { + if (s_log.isDebugEnabled()) { s_log.debug("Processing object " + dobj.getOID() + " using new adapters"); @@ -87,6 +94,14 @@ } doc.setContent(buf.toString().replace('\0', ' ')); } else { + // document already exists, but now shouldn't be indexed + if (doc != null) { + + doc.setDeleted(true); + } + + } + } else { if (s_log.isDebugEnabled()) { s_log.debug("Processing object " + dobj.getOID() + " using old adapters"); @@ -108,10 +123,11 @@ doc.setLastModifiedParty(party == null ? null : party.getID()); doc.setContent(ladapter.getContent(dobj)); } - + if (doc != null) { doc.setDirty(true); doc.save(); } + } /** * Invoked after a searchable object has been |
From: <cgy...@vh...> - 2006-07-17 08:24:36
|
Author: cgyg9330 Date: 2006-07-17 10:18:47 +0200 (Mon, 17 Jul 2006) New Revision: 1261 Added: trunk/ccm-cms/sql/ccm-cms/oracle-se/upgrade/6.3.1-6.3.2/ trunk/ccm-cms/sql/ccm-cms/oracle-se/upgrade/6.3.1-6.3.2/add-description-field.sql trunk/ccm-cms/sql/ccm-cms/postgres/upgrade/6.3.1-6.3.2/ trunk/ccm-cms/sql/ccm-cms/postgres/upgrade/6.3.1-6.3.2/add-description-field.sql trunk/ccm-cms/sql/ccm-cms/upgrade/oracle-se-6.3.1-6.3.2.sql trunk/ccm-cms/sql/ccm-cms/upgrade/postgres-6.3.1-6.3.2.sql Modified: trunk/ccm-cms/pdl/com/arsdigita/content-section/ContentPage.pdl trunk/ccm-cms/src/WEB-INF/resources/cms-item-adapters.xml trunk/ccm-cms/src/ccm-cms.upgrade trunk/ccm-cms/src/com/arsdigita/cms/ContentPage.java trunk/ccm-cms/src/com/arsdigita/cms/search/ContentItemMetadataProvider.java trunk/ccm-cms/src/com/arsdigita/cms/search/TextContentProvider.java Log: See patch from SF [1465604] - manage file indexing. Also, add description field to ContentPage. ContentTypes should refer to this inherited description Modified: trunk/ccm-cms/pdl/com/arsdigita/content-section/ContentPage.pdl =================================================================== --- trunk/ccm-cms/pdl/com/arsdigita/content-section/ContentPage.pdl 2006-07-17 08:15:45 UTC (rev 1260) +++ trunk/ccm-cms/pdl/com/arsdigita/content-section/ContentPage.pdl 2006-07-17 08:18:47 UTC (rev 1261) @@ -15,7 +15,7 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// $Id$ +// $Id$ // $DateTime: 2004/08/17 23:15:09 $ model com.arsdigita.cms; @@ -26,6 +26,9 @@ String[0..1] title = cms_pages.title VARCHAR(1000); Date[0..1] launchDate = cms_pages.launch_date DATE; + // would have used description as attribute name, but existing subtypes + // use that name + String[0..1] pageDescription = cms_pages.description VARCHAR(4000); reference key (cms_pages.item_id); } Added: trunk/ccm-cms/sql/ccm-cms/oracle-se/upgrade/6.3.1-6.3.2/add-description-field.sql =================================================================== --- trunk/ccm-cms/sql/ccm-cms/oracle-se/upgrade/6.3.1-6.3.2/add-description-field.sql 2006-07-17 08:15:45 UTC (rev 1260) +++ trunk/ccm-cms/sql/ccm-cms/oracle-se/upgrade/6.3.1-6.3.2/add-description-field.sql 2006-07-17 08:18:47 UTC (rev 1261) @@ -0,0 +1,26 @@ +-- +-- Copyright (C) 2003-2004 Red Hat Inc. All Rights Reserved. +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public License +-- as published by the Free Software Foundation; either version 2.1 of +-- the License, or (at your option) any later version. +-- +-- This library is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- You should have received a copy of the GNU Lesser General Public +-- License along with this library; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-- +-- $Id: add-description-field.sql,v 1.1.2.1 2005/10/04 12:09:59 cgyg9330 Exp $ +-- $DateTime: 2004/08/17 23:15:09 $ + +-- add a description field at the level of cms_pages that may be used +-- by any content type, unless they choose to continue using their +-- custom version +ALTER TABLE cms_pages +ADD (description VARCHAR2(4000) ); + Added: trunk/ccm-cms/sql/ccm-cms/postgres/upgrade/6.3.1-6.3.2/add-description-field.sql =================================================================== --- trunk/ccm-cms/sql/ccm-cms/postgres/upgrade/6.3.1-6.3.2/add-description-field.sql 2006-07-17 08:15:45 UTC (rev 1260) +++ trunk/ccm-cms/sql/ccm-cms/postgres/upgrade/6.3.1-6.3.2/add-description-field.sql 2006-07-17 08:18:47 UTC (rev 1261) @@ -0,0 +1,26 @@ +-- +-- Copyright (C) 2003-2004 Red Hat Inc. All Rights Reserved. +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public License +-- as published by the Free Software Foundation; either version 2.1 of +-- the License, or (at your option) any later version. +-- +-- This library is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- You should have received a copy of the GNU Lesser General Public +-- License along with this library; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-- +-- $Id: add-description-field.sql,v 1.1.2.1 2005/10/04 12:09:59 cgyg9330 Exp $ +-- $DateTime: 2004/08/17 23:15:09 $ + +-- add a description field at the level of cms_pages that may be used +-- by any content type, unless they choose to continue using their +-- custom version +ALTER TABLE cms_pages +ADD description VARCHAR(4000) ; + Added: trunk/ccm-cms/sql/ccm-cms/upgrade/oracle-se-6.3.1-6.3.2.sql =================================================================== --- trunk/ccm-cms/sql/ccm-cms/upgrade/oracle-se-6.3.1-6.3.2.sql 2006-07-17 08:15:45 UTC (rev 1260) +++ trunk/ccm-cms/sql/ccm-cms/upgrade/oracle-se-6.3.1-6.3.2.sql 2006-07-17 08:18:47 UTC (rev 1261) @@ -0,0 +1,24 @@ +-- +-- Copyright (C) 2005 Runtime Collective Ltd. 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 +-- +-- $Id: oracle-se-6.3.1-6.3.2.sql 293 2005-02-22 15:10:39Z cgilbert $ +-- $DateTime: 2004/08/16 18:10:38 $ + +PROMPT Red Hat Enterprise CMS 6.3.1 -> 6.3.2 Upgrade Script (Oracle) + +@@ ../oracle-se/upgrade/6.3.1-6.3.2/add-description-field.sql + Added: trunk/ccm-cms/sql/ccm-cms/upgrade/postgres-6.3.1-6.3.2.sql =================================================================== --- trunk/ccm-cms/sql/ccm-cms/upgrade/postgres-6.3.1-6.3.2.sql 2006-07-17 08:15:45 UTC (rev 1260) +++ trunk/ccm-cms/sql/ccm-cms/upgrade/postgres-6.3.1-6.3.2.sql 2006-07-17 08:18:47 UTC (rev 1261) @@ -0,0 +1,28 @@ +-- +-- Copyright (C) 2003-2004 Red Hat Inc. All Rights Reserved. +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public License +-- as published by the Free Software Foundation; either version 2.1 of +-- the License, or (at your option) any later version. +-- +-- This library is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- You should have received a copy of the GNU Lesser General Public +-- License along with this library; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-- +-- $Id: postgres-6.3.0-6.3.1.sql,v 1.1.2.1 2005/10/04 12:09:52 cgyg9330 Exp $ +-- $DateTime: 2004/08/17 23:15:09 $ + +\echo Red Hat Enterprise CMS 6.3.1 -> 6.3.2 Upgrade Script (PostgreSQL) + +begin; + +\i ../postgres/upgrade/6.3.1-6.3.2/add-description-field.sql + + +commit; Modified: trunk/ccm-cms/src/WEB-INF/resources/cms-item-adapters.xml =================================================================== --- trunk/ccm-cms/src/WEB-INF/resources/cms-item-adapters.xml 2006-07-17 08:15:45 UTC (rev 1260) +++ trunk/ccm-cms/src/WEB-INF/resources/cms-item-adapters.xml 2006-07-17 08:18:47 UTC (rev 1261) @@ -7,6 +7,7 @@ <!-- First off the adapters for ContentItemPanel --> <xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator"> + <!-- Content item is the simplest type --> <xrd:adapter objectType="com.arsdigita.cms.ContentItem" traversalClass="com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter"> <xrd:attributes rule="exclude"> @@ -32,12 +33,44 @@ </xrd:adapter> <xrd:adapter objectType="com.arsdigita.cms.ContentPage" extends="com.arsdigita.cms.ContentItem" traversalClass="com.arsdigita.cms.contenttypes.ContentItemTraversalAdapter"> + <xrd:formatter property="/object/masterVersion/auditing/creationDate" + class="com.arsdigita.xml.formatters.DateFormatter"/> + <xrd:formatter property="/object/masterVersion/auditing/lastModifiedDate" + class="com.arsdigita.xml.formatters.DateFormatter"/> + + <xrd:attributes rule="exclude"> - <xrd:property name="/object/auditing/id"/> + <xrd:property name="/object/masterVersion/id"/> + <xrd:property name="/object/masterVersion/defaultDomainClass"/> + <xrd:property name="/object/masterVersion/displayName"/> + <xrd:property name="/object/masterVersion/ancestors"/> + <xrd:property name="/object/masterVersion/version"/> + <xrd:property name="/object/masterVersion/isDeleted"/> + <xrd:property name="/object/masterVersion/lead"/> + <xrd:property name="/object/masterVersion/title"/> + <xrd:property name="/object/masterVersion/launchDate"/> + <xrd:property name="/object/masterVersion/name"/> + <xrd:property name="/object/masterVersion/language"/> + <xrd:property name="/object/masterVersion/objectType"/> + <xrd:property name="/object/masterVersion/auditing/id"/> + <xrd:property name="/object/masterVersion/auditing/creationIP"/> + <xrd:property name="/object/masterVersion/auditing/lastModifiedIP"/> + <xrd:property name="/object/masterVersion/auditing/creationUser/id"/> + <xrd:property name="/object/masterVersion/auditing/creationUser/objectType"/> + <xrd:property name="/object/masterVersion/auditing/creationUser/defaultDomainClass"/> + <xrd:property name="/object/masterVersion/auditing/lastModifiedUser/id"/> + <xrd:property name="/object/masterVersion/auditing/lastModifiedUser/objectType"/> + <xrd:property name="/object/masterVersion/auditing/lastModifiedUser/defaultDomainClass"/> + </xrd:attributes> <xrd:associations rule="include"> - <xrd:property name="/object/auditing"/> + <xrd:property name="/object/masterVersion"/> + <xrd:property name="/object/masterVersion/auditing"/> + <xrd:property name="/object/masterVersion/auditing/creationUser"/> + <xrd:property name="/object/masterVersion/auditing/lastModifiedUser"/> + </xrd:associations> + </xrd:adapter> <!-- Adds a text asset --> @@ -118,7 +151,6 @@ <xrd:associations rule="include"> <xrd:property name="/object/locale"/> <xrd:property name="/object/type"/> - <xrd:property name="/object/fileAttachments"/> </xrd:associations> </xrd:adapter> Modified: trunk/ccm-cms/src/ccm-cms.upgrade =================================================================== --- trunk/ccm-cms/src/ccm-cms.upgrade 2006-07-17 08:15:45 UTC (rev 1260) +++ trunk/ccm-cms/src/ccm-cms.upgrade 2006-07-17 08:18:47 UTC (rev 1261) @@ -17,4 +17,8 @@ <version from="6.3.0" to="6.3.1"> <script sql="ccm-cms/upgrade/::database::-6.3.0-6.3.1.sql"/> </version> + <version from="6.3.1" to="6.3.2"> + <script sql="ccm-cms/upgrade/::database::-6.3.1-6.3.2.sql"/> + </version> + </upgrade> Modified: trunk/ccm-cms/src/com/arsdigita/cms/ContentPage.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ContentPage.java 2006-07-17 08:15:45 UTC (rev 1260) +++ trunk/ccm-cms/src/com/arsdigita/cms/ContentPage.java 2006-07-17 08:18:47 UTC (rev 1261) @@ -36,17 +36,17 @@ /** * This class extends {@link com.arsdigita.cms.ContentItem content - * item} with the additional attributes name and title. The name + * item} with the additional attributes name, title and description. The name * attribute is used in generating the URL for this content page. * * @author Uday Mathur * @author Jack Chung * @author Michael Pih - * @version $Id$ + * @version $Id$ */ public class ContentPage extends ContentItem { - public static final String versionId = "$Id$ by $Author$, $DateTime: 2004/08/17 23:15:09 $"; + public static final String versionId = "$Id$ by $Author$, $DateTime: 2004/08/17 23:15:09 $"; private static final Logger s_log = Logger.getLogger(ContentPage.class); @@ -56,6 +56,8 @@ public static final String TITLE = "title"; public static final String SUMMARY = "summary"; public static final String LAUNCH_DATE = "launchDate"; + public static final String DESCRIPTION = "pageDescription"; + protected static final String PAGES_IN_FOLDER = "com.arsdigita.cms.pagesInFolder"; @@ -147,6 +149,37 @@ } } + /** + * Decides whether plugged in assets should be indexed with the + * page or separately. Default is false (assets are ONLY indexed + * as separate items) Subtypes may override this method to + * provide the logic that decides whether or not assets should + * be indexed separately. If true, content of assets is ONLY + * included in the page, not as a separate item. This method only provides + * guidance to assets. Writers of plug in assets should + * refer to this method in relation to the object that + * owns the asset and make a decision based on the answer. + * + * Best course of action is for assets to provide their + * own MetadataProvider which refers to this method in the + * indexObject method eg. + * + * + * + <pre> + public boolean indexObject (DomainObject dobj) { + FileAttachment file = (FileAttachment) dobj; + ContentPage owner = (ContentPage) file.getFileOwner(); + s_log.debug("index this file attachment? " + !owner.indexAssetsWithPage()); + return !owner.indexAssetsWithPage(); + } + </pre> + * @return + */ + public boolean indexAssetsWithPage() { + return false; + } + public final ContentBundle getContentBundle() { final ACSObject parent = getParent(); @@ -173,6 +206,12 @@ set(LAUNCH_DATE, ldate); } + public void setDescription(String description) { + set(DESCRIPTION, description); + } + public String getDescription() { + return (String)get(DESCRIPTION); + } // Set parameters on the pagesInFolder data query /** @@ -297,8 +336,12 @@ // These could be protected, but public may make it easier to // debug + /** + * default behaviour is to return the description. Subtypes should + * override to change use some other attribute + */ public String getSearchSummary() { - return ""; + return getDescription(); } } Modified: trunk/ccm-cms/src/com/arsdigita/cms/search/ContentItemMetadataProvider.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/search/ContentItemMetadataProvider.java 2006-07-17 08:15:45 UTC (rev 1260) +++ trunk/ccm-cms/src/com/arsdigita/cms/search/ContentItemMetadataProvider.java 2006-07-17 08:18:47 UTC (rev 1261) @@ -18,7 +18,9 @@ */ package com.arsdigita.cms.search; +import com.arsdigita.cms.Asset; import com.arsdigita.cms.ContentItem; +import com.arsdigita.cms.ContentPage; import com.arsdigita.domain.DomainObject; import com.arsdigita.kernel.Party; import com.arsdigita.search.ContentType; @@ -38,15 +40,15 @@ * subclass of {@link com.arsdigita.cms.ContentItem}. * * @author <a href="mailto:ber...@re...">Daniel Berrange</a> - * @version $Revision: #5 $ $Date: 2004/08/17 $ + * @version $Revision: 1.1.2.1 $ $Date: 2005/10/04 12:09:55 $ */ public abstract class ContentItemMetadataProvider implements MetadataProvider { private static final Logger s_log = Logger.getLogger(ContentItemMetadataProvider.class); public final static String versionId = - "$Id$" - + " by $Author$, $DateTime: 2004/08/17 23:15:09 $"; + "$Id$" + + " by $Author$, $DateTime: 2004/08/17 23:15:09 $"; public String getTypeSpecificInfo(DomainObject dobj) { ContentItem item = (ContentItem) dobj; @@ -80,6 +82,9 @@ return item.getLastModifiedUser(); } + public boolean isIndexable (DomainObject dobj) { + return true; + } public ContentProvider[] getContent(DomainObject dobj, ContentType type) { List content = new ArrayList(); @@ -96,17 +101,40 @@ } content.add(new TextContentProvider("text", dobj, getClass().getName())); + if (dobj instanceof ContentPage) { + if (((ContentPage)dobj).indexAssetsWithPage()) { + + content.add(new TextContentProvider("text", dobj, + AssetExtractor.class.getName())); + } + } else { content.add(new TextContentProvider("text", dobj, AssetExtractor.class.getName())); - } else if (type == ContentType.RAW) { - if (s_log.isDebugEnabled()) { - s_log.debug("Adding Raw Content for " + dobj.getOID()); } + } else if (type == ContentType.RAW) { + // if assets are indexed separately for this type, don't index them here. If that is the case, + // then the asset itself must have a separate metadataprovider registered to ensure that + // the asset will be indexed + if (dobj instanceof ContentPage) { + if (((ContentPage)dobj).indexAssetsWithPage()) { + AssetExtractor ex = new AssetExtractor(); + ex.walk(dobj, AssetExtractor.class.getName()); + content.addAll(ex.getContent()); + } // else do nothing + } else { + // by default, add content for these items - asset applications should register their own + // metadataproviders to ensure they react correctly to the value of ContentPage.indexAssetsWithPage + // + // only the asset istelf knows how to refer to it's owning article in order to find out if it + // should be indexed or not AssetExtractor ex = new AssetExtractor(); ex.walk(dobj, AssetExtractor.class.getName()); content.addAll(ex.getContent()); } + + } + return (ContentProvider[])content.toArray( new ContentProvider[content.size()]); } Modified: trunk/ccm-cms/src/com/arsdigita/cms/search/TextContentProvider.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/search/TextContentProvider.java 2006-07-17 08:15:45 UTC (rev 1260) +++ trunk/ccm-cms/src/com/arsdigita/cms/search/TextContentProvider.java 2006-07-17 08:18:47 UTC (rev 1261) @@ -18,6 +18,7 @@ */ package com.arsdigita.cms.search; +import com.arsdigita.cms.ContentPage; import com.arsdigita.cms.ContentSection; import com.arsdigita.cms.FileAsset; import com.arsdigita.cms.TextAsset; @@ -183,15 +184,19 @@ if (!ContentSection.getConfig().getDisableFileAssetExtraction()) { while (association.next()) { - if( s_log.isDebugEnabled() ) { - s_log.debug( "Adding file asset association " + + if( s_log.isDebugEnabled() ) { + s_log.debug( "Adding file asset association " + property.getName() + " for " + obj.getOID() ); + } + if (obj.getObjectType().isSubtypeOf(ContentPage.BASE_DATA_OBJECT_TYPE)) { + ContentPage cp = (ContentPage) obj; + if (cp.indexAssetsWithPage()) { + appendFileAsset(new FileAsset(association.getDataObject())); + } + } } - - appendFileAsset(new FileAsset(association.getDataObject())); } - } } else if (association != null && association.getObjectType().isSubtypeOf |
From: <cgy...@vh...> - 2006-07-17 08:21:26
|
Author: cgyg9330 Date: 2006-07-17 10:15:45 +0200 (Mon, 17 Jul 2006) New Revision: 1260 Added: trunk/ccm-cms-assets-fileattachment/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contentassets/FileAttachment-search.xml trunk/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/FileAttachmentMetadataProvider.java Modified: trunk/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/FileAttachmentInitializer.java Log: See patch from SF [1465604] - refer to owner to decide whether to index files with owner or separately Added: trunk/ccm-cms-assets-fileattachment/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contentassets/FileAttachment-search.xml =================================================================== --- trunk/ccm-cms-assets-fileattachment/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contentassets/FileAttachment-search.xml 2006-07-17 08:14:35 UTC (rev 1259) +++ trunk/ccm-cms-assets-fileattachment/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contentassets/FileAttachment-search.xml 2006-07-17 08:15:45 UTC (rev 1260) @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<xrd:adapters xmlns:xrd="http://xmlns.redhat.com/schemas/waf/xml-renderer-rules" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://rhea.redhat.com/schemas/waf/xml-renderer-rules xml-renderer-rules.xsd"> + + + <!-- this xml file is parsed by the standard TraversalHandler, enabling FileAttachmentMetadataProvider to + override the standard AssetMetadataProvider to give some more useful information --> + + <xrd:context name="com.arsdigita.cms.contentassets.FileAttachmentMetadataProvider"> + <xrd:adapter objectType="com.arsdigita.cms.contentassets.FileAttachment"> + <xrd:attributes rule="include"> + <xrd:property name="/object/name"/> + <xrd:property name="/object/description"/> + + </xrd:attributes> + </xrd:adapter> + </xrd:context> +</xrd:adapters> Modified: trunk/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/FileAttachmentInitializer.java =================================================================== --- trunk/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/FileAttachmentInitializer.java 2006-07-17 08:14:35 UTC (rev 1259) +++ trunk/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/FileAttachmentInitializer.java 2006-07-17 08:15:45 UTC (rev 1260) @@ -14,35 +14,36 @@ */ package com.arsdigita.cms.contentassets; -import com.arsdigita.cms.ContentPage; import com.arsdigita.cms.contenttypes.ContentAssetInitializer; -import com.arsdigita.cms.contentassets.FileAttachment; import com.arsdigita.cms.contentassets.ui.FileAttachmentsStep; +import com.arsdigita.cms.ContentPage; import com.arsdigita.domain.xml.TraversalHandler; - import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.kernel.URLService; +import com.arsdigita.runtime.DomainInitEvent; import com.arsdigita.runtime.LegacyInitEvent; +import com.arsdigita.search.MetadataProviderRegistry; import com.arsdigita.xml.XML; /** * Initializer * * @author Rafael H. Schloming <rh...@mi...> - * @version $Revision: #4 $ $Date: 2004/03/30 $ + * @version $Revision: 1.1 $ $Date: 2004/12/15 15:37:51 $ **/ public class FileAttachmentInitializer extends ContentAssetInitializer { - public final static String versionId = "$Id$ by $Author$, $DateTime: 2004/03/30 18:21:14 $"; + public final static String versionId = + "$Id$ by $Author$, $DateTime: 2004/03/30 18:21:14 $"; public FileAttachmentInitializer() { super("ccm-cms-assets-fileattachment.pdl.mf"); } public String getTraversalXML() { - return "/WEB-INF/traversal-adapters/com/arsdigita/" + - "cms/contentassets/FileAttachment.xml"; + return "/WEB-INF/traversal-adapters/com/arsdigita/" + + "cms/contentassets/FileAttachment.xml"; } public String getProperty() { @@ -80,8 +81,22 @@ FileAttachment.BASE_DATA_OBJECT_TYPE, new FileAttachmentURLFinder()); - // we might need to output FA XML standalone - XML.parseResource(getTraversalXML(), + /* + * cms registers AssetMetadataProvider for type FileAsset and provides adapter for that + * context. We register a more specific metadataprovider for FileAttachment that provides useful information + * about the owner. Because we are using a new metadataprovider, we need to register + * adapter for that context. Note this is not the same as the adapters registered by the + * ContentAssetInitializer, because those are used specifically when traversing a content item + * that delegates assets to their specific adapters + * + * chr...@we... + */ + MetadataProviderRegistry.registerAdapter( + FileAttachment.BASE_DATA_OBJECT_TYPE, + new FileAttachmentMetadataProvider()); + XML.parseResource( + "/WEB-INF/traversal-adapters/com/arsdigita/cms/contentassets/FileAttachment-search.xml", new TraversalHandler()); } + } Added: trunk/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/FileAttachmentMetadataProvider.java =================================================================== --- trunk/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/FileAttachmentMetadataProvider.java 2006-07-17 08:14:35 UTC (rev 1259) +++ trunk/ccm-cms-assets-fileattachment/src/com/arsdigita/cms/contentassets/FileAttachmentMetadataProvider.java 2006-07-17 08:15:45 UTC (rev 1260) @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2003-2004 Red Hat Inc. All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +package com.arsdigita.cms.contentassets; + +import com.arsdigita.cms.Asset; +import com.arsdigita.domain.DomainObject; +import com.arsdigita.search.ContentProvider; +import com.arsdigita.search.ContentType; +import com.arsdigita.util.StringUtils; +import com.arsdigita.web.ParameterMap; +import com.arsdigita.web.URL; +import com.arsdigita.web.Web; +import com.arsdigita.kernel.URLService; +import com.arsdigita.kernel.NoValidURLException; +import com.arsdigita.cms.ContentPage; +import com.arsdigita.cms.ContentItem; +import org.apache.log4j.Logger; +import com.arsdigita.cms.search.AssetMetadataProvider; + +/** + * This class is an implementation of the Search metadata provider for any + * subclass of {@link com.arsdigita.cms.Asset}. + * + * @author <a href="mailto:ber...@re...">Daniel Berrange</a> + * @version $Revision: 1.2 $ $Date: 2005/09/07 15:18:36 $ + */ +public class FileAttachmentMetadataProvider extends AssetMetadataProvider { + + private static final Logger s_log = + Logger.getLogger(FileAttachmentMetadataProvider.class); + + public final static String versionId = + "$Id: FileAttachmentMetadataProvider.java,v 1.2 2005/09/07 15:18:36 cgyg9330 Exp $" + + " by $Author: cgyg9330 $, $DateTime: 2004/08/17 23:15:09 $"; + + public String getSummary(DomainObject dobj) { + + // add config parameter to allow link to owner + + FileAttachment file = (FileAttachment) dobj; + String description = file.getDescription(); + ContentPage owner = (ContentPage) file.getFileOwner(); + String title = owner.getTitle(); + StringBuffer summary = new StringBuffer(); + if (description != null) { + summary.append(description + " - "); + } + + if (owner.isLiveVersion()) { + ParameterMap map = new ParameterMap(); + map.setParameter( "oid", owner.getOID().toString() ); + + String url = new URL(Web.getConfig().getDefaultScheme(), + Web.getConfig().getServer().getName(), + Web.getConfig().getServer().getPort(), + "", + "", + "/redirect/", map ).getURL(); + + summary.append( + "A file attached to <a href=\"" + url + "\">" + title + "</a>"); + + } else { + // draft - don't give a live link because stylesheets + // escape <a> tags. If this is changed in the bebop stylesheets + // then just add parameter context=draft in map created above + // instead of this + summary.append("A file attached to " + title); + + } + + return summary.toString(); + + } + + + + public boolean isIndexable (DomainObject dobj) { + FileAttachment file = (FileAttachment) dobj; + ContentPage owner = (ContentPage) file.getFileOwner(); + s_log.debug("index this file attachment? " + !owner.indexAssetsWithPage()); + return !owner.indexAssetsWithPage(); + } + +} |
From: <cgy...@vh...> - 2006-07-17 08:20:25
|
Author: cgyg9330 Date: 2006-07-17 10:14:35 +0200 (Mon, 17 Jul 2006) New Revision: 1259 Modified: trunk/ccm-cms-types-filestorageitem/src/com/arsdigita/cms/contenttypes/FileStorageItem.java Log: See patch from SF [1465604] - file indexing changes applied to ensure file storage items index files WITH item Modified: trunk/ccm-cms-types-filestorageitem/src/com/arsdigita/cms/contenttypes/FileStorageItem.java =================================================================== --- trunk/ccm-cms-types-filestorageitem/src/com/arsdigita/cms/contenttypes/FileStorageItem.java 2006-07-14 10:41:40 UTC (rev 1258) +++ trunk/ccm-cms-types-filestorageitem/src/com/arsdigita/cms/contenttypes/FileStorageItem.java 2006-07-17 08:14:35 UTC (rev 1259) @@ -114,5 +114,14 @@ public void setFile(FileAsset file) { setAssociation(FILE, file); } - + /** + * instruct search framework to include file contents in the same record + * as the other parts of the page (eg title, metadata etc). See + * indexAssetsWithPage in com.arsdigita.cms.ContentPage + * + */ + public boolean indexAssetsWithPage() { + return true; + } + } |
From: <ssk...@vh...> - 2006-07-14 10:47:23
|
Author: sskracic Date: 2006-07-14 12:41:40 +0200 (Fri, 14 Jul 2006) New Revision: 1258 Modified: trunk/ccm-cms/application.xml Log: Bringing the version number in sync with the database upgrade scripts. Modified: trunk/ccm-cms/application.xml =================================================================== --- trunk/ccm-cms/application.xml 2006-07-14 07:09:10 UTC (rev 1257) +++ trunk/ccm-cms/application.xml 2006-07-14 10:41:40 UTC (rev 1258) @@ -2,8 +2,8 @@ <ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project" name="ccm-cms" prettyName="Red Hat CCM Content Management System" - version="6.3.0" - release="15" + version="6.3.1" + release="1" webapp="ROOT"> <ccm:dependencies> <ccm:requires name="ccm-core" version="6.3.0" relation="ge"/> |
From: <ssk...@vh...> - 2006-07-14 07:14:48
|
Author: sskracic Date: 2006-07-14 09:09:10 +0200 (Fri, 14 Jul 2006) New Revision: 1257 Modified: trunk/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/category/AbstractTree.java Log: Fixing the category UI elements to display correct category navigation URLs by removing obsolete code. The top level category used to start the iteration is always a root term category. We construct the category navigation URLs by appending the category URL and "/" to the parent URL if the latter happens to be in "canonical" form, ie. ending with slash. Otherwise, if parent's URL is something like /redirect or category.jsp?categoryID=blah then give up and use redirect URLs for all of its children. Modified: trunk/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/category/AbstractTree.java =================================================================== --- trunk/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/category/AbstractTree.java 2006-07-13 10:58:49 UTC (rev 1256) +++ trunk/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/category/AbstractTree.java 2006-07-14 07:09:10 UTC (rev 1257) @@ -46,8 +46,6 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.log4j.Logger; - public abstract class AbstractTree extends CategoryComponent { protected Element generateTreeXML(HttpServletRequest request, @@ -73,43 +71,15 @@ isDefault.booleanValue())); } - String url = null; - Application app = Web.getContext().getApplication(); - if (app instanceof Navigation) { - // Check the current category is actually in the current - // application's category hierarchy + String path = URLService.locate(cat.getOID()); - Category root = Category.getRootForObject( app ); - - CategoryCollection rootPath = root.getDefaultAscendants(); - CategoryCollection path = cat.getDefaultAscendants(); - - boolean common = true; - while( common && rootPath.next() ) { - if( ! path.next() || - ! rootPath.getID().equals( path.getID() ) ) - { - common = false; - } - } - rootPath.close(); - path.close(); - - if( common ) url = ""; - } else { - url = URLService.locate(cat.getOID()); - if (!url.endsWith("/")) { - url = null; - } - } - return generateNodeXML(request, response, cat, null, selected, children, - url, + path, Collections.EMPTY_LIST); } @@ -131,21 +101,19 @@ idPath = new ArrayList(idPath); idPath.add(cat.getID()); - String url = null; - if (path == null) { - url = Navigation.redirectURL(cat.getOID()); - } else if (path.endsWith("/")) { - url = path; - } else { - url = URL.here(Web.getRequest(), path + "/").toString(); - } + // We will concatenate category URLs only if all ancestors have + // their URLs set correctly. We recognize that is the case if + // path ends with slash. Otherwise resort to generic (ie. redirect) + // URLs. + boolean concatURLs = (path != null && path.endsWith("/")); + Element el = generateCategoryXML(request, response, cat.getID(), cat.getName(), cat.getDescription(), - url); + concatURLs ? path : Navigation.redirectURL(cat.getOID())); el.addAttribute("AbstractTree", "AbstractTree"); @@ -160,7 +128,7 @@ } } if (isSelected) { - el.addAttribute("isSelected", "true" ); + el.addAttribute("isSelected", "true" ); } } @@ -177,9 +145,9 @@ childSortKey, selected, children, - child.getURL() == null || - path == null ? null : - path + "/" + child.getURL(), + concatURLs && child.getURL() != null + ? path + child.getURL() + "/" + : null, idPath ); |
From: <ssk...@vh...> - 2006-07-13 11:04:23
|
Author: sskracic Date: 2006-07-13 12:58:49 +0200 (Thu, 13 Jul 2006) New Revision: 1256 Modified: trunk/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/category/AbstractTree.java Log: Integrated SF patch [ 1410665 ] poly-hierarchical list and default categories. Modified: trunk/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/category/AbstractTree.java =================================================================== --- trunk/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/category/AbstractTree.java 2006-07-13 10:13:37 UTC (rev 1255) +++ trunk/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/category/AbstractTree.java 2006-07-13 10:58:49 UTC (rev 1256) @@ -59,6 +59,7 @@ while (cats.next()) { Category category = cats.getCategory(); BigDecimal parentID = (BigDecimal)cats.get("parents.id"); + Boolean isDefault = (Boolean) cats.get("pa...@li...Default"); Set childList = (Set)children.get(parentID); if (childList == null) { @@ -68,7 +69,8 @@ childList.add(new CategorySortKeyPair (category, - (BigDecimal)cats.get("parents.link.sortKey"))); + (BigDecimal)cats.get("parents.link.sortKey"), + isDefault.booleanValue())); } String url = null; @@ -180,7 +182,11 @@ path + "/" + child.getURL(), idPath ); + if (childEl != null) { + boolean isDefault = pair.isDefault(); + childEl.addAttribute("isDefault", String.valueOf(isDefault)); + el.addContent(childEl); } } @@ -192,10 +198,12 @@ private class CategorySortKeyPair implements Comparable { private Category m_category; private BigDecimal m_sortKey; + private boolean m_isDefault; - public CategorySortKeyPair(Category category, BigDecimal sortKey) { + public CategorySortKeyPair(Category category, BigDecimal sortKey, boolean isDefault) { m_category = category; m_sortKey = sortKey; + m_isDefault = isDefault; } public Category getCategory() { return m_category; @@ -203,7 +211,9 @@ public BigDecimal getSortKey() { return m_sortKey; } - + public boolean isDefault() { + return m_isDefault; + } public int compareTo(Object o) { return m_sortKey.compareTo(((CategorySortKeyPair)o).m_sortKey); } |
From: <ssk...@vh...> - 2006-07-13 10:19:18
|
Author: sskracic Date: 2006-07-13 12:13:37 +0200 (Thu, 13 Jul 2006) New Revision: 1255 Modified: trunk/ccm-cms/src/com/arsdigita/cms/dispatcher/StreamImage.java Log: Integrated SF patch [ 1473663 ] invalid imageid causes error. Modified: trunk/ccm-cms/src/com/arsdigita/cms/dispatcher/StreamImage.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/dispatcher/StreamImage.java 2006-07-11 11:43:32 UTC (rev 1254) +++ trunk/ccm-cms/src/com/arsdigita/cms/dispatcher/StreamImage.java 2006-07-13 10:13:37 UTC (rev 1255) @@ -136,10 +136,8 @@ if (s_log.isInfoEnabled()) { s_log.info("no ImageAsset with oid " + oid); } - throw new ServletException - ((String) GlobalizationUtil.globalize - ("cms.dispatcher.could_not_find_imageasset").localize() + - oid); + response.sendError(404); + return; } } else { |
From: <ssk...@vh...> - 2006-07-11 11:49:15
|
Author: sskracic Date: 2006-07-11 13:43:32 +0200 (Tue, 11 Jul 2006) New Revision: 1254 Modified: trunk/ccm-ldn-navigation/src/com/arsdigita/london/navigation/DataCollectionRenderer.java trunk/ccm-ldn-navigation/src/com/arsdigita/london/navigation/cms/CMSDataCollectionRenderer.java Log: Added getStableURL() method to DataCollectionRenderer so that subclasses can provide their own implementation, which will end up in the nav:path element of object list XML. CMSDataCollectionRendered overrides this to provide stable URL of a content item, ie. the URL of a draft item, which is immutable. Modified: trunk/ccm-ldn-navigation/src/com/arsdigita/london/navigation/DataCollectionRenderer.java =================================================================== --- trunk/ccm-ldn-navigation/src/com/arsdigita/london/navigation/DataCollectionRenderer.java 2006-07-09 14:51:12 UTC (rev 1253) +++ trunk/ccm-ldn-navigation/src/com/arsdigita/london/navigation/DataCollectionRenderer.java 2006-07-11 11:43:32 UTC (rev 1254) @@ -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 @@ -39,8 +39,8 @@ import org.apache.log4j.Logger; public class DataCollectionRenderer extends LockableImpl { - - private static final Logger s_log = + + private static final Logger s_log = Logger.getLogger(DataCollectionRenderer.class); private ArrayList m_attributes = new ArrayList(); @@ -108,7 +108,7 @@ long objectCount = objects.size(); int pageCount = (int)Math.ceil((double)objectCount / (double)m_pageSize); - + if (pageNumber < 1) { pageNumber = 1; } @@ -116,15 +116,15 @@ if (pageNumber > pageCount) { pageNumber = (pageCount == 0 ? 1 : pageCount); } - + long begin = ((pageNumber-1) * m_pageSize); int count = (int)Math.min(m_pageSize, (objectCount - begin)); long end = begin + count; - + if (count != 0) { objects.setRange(new Integer((int)begin+1), new Integer((int)end+1)); } - + Element paginator = Navigation.newElement("paginator"); paginator.addAttribute("pageNumber", new Long(pageNumber).toString()); paginator.addAttribute("pageCount", new Long(pageCount).toString()); @@ -134,7 +134,7 @@ paginator.addAttribute("objectCount", new Long(objectCount).toString()); content.addContent(paginator); - + int index = 0; while (objects.next()) { DataObject dobj = objects.getDataObject(); @@ -149,8 +149,8 @@ Iterator attributes = m_attributes.iterator(); while (attributes.hasNext()) { String name = (String)attributes.next(); - String[] paths = StringUtils.split(name, '.'); - outputValue( item, dobj, name, paths, 0 ); + String[] paths = StringUtils.split(name, '.'); + outputValue( item, dobj, name, paths, 0 ); } Iterator properties = m_properties.iterator(); @@ -158,53 +158,55 @@ DataCollectionPropertyRenderer property = (DataCollectionPropertyRenderer) properties.next(); property.render( objects, item ); } - - OID oid = new OID((String)dobj.get(ACSObject.OBJECT_TYPE), - dobj.get(ACSObject.ID)); - String url = Navigation.redirectURL(oid); Element path = Navigation.newElement("path"); - path.setText(url); + path.setText(getStableURL(dobj, object)); item.addContent(path); - + generateItemXML(item, dobj, object, index); index++; content.addContent(item); } - + return content; } - private void outputValue( final Element item, final Object value, - final String name, - final String[] paths, final int depth ) { + protected String getStableURL(DataObject dobj, ACSObject obj) { + OID oid = new OID((String)dobj.get(ACSObject.OBJECT_TYPE), + dobj.get(ACSObject.ID)); + return Navigation.redirectURL(oid); + } + + private void outputValue( final Element item, final Object value, + final String name, + final String[] paths, final int depth ) { if( null == value ) return; - if( value instanceof DataAssociation ) { - DataAssociation assoc = (DataAssociation) value; - DataAssociationCursor cursor = assoc.cursor(); + if( value instanceof DataAssociation ) { + DataAssociation assoc = (DataAssociation) value; + DataAssociationCursor cursor = assoc.cursor(); - while( cursor.next() ) { - outputValue( item, cursor.getDataObject(), name, paths, depth ); - } + while( cursor.next() ) { + outputValue( item, cursor.getDataObject(), name, paths, depth ); + } - cursor.close(); - } + cursor.close(); + } - else if( value instanceof DataObject ) { - try { - Object newValue = ((DataObject) value).get( paths[depth] ); - outputValue( item, newValue, name, paths, depth + 1 ); - } catch( PersistenceException ex ) { - valuePersistenceError( ex, paths, depth ); - } - } + else if( value instanceof DataObject ) { + try { + Object newValue = ((DataObject) value).get( paths[depth] ); + outputValue( item, newValue, name, paths, depth + 1 ); + } catch( PersistenceException ex ) { + valuePersistenceError( ex, paths, depth ); + } + } - else if( depth == paths.length ) { - Element attribute = Navigation.newElement("attribute"); - attribute.addAttribute("name", name); - attribute.setText(value.toString()); + else if( depth == paths.length ) { + Element attribute = Navigation.newElement("attribute"); + attribute.addAttribute("name", name); + attribute.setText(value.toString()); if (value instanceof Date) { Date date = (Date) value; Calendar calDate = Calendar.getInstance(); @@ -216,25 +218,25 @@ attribute.addAttribute("minute", Integer.toString(calDate.get(Calendar.MINUTE))); attribute.addAttribute("second", Integer.toString(calDate.get(Calendar.SECOND))); } - item.addContent(attribute); - } + item.addContent(attribute); + } - else valuePersistenceError( null, paths, depth ); - } + else valuePersistenceError( null, paths, depth ); + } - private void valuePersistenceError( PersistenceException ex, - String[] paths, int depth ) { - StringBuffer msg = new StringBuffer(); - msg.append( "Attribute " ); - for( int i=0; i <= depth; i++ ) { - msg.append( paths[i] ); - if( i != depth ) msg.append( '.' ); - } - msg.append( " doesn't exist" ); + private void valuePersistenceError( PersistenceException ex, + String[] paths, int depth ) { + StringBuffer msg = new StringBuffer(); + msg.append( "Attribute " ); + for( int i=0; i <= depth; i++ ) { + msg.append( paths[i] ); + if( i != depth ) msg.append( '.' ); + } + msg.append( " doesn't exist" ); - if( null == ex ) s_log.warn( msg.toString() ); - else s_log.warn( msg.toString(), ex ); - } + if( null == ex ) s_log.warn( msg.toString() ); + else s_log.warn( msg.toString(), ex ); + } protected void generateItemXML(Element item, DataObject dobj, Modified: trunk/ccm-ldn-navigation/src/com/arsdigita/london/navigation/cms/CMSDataCollectionRenderer.java =================================================================== --- trunk/ccm-ldn-navigation/src/com/arsdigita/london/navigation/cms/CMSDataCollectionRenderer.java 2006-07-09 14:51:12 UTC (rev 1253) +++ trunk/ccm-ldn-navigation/src/com/arsdigita/london/navigation/cms/CMSDataCollectionRenderer.java 2006-07-11 11:43:32 UTC (rev 1254) @@ -18,9 +18,13 @@ package com.arsdigita.london.navigation.cms; +import com.arsdigita.cms.ContentItem; +import com.arsdigita.domain.DomainObjectFactory; +import com.arsdigita.kernel.ACSObject; import com.arsdigita.london.navigation.DataCollectionRenderer; -import com.arsdigita.kernel.ACSObject; +import com.arsdigita.london.navigation.Navigation; import com.arsdigita.persistence.DataObject; +import com.arsdigita.persistence.OID; import com.arsdigita.xml.Element; public class CMSDataCollectionRenderer extends DataCollectionRenderer { @@ -29,10 +33,22 @@ addAttribute("masterVersion.id"); } + protected String getStableURL(DataObject dobj, + ACSObject obj) { + if (obj == null) { + obj = (ACSObject) DomainObjectFactory.newInstance(dobj); + } + if (obj instanceof ContentItem) { + OID oid = ( (ContentItem) obj).getDraftVersion().getOID(); + return Navigation.redirectURL(oid); + } + return super.getStableURL(dobj, obj); + } + + protected void generateItemXML(Element item, DataObject dobj, ACSObject obj, int index) { - } } |
Author: sshinde Date: 2006-07-09 16:51:12 +0200 (Sun, 09 Jul 2006) New Revision: 1253 Added: contrib/ccm-ldn-camden-wordxml/trunk/web/packages/content-section/ contrib/ccm-ldn-camden-wordxml/trunk/web/packages/content-section/www/ contrib/ccm-ldn-camden-wordxml/trunk/web/packages/content-section/www/admin/ contrib/ccm-ldn-camden-wordxml/trunk/web/packages/content-section/www/admin/wordxml/ contrib/ccm-ldn-camden-wordxml/trunk/web/packages/content-section/www/admin/wordxml/download.jsp contrib/ccm-ldn-camden-wordxml/trunk/web/packages/content-section/www/admin/wordxml/serveimage.jsp Log: Add the missing JSP pages. Added: contrib/ccm-ldn-camden-wordxml/trunk/web/packages/content-section/www/admin/wordxml/download.jsp =================================================================== --- contrib/ccm-ldn-camden-wordxml/trunk/web/packages/content-section/www/admin/wordxml/download.jsp 2006-07-06 16:18:58 UTC (rev 1252) +++ contrib/ccm-ldn-camden-wordxml/trunk/web/packages/content-section/www/admin/wordxml/download.jsp 2006-07-09 14:51:12 UTC (rev 1253) @@ -0,0 +1,69 @@ +<jsp:root + xmlns:jsp="http://java.sun.com/JSP/Page" + xmlns:define="/WEB-INF/bebop-define.tld" + xmlns:show="/WEB-INF/bebop-show.tld" + version="1.2"> + + <jsp:directive.page import="java.math.BigDecimal"/> + <jsp:directive.page import="com.arsdigita.camden.cms.contenttypes.WordxmlResources"/> + <jsp:directive.page import="com.arsdigita.camden.cms.contenttypes.Wordxml"/> + <jsp:directive.page import="java.io.OutputStream"/> + <jsp:directive.page import="com.arsdigita.kernel.User"/> + <jsp:directive.page import="com.arsdigita.kernel.KernelHelper"/> + <jsp:directive.page import="com.arsdigita.kernel.permissions.PrivilegeDescriptor"/> + <jsp:directive.page import="com.arsdigita.cms.SecurityManager"/> + <jsp:directive.page import="com.arsdigita.kernel.permissions.PermissionDescriptor"/> + <jsp:directive.page import="com.arsdigita.kernel.permissions.PermissionService"/> + <jsp:directive.page import="com.arsdigita.dispatcher.AccessDeniedException"/> + <jsp:directive.page import="com.arsdigita.cms.util.GlobalizationUtil"/> + + <jsp:scriptlet> + BigDecimal itemID = null; + String contentField = null; + if (null != request.getParameter("itemID")) { + itemID = new BigDecimal(request.getParameter("itemID")); + } + if (null != request.getParameter("content")) { + contentField = request.getParameter("content"); + } + if (null == itemID || null == contentField) { + throw new IllegalArgumentException("Parameter itemID or content is Null"); + } + // Instantiate Item from itemID parameter. + Wordxml item = WordxmlResources.getWordxmlItem(itemID); + + // Check permission to read the item. + User user = KernelHelper.getCurrentUser(request); + + PrivilegeDescriptor view = PrivilegeDescriptor.get + (SecurityManager.CMS_READ_ITEM); + PermissionDescriptor perm = new PermissionDescriptor(view, item, user); + + if ( ! PermissionService.checkPermission(perm)) { + throw new AccessDeniedException( (String) GlobalizationUtil.globalize("cms.dispatcher.no_permission_to_access_resource").localize()); + } + + // Set the Headers +// StringBuffer disposition = new StringBuffer("inline; filename="); + StringBuffer disposition = new StringBuffer("attachment; filename="); + disposition.append('"').append(item.getFilename()).append('"'); + response.setHeader("Content-Disposition", disposition.toString()); + response.setContentType("application/octet-stream"); +// response.setContentType("text/html"); + + // Write out the data + String content = item.getContent(contentField); + if (null == content) { + content = "No Data Available"; + } + OutputStream os = response.getOutputStream(); + try { + response.setContentLength(content.getBytes().length); + os.write(content.getBytes()); + } finally { + os.close(); + } + + </jsp:scriptlet> + +</jsp:root> Added: contrib/ccm-ldn-camden-wordxml/trunk/web/packages/content-section/www/admin/wordxml/serveimage.jsp =================================================================== --- contrib/ccm-ldn-camden-wordxml/trunk/web/packages/content-section/www/admin/wordxml/serveimage.jsp 2006-07-06 16:18:58 UTC (rev 1252) +++ contrib/ccm-ldn-camden-wordxml/trunk/web/packages/content-section/www/admin/wordxml/serveimage.jsp 2006-07-09 14:51:12 UTC (rev 1253) @@ -0,0 +1,73 @@ +<jsp:root + xmlns:jsp="http://java.sun.com/JSP/Page" + xmlns:define="/WEB-INF/bebop-define.tld" + xmlns:show="/WEB-INF/bebop-show.tld" + version="1.2"> + + <jsp:directive.page import="java.math.BigDecimal"/> + <jsp:directive.page import="com.arsdigita.camden.cms.contenttypes.Wordxml"/> + <jsp:directive.page import="com.arsdigita.camden.cms.contenttypes.WordxmlResources"/> + <jsp:directive.page import="com.arsdigita.camden.cms.contenttypes.WordxmlImage"/> + <jsp:directive.page import="java.io.OutputStream"/> + <jsp:directive.page import="com.arsdigita.kernel.User"/> + <jsp:directive.page import="com.arsdigita.kernel.KernelHelper"/> + <jsp:directive.page import="com.arsdigita.kernel.permissions.PrivilegeDescriptor"/> + <jsp:directive.page import="com.arsdigita.cms.SecurityManager"/> + <jsp:directive.page import="com.arsdigita.kernel.permissions.PermissionDescriptor"/> + <jsp:directive.page import="com.arsdigita.kernel.permissions.PermissionService"/> + <jsp:directive.page import="com.arsdigita.dispatcher.AccessDeniedException"/> + <jsp:directive.page import="com.arsdigita.cms.util.GlobalizationUtil"/> + + <jsp:scriptlet> + BigDecimal itemID = null; + String imageName = null; + if (null != request.getParameter("itemID")) { + itemID = new BigDecimal(request.getParameter("itemID")); + } + if (null != request.getParameter("imgName")) { + imageName = request.getParameter("imgName"); + } + if (null == itemID || null == imageName) { + throw new IllegalArgumentException("Parameter itemID or imgName is Null"); + } + // Instantiate Item from itemID parameter. + Wordxml item = WordxmlResources.getWordxmlItem(itemID); + + // Check permission to read the item. + User user = KernelHelper.getCurrentUser(request); + + PrivilegeDescriptor view = PrivilegeDescriptor.get + (SecurityManager.CMS_READ_ITEM); + PermissionDescriptor perm = new PermissionDescriptor(view, item, user); + System.out.println("Current User is: " + user); + + if ( ! PermissionService.checkPermission(perm)) { + throw new AccessDeniedException( (String) GlobalizationUtil.globalize("cms.dispatcher.no_permission_to_access_resource").localize()); + } + + WordxmlImage image = item.getSingleImage(imageName); + // Collect the data + byte[] content; + System.out.println("Image is: " + image); + if (image == null || null == image.getContent()) { + content = new byte[0]; + } else { + content = image.getContent(); + } + + // Set the Headers + StringBuffer disposition = new StringBuffer("inline; filename="); + disposition.append('"').append(imageName).append('"'); + response.setHeader("Content-Disposition", disposition.toString()); + response.setContentType("image/jpeg"); + //Write Out the Data + OutputStream os = response.getOutputStream(); + try { + response.setContentLength(content.length); + os.write(content); + } finally { + os.close(); + } + </jsp:scriptlet> + +</jsp:root> |
From: <ss...@vh...> - 2006-07-06 16:24:13
|
Author: sshinde Date: 2006-07-06 18:18:58 +0200 (Thu, 06 Jul 2006) New Revision: 1252 Modified: contrib/ccm-ldn-camden-wordxml/trunk/src/WEB-INF/content-types/com/arsdigita/camden/cms/contenttypes/Wordxml.xml Log: Add the basic properties edit step. Modified: contrib/ccm-ldn-camden-wordxml/trunk/src/WEB-INF/content-types/com/arsdigita/camden/cms/contenttypes/Wordxml.xml =================================================================== --- contrib/ccm-ldn-camden-wordxml/trunk/src/WEB-INF/content-types/com/arsdigita/camden/cms/contenttypes/Wordxml.xml 2006-07-06 16:18:39 UTC (rev 1251) +++ contrib/ccm-ldn-camden-wordxml/trunk/src/WEB-INF/content-types/com/arsdigita/camden/cms/contenttypes/Wordxml.xml 2006-07-06 16:18:58 UTC (rev 1252) @@ -2,6 +2,12 @@ <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="Wordxml" description="An content type for Camden WordXML." objectType="com.arsdigita.camden.cms.contenttypes.Wordxml" classname="com.arsdigita.camden.cms.contenttypes.Wordxml"> <ctd:authoring-kit createComponent="com.arsdigita.cms.ui.authoring.PageCreate"> + <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.ui.authoring.PageEdit"/> <ctd:include href="/WEB-INF/content-types/assign-categories-step.xml"/> <ctd:authoring-step label="Wordxml File Properties" |
From: <ss...@vh...> - 2006-07-06 16:23:57
|
Author: sshinde Date: 2006-07-06 18:18:39 +0200 (Thu, 06 Jul 2006) New Revision: 1251 Modified: contrib/ccm-ldn-camden-wordxml/trunk/pdl/com/arsdigita/camden/cms/contenttypes/Wordxml.pdl Log: Fix the pdl association so deletion of associated images works transparently when item is deleted. Modified: contrib/ccm-ldn-camden-wordxml/trunk/pdl/com/arsdigita/camden/cms/contenttypes/Wordxml.pdl =================================================================== --- contrib/ccm-ldn-camden-wordxml/trunk/pdl/com/arsdigita/camden/cms/contenttypes/Wordxml.pdl 2006-07-06 13:10:14 UTC (rev 1250) +++ contrib/ccm-ldn-camden-wordxml/trunk/pdl/com/arsdigita/camden/cms/contenttypes/Wordxml.pdl 2006-07-06 16:18:39 UTC (rev 1251) @@ -37,6 +37,6 @@ } association { - Wordxml[1..1] wordxmlItem = join camden_wordxml_images.wordxml_id to camden_wordxml.wordxml_id; - WordxmlImage[0..n] wordxmlImages = join camden_wordxml.wordxml_id to camden_wordxml_images.wordxml_id; + composite Wordxml[1..1] wordxmlItem = join camden_wordxml_images.wordxml_id to camden_wordxml.wordxml_id; + component WordxmlImage[0..n] wordxmlImages = join camden_wordxml.wordxml_id to camden_wordxml_images.wordxml_id; } |
From: <ssk...@vh...> - 2006-07-06 13:16:05
|
Author: sskracic Date: 2006-07-06 15:10:14 +0200 (Thu, 06 Jul 2006) New Revision: 1250 Modified: trunk/ccm-ldn-rss/application.xml Log: Bumping the release number to reflect the latest fix to RSSService.java. Modified: trunk/ccm-ldn-rss/application.xml =================================================================== --- trunk/ccm-ldn-rss/application.xml 2006-07-05 13:43:42 UTC (rev 1249) +++ trunk/ccm-ldn-rss/application.xml 2006-07-06 13:10:14 UTC (rev 1250) @@ -3,7 +3,7 @@ name="ccm-ldn-rss" prettyName="RSS" version="6.3.0" - release="4"> + release="5"> <ccm:dependencies> <ccm:requires name="ccm-core" version="6.2.0" relation="ge"/> <ccm:requires name="ccm-cms" version="6.2.0" relation="ge"/> |
From: <ss...@vh...> - 2006-07-05 13:49:07
|
Author: sshinde Date: 2006-07-05 15:43:42 +0200 (Wed, 05 Jul 2006) New Revision: 1249 Modified: trunk/ccm-core/sql/ccm-core/default/categorization/table-cat_purposes.sql trunk/ccm-core/sql/ccm-core/oracle-se/upgrade/6.3.1-6.3.2/add_column_catpurpose_lang_default.sql Log: Fix Syntax Error during fresh loading of Oracle Schema. Modified: trunk/ccm-core/sql/ccm-core/default/categorization/table-cat_purposes.sql =================================================================== --- trunk/ccm-core/sql/ccm-core/default/categorization/table-cat_purposes.sql 2006-07-05 11:31:29 UTC (rev 1248) +++ trunk/ccm-core/sql/ccm-core/default/categorization/table-cat_purposes.sql 2006-07-05 13:43:42 UTC (rev 1249) @@ -30,5 +30,5 @@ language char(2) not null ); -alter table cat_purposes alter column language set default 'en'; +alter table cat_purposes modify language default 'en'; alter table cat_purposes add constraint cat_purposes_lang_un unique (key, language); Modified: trunk/ccm-core/sql/ccm-core/oracle-se/upgrade/6.3.1-6.3.2/add_column_catpurpose_lang_default.sql =================================================================== --- trunk/ccm-core/sql/ccm-core/oracle-se/upgrade/6.3.1-6.3.2/add_column_catpurpose_lang_default.sql 2006-07-05 11:31:29 UTC (rev 1248) +++ trunk/ccm-core/sql/ccm-core/oracle-se/upgrade/6.3.1-6.3.2/add_column_catpurpose_lang_default.sql 2006-07-05 13:43:42 UTC (rev 1249) @@ -1 +1 @@ -alter table cat_purposes alter column language set default 'en'; +alter table cat_purposes modify language default 'en'; |
From: <ssk...@vh...> - 2006-07-05 11:36:45
|
Author: sskracic Date: 2006-07-05 13:31:29 +0200 (Wed, 05 Jul 2006) New Revision: 1248 Modified: releases/1.0.3/ccm-core/application.xml releases/1.0.3/ccm-core/src/com/arsdigita/web/ui/ApplicationConfigFormSection.java Log: Integrated r1246 from trunk (allow portal URLs to be 100 chars long). Modified: releases/1.0.3/ccm-core/application.xml =================================================================== --- releases/1.0.3/ccm-core/application.xml 2006-07-05 11:06:47 UTC (rev 1247) +++ releases/1.0.3/ccm-core/application.xml 2006-07-05 11:31:29 UTC (rev 1248) @@ -3,7 +3,7 @@ name="ccm-core" prettyName="Core" version="6.2.0" - release="6" + release="7" webapp="ROOT" buildHooks="build-hooks.xml"> <ccm:dependencies> Modified: releases/1.0.3/ccm-core/src/com/arsdigita/web/ui/ApplicationConfigFormSection.java =================================================================== --- releases/1.0.3/ccm-core/src/com/arsdigita/web/ui/ApplicationConfigFormSection.java 2006-07-05 11:06:47 UTC (rev 1247) +++ releases/1.0.3/ccm-core/src/com/arsdigita/web/ui/ApplicationConfigFormSection.java 2006-07-05 11:31:29 UTC (rev 1248) @@ -117,7 +117,7 @@ m_url = new TextField(new StringParameter("url")); m_url.setSize(35); m_url.addValidationListener(new NotNullValidationListener()); - m_url.addValidationListener(new StringInRangeValidationListener(1, 30)); + m_url.addValidationListener(new StringInRangeValidationListener(1, 100)); m_title = new TextField(new StringParameter("title")); m_title.setSize(35); |
From: <ssk...@vh...> - 2006-07-05 11:12:11
|
Author: sskracic Date: 2006-07-05 13:06:47 +0200 (Wed, 05 Jul 2006) New Revision: 1247 Modified: releases/1.0.3/ccm-cms/application.xml Log: Bumping the release number for the latest backports from development trunk. Modified: releases/1.0.3/ccm-cms/application.xml =================================================================== --- releases/1.0.3/ccm-cms/application.xml 2006-07-04 09:58:04 UTC (rev 1246) +++ releases/1.0.3/ccm-cms/application.xml 2006-07-05 11:06:47 UTC (rev 1247) @@ -3,7 +3,7 @@ name="ccm-cms" prettyName="Red Hat CCM Content Management System" version="6.2.0" - release="9" + release="10" webapp="ROOT"> <ccm:dependencies> <ccm:requires name="ccm-core" version="6.2.0" relation="ge"/> |
From: <ssk...@vh...> - 2006-07-04 10:03:35
|
Author: sskracic Date: 2006-07-04 11:58:04 +0200 (Tue, 04 Jul 2006) New Revision: 1246 Modified: trunk/ccm-core/src/com/arsdigita/web/ui/ApplicationConfigFormSection.java Log: Allowed node names to be 100 chars long, since 30 chars seem to be too restrictive when whole path can be 4000 chars long. Modified: trunk/ccm-core/src/com/arsdigita/web/ui/ApplicationConfigFormSection.java =================================================================== --- trunk/ccm-core/src/com/arsdigita/web/ui/ApplicationConfigFormSection.java 2006-06-29 18:12:54 UTC (rev 1245) +++ trunk/ccm-core/src/com/arsdigita/web/ui/ApplicationConfigFormSection.java 2006-07-04 09:58:04 UTC (rev 1246) @@ -117,7 +117,7 @@ m_url = new TextField(new StringParameter("url")); m_url.setSize(35); m_url.addValidationListener(new NotNullValidationListener()); - m_url.addValidationListener(new StringInRangeValidationListener(1, 30)); + m_url.addValidationListener(new StringInRangeValidationListener(1, 100)); m_title = new TextField(new StringParameter("title")); m_title.setSize(35); |
From: <ap...@vh...> - 2006-06-29 18:18:04
|
Author: apevec Date: 2006-06-29 20:12:54 +0200 (Thu, 29 Jun 2006) New Revision: 1245 Modified: trunk/ccm-core/sql/ccm-core/postgres/upgrade/6.3.1-6.3.2/add_column_catpurpose_lang_default.sql Log: begin/end are in the main upgrade script Modified: trunk/ccm-core/sql/ccm-core/postgres/upgrade/6.3.1-6.3.2/add_column_catpurpose_lang_default.sql =================================================================== --- trunk/ccm-core/sql/ccm-core/postgres/upgrade/6.3.1-6.3.2/add_column_catpurpose_lang_default.sql 2006-06-29 11:08:27 UTC (rev 1244) +++ trunk/ccm-core/sql/ccm-core/postgres/upgrade/6.3.1-6.3.2/add_column_catpurpose_lang_default.sql 2006-06-29 18:12:54 UTC (rev 1245) @@ -1,3 +1 @@ -begin; alter table cat_purposes alter column language set default 'en'; -commit; |
From: <ap...@vh...> - 2006-06-29 11:13:37
|
Author: apevec Date: 2006-06-29 13:08:27 +0200 (Thu, 29 Jun 2006) New Revision: 1244 Added: releases/1.0.3/ccm-cms/src/com/arsdigita/cms/util/CMSResourceBundle.java Modified: releases/1.0.3/ccm-cms/src/com/arsdigita/cms/ui/item/ItemLanguagesTable.java releases/1.0.3/ccm-cms/src/com/arsdigita/cms/util/GlobalizationUtil.java releases/1.0.3/ccm-core/src/com/arsdigita/globalization/ChainedResourceBundle.java Log: backport from trunk: enable override of keys in CMSResources Modified: releases/1.0.3/ccm-cms/src/com/arsdigita/cms/ui/item/ItemLanguagesTable.java =================================================================== --- releases/1.0.3/ccm-cms/src/com/arsdigita/cms/ui/item/ItemLanguagesTable.java 2006-06-29 10:07:01 UTC (rev 1243) +++ releases/1.0.3/ccm-cms/src/com/arsdigita/cms/ui/item/ItemLanguagesTable.java 2006-06-29 11:08:27 UTC (rev 1244) @@ -47,11 +47,8 @@ /** - * Displays a table of publishing history for an item, with options - * to republish the item at any of its previous states. + * Displays a list of all language instances of an item. * - * @author Stanislav Freidin (sfr...@ar...) - * @version $Id$ */ public class ItemLanguagesTable extends DataTable { @@ -70,7 +67,7 @@ addColumn("cms.ui.language.header", ContentPage.LANGUAGE, false, new LanguageRenderer()); addColumn("cms.title", ContentPage.TITLE); m_deleteColumn = addColumn("cms.ui.action", new ActionCellRenderer(m_model)); - setResourceBundle(GlobalizationUtil.BUNDLE_NAME); + setResourceBundle(GlobalizationUtil.getBundleName()); addTableActionListener(new InstanceDeleter()); } Copied: releases/1.0.3/ccm-cms/src/com/arsdigita/cms/util/CMSResourceBundle.java (from rev 975, trunk/ccm-cms/src/com/arsdigita/cms/util/CMSResourceBundle.java) Modified: releases/1.0.3/ccm-cms/src/com/arsdigita/cms/util/GlobalizationUtil.java =================================================================== --- releases/1.0.3/ccm-cms/src/com/arsdigita/cms/util/GlobalizationUtil.java 2006-06-29 10:07:01 UTC (rev 1243) +++ releases/1.0.3/ccm-cms/src/com/arsdigita/cms/util/GlobalizationUtil.java 2006-06-29 11:08:27 UTC (rev 1244) @@ -18,7 +18,6 @@ */ package com.arsdigita.cms.util; -import com.arsdigita.cms.CMSGlobalized; import com.arsdigita.globalization.GlobalizedMessage; /** @@ -31,13 +30,29 @@ * @version $Revision: #7 $ $Date: 2004/08/17 $ */ -public class GlobalizationUtil implements CMSGlobalized { - - public static GlobalizedMessage globalize(String key) { - return new GlobalizedMessage(key, BUNDLE_NAME); - } - public static GlobalizedMessage globalize(String key, Object[] args) { - return new GlobalizedMessage(key, BUNDLE_NAME, args); - } +public class GlobalizationUtil { + public static String s_bundleName = "com.arsdigita.cms.util.CMSResourceBundle"; + + public static GlobalizedMessage globalize(String key) { + return new GlobalizedMessage(key, getBundleName()); + } + + public static GlobalizedMessage globalize(String key, Object[] args) { + return new GlobalizedMessage(key, getBundleName(), args); + } + + /* + * Not a part of API. Otherwise it would need to be properly synchronized. + * Only meant be used to override resource keys in CMSResources + * by a custom application, in Initializer. + */ + public static void internalSetBundleName(String bundleName) { + s_bundleName = bundleName; + } + + public static String getBundleName() { + return s_bundleName; + } + } Modified: releases/1.0.3/ccm-core/src/com/arsdigita/globalization/ChainedResourceBundle.java =================================================================== --- releases/1.0.3/ccm-core/src/com/arsdigita/globalization/ChainedResourceBundle.java 2006-06-29 10:07:01 UTC (rev 1243) +++ releases/1.0.3/ccm-core/src/com/arsdigita/globalization/ChainedResourceBundle.java 2006-06-29 11:08:27 UTC (rev 1244) @@ -18,6 +18,8 @@ */ package com.arsdigita.globalization; +import java.util.LinkedList; +import java.util.List; import java.util.ResourceBundle; import java.util.PropertyResourceBundle; import java.util.ListResourceBundle; @@ -44,13 +46,13 @@ **/ public class ChainedResourceBundle extends ResourceBundle { - private ArrayList m_bundles; - private ArrayList m_keys; + private List m_bundles; + private List m_keys; public ChainedResourceBundle() { super(); - m_bundles = new ArrayList(); - m_keys = new ArrayList(); + m_bundles = new LinkedList(); + m_keys = new LinkedList(); } /** @@ -73,14 +75,32 @@ * This adds bundles to this chained resource. The bundles * are examined for the key in the order that they are added. */ - public void addBundle(ChainableResourceBundle bundle) { + private void addBundle(ChainableResourceBundle bundle) { m_bundles.add(bundle); Enumeration enu = bundle.getKeys(); while (enu.hasMoreElements()) { m_keys.add(enu.nextElement()); } } + + public void putBundle(PropertyResourceBundle bundle) { + putBundle(new ChainablePropertyResourceBundle(bundle)); + } + + public void putBundle(ListResourceBundle bundle) { + putBundle(new ChainableListResourceBundle(bundle)); + } + private void putBundle(ChainableResourceBundle bundle) { + m_bundles.add(0,bundle); + Enumeration enu = bundle.getKeys(); + List bundleKeys = new LinkedList(); + while (enu.hasMoreElements()) { + bundleKeys.add(enu.nextElement()); + } + m_keys.addAll(0, bundleKeys); + } + /** * Because this particular bundle is just a wrapper around other bundles, * this method will return null so that the ResourceBundle can then |
From: <ap...@vh...> - 2006-06-29 10:12:00
|
Author: apevec Date: 2006-06-29 12:07:01 +0200 (Thu, 29 Jun 2006) New Revision: 1243 Modified: releases/1.0.3/ccm-cms/src/com/arsdigita/cms/workflow/CMSTask.java Log: merge _LASTAUTHOR from the trunk Modified: releases/1.0.3/ccm-cms/src/com/arsdigita/cms/workflow/CMSTask.java =================================================================== --- releases/1.0.3/ccm-cms/src/com/arsdigita/cms/workflow/CMSTask.java 2006-06-29 09:56:22 UTC (rev 1242) +++ releases/1.0.3/ccm-cms/src/com/arsdigita/cms/workflow/CMSTask.java 2006-06-29 10:07:01 UTC (rev 1243) @@ -43,6 +43,10 @@ import com.arsdigita.persistence.SessionManager; import com.arsdigita.persistence.metadata.ObjectType; import com.arsdigita.util.Assert; +import com.arsdigita.versioning.TagCollection; +import com.arsdigita.versioning.Transaction; +import com.arsdigita.versioning.TransactionCollection; +import com.arsdigita.versioning.Versions; import com.arsdigita.web.URL; import com.arsdigita.workflow.simple.TaskComment; import com.arsdigita.workflow.simple.TaskException; @@ -85,8 +89,15 @@ // a Map containing a list of the list of operations that // alerts should be sent out for private static final Map s_alerts = new HashMap(5); + private static final String ALERT_OPERATIONS = "operations"; + private static final String ALERT_RECIPIENTS = "recipients"; + private static final String ALERT_RECIPIENT_ALL = "_ALL"; + private static final String ALERT_RECIPIENT_LASTAUTHOR = "_LASTAUTHOR"; private static final Logger s_log = Logger.getLogger(CMSTask.class); + + private boolean m_authorOnly = false; + public CMSTask() { this(BASE_DATA_OBJECT_TYPE); } @@ -244,18 +255,18 @@ Assert.assertNotNull(item, "item associated with this CMSTask"); // for enable events, this will be the finish URL // for everything else, it will be the item authoring URL - String emailURL = null; + String emailURL; + String authoringURL = getAuthoringURL(item); if (ENABLE_OP.equals(operation)) { emailURL = getFinishURL(item.getID()); } else { - emailURL = getAuthoringURL(item); + emailURL = authoringURL; } - String fullURL = URL.there(emailURL, null).getURL(); // see CMSResources.properties for how these values are used - Object[] g11nArgs = new Object[9]; + Object[] g11nArgs = new Object[10]; g11nArgs[0] = item.getDisplayName(); g11nArgs[1] = new Double(getTaskType().doubleValue()); - g11nArgs[2] = fullURL; + g11nArgs[2] = URL.there(emailURL, null).getURL(); g11nArgs[3] = KernelHelper.getSiteName(); g11nArgs[4] = KernelHelper.getSystemAdministratorEmailAddress(); g11nArgs[5] = new Date(); @@ -273,6 +284,7 @@ g11nArgs[7] = (String) GlobalizationUtil.globalize("cms.ui.unknown").localize(); } g11nArgs[8] = getStartDate(); + g11nArgs[9] = URL.there(authoringURL, null).getURL(); String subject = (String) GlobalizationUtil.globalize("cms.ui.workflow.email.subject." + operation, g11nArgs).localize(); String body = (String) GlobalizationUtil.globalize("cms.ui.workflow.email.body." + operation, @@ -332,6 +344,7 @@ // UnfinishedTaskNotifier TimerTask, and that task will never // be scheduled unless we're supposed to send these messages Message msg = generateMessage(UNFINISHED_OP, sender); + m_authorOnly = false; sendMessageToAssignees(msg); } } @@ -352,20 +365,53 @@ typeMap = new HashMap(5); s_alerts.put(section.getID(), typeMap); } - Set operationSet = (Set) typeMap.get(typeLabel); + Map operations = (Map) typeMap.get(typeLabel); + if (operations == null) { + operations = new HashMap(2); + typeMap.put(typeLabel,operations); + } + Set operationSet = (Set) operations.get(ALERT_OPERATIONS); if (operationSet == null) { operationSet = new HashSet(5); - typeMap.put(typeLabel, operationSet); + operations.put(ALERT_OPERATIONS, operationSet); } + Set authorOnlySet = (Set) operations.get(ALERT_RECIPIENTS); + if (authorOnlySet == null) { + authorOnlySet = new HashSet(5); + operations.put(ALERT_RECIPIENTS, authorOnlySet); + } + // sufix _LASTAUTHOR to send the alert only to auditing.lastModifiedUser + // default if _ALL - send alert to all task assignees + String recipients = ALERT_RECIPIENT_ALL; + if (operation.endsWith(ALERT_RECIPIENT_LASTAUTHOR)) { + operation = operation.substring(0,operation.length() - ALERT_RECIPIENT_LASTAUTHOR.length()); + authorOnlySet.add(operation); + recipients = ALERT_RECIPIENT_LASTAUTHOR; + } else if (operation.endsWith(ALERT_RECIPIENT_ALL)) { + operation = operation.substring(0,operation.length() - ALERT_RECIPIENT_ALL.length()); + } operationSet.add(operation); s_log.info("Added alert for \"" + operation + "\" of " + typeLabel + - " task in section \"" + section.getName() + "\""); + " task in section \"" + section.getName() + "\" recipients flag: "+recipients); } protected static boolean shouldSendAlert(ContentSection section, + String typeLabel, + String operation) { + return checkAlertsConfig(section, typeLabel, operation, ALERT_OPERATIONS); + } + + protected static boolean shouldSendToAuthorOnly(ContentSection section, + String typeLabel, + String operation) { + return checkAlertsConfig(section, typeLabel, operation, ALERT_RECIPIENTS); + } + + private static boolean checkAlertsConfig(ContentSection section, String typeLabel, - String operation) { + String operation, + String field) { if (section == null || typeLabel == null || operation == null) { @@ -381,20 +427,24 @@ Map typeMap = (Map) s_alerts.get(section.getID()); Set operationSet = null; if (typeMap != null) { - operationSet = (Set) typeMap.get(typeLabel); + Map operations = (Map) typeMap.get(typeLabel); + if (operations != null) { + operationSet = (Set) operations.get(field); + } } if (operationSet != null) { send = operationSet.contains(operation); } - s_log.debug("Send email for operation " + operation + " of task " + typeLabel + "?: " + send); + s_log.debug("operation " + operation + " field " + field + " of task " + typeLabel + "?: " + send); return send; } protected boolean sendAlerts(String operation) { + ContentSection section = getContentSection(); + String label = getLabel(); + m_authorOnly = shouldSendToAuthorOnly(section, label, operation); return (super.sendAlerts(operation) && - shouldSendAlert(getContentSection(), - getLabel(), - operation)); + shouldSendAlert(section, label, operation)); } /** @@ -412,6 +462,37 @@ * @see #filterUsersAndSendMessage */ protected void sendMessageToAssignees(Message msg) { + if (m_authorOnly) { + ContentItem item = getItem(); + User author = null; + // XXX lastModifiedUser in audit trail is overwritten on each save + // author = item.getLastModifiedUser(); + // workaround: use the latest history record with 'Authored' tag + TransactionCollection hist = Versions.getTaggedTransactions(item.getOID()); + while (author == null && hist.next()) { + Transaction txn = hist.getTransaction(); + TagCollection tags = txn.getTags(); + while (tags.next()) { + String tag = tags.getTag().getDescription(); + if ("Authored".equals(tag)) { + author = txn.getUser(); + if (s_log.isDebugEnabled()) { + s_log.debug("author from hist="+author+" at "+txn.getTimestamp()); + } + } + } + } + if (author == null) { + // fallback: creator is always available in audit trail + author = item.getCreationUser(); + } + if (s_log.isDebugEnabled()) { + s_log.debug("spamming ONLY author " + author); + } + Notification notification = new Notification(author, msg); + notification.save(); + return; + } /* NOTE: * it would be cleaner to simply change getAssignedUsers() * to do what we want; however that is used by cms.ui.workflow.UserTaskComponent |