[Yanel-commits] rev 28989 - in public/yanel/contributions/resources/flow-player: . src/java/com/wyonapictures/yanel/impl/resources/flv

simon at wyona.com simon at wyona.com
Sat Nov 17 00:19:33 CET 2007


Author: simon
Date: 2007-11-17 00:19:33 +0100 (Sat, 17 Nov 2007)
New Revision: 28989

Modified:
   public/yanel/contributions/resources/flow-player/
   public/yanel/contributions/resources/flow-player/resource.xml
   public/yanel/contributions/resources/flow-player/src/java/com/wyonapictures/yanel/impl/resources/flv/FlowPlayerResource.java
Log:
added some more configuration properties. made it works with rc-map


Property changes on: public/yanel/contributions/resources/flow-player
___________________________________________________________________
Name: svn:ignore
   + build


Modified: public/yanel/contributions/resources/flow-player/resource.xml
===================================================================
--- public/yanel/contributions/resources/flow-player/resource.xml	2007-11-16 17:36:18 UTC (rev 28988)
+++ public/yanel/contributions/resources/flow-player/resource.xml	2007-11-16 23:19:33 UTC (rev 28989)
@@ -10,11 +10,17 @@
 </description>
 
 <rtd>
+  <property name="width"/> <!-- optional. sample value 250px -->
+  <property name="height"/> <!-- optional. sample value 250px -->
+  <property name="configFileName"/> <!-- see http://flowplayer.org/documentation/config how to config -->
+  <!-- all following properties are ignored if configFileName is set -->
   <property name="flvPath"/> <!-- ignored if configFileName is used. -->
+  <property name="path-replace-tokens"/> <!-- optional, example: {1}.flv, see: org.wyona.yanel.core.util.WildcardReplacerHelper, ignored if flvPath is set -->
+  <property name="path-matcher"/> <!-- optional, example: **.*, see: org.wyona.yanel.core.util.WildcardReplacerHelper, ignored if flvPath is set -->
   <property name="title"/>
   <property name="splashImg"/> <!-- if not set standard splash image will be displayed. set to "none" if no splash image is desired. ignored if configFileName is used. -->
-  <property name="width"/> <!-- optional. sample value 250px -->
-  <property name="height"/> <!-- optional. sample value 250px -->
-  <property name="configFileName"/> <!-- see http://flowplayer.org/documentation/config how to config -->
+  <property name="showFullScreenButton"/> <!-- optional, [true/false], default false -->
+  <property name="showMenu"/> <!-- optional, [true/false], default false -->
+  <property name="initialScale"/> <!-- optional, [fit/half/orig/scale], default fit -->
 </rtd>
 </resource>

Modified: public/yanel/contributions/resources/flow-player/src/java/com/wyonapictures/yanel/impl/resources/flv/FlowPlayerResource.java
===================================================================
--- public/yanel/contributions/resources/flow-player/src/java/com/wyonapictures/yanel/impl/resources/flv/FlowPlayerResource.java	2007-11-16 17:36:18 UTC (rev 28988)
+++ public/yanel/contributions/resources/flow-player/src/java/com/wyonapictures/yanel/impl/resources/flv/FlowPlayerResource.java	2007-11-16 23:19:33 UTC (rev 28989)
@@ -14,6 +14,7 @@
 import org.wyona.yanel.core.attributes.viewable.View;
 import org.wyona.yanel.core.attributes.viewable.ViewDescriptor;
 import org.wyona.yanel.core.util.PathUtil;
+import org.wyona.yanel.core.util.WildcardReplacerHelper;
 import org.wyona.yanel.impl.resources.BasicXMLResource;
 import org.wyona.yarep.core.Repository;
 
@@ -113,20 +114,33 @@
                 splashImg = "{ url: '" + PathUtil.getResourcesHtdocsPath(this) + "wyona-pictures.jpg' },";
             }
             if (getResourceConfigProperty("splashImg") != null && !getResourceConfigProperty("splashImg").equals("none")) {
-                splashImg = "{ url: '" + getResourceConfigProperty("splashImg") + "' },";
+                splashImg = "{ url: '" + PathUtil.backToRealm(getPath()) + getResourceConfigProperty("splashImg") + "' },";
             }
+
             String flvPath;
             if (getResourceConfigProperty("flvPath") == null) {
-                flvPath = getPath().substring(0, getPath().indexOf(".")) + ".flv";
-                Repository dataRepo = getRealm().getRepository();
-                if(!dataRepo.existsNode(flvPath)) {
-                    log.error("No .flv file specified. tried to guess (" + flvPath + ") but nothing found.");
-                    throw new Exception("No .flv file specified.");
-                }
+                WildcardReplacerHelper dataPath = new WildcardReplacerHelper(getResourceConfigProperty("path-replace-tokens"), getResourceConfigProperty("path-matcher"));
+                flvPath = dataPath.getReplacedString(getPath().substring(getPath().lastIndexOf("/") + 1, getPath().length()));
             } else {
                 flvPath = getResourceConfigProperty("flvPath");
             }
-            IOUtils.write("fo.addVariable(\"config\", \"{ showPlayListButtons: true,  playList: [  " + splashImg + "  { url: '" + flvPath + "' } ], initialScale: 'fit' }\");", baos);
+
+            String showFullScreenButton = ", showFullScreenButton: false ";
+            if (getResourceConfigProperty("showFullScreenButton") != null && getResourceConfigProperty("showFullScreenButton").equals("true")) {
+                showFullScreenButton = ", showFullScreenButton: true ";
+            }
+            String showMenu = ", showMenu: false ";
+            if (getResourceConfigProperty("showMenu") != null && getResourceConfigProperty("showMenu").equals("true")) {
+                showMenu = ", showMenu: true ";
+            }
+            String initialScale;
+            if (getResourceConfigProperty("initialScale") == null) {
+                initialScale = ", initialScale: 'fit' ";
+            } else {
+                initialScale = ", initialScale: '" + getResourceConfigProperty("initialScale") + "' ";
+            }
+
+            IOUtils.write("fo.addVariable(\"config\", \"{ showPlayListButtons: true,  playList: [  " + splashImg + "  { url: '" + flvPath + "' } ]" + showMenu + showFullScreenButton + initialScale + " }\");", baos);
         }
         IOUtils.write("fo.write(\"flowplayerholder\");", baos);
         //IOUtils.write("// ]]>", baos);



More information about the Yanel-commits mailing list