Author: scottbw
Date: Thu Mar 8 20:59:57 2012
New Revision: 1298578
URL: http://svn.apache.org/viewvc?rev=1298578&view=rev
Log:
Created a basic "demo widget" page using the same style as the Wookie incubator
project page as a replacement for the Wookie JSP-based UI which will be removed
in 0.10. See WOOKIE-328
Added:
incubator/wookie/trunk/WebContent/demo/
incubator/wookie/trunk/WebContent/demo/alice.png (with props)
incubator/wookie/trunk/WebContent/demo/bob.png (with props)
incubator/wookie/trunk/WebContent/demo/index.htm
incubator/wookie/trunk/WebContent/demo/logo.png (with props)
incubator/wookie/trunk/WebContent/demo/wookie-connector.js
incubator/wookie/trunk/WebContent/demo/wookie.css
incubator/wookie/trunk/WebContent/demo/wookie.js
Added: incubator/wookie/trunk/WebContent/demo/alice.png
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/WebContent/demo/alice.png?rev=1298578&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/wookie/trunk/WebContent/demo/alice.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/wookie/trunk/WebContent/demo/bob.png
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/WebContent/demo/bob.png?rev=1298578&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/wookie/trunk/WebContent/demo/bob.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/wookie/trunk/WebContent/demo/index.htm
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/WebContent/demo/index.htm?rev=1298578&view=auto
==============================================================================
--- incubator/wookie/trunk/WebContent/demo/index.htm (added)
+++ incubator/wookie/trunk/WebContent/demo/index.htm Thu Mar 8 20:59:57 2012
@@ -0,0 +1,99 @@
+<!--
+/*
+ * Licensed 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.
+ */
+-->
+
+<html>
+ <head>
+ <title>Apache Wookie 0.10</title>
+ <script src="../shared/js/jquery/jquery-1.3.2.min.js"></script>
+ <script src="wookie-connector.js"></script>
+ <script src="wookie.js"></script>
+ <link rel="stylesheet" href="wookie.css"></link>
+ <style>
+ #preview{
+ width: 100%;
+ height: 500px;
+ }
+ .preview{
+ width: 48%;
+ margin: 1%;
+ float:left;
+ }
+ #navigation{
+ height: 600px;
+ overflow-y: scroll;
+ }
+
+
+
+ </style>
+ </head>
+
+ <body>
+
+ <!-- Title area -->
+ <div id="banner">
+ <img alt="Apache Wookie (Incubating)" src="logo.png">
+ <h1 class="title">Apache Wookie 0.10</h1>
+ </div>
+
+
+ <!-- Scrolling list of widgets -->
+ <div id="navigation">
+ </div>
+
+ <div id="content">
+ <p>Below you can preview widgets using two test users, Alice and
Bob.
+ Just click an icon or name of a widget displayed in the panel on
the left
+ of the page to display an instance of that widget for each of the
users.
+ </p>
+ <p>
+ If the widget supports it, Alice has been given extra privilages
+ (i.e. she can set the questions in a vote).
+ </p>
+ <p>A well implemented widget has
+ sensible fallback behaviour for unknown users. This page allows
you to both
+ see the widgets in operation and, during development, you can test
them here too.
+ </p>
+ <p>Remember, not all widgets are designed to be multi-user and
thus you may not
+ see any interaction between the two widget instances.
+ </p>
+ <!-- Preview area -->
+ <div id="preview">
+ <div id="preview_alice" class="preview">
+ <h1><img
src="http://localhost:8080/wookie/demo/alice.png"> Alice</h1>
+ <div id="preview_alice_widget">Select a widget on the
left</div>
+ </div>
+ <div id="preview_bob" class="preview">
+ <h1><img src="http://localhost:8080/wookie/demo/bob.png">
Bob</h1>
+ <div id="preview_bob_widget">Select a widget on the
left</div>
+ </div>
+ </div>
+ <p></p>
+ </div>
+
+ <div id="footer">
+ <div class="copyright">
+ <p>
+ Copyright © 2011-2012 The Apache Software Foundation,
Licensed under
+ the <a
href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version
2.0</a>.
+ <br>
+ Apache and the Apache feather logos are trademarks of The
Apache Software Foundation.
+ </p>
+ </div>
+ </div>
+
+ </body>
+</html>
Added: incubator/wookie/trunk/WebContent/demo/logo.png
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/WebContent/demo/logo.png?rev=1298578&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/wookie/trunk/WebContent/demo/logo.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/wookie/trunk/WebContent/demo/wookie-connector.js
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/WebContent/demo/wookie-connector.js?rev=1298578&view=auto
==============================================================================
--- incubator/wookie/trunk/WebContent/demo/wookie-connector.js (added)
+++ incubator/wookie/trunk/WebContent/demo/wookie-connector.js Thu Mar 8
20:59:57 2012
@@ -0,0 +1,223 @@
+/*
+ * 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.
+ */
+
+//
+// Wookie JavaScript Connector
+// @version 0.10
+//
+//
+// Example usage:
+//
+// Wookie.configureConnection("http://myserver.com/wookie", "MyAPIKey",
"MySharedDataKey");
+// Wookie.setCurrentUser("bob","the bobster","http://bob.com/bob.png");
+// var instance = Wookie.getOrCreateInstance(widgetURI);
+//
+
+var Wookie = {
+ widgets: [],
+ currentUser: null,
+ instances: {},
+ connection: null,
+
+ //
+ // Get available widgets, and send
+ // to the callback function when retrieved
+ //
+ getWidgets: function(callback){
+
+ //
+ // Use default connection if not set
+ //
+ if (Wookie.connection === null){
+ Wookie.configureConnection(null, null, null);
+ }
+
+ $.ajax({
+ url: Wookie.connection.url + "/widgets",
+ accept: "text/xml",
+ success:function(xml){
+ Wookie.widgets = [];
+ $(xml).find("widget").each(function(){
+ var widget = {};
+ widget.id = $(this).attr("id");
+ widget.name = $(this).find("name").text();
+
+ if ($(this).find("icon").length > 0){
+ widget.icon = $(this).find("icon").attr("src");
+ } else {
+ widget.icon = "../shared/images/defaultwidget.png";
+ }
+ Wookie.widgets.push(widget);
+ });
+ callback(Wookie.widgets);
+ },
+ error:function(err){
+ alert("error retrieving widgets");
+ }
+ });
+
+ },
+
+ setPreference: function(id, key, value){
+ //
+ // Use default connection if not set
+ //
+ if (Wookie.connection === null){
+ Wookie.configureConnection(null, null, null);
+ }
+
+ //
+ // Use default user if not set
+ //
+ if (Wookie.currentUser === null){
+ Wookie.setCurrentUser("test","test user",null);
+ }
+
+ var postdata = "api_key=";
+ postdata = postdata + encodeURI(Wookie.connection.apiKey);
+ postdata = postdata + "&shareddatakey=";
+ postdata = postdata + encodeURI(Wookie.connection.sharedDataKey);
+ postdata = postdata + "&userid=";
+ postdata = postdata + encodeURI(Wookie.currentUser.loginName);
+ postdata = postdata + "&widgetid=";
+ postdata = postdata + encodeURI(id);
+ postdata = postdata + "&is_public=false";
+ postdata = postdata + "&propertyname=";
+ postdata = postdata + encodeURI(key);
+ postdata = postdata + "&propertyvalue=";
+ postdata = postdata + encodeURI(value);
+ var url = Wookie.connection.url + "/properties";
+ $.ajax({
+ type: 'POST',
+ url: url,
+ data: postdata,
+ async: false
+ });
+ },
+
+ getOrCreateInstance: function(id) {
+
+ //
+ // Use default connection if not set
+ //
+ if (Wookie.connection === null){
+ Wookie.configureConnection(null, null, null);
+ }
+
+ //
+ // Use default user if not set
+ //
+ if (Wookie.currentUser === null){
+ Wookie.setCurrentUser("test","test user",null);
+ }
+
+ var key = id + ":" + Wookie.currentUser.loginName;
+
+ if (this.instances[key] === undefined) {
+ var postdata = "api_key=";
+ postdata = postdata + encodeURI(Wookie.connection.apiKey);
+ postdata = postdata + "&shareddatakey=";
+ postdata = postdata + encodeURI(Wookie.connection.sharedDataKey);
+ postdata = postdata + "&userid=";
+ postdata = postdata + encodeURI(Wookie.currentUser.loginName);
+ postdata = postdata + "&widgetid=";
+ postdata = postdata + encodeURI(id);
+ var url = Wookie.connection.url + "/widgetinstances";
+ $.ajax({
+ type: 'POST',
+ url: url,
+ data: postdata,
+ success: function(doc) {
+ url = $(doc).find("url").text();
+ title = $(doc).find("title").text();
+ height = $(doc).find("height").text();
+ width = $(doc).find("width").text();
+
+ var instance = {};
+ instance.url = url;
+ instance.id = id;
+ instance.title = title;
+ instance.height = height;
+ instance.width = width;
+ Wookie.instances[key]=instance;
+ },
+ async: false
+ });
+
+ var postdata = "api_key=";
+ postdata = postdata + encodeURI(Wookie.connection.apiKey);
+ postdata = postdata + "&shareddatakey=";
+ postdata = postdata + encodeURI(Wookie.connection.sharedDataKey);
+ postdata = postdata + "&userid=";
+ postdata = postdata + encodeURI(Wookie.currentUser.loginName);
+ postdata = postdata + "&widgetid=";
+ postdata = postdata + encodeURI(id);
+ postdata = postdata + "&participant_display_name=";
+ postdata = postdata + encodeURI(Wookie.currentUser.screenName);
+ postdata = postdata + "&participant_id=";
+ postdata = postdata + encodeURI(Wookie.currentUser.loginName);
+ postdata = postdata + "&participant_thumbnail_url=";
+ postdata = postdata + encodeURI(Wookie.currentUser.thumbnailUrl);
+ var url = Wookie.connection.url + "/participants";
+ $.ajax({
+ type: 'POST',
+ url: url,
+ data: postdata,
+ success: function(data) {
+ },
+ async: false
+ });
+ }
+ return Wookie.instances[key];
+ },
+
+ setCurrentUser: function(loginName, screenName, thumbnailUrl){
+ var user = {};
+ user.loginName = loginName;
+ user.screenName = screenName;
+ if (!thumbnailUrl || typeof thumbnailUrl === "undefined") {
+ user.thumbnailUrl = "";
+ } else {
+ user.thumbnailUrl = thumbnailUrl
+ }
+ Wookie.currentUser = user;
+ },
+
+ configureConnection: function(url, apiKey, sharedDataKey){
+ Wookie.connection = {};
+
+ if (!url || typeof url === "undefined") {
+ Wookie.connection.url = "http://localhost:8080/wookie";
+ } else {
+ Wookie.connection.url = url;
+ }
+
+ if (!apiKey || typeof apiKey === "undefined") {
+ Wookie.connection.apiKey = "TEST";
+ } else {
+ Wookie.connection.apiKey = apiKey;
+ }
+
+ if (!sharedDataKey || typeof sharedDataKey === "undefined") {
+ Wookie.connection.sharedDataKey = "mysharedkey";
+ } else {
+ Wookie.connection.sharedDataKey = sharedDataKey;
+ }
+ }
+}
\ No newline at end of file
Added: incubator/wookie/trunk/WebContent/demo/wookie.css
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/WebContent/demo/wookie.css?rev=1298578&view=auto
==============================================================================
--- incubator/wookie/trunk/WebContent/demo/wookie.css (added)
+++ incubator/wookie/trunk/WebContent/demo/wookie.css Thu Mar 8 20:59:57 2012
@@ -0,0 +1,157 @@
+/*
+* 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.
+*/
+body {
+ color: white;
+ font-family: Arial,Helvetica,sans-serif;
+ font-size: 11pt;
+ margin: 0;
+}
+
+a {
+ color: #339;
+ text-decoration: none;
+}
+
+a:visited {
+ color: #369;
+}
+
+a:hover {
+ color: #ddf;
+ background-color: #6badff;
+}
+
+.title {
+ float:right;
+}
+
+h1,h2,h3,h4,h5,h6 {
+ color: #6f3f00;
+}
+
+#content {
+ margin-top: 15px;
+ margin-left: 200px;
+ margin-right: 200px;
+ padding: 0 8px 40px;
+ color: black;
+ background: white;
+}
+
+#content h1,h2,h3,h4,h5,h6 {
+ color: #955500;
+ border-bottom: 1px solid #ffdaae;
+ font-weight: normal;
+ margin: 10px 0 15px;
+ padding: 5px 0;
+}
+
+#content h1 {
+ font-size: 18pt;
+ border: 1px solid #ffdaae;
+ -moz-border-radius: 10px;
+ border-radius: 10px;
+ padding: 15px;
+}
+
+#content h2 {
+ font-size: 16pt;
+}
+
+#content h3,h4,h5,h6 {
+ border-bottom: none;
+ color: #688a6f;
+ font-size: 14pt;
+ margin-bottom: 0;
+}
+
+#navigation {
+ border: 1px solid #ffdaae;
+ -moz-border-radius: 10px;
+ border-radius: 10px;
+ font-size: 85%;
+ color: #003;
+ float: left;
+ padding: 8px;
+ width: 160px;
+ background: white;
+ margin-left: 10px;
+ margin-right: 10px;
+}
+
+#navigation img {
+ padding-bottom: 15px;
+ margin-left: auto;
+ margin-right: auto;
+ display: block;
+}
+
+#navigation h1 {
+ color: #000;
+ font-size: 1.1em;
+ padding: 0;
+ margin-top: 0.8em;
+ margin-bottom: 0.5em;
+ border-bottom: 1px dotted #3487ef;
+}
+
+#navigation ul {
+ margin: 0 0;
+ padding: 0;
+ list-style: none;
+}
+
+#navigation li {
+ margin: 0;
+ padding: 0;
+}
+
+#navigation li a {
+ margin: 0;
+ color: #003;
+ text-decoration:none;
+}
+
+#navigation li a:visited {
+ color: #226;
+}
+
+#navigation li a:hover {
+ background-color: #6badff;
+ color: #000;
+}
+
+#footer {
+ margin-top: 15px;
+ margin-left: 200px;
+ margin-right: 200px;
+ border: 1px solid #ffdaae;
+ -moz-border-radius: 10px;
+ border-radius: 10px;
+ background-color:#b0b0b0;
+ color:#336;
+ font-size: 80%;
+ padding: 0 8px;
+}
+
+/* definition lists */
+dd {}
+dl {}
+dt {
+ display: inline;
+ float: left;
+}
\ No newline at end of file
Added: incubator/wookie/trunk/WebContent/demo/wookie.js
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/WebContent/demo/wookie.js?rev=1298578&view=auto
==============================================================================
--- incubator/wookie/trunk/WebContent/demo/wookie.js (added)
+++ incubator/wookie/trunk/WebContent/demo/wookie.js Thu Mar 8 20:59:57 2012
@@ -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.
+ */
+
+ $(document).ready(getWidgets);
+
+//
+// Get the current widgets installed and
+// show in the browse list
+//
+function getWidgets(){
+ Wookie.getWidgets(updateWidgets);
+}
+
+function updateWidgets(widgets){
+ for (var i=0;i<widgets.length;i++){
+ var widgetEntry = $("<div
id=\""+widgets[i].id+"\"class=\"widget\"><p><img
src=\""+widgets[i].icon+"\">"+widgets[i].name+"</p></div>");
+ var id = widgets[i].id;
+ $(widgetEntry).click(function(){
+ showWidget($(this).attr("id"));
+ });
+ $("#navigation").append(widgetEntry);
+ }
+}
+
+function showWidget(id){
+
Wookie.setCurrentUser("alice","alice","http://localhost:8080/wookie/demo/alice.png");
+ var widgetInstance = Wookie.getOrCreateInstance(id);
+ $("#preview_alice_widget").html('');
+ $("#preview_alice_widget").append("<iframe src='"+widgetInstance.url+"'
height='"+widgetInstance.height+"' width='"+widgetInstance.width+"'></iframe>");
+ Wookie.setPreference(id, "conference-manager","true");
+
+
Wookie.setCurrentUser("bob","bob","http://localhost:8080/wookie/demo/bob.png");
+ var widgetInstance = Wookie.getOrCreateInstance(id);
+ $("#preview_bob_widget").html('');
+ $("#preview_bob_widget").append("<iframe src='"+widgetInstance.url+"'
height='"+widgetInstance.height+"' width='"+widgetInstance.width+"'></iframe>");
+}
\ No newline at end of file