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 2012/07/16 08:47:40 UTC

svn commit: r1361914 [1/3] - in /tuscany/sca-cpp/trunk: ./ hosting/server/ hosting/server/htdocs/ hosting/server/htdocs/account/ hosting/server/htdocs/app/ hosting/server/htdocs/clone/ hosting/server/htdocs/create/ hosting/server/htdocs/delete/ hosting...

Author: jsdelfino
Date: Mon Jul 16 06:47:37 2012
New Revision: 1361914

URL: http://svn.apache.org/viewvc?rev=1361914&view=rev
Log:
Improve caching support and some of the navigations in the hosting environment.

Added:
    tuscany/sca-cpp/trunk/hosting/server/htdocs/app/cache-template.cmf
      - copied, changed from r1343580, tuscany/sca-cpp/trunk/hosting/server/htdocs/app/cache-manifest.cmf
    tuscany/sca-cpp/trunk/hosting/server/htdocs/cache-template.cmf
      - copied, changed from r1343580, tuscany/sca-cpp/trunk/hosting/server/htdocs/cache-manifest.cmf
    tuscany/sca-cpp/trunk/hosting/server/logic-test
      - copied, changed from r1343580, tuscany/sca-cpp/trunk/hosting/server/server-test
    tuscany/sca-cpp/trunk/hosting/server/proxy-start
      - copied, changed from r1343580, tuscany/sca-cpp/trunk/hosting/server/start
    tuscany/sca-cpp/trunk/hosting/server/ssl-proxy-start   (with props)
    tuscany/sca-cpp/trunk/modules/http/alt-host-conf
      - copied, changed from r1343580, tuscany/sca-cpp/trunk/hosting/server/server-test
    tuscany/sca-cpp/trunk/modules/http/cache-conf
      - copied, changed from r1343580, tuscany/sca-cpp/trunk/hosting/server/server-test
    tuscany/sca-cpp/trunk/modules/http/cache-manifest
      - copied, changed from r1343580, tuscany/sca-cpp/trunk/hosting/server/stop
    tuscany/sca-cpp/trunk/modules/http/cache-ssl-conf
      - copied, changed from r1343580, tuscany/sca-cpp/trunk/hosting/server/server-test
    tuscany/sca-cpp/trunk/modules/http/mass-host-conf
      - copied, changed from r1343580, tuscany/sca-cpp/trunk/modules/http/vhost-conf
    tuscany/sca-cpp/trunk/modules/http/mass-host-ssl-conf
      - copied, changed from r1343580, tuscany/sca-cpp/trunk/modules/http/vhost-ssl-conf
Removed:
    tuscany/sca-cpp/trunk/hosting/server/htdocs/app/cache-manifest.cmf
    tuscany/sca-cpp/trunk/hosting/server/htdocs/cache-manifest.cmf
    tuscany/sca-cpp/trunk/modules/http/vhost-conf
    tuscany/sca-cpp/trunk/modules/http/vhost-ssl-conf
Modified:
    tuscany/sca-cpp/trunk/.gitignore
    tuscany/sca-cpp/trunk/hosting/server/htdocs/account/index.html
    tuscany/sca-cpp/trunk/hosting/server/htdocs/app/index.html
    tuscany/sca-cpp/trunk/hosting/server/htdocs/clone/index.html
    tuscany/sca-cpp/trunk/hosting/server/htdocs/config.js
    tuscany/sca-cpp/trunk/hosting/server/htdocs/create/index.html
    tuscany/sca-cpp/trunk/hosting/server/htdocs/delete/index.html
    tuscany/sca-cpp/trunk/hosting/server/htdocs/graph/index.html
    tuscany/sca-cpp/trunk/hosting/server/htdocs/home/index.html
    tuscany/sca-cpp/trunk/hosting/server/htdocs/index.html
    tuscany/sca-cpp/trunk/hosting/server/htdocs/login/index.html
    tuscany/sca-cpp/trunk/hosting/server/htdocs/page/index.html
    tuscany/sca-cpp/trunk/hosting/server/htdocs/proxy/public/oops/index.html
    tuscany/sca-cpp/trunk/hosting/server/htdocs/public/config.js
    tuscany/sca-cpp/trunk/hosting/server/htdocs/public/notauth/index.html
    tuscany/sca-cpp/trunk/hosting/server/htdocs/public/notfound/index.html
    tuscany/sca-cpp/trunk/hosting/server/htdocs/public/notyet/index.html
    tuscany/sca-cpp/trunk/hosting/server/htdocs/public/oops/index.html
    tuscany/sca-cpp/trunk/hosting/server/htdocs/stats/index.html
    tuscany/sca-cpp/trunk/hosting/server/htdocs/store/index.html
    tuscany/sca-cpp/trunk/hosting/server/server-test
    tuscany/sca-cpp/trunk/hosting/server/start
    tuscany/sca-cpp/trunk/hosting/server/stop
    tuscany/sca-cpp/trunk/modules/http/Makefile.am
    tuscany/sca-cpp/trunk/modules/http/htdocs/index.html
    tuscany/sca-cpp/trunk/modules/http/htdocs/login/index.html
    tuscany/sca-cpp/trunk/modules/http/htdocs/logout/index.html
    tuscany/sca-cpp/trunk/modules/http/httpd-conf
    tuscany/sca-cpp/trunk/modules/http/httpd.hpp
    tuscany/sca-cpp/trunk/modules/js/htdocs/ui.css
    tuscany/sca-cpp/trunk/modules/js/htdocs/ui.js
    tuscany/sca-cpp/trunk/modules/js/js-conf
    tuscany/sca-cpp/trunk/modules/oauth/htdocs/index.html
    tuscany/sca-cpp/trunk/modules/oauth/htdocs/login/index.html
    tuscany/sca-cpp/trunk/modules/oauth/htdocs/login/mixed.html
    tuscany/sca-cpp/trunk/modules/oauth/htdocs/logout/index.html
    tuscany/sca-cpp/trunk/modules/oauth/htdocs/public/index.html
    tuscany/sca-cpp/trunk/modules/openid/htdocs/index.html
    tuscany/sca-cpp/trunk/modules/openid/htdocs/login/index.html
    tuscany/sca-cpp/trunk/modules/openid/htdocs/logout/index.html
    tuscany/sca-cpp/trunk/modules/openid/htdocs/public/index.html
    tuscany/sca-cpp/trunk/modules/server/htdocs/index.html
    tuscany/sca-cpp/trunk/modules/wsgi/htdocs/index.html
    tuscany/sca-cpp/trunk/samples/relay-gae/htdocs/index.html
    tuscany/sca-cpp/trunk/samples/relay-python/htdocs/index.html
    tuscany/sca-cpp/trunk/samples/store-cluster/domains/jane/htdocs/index.html
    tuscany/sca-cpp/trunk/samples/store-cluster/domains/jane/htdocs/login/index.html
    tuscany/sca-cpp/trunk/samples/store-cluster/domains/jane/htdocs/logout/index.html
    tuscany/sca-cpp/trunk/samples/store-cluster/domains/joe/htdocs/index.html
    tuscany/sca-cpp/trunk/samples/store-cluster/domains/joe/htdocs/login/index.html
    tuscany/sca-cpp/trunk/samples/store-cluster/domains/joe/htdocs/logout/index.html
    tuscany/sca-cpp/trunk/samples/store-cluster/htdocs/index.html
    tuscany/sca-cpp/trunk/samples/store-cluster/htdocs/login/index.html
    tuscany/sca-cpp/trunk/samples/store-cluster/htdocs/logout/index.html
    tuscany/sca-cpp/trunk/samples/store-cluster/proxy-conf
    tuscany/sca-cpp/trunk/samples/store-cluster/proxy-ssl-conf
    tuscany/sca-cpp/trunk/samples/store-cluster/server-conf
    tuscany/sca-cpp/trunk/samples/store-cluster/server-ssl-conf
    tuscany/sca-cpp/trunk/samples/store-constdb/htdocs/index.html
    tuscany/sca-cpp/trunk/samples/store-cpp/htdocs/index.html
    tuscany/sca-cpp/trunk/samples/store-gae/htdocs/index.html
    tuscany/sca-cpp/trunk/samples/store-java/htdocs/index.html
    tuscany/sca-cpp/trunk/samples/store-python/htdocs/index.html
    tuscany/sca-cpp/trunk/samples/store-python/htdocs/login/index.html
    tuscany/sca-cpp/trunk/samples/store-python/htdocs/logout/index.html
    tuscany/sca-cpp/trunk/samples/store-scheme/htdocs/index.html
    tuscany/sca-cpp/trunk/samples/store-sql/htdocs/index.html
    tuscany/sca-cpp/trunk/samples/store-vhost/domains/jane/htdocs/index.html
    tuscany/sca-cpp/trunk/samples/store-vhost/domains/joe/htdocs/index.html
    tuscany/sca-cpp/trunk/samples/store-vhost/htdocs/index.html
    tuscany/sca-cpp/trunk/samples/store-vhost/ssl-start
    tuscany/sca-cpp/trunk/samples/store-vhost/start
    tuscany/sca-cpp/trunk/samples/store-vhost/uec2-start

Modified: tuscany/sca-cpp/trunk/.gitignore
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/.gitignore?rev=1361914&r1=1361913&r2=1361914&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/.gitignore (original)
+++ tuscany/sca-cpp/trunk/.gitignore Mon Jul 16 06:47:37 2012
@@ -57,6 +57,7 @@ config.guess
 config.sub
 config.status
 all.js
+cache-manifest.cmf
 *-min.html
 *-min.js
 *-min.css

Modified: tuscany/sca-cpp/trunk/hosting/server/htdocs/account/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/account/index.html?rev=1361914&r1=1361913&r2=1361914&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/hosting/server/htdocs/account/index.html (original)
+++ tuscany/sca-cpp/trunk/hosting/server/htdocs/account/index.html Mon Jul 16 06:47:37 2012
@@ -27,7 +27,7 @@
 <tr><td><img id="userimg" style="width: 50px; height: 50px; vertical-align: top;"></td></tr>
 <tr><tr><td style="padding-top: 6px;"><b>Name:</b></td></tr>
 <tr><td><input type="text" id="userTitle" class="flatentry" size="30" placeholder="Enter your name" style="width: 300px;"/></td></tr>
-<tr><tr><td style="padding-top: 6px;"><b>Description:</b></td></tr>
+<tr><tr><td style="padding-top: 6px;"><b>About Me:</b></td></tr>
 <tr><td><textarea id="userDescription" class="flatentry" cols="40" rows="3" placeholder="Enter a short description of yourself" style="width: 300px;"></textarea></td></tr>
 </table>
 
@@ -70,17 +70,24 @@
 </div>
 
 <script type="text/javascript">
+(function() {
 
-// Init service references
-var editWidget = sca.component("EditWidget");
-var user= sca.defun(sca.reference(editWidget, "user"));
-var accounts = sca.reference(editWidget, "accounts");
-
-// Set page titles
-document.title = ui.windowtitle(location.hostname) + ' - Account';
-$('viewhead').innerHTML = '<span class="smenu">' + username + '</span>';
+/**
+ * Init service references.
+ */
+var editorComp = sca.component("Editor");
+var user= sca.defun(sca.reference(editorComp, "user"));
+var accounts = sca.reference(editorComp, "accounts");
+
+/**
+ * Set page titles.
+ */
+document.title = config.windowtitle() + ' - Account';
+$('viewhead').innerHTML = '<span class="cmenu">' + username + '</span>';
 
-// Set images
+/**
+ * Set images.
+ */
 $('userimg').src = ui.b64img(appcache.get('/public/user.b64'));
 
 /**
@@ -95,18 +102,16 @@ var savedaccountentryxml = '';
 function getaccount() {
     showStatus('Loading');
 
-    return accounts.get(name, function(doc) {
+    return accounts.get('', function(doc) {
 
         // Stop now if we didn't get an account
         if (doc == null) {
-            showError('App not available');
+            showError('Account info not available');
             return false;
         }
-        showStatus(defaultStatus());
+        showOnlineStatus();
 
         accountentry = car(elementsToValues(atom.readATOMEntry(mklist(doc))));
-        //username = cadr(assoc("'id", cdr(accountentry)));
-        $('userNameHeader').innerHTML = username;
         $('userTitle').value = cadr(assoc("'title", cdr(accountentry)));
 
         var content = cadr(assoc("'content", cdr(accountentry)));
@@ -146,7 +151,7 @@ function save(entryxml) {
         return false;
     showStatus('Saving');
     savedaccountentryxml = entryxml;
-    accounts.put(username, savedaccountentryxml, function(e) {
+    accounts.put('', savedaccountentryxml, function(e) {
         if (e) {
             showStatus('Local copy');
             return false;
@@ -206,9 +211,12 @@ $('userForm').onsubmit = function() {
     return false;
 };
 
-// Get the user's account
+/**
+ * Get the user's account.
+ */
 getaccount();
 
+})();
 </script>
 
 </div>

