You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2011/08/06 07:59:33 UTC

svn commit: r1154447 [2/3] - in /tuscany/sca-cpp/trunk/modules: edit/ edit/htdocs/ edit/htdocs/account/ edit/htdocs/app/ edit/htdocs/clone/ edit/htdocs/create/ edit/htdocs/data/ edit/htdocs/graph/ edit/htdocs/login/ edit/htdocs/logout/ edit/htdocs/page...

Modified: tuscany/sca-cpp/trunk/modules/edit/htdocs/graph/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/edit/htdocs/graph/index.html?rev=1154447&r1=1154446&r2=1154447&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/edit/htdocs/graph/index.html (original)
+++ tuscany/sca-cpp/trunk/modules/edit/htdocs/graph/index.html Sat Aug  6 05:59:32 2011
@@ -17,7 +17,7 @@
  * specific language governing permissions and limitations
  * under the License.    
 -->
-<html>
+<html manifest="/cache-manifest.cmf">
 <head>
 <title></title>
 <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0"/> 
@@ -29,49 +29,65 @@
 <script type="text/javascript" src="/menu.js"></script>
 <script type="text/javascript" src="graph.js"></script>
 </head>
-<body class="delayed" onload="ui.onload();">
-<div id="bodydiv" class="devicewidth">
+<body class="delayed" onload="ui.onload();" onbeforeunload="ui.onbeforeunload();">
+<div id="bodydiv" class="bodydiv" style="overflow: visible;">
 
 <div id="headdiv" class="hsection">
 <script type="text/javascript" src="/headconfig.js"></script>
 </div>
 
+<div id="menubackground" style="position: absolute; top: 0px; left: 0px; z-index: -1; width: 2500px;">
+<table cellpadding="0" cellspacing="0" width="100%" class="tbar"><tr><td class="dtbar">
+<table border="0" cellspacing="0" cellpadding="0"><tr><td class="ltbar"><span class="tbarsmenu">>&nbsp</span></td></tr></table>
+</td></tr></table>
+</div>
+
 <div id="menu"></div>
 
 <table style="width: 100%;">
 <tr>
-<td><h2><span id="h1"></span><span id="appNameHeader"></span></h2></td>
-<td style="vertical-align: middle; text-align: right; padding-right: 2px;"><span id="saveStatus" style="font-weight: bold; color: #808080;">Saved</span></td>
+<td><h2><span id="appNameHeader"></span></h2></td>
+<td style="vertical-align: middle; text-align: right; padding-right: 8px;"><span id="saveStatus" style="font-weight: bold; color: #808080;">Saved</span></td>
 </tr>
 </table>
 
-<table style="width: 100%;">
+<table id="compValueBackground" style="width: 2500px; position: absolute; top: 59px; left: 0px; z-index: -1;">
 <tr>
-<th class="thr thl" style="padding-left: 2px; padding-right: 2px; width: 100%">
+<th class="thr thl"><span style="display: inline-block; padding-top: 0px; padding-bottom: 0px; height: 24px;"></span></th>
+</tr>
+</table>
+
+<table id="compValueTable" style="width: 100%;">
+<tr>
+<td class="thr thl" style="padding-left: 2px; padding-right: 2px; vertical-align: top; width: 100%">
 <input id="compValue" type="text" value="" title="Component value" autocapitalize="off" placeholder="Value" style="position: relative; width: 100%;"/>
-</th>
+</td>
 
-<th class="thl thr" style="text-align: right; padding-right: 2px;">
-<span id="deleteCompButton" title="Delete a component" class="redbutton" style="font-weight: bold; font-size: 16px; color: #808080; display: inline-block; width: 24px; height: 20px; padding-top: 0px; padding-bottom: 0px; vertical-align: middle; text-align: center; margin-left: 0px; margin-right: 0px;">-</span>
+<td class="thl thr" style="text-align: right; padding-right: 2px; vertical-align: top;">
+<span id="deleteCompButton" title="Delete a component" class="graybutton" style="font-weight: bold; font-size: 16px; color: #808080; display: inline-block; width: 24px; height: 20px; padding-top: 0px; padding-bottom: 0px; text-align: center; margin-left: 0px; margin-right: 0px;">-</span>
 
-<span id="addCompButton" title="Add a component" class="greenbutton" style="font-weight: bold; font-size: 16px; display: inline-block; width: 24px; height: 20px; padding-top: 0px; padding-bottom: 0px; vertical-align: middle; text-align: center; margin-left: 0px; margin-right: 0px;">+</span>
+<span id="copyCompButton" title="Copy a component" class="graybutton" style="font-weight: bold; font-size: 16px; color: #808080; display: inline-block; width: 24px; height: 20px; padding-top: 0px; padding-bottom: 0px; text-align: center; margin-left: 0px; margin-right: 0px;">c</span>
 
-<span id="playCompButton" title="View component value" class="bluebutton" style="font-weight: bold; font-size: 16px; color: #808080; display: inline-block; width: 24px; height: 20px; padding-top: 0px; padding-bottom: 0px; vertical-align: middle; text-align: center; margin-left: 0px; margin-right: 0px;">&gt;</span>
-</th>
+<span id="addCompButton" title="Add a component" class="graybutton" style="font-weight: bold; font-size: 16px; display: inline-block; width: 24px; height: 20px; padding-top: 0px; padding-bottom: 0px; text-align: center; margin-left: 0px; margin-right: 0px;">+</span>
+
+<span id="playCompButton" title="View component value" class="graybutton" style="font-weight: bold; font-size: 16px; color: #808080; display: inline-block; width: 24px; height: 20px; padding-top: 0px; padding-bottom: 0px; text-align: center; margin-left: 0px; margin-right: 0px;">&gt;</span>
+</td>
 </tr>
 </table>
 
-<div id="contentdiv" style="margin-top: 4px; width: 100%;">
-<div id="playdiv" style="position:relative; top: 0x; left: 0px; right: 0px; height: 5000px; visibility: hidden">
+<div id="contentdiv" style="margin-top: 4px; width: 2500px;">
+<div id="playdiv" style="position:relative; top: 0x; left: 0px; right: 0px; width: 2500px; height: 5000px; visibility: hidden">
 </div>
 </div>
 
 <script type="text/javascript">
+ui.initbody();
+
 // Get the app name
-var appname = ui.queryParams()['app'];
+var appname = ui.fragmentParams()['app'];
 var ispalette = false;
 if (isNil(appname)) {
-    appname = ui.queryParams()['palette'];
+    appname = ui.fragmentParams()['palette'];
     if (isNil(appname))
         window.open('/', '_self');
 
@@ -94,8 +110,7 @@ function applink(appname) {
 
 // Set page titles
 document.title = windowtitle(window.location.hostname) + ' - ' + (isNil(config.compose)? 'Composition' : config.compose) + ' - ' + appname;
-//$('h1').innerHTML = hometitle(window.location.hostname);
-$('appNameHeader').innerHTML = '<a href=\"' + applink(appname) + '\" target=\"' + '_blank' + '\">' + appname + '.' + window.location.hostname + '</a>';
+$('appNameHeader').innerHTML = '<a href=\"' + applink(appname) + '\" target=\"' + '_blank' + '\">' + appname + '</a>';
 
 // Load the menu bar
 displaymenu();
@@ -106,10 +121,20 @@ displaymenu();
 var cvalue = $('compValue');
 var cadd = $('addCompButton');
 var cdelete = $('deleteCompButton');
+var ccopy = $('copyCompButton');
 var cplay = $('playCompButton');
 
+// Position background divs
+var mbackground = $('menubackground');
+var menudiv = $('menu');
+mbackground.style.top = ui.pixpos(menudiv.offsetTop);
+
+var cvbackground = $('compValueBackground');
+var cvtable = $('compValueTable');
+cvbackground.style.top = ui.pixpos(cvtable.offsetTop);
+
 /**
- * Adjust field size.
+ * Adjust component value field size.
  */
 function resizeFields() {
     cvalue.style.width = '0px';
@@ -176,6 +201,11 @@ function getapp(name, g) {
     if (isNil(name))
         return false;
     return composites.get(name, function(doc) {
+
+        // Stop now if we didn't get a composite
+        if (doc == null)
+            return false;
+
         composite = atomcomposite(doc);
         if (isNil(composite)) {
 
@@ -197,16 +227,19 @@ function getapp(name, g) {
 /**
  * Display a palette. Get it from the server if needed.
  */
-function displaypalette(name, g, palette, gpalettes) {
+function displaypalette(name, g, svg, palette, gpalettes) {
     if (isNil(name))
         return;
     if (isNil(gpalettes[name])) {
 
         // Get the palette from the server
-        var doc = palettes.get(name);
-        gpalettes[name] = graph.composite(atomcomposite(doc), graph.mkpath().move(2580,0), true, g);
+        palettes.get(name, function(doc) {
+            gpalettes[name] = graph.composite(atomcomposite(doc), graph.mkpath().move(2580,0), true, g);
+            graph.display(gpalettes[name], g, svg);
+        });
+        return true;
     }
-    graph.display(gpalettes[name], g);
+    graph.display(gpalettes[name], g, svg);
     return true;
 }
 
@@ -216,16 +249,16 @@ function displaypalette(name, g, palette
  */
 function installpalette(name, pos, g, bg, palette, gpalettes) {
     var b = graph.mkbutton(name, pos);
-    graph.display(mklist(b), g);
+    graph.display(mklist(b), g, g);
     b.onclick = function(e) {
 
         // Swap the selected palette
-        graph.compselect(bpalette, false);
-        displaypalette(spalette, bg, palette, gpalettes);
+        graph.paletteselect(bpalette, false);
+        displaypalette(spalette, bg, g, palette, gpalettes);
         bpalette = b;
-        graph.compselect(b, true, null, null);
+        graph.paletteselect(b, true);
         spalette = name;
-        return displaypalette(spalette, g, palette, gpalettes);
+        return displaypalette(spalette, g, g, palette, gpalettes);
     };
 
     if (name != spalette) {
@@ -236,8 +269,8 @@ function installpalette(name, pos, g, bg
     }
 
     // Display the selected palette
-    graph.compselect(b, true, null, null);
-    displaypalette(name, g, palette, gpalettes);
+    graph.paletteselect(b, true);
+    displaypalette(name, g, g, palette, gpalettes);
 
     return b;
 }
@@ -251,8 +284,11 @@ function save(savexml) {
     var entry = '<entry xmlns="http://www.w3.org/2005/Atom">' +
         '<title type="text">' + appname + '</title><id>' + appname + '</id><content type="application/xml">' +
         savedcomposxml + '</content></entry>';
-    composites.put(appname, entry, function(r) {
+    composites.put(appname, entry, function(e) {
+        if (e)
+            return false;
         $('saveStatus').innerHTML = 'Saved';
+        return false;
     });
     return true;
 }
@@ -293,7 +329,7 @@ function compdatalink(appname, cname) {
     var port = ':' + window.location.port;
     if (port == ':80' || port == ':443' || port == ':')
         port = '';
-    var link = protocol + '//' + appname + '.' + host + port + '/data/?component=' + cname;
+    var link = protocol + '//' + appname + '.' + host + port + '/data/#component=' + cname;
     return link;
 }
 
@@ -327,6 +363,7 @@ function oncompselect(gsel) {
     }
 
     updateButton(cdelete, link != '');
+    updateButton(ccopy, link != '');
     updateButton(cplay, link != '');
     return true;
 }
@@ -344,7 +381,8 @@ function showdata(gcomp) {
     gdiv.style.visibility = 'hidden'
     gvisible = false;
     pdiv.style.visibility = 'visible';
-    pdiv.innerHTML = '<iframe id="dataFrame" style="position: relative; height: 5000px; width: 100%; border: 0px;" scrolling="no" frameborder="0" src="' +
+    pdiv.innerHTML = '';
+    pdiv.innerHTML = '<iframe id="dataFrame" style="position: relative; height: 5000px; width: 2500px; border: 0px;" scrolling="no" frameborder="0" src="' +
                         compdatalink(appname, gcomp.id) + '"></iframe>';
     return true;
 }
@@ -360,7 +398,7 @@ function showgraph(gcomp) {
     pdiv.innerHTML = '';
     gdiv.style.visibility = 'visible'
     gvisible = true;
-    graph.compselect(gcomp, true, cvalue, cdelete);
+    graph.compselect(gcomp, true, cvalue, ccopy, cdelete);
     return true;
 }
 
@@ -376,26 +414,26 @@ cplay.onclick = function() {
 }
 
 // Create editor graph area
-g = graph.mkgraph(cdiv, graph.mkpath().move(-2500,0), cvalue, cadd, cdelete);
+g = graph.mkgraph(cdiv, graph.mkpath().move(-2500,0), cvalue, cadd, ccopy, cdelete);
 gdiv = g.parentNode;
 bg = graph.mkgroup(graph.mkpath());
 
 // Install the palettes
 var pos = graph.mkpath().move(0, 0);
-bpalette = installpalette('control', pos.rmove(5,0), g, bg, spalette, gpalettes);
-installpalette('values', pos.rmove(0,35), g, bg, spalette, gpalettes);
-installpalette('lists', pos.rmove(0, 35), g, bg, spalette, gpalettes);
-installpalette('transform', pos.rmove(0, 35), g, bg, spalette, gpalettes);
-installpalette('text', pos.rmove(0, 35), g, bg, spalette, gpalettes);
-installpalette('http', pos.rmove(0, 35), g, bg, spalette, gpalettes);
-installpalette('animation', pos.rmove(0, 35), g, bg, spalette, gpalettes);
-installpalette('talk', pos.rmove(0, 35), g, bg, spalette, gpalettes);
-installpalette('social', pos.rmove(0, 35), g, bg, spalette, gpalettes);
-installpalette('search', pos.rmove(0, 35), g, bg, spalette, gpalettes);
-installpalette('database', pos.rmove(0, 35), g, bg, spalette, gpalettes);
-installpalette('logic', pos.rmove(0, 35), g, bg, spalette, gpalettes);
-installpalette('math', pos.rmove(0, 35), g, bg, spalette, gpalettes);
-installpalette('python', pos.rmove(0, 35), g, bg, spalette, gpalettes);
+bpalette = installpalette('control', pos.rmove(5,2), g, bg, spalette, gpalettes);
+installpalette('values', pos.rmove(0,28), g, bg, spalette, gpalettes);
+installpalette('lists', pos.rmove(0, 28), g, bg, spalette, gpalettes);
+installpalette('transform', pos.rmove(0, 28), g, bg, spalette, gpalettes);
+installpalette('text', pos.rmove(0, 28), g, bg, spalette, gpalettes);
+installpalette('http', pos.rmove(0, 28), g, bg, spalette, gpalettes);
+installpalette('animation', pos.rmove(0, 28), g, bg, spalette, gpalettes);
+installpalette('talk', pos.rmove(0, 28), g, bg, spalette, gpalettes);
+installpalette('social', pos.rmove(0, 28), g, bg, spalette, gpalettes);
+installpalette('search', pos.rmove(0, 28), g, bg, spalette, gpalettes);
+installpalette('database', pos.rmove(0, 28), g, bg, spalette, gpalettes);
+installpalette('logic', pos.rmove(0, 28), g, bg, spalette, gpalettes);
+installpalette('math', pos.rmove(0, 28), g, bg, spalette, gpalettes);
+installpalette('python', pos.rmove(0, 28), g, bg, spalette, gpalettes);
 
 // Get and display the current app
 getapp(appname, g);

Modified: tuscany/sca-cpp/trunk/modules/edit/htdocs/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/edit/htdocs/index.html?rev=1154447&r1=1154446&r2=1154447&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/edit/htdocs/index.html (original)
+++ tuscany/sca-cpp/trunk/modules/edit/htdocs/index.html Sat Aug  6 05:59:32 2011
@@ -28,8 +28,8 @@
 <script type="text/javascript" src="/all-min.js"></script>
 <script type="text/javascript" src="/menu.js"></script>
 </head>
-<body class="delayed" onload="ui.onload();">
-<div id="bodydiv" class="devicewidth">
+<body class="delayed" onload="ui.onload();" onbeforeunload="ui.onbeforeunload();">
+<div id="bodydiv" class="bodydiv">
 
 <div id="headdiv" class="hsection">
 <script type="text/javascript" src="/headconfig.js"></script>
@@ -46,7 +46,6 @@
 <div id="maintitle" style="font-size: 150%;"></div>
 
 <div id="maindiagram"><div id="diagram" style="width: 320px; height: 280px; background: url(home.png); padding: 0px; margin: 0px auto;"></div></div>
-<br/>
 
 <input type="button" class="greenbutton" style="font-size: 150%; font-weight: bold; font-style: italic; padding: 10px;" id="getstarted" title="Get Started" value="Get Started"/>
 
@@ -56,6 +55,17 @@
 </div>
 
 <script type="text/javascript">
+
+// On mobile devices, redirect to the last visited page
+if (ui.isMobile() && (document.referrer == null || document.referrer == '')) {
+    var last = ui.lastvisited();
+    if (!isNil(last) && last != document.location)
+        window.open(last, '_self');
+}
+
+// Init and display this page
+ui.initbody();
+
 // Set page titles
 document.title = windowtitle(window.location.hostname);
 $('h1').innerHTML = hometitle(window.location.hostname);
@@ -65,7 +75,7 @@ displaymenu();
 
 $('maintitle').innerHTML = isNil(config.maintitle)? 'Simple App Builder' : config.maintitle;
 $('getstarted').onclick = function() {
-    return window.open('/store/', '_self');
+    return ui.navigate('/store/', '_self');
 };
 
 // Display the main diagram

Modified: tuscany/sca-cpp/trunk/modules/edit/htdocs/login/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/edit/htdocs/login/index.html?rev=1154447&r1=1154446&r2=1154447&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/edit/htdocs/login/index.html (original)
+++ tuscany/sca-cpp/trunk/modules/edit/htdocs/login/index.html Sat Aug  6 05:59:32 2011
@@ -17,7 +17,7 @@
  * specific language governing permissions and limitations
  * under the License.    
 -->
-<html>
+<html manifest="/cache-manifest.cmf">
 <head>
 <title>Sign in</title>
 <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0"/> 
@@ -27,8 +27,8 @@
 <link rel="stylesheet" type="text/css" href="/ui-min.css"/>
 <script type="text/javascript" src="/all-min.js"></script>
 </head>
-<body class="delayed" onload="ui.onload();">
-<div id="bodydiv" class="devicewidth">
+<body class="delayed" onload="ui.onload();" onbeforeunload="ui.onbeforeunload();">
+<div id="bodydiv" class="bodydiv">
 
 <h1>Sign in</h1>
 
@@ -38,12 +38,14 @@
 <tr><td><input type="text" id="httpd_username" name="httpd_username" value="" size="15" autocapitalize="off" placeholder="Enter your user name" style="width: 300px;"/></td></tr>
 <tr><td><b>Password:</b></td></tr>
 <tr><td><input type="password" name="httpd_password" value="" size="15" placeholder="Enter your password" style="width: 300px;"/></td></tr>
-<tr><td><input type="submit" value="Sign in" class="greenbutton" style="font-weight: bold;"/></td><td></td></tr>
+<tr><td><input type="submit" value="Sign in" class="graybutton" style="font-weight: bold;"/></td><td></td></tr>
 </table>
 <input type="hidden" name="httpd_location" value="/"/>
 </form>
 
 <script type="text/javascript">
+ui.initbody();
+
 function queryParams() {
     qp = new Array();
     qs = window.location.search.substring(1).split('&');

Modified: tuscany/sca-cpp/trunk/modules/edit/htdocs/logout/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/edit/htdocs/logout/index.html?rev=1154447&r1=1154446&r2=1154447&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/edit/htdocs/logout/index.html (original)
+++ tuscany/sca-cpp/trunk/modules/edit/htdocs/logout/index.html Sat Aug  6 05:59:32 2011
@@ -17,7 +17,7 @@
  * specific language governing permissions and limitations
  * under the License.    
 -->
-<html>
+<html manifest="/cache-manifest.cmf">
 <head>
 <title>Sign out</title>
 <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0"/> 
@@ -27,19 +27,23 @@
 <link rel="stylesheet" type="text/css" href="/ui-min.css"/>
 <script type="text/javascript" src="/all-min.js"></script>
 </head>
-<body class="delayed" onload="ui.onload();">
-<div id="bodydiv" class="devicewidth">
+<body class="delayed" onload="ui.onload();" onbeforeunload="ui.onbeforeunload();">
+<div id="bodydiv" class="bodydiv">
 
 <h1>Sign out</h1>
 
 <form name="signout" onsubmit="submitSignout();" action="/" method="GET">
-<input type="submit" id="signOut" value="Sign out" class="greenbutton" style="font-weight: bold"/>
+<input type="submit" id="signOut" value="Sign out" class="graybutton" style="font-weight: bold"/>
 </form>
 
 <script type="text/javascript">
+ui.initbody();
+
 function submitSignout() {
-    var reset = 'TuscanyOpenAuth=;expires=' + new Date(1970,01,01).toGMTString() + ';domain=.' + domainname(window.location.hostname) + ';path=/;secure=TRUE';
+    // Clear session cookie and local storage
+    var reset = 'TuscanyOpenAuth=; expires=' + new Date(1970,01,01).toGMTString() + '; domain=.' + domainname(window.location.hostname) + '; path=/; secure; version=1';
     document.cookie = reset;
+    localStorage.clear();
     document.signout.submit();
     return true;
 }

Modified: tuscany/sca-cpp/trunk/modules/edit/htdocs/menu.js
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/edit/htdocs/menu.js?rev=1154447&r1=1154446&r2=1154447&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/edit/htdocs/menu.js (original)
+++ tuscany/sca-cpp/trunk/modules/edit/htdocs/menu.js Sat Aug  6 05:59:32 2011
@@ -38,16 +38,16 @@ function userMenu() {
  */
 function displaymenu() {
     var mdiv = $('menu'); 
-    var name = ui.queryParams()['app'];
+    var name = ui.fragmentParams()['app'];
 
     mdiv.innerHTML = ui.menubar(
         append(mklist(ui.menu('Home', '/'), ui.menu('Store', '/store/')),
                 (isNil(name) || name == 'undefined')?
                     mklist() :
                     mklist(
-                        ui.menu('Stats', '/stats/?app=' + name),
-                        ui.menu('Page', '/page/?app=' + name),
-                        ui.menu(isNil(config.compose)? 'Composition' : config.compose, '/graph/?app=' + name))),
+                        ui.menu('Stats', '/stats/#app=' + name),
+                        ui.menu('Page', '/page/#app=' + name),
+                        ui.menu(isNil(config.compose)? 'Composition' : config.compose, '/graph/#app=' + name))),
         mklist(ui.menu('Account', '/account/'), ui.menu('Sign out', '/logout/')));
 }
 

Modified: tuscany/sca-cpp/trunk/modules/edit/htdocs/page/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/edit/htdocs/page/index.html?rev=1154447&r1=1154446&r2=1154447&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/edit/htdocs/page/index.html (original)
+++ tuscany/sca-cpp/trunk/modules/edit/htdocs/page/index.html Sat Aug  6 05:59:32 2011
@@ -17,7 +17,7 @@
  * specific language governing permissions and limitations
  * under the License.    
 -->
-<html>
+<html manifest="/cache-manifest.cmf">
 <head>
 <title>Page</title>
 <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0"/> 
@@ -29,40 +29,54 @@
 <script type="text/javascript" src="/menu.js"></script>
 <script type="text/javascript" src="page.js"></script>
 </head>
-<body class="delayed" onload="ui.onload();">
-<div id="bodydiv" class="devicewidth">
+<body class="delayed" onload="ui.onload();" onbeforeunload="ui.onbeforeunload();">
+<div id="bodydiv" class="bodydiv" style="overflow: visible;">
 
 <div id="headdiv" class="hsection">
 <script type="text/javascript" src="/headconfig.js"></script>
 </div>
 
+<div id="menubackground" style="position: absolute; top: 0px; left: 0px; z-index: -1; width: 2500px;">
+<table cellpadding="0" cellspacing="0" width="100%" class="tbar"><tr><td class="dtbar">
+<table border="0" cellspacing="0" cellpadding="0"><tr><td class="ltbar"><span class="tbarsmenu">&nbsp</span></td></tr></table>
+</td></tr></table>
+</div>
+
 <div id="menu"></div>
 
 <table style="width: 100%;">
 <tr>
-<td><h2><span id="h1"></span><span id="appNameHeader"></span></h2></td>
-<td style="vertical-align: middle; text-align: right; padding-right: 2px;"><span id="saveStatus" style="font-weight: bold; color: #808080;">Saved</span></td>
+<td><h2><span id="appNameHeader"></span></h2></td>
+<td style="vertical-align: middle; text-align: right; padding-right: 8px;"><span id="saveStatus" style="font-weight: bold; color: #808080;">Saved</span></td>
 </tr>
 </table>
 
-<table style="width: 100%;">
+<table id="widgetValueBackground" style="width: 2500px; position: absolute; top: 59px; left: 0px; z-index: -1;">
+<tr>
+<th class="thr thl"><span style="display: inline-block; padding-top: 0px; padding-bottom: 0px; height: 24px;"></span></th>
+</tr>
+</table>
+
+<table id="widgetValueTable" style="width: 100%;">
 <tr>
-<th class="thr thl" style="padding-left: 2px; padding-right: 2px; width: 100%;">
+<td class="thr thl" style="padding-left: 2px; padding-right: 2px; vertical-align: top; width: 100%;">
 <input id="widgetValue" type="text" value="" title="Widget value" autocapitalize="off" placeholder="Value" style="position: relative; width: 100%;"/>
-</th>
+</td>
+
+<td class="thl thr" style="text-align: right; padding-right: 2px; vertical-align: top;">
+<span id="deleteWidgetButton" title="Delete a Widget" class="graybutton" style="font-weight: bold; font-size: 16px; color: #808080; display: inline-block; width: 24px; height: 20px; padding-top: 0px; padding-bottom: 0px; text-align: center; margin-left: 0px; margin-right: 0px;">-</span>
 
-<th class="thl thr" style="text-align: right; padding-right: 2px;">
-<span id="deleteWidgetButton" title="Delete a Widget" class="redbutton" style="font-weight: bold; font-size: 16px; color: #808080; display: inline-block; width: 24px; height: 20px; padding-top: 0px; padding-bottom: 0px; vertical-align: middle; text-align: center; margin-left: 0px; margin-right: 0px;">-</span>
+<span id="copyWidgetButton" title="Copy a Widget" class="graybutton" style="font-weight: bold; font-size: 16px; color: #808080; display: inline-block; width: 24px; height: 20px; padding-top: 0px; padding-bottom: 0px; text-align: center; margin-left: 0px; margin-right: 0px;">c</span>
 
-<span id="addWidgetButton" title="Add a Widget" class="greenbutton" style="font-weight: bold; font-size: 16px; display: inline-block; width: 24px; height: 20px; padding-top: 0px; padding-bottom: 0px; vertical-align: middle; text-align: center; margin-left: 0px; margin-right: 0px;">+</span>
+<span id="addWidgetButton" title="Add a Widget" class="graybutton" style="font-weight: bold; font-size: 16px; display: inline-block; width: 24px; height: 20px; padding-top: 0px; padding-bottom: 0px; middle; text-align: center; margin-left: 0px; margin-right: 0px;">+</span>
 
-<span id="playPageButton" title="View page" class="bluebutton" style="font-weight: bold; font-size: 16px; display: inline-block; width: 24px; height: 20px; padding-top: 0px; padding-bottom: 0px; vertical-align: middle; text-align: center; margin-left: 0px; margin-right: 0px;">&gt;</span>
-</th>
+<span id="playPageButton" title="View page" class="graybutton" style="font-weight: bold; font-size: 16px; display: inline-block; width: 24px; height: 20px; padding-top: 0px; padding-bottom: 0px; middle; text-align: center; margin-left: 0px; margin-right: 0px;">&gt;</span>
+</td>
 </tr>
 </table>
 
-<div id="contentdiv" style="margin-top: 4px; width: 100%;">
-<div id="editdiv" style="visibility: visible; position: relative; top: 0px; left: -2500px; right: 0px; height: 5000px;">
+<div id="contentdiv" style="margin-top: 4px; width: 2500px">
+<div id="editdiv" style="visibility: visible; position: relative; top: 0px; left: -2500px; width: 2500px; height: 5000px;">
 
 <div style="position: relative; left: 2500px; top: 0px; right: 0px; height: 5000px; border:1px; border-style: solid; border-color: #a2bae7; background: url(/public/grid72.png);"></div>
 <div class="guide" style="position: absolute; left: 2500px; top: 0px; width: 320px; height: 460px;"></div>
@@ -90,15 +104,18 @@
 <span class="img" id="palette:img" style="position: absolute; left: 0px; top: 430px;"><img src="/public/img.png"/></span>
 </div>
 
-<div id="playdiv" style="visibility: hidden; position: absolute; top: 0px; left: 0px; right: 0px; height: 5000px;">
+<div id="playdiv" style="visibility: hidden; position: absolute; top: 0px; left: 0px; width: 2500px; height: 5000px;">
 </div>
+
 </div>
 
 <div id="buffer" style="visibility: hidden; width: 0px; height: 0px"></div>
 
 <script type="text/javascript">
+ui.initbody();
+
 // Get the app name
-var appname = ui.queryParams()['app'];
+var appname = ui.fragmentParams()['app'];
 if (isNil(appname))
     window.open('/', '_self');
 
@@ -117,8 +134,7 @@ function applink(appname) {
 
 // Set page titles
 document.title = windowtitle(window.location.hostname) + ' - Page - ' + appname;
-//$('h1').innerHTML = hometitle(window.location.hostname);
-$('appNameHeader').innerHTML = '<a href=\"' + applink(appname) + '\" target=\"' + '_blank' + '\">' + appname + '.' + window.location.hostname + '</a>';
+$('appNameHeader').innerHTML = '<a href=\"' + applink(appname) + '\" target=\"' + '_blank' + '\">' + appname + '</a>';
 
 // Load the menu bar
 displaymenu();
@@ -133,6 +149,7 @@ var pdiv = $('playdiv');
 var wvalue = $('widgetValue');
 var wadd = $('addWidgetButton');
 var wdelete = $('deleteWidgetButton');
+var wcopy = $('copyWidgetButton');
 var pplay = $('playPageButton');
 
 // Position edit and play divs inside the content div
@@ -141,8 +158,17 @@ ediv.style.top = cdiv.offsetTop + 'px';
 pdiv.style.position = 'absolute';
 pdiv.style.top = cdiv.offsetTop + 'px';
 
+// Position background divs
+var mbackground = $('menubackground');
+var menudiv = $('menu');
+mbackground.style.top = ui.pixpos(menudiv.offsetTop);
+
+var wvbackground = $('widgetValueBackground');
+var wvtable = $('widgetValueTable');
+wvbackground.style.top = ui.pixpos(wvtable.offsetTop);
+
 /**
- * Adjust fields sizes.
+ * Adjust widget value field size.
  */
 function resizeFields() {
     wvalue.style.width = '0px';
@@ -188,6 +214,10 @@ function getpage(name, ediv) {
         return false;
     return pages.get(name, function(doc) {
 
+        // Stop now if we didn't get a page
+        if (doc == null)
+            return false;
+
         // Convert the page to XHTML and place it in a hidden buffer
         var buffer = $('buffer');
         var el = atompage(doc);
@@ -198,7 +228,21 @@ function getpage(name, ediv) {
         else
             buffer.innerHTML = writeStrings(writeXML(atompage(doc), false));
 
-        // Append page nodes to editor
+        // Remove any existing page nodes from the editor div
+        var fnodes = filter(function(e) {
+            if (isNil(e.id) || e.id == '' || e.id.substr(0, 8) == 'palette:')
+                return false;
+            var x = ui.numpos(e.style.left) - 2500;
+            if (x < 0 || ui.numpos(e.style.top) < 0)
+                return false;
+            return true;
+        }, nodeList(ediv.childNodes));
+
+        map(function(e) {
+            ediv.removeChild(e);
+        }, fnodes);
+
+        // Append new page nodes to editor
         map(function(e) {
                 ediv.appendChild(e);
                 if (!isNil(e.style))
@@ -295,8 +339,11 @@ function save(newxml) {
         '<title type="text">' + appname + '</title><id>' + appname + '</id><content type="application/xml">' +
         newxml + '</content></entry>';
 
-    pages.put(appname, entry, function(r) {
+    pages.put(appname, entry, function(e) {
+        if (e)
+            return false;
         $('saveStatus').innerHTML = 'Saved';
+        return false;
     });
     return true;
 };
@@ -336,7 +383,7 @@ function compvaluelink(appname, cname) {
     var port = ':' + window.location.port;
     if (port == ':80' || port == ':443' || port == ':')
         port = '';
-    var link = protocol + '//' + appname + '.' + host + port + '/data/?component=' + cname;
+    var link = protocol + '//' + appname + '.' + host + port + '/data/#component=' + cname;
     return link;
 }
 
@@ -354,6 +401,7 @@ function onwidgetselect(w) {
     }
 
     updateButton(wdelete, link != '');
+    updateButton(wcopy, link != '');
     return true;
 }
 
@@ -363,14 +411,15 @@ function onwidgetselect(w) {
 function playpage() {
     if (!evisible)
         return true;
-    page.widgetselect(widget, false, wvalue, wdelete);
+    page.widgetselect(widget, false, wvalue, wcopy, wdelete);
     page.selected = null;
     wvalue.value = applink(appname);
     pplay.innerHTML = '&lt;';
     ediv.style.visibility = 'hidden'
     evisible = false;
     pdiv.style.visibility = 'visible';
-    pdiv.innerHTML = '<iframe id="playappframe" style="position: relative; height: 5000px; width: 100%; border: 0px;" scrolling="no" frameborder="0" src="' +
+    pdiv.innerHTML = '';
+    pdiv.innerHTML = '<iframe id="playappframe" style="position: relative; height: 5000px; width: 2500px; border: 0px;" scrolling="no" frameborder="0" src="' +
                         applink(appname) + '"></iframe>';
     return true;
 }
@@ -386,7 +435,7 @@ function showedit() {
     pdiv.innerHTML = '';
     ediv.style.visibility = 'visible'
     evisible = true;
-    page.widgetselect(widget, true, wvalue, wdelete);
+    page.widgetselect(widget, true, wvalue, wcopy, wdelete);
     page.selected = widget;
     return true;
 }
@@ -401,7 +450,7 @@ pplay.onclick = function() {
 }
 
 // Initialize the page editor
-page.edit(ediv, wvalue, wadd, wdelete, onpagechange, onwidgetselect);
+page.edit(ediv, wvalue, wadd, wcopy, wdelete, onpagechange, onwidgetselect);
 
 // Get and display the current app page
 getpage(appname, ediv);

Modified: tuscany/sca-cpp/trunk/modules/edit/htdocs/page/page.js
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/edit/htdocs/page/page.js?rev=1154447&r1=1154446&r2=1154447&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/edit/htdocs/page/page.js (original)
+++ tuscany/sca-cpp/trunk/modules/edit/htdocs/page/page.js Sat Aug  6 05:59:32 2011
@@ -30,12 +30,13 @@ var palcx = 2500;
 /**
  * Init a page editor. Works with all browsers except IE.
  */
-page.edit = function(elem, wvalue, wadd, wdelete, onchange, onselect) {
+page.edit = function(elem, wvalue, wadd, wcopy, wdelete, onchange, onselect) {
 
     // Track element dragging and selection
     page.dragging = null;
     page.selected = null;
     wvalue.disabled = true;
+    wcopy.disabled = true;
     wdelete.disabled = true;
 
     // Trigger widget select and page change events
@@ -59,7 +60,7 @@ page.edit = function(elem, wvalue, wadd,
         page.dragging = dragging;
 
         // Remember mouse position
-        var pos = typeof e.touches != "undefined" ? e.touches[0] : e;
+        var pos = typeof e.touches != "undefined"? e.touches[0] : e;
         page.dragX = pos.screenX;
         page.dragY = pos.screenY;
 
@@ -110,7 +111,7 @@ page.edit = function(elem, wvalue, wadd,
             return true;
 
         // Get the mouse position
-        var pos = typeof e.touches != "undefined" ? e.touches[0] : e;
+        var pos = typeof e.touches != "undefined"? e.touches[0] : e;
         if (pos.screenX == page.dragX && pos.screenY == page.dragY)
             return true;
 
@@ -150,7 +151,7 @@ page.edit = function(elem, wvalue, wadd,
             if (page.selected != null) {
 
                 // Reset current selection
-                page.widgetselect(page.selected, false, wvalue, wdelete);
+                page.widgetselect(page.selected, false, wvalue, wcopy, wdelete);
                 page.selected = null;
 
                 // Trigger widget select event
@@ -165,7 +166,7 @@ page.edit = function(elem, wvalue, wadd,
         }
 
         // Deselect the previously selected element
-        page.widgetselect(page.selected, false, wvalue, wdelete);
+        page.widgetselect(page.selected, false, wvalue, wcopy, wdelete);
 
         // Clone element dragged from palette
         if (selected.id.substring(0, 8) == 'palette:') {
@@ -190,7 +191,7 @@ page.edit = function(elem, wvalue, wadd,
         }
 
         // Select the element
-        page.widgetselect(page.selected, true, wvalue, wdelete);
+        page.widgetselect(page.selected, true, wvalue, wcopy, wdelete);
 
         // Trigger widget select event
         page.onwidgetselect(page.selected);
@@ -227,7 +228,7 @@ page.edit = function(elem, wvalue, wadd,
             return false;
 
         // Reset current selection
-        page.widgetselect(page.selected, false, wvalue, wdelete);
+        page.widgetselect(page.selected, false, wvalue, wcopy, wdelete);
 
         // Remove selected widget
         page.selected.parentNode.removeChild(page.selected);
@@ -242,6 +243,39 @@ page.edit = function(elem, wvalue, wadd,
         return false;
     };
 
+    // Handle copy event.
+    wcopy.onclick = function() {
+        if (page.selected == null)
+            return false;
+        if (page.selected.id.substring(0, 8) == 'palette:')
+            return false;
+
+        // Reset current selection
+        page.widgetselect(page.selected, false, wvalue, wcopy, wdelete);
+
+        // Clone selected widget
+        page.selected = page.clone(page.selected);
+
+        // Move 10 pixels down right
+        page.selected.style.left = ui.pixpos(ui.numpos(page.selected.style.left) + 10);
+        page.selected.style.top = ui.pixpos(ui.numpos(page.selected.style.top) + 10);
+        page.selected.cover.style.left = ui.pixpos(ui.numpos(page.selected.cover.style.left) + 10);
+        page.selected.cover.style.top = ui.pixpos(ui.numpos(page.selected.cover.style.top) + 10);
+    
+        // Bring it to the top
+        page.bringtotop(page.selected);
+
+        // Select the element
+        page.widgetselect(page.selected, true, wvalue, wcopy, wdelete);
+
+        // Trigger widget select event
+        page.onwidgetselect(page.selected);
+
+        // Trigger page change event
+        page.onpagechange(true);
+        return false;
+    };
+
     // Cover child elements with span elements to prevent
     // any input events to reach them
     map(page.cover, nodeList(elem.childNodes));
@@ -253,35 +287,54 @@ page.edit = function(elem, wvalue, wadd,
  * Return the text of a widget.
  */
 page.text = function(e) {
-    var formula = e.id;
-    if (formula.substring(0, 5) != 'page:') {
-        return '=' + formula;
+    function formula(e) {
+        var f = e.id;
+        if (f.substring(0, 5) != 'page:')
+            return '=' + f;
+        return '';
     }
 
-    if (e.className == 'h1' || e.className == 'h2' || e.className == 'text' || e.className == 'section')
-        return car(childElements(e)).innerHTML;
-    if (e.className == 'button' || e.className == 'checkbox')
-        return car(childElements(e)).value;
-    if (e.className == 'entry' || e.className == 'password')
-        return car(childElements(e)).defaultValue;
-    if (e.className == 'select')
-        return car(childElements(car(childElements(e)))).value;
-    if (e.className == 'link') {
-        var hr = car(childElements(e)).href;
-        var t = car(childElements(car(childElements(e)))).innerHTML;
-        return hr == t? hr : hr + ',' + t;
-    }
-    if (e.className == 'img') {
-        var src = car(childElements(e)).src;
-        return src == window.location.href? '' : src;
-    }
-    if (e.className == 'iframe')
-        return car(childElements(e)).href;
-    if (e.className == 'list')
-        return '';
-    if (e.className == 'table')
+    function constant(e, f) {
+        if (e.className == 'h1' || e.className == 'h2' || e.className == 'text' || e.className == 'section') {
+            var t = car(childElements(e)).innerHTML;
+            return t == f? '' : t;
+        }
+        if (e.className == 'button' || e.className == 'checkbox') {
+            var t = car(childElements(e)).value;
+            return t == f? '' : t;
+        }
+        if (e.className == 'entry' || e.className == 'password') {
+            var t = car(childElements(e)).defaultValue;
+            return t == f? '' : t;
+        }
+        if (e.className == 'select') {
+            var t = car(childElements(car(childElements(e)))).value;
+            return t == f? '' : t;
+        }
+        if (e.className == 'link') {
+            var lhr = car(childElements(e)).href;
+            var hr = lhr.substring(0, 5) == 'link:'? lhr.substring(5) : '';
+            var t = car(childElements(car(childElements(e)))).innerHTML;
+            return t == f? hr : (t == hr? hr : (t == ''? hr : hr + ',' + t));
+        }
+        if (e.className == 'img') {
+            var src = car(childElements(e)).src;
+            return src == window.location.href? '' : src;
+        }
+        if (e.className == 'iframe') {
+            var hr = car(childElements(e)).href;
+            return hr == window.location.href? '' : hr;
+        }
+        if (e.className == 'list')
+            return '';
+        if (e.className == 'table')
+            return '';
         return '';
-    return '';
+    }
+
+    var f = formula(e);
+    var c = constant(e, f);
+    return f == ''? c : (c == ''? f : f + ',' + c);
 };
 
 /**
@@ -313,49 +366,60 @@ page.hastext = function(e) {
  * Set the text of a widget.
  */
 page.settext = function(e, t) {
-    var formula = t.length > 1 && t.substring(0, 1) == '=';
-    e.id = formula? t.substring(1) : 'page:' + e.className;
+    function formula(t) {
+        if (t.length > 1 && t.substring(0, 1) == '=')
+            return car(t.split(','));
+        return '';
+    }
+
+    function constant(t) {
+        return t.length > 1 && t.substring(0, 1) == '='? cdr(t.split(',')) : t.split(',');
+    }
+
+    var f = formula(t);
+    var c = constant(t);
+
+    e.id = f != ''? f.substring(1) : ('page:' + e.className);
 
     if (e.className == 'h1' || e.className == 'h2' || e.className == 'text' || e.className == 'section') {
-        car(childElements(e)).innerHTML = t;
+        car(childElements(e)).innerHTML = isNil(c)? f : car(c);
         return t;
     }
     if (e.className == 'button' || e.className == 'entry' || e.className == 'password') {
-        car(childElements(e)).defaultValue = t;
+        car(childElements(e)).defaultValue = isNil(c)? f : car(c);
         return t;
     }
     if (e.className == 'checkbox') {
-        car(childElements(e)).value = t;
-        map(function(n) { if (n.nodeName == "SPAN") n.innerHTML = t; return n; }, nodeList(e.childNodes));
+        car(childElements(e)).value = isNil(c)? f : car(c);
+        map(function(n) { if (n.nodeName == "SPAN") n.innerHTML = isNil(c)? f : car(c); return n; }, nodeList(e.childNodes));
         return t;
     }
     if (e.className == 'select') {
         var ce = car(childElements(car(childElements(e))));
-        ce.value = t;
-        ce.innerHTML = t;
+        ce.value = isNil(c)? f : car(c);
+        ce.innerHTML = isNil(c)? f : car(c);
         return t;
     }
     if (e.className == 'list') {
-        e.innerHTML = '<table class="datatable" style="width: 100%;;"><tr><td class="datatd">' + t + '</td></tr><tr><td class="datatd">...</td></tr></table>';
-        return '';
+        e.innerHTML = '<table class="datatable" style="width: 100%;;"><tr><td class="datatd">' + (isNil(c)? f : car(c)) + '</td></tr><tr><td class="datatd">...</td></tr></table>';
+        return t;
     }
     if (e.className == 'table') {
-        e.innerHTML = '<table class="datatable" style="width: 100%;"><tr><td class="datatdl">' + t + '</td><td class="datatdr">...</td></tr><tr><td class="datatdl">...</td><td class="datatdr">...</td></tr></table>';
+        e.innerHTML = '<table class="datatable" style="width: 100%;"><tr><td class="datatdl">' + (isNil(c)? f : car(c)) + '</td><td class="datatdr">...</td></tr><tr><td class="datatdl">...</td><td class="datatdr">...</td></tr></table>';
         return t;
     }
     if (e.className == 'link') {
-        var l = t.split(',');
         var ce = car(childElements(e));
-        ce.href = car(l);
-        car(childElements(ce)).innerHTML = isNil(cdr(l))? car(l) : cadr(l);
+        ce.href = isNil(c)? 'link:/index.html' : ('link:' + car(c));
+        car(childElements(ce)).innerHTML = isNil(c)? (f != ''? f : '/index.html') : isNil(cdr(c))? (f != ''? f : car(c)) : cadr(c);
         return t;
     }
     if (e.className == 'img') {
-        car(childElements(e)).src = formula? '/public/img.png' : t;
+        car(childElements(e)).src = isNil(c)? '/public/img.png' : car(c);
         return t;
     }
     if (e.className == 'iframe') {
-        car(childElements(e)).href = formula? '/public/iframe.html' : t;
+        car(childElements(e)).href = isNil(c)? '/public/iframe.html' : car(c);
         return t;
     }
     return '';
@@ -418,11 +482,12 @@ page.bringtotop = function(n) {
 /**
  * Draw widget selection.
  */
-page.widgetselect = function(n, s, wvalue, wdelete) {
+page.widgetselect = function(n, s, wvalue, wcopy, wdelete) {
     if (isNil(n) || !s) {
         // Clear the widget value field
         wvalue.value = '';
         wvalue.disabled = true;
+        wcopy.disabled = true;
         wdelete.disabled = true;
 
         // Clear the widget outline
@@ -434,6 +499,7 @@ page.widgetselect = function(n, s, wvalu
     // Update the widget value field
     wvalue.value = page.text(n);
     wvalue.disabled = false;
+    wcopy.disabled = false;
     wdelete.disabled = false;
 
     // Outline the widget

Modified: tuscany/sca-cpp/trunk/modules/edit/htdocs/public/iframe.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/edit/htdocs/public/iframe.html?rev=1154447&r1=1154446&r2=1154447&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/edit/htdocs/public/iframe.html (original)
+++ tuscany/sca-cpp/trunk/modules/edit/htdocs/public/iframe.html Sat Aug  6 05:59:32 2011
@@ -17,7 +17,7 @@
  * specific language governing permissions and limitations
  * under the License.    
 -->
-<html>
+<html manifest="/cache-manifest.cmf">
 <head>
 <title>frame</title>
 <meta name="viewport" content="width=device-width user-scalable=no initial-scale=1.0"/>

Modified: tuscany/sca-cpp/trunk/modules/edit/htdocs/public/notauth.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/edit/htdocs/public/notauth.html?rev=1154447&r1=1154446&r2=1154447&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/edit/htdocs/public/notauth.html (original)
+++ tuscany/sca-cpp/trunk/modules/edit/htdocs/public/notauth.html Sat Aug  6 05:59:32 2011
@@ -17,7 +17,7 @@
  * specific language governing permissions and limitations
  * under the License.    
 -->
-<html>
+<html manifest="/cache-manifest.cmf">
 <head>
 <title>Sorry</title>
 <meta name="viewport" content="width=device-width user-scalable=no initial-scale=1.0"/>
@@ -27,8 +27,8 @@
 <script type="text/javascript" src="/all-min.js"></script>
 <script type="text/javascript" src="/menu.js"></script>
 </head>
-<body class="delayed" onload="ui.onload();">
-<div id="bodydiv" class="devicewidth">
+<body class="delayed" onload="ui.onload();" onbeforeunload="ui.onbeforeunload();">
+<div id="bodydiv" class="bodydiv">
 
 <div id="headdiv" class="hsection">
 <script type="text/javascript" src="/headconfig.js"></script>
@@ -48,6 +48,8 @@
 </form>
 
 <script type="text/javascript">
+ui.initbody();
+
 // Set page title
 $('h1').innerHTML = hometitle(window.location.hostname);
 

Modified: tuscany/sca-cpp/trunk/modules/edit/htdocs/public/notfound.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/edit/htdocs/public/notfound.html?rev=1154447&r1=1154446&r2=1154447&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/edit/htdocs/public/notfound.html (original)
+++ tuscany/sca-cpp/trunk/modules/edit/htdocs/public/notfound.html Sat Aug  6 05:59:32 2011
@@ -17,7 +17,7 @@
  * specific language governing permissions and limitations
  * under the License.    
 -->
-<html>
+<html manifest="/cache-manifest.cmf">
 <head>
 <title>Page not found</title>
 <meta name="viewport" content="width=device-width user-scalable=no initial-scale=1.0"/>
@@ -27,8 +27,8 @@
 <script type="text/javascript" src="/all-min.js"></script>
 <script type="text/javascript" src="/menu.js"></script>
 </head>
-<body class="delayed" onload="ui.onload();">
-<div id="bodydiv" class="devicewidth">
+<body class="delayed">
+<div id="bodydiv" class="bodydiv" onload="ui.onload();" onbeforeunload="ui.onbeforeunload();">
 
 <div id="headdiv" class="hsection">
 <script type="text/javascript" src="/headconfig.js"></script>
@@ -46,6 +46,8 @@
 </div>
 
 <script type="text/javascript">
+ui.initbody();
+
 // Set page title
 $('h1').innerHTML = hometitle(window.location.hostname);
 

Modified: tuscany/sca-cpp/trunk/modules/edit/htdocs/public/notyet.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/edit/htdocs/public/notyet.html?rev=1154447&r1=1154446&r2=1154447&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/edit/htdocs/public/notyet.html (original)
+++ tuscany/sca-cpp/trunk/modules/edit/htdocs/public/notyet.html Sat Aug  6 05:59:32 2011
@@ -17,7 +17,7 @@
  * specific language governing permissions and limitations
  * under the License.    
 -->
-<html>
+<html manifest="/cache-manifest.cmf">
 <head>
 <title>Page not found</title>
 <meta name="viewport" content="width=device-width user-scalable=no initial-scale=1.0"/>
@@ -27,8 +27,8 @@
 <script type="text/javascript" src="/all-min.js"></script>
 <script type="text/javascript" src="/menu.js"></script>
 </head>
-<body class="delayed" onload="ui.onload();">
-<div id="bodydiv" class="devicewidth">
+<body class="delayed" onload="ui.onload();" onbeforeunload="ui.onbeforeunload();">
+<div id="bodydiv" class="bodydiv">
 
 <div id="headdiv" class="hsection">
 <script type="text/javascript" src="/headconfig.js"></script>
@@ -45,6 +45,8 @@
 </div>
 
 <script type="text/javascript">
+ui.initbody();
+
 // Set page title
 $('h1').innerHTML = hometitle(window.location.hostname);
 

Modified: tuscany/sca-cpp/trunk/modules/edit/htdocs/public/oops.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/edit/htdocs/public/oops.html?rev=1154447&r1=1154446&r2=1154447&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/edit/htdocs/public/oops.html (original)
+++ tuscany/sca-cpp/trunk/modules/edit/htdocs/public/oops.html Sat Aug  6 05:59:32 2011
@@ -17,7 +17,7 @@
  * specific language governing permissions and limitations
  * under the License.    
 -->
-<html>
+<html manifest="/cache-manifest.cmf">
 <head>
 <title>Oops</title>
 <meta name="viewport" content="width=device-width user-scalable=no initial-scale=1.0"/>
@@ -27,8 +27,8 @@
 <script type="text/javascript" src="/all-min.js"></script>
 <script type="text/javascript" src="/menu.js"></script>
 </head>
-<body class="delayed" onload="ui.onload();">
-<div id="bodydiv" class="devicewidth">
+<body class="delayed" onload="ui.onload();" onbeforeunload="ui.onbeforeunload();">
+<div id="bodydiv" class="bodydiv">
 
 <div id="headdiv" class="hsection">
 <script type="text/javascript" src="/headconfig.js"></script>
@@ -45,6 +45,8 @@
 </div>
 
 <script type="text/javascript">
+ui.initbody();
+
 // Set page title
 $('h1').innerHTML = hometitle(window.location.hostname);
 

Modified: tuscany/sca-cpp/trunk/modules/edit/htdocs/stats/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/edit/htdocs/stats/index.html?rev=1154447&r1=1154446&r2=1154447&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/edit/htdocs/stats/index.html (original)
+++ tuscany/sca-cpp/trunk/modules/edit/htdocs/stats/index.html Sat Aug  6 05:59:32 2011
@@ -17,7 +17,7 @@
  * specific language governing permissions and limitations
  * under the License.    
 -->
-<html>
+<html manifest="/cache-manifest.cmf">
 <head>
 <title>Stats</title>
 <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0"/> 
@@ -28,8 +28,8 @@
 <script type="text/javascript" src="/all-min.js"></script>
 <script type="text/javascript" src="/menu.js"></script>
 </head>
-<body class="delayed" onload="ui.onload();">
-<div id="bodydiv" class="devicewidth">
+<body class="delayed" onload="ui.onload();" onbeforeunload="ui.onbeforeunload();">
+<div id="bodydiv" class="bodydiv">
 
 <div id="headdiv" class="hsection">
 <script type="text/javascript" src="/headconfig.js"></script>
@@ -49,7 +49,7 @@
 <th class="thl thr" style="padding-top: 4px; padding-bottom: 4px; padding-left: 2px; padding-right: 2px; ">Stats</th>
 
 <th class="thl thr" style="width: 100%; text-align: right; padding-right: 2px; padding-top: 0px; padding-bottom: 0px;">
-<input type="button" class="greenbutton" style="font-weight: bold; margin-top: 0px; margin-bottom: 0px; height: 24px;" id="cloneApp" value="Clone" title="Clone this app"/>
+<input type="button" class="graybutton" style="font-weight: bold; margin-top: 0px; margin-bottom: 0px; height: 24px;" id="cloneApp" value="Clone" title="Clone this app"/>
 </th>
 </tr>
 </table>
@@ -70,8 +70,10 @@
 </form>
 
 <script type="text/javascript">
+ui.initbody();
+
 // Get the app name
-var appname = ui.queryParams()['app'];
+var appname = ui.fragmentParams()['app'];
 if (isNil(appname))
     window.open('/', '_self');
 
@@ -90,8 +92,7 @@ function applink(appname) {
 
 // Set page titles
 document.title = windowtitle(window.location.hostname) + ' - Stats - ' + appname;
-//$('h1').innerHTML = hometitle(window.location.hostname);
-$('appNameHeader').innerHTML = '<a href=\"' + applink(appname) + '\" target=\"' + '_blank' + '\">' + appname + '.' + window.location.hostname + '</a>';
+$('appNameHeader').innerHTML = '<a href=\"' + applink(appname) + '\" target=\"' + '_blank' + '\">' + appname + '</a>';
 var tclone = isNil(config.clone)? 'Clone' : config.clone;
 $('cloneApp').value = tclone;
 $('cloneApp').title = tclone + ' this app';
@@ -102,6 +103,7 @@ displaymenu();
 // Init service references
 var editWidget = sca.component("EditWidget");
 var dashboards = sca.reference(editWidget, "dashboards");
+var apps = sca.reference(editWidget, "apps");
 
 /**
  * The current app entry and corresponding saved XML content.
@@ -115,7 +117,12 @@ var savedappentryxml = '';
 function getapp(name) {
     if (isNil(name))
         return false;
-    return dashboards.get(name, function(doc) {
+    return apps.get(name, function(doc) {
+
+        // Stop now if we didn't get the app
+        if (doc == null)
+            return false;
+
         appentry = doc != null? car(elementsToValues(atom.readATOMEntry(mklist(doc)))) : mklist("'entry", mklist("'title", ''), mklist("'id", name));
         var title = cadr(assoc("'title", cdr(appentry)));
         $('appTitle').value = title;
@@ -132,8 +139,12 @@ function getapp(name) {
 function save(entryxml) {
     $('saveStatus').innerHTML = 'Saving';
     savedappentryxml = entryxml;
-    dashboards.put(appname, savedappentryxml);
-    $('saveStatus').innerHTML = 'Saved';
+    dashboards.put(appname, savedappentryxml, function(e) {
+        if (e)
+            return false;
+        $('saveStatus').innerHTML = 'Saved';
+        return false;
+    });
     return true;
 }
 
@@ -165,7 +176,7 @@ $('appForm').onsubmit = function() {
  * Handle Clone button event.
  */
 $('cloneApp').onclick = function() {
-    return window.open('/clone/?app=' + appname, '_self');
+    return ui.navigate('/clone/#app=' + appname, '_self');
 }
 
 // Get the current app

Modified: tuscany/sca-cpp/trunk/modules/edit/htdocs/store/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/edit/htdocs/store/index.html?rev=1154447&r1=1154446&r2=1154447&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/edit/htdocs/store/index.html (original)
+++ tuscany/sca-cpp/trunk/modules/edit/htdocs/store/index.html Sat Aug  6 05:59:32 2011
@@ -17,7 +17,7 @@
  * specific language governing permissions and limitations
  * under the License.    
 -->
-<html>
+<html manifest="/cache-manifest.cmf">
 <head>
 <title>Store</title>
 <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0"/> 
@@ -28,8 +28,8 @@
 <script type="text/javascript" src="/all-min.js"></script>
 <script type="text/javascript" src="/menu.js"></script>
 </head>
-<body class="delayed" onload="ui.onload();">
-<div id="bodydiv" class="devicewidth">
+<body class="delayed" onload="ui.onload();" onbeforeunload="ui.onbeforeunload();">
+<div id="bodydiv" class="bodydiv">
 
 <div id="headdiv" class="hsection">
 <script type="text/javascript" src="/headconfig.js"></script>
@@ -46,6 +46,8 @@
 <div id="apps"></div>
 
 <script type="text/javascript">
+ui.initbody();
+
 // Set page titles
 document.title = windowtitle(window.location.hostname) + ' - Store';
 $('h1').innerHTML = hometitle(window.location.hostname);
@@ -54,7 +56,7 @@ $('h1').innerHTML = hometitle(window.loc
 displaymenu();
 
 // Get the store category
-var category = ui.queryParams()['category'];
+var category = ui.fragmentParams()['category'];
 if (isNil(category))
     category = 'myapps';
 
@@ -65,10 +67,10 @@ function catmenu() {
     function catmenuitem(name, cat) {
         var c = cat == category? 'smenu' : 'amenu';
         return '<th class="thl thr" style="width: 10px; padding-top: 4px; padding-bottom: 4px; padding-right: 6px;">'
-                + ui.ahref('/store/?category=' + cat, '_self', '<span class="' + c + '">' + name + '</span>') + '</th>';
+                + ui.ahref('/store/#category=' + cat, '_reload', '<span class="' + c + '">' + name + '</span>') + '</th>';
     }
 
-    var m = '<table style="width: 100%;"><tr>';
+    var m = '<table style="width: 100%; margin-bottom: 2px;"><tr>';
     m += catmenuitem('My Apps', 'myapps');
     m += catmenuitem('New', 'new');
     m += catmenuitem('Top', 'top');
@@ -76,7 +78,7 @@ function catmenu() {
     m += catmenuitem('All', 'all');
     if (category == 'myapps') {
         m += '<th class="thl thr" style="width: 100%; padding-top: 0px; padding-bottom: 0px; padding-right: 0px; text-align: right;">';
-        m += '<input type="button" class="greenbutton" id="createApp" title="Create a new app" style="font-weight: bold; margin-top: 0px; margin-bottom: 0px; height: 24px;" Value="New App"/>';
+        m += '<input type="button" class="graybutton" id="createApp" title="Create a new app" style="font-weight: bold; margin-top: 0px; margin-bottom: 0px; height: 24px;" Value="New App"/>';
         m += '</th></tr></table>';
         return m;
     }
@@ -111,14 +113,14 @@ function applink(appname) {
  * Edit an app.
  */
 function editApp(appname) {
-    return window.open('/page/?app=' + appname, '_self');
+    return ui.navigate('/page/#app=' + appname, '_self');
 }
 
 /**
  * View an app.
  */
 function viewApp(appname) {
-    return window.open('/stats/?app=' + appname, '_self');
+    return ui.navigate('/stats/#app=' + appname, '_self');
 }
 
 /**
@@ -126,7 +128,7 @@ function viewApp(appname) {
  */
 if (category == 'myapps') {
     $('createApp').onclick = function() {
-        return window.open('/create/', '_self');
+        return ui.navigate('/create/', '_self');
     }
 }
 
@@ -135,21 +137,29 @@ if (category == 'myapps') {
  */
 function getapps(category) {
     function display(doc) {
+
+        // Stop now if we didn't get the apps
+        if (doc == null)
+            return false;
+
         var apps = '<div>';
         var feed = car(elementsToValues(atom.readATOMFeed(mklist(doc))));
         var aentries = assoc("'entry", cdr(feed));
         var entries = isNil(aentries)? mklist() : isList(car(cadr(aentries)))? cadr(aentries) : mklist(cdr(aentries));
-        for (var i = 0; i < length(entries); i++) {
-            var entry = entries[i];
+
+        function displayentries(entries) {
+            if (isNil(entries))
+                return apps;
+            var entry = car(entries);
             var title = cadr(assoc("'title", entry))
             var name = cadr(assoc("'id", entry))
             var author = 'joe';
             var clone = isNil(config.clone)? 'Clone' : config.clone;
 
-            apps += '<div class="box" style="width: 285px; display: inline-block; border: 1px; border-style: solid; border-color: #dcdcdc; border-collapse: collapse; margin: 5px; padding: 10px; vertical-align: top;">'
+            apps += '<div class="box" style="width: 150px; display: inline-block; border: 1px; border-style: solid; border-color: #dcdcdc; border-collapse: collapse; margin: 2px; padding: 2px; vertical-align: top;">'
             apps += '<table><tr>';
             apps += '<td>';
-            apps += '<div>' + ui.ahref('/stats/?app=' + name, '_self', '<img src="/public/app.png" width="50" height="50" style="height: 50px; width: 50px; vertical-align: top; margin-right: 10px; margin-bottom: 5px;"></img>') + '</div>';
+            apps += '<div>' + ui.ahref('/stats/#app=' + name, '_self', '<img src="/public/app.png" width="50" height="50" style="height: 50px; width: 50px; vertical-align: top; margin: 0px; padding: 0px;"></img>') + '</div>';
             apps += '</td>';
             apps += '<td class="tdw">';
             apps += '<div style="font-weight: bold">' + ui.ahref(applink(name), '_blank', name) + '</div>';
@@ -157,13 +167,14 @@ function getapps(category) {
                 apps += '<div style="color: #808080;">Shared</div>';
             else
                 apps += '<div>' + 'by&nbsp;' + '<span style="font-weight: bold;">' + author + '</span></div>';
-            apps += '<div>Feb 4, 2011</div>';
-            apps += '<br/>';
-            apps += '<div>' + title + '</div>';
             apps += '</td>';
             apps += '</tr></table>';
             apps += '</div>';
+            return displayentries(cdr(entries));
         }
+
+        displayentries(entries);
+
         apps += '</div>';
         $('apps').innerHTML = apps;
     }

Modified: tuscany/sca-cpp/trunk/modules/edit/log.py
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/edit/log.py?rev=1154447&r1=1154446&r2=1154447&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/edit/log.py (original)
+++ tuscany/sca-cpp/trunk/modules/edit/log.py Sat Aug  6 05:59:32 2011
@@ -20,5 +20,5 @@ from sys import stderr
 
 # Log a message
 def log(msg):
-    print >> stderr, msg
+    print >> stderr, '[rconsole]', msg
 

Modified: tuscany/sca-cpp/trunk/modules/js/htdocs/all-min.js
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/js/htdocs/all-min.js?rev=1154447&r1=1154446&r2=1154447&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/modules/js/htdocs/all-min.js (original)
+++ tuscany/sca-cpp/trunk/modules/js/htdocs/all-min.js Sat Aug  6 05:59:32 2011
@@ -1,39 +1,37 @@
 function cons(car,cdr){var a=new Array();a.push(car);return a.concat(cdr);}
 function car(l){return l[0];}
-function first(l){return car(l);}
+function first(l){return l[0];}
 function cdr(l){return l.slice(1);}
-function rest(l){return cdr(l);}
-function cadr(l){return car(cdr(l));}
-function cddr(l){return cdr(cdr(l));}
-function caddr(l){return car(cddr(l));}
-function cdddr(l){return cdr(cdr(cdr(l)));}
-function cadddr(l){return car(cdddr(l));}
+function rest(l){return l.slice(1);}
+function cadr(l){return l[1];}
+function cddr(l){return l.slice(2);}
+function caddr(l){return l[2];}
+function cdddr(l){return l.slice(3);}
+function cadddr(l){return l[3];}
 function append(a,b){return a.concat(b);}
 function reverse(l){return l.slice(0).reverse();}
 function range(a,b){var l=new Array();for(var x=a;x<b;x++)
 l.push(x);return l;}
-function isNil(v){if(v==null||typeof v=='undefined'||(v.constructor==Array&&v.length==0))
-return true;return false;}
-function isSymbol(v){if(typeof v=='string'&&v.slice(0,1)=="'")
-return true;return false;}
-function isString(v){if(typeof v=='string'&&v.slice(0,1)!="'")
-return true;return false;}
-function isList(v){if(v!=null&&typeof v!='undefined'&&v.constructor==Array)
-return true;return false;}
-function isTaggedList(v,t){if(isList(v)&&!isNil(v)&&car(v)==t)
-return true;return false;}
+function isNil(v){return(v==null||typeof v=='undefined'||(v.constructor==Array&&v.length==0));}
+function isSymbol(v){return(typeof v=='string'&&v.slice(0,1)=="'");}
+function isString(v){return(typeof v=='string'&&v.slice(0,1)!="'");}
+function isList(v){return(v!=null&&typeof v!='undefined'&&v.constructor==Array);}
+function isTaggedList(v,t){return(isList(v)&&!isNil(v)&&car(v)==t);}
 var emptylist=new Array();function mklist(){if(arguments.length==0)
 return emptylist;var a=new Array();for(i=0;i<arguments.length;i++)
 a[i]=arguments[i];return a;}
 function length(l){return l.length;}
 function assoc(k,l){if(isNil(l))
-return mklist();if(k==car(car(l)))
-return car(l);return assoc(k,cdr(l));}
+return emptylist;var n=l.length;for(var i=0;i<n;i++){if(k==car(l[i]))
+return l[i];}
+return emptylist;}
 function map(f,l){if(isNil(l))
-return l;return cons(f(car(l)),map(f,cdr(l)));}
+return l;var n=l.length;var a=new Array();for(var i=0;i<n;i++){a.push(f(l[i]));}
+return a;}
 function filter(f,l){if(isNil(l))
-return l;if(f(car(l)))
-return cons(car(l),filter(f,cdr(l)));return filter(f,cdr(l));}
+return l;var n=l.length;var a=new Array();for(var i=0;i<n;i++){if(f(l[i]))
+a.push(l[i]);}
+return a;}
 function reduce(f,i,l){if(isNil(l))
 return i;return reduce(f,f(i,car(l)),cdr(l));}
 function tokens(path){return filter(function(s){return length(s)!=0;},path.split("/"));}
@@ -50,7 +48,8 @@ config={};function AssertException(){}
 AssertException.prototype.toString=function(){return'AssertException';};function assert(exp){if(!exp)
 throw new AssertException();}
 function writeStrings(l){if(isNil(l))
-return'';return car(l)+writeStrings(cdr(l));}
+return'';var s='';var n=l.length;for(var i=0;i<n;i++){s=s+l[i];}
+return s;}
 function writeValue(v){function writePrimitive(p){if(isSymbol(p))
 return''+p.substring(1);if(isString(p))
 return'"'+p+'"';return''+p;}
@@ -84,18 +83,11 @@ return b;a.length=0;return setappend(a,b
 var element="'element"
 var attribute="'attribute"
 var atsign="'@"
-function isElement(v){if(!isList(v)||isNil(v)||car(v)!=element)
-return false;return true;}
-function isAttribute(v){if(!isList(v)||isNil(v)||car(v)!=attribute)
-return false;return true;}
-function attributeName(l){return cadr(l);}
-function attributeValue(l){return caddr(l);}
-function elementName(l){return cadr(l);}
-function elementHasChildren(l){return!isNil(cddr(l));}
-function elementChildren(l){return cddr(l);}
-function elementHasValue(l){r=reverse(l);if(isSymbol(car(r)))
-return false;if(isList(car(r))&&!isNil(car(r))&&isSymbol(car(car(r))))
-return false;return true;}
+function isElement(v){return(!(!isList(v)||isNil(v)||car(v)!=element));}
+function isAttribute(v){return(!(!isList(v)||isNil(v)||car(v)!=attribute));}
+attributeName=cadr;attributeValue=caddr;elementName=cadr;function elementHasChildren(l){return!isNil(cddr(l));}
+elementChildren=cddr;function elementHasValue(l){var r=reverse(l);if(isSymbol(car(r)))
+return false;return(!(isList(car(r))&&!isNil(car(r))&&isSymbol(car(car(r)))))}
 function elementValue(l){return car(reverse(l));}
 function elementToValueIsList(v){if(!isList(v))
 return false;return isNil(v)||!isSymbol(car(v));}
@@ -105,10 +97,7 @@ return mklist(elementName(t),elementValu
 return cons(elementName(t),elementsToValues(elementChildren(t)));}
 if(!isList(t))
 return t;return elementsToValues(t);}
-function elementToValueIsSymbol(v){if(!isList(v))
-return false;if(isNil(v))
-return false;if(!isSymbol(car(v)))
-return false;return true;}
+function elementToValueIsSymbol(v){return(!(!isList(v))||isNil(v)||!isSymbol(car(v)));}
 function elementToValueGroupValues(v,l){if(isNil(l)||!elementToValueIsSymbol(v)||!elementToValueIsSymbol(car(l)))
 return cons(v,l);if(car(car(l))!=car(v))
 return cons(v,l);if(!elementToValueIsList(cadr(car(l)))){var g=mklist(car(v),mklist(cdr(v),cdr(car(l))));return elementToValueGroupValues(g,cdr(l));}
@@ -243,12 +232,13 @@ var turi=targetURI();if(isNil(turi))
 return turi;return car(tokens(turi));};scdl.properties=function(l){return namedElementChildren("'property",l);};scdl.propertyValue=function(l){if(!elementHasValue(l))
 return'';return elementValue(l);};scdl.nameToElementAssoc=function(l){if(isNil(l))
 return l;return cons(mklist(scdl.name(car(l)),car(l)),scdl.nameToElementAssoc(cdr(l)));};var ui={};ui.ahref=function(loc,target,html){if(target=='_blank')
-return'<a href="'+loc+'" target="_blank">'+html+'</a>';return'<a href="javascript:void(0)" onclick="window.open(\''+loc+'\', \''+target+'\');">'+html+'</a>';};ui.menu=function(name,href,target){function Menu(n,h,t){this.name=n;this.href=h;this.target=isNil(t)?'_parent':t;this.content=function(){function complete(uri){var q=uri.indexOf('?');if(q!=-1)
+return'<a href="'+loc+'" target="_blank">'+html+'</a>';return'<a href="javascript:void(0)" onclick="ui.navigate(\''+loc+'\', \''+target+'\');">'+html+'</a>';};ui.menu=function(name,href,target){function Menu(n,h,t){this.name=n;this.href=h;this.target=isNil(t)?'_parent':t;this.content=function(){function complete(uri){var h=uri.indexOf('#');if(h!=-1)
+return complete(uri.substr(0,h));var q=uri.indexOf('?');if(q!=-1)
 return complete(uri.substr(0,q));if(uri.match('.*\.html$'))
 return uri;if(uri.match('.*/$'))
 return uri+'index.html';return uri+'/index.html';}
 if(complete(this.href)!=complete(window.top.location.pathname))
-return ui.ahref(this.href,this.target,'<span class="amenu">'+this.name+'</span>');return ui.ahref(this.href,this.target,'<span class="smenu">'+this.name+'</span>');};}
+return ui.ahref(this.href,this.target,'<span class="tbaramenu">'+this.name+'</span>');return ui.ahref(this.href,this.target,'<span class="tbarsmenu">'+this.name+'</span>');};}
 return new Menu(name,href,target);};ui.menubar=function(left,right){var bar='<table cellpadding="0" cellspacing="0" width="100%" class="tbar"><tr>'+'<td class="dtbar"><table border="0" cellspacing="0" cellpadding="0"><tr>';for(i in left)
 bar=bar+'<td class="ltbar">'+left[i].content()+'</td>'
 bar=bar+'</tr></table></td>'+'<td class="dtbar"><table border="0" cellpadding="0" cellspacing="0" align="right"><tr>';for(i in right)
@@ -267,18 +257,30 @@ items+='</table>';this.suggestDiv.innerH
 break;}
 this.suggestDiv.style.left=left;this.suggestDiv.style.top=top+input.offsetHeight;this.suggestDiv.style.visibility='visible';}else
 this.suggestDiv.style.visibility='hidden';}
-input.onkeydown=function(event){this.showSuggestDiv();};input.onkeyup=function(event){this.showSuggestDiv();};input.onmousedown=function(event){this.showSuggestDiv();};input.onblur=function(event){setTimeout(function(){input.hideSuggestDiv();},50);};};ui.content=function(win){if(!isNil(win.document))
-return win.document;if(!isNil(win.contentDocument))
-return win.contentDocument;return null;};ui.elementByID=function(node,id){for(var i in node.childNodes){var child=node.childNodes[i];if(child.id==id)
+input.onkeydown=function(event){this.showSuggestDiv();};input.onkeyup=function(event){this.showSuggestDiv();};input.onmousedown=function(event){this.showSuggestDiv();};input.onblur=function(event){setTimeout(function(){input.hideSuggestDiv();},50);};};ui.elementByID=function(node,id){for(var i in node.childNodes){var child=node.childNodes[i];if(child.id==id)
 return child;var gchild=ui.elementByID(child,id);if(gchild!=null)
 return gchild;}
 return null;};function $(id){if(id==document){if(!isNil(document.widget))
 return document.widget;return document;}
 return ui.elementByID($(document),id);};ui.queryParams=function(){var qp=new Array();var qs=window.location.search.substring(1).split('&');for(var i=0;i<qs.length;i++){var e=qs[i].indexOf('=');if(e>0)
 qp[qs[i].substring(0,e)]=unescape(qs[i].substring(e+1));}
-return qp;};ui.isMobile=function(){var ua=navigator.userAgent;if(ua.match(/iPhone/i)||ua.match(/iPad/i)||ua.match(/Android/i)||ua.match(/Blackberry/i)||ua.match(/WebOs/i))
-return true;return false;};ui.onload=function(){document.body.style.visibility='visible';document.body.onorientationchange=function(){window.open(window.location,'_self');return true;};return true;};ui.numpos=function(p){if(p=='')
-return 0;return Number(p.substr(0,p.length-2));};ui.pixpos=function(p){return p+'px';};ui.datatable=function(l){function indent(i){if(i==0)
+return qp;};ui.fragmentParams=function(){var qp=new Array();var qs=window.location.hash.substring(1).split('&');for(var i=0;i<qs.length;i++){var e=qs[i].indexOf('=');if(e>0)
+qp[qs[i].substring(0,e)]=unescape(qs[i].substring(e+1));}
+return qp;};ui.mobiledetected=false;ui.mobile=false;ui.isMobile=function(){if(ui.mobiledetected)
+return ui.mobile;var ua=navigator.userAgent;if(ua.match(/iPhone/i)||ua.match(/iPad/i)||ua.match(/Android/i)||ua.match(/Blackberry/i)||ua.match(/WebOs/i))
+ui.mobile=true;ui.mobiledetected=true;return ui.mobile;};ui.pagetransitions=false;ui.initbody=function(){if(ui.isMobile()){if(ui.pagetransitions){var bdiv=$('bodydiv');if(!isNil(bdiv)){bdiv.className='bodydivloading';}}
+document.body.onorientationchange=ui.onorientationchange;}
+return true;}
+ui.onorientationchange=function(){window.open(window.location,'_self');return true;}
+ui.onload=function(){var path=document.location.pathname;if(path.indexOf('/login/')!=0&&path.indexOf('/logout/')!=0)
+localStorage.setItem('ui.lastvisited',''+document.location);document.body.style.visibility='visible';if(ui.pagetransitions&&ui.isMobile()){setTimeout(function(){var bdiv=$('bodydiv');if(!isNil(bdiv)){function transitionend(e){bdiv.removeEventListener('webkitTransitionEnd',transitionend,false);bdiv.removeEventListener('transitionend',transitionend,false);bdiv.className='bodydiv';};bdiv.addEventListener('webkitTransitionEnd',transitionend,false);bdiv.addEventListener('transitionend',transitionend,false);bdiv.className='bodydivloaded';}},0);}
+return true;};ui.navigate=function(url,win){function opendoc(url,win){if(win=='_reload'){window.location=url;return window.location.reload();}
+return window.open(url,win);}
+if(ui.pagetransitions&&ui.isMobile()&&win!='_blank'){var bdiv=$('bodydiv');if(!isNil(bdiv)){function transitionend(e){bdiv.removeEventListener('webkitTransitionEnd',transitionend,false);bdiv.removeEventListener('transitionend',transitionend,false);return opendoc(url,win);};bdiv.addEventListener('webkitTransitionEnd',transitionend,false);bdiv.addEventListener('transitionend',transitionend,false);bdiv.className='bodydivunloaded';return true;}}
+return opendoc(url,win);}
+ui.onbeforeunload=function(){if(ui.pagetransitions&&ui.isMobile()){var bdiv=$('bodydiv');if(!isNil(bdiv))
+bdiv.className='bodydivunloaded';}};ui.lastvisited=function(){return localStorage.getItem('ui.lastvisited');}
+ui.numpos=function(p){return p==''?0:Number(p.substr(0,p.length-2));};ui.pixpos=function(p){return p+'px';};ui.datatable=function(l){function indent(i){if(i==0)
 return'';return'&nbsp;&nbsp;'+indent(i-1);}
 function rows(l,i){if(isNil(l))
 return'';var e=car(l);if(!isList(e))
@@ -310,30 +312,31 @@ return"{"+v.join(", ")+"}";};function HT
 HTTPBindingClient.jsonrpcID=1;HTTPBindingClient.prototype.createApplyMethod=function(){var fn=function(){var methodName=arguments[0];var args=[];for(var i=1;i<arguments.length;i++)
 args.push(arguments[i]);var cb=null;if(typeof args[args.length-1]=="function")
 cb=args.pop();var req=HTTPBindingClient.makeJSONRequest(methodName,args,cb);return fn.client.jsonApply(req);};fn.client=this;return fn;};HTTPBindingClient.makeJSONRequest=function(methodName,args,cb){var req={};req.id=HTTPBindingClient.jsonrpcID++;if(cb)
-req.cb=cb;var obj={};obj.id=req.id;obj.method=methodName;obj.params=args;req.data=JSONClient.toJSON(obj);return req;};HTTPBindingClient.jsonResult=function(http){function httpCharset(http){try{var contentType=http.getResponseHeader("Content-type");var parts=contentType.split(/\s*;\s*/);for(var i=0;i<parts.length;i++){if(parts[i].substring(0,8)=="charset=")
+req.cb=cb;var obj={};obj.id=req.id;obj.method=methodName;obj.params=args;req.data=JSONClient.toJSON(obj);return req;};HTTPBindingClient.jsonResult=function(http){function httpCharset(http){try{var contentType=http.getResponseHeader("Content-Type");var parts=contentType.split(/\s*;\s*/);for(var i=0;i<parts.length;i++){if(parts[i].substring(0,8)=="charset=")
 return parts[i].substring(8,parts[i].length);}}catch(e){}
 return"UTF-8";}
 if(!HTTPBindingClient.charset)
 HTTPBindingClient.charset=httpCharset(http);var obj;eval("obj = "+http.responseText);if(obj.error)
-throw new HTTPBindingClient.Exception(obj.error.code,obj.error.msg);var res=obj.result;return res;};HTTPBindingClient.prototype.jsonApply=function(req){var http=HTTPBindingClient.getHTTPRequest();var hascb=req.cb?true:false;http.open("POST",this.uri,hascb);http.setRequestHeader("Content-type","application/json-rpc");if(hascb){http.onreadystatechange=function(){if(http.readyState==4){if(http.status==200){var res=null;try{res=HTTPBindingClient.jsonResult(http);}catch(e){req.cb(null,e);}
-req.cb(res);}else
-req.cb(null,HTTPBindingClient.Exception(http.status,http.statusText));}};http.send(req.data);return req.id;}
+throw new HTTPBindingClient.Exception(obj.error.code,obj.error.msg);var res=obj.result;return res;};HTTPBindingClient.prototype.jsonApply=function(req){var http=HTTPBindingClient.getHTTPRequest();var hascb=req.cb?true:false;http.open("POST",this.uri,hascb);http.setRequestHeader("Content-Type","application/json-rpc");if(hascb){http.onreadystatechange=function(){if(http.readyState==4){if(http.status==200){var res=null;try{res=HTTPBindingClient.jsonResult(http);try{req.cb(res);}catch(cbe){}}catch(e){try{req.cb(null,e);}catch(cbe){}}}else
+try{req.cb(null,HTTPBindingClient.Exception(http.status,http.statusText));}catch(cbe){}}};http.send(req.data);return req.id;}
 http.send(req.data);if(http.status==200)
-return HTTPBindingClient.jsonResult(http);throw new HTTPBindingClient.Exception(http.status,http.statusText);};HTTPBindingClient.prototype.get=function(id,cb){var http=HTTPBindingClient.getHTTPRequest();var hascb=cb?true:false;http.open("GET",this.uri+'/'+id,hascb);if(hascb){http.onreadystatechange=function(){if(http.readyState==4){if(http.status==200)
-cb(http.responseText);else
-cb(null,new HTTPBindingClient.Exception(http.status,http.statusText));}};http.send(null);return true;}
-http.send(null);if(http.status==200)
-return http.responseText;throw new HTTPBindingClient.Exception(http.status,http.statusText);};HTTPBindingClient.prototype.post=function(entry,cb){var http=HTTPBindingClient.getHTTPRequest();var hascb=cb?true:false;http.open("POST",this.uri,hascb);http.setRequestHeader("Content-Type","application/atom+xml");if(hascb){http.onreadystatechange=function(){if(http.readyState==4){if(http.status==201)
-cb(http.responseText);else
-cb(null,new HTTPBindingClient.Exception(http.status,http.statusText));}};http.send(entry);return true;}
+return HTTPBindingClient.jsonResult(http);throw new HTTPBindingClient.Exception(http.status,http.statusText);};HTTPBindingClient.prototype.get=function(id,cb){var u=this.uri+'/'+id;var hascb=cb?true:false;var item=localStorage.getItem(u);if(item!=null&&item!=''){if(!hascb)
+return item;try{cb(item);}catch(cbe){}}
+var http=HTTPBindingClient.getHTTPRequest();http.open("GET",u,hascb);if(hascb){http.onreadystatechange=function(){if(http.readyState==4){if(http.status==200){if(http.getResponseHeader("X-Login")!=null){try{cb(null,new HTTPBindingClient.Exception(403,'X-Login'));}catch(cbe){}}else if(http.responseText==''||http.getResponseHeader("Content-Type")==null){try{cb(null,new HTTPBindingClient.Exception(403,'No-Content'));}catch(cbe){}}else{if(item==null||http.responseText!=item){if(http.responseText!=null){localStorage.setItem(u,http.responseText);}
+try{cb(http.responseText);}catch(cbe){}}}}
+else{if(item==null){try{cb(null,new HTTPBindingClient.Exception(http.status,http.statusText));}catch(cbe){}}}}};http.send(null);return true;}
+http.send(null);if(http.status==200){if(http.getResponseHeader("X-Login")!=null){throw new HTTPBindingClient.Exception(403,'X-Login');}else if(http.responseText==''||http.getResponseHeader("Content-Type")==null){throw new HTTPBindingClient.Exception(403,'No-Content');}
+return http.responseText;}
+throw new HTTPBindingClient.Exception(http.status,http.statusText);};HTTPBindingClient.prototype.getnocache=function(id,cb){var u=this.uri+'/'+id;var hascb=cb?true:false;var http=HTTPBindingClient.getHTTPRequest();http.open("GET",u,hascb);if(hascb){http.onreadystatechange=function(){if(http.readyState==4){if(http.status==200){if(http.getResponseHeader("X-Login")!=null){try{return cb(null,new HTTPBindingClient.Exception(403,'X-Login'));}catch(cbe){}}else if(http.responseText==''||http.getResponseHeader("Content-Type")==null){try{return cb(null,new HTTPBindingClient.Exception(403,'No-Content'));}catch(cbe){}}else{try{cb(http.responseText);}catch(cbe){}}}else{try{cb(null,new HTTPBindingClient.Exception(http.status,http.statusText));}catch(cbe){}}}};http.send(null);return true;}
+http.send(null);if(http.status==200){if(http.getResponseHeader("X-Login")!=null){throw new HTTPBindingClient.Exception(403,'X-Login');}else if(http.responseText==''||http.getResponseHeader("Content-Type")==null){throw new HTTPBindingClient.Exception(403,'No-Content');}
+return http.responseText;}
+throw new HTTPBindingClient.Exception(http.status,http.statusText);};HTTPBindingClient.prototype.post=function(entry,cb){var http=HTTPBindingClient.getHTTPRequest();var hascb=cb?true:false;http.open("POST",this.uri,hascb);http.setRequestHeader("Content-Type","application/atom+xml");if(hascb){http.onreadystatechange=function(){if(http.readyState==4){if(http.status==201){try{cb(http.responseText);}catch(cbe){}}
+else{try{cb(null,new HTTPBindingClient.Exception(http.status,http.statusText));}catch(cbe){}}}};http.send(entry);return true;}
 http.send(entry);if(http.status==201)
-return http.responseText;throw new HTTPBindingClient.Exception(http.status,http.statusText);};HTTPBindingClient.prototype.put=function(id,entry,cb){var http=HTTPBindingClient.getHTTPRequest();var hascb=cb?true:false;http.open("PUT",this.uri+'/'+id,hascb);http.setRequestHeader("Content-Type","application/atom+xml");if(hascb){http.onreadystatechange=function(){if(http.readyState==4){if(http.status==200)
-cb();else
-cb(new HTTPBindingClient.Exception(http.status,http.statusText));}};http.send(entry);return true;}
+return http.responseText;throw new HTTPBindingClient.Exception(http.status,http.statusText);};HTTPBindingClient.prototype.put=function(id,entry,cb){var u=this.uri+'/'+id;localStorage.setItem(u,entry);var http=HTTPBindingClient.getHTTPRequest();var hascb=cb?true:false;http.open("PUT",u,hascb);http.setRequestHeader("Content-Type","application/atom+xml");if(hascb){http.onreadystatechange=function(){if(http.readyState==4){if(http.status==200){try{cb();}catch(cbe){}}else{try{cb(new HTTPBindingClient.Exception(http.status,http.statusText));}catch(cbe){}}}};http.send(entry);return true;}
 http.send(entry);if(http.status==200)
-return true;throw new HTTPBindingClient.Exception(http.status,http.statusText);};HTTPBindingClient.prototype.del=function(id,cb){var http=HTTPBindingClient.getHTTPRequest();var hascb=cb?true:false;http.open("DELETE",this.uri+'/'+id,hascb);if(cb){http.onreadystatechange=function(){if(http.readyState==4){if(http.status==200)
-cb();else
-cb(new HTTPBindingClient.Exception(http.status,http.statusText));}};http.send(null);return true;}
+return true;throw new HTTPBindingClient.Exception(http.status,http.statusText);};HTTPBindingClient.prototype.del=function(id,cb){var u=this.uri+'/'+id;localStorage.removeItem(u);var http=HTTPBindingClient.getHTTPRequest();var hascb=cb?true:false;http.open("DELETE",u,hascb);if(cb){http.onreadystatechange=function(){if(http.readyState==4){if(http.status==200){try{cb();}catch(cbe){}}
+else{try{cb(new HTTPBindingClient.Exception(http.status,http.statusText));}catch(cbe){}}}};http.send(null);return true;}
 http.send(null);if(http.status==200)
 return true;throw new HTTPBindingClient.Exception(http.status,http.statusText);};HTTPBindingClient.Exception=function(code,message){this.name="HTTPBindingClientException";this.code=code;this.message=message;};HTTPBindingClient.Exception.prototype=new Error();HTTPBindingClient.Exception.prototype.toString=function(){return this.name+": "+this.message;};HTTPBindingClient.msxmlNames=["MSXML2.XMLHTTP.5.0","MSXML2.XMLHTTP.4.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"];HTTPBindingClient.getHTTPRequest=function(){if(HTTPBindingClient.httpFactory)
 return HTTPBindingClient.httpFactory();try{HTTPBindingClient.httpFactory=function(){return new XMLHttpRequest();};return HTTPBindingClient.httpFactory();}catch(e){}