diff options
Diffstat (limited to 'sca-cpp/trunk/hosting/server/htdocs/public')
34 files changed, 1085 insertions, 334 deletions
diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/app.b64 b/sca-cpp/trunk/hosting/server/htdocs/public/app.b64 index 7ed235aa14..4690a5c79c 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/public/app.b64 +++ b/sca-cpp/trunk/hosting/server/htdocs/public/app.b64 @@ -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 diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/app.png b/sca-cpp/trunk/hosting/server/htdocs/public/app.png Binary files differindex 1f73274b76..7293fe7ee5 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/public/app.png +++ b/sca-cpp/trunk/hosting/server/htdocs/public/app.png diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/app.xcf b/sca-cpp/trunk/hosting/server/htdocs/public/app.xcf Binary files differindex 741b7ff43f..b144d46743 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/public/app.xcf +++ b/sca-cpp/trunk/hosting/server/htdocs/public/app.xcf diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/cache/cache-template.cmf b/sca-cpp/trunk/hosting/server/htdocs/public/cache/cache-template.cmf new file mode 100644 index 0000000000..40da327179 --- /dev/null +++ b/sca-cpp/trunk/hosting/server/htdocs/public/cache/cache-template.cmf @@ -0,0 +1,17 @@ +CACHE MANIFEST + +# Version SHA1 + +# App resources +/favicon.ico +/login/ +/public/img.png +/public/notauth/ +/public/notfound/ +/public/notyet/ +/public/oops/ +/public/touchicon.png + +NETWORK: +* + diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/cache/index.html b/sca-cpp/trunk/hosting/server/htdocs/public/cache/index.html new file mode 100644 index 0000000000..c810cc16b8 --- /dev/null +++ b/sca-cpp/trunk/hosting/server/htdocs/public/cache/index.html @@ -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> diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/config.js b/sca-cpp/trunk/hosting/server/htdocs/public/config.js index 54818f4810..be23c7c01e 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/public/config.js +++ b/sca-cpp/trunk/hosting/server/htdocs/public/config.js @@ -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()); }; diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/delete.b64 b/sca-cpp/trunk/hosting/server/htdocs/public/delete.b64 deleted file mode 100644 index c8137d7ab4..0000000000 --- a/sca-cpp/trunk/hosting/server/htdocs/public/delete.b64 +++ /dev/null @@ -1 +0,0 @@ -iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAYAAADE6YVjAAAAAXNSR0IArs4c6QAAAAZiS0dEANAAPwBBXloXjQAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sEFhQaKzNh4PgAAAMKSURBVEjHxZZPTBNBFMa/maVbWjcUi0YiIHIoNBADTUgsqCWgUUFjwkk5CXLUBKIc9KIXjx64oMSDoiggGC8koImCGDWYkADRIiQQgikWCq0WoXW33R0PpYjSLeWP8btN3sv85s17894QrKNeIBng8gFmJSDZgGIAqJeBjQCkH5AHioGZaHsQNUMP+ByKYB0ByVjvIAxsUkHcrRJI9pggXYBWB1pLQUqxQSlg3X4o9WWAqArpAhL04JoIYMQmxQCPD3JlGbCwBtIFaPXgWrcC+AtUEY6Ihg060NrtACyf3KgDrQ2v6e8kbzwH0URBSnvA56xAKIJ1kRzNbS2ZNhYssjodVj41VbPaxqemaqxOh9XGgkXmtpbMyKDQvqQXSKbg2iKGzfPE0v8uV7BYDIuDg95B66FhJkmM8DyxfHifK+TlGRaHhryDBwuHmSSxyBUnn6Ohh6aSQElin86U26XZWVGwWAxZD5tMAGBufmAS8vIMkssl2s+Uj6gBQuLySS/oTQpyONr9GmxHhAMvnltovJZ+73vjTiyyJSmipHw8WTrkfd33Y52385arAr1EAF00R3HqixRwu38mnT61O35/uh4AJq7Ujc0/affEUGsCDfWi9TXX3uEOeDwBABCnp/3OO42uGPuAgQLUG4urueVRlsZo1ACANiVFZ7rTkBFjMXtpqJtGV9q1q3uNJ47vlpd88kTt5VEWCLLk6gtpeyrP74qheY5wlaB6AhSqOSUUFOzIun8vh8RxZKKmZvRrw20X0WjkxCKbceexo0Z3Z+d8wDUXVIeQdgrIA6rFl5DAmVsfZ1MtT+faO5zOxrtzADB1/Ybj28tX85wgxOU8e5pN9XqqHos8QIuBGQY2GTEPD5tM8en79P7x8aWxqurx1bbPZytGRYfDrzOZBHPzA5PanCkGZki4d3GQG7DNksFdLIFkpwBQAsmugHVvJ0AB6w5PypW79EOpZ4BnOwAM8Pih1P/R6gGgDBB9kCu3Clo1GcU1kGXQgg9yxWavTgHrXp6IC///t/Iv/l2/AGa0Qa2X0eC0AAAAAElFTkSuQmCC
\ No newline at end of file diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/delete.png b/sca-cpp/trunk/hosting/server/htdocs/public/delete.png Binary files differdeleted file mode 100644 index fb56bae030..0000000000 --- a/sca-cpp/trunk/hosting/server/htdocs/public/delete.png +++ /dev/null diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/delete.xcf b/sca-cpp/trunk/hosting/server/htdocs/public/delete.xcf Binary files differdeleted file mode 100644 index 7691f50cc5..0000000000 --- a/sca-cpp/trunk/hosting/server/htdocs/public/delete.xcf +++ /dev/null diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/grid72.b64 b/sca-cpp/trunk/hosting/server/htdocs/public/grid72.b64 deleted file mode 100644 index 34be13e5ca..0000000000 --- a/sca-cpp/trunk/hosting/server/htdocs/public/grid72.b64 +++ /dev/null @@ -1 +0,0 @@ -iVBORw0KGgoAAAANSUhEUgAAAEgAAABIAgMAAAAog1vUAAAABGdBTUEAALGPC/xhBQAAAAlQTFRFwuD84/T+////fj9v9QAAACxJREFUOMtjWLUqa9WsVctWrYQxVjAMCqFQdBDCMOrUUaeOOnXUqYPPqZgAABmg/C7pJC7lAAAAAElFTkSuQmCC
\ No newline at end of file diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/grid72.png b/sca-cpp/trunk/hosting/server/htdocs/public/grid72.png Binary files differdeleted file mode 100644 index cf6008171a..0000000000 --- a/sca-cpp/trunk/hosting/server/htdocs/public/grid72.png +++ /dev/null diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/iframe.html b/sca-cpp/trunk/hosting/server/htdocs/public/iframe.html deleted file mode 100644 index e2b862dbaa..0000000000 --- a/sca-cpp/trunk/hosting/server/htdocs/public/iframe.html +++ /dev/null @@ -1,28 +0,0 @@ -<!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> -<head> -</head> -<body style="margin:3px; padding: 0px; background-color: #dcdcdc;"> - -<div>frame ...</div> - -</body> -</html> diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/img.b64 b/sca-cpp/trunk/hosting/server/htdocs/public/img.b64 index 97dae687a0..1025ce0d3a 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/public/img.b64 +++ b/sca-cpp/trunk/hosting/server/htdocs/public/img.b64 @@ -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= diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/img.png b/sca-cpp/trunk/hosting/server/htdocs/public/img.png Binary files differindex 2363b25e8e..e05e74fa2d 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/public/img.png +++ b/sca-cpp/trunk/hosting/server/htdocs/public/img.png diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/img.xcf b/sca-cpp/trunk/hosting/server/htdocs/public/img.xcf Binary files differindex ffcc124584..c1736338ec 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/public/img.xcf +++ b/sca-cpp/trunk/hosting/server/htdocs/public/img.xcf diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/notauth/index.html b/sca-cpp/trunk/hosting/server/htdocs/public/notauth/index.html index 89852393bf..f453e0491c 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/public/notauth/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/public/notauth/index.html @@ -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> diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/notfound/index.html b/sca-cpp/trunk/hosting/server/htdocs/public/notfound/index.html index 8f0d486854..c8475147d7 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/public/notfound/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/public/notfound/index.html @@ -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.declareScript(appcache.get('/public/config-min.js')) <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; + } + + //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); + }); + }); + } +})(); -onload(); +/** + * 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> diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/notyet/index.html b/sca-cpp/trunk/hosting/server/htdocs/public/notyet/index.html index e43a992f38..4bcb3728ae 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/public/notyet/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/public/notyet/index.html @@ -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; + } + + //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); + }); + }); + } +})(); -onload(); +/** + * 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> diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/oops/index.html b/sca-cpp/trunk/hosting/server/htdocs/public/oops/index.html index cc97c5362e..68554efdb0 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/public/oops/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/public/oops/index.html @@ -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.declareScript(appcache.get('/public/config-min.js')) </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; + } + + //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); + }); + }); + } +})(); -onload(); +/** + * 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> diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/rate.png b/sca-cpp/trunk/hosting/server/htdocs/public/rate.png Binary files differnew file mode 100644 index 0000000000..27c744c5a6 --- /dev/null +++ b/sca-cpp/trunk/hosting/server/htdocs/public/rate.png diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/rate.xcf b/sca-cpp/trunk/hosting/server/htdocs/public/rate.xcf Binary files differnew file mode 100644 index 0000000000..eb807f6005 --- /dev/null +++ b/sca-cpp/trunk/hosting/server/htdocs/public/rate.xcf diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/ratings.png b/sca-cpp/trunk/hosting/server/htdocs/public/ratings.png Binary files differnew file mode 100644 index 0000000000..9c10be52dd --- /dev/null +++ b/sca-cpp/trunk/hosting/server/htdocs/public/ratings.png diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/ratings.xcf b/sca-cpp/trunk/hosting/server/htdocs/public/ratings.xcf Binary files differnew file mode 100644 index 0000000000..cad8d31b2e --- /dev/null +++ b/sca-cpp/trunk/hosting/server/htdocs/public/ratings.xcf diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/search.png b/sca-cpp/trunk/hosting/server/htdocs/public/search.png Binary files differnew file mode 100644 index 0000000000..d5178fea3c --- /dev/null +++ b/sca-cpp/trunk/hosting/server/htdocs/public/search.png diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/search.xcf b/sca-cpp/trunk/hosting/server/htdocs/public/search.xcf Binary files differnew file mode 100644 index 0000000000..30d03df40a --- /dev/null +++ b/sca-cpp/trunk/hosting/server/htdocs/public/search.xcf diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/touchicon-50.xcf b/sca-cpp/trunk/hosting/server/htdocs/public/touchicon-50.xcf Binary files differnew file mode 100644 index 0000000000..8dcc8e4f1b --- /dev/null +++ b/sca-cpp/trunk/hosting/server/htdocs/public/touchicon-50.xcf diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/touchicon-53.xcf b/sca-cpp/trunk/hosting/server/htdocs/public/touchicon-53.xcf Binary files differnew file mode 100644 index 0000000000..b2dcd6f12c --- /dev/null +++ b/sca-cpp/trunk/hosting/server/htdocs/public/touchicon-53.xcf diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/touchicon-57.xcf b/sca-cpp/trunk/hosting/server/htdocs/public/touchicon-57.xcf Binary files differnew file mode 100644 index 0000000000..5ab284973d --- /dev/null +++ b/sca-cpp/trunk/hosting/server/htdocs/public/touchicon-57.xcf diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/touchicon.b64 b/sca-cpp/trunk/hosting/server/htdocs/public/touchicon.b64 deleted file mode 100644 index 2239f6ae0f..0000000000 --- a/sca-cpp/trunk/hosting/server/htdocs/public/touchicon.b64 +++ /dev/null @@ -1 +0,0 @@ -iVBORw0KGgoAAAANSUhEUgAAADkAAAA5CAIAAAADehTSAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sDGxMkCJXGmL8AAAHwSURBVGje7ZpNbhNBEIXf625sCzA/QUhkg8SGiGxZcpDcgRux5hLkEjkE7BAS9gIyk+muxyZIsSeOG09bsXHX0p4pfVNdP8/loSTsiTnsj1XWyrrMutVSG+ic/ftNqe1mIMtSjsPUu9EQJ6H/UdvNLr59cgwFWaM1p8dnLx6dFGYF6RhIXzLVGIChB3VX8Fg0DWrPqqyHxTq4MUnKKEEBoNvIN4uxiqTkofUXpgZKsqtMx3Djpb45lNWAxxbfXf6wtdH9+vkKBLLGrFLz4M1HTk+K5gAIgBCVcaTI1gOK/acazqqbw2PdYzE7tdyh9AFJTL0zNDIJMInAZpKPzBzmIZuUnjoa9QQkOBHAyWbigYDaTslybg/59f7Q4+003pqwhqcbqjLH9H2OXw0Ksl6XsWB/a39lhf1rz8vOnKoHKmtlrayVtbLuuc6SFK1Z2hEZkBwAv1us4zA9PT7rDX3v9dPiOeBxT/uY0A+qd6Pbl2Sax/kXDN9LlcrXO3Rk9k/QWluVtbIe2O5toBGwFum3bLH/pEso7RarrPNHH/D8JbBIpsjJqx2Lq3Xu2Xv61yvXJzf6/b3nK2Htyu8WB9P/XltF/wfVllgFxet9azGL+bjMD5IUYbPSMktwT8hRSdalkizcufKcs77vUlkr61bsD5lbwtgOKPT2AAAAAElFTkSuQmCC
\ No newline at end of file diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/touchicon.png b/sca-cpp/trunk/hosting/server/htdocs/public/touchicon.png Binary files differindex f22c33d2a0..1975eb16bf 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/public/touchicon.png +++ b/sca-cpp/trunk/hosting/server/htdocs/public/touchicon.png diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/touchicon.xcf b/sca-cpp/trunk/hosting/server/htdocs/public/touchicon.xcf Binary files differdeleted file mode 100644 index fc713b478b..0000000000 --- a/sca-cpp/trunk/hosting/server/htdocs/public/touchicon.xcf +++ /dev/null diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/user.b64 b/sca-cpp/trunk/hosting/server/htdocs/public/user.b64 index 7ed235aa14..70e650a50b 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/public/user.b64 +++ b/sca-cpp/trunk/hosting/server/htdocs/public/user.b64 @@ -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/dZlPzw8YD6ff9q2bIXIsgxKKSilwicmH5Wu6+j1euj1eojjGEEQIAiCrdv0O8jR0RFOT0/RbrchSRL2qQzDwPn5OVzXxWw2w93d3btzi7wBuK6LVqvFPQ2vqiRJQrfbBaUU8/n8rRsgjLGfjLEf+w746FlECPlFmOiRSEV1+OfDAXKAfFy/AU/NFLNNzbKxAAAAAElFTkSuQmCC diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/user.png b/sca-cpp/trunk/hosting/server/htdocs/public/user.png Binary files differindex 1f73274b76..e99b30815d 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/public/user.png +++ b/sca-cpp/trunk/hosting/server/htdocs/public/user.png diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/user.xcf b/sca-cpp/trunk/hosting/server/htdocs/public/user.xcf Binary files differnew file mode 100644 index 0000000000..2f304c45a7 --- /dev/null +++ b/sca-cpp/trunk/hosting/server/htdocs/public/user.xcf |