Copied: tuscany/sca-cpp/trunk/hosting/server/htdocs/app/cache-template.cmf (from r1343580, tuscany/sca-cpp/trunk/hosting/server/htdocs/app/cache-manifest.cmf)
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/app/cache-template.cmf?p2=tuscany/sca-cpp/trunk/hosting/server/htdocs/app/cache-template.cmf&p1=tuscany/sca-cpp/trunk/hosting/server/htdocs/app/cache-manifest.cmf&r1=1343580&r2=1361914&rev=1361914&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/hosting/server/htdocs/app/cache-manifest.cmf (original)
+++ tuscany/sca-cpp/trunk/hosting/server/htdocs/app/cache-template.cmf Mon Jul 16 06:47:37 2012
@@ -1,6 +1,6 @@
 CACHE MANIFEST
 
-# Version 5
+# Version SHA1
 
 # App resources
 /favicon.ico

Modified: tuscany/sca-cpp/trunk/hosting/server/htdocs/app/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/app/index.html?rev=1361914&r1=1361913&r2=1361914&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/hosting/server/htdocs/app/index.html (original)
+++ tuscany/sca-cpp/trunk/hosting/server/htdocs/app/index.html Mon Jul 16 06:47:37 2012
@@ -26,6 +26,7 @@
 <link rel="apple-touch-icon" href="/public/touchicon.png"/>
 <base href="/"/>
 <script type="text/javascript">
