From a7a8f4f9c9bbbd3bd16605235440dec29f581ad7 Mon Sep 17 00:00:00 2001 From: jsdelfino Date: Mon, 28 May 2012 16:49:36 +0000 Subject: Improvements to the hosted composite management app. Simplify and optimize the Web UI a bit. Add test cases and fix some of the logic in the management components. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1343316 13f79535-47bb-0310-9956-ffa450edef68 --- sca-cpp/trunk/.gitignore | 1 - sca-cpp/trunk/hosting/server/Makefile.am | 14 +- sca-cpp/trunk/hosting/server/accounts.py | 5 +- sca-cpp/trunk/hosting/server/apps.py | 74 +- sca-cpp/trunk/hosting/server/composites.py | 85 +- sca-cpp/trunk/hosting/server/dashboards.py | 63 +- .../trunk/hosting/server/htdocs/account/index.html | 66 +- sca-cpp/trunk/hosting/server/htdocs/app/index.html | 279 ++++--- .../trunk/hosting/server/htdocs/cache-manifest.cmf | 2 +- .../trunk/hosting/server/htdocs/clone/index.html | 87 +-- sca-cpp/trunk/hosting/server/htdocs/config.js | 31 + .../trunk/hosting/server/htdocs/create/index.html | 70 +- .../trunk/hosting/server/htdocs/delete/index.html | 127 +++ .../trunk/hosting/server/htdocs/graph/index.html | 865 +++++++++------------ .../trunk/hosting/server/htdocs/home/index.html | 49 +- sca-cpp/trunk/hosting/server/htdocs/index.html | 214 +++-- .../trunk/hosting/server/htdocs/login/index.html | 173 +++-- .../trunk/hosting/server/htdocs/page/index.html | 572 ++++++++------ .../server/htdocs/proxy/public/oops/index.html | 171 ++++ .../trunk/hosting/server/htdocs/public/config.js | 29 + .../server/htdocs/public/notauth/index.html | 64 +- .../server/htdocs/public/notfound/index.html | 64 +- .../hosting/server/htdocs/public/notyet/index.html | 64 +- .../hosting/server/htdocs/public/oops/index.html | 64 +- .../trunk/hosting/server/htdocs/stats/index.html | 84 +- .../trunk/hosting/server/htdocs/store/index.html | 79 +- sca-cpp/trunk/hosting/server/pages.py | 88 ++- sca-cpp/trunk/hosting/server/server-test | 28 + sca-cpp/trunk/hosting/server/server.composite | 10 + sca-cpp/trunk/hosting/server/ssl-start | 40 +- sca-cpp/trunk/hosting/server/start | 9 +- sca-cpp/trunk/hosting/server/store.py | 86 +- sca-cpp/trunk/hosting/server/test.py | 296 +++++++ sca-cpp/trunk/hosting/server/test/__init__.py | 17 + sca-cpp/trunk/hosting/server/test/cache.py | 48 ++ sca-cpp/trunk/hosting/server/test/property.py | 38 + sca-cpp/trunk/hosting/server/test/reference.py | 38 + sca-cpp/trunk/hosting/server/user.py | 7 +- sca-cpp/trunk/modules/atom/atom-test.cpp | 36 +- sca-cpp/trunk/modules/atom/atom.hpp | 56 +- sca-cpp/trunk/modules/http/conf/mime.types | 4 +- sca-cpp/trunk/modules/http/form-auth-conf | 2 +- sca-cpp/trunk/modules/http/httpd-conf | 36 +- sca-cpp/trunk/modules/http/httpd-ssl-conf | 27 +- sca-cpp/trunk/modules/http/proxy-base-conf | 5 +- sca-cpp/trunk/modules/http/proxy-conf | 6 +- sca-cpp/trunk/modules/http/proxy-ssl-conf | 6 +- sca-cpp/trunk/modules/js/htdocs/atomutil.js | 32 +- sca-cpp/trunk/modules/js/htdocs/component.js | 18 +- sca-cpp/trunk/modules/js/htdocs/ui.css | 520 ++++++++----- sca-cpp/trunk/modules/js/htdocs/ui.js | 169 ++-- sca-cpp/trunk/modules/js/htdocs/util.js | 55 +- 52 files changed, 3282 insertions(+), 1791 deletions(-) create mode 100644 sca-cpp/trunk/hosting/server/htdocs/config.js create mode 100644 sca-cpp/trunk/hosting/server/htdocs/delete/index.html create mode 100644 sca-cpp/trunk/hosting/server/htdocs/proxy/public/oops/index.html create mode 100644 sca-cpp/trunk/hosting/server/htdocs/public/config.js create mode 100755 sca-cpp/trunk/hosting/server/server-test create mode 100755 sca-cpp/trunk/hosting/server/test.py create mode 100644 sca-cpp/trunk/hosting/server/test/__init__.py create mode 100644 sca-cpp/trunk/hosting/server/test/cache.py create mode 100644 sca-cpp/trunk/hosting/server/test/property.py create mode 100644 sca-cpp/trunk/hosting/server/test/reference.py (limited to 'sca-cpp') diff --git a/sca-cpp/trunk/.gitignore b/sca-cpp/trunk/.gitignore index b43b8a7d7a..af24acaaa7 100644 --- a/sca-cpp/trunk/.gitignore +++ b/sca-cpp/trunk/.gitignore @@ -56,7 +56,6 @@ m4/ config.guess config.sub config.status -config.js all.js *-min.html *-min.js diff --git a/sca-cpp/trunk/hosting/server/Makefile.am b/sca-cpp/trunk/hosting/server/Makefile.am index d7a808c5e4..d140895dcd 100644 --- a/sca-cpp/trunk/hosting/server/Makefile.am +++ b/sca-cpp/trunk/hosting/server/Makefile.am @@ -20,16 +20,9 @@ if WANT_PYTHON moddir = $(prefix)/hosting/server dist_mod_SCRIPTS = start stop ssl-start mkapplinks config-backup data-backup -BUILT_SOURCES = htdocs/config.js htdocs/public/config.js -htdocs/config.js: - touch htdocs/config.js +not_minified = htdocs/public/iframe.html htdocs/create/index.html htdocs/page/index.html htdocs/login/index.html htdocs/public/notfound/index.html htdocs/public/oops/index.html htdocs/proxy/public/oops/index.html htdocs/graph/index.html htdocs/public/notauth/index.html htdocs/account/index.html htdocs/home/index.html htdocs/index.html htdocs/public/notyet/index.html htdocs/clone/index.html htdocs/delete/index.html htdocs/stats/index.html htdocs/app/index.html htdocs/store/index.html htdocs/config.js htdocs/public/config.js -htdocs/public/config.js: - touch htdocs/public/config.js - -not_minified = htdocs/public/iframe.html htdocs/create/index.html htdocs/page/index.html htdocs/login/index.html htdocs/public/notfound/index.html htdocs/public/oops/index.html htdocs/graph/index.html htdocs/public/notauth/index.html htdocs/account/index.html htdocs/home/index.html htdocs/index.html htdocs/public/notyet/index.html htdocs/clone/index.html htdocs/stats/index.html htdocs/app/index.html htdocs/store/index.html htdocs/config.js htdocs/public/config.js - -minified = htdocs/public/iframe-min.html htdocs/create/index-min.html htdocs/page/index-min.html htdocs/login/index-min.html htdocs/public/notfound/index-min.html htdocs/public/oops/index-min.html htdocs/graph/index-min.html htdocs/public/notauth/index-min.html htdocs/account/index-min.html htdocs/home/index-min.html htdocs/index-min.html htdocs/public/notyet/index-min.html htdocs/clone/index-min.html htdocs/stats/index-min.html htdocs/app/index-min.html htdocs/store/index-min.html htdocs/config-min.js htdocs/public/config-min.js +minified = htdocs/public/iframe-min.html htdocs/create/index-min.html htdocs/page/index-min.html htdocs/login/index-min.html htdocs/public/notfound/index-min.html htdocs/public/oops/index-min.html htdocs/proxy/public/oops/index-min.html htdocs/graph/index-min.html htdocs/public/notauth/index-min.html htdocs/account/index-min.html htdocs/home/index-min.html htdocs/index-min.html htdocs/public/notyet/index-min.html htdocs/clone/index-min.html htdocs/delete/index-min.html htdocs/stats/index-min.html htdocs/app/index-min.html htdocs/store/index-min.html htdocs/config-min.js htdocs/public/config-min.js resources = server.composite *.py htdocs/*.cmf htdocs/*.ico htdocs/home/*.png htdocs/app/*.cmf htdocs/home/*.b64 htdocs/*.txt htdocs/public/*.png htdocs/public/*.b64 data/palettes/*/palette.composite data/accounts/*/*.account data/apps/*/app.composite data/apps/*/app.stats data/apps/*/htdocs/app.html data/dashboards/*/user.apps data/store/*/store.apps ${not_minified} ${minified} @@ -45,4 +38,7 @@ SUFFIXES = -min.html -min.js CLEANFILES = ${minified} +dist_noinst_SCRIPTS = server-test test.py +TESTS = server-test + endif diff --git a/sca-cpp/trunk/hosting/server/accounts.py b/sca-cpp/trunk/hosting/server/accounts.py index 4415c69e62..3587f5fb65 100644 --- a/sca-cpp/trunk/hosting/server/accounts.py +++ b/sca-cpp/trunk/hosting/server/accounts.py @@ -16,17 +16,18 @@ # under the License. # Accounts collection implementation +from time import strftime from util import * # Convert a particular user id to an account id def accountid(user): - return ("accounts", user.id(), "user.account") + return ('accounts', user.get(()), 'user.account') # Get the current user's account def get(id, user, cache): account = cache.get(accountid(user)) if isNil(account) or account is None: - return () + return (("'entry", ("'title", user.get(())), ("'id", user.get(())), ("'updated", strftime('%b %d, %Y'))),) return account # Update the user's account diff --git a/sca-cpp/trunk/hosting/server/apps.py b/sca-cpp/trunk/hosting/server/apps.py index 40d1da7dce..064701a7df 100644 --- a/sca-cpp/trunk/hosting/server/apps.py +++ b/sca-cpp/trunk/hosting/server/apps.py @@ -16,42 +16,96 @@ # under the License. # App collection implementation -import os +from time import strftime from util import * +from sys import debug # Convert an id to an app id def appid(id): return ("apps", car(id), "app.stats") # Put an app into the apps db -def put(id, app, cache, store, composites, pages): - eid = cadr(caddr(car(app))) - appentry = (("'entry", cadr(car(app)), ("'id", car(id))),) +def put(id, app, user, cache, dashboard, store, composites, pages): + debug('apps.py::put::id', id) + debug('apps.py::put::app', app) - # Update app in apps db + # Update an app + eid = cadr(assoc("'id", car(app))) if car(id) == eid: + # Check app author + eapp = cache.get(appid(id)); + if (not (isNil(eapp) or eapp is None)) and (cadr(assoc("'author", car(eapp))) != user.get(())): + debug('apps.py::put', 'different author', cadr(assoc("'author", car(eapp)))) + return False + + # Update the app in the apps db + appentry = (("'entry", assoc("'title", car(app)), ("'id", car(id)), ("'author", user.get(())), ("'updated", strftime('%b %d, %Y')), assoc("'content", car(app))),) + debug('apps.py::put::appentry', appentry) cache.put(appid(id), appentry) + dashboard.put(id, appentry) + + # Create new page and composite if necessary + if isNil(eapp) or eapp is None: + comp = (("'entry", ("'title", car(id)), ("'id", car(id))),) + composites.put(id, comp); + page = (("'entry", ("'title", car(id)), ("'id", car(id))),) + pages.put(id, comp); + return True return True - # Clone an app's composite and page + # Check app author + eapp = cache.get(appid(id)); + if (not (isNil(eapp) or eapp is None)) and (cadr(assoc("'author", car(eapp))) != user.get(())): + debug('apps.py::put', 'different author', cadr(assoc("'author", car(eapp)))) + return False + + # Clone an app + appentry = (("'entry", assoc("'title", car(app)), ("'id", car(id)), ("'author", user.get(())), ("'updated", strftime('%b %d, %Y')), assoc("'content", car(app))),) + debug('apps.py::put::appentry', appentry) cache.put(appid(id), appentry) composites.put(id, composites.get((eid,))) pages.put(id, pages.get((eid,))) + dashboard.put(id, appentry) return True # Get an app from the apps db -def get(id, cache, store, composites, pages): +def get(id, user, cache, dashboard, store, composites, pages): + debug('apps.py::get::id', id) if isNil(id): return (("'feed", ("'title", "Apps"), ("'id", "apps")),) + + # Get the requested app app = cache.get(appid(id)); if isNil(app) or app is None: - return (("'entry", ("'title", car(id)), ("'id", car(id))),) + debug('apps.py::get', 'app not found', id) + + # Return a default new app + return (("'entry", ("'title", car(id)), ("'id", car(id)), ("'author", user.get(())), ("'updated", strftime('%b %d, %Y')), ("'content", ("'stats", ("'description", '')))),) + + # Return the app + debug('apps.py::get::app', app) return app # Delete an app from the apps db -def delete(id, cache, store, composites, pages): - cache.delete(appid(id)) +def delete(id, user, cache, dashboard, store, composites, pages): + debug('apps.py::delete::id', id) + + # Get the requested app + app = cache.get(appid(id)); + if isNil(app) or app is None: + debug('apps.py::delete', 'app not found', id) + return False + + # Check app author + author = cadr(assoc("'author", car(app))) + if author != user.get(()): + debug('apps.py::delete', 'different author', author) + return False + + # Delete the app, its composite and page + dashboard.delete(id) composites.delete(id) pages.delete(id) + cache.delete(appid(id)) return True diff --git a/sca-cpp/trunk/hosting/server/composites.py b/sca-cpp/trunk/hosting/server/composites.py index 2b59ebdab4..970bc98a5c 100644 --- a/sca-cpp/trunk/hosting/server/composites.py +++ b/sca-cpp/trunk/hosting/server/composites.py @@ -16,29 +16,82 @@ # under the License. # App composites collection implementation +from time import strftime from util import * +from sys import debug -# Convert an id to an app id -def appid(id): +# Convert an id to a composite id +def compid(id): return ("apps", car(id), "app.composite") -# Put an app into the apps db -def put(id, app, cache): - comp = cdr(cadddr(car(app))) - cache.put(appid(id), comp) - return True +# Put a composite into the composite db +def put(id, comp, user, cache, apps): + debug('composites.py::put::id', id) + debug('composites.py::put::comp', comp) -# Get an app from the apps db -def get(id, cache): + # Get the requested app + app = apps.get(id); + if isNil(app) or app is None: + debug('composites.py::put', 'app not found', id) + return False + + # Check app author + author = cadr(assoc("'author", car(app))) + if author != user.get(()): + debug('composites.py::put', 'different author', author) + return False + + # Update the composite in the composite db + compentry = (("'entry", assoc("'title", car(app)), ("'id", car(id)), ("'author", user.get(())), ("'updated", strftime('%b %d, %Y')), assoc("'content", car(comp))),) + debug('composites.py::put::compentry', compentry) + return cache.put(compid(id), compentry) + +# Get a composite from the composite db +def get(id, user, cache, apps): + debug('composites.py::get::id', id) if isNil(id): return (("'feed", ("'title", "Composites"), ("'id", "composites")),) - app = cache.get(appid(id)); + + # Get the requested app + app = apps.get(id) + if isNil(app) or app is None: + debug('composites.py::get', 'app not found', id) + + # Return a default new composite + return (("'entry", ("'title", car(id)), ("'id", car(id)), ("'author", user.get(())), ("'updated", strftime('%b %d, %Y'))),) + + # Get the requested composite + comp = cache.get(compid(id)); + if isNil(comp) or comp is None: + debug('composites.py::get', 'composite not found', id) + + # Return a default new composite + return (("'entry", ("'title", car(id)), ("'id", car(id)), assoc("'author", car(app)), assoc("'updated", car(app))),) + + # Return the composite + def updated(u): + return assoc("'updated", car(app)) if isNil(u) or u is None else u + + compentry = (("'entry", assoc("'title", car(app)), ("'id", car(id)), assoc("'author", car(app)), updated(assoc("'updated", car(comp))), assoc("'content", car(comp))),) + debug('composites.py::get::compentry', compentry) + return compentry + +# Delete a composite from the composite db +def delete(id, user, cache, apps): + debug('composites.py::delete::id', id) + + # Get the requested app + app = apps.get(id); if isNil(app) or app is None: - return (("'entry", ("'title", car(id)), ("'id", car(id))),) - return (("'entry", ("'title", car(id)), ("'id", car(id)), ("'content", car(app))),) + debug('composites.py::delete', 'app not found', id) + return False + + # Check app author + author = cadr(assoc("'author", car(app))) + if author != user.get(()): + debug('composites.py::delete', 'different author', author) + return False -# Delete an app from the apps db -def delete(id, cache): - cache.delete(appid(id)) - return True + # Delete the composite + return cache.delete(compid(id)) diff --git a/sca-cpp/trunk/hosting/server/dashboards.py b/sca-cpp/trunk/hosting/server/dashboards.py index c7ea066d4e..d6281d0454 100644 --- a/sca-cpp/trunk/hosting/server/dashboards.py +++ b/sca-cpp/trunk/hosting/server/dashboards.py @@ -17,68 +17,89 @@ # Dashboards collection implementation from util import * +from sys import debug # Convert a particular user id to a dashboard id def dashboardid(user): - return ("dashboards", user.id(), "user.apps") + return ("dashboards", user.get(()), "user.apps") # Get a dashboard from the cache def getdashboard(id, cache): + debug('dashboards.py::getdashboard::id', id) val = cache.get(id) if isNil(val) or val is None: return () - return cdddr(car(val)) + dashboard = cdddr(car(val)) + if not isNil(dashboard) and isList(car(cadr(car(dashboard)))): + # Expand list of entries + edashboard = tuple(map(lambda e: cons("'entry", e), cadr(car(dashboard)))) + debug('dashboards.py::getdashboard::edashboard', edashboard) + return edashboard + + debug('dashboards.py::getdashboard::dashboard', dashboard) + return dashboard # Put a dashboard into the cache def putdashboard(id, dashboard, cache): + debug('dashboards.py::putdashboard::id', id) + debug('dashboards.py::putdashboard::dashboard', dashboard) val = ((("'feed", ("'title", "Your Apps"), ("'id", cadr(id))) + dashboard),) + return cache.put(id, val) # Put an app into the user's dashboard def put(id, app, user, cache, apps): - def putapp(app, dashboard): + debug('dashboards.py::put::id', id) + debug('dashboards.py::put::app', app) + + def putapp(id, app, dashboard): if isNil(dashboard): return app - if cadr(caddr(car(app))) == cadr(caddr(car(dashboard))): + if car(id) == cadr(assoc("'id", car(dashboard))): return cons(car(app), cdr(dashboard)) - return cons(car(dashboard), putapp(app, cdr(dashboard))) + return cons(car(dashboard), putapp(id, app, cdr(dashboard))) - appentry = (("'entry", cadr(car(app)), ("'id", car(id))),) - dashboard = putapp(appentry, getdashboard(dashboardid(user), cache)) - putdashboard(dashboardid(user), dashboard, cache) + appentry = (("'entry", assoc("'title", car(app)), ("'id", car(id)), ("'author", user.get(())), assoc("'updated", car(app)), assoc("'content", car(app))),) + debug('dashboards.py::put::appentry', appentry) - # Update app in app repository - apps.put(id, app); - return True + dashboard = putapp(id, appentry, getdashboard(dashboardid(user), cache)) + return putdashboard(dashboardid(user), dashboard, cache) # Get apps from the user's dashboard def get(id, user, cache, apps): + debug('dashboards.py::get::id', id) + def findapp(id, dashboard): if isNil(dashboard): return None - if car(id) == cadr(caddr(car(dashboard))): + if car(id) == cadr(assoc("'id", car(dashboard))): return (car(dashboard),) return findapp(id, cdr(dashboard)) if isNil(id): - return ((("'feed", ("'title", "Your Apps"), ("'id", user.id())) + getdashboard(dashboardid(user), cache)),) - return findapp(id, getdashboard(dashboardid(user), cache)) + dashboard = ((("'feed", ("'title", "Your Apps"), ("'id", user.get(()))) + getdashboard(dashboardid(user), cache)),) + debug('dashboards.py::get::dashboard', dashboard) + return dashboard + + app = findapp(id, getdashboard(dashboardid(user), cache)) + debug('dashboards.py::get::app', app) + return app # Delete apps from the user's dashboard def delete(id, user, cache, apps): + debug('dashboards.py::delete::id', id) if isNil(id): return cache.delete(dashboardid(user)) def deleteapp(id, dashboard): if isNil(dashboard): return () - if car(id) == cadr(caddr(car(dashboard))): + if car(id) == cadr(assoc("'id", car(dashboard))): return cdr(dashboard) return cons(car(dashboard), deleteapp(id, cdr(dashboard))) - dashboard = deleteapp(id, getdashboard(dashboardid(user), cache)) - putdashboard(dashboardid(user), dashboard, cache) - - # Delete app from app repository - apps.delete(id); - return True + dashboard = getdashboard(dashboardid(user), cache) + deleted = deleteapp(id, dashboard) + if deleted == dashboard: + return False + return putdashboard(dashboardid(user), deleted, cache) diff --git a/sca-cpp/trunk/hosting/server/htdocs/account/index.html b/sca-cpp/trunk/hosting/server/htdocs/account/index.html index 291f6dea1c..dce34d2ef3 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/account/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/account/index.html @@ -17,29 +17,18 @@ * specific language governing permissions and limitations * under the License. --> -
+
- - - - - -

