|
From: <fg...@us...> - 2011-07-03 15:26:25
|
Revision: 3573
http://openutils.svn.sourceforge.net/openutils/?rev=3573&view=rev
Author: fgiust
Date: 2011-07-03 15:26:14 +0000 (Sun, 03 Jul 2011)
Log Message:
-----------
MEDIA-244 Make EL functions also accept a media UUID and not only a media node
Modified Paths:
--------------
trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/tags/el/MediaEl.java
trunk/openutils-mgnlmedia/src/main/resources/META-INF/media.tld
Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/tags/el/MediaEl.java
===================================================================
--- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/tags/el/MediaEl.java 2011-07-03 14:46:43 UTC (rev 3572)
+++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/tags/el/MediaEl.java 2011-07-03 15:26:14 UTC (rev 3573)
@@ -313,9 +313,9 @@
* @param media media
* @return url
*/
- public static String url(Content media)
+ public static String url(Object media)
{
- return urlParams(media, Collections.<String, String> emptyMap());
+ return urlParams(node(media), Collections.<String, String> emptyMap());
}
/**
@@ -324,8 +324,9 @@
* @param options optional parameters
* @return url
*/
- public static String urlParams(Content media, Map<String, String> options)
+ public static String urlParams(Object mediaref, Map<String, String> options)
{
+ Content media = node(mediaref);
if (media == null)
{
return null;
@@ -343,8 +344,11 @@
* @param media media to get the url for
* @return the thumbnail url for this media, null otherwise
*/
- public static String thumbnail(Content media)
+ public static String thumbnail(Object mediaref)
{
+
+ Content media = node(mediaref);
+
if (media == null)
{
return null;
@@ -362,13 +366,13 @@
* @param media media to get the type
* @return the type of this media if existing, null otherwise
*/
- public static String type(Content media)
+ public static String type(Object media)
{
if (media == null)
{
return null;
}
- return NodeDataUtil.getString(media, "type");
+ return NodeDataUtil.getString(node(media), "type");
}
/**
@@ -376,9 +380,11 @@
* @param media media to get the resolutions
* @return all resolution strings
*/
- public static String[] resolutions(Content media)
+ public static String[] resolutions(Object mediaref)
{
+ Content media = node(mediaref);
+
List<String> res = new ArrayList<String>();
Content resolutions = getResolutionsNode(media);
@@ -410,9 +416,11 @@
* @param resolution resolution
* @return url
*/
- public static String urlres(Content media, String resolution)
+ public static String urlres(Object mediaref, String resolution)
{
+ Content media = node(mediaref);
+
if (media == null)
{
return null;
@@ -462,8 +470,11 @@
* @param resolution resolution for witch calculate size
* @return size of an image
*/
- public static int[] size(Content media, String resolution)
+ public static int[] size(Object mediaref, String resolution)
{
+
+ Content media = node(mediaref);
+
if (media != null)
{
@@ -519,8 +530,11 @@
* @param media media
* @return the preview url for this media if existing, null otherwise
*/
- public static String preview(Content media)
+ public static String preview(Object mediaref)
{
+
+ Content media = node(mediaref);
+
if (media == null)
{
return null;
@@ -538,8 +552,11 @@
* @param media media to search in web pages
* @return an array of String(s) containing a list of web pages where this media is used, an empty array otherwise
*/
- public static String[] usedInWebPages(Content media)
+ public static String[] usedInWebPages(Object mediaref)
{
+
+ Content media = node(mediaref);
+
if (media == null)
{
log.warn("findMediaUsedInWebPages called with a null media");
@@ -569,8 +586,11 @@
* @param property property name
* @return the value of the given nodedata or null if not found
*/
- public static Object property(Content media, String property)
+ public static Object property(Object mediaref, String property)
{
+
+ Content media = node(mediaref);
+
try
{
if (media == null || !media.hasNodeData(property))
@@ -592,7 +612,7 @@
* @param media media Content
* @return width of the original media, if available
*/
- public static Integer width(Content media)
+ public static Integer width(Object media)
{
Number longproperty = (Number) property(media, MediaTypeHandler.METADATA_WIDTH);
if (longproperty != null)
@@ -607,7 +627,7 @@
* @param media media Content
* @return height of the original media, if available
*/
- public static Integer height(Content media)
+ public static Integer height(Object media)
{
Number longproperty = (Number) property(media, MediaTypeHandler.METADATA_HEIGHT);
if (longproperty != null)
Modified: trunk/openutils-mgnlmedia/src/main/resources/META-INF/media.tld
===================================================================
--- trunk/openutils-mgnlmedia/src/main/resources/META-INF/media.tld 2011-07-03 14:46:43 UTC (rev 3572)
+++ trunk/openutils-mgnlmedia/src/main/resources/META-INF/media.tld 2011-07-03 15:26:14 UTC (rev 3573)
@@ -160,11 +160,11 @@
</example>
</function>
<function>
- <description>Get the url to the media, given the media node itself</description>
+ <description>Get the url to the media, given the media node itself or its UUID</description>
<display-name>url</display-name>
<name>url</name>
<function-class>net.sourceforge.openutils.mgnlmedia.media.tags.el.MediaEl</function-class>
- <function-signature>java.lang.String url(info.magnolia.cms.core.Content)</function-signature>
+ <function-signature>java.lang.String url(java.lang.Object)</function-signature>
<example>
<![CDATA[
<c:set var="mediaNode" value="${media:node(content.image)}" />
@@ -180,11 +180,11 @@
<function-signature>java.lang.String getUrl2(info.magnolia.cms.core.Content, java.util.Map)</function-signature>
</function>
<function>
- <description>Get the url to the media, given the media node itself and an options map</description>
+ <description>Get the url to the media, given the media node itself or its UUID and a Map of options</description>
<display-name>url2</display-name>
<name>urlParams</name>
<function-class>net.sourceforge.openutils.mgnlmedia.media.tags.el.MediaEl</function-class>
- <function-signature>java.lang.String urlParams(info.magnolia.cms.core.Content, java.util.Map)</function-signature>
+ <function-signature>java.lang.String urlParams(java.lang.Object, java.util.Map)</function-signature>
<example>
<![CDATA[
<c:set var="mediaNode" value="${media:node(content.image)}" />
@@ -223,7 +223,7 @@
<display-name>urlres</display-name>
<name>urlres</name>
<function-class>net.sourceforge.openutils.mgnlmedia.media.tags.el.MediaEl</function-class>
- <function-signature>java.lang.String urlres(info.magnolia.cms.core.Content, java.lang.String)</function-signature>
+ <function-signature>java.lang.String urlres(java.lang.Object, java.lang.String)</function-signature>
<example>
<![CDATA[
<c:set var="mediaNode" value="${media:node(content.image)}" />
@@ -236,7 +236,7 @@
<display-name>resolutions</display-name>
<name>resolutions</name>
<function-class>net.sourceforge.openutils.mgnlmedia.media.tags.el.MediaEl</function-class>
- <function-signature>java.lang.String[] resolutions(info.magnolia.cms.core.Content)</function-signature>
+ <function-signature>java.lang.String[] resolutions(java.lang.Object)</function-signature>
<example>
<![CDATA[
<c:set var="mediaNode" value="${media:node(content.image)}" />
@@ -251,7 +251,7 @@
<display-name>thumbnail</display-name>
<name>thumbnail</name>
<function-class>net.sourceforge.openutils.mgnlmedia.media.tags.el.MediaEl</function-class>
- <function-signature>java.lang.String thumbnail(info.magnolia.cms.core.Content)</function-signature>
+ <function-signature>java.lang.String thumbnail(java.lang.Object)</function-signature>
<example>
<![CDATA[
<c:set var="mediaNode" value="${media:node(content.image)}" />
@@ -264,7 +264,7 @@
<display-name>preview</display-name>
<name>preview</name>
<function-class>net.sourceforge.openutils.mgnlmedia.media.tags.el.MediaEl</function-class>
- <function-signature>java.lang.String preview(info.magnolia.cms.core.Content)</function-signature>
+ <function-signature>java.lang.String preview(java.lang.Object)</function-signature>
<example>
<![CDATA[
<c:set var="mediaNode" value="${media:node(content.image)}" />
@@ -277,7 +277,7 @@
<display-name>type</display-name>
<name>type</name>
<function-class>net.sourceforge.openutils.mgnlmedia.media.tags.el.MediaEl</function-class>
- <function-signature>java.lang.String type(info.magnolia.cms.core.Content)</function-signature>
+ <function-signature>java.lang.String type(java.lang.Object)</function-signature>
<example>
<![CDATA[
<c:set var="mediaNode" value="${media:node(content.image)}" />
@@ -293,7 +293,7 @@
<display-name>size</display-name>
<name>size</name>
<function-class>net.sourceforge.openutils.mgnlmedia.media.tags.el.MediaEl</function-class>
- <function-signature>int[] size(info.magnolia.cms.core.Content, java.lang.String)</function-signature>
+ <function-signature>int[] size(java.lang.Object, java.lang.String)</function-signature>
<example>
<![CDATA[
<c:set var="mediaNode" value="${media:node(content.image)}" />
@@ -307,7 +307,7 @@
<display-name>usedInWebPages</display-name>
<name>usedInWebPages</name>
<function-class>net.sourceforge.openutils.mgnlmedia.media.tags.el.MediaEl</function-class>
- <function-signature>java.lang.String[] usedInWebPages(info.magnolia.cms.core.Content)</function-signature>
+ <function-signature>java.lang.String[] usedInWebPages(java.lang.Object)</function-signature>
<example>
<![CDATA[
<c:set var="mediaNode" value="${media:node(content.image)}" />
@@ -322,21 +322,21 @@
<display-name>width</display-name>
<name>width</name>
<function-class>net.sourceforge.openutils.mgnlmedia.media.tags.el.MediaEl</function-class>
- <function-signature>java.lang.Integer width(info.magnolia.cms.core.Content)</function-signature>
+ <function-signature>java.lang.Integer width(java.lang.Object)</function-signature>
</function>
<function>
<description>Returns the height of the *original* media, if available</description>
<display-name>height</display-name>
<name>height</name>
<function-class>net.sourceforge.openutils.mgnlmedia.media.tags.el.MediaEl</function-class>
- <function-signature>java.lang.Integer height(info.magnolia.cms.core.Content)</function-signature>
+ <function-signature>java.lang.Integer height(java.lang.Object)</function-signature>
</function>
<function>
<description>Returns a property (nodeData) of the media, given the media Content and the property name</description>
<display-name>property</display-name>
<name>property</name>
<function-class>net.sourceforge.openutils.mgnlmedia.media.tags.el.MediaEl</function-class>
- <function-signature>java.lang.Object property(info.magnolia.cms.core.Content, java.lang.String)</function-signature>
+ <function-signature>java.lang.Object property(java.lang.Object, java.lang.String)</function-signature>
</function>
<function>
<description></description>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <die...@us...> - 2011-10-22 06:20:30
|
Revision: 3673
http://openutils.svn.sourceforge.net/openutils/?rev=3673&view=rev
Author: diego_schivo
Date: 2011-10-22 06:20:23 +0000 (Sat, 22 Oct 2011)
Log Message:
-----------
MEDIA-263 Add mediaType handling to media column type for grid control
Modified Paths:
--------------
trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/grid/MediaGridColumnType.java
trunk/openutils-mgnlmedia/src/main/resources/mgnl-resources/media/js/MediaField.js
Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/grid/MediaGridColumnType.java
===================================================================
--- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/grid/MediaGridColumnType.java 2011-10-21 15:49:23 UTC (rev 3672)
+++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/grid/MediaGridColumnType.java 2011-10-22 06:20:23 UTC (rev 3673)
@@ -68,7 +68,14 @@
protected void addColumnData(Map<String, String> column, String propertyName, int colIndex, Map colMap,
Messages msgs)
{
- column.put("editor", "new Ed(new MediaField({}))");
+ StringBuilder sb = new StringBuilder();
+ sb.append("new Ed(new MediaField({");
+ if (colMap.get("mediaType") != null)
+ {
+ sb.append("mediaType: '" + String.valueOf(colMap.get("mediaType")) + "'");
+ }
+ sb.append("}))");
+ column.put("editor", sb.toString());
column.put(
"renderer",
"function(v, p, record){ return v ? '<img border=\"0\" alt=\"\" src=\""
Modified: trunk/openutils-mgnlmedia/src/main/resources/mgnl-resources/media/js/MediaField.js
===================================================================
--- trunk/openutils-mgnlmedia/src/main/resources/mgnl-resources/media/js/MediaField.js 2011-10-21 15:49:23 UTC (rev 3672)
+++ trunk/openutils-mgnlmedia/src/main/resources/mgnl-resources/media/js/MediaField.js 2011-10-22 06:20:23 UTC (rev 3673)
@@ -2,13 +2,15 @@
triggerClass: 'x-form-media-trigger',
+ mediaType: '',
+
onTriggerClick: function(){
if (this.disabled) return;
window.setNewMedia = function(nodeid, uuid, file, thumb){
this.setValue(uuid);
}.createDelegate(this);
- mgnlOpenWindow('/.magnolia/pages/mediaBrowser.html?nodeid=' + name + '&selectMedia=true&mgnlCK=' + mgnlGetCacheKiller(), 840, 560);
+ mgnlOpenWindow('/.magnolia/pages/mediaBrowser.html?nodeid=' + name + '&selectMedia=true&mediaType=' + this.mediaType + '&mgnlCK=' + mgnlGetCacheKiller(), 840, 560);
}
});
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fg...@us...> - 2011-11-20 17:24:39
|
Revision: 3701
http://openutils.svn.sourceforge.net/openutils/?rev=3701&view=rev
Author: fgiust
Date: 2011-11-20 17:24:32 +0000 (Sun, 20 Nov 2011)
Log Message:
-----------
MEDIA-274 New mediatype for SWF files - wip
Modified Paths:
--------------
trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/setup/MediaModuleVersionHandler.java
trunk/openutils-mgnlmedia/src/main/resources/net/sourceforge/openutils/mgnlmedia/media/lang/messages.properties
trunk/openutils-mgnlmedia/src/main/resources/net/sourceforge/openutils/mgnlmedia/media/lang/messages_it.properties
Added Paths:
-----------
trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/setup/AddExtensionToType.java
trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/setup/RemoveExtensionFromType.java
trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/types/impl/SwfTypeHandler.java
trunk/openutils-mgnlmedia/src/main/resources/mgnl-bootstrap/media-nooverwrite/config.modules.media.dialogs.mediaSwfDlg.xml
trunk/openutils-mgnlmedia/src/main/resources/mgnl-bootstrap/media-nooverwrite/config.modules.media.mediatypes.swf.xml
trunk/openutils-mgnlmedia/src/main/resources/mgnl-resources/media/icons/type-swf.png
Added: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/setup/AddExtensionToType.java
===================================================================
--- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/setup/AddExtensionToType.java (rev 0)
+++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/setup/AddExtensionToType.java 2011-11-20 17:24:32 UTC (rev 3701)
@@ -0,0 +1,102 @@
+/**
+ *
+ * SimpleMedia Module for Magnolia CMS (http://www.openmindlab.com/lab/products/media.html)
+ * Copyright(C) 2008-2011, 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.setup;
+
+import info.magnolia.cms.beans.config.ContentRepository;
+import info.magnolia.cms.core.Content;
+import info.magnolia.cms.core.HierarchyManager;
+import info.magnolia.module.InstallContext;
+import info.magnolia.module.delta.AbstractRepositoryTask;
+import info.magnolia.module.delta.TaskExecutionException;
+
+import javax.jcr.RepositoryException;
+
+import org.apache.commons.lang.StringUtils;
+
+
+/**
+ * @author fgiust
+ * @version $Id$
+ */
+public class AddExtensionToType extends AbstractRepositoryTask
+{
+
+ private final String extension;
+
+ private final String mediatype;
+
+ private final String control;
+
+ /**
+ * @param name
+ * @param description
+ */
+ public AddExtensionToType(String extension, String mediatype, String control)
+ {
+ super("Adding " + extension + " extension to mediatype " + mediatype, "Adding "
+ + extension
+ + " extension to mediatype "
+ + mediatype);
+ this.extension = extension;
+ this.mediatype = mediatype;
+ this.control = control;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void doExecute(InstallContext ctx) throws RepositoryException, TaskExecutionException
+ {
+
+ final HierarchyManager hm = ctx.getHierarchyManager(ContentRepository.CONFIG);
+ String nodePath = "/modules/media/mediatypes/" + this.mediatype;
+
+ try
+ {
+ final Content mediatypenode = hm.getContent(nodePath);
+ String extensions = mediatypenode.getNodeData("extensions").getString();
+ if (!StringUtils.contains(extensions, this.extension))
+ {
+ mediatypenode.setNodeData("extensions", extensions + "," + this.extension);
+ }
+ }
+ catch (RepositoryException e)
+ {
+ // ignore and skip
+ }
+
+ try
+ {
+ final Content mediatypenode = hm.getContent(control);
+ String extensions = mediatypenode.getNodeData("extensions").getString();
+ if (!StringUtils.contains(extensions, this.extension))
+ {
+ mediatypenode.setNodeData("extensions", extensions + "," + this.extension);
+ }
+ }
+ catch (RepositoryException e)
+ {
+ // ignore and skip
+ }
+
+ }
+
+}
Property changes on: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/setup/AddExtensionToType.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/setup/MediaModuleVersionHandler.java
===================================================================
--- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/setup/MediaModuleVersionHandler.java 2011-11-20 16:46:36 UTC (rev 3700)
+++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/setup/MediaModuleVersionHandler.java 2011-11-20 17:24:32 UTC (rev 3701)
@@ -179,49 +179,16 @@
"parseremotefiles",
Boolean.TRUE));
- // add "jpeg"
- tasks.add(new ChangeExistingPropertyTask(
- ContentRepository.CONFIG,
- "/modules/media/dialogs/mediaImageDlg/tabImage/original",
- "extensions",
- "jpg,gif,png",
- "jpg,jpeg,gif,png"));
- tasks.add(new ChangeExistingPropertyTask(
- ContentRepository.CONFIG,
- "/modules/media/mediatypes/image",
- "extensions",
- "jpg,gif,png",
- "jpg,jpeg,gif,png"));
+ tasks.add(new AddExtensionToType("jpeg", "image", "/modules/media/dialogs/mediaImageDlg/tabImage/original"));
+ tasks.add(new AddExtensionToType("ico", "image", "/modules/media/dialogs/mediaImageDlg/tabImage/original"));
- // add "ico"
- tasks.add(new ChangeExistingPropertyTask(
- ContentRepository.CONFIG,
- "/modules/media/dialogs/mediaImageDlg/tabImage/original",
- "extensions",
- "jpg,jpeg,gif,png",
- "jpg,jpeg,gif,png,ico"));
+ tasks.add(new AddExtensionToType("mp4", "video", "/modules/media/dialogs/mediaVideoDlg/tabVideo/original"));
+ tasks.add(new AddExtensionToType("mpv", "video", "/modules/media/dialogs/mediaVideoDlg/tabVideo/original"));
+ tasks.add(new AddExtensionToType("ogv", "video", "/modules/media/dialogs/mediaVideoDlg/tabVideo/original"));
- tasks.add(new ChangeExistingPropertyTask(
- ContentRepository.CONFIG,
- "/modules/media/mediatypes/image",
- "extensions",
- "jpg,jpeg,gif,png",
- "jpg,jpeg,gif,png,ico"));
+ tasks
+ .add(new RemoveExtensionFromType("swf", "video", "/modules/media/dialogs/mediaVideoDlg/tabVideo/original"));
- // add mp4
- tasks.add(new ChangeExistingPropertyTask(
- ContentRepository.CONFIG,
- "/modules/media/mediatypes/video",
- "extensions",
- "flv,swf",
- "flv,swf,mp4,m4v"));
- tasks.add(new ChangeExistingPropertyTask(
- ContentRepository.CONFIG,
- "/modules/media/dialogs/mediaVideoDlg/tabVideo/original",
- "extensions",
- "flv,swf",
- "flv,swf,mp4,m4v"));
-
// REVERT old stk support for magnolia < 4.3
if (isModuleInstalled("standard-templating-kit"))
{
Added: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/setup/RemoveExtensionFromType.java
===================================================================
--- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/setup/RemoveExtensionFromType.java (rev 0)
+++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/setup/RemoveExtensionFromType.java 2011-11-20 17:24:32 UTC (rev 3701)
@@ -0,0 +1,110 @@
+/**
+ *
+ * SimpleMedia Module for Magnolia CMS (http://www.openmindlab.com/lab/products/media.html)
+ * Copyright(C) 2008-2011, 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.setup;
+
+import info.magnolia.cms.beans.config.ContentRepository;
+import info.magnolia.cms.core.Content;
+import info.magnolia.cms.core.HierarchyManager;
+import info.magnolia.module.InstallContext;
+import info.magnolia.module.delta.AbstractRepositoryTask;
+import info.magnolia.module.delta.TaskExecutionException;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.jcr.RepositoryException;
+
+import org.apache.commons.lang.StringUtils;
+
+
+/**
+ * @author fgiust
+ * @version $Id$
+ */
+public class RemoveExtensionFromType extends AbstractRepositoryTask
+{
+
+ private final String extension;
+
+ private final String mediatype;
+
+ private final String control;
+
+ /**
+ * @param name
+ * @param description
+ */
+ public RemoveExtensionFromType(String extension, String mediatype, String control)
+ {
+ super("Adding " + extension + " extension to mediatype " + mediatype, "Adding "
+ + extension
+ + " extension to mediatype "
+ + mediatype);
+ this.extension = extension;
+ this.mediatype = mediatype;
+ this.control = control;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void doExecute(InstallContext ctx) throws RepositoryException, TaskExecutionException
+ {
+
+ final HierarchyManager hm = ctx.getHierarchyManager(ContentRepository.CONFIG);
+ String nodePath = "/modules/media/mediatypes/" + this.mediatype;
+
+ try
+ {
+ final Content mediatypenode = hm.getContent(nodePath);
+ String extensions = mediatypenode.getNodeData("extensions").getString();
+ if (StringUtils.contains(extensions, this.extension))
+ {
+ List<String> exts = new ArrayList<String>(Arrays.asList(StringUtils.split(extensions, ",")));
+ exts.remove(this.extension);
+ mediatypenode.setNodeData("extensions", StringUtils.join(exts, ","));
+ }
+ }
+ catch (RepositoryException e)
+ {
+ // ignore and skip
+ }
+
+ try
+ {
+ final Content mediatypenode = hm.getContent(control);
+ String extensions = mediatypenode.getNodeData("extensions").getString();
+ if (StringUtils.contains(extensions, this.extension))
+ {
+ List<String> exts = new ArrayList<String>(Arrays.asList(StringUtils.split(extensions, ",")));
+ exts.remove(this.extension);
+ mediatypenode.setNodeData("extensions", StringUtils.join(exts, ","));
+ }
+ }
+ catch (RepositoryException e)
+ {
+ // ignore and skip
+ }
+
+ }
+
+}
Property changes on: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/setup/RemoveExtensionFromType.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/java/net/sourceforge/openutils/mgnlmedia/media/types/impl/SwfTypeHandler.java
===================================================================
--- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/types/impl/SwfTypeHandler.java (rev 0)
+++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/types/impl/SwfTypeHandler.java 2011-11-20 17:24:32 UTC (rev 3701)
@@ -0,0 +1,29 @@
+/**
+ *
+ * SimpleMedia Module for Magnolia CMS (http://www.openmindlab.com/lab/products/media.html)
+ * Copyright(C) 2008-2011, 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.types.impl;
+
+/**
+ * @author fgiust
+ * @version $Id$
+ */
+public class SwfTypeHandler extends ImageTypeHandler
+{
+
+}
Property changes on: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/types/impl/SwfTypeHandler.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-nooverwrite/config.modules.media.dialogs.mediaSwfDlg.xml
===================================================================
--- trunk/openutils-mgnlmedia/src/main/resources/mgnl-bootstrap/media-nooverwrite/config.modules.media.dialogs.mediaSwfDlg.xml (rev 0)
+++ trunk/openutils-mgnlmedia/src/main/resources/mgnl-bootstrap/media-nooverwrite/config.modules.media.dialogs.mediaSwfDlg.xml 2011-11-20 17:24:32 UTC (rev 3701)
@@ -0,0 +1,304 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<sv:node sv:name="mediaSwfDlg" 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:uuid" sv:type="String">
+ <sv:value>2402c2ee-3e93-4648-afc4-aa0cb9d46fc7</sv:value>
+ </sv:property>
+ <sv:property sv:name="class" sv:type="String">
+ <sv:value>net.sourceforge.openutils.mgnlmedia.media.dialog.LayerDialogMVC</sv:value>
+ </sv:property>
+ <sv:property sv:name="height" sv:type="String">
+ <sv:value>500</sv:value>
+ </sv:property>
+ <sv:property sv:name="i18nBasename" sv:type="String">
+ <sv:value>net.sourceforge.openutils.mgnlmedia.media.lang.messages</sv:value>
+ </sv:property>
+ <sv:property sv:name="jcr:createdBy" sv:type="String">
+ <sv:value>admin</sv:value>
+ </sv:property>
+ <sv:property sv:name="label" sv:type="String">
+ <sv:value>media.dialogs.mediaSwfDlg.label</sv:value>
+ </sv:property>
+ <sv:property sv:name="width" sv:type="String">
+ <sv:value>520</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:Data" sv:type="String">
+ <sv:value>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>superuser</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:creationdate" sv:type="String">
+ <sv:value>2004-11-02T15:34:23.417+01:00</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:lastaction" sv:type="Date">
+ <sv:value>2008-07-02T15:10:45.780Z</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:lastmodified" sv:type="Date">
+ <sv:value>2011-11-19T22:59:58.052+01:00</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:title" sv:type="String">
+ <sv:value/>
+ </sv:property>
+ </sv:node>
+ <sv:node sv:name="tabVideo">
+ <sv:property sv:name="jcr:primaryType" sv:type="Name">
+ <sv:value>mgnl:contentNode</sv:value>
+ </sv:property>
+ <sv:property sv:name="jcr:uuid" sv:type="String">
+ <sv:value>a64f4eb5-a9cb-4c17-baab-7c4eb1d04c04</sv:value>
+ </sv:property>
+ <sv:property sv:name="controlType" sv:type="String">
+ <sv:value>tab</sv:value>
+ </sv:property>
+ <sv:property sv:name="jcr:createdBy" sv:type="String">
+ <sv:value>admin</sv:value>
+ </sv:property>
+ <sv:property sv:name="label" sv:type="String">
+ <sv:value>media.dialogs.tabSwf.label</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:Data" sv:type="String">
+ <sv:value>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>superuser</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:creationdate" sv:type="String">
+ <sv:value>2004-11-02T15:34:29.217+01:00</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:lastaction" sv:type="Date">
+ <sv:value>2008-07-02T15:10:54.979Z</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:lastmodified" sv:type="Date">
+ <sv:value>2011-11-19T23:00:08.911+01:00</sv:value>
+ </sv:property>
+ </sv:node>
+ <sv:node sv:name="original">
+ <sv:property sv:name="jcr:primaryType" sv:type="Name">
+ <sv:value>mgnl:contentNode</sv:value>
+ </sv:property>
+ <sv:property sv:name="jcr:uuid" sv:type="String">
+ <sv:value>f6b39267-7267-450e-aa59-c6ae3e3895ed</sv:value>
+ </sv:property>
+ <sv:property sv:name="controlType" sv:type="String">
+ <sv:value>mediaFile</sv:value>
+ </sv:property>
+ <sv:property sv:name="extensions" sv:type="String">
+ <sv:value>swf</sv:value>
+ </sv:property>
+ <sv:property sv:name="jcr:createdBy" sv:type="String">
+ <sv:value>admin</sv:value>
+ </sv:property>
+ <sv:property sv:name="label" sv:type="String">
+ <sv:value>media.dialogs.tabSwf.video.label</sv:value>
+ </sv:property>
+ <sv:property sv:name="required" sv:type="String">
+ <sv:value>true</sv:value>
+ </sv:property>
+ <sv:property sv:name="type" sv:type="String">
+ <sv:value>Binary</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:Data" sv:type="String">
+ <sv:value>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>superuser</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:creationdate" sv:type="String">
+ <sv:value>2004-11-02T15:34:29.357+01:00</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:lastaction" sv:type="Date">
+ <sv:value>2008-07-02T15:15:57.112Z</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:lastmodified" sv:type="Date">
+ <sv:value>2011-11-19T23:00:28.248+01:00</sv:value>
+ </sv:property>
+ </sv:node>
+ </sv:node>
+ <sv:node sv:name="image">
+ <sv:property sv:name="jcr:primaryType" sv:type="Name">
+ <sv:value>mgnl:contentNode</sv:value>
+ </sv:property>
+ <sv:property sv:name="jcr:uuid" sv:type="String">
+ <sv:value>a243137a-3013-4267-b8e3-097a066e004e</sv:value>
+ </sv:property>
+ <sv:property sv:name="controlType" sv:type="String">
+ <sv:value>mediaFile</sv:value>
+ </sv:property>
+ <sv:property sv:name="description" sv:type="String">
+ <sv:value>media.dialogs.mediaSwfDlg.tabSwf.image.description</sv:value>
+ </sv:property>
+ <sv:property sv:name="extensions" sv:type="String">
+ <sv:value>jpg,gif,png</sv:value>
+ </sv:property>
+ <sv:property sv:name="jcr:createdBy" sv:type="String">
+ <sv:value>admin</sv:value>
+ </sv:property>
+ <sv:property sv:name="label" sv:type="String">
+ <sv:value>media.dialogs.tabSwf.image.label</sv:value>
+ </sv:property>
+ <sv:property sv:name="type" sv:type="String">
+ <sv:value>Binary</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:Data" sv:type="String">
+ <sv:value>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>superuser</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:creationdate" sv:type="String">
+ <sv:value>2004-11-02T15:34:29.357+01:00</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:lastaction" sv:type="Date">
+ <sv:value>2008-07-02T15:14:49.217Z</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:lastmodified" sv:type="Date">
+ <sv:value>2011-11-19T23:00:51.872+01:00</sv:value>
+ </sv:property>
+ </sv:node>
+ </sv:node>
+ </sv:node>
+ <sv:node sv:name="tabAttributes">
+ <sv:property sv:name="jcr:primaryType" sv:type="Name">
+ <sv:value>mgnl:contentNode</sv:value>
+ </sv:property>
+ <sv:property sv:name="jcr:uuid" sv:type="String">
+ <sv:value>f0dbd995-a36e-4560-b204-868c67acedbd</sv:value>
+ </sv:property>
+ <sv:property sv:name="jcr:createdBy" sv:type="String">
+ <sv:value>admin</sv:value>
+ </sv:property>
+ <sv:property sv:name="reference" sv:type="String">
+ <sv:value>/modules/media/dialogs/common/tabAttributes</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:Data" sv:type="String">
+ <sv:value>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>superuser</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:creationdate" sv:type="String">
+ <sv:value>2004-11-02T15:34:29.217+01:00</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:lastaction" sv:type="Date">
+ <sv:value>2008-07-02T16:35:26.540Z</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:lastmodified" sv:type="Date">
+ <sv:value>2011-11-19T22:59:37.920+01:00</sv:value>
+ </sv:property>
+ </sv:node>
+ </sv:node>
+ <sv:node sv:name="type">
+ <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:multiple="true">
+ <sv:value>mix:lockable</sv:value>
+ </sv:property>
+ <sv:property sv:name="jcr:uuid" sv:type="String">
+ <sv:value>d93c93c6-22ec-4ad4-94c8-1aa6fe131521</sv:value>
+ </sv:property>
+ <sv:property sv:name="controlType" sv:type="String">
+ <sv:value>hidden</sv:value>
+ </sv:property>
+ <sv:property sv:name="defaultValue" sv:type="String">
+ <sv:value>swf</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>2008-06-21T10:51:52.322Z</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:lastaction" sv:type="Date">
+ <sv:value>2008-07-02T15:10:45.802Z</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:lastmodified" sv:type="Date">
+ <sv:value>2011-11-19T22:59:37.921+01:00</sv:value>
+ </sv:property>
+ </sv:node>
+ </sv:node>
+</sv:node>
Property changes on: trunk/openutils-mgnlmedia/src/main/resources/mgnl-bootstrap/media-nooverwrite/config.modules.media.dialogs.mediaSwfDlg.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/openutils-mgnlmedia/src/main/resources/mgnl-bootstrap/media-nooverwrite/config.modules.media.mediatypes.swf.xml
===================================================================
--- trunk/openutils-mgnlmedia/src/main/resources/mgnl-bootstrap/media-nooverwrite/config.modules.media.mediatypes.swf.xml (rev 0)
+++ trunk/openutils-mgnlmedia/src/main/resources/mgnl-bootstrap/media-nooverwrite/config.modules.media.mediatypes.swf.xml 2011-11-20 17:24:32 UTC (rev 3701)
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<sv:node sv:name="swf" 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:multiple="true">
+ <sv:value>mix:lockable</sv:value>
+ </sv:property>
+ <sv:property sv:name="jcr:uuid" sv:type="String">
+ <sv:value>b84c36d1-01ee-4f75-84a3-269da3b29798</sv:value>
+ </sv:property>
+ <sv:property sv:name="dialog" sv:type="String">
+ <sv:value>mediaSwfDlg</sv:value>
+ </sv:property>
+ <sv:property sv:name="enabled" sv:type="Boolean">
+ <sv:value>true</sv:value>
+ </sv:property>
+ <sv:property sv:name="extensions" sv:type="String">
+ <sv:value>swf</sv:value>
+ </sv:property>
+ <sv:property sv:name="i18nBasename" sv:type="String">
+ <sv:value>net.sourceforge.openutils.mgnlmedia.media.lang.messages</sv:value>
+ </sv:property>
+ <sv:property sv:name="jcr:createdBy" sv:type="String">
+ <sv:value>admin</sv:value>
+ </sv:property>
+ <sv:property sv:name="label" sv:type="String">
+ <sv:value>media.types.swf</sv:value>
+ </sv:property>
+ <sv:property sv:name="menuIcon" sv:type="String">
+ <sv:value>/.resources/media/icons/type-swf.png</sv:value>
+ </sv:property>
+ <sv:property sv:name="order" sv:type="Long">
+ <sv:value>15</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>2008-06-17T16:49:16.314Z</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:lastaction" sv:type="Date">
+ <sv:value>2008-06-17T16:51:17.750Z</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:lastmodified" sv:type="Date">
+ <sv:value>2011-11-19T22:59:05.138+01:00</sv:value>
+ </sv:property>
+ </sv:node>
+ <sv:node sv:name="handler">
+ <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:multiple="true">
+ <sv:value>mix:lockable</sv:value>
+ </sv:property>
+ <sv:property sv:name="jcr:uuid" sv:type="String">
+ <sv:value>7f9e15ed-1f85-4df8-bb63-0cd42c8f4902</sv:value>
+ </sv:property>
+ <sv:property sv:name="class" sv:type="String">
+ <sv:value>net.sourceforge.openutils.mgnlmedia.media.types.impl.SwfTypeHandler</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:authorid" sv:type="String">
+ <sv:value>superuser</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:creationdate" sv:type="Date">
+ <sv:value>2010-02-14T21:24:17.243+01:00</sv:value>
+ </sv:property>
+ <sv:property sv:name="mgnl:lastmodified" sv:type="Date">
+ <sv:value>2011-11-19T22:59:15.837+01:00</sv:value>
+ </sv:property>
+ </sv:node>
+ </sv:node>
+</sv:node>
Property changes on: trunk/openutils-mgnlmedia/src/main/resources/mgnl-bootstrap/media-nooverwrite/config.modules.media.mediatypes.swf.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/openutils-mgnlmedia/src/main/resources/mgnl-resources/media/icons/type-swf.png
===================================================================
(Binary files differ)
Property changes on: trunk/openutils-mgnlmedia/src/main/resources/mgnl-resources/media/icons/type-swf.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Modified: trunk/openutils-mgnlmedia/src/main/resources/net/sourceforge/openutils/mgnlmedia/media/lang/messages.properties
===================================================================
--- trunk/openutils-mgnlmedia/src/main/resources/net/sourceforge/openutils/mgnlmedia/media/lang/messages.properties 2011-11-20 16:46:36 UTC (rev 3700)
+++ trunk/openutils-mgnlmedia/src/main/resources/net/sourceforge/openutils/mgnlmedia/media/lang/messages.properties 2011-11-20 17:24:32 UTC (rev 3701)
@@ -55,13 +55,15 @@
media.types.youtube=External videos
media.types.video=Videos
media.types.document=Documents
+media.types.swf=SWF
-media.types.image.load=Upload new image
-media.types.audio.load=Upload new mp3
-media.types.youtube.load=Link external video
-media.types.video.load=Upload flv/mp4 video
-media.types.document.load=Upload new document
+media.types.image.load=Upload a new image
+media.types.audio.load=Upload a new mp3
+media.types.youtube.load=Link an external video
+media.types.video.load=Upload a flv/mp4 video
+media.types.document.load=Upload a new document
+media.types.swf.load=Upload a new SWF
media.download=Download
media.edit=Edit
@@ -165,3 +167,11 @@
config.search.filters.sorting=Sorting
media.info.media_originalpath=Original path: {0}
+
+media.dialogs.mediaSwfDialog.label=SWF
+media.dialogs.tabSwf.label=SWF
+media.dialogs.tabSwf.video.label=SWF file
+media.dialogs.tabSwf.image.label=Alternative image
+media.dialogs.mediaSwfDlg.tabSwf.image.description=The image will be shown if the browser doesn''t support flash
+
+media.types.all=All
Modified: trunk/openutils-mgnlmedia/src/main/resources/net/sourceforge/openutils/mgnlmedia/media/lang/messages_it.properties
===================================================================
--- trunk/openutils-mgnlmedia/src/main/resources/net/sourceforge/openutils/mgnlmedia/media/lang/messages_it.properties 2011-11-20 16:46:36 UTC (rev 3700)
+++ trunk/openutils-mgnlmedia/src/main/resources/net/sourceforge/openutils/mgnlmedia/media/lang/messages_it.properties 2011-11-20 17:24:32 UTC (rev 3701)
@@ -56,6 +56,7 @@
media.types.youtube=Video esterni
media.types.video=Video
media.types.document=Documenti
+media.types.swf=SWF
media.types.image.load=Carica immagine
@@ -63,6 +64,7 @@
media.types.youtube.load=Collega video esterno
media.types.video.load=Carica video flv/mp4
media.types.document.load=Carica documento
+media.types.swf.load=Carica SWF
media.download=Scarica
media.edit=Modifica
@@ -168,3 +170,13 @@
config.search.filters.sorting=Ordinamento
media.info.media_originalpath=Posizione originale: {0}
+
+media.dialogs.mediaSwfDialog.label=SWF
+media.dialogs.tabSwf.label=SWF
+media.dialogs.tabSwf.video.label=File SWF
+media.dialogs.tabSwf.image.label=Immagine alternativa
+media.dialogs.mediaSwfDlg.tabSwf.image.description=L''immagine sar\xE0 visualizzata se il browser non supporta flash
+
+media.types.all=Tutti
+
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fg...@us...> - 2011-11-20 17:59:36
|
Revision: 3702
http://openutils.svn.sourceforge.net/openutils/?rev=3702&view=rev
Author: fgiust
Date: 2011-11-20 17:59:29 +0000 (Sun, 20 Nov 2011)
Log Message:
-----------
MEDIA-274 SWF alt image and refactoring of existing mediatypes with preview
Modified Paths:
--------------
trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/types/impl/BaseVideoTypeHandler.java
trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/types/impl/DocumentTypeHandler.java
trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/types/impl/MediaWithPreviewImageTypeHandler.java
trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/types/impl/SwfTypeHandler.java
Added Paths:
-----------
trunk/openutils-mgnlmedia/src/main/resources/mgnl-resources/media/icons/thumb-swf.png
trunk/openutils-mgnlmedia/src/main/resources/mgnl-resources/media/icons/thumb-video.png
Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/types/impl/BaseVideoTypeHandler.java
===================================================================
--- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/types/impl/BaseVideoTypeHandler.java 2011-11-20 17:24:32 UTC (rev 3701)
+++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/types/impl/BaseVideoTypeHandler.java 2011-11-20 17:59:29 UTC (rev 3702)
@@ -107,4 +107,10 @@
return info;
}
+ @Override
+ public String getReplacementThumbnail()
+ {
+ return "/.resources/media/icons/thumb-video.png";
+ }
+
}
Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/types/impl/DocumentTypeHandler.java
===================================================================
--- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/types/impl/DocumentTypeHandler.java 2011-11-20 17:24:32 UTC (rev 3701)
+++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/types/impl/DocumentTypeHandler.java 2011-11-20 17:59:29 UTC (rev 3702)
@@ -37,9 +37,6 @@
import javax.jcr.PropertyType;
import javax.jcr.RepositoryException;
-import net.sourceforge.openutils.mgnlmedia.media.configuration.MediaConfigurationManager;
-import net.sourceforge.openutils.mgnlmedia.media.utils.ImageUtils;
-
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.pdfbox.pdmodel.PDDocument;
@@ -53,15 +50,10 @@
* @author dschivo
* @version $Id$
*/
-public class DocumentTypeHandler extends BaseTypeHandler
+public class DocumentTypeHandler extends MediaWithPreviewImageTypeHandler
{
/**
- * Nodedata name where preview media content is saved
- */
- public static final String PREVIEW_NODEDATA_NAME = "image";
-
- /**
* metadata containing the number of pages
*/
private static final String METADATA_PAGES = "media_pages";
@@ -74,35 +66,6 @@
/**
* {@inheritDoc}
*/
- public String getThumbnailUrl(Content media)
- {
- try
- {
- // check if a thumbnail has been generated
- if (media == null
- || !media.hasNodeData(PREVIEW_NODEDATA_NAME)
- || !ImageUtils.checkOrCreateResolution(media, "thumbnail", PREVIEW_NODEDATA_NAME))
- {
- return "/.resources/media/icons/thumb-document.png";
- }
- }
- catch (RepositoryException e)
- {
- return "/.resources/media/icons/thumb-document.png";
- }
-
- return MediaConfigurationManager.getInstance().getURIMappingPrefix()
- + media.getHandle()
- + "/resolutions/thumbnail/"
- + media.getName()
- + "."
- + ImageUtils.getExtension(media, "thumbnail");
-
- }
-
- /**
- * {@inheritDoc}
- */
@Override
public String getUrl(Content media)
{
@@ -175,7 +138,7 @@
PDPage page = pages.get(0);
- java.awt.image.BufferedImage image = page.convertToImage(BufferedImage.TYPE_INT_ARGB, 36);
+ java.awt.image.BufferedImage image = page.convertToImage(BufferedImage.TYPE_INT_ARGB, 72);
File file = File.createTempFile(filename, ".png");
ImageIO.write(image, "png", file);
@@ -248,4 +211,13 @@
}
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getReplacementThumbnail()
+ {
+ return "/.resources/media/icons/thumb-document.png";
+ }
}
Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/types/impl/MediaWithPreviewImageTypeHandler.java
===================================================================
--- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/types/impl/MediaWithPreviewImageTypeHandler.java 2011-11-20 17:24:32 UTC (rev 3701)
+++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/types/impl/MediaWithPreviewImageTypeHandler.java 2011-11-20 17:59:29 UTC (rev 3702)
@@ -20,12 +20,13 @@
package net.sourceforge.openutils.mgnlmedia.media.types.impl;
import info.magnolia.cms.core.Content;
+
+import javax.jcr.RepositoryException;
+
import net.sourceforge.openutils.mgnlmedia.media.configuration.MediaConfigurationManager;
import net.sourceforge.openutils.mgnlmedia.media.utils.ImageUtils;
-import org.apache.commons.lang.StringUtils;
-
/**
* Base class for medias that has a dynamic image as thumbnail
* @author molaschi
@@ -44,19 +45,37 @@
*/
public String getThumbnailUrl(Content media)
{
- if (!ImageUtils.checkOrCreateResolution(media, "thumbnail", PREVIEW_NODEDATA_NAME))
+ boolean hasPreview = false;
+
+ try
{
- return StringUtils.EMPTY;
+ hasPreview = media.hasNodeData(PREVIEW_NODEDATA_NAME);
}
+ catch (RepositoryException e)
+ {
+ // ignore
+ }
- return MediaConfigurationManager.getInstance().getURIMappingPrefix()
- + media.getHandle()
- + "/resolutions/thumbnail/"
- + media.getName()
- + "."
- + ImageUtils.getExtension(media, "thumbnail");
+ if (hasPreview)
+ {
+ if (!ImageUtils.checkOrCreateResolution(media, "thumbnail", PREVIEW_NODEDATA_NAME))
+ {
+ return "";
+ }
+ return MediaConfigurationManager.getInstance().getURIMappingPrefix()
+ + media.getHandle()
+ + "/resolutions/thumbnail/"
+ + media.getName()
+ + "."
+ + ImageUtils.getExtension(media, "thumbnail");
+ }
+
+ return getReplacementThumbnail();
+
}
+ public abstract String getReplacementThumbnail();
+
@Override
public String getPreviewImageNodeDataName()
{
Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/types/impl/SwfTypeHandler.java
===================================================================
--- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/types/impl/SwfTypeHandler.java 2011-11-20 17:24:32 UTC (rev 3701)
+++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/types/impl/SwfTypeHandler.java 2011-11-20 17:59:29 UTC (rev 3702)
@@ -19,11 +19,67 @@
package net.sourceforge.openutils.mgnlmedia.media.types.impl;
+import info.magnolia.cms.core.Content;
+import info.magnolia.cms.util.NodeDataUtil;
+
+import java.io.InputStream;
+
+import org.apache.commons.io.IOUtils;
+import org.devlib.schmidt.imageinfo.ImageInfo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
/**
+ * Type handler for Flash SWF files.
* @author fgiust
* @version $Id$
*/
-public class SwfTypeHandler extends ImageTypeHandler
+public class SwfTypeHandler extends MediaWithPreviewImageTypeHandler
{
+ /**
+ * Logger.
+ */
+ private Logger log = LoggerFactory.getLogger(SwfTypeHandler.class);
+
+ @Override
+ public boolean onPostSave(Content media)
+ {
+ InputStream stream = null;
+ try
+ {
+ stream = getOriginalFileNodeData(media).getStream();
+ ImageInfo ii = new ImageInfo();
+ ii.setInput(stream);
+ if (ii.check())
+ {
+ NodeDataUtil.getOrCreateAndSet(media, METADATA_WIDTH, ii.getWidth());
+ NodeDataUtil.getOrCreateAndSet(media, METADATA_HEIGHT, ii.getHeight());
+ media.save();
+ }
+
+ }
+ catch (Throwable e)
+ {
+ log.warn("Error extracting metadata "
+ + getOriginalFileNodeData(media).getHandle()
+ + " "
+ + e.getClass().getName()
+ + " "
+ + e.getMessage(), e);
+ }
+ finally
+ {
+ IOUtils.closeQuietly(stream);
+ }
+
+ return super.onPostSave(media);
+ }
+
+ @Override
+ public String getReplacementThumbnail()
+ {
+ return "/.resources/media/icons/thumb-swf.png";
+ }
}
Added: trunk/openutils-mgnlmedia/src/main/resources/mgnl-resources/media/icons/thumb-swf.png
===================================================================
(Binary files differ)
Property changes on: trunk/openutils-mgnlmedia/src/main/resources/mgnl-resources/media/icons/thumb-swf.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: trunk/openutils-mgnlmedia/src/main/resources/mgnl-resources/media/icons/thumb-video.png
===================================================================
(Binary files differ)
Property changes on: trunk/openutils-mgnlmedia/src/main/resources/mgnl-resources/media/icons/thumb-video.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|