+(function() {
 
 window.appcache = {};
 
@@ -50,50 +51,60 @@ appcache.get = function(uri) {
     http.send(null);
     if (http.status == 200) {
         if (http.getResponseHeader("X-Login") != null) {
-            if (debug) debug('http error', u, 'X-Login');
+            if (window.debug) debug('http error', u, 'X-Login');
             // Redirect to login page if not signed in
             document.location = '/login/';
             return null;
         } else if (http.responseText == '' || http.getResponseHeader("Content-Type") == null) {
-            if (debug) debug('http error', u, 'No-Content');
+            if (window.debug) debug('http error', u, 'No-Content');
             return null;
         }
         try { ls.setItem(u, http.responseText); } catch(e) {}
         return http.responseText;
     }
-    if (debug) debug('http error', u, http.status, http.statusText);
+    if (window.debug) debug('http error', u, http.status, http.statusText);
     // Redirect to login page if not signed in
     if (http.status == 403)
         document.location = '/login/';
     return null;
 };
 
-// Load Javascript and CSS
-(function() {
-    var bootjs = document.createElement('script');
-    bootjs.type = 'text/javascript';
-    bootjs.text = appcache.get('/all-min.js');
-    document.head.appendChild(bootjs);
-    document.head.appendChild(ui.declareCSS(appcache.get('/ui-min.css')));
 })();
 
-</script>
+/**
+ * Load Javascript and CSS.
+ */
+(function() {
 
-<script type="text/javascript">
+var bootjs = document.createElement('script');
+bootjs.type = 'text/javascript';
+bootjs.text = appcache.get('/all-min.js');
+document.head.appendChild(bootjs);
+document.head.appendChild(ui.declareCSS(appcache.get('/ui-min.css')));
+
+})();
+
+/**
+ * Redirect to login page if not signed in.
+ */
+(function() {
 
-// Redirect to login page if not signed in
 if (document.location.protocol == 'https:' && !hasauthcookie())
     document.location = '/login/';
 
+})();
+
 </script>
 </head>
-<body class="delayed" onload="onload();">
+<body class="delayed">
 <div id="mainbodydiv" class="mainbodydiv">
 
 <div id="headdiv" class="hsection">
 <script type="text/javascript">
 (function() {
+
 $('headdiv').appendChild(ui.declareScript(appcache.get('/config-min.js')));
+
 })();
 </script>
 </div>
@@ -102,13 +113,16 @@ $('headdiv').appendChild(ui.declareScrip
 </div>
 
 <script type="text/javascript">
+(function() {
 
 /**
  * Get the app name
  */
 var appname = location.pathname.split('/')[1];
 
-// Set page title
+/**
+ * Set page title.
+ */
 document.title = appname;
 
 /**
@@ -125,9 +139,9 @@ var apppage = null;
 /**
  * Initialize the app HTTP clients.
  */
-var appWidget = sca.component('AppWidget');
-var pagecomp = sca.reference(appWidget, 'pages');
-var composcomp = sca.reference(appWidget, 'composites');
+var appComp = sca.component('App');
+var pagecomp = sca.reference(appComp, 'pages');
+var composcomp = sca.reference(appComp, 'composites');
 var startcomp = sca.httpclient('start', '/' + appname + '/start');
 var stopcomp = sca.httpclient('stop', '/' + appname + '/stop');
 var timercomp = sca.httpclient('timer', '/' + appname + '/timer');
@@ -964,7 +978,7 @@ function getappcomposite(appname) {
 }
 
 /**
- * Document load post processing.
+ * Initialize the document.
  */
 function onload() {
     //debug('onload');
@@ -984,6 +998,9 @@ function onload() {
     return true;
 }
 
+onload();
+
+})();
 </script>
 
 <div id="footdiv" class="fsection">

Copied: tuscany/sca-cpp/trunk/hosting/server/htdocs/cache-template.cmf (from r1343580, tuscany/sca-cpp/trunk/hosting/server/htdocs/cache-manifest.cmf)
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/cache-template.cmf?p2=tuscany/sca-cpp/trunk/hosting/server/htdocs/cache-template.cmf&p1=tuscany/sca-cpp/trunk/hosting/server/htdocs/cache-manifest.cmf&r1=1343580&r2=1361914&rev=1361914&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/hosting/server/htdocs/cache-manifest.cmf (original)
+++ tuscany/sca-cpp/trunk/hosting/server/htdocs/cache-template.cmf Mon Jul 16 06:47:37 2012
@@ -1,6 +1,6 @@
 CACHE MANIFEST
 
-# Version 6
+# Version SHA1
 
 # App resources
 /

Modified: tuscany/sca-cpp/trunk/hosting/server/htdocs/clone/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/clone/index.html?rev=1361914&r1=1361913&r2=1361914&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/hosting/server/htdocs/clone/index.html (original)
+++ tuscany/sca-cpp/trunk/hosting/server/htdocs/clone/index.html Mon Jul 16 06:47:37 2012
@@ -41,22 +41,31 @@
 </div>
 
 <script type="text/javascript">
+(function() {
 
-// Get the app name
+/**
+ * Get the app name.
+ */
 var appname = ui.fragmentParams(location)['app'];
 
-// Set page titles
-document.title = ui.windowtitle(location.hostname) + ' - ' + config.clone + ' - ' + appname;
-$('viewhead').innerHTML = '<span class="smenu">' + config.clone + ' ' + appname + '</span>';
-$('cloneAppOKButton').value = config.clone;
-$('cloneAppOKButton').title = config.clone + ' this app';
+/**
+ * Set page titles.
+ */
+document.title = config.windowtitle() + ' - ' + config.clone() + ' - ' + appname;
+$('viewhead').innerHTML = '<span class="smenu">' + config.clone() + ' ' + appname + '</span>';
+$('cloneAppOKButton').value = config.clone();
+$('cloneAppOKButton').title = config.clone() + ' this app';
 
-// Set images
+/**
+ * Set images.
+ */
 $('appimg').src = ui.b64img(appcache.get('/public/app.b64'));
 
-// Init service references
-var editWidget = sca.component("EditWidget");
-var apps = sca.reference(editWidget, "apps");
+/**
+ * Init service references.
+ */
+var editorComp = sca.component("Editor");
+var apps = sca.reference(editorComp, "apps");
 
 /**
  * The current app entry and corresponding saved XML content.
@@ -79,7 +88,7 @@ function getapp(name) {
             showError('App not available');
             return false;
         }
-        showStatus(defaultStatus());
+        showOnlineStatus();
 
         appentry = doc != null? car(elementsToValues(atom.readATOMEntry(mklist(doc)))) : mklist("'entry", mklist("'title", ''), mklist("'id", name));
         $('appTitle').value = cadr(assoc("'title", cdr(appentry)));
@@ -137,9 +146,12 @@ $('cloneAppCancelButton').onclick = func
     history.back();
 };
 
-// Get the current app
+/**
+ * Get the current app.
+ */
 getapp(appname);
 
+})();
 </script>
 
 </div>

Modified: tuscany/sca-cpp/trunk/hosting/server/htdocs/config.js
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/config.js?rev=1361914&r1=1361913&r2=1361914&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/hosting/server/htdocs/config.js (original)
+++ tuscany/sca-cpp/trunk/hosting/server/htdocs/config.js Mon Jul 16 06:47:37 2012
@@ -23,9 +23,31 @@ if (isNil(config))
 /**
  * UI configuration.
  */
-config.windowtitle = 'App Builder'
-config.pagetitle = '<span style="font-weight: bold;">App Builder</span>';
-config.hometitle = '<br/><span style="font-weight: bold;">Create SCA Composite Apps</span><br/><br/>';
-config.clone = 'Clone';
-config.logic = 'Logic';
+config.windowtitle = function() {
+    return 'App Builder';
+};
+
+config.pagetitle = function() {
+    return '<span style="font-weight: bold;">App Builder</span>';
+};
+
+config.hometitle = function() {
+    return '<br/><span style="font-weight: bold;">Create SCA Composite Apps</span><br/><br/>';
+};
+
+config.clone = function() {
+    return 'Clone';
+};
+
+config.logic = function() {
+    return 'Logic';
+};
+
+config.viewfoot = function() {
+    return ui.menubar(mklist(ui.menu('menuabout', 'About', '/', '_view', 'note')), mklist());
+};
+
+config.appresources = function() {
+    return mklist();
+};
 

Modified: tuscany/sca-cpp/trunk/hosting/server/htdocs/create/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/create/index.html?rev=1361914&r1=1361913&r2=1361914&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/hosting/server/htdocs/create/index.html (original)
+++ tuscany/sca-cpp/trunk/hosting/server/htdocs/create/index.html Mon Jul 16 06:47:37 2012
@@ -41,17 +41,24 @@
 </div>
 
 <script type="text/javascript">
+(function() {
 
-// Set page titles
-document.title = ui.windowtitle(location.hostname) + ' - Create App';
+/**
+ * Set page titles.
+ */
+document.title = config.windowtitle() + ' - Create App';
 $('viewhead').innerHTML = '<span class="smenu">Create an App</span>';
 
-// Set images
+/**
+ * Set images.
+ */
 $('appimg').src = ui.b64img(appcache.get('/public/app.b64'));
 
-// Init service references
-var editWidget = sca.component("EditWidget");
-var apps = sca.reference(editWidget, "apps");
+/**
+ * Init service references.
+ */
+var editorComp = sca.component("Editor");
+var apps = sca.reference(editorComp, "apps");
 
 /**
  * The current app entry and corresponding saved XML content.
@@ -105,8 +112,12 @@ $('createAppCancelButton').onclick = fun
     history.back();
 };
 
-showStatus(defaultStatus());
+/**
+ * Show the status.
+ */
+showOnlineStatus();
 
+})();
 </script>
 
 </div>

Modified: tuscany/sca-cpp/trunk/hosting/server/htdocs/delete/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/delete/index.html?rev=1361914&r1=1361913&r2=1361914&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/hosting/server/htdocs/delete/index.html (original)
+++ tuscany/sca-cpp/trunk/hosting/server/htdocs/delete/index.html Mon Jul 16 06:47:37 2012
@@ -43,20 +43,29 @@
 </div>
 
 <script type="text/javascript">
+(function() {
 
-// Get the app name
+/**
+ * Get the app name.
+ */
 var appname = ui.fragmentParams(location)['app'];
 
-// Set page titles
-document.title = ui.windowtitle(location.hostname) + ' - ' + 'Delete' + ' - ' + appname;
+/**
+ * Set page titles.
+ */
+document.title = config.windowtitle() + ' - ' + 'Delete' + ' - ' + appname;
 $('viewhead').innerHTML = '<span class="smenu">Delete ' + appname + '</span>';
 
-// Set images
+/**
+ * Set images.
+ */
 $('appimg').src = ui.b64img(appcache.get('/public/app.b64'));
 
-// Init service references
-var editWidget = sca.component("EditWidget");
-var apps = sca.reference(editWidget, "apps");
+/**
+ * Init service references.
+ */
+var editorComp = sca.component("Editor");
+var apps = sca.reference(editorComp, "apps");
 
 /**
  * The current app entry and corresponding saved XML content.
@@ -78,7 +87,7 @@ function getapp(name) {
             showError('App not available');
             return false;
         }
-        showStatus(defaultStatus());
+        showOnlineStatus();
 
         appentry = doc != null? car(elementsToValues(atom.readATOMEntry(mklist(doc)))) : mklist("'entry", mklist("'title", ''), mklist("'id", name));
         $('appTitle').value = cadr(assoc("'title", cdr(appentry)));
@@ -103,7 +112,7 @@ $('deleteAppForm').onsubmit = function()
             showStatus('Local copy');
             return false;
         }
-        showStatus(defaultStatus());
+        showOnlineStatus();
 
         // Return to the app store
         ui.navigate('/#view=store', '_view');
@@ -119,9 +128,12 @@ $('deleteAppCancelButton').onclick = fun
     history.back();
 };
 
-// Get the current app
+/**
+ * Get the current app.
+ */
 getapp(appname);
 
+})();
 </script>
 
 </div>

Modified: tuscany/sca-cpp/trunk/hosting/server/htdocs/graph/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/graph/index.html?rev=1361914&r1=1361913&r2=1361914&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/hosting/server/htdocs/graph/index.html (original)
+++ tuscany/sca-cpp/trunk/hosting/server/htdocs/graph/index.html Mon Jul 16 06:47:37 2012
@@ -25,8 +25,11 @@
 </div>
 
 <script type="text/javascript">
+(function() {
 
-// Get the app name
+/**
+ * Get the current app name.
+ */
 var appname = ui.fragmentParams(location)['app'];
 var ispalette = false;
 if (isNil(appname)) {
@@ -37,10 +40,14 @@ if (isNil(appname)) {
         ispalette = true;
 }
 
-// Set page title
-document.title = ui.windowtitle(location.hostname) + ' - ' + config.logic + ' - ' + appname;
+/**
+ * Set page title.
+ */
+document.title = config.windowtitle() + ' - ' + config.logic() + ' - ' + appname;
 
-// Set header div
+/**
+ * Set header div.
+ */
 $('viewhead').innerHTML = '<span id="appTitle" class="cmenu">' + appname + '</span>' +
 '<input type="button" id="deleteCompButton" title="Delete a component" class="graybutton redbutton plusminus" style="position: absolute; top: 4px; left: 5px;" disabled="true" value="-"/>' +
 '<span style="position: absolute; top: 0px; left: 45px; right: 115px; padding: 0px; background: transparent;"><input id="compValue" type="text" value="" class="flatentry" title="Component value" autocapitalize="off" placeholder="Value" style="position: absolute; left: 0px; top: 4px; width: 100%; visibility: hidden;" readonly="readonly"/></span>' +
@@ -66,13 +73,12 @@ var cdelete = $('deleteCompButton');
 var ccopy = $('copyCompButton');
 var cplay = $('playCompButton');
 
-// Init componnent references
-var editWidget = sca.component("EditWidget");
-var palettes = sca.reference(editWidget, "palettes");
-var composites = sca.reference(editWidget, ispalette? "palettes" : "composites");
-
-// Setup remote log
-//rconsole = sca.defun(sca.reference(editWidget, "log"), "log");
+/**
+ * Init componnent references.
+ */
+var editorComp = sca.component("Editor");
+var palettes = sca.reference(editorComp, "palettes");
+var composites = sca.reference(editorComp, ispalette? "palettes" : "composites");
 
 /**
  * Composite rendering functions.
@@ -1843,7 +1849,7 @@ function getapp(name, g) {
         author = elementValue(namedElementChild("'author", composentry));
         editable = author == username;
         cadd.disabled = !editable;
-        showStatus(editable? defaultStatus() : 'Read only');
+        showStatus(editable? onlineStatus() : 'Read only');
         return true;
     });
 }
@@ -2058,10 +2064,14 @@ cplay.onclick = function() {
     return showdata(gcomp);
 }
 
-// Create editor graph area
+/**
+ * Create editor graph area.
+ */
 graph.mkedit(graphdiv, graph.mkpath().move(-2500,0), atitle, cvalue, cadd, ccopy, cdelete, oncomposchange, oncompselect);
 
-// Install the palettes
+/**
+ * Install the palettes.
+ */
 var bg = graph.mkgroup(graph.mkpath());
 var pos = graph.mkpath().move(0, 0);
 bpalette = installpalette('control', pos.rmove(5,2), graphdiv, bg, spalette, gpalettes);
@@ -2079,9 +2089,12 @@ installpalette('logic', pos.rmove(0, 28)
 installpalette('math', pos.rmove(0, 28), graphdiv, bg, spalette, gpalettes);
 installpalette('python', pos.rmove(0, 28), graphdiv, bg, spalette, gpalettes);
 
-// Get and display the current app
+/**
+ * Get and display the current app.
+ */
 getapp(appname, graphdiv);
 
+})();
 </script>
 
 </div>

Modified: tuscany/sca-cpp/trunk/hosting/server/htdocs/home/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/home/index.html?rev=1361914&r1=1361913&r2=1361914&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/hosting/server/htdocs/home/index.html (original)
+++ tuscany/sca-cpp/trunk/hosting/server/htdocs/home/index.html Mon Jul 16 06:47:37 2012
@@ -37,17 +37,22 @@
 </div>
 
 <script type="text/javascript">
+(function() {
 
-// Set page titles
-document.title = ui.windowtitle(location.hostname);
-$('viewhead').innerHTML = '<span class="bcmenu">' + config.pagetitle + '</span>';
-$('hometitle').innerHTML = config.hometitle;
+/**
+ * Set page titles.
+ */
+document.title = config.windowtitle();
+$('viewhead').innerHTML = '<span class="bcmenu">' + config.pagetitle() + '</span>';
+$('hometitle').innerHTML = config.hometitle();
 
 $('getstarted').onclick = function() {
     return ui.navigate('/#view=store', '_view');
 };
 
-// Display animation
+/**
+ * Display animation.
+ */
 var anim = $('homeanimation');
 if (!isNil(anim)) {
     anim.style.background = 'url(\'' + ui.b64img(appcache.get('/home/home.b64')) + '\')';
@@ -60,8 +65,12 @@ if (!isNil(anim)) {
     }, 2000);
 }
 
-showStatus(defaultStatus());
+/**
+ * Show the status.
+ */
+showOnlineStatus();
 
+})();
 </script>
 
 </div>

Modified: tuscany/sca-cpp/trunk/hosting/server/htdocs/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/index.html?rev=1361914&r1=1361913&r2=1361914&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/hosting/server/htdocs/index.html (original)
+++ tuscany/sca-cpp/trunk/hosting/server/htdocs/index.html Mon Jul 16 06:47:37 2012
@@ -26,6 +26,7 @@
 <link rel="apple-touch-icon" href="/public/touchicon.png"/>
 <base href="/"/>
 <script type="text/javascript">
+(function() {
 
 window.appcache = {};
 
@@ -44,59 +45,77 @@ appcache.get = function(uri) {
         return item;
 
     // Get resource from network
+    //if (window.debug) debug('appcache.get', u);
     var http = new XMLHttpRequest();
     http.open("GET", u, false);
     http.setRequestHeader("Accept", "*/*");
     http.send(null);
     if (http.status == 200) {
         if (http.getResponseHeader("X-Login") != null) {
-            if (debug) debug('http error', u, 'X-Login');
+            if (window.debug) debug('http error', u, 'X-Login');
             // Redirect to login page if not signed in
             document.location = '/login/';
             return null;
         } else if (http.responseText == '' || http.getResponseHeader("Content-Type") == null) {
-            if (debug) debug('http error', u, 'No-Content');
+            if (window.debug) debug('http error', u, 'No-Content');
             return null;
         }
         try { ls.setItem(u, http.responseText); } catch(e) {}
         return http.responseText;
     }
-    if (debug) debug('http error', u, http.status, http.statusText);
+    if (window.debug) debug('http error', u, http.status, http.statusText);
     // Redirect to login page if not signed in
     if (http.status == 403)
         document.location = '/login/';
     return null;
 };
 
-// Load Javascript and CSS
+appcache.remove = function(uri) {
+    var h = uri.indexOf('#');
+    var u = h == -1? uri : uri.substring(0, h);
+    var ls = window.lstorage || localStorage;
+    try { ls.removeItem(u); } catch(e) {}
+    return true;
+};
+
+})();
+
+/**
+ * Load Javascript and CSS.
+ */
 (function() {
-    var bootjs = document.createElement('script');
-    bootjs.type = 'text/javascript';
-    bootjs.text = appcache.get('/all-min.js');
-    document.head.appendChild(bootjs);
-    document.head.appendChild(ui.declareCSS(appcache.get('/ui-min.css')));
 
-    // Disable cache for testing
-    lstorage.enabled = false;
+var bootjs = document.createElement('script');
+bootjs.type = 'text/javascript';
+bootjs.text = appcache.get('/all-min.js');
+document.head.appendChild(bootjs);
+document.head.appendChild(ui.declareCSS(appcache.get('/ui-min.css')));
+
+// Disable cache for testing
+//lstorage.enabled = false;
 
 })();
 
-</script>
-<script type="text/javascript">
+/**
+ * Redirect to login page if not signed in.
+ */
+(function() {
 
-// Redirect to login page if not signed in
 if (document.location.protocol == 'https:' && !hasauthcookie())
     document.location = '/login/';
 
+})();
 </script>
 </head>
-<body class="delayed" onload="onload();">
+<body class="delayed">
 <div id="mainbodydiv" class="mainbody">
 
 <div id="headdiv" class="hsection">
 <script type="text/javascript">
 (function() {
+
 $('headdiv').appendChild(ui.declareScript(appcache.get('/config-min.js')));
+
 })();
 </script>
 </div>
@@ -109,28 +128,45 @@ $('headdiv').appendChild(ui.declareScrip
 
 <div id="viewcontainer"></div>
 
+<div id="viewfootbackground" class="viewfootbackground fixed"></div>
+<div id="viewfoot" class="viewfoot fixed"></div>
+<div id="status" class="status fixed" style="visibility: hidden;"></div>
+
 <script type="text/javascript">
+(function() {
 
-// Init service references
-var editWidget = sca.component("EditWidget");
-var user= sca.defun(sca.reference(editWidget, "user"));
-var accounts = sca.reference(editWidget, "accounts");
+/**
+ * Init service references.
+ */
+var editorComp = sca.component("Editor");
+var user= sca.defun(sca.reference(editorComp, "user"));
+var accounts = sca.reference(editorComp, "accounts");
 
-// Set page title
-document.title = ui.windowtitle(location.hostname);
+/**
+ * Set page title.
+ */
+document.title = config.windowtitle();
 
-// Init div variables
+/**
+ * Init div variables.
+ */
 var bdiv = $('mainbodydiv');
 var mdiv = $('menu'); 
 var hdiv = $('viewhead'); 
 var vcontainer = $('viewcontainer');
 vcontainer.className = ui.isMobile()? 'viewcontainer3dm' : 'viewcontainer3d';
+var fdiv = $('viewfoot'); 
 
 /**
  * The current user name and account entry.
  */
-var username;
-var accountentry;
+window.username = 'anonymous';
+
+/**
+ * The current store category.
+ */
+var storecat = 'top';
+var storeidx = 0;
 
 /**
  * Pre-fetch app resources.
@@ -138,26 +174,66 @@ var accountentry;
 var appresources = [
     ['/all-min.js'],
     ['/ui-min.css'],
-    ['/account/', '9'],
-    ['/clone/', '3'],
-    ['/create/', '2'],
-    ['/delete/', '3'],
-    ['/graph/', '5'],
+    ['/account/', 9],
+    ['/clone/', 3],
+    ['/create/', 2],
+    ['/delete/', 3],
+    ['/graph/', 5],
     ['/config-min.js'],
-    ['/home/', '0'],
+    ['/home/', 0],
     ['/home/home.b64'],
-    ['/page/', '4'],
+    ['/page/', 4],
     ['/public/app.b64'],
     ['/public/config-min.js'],
     ['/public/grid72.b64'],
     ['/public/iframe-min.html'],
     ['/public/img.b64'],
     ['/public/user.b64'],
-    ['/stats/', '2'],
-    ['/store/', '1']
+    ['/stats/', 2],
+    ['/store/', 1]
 ];
 
 /**
+ * Show a status message.
+ */
+window.showStatus = function(s, c) {
+    //debug('status', s);
+    var sdiv = $('status');
+    if (isNil(sdiv))
+        return s;
+    sdiv.innerHTML = '<span class="' + (c? c : 'okstatus') + '">' + s + '</span>';
+    sdiv.className = 'status fixed';
+    sdiv.style.visibility = 'visible';
+    
+    function divtransitionend(e) {
+        e.target.style.visibility = 'hidden';
+        e.target.className = 'status fixed';
+    }
+    if (!sdiv.addedTransitionEnd) {
+        sdiv.addEventListener('webkitTransitionEnd', divtransitionend, false);
+        sdiv.addEventListener('transitionend', divtransitionend, false);
+        sdiv.addedTransitionEnd = true;
+    }
+    sdiv.className = 'statusout3 fixed';
+    return s;
+}
+
+/**
+ * Show an error message.
+ */
+window.showError = function(s) {
+    //debug('error', s);
+    return showStatus(s, 'errorstatus');
+}
+
+/**
+ * Show the online/offline status.
+ */
+window.showOnlineStatus = function() {
+    return navigator.onLine? showStatus('Online') : showError('Offline');
+}
+
+/**
  * Handle application cache events.
  */
 applicationCache.addEventListener('checking', function(e) {
@@ -166,11 +242,11 @@ applicationCache.addEventListener('check
 }, false);
 applicationCache.addEventListener('error', function(e) {
     //debug('appcache error', e);
-    showStatus(defaultStatus());
+    showOnlineStatus();
 }, false);
 applicationCache.addEventListener('noupdate', function(e) {
     //debug('appcache noupdate', e);
-    showStatus(defaultStatus());
+    showOnlineStatus();
 }, false);
 applicationCache.addEventListener('downloading', function(e) {
     //debug('appcache downloading', e);
@@ -185,16 +261,27 @@ applicationCache.addEventListener('updat
     try {
         applicationCache.swapCache();
     } catch(e) {}
-    showStatus(defaultStatus());
+    showOnlineStatus();
     //debug('appcache swapped', e);
+
+    // Update offline resources in local storage and reload the page
+    map(function(res) {
+        showStatus('Updating');
+        appcache.remove(res[0]);
+        appcache.get(res[0]);
+    }, append(appresources, config.appresources()));
+    window.location.reload();
 }, false);
 applicationCache.addEventListener('cached', function(e) {
     //debug('appcache cached', e);
+    showOnlineStatus();
+
+    // Install offline resources in local storage
     map(function(res) {
-        showStatus('Updating');
+        showStatus('Installing');
+        appcache.remove(res[0]);
         appcache.get(res[0]);
-    }, appresources);
-    showStatus(defaultStatus());
+    }, append(appresources, config.appresources()));
 }, false);
 
 /**
@@ -214,11 +301,9 @@ window.addEventListener('online', functi
 /**
  * Handle view transitions.
  */
-
-// Keep track of the current view url and uri
 var viewurl = '';
 var viewuri = '';
-var viewidx = '';
+var viewidx = 0;
 var viewdiv;
 
 /**
@@ -228,7 +313,7 @@ var apptransitions = {};
 map(function(res) {
     if (res.length > 1)
         apptransitions[res[0]] = res[1];
-}, appresources);
+}, append(appresources, config.appresources()));
 
 /**
  * Return the transition that should be applied to a resource.
@@ -266,7 +351,9 @@ function mkviewdiv(cname) {
  * Return the last visited location.
  */
 function lastvisited() {
-    return lstorage.getItem('ui.lastvisited');
+    if (username != lstorage.getItem('ui.lastvisit.user'))
+        return null;
+    return lstorage.getItem('ui.lastvisit.url');
 }
 
 /**
@@ -274,49 +361,22 @@ function lastvisited() {
  */
 function showmenu(mdiv, view, appname) {
     mdiv.innerHTML = ui.menubar(
-        append(mklist(ui.menu('Home', '/', '_view', view == 'home'), ui.menu('Store', '/#view=store', '_view', view === 'store')),
+        append(mklist(ui.menu('menuhome', 'Home', '/', '_view', view == 'home'),
+                    ui.menu('menustore', 'Store', '/#view=store&category=' + storecat + '&idx=' + storeidx, '_view', view === 'store')),
                 (isNil(appname) || appname == 'undefined')?
                     mklist() :
                     mklist(
-                        ui.menu('Stats', '/#view=stats&app=' + appname, '_view', view == 'stats'),
-                        ui.menu('Page', '/#view=page&app=' + appname, '_view', view == 'page'),
-                        ui.menu(config.logic, '/#view=graph&app=' + appname, '_view', view == 'graph'),
-                        ui.menu('<span class="greentext" style="font-weight: bold">Run!</span>', '/' + appname + '/', '_blank', false))),
+                        ui.menu('menustats', 'Stats', '/#view=stats&app=' + appname, '_view', view == 'stats'),
+                        ui.menu('menupage', 'Page', '/#view=page&app=' + appname, '_view', view == 'page'),
+                        ui.menu('menulogic', config.logic(), '/#view=graph&app=' + appname, '_view', view == 'graph'),
+                        ui.menu('menurun', '<span class="greentext" style="font-weight: bold">Run!</span>', '/' + appname + '/', '_blank', false))),
         (isNil(appname) || appname == 'undefined')? mklist(
-            hasauthcookie()? ui.menufunc('Sign out', 'logout();', false) : ui.menu('Sign in', '/login/', '_self', false),
-            ui.menu('Account', '/#view=account', '_view', view == 'account')) :
+            hasauthcookie()? ui.menufunc('menusignout', 'Sign out', 'return logout();', false) : ui.menu('menusignin', 'Sign in', '/login/', '_self', false),
+            ui.menu('menuaccount', 'Account', '/#view=account', '_view', view == 'account')) :
             mklist());
-}
 
-/**
- * Show a status message.
- */
-function showStatus(s) {
-    var sdiv = $('status');
-    if (isNil(sdiv))
-        return s;
-    sdiv.style.color = '#808080'
-    sdiv.innerHTML = s;
-    return s;
-}
-
-/**
- * Show an error message.
- */
-function showError(s) {
-    var sdiv = $('status');
-    if (isNil(sdiv))
-        return s;
-    sdiv.style.color = '#dd4b39'
-    sdiv.innerHTML = s;
-    return s;
-}
-
-/**
- * Return the default status message.
- */
-function defaultStatus() {
-    return navigator.onLine? 'Online' : 'Offline';
+    if (fdiv.innerHTML == '') 
+        fdiv.innerHTML = config.viewfoot();
 }
 
 /**
@@ -326,12 +386,10 @@ function getaccount() {
     var doc = accounts.get();
 
     // Stop now if we didn't get an account
-    if (doc == null) {
-        username = 'anonymous';
+    if (doc == null)
         return false;
-    }
 
-    accountentry = car(elementsToValues(atom.readATOMEntry(mklist(doc))));
+    var accountentry = car(elementsToValues(atom.readATOMEntry(mklist(doc))));
     username = cadr(assoc("'id", cdr(accountentry)));
     return true;
 }
@@ -343,13 +401,20 @@ function showview(url) {
     //debug('showview', url);
 
     // Save last visited location
-    lstorage.setItem('ui.lastvisited', url);
+    lstorage.setItem('ui.lastvisit.user', username);
+    lstorage.setItem('ui.lastvisit.url', url);
 
     // Determine the view to show
     var params = ui.fragmentParams(url);
     var view = isNil(params['view'])? 'home' : params['view'];;
     var uri = '/' + view + '/';
-    var idx = isNil(params['idx'])? '1' : params['idx'];
+    var idx = isNil(params['idx'])? 0 : parseInt(params['idx']);
+
+    // Track store category view
+    if (view == 'store') {
+        storecat = isNil(params['category'])? 'top' : params['category'];
+        storeidx = idx;
+    }
 
     // Determine the transition to use
     var vtransition = uri == viewuri? (idx >= viewidx? 'left' : 'right') : viewtransition(viewuri, uri);
@@ -424,7 +489,7 @@ function showview(url) {
 
     // Track the current visible view
     viewdiv = vdiv;
-
+    
     return true;
 }
 
@@ -455,6 +520,7 @@ function updatelocation(url) {
 window.onnavigate = function(url) {
     //debug('onnavigate', url);
 
+    // Update the browser window location
     updatelocation(url);
 
     // Show the specified view
@@ -473,13 +539,13 @@ window.onloginredirect = function(e) {
 /**
  * Log the current user out.
  */
-function logout() {
+window.logout = function() {
     // Clear session cookie and user-specific local storage entries
     clearauthcookie();
-    lstorage.removeItem('/r/EditWidget/accounts');
-    lstorage.removeItem('/r/EditWidget/dashboards');
+    lstorage.removeItem('/r/Editor/accounts');
+    lstorage.removeItem('/r/Editor/dashboards');
     document.location = '/login/';
-    return true;
+    return false;
 }
 
 /**
@@ -523,7 +589,7 @@ document.body.onorientationchange = func
 };
 
 /**
- * Document load post processing.
+ * Initialize the document.
  */
 function onload() {
     //debug('onload', history.length);
@@ -542,8 +608,10 @@ function onload() {
     }
 
     // Show the last visited view
-    if (ui.isMobile() && (document.referrer == null || document.referrer == '')) {
-        //debug('show lastvisited');
+    if (ui.isMobile() && (document.referrer == null || document.referrer == '' ||
+        document.referrer.indexOf('//' + location.hostname + '/login/') != -1 ||
+        document.referrer.indexOf('//accounts.google.com/ServiceLogin') != -1 ||
+        document.referrer.indexOf('//www.facebook.com/login.php') != -1)) {
         var lv = lastvisited();
         var url = isNil(lv)? location.pathname : lv;
         updatelocation(url);
@@ -559,6 +627,9 @@ function onload() {
     return showview(url);
 }
 
+onload();
+
+})();
 </script>
 
 <div id="footdiv" class="fsection">

Modified: tuscany/sca-cpp/trunk/hosting/server/htdocs/login/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/login/index.html?rev=1361914&r1=1361913&r2=1361914&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/hosting/server/htdocs/login/index.html (original)
+++ tuscany/sca-cpp/trunk/hosting/server/htdocs/login/index.html Mon Jul 16 06:47:37 2012
@@ -25,6 +25,7 @@
 <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
 <base href="/login/"/>
 <script type="text/javascript">
+(function() {
 
 window.appcache = {};
 
@@ -49,37 +50,45 @@ appcache.get = function(uri) {
     http.send(null);
     if (http.status == 200) {
         if (http.getResponseHeader("X-Login") != null) {
-            if (debug) debug('http error', u, 'X-Login');
+            if (window.debug) debug('http error', u, 'X-Login');
             return null;
         } else if (http.responseText == '' || http.getResponseHeader("Content-Type") == null) {
-            if (debug) debug('http error', u, 'No-Content');
+            if (window.debug) debug('http error', u, 'No-Content');
             return null;
         }
         try { ls.setItem(u, http.responseText); } catch(e) {}
         return http.responseText;
     }
-    if (debug) debug('http error', u, http.status, http.statusText);
+    if (window.debug) debug('http error', u, http.status, http.statusText);
     return null;
 };
 
-// Load Javascript and CSS
+})();
+
+/**
+ * Load Javascript and CSS.
+ */
 (function() {
-    var bootjs = document.createElement('script');
-    bootjs.type = 'text/javascript';
-    bootjs.text = appcache.get('/all-min.js');
-    document.head.appendChild(bootjs);
-    document.head.appendChild(ui.declareCSS(appcache.get('/ui-min.css')));
+
+var bootjs = document.createElement('script');
+bootjs.type = 'text/javascript';
+bootjs.text = appcache.get('/all-min.js');
+document.head.appendChild(bootjs);
+document.head.appendChild(ui.declareCSS(appcache.get('/ui-min.css')));
+
 })();
 
 </script>
 </head>
-<body class="delayed" onload="onload();">
+<body class="delayed"">
 <div id="mainbodydiv" class="bodydiv">
 
 <div id="headdiv" class="hsection">
 <script type="text/javascript">
 (function() {
+
 $('headdiv').appendChild(ui.declareScript(appcache.get('/public/config-min.js')));
+
 })();
 </script>
 </div>
@@ -96,22 +105,31 @@ $('headdiv').appendChild(ui.declareScrip
 <div id="view">
 <div id="viewcontent" class="viewcontent" style="margin-left: auto; margin-right: auto; text-align: center;">
 
-<form name="facebookOAuth2Form" style="width: 100%;">
-<p style="font-size: 16px;">Sign in with your <span style="font-weight: bold;">Facebook</span> account</p>
-<p><input type="button" value="Sign in" class="graybutton bluebutton" style="font-size: 16px; line-height: 16px; padding: 6px; height: 32px" onclick="submitOAuth2Signin(withFacebook)"/></p>
+<br/>
+<form id="formSignin" name="formSignin" method="POST" action="/login/dologin" style="width: 100%;">
+<table style="width: 100%;">
+<tr><td><span id="loginprompt" style="font-size: 16px;"></span></tr></td>
+<tr><td><input type="text" class="flatentry" name="httpd_username" value="" placeholder="User id"/></td></tr>
+<tr><td><input type="password" class="flatentry" name="httpd_password" value="" placeholder="Password"/></td></tr>
+<tr><td><input type="submit" class="graybutton bluebutton" style="font-size: 16px; line-height: 16px; padding: 6px; height: 32px" value="Sign in"/></td></tr>
+</table>
+<input type="hidden" name="httpd_location" value="/"/>
 </form>
+<br/>
 
-<form name="googleOAuth2Form" style="width: 100%;">
-<p style="font-size: 16px;">Sign in with your <span style="font-weight: bold;" >Google</span> account</p>
-<p><input type="button" value="Sign in" class="graybutton bluebutton" style="font-size: 16px; line-height: 16px; padding: 6px; height: 32px" onclick="submitOAuth2Signin(withGoogleOAuth)"/></p>
+<form name="facebookOAuth2Form" style="width: 100%;">
+<table style="width: 100%;">
+<tr><td><span style="font-size: 16px;">Sign in with your <span style="font-weight: bold;">Facebook</span> account</span></td></tr>
+<tr><td><input type="button" id="facebookOAuth2Signin" value="Sign in" class="graybutton bluebutton" style="font-size: 16px; line-height: 16px; padding: 6px; height: 32px"/></td></tr>
+</table>
 </form>
+<br/>
 
-<form name="formSignin" method="POST" action="/login/dologin" onsubmit="submitFormSignin()" style="width: 100%;">
-<p id="loginprompt" style="font-size: 16px;"></p>
-<p><input type="text" class="flatentry" name="httpd_username" value="" placeholder="User id"/></p>
-<p><input type="password" class="flatentry" name="httpd_password" value="" placeholder="Password"/></p>
-<p><input type="submit" class="graybutton bluebutton" style="font-size: 16px; line-height: 16px; padding: 6px; height: 32px" value="Sign in"/></p>
-<input type="hidden" name="httpd_location" value="/"/>
+<form name="googleOAuth2Form" style="width: 100%;">
+<table style="width: 100%;">
+<tr><td><span style="font-size: 16px;">Sign in with your <span style="font-weight: bold;" >Google</span> account</span></td></tr>
+<tr><td><input type="button" id="googleOAuth2Signin" value="Sign in" class="graybutton bluebutton" style="font-size: 16px; line-height: 16px; padding: 6px; height: 32px"/></td></tr>
+</table>
 </form>
 <br/>
 
@@ -129,31 +147,75 @@ $('headdiv').appendChild(ui.declareScrip
 </div>
 </div>
 
+<div id="viewfootbackground" class="viewfootbackground fixed"></div>
+<div id="viewfoot" class="viewfoot fixed"></div>
+<div id="status" class="status fixed" style="visibility: hidden;"></div>
+
 <script type="text/javascript">
+(function() {
 
-// Init div variables
+/**
+ * Init div variables.
+ */
 var mbdiv = $('menubackground'); 
 var mdiv = $('menu'); 
 var hdiv = $('viewhead'); 
 var hbdiv = $('viewheadbackground'); 
 $('viewcontainer').className = ui.isMobile()? 'viewcontainer3d' : 'viewcontainer3dm';
 $('view').className = ui.isMobile()? 'viewloaded3d' : 'viewloaded3dm';
-$('loginprompt').innerHTML = config.loginprompt;
+$('loginprompt').innerHTML = config.loginprompt();
+var fdiv = $('viewfoot'); 
 
-// Set page titles
-document.title = ui.windowtitle(location.hostname) + ' - Sign in';
-$('viewhead').innerHTML = '<span class="bcmenu">' + config.pagetitle + '</span>';
+/**
+ * Set page titles.
+ */
+document.title = config.windowtitle() + ' - Sign in';
+$('viewhead').innerHTML = '<span class="bcmenu">' + config.pagetitle() + '</span>';
 
 /**
  * Build and show the menu bar.
  */
 function showmenu(mdiv) {
-    mdiv.innerHTML = ui.menubar(mklist(ui.menu('Home', '/', '_self', false)), mklist(ui.menu('Sign in', '/login/', '_self', true)));
+    mdiv.innerHTML = ui.menubar(mklist(ui.menu('menuhome', 'Home', '/', '_self', false)), mklist());
+    fdiv.innerHTML = config.viewfoot();
 }
 
 showmenu(mdiv);
 
 /**
+ * Show a status message.
+ */
+window.showStatus = function(s, c) {
+    //debug('status', s);
+    var sdiv = $('status');
+    if (isNil(sdiv))
+        return s;
+    sdiv.innerHTML = '<span class="' + (c? c : 'okstatus') + '">' + s + '</span>';
+    sdiv.className = 'status fixed';
+    sdiv.style.visibility = 'visible';
+    
+    function divtransitionend(e) {
+        e.target.style.visibility = 'hidden';
+        e.target.className = 'status fixed';
+    }
+    if (!sdiv.addedTransitionEnd) {
+        sdiv.addEventListener('webkitTransitionEnd', divtransitionend, false);
+        sdiv.addEventListener('transitionend', divtransitionend, false);
+        sdiv.addedTransitionEnd = true;
+    }
+    sdiv.className = 'statusout3 fixed';
+    return s;
+}
+
+/**
+ * Show an error message.
+ */
+window.showError = function(s) {
+    //debug('error', s);
+    return showStatus(s, 'errorstatus');
+}
+
+/**
  * Parse the query parameeters.
  */
 function queryParams() {
@@ -168,6 +230,18 @@ function queryParams() {
 }
 
 /**
+ * Show login status.
+ */
+function showLoginStatus() {
+    var a = queryParams()['openauth_attempt'];
+    debug('a', a);
+    if (typeof(a) != 'undefined' && a == '1')
+        showError('Incorrect email or password, please try again');
+}
+
+showLoginStatus();
+
+/**
  * Return the referrer URL.
  */
 function openauthReferrer() {
@@ -181,31 +255,13 @@ function openauthReferrer() {
 }
 
 /**
- * Signin with OpenID.
- */
-/*
-function submitOpenIDSignin(w) {
-    clearauthcookie();
-    lstorage.removeItem('/r/EditWidget/accounts');
-    lstorage.removeItem('/r/EditWidget/dashboards');
-    document.openIDSignin.openid_identifier.value = w();
-    document.openIDSignin.action = openauthReferrer();
-    document.openIDSignin.submit();
-}
-
-function withGoogleOpenID() {
-    return 'https://www.google.com/accounts/o8/id';
-}
-*/
-
-/**
  * Signin with OAuth 2.0.
  */
 function submitOAuth2Signin(w) {
     parms = w();
     clearauthcookie();
-    lstorage.removeItem('/r/EditWidget/accounts');
-    lstorage.removeItem('/r/EditWidget/dashboards');
+    lstorage.removeItem('/r/Editor/accounts');
+    lstorage.removeItem('/r/Editor/dashboards');
     document.oauth2Signin.oauth2_authorize.value = parms[0];
     document.oauth2Signin.oauth2_access_token.value = parms[1];
     document.oauth2Signin.oauth2_client_id.value = parms[2];
@@ -222,11 +278,19 @@ function withFacebook() {
     return parms;
 }
 
-function withGoogleOAuth() {
+function withGoogle() {
     var parms = ['https://accounts.google.com/o/oauth2/auth', 'https://accounts.google.com/o/oauth2/token', 'google.com', 'https://www.googleapis.com/oauth2/v1/userinfo', 'https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile', ''];
     return parms;
 }
 
+$('facebookOAuth2Signin').onclick = function() {
+    return submitOAuth2Signin(withFacebook);
+};
+
+$('googleOAuth2Signin').onclick = function() {
+    return submitOAuth2Signin(withGoogle);
+};
+
 /**
  * Signin with a userid and password.
  */
@@ -236,6 +300,8 @@ function submitFormSignin() {
     document.formSignin.submit();
 }
 
+$('formSignin').onsubmit = submitFormSignin;
+
 /**
  * Handle orientation change.
  */
@@ -250,7 +316,7 @@ document.body.onorientationchange = func
 };
 
 /**
- * Load post processing.
+ * Initialize the document.
  */
 function onload() {
     //debug('onload');
@@ -261,6 +327,9 @@ function onload() {
     return true;
 }
 
+onload();
+
+})();
 </script>
 
 </div>

Modified: tuscany/sca-cpp/trunk/hosting/server/htdocs/page/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/page/index.html?rev=1361914&r1=1361913&r2=1361914&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/hosting/server/htdocs/page/index.html (original)
+++ tuscany/sca-cpp/trunk/hosting/server/htdocs/page/index.html Mon Jul 16 06:47:37 2012
@@ -71,8 +71,11 @@
 <div id="buffer" style="visibility: hidden; width: 0px; height: 0px"></div>
 
 <script type="text/javascript">
+(function() {
 
-// Get the app name
+/**
+ * Get the current app name.
+ */
 var appname = ui.fragmentParams(location)['app'];
 
 /**
@@ -88,10 +91,14 @@ function applink(appname) {
     return link;
 }
 
-// Set page titles
-document.title = ui.windowtitle(location.hostname) + ' - Page - ' + appname;
+/**
+ * Set page titles.
+ */
+document.title = config.windowtitle() + ' - Page - ' + appname;
 
-// Set header div
+/**
+ * Set header div.
+ */
 $('viewhead').innerHTML = '<span id="appTitle" class="cmenu">' + appname + '</span>' +
 '<input type="button" id="deleteWidgetButton" title="Delete a Widget" class="graybutton redbutton plusminus" style="position: absolute; top: 4px; left: 5px;" disabled="true" value="-"/>' +
 '<span style="position: absolute; top: 0px; left: 45px; right: 115px; padding: 0px; background: transparent;"><input id="widgetValue" type="text" value="" class="flatentry" title="Widget value" autocapitalize="off" placeholder="Value" style="position: absolute; left: 0px; top: 4px; width: 100%; visibility: hidden;" readonly="readonly"/></span>' +
@@ -120,12 +127,16 @@ var wvalue = $('widgetValue');
 var atitle = $('appTitle');
 var pplay = $('playPageButton');
 
-// Set images
+/**
+ * Set images.
+ */
 $('imgimg').src = ui.b64img(appcache.get('/public/img.b64'));
 
-// Init component references
-var editWidget = sca.component('EditWidget');
-var pages = sca.reference(editWidget, 'pages');
+/**
+ * Init component references.
+ */
+var editorComp = sca.component('Editor');
+var pages = sca.reference(editorComp, 'pages');
 
 /**
  * Page editing functions.
@@ -868,7 +879,7 @@ function getpage(name, pagediv) {
         author = elementValue(namedElementChild("'author", pageentry));
         editable = author == username;
         wadd.disabled = !editable;
-        showStatus(editable? defaultStatus() : 'Read only');
+        showStatus(editable? onlineStatus() : 'Read only');
 
         return true;
     });
@@ -1054,12 +1065,17 @@ pplay.onclick = function() {
     return playpage();
 }
 
-// Initialize the page editor
+/**
+ * Initialize the page editor.
+ */
 page.mkedit(pagediv, atitle, wvalue, wadd, wcopy, wdelete, onpagechange, onselectwidget);
 
-// Get and display the current app page
+/**
+ * Get and display the current app page.
+ */
 getpage(appname, pagediv);
 
+})();
 </script>
 
 </div>

Modified: tuscany/sca-cpp/trunk/hosting/server/htdocs/proxy/public/oops/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/proxy/public/oops/index.html?rev=1361914&r1=1361913&r2=1361914&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/hosting/server/htdocs/proxy/public/oops/index.html (original)
+++ tuscany/sca-cpp/trunk/hosting/server/htdocs/proxy/public/oops/index.html Mon Jul 16 06:47:37 2012
@@ -25,6 +25,7 @@
 <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
 <base href="/proxy/public/oops/"/>
 <script type="text/javascript">
+(function() {
 
 window.appcache = {};
 
@@ -49,37 +50,45 @@ appcache.get = function(uri) {
     http.send(null);
     if (http.status == 200) {
         if (http.getResponseHeader("X-Login") != null) {
-            if (debug) debug('http error', u, 'X-Login');
+            if (window.debug) debug('http error', u, 'X-Login');
             return null;
         } else if (http.responseText == '' || http.getResponseHeader("Content-Type") == null) {
-            if (debug) debug('http error', u, 'No-Content');
+            if (window.debug) debug('http error', u, 'No-Content');
             return null;
         }
         try { ls.setItem(u, http.responseText); } catch(e) {}
         return http.responseText;
     }
-    if (debug) debug('http error', u, http.status, http.statusText);
+    if (window.debug) debug('http error', u, http.status, http.statusText);
     return null;
 };
 
-// Load Javascript and CSS
+})();
+
+/**
+ * Load Javascript and CSS.
+ */
 (function() {
-    var bootjs = document.createElement('script');
-    bootjs.type = 'text/javascript';
-    bootjs.text = appcache.get('/proxy/all-min.js');
-    document.head.appendChild(bootjs);
-    document.head.appendChild(ui.declareCSS(appcache.get('/proxy/ui-min.css')));
+
+var bootjs = document.createElement('script');
+bootjs.type = 'text/javascript';
+bootjs.text = appcache.get('/proxy/all-min.js');
+document.head.appendChild(bootjs);
+document.head.appendChild(ui.declareCSS(appcache.get('/proxy/ui-min.css')));
+
 })();
 
 </script>
 </head>
-<body class="delayed" onload="onload();">
+<body class="delayed">
 <div id="mainbodydiv" class="mainbodydiv">
 
 <div id="headdiv" class="hsection">
 <script type="text/javascript">
 (function() {
+
 $('headdiv').appendChild(ui.declareScript(appcache.get('/proxy/public/config-min.js')));
+
 })();
 </script>
 </div>
@@ -101,25 +110,35 @@ $('headdiv').appendChild(ui.declareScrip
 </div>
 </div>
 
+<div id="viewfootbackground" class="viewfootbackground fixed"></div>
+<div id="viewfoot" class="viewfoot fixed"></div>
+
 <script type="text/javascript">
+(function() {
 
-// Init div variables
+/**
+ * Init div variables.
+ */
 var mdiv = $('menu'); 
 var hdiv = $('viewhead'); 
 $('viewcontainer').className = ui.isMobile()? 'viewcontainer3d' : 'viewcontainer3dm';
 $('view').className = ui.isMobile()? 'viewloaded3d' : 'viewloaded3dm';
+var fdiv = $('viewfoot'); 
 
-// Set page title
-document.title = ui.windowtitle(location.hostname) + ' - Oops';
-$('viewhead').innerHTML = '<span class="bcmenu">' + config.pagetitle + '</span>';
+/**
+ * Set page title.
+ */
+document.title = config.windowtitle() + ' - Oops';
+$('viewhead').innerHTML = '<span class="bcmenu">' + config.pagetitle() + '</span>';
 
 /**
  * Build and show the menu bar.
  */
 function showmenu(mdiv) {
     mdiv.innerHTML = ui.menubar(
-        mklist(ui.menu('Home', '/', '_view', false)),
-            mklist(hasauthcookie()? ui.menufunc('Sign out', 'logout();', false) : ui.menu('Sign in', '/login/', '_self', false)));
+        mklist(ui.menu('menuhome', 'Home', '/', '_self', false)),
+            mklist(hasauthcookie()? ui.menufunc('menusignout', 'Sign out', 'return logout();', false) : ui.menu('menusignin', 'Sign in', '/login/', '_self', false)));
+    fdiv.innerHTML = config.viewfoot();
 }
 
 showmenu(mdiv);
@@ -127,13 +146,13 @@ showmenu(mdiv);
 /**
  * Log the current user out.
  */
-function logout() {
+window.logout = function() {
     // Clear session cookie and user-specific local storage entries
     clearauthcookie();
-    lstorage.removeItem('/r/EditWidget/accounts');
-    lstorage.removeItem('/r/EditWidget/dashboards');
+    lstorage.removeItem('/r/Editor/accounts');
+    lstorage.removeItem('/r/Editor/dashboards');
     document.location = '/login/';
-    return true;
+    return false;
 }
 
 /**
@@ -150,7 +169,7 @@ document.body.onorientationchange = func
 };
 
 /**
- * Load post processing.
+ * Initialize the document.
  */
 function onload() {
     //debug('onload');
@@ -161,6 +180,9 @@ function onload() {
     return true;
 }
 
+onload();
+
+})();
 </script>
 
 <div id="footdiv" class="fsection">

Modified: tuscany/sca-cpp/trunk/hosting/server/htdocs/public/config.js
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/public/config.js?rev=1361914&r1=1361913&r2=1361914&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/hosting/server/htdocs/public/config.js (original)
+++ tuscany/sca-cpp/trunk/hosting/server/htdocs/public/config.js Mon Jul 16 06:47:37 2012
@@ -23,7 +23,23 @@ if (isNil(config))
 /**
  * UI configuration.
  */
-config.windowtitle = 'App Builder'
-config.pagetitle = '<span style="font-weight: bold;">App Builder</span>';
-config.loginprompt = '<span>Sign in with your userid and password</span>';
+config.windowtitle = function() {
+    return 'App Builder';
+};
+
+config.pagetitle = function() {
+    return '<span style="font-weight: bold;">App Builder</span>';
+};
+
+config.loginprompt = function() {
+    return '<span>Sign in with your userid and password</span>';
+};
+
+config.viewfoot = function() {
+    return ui.menubar(mklist(ui.menu('menuabout', 'About', '/', '_view', 'note')), mklist());
+};
+
+config.appresources = function() {
+    return mklist();
+};
 

Modified: tuscany/sca-cpp/trunk/hosting/server/htdocs/public/notauth/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/public/notauth/index.html?rev=1361914&r1=1361913&r2=1361914&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/hosting/server/htdocs/public/notauth/index.html (original)
+++ tuscany/sca-cpp/trunk/hosting/server/htdocs/public/notauth/index.html Mon Jul 16 06:47:37 2012
@@ -25,6 +25,7 @@
 <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
 <base href="/public/notauth/"/>
 <script type="text/javascript">
+(function() {
 
 window.appcache = {};
 
@@ -49,37 +50,45 @@ appcache.get = function(uri) {
     http.send(null);
     if (http.status == 200) {
         if (http.getResponseHeader("X-Login") != null) {
-            if (debug) debug('http error', u, 'X-Login');
+            if (window.debug) debug('http error', u, 'X-Login');
             return null;
         } else if (http.responseText == '' || http.getResponseHeader("Content-Type") == null) {
-            if (debug) debug('http error', u, 'No-Content');
+            if (window.debug) debug('http error', u, 'No-Content');
             return null;
         }
         try { ls.setItem(u, http.responseText); } catch(e) {}
         return http.responseText;
     }
-    if (debug) debug('http error', u, http.status, http.statusText);
+    if (window.debug) debug('http error', u, http.status, http.statusText);
     return null;
 };
 
-// Load Javascript and CSS
+})();
+
+/**
+ * Load Javascript and CSS.
+ */
 (function() {
-    var bootjs = document.createElement('script');
-    bootjs.type = 'text/javascript';
-    bootjs.text = appcache.get('/all-min.js');
-    document.head.appendChild(bootjs);
-    document.head.appendChild(ui.declareCSS(appcache.get('/ui-min.css')));
+
+var bootjs = document.createElement('script');
+bootjs.type = 'text/javascript';
+bootjs.text = appcache.get('/all-min.js');
+document.head.appendChild(bootjs);
+document.head.appendChild(ui.declareCSS(appcache.get('/ui-min.css')));
+
 })();
 
 </script>
 </head>
-<body class="delayed" onload="onload();">
+<body class="delayed">
 <div id="mainbodydiv" class="mainbodydiv">
 
 <div id="headdiv" class="hsection">
 <script type="text/javascript">
 (function() {
+
 $('headdiv').appendChild(ui.declareScript(appcache.get('/public/config-min.js')));
+
 })();
 </script>
 </div>
@@ -101,26 +110,36 @@ $('headdiv').appendChild(ui.declareScrip
 </div>
 </div>
 
+<div id="viewfootbackground" class="viewfootbackground fixed"></div>
+<div id="viewfoot" class="viewfoot fixed"></div>
+
 <script type="text/javascript">
+(function() {
 
-// Init div variables
+/**
+ * Init div variables.
+ */
 var mdiv = $('menu'); 
 var hdiv = $('viewhead'); 
-$('viewhead').innerHTML = '<span class="bcmenu">' + config.pagetitle + '</span>';
+$('viewhead').innerHTML = '<span class="bcmenu">' + config.pagetitle() + '</span>';
 $('viewcontainer').className = ui.isMobile()? 'viewcontainer3d' : 'viewcontainer3dm';
 $('view').className = ui.isMobile()? 'viewloaded3d' : 'viewloaded3dm';
+var fdiv = $('viewfoot'); 
 
-// Set page title
-document.title = ui.windowtitle(location.hostname) + ' - Sorry';
-$('viewhead').innerHTML = '<span class="bcmenu">' + config.pagetitle + '</span>';
+/**
+ * Set page title.
+ */
+document.title = config.windowtitle() + ' - Sorry';
+$('viewhead').innerHTML = '<span class="bcmenu">' + config.pagetitle() + '</span>';
 
 /**
  * Build and show the menu bar.
  */
 function showmenu(mdiv) {
     mdiv.innerHTML = ui.menubar(
-        mklist(ui.menu('Home', '/', '_view', false)),
-            mklist(hasauthcookie()? ui.menufunc('Sign out', 'logout();', false) : ui.menu('Sign in', '/login/', '_self', false)));
+        mklist(ui.menu('menuhome', 'Home', '/', '_self', false)),
+            mklist(hasauthcookie()? ui.menufunc('menusignout', 'Sign out', 'return logout();', false) : ui.menu('menusignin', 'Sign in', '/login/', '_self', false)));
+    fdiv.innerHTML = config.viewfoot();
 }
 
 showmenu(mdiv);
@@ -128,13 +147,13 @@ showmenu(mdiv);
 /**
  * Log the current user out.
  */
-function logout() {
+window.logout = function() {
     // Clear session cookie and user-specific local storage entries
     clearauthcookie();
-    lstorage.removeItem('/r/EditWidget/accounts');
-    lstorage.removeItem('/r/EditWidget/dashboards');
+    lstorage.removeItem('/r/Editor/accounts');
+    lstorage.removeItem('/r/Editor/dashboards');
     document.location = '/login/';
-    return true;
+    return false;
 }
 
 /**
@@ -152,7 +171,7 @@ document.body.onorientationchange = func
 };
 
 /**
- * Load post processing.
+ * Initialize the document.
  */
 function onload() {
     //debug('onload');
@@ -163,6 +182,9 @@ function onload() {
     return true;
 }
 
+onload();
+
+})();
 </script>
 
 <div id="footdiv" class="fsection">

Modified: tuscany/sca-cpp/trunk/hosting/server/htdocs/public/notfound/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/public/notfound/index.html?rev=1361914&r1=1361913&r2=1361914&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/hosting/server/htdocs/public/notfound/index.html (original)
+++ tuscany/sca-cpp/trunk/hosting/server/htdocs/public/notfound/index.html Mon Jul 16 06:47:37 2012
@@ -25,6 +25,7 @@
 <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
 <base href="/public/notfound/"/>
 <script type="text/javascript">
+(function() {
 
 window.appcache = {};
 
@@ -49,37 +50,45 @@ appcache.get = function(uri) {
     http.send(null);
     if (http.status == 200) {
         if (http.getResponseHeader("X-Login") != null) {
-            if (debug) debug('http error', u, 'X-Login');
+            if (window.debug) debug('http error', u, 'X-Login');
             return null;
         } else if (http.responseText == '' || http.getResponseHeader("Content-Type") == null) {
-            if (debug) debug('http error', u, 'No-Content');
+            if (window.debug) debug('http error', u, 'No-Content');
             return null;
         }
         try { ls.setItem(u, http.responseText); } catch(e) {}
         return http.responseText;
     }
-    if (debug) debug('http error', u, http.status, http.statusText);
+    if (window.debug) debug('http error', u, http.status, http.statusText);
     return null;
 };
 
-// Load Javascript and CSS
+})();
+
+/**
+ * Load Javascript and CSS.
+ */
 (function() {
-    var bootjs = document.createElement('script');
-    bootjs.type = 'text/javascript';
-    bootjs.text = appcache.get('/all-min.js');
-    document.head.appendChild(bootjs);
-    document.head.appendChild(ui.declareCSS(appcache.get('/ui-min.css')));
+
+var bootjs = document.createElement('script');
+bootjs.type = 'text/javascript';
+bootjs.text = appcache.get('/all-min.js');
+document.head.appendChild(bootjs);
+document.head.appendChild(ui.declareCSS(appcache.get('/ui-min.css')));
+
 })();
 
 </script>
 </head>
-<body class="delayed" onload="onload();">
+<body class="delayed">
 <div id="mainbodydiv" class="mainbodydiv">
 
 <div id="headdiv" class="hsection">
 <script type="text/javascript">
 (function() {
+
 $('headdiv').appendChild(ui.declareScript(appcache.get('/public/config-min.js')));
+
 })();
 </script>
 </div>
@@ -102,25 +111,35 @@ $('headdiv').appendChild(ui.declareScrip
 </div>
 </div>
 
+<div id="viewfootbackground" class="viewfootbackground fixed"></div>
+<div id="viewfoot" class="viewfoot fixed"></div>
+
 <script type="text/javascript">
+(function() {
 
-// Init div variables
+/**
+ * Init div variables.
+ */
 var mdiv = $('menu'); 
 var hdiv = $('viewhead'); 
 $('viewcontainer').className = ui.isMobile()? 'viewcontainer3d' : 'viewcontainer3dm';
 $('view').className = ui.isMobile()? 'viewloaded3d' : 'viewloaded3dm';
+var fdiv = $('viewfoot'); 
 
-// Set page title
-document.title = ui.windowtitle(location.hostname) + ' - Page not found';
-$('viewhead').innerHTML = '<span class="bcmenu">' + config.pagetitle + '</span>';
+/**
+ * Set page title.
+ */
+document.title = config.windowtitle() + ' - Page not found';
+$('viewhead').innerHTML = '<span class="bcmenu">' + config.pagetitle() + '</span>';
 
 /**
  * Build and show the menu bar.
  */
 function showmenu(mdiv) {
     mdiv.innerHTML = ui.menubar(
-        mklist(ui.menu('Home', '/', '_view', false)),
-            mklist(hasauthcookie()? ui.menufunc('Sign out', 'logout();', false) : ui.menu('Sign in', '/login/', '_self', false)));
+        mklist(ui.menu('menuhome', 'Home', '/', '_self', false)),
+            mklist(hasauthcookie()? ui.menufunc('menusignout', 'Sign out', 'return logout();', false) : ui.menu('menusignin', 'Sign in', '/login/', '_self', false)));
+    fdiv.innerHTML = config.viewfoot();
 }
 
 showmenu(mdiv);
@@ -128,13 +147,13 @@ showmenu(mdiv);
 /**
  * Log the current user out.
  */
-function logout() {
+window.logout = function() {
     // Clear session cookie and user-specific local storage entries
     clearauthcookie();
-    lstorage.removeItem('/r/EditWidget/accounts');
-    lstorage.removeItem('/r/EditWidget/dashboards');
+    lstorage.removeItem('/r/Editor/accounts');
+    lstorage.removeItem('/r/Editor/dashboards');
     document.location = '/login/';
-    return true;
+    return false;
 }
 
 /**
@@ -151,7 +170,7 @@ document.body.onorientationchange = func
 };
 
 /**
- * Load post processing.
+ * Initialize the document.
  */
 function onload() {
     //debug('onload');
@@ -162,6 +181,9 @@ function onload() {
     return true;
 }
 
+onload();
+
+})();
 </script>
 
 <div id="footdiv" class="fsection">

Modified: tuscany/sca-cpp/trunk/hosting/server/htdocs/public/notyet/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/public/notyet/index.html?rev=1361914&r1=1361913&r2=1361914&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/hosting/server/htdocs/public/notyet/index.html (original)
+++ tuscany/sca-cpp/trunk/hosting/server/htdocs/public/notyet/index.html Mon Jul 16 06:47:37 2012
@@ -25,6 +25,7 @@
 <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
 <base href="/public/notyet/"/>
 <script type="text/javascript">
+(function() {
 
 window.appcache = {};
 
@@ -49,37 +50,45 @@ appcache.get = function(uri) {
     http.send(null);
     if (http.status == 200) {
         if (http.getResponseHeader("X-Login") != null) {
-            if (debug) debug('http error', u, 'X-Login');
+            if (window.debug) debug('http error', u, 'X-Login');
             return null;
         } else if (http.responseText == '' || http.getResponseHeader("Content-Type") == null) {
-            if (debug) debug('http error', u, 'No-Content');
+            if (window.debug) debug('http error', u, 'No-Content');
             return null;
         }
         try { ls.setItem(u, http.responseText); } catch(e) {}
         return http.responseText;
     }
-    if (debug) debug('http error', u, http.status, http.statusText);
+    if (window.debug) debug('http error', u, http.status, http.statusText);
     return null;
 };
 
-// Load Javascript and CSS
+})();
+
+/**
+ * Load Javascript and CSS.
+ */
 (function() {
-    var bootjs = document.createElement('script');
-    bootjs.type = 'text/javascript';
-    bootjs.text = appcache.get('/all-min.js');
-    document.head.appendChild(bootjs);
-    document.head.appendChild(ui.declareCSS(appcache.get('/ui-min.css')));
+
+var bootjs = document.createElement('script');
+bootjs.type = 'text/javascript';
+bootjs.text = appcache.get('/all-min.js');
+document.head.appendChild(bootjs);
+document.head.appendChild(ui.declareCSS(appcache.get('/ui-min.css')));
+
 })();
 
 </script>
 </head>
-<body class="delayed" onload="onload();">
+<body class="delayed">
 <div id="mainbodydiv" class="mainbodydiv">
 
 <div id="headdiv" class="hsection">
 <script type="text/javascript">
 (function() {
+
 $('headdiv').appendChild(ui.declareScript(appcache.get('/public/config-min.js')));
+
 })();
 </script>
 </div>
@@ -102,25 +111,35 @@ $('headdiv').appendChild(ui.declareScrip
 </div>
 </div>
 
+<div id="viewfootbackground" class="viewfootbackground fixed"></div>
+<div id="viewfoot" class="viewfoot fixed"></div>
+
 <script type="text/javascript">
+(function() {
 
-// Init div variables
+/**
+ * Init div variables.
+ */
 var mdiv = $('menu'); 
 var hdiv = $('viewhead'); 
 $('viewcontainer').className = ui.isMobile()? 'viewcontainer3d' : 'viewcontainer3dm';
 $('view').className = ui.isMobile()? 'viewloaded3d' : 'viewloaded3dm';
+var fdiv = $('viewfoot'); 
 
-// Set page title
-document.title = ui.windowtitle(location.hostname) + ' - Page not found';
-$('viewhead').innerHTML = '<span class="bcmenu">' + config.pagetitle + '</span>';
+/**
+ * Set page title.
+ */
+document.title = config.windowtitle() + ' - Page not found';
+$('viewhead').innerHTML = '<span class="bcmenu">' + config.pagetitle() + '</span>';
 
 /**
  * Build and show the menu bar.
  */
 function showmenu(mdiv) {
     mdiv.innerHTML = ui.menubar(
-        mklist(ui.menu('Home', '/', '_view', false)),
-            mklist(hasauthcookie()? ui.menufunc('Sign out', 'logout();', false) : ui.menu('Sign in', '/login/', '_self', false)));
+        mklist(ui.menu('menuhome', 'Home', '/', '_self', false)),
+            mklist(hasauthcookie()? ui.menufunc('menusignout', 'Sign out', 'return logout();', false) : ui.menu('menusignin', 'Sign in', '/login/', '_self', false)));
+    fdiv.innerHTML = config.viewfoot();
 }
 
 showmenu(mdiv);
@@ -128,13 +147,13 @@ showmenu(mdiv);
 /**
  * Log the current user out.
  */
-function logout() {
+window.logout = function() {
     // Clear session cookie and user-specific local storage entries
     clearauthcookie();
-    lstorage.removeItem('/r/EditWidget/accounts');
-    lstorage.removeItem('/r/EditWidget/dashboards');
+    lstorage.removeItem('/r/Editor/accounts');
+    lstorage.removeItem('/r/Editor/dashboards');
     document.location = '/login/';
-    return true;
+    return false;
 }
 
 /**
@@ -151,7 +170,7 @@ document.body.onorientationchange = func
 };
 
 /**
- * Load post processing.
+ * Initialize the document.
  */
 function onload() {
     //debug('onload');
@@ -162,6 +181,9 @@ function onload() {
     return true;
 }
 
+onload();
+
+})();
 </script>
 
 <div id="footdiv" class="fsection">

Modified: tuscany/sca-cpp/trunk/hosting/server/htdocs/public/oops/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/public/oops/index.html?rev=1361914&r1=1361913&r2=1361914&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/hosting/server/htdocs/public/oops/index.html (original)
+++ tuscany/sca-cpp/trunk/hosting/server/htdocs/public/oops/index.html Mon Jul 16 06:47:37 2012
@@ -25,6 +25,7 @@
 <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
 <base href="/public/oops/"/>
 <script type="text/javascript">
+(function() {
 
 window.appcache = {};
 
@@ -49,37 +50,45 @@ appcache.get = function(uri) {
     http.send(null);
     if (http.status == 200) {
         if (http.getResponseHeader("X-Login") != null) {
-            if (debug) debug('http error', u, 'X-Login');
+            if (window.debug) debug('http error', u, 'X-Login');
             return null;
         } else if (http.responseText == '' || http.getResponseHeader("Content-Type") == null) {
-            if (debug) debug('http error', u, 'No-Content');
+            if (window.debug) debug('http error', u, 'No-Content');
             return null;
         }
         try { ls.setItem(u, http.responseText); } catch(e) {}
         return http.responseText;
     }
-    if (debug) debug('http error', u, http.status, http.statusText);
+    if (window.debug) debug('http error', u, http.status, http.statusText);
     return null;
 };
 
-// Load Javascript and CSS
+})();
+
+/**
+ * Load Javascript and CSS.
+ */
 (function() {
-    var bootjs = document.createElement('script');
-    bootjs.type = 'text/javascript';
-    bootjs.text = appcache.get('/all-min.js');
-    document.head.appendChild(bootjs);
-    document.head.appendChild(ui.declareCSS(appcache.get('/ui-min.css')));
+
+var bootjs = document.createElement('script');
+bootjs.type = 'text/javascript';
+bootjs.text = appcache.get('/all-min.js');
+document.head.appendChild(bootjs);
+document.head.appendChild(ui.declareCSS(appcache.get('/ui-min.css')));
+
 })();
 
 </script>
 </head>
-<body class="delayed" onload="onload();">
+<body class="delayed">
 <div id="mainbodydiv" class="mainbodydiv">
 
 <div id="headdiv" class="hsection">
 <script type="text/javascript">
 (function() {
+
 $('headdiv').appendChild(ui.declareScript(appcache.get('/public/config-min.js')));
+
 })();
 </script>
 </div>
@@ -101,25 +110,35 @@ $('headdiv').appendChild(ui.declareScrip
 </div>
 </div>
 
+<div id="viewfootbackground" class="viewfootbackground fixed"></div>
+<div id="viewfoot" class="viewfoot fixed"></div>
+
 <script type="text/javascript">
+(function() {
 
-// Init div variables
+/**
+ * Init div variables.
+ */
 var mdiv = $('menu'); 
 var hdiv = $('viewhead'); 
 $('viewcontainer').className = ui.isMobile()? 'viewcontainer3d' : 'viewcontainer3dm';
 $('view').className = ui.isMobile()? 'viewloaded3d' : 'viewloaded3dm';
+var fdiv = $('viewfoot'); 
 
-// Set page title
-document.title = ui.windowtitle(location.hostname) + ' - Oops';
-$('viewhead').innerHTML = '<span class="bcmenu">' + config.pagetitle + '</span>';
+/**
+ * Set page title.
+ */
+document.title = config.windowtitle() + ' - Oops';
+$('viewhead').innerHTML = '<span class="bcmenu">' + config.pagetitle() + '</span>';
 
 /**
  * Build and show the menu bar.
  */
 function showmenu(mdiv) {
     mdiv.innerHTML = ui.menubar(
-        mklist(ui.menu('Home', '/', '_view', false)),
-            mklist(hasauthcookie()? ui.menufunc('Sign out', 'logout();', false) : ui.menu('Sign in', '/login/', '_self', false)));
+        mklist(ui.menu('menuhome', 'Home', '/', '_self', false)),
+            mklist(hasauthcookie()? ui.menufunc('menusignout', 'Sign out', 'return logout();', false) : ui.menu('menusignin', 'Sign in', '/login/', '_self', false)));
+    fdiv.innerHTML = config.viewfoot();
 }
 
 showmenu(mdiv);
@@ -127,13 +146,13 @@ showmenu(mdiv);
 /**
  * Log the current user out.
  */
-function logout() {
+window.logout = function() {
     // Clear session cookie and user-specific local storage entries
     clearauthcookie();
-    lstorage.removeItem('/r/EditWidget/accounts');
-    lstorage.removeItem('/r/EditWidget/dashboards');
+    lstorage.removeItem('/r/Editor/accounts');
+    lstorage.removeItem('/r/Editor/dashboards');
     document.location = '/login/';
-    return true;
+    return false;
 }
 
 /**
@@ -150,7 +169,7 @@ document.body.onorientationchange = func
 };
 
 /**
- * Load post processing.
+ * Initialize the document.
  */
 function onload() {
     //debug('onload');
@@ -161,6 +180,9 @@ function onload() {
     return true;
 }
 
+onload();
+
+})();
 </script>
 
 <div id="footdiv" class="fsection">

Modified: tuscany/sca-cpp/trunk/hosting/server/htdocs/stats/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/stats/index.html?rev=1361914&r1=1361913&r2=1361914&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/hosting/server/htdocs/stats/index.html (original)
+++ tuscany/sca-cpp/trunk/hosting/server/htdocs/stats/index.html Mon Jul 16 06:47:37 2012
@@ -39,22 +39,31 @@
 </div>
 
 <script type="text/javascript">
+(function() {
 
-// Get the app name
+/**
+ * Get the app name.
+ */
 var appname = ui.fragmentParams(location)['app'];
 
-// Set page titles
-document.title = ui.windowtitle(location.hostname) + ' - Stats - ' + appname;
+/**
+ * Set page titles.
+ */
+document.title = config.windowtitle() + ' - Stats - ' + appname;
 $('viewhead').innerHTML = '<span id="appname" class="cmenu">' + appname + '</span>' +
 '<input type="button" class="graybutton redbutton plusminus" style="position: absolute; top: 4px; left: 5px;" id="deleteApp" value="-" title="Delete the app" disabled="true"/>' +
-'<input type="button" class="graybutton bluebutton" style="position: absolute; top: 4px; right: 5px;" id="cloneApp" value="'+ config.clone +'" title="' + config.clone + ' this app"/>';
+'<input type="button" class="graybutton bluebutton" style="position: absolute; top: 4px; right: 5px;" id="cloneApp" value="'+ config.clone() +'" title="' + config.clone() + ' this app"/>';
 
-// Set images
+/**
+ * Set images.
+ */
 $('appimg').src = ui.b64img(appcache.get('/public/app.b64'));
 
-// Init service references
-var editWidget = sca.component("EditWidget");
-var apps = sca.reference(editWidget, "apps");
+/**
+ * Init service references.
+ */
+var editorComp = sca.component("Editor");
+var apps = sca.reference(editorComp, "apps");
 
 /**
  * The current app entry, author and saved XML content.
@@ -97,7 +106,7 @@ function getapp(name) {
             $('deleteApp').onclick = function() {
                 return ui.navigate('/#view=delete&app=' + appname, '_view');
             }
-            showStatus(defaultStatus());
+            showOnlineStatus();
         } else {
             $('appTitle').placeholder = '';
             $('appDescription').placeholder = '';
@@ -159,9 +168,12 @@ $('cloneApp').onclick = function() {
     return ui.navigate('/#view=clone&app=' + appname, '_view');
 }
 
-// Get the current app
+/**
+ * Get the current app.
+ */
 getapp(appname);
 
+})();
 </script>
 
 </div>

Modified: tuscany/sca-cpp/trunk/hosting/server/htdocs/store/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/store/index.html?rev=1361914&r1=1361913&r2=1361914&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/hosting/server/htdocs/store/index.html (original)
+++ tuscany/sca-cpp/trunk/hosting/server/htdocs/store/index.html Mon Jul 16 06:47:37 2012
@@ -22,43 +22,67 @@
 <div id="apps" class="viewcontent"></div>
 
 <script type="text/javascript">
+(function() {
 
-// Set page titles
-document.title = ui.windowtitle(location.hostname) + ' - Store';
+/**
+ * Set page titles.
+ */
+document.title = config.windowtitle() + ' - Store';
+
+/**
+ * The store categories
+ */
+var categories = [
+    //['Featured', 'featured', 1],
+    ['Top', 'top', 2],
+    ['New', 'new', 3],
+    ['Search', 'all', 4],
+    ['My Apps', 'myapps', 5]
+];
 
-// Get the store category
-var category = ui.fragmentParams(location)['category'];
-if (isNil(category))
-    category = 'top';
+/**
+ * Find a store category.
+ */
+function findcategory(name) {
+    if (isNil(name))
+        return findcategory('top');
+    var f = filter(function(c) { return cadr(c) == name }, categories);
+    if (isNil(f))
+        return findcategory('top');
+    return car(f);
+}
 
 /**
- * Build store menu bar
+ * Get the current store category.
+ */
+var catname = cadr(findcategory(ui.fragmentParams(location)['category']));
+
+/**
+ * Build the store menu bar
  */
 function catmenu() {
     function catmenuitem(name, cat, idx) {
-        var c = cat == category? 'smenu' : 'amenu';
-        return '<span>' + ui.ahref('/#view=store&category=' + cat + '&idx=' + idx, '_view', '<span class="' + c + '">' + name + '</span>') + '</span>';
+        var c = cat == catname? 'smenu' : 'amenu';
+        return '<span>' + ui.href('storecat_' + cat, '/#view=store&category=' + cat + '&idx=' + idx, '_view', '<span class="' + c + '">' + name + '</span>') + '</span>';
     }
 
     var m = '';
-    //m += catmenuitem('Featured', 'featured', '1');
-    m += catmenuitem('Top', 'top', '2');
-    m += catmenuitem('New', 'new', '3');
-    m += catmenuitem('Search', 'all', '4');
-    m += catmenuitem('My Apps', 'myapps', '5');
+    map(function(c) { m += catmenuitem(car(c), cadr(c), caddr(c)); }, categories);
     m += '<span class="rmenu"><input type="button" class="graybutton bluebutton" id="createApp" title="Create a new app" Value="Create"/></span>';
     return m;
 }
 
-// Build store menu bar
+/**
+ * Build the store menu bar.
+ */
 $('viewhead').innerHTML = catmenu();
 
 /**
- * Service references.
+ * Init service references.
  */
-var editWidget = sca.component("EditWidget");
-var store = sca.reference(editWidget, "store");
-var dashboards = sca.reference(editWidget, "dashboards");
+var editorComp = sca.component("Editor");
+var store = sca.reference(editorComp, "store");
+var dashboards = sca.reference(editorComp, "dashboards");
 
 /**
  * Edit an app.
@@ -84,8 +108,8 @@ $('createApp').onclick = function() {
 /**
  * Get and display list of apps.
  */
-function getapps(category) {
-    //debug('category', category);
+function getapps(catname) {
+    //debug('catname', catname);
     showStatus('Loading');
 
     function display(doc) {
@@ -95,7 +119,7 @@ function getapps(category) {
             showError('App not available');
             return false;
         }
-        showStatus(defaultStatus());
+        showOnlineStatus();
 
         var apps = '<div>';
         var feed = car(elementsToValues(atom.readATOMFeed(mklist(doc))));
@@ -114,10 +138,10 @@ function getapps(category) {
             var updated = cadr(assoc("'updated", entry));
 
             apps += '<div class="box">'
-            apps += '<span class="appicon">' + ui.ahref('/#view=stats&app=' + name, '_view', '<img src="' + appimg + '" width="50" height="50"></img>') + '</span>';
+            apps += '<span class="appicon">' + ui.href('appicon_' + name, '/#view=stats&app=' + name, '_view', '<img src="' + appimg + '" width="50" height="50"></img>') + '</span>';
             apps += '<span>'
-            apps += '<span class="apptitle">' + ui.ahref('/#view=stats&app=' + name, '_view', name) + '</span>';
-            if (category != 'myapps')
+            apps += '<span class="apptitle">' + ui.href('apptitle_' + name, '/#view=stats&app=' + name, '_view', name) + '</span>';
+            if (catname != 'myapps')
                 apps += '<br/><span>' + 'by&nbsp;' + author.split('@')[0] + '</span>';
             apps += '</span>';
             apps += '</div>';
@@ -130,14 +154,17 @@ function getapps(category) {
         $('apps').innerHTML = apps;
     }
 
-    if (category == 'myapps')
+    if (catname == 'myapps')
         return dashboards.get('', display);
-    return store.get(category, display);
+    return store.get(catname, display);
 }
 
-// Get and display the list of apps
-getapps(category);
+/**
+ * Get and display the list of apps.
+ */
+getapps(catname);
 
+})();
 </script>
 
 </div>