From: <fg...@us...> - 2010-06-08 16:08:22
|
Revision: 2636 http://openutils.svn.sourceforge.net/openutils/?rev=2636&view=rev Author: fgiust Date: 2010-06-08 16:08:16 +0000 (Tue, 08 Jun 2010) Log Message: ----------- CONTROLS-27 virtualuri name improved, can be useful for more than a grid... Added Paths: ----------- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/virtualurimapping/MediaThumbnailVirtualUriMapping.java trunk/openutils-mgnlmedia/src/main/resources/mgnl-bootstrap/media-nooverwrite/config.modules.media.virtualURIMapping.mediathumbs.xml Removed Paths: ------------- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/virtualurimapping/VirtualUriMappingMediaThumbOnGrid.java trunk/openutils-mgnlmedia/src/main/resources/mgnl-bootstrap/media/config.modules.media.virtualURIMapping.thumbDocumentMapping.xml Copied: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/virtualurimapping/MediaThumbnailVirtualUriMapping.java (from rev 2634, trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/virtualurimapping/VirtualUriMappingMediaThumbOnGrid.java) =================================================================== --- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/virtualurimapping/MediaThumbnailVirtualUriMapping.java (rev 0) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/virtualurimapping/MediaThumbnailVirtualUriMapping.java 2010-06-08 16:08:16 UTC (rev 2636) @@ -0,0 +1,59 @@ +/** + * + * Magnolia SimpleMedia Module (http://www.openmindlab.com/lab/products/media.html) + * Copyright (C)2008 - 2010, Openmind S.r.l. http://www.openmindonline.it + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package net.sourceforge.openutils.mgnlmedia.media.virtualurimapping; + +import info.magnolia.cms.beans.config.VirtualURIMapping; +import info.magnolia.cms.core.Content; +import net.sourceforge.openutils.mgnlmedia.media.tags.el.MediaEl; + +import org.apache.commons.lang.StringUtils; + + +/** + * @author cstrap + */ +public class MediaThumbnailVirtualUriMapping implements VirtualURIMapping +{ + + private static String PREFIX_MAPPING = "/mediathumbnail/"; + + /** + * {@inheritDoc} + */ + public MappingResult mapURI(String uri) + { + + if (uri.startsWith(PREFIX_MAPPING)) + { + String uuid = StringUtils.substringAfter(uri, PREFIX_MAPPING); + Content media = MediaEl.node(uuid); + if (media != null) + { + MappingResult mr = new MappingResult(); + mr.setToURI("redirect:" + MediaEl.thumbnail(media)); + mr.setLevel(1); + return mr; + } + } + + return null; + } + +} \ No newline at end of file Deleted: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/virtualurimapping/VirtualUriMappingMediaThumbOnGrid.java =================================================================== --- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/virtualurimapping/VirtualUriMappingMediaThumbOnGrid.java 2010-06-08 15:51:39 UTC (rev 2635) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/virtualurimapping/VirtualUriMappingMediaThumbOnGrid.java 2010-06-08 16:08:16 UTC (rev 2636) @@ -1,59 +0,0 @@ -/** - * - * Magnolia SimpleMedia Module (http://www.openmindlab.com/lab/products/media.html) - * Copyright (C)2008 - 2010, Openmind S.r.l. http://www.openmindonline.it - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package net.sourceforge.openutils.mgnlmedia.media.virtualurimapping; - -import info.magnolia.cms.beans.config.VirtualURIMapping; -import info.magnolia.cms.core.Content; -import net.sourceforge.openutils.mgnlmedia.media.tags.el.MediaEl; - -import org.apache.commons.lang.StringUtils; - - -/** - * @author cstrap - */ -public class VirtualUriMappingMediaThumbOnGrid implements VirtualURIMapping -{ - - private static String PREFIX_MAPPING = "/mediathumbnail/"; - - /** - * {@inheritDoc} - */ - public MappingResult mapURI(String uri) - { - - if (uri.startsWith(PREFIX_MAPPING)) - { - String uuid = StringUtils.substringAfter(uri, PREFIX_MAPPING); - Content media = MediaEl.node(uuid); - if (media != null) - { - MappingResult mr = new MappingResult(); - mr.setToURI("redirect:" + MediaEl.thumbnail(media)); - mr.setLevel(1); - return mr; - } - } - - return null; - } - -} \ No newline at end of file Deleted: trunk/openutils-mgnlmedia/src/main/resources/mgnl-bootstrap/media/config.modules.media.virtualURIMapping.thumbDocumentMapping.xml =================================================================== --- trunk/openutils-mgnlmedia/src/main/resources/mgnl-bootstrap/media/config.modules.media.virtualURIMapping.thumbDocumentMapping.xml 2010-06-08 15:51:39 UTC (rev 2635) +++ trunk/openutils-mgnlmedia/src/main/resources/mgnl-bootstrap/media/config.modules.media.virtualURIMapping.thumbDocumentMapping.xml 2010-06-08 16:08:16 UTC (rev 2636) @@ -1,38 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<sv:node sv:name="thumbDocumentMapping" xmlns:sv="http://www.jcp.org/jcr/sv/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <sv:property sv:name="jcr:primaryType" sv:type="Name"> - <sv:value>mgnl:contentNode</sv:value> - </sv:property> - <sv:property sv:name="jcr:mixinTypes" sv:type="Name"> - <sv:value>mix:lockable</sv:value> - </sv:property> - <sv:property sv:name="jcr:uuid" sv:type="String"> - <sv:value>13b23aa0-bf7e-47c4-a89b-3ce373f9d8c4</sv:value> - </sv:property> - <sv:property sv:name="class" sv:type="String"> - <sv:value>net.sourceforge.openutils.mgnlmedia.media.virtualurimapping.VirtualUriMappingMediaThumbOnGrid</sv:value> - </sv:property> - <sv:node sv:name="MetaData"> - <sv:property sv:name="jcr:primaryType" sv:type="Name"> - <sv:value>mgnl:metaData</sv:value> - </sv:property> - <sv:property sv:name="mgnl:activated" sv:type="Boolean"> - <sv:value>false</sv:value> - </sv:property> - <sv:property sv:name="mgnl:activatorid" sv:type="String"> - <sv:value>superuser</sv:value> - </sv:property> - <sv:property sv:name="mgnl:authorid" sv:type="String"> - <sv:value>admin</sv:value> - </sv:property> - <sv:property sv:name="mgnl:creationdate" sv:type="Date"> - <sv:value>2007-11-29T22:08:08.307+01:00</sv:value> - </sv:property> - <sv:property sv:name="mgnl:lastaction" sv:type="Date"> - <sv:value>2008-07-14T12:07:45.140+02:00</sv:value> - </sv:property> - <sv:property sv:name="mgnl:lastmodified" sv:type="Date"> - <sv:value>2010-05-17T10:08:17.852+02:00</sv:value> - </sv:property> - </sv:node> -</sv:node> \ No newline at end of file Added: trunk/openutils-mgnlmedia/src/main/resources/mgnl-bootstrap/media-nooverwrite/config.modules.media.virtualURIMapping.mediathumbs.xml =================================================================== --- trunk/openutils-mgnlmedia/src/main/resources/mgnl-bootstrap/media-nooverwrite/config.modules.media.virtualURIMapping.mediathumbs.xml (rev 0) +++ trunk/openutils-mgnlmedia/src/main/resources/mgnl-bootstrap/media-nooverwrite/config.modules.media.virtualURIMapping.mediathumbs.xml 2010-06-08 16:08:16 UTC (rev 2636) @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8"?> +<sv:node sv:name="mediathumbs" xmlns:sv="http://www.jcp.org/jcr/sv/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <sv:property sv:name="jcr:primaryType" sv:type="Name"> + <sv:value>mgnl:contentNode</sv:value> + </sv:property> + <sv:property sv:name="jcr:mixinTypes" sv:type="Name"> + <sv:value>mix:lockable</sv:value> + </sv:property> + <sv:property sv:name="jcr:uuid" sv:type="String"> + <sv:value>ee4e82be-d5bd-4c65-a529-2ba6a98b10d5</sv:value> + </sv:property> + <sv:property sv:name="class" sv:type="String"> + <sv:value>net.sourceforge.openutils.mgnlmedia.media.virtualurimapping.MediaThumbnailVirtualUriMapping</sv:value> + </sv:property> + <sv:property sv:name="jcr:createdBy" sv:type="String"> + <sv:value>admin</sv:value> + </sv:property> + <sv:node sv:name="MetaData"> + <sv:property sv:name="jcr:primaryType" sv:type="Name"> + <sv:value>mgnl:metaData</sv:value> + </sv:property> + <sv:property sv:name="jcr:createdBy" sv:type="String"> + <sv:value>admin</sv:value> + </sv:property> + <sv:property sv:name="mgnl:activated" sv:type="Boolean"> + <sv:value>false</sv:value> + </sv:property> + <sv:property sv:name="mgnl:activatorid" sv:type="String"> + <sv:value>superuser</sv:value> + </sv:property> + <sv:property sv:name="mgnl:authorid" sv:type="String"> + <sv:value>superuser</sv:value> + </sv:property> + <sv:property sv:name="mgnl:creationdate" sv:type="Date"> + <sv:value>2007-11-29T22:08:08.307+01:00</sv:value> + </sv:property> + <sv:property sv:name="mgnl:lastaction" sv:type="Date"> + <sv:value>2008-07-14T12:07:45.140+02:00</sv:value> + </sv:property> + <sv:property sv:name="mgnl:lastmodified" sv:type="Date"> + <sv:value>2010-06-08T18:03:48.865+02:00</sv:value> + </sv:property> + </sv:node> +</sv:node> Property changes on: trunk/openutils-mgnlmedia/src/main/resources/mgnl-bootstrap/media-nooverwrite/config.modules.media.virtualURIMapping.mediathumbs.xml ___________________________________________________________________ Added: svn:mime-type + text/xml Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |