|
From: <cs...@us...> - 2010-05-17 09:51:39
|
Revision: 2460
http://openutils.svn.sourceforge.net/openutils/?rev=2460&view=rev
Author: cstrap
Date: 2010-05-17 09:51:33 +0000 (Mon, 17 May 2010)
Log Message:
-----------
CONTROLS-27 Show thumb on grid improved, use always the uuid
Modified Paths:
--------------
trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/DialogGrid.java
trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/DialogGridSaveHandler.java
trunk/openutils-mgnlcontrols/src/main/resources/dialogs/grid.ftl
trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/MediaField.js
Added Paths:
-----------
trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/virtualurimapping/
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
Modified: trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/DialogGrid.java
===================================================================
--- trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/DialogGrid.java 2010-05-17 09:51:12 UTC (rev 2459)
+++ trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/DialogGrid.java 2010-05-17 09:51:33 UTC (rev 2460)
@@ -111,10 +111,10 @@
.getString(colConfig, "valueType"), "uuid");
if ("uuid".equals(valueType))
{
- Content node = ContentUtil.getContentByUUID("media", token);
- if (node != null)
+ if (StringUtils.startsWith(token, "/"))
{
- token = node.getHandle();
+ Content node = ContentUtil.getContentByUUID("media", token);
+ token = node != null ? node.getUUID() : token;
}
}
}
Modified: trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/DialogGridSaveHandler.java
===================================================================
--- trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/DialogGridSaveHandler.java 2010-05-17 09:51:12 UTC (rev 2459)
+++ trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/DialogGridSaveHandler.java 2010-05-17 09:51:33 UTC (rev 2460)
@@ -106,10 +106,10 @@
"valueType"), "uuid");
if ("uuid".equals(mediaValueType))
{
- Content node = ContentUtil.getContent("media", token);
- if (node != null)
+ if (StringUtils.startsWith(token, "/"))
{
- token = node.getUUID();
+ Content node = ContentUtil.getContentByUUID("media", token);
+ token = node != null ? node.getUUID() : token;
}
}
}
Modified: trunk/openutils-mgnlcontrols/src/main/resources/dialogs/grid.ftl
===================================================================
--- trunk/openutils-mgnlcontrols/src/main/resources/dialogs/grid.ftl 2010-05-17 09:51:12 UTC (rev 2459)
+++ trunk/openutils-mgnlcontrols/src/main/resources/dialogs/grid.ftl 2010-05-17 09:51:33 UTC (rev 2460)
@@ -154,7 +154,7 @@
editor: new Ed(new MediaField({
})),
renderer : function(v, p, record){
- return v ? '<img border="0" alt="" src="${request.contextPath}/mediaObject' + v + '/resolutions/thumbnail/data.jpg" [#if (colmap.previewWidth??)]width="${colmap.previewWidth}"[/#if] [#if (colmap.previewHeight??)]height="${colmap.previewHeight}"[/#if]/>' : v;
+ return v ? '<img border="0" alt="" src="${request.contextPath}/mediathumbnail/' + v + '" />' : v;
}
[#elseif (colmap.type?? && colmap.type = 'fckedit')]
editor: new Ed(new FckEditorField({
Modified: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/MediaField.js
===================================================================
--- trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/MediaField.js 2010-05-17 09:51:12 UTC (rev 2459)
+++ trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/MediaField.js 2010-05-17 09:51:33 UTC (rev 2460)
@@ -6,7 +6,7 @@
if (this.disabled) return;
window.setNewMedia = function(nodeid, uuid, file, thumb){
- this.setValue(thumb.replace(/^.*\/mediaObject\/(.*)\/resolutions\/.*$/, '/$1'));
+ this.setValue(uuid);
}.createDelegate(this);
mgnlOpenWindow('/.magnolia/pages/mediaBrowser.html?nodeid=' + name + '&selectMedia=true&mgnlCK=' + mgnlGetCacheKiller(), 800, 500);
}
Added: 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 (rev 0)
+++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/virtualurimapping/VirtualUriMappingMediaThumbOnGrid.java 2010-05-17 09:51:33 UTC (rev 2460)
@@ -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 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
Property changes on: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/virtualurimapping/VirtualUriMappingMediaThumbOnGrid.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: 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 (rev 0)
+++ trunk/openutils-mgnlmedia/src/main/resources/mgnl-bootstrap/media/config.modules.media.virtualURIMapping.thumbDocumentMapping.xml 2010-05-17 09:51:33 UTC (rev 2460)
@@ -0,0 +1,38 @@
+<?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
Property changes on: trunk/openutils-mgnlmedia/src/main/resources/mgnl-bootstrap/media/config.modules.media.virtualURIMapping.thumbDocumentMapping.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.
|