summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/hosting/server/htdocs/app
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2013-01-03 07:41:53 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2013-01-03 07:41:53 +0000
commitd7069b5a2e7859ab14c5a909d5e5fc6bc84b80cb (patch)
treed8027520fb22c176f54e860c0d2ebd000b1c457f /sca-cpp/trunk/hosting/server/htdocs/app
parent9e1b9e73145e00ea591bd1e0e9777625bad66dc9 (diff)
Improve app hosting management app, restructure UI and refactor REST services and data model to use an SQL database.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1428193 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/cache-template.cmf (renamed from sca-cpp/trunk/hosting/server/htdocs/app/cache-template.cmf)2
-rw-r--r--sca-cpp/trunk/hosting/server/htdocs/app/index.html102
2 files changed, 48 insertions, 56 deletions
diff --git a/sca-cpp/trunk/hosting/server/htdocs/app/cache-template.cmf b/sca-cpp/trunk/hosting/server/htdocs/app/cache/cache-template.cmf
index 5881cf83dd..40da327179 100644
--- a/sca-cpp/trunk/hosting/server/htdocs/app/cache-template.cmf
+++ b/sca-cpp/trunk/hosting/server/htdocs/app/cache/cache-template.cmf
@@ -4,7 +4,7 @@ CACHE MANIFEST
# App resources
/favicon.ico
-/public/iframe-min.html
+/login/
/public/img.png
/public/notauth/
/public/notfound/
diff --git a/sca-cpp/trunk/hosting/server/htdocs/app/index.html b/sca-cpp/trunk/hosting/server/htdocs/app/index.html
index cddf4fb477..cd033118a3 100644
--- a/sca-cpp/trunk/hosting/server/htdocs/app/index.html
+++ b/sca-cpp/trunk/hosting/server/htdocs/app/index.html
@@ -17,37 +17,51 @@
* specific language governing permissions and limitations
* under the License.
-->
-<html manifest="cache-manifest.cmf">
+<html manifest="cache/cache-manifest.cmf">
<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></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" href="/public/touchicon.png"/>
+-->
+<link rel="apple-touch-icon-precomposed" href="/public/touchicon.png"/>
<base href="/"/>
<script type="text/javascript">
-(function() {
+try {
+
+(function apphead() {
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) {}
+ try { item = ls.getItem('ui.r.' + u); } catch(e) {}
if (item != null && item != '')
return item;
// 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", "*/*");
+ if (mode == 'remote')
+ http.setRequestHeader("If-Modified-Since", "Thu, 1 Jan 1970 00:00:00 GMT");
http.send(null);
if (http.status == 200) {
if (http.getResponseHeader("X-Login") != null) {
@@ -59,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);
@@ -74,46 +88,32 @@ appcache.get = function(uri) {
/**
* Load Javascript and CSS.
*/
-(function() {
+(function appboot() {
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() {
-
-if (document.location.protocol == 'https:' && !hasauthcookie())
- document.location = '/login/';
+bootjs.text = 'try {\n' + appcache.get('/all-min.js') + '\n' + appcache.get('/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('/config-min.js')));
-
-})();
-</script>
-</div>
<div id="content">
</div>
<script type="text/javascript">
-(function() {
+try {
+
+(function appbody() {
/**
* Get the app name
@@ -186,7 +186,7 @@ applicationCache.addEventListener('updateready', function(e) {
applicationCache.addEventListener('cached', function(e) {
//debug('appcache cached', e);
map(function(res) {
- appcache.get(res[0]);
+ appcache.get(res[0], 'remote');
}, appresources);
}, false);
@@ -316,7 +316,8 @@ function setwidgetvalue(e, dv) {
var nesheet = document.createElement('style');
nesheet.id = 'style_' + e.id;
nesheet.type = 'text/css';
- document.head.appendChild(nesheet);
+ var head = document.getElementsByTagName('head')[0];
+ head.appendChild(nesheet);
nesheet.innerHTML = s;
} else {
esheet.innerHTML = s;
@@ -331,9 +332,9 @@ function setwidgetvalue(e, dv) {
// Restart current animation if necessary
if (!isNil(aname) && ce.style.webkitAnimationName == aname) {
ce.style.webkitAnimationName = '';
- setTimeout(function() {
+ ui.async(function restartanimation() {
ce.style.webkitAnimationName = aname;
- }, 0);
+ });
}
return a;
}
@@ -930,10 +931,7 @@ function setupLocationHandler() {
*/
document.body.onorientationchange = function(e) {
//debug('onorientationchange');
-
- // Scroll to the top and hide the address bar
- window.scrollTo(0, 0);
-
+ ui.onorientationchange(e);
return true;
};
@@ -980,14 +978,9 @@ function getappcomposite(appname) {
/**
* Initialize the document.
*/
-function onload() {
+window.onload = function() {
//debug('onload');
-
- // Scroll to the top and hide the address bar
- window.scrollTo(0, 0);
-
- // Show the page
- document.body.style.visibility = 'visible';
+ ui.onload();
// Initialize the app composite
getappcomposite(appname);
@@ -996,17 +989,16 @@ function onload() {
getapppage(appname);
return true;
-}
-
-onload();
+};
})();
-</script>
-<div id="footdiv" class="fsection">
-</div>
+} catch(e) {
+ debug(e.stack);
+ throw e;
+}
+</script>
-</div>
</body>
</html>