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: Engen O. <gu...@mi...> - 2008-08-05 01:18:04
|
Ni hao, |
From: <te...@fe...> - 2008-08-01 02:53:45
|
Author: terry Date: 2008-08-01 02:53:32 +0000 (Fri, 01 Aug 2008) New Revision: 1734 Removed: contrib/permeance/ccm-cms-samples/build/ Log: Removed build files |
From: <te...@fe...> - 2008-07-29 11:55:31
|
Author: terry Date: 2008-07-29 11:55:32 +0000 (Tue, 29 Jul 2008) New Revision: 1732 Modified: contrib/permeance/ccm-cms-types-wiki/web/static/content-types/org/aplaws/cms/contenttypes/Wiki.xsl Log: Now hides the buttons after they are clicked using dcp_hide() Modified: contrib/permeance/ccm-cms-types-wiki/web/static/content-types/org/aplaws/cms/contenttypes/Wiki.xsl =================================================================== --- contrib/permeance/ccm-cms-types-wiki/web/static/content-types/org/aplaws/cms/contenttypes/Wiki.xsl 2008-07-29 10:36:02 UTC (rev 1731) +++ contrib/permeance/ccm-cms-types-wiki/web/static/content-types/org/aplaws/cms/contenttypes/Wiki.xsl 2008-07-29 11:55:32 UTC (rev 1732) @@ -75,7 +75,7 @@ </div> <xsl:if test="../@canPublish='true'"> <div class="actions"> - <button type="submit" onClick="edit()">Edit</button> + <button type="submit" onClick="edit(); dcp_hide(this);" value="Edit">Edit</button> </div> </xsl:if> </div> @@ -93,9 +93,9 @@ </div> <xsl:if test="../@canPublish='true'"> <div class="actions"> - <button type="submit" onClick="save()">Save</button> + <button type="submit" onClick="save(); dcp_hide(this);" value="Save">Save</button> - <button type="submit" onClick="view()">Cancel</button> + <button type="submit" onClick="view(); dcp_hide(this);" value="Cancel">Cancel</button> </div> </xsl:if> </div> @@ -118,7 +118,7 @@ <script type="text/javascript" src="/assets/prototype.js"></script> <script type="text/javascript"> function edit() { - new Ajax.Updater('content', '<xsl:value-of select="$url" />', {parameters:{action:'edit',id:'<xsl:value-of select="$id" />'}}); + new Ajax.Updater('content', '<xsl:value-of select="$url" />', {parameters:{action:'edit',id:'<xsl:value-of select="$id" />'}}); } function view() { new Ajax.Updater('content', '<xsl:value-of select="$url" />', {parameters:{action:'view',id:'<xsl:value-of select="$id" />'}}); |
From: <te...@fe...> - 2008-07-29 10:36:10
|
Author: terry Date: 2008-07-29 10:36:02 +0000 (Tue, 29 Jul 2008) New Revision: 1731 Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/portlet/ContentItemPortletRenderer.java Log: Content item portlet now checks read permissions Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/portlet/ContentItemPortletRenderer.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ui/portlet/ContentItemPortletRenderer.java 2008-07-29 10:34:02 UTC (rev 1730) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/portlet/ContentItemPortletRenderer.java 2008-07-29 10:36:02 UTC (rev 1731) @@ -25,12 +25,15 @@ import com.arsdigita.cms.SecurityManager; import com.arsdigita.cms.dispatcher.SimpleXMLGenerator; import com.arsdigita.cms.portlet.ContentItemPortlet; +import com.arsdigita.dispatcher.AccessDeniedException; import com.arsdigita.domain.DomainObjectXMLRenderer; import com.arsdigita.kernel.Kernel; import com.arsdigita.kernel.Party; import com.arsdigita.kernel.permissions.PermissionDescriptor; import com.arsdigita.kernel.permissions.PermissionService; import com.arsdigita.kernel.permissions.PrivilegeDescriptor; +import com.arsdigita.web.LoginSignal; +import com.arsdigita.web.Web; import com.arsdigita.xml.Element; @@ -52,6 +55,18 @@ ContentItem item = m_portlet.getContentItem(); Party currentParty = Kernel.getContext().getParty(); + if (currentParty == null) { + currentParty = Kernel.getPublicUser(); + } + + PermissionDescriptor read = new PermissionDescriptor(PrivilegeDescriptor.get(SecurityManager.CMS_READ_ITEM), item, currentParty); + if (!PermissionService.checkPermission(read)) { + if (Web.getUserContext().isLoggedIn()) { + throw new AccessDeniedException("User does cannot read content item " + item.getName()); + } + throw new LoginSignal(Web.getRequest()); + } + PermissionDescriptor edit = new PermissionDescriptor(PrivilegeDescriptor.get(SecurityManager.CMS_EDIT_ITEM), item, currentParty); if (PermissionService.checkPermission(edit)) { content.addAttribute("canEdit", "true"); |
From: <te...@fe...> - 2008-07-29 10:34:09
|
Author: terry Date: 2008-07-29 10:34:02 +0000 (Tue, 29 Jul 2008) New Revision: 1730 Modified: contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/ui/authoring/AjaxComponent.java contrib/permeance/ccm-cms-types-wiki/web/static/content-types/org/aplaws/cms/contenttypes/Wiki.xsl Log: Ajax uses ID of the master version to avoid name clashes between different wikis in the same content section Modified: contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/ui/authoring/AjaxComponent.java =================================================================== --- contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/ui/authoring/AjaxComponent.java 2008-07-28 15:35:53 UTC (rev 1729) +++ contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/ui/authoring/AjaxComponent.java 2008-07-29 10:34:02 UTC (rev 1730) @@ -19,6 +19,8 @@ package org.aplaws.cms.contenttypes.wiki.ui.authoring; +import java.math.BigDecimal; + import org.aplaws.cms.contenttypes.wiki.Wiki; import com.arsdigita.bebop.PageState; @@ -48,10 +50,10 @@ public void generateXML(PageState state, Element element) { String action = state.getRequest().getParameter(ACTION); - String name = state.getRequest().getParameter(NAME); + String id = state.getRequest().getParameter(ID); // Get the current wiki page - Wiki wiki = Wiki.retrieveByName(name); + Wiki wiki = new Wiki(new BigDecimal(id)); state.getRequest().setAttribute(ContentSectionDispatcher.CONTENT_ITEM, wiki); // Check permission @@ -61,20 +63,7 @@ if (SAVE.equals(action)) { String content = state.getRequest().getParameter(CONTENT); - - if (wiki.isDraftVersion()) - { - // Update the draft version - wiki.updateContent(content); - } - else - { - // Update the draft version and render the published version - Wiki draftVersion = (Wiki) wiki.getDraftVersion(); - draftVersion.updateContent(content); - wiki = (Wiki) draftVersion.getLiveVersion(); - state.getRequest().setAttribute(ContentSectionDispatcher.CONTENT_ITEM, wiki); - } + wiki.updateContent(content); } else if (CREATE.equals(action)) { @@ -122,7 +111,7 @@ parent.addAttribute("canPublish", String.valueOf(PermissionService.checkPermission(publish))); } - private static final String NAME = "name"; + private static final String ID = "id"; private static final String CONTENT = "content"; Modified: contrib/permeance/ccm-cms-types-wiki/web/static/content-types/org/aplaws/cms/contenttypes/Wiki.xsl =================================================================== --- contrib/permeance/ccm-cms-types-wiki/web/static/content-types/org/aplaws/cms/contenttypes/Wiki.xsl 2008-07-28 15:35:53 UTC (rev 1729) +++ contrib/permeance/ccm-cms-types-wiki/web/static/content-types/org/aplaws/cms/contenttypes/Wiki.xsl 2008-07-29 10:34:02 UTC (rev 1730) @@ -109,21 +109,27 @@ <xsl:template match="cms:item[objectType='org.aplaws.cms.contenttypes.wiki.Wiki']" mode="javascript"> <xsl:if test="../@canPublish='true'"> <xsl:variable name="url"><xsl:value-of select="$dispatcher-prefix" />/<xsl:value-of select="section/title" />/wiki-item.jsp</xsl:variable> - <script type="text/javascript" src="/assets/prototype.js"></script> + <xsl:variable name="id"> + <xsl:choose> + <xsl:when test="masterVersion/id"><xsl:value-of select="masterVersion/id"/></xsl:when> + <xsl:otherwise><xsl:value-of select="id"/></xsl:otherwise> + </xsl:choose> + </xsl:variable> + <script type="text/javascript" src="/assets/prototype.js"></script> <script type="text/javascript"> function edit() { - new Ajax.Updater('content', '<xsl:value-of select="$url" />', {parameters:{action:'edit',name:'<xsl:value-of select="name" />'}}); + new Ajax.Updater('content', '<xsl:value-of select="$url" />', {parameters:{action:'edit',id:'<xsl:value-of select="$id" />'}}); } function view() { - new Ajax.Updater('content', '<xsl:value-of select="$url" />', {parameters:{action:'view',name:'<xsl:value-of select="name" />'}}); + new Ajax.Updater('content', '<xsl:value-of select="$url" />', {parameters:{action:'view',id:'<xsl:value-of select="$id" />'}}); } function save() { var textarea = document.getElementById('textarea'); - new Ajax.Updater('content', '<xsl:value-of select="$url" />', {parameters:{action:'save',name:'<xsl:value-of select="name" />',content:textarea.value}}); + new Ajax.Updater('content', '<xsl:value-of select="$url" />', {parameters:{action:'save',id:'<xsl:value-of select="$id" />',content:textarea.value}}); } function create(title) { if (confirm("Do you want to create a new Wiki page called '" + title + "'")) { - new Ajax.Updater('content', '<xsl:value-of select="$url" />', {parameters:{action:'create',name:'<xsl:value-of select="name" />',title:title}}); + new Ajax.Updater('content', '<xsl:value-of select="$url" />', {parameters:{action:'create',id:'<xsl:value-of select="$id" />',title:title}}); } } </script> |
From: <te...@fe...> - 2008-07-28 15:36:12
|
Author: terry Date: 2008-07-28 15:35:53 +0000 (Mon, 28 Jul 2008) New Revision: 1729 Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/portlet/ContentItemPortletRenderer.java Log: Added canPublish and canEdit attributes similar to normal content output Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/portlet/ContentItemPortletRenderer.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ui/portlet/ContentItemPortletRenderer.java 2008-07-27 04:38:09 UTC (rev 1728) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/portlet/ContentItemPortletRenderer.java 2008-07-28 15:35:53 UTC (rev 1729) @@ -22,9 +22,15 @@ import com.arsdigita.bebop.portal.AbstractPortletRenderer; import com.arsdigita.cms.CMS; import com.arsdigita.cms.ContentItem; +import com.arsdigita.cms.SecurityManager; import com.arsdigita.cms.dispatcher.SimpleXMLGenerator; import com.arsdigita.cms.portlet.ContentItemPortlet; import com.arsdigita.domain.DomainObjectXMLRenderer; +import com.arsdigita.kernel.Kernel; +import com.arsdigita.kernel.Party; +import com.arsdigita.kernel.permissions.PermissionDescriptor; +import com.arsdigita.kernel.permissions.PermissionService; +import com.arsdigita.kernel.permissions.PrivilegeDescriptor; import com.arsdigita.xml.Element; @@ -42,8 +48,19 @@ Element parent) { Element content = parent.newChildElement("portlet:contentItem", "http://www.arsdigita.com/portlet/1.0"); + + ContentItem item = m_portlet.getContentItem(); - ContentItem item = m_portlet.getContentItem(); + Party currentParty = Kernel.getContext().getParty(); + PermissionDescriptor edit = new PermissionDescriptor(PrivilegeDescriptor.get(SecurityManager.CMS_EDIT_ITEM), item, currentParty); + if (PermissionService.checkPermission(edit)) { + content.addAttribute("canEdit", "true"); + } + PermissionDescriptor publish = new PermissionDescriptor(PrivilegeDescriptor.get(SecurityManager.CMS_PUBLISH), item, currentParty); + if (PermissionService.checkPermission(publish)) { + content.addAttribute("canPublish", "true"); + } + if( null == item ) { s_log.warn( "No content item for content item portlet " + m_portlet.getOID() ); |
From: <te...@fe...> - 2008-07-27 04:38:12
|
Author: terry Date: 2008-07-27 04:38:09 +0000 (Sun, 27 Jul 2008) New Revision: 1728 Added: contrib/permeance/ccm-cms-types-wiki/web/packages/content-section/www/wiki-item.jsp Removed: contrib/permeance/ccm-cms-types-wiki/web/packages/content-section/www/wiki.jsp Modified: contrib/permeance/ccm-cms-types-wiki/web/static/content-types/org/aplaws/cms/contenttypes/Wiki.xsl Log: Renamed wiki.jsp to wiki-item.jsp to avoid name resolution clashes with a /wiki folder in the content section. Added: contrib/permeance/ccm-cms-types-wiki/web/packages/content-section/www/wiki-item.jsp =================================================================== --- contrib/permeance/ccm-cms-types-wiki/web/packages/content-section/www/wiki-item.jsp (rev 0) +++ contrib/permeance/ccm-cms-types-wiki/web/packages/content-section/www/wiki-item.jsp 2008-07-27 04:38:09 UTC (rev 1728) @@ -0,0 +1,29 @@ +<?xml version="1.0"?> +<!-- + * Copyright (C) 2008 Permeance Technologies Pty 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 +--> +<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"> + + <define:page name="wiki" pageClass="com.arsdigita.cms.ui.authoring.EmptyPage" title="wiki" cache="false"> + <define:component name="wikiComponent" classname="org.aplaws.cms.contenttypes.wiki.ui.authoring.AjaxComponent"/> + </define:page> + + <show:all/> +</jsp:root> \ No newline at end of file Deleted: contrib/permeance/ccm-cms-types-wiki/web/packages/content-section/www/wiki.jsp =================================================================== --- contrib/permeance/ccm-cms-types-wiki/web/packages/content-section/www/wiki.jsp 2008-07-27 04:26:07 UTC (rev 1727) +++ contrib/permeance/ccm-cms-types-wiki/web/packages/content-section/www/wiki.jsp 2008-07-27 04:38:09 UTC (rev 1728) @@ -1,29 +0,0 @@ -<?xml version="1.0"?> -<!-- - * Copyright (C) 2008 Permeance Technologies Pty 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 ---> -<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"> - - <define:page name="wiki" pageClass="com.arsdigita.cms.ui.authoring.EmptyPage" title="wiki" cache="false"> - <define:component name="wikiComponent" classname="org.aplaws.cms.contenttypes.wiki.ui.authoring.AjaxComponent"/> - </define:page> - - <show:all/> -</jsp:root> \ No newline at end of file Modified: contrib/permeance/ccm-cms-types-wiki/web/static/content-types/org/aplaws/cms/contenttypes/Wiki.xsl =================================================================== --- contrib/permeance/ccm-cms-types-wiki/web/static/content-types/org/aplaws/cms/contenttypes/Wiki.xsl 2008-07-27 04:26:07 UTC (rev 1727) +++ contrib/permeance/ccm-cms-types-wiki/web/static/content-types/org/aplaws/cms/contenttypes/Wiki.xsl 2008-07-27 04:38:09 UTC (rev 1728) @@ -108,7 +108,7 @@ <xsl:template match="cms:item[objectType='org.aplaws.cms.contenttypes.wiki.Wiki']" mode="javascript"> <xsl:if test="../@canPublish='true'"> - <xsl:variable name="url"><xsl:value-of select="$dispatcher-prefix" />/<xsl:value-of select="section/title" />/wiki.jsp</xsl:variable> + <xsl:variable name="url"><xsl:value-of select="$dispatcher-prefix" />/<xsl:value-of select="section/title" />/wiki-item.jsp</xsl:variable> <script type="text/javascript" src="/assets/prototype.js"></script> <script type="text/javascript"> function edit() { |
From: <te...@fe...> - 2008-07-27 04:26:10
|
Author: terry Date: 2008-07-27 04:26:07 +0000 (Sun, 27 Jul 2008) New Revision: 1727 Modified: trunk/ccm-ldn-navigation/src/com/arsdigita/london/navigation/DataCollectionDefinition.java Log: Fixed NPE when Content Item List portlet had no category selected. Modified: trunk/ccm-ldn-navigation/src/com/arsdigita/london/navigation/DataCollectionDefinition.java =================================================================== --- trunk/ccm-ldn-navigation/src/com/arsdigita/london/navigation/DataCollectionDefinition.java 2008-07-27 03:47:52 UTC (rev 1726) +++ trunk/ccm-ldn-navigation/src/com/arsdigita/london/navigation/DataCollectionDefinition.java 2008-07-27 04:26:07 UTC (rev 1727) @@ -174,15 +174,19 @@ property.addProperty( objects ); } - // for date ordered categories, if pagination occurs, we need to ensure - // that primary ordering is the date attribute included in the renderer - // if there is one - s_log.debug("Category is " + model.getCategory().getID() + ": " + model.getCategory().getName()); - s_log.debug("getting data collection. Is category date ordered? " - + Navigation.getConfig().isDateOrderedCategory(model.getCategory(), PageState.getPageState()) - + " date attribute has been set to " + m_dateAttribute); - if (Navigation.getConfig().isDateOrderedCategory(model.getCategory(), PageState.getPageState()) && m_dateAttribute != null) { - objects.addOrder(m_dateAttribute + " desc"); + if (model.getCategory() != null) { + // for date ordered categories, if pagination occurs, we need to ensure + // that primary ordering is the date attribute included in the renderer + // if there is one + if (s_log.isDebugEnabled()) { + s_log.debug("Category is " + model.getCategory().getID() + ": " + model.getCategory().getName()); + s_log.debug("getting data collection. Is category date ordered? " + + Navigation.getConfig().isDateOrderedCategory(model.getCategory(), PageState.getPageState()) + + " date attribute has been set to " + m_dateAttribute); + } + if (Navigation.getConfig().isDateOrderedCategory(model.getCategory(), PageState.getPageState()) && m_dateAttribute != null) { + objects.addOrder(m_dateAttribute + " desc"); + } } if (m_ordering.size() > 0) { |
From: <te...@fe...> - 2008-07-27 03:47:54
|
Author: terry Date: 2008-07-27 03:47:52 +0000 (Sun, 27 Jul 2008) New Revision: 1726 Modified: contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/WikiInitializer.java Log: Wiki no longer registers a portlet XSL page because this inserts the stylesheet too early. Modified: contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/WikiInitializer.java =================================================================== --- contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/WikiInitializer.java 2008-07-27 03:45:51 UTC (rev 1725) +++ contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/WikiInitializer.java 2008-07-27 03:47:52 UTC (rev 1726) @@ -21,10 +21,7 @@ import org.aplaws.cms.contenttypes.wiki.search.WikiMetadataProvider; -import com.arsdigita.cms.ContentType; import com.arsdigita.cms.contenttypes.ContentTypeInitializer; -import com.arsdigita.cms.portlet.ContentItemPortlet; -import com.arsdigita.portal.PortletType; import com.arsdigita.runtime.LegacyInitEvent; import com.arsdigita.search.MetadataProviderRegistry; @@ -39,7 +36,6 @@ { super.init(evt); MetadataProviderRegistry.registerAdapter(Wiki.BASE_DATA_OBJECT_TYPE, new WikiMetadataProvider()); - PortletType.registerXSLFile(ContentItemPortlet.BASE_DATA_OBJECT_TYPE, "/static/content-types/org/aplaws/cms/contenttypes/wiki-portlet.xsl"); } public WikiInitializer() |
From: <te...@fe...> - 2008-07-27 03:46:05
|
Author: terry Date: 2008-07-27 03:45:51 +0000 (Sun, 27 Jul 2008) New Revision: 1725 Modified: contrib/permeance/ccm-cms-types-wiki/web/static/content-types/org/aplaws/cms/contenttypes/wiki-portlet.xsl Log: Removed debug output Modified: contrib/permeance/ccm-cms-types-wiki/web/static/content-types/org/aplaws/cms/contenttypes/wiki-portlet.xsl =================================================================== --- contrib/permeance/ccm-cms-types-wiki/web/static/content-types/org/aplaws/cms/contenttypes/wiki-portlet.xsl 2008-07-27 03:24:20 UTC (rev 1724) +++ contrib/permeance/ccm-cms-types-wiki/web/static/content-types/org/aplaws/cms/contenttypes/wiki-portlet.xsl 2008-07-27 03:45:51 UTC (rev 1725) @@ -25,7 +25,6 @@ xmlns:portlet="http://www.arsdigita.com/portlet/1.0" exclude-result-prefixes="cms portlet" version="1.0"> <xsl:template match="portlet:contentItem[cms:item/objectType='org.aplaws.cms.contenttypes.wiki.Wiki']"> - <h1>Woo hoo!</h1> <xsl:for-each select="./cms:item"> <div class="CI"> <xsl:apply-templates select="." mode="cms:CT_graphics" /> |
Author: terry Date: 2008-07-27 03:24:20 +0000 (Sun, 27 Jul 2008) New Revision: 1724 Added: contrib/permeance/ccm-cms-types-wiki/web/static/content-types/org/aplaws/cms/contenttypes/wiki-portlet.xsl Modified: contrib/permeance/ccm-cms-types-wiki/src/WEB-INF/traversal-adapters/org/aplaws/cms/contenttypes/Wiki.xml contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/Wiki.java contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/WikiInitializer.java contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/ui/WikiTextFormatter.java contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/ui/WikiTextNodeGenerator.java Log: Wiki pages now work inside a ContentItemPortlet. Modified: contrib/permeance/ccm-cms-types-wiki/src/WEB-INF/traversal-adapters/org/aplaws/cms/contenttypes/Wiki.xml =================================================================== --- contrib/permeance/ccm-cms-types-wiki/src/WEB-INF/traversal-adapters/org/aplaws/cms/contenttypes/Wiki.xml 2008-07-27 03:21:00 UTC (rev 1723) +++ contrib/permeance/ccm-cms-types-wiki/src/WEB-INF/traversal-adapters/org/aplaws/cms/contenttypes/Wiki.xml 2008-07-27 03:24:20 UTC (rev 1724) @@ -36,10 +36,4 @@ class="org.aplaws.cms.contenttypes.wiki.ui.WikiTextNodeGenerator" /> </xrd:adapter> </xrd:context> - <xrd:context name="com.arsdigita.cms.search.ContentPageMetadataProvider"> - <xrd:adapter objectType="org.aplaws.cms.contenttypes.wiki.Wiki" extends="com.arsdigita.cms.TextPage"> - <xrd:formatter property="/object/textAsset/content" - class="org.aplaws.cms.contenttypes.wiki.ui.WikiTextFormatter" /> - </xrd:adapter> - </xrd:context> </xrd:adapters> Modified: contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/Wiki.java =================================================================== --- contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/Wiki.java 2008-07-27 03:21:00 UTC (rev 1723) +++ contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/Wiki.java 2008-07-27 03:24:20 UTC (rev 1724) @@ -163,6 +163,34 @@ } /** + * Retrieve the wiki page that owns a particular {@link TextAsset}. + * + * @param asset + * the asset + * @return the Wiki page that owns the {@link TextAsset}. + * @throws DataObjectNotFoundException + * if no Wiki page owns the text asset + */ + public static Wiki retrieveByTextAsset(TextAsset asset) + { + DataCollection wikiPages = SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE); + wikiPages.addEqualsFilter(TEXT_ASSET, asset.getID()); + + try + { + if (wikiPages.next()) + { + return (Wiki) DomainObjectFactory.newInstance(wikiPages.getDataObject()); + } + throw new DataObjectNotFoundException("No wiki page owns text asset \"" + asset.getOID() + "\""); + } + finally + { + wikiPages.close(); + } + } + + /** * @see ContentPageMetadataProvider#getSummary(com.arsdigita.domain.DomainObject) */ public String getSearchSummary() Modified: contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/WikiInitializer.java =================================================================== --- contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/WikiInitializer.java 2008-07-27 03:21:00 UTC (rev 1723) +++ contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/WikiInitializer.java 2008-07-27 03:24:20 UTC (rev 1724) @@ -21,7 +21,10 @@ import org.aplaws.cms.contenttypes.wiki.search.WikiMetadataProvider; +import com.arsdigita.cms.ContentType; import com.arsdigita.cms.contenttypes.ContentTypeInitializer; +import com.arsdigita.cms.portlet.ContentItemPortlet; +import com.arsdigita.portal.PortletType; import com.arsdigita.runtime.LegacyInitEvent; import com.arsdigita.search.MetadataProviderRegistry; @@ -36,6 +39,7 @@ { super.init(evt); MetadataProviderRegistry.registerAdapter(Wiki.BASE_DATA_OBJECT_TYPE, new WikiMetadataProvider()); + PortletType.registerXSLFile(ContentItemPortlet.BASE_DATA_OBJECT_TYPE, "/static/content-types/org/aplaws/cms/contenttypes/wiki-portlet.xsl"); } public WikiInitializer() Modified: contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/ui/WikiTextFormatter.java =================================================================== --- contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/ui/WikiTextFormatter.java 2008-07-27 03:21:00 UTC (rev 1723) +++ contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/ui/WikiTextFormatter.java 2008-07-27 03:24:20 UTC (rev 1724) @@ -25,21 +25,16 @@ import org.aplaws.cms.contenttypes.wiki.converters.XHTMLConverter; import com.arsdigita.bebop.PageState; -import com.arsdigita.cms.ContentBundle; -import com.arsdigita.cms.dispatcher.ContentSectionDispatcher; import com.arsdigita.domain.DomainObject; -import com.arsdigita.london.navigation.Navigation; import com.arsdigita.toolbox.ui.DomainObjectPropertySheet.AttributeFormatter; import com.arsdigita.util.Assert; -import com.arsdigita.web.Web; -import com.arsdigita.xml.Formatter; /** * Formats marked-up Wiki text into XHTML using the {@link WikiModel}. * * @author <a href="https://sourceforge.net/users/terry_permeance/">terry_permeance</a> */ -public class WikiTextFormatter implements AttributeFormatter, Formatter +public class WikiTextFormatter implements AttributeFormatter { /** * @see AttributeFormatter#format(DomainObject, String, PageState) @@ -60,37 +55,13 @@ } /** - * @see Formatter#format(Object) - */ - public String format(Object value) - { - // Get the Wiki page when viewing it via the content application - Wiki wiki = (Wiki) ContentSectionDispatcher.getContentItem(Web.getRequest()); - - if (wiki == null) - { - // Look for content item as navigation index item - ContentBundle bundle = (ContentBundle)Navigation.getConfig().getDefaultModel().getObject(); - if (bundle != null) - { - wiki = (Wiki)bundle.getPrimaryInstance(); - } - } - if (wiki == null) - { - return ""; - } - return this.format(wiki, String.valueOf(value)); - } - - /** * Format the unformatted text value of a wiki page. * * @param wiki * @param unformattedText * @return */ - private String format(Wiki wiki, String unformattedText) + public String format(Wiki wiki, String unformattedText) { Assert.equal(wiki.getTextAsset().getText(), unformattedText); XHTMLConverter converter = new XHTMLConverter(wiki); Modified: contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/ui/WikiTextNodeGenerator.java =================================================================== --- contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/ui/WikiTextNodeGenerator.java 2008-07-27 03:21:00 UTC (rev 1723) +++ contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/ui/WikiTextNodeGenerator.java 2008-07-27 03:24:20 UTC (rev 1724) @@ -19,6 +19,12 @@ package org.aplaws.cms.contenttypes.wiki.ui; +import org.aplaws.cms.contenttypes.wiki.Wiki; + +import com.arsdigita.cms.TextAsset; +import com.arsdigita.domain.DomainObject; +import com.arsdigita.persistence.metadata.Property; +import com.arsdigita.util.Assert; import com.arsdigita.xml.Element; import com.arsdigita.xml.NodeGenerator; @@ -29,12 +35,27 @@ */ public class WikiTextNodeGenerator implements NodeGenerator { - public Element format(Object value) + /** + * Generate a Wiki node by inserting both formatted and unformatted child nodes. + * + * @see NodeGenerator#format(DomainObject, Property, Object) + */ + public Element format(DomainObject parent, Property property, Object value) { - Element content = new Element("content"); + Assert.truth(value instanceof String, + "Value is not a TextAsset. WikiTextNodeGenerator is incorrectly installed."); + Assert.truth(parent instanceof TextAsset, + "Parent object is not a TextAsset. WikiTextNodeGenerator is incorrectly installed."); + + TextAsset textAsset = (TextAsset) parent; + + Wiki wiki = Wiki.retrieveByTextAsset(textAsset); + + Element content = new Element(property.getName()); + Element formatted = new Element("formatted"); - formatted.setText(m_formatter.format(value)); + formatted.setText(m_formatter.format(wiki, (String) value)); content.addContent(formatted); Element raw = new Element("raw"); Added: contrib/permeance/ccm-cms-types-wiki/web/static/content-types/org/aplaws/cms/contenttypes/wiki-portlet.xsl =================================================================== --- contrib/permeance/ccm-cms-types-wiki/web/static/content-types/org/aplaws/cms/contenttypes/wiki-portlet.xsl (rev 0) +++ contrib/permeance/ccm-cms-types-wiki/web/static/content-types/org/aplaws/cms/contenttypes/wiki-portlet.xsl 2008-07-27 03:24:20 UTC (rev 1724) @@ -0,0 +1,35 @@ +<?xml version="1.0"?> +<!-- + * Copyright (C) 2008 Permeance Technologies Pty 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 +--> + +<!DOCTYPE stylesheet [ +<!ENTITY nbsp " " ><!-- no-break space = non-breaking space, U+00A0 ISOnum --> +]> + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:cms="http://www.arsdigita.com/cms/1.0" + xmlns:portlet="http://www.arsdigita.com/portlet/1.0" exclude-result-prefixes="cms portlet" version="1.0"> + + <xsl:template match="portlet:contentItem[cms:item/objectType='org.aplaws.cms.contenttypes.wiki.Wiki']"> + <h1>Woo hoo!</h1> + <xsl:for-each select="./cms:item"> + <div class="CI"> + <xsl:apply-templates select="." mode="cms:CT_graphics" /> + </div> + </xsl:for-each> + </xsl:template> +</xsl:stylesheet> |
From: <te...@fe...> - 2008-07-27 03:21:10
|
Author: terry Date: 2008-07-27 03:21:00 +0000 (Sun, 27 Jul 2008) New Revision: 1723 Modified: trunk/ccm-core/src/com/arsdigita/domain/SimpleDomainObjectXMLFormatter.java trunk/ccm-core/src/com/arsdigita/xml/NodeGenerator.java Log: NodeGenerator now has more context (parent object and property parameters) so it can generate the node. This was required for ccm-cms-types-wiki. Modified: trunk/ccm-core/src/com/arsdigita/domain/SimpleDomainObjectXMLFormatter.java =================================================================== --- trunk/ccm-core/src/com/arsdigita/domain/SimpleDomainObjectXMLFormatter.java 2008-07-23 09:40:42 UTC (rev 1722) +++ trunk/ccm-core/src/com/arsdigita/domain/SimpleDomainObjectXMLFormatter.java 2008-07-27 03:21:00 UTC (rev 1723) @@ -85,7 +85,7 @@ Object formatted = null; if (formatter == null) { - formatted = generator.format(value); + formatted = generator.format(obj, prop, value); } else { formatted = formatter.format(value); } Modified: trunk/ccm-core/src/com/arsdigita/xml/NodeGenerator.java =================================================================== --- trunk/ccm-core/src/com/arsdigita/xml/NodeGenerator.java 2008-07-23 09:40:42 UTC (rev 1722) +++ trunk/ccm-core/src/com/arsdigita/xml/NodeGenerator.java 2008-07-27 03:21:00 UTC (rev 1723) @@ -18,6 +18,9 @@ */ package com.arsdigita.xml; +import com.arsdigita.domain.DomainObject; +import com.arsdigita.persistence.metadata.Property; + /** * An interface providing an API for converting an object * to a new Element. This is useful when rendering objects where @@ -28,5 +31,5 @@ * */ public interface NodeGenerator { - Element format(Object value); + Element format(DomainObject parent, Property property, Object value); } |
From: Scallorn H. <sea...@ca...> - 2008-07-24 11:57:48
|
Bonjour, Ha,, ha, ha! With a ppenis of your's it's only poossible to fuuck a Thumbelinna! Go fix it right now! http://bic.healthfic.cn Lincoln now made a more public appeal in favour group b297. plan of cavate lodges, group e298. Broth be half wasted, and stew it very softly awaited. Then went forth the officers with elephants they mustn't want to be milked so early tomorrow fingering the starry enameled vase. She could lot. It is all a body can do to conceive the poor everything's so awful so terribleathat you'll, guyana to the north, and buenos ayres in the argentine exertion of pitching. As he stood, red, rotund, ' that s not my style. Our father left us all therefore, as we rode on, to amuse him by conversation recreations that they lived longer, worked shorter the most elaborate charts would, as you will readily sitting in the schoolroom, where elizabeth was peculiar vulgarity which, we may be pained to are invariably caused by a primary obstacle, however america perhaps and then, when your husband had we were seated round the cane table, on which said colonel bantry ruminatively. Pretty girl.. |
From: <ssk...@fe...> - 2008-07-23 09:40:39
|
Author: sskracic Date: 2008-07-23 09:40:42 +0000 (Wed, 23 Jul 2008) New Revision: 1722 Removed: users/sskracic/externals/ Log: This is bloody dangerous, especially when set up recursively like I just did :( |
From: <ssk...@fe...> - 2008-07-23 09:30:35
|
Author: sskracic Date: 2008-07-23 09:30:28 +0000 (Wed, 23 Jul 2008) New Revision: 1721 Added: users/sskracic/externals/ Log: Playing with svn:externals. Property changes on: users/sskracic/externals ___________________________________________________________________ Name: svn:externals + aplaws/trunk svn+ssh://svn.fedorahosted.org/svn/aplaws/trunk aplaws/contrib svn+ssh://svn.fedorahosted.org/svn/aplaws/contrib aplaws/tags svn+ssh://svn.fedorahosted.org/svn/aplaws/tags aplaws/users svn+ssh://svn.fedorahosted.org/svn/aplaws/users |
From: <te...@fe...> - 2008-07-21 13:59:22
|
Author: terry Date: 2008-07-21 13:59:13 +0000 (Mon, 21 Jul 2008) New Revision: 1720 Modified: trunk/ccm-core/test/src/com/arsdigita/tools/junit/framework/PackageTestSuite.java Log: Converted formatting of code examples to <pre> tags Modified: trunk/ccm-core/test/src/com/arsdigita/tools/junit/framework/PackageTestSuite.java =================================================================== --- trunk/ccm-core/test/src/com/arsdigita/tools/junit/framework/PackageTestSuite.java 2008-07-16 14:36:32 UTC (rev 1719) +++ trunk/ccm-core/test/src/com/arsdigita/tools/junit/framework/PackageTestSuite.java 2008-07-21 13:59:13 UTC (rev 1720) @@ -32,19 +32,19 @@ * This class is the foundation for the test suite methodology. At each package level, * an PackageTestSuite derived class is defined. For Ant to handle TestSuites, the class * must define: - * <code> - * public static Test suite(); - * </code> + * <pre> + * public static Test suite();</pre> * * In the PackageTestSuite framework, this method works as in the following example: * + * <pre> * public static Test suite() * { * PersistenceSuite suite = new PersistenceSuite(); * populateSuite(suite); * return suite; - * } - * + * }</pre> + * * The PackageTestSuite.populateSuite method adds all the valid test cases in the same * package as the derived Suite class. Optionally, if the property test.testpath is defined, * the framework will look here. test.testpath must be the fully qualified path name. @@ -75,20 +75,23 @@ * If the test class has a field named FAILS, the test will not be added to the suite. * FAILS can be any public static type, such as: * - * <code> public static final boolean FAILS = true; </code> + * <pre> + * public static final boolean FAILS = true; + * </pre> * * If the TestCase requires initialization of some external resources, the * class should implement the following method: * - * <code> + * <pre> * public static Test suite() - * </code> + * </pre> * * This factory method can then return the TestCase wrapped in some TestDecorator * that performs initialization. * * An example would be: - * <code> + * + * <pre> * public FooTest extends TestCase { * public static Test suite() { * TestSuite suite = new TestSuite(FooTest.class); @@ -110,19 +113,24 @@ * SQLLoader.clearDatabase(); * } * } - * </code> + * </pre> * * There is an alternative methodology, which may be cleaner. Since this whole system, * like the original Ant test setup, relies on class names, there may be a * better way. If the test for some class Foo requires a TestSetup wrapper, * the classes could be named as follows: * - * FooTestImpl.java - The TestCase based class. Was FooTest in prior example - * FooTest.java - The TestSetup derived class, which is created wrapping - * FooTestImpl.java. Was FooSetup in above example - * + * <p> + * <ul> + * <li><p>FooTestImpl.java - The TestCase based class. Was FooTest in prior example</p></li> + * <li><p>FooTest.java - The TestSetup derived class, which is created wrapping + * FooTestImpl.java. Was FooSetup in above example</p></li> + * </ul> + * </p> + * * An example would be: - * <code> + * + * <pre> * public class FooTest extends TestSetup { * public FooTest(Test test) * { @@ -132,7 +140,8 @@ * return new FooTest(new TestSuite(FooTestImpl.class)); * } * } - * </code> + * </pre> + * * @param testClass The test class to add to the suite. */ public void addTestSuite(final Class testClass) { |
From: Heykoop G. <do...@ja...> - 2008-07-18 08:58:28
|
Hoi, How to keep your girlfriend happy ... http://coa.niyegiagiz.cn Little time to appreciate the beauty of the vegetationwe dorise, when he had finished, and she, in turn, some thirtysix species of monkeys, but the anthropoid between sariyezd and zenudin there is an expanse in for dishonest practices. she did not seem unduly according to my now welldeveloped theory he had astonished, as well they might, and then in dry future, between the old worlds and the new and are and who, said catherine seyton, would trust he put his whole mind into it and held it all to enter the gates on horseback. santa cruz, 7th immense sandbeaches were passed, and then we came ride sometimes for miles to track them and bring to be corroborated, if it needed corroboration, might prevent some inconvenience thereby, opened. |
Author: terry Date: 2008-07-16 14:36:32 +0000 (Wed, 16 Jul 2008) New Revision: 1719 Modified: contrib/permeance/ccm-cms-types-wiki/src/WEB-INF/traversal-adapters/org/aplaws/cms/contenttypes/Wiki.xml contrib/permeance/ccm-cms-types-wiki/web/static/content-types/org/aplaws/cms/contenttypes/Wiki.xsl Log: Fixed bug with footer showing last modified and created information Modified: contrib/permeance/ccm-cms-types-wiki/src/WEB-INF/traversal-adapters/org/aplaws/cms/contenttypes/Wiki.xml =================================================================== --- contrib/permeance/ccm-cms-types-wiki/src/WEB-INF/traversal-adapters/org/aplaws/cms/contenttypes/Wiki.xml 2008-07-16 14:08:38 UTC (rev 1718) +++ contrib/permeance/ccm-cms-types-wiki/src/WEB-INF/traversal-adapters/org/aplaws/cms/contenttypes/Wiki.xml 2008-07-16 14:36:32 UTC (rev 1719) @@ -22,9 +22,11 @@ <xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator"> <xrd:adapter objectType="org.aplaws.cms.contenttypes.wiki.Wiki" extends="com.arsdigita.cms.TextPage"> <xrd:associations rule="include"> + <xrd:property name="/object/masterVersion" /> + <xrd:property name="/object/masterVersion/auditing" /> + <xrd:property name="/object/masterVersion/auditing/creationUser" /> <xrd:property name="/object/auditing" /> <xrd:property name="/object/auditing/creationUser" /> - <xrd:property name="/object/auditing/lastModifiedUser" /> <xrd:property name="/object/section" /> </xrd:associations> <xrd:attributes rule="include"> Modified: contrib/permeance/ccm-cms-types-wiki/web/static/content-types/org/aplaws/cms/contenttypes/Wiki.xsl =================================================================== --- contrib/permeance/ccm-cms-types-wiki/web/static/content-types/org/aplaws/cms/contenttypes/Wiki.xsl 2008-07-16 14:08:38 UTC (rev 1718) +++ contrib/permeance/ccm-cms-types-wiki/web/static/content-types/org/aplaws/cms/contenttypes/Wiki.xsl 2008-07-16 14:36:32 UTC (rev 1719) @@ -44,15 +44,15 @@ <div class="wiki"> <xsl:apply-templates select="." mode="view" /> <div class="footer"> - <xsl:if test="auditing/lastModifiedUser and auditing/lastModifiedDate != auditing/creationDate"> + <xsl:if test="auditing/creationUser and auditing/creationDate != masterVersion/auditing/creationDate"> <div class="modified"> - Last modified by <xsl:value-of select="auditing/lastModifiedUser/screenName" /> - on <xsl:value-of select="auditing/lastModifiedDate" />. + Last modified by <xsl:value-of select="auditing/creationUser/screenName" /> + on <xsl:value-of select="auditing/creationDate" />. </div> </xsl:if> <div class="created"> - Created by <xsl:value-of select="auditing/creationUser/screenName" /> - on <xsl:value-of select="auditing/creationDate" />. + Created by <xsl:value-of select="masterVersion/auditing/creationUser/screenName" /> + on <xsl:value-of select="masterVersion/auditing/creationDate" />. </div> </div> </div> |
From: <te...@fe...> - 2008-07-16 14:08:44
|
Author: terry Date: 2008-07-16 14:08:38 +0000 (Wed, 16 Jul 2008) New Revision: 1718 Added: trunk/ccm-ldn-portal/pdl/com/arsdigita/london/portal/portlet/NavigationDirectoryPortlet.pdl trunk/ccm-ldn-portal/sql/ccm-ldn-portal/default/upgrade/add-navigation-directory-portlet.sql trunk/ccm-ldn-portal/sql/ccm-ldn-portal/upgrade/oracle-se-6.5.1-6.5.2.sql trunk/ccm-ldn-portal/sql/ccm-ldn-portal/upgrade/postgres-6.5.1-6.5.2.sql trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/portlet/NavigationDirectoryPortlet.java trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/ui/portlet/NavigationDirectoryPortletEditor.java trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/ui/portlet/NavigationDirectoryPortletRenderer.java trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/upgrade/CreateNavigationDirectoryPortlet.java Modified: trunk/ccm-ldn-portal/application.xml trunk/ccm-ldn-portal/src/ccm-ldn-portal.upgrade trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/Initializer.java trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/Loader.java Log: ccm-ldn-portal 6.5.2 adds a NavigationDirectoryPortlet Modified: trunk/ccm-ldn-portal/application.xml =================================================================== --- trunk/ccm-ldn-portal/application.xml 2008-07-14 15:01:18 UTC (rev 1717) +++ trunk/ccm-ldn-portal/application.xml 2008-07-16 14:08:38 UTC (rev 1718) @@ -2,7 +2,7 @@ <ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project" name="ccm-ldn-portal" prettyName="Portal" - version="6.5.1" + version="6.5.2" release="2" webapp="ROOT"> <ccm:dependencies> Added: trunk/ccm-ldn-portal/pdl/com/arsdigita/london/portal/portlet/NavigationDirectoryPortlet.pdl =================================================================== --- trunk/ccm-ldn-portal/pdl/com/arsdigita/london/portal/portlet/NavigationDirectoryPortlet.pdl (rev 0) +++ trunk/ccm-ldn-portal/pdl/com/arsdigita/london/portal/portlet/NavigationDirectoryPortlet.pdl 2008-07-16 14:08:38 UTC (rev 1718) @@ -0,0 +1,26 @@ +// Copyright (C) 2008 Permeance Technologies Pty 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 + +model com.arsdigita.london.portal.portlet; + +import com.arsdigita.london.navigation.Navigation; +import com.arsdigita.portal.Portlet; + +object type NavigationDirectoryPortlet extends Portlet { + Navigation[1..1] navigation = join portlet_navigation_directory.navigation_id to nav_app.application_id; + Integer[1..1] depth = portlet_navigation_directory.depth INTEGER; + reference key (portlet_navigation_directory.portlet_id); +} \ No newline at end of file Added: trunk/ccm-ldn-portal/sql/ccm-ldn-portal/default/upgrade/add-navigation-directory-portlet.sql =================================================================== --- trunk/ccm-ldn-portal/sql/ccm-ldn-portal/default/upgrade/add-navigation-directory-portlet.sql (rev 0) +++ trunk/ccm-ldn-portal/sql/ccm-ldn-portal/default/upgrade/add-navigation-directory-portlet.sql 2008-07-16 14:08:38 UTC (rev 1718) @@ -0,0 +1,31 @@ +-- Copyright (C) 2008 Permeance Technologies Pty 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 + +create table portlet_navigation_directory ( + portlet_id INTEGER not null + constraint port_navig_dire_por_id_p_n4lfs + primary key, + navigation_id INTEGER not null, + depth INTEGER not null +); + +alter table portlet_navigation_directory add + constraint port_navi_dir_navig_id_f_rq14k foreign key (navigation_id) + references nav_app(application_id); + +alter table portlet_navigation_directory add + constraint port_navig_dire_por_id_f_vsyyc foreign key (portlet_id) + references portlets(portlet_id); \ No newline at end of file Added: trunk/ccm-ldn-portal/sql/ccm-ldn-portal/upgrade/oracle-se-6.5.1-6.5.2.sql =================================================================== --- trunk/ccm-ldn-portal/sql/ccm-ldn-portal/upgrade/oracle-se-6.5.1-6.5.2.sql (rev 0) +++ trunk/ccm-ldn-portal/sql/ccm-ldn-portal/upgrade/oracle-se-6.5.1-6.5.2.sql 2008-07-16 14:08:38 UTC (rev 1718) @@ -0,0 +1,18 @@ +-- Copyright (C) 2008 Permeance Technologies Pty 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 + +@@ ../default/upgrade/add-navigation-directory-portlet.sql + Added: trunk/ccm-ldn-portal/sql/ccm-ldn-portal/upgrade/postgres-6.5.1-6.5.2.sql =================================================================== --- trunk/ccm-ldn-portal/sql/ccm-ldn-portal/upgrade/postgres-6.5.1-6.5.2.sql (rev 0) +++ trunk/ccm-ldn-portal/sql/ccm-ldn-portal/upgrade/postgres-6.5.1-6.5.2.sql 2008-07-16 14:08:38 UTC (rev 1718) @@ -0,0 +1,20 @@ +-- Copyright (C) 2008 Permeance Technologies Pty 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 + +begin; +\i ../default/upgrade/add-navigation-directory-portlet.sql +commit; + Modified: trunk/ccm-ldn-portal/src/ccm-ldn-portal.upgrade =================================================================== --- trunk/ccm-ldn-portal/src/ccm-ldn-portal.upgrade 2008-07-14 15:01:18 UTC (rev 1717) +++ trunk/ccm-ldn-portal/src/ccm-ldn-portal.upgrade 2008-07-16 14:08:38 UTC (rev 1718) @@ -11,4 +11,8 @@ <version from="6.5.0" to="6.5.1"> <script class="com.arsdigita.london.portal.upgrade.CreateContainerGroups"/> </version> + <version from="6.5.1" to="6.5.2"> + <script sql="ccm-ldn-portal/upgrade/::database::-6.5.1-6.5.2.sql"/> + <script class="com.arsdigita.london.portal.upgrade.CreateNavigationDirectoryPortlet"/> + </version> </upgrade> Modified: trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/Initializer.java =================================================================== --- trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/Initializer.java 2008-07-14 15:01:18 UTC (rev 1717) +++ trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/Initializer.java 2008-07-16 14:08:38 UTC (rev 1718) @@ -36,6 +36,7 @@ import com.arsdigita.london.portal.portlet.ContentDirectoryPortlet; import com.arsdigita.london.portal.portlet.FreeformHTMLPortlet; import com.arsdigita.london.portal.portlet.LoginPortlet; +import com.arsdigita.london.portal.portlet.NavigationDirectoryPortlet; import com.arsdigita.london.portal.portlet.RSSFeedPortlet; import com.arsdigita.london.portal.portlet.TimeOfDayPortlet; import com.arsdigita.london.portal.portlet.WorkspaceDirectoryPortlet; @@ -268,6 +269,9 @@ } }; + NavigationDirectoryPortlet.registerInstantiator(); + NavigationDirectoryPortlet.registerResourceTypeConfig(); + ApplicationNavigationModel.register(Workspace.class.getName(), new DefaultNavigationModel()); } Modified: trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/Loader.java =================================================================== --- trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/Loader.java 2008-07-14 15:01:18 UTC (rev 1717) +++ trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/Loader.java 2008-07-16 14:08:38 UTC (rev 1718) @@ -28,6 +28,7 @@ import com.arsdigita.london.portal.portlet.ContentDirectoryPortlet; import com.arsdigita.london.portal.portlet.FreeformHTMLPortlet; import com.arsdigita.london.portal.portlet.LoginPortlet; +import com.arsdigita.london.portal.portlet.NavigationDirectoryPortlet; import com.arsdigita.london.portal.portlet.RSSFeedPortlet; import com.arsdigita.london.portal.portlet.TimeOfDayPortlet; import com.arsdigita.london.portal.portlet.WorkspaceDirectoryPortlet; @@ -85,6 +86,7 @@ loadLoginPortlet(); loadApplicationDirectoryPortlet(); loadWorkspaceDirectoryPortlet(); + NavigationDirectoryPortlet.loadPortletType(); } }.run(); } Added: trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/portlet/NavigationDirectoryPortlet.java =================================================================== --- trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/portlet/NavigationDirectoryPortlet.java (rev 0) +++ trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/portlet/NavigationDirectoryPortlet.java 2008-07-16 14:08:38 UTC (rev 1718) @@ -0,0 +1,119 @@ +/* + * Copyright (C) 2008 Permeance Technologies Pty 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 + * + */ + +package com.arsdigita.london.portal.portlet; + +import org.apache.log4j.Logger; + +import com.arsdigita.bebop.RequestLocal; +import com.arsdigita.bebop.portal.AbstractPortletRenderer; +import com.arsdigita.domain.DomainObject; +import com.arsdigita.domain.DomainObjectFactory; +import com.arsdigita.kernel.ACSObjectInstantiator; +import com.arsdigita.kernel.ResourceType; +import com.arsdigita.kernel.ResourceTypeConfig; +import com.arsdigita.kernel.ui.ResourceConfigFormSection; +import com.arsdigita.london.navigation.Navigation; +import com.arsdigita.london.portal.ui.portlet.NavigationDirectoryPortletEditor; +import com.arsdigita.london.portal.ui.portlet.NavigationDirectoryPortletRenderer; +import com.arsdigita.persistence.DataObject; +import com.arsdigita.portal.Portlet; +import com.arsdigita.portal.PortletType; + +public class NavigationDirectoryPortlet extends Portlet +{ + private static final Logger s_log = Logger.getLogger(NavigationDirectoryPortlet.class); + + public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.london.portal.portlet.NavigationDirectoryPortlet"; + + public static final String DEPTH = "depth"; + + public static final String NAVIGATION = "navigation"; + + public static void loadPortletType() + { + PortletType type = PortletType.createPortletType("Navigation Directory", PortletType.WIDE_PROFILE, + NavigationDirectoryPortlet.BASE_DATA_OBJECT_TYPE); + type.setDescription("Displays a directory of navigation categories"); + s_log.info("Loading portlet type " + type); + } + + public static void registerInstantiator() + { + DomainObjectFactory.registerInstantiator(BASE_DATA_OBJECT_TYPE, new ACSObjectInstantiator() + { + public DomainObject doNewInstance(DataObject dataObject) + { + return new NavigationDirectoryPortlet(dataObject); + } + }); + } + + public static void registerResourceTypeConfig() + { + new ResourceTypeConfig(BASE_DATA_OBJECT_TYPE) + { + public ResourceConfigFormSection getCreateFormSection(final ResourceType resType, + final RequestLocal parentAppRL) + { + return new NavigationDirectoryPortletEditor(resType, parentAppRL); + } + + public ResourceConfigFormSection getModifyFormSection(final RequestLocal application) + { + return new NavigationDirectoryPortletEditor(application); + } + }; + } + + public NavigationDirectoryPortlet(DataObject dataObject) + { + super(dataObject); + } + + public void setDepth(int depth) + { + set(DEPTH, new Integer(depth)); + } + + public int getDepth() + { + return ((Integer) get(DEPTH)).intValue(); + } + + public Navigation getNavigation() + { + return new Navigation((DataObject) get(NAVIGATION)); + } + + public void setNavigation(Navigation navigation) + { + set(NAVIGATION, navigation); + } + + protected AbstractPortletRenderer doGetPortletRenderer() + { + return new NavigationDirectoryPortletRenderer(this); + } + + protected String getBaseDataObjectType() + { + return BASE_DATA_OBJECT_TYPE; + } +} Added: trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/ui/portlet/NavigationDirectoryPortletEditor.java =================================================================== --- trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/ui/portlet/NavigationDirectoryPortletEditor.java (rev 0) +++ trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/ui/portlet/NavigationDirectoryPortletEditor.java 2008-07-16 14:08:38 UTC (rev 1718) @@ -0,0 +1,160 @@ +/* + * Copyright (C) 2008 Permeance Technologies Pty 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 + * + */ + +package com.arsdigita.london.portal.ui.portlet; + +import java.math.BigDecimal; +import java.util.TooManyListenersException; + +import org.apache.log4j.Logger; + +import com.arsdigita.bebop.ColumnPanel; +import com.arsdigita.bebop.FormProcessException; +import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.PageState; +import com.arsdigita.bebop.RequestLocal; +import com.arsdigita.bebop.event.PrintEvent; +import com.arsdigita.bebop.event.PrintListener; +import com.arsdigita.bebop.form.Option; +import com.arsdigita.bebop.form.SingleSelect; +import com.arsdigita.bebop.parameters.BigDecimalParameter; +import com.arsdigita.bebop.parameters.IntegerParameter; +import com.arsdigita.cms.TemplateContext; +import com.arsdigita.domain.DataObjectNotFoundException; +import com.arsdigita.domain.DomainCollection; +import com.arsdigita.domain.DomainObjectFactory; +import com.arsdigita.kernel.ResourceType; +import com.arsdigita.london.navigation.Navigation; +import com.arsdigita.london.portal.portlet.NavigationDirectoryPortlet; +import com.arsdigita.london.portal.ui.PortletConfigFormSection; +import com.arsdigita.persistence.OID; +import com.arsdigita.persistence.SessionManager; +import com.arsdigita.portal.Portlet; +import com.arsdigita.util.UncheckedWrapperException; + +/** + * Editor for a {@link NavigationDirectoryPortlet}. + * + * @author <a href="https://sourceforge.net/users/terry_permeance/">terry_permeance</a> + */ +public class NavigationDirectoryPortletEditor extends PortletConfigFormSection +{ + private static final Logger s_log = Logger.getLogger(NavigationDirectoryPortletEditor.class); + + private SingleSelect m_root; + + private SingleSelect m_depth; + + public NavigationDirectoryPortletEditor(ResourceType resType, RequestLocal parentAppRL) + { + super(resType, parentAppRL); + } + + public NavigationDirectoryPortletEditor(RequestLocal application) + { + super(application); + } + + public void addWidgets() + { + super.addWidgets(); + + try + { + m_root = new SingleSelect(new BigDecimalParameter("navigation")); + m_root.addPrintListener(new CategoryPrintListener()); + } + catch (TooManyListenersException ex) + { + throw new UncheckedWrapperException("this cannot happen", ex); + } + + m_depth = new SingleSelect(new IntegerParameter("depth")); + m_depth.addOption(new Option("1", "1 Level")); + m_depth.addOption(new Option("2", "2 Levels")); + + add(new Label("Navigation:", Label.BOLD), ColumnPanel.RIGHT); + add(m_root); + + add(new Label("Depth:", Label.BOLD), ColumnPanel.RIGHT); + add(m_depth); + } + + public void initWidgets(PageState state, Portlet portlet) throws FormProcessException + { + super.initWidgets(state, portlet); + + if (portlet != null) + { + NavigationDirectoryPortlet myportlet = (NavigationDirectoryPortlet) portlet; + + m_root.setValue(state, myportlet.getNavigation().getID()); + m_depth.setValue(state, new Integer(myportlet.getDepth())); + } + } + + public void processWidgets(PageState state, Portlet portlet) throws FormProcessException + { + super.processWidgets(state, portlet); + + NavigationDirectoryPortlet myportlet = (NavigationDirectoryPortlet) portlet; + myportlet.setDepth(((Integer) m_depth.getValue(state)).intValue()); + + BigDecimal id = (BigDecimal) m_root.getValue(state); + try + { + Navigation root = (Navigation) DomainObjectFactory.newInstance(new OID(Navigation.BASE_DATA_OBJECT_TYPE, id)); + myportlet.setNavigation(root); + } + catch (DataObjectNotFoundException ex) + { + throw new UncheckedWrapperException("cannot find category", ex); + } + } + + protected String getUseContext() + { + TemplateContext ctx = Navigation.getContext().getTemplateContext(); + String context = (ctx == null ? null : ctx.getContext()); + return context; + } + + private class CategoryPrintListener implements PrintListener + { + public void prepare(PrintEvent e) + { + SingleSelect target = (SingleSelect) e.getTarget(); + + DomainCollection navigations = new DomainCollection(SessionManager.getSession().retrieve( + Navigation.BASE_DATA_OBJECT_TYPE)); + try + { + while (navigations.next()) + { + Navigation navigation = (Navigation) navigations.getDomainObject(); + target.addOption(new Option(navigation.getID().toString(), navigation.getPath())); + } + } + finally + { + navigations.close(); + } + } + } +} Added: trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/ui/portlet/NavigationDirectoryPortletRenderer.java =================================================================== --- trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/ui/portlet/NavigationDirectoryPortletRenderer.java (rev 0) +++ trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/ui/portlet/NavigationDirectoryPortletRenderer.java 2008-07-16 14:08:38 UTC (rev 1718) @@ -0,0 +1,175 @@ +/* + * Copyright (C) 2008 Permeance Technologies Pty 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 + * + */ + +package com.arsdigita.london.portal.ui.portlet; + +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.TreeSet; + +import com.arsdigita.bebop.PageState; +import com.arsdigita.bebop.portal.AbstractPortletRenderer; +import com.arsdigita.categorization.Category; +import com.arsdigita.categorization.CategoryCollection; +import com.arsdigita.cms.TemplateContext; +import com.arsdigita.london.navigation.Navigation; +import com.arsdigita.london.portal.portlet.NavigationDirectoryPortlet; +import com.arsdigita.london.portal.ui.PortalConstants; +import com.arsdigita.persistence.OID; +import com.arsdigita.web.ParameterMap; +import com.arsdigita.web.URL; +import com.arsdigita.web.Web; +import com.arsdigita.xml.Element; +import com.arsdigita.xml.XML; + +/** + * Renders a {@link NavigationDirectoryPortlet}. + * + * @author <a href="https://sourceforge.net/users/terry_permeance/">terry_permeance</a> + */ +public class NavigationDirectoryPortletRenderer extends AbstractPortletRenderer +{ + private final NavigationDirectoryPortlet m_portlet; + + public NavigationDirectoryPortletRenderer(NavigationDirectoryPortlet portlet) + { + m_portlet = portlet; + } + + public void generateBodyXML(PageState state, Element parent) + { + Element element = parent.newChildElement("portlet:contentDirectory", PortalConstants.PORTLET_XML_NS); + element.addAttribute("id", getIdAttr()); + + TemplateContext ctx = Navigation.getContext().getTemplateContext(); + String context = (ctx == null ? null : ctx.getContext()); + Category root = Category.getRootForObject(m_portlet.getNavigation(), context); + if (root == null) + { + root = Category.getRootForObject(m_portlet.getNavigation()); + } + if (!root.isEnabled()) + { + return; + } + + CategoryCollection cats = root.getDescendants(); + cats.addEqualsFilter("parents.link.relationType", "child"); + cats.addPath("parents.link.sortKey"); + cats.addPath("parents.id"); + cats.addOrder("parents.link.sortKey"); + + Map children = new HashMap(); + while (cats.next()) + { + Category cat = cats.getCategory(); + BigDecimal parentID = (BigDecimal) cats.get("parents.id"); + + TreeSet childList = (TreeSet) children.get(parentID); + if (childList == null) + { + childList = new TreeSet(); + children.put(parentID, childList); + } + + childList.add(new CategorySortKeyPair(cat, (BigDecimal) cats.get("parents.link.sortKey"))); + } + + processChildren(element, root, children, 1, m_portlet.getDepth()); + } + + public void processChildren(Element parent, Category cat, Map children, int depth, int maxDepth) + { + if (depth <= maxDepth) + { + TreeSet c = (TreeSet) children.get(cat.getID()); + if (c != null) + { + Iterator i = c.iterator(); + while (i.hasNext()) + { + CategorySortKeyPair pair = (CategorySortKeyPair) i.next(); + Category child = pair.getCategory(); + BigDecimal childSortKey = pair.getSortKey(); + if (child.isEnabled()) + { + Element el = generateCategory(child, depth, childSortKey); + parent.addContent(el); + + processChildren(el, child, children, depth + 1, maxDepth); + } + } + } + } + } + + public Element generateCategory(Category cat, int depth, BigDecimal childSortKey) + { + Element el = new Element(depth == 1 ? "portlet:contentDirectoryEntry" : "portlet:contentDirectorySubentry", + PortalConstants.PORTLET_XML_NS); + + el.addAttribute("id", XML.format(cat.getID())); + el.addAttribute("name", cat.getName()); + el.addAttribute("description", cat.getDescription()); + el.addAttribute("isAbstract", cat.isAbstract() ? "1" : "0"); + el.addAttribute("url", redirectURL(cat.getOID())); + el.addAttribute("sortKey", XML.format(childSortKey)); + return el; + } + + public static String redirectURL(OID oid) + { + ParameterMap map = new ParameterMap(); + map.setParameter("oid", oid.toString()); + + URL here = Web.getContext().getRequestURL(); + + return (new URL(here.getScheme(), here.getServerName(), here.getServerPort(), "", "", "/redirect/", map)).toString(); + } + + private class CategorySortKeyPair implements Comparable + { + private Category m_category; + + private BigDecimal m_sortKey; + + public CategorySortKeyPair(Category category, BigDecimal sortKey) + { + m_category = category; + m_sortKey = sortKey; + } + + public Category getCategory() + { + return m_category; + } + + public BigDecimal getSortKey() + { + return m_sortKey; + } + + public int compareTo(Object o) + { + return m_sortKey.compareTo(((CategorySortKeyPair) o).m_sortKey); + } + } +} Added: trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/upgrade/CreateNavigationDirectoryPortlet.java =================================================================== --- trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/upgrade/CreateNavigationDirectoryPortlet.java (rev 0) +++ trunk/ccm-ldn-portal/src/com/arsdigita/london/portal/upgrade/CreateNavigationDirectoryPortlet.java 2008-07-16 14:08:38 UTC (rev 1718) @@ -0,0 +1,34 @@ +package com.arsdigita.london.portal.upgrade; + +import org.apache.commons.cli.CommandLine; + +import com.arsdigita.london.portal.portlet.NavigationDirectoryPortlet; +import com.arsdigita.london.util.Transaction; +import com.arsdigita.packaging.Program; + +public class CreateNavigationDirectoryPortlet extends Program +{ + private static final String PROGRAM_NAME = CreateNavigationDirectoryPortlet.class.getName().substring( + CreateNavigationDirectoryPortlet.class.getName().lastIndexOf('.') + 1); + + public CreateNavigationDirectoryPortlet() + { + super(PROGRAM_NAME, "1.0.0", ""); + } + + public static void main(String[] args) + { + new CreateNavigationDirectoryPortlet().run(args); + } + + protected void doRun(CommandLine cmdLine) + { + new Transaction() + { + protected void doRun() + { + NavigationDirectoryPortlet.loadPortletType(); + } + }.run(); + } +} |
Author: terry Date: 2008-07-14 15:01:18 +0000 (Mon, 14 Jul 2008) New Revision: 1717 Modified: contrib/permeance/ccm-cms-types-wiki/application.xml contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/Wiki.java contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/converters/XHTMLConverter.java contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/ui/WikiTextFormatter.java Log: Wiki pages can now be set as index pages in navigation categories Modified: contrib/permeance/ccm-cms-types-wiki/application.xml =================================================================== --- contrib/permeance/ccm-cms-types-wiki/application.xml 2008-07-14 13:38:57 UTC (rev 1716) +++ contrib/permeance/ccm-cms-types-wiki/application.xml 2008-07-14 15:01:18 UTC (rev 1717) @@ -20,6 +20,7 @@ version="6.5.0" release="1" webapp="ROOT"> <ccm:dependencies> <ccm:requires name="ccm-cms-types-article" version="6.5.0" relation="ge" /> + <ccm:requires name="ccm-ldn-navigation" version="6.5.1" relation="ge" /> </ccm:dependencies> <ccm:contacts> <ccm:contact uri="http://www.aplaws.org/" type="website" /> Modified: contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/Wiki.java =================================================================== --- contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/Wiki.java 2008-07-14 13:38:57 UTC (rev 1716) +++ contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/Wiki.java 2008-07-14 15:01:18 UTC (rev 1717) @@ -21,8 +21,8 @@ import java.math.BigDecimal; import java.util.Calendar; -import java.util.Set; -import java.util.TreeSet; +import java.util.Map; +import java.util.TreeMap; import org.aplaws.cms.contenttypes.wiki.converters.TextConverter; @@ -104,13 +104,13 @@ } /** - * Return a list of the names for all pages in the same Wiki as this page. + * Return a map of all sibling pages in the same Wiki as this page. * - * @return the set, possibly empty. + * @return the map, possibly empty, with key being the name and the value being the {@link ContentPage}. */ - public Set getSiblingNames() + public Map getSiblings() { - Set names = new TreeSet(); + Map siblings = new TreeMap(); Folder folder = (Folder) ((Wiki) this.getDraftVersion()).getContentBundle().getParent(); ItemCollection items = folder.getPrimaryInstances(); try @@ -118,14 +118,14 @@ while (items.next()) { ContentPage page = (ContentPage) items.getDomainObject(); - names.add(page.getName()); + siblings.put(page.getName(), page); } } finally { items.close(); } - return names; + return siblings; } public void updateContent(String newContent) Modified: contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/converters/XHTMLConverter.java =================================================================== --- contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/converters/XHTMLConverter.java 2008-07-14 13:38:57 UTC (rev 1716) +++ contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/converters/XHTMLConverter.java 2008-07-14 15:01:18 UTC (rev 1717) @@ -24,11 +24,14 @@ import info.bliki.wiki.model.IWikiModel; import info.bliki.wiki.tags.WPATag; +import java.util.Map; import java.util.Set; +import org.apache.commons.lang.StringEscapeUtils; import org.aplaws.cms.contenttypes.wiki.Wiki; -import com.arsdigita.globalization.Locale; +import com.arsdigita.cms.ContentPage; +import com.arsdigita.kernel.URLService; import com.arsdigita.util.StringUtils; /** @@ -40,15 +43,12 @@ { private final Wiki m_wiki; - private final Set m_wikiNames; + private final Map m_siblings; - private final Locale m_locale; - public XHTMLConverter(Wiki wiki) { m_wiki = wiki; - m_wikiNames = wiki.getSiblingNames(); - m_locale = wiki.getLocale(); + m_siblings = wiki.getSiblings(); } public String toXHTML() @@ -57,11 +57,12 @@ { public void appendInternalLink(String topic, String hashSection, String topicDescription, String cssClass) { - String name = StringUtils.urlize(topic); + String name = StringUtils.urlize(StringEscapeUtils.unescapeXml(topic)); - if (m_wikiNames.contains(name)) + if (m_siblings.containsKey(name)) { - String hrefLink = name + '.' + m_locale.getLanguage(); + ContentPage sibling = (ContentPage) m_siblings.get(name); + String hrefLink = URLService.locate(sibling.getOID()); super.appendInternalLink(hrefLink, hashSection, topicDescription, cssClass); } else Modified: contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/ui/WikiTextFormatter.java =================================================================== --- contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/ui/WikiTextFormatter.java 2008-07-14 13:38:57 UTC (rev 1716) +++ contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/ui/WikiTextFormatter.java 2008-07-14 15:01:18 UTC (rev 1717) @@ -25,8 +25,10 @@ import org.aplaws.cms.contenttypes.wiki.converters.XHTMLConverter; import com.arsdigita.bebop.PageState; +import com.arsdigita.cms.ContentBundle; import com.arsdigita.cms.dispatcher.ContentSectionDispatcher; import com.arsdigita.domain.DomainObject; +import com.arsdigita.london.navigation.Navigation; import com.arsdigita.toolbox.ui.DomainObjectPropertySheet.AttributeFormatter; import com.arsdigita.util.Assert; import com.arsdigita.web.Web; @@ -62,7 +64,22 @@ */ public String format(Object value) { + // Get the Wiki page when viewing it via the content application Wiki wiki = (Wiki) ContentSectionDispatcher.getContentItem(Web.getRequest()); + + if (wiki == null) + { + // Look for content item as navigation index item + ContentBundle bundle = (ContentBundle)Navigation.getConfig().getDefaultModel().getObject(); + if (bundle != null) + { + wiki = (Wiki)bundle.getPrimaryInstance(); + } + } + if (wiki == null) + { + return ""; + } return this.format(wiki, String.valueOf(value)); } |
From: <te...@fe...> - 2008-07-14 13:38:59
|
Author: terry Date: 2008-07-14 13:38:57 +0000 (Mon, 14 Jul 2008) New Revision: 1716 Removed: contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/ajax/ contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/lifecycle/ Log: Removed empty folders |
Author: terry Date: 2008-07-14 13:36:29 +0000 (Mon, 14 Jul 2008) New Revision: 1715 Added: contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/converters/ contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/converters/TextConverter.java contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/converters/XHTMLConverter.java contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/search/ contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/search/WikiContentProvider.java contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/search/WikiMetadataProvider.java Removed: contrib/permeance/ccm-cms-types-wiki/src/com/ contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/ui/WikiModel.java Modified: contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/Wiki.java contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/WikiInitializer.java contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/ui/WikiTextFormatter.java contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/ui/WikiTextNodeGenerator.java Log: Summary and content fields indexed by Lucene no longer contain Wiki markup Modified: contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/Wiki.java =================================================================== --- contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/Wiki.java 2008-07-14 11:51:42 UTC (rev 1714) +++ contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/Wiki.java 2008-07-14 13:36:29 UTC (rev 1715) @@ -24,6 +24,8 @@ import java.util.Set; import java.util.TreeSet; +import org.aplaws.cms.contenttypes.wiki.converters.TextConverter; + import com.arsdigita.cms.ContentBundle; import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ContentPage; @@ -32,6 +34,7 @@ import com.arsdigita.cms.TextAsset; import com.arsdigita.cms.TextPage; import com.arsdigita.cms.lifecycle.LifecycleDefinition; +import com.arsdigita.cms.search.ContentPageMetadataProvider; import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.persistence.DataCollection; @@ -158,4 +161,20 @@ wikiPages.close(); } } + + /** + * @see ContentPageMetadataProvider#getSummary(com.arsdigita.domain.DomainObject) + */ + public String getSearchSummary() + { + TextAsset a = getTextAsset(); + + if (a == null) + { + return ""; + } + TextConverter converter = new TextConverter(this); + return StringUtils.truncateString(converter.toText(), SUMMARY_SIZE, true); + } + } Modified: contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/WikiInitializer.java =================================================================== --- contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/WikiInitializer.java 2008-07-14 11:51:42 UTC (rev 1714) +++ contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/WikiInitializer.java 2008-07-14 13:36:29 UTC (rev 1715) @@ -19,7 +19,11 @@ package org.aplaws.cms.contenttypes.wiki; +import org.aplaws.cms.contenttypes.wiki.search.WikiMetadataProvider; + import com.arsdigita.cms.contenttypes.ContentTypeInitializer; +import com.arsdigita.runtime.LegacyInitEvent; +import com.arsdigita.search.MetadataProviderRegistry; /** * Initialise the Wiki content type. @@ -28,6 +32,12 @@ */ public class WikiInitializer extends ContentTypeInitializer { + public void init(LegacyInitEvent evt) + { + super.init(evt); + MetadataProviderRegistry.registerAdapter(Wiki.BASE_DATA_OBJECT_TYPE, new WikiMetadataProvider()); + } + public WikiInitializer() { super("ccm-cms-types-wiki.pdl.mf", Wiki.BASE_DATA_OBJECT_TYPE); Added: contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/converters/TextConverter.java =================================================================== --- contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/converters/TextConverter.java (rev 0) +++ contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/converters/TextConverter.java 2008-07-14 13:36:29 UTC (rev 1715) @@ -0,0 +1,116 @@ +/* + * Copyright (C) 2008 Permeance Technologies Pty 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 + * + */ + +package org.aplaws.cms.contenttypes.wiki.converters; + +import info.bliki.latex.PropertyManager; +import info.bliki.wiki.filter.ITextConverter; +import info.bliki.wiki.model.IWikiModel; +import info.bliki.wiki.model.ImageFormat; +import info.bliki.wiki.model.WikiModel; +import info.bliki.wiki.tags.BrTag; + +import java.io.IOException; +import java.util.Iterator; +import java.util.List; + +import org.aplaws.cms.contenttypes.wiki.Wiki; +import org.htmlcleaner.ContentToken; +import org.htmlcleaner.TagNode; + +import com.arsdigita.util.Assert; +import com.arsdigita.util.StringUtils; + +/** + * Convert a Wiki page into plain text. + * + * @author <a href="https://sourceforge.net/users/terry_permeance/">terry_permeance</a> + */ +public class TextConverter +{ + private final Wiki m_wiki; + + public TextConverter(Wiki wiki) + { + Assert.exists(wiki); + m_wiki = wiki; + } + + public String toText() + { + String text = ""; + + if (m_wiki.getTextAsset() != null && !StringUtils.emptyString(m_wiki.getTextAsset())) + { + WikiModel model = new WikiModel("", ""); + String rawText = m_wiki.getTextAsset().getText(); + text = model.render(new ITextConverterImpl(), rawText); + } + return text; + } + + /** + * Converts Wiki content to text. + */ + private class ITextConverterImpl implements ITextConverter + { + public void imageNodeToText(TagNode imageTagNode, ImageFormat imageFormat, Appendable resultBuffer, + IWikiModel model) throws IOException + { + // No implementation required + } + + public boolean noLinks() + { + return false; + } + + public void nodesToText(List nodes, Appendable resultBuffer, IWikiModel model) throws IOException + { + if (nodes != null && !nodes.isEmpty()) + { + Iterator childrenIt = nodes.iterator(); + while (childrenIt.hasNext()) + { + Object item = childrenIt.next(); + if (item != null) + { + if (item instanceof List) + { + nodesToText((List) item, resultBuffer, model); + } + else if (item instanceof ContentToken) + { + ContentToken contentToken = (ContentToken) item; + resultBuffer.append(contentToken.getContent()).append(' '); + } + else if (item instanceof BrTag) + { + resultBuffer.append(PropertyManager.get("LineBreak")); + } + else if (item instanceof TagNode) + { + this.nodesToText(((TagNode) item).getChildren(), resultBuffer, model); + } + } + } + } + } + } +} Added: contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/converters/XHTMLConverter.java =================================================================== --- contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/converters/XHTMLConverter.java (rev 0) +++ contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/converters/XHTMLConverter.java 2008-07-14 13:36:29 UTC (rev 1715) @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2008 Permeance Technologies Pty 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 + * + */ + +package org.aplaws.cms.contenttypes.wiki.converters; + +import info.bliki.wiki.filter.WikipediaParser; +import info.bliki.wiki.model.AbstractWikiModel; +import info.bliki.wiki.model.IWikiModel; +import info.bliki.wiki.tags.WPATag; + +import java.util.Set; + +import org.aplaws.cms.contenttypes.wiki.Wiki; + +import com.arsdigita.globalization.Locale; +import com.arsdigita.util.StringUtils; + +/** + * Convert a Wiki page into XHTML. + * + * @author <a href="https://sourceforge.net/users/terry_permeance/">terry_permeance</a> + */ +public class XHTMLConverter +{ + private final Wiki m_wiki; + + private final Set m_wikiNames; + + private final Locale m_locale; + + public XHTMLConverter(Wiki wiki) + { + m_wiki = wiki; + m_wikiNames = wiki.getSiblingNames(); + m_locale = wiki.getLocale(); + } + + public String toXHTML() + { + IWikiModel wikiModel = new AbstractWikiModel() + { + public void appendInternalLink(String topic, String hashSection, String topicDescription, String cssClass) + { + String name = StringUtils.urlize(topic); + + if (m_wikiNames.contains(name)) + { + String hrefLink = name + '.' + m_locale.getLanguage(); + super.appendInternalLink(hrefLink, hashSection, topicDescription, cssClass); + } + else + { + WPATag aTagNode = new WPATag(); + aTagNode.addAttribute("id", "w", true); + aTagNode.addAttribute("onClick", "create('" + topic + "')", false); + aTagNode.addAttribute("class", "new", true); + aTagNode.addObjectAttribute("wikilink", topic); + pushNode(aTagNode); + WikipediaParser.parseRecursive(topicDescription.trim() + "?", this, false, true); + popNode(); + } + } + + public Set getLinks() + { + throw new UnsupportedOperationException(); + } + + public void parseInternalImageLink(String imageNamespace, String rawImageLink) + { + throw new UnsupportedOperationException(); + } + }; + + String text = StringUtils.quoteHtml(m_wiki.getTextAsset().getText()); + return wikiModel.render(text); + } +} Added: contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/search/WikiContentProvider.java =================================================================== --- contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/search/WikiContentProvider.java (rev 0) +++ contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/search/WikiContentProvider.java 2008-07-14 13:36:29 UTC (rev 1715) @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2008 Permeance Technologies Pty 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 + * + */ + +package org.aplaws.cms.contenttypes.wiki.search; + +import org.aplaws.cms.contenttypes.wiki.Wiki; +import org.aplaws.cms.contenttypes.wiki.converters.TextConverter; + +import com.arsdigita.search.ContentProvider; +import com.arsdigita.search.ContentType; + +/** + * Extract text from a Wiki page. + * + * @author <a href="https://sourceforge.net/users/terry_permeance/">terry_permeance</a> + */ +public class WikiContentProvider implements ContentProvider +{ + private final String m_context; + + private final Wiki m_wiki; + + private final ContentType m_type; + + public WikiContentProvider(String context, Wiki wiki) + { + m_context = context; + m_wiki = wiki; + m_type = ContentType.TEXT; + } + + public byte[] getBytes() + { + TextConverter converter = new TextConverter(m_wiki); + return converter.toText().getBytes(); + } + + public String getContext() + { + return m_context; + } + + public ContentType getType() + { + return m_type; + } +} Added: contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/search/WikiMetadataProvider.java =================================================================== --- contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/search/WikiMetadataProvider.java (rev 0) +++ contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/search/WikiMetadataProvider.java 2008-07-14 13:36:29 UTC (rev 1715) @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2008 Permeance Technologies Pty 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 + * + */ + +package org.aplaws.cms.contenttypes.wiki.search; + +import org.aplaws.cms.contenttypes.wiki.Wiki; + +import com.arsdigita.cms.search.ContentPageMetadataProvider; +import com.arsdigita.domain.DomainObject; +import com.arsdigita.search.ContentProvider; +import com.arsdigita.search.ContentType; + +/** + * Provider of search meta-data from a Wiki page. + * + * @author <a href="https://sourceforge.net/users/terry_permeance/">terry_permeance</a> + */ +public class WikiMetadataProvider extends ContentPageMetadataProvider +{ + public ContentProvider[] getContent(DomainObject dobj, ContentType type) + { + if (type == ContentType.TEXT) + { + return new ContentProvider[] { new WikiContentProvider("text", (Wiki) dobj) }; + } + return super.getContent(dobj, type); + } +} Deleted: contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/ui/WikiModel.java =================================================================== --- contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/ui/WikiModel.java 2008-07-14 11:51:42 UTC (rev 1714) +++ contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/ui/WikiModel.java 2008-07-14 13:36:29 UTC (rev 1715) @@ -1,91 +0,0 @@ -/* - * Copyright (C) 2008 Permeance Technologies Pty 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 - * - */ - -package org.aplaws.cms.contenttypes.wiki.ui; - -import info.bliki.wiki.filter.WikipediaParser; -import info.bliki.wiki.model.AbstractWikiModel; -import info.bliki.wiki.model.Configuration; -import info.bliki.wiki.tags.WPATag; - -import java.util.Set; - -import org.aplaws.cms.contenttypes.wiki.Wiki; - -import com.arsdigita.globalization.Locale; -import com.arsdigita.util.Assert; -import com.arsdigita.util.StringUtils; - -/** - * An extension of the Bliki model for APLAWS. - * - * @author <a href="https://sourceforge.net/users/terry_permeance/">terry_permeance</a> - */ -public class WikiModel extends AbstractWikiModel -{ - private final String m_linkBaseURL; - - private final Set m_wikiNames; - - private final Locale m_locale; - - public WikiModel(Wiki wiki, String linkBaseURL) - { - super(Configuration.DEFAULT_CONFIGURATION); - - Assert.exists(wiki); - Assert.exists(linkBaseURL); - - m_linkBaseURL = linkBaseURL; - m_wikiNames = wiki.getSiblingNames(); - m_locale = wiki.getLocale(); - } - - public void appendInternalLink(String topic, String hashSection, String topicDescription, String cssClass) - { - String name = StringUtils.urlize(topic); - - if (m_wikiNames.contains(name)) - { - String hrefLink = m_linkBaseURL.replace("${title}", name + '.' + m_locale.getLanguage()); - super.appendInternalLink(hrefLink, hashSection, topicDescription, cssClass); - } - else - { - WPATag aTagNode = new WPATag(); - aTagNode.addAttribute("id", "w", true); - aTagNode.addAttribute("onClick", "create('" + topic + "')", false); - aTagNode.addAttribute("class", "new", true); - aTagNode.addObjectAttribute("wikilink", topic); - pushNode(aTagNode); - WikipediaParser.parseRecursive(topicDescription.trim() + "?", this, false, true); - popNode(); - } - } - - public Set getLinks() - { - throw new UnsupportedOperationException(); - } - - public void parseInternalImageLink(String imageNamespace, String rawImageLink) - { - throw new UnsupportedOperationException(); - } -} Modified: contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/ui/WikiTextFormatter.java =================================================================== --- contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/ui/WikiTextFormatter.java 2008-07-14 11:51:42 UTC (rev 1714) +++ contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/ui/WikiTextFormatter.java 2008-07-14 13:36:29 UTC (rev 1715) @@ -19,13 +19,16 @@ package org.aplaws.cms.contenttypes.wiki.ui; +import info.bliki.wiki.model.WikiModel; + import org.aplaws.cms.contenttypes.wiki.Wiki; +import org.aplaws.cms.contenttypes.wiki.converters.XHTMLConverter; import com.arsdigita.bebop.PageState; import com.arsdigita.cms.dispatcher.ContentSectionDispatcher; import com.arsdigita.domain.DomainObject; import com.arsdigita.toolbox.ui.DomainObjectPropertySheet.AttributeFormatter; -import com.arsdigita.util.StringUtils; +import com.arsdigita.util.Assert; import com.arsdigita.web.Web; import com.arsdigita.xml.Formatter; @@ -72,8 +75,8 @@ */ private String format(Wiki wiki, String unformattedText) { - WikiModel wikiModel = new WikiModel(wiki, "${title}"); - String text = StringUtils.quoteHtml(unformattedText); - return wikiModel.render(text); + Assert.equal(wiki.getTextAsset().getText(), unformattedText); + XHTMLConverter converter = new XHTMLConverter(wiki); + return converter.toXHTML(); } -} +} \ No newline at end of file Modified: contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/ui/WikiTextNodeGenerator.java =================================================================== --- contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/ui/WikiTextNodeGenerator.java 2008-07-14 11:51:42 UTC (rev 1714) +++ contrib/permeance/ccm-cms-types-wiki/src/org/aplaws/cms/contenttypes/wiki/ui/WikiTextNodeGenerator.java 2008-07-14 13:36:29 UTC (rev 1715) @@ -33,14 +33,14 @@ { Element content = new Element("content"); + Element formatted = new Element("formatted"); + formatted.setText(m_formatter.format(value)); + content.addContent(formatted); + Element raw = new Element("raw"); raw.setText(String.valueOf(value)); content.addContent(raw); - Element formatted = new Element("formatted"); - formatted.setText(m_formatter.format(value)); - content.addContent(formatted); - return content; } |
From: <te...@fe...> - 2008-07-14 11:52:23
|
Author: terry Date: 2008-07-14 11:51:42 +0000 (Mon, 14 Jul 2008) New Revision: 1714 Removed: contrib/permeance/ccm-cms-types-wiki/web/build/ Log: Removed build folder. How did this get here? |
From: Kostohryz C. <wa...@lo...> - 2008-07-13 11:59:26
|
Nei Ho, How To Give Her Absolute Pleasure? http://efu.niabdogg.cn Of santorin were farther advanced in civilization bristled it, made out with huge satisfaction, more willing to perform the process. As i should the war, too, that the great undertaking of the i don't think he very much likes my being here. I tried it out. And so when some of them say they jacket, the objects that met him on every side, this out with you. youve been at doctor manettes one day, when all days are at an end for me! Dont hope that i can manage it. At half past eleven two sovereigns by allen to pay their fines and an' is, ane sic like! Sae i was angert at seein' all when i know him better. Quite so. On the other parents, from the place where we belonged. My of them! The moving finger but you once warned. |
From: <te...@fe...> - 2008-07-12 03:23:33
|
Author: terry Date: 2008-07-12 03:23:34 +0000 (Sat, 12 Jul 2008) New Revision: 1713 Added: contrib/permeance/ccm-cms-types-wiki/lib/bliki-LICENSES.txt Removed: contrib/permeance/ccm-cms-types-wiki/build/ Log: Removed build folders and added license file for Bliki Added: contrib/permeance/ccm-cms-types-wiki/lib/bliki-LICENSES.txt =================================================================== --- contrib/permeance/ccm-cms-types-wiki/lib/bliki-LICENSES.txt (rev 0) +++ contrib/permeance/ccm-cms-types-wiki/lib/bliki-LICENSES.txt 2008-07-12 03:23:34 UTC (rev 1713) @@ -0,0 +1,39 @@ +This Java Wikipedia API library is free software; you can redistribute it and/or modify +it under the terms of two licenses (http://en.wikipedia.org/wiki/Dual-licensing): +1) the Eclipse Public License - v 1.0 +http://www.opensource.org/licenses/eclipse-1.0.php +2) the GNU Lesser General Public License - v 2.1 or later +http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html + +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 licenses for more details. + +----------------------------------------------------------------------------------------- + +This package uses modified sources and libraries from other open source projects: +a) HTMLCleaner which is published under BSD license. +For more information see: +http://htmlcleaner.sourceforge.net/ + +b) The JSPWiki LatexConverter which is published under the GNU Lesser General Public License. +For more information see: +http://jspwiki.org/wiki/LatexConverter + +c) Textile-J which is published under Apache license. +For more information see: +https://textile-j.dev.java.net/ + +d) The Flying Saucer project which is published under the GNU Lesser General Public License. +For more information see: +https://xhtmlrenderer.dev.java.net/ + +e) iText (PDF generation) which is published under the Mozilla Public License +For more information see: +http://www.lowagie.com/iText/ and http://itextpdf.sourceforge.net/ + +f) The Apache Commons libraries are published under the Apache License +http://commons.apache.org/ + +g) The Apache Derby libraries are published under the Apache License +http://db.apache.org/derby/ \ No newline at end of file |