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 2013/01/03 08:41:56 UTC
svn commit: r1428193 [4/8] - in /tuscany/sca-cpp/trunk: etc/ hosting/server/
hosting/server/data/apps/me360/ hosting/server/data/apps/nearme/
hosting/server/data/apps/nearme2/ hosting/server/data/apps/new/
hosting/server/data/apps/ourphotos/ hosting/se...
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=1428193&r1=1428192&r2=1428193&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 Thu Jan 3 07:41:53 2013
@@ -19,33 +19,50 @@
-->
<html>
<head>
+<!-- Firebug inspector -->
+<!--
+<script type="text/javascript" src="https://getfirebug.com/releases/lite/1.3/firebug-lite.js"></script>
+-->
+<!-- Weinre inspector -->
+<!--
+<script src="http://www.example.com:9998/target/target-script-min.js#anonymous"></script>
+-->
<title>Oops</title>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"/>
+<!--
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
+-->
+<link rel="apple-touch-icon-precomposed" href="/proxy/public/touchicon.png"/>
<base href="/proxy/public/oops/"/>
<script type="text/javascript">
-(function() {
+try {
+
+(function oopshead() {
window.appcache = {};
/**
* Get and cache a resource.
*/
-appcache.get = function(uri) {
+appcache.get = function(uri, mode) {
var h = uri.indexOf('#');
var u = h == -1? uri : uri.substring(0, h);
// Get resource from local storage first
var ls = window.lstorage || localStorage;
- var item = null;
- try { item = ls.getItem(u); } catch(e) {}
- if (item != null && item != '')
- return item;
+ if (mode != 'remote') {
+ var item = null;
+ try { item = ls.getItem('ui.r.' + u); } catch(e) {}
+ if (item != null && item != '')
+ return item;
+ if (mode == 'local')
+ return null;
+ }
// Get resource from network
var http = new XMLHttpRequest();
- http.open("GET", u, false);
+ http.open("GET", mode == 'remote'? (u + '?t=' + new Date().getTime() + '&r=' + Math.random()) : u, false);
http.setRequestHeader("Accept", "*/*");
http.send(null);
if (http.status == 200) {
@@ -56,7 +73,7 @@ appcache.get = function(uri) {
if (window.debug) debug('http error', u, 'No-Content');
return null;
}
- try { ls.setItem(u, http.responseText); } catch(e) {}
+ try { ls.setItem('ui.r.' + u, http.responseText); } catch(e) {}
return http.responseText;
}
if (window.debug) debug('http error', u, http.status, http.statusText);
@@ -68,36 +85,32 @@ appcache.get = function(uri) {
/**
* Load Javascript and CSS.
*/
-(function() {
+(function oopsboot() {
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')));
+bootjs.text = 'try {\n' + appcache.get('/proxy/all-min.js') + '\n' + appcache.get('/proxy/public/config-min.js') + '\n} catch(e) { console.log(e.stack); throw e; }\n';
+var head = document.getElementsByTagName('head')[0];
+head.appendChild(bootjs);
+head.appendChild(ui.declareCSS(appcache.get('/proxy/ui-min.css')));
})();
+} catch(e) {
+ if (window.debug) debug(e.stack);
+ throw e;
+}
</script>
</head>
<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 id="menucontainer" class="tbarmenu">
+<div id="menu"></div>
</div>
-<div id="menubackground" class="tbarbackground fixed"></div>
-<div id="menu" class="tbarmenu fixed"></div>
-
-<div id="viewheadbackground" class="viewheadbackground fixed"></div>
-<div id="viewhead" class="viewhead fixed"></div>
+<div id="viewheadcontainer" class="viewhead">
+<div id="viewhead"></div>
+</div>
<div id="viewcontainer">
<div id="view">
@@ -110,84 +123,250 @@ $('headdiv').appendChild(ui.declareScrip
</div>
</div>
-<div id="viewfootbackground" class="viewfootbackground fixed"></div>
-<div id="viewfoot" class="viewfoot fixed"></div>
+<div id="viewfootcontainer" class="viewfoot">
+<div id="viewfoot"></div>
+<div id="status"></div>
+</div>
+
+<div id="installer" class="installer"></div>
<script type="text/javascript">
-(function() {
+try {
+
+(function oopsbody() {
/**
- * Init div variables.
+ * Setup page layout.
*/
-var mdiv = $('menu');
-var hdiv = $('viewhead');
-$('viewcontainer').className = ui.isMobile()? 'viewcontainer3d' : 'viewcontainer3dm';
-$('view').className = ui.isMobile()? 'viewloaded3d' : 'viewloaded3dm';
-var fdiv = $('viewfoot');
+(function layout() {
+ $('viewcontainer').className = ui.isMobile()? 'viewcontainer3dm' : 'viewcontainer3d';
+ $('view').className = ui.isMobile()? 'viewloaded3dm' : 'viewloaded3d';
+ document.title = config.windowtitle() + ' - Oops';
+ $('viewhead').innerHTML = '<span class="bcmenu">' + config.pagetitle() + '</span>';
+ if (!ui.isMobile())
+ $('viewcontent').className = 'viewcontent flatscrollbars';
+ $('status').className = ui.isMobile()? 'status3dm' : 'status3d';
+})();
/**
- * Set page title.
+ * Setup menu bar.
*/
-document.title = config.windowtitle() + ' - Oops';
-$('viewhead').innerHTML = '<span class="bcmenu">' + config.pagetitle() + '</span>';
+(function showmenu() {
+ $('menu').innerHTML = ui.menubar(
+ mklist(ui.menu('menuhome', 'Home', '/', '_self', false)), mklist());
+ $('viewfoot').innerHTML = config.viewfoot();
+})();
/**
- * Build and show the menu bar.
+ * Initialize status message area.
*/
-function showmenu(mdiv) {
- mdiv.innerHTML = ui.menubar(
- 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();
-}
+(function initstatus() {
+ if (isNil($('status')))
+ return;
+ $('status').style.display = 'none';
+
+ function divtransitionend(e) {
+ e.target.style.display = 'none';
+ e.target.className = ui.isMobile()? 'status3dm' : 'status3d';
+ e.target.error = false;
+ }
+ $('status').addEventListener('webkitTransitionEnd', divtransitionend, false);
+ $('status').addEventListener('transitionend', divtransitionend, false);
+})();
-showmenu(mdiv);
+/**
+ * Show a status message.
+ */
+window.showstatus = function(s, c) {
+ //debug('show status', s);
+ if (isNil($('status')) || $('status').error)
+ return s;
+ $('status').innerHTML = '<span class="' + (c? c : 'okstatus') + '">' + s + '</span>';
+ $('status').className = ui.isMobile()? 'status3dm' : 'status3d';
+ $('status').style.display = 'block';
+ $('status').error = c == 'errorstatus';
+ if ($('status').delay)
+ ui.cancelDelay($('status').delay);
+ $('status').delay = ui.delay(function hidestatus() {
+ $('status').className = ui.isMobile()? 'statusout3dm' : 'statusout3d';
+ $('status').error = false;
+ }, 3000);
+ return s;
+};
/**
- * Log the current user out.
+ * Show an error message.
*/
-window.logout = function() {
- // Clear session cookie and user-specific local storage entries
- clearauthcookie();
- lstorage.removeItem('/r/Editor/accounts');
- lstorage.removeItem('/r/Editor/dashboards');
- document.location = '/login/';
- return false;
-}
+window.errorstatus = function(s) {
+ //debug('error', s);
+ return showstatus(s, 'errorstatus');
+};
+
+/**
+ * Show working status.
+ */
+window.workingstatus = function(w, c) {
+ //debug('show working', w);
+ if (isNil($('working')))
+ return w;
+ if (!ui.isMobile())
+ $('working').style.top = ui.pixpos(Math.round(window.clientHeight / 2));
+ $('working').style.display = w? 'block' : 'none';
+ return w;
+};
+
+/**
+ * Show the online/offline status.
+ */
+window.onlinestatus = function() {
+ return navigator.onLine? (ui.isMobile()? showstatus('Online') : showstatus('Online')) : errorstatus('Offline');
+
+};
/**
* Handle orientation change.
*/
document.body.onorientationchange = function(e) {
//debug('onorientationchange');
- ui.onorientationchange(e);
-
- // Resize menu and view header
- mdiv.style.width = ui.pixpos(document.documentElement.clientWidth);
- hdiv.style.width = ui.pixpos(document.documentElement.clientWidth);
- return true;
+ return ui.onorientationchange(e);
};
/**
- * Initialize the document.
+ * Populate cache with app resources.
*/
-function onload() {
- //debug('onload');
- ui.onload();
+var appresources = [
+ ['/proxy/all-min.js'],
+ ['/proxy/ui-min.css'],
+ ['/proxy/public/config-min.js']
+];
- // Show the page
- document.body.style.visibility = 'visible';
- return true;
-}
+/**
+ * Install the application cache.
+ */
+(function installappcache() {
+ if (ui.isMobile()) {
+ // On mobile devices, trigger usage of an application cache manifest
+ window.onappcachechecking = function(e) {
+ //debug('appcache checking', e);
+ workingstatus(true);
+ showstatus('Checking');
+ };
+ window.onappcacheerror = function(e) {
+ //debug('appcache error', e);
+ onlinestatus();
+ workingstatus(false);
+ };
+ window.onappcachenoupdate = function(e) {
+ //debug('appcache noupdate', e);
+ onlinestatus();
+ workingstatus(false);
+ };
+ window.onappcachedownloading = function(e) {
+ //debug('appcache downloading', e);
+ workingstatus(true);
+ showstatus('Updating');
+ };
+ window.onappcacheprogress = function(e) {
+ //debug('appcache progress', e);
+ workingstatus(true);
+ showstatus('Updating');
+ };
+ window.onappcacheupdateready = function(e) {
+ //debug('appcache updateready', e);
+ try {
+ applicationCache.swapCache();
+ } catch(e) {}
+ onlinestatus();
+ workingstatus(false);
+ //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], 'remote');
+ }, append(appresources, config.appresources()));
+ window.location.reload();
+ };
+ window.onappcachecached = function(e) {
+ //debug('appcache cached', e);
+ onlinestatus();
+ workingstatus(false);
+
+ // Install offline resources in local storage
+ map(function(res) {
+ showstatus('Updating');
+ appcache.remove(res[0]);
+ appcache.get(res[0], 'remote');
+ }, append(appresources, config.appresources()));
+ };
+
+ window.onloadappcache = function() {
+ //debug('appcache iframe loaded');
+ };
+
+ ui.delay(function() {
+ $('installer').innerHTML = '<iframe src="/proxy/public/cache/" class="installer"></iframe>';
+ });
+
+ } else {
+ // On non-mobile devices, check for cache-manifest changes ourselves.
+ workingstatus(true);
+ showstatus('Checking');
+ var lcmf = appcache.get('/proxy/public/cache/cache-manifest.cmf', 'local');
+ var rcmf = appcache.get('/proxy/public/cache/cache-manifest.cmf', 'remote');
+ if (lcmf == rcmf) {
+ onlinestatus();
+ workingstatus(false);
+ return true;
+ }
-onload();
+ //debug('cache-manifest changed, reloading');
+ ui.delay(function() {
+ showstatus('Updating');
+ ui.delay(function() {
+ map(function(res) {
+ appcache.remove(res[0]);
+ appcache.get(res[0], 'remote');
+ }, append(appresources, config.appresources()));
+ if (!isNil(lcmf)) {
+ //debug('reloading');
+ window.location.reload();
+ }
+ onlinestatus();
+ workingstatus(false);
+ });
+ });
+ }
+})();
+
+/**
+ * Handle network offline/online events.
+ */
+window.addEventListener('offline', function(e) {
+ //debug('going offline');
+ showstatus('Offline');
+}, false);
+window.addEventListener('online', function(e) {
+ //debug('going online');
+ showstatus('Online');
+}, false);
+
+/**
+ * Initialize the document.
+ */
+window.onload = function() {
+ //debug('onload');
+ return ui.onload();
+};
})();
-</script>
-<div id="footdiv" class="fsection">
-</div>
+} catch(e) {
+ debug(e.stack);
+ throw e;
+}
+</script>
-</div>
</body>
</html>
Modified: tuscany/sca-cpp/trunk/hosting/server/htdocs/public/app.b64
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/public/app.b64?rev=1428193&r1=1428192&r2=1428193&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/hosting/server/htdocs/public/app.b64 (original)
+++ tuscany/sca-cpp/trunk/hosting/server/htdocs/public/app.b64 Thu Jan 3 07:41:53 2013
@@ -1 +1 @@
-iVBORw0KGgoAAAANSUhEUgAAADIAAAAyAgMAAABjUWAiAAAABGdBTUEAALGPC/xhBQAAAAxQTFRFyN+N+dR1/PCI////6HjE5gAAADJJREFUKM9j+I8EPjBQifeBAQSY6coLBYN6inhaq0Bg6SDn/f//akB466ExTS6P2ukMAKumzarJO/66AAAAAElFTkSuQmCC
\ No newline at end of file
+iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAfklEQVRo3u3YoQ2EQBBA0VlauEJwODQUcw1QAQ1QDGgcjkKo4U4Q0JhNCLyvVs3kZd1E6F6l49H02y/Hgqn7pIiIeogs8+fvbiie8iMgICAgICAgICAgICAgICDSlc67Vu6709pWWeaX4+KuBQICAgICAgICAgICAgICovf1B5ehDldEK+NOAAAAAElFTkSuQmCC
Modified: tuscany/sca-cpp/trunk/hosting/server/htdocs/public/app.png
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/public/app.png?rev=1428193&r1=1428192&r2=1428193&view=diff
==============================================================================
Files tuscany/sca-cpp/trunk/hosting/server/htdocs/public/app.png (original) and tuscany/sca-cpp/trunk/hosting/server/htdocs/public/app.png Thu Jan 3 07:41:53 2013 differ
Modified: tuscany/sca-cpp/trunk/hosting/server/htdocs/public/app.xcf
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/public/app.xcf?rev=1428193&r1=1428192&r2=1428193&view=diff
==============================================================================
Files tuscany/sca-cpp/trunk/hosting/server/htdocs/public/app.xcf (original) and tuscany/sca-cpp/trunk/hosting/server/htdocs/public/app.xcf Thu Jan 3 07:41:53 2013 differ
Copied: tuscany/sca-cpp/trunk/hosting/server/htdocs/public/cache/cache-template.cmf (from r1428192, tuscany/sca-cpp/trunk/hosting/server/htdocs/app/cache-template.cmf)
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/public/cache/cache-template.cmf?p2=tuscany/sca-cpp/trunk/hosting/server/htdocs/public/cache/cache-template.cmf&p1=tuscany/sca-cpp/trunk/hosting/server/htdocs/app/cache-template.cmf&r1=1428192&r2=1428193&rev=1428193&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/hosting/server/htdocs/app/cache-template.cmf (original)
+++ tuscany/sca-cpp/trunk/hosting/server/htdocs/public/cache/cache-template.cmf Thu Jan 3 07:41:53 2013
@@ -4,7 +4,7 @@ CACHE MANIFEST
# App resources
/favicon.ico
-/public/iframe-min.html
+/login/
/public/img.png
/public/notauth/
/public/notfound/
Added: tuscany/sca-cpp/trunk/hosting/server/htdocs/public/cache/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/public/cache/index.html?rev=1428193&view=auto
==============================================================================
--- tuscany/sca-cpp/trunk/hosting/server/htdocs/public/cache/index.html (added)
+++ tuscany/sca-cpp/trunk/hosting/server/htdocs/public/cache/index.html Thu Jan 3 07:41:53 2013
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<html manifest="/public/cache/cache-manifest.cmf">
+<head>
+<script type="text/javascript">
+applicationCache.addEventListener('checking', function(e) {
+ return window.parent.onappcachechecking(e);
+}, false);
+applicationCache.addEventListener('error', function(e) {
+ return window.parent.onappcacheerror(e);
+}, false);
+applicationCache.addEventListener('noupdate', function(e) {
+ return window.parent.onappcachenoupdate(e);
+}, false);
+applicationCache.addEventListener('downloading', function(e) {
+ return window.parent.onappcachedownloading(e);
+}, false);
+applicationCache.addEventListener('progress', function(e) {
+ return window.parent.onappcacheprogress(e);
+}, false);
+applicationCache.addEventListener('updateready', function(e) {
+ return window.parent.onappcacheupdateready(e);
+}, false);
+applicationCache.addEventListener('cached', function(e) {
+ return window.parent.onappcachecached(e);
+}, false);
+window.onload = function() {
+ window.parent.onloadappcache();
+};
+</script>
+</head>
+<body>
+</body>
+</html>
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=1428193&r1=1428192&r2=1428193&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/hosting/server/htdocs/public/config.js (original)
+++ tuscany/sca-cpp/trunk/hosting/server/htdocs/public/config.js Thu Jan 3 07:41:53 2013
@@ -35,6 +35,10 @@ config.loginprompt = function() {
return '<span>Sign in with your userid and password</span>';
};
+config.signuptitle = function() {
+ return 'Sign up for an account';
+};
+
config.viewfoot = function() {
return ui.menubar(mklist(ui.menu('menuabout', 'About', '/', '_view', 'note')), mklist());
};
Modified: tuscany/sca-cpp/trunk/hosting/server/htdocs/public/img.b64
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/public/img.b64?rev=1428193&r1=1428192&r2=1428193&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/hosting/server/htdocs/public/img.b64 (original)
+++ tuscany/sca-cpp/trunk/hosting/server/htdocs/public/img.b64 Thu Jan 3 07:41:53 2013
@@ -1 +1 @@
-iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAABGdBTUEAALGPC/xhBQAAAIRQTFRFwdt/w9yEw9+MxN2GxN6NxN+Oxd2Mxd6Nxt6Lx96Lx96Nx9+NyN6MyN+MyN+N8u2I8+2I+NBq+NFr+NFt+NFu+NJz+NN0+dR1+dR3+dZw+dh4+9Fy+9Nz++5++++B+++F/NNz/PCH/PCI/PGW/PKc/fKd/vzp/vzq/v7+/v/z/9Jx////nQZfHwAAAIxJREFUOMtj0CYAGKiiQANdUAPdBAZmFMCIYQUzHwrgpKECblYwYEJ2LYoCHi0FMBCEAmF0E3hkxFGABJICXnYWFhY2aVE4EENTwCWgCARKCCCFoUAJFQw9BYycnBz8eBSA04cqPhNAQIX+CiSFhIRE8CiQ10ROMNgUqKNnHGU5FCCrhqZAg7Z5Ey8AALiBh6brcmloAAAAAElFTkSuQmCC
\ No newline at end of file
+iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAX0lEQVRYw2NgGGDAyMDAwODe/vY/OZp3VgozMjAwMNhOYSBL/+EcBkamgQ6BUQeMOmDUAaMOGHXAqANGAcX1OQMDA8NFDzOy9OvvODXaHhh1wKgDRh0w6oBRB4y2BxgA0K4ON379R2QAAAAASUVORK5CYII=
Modified: tuscany/sca-cpp/trunk/hosting/server/htdocs/public/img.png
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/public/img.png?rev=1428193&r1=1428192&r2=1428193&view=diff
==============================================================================
Files tuscany/sca-cpp/trunk/hosting/server/htdocs/public/img.png (original) and tuscany/sca-cpp/trunk/hosting/server/htdocs/public/img.png Thu Jan 3 07:41:53 2013 differ
Modified: tuscany/sca-cpp/trunk/hosting/server/htdocs/public/img.xcf
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/public/img.xcf?rev=1428193&r1=1428192&r2=1428193&view=diff
==============================================================================
Files tuscany/sca-cpp/trunk/hosting/server/htdocs/public/img.xcf (original) and tuscany/sca-cpp/trunk/hosting/server/htdocs/public/img.xcf Thu Jan 3 07:41:53 2013 differ
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=1428193&r1=1428192&r2=1428193&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 Thu Jan 3 07:41:53 2013
@@ -19,33 +19,50 @@
-->
<html>
<head>
+<!-- Firebug inspector -->
+<!--
+<script type="text/javascript" src="https://getfirebug.com/releases/lite/1.3/firebug-lite.js"></script>
+-->
+<!-- Weinre inspector -->
+<!--
+<script src="http://www.example.com:9998/target/target-script-min.js#anonymous"></script>
+-->
<title>Sorry</title>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"/>
+<!--
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
+-->
+<link rel="apple-touch-icon-precomposed" href="/public/touchicon.png"/>
<base href="/public/notauth/"/>
<script type="text/javascript">
-(function() {
+try {
+
+(function notauthhead() {
window.appcache = {};
/**
* Get and cache a resource.
*/
-appcache.get = function(uri) {
+appcache.get = function(uri, mode) {
var h = uri.indexOf('#');
var u = h == -1? uri : uri.substring(0, h);
// Get resource from local storage first
var ls = window.lstorage || localStorage;
- var item = null;
- try { item = ls.getItem(u); } catch(e) {}
- if (item != null && item != '')
- return item;
+ if (mode != 'remote') {
+ var item = null;
+ try { item = ls.getItem('ui.r.' + u); } catch(e) {}
+ if (item != null && item != '')
+ return item;
+ if (mode == 'local')
+ return null;
+ }
// Get resource from network
var http = new XMLHttpRequest();
- http.open("GET", u, false);
+ http.open("GET", mode == 'remote'? (u + '?t=' + new Date().getTime() + '&r=' + Math.random()) : u, false);
http.setRequestHeader("Accept", "*/*");
http.send(null);
if (http.status == 200) {
@@ -56,7 +73,7 @@ appcache.get = function(uri) {
if (window.debug) debug('http error', u, 'No-Content');
return null;
}
- try { ls.setItem(u, http.responseText); } catch(e) {}
+ try { ls.setItem('ui.r.' + u, http.responseText); } catch(e) {}
return http.responseText;
}
if (window.debug) debug('http error', u, http.status, http.statusText);
@@ -68,128 +85,287 @@ appcache.get = function(uri) {
/**
* Load Javascript and CSS.
*/
-(function() {
+(function notauthboot() {
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')));
+bootjs.text = 'try {\n' + appcache.get('/all-min.js') + '\n' + appcache.get('/public/config-min.js') + '\n} catch(e) { console.log(e.stack); throw e; }\n';
+var head = document.getElementsByTagName('head')[0];
+head.appendChild(bootjs);
+head.appendChild(ui.declareCSS(appcache.get('/ui-min.css')));
})();
+} catch(e) {
+ if (window.debug) debug(e.stack);
+ throw e;
+}
</script>
</head>
<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 id="menucontainer" class="tbarmenu">
+<div id="menu"></div>
</div>
-<div id="menubackground" class="tbarbackground fixed"></div>
-<div id="menu" class="tbarmenu fixed"></div>
-
-<div id="viewheadbackground" class="viewheadbackground fixed"></div>
-<div id="viewhead" class="viewhead fixed"></div>
+<div id="viewheadcontainer" class="viewhead">
+<div id="viewhead"></div>
+</div>
<div id="viewcontainer">
<div id="view">
<div id="viewcontent" class="viewcontent" style="margin-left: auto; margin-right: auto; text-align: center;">
<br/>
-<div class="hd2">Sorry, you're not authorized to view this page.</div>
+<div class="hd2">Sorry, you're not authorized<br/>to view this page.</div>
</div>
</div>
</div>
-<div id="viewfootbackground" class="viewfootbackground fixed"></div>
-<div id="viewfoot" class="viewfoot fixed"></div>
+<div id="viewfootcontainer" class="viewfoot">
+<div id="viewfoot"></div>
+<div id="status"></div>
+</div>
+
+<div id="installer" class="installer"></div>
<script type="text/javascript">
-(function() {
+try {
+
+(function notauthbody() {
/**
- * Init div variables.
+ * Setup page layout.
*/
-var mdiv = $('menu');
-var hdiv = $('viewhead');
-$('viewhead').innerHTML = '<span class="bcmenu">' + config.pagetitle() + '</span>';
-$('viewcontainer').className = ui.isMobile()? 'viewcontainer3d' : 'viewcontainer3dm';
-$('view').className = ui.isMobile()? 'viewloaded3d' : 'viewloaded3dm';
-var fdiv = $('viewfoot');
+(function layout() {
+ $('viewcontainer').className = ui.isMobile()? 'viewcontainer3dm' : 'viewcontainer3d';
+ $('view').className = ui.isMobile()? 'viewloaded3dm' : 'viewloaded3d';
+ document.title = config.windowtitle() + ' - Sorry';
+ $('viewhead').innerHTML = '<span class="bcmenu">' + config.pagetitle() + '</span>';
+ if (!ui.isMobile())
+ $('viewcontent').className = 'viewcontent flatscrollbars';
+ $('status').className = ui.isMobile()? 'status3dm' : 'status3d';
+})();
/**
- * Set page title.
+ * Setup menu bar.
*/
-document.title = config.windowtitle() + ' - Sorry';
-$('viewhead').innerHTML = '<span class="bcmenu">' + config.pagetitle() + '</span>';
+(function showmenu() {
+ $('menu').innerHTML = ui.menubar(
+ mklist(ui.menu('menuhome', 'Home', '/', '_self', false)), mklist());
+ $('viewfoot').innerHTML = config.viewfoot();
+})();
/**
- * Build and show the menu bar.
+ * Initialize status message area.
*/
-function showmenu(mdiv) {
- mdiv.innerHTML = ui.menubar(
- 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();
-}
+(function initstatus() {
+ if (isNil($('status')))
+ return;
+ $('status').style.display = 'none';
+
+ function divtransitionend(e) {
+ e.target.style.display = 'none';
+ e.target.className = ui.isMobile()? 'status3dm' : 'status3d';
+ e.target.error = false;
+ }
+ $('status').addEventListener('webkitTransitionEnd', divtransitionend, false);
+ $('status').addEventListener('transitionend', divtransitionend, false);
+})();
-showmenu(mdiv);
+/**
+ * Show a status message.
+ */
+window.showstatus = function(s, c) {
+ //debug('show status', s);
+ if (isNil($('status')) || $('status').error)
+ return s;
+ $('status').innerHTML = '<span class="' + (c? c : 'okstatus') + '">' + s + '</span>';
+ $('status').className = ui.isMobile()? 'status3dm' : 'status3d';
+ $('status').style.display = 'block';
+ $('status').error = c == 'errorstatus';
+ if ($('status').delay)
+ ui.cancelDelay($('status').delay);
+ $('status').delay = ui.delay(function hidestatus() {
+ $('status').className = ui.isMobile()? 'statusout3dm' : 'statusout3d';
+ $('status').error = false;
+ }, 3000);
+ return s;
+};
/**
- * Log the current user out.
+ * Show an error message.
*/
-window.logout = function() {
- // Clear session cookie and user-specific local storage entries
- clearauthcookie();
- lstorage.removeItem('/r/Editor/accounts');
- lstorage.removeItem('/r/Editor/dashboards');
- document.location = '/login/';
- return false;
-}
+window.errorstatus = function(s) {
+ //debug('error', s);
+ return showstatus(s, 'errorstatus');
+};
+
+/**
+ * Show working status.
+ */
+window.workingstatus = function(w, c) {
+ //debug('show working', w);
+ if (isNil($('working')))
+ return w;
+ if (!ui.isMobile())
+ $('working').style.top = ui.pixpos(Math.round(window.clientHeight / 2));
+ $('working').style.display = w? 'block' : 'none';
+ return w;
+};
+
+/**
+ * Show the online/offline status.
+ */
+window.onlinestatus = function() {
+ return navigator.onLine? (ui.isMobile()? showstatus('Online') : showstatus('Online')) : errorstatus('Offline');
+};
/**
* Handle orientation change.
*/
document.body.onorientationchange = function(e) {
//debug('onorientationchange');
- ui.onorientationchange(e);
+ return ui.onorientationchange(e);
+};
- // Resize menu and view header
- mdiv.style.width = ui.pixpos(document.documentElement.clientWidth);
- hdiv.style.width = ui.pixpos(document.documentElement.clientWidth);
+/**
+ * Populate cache with app resources.
+ */
+var appresources = [
+ ['/all-min.js'],
+ ['/ui-min.css'],
+ ['/public/config-min.js']
+];
- return true;
-};
+/**
+ * Install the application cache.
+ */
+(function installappcache() {
+ if (ui.isMobile()) {
+ // On mobile devices, trigger usage of an application cache manifest
+ window.onappcachechecking = function(e) {
+ //debug('appcache checking', e);
+ workingstatus(true);
+ showstatus('Checking');
+ };
+ window.onappcacheerror = function(e) {
+ //debug('appcache error', e);
+ onlinestatus();
+ workingstatus(false);
+ };
+ window.onappcachenoupdate = function(e) {
+ //debug('appcache noupdate', e);
+ onlinestatus();
+ workingstatus(false);
+ };
+ window.onappcachedownloading = function(e) {
+ //debug('appcache downloading', e);
+ workingstatus(true);
+ showstatus('Updating');
+ };
+ window.onappcacheprogress = function(e) {
+ //debug('appcache progress', e);
+ workingstatus(true);
+ showstatus('Updating');
+ };
+ window.onappcacheupdateready = function(e) {
+ //debug('appcache updateready', e);
+ try {
+ applicationCache.swapCache();
+ } catch(e) {}
+ onlinestatus();
+ workingstatus(false);
+ //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], 'remote');
+ }, append(appresources, config.appresources()));
+ window.location.reload();
+ };
+ window.onappcachecached = function(e) {
+ //debug('appcache cached', e);
+ onlinestatus();
+ workingstatus(false);
+
+ // Install offline resources in local storage
+ map(function(res) {
+ showstatus('Updating');
+ appcache.remove(res[0]);
+ appcache.get(res[0], 'remote');
+ }, append(appresources, config.appresources()));
+ };
+
+ window.onloadappcache = function() {
+ //debug('appcache iframe loaded');
+ };
+
+ ui.delay(function() {
+ $('installer').innerHTML = '<iframe src="/public/cache/" class="installer"></iframe>';
+ });
+
+ } else {
+ // On non-mobile devices, check for cache-manifest changes ourselves.
+ workingstatus(true);
+ showstatus('Checking');
+ var lcmf = appcache.get('/public/cache/cache-manifest.cmf', 'local');
+ var rcmf = appcache.get('/public/cache/cache-manifest.cmf', 'remote');
+ if (lcmf == rcmf) {
+ onlinestatus();
+ workingstatus(false);
+ return true;
+ }
+
+ //debug('cache-manifest changed, reloading');
+ ui.delay(function() {
+ showstatus('Updating');
+ ui.delay(function() {
+ map(function(res) {
+ appcache.remove(res[0]);
+ appcache.get(res[0], 'remote');
+ }, append(appresources, config.appresources()));
+ if (!isNil(lcmf)) {
+ //debug('reloading');
+ window.location.reload();
+ }
+ onlinestatus();
+ workingstatus(false);
+ });
+ });
+ }
+})();
+
+/**
+ * Handle network offline/online events.
+ */
+window.addEventListener('offline', function(e) {
+ //debug('going offline');
+ showstatus('Offline');
+}, false);
+window.addEventListener('online', function(e) {
+ //debug('going online');
+ showstatus('Online');
+}, false);
/**
* Initialize the document.
*/
-function onload() {
+window.onload = function() {
//debug('onload');
- ui.onload();
-
- // Show the page
- document.body.style.visibility = 'visible';
- return true;
-}
-
-onload();
+ return ui.onload();
+};
})();
-</script>
-<div id="footdiv" class="fsection">
-</div>
+} catch(e) {
+ debug(e.stack);
+ throw e;
+}
+</script>
-</div>
</body>
</html>
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=1428193&r1=1428192&r2=1428193&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 Thu Jan 3 07:41:53 2013
@@ -19,33 +19,50 @@
-->
<html>
<head>
+<!-- Firebug inspector -->
+<!--
+<script type="text/javascript" src="https://getfirebug.com/releases/lite/1.3/firebug-lite.js"></script>
+-->
+<!-- Weinre inspector -->
+<!--
+<script src="http://www.example.com:9998/target/target-script-min.js#anonymous"></script>
+-->
<title>Page not found</title>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"/>
+<!--
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
+-->
+<link rel="apple-touch-icon-precomposed" href="/public/touchicon.png"/>
<base href="/public/notfound/"/>
<script type="text/javascript">
-(function() {
+try {
+
+(function notfoundhead() {
window.appcache = {};
/**
* Get and cache a resource.
*/
-appcache.get = function(uri) {
+appcache.get = function(uri, mode) {
var h = uri.indexOf('#');
var u = h == -1? uri : uri.substring(0, h);
// Get resource from local storage first
var ls = window.lstorage || localStorage;
- var item = null;
- try { item = ls.getItem(u); } catch(e) {}
- if (item != null && item != '')
- return item;
+ if (mode != 'remote') {
+ var item = null;
+ try { item = ls.getItem('ui.r.' + u); } catch(e) {}
+ if (item != null && item != '')
+ return item;
+ if (mode == 'local')
+ return null;
+ }
// Get resource from network
var http = new XMLHttpRequest();
- http.open("GET", u, false);
+ http.open("GET", mode == 'remote'? (u + '?t=' + new Date().getTime() + '&r=' + Math.random()) : u, false);
http.setRequestHeader("Accept", "*/*");
http.send(null);
if (http.status == 200) {
@@ -56,7 +73,7 @@ appcache.get = function(uri) {
if (window.debug) debug('http error', u, 'No-Content');
return null;
}
- try { ls.setItem(u, http.responseText); } catch(e) {}
+ try { ls.setItem('ui.r.' + u, http.responseText); } catch(e) {}
return http.responseText;
}
if (window.debug) debug('http error', u, http.status, http.statusText);
@@ -68,36 +85,32 @@ appcache.get = function(uri) {
/**
* Load Javascript and CSS.
*/
-(function() {
+(function notfoundboot() {
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')));
+bootjs.text = 'try {\n' + appcache.get('/all-min.js') + '\n' + appcache.get('/public/config-min.js') + '\n} catch(e) { console.log(e.stack); throw e; }\n';
+var head = document.getElementsByTagName('head')[0];
+head.appendChild(bootjs);
+head.appendChild(ui.declareCSS(appcache.get('/ui-min.css')));
})();
+} catch(e) {
+ if (window.debug) debug(e.stack);
+ throw e;
+}
</script>
</head>
<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 id="menucontainer" class="tbarmenu">
+<div id="menu"></div>
</div>
-<div id="menubackground" class="tbarbackground fixed"></div>
-<div id="menu" class="tbarmenu fixed"></div>
-
-<div id="viewheadbackground" class="viewheadbackground fixed"></div>
-<div id="viewhead" class="viewhead fixed"></div>
+<div id="viewheadcontainer" class="viewhead">
+<div id="viewhead"></div>
+</div>
<div id="viewcontainer">
<div id="view">
@@ -105,90 +118,255 @@ $('headdiv').appendChild(ui.declareScrip
<br/>
<div class="hd2">Sorry, that page was not found.</div>
-<div>You may have clicked an expired link or mistyped the address.</div>
+<div>You may have clicked an expired link<br/>or mistyped the address.</div>
</div>
</div>
</div>
-<div id="viewfootbackground" class="viewfootbackground fixed"></div>
-<div id="viewfoot" class="viewfoot fixed"></div>
+<div id="viewfootcontainer" class="viewfoot">
+<div id="viewfoot"></div>
+<div id="status"></div>
+</div>
+
+<div id="installer" class="installer"></div>
<script type="text/javascript">
-(function() {
+try {
+
+(function notfoundbody() {
/**
- * Init div variables.
+ * Setup page layout.
*/
-var mdiv = $('menu');
-var hdiv = $('viewhead');
-$('viewcontainer').className = ui.isMobile()? 'viewcontainer3d' : 'viewcontainer3dm';
-$('view').className = ui.isMobile()? 'viewloaded3d' : 'viewloaded3dm';
-var fdiv = $('viewfoot');
+(function layout() {
+ $('viewcontainer').className = ui.isMobile()? 'viewcontainer3dm' : 'viewcontainer3d';
+ $('view').className = ui.isMobile()? 'viewloaded3dm' : 'viewloaded3d';
+ document.title = config.windowtitle() + ' - Page not found';
+ $('viewhead').innerHTML = '<span class="bcmenu">' + config.pagetitle() + '</span>';
+ if (!ui.isMobile())
+ $('viewcontent').className = 'viewcontent flatscrollbars';
+ $('status').className = ui.isMobile()? 'status3dm' : 'status3d';
+})();
/**
- * Set page title.
+ * Setup menu bar.
*/
-document.title = config.windowtitle() + ' - Page not found';
-$('viewhead').innerHTML = '<span class="bcmenu">' + config.pagetitle() + '</span>';
+(function showmenu() {
+ $('menu').innerHTML = ui.menubar(
+ mklist(ui.menu('menuhome', 'Home', '/', '_self', false)), mklist());
+ $('viewfoot').innerHTML = config.viewfoot();
+})();
/**
- * Build and show the menu bar.
+ * Initialize status message area.
*/
-function showmenu(mdiv) {
- mdiv.innerHTML = ui.menubar(
- 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();
-}
+(function initstatus() {
+ if (isNil($('status')))
+ return;
+ $('status').style.display = 'none';
+
+ function divtransitionend(e) {
+ e.target.style.display = 'none';
+ e.target.className = ui.isMobile()? 'status3dm' : 'status3d';
+ e.target.error = false;
+ }
+ $('status').addEventListener('webkitTransitionEnd', divtransitionend, false);
+ $('status').addEventListener('transitionend', divtransitionend, false);
+})();
-showmenu(mdiv);
+/**
+ * Show a status message.
+ */
+window.showstatus = function(s, c) {
+ //debug('show status', s);
+ if (isNil($('status')) || $('status').error)
+ return s;
+ $('status').innerHTML = '<span class="' + (c? c : 'okstatus') + '">' + s + '</span>';
+ $('status').className = ui.isMobile()? 'status3dm' : 'status3d';
+ $('status').style.display = 'block';
+ $('status').error = c == 'errorstatus';
+ if ($('status').delay)
+ ui.cancelDelay($('status').delay);
+ $('status').delay = ui.delay(function hidestatus() {
+ $('status').className = ui.isMobile()? 'statusout3dm' : 'statusout3d';
+ $('status').error = false;
+ }, 3000);
+ return s;
+};
/**
- * Log the current user out.
+ * Show an error message.
*/
-window.logout = function() {
- // Clear session cookie and user-specific local storage entries
- clearauthcookie();
- lstorage.removeItem('/r/Editor/accounts');
- lstorage.removeItem('/r/Editor/dashboards');
- document.location = '/login/';
- return false;
-}
+window.errorstatus = function(s) {
+ //debug('error', s);
+ return showstatus(s, 'errorstatus');
+};
+
+/**
+ * Show working status.
+ */
+window.workingstatus = function(w, c) {
+ //debug('show working', w);
+ if (isNil($('working')))
+ return w;
+ if (!ui.isMobile())
+ $('working').style.top = ui.pixpos(Math.round(window.clientHeight / 2));
+ $('working').style.display = w? 'block' : 'none';
+ return w;
+};
+
+/**
+ * Show the online/offline status.
+ */
+window.onlinestatus = function() {
+ return navigator.onLine? (ui.isMobile()? showstatus('Online') : showstatus('Online')) : errorstatus('Offline');
+};
/**
* Handle orientation change.
*/
document.body.onorientationchange = function(e) {
//debug('onorientationchange');
- ui.onorientationchange(e);
-
- // Resize menu and view header
- mdiv.style.width = ui.pixpos(document.documentElement.clientWidth);
- hdiv.style.width = ui.pixpos(document.documentElement.clientWidth);
- return true;
+ return ui.onorientationchange(e);
};
/**
- * Initialize the document.
+ * Populate cache with app resources.
*/
-function onload() {
- //debug('onload');
- ui.onload();
+var appresources = [
+ ['/all-min.js'],
+ ['/ui-min.css'],
+ ['/public/config-min.js']
+];
- // Show the page
- document.body.style.visibility = 'visible';
- return true;
-}
+/**
+ * Install the application cache.
+ */
+(function installappcache() {
+ if (ui.isMobile()) {
+ // On mobile devices, trigger usage of an application cache manifest
+ window.onappcachechecking = function(e) {
+ //debug('appcache checking', e);
+ workingstatus(true);
+ showstatus('Checking');
+ };
+ window.onappcacheerror = function(e) {
+ //debug('appcache error', e);
+ onlinestatus();
+ workingstatus(false);
+ };
+ window.onappcachenoupdate = function(e) {
+ //debug('appcache noupdate', e);
+ onlinestatus();
+ workingstatus(false);
+ };
+ window.onappcachedownloading = function(e) {
+ //debug('appcache downloading', e);
+ workingstatus(true);
+ showstatus('Updating');
+ };
+ window.onappcacheprogress = function(e) {
+ //debug('appcache progress', e);
+ workingstatus(true);
+ showstatus('Updating');
+ };
+ window.onappcacheupdateready = function(e) {
+ //debug('appcache updateready', e);
+ try {
+ applicationCache.swapCache();
+ } catch(e) {}
+ onlinestatus();
+ workingstatus(false);
+ //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], 'remote');
+ }, append(appresources, config.appresources()));
+ window.location.reload();
+ };
+ window.onappcachecached = function(e) {
+ //debug('appcache cached', e);
+ onlinestatus();
+ workingstatus(false);
+
+ // Install offline resources in local storage
+ map(function(res) {
+ showstatus('Updating');
+ appcache.remove(res[0]);
+ appcache.get(res[0], 'remote');
+ }, append(appresources, config.appresources()));
+ };
+
+ window.onloadappcache = function() {
+ //debug('appcache iframe loaded');
+ };
+
+ ui.delay(function() {
+ $('installer').innerHTML = '<iframe src="/public/cache/" class="installer"></iframe>';
+ });
+
+ } else {
+ // On non-mobile devices, check for cache-manifest changes ourselves.
+ workingstatus(true);
+ showstatus('Checking');
+ var lcmf = appcache.get('/public/cache/cache-manifest.cmf', 'local');
+ var rcmf = appcache.get('/public/cache/cache-manifest.cmf', 'remote');
+ if (lcmf == rcmf) {
+ onlinestatus();
+ workingstatus(false);
+ return true;
+ }
-onload();
+ //debug('cache-manifest changed, reloading');
+ ui.delay(function() {
+ showstatus('Updating');
+ ui.delay(function() {
+ map(function(res) {
+ appcache.remove(res[0]);
+ appcache.get(res[0], 'remote');
+ }, append(appresources, config.appresources()));
+ if (!isNil(lcmf)) {
+ //debug('reloading');
+ window.location.reload();
+ }
+ onlinestatus();
+ workingstatus(false);
+ });
+ });
+ }
+})();
+
+/**
+ * Handle network offline/online events.
+ */
+window.addEventListener('offline', function(e) {
+ //debug('going offline');
+ showstatus('Offline');
+}, false);
+window.addEventListener('online', function(e) {
+ //debug('going online');
+ showstatus('Online');
+}, false);
+
+/**
+ * Initialize the document.
+ */
+window.onload = function() {
+ //debug('onload');
+ return ui.onload();
+};
})();
-</script>
-<div id="footdiv" class="fsection">
-</div>
+} catch(e) {
+ debug(e.stack);
+ throw e;
+}
+</script>
-</div>
</body>
</html>
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=1428193&r1=1428192&r2=1428193&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 Thu Jan 3 07:41:53 2013
@@ -19,33 +19,50 @@
-->
<html>
<head>
+<!-- Firebug inspector -->
+<!--
+<script type="text/javascript" src="https://getfirebug.com/releases/lite/1.3/firebug-lite.js"></script>
+-->
+<!-- Weinre inspector -->
+<!--
+<script src="http://www.example.com:9998/target/target-script-min.js#anonymous"></script>
+-->
<title>Page not found</title>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"/>
+<!--
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
+-->
+<link rel="apple-touch-icon-precomposed" href="/public/touchicon.png"/>
<base href="/public/notyet/"/>
<script type="text/javascript">
-(function() {
+try {
+
+(function notyethead() {
window.appcache = {};
/**
* Get and cache a resource.
*/
-appcache.get = function(uri) {
+appcache.get = function(uri, mode) {
var h = uri.indexOf('#');
var u = h == -1? uri : uri.substring(0, h);
// Get resource from local storage first
var ls = window.lstorage || localStorage;
- var item = null;
- try { item = ls.getItem(u); } catch(e) {}
- if (item != null && item != '')
- return item;
+ if (mode != 'remote') {
+ var item = null;
+ try { item = ls.getItem('ui.r.' + u); } catch(e) {}
+ if (item != null && item != '')
+ return item;
+ if (mode == 'local')
+ return null;
+ }
// Get resource from network
var http = new XMLHttpRequest();
- http.open("GET", u, false);
+ http.open("GET", mode == 'remote'? (u + '?t=' + new Date().getTime() + '&r=' + Math.random()) : u, false);
http.setRequestHeader("Accept", "*/*");
http.send(null);
if (http.status == 200) {
@@ -56,7 +73,7 @@ appcache.get = function(uri) {
if (window.debug) debug('http error', u, 'No-Content');
return null;
}
- try { ls.setItem(u, http.responseText); } catch(e) {}
+ try { ls.setItem('ui.r.' + u, http.responseText); } catch(e) {}
return http.responseText;
}
if (window.debug) debug('http error', u, http.status, http.statusText);
@@ -68,127 +85,288 @@ appcache.get = function(uri) {
/**
* Load Javascript and CSS.
*/
-(function() {
+(function notyetboot() {
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')));
+bootjs.text = 'try {\n' + appcache.get('/all-min.js') + '\n' + appcache.get('/public/config-min.js') + '\n} catch(e) { console.log(e.stack); throw e; }\n';
+var head = document.getElementsByTagName('head')[0];
+head.appendChild(bootjs);
+head.appendChild(ui.declareCSS(appcache.get('/ui-min.css')));
})();
+} catch(e) {
+ if (window.debug) debug(e.stack);
+ throw e;
+}
</script>
</head>
<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 id="menucontainer" class="tbarmenu">
+<div id="menu"></div>
</div>
-<div id="menubackground" class="tbarbackground fixed"></div>
-<div id="menu" class="tbarmenu fixed"></div>
-
-<div id="viewheadbackground" class="viewheadbackground fixed"></div>
-<div id="viewhead" class="viewhead fixed"></div>
+<div id="viewheadcontainer" class="viewhead">
+<div id="viewhead"></div>
+</div>
<div id="viewcontainer">
<div id="view">
<div id="viewcontent" class="viewcontent" style="margin-left: auto; margin-right: auto; text-align: center;">
<br/>
-<div class="hd2">Sorry, that page is still under construction.</div>
+<div class="hd2">Sorry, this page is still<br/>under construction.</div>
<div>Please check back later.</div>
</div>
</div>
</div>
-<div id="viewfootbackground" class="viewfootbackground fixed"></div>
-<div id="viewfoot" class="viewfoot fixed"></div>
+<div id="viewfootcontainer" class="viewfoot">
+<div id="viewfoot"></div>
+<div id="status"></div>
+</div>
+
+<div id="installer" class="installer"></div>
<script type="text/javascript">
-(function() {
+try {
+
+(function notyetbody() {
/**
- * Init div variables.
+ * Setup page layout.
*/
-var mdiv = $('menu');
-var hdiv = $('viewhead');
-$('viewcontainer').className = ui.isMobile()? 'viewcontainer3d' : 'viewcontainer3dm';
-$('view').className = ui.isMobile()? 'viewloaded3d' : 'viewloaded3dm';
-var fdiv = $('viewfoot');
+(function layout() {
+ $('viewcontainer').className = ui.isMobile()? 'viewcontainer3dm' : 'viewcontainer3d';
+ $('view').className = ui.isMobile()? 'viewloaded3dm' : 'viewloaded3d';
+ document.title = config.windowtitle() + ' - Page not found';
+ $('viewhead').innerHTML = '<span class="bcmenu">' + config.pagetitle() + '</span>';
+ if (!ui.isMobile())
+ $('viewcontent').className = 'viewcontent flatscrollbars';
+ $('status').className = ui.isMobile()? 'status3dm' : 'status3d';
+})();
/**
- * Set page title.
+ * Setup menu bar.
*/
-document.title = config.windowtitle() + ' - Page not found';
-$('viewhead').innerHTML = '<span class="bcmenu">' + config.pagetitle() + '</span>';
+(function showmenu() {
+ $('menu').innerHTML = ui.menubar(
+ mklist(ui.menu('menuhome', 'Home', '/', '_self', false)), mklist());
+ $('viewfoot').innerHTML = config.viewfoot();
+})();
/**
- * Build and show the menu bar.
+ * Initialize status message area.
*/
-function showmenu(mdiv) {
- mdiv.innerHTML = ui.menubar(
- 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();
-}
+(function initstatus() {
+ if (isNil($('status')))
+ return;
+ $('status').style.display = 'none';
+
+ function divtransitionend(e) {
+ e.target.style.display = 'none';
+ e.target.className = ui.isMobile()? 'status3dm' : 'status3d';
+ e.target.error = false;
+ }
+ $('status').addEventListener('webkitTransitionEnd', divtransitionend, false);
+ $('status').addEventListener('transitionend', divtransitionend, false);
+})();
-showmenu(mdiv);
+/**
+ * Show a status message.
+ */
+window.showstatus = function(s, c) {
+ //debug('show status', s);
+ if (isNil($('status')) || $('status').error)
+ return s;
+ $('status').innerHTML = '<span class="' + (c? c : 'okstatus') + '">' + s + '</span>';
+ $('status').className = ui.isMobile()? 'status3dm' : 'status3d';
+ $('status').style.display = 'block';
+ $('status').error = c == 'errorstatus';
+ if ($('status').delay)
+ ui.cancelDelay($('status').delay);
+ $('status').delay = ui.delay(function hidestatus() {
+ $('status').className = ui.isMobile()? 'statusout3dm' : 'statusout3d';
+ $('status').error = false;
+ }, 3000);
+ return s;
+};
/**
- * Log the current user out.
+ * Show an error message.
*/
-window.logout = function() {
- // Clear session cookie and user-specific local storage entries
- clearauthcookie();
- lstorage.removeItem('/r/Editor/accounts');
- lstorage.removeItem('/r/Editor/dashboards');
- document.location = '/login/';
- return false;
-}
+window.errorstatus = function(s) {
+ //debug('error', s);
+ return showstatus(s, 'errorstatus');
+};
+
+/**
+ * Show working status.
+ */
+window.workingstatus = function(w, c) {
+ //debug('show working', w);
+ if (isNil($('working')))
+ return w;
+ if (!ui.isMobile())
+ $('working').style.top = ui.pixpos(Math.round(window.clientHeight / 2));
+ $('working').style.display = w? 'block' : 'none';
+ return w;
+};
+
+/**
+ * Show the online/offline status.
+ */
+window.onlinestatus = function() {
+ return navigator.onLine? (ui.isMobile()? showstatus('Online') : showstatus('Online')) : errorstatus('Offline');
+};
/**
* Handle orientation change.
*/
document.body.onorientationchange = function(e) {
//debug('onorientationchange');
- ui.onorientationchange(e);
-
- // Resize menu and view header
- mdiv.style.width = ui.pixpos(document.documentElement.clientWidth);
- hdiv.style.width = ui.pixpos(document.documentElement.clientWidth);
- return true;
+ return ui.onorientationchange(e);
};
/**
- * Initialize the document.
+ * Populate cache with app resources.
*/
-function onload() {
- //debug('onload');
- ui.onload();
+var appresources = [
+ ['/all-min.js'],
+ ['/ui-min.css'],
+ ['/public/config-min.js']
+];
- // Show the page
- document.body.style.visibility = 'visible';
- return true;
-}
+/**
+ * Install the application cache.
+ */
+(function installappcache() {
+ if (ui.isMobile()) {
+ // On mobile devices, trigger usage of an application cache manifest
+ window.onappcachechecking = function(e) {
+ //debug('appcache checking', e);
+ workingstatus(true);
+ showstatus('Checking');
+ };
+ window.onappcacheerror = function(e) {
+ //debug('appcache error', e);
+ onlinestatus();
+ workingstatus(false);
+ };
+ window.onappcachenoupdate = function(e) {
+ //debug('appcache noupdate', e);
+ onlinestatus();
+ workingstatus(false);
+ };
+ window.onappcachedownloading = function(e) {
+ //debug('appcache downloading', e);
+ workingstatus(true);
+ showstatus('Updating');
+ };
+ window.onappcacheprogress = function(e) {
+ //debug('appcache progress', e);
+ workingstatus(true);
+ showstatus('Updating');
+ };
+ window.onappcacheupdateready = function(e) {
+ //debug('appcache updateready', e);
+ try {
+ applicationCache.swapCache();
+ } catch(e) {}
+ onlinestatus();
+ workingstatus(false);
+ //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], 'remote');
+ }, append(appresources, config.appresources()));
+ window.location.reload();
+ };
+ window.onappcachecached = function(e) {
+ //debug('appcache cached', e);
+ onlinestatus();
+ workingstatus(false);
+
+ // Install offline resources in local storage
+ map(function(res) {
+ showstatus('Updating');
+ appcache.remove(res[0]);
+ appcache.get(res[0], 'remote');
+ }, append(appresources, config.appresources()));
+ };
+
+ window.onloadappcache = function() {
+ //debug('appcache iframe loaded');
+ };
+
+ ui.delay(function() {
+ $('installer').innerHTML = '<iframe src="/public/cache/" class="installer"></iframe>';
+ });
+
+ } else {
+ // On non-mobile devices, check for cache-manifest changes ourselves.
+ workingstatus(true);
+ showstatus('Checking');
+ var lcmf = appcache.get('/public/cache/cache-manifest.cmf', 'local');
+ var rcmf = appcache.get('/public/cache/cache-manifest.cmf', 'remote');
+ if (lcmf == rcmf) {
+ onlinestatus();
+ workingstatus(false);
+ return true;
+ }
-onload();
+ //debug('cache-manifest changed, reloading');
+ ui.delay(function() {
+ showstatus('Updating');
+ ui.delay(function() {
+ map(function(res) {
+ appcache.remove(res[0]);
+ appcache.get(res[0], 'remote');
+ }, append(appresources, config.appresources()));
+ if (!isNil(lcmf)) {
+ //debug('reloading');
+ window.location.reload();
+ }
+ onlinestatus();
+ workingstatus(false);
+ });
+ });
+ }
+})();
+
+/**
+ * Handle network offline/online events.
+ */
+window.addEventListener('offline', function(e) {
+ //debug('going offline');
+ showstatus('Offline');
+}, false);
+window.addEventListener('online', function(e) {
+ //debug('going online');
+ showstatus('Online');
+}, false);
+
+/**
+ * Initialize the document.
+ */
+window.onload = function() {
+ //debug('onload');
+ return ui.onload();
+};
})();
-</script>
-<div id="footdiv" class="fsection">
-</div>
+} catch(e) {
+ debug(e.stack);
+ throw e;
+}
+</script>
-</div>
</body>
</html>
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=1428193&r1=1428192&r2=1428193&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 Thu Jan 3 07:41:53 2013
@@ -19,33 +19,50 @@
-->
<html>
<head>
+<!-- Firebug inspector -->
+<!--
+<script type="text/javascript" src="https://getfirebug.com/releases/lite/1.3/firebug-lite.js"></script>
+-->
+<!-- Weinre inspector -->
+<!--
+<script src="http://www.example.com:9998/target/target-script-min.js#anonymous"></script>
+-->
<title>Oops</title>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"/>
+<!--
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
+-->
+<link rel="apple-touch-icon-precomposed" href="/public/touchicon.png"/>
<base href="/public/oops/"/>
<script type="text/javascript">
-(function() {
+try {
+
+(function oopshead() {
window.appcache = {};
/**
* Get and cache a resource.
*/
-appcache.get = function(uri) {
+appcache.get = function(uri, mode) {
var h = uri.indexOf('#');
var u = h == -1? uri : uri.substring(0, h);
// Get resource from local storage first
var ls = window.lstorage || localStorage;
- var item = null;
- try { item = ls.getItem(u); } catch(e) {}
- if (item != null && item != '')
- return item;
+ if (mode != 'remote') {
+ var item = null;
+ try { item = ls.getItem('ui.r.' + u); } catch(e) {}
+ if (item != null && item != '')
+ return item;
+ if (mode == 'local')
+ return null;
+ }
// Get resource from network
var http = new XMLHttpRequest();
- http.open("GET", u, false);
+ http.open("GET", mode == 'remote'? (u + '?t=' + new Date().getTime() + '&r=' + Math.random()) : u, false);
http.setRequestHeader("Accept", "*/*");
http.send(null);
if (http.status == 200) {
@@ -56,7 +73,7 @@ appcache.get = function(uri) {
if (window.debug) debug('http error', u, 'No-Content');
return null;
}
- try { ls.setItem(u, http.responseText); } catch(e) {}
+ try { ls.setItem('ui.r.' + u, http.responseText); } catch(e) {}
return http.responseText;
}
if (window.debug) debug('http error', u, http.status, http.statusText);
@@ -68,36 +85,32 @@ appcache.get = function(uri) {
/**
* Load Javascript and CSS.
*/
-(function() {
+(function oopsboot() {
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')));
+bootjs.text = 'try {\n' + appcache.get('/all-min.js') + '\n' + appcache.get('/public/config-min.js') + '\n} catch(e) { console.log(e.stack); throw e; }\n';
+var head = document.getElementsByTagName('head')[0];
+head.appendChild(bootjs);
+head.appendChild(ui.declareCSS(appcache.get('/ui-min.css')));
})();
+} catch(e) {
+ if (window.debug) debug(e.stack);
+ throw e;
+}
</script>
</head>
<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 id="menucontainer" class="tbarmenu">
+<div id="menu"></div>
</div>
-<div id="menubackground" class="tbarbackground fixed"></div>
-<div id="menu" class="tbarmenu fixed"></div>
-
-<div id="viewheadbackground" class="viewheadbackground fixed"></div>
-<div id="viewhead" class="viewhead fixed"></div>
+<div id="viewheadcontainer" class="viewhead">
+<div id="viewhead"></div>
+</div>
<div id="viewcontainer">
<div id="view">
@@ -110,84 +123,249 @@ $('headdiv').appendChild(ui.declareScrip
</div>
</div>
-<div id="viewfootbackground" class="viewfootbackground fixed"></div>
-<div id="viewfoot" class="viewfoot fixed"></div>
+<div id="viewfootcontainer" class="viewfoot">
+<div id="viewfoot"></div>
+<div id="status"></div>
+</div>
+
+<div id="installer" class="installer"></div>
<script type="text/javascript">
-(function() {
+try {
+
+(function oopsbody() {
/**
- * Init div variables.
+ * Setup page layout.
*/
-var mdiv = $('menu');
-var hdiv = $('viewhead');
-$('viewcontainer').className = ui.isMobile()? 'viewcontainer3d' : 'viewcontainer3dm';
-$('view').className = ui.isMobile()? 'viewloaded3d' : 'viewloaded3dm';
-var fdiv = $('viewfoot');
+(function layout() {
+ $('viewcontainer').className = ui.isMobile()? 'viewcontainer3dm' : 'viewcontainer3d';
+ $('view').className = ui.isMobile()? 'viewloaded3dm' : 'viewloaded3d';
+ document.title = config.windowtitle() + ' - Oops';
+ $('viewhead').innerHTML = '<span class="bcmenu">' + config.pagetitle() + '</span>';
+ if (!ui.isMobile())
+ $('viewcontent').className = 'viewcontent flatscrollbars';
+ $('status').className = ui.isMobile()? 'status3dm' : 'status3d';
+})();
/**
- * Set page title.
+ * Setup menu bar.
*/
-document.title = config.windowtitle() + ' - Oops';
-$('viewhead').innerHTML = '<span class="bcmenu">' + config.pagetitle() + '</span>';
+(function showmenu() {
+ $('menu').innerHTML = ui.menubar(
+ mklist(ui.menu('menuhome', 'Home', '/', '_self', false)), mklist());
+ $('viewfoot').innerHTML = config.viewfoot();
+})();
/**
- * Build and show the menu bar.
+ * Initialize status message area.
*/
-function showmenu(mdiv) {
- mdiv.innerHTML = ui.menubar(
- 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();
-}
+(function initstatus() {
+ if (isNil($('status')))
+ return;
+ $('status').style.display = 'none';
+
+ function divtransitionend(e) {
+ e.target.style.display = 'none';
+ e.target.className = ui.isMobile()? 'status3dm' : 'status3d';
+ e.target.error = false;
+ }
+ $('status').addEventListener('webkitTransitionEnd', divtransitionend, false);
+ $('status').addEventListener('transitionend', divtransitionend, false);
+})();
-showmenu(mdiv);
+/**
+ * Show a status message.
+ */
+window.showstatus = function(s, c) {
+ //debug('show status', s);
+ if (isNil($('status')) || $('status').error)
+ return s;
+ $('status').innerHTML = '<span class="' + (c? c : 'okstatus') + '">' + s + '</span>';
+ $('status').className = ui.isMobile()? 'status3dm' : 'status3d';
+ $('status').style.display = 'block';
+ $('status').error = c == 'errorstatus';
+ if ($('status').delay)
+ ui.cancelDelay($('status').delay);
+ $('status').delay = ui.delay(function hidestatus() {
+ $('status').className = ui.isMobile()? 'statusout3dm' : 'statusout3d';
+ $('status').error = false;
+ }, 3000);
+ return s;
+};
/**
- * Log the current user out.
+ * Show an error message.
*/
-window.logout = function() {
- // Clear session cookie and user-specific local storage entries
- clearauthcookie();
- lstorage.removeItem('/r/Editor/accounts');
- lstorage.removeItem('/r/Editor/dashboards');
- document.location = '/login/';
- return false;
-}
+window.errorstatus = function(s) {
+ //debug('error', s);
+ return showstatus(s, 'errorstatus');
+};
+
+/**
+ * Show working status.
+ */
+window.workingstatus = function(w, c) {
+ //debug('show working', w);
+ if (isNil($('working')))
+ return w;
+ if (!ui.isMobile())
+ $('working').style.top = ui.pixpos(Math.round(window.clientHeight / 2));
+ $('working').style.display = w? 'block' : 'none';
+ return w;
+};
+
+/**
+ * Show the online/offline status.
+ */
+window.onlinestatus = function() {
+ return navigator.onLine? (ui.isMobile()? showstatus('Online') : showstatus()) : errorstatus('Offline');
+};
/**
* Handle orientation change.
*/
document.body.onorientationchange = function(e) {
//debug('onorientationchange');
- ui.onorientationchange(e);
-
- // Resize menu and view header
- mdiv.style.width = ui.pixpos(document.documentElement.clientWidth);
- hdiv.style.width = ui.pixpos(document.documentElement.clientWidth);
- return true;
+ return ui.onorientationchange(e);
};
/**
- * Initialize the document.
+ * Populate cache with app resources.
*/
-function onload() {
- //debug('onload');
- ui.onload();
+var appresources = [
+ ['/all-min.js'],
+ ['/ui-min.css'],
+ ['/public/config-min.js']
+];
- // Show the page
- document.body.style.visibility = 'visible';
- return true;
-}
+/**
+ * Install the application cache.
+ */
+(function installappcache() {
+ if (ui.isMobile()) {
+ // On mobile devices, trigger usage of an application cache manifest
+ window.onappcachechecking = function(e) {
+ //debug('appcache checking', e);
+ workingstatus(true);
+ showstatus('Checking');
+ };
+ window.onappcacheerror = function(e) {
+ //debug('appcache error', e);
+ onlinestatus();
+ workingstatus(false);
+ };
+ window.onappcachenoupdate = function(e) {
+ //debug('appcache noupdate', e);
+ onlinestatus();
+ workingstatus(false);
+ };
+ window.onappcachedownloading = function(e) {
+ //debug('appcache downloading', e);
+ workingstatus(true);
+ showstatus('Updating');
+ };
+ window.onappcacheprogress = function(e) {
+ //debug('appcache progress', e);
+ workingstatus(true);
+ showstatus('Updating');
+ };
+ window.onappcacheupdateready = function(e) {
+ //debug('appcache updateready', e);
+ try {
+ applicationCache.swapCache();
+ } catch(e) {}
+ onlinestatus();
+ workingstatus(false);
+ //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], 'remote');
+ }, append(appresources, config.appresources()));
+ window.location.reload();
+ };
+ window.onappcachecached = function(e) {
+ //debug('appcache cached', e);
+ onlinestatus();
+ workingstatus(false);
+
+ // Install offline resources in local storage
+ map(function(res) {
+ showstatus('Updating');
+ appcache.remove(res[0]);
+ appcache.get(res[0], 'remote');
+ }, append(appresources, config.appresources()));
+ };
+
+ window.onloadappcache = function() {
+ //debug('appcache iframe loaded');
+ };
+
+ ui.delay(function() {
+ $('installer').innerHTML = '<iframe src="/public/cache/" class="installer"></iframe>';
+ });
+
+ } else {
+ // On non-mobile devices, check for cache-manifest changes ourselves.
+ workingstatus(true);
+ showstatus('Checking');
+ var lcmf = appcache.get('/public/cache/cache-manifest.cmf', 'local');
+ var rcmf = appcache.get('/public/cache/cache-manifest.cmf', 'remote');
+ if (lcmf == rcmf) {
+ onlinestatus();
+ workingstatus(false);
+ return true;
+ }
-onload();
+ //debug('cache-manifest changed, reloading');
+ ui.delay(function() {
+ showstatus('Updating');
+ ui.delay(function() {
+ map(function(res) {
+ appcache.remove(res[0]);
+ appcache.get(res[0], 'remote');
+ }, append(appresources, config.appresources()));
+ if (!isNil(lcmf)) {
+ //debug('reloading');
+ window.location.reload();
+ }
+ onlinestatus();
+ workingstatus(false);
+ });
+ });
+ }
+})();
+
+/**
+ * Handle network offline/online events.
+ */
+window.addEventListener('offline', function(e) {
+ //debug('going offline');
+ showstatus('Offline');
+}, false);
+window.addEventListener('online', function(e) {
+ //debug('going online');
+ showstatus('Online');
+}, false);
+
+/**
+ * Initialize the document.
+ */
+window.onload = function() {
+ //debug('onload');
+ return ui.onload();
+};
})();
-</script>
-<div id="footdiv" class="fsection">
-</div>
+} catch(e) {
+ debug(e.stack);
+ throw e;
+}
+</script>
-</div>
</body>
</html>
Added: tuscany/sca-cpp/trunk/hosting/server/htdocs/public/rate.png
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/public/rate.png?rev=1428193&view=auto
==============================================================================
Files tuscany/sca-cpp/trunk/hosting/server/htdocs/public/rate.png (added) and tuscany/sca-cpp/trunk/hosting/server/htdocs/public/rate.png Thu Jan 3 07:41:53 2013 differ
Added: tuscany/sca-cpp/trunk/hosting/server/htdocs/public/rate.xcf
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/public/rate.xcf?rev=1428193&view=auto
==============================================================================
Files tuscany/sca-cpp/trunk/hosting/server/htdocs/public/rate.xcf (added) and tuscany/sca-cpp/trunk/hosting/server/htdocs/public/rate.xcf Thu Jan 3 07:41:53 2013 differ
Added: tuscany/sca-cpp/trunk/hosting/server/htdocs/public/ratings.png
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/public/ratings.png?rev=1428193&view=auto
==============================================================================
Files tuscany/sca-cpp/trunk/hosting/server/htdocs/public/ratings.png (added) and tuscany/sca-cpp/trunk/hosting/server/htdocs/public/ratings.png Thu Jan 3 07:41:53 2013 differ
Added: tuscany/sca-cpp/trunk/hosting/server/htdocs/public/ratings.xcf
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/public/ratings.xcf?rev=1428193&view=auto
==============================================================================
Files tuscany/sca-cpp/trunk/hosting/server/htdocs/public/ratings.xcf (added) and tuscany/sca-cpp/trunk/hosting/server/htdocs/public/ratings.xcf Thu Jan 3 07:41:53 2013 differ
Added: tuscany/sca-cpp/trunk/hosting/server/htdocs/public/search.png
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/public/search.png?rev=1428193&view=auto
==============================================================================
Files tuscany/sca-cpp/trunk/hosting/server/htdocs/public/search.png (added) and tuscany/sca-cpp/trunk/hosting/server/htdocs/public/search.png Thu Jan 3 07:41:53 2013 differ
Added: tuscany/sca-cpp/trunk/hosting/server/htdocs/public/search.xcf
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/public/search.xcf?rev=1428193&view=auto
==============================================================================
Files tuscany/sca-cpp/trunk/hosting/server/htdocs/public/search.xcf (added) and tuscany/sca-cpp/trunk/hosting/server/htdocs/public/search.xcf Thu Jan 3 07:41:53 2013 differ
Added: tuscany/sca-cpp/trunk/hosting/server/htdocs/public/touchicon-50.xcf
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/public/touchicon-50.xcf?rev=1428193&view=auto
==============================================================================
Files tuscany/sca-cpp/trunk/hosting/server/htdocs/public/touchicon-50.xcf (added) and tuscany/sca-cpp/trunk/hosting/server/htdocs/public/touchicon-50.xcf Thu Jan 3 07:41:53 2013 differ
Added: tuscany/sca-cpp/trunk/hosting/server/htdocs/public/touchicon-53.xcf
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/public/touchicon-53.xcf?rev=1428193&view=auto
==============================================================================
Files tuscany/sca-cpp/trunk/hosting/server/htdocs/public/touchicon-53.xcf (added) and tuscany/sca-cpp/trunk/hosting/server/htdocs/public/touchicon-53.xcf Thu Jan 3 07:41:53 2013 differ
Added: tuscany/sca-cpp/trunk/hosting/server/htdocs/public/touchicon-57.xcf
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/public/touchicon-57.xcf?rev=1428193&view=auto
==============================================================================
Files tuscany/sca-cpp/trunk/hosting/server/htdocs/public/touchicon-57.xcf (added) and tuscany/sca-cpp/trunk/hosting/server/htdocs/public/touchicon-57.xcf Thu Jan 3 07:41:53 2013 differ
Modified: tuscany/sca-cpp/trunk/hosting/server/htdocs/public/touchicon.png
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/public/touchicon.png?rev=1428193&r1=1428192&r2=1428193&view=diff
==============================================================================
Files tuscany/sca-cpp/trunk/hosting/server/htdocs/public/touchicon.png (original) and tuscany/sca-cpp/trunk/hosting/server/htdocs/public/touchicon.png Thu Jan 3 07:41:53 2013 differ
Modified: tuscany/sca-cpp/trunk/hosting/server/htdocs/public/user.b64
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/public/user.b64?rev=1428193&r1=1428192&r2=1428193&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/hosting/server/htdocs/public/user.b64 (original)
+++ tuscany/sca-cpp/trunk/hosting/server/htdocs/public/user.b64 Thu Jan 3 07:41:53 2013
@@ -1 +1 @@
-iVBORw0KGgoAAAANSUhEUgAAADIAAAAyAgMAAABjUWAiAAAABGdBTUEAALGPC/xhBQAAAAxQTFRFyN+N+dR1/PCI////6HjE5gAAADJJREFUKM9j+I8EPjBQifeBAQSY6coLBYN6inhaq0Bg6SDn/f//akB466ExTS6P2ukMAKumzarJO/66AAAAAElFTkSuQmCC
\ No newline at end of file
+iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAADG0lEQVRo3u3a326iQBQG8G8EhAIRMFXHJrXEJo0XNfER+jz7PrvP04fojb0gJq2BaCOmBUuRMntls82a/hkYdDeeW+OnPweGMycC/0kRALi+vmb/MuLq6orU/pcVOUAOEEEliwhVVRWUUjiOA13XIcsysizDarVCGIYIggAvLy/7C5EkCf1+H91uF4SQd68pigLLsmBZFs7OzuD7PjzPw+vr635BDMPA5eUlNE37fM8nBCcnJ2g2m7i5uUEcx/txj5imidFo9CXEn6VpGkajEUzT3D1EVVUMh0PIMt/iyrKM4XAIVVV3CxkMBqjX64Uy6vU6BoPB7iCUUti2Xco9Zts2KKXVQwghcF231C3Udd2/djvhkE6nU/i63na/dTqdaiFFLgMRuTXem9OyLCGQRqPBtXlwQRzHEXdAIoQrv8b7q4ksnnwuiGEYQiE8+VyQsnerMvK5IIqiCIXw5HNBajWx5zGefK5vxJjYoQtPPhckyzKhEJ58LkiapkIhPMdgLshqtRIKeX5+rgby9PQkFMKTzwVZLpdCITz5XJAoipAkiRBEkiSIoqi6Nn42mwmB8OZyQ6bTKfI8LxWR5zmm02m1kDRN4ft+qRDf97m39kK9xmQyKe2ZkqYpJpPJbqYoWZZhPB4XblkYYxiPx4U6hsLd32KxgOd5hTI8z8NisSiUUcrs9/7+HgDQ7/e/Nc5hjMHzvLf37xyywcRxjIuLiy/NgJMkwe3tLcIwLOXzC0EURYFhGDAMA5qmQdM0rNdrSJIEWZa3rk6e50jTFFEUodlsQtd1xHGMOI6xXq+rgWiaBsdxYNs2Go3Gt6fvm0PTBr1tlR4fH7FcLhGG4be6h08hpmmi1Wrh+PgYuq4L7bE2wHa7/dZlPzw8Y
D6ff9q2bIXIsgxKKSilwicmH5Wu6+j1euj1eojjGEEQIAiCrdv0O8jR0RFOT0/RbrchSRL2qQzDwPn5OVzXxWw2w93d3btzi7wBuK6LVqvFPQ2vqiRJQrfbBaUU8/n8rRsgjLGfjLEf+w746FlECPlFmOiRSEV1+OfDAXKAfFy/AU/NFLNNzbKxAAAAAElFTkSuQmCC
Modified: tuscany/sca-cpp/trunk/hosting/server/htdocs/public/user.png
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/public/user.png?rev=1428193&r1=1428192&r2=1428193&view=diff
==============================================================================
Files tuscany/sca-cpp/trunk/hosting/server/htdocs/public/user.png (original) and tuscany/sca-cpp/trunk/hosting/server/htdocs/public/user.png Thu Jan 3 07:41:53 2013 differ
Added: tuscany/sca-cpp/trunk/hosting/server/htdocs/public/user.xcf
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/public/user.xcf?rev=1428193&view=auto
==============================================================================
Files tuscany/sca-cpp/trunk/hosting/server/htdocs/public/user.xcf (added) and tuscany/sca-cpp/trunk/hosting/server/htdocs/public/user.xcf Thu Jan 3 07:41:53 2013 differ
Added: tuscany/sca-cpp/trunk/hosting/server/htdocs/rate/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/rate/index.html?rev=1428193&view=auto
==============================================================================
--- tuscany/sca-cpp/trunk/hosting/server/htdocs/rate/index.html (added)
+++ tuscany/sca-cpp/trunk/hosting/server/htdocs/rate/index.html Thu Jan 3 07:41:53 2013
@@ -0,0 +1,190 @@
+<!DOCTYPE html>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<div id="bodydiv" class="body">
+
+<div id="viewform" class="viewform">
+
+<form id="rateAppForm">
+<table style="width: 100%;">
+<tr><td class="label">Rating:</td></tr>
+<tr><td class="lightlabel" id="taptorate"></td></tr>
+<tr><td class="label">
+<span style="display: inline-block; width: 2px;"></span>
+<span id="rateApp1" class="graystar"> </span><span style="display: inline-block; width: 20px;"></span>
+<span id="rateApp2" class="graystar"> </span><span style="display: inline-block; width: 20px;"></span>
+<span id="rateApp3" class="graystar"> </span><span style="display: inline-block; width: 20px;"></span>
+<span id="rateApp4" class="graystar"> </span>
+</td></tr>
+<tr><td class="lightlabel" id="ratedescription"> </span></td></tr>
+<tr><td style="padding-top: 20px;">
+<input id="rateAppDoneButton" type="button" class="graybutton" value="Done"/>
+</td></tr>
+</table>
+</form>
+<br/>
+
+</div>
+
+<script type="text/javascript">
+(function ratebody() {
+
+/**
+ * Get the app name.
+ */
+var appname = ui.fragmentParams(location)['app'];
+
+/**
+ * Setup page layout.
+ */
+(function layout() {
+ document.title = config.windowtitle() + ' - ' + 'Rate' + ' - ' + appname;
+ $('viewhead').innerHTML = '<span class="smenu">' + 'Rate' + ' ' + appname + '</span>';
+ if (!ui.isMobile())
+ $('viewform').className = 'viewform flatscrollbars';
+
+ $('viewform').appendChild(ui.declareCSS(
+ '.redstar { ' +
+ 'background: url(\'' + ui.b64png(appcache.get('/public/rate.b64')) + '\'); background-repeat: no-repeat; ' +
+ 'vertical-align: middle; width: 40px; height: 40px; display: inline-block; background-position: 0px 1px;' +
+ ' } ' +
+ '.graystar { ' +
+ 'background: url(\'' + ui.b64png(appcache.get('/public/rate.b64')) + '\'); background-repeat: no-repeat; ' +
+ 'vertical-align: middle; width: 40px; height: 40px; display: inline-block; background-position: -50px 1px;' +
+ ' }'));
+
+ $('taptorate').innerHTML = ui.isMobile()? 'Tap a star to select a rating' : ' Click a star to select a rating';
+})();
+
+/**
+ * Initialize service references.
+ */
+var editorComp = sca.component("Editor");
+var reviews = sca.reference(editorComp, "reviews");
+
+/**
+ * Initialize the rate buttons.
+ */
+var rateAppButtons = [
+ [$('rateApp1'), 1, function() { return onclickrating(1); }, 'Don\'t like it'],
+ [$('rateApp2'), 2, function() { return onclickrating(2); }, 'It\'s ok'],
+ [$('rateApp3'), 3, function() { return onclickrating(3); }, 'It\'s good'],
+ [$('rateApp4'), 4, function() { return onclickrating(4); }, 'It\'s great']
+];
+(function initRateAppButtons() {
+ map(function(b) {
+ b[0].onclick = b[2];
+ }, rateAppButtons);
+})();
+
+/**
+ * Select a rating.
+ */
+var selectedrating = 0;
+function selectrating(r) {
+ selectedrating = r;
+ map(function(b) {
+ b[0].className = b[1] <= r? 'redstar' : 'graystar';
+ }, rateAppButtons);
+ $('ratedescription').innerHTML = rateAppButtons[r - 1][3];
+ return true;
+}
+
+/**
+ * The current app entry and corresponding saved XML content.
+ */
+var appentry;
+var savedxml = '';
+
+/**
+ * Get and display the requested app rating.
+ */
+(function getrating() {
+ if (isNil(appname))
+ return false;
+ workingstatus(true);
+ showstatus('Loading');
+
+ return reviews.get(appname, function(doc) {
+
+ // Stop now if we didn't get the rating
+ if (doc == null) {
+ onlinestatus();
+ workingstatus(false);
+ return false;
+ }
+
+ appentry = doc != null? car(elementsToValues(atom.readATOMEntry(mklist(doc)))) : mklist("'entry", mklist("'title", ''), mklist("'id", appname));
+ savedxml = car(atom.writeATOMEntry(valuesToElements(mklist(appentry))));
+ var content = cadr(assoc("'content", appentry));
+ if (!isNil(content))
+ selectrating(parseInt(cadr(content)));
+
+ onlinestatus();
+ workingstatus(false);
+ return true;
+ });
+})();
+
+/**
+ * Save an app rating.
+ */
+function save(name, entryxml) {
+ workingstatus(true);
+ showstatus('Saving');
+
+ savedxml = entryxml;
+ reviews.put(name, savedxml, function(e) {
+ if (e) {
+ showstatus('Local copy');
+ workingstatus(false);
+ return false;
+ }
+ showstatus('Saved');
+ workingstatus(false);
+ return false;
+ });
+ return false;
+}
+
+/**
+ * Handle rating click event.
+ */
+function onclickrating(r) {
+ // Select the rating
+ selectrating(r);
+
+ // Save
+ showstatus('Saving');
+ appentry = mklist("'entry", mklist("'title", appname), mklist("'id", appname), mklist("'content", mklist("'rating", selectedrating.toString())));
+ var entryxml = car(atom.writeATOMEntry(valuesToElements(mklist(appentry))));
+ return save(appname, entryxml);
+}
+
+/**
+ * Navigate back.
+ */
+$('rateAppDoneButton').onclick = function() {
+ history.back();
+};
+
+})();
+</script>
+
+</div>