From: <mol...@us...> - 2009-08-26 13:37:10
|
Revision: 1318 http://openutils.svn.sourceforge.net/openutils/?rev=1318&view=rev Author: molaschi Date: 2009-08-26 13:36:56 +0000 (Wed, 26 Aug 2009) Log Message: ----------- MEDIA-9 add media tag for media rendering Modified Paths: -------------- trunk/openutils-mgnlmedia/pom.xml trunk/openutils-mgnlmedia/src/main/resources/META-INF/media.tld Added Paths: ----------- trunk/openutils-mgnlmedia/src/main/resources/META-INF/tags/media.tag Modified: trunk/openutils-mgnlmedia/pom.xml =================================================================== --- trunk/openutils-mgnlmedia/pom.xml 2009-08-26 12:55:45 UTC (rev 1317) +++ trunk/openutils-mgnlmedia/pom.xml 2009-08-26 13:36:56 UTC (rev 1318) @@ -91,6 +91,11 @@ <version>2.1</version> </dependency> <dependency> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils-elfunctions</artifactId> + <version>1.0</version> + </dependency> + <dependency> <groupId>com.drewnoakes</groupId> <artifactId>metadata-extractor</artifactId> <version>2.4.0-beta-1</version> Modified: trunk/openutils-mgnlmedia/src/main/resources/META-INF/media.tld =================================================================== --- trunk/openutils-mgnlmedia/src/main/resources/META-INF/media.tld 2009-08-26 12:55:45 UTC (rev 1317) +++ trunk/openutils-mgnlmedia/src/main/resources/META-INF/media.tld 2009-08-26 13:36:56 UTC (rev 1318) @@ -7,6 +7,169 @@ <tlib-version>1.1</tlib-version> <short-name>media</short-name> <uri>http://net.sourceforge.openutils/mgnlMedia</uri> + <tag-file> + <name>media</name> + <path>/META-INF/tags/media.tag</path> + <display-name>Media Tag</display-name> + <description> + <![CDATA[ + Media tag that renders according to media type. <br/> + + The following properties are supported: + <table> + <tr> + <th>Property</th> + <th>Required</th> + <th>Description</th> + </tr> + <tr> + <td> + id + </td> + <td> + false + </td> + <td> + html element id + </td> + </tr> + <tr> + <td> + item + </td> + <td> + true + </td> + <td> + media uuid or media content node + </td> + </tr> + <tr> + <td> + width + </td> + <td> + false for images, true for videos or mp3 + </td> + <td> + image or player width + </td> + </tr> + <tr> + <td> + height + </td> + <td> + false for images, true for videos or mp3 + </td> + <td> + image or player height + </td> + </tr> + <tr> + <td> + alt + </td> + <td> + false + </td> + <td> + alt / title on images. If not specified, the title of the media (if present) will be used + </td> + </tr> + <tr> + <td> + cssClass + </td> + <td> + false + </td> + <td> + cssClass to be applied on html element + </td> + </tr> + <tr> + <td> + style + </td> + <td> + false + </td> + <td> + style to be applied on html element + </td> + </tr> + <tr> + <td> + resize + </td> + <td> + false + </td> + <td> + valid values are 'fit', 'nocrop', 'crop' + </td> + </tr> + <tr> + <td> + autoPlay + </td> + <td> + false + </td> + <td> + auto starts the player without waiting for user play command + </td> + </tr> + <tr> + <td> + loop + </td> + <td> + false + </td> + <td> + loop video or audio + </td> + </tr> + <tr> + <td> + noPlayIcon + </td> + <td> + false + </td> + <td> + hide player icons + </td> + </tr> + <tr> + <td> + skin + </td> + <td> + false + </td> + <td> + set player skin + </td> + </tr> + </table> + + For videos or mp3s it needs the following scripts loaded in page: + <ul> + <li>.resources/media/js/mootools-1.2-core.js</li> + <li>.resources/media/js/mootools-1.2-more.js</li> + <li>.resources/media/js/mootools-1.2-swfobject.js</li> + </ul> + ]]> + </description> + <example> + <![CDATA[ + <media:media id="myMedia" item="${content.image}" /> + ]]> + </example> + </tag-file> <function> <name>node</name> <description>Load a node from the media repository, given the UUID of the media node.</description> Added: trunk/openutils-mgnlmedia/src/main/resources/META-INF/tags/media.tag =================================================================== --- trunk/openutils-mgnlmedia/src/main/resources/META-INF/tags/media.tag (rev 0) +++ trunk/openutils-mgnlmedia/src/main/resources/META-INF/tags/media.tag 2009-08-26 13:36:56 UTC (rev 1318) @@ -0,0 +1,150 @@ +<jsp:root version="2.0" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:c="http://java.sun.com/jsp/jstl/core" + xmlns:cms="cms-taglib" xmlns:cmsu="cms-util-taglib" xmlns:fmt="http://java.sun.com/jsp/jstl/fmt" xmlns:fn="http://java.sun.com/jsp/jstl/functions" + xmlns:media="http://net.sourceforge.openutils/mgnlMedia" xmlns:su="http://openutils.sf.net/openutils-stringutils"> + <jsp:directive.attribute name="id" required="false" rtexprvalue="true" /> + <jsp:directive.attribute name="item" required="true" rtexprvalue="true" type="java.lang.Object" /> + <jsp:directive.attribute name="width" required="false" rtexprvalue="true" type="java.lang.Integer" /> + <jsp:directive.attribute name="height" required="false" rtexprvalue="true" type="java.lang.Integer" /> + <jsp:directive.attribute name="alt" required="false" rtexprvalue="true" /> + <jsp:directive.attribute name="cssClass" required="false" rtexprvalue="true" /> + <jsp:directive.attribute name="style" required="false" rtexprvalue="true" /> + <jsp:directive.attribute name="resize" required="false" rtexprvalue="true" /> + <jsp:directive.attribute name="autoPlay" required="false" rtexprvalue="true" type="java.lang.Boolean" /> + <jsp:directive.attribute name="loop" required="false" rtexprvalue="true" type="java.lang.Boolean" /> + <jsp:directive.attribute name="noPlayIcon" required="false" rtexprvalue="true" type="java.lang.Boolean" /> + <jsp:directive.attribute name="skin" required="false" rtexprvalue="true" /> + <c:set value="${media:node(item)}" var="mediaNode" /> + <c:choose> + <c:when test="${!empty mediaNode}"> + <cms:setNode var="media" content="${mediaNode}" /> + <c:choose> + <c:when test="${media.type eq 'image' or media.type eq 'wallpaper'}"> + <c:set var="controlChar" value="" /> + <c:choose> + <c:when test="${resize eq 'nocrop'}"> + <c:set var="controlChar" value="o" /> + </c:when> + <c:when test="${resize eq 'fit'}"> + <c:set var="controlChar" value="l" /> + </c:when> + </c:choose> + <c:set var="resolution">${controlChar}${width}x${height}</c:set> + <c:set var="url" value="${media:urlres(mediaNode, resolution)}" /> + <c:if test="${!empty(url)}"> + <c:if test="${empty alt}"> + <c:set var="alt" value="${media:title(mediaNode)}" /> + </c:if> + <![CDATA[<img src="${pageContext.request.contextPath}${url}" alt="${alt}" title="${alt}"]]> + <c:if test="${not empty id}"> + <![CDATA[ id="${id}"]]> + </c:if> + <c:if test="${not empty width"> + <![CDATA[ width="${width}"]]> + </c:if> + <c:if test="${not empty height"> + <![CDATA[ height="${height}"]]> + </c:if> + <c:if test="${not empty cssClass}"> + <![CDATA[ class="${cssClass}"]]> + </c:if> + <c:if test="${not empty style}"> + <![CDATA[ style="${style}"]]> + </c:if> + <![CDATA[ />]]> + </c:if> + </c:when> + <c:when test="${media.type eq 'video'}"> + <c:set var="url" value="${media:url(mediaNode)}" /> + <c:if test="${!empty(url)}"> + <c:set var="previewId" value="preview-${su:randomAlphanumeric(6)}" /> + <div id="${previewId}" class="preview"> + <div id="no-player"> + </div> + </div> + <c:if test="${fn:endsWith(fn:toLowerCase(media:url(mediaNode)), 'flv')}"> + <c:set var="flashvars"> + <![CDATA[file=${pageContext.request.contextPath}${media:url(mediaNode)}&controlbar=over]]> + <c:if test="${autoPlay}"> + <![CDATA[&autostart=true]]> + </c:if> + <c:if test="${loop}"> + <![CDATA[&repeat=always]]> + </c:if> + <c:if test="${noPlayIcon}"> + <![CDATA[&icons=false]]> + </c:if> + <c:if test="${not empty skin}"> + <![CDATA[&skin=${skin}]]> + </c:if> + </c:set> + <script type='text/javascript'> + <![CDATA[ + window.addEvent('domready', function(){ + var swfobject = new SWFObject('${pageContext.request.contextPath}/.resources/media/players/player.swf','player','${width}','${height}','9','#ffffff'); + swfobject.addParam('allowfullscreen','true'); + swfobject.addParam('allowscriptaccess','always'); + swfobject.addParam('wmode','opaque'); + swfobject.addParam('flashvars', '${flashvars}'); + + var version = deconcept.SWFObjectUtil.getPlayerVersion(); + if (version["major"] == 0 || version["major"] < 9) { + $('no-player').setStyle('display','block'); + } else { + swfobject.write('${previewId}'); + } + });]]> + </script> + </c:if> + <c:if test="${fn:endsWith(fn:toLowerCase(media:url(mediaNode)), 'swf')}"> + <script type='text/javascript'> + <![CDATA[ + window.addEvent('domready', function(){ + var swfobject = new SWFObject('${pageContext.request.contextPath}${media:url(mediaNode)}', '${previewId}', "${width}", "${height}", "9.0.0"); + var version = deconcept.SWFObjectUtil.getPlayerVersion(); + if (version["major"] == 0 || version["major"] < 9) { + $('no-player').setStyle('display','block'); + } else { + swfobject.write('${previewId}'); + } + });]]> + </script> + </c:if> + </c:if> + </c:when> + <c:when test="${media.type eq 'youtube'}"> + <c:set var="url" value="${media:url(mediaNode)}" /> + <c:set var="previewImage" value="${su:substringAfterLast(url, 'v=')}" /> + <c:if test="${!empty(url)}"> + <c:set var="previewId" value="preview-${su:randomAlphanumeric(6)}" /> + <div id="${previewId}" class="preview"> + <div id="no-player"> + <!-- + <ma:message key="media.noFlashPlayerDetected" /> --> + </div> + </div> + <script type='text/javascript'> + <![CDATA[ + + window.addEvent('domready', function(){ + var swfobject = new SWFObject('${pageContext.request.contextPath}/.resources/media/players/player.swf','player','${width}','${height}','9','#ffffff'); + swfobject.addParam('allowfullscreen','true'); + swfobject.addParam('allowscriptaccess','always'); + swfobject.addParam('wmode','opaque'); + swfobject.addParam('flashvars','file=${media:url(mediaNode)}&controlbar=over&type=youtube&image=http://img.youtube.com/vi/${previewImage}/0.jpg'); + var version = deconcept.SWFObjectUtil.getPlayerVersion(); + if (version["major"] == 0 || version["major"] < 9) { + $('no-player').setStyle('display','block'); + } else { + swfobject.write('${previewId}'); + } + }); + ]]></script> + </c:if> + </c:when> + </c:choose> + </c:when> + <c:otherwise> + <![CDATA[<!-- missing media: ${item} -->]]> + </c:otherwise> + </c:choose> +</jsp:root> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |