Author: rgardler
Date: Wed Aug 8 11:50:22 2012
New Revision: 1370743
URL: http://svn.apache.org/viewvc?rev=1370743&view=rev
Log:
add an asset player template - provides basic functionality for displaying
image slideshows and audio/video assets
Added:
incubator/wookie/trunk/widgets/templates/assetPlayer/
incubator/wookie/trunk/widgets/templates/assetPlayer/content_primary.html
(with props)
incubator/wookie/trunk/widgets/templates/assetPlayer/content_scripts.html
(with props)
incubator/wookie/trunk/widgets/templates/assetPlayer/content_secondary.html
(with props)
incubator/wookie/trunk/widgets/templates/assetPlayer/default.widget.properties
(with props)
incubator/wookie/trunk/widgets/templates/assetPlayer/readme.txt (with
props)
incubator/wookie/trunk/widgets/templates/assetPlayer/scripts/
incubator/wookie/trunk/widgets/templates/assetPlayer/scripts/asset_controller.js
(with props)
incubator/wookie/trunk/widgets/templates/assetPlayer/style/
incubator/wookie/trunk/widgets/templates/assetPlayer/style/screen.css.add
(with props)
incubator/wookie/trunk/widgets/templates/assetPlayer/template_build.xml
(with props)
Added: incubator/wookie/trunk/widgets/templates/assetPlayer/content_primary.html
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/templates/assetPlayer/content_primary.html?rev=1370743&view=auto
==============================================================================
--- incubator/wookie/trunk/widgets/templates/assetPlayer/content_primary.html
(added)
+++ incubator/wookie/trunk/widgets/templates/assetPlayer/content_primary.html
Wed Aug 8 11:50:22 2012
@@ -0,0 +1,5 @@
+<div>
+ <div id="player">
+ <img id="asset" src="" width="640" height="480"/>
+ </div>
+</div>
Propchange:
incubator/wookie/trunk/widgets/templates/assetPlayer/content_primary.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/wookie/trunk/widgets/templates/assetPlayer/content_primary.html
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/wookie/trunk/widgets/templates/assetPlayer/content_scripts.html
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/templates/assetPlayer/content_scripts.html?rev=1370743&view=auto
==============================================================================
--- incubator/wookie/trunk/widgets/templates/assetPlayer/content_scripts.html
(added)
+++ incubator/wookie/trunk/widgets/templates/assetPlayer/content_scripts.html
Wed Aug 8 11:50:22 2012
@@ -0,0 +1,3 @@
+<script type="text/javascript"
src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
+<script type="text/javascript"
src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"></script>
+<script type="text/javascript" src="scripts/controller.js"></script>
Propchange:
incubator/wookie/trunk/widgets/templates/assetPlayer/content_scripts.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/wookie/trunk/widgets/templates/assetPlayer/content_scripts.html
------------------------------------------------------------------------------
svn:executable = *
Added:
incubator/wookie/trunk/widgets/templates/assetPlayer/content_secondary.html
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/templates/assetPlayer/content_secondary.html?rev=1370743&view=auto
==============================================================================
--- incubator/wookie/trunk/widgets/templates/assetPlayer/content_secondary.html
(added)
+++ incubator/wookie/trunk/widgets/templates/assetPlayer/content_secondary.html
Wed Aug 8 11:50:22 2012
@@ -0,0 +1,17 @@
+<div>
+ <div id="gotoAlbum" data-role="button">
+ Change Photos
+ </div>
+
+ <div id="playPause" data-role="button">
+ Play
+ </div>
+
+ <div id="prev" data-role="button">
+ Previous Photo
+ </div>
+
+ <div id="next" data-role="button">
+ Next Photo
+ </div>
+</div>
Propchange:
incubator/wookie/trunk/widgets/templates/assetPlayer/content_secondary.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/wookie/trunk/widgets/templates/assetPlayer/content_secondary.html
------------------------------------------------------------------------------
svn:executable = *
Added:
incubator/wookie/trunk/widgets/templates/assetPlayer/default.widget.properties
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/templates/assetPlayer/default.widget.properties?rev=1370743&view=auto
==============================================================================
---
incubator/wookie/trunk/widgets/templates/assetPlayer/default.widget.properties
(added)
+++
incubator/wookie/trunk/widgets/templates/assetPlayer/default.widget.properties
Wed Aug 8 11:50:22 2012
@@ -0,0 +1,7 @@
+template.name=twoColumn
+widget.shortname=assetPlayer
+widget.name=MAAVIS Asset Player
+widget.description=An accessible asset player with minimal controls.
+twoColumn.primary.position=left
+twoColumn.secondary.position=right
+
Propchange:
incubator/wookie/trunk/widgets/templates/assetPlayer/default.widget.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/wookie/trunk/widgets/templates/assetPlayer/default.widget.properties
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/wookie/trunk/widgets/templates/assetPlayer/readme.txt
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/templates/assetPlayer/readme.txt?rev=1370743&view=auto
==============================================================================
--- incubator/wookie/trunk/widgets/templates/assetPlayer/readme.txt (added)
+++ incubator/wookie/trunk/widgets/templates/assetPlayer/readme.txt Wed Aug 8
11:50:22 2012
@@ -0,0 +1,17 @@
+* Asset Player Template
+The Asset Player Template allows new player widgets to be quickly and
+easily built. It can, by default, handle images, video and
+audio. However, at present there is no way for the template to
+differentiate between these. The appropriate tags, if not <img..> must
+be provide in the content_primary or content_secondary files when
+building a widget from this template.
+
+By defaul the template expects to find an <img...> tag with the ID
+"asset". This can be changed to an audio or video tag in the widgets
+that build on this template (see content_primary.html).
+
+** Functions
+
+ - play a collection of assets in a rolling "slideshow"
+ - move to the next asset
+ - move back tot he previous asset
Propchange: incubator/wookie/trunk/widgets/templates/assetPlayer/readme.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/wookie/trunk/widgets/templates/assetPlayer/readme.txt
------------------------------------------------------------------------------
svn:executable = *
Added:
incubator/wookie/trunk/widgets/templates/assetPlayer/scripts/asset_controller.js
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/templates/assetPlayer/scripts/asset_controller.js?rev=1370743&view=auto
==============================================================================
---
incubator/wookie/trunk/widgets/templates/assetPlayer/scripts/asset_controller.js
(added)
+++
incubator/wookie/trunk/widgets/templates/assetPlayer/scripts/asset_controller.js
Wed Aug 8 11:50:22 2012
@@ -0,0 +1,87 @@
+/**
+ * This provides the code for managing assets and collections of assets.
+ * It provides generic functionality that is applicable to all asset types
+ * and is therefore intended to be reused across all asset players.
+ */
+var ${widget.shortname}_asset_controller = {
+ idx: 0, // index of current asset being displayed,
+ auto: false, // indicates if we are auto playing assets
+ staticDuration: 5000, // interval between auto play of static assets (e.g.
photo's)
+ interval: null, // the interval object that controls the auto player
+
+ init:function() {
+ // register button events
+ $('#next').click(function() {
+ ${widget.shortname}_asset_controller.nextAsset();
+ });
+
+ $('#prev').click(function() {
+ ${widget.shortname}_asset_controller.prevAsset();
+ });
+
+ $('#gotoAlbum').click(function() {
+ alert("gotoAlbum not implemented yet");
+ });
+
+ $('#playPause').click(function() {
+ if (!${widget.shortname}_asset_controller.auto) {
+ ${widget.shortname}_asset_controller.startAuto();
+ // FIXME: this breaks layout - as it overwrides JQuery markup
+ this.innerText = "Pause";
+ } else {
+ ${widget.shortname}_asset_controller.stopAuto();
+ // FIXME: this breaks layout - as it overwrides JQuery markup
+ this.innerText = "Play";
+ }
+ });
+ },
+
+ setCollection:function(album){
+ sessionStorage.setItem('collection', JSON.stringify(album));
+ // FIXME: cache images for faster slideshow. e.g.
http://www.anthonymclin.com/code/7-miscellaneous/98-on-demand-image-loading-with-jquery
+ ${widget.shortname}_asset_controller.displayAsset(0);
+ },
+
+ getCollection:function() {
+ return JSON.parse(sessionStorage.getItem('collection'));
+ },
+
+ displayAsset:function(idx) {
+ var album = ${widget.shortname}_asset_controller.getCollection();
+ $('#asset').attr("src", album[idx].src);
+ },
+
+ nextAsset:function() {
+ var album = ${widget.shortname}_asset_controller.getCollection();
+ ${widget.shortname}_asset_controller.idx += 1;
+ if (${widget.shortname}_asset_controller.idx >= album.length) {
+ ${widget.shortname}_asset_controller.idx = 0;
+ };
+
${widget.shortname}_asset_controller.displayAsset(${widget.shortname}_asset_controller.idx);
+ },
+
+ prevAsset:function() {
+ var album = ${widget.shortname}_asset_controller.getCollection();
+ ${widget.shortname}_asset_controller.idx -= 1;
+ if (${widget.shortname}_asset_controller.idx <0) {
+ ${widget.shortname}_asset_controller.idx = album.length - 1;
+ };
+
${widget.shortname}_asset_controller.displayAsset(${widget.shortname}_asset_controller.idx);
+ },
+
+ startAuto:function() {
+ ${widget.shortname}_asset_controller.auto = true;
+ ${widget.shortname}_asset_controller.interval =
+ window.setInterval(${widget.shortname}_asset_controller.nextAsset,
+
${widget.shortname}_asset_controller.staticDuration);
+ },
+
+ stopAuto:function() {
+ ${widget.shortname}_asset_controller.auto = false;
+ window.clearInterval(${widget.shortname}_asset_controller.interval);
+ }
+};
+
+$('#home').live('pageshow',function(event) {
+ ${widget.shortname}_asset_controller.init();
+});
Propchange:
incubator/wookie/trunk/widgets/templates/assetPlayer/scripts/asset_controller.js
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/wookie/trunk/widgets/templates/assetPlayer/scripts/asset_controller.js
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/wookie/trunk/widgets/templates/assetPlayer/style/screen.css.add
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/templates/assetPlayer/style/screen.css.add?rev=1370743&view=auto
==============================================================================
--- incubator/wookie/trunk/widgets/templates/assetPlayer/style/screen.css.add
(added)
+++ incubator/wookie/trunk/widgets/templates/assetPlayer/style/screen.css.add
Wed Aug 8 11:50:22 2012
@@ -0,0 +1,5 @@
+.gallery { list-style: none; padding: 0; margin: 0; }
+.gallery:after { clear: both; content: "."; display: block; height: 0;
visibility: hidden; }
+.gallery li { float: left; width: 33.33333333%; }
+.gallery li a { display: block; margin: 5px; border: 1px solid #3c3c3c; }
+.gallery li img { display: block; width: 100%; height: auto; }
\ No newline at end of file
Propchange:
incubator/wookie/trunk/widgets/templates/assetPlayer/style/screen.css.add
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/wookie/trunk/widgets/templates/assetPlayer/template_build.xml
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/templates/assetPlayer/template_build.xml?rev=1370743&view=auto
==============================================================================
--- incubator/wookie/trunk/widgets/templates/assetPlayer/template_build.xml
(added)
+++ incubator/wookie/trunk/widgets/templates/assetPlayer/template_build.xml Wed
Aug 8 11:50:22 2012
@@ -0,0 +1,161 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project basedir="." name="assetPlayer_template">
+
+ <target name="_init_template"
+ description="Define any template specific properties">
+ <echo message="+------------------------------------------"/>
+ <echo message="| Initialising template properties for ${template.name}"/>
+ <echo message="+------------------------------------------"/>
+
+ <loadfile property="content.scripts"
+ srcFile="content_scripts.html"
+ failonerror="false">
+ <filterchain>
+ <expandproperties/>
+ </filterchain>
+ </loadfile>
+
+ <loadfile property="content.scripts"
+ srcFile="${template.dir}/${template.name}/content_scripts.html"
+ failonerror="false">
+ <filterchain>
+ <expandproperties/>
+ </filterchain>
+ </loadfile>
+
+ <loadfile property="content.header"
+ srcFile="content_header.html"
+ failonerror="false">
+ <filterchain>
+ <expandproperties/>
+ </filterchain>
+ </loadfile>
+
+ <loadfile property="content.header"
+ srcFile="../common/content_header.html"
+ failonerror="false">
+ <filterchain>
+ <expandproperties/>
+ </filterchain>
+ </loadfile>
+
+ <loadfile property="content.header"
+ srcFile="${template.dir}/${template.name}/content_header.html"
+ failonerror="false">
+ <filterchain>
+ <expandproperties/>
+ </filterchain>
+ </loadfile>
+
+ <loadfile property="content.primary"
+ srcFile="content_primary.html"
+ failonerror="false">
+ <filterchain>
+ <expandproperties/>
+ </filterchain>
+ </loadfile>
+
+ <loadfile property="content.primary"
+ srcFile="../common/content_primary.html"
+ failonerror="false">
+ <filterchain>
+ <expandproperties/>
+ </filterchain>
+ </loadfile>
+
+ <loadfile property="content.primary"
+ srcFile="${template.dir}/${template.name}/content_primary.html"
+ failonerror="false">
+ <filterchain>
+ <expandproperties/>
+ </filterchain>
+ </loadfile>
+
+ <loadfile property="content.secondary"
+ srcFile="content_secondary.html"
+ failonerror="false">
+ <filterchain>
+ <expandproperties/>
+ </filterchain>
+ </loadfile>
+
+
+ <loadfile property="content.secondary"
+ srcFile="../common/content_secondary.html"
+ failonerror="false">
+ <filterchain>
+ <expandproperties/>
+ </filterchain>
+ </loadfile>
+
+ <loadfile property="content.secondary"
+ srcFile="${template.dir}/${template.name}/content_secondary.html"
+ failonerror="false">
+ <filterchain>
+ <expandproperties/>
+ </filterchain>
+ </loadfile>
+
+ <loadfile property="content.footer"
+ srcFile="content_footer.html"
+ failonerror="false">
+ <filterchain>
+ <expandproperties/>
+ </filterchain>
+ </loadfile>
+
+ <loadfile property="content.footer"
+ srcFile="../common/content_footer.html"
+ failonerror="false">
+ <filterchain>
+ <expandproperties/>
+ </filterchain>
+ </loadfile>
+
+ <loadfile property="content.footer"
+ srcFile="${template.dir}/${template.name}/content_footer.html"
+ failonerror="false">
+ <filterchain>
+ <expandproperties/>
+ </filterchain>
+ </loadfile>
+
+ <!-- load properties we've set in other templates -->
+ <property file="${widget.build.dir}/${widget.shortname}.properties"/>
+ <!-- write the full property set for this template -->
+ <echoproperties
destfile="${widget.build.dir}/${widget.shortname}.properties" prefix=""/>
+ </target>
+
+ <target name="_prepare_template_files"
+ description="move all template files into the build director">
+
+ </target>
+
+ <target name="_generate_from_parent_templates">
+ <echo message="+------------------------------------------"/>
+ <echo message="| Generating from parent templates for ${template.name}"/>
+ <echo message="+------------------------------------------"/>
+
+ <ant antfile="../build.xml"
+ target="_generate_widget">
+ <property name="template.name" value="twoColumn"/>
+ <property name="copyWidgetFiles" value="false"/>
+ </ant>
+ </target>
+</project>
\ No newline at end of file
Propchange:
incubator/wookie/trunk/widgets/templates/assetPlayer/template_build.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/wookie/trunk/widgets/templates/assetPlayer/template_build.xml
------------------------------------------------------------------------------
svn:executable = *
Propchange:
incubator/wookie/trunk/widgets/templates/assetPlayer/template_build.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml