Author: rgardler
Date: Mon Oct 31 23:26:49 2011
New Revision: 1195718

URL: http://svn.apache.org/viewvc?rev=1195718&view=rev
Log:
allow widgets to define propertiese unique to themselves

Modified:
    incubator/wookie/trunk/widgets/templates/browse/default.widget.properties
    incubator/wookie/trunk/widgets/templates/browse/index.html
    incubator/wookie/trunk/widgets/templates/browse/scripts/browse_controller.js
    incubator/wookie/trunk/widgets/templates/build.xml

Modified: 
incubator/wookie/trunk/widgets/templates/browse/default.widget.properties
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/templates/browse/default.widget.properties?rev=1195718&r1=1195717&r2=1195718&view=diff
==============================================================================
--- incubator/wookie/trunk/widgets/templates/browse/default.widget.properties 
(original)
+++ incubator/wookie/trunk/widgets/templates/browse/default.widget.properties 
Mon Oct 31 23:26:49 2011
@@ -1,7 +1,10 @@
 # The URL from which to retrieve data for the browse index
 #
 # type: string
-browse.index.url="http://www.myexperiment.org/users.xml?sort=updated&order=reverse";
+# variables: query = query string entered into the search form
+#            sort = the sort term for APIs that support it
+#            order = the sort order for APId that support it
+browse.index.url="http://www.myexperiment.org/workflows.xml?sort="; + sort + 
"&order=" + order
 
 # URL of the stylesheet for transforming the index file returned from 
browse.index.url into html
 #
@@ -12,14 +15,18 @@ browse.index.xsl.url="index2html.xsl" 
 #
 # type: string
 # variables: query = query string entered into the search form
-browse.search.url="http://www.myexperiment.org/search.xml?query="; + query + 
"&type=workflow"
+#            sprt = the sort term for APIs that support it
+browse.search.url="http://www.myexperiment.org/search.xml?sort="; + sort + 
"&query=" + query + "&type=workflow"+ "&order=" + order
+
+# Default sort parameter for APIs that support sorting of the results
+browse.sort=updated
 
 # The URL from which to retrieve detailed 
 # information about an item
 #
 # type: string
 # variables: itemId is the ID of the item to display
-browse.get.detail.url=itemId + 
"&elements=thumbnail,uploader,type,license-type,description,updated-at"
+browse.get.detail.url=itemId + 
"&elements=id,thumbnail,uploader,type,license-type,description,updated-at"
 
 # URL of the stylesheet for transforming a record detail 
 # into HTML for display in the expanded index section

Modified: incubator/wookie/trunk/widgets/templates/browse/index.html
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/templates/browse/index.html?rev=1195718&r1=1195717&r2=1195718&view=diff
==============================================================================
--- incubator/wookie/trunk/widgets/templates/browse/index.html (original)
+++ incubator/wookie/trunk/widgets/templates/browse/index.html Mon Oct 31 
23:26:49 2011
@@ -48,71 +48,42 @@
 
                <div data-role="content">
 
-                       <div data-role="collapsible" class="content-secondary" 
data-theme="c"
-                               data-content-theme="c">
-                               <h2>Search and Filter</h2>
-
-                               <form
-                                       
action="javascript:${widget.shortname}_browse_controller.submitSearchForm()"
-                                       method="get">
-                                       <div data-role="fieldcontain">
-                                               <label 
for="searchString">Search:</label> <input type="text"
-                                                       name="searchString" 
id="searchString" value=""
-                                                       placeholder="Search 
terms..." />
-                                       </div>
-<!-- 
-                                       <div data-role="fieldcontain">
-                                               <label for="filter-term-1" 
class="ui-hidden-accessible">Filter
-                                                       term:</label> <input 
type="text" name="filter-term-1" id="filter-term-1"
-                                                       value="" 
placeholder="Filter term..." /> <label
-                                                       for="filter-by-1" 
class="ui-hidden-accessible">Filter in:</label>
-                                               <select name="filter-by-1" 
id="sort">
-                                                       <option 
value="type">Type</option>
-                                                       <option 
value="tag">Tag</option>
-                                                       <option 
value="user">User</option>
-                                                       <option 
value="license">Licence</option>
-                                                       <option 
value="group">Group</option>
-                                                       <option 
value="wsdl">WSDL</option>
-                                                       <option 
value="curation">Curation</option>
-                                               </select>
-                                       </div>
-
-                                       <div data-role="fieldcontain">
-                                               <label for="filter-term-2" 
class="ui-hidden-accessible">Filter
-                                                       term:</label> <input 
class="left" type="text" name="filter-term-2"
-                                                       id="filter-term-2" 
value="" placeholder="Filter term..." /> <label
-                                                       for="filter-by-2" 
class="ui-hidden-accessible">Filter in:</label>
-                                               <select name="filter-by-2" 
id="sort">
-                                                       <option 
value="type">Type</option>
-                                                       <option 
value="tag">Tag</option>
-                                                       <option 
value="user">User</option>
-                                                       <option 
value="license">Licence</option>
-                                                       <option 
value="group">Group</option>
-                                                       <option 
value="wsdl">WSDL</option>
-                                                       <option 
value="curation">Curation</option>
-                                               </select>
-                                       </div>
+                 <div data-role="collapsible" class="content-secondary" 
data-theme="c"
+                      data-content-theme="c">
+                   <h2>Search</h2>
+
+                   <form
+                      
action="javascript:${widget.shortname}_browse_controller.submitSearchForm()"
+                      method="get">
+                     <div data-role="fieldcontain">
+                       <label for="searchString">Search:</label> <input 
type="text"
+                                                                        
name="searchString" id="searchString" value=""
+                                                                        
placeholder="Search terms..." />
+                     </div>
+
+                     <div data-role="fieldcontain">
+                       <label for="sort">Sort:</label> 
+                       <select name="sort" id="sort"> creation time (created), 
update time (updated), title (title) and name (name) 
+                         <option value="updated">Updated</option>
+                         <option value="created">Created</option>
+                         <option value="title">Title</option>
+                         <option value="name">Name</option>
+                       </select>
+                     </div>
+
+                     <fieldset data-role="controlgroup" data-type="horizontal">
+                       <legend>Sort order</legend>
+                       <input type="radio" name="sortOrder" id="reverseOrder" 
value="reverse" checked="checked" />
+                       <label for="reverseOrder">Reverse</label>
+                       
+                       <input type="radio" name="sortOrder" id="forwardOrder" 
value="forward"  />
+                       <label for="forwardOrder">Forward</label>
+                     </fieldset>
 
-                                       <div data-role="fieldcontain">
-                                               <label for="filter-term-3" 
class="ui-hidden-accessible">Filter
-                                                       term:</label> <input 
class="left" type="text" name="filter-term-3"
-                                                       id="filter-term-3" 
value="" placeholder="Filter term..." /> <label
-                                                       for="filter-by-3" 
class="ui-hidden-accessible">Filter in:</label>
-                                               <select name="filter-by-3" 
id="sort">
-                                                       <option 
value="type">Type</option>
-                                                       <option 
value="tag">Tag</option>
-                                                       <option 
value="user">User</option>
-                                                       <option 
value="license">Licence</option>
-                                                       <option 
value="group">Group</option>
-                                                       <option 
value="wsdl">WSDL</option>
-                                                       <option 
value="curation">Curation</option>
-                                               </select>
-                                       </div>
--->
+                     <input type="submit" value="Search" />
+                   </form>
 
-                                       <input type="submit" value="Search" />
-                               </form>
-                       </div>
+                 </div>
                        <!-- /content-secondary -->
 
                        <div class="content-primary" id="content-primary">

Modified: 
incubator/wookie/trunk/widgets/templates/browse/scripts/browse_controller.js
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/templates/browse/scripts/browse_controller.js?rev=1195718&r1=1195717&r2=1195718&view=diff
==============================================================================
--- 
incubator/wookie/trunk/widgets/templates/browse/scripts/browse_controller.js 
(original)
+++ 
incubator/wookie/trunk/widgets/templates/browse/scripts/browse_controller.js 
Mon Oct 31 23:26:49 2011
@@ -26,26 +26,30 @@ var ${widget.shortname}_browse_controlle
     },
     
     /**
-     * Search the myExperiment system and display the results
+     * Search the remote service and sort results if possible.
      */
-    search:function(query) {
-               // Load data into the initial results list
-       if (query === undefined) {
-                 var url = widget.proxify(${browse.index.url});
+    search:function(query, sort, order) {
+       if (sort === undefined) {
+           sort = "${browse.sort}";
+       }
+       if (query === undefined || query == "") {
+           var url = widget.proxify(${browse.index.url});
        } else {
-               var url = widget.proxify(${browse.search.url});
+           var url = widget.proxify(${browse.search.url});
        }
        ${widget.shortname}_browse_controller.populate(url);
-       },
+    },
        
        
-       /**
-        * Extract the values from the search form, do the search and display 
the results.
-        */
-       submitSearchForm:function() {
-               var query = $('#searchString').val();
-               ${widget.shortname}_browse_controller.search(query);
-       },
+    /**
+     * Extract the values from the search form, do the search and display the 
results.
+     */
+    submitSearchForm:function() {
+       var query = $('#searchString').val();
+       var sort = $('#sort').val();
+       var order = ($("input[@name='sortOrder']:checked").val());
+       ${widget.shortname}_browse_controller.search(query, sort, order);
+    },
 
     /**
      * Update the display

Modified: incubator/wookie/trunk/widgets/templates/build.xml
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/templates/build.xml?rev=1195718&r1=1195717&r2=1195718&view=diff
==============================================================================
--- incubator/wookie/trunk/widgets/templates/build.xml (original)
+++ incubator/wookie/trunk/widgets/templates/build.xml Mon Oct 31 23:26:49 2011
@@ -87,6 +87,7 @@
           <propertyref prefix="wookie"/>
           <propertyref prefix="template."/>
           <propertyref prefix="widget."/>
+          <propertyref prefix="${widget.shortname}"/>
         </propertyset>
       </antcall>
 


Reply via email to