diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2012-07-16 06:47:37 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2012-07-16 06:47:37 +0000 |
commit | f82576588fc9672a011655e709179eb43e5ab5b4 (patch) | |
tree | 159705233ce5c77c3975764d3211439171029147 /sca-cpp/trunk/hosting/server/htdocs/app | |
parent | 9bcbce787a3e7ecbc257a773be29edb1ae34f37f (diff) |
Improve caching support and some of the navigations in the hosting environment.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1361914 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/hosting/server/htdocs/app')
-rw-r--r-- | sca-cpp/trunk/hosting/server/htdocs/app/cache-template.cmf (renamed from sca-cpp/trunk/hosting/server/htdocs/app/cache-manifest.cmf) | 2 | ||||
-rw-r--r-- | sca-cpp/trunk/hosting/server/htdocs/app/index.html | 55 |
2 files changed, 37 insertions, 20 deletions
diff --git a/sca-cpp/trunk/hosting/server/htdocs/app/cache-manifest.cmf b/sca-cpp/trunk/hosting/server/htdocs/app/cache-template.cmf index 6ea53970aa..5881cf83dd 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/app/cache-manifest.cmf +++ b/sca-cpp/trunk/hosting/server/htdocs/app/cache-template.cmf @@ -1,6 +1,6 @@ CACHE MANIFEST -# Version 5 +# Version SHA1 # App resources /favicon.ico diff --git a/sca-cpp/trunk/hosting/server/htdocs/app/index.html b/sca-cpp/trunk/hosting/server/htdocs/app/index.html index 30bd1d9999..cddf4fb477 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/app/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/app/index.html @@ -26,6 +26,7 @@ <link rel="apple-touch-icon" href="/public/touchicon.png"/> <base href="/"/> <script type="text/javascript"> +(function() { window.appcache = {}; @@ -50,50 +51,60 @@ appcache.get = function(uri) { http.send(null); if (http.status == 200) { if (http.getResponseHeader("X-Login") != null) { - if (debug) debug('http error', u, 'X-Login'); + if (window.debug) debug('http error', u, 'X-Login'); // Redirect to login page if not signed in document.location = '/login/'; return null; } else if (http.responseText == '' || http.getResponseHeader("Content-Type") == null) { - if (debug) debug('http error', u, 'No-Content'); + if (window.debug) debug('http error', u, 'No-Content'); return null; } try { ls.setItem(u, http.responseText); } catch(e) {} return http.responseText; } - if (debug) debug('http error', u, http.status, http.statusText); + if (window.debug) debug('http error', u, http.status, http.statusText); // Redirect to login page if not signed in if (http.status == 403) document.location = '/login/'; return null; }; -// Load Javascript and CSS -(function() { - var bootjs = document.createElement('script'); - bootjs.type = 'text/javascript'; - bootjs.text = appcache.get('/all-min.js'); - document.head.appendChild(bootjs); - document.head.appendChild(ui.declareCSS(appcache.get('/ui-min.css'))); })(); -</script> +/** + * Load Javascript and CSS. + */ +(function() { -<script type="text/javascript"> +var bootjs = document.createElement('script'); +bootjs.type = 'text/javascript'; +bootjs.text = appcache.get('/all-min.js'); +document.head.appendChild(bootjs); +document.head.appendChild(ui.declareCSS(appcache.get('/ui-min.css'))); + +})(); + +/** + * Redirect to login page if not signed in. + */ +(function() { -// Redirect to login page if not signed in if (document.location.protocol == 'https:' && !hasauthcookie()) document.location = '/login/'; +})(); + </script> </head> -<body class="delayed" onload="onload();"> +<body class="delayed"> <div id="mainbodydiv" class="mainbodydiv"> <div id="headdiv" class="hsection"> <script type="text/javascript"> (function() { + $('headdiv').appendChild(ui.declareScript(appcache.get('/config-min.js'))); + })(); </script> </div> @@ -102,13 +113,16 @@ $('headdiv').appendChild(ui.declareScript(appcache.get('/config-min.js'))); </div> <script type="text/javascript"> +(function() { /** * Get the app name */ var appname = location.pathname.split('/')[1]; -// Set page title +/** + * Set page title. + */ document.title = appname; /** @@ -125,9 +139,9 @@ var apppage = null; /** * Initialize the app HTTP clients. */ -var appWidget = sca.component('AppWidget'); -var pagecomp = sca.reference(appWidget, 'pages'); -var composcomp = sca.reference(appWidget, 'composites'); +var appComp = sca.component('App'); +var pagecomp = sca.reference(appComp, 'pages'); +var composcomp = sca.reference(appComp, 'composites'); var startcomp = sca.httpclient('start', '/' + appname + '/start'); var stopcomp = sca.httpclient('stop', '/' + appname + '/stop'); var timercomp = sca.httpclient('timer', '/' + appname + '/timer'); @@ -964,7 +978,7 @@ function getappcomposite(appname) { } /** - * Document load post processing. + * Initialize the document. */ function onload() { //debug('onload'); @@ -984,6 +998,9 @@ function onload() { return true; } +onload(); + +})(); </script> <div id="footdiv" class="fsection"> |