- - - - - -
Account
+
- + - +
Photo:
Name:
Description:

@@ -50,11 +39,11 @@ - - - - - + + + + +

@@ -65,28 +54,31 @@ - - - - - - - - - - + + + + + + + + + +
+
+ + +
diff --git a/sca-cpp/trunk/hosting/server/htdocs/graph/index.html b/sca-cpp/trunk/hosting/server/htdocs/graph/index.html index 34b7ead90e..6f73aec5ec 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/graph/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/graph/index.html @@ -17,42 +17,11 @@ * specific language governing permissions and limitations * under the License. --> -
+
- - - - - -

- - - - - -
- - - - - - - -
-- - -c - -+ - -> - - -
- -
- +
+
+
diff --git a/sca-cpp/trunk/hosting/server/htdocs/home/index.html b/sca-cpp/trunk/hosting/server/htdocs/home/index.html index 6fb9b558bf..914eb1df00 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/home/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/home/index.html @@ -17,25 +17,22 @@ * specific language governing permissions and limitations * under the License. --> -
+
- - - - - -

+
-
+
+
+
-
- -
+ - +

-
Requires Safari 5+, Chrome 11+, Firefox 4+, IE 9+
+
Requires Safari 5+, Chrome 11+, Firefox 4+, IE 9+
@@ -43,23 +40,25 @@ // Set page titles document.title = ui.windowtitle(location.hostname); -$('h1').innerHTML = ui.hometitle(location.hostname); +$('viewhead').innerHTML = '' + config.pagetitle + ''; +$('hometitle').innerHTML = config.hometitle; -$('maintitle').innerHTML = isNil(config.maintitle)? 'Simple App Builder' : config.maintitle; $('getstarted').onclick = function() { return ui.navigate('/#view=store', '_view'); }; -// Display the main diagram -var diagram = $('diagram'); -diagram.style.background = 'url(\'' + ui.b64img(appcache.get('/home/home.b64')) + '\')'; -var bgpos = 0; -setInterval(function() { - bgpos = bgpos -280; - if (bgpos == -2800) - bgpos = 0; - diagram.style.backgroundPosition = '0px ' + ui.pixpos(bgpos); -}, 2000); +// Display animation +var anim = $('homeanimation'); +if (!isNil(anim)) { + anim.style.background = 'url(\'' + ui.b64img(appcache.get('/home/home.b64')) + '\')'; + var bgpos = 0; + setInterval(function() { + bgpos = bgpos -280; + if (bgpos == -2800) + bgpos = 0; + anim.style.backgroundPosition = '0px ' + ui.pixpos(bgpos); + }, 2000); +} showStatus(defaultStatus()); diff --git a/sca-cpp/trunk/hosting/server/htdocs/index.html b/sca-cpp/trunk/hosting/server/htdocs/index.html index 468461cedc..b46141919d 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/index.html @@ -37,28 +37,31 @@ appcache.get = function(uri) { var u = h == -1? uri : uri.substring(0, h); // Get resource from local storage first - var item = localStorage.getItem(u); + var ls = window.lstorage || localStorage; + var item = null; + try { item = ls.getItem(u); } catch(e) {} if (item != null && item != '') return item; // Get resource from network var http = new XMLHttpRequest(); http.open("GET", u, false); + http.setRequestHeader("Accept", "*/*"); http.send(null); if (http.status == 200) { if (http.getResponseHeader("X-Login") != null) { - if (log) log('http error', u, 'X-Login'); + if (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 (log) log('http error', u, 'No-Content'); + if (debug) debug('http error', u, 'No-Content'); return null; } - localStorage.setItem(u, http.responseText); + try { ls.setItem(u, http.responseText); } catch(e) {} return http.responseText; } - if (log) log('http error', u, http.status, http.statusText); + if (debug) debug('http error', u, http.status, http.statusText); // Redirect to login page if not signed in if (http.status == 403) document.location = '/login/'; @@ -72,6 +75,10 @@ appcache.get = function(uri) { bootjs.text = appcache.get('/all-min.js'); document.head.appendChild(bootjs); document.head.appendChild(ui.declareCSS(appcache.get('/ui-min.css'))); + + // Disable cache for testing + lstorage.enabled = false; + })(); @@ -84,7 +91,7 @@ if (document.location.protocol == 'https:' && !hasauthcookie()) -
+
- + + - +
+
-
-
+ -
+
+ +
+ +
-

