You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wookie.apache.org by rg...@apache.org on 2011/10/27 17:21:07 UTC
svn commit: r1189802 - in /incubator/wookie/trunk/widgets/templates:
itemDetail/ itemDetail/lib/ itemDetail/scripts/ itemDetail/style/
testWidgets/itemDetailTestWidget/
Author: rgardler
Date: Thu Oct 27 15:21:07 2011
New Revision: 1189802
URL: http://svn.apache.org/viewvc?rev=1189802&view=rev
Log:
Add an initial item detail widget template. At present this is not overly useful since one cannot change the item being displayed. This is coming soon.
Added:
incubator/wookie/trunk/widgets/templates/itemDetail/
incubator/wookie/trunk/widgets/templates/itemDetail/default.widget.properties
incubator/wookie/trunk/widgets/templates/itemDetail/detail2html.xsl
incubator/wookie/trunk/widgets/templates/itemDetail/index.html
incubator/wookie/trunk/widgets/templates/itemDetail/lib/
- copied from r1189252, incubator/wookie/trunk/widgets/templates/browse/lib/
incubator/wookie/trunk/widgets/templates/itemDetail/readme.txt
incubator/wookie/trunk/widgets/templates/itemDetail/scripts/
incubator/wookie/trunk/widgets/templates/itemDetail/scripts/itemDetail_controller.js
incubator/wookie/trunk/widgets/templates/itemDetail/style/
incubator/wookie/trunk/widgets/templates/itemDetail/style/screen.css.add
incubator/wookie/trunk/widgets/templates/itemDetail/template_build.xml
incubator/wookie/trunk/widgets/templates/testWidgets/itemDetailTestWidget/
incubator/wookie/trunk/widgets/templates/testWidgets/itemDetailTestWidget/widget.properties
Added: incubator/wookie/trunk/widgets/templates/itemDetail/default.widget.properties
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/templates/itemDetail/default.widget.properties?rev=1189802&view=auto
==============================================================================
--- incubator/wookie/trunk/widgets/templates/itemDetail/default.widget.properties (added)
+++ incubator/wookie/trunk/widgets/templates/itemDetail/default.widget.properties Thu Oct 27 15:21:07 2011
@@ -0,0 +1,11 @@
+# The URL for retrieving the item detals in XML format.
+#
+# Variables: itemId is the id of the item to be displayed
+itemDetail.get.url="http://www.myexperiment.org/workflow.xml?id=" + itemId + "&all_elements=yes"
+
+# The initial itemID to use if none has been set.
+# This value will be overwritten by calling Widget.preferences.getItem("itemId");
+itemDetail.default.itemId=173
+
+# The XSL to transform the detail XML (from itemDetail.get.url) to HTML
+itemDetail.xsl.url="detail2html.xsl"
\ No newline at end of file
Added: incubator/wookie/trunk/widgets/templates/itemDetail/detail2html.xsl
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/templates/itemDetail/detail2html.xsl?rev=1189802&view=auto
==============================================================================
--- incubator/wookie/trunk/widgets/templates/itemDetail/detail2html.xsl (added)
+++ incubator/wookie/trunk/widgets/templates/itemDetail/detail2html.xsl Thu Oct 27 15:21:07 2011
@@ -0,0 +1,148 @@
+<!-- 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. -->
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+ <xsl:template match="/">
+ <xsl:apply-templates />
+ </xsl:template>
+
+ <xsl:template match="workflow">
+ <div class="workflow">
+ <div class="overview">
+ <xsl:apply-templates select="thumbnail-big" />
+ <div class="meta-data">
+ <xsl:apply-templates select="title" />
+ <xsl:apply-templates select="uploader" />
+ <div class="update-rating">
+ <xsl:apply-templates select="updated-at" />
+ <xsl:apply-templates select="ratings" />
+ </div>
+ <div class="version-info">
+ <xsl:apply-templates select="versions" />
+ <xsl:apply-templates select="type" />
+ <xsl:apply-templates select="license-type" />
+ </div>
+ </div>
+ <xsl:apply-templates select="description" />
+ </div>
+
+ <div class="clear">
+ <div class="boxed">
+ <xsl:apply-templates select="created-at" />
+ <xsl:apply-templates select="statistics" />
+ </div>
+ <div class="boxed">
+ <xsl:apply-templates select="tags" />
+ <p>FIXME: Groups should be here</p>
+ </div>
+ </div>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="title">
+ <h3>
+ <xsl:value-of select="." />
+ </h3>
+ </xsl:template>
+
+ <xsl:template match="ratings">
+ <div class="rating">
+ Rating:
+ <xsl:value-of select="sum(rating) div count(rating)" />
+ </div>
+ </xsl:template>
+
+ <xsl:template match="type">
+ <p>
+ Type:
+ <xsl:value-of select="." />
+ </p>
+ </xsl:template>
+
+ <xsl:template match="license-type">
+ <p>
+ License:
+ <xsl:value-of select="." />
+ </p>
+ </xsl:template>
+
+ <xsl:template match="versions">
+ <p>
+ Version:
+ <xsl:for-each select="workflow[last()]">
+ <xsl:number count="*"/>
+ </xsl:for-each>
+ </p>
+ </xsl:template>
+
+ <xsl:template match="uploader">
+ <p>
+ Uploaded By:
+ <xsl:value-of select="." />
+ </p>
+ </xsl:template>
+
+ <xsl:template match="thumbnail-big">
+
+ <div class="thumbnail">
+ <img width="241">
+ <xsl:attribute name="src"><xsl:value-of select="." /></xsl:attribute>
+ <xsl:attribute name="alt">Preview of the <xsl:value-of
+ select="../title" /> workflow.</xsl:attribute>
+ </img>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="updated-at">
+ <p>
+ Last Updated:
+ <xsl:value-of select="." />
+ </p>
+ </xsl:template>
+
+ <xsl:template match="created-at">
+ <p>
+ Created:
+ <xsl:value-of select="." />
+ </p>
+ </xsl:template>
+
+ <xsl:template match="description">
+ <div class="description">
+ <xsl:value-of select="." />
+ </div>
+ </xsl:template>
+
+ <xsl:template match="statistics">
+ <p>
+ Viewed:
+ <xsl:value-of select="viewings/total" />
+ </p>
+ <p>
+ Downloaded:
+ <xsl:value-of select="downloads/total" />
+ </p>
+ </xsl:template>
+
+ <xsl:template match="tags">
+ <p>
+ Tags:
+ <xsl:for-each select="tag">
+ <xsl:value-of select="." />
+ <xsl:if test="position() != last()">
+ <xsl:text>, </xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+ </p>
+ </xsl:template>
+
+</xsl:stylesheet>
Added: incubator/wookie/trunk/widgets/templates/itemDetail/index.html
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/templates/itemDetail/index.html?rev=1189802&view=auto
==============================================================================
--- incubator/wookie/trunk/widgets/templates/itemDetail/index.html (added)
+++ incubator/wookie/trunk/widgets/templates/itemDetail/index.html Thu Oct 27 15:21:07 2011
@@ -0,0 +1,138 @@
+<!--
+ 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.
+-->
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="pragma" content="no-cache" />
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<meta name="viewport" content="width=device-width, initial-scale=1">
+
+<link rel="stylesheet" href="style/all.css" />
+
+<link rel="stylesheet"
+ href="http://code.jquery.com/mobile/1.0rc2/jquery.mobile-1.0rc2.min.css" />
+<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.0rc2/jquery.mobile-1.0rc2.min.js"></script>
+
+<script type="text/javascript" src="lib/XSLTransform.js"></script>
+<script type="text/javascript" src="scripts/controller.js"></script>
+
+<title>${widget.name}</title>
+</head>
+
+<body>
+ <div data-role="page" class="type-home" id="home" data-theme="d">
+ <div data-role="header">
+ <img class="logo" src="images/myExperiment_logo_32h.png"
+ alt="MyExperiment" title="MyExperiment Logo" />
+ <div class="header_title" id="view_title">${widget.name}</div>
+ </div>
+ <!-- /header -->
+
+ <div data-role="content">
+
+ <div data-role="collapsible" class="content-secondary" data-theme="c"
+ data-content-theme="c">${content.secondary.actions}</div>
+ <!-- /content-secondary -->
+
+ <div class="content-primary" id="content-primary">
+ <div id="detail">
+ <p>NOTE: this section will be replaced by dynamic content when
+ the widget is run.</p>
+ <div class="overview">
+ <div class="thumbnail">
+ <img
+ src="http://www.myexperiment.org/workflows/16/versions/7/previews/medium.png"
+ /
+ alt="Preview image of the workflow" width="160">
+ </div>
+ <div class="meta-data">
+ <h3>Title</h3>
+ <p>Uploaded by:</p>
+ <div class="update-rating">
+ <div class="update"
+ <p>Last Updated</p>
+ </div>
+ <div class="rating">
+ <p>Rating</p>
+ </div>
+ </div>
+ <div class="clearer"/>
+ <div class="version-info">
+ <p>Version</p>
+ <p>Type</p>
+ <p>Licence</p>
+ </div>
+ </div>
+ <div class="description">
+ <p>This workflow searches for genes which reside in a QTL
+ (Quantitative Trait Loci) region in the mouse, Mus musculus. The
+ workflow requires an input of: a chromosome name or number; a
+ QTL start base pair position; QTL end base pair position. Data
+ is then extracted from BioMart to annotate each of the genes
+ found in this region. The Entrez and UniProt identifiers are
+ then sent to KEGG to obtain KEGG gene identifiers. The KEGG gene
+ identifiers are then used to searcg for pathways in the KEGG
+ pathway database.</p>
+ </div>
+ </div>
+
+ <div class="clear">
+
+ <div class="boxed">
+ <p>Created on</p>
+ <p>Viewed</p>
+ <p>Downloaded</p>
+ </div>
+
+ <div class="boxed">
+ <p>Tags:</p>
+ <p>Groups</p>
+ </div>
+ </div>
+ </div>
+ </div>
+ <!-- /content-primary -->
+ </div>
+ <!-- /content -->
+
+ <div data-role="footer" class="footer">
+ <div class="content">© University of Oxford</div>
+ <a class="button" href="#help" data-role="button" data-rel="dialog"
+ data-transition="pop" data-icon="info" data-iconpos="left">Help</a>
+
+ </div>
+ <!-- /footer -->
+ </div>
+ <!-- /page -->
+
+ <div data-role="dialog" id="help">
+ <div data-role="header">
+ <h4>Help: ${widget.name}</h4>
+ </div>
+ <!-- /header -->
+
+ <div data-role="content" class="ui-content" id="content-help">
+ ${widget.help}</div>
+ <!-- /content -->
+ </div>
+ <!-- /page -->
+
+</body>
+</html>
Added: incubator/wookie/trunk/widgets/templates/itemDetail/readme.txt
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/templates/itemDetail/readme.txt?rev=1189802&view=auto
==============================================================================
--- incubator/wookie/trunk/widgets/templates/itemDetail/readme.txt (added)
+++ incubator/wookie/trunk/widgets/templates/itemDetail/readme.txt Thu Oct 27 15:21:07 2011
@@ -0,0 +1,18 @@
+This template creates a widget capable of displaying the detail of an item retrieved from a REST API.
+
+In its default configuration an item is retrieved from the location defined by the property itemDetail.get.url.
+
+This is expected to return an XML document which is processed by the stylesheet defined in itemDetail.xsl.url.
+
+The initial item displayed is identified by the itemDetail.default.itemId property. However, this can be changed
+by calling Widget.preferences.setItem("itemId", value).
+
+TODO
+====
+
+Later iterations of this template will use a form of Inter-Widget Communication to allow other widgets to set
+the itemId. For example, it will be possible to use the browse template to force this widget to update to
+display an item defined in a browse widget.
+
+We also plan to add a configurable "actions" section to the widget that will allow a set of user enabled actions
+to be performed on the item, e.g. marking as a favourite.
\ No newline at end of file
Added: incubator/wookie/trunk/widgets/templates/itemDetail/scripts/itemDetail_controller.js
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/templates/itemDetail/scripts/itemDetail_controller.js?rev=1189802&view=auto
==============================================================================
--- incubator/wookie/trunk/widgets/templates/itemDetail/scripts/itemDetail_controller.js (added)
+++ incubator/wookie/trunk/widgets/templates/itemDetail/scripts/itemDetail_controller.js Thu Oct 27 15:21:07 2011
@@ -0,0 +1,51 @@
+/*
+ * 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.
+ */
+
+/**
+ * The ${widget.shortname}_controller object
+ * This is used to wire up the view and model with actions
+ */
+var ${widget.shortname}_browse_controller = {
+ init:function() {
+ var id = Widget.preferences.getItem("itemId");
+ if (id === undefined) {
+ id = ${itemDetail.default.itemId}
+ }
+ ${widget.shortname}_browse_controller.populate(id);
+ },
+
+ /**
+ * Populate the results list with data from a given URL. The data is transformed using the "index2html.xsl" stylesheet.
+ */
+ populate:function(itemId) {
+ var url = widget.proxify(${itemDetail.get.url});
+ $('#detail').remove();
+ var html = $.XSLTransform({
+ xmlurl:url,
+ xslurl:${itemDetail.xsl.url}
+ });
+ $('#content-primary').html(html).trigger("create");
+ }
+}
+
+/**
+ * Initialise page
+ */
+$('#home').live('pageshow',function(event) {
+ ${widget.shortname}_browse_controller.init();
+});
+
Added: incubator/wookie/trunk/widgets/templates/itemDetail/style/screen.css.add
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/templates/itemDetail/style/screen.css.add?rev=1189802&view=auto
==============================================================================
--- incubator/wookie/trunk/widgets/templates/itemDetail/style/screen.css.add (added)
+++ incubator/wookie/trunk/widgets/templates/itemDetail/style/screen.css.add Thu Oct 27 15:21:07 2011
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ */
+ /**
+ * Summary information for a results browser
+ */
+
+.thumbnail {
+ float:left;
+}
+
+.update {
+ float: left;
+}
+
+.rating {
+ float: right;
+}
+
+.update_rating {
+ width: 100%;
+}
+
+.clearer {
+ clear: right;
+}
+
+.version-info {
+}
+
+.clear {
+ clear:both;
+}
+
+.boxed {
+ border-style:solid;
+ border-color:gray;
+ border-width:1px;
+}
\ No newline at end of file
Added: incubator/wookie/trunk/widgets/templates/itemDetail/template_build.xml
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/templates/itemDetail/template_build.xml?rev=1189802&view=auto
==============================================================================
--- incubator/wookie/trunk/widgets/templates/itemDetail/template_build.xml (added)
+++ incubator/wookie/trunk/widgets/templates/itemDetail/template_build.xml Thu Oct 27 15:21:07 2011
@@ -0,0 +1,90 @@
+<?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="itemDetail_template">
+
+ <target name="_init_template"
+ description="Define any template specifc properties">
+ <echo message="+------------------------------------------"/>
+ <echo message="| Initialising template properties"/>
+ <echo message="+------------------------------------------"/>
+
+ <loadfile property="content.header"
+ srcFile="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>
+
+ <!-- load content from widget definition -->
+ <loadfile property="content.primary"
+ srcFile="content_primary.html"
+ failonerror="false">
+ <filterchain>
+ <expandproperties/>
+ </filterchain>
+ </loadfile>
+
+ <!-- load content from template definition -->
+ <loadfile property="content.primary"
+ srcFile="${template.dir}/${template.name}/content_primary.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="${template.dir}/${template.name}/content_footer.html"
+ failonerror="false">
+ <filterchain>
+ <expandproperties/>
+ </filterchain>
+ </loadfile>
+
+ <echoproperties destfile="${widget.build.dir}/${widget.shortname}.properties" prefix=""/>
+ </target>
+
+ <target name="_generate_from_parent_templates">
+ <echo message="+------------------------------------------"/>
+ <echo message="| There are no parent templates for ${template.name}"/>
+ <!-- <echo message="| Generating from parent templates for ${template.name}"/> -->
+ <echo message="+------------------------------------------"/>
+
+ <ant antfile="../../build.xml"
+ target="_generate_widget">
+ <property name="template.name" value="base"/>
+ </ant>
+ </target>
+</project>
\ No newline at end of file
Added: incubator/wookie/trunk/widgets/templates/testWidgets/itemDetailTestWidget/widget.properties
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/templates/testWidgets/itemDetailTestWidget/widget.properties?rev=1189802&view=auto
==============================================================================
--- incubator/wookie/trunk/widgets/templates/testWidgets/itemDetailTestWidget/widget.properties (added)
+++ incubator/wookie/trunk/widgets/templates/testWidgets/itemDetailTestWidget/widget.properties Thu Oct 27 15:21:07 2011
@@ -0,0 +1,6 @@
+template.name=itemDetail
+widget.shortname=ItemDetailTestWidget
+widget.name=Item Detail Test Widget (Tweet)
+widget.description=This is a demonstration of the item detail interface. It pulls the full details of a Tweet from the Twitter public timeline and displays it.
+widget.help=<p>This widget hardly requires instructions.</p>
+