Sign in

+ + -
- - - -
Sign in with your Google account (using OpenID)
-
+
+
+Sign in +
-
- - - -
Sign in with your Facebook account (using OAuth)
-
+
+
+
-
- - - -
Sign in with your Google account (using OAuth)
+ +

Sign in with your Facebook account

+

-
- - - - - -
Sign in with your user id and password
User id:
Password:
-

- + +

Sign in with your Google account

+

-
- + +

+

+

+

+
+
@@ -78,7 +125,37 @@
+
+
+
+ diff --git a/sca-cpp/trunk/hosting/server/htdocs/proxy/public/oops/index.html b/sca-cpp/trunk/hosting/server/htdocs/proxy/public/oops/index.html new file mode 100644 index 0000000000..9c795bf843 --- /dev/null +++ b/sca-cpp/trunk/hosting/server/htdocs/proxy/public/oops/index.html @@ -0,0 +1,171 @@ + + + + +Oops + + + + + + + +
+ +
+ +
+ + + + +
+
+ +
+
+
+ +
+
Oops, something went wrong...
+ +
+
+
+ + + +
+
+ +
+ + diff --git a/sca-cpp/trunk/hosting/server/htdocs/public/config.js b/sca-cpp/trunk/hosting/server/htdocs/public/config.js new file mode 100644 index 0000000000..41a3bf6771 --- /dev/null +++ b/sca-cpp/trunk/hosting/server/htdocs/public/config.js @@ -0,0 +1,29 @@ +/* + * 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. + */ + +if (isNil(config)) + config = {}; + +/** + * UI configuration. + */ +config.windowtitle = 'App Builder' +config.pagetitle = 'App Builder'; +config.loginprompt = 'Sign in with your userid and password'; + 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 0c0435d8a7..959c6be327 100644 --- a/sca-cpp/trunk/hosting/server/htdocs/public/notauth/index.html +++ b/sca-cpp/trunk/hosting/server/htdocs/public/notauth/index.html @@ -36,26 +36,29 @@ appcache.get = function(uri) { var u = h == -1? uri : uri.substring(0, h); // Get resource from local storage first - var item = localStorage.getItem(u); + var ls = window.lstorage || localStorage; + var item = null; + try { item = ls.getItem(u); } catch(e) {} if (item != null && item != '') return item; // Get resource from network var http = new XMLHttpRequest(); http.open("GET", u, false); + http.setRequestHeader("Accept", "*/*"); http.send(null); if (http.status == 200) { if (http.getResponseHeader("X-Login") != null) { - if (log) log('http error', u, 'X-Login'); + if (debug) debug('http error', u, 'X-Login'); return null; } else if (http.responseText == '' || http.getResponseHeader("Content-Type") == null) { - if (log) log('http error', u, 'No-Content'); + if (debug) debug('http error', u, 'No-Content'); return null; } - localStorage.setItem(u, http.responseText); + try { ls.setItem(u, http.responseText); } catch(e) {} return http.responseText; } - if (log) log('http error', u, http.status, http.statusText); + if (debug) debug('http error', u, http.status, http.statusText); return null; }; @@ -71,7 +74,7 @@ appcache.get = function(uri) { -
+
- + + -
+
+
- - -

+
+
+
-
+
Sorry, you're not authorized to view this page.
-
+
+
-
+
- + + -
+
+
- - -

+
+
+
-
+
Sorry, that page was not found.
You may have clicked an expired link or mistyped the address.
-
+
+
-
+
- + + -
+
+
- - -

+
+
+
-
+
Sorry, that page is still under construction.
Please check back later.
-
+
+
-
+
- + + -
+
+
- - -

+
+
+
-
+
Oops, something went wrong...
-
+
+