Modified: tuscany/sca-cpp/trunk/modules/js/htdocs/component.js URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/js/htdocs/component.js?rev=1154447&r1=1154446&r2=1154447&view=diff ============================================================================== --- tuscany/sca-cpp/trunk/modules/js/htdocs/component.js (original) +++ tuscany/sca-cpp/trunk/modules/js/htdocs/component.js Sat Aug 6 05:59:32 2011 @@ -161,7 +161,7 @@ HTTPBindingClient.jsonResult = function( // Get the charset function httpCharset(http) { try { - var contentType = http.getResponseHeader("Content-type"); + var contentType = http.getResponseHeader("Content-Type"); var parts = contentType.split(/\s*;\s*/); for (var i = 0; i < parts.length; i++) { if (parts[i].substring(0, 8) == "charset=") @@ -190,7 +190,7 @@ HTTPBindingClient.prototype.jsonApply = var http = HTTPBindingClient.getHTTPRequest(); var hascb = req.cb? true : false; http.open("POST", this.uri, hascb); - http.setRequestHeader("Content-type", "application/json-rpc"); + http.setRequestHeader("Content-Type", "application/json-rpc"); // Construct call back if we have one if(hascb) { @@ -201,12 +201,18 @@ HTTPBindingClient.prototype.jsonApply = var res = null; try { res = HTTPBindingClient.jsonResult(http); + try { + req.cb(res); + } catch(cbe) {} } catch(e) { - req.cb(null, e); + try { + req.cb(null, e); + } catch(cbe) {} } - req.cb(res); } else - req.cb(null, HTTPBindingClient.Exception(http.status, http.statusText)); + try { + req.cb(null, HTTPBindingClient.Exception(http.status, http.statusText)); + } catch(cbe) {} } }; @@ -222,24 +228,137 @@ HTTPBindingClient.prototype.jsonApply = throw new HTTPBindingClient.Exception(http.status, http.statusText); }; + /** * REST ATOMPub GET method. */ HTTPBindingClient.prototype.get = function(id, cb) { + var u = this.uri + '/' + id; + var hascb = cb? true : false; + + // Get from local storage first + var item = localStorage.getItem(u); + //log('localStorage.getItem', u, item); + if (item != null && item != '') { + if (!hascb) + return item; + + // Pass local result to callback + try { + cb(item); + } catch (cbe) {} + } + // Connect to the service var http = HTTPBindingClient.getHTTPRequest(); + http.open("GET", u, hascb); + + // Construct call back if we have one + if (hascb) { + http.onreadystatechange = function() { + //log('readystate', http.readyState, 'status', http.status, 'headers', http.getAllResponseHeaders()); + if (http.readyState == 4) { + // Pass result if different from local result + if (http.status == 200) { + + if (http.getResponseHeader("X-Login") != null) { + // Detect redirect to a login page + try { + cb(null, new HTTPBindingClient.Exception(403, 'X-Login')); + } catch(cbe) {} + + } else if (http.responseText == '' || http.getResponseHeader("Content-Type") == null) { + // Report empty response + try { + cb(null, new HTTPBindingClient.Exception(403, 'No-Content')); + } catch(cbe) {} + + } else { + if (item == null || http.responseText != item) { + // Store retrieved entry in local storage + if (http.responseText != null) { + //log('localStorage.setItem', u, http.responseText); + localStorage.setItem(u, http.responseText); + } + try { + cb(http.responseText); + } catch(cbe) {} + } + } + } + else { + // Pass exception if we didn't have a local result + if (item == null) { + try { + cb(null, new HTTPBindingClient.Exception(http.status, http.statusText)); + } catch(cbe) {} + } + } + } + }; + + // Send the request + http.send(null); + return true; + } + + // Send the request and return the result or exception + http.send(null); + if (http.status == 200) { + if (http.getResponseHeader("X-Login") != null) { + + // Detect redirect to a login page + throw new HTTPBindingClient.Exception(403, 'X-Login'); + + } else if (http.responseText == '' || http.getResponseHeader("Content-Type") == null) { + + // Report empty response + throw new HTTPBindingClient.Exception(403, 'No-Content'); + } + return http.responseText; + } + throw new HTTPBindingClient.Exception(http.status, http.statusText); +}; + +/** + * REST ATOMPub GET method, does not use the local cache. + */ +HTTPBindingClient.prototype.getnocache = function(id, cb) { + var u = this.uri + '/' + id; var hascb = cb? true : false; - http.open("GET", this.uri + '/' + id, hascb); + + // Connect to the service + var http = HTTPBindingClient.getHTTPRequest(); + http.open("GET", u, hascb); // Construct call back if we have one if (hascb) { http.onreadystatechange = function() { if (http.readyState == 4) { - // Pass the result or exception - if (http.status == 200) - cb(http.responseText); - else - cb(null, new HTTPBindingClient.Exception(http.status, http.statusText)); + if (http.status == 200) { + + if (http.getResponseHeader("X-Login") != null) { + // Detect redirect to a login page + try { + return cb(null, new HTTPBindingClient.Exception(403, 'X-Login')); + } catch(cbe) {} + + } else if (http.responseText == '' || http.getResponseHeader("Content-Type") == null) { + // Report empty response + try { + return cb(null, new HTTPBindingClient.Exception(403, 'No-Content')); + } catch(cbe) {} + + } else { + try { + cb(http.responseText); + } catch(cbe) {} + } + } else { + try { + cb(null, new HTTPBindingClient.Exception(http.status, http.statusText)); + } catch(cbe) {} + } } }; @@ -250,8 +369,19 @@ HTTPBindingClient.prototype.get = functi // Send the request and return the result or exception http.send(null); - if (http.status == 200) + if (http.status == 200) { + if (http.getResponseHeader("X-Login") != null) { + + // Detect redirect to a login page + throw new HTTPBindingClient.Exception(403, 'X-Login'); + + } else if (http.responseText == '' || http.getResponseHeader("Content-Type") == null) { + + // Report empty response + throw new HTTPBindingClient.Exception(403, 'No-Content'); + } return http.responseText; + } throw new HTTPBindingClient.Exception(http.status, http.statusText); }; @@ -259,6 +389,7 @@ HTTPBindingClient.prototype.get = functi * REST ATOMPub POST method. */ HTTPBindingClient.prototype.post = function (entry, cb) { + // Connect to the service var http = HTTPBindingClient.getHTTPRequest(); var hascb = cb? true : false; @@ -270,10 +401,16 @@ HTTPBindingClient.prototype.post = funct http.onreadystatechange = function() { // Pass the result or exception if (http.readyState == 4) { - if (http.status == 201) - cb(http.responseText); - else - cb(null, new HTTPBindingClient.Exception(http.status, http.statusText)); + if (http.status == 201) { + try { + cb(http.responseText); + } catch(cbe) {} + } + else { + try { + cb(null, new HTTPBindingClient.Exception(http.status, http.statusText)); + } catch(cbe) {} + } } }; // Send the request @@ -292,10 +429,16 @@ HTTPBindingClient.prototype.post = funct * REST ATOMPub PUT method. */ HTTPBindingClient.prototype.put = function (id, entry, cb) { + var u = this.uri + '/' + id; + + // Update local storage + localStorage.setItem(u, entry); + //log('localStorage.setItem', u, entry); + // Connect to the service var http = HTTPBindingClient.getHTTPRequest(); var hascb = cb? true : false; - http.open("PUT", this.uri + '/' + id, hascb); + http.open("PUT", u, hascb); http.setRequestHeader("Content-Type", "application/atom+xml"); // Construct call back if we have one @@ -303,10 +446,15 @@ HTTPBindingClient.prototype.put = functi http.onreadystatechange = function() { if (http.readyState == 4) { // Pass any exception - if (http.status == 200) - cb(); - else - cb(new HTTPBindingClient.Exception(http.status, http.statusText)); + if (http.status == 200) { + try { + cb(); + } catch(cbe) {} + } else { + try { + cb(new HTTPBindingClient.Exception(http.status, http.statusText)); + } catch(cbe) {} + } } }; // Send the request @@ -325,20 +473,32 @@ HTTPBindingClient.prototype.put = functi * REST ATOMPub DELETE method. */ HTTPBindingClient.prototype.del = function (id, cb) { + var u = this.uri + '/' + id; + + // Update local storage + localStorage.removeItem(u); + //log('localStorage.removeItem', u); + // Connect to the service var http = HTTPBindingClient.getHTTPRequest(); var hascb = cb? true : false; - http.open("DELETE", this.uri + '/' + id, hascb); + http.open("DELETE", u, hascb); // Construct call back if we have one if (cb) { http.onreadystatechange = function() { if (http.readyState == 4) { // Pass any exception - if (http.status == 200) - cb(); - else - cb(new HTTPBindingClient.Exception(http.status, http.statusText)); + if (http.status == 200) { + try { + cb(); + } catch(cbe) {} + } + else { + try { + cb(new HTTPBindingClient.Exception(http.status, http.statusText)); + } catch(cbe) {} + } } }; // Send the request
Modified: tuscany/sca-cpp/trunk/modules/js/htdocs/elemutil.js URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/js/htdocs/elemutil.js?rev=1154447&r1=1154446&r2=1154447&view=diff ============================================================================== --- tuscany/sca-cpp/trunk/modules/js/htdocs/elemutil.js (original) +++ tuscany/sca-cpp/trunk/modules/js/htdocs/elemutil.js Sat Aug 6 05:59:32 2011 @@ -29,40 +29,30 @@ var atsign = "'@" * Return true if a value is an element. */ function isElement(v) { - if (!isList(v) || isNil(v) || car(v) != element) - return false; - return true; + return (!(!isList(v) || isNil(v) || car(v) != element)); } /** * Return true if a value is an attribute. */ function isAttribute(v) { - if (!isList(v) || isNil(v) || car(v) != attribute) - return false; - return true; + return (!(!isList(v) || isNil(v) || car(v) != attribute)); } /** * Return the name of an attribute. */ -function attributeName(l) { - return cadr(l); -} +attributeName = cadr; /** * Return the value of an attribute. */ -function attributeValue(l) { - return caddr(l); -} +attributeValue = caddr; /** * Return the name of an element. */ -function elementName(l) { - return cadr(l); -} +elementName = cadr; /** * Return true if an element has children. @@ -74,21 +64,16 @@ function elementHasChildren(l) { /** * Return the children of an element. */ -function elementChildren(l) { - return cddr(l); -} - +elementChildren = cddr; /** * Return true if an element has a value. */ function elementHasValue(l) { - r = reverse(l); + var r = reverse(l); if (isSymbol(car(r))) return false; - if (isList(car(r)) && !isNil(car(r)) && isSymbol(car(car(r)))) - return false; - return true; + return (!(isList(car(r)) && !isNil(car(r)) && isSymbol(car(car(r))))) } /** @@ -127,13 +112,7 @@ function elementToValue(t) { * Convert a list of elements to a list of values. */ function elementToValueIsSymbol(v) { - if (!isList(v)) - return false; - if (isNil(v)) - return false; - if (!isSymbol(car(v))) - return false; - return true; + return (!(!isList(v)) || isNil(v) || !isSymbol(car(v))); } function elementToValueGroupValues(v, l) { Modified: tuscany/sca-cpp/trunk/modules/js/htdocs/ui-min.css URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/js/htdocs/ui-min.css?rev=1154447&r1=1154446&r2=1154447&view=diff ============================================================================== --- tuscany/sca-cpp/trunk/modules/js/htdocs/ui-min.css (original) +++ tuscany/sca-cpp/trunk/modules/js/htdocs/ui-min.css Sat Aug 6 05:59:32 2011 @@ -1,13 +1,17 @@ -body{margin:2px;font-family:"Helvetica Neue", Helvetica;font-style:normal;font-variant:normal;font-size:13px;-webkit-text-size-adjust:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-user-select:none;} +body{margin-top:0px;margin-bottom:2px;margin-left:2px;margin-right:2px;font-family:"Helvetica Neue", Helvetica;font-style:normal;font-variant:normal;font-size:13px;-webkit-text-size-adjust:none;-webkit-touch-callout:none;-webkit-user-select:none;} .delayed{visibility:hidden;} -.devicewidth{position:absolute;top:0px;left:0px;right:0px;height:5000px;overflow:hidden;} +.devicewidth{position:absolute;top:0px;left:0px;width:100%;height:5000px;overflow:hidden;} +.bodydiv{position:absolute;top:0px;left:0px;width:100%;height:5000px;overflow:hidden;} +.bodydivloading{position:absolute;top:0px;left:0px;width:100%;height:5000px;overflow:hidden;-webkit-transform:translate(100%, 0px);-webkit-backface-visibility:hidden;-moz-transform:translate(100%, 0px);-ms-transform:translate(100%, 0px);transform:translate(100%, 0px);} +.bodydivloaded{-webkit-transition:-webkit-transform 0.4s linear;-moz-transition:-moz-transform 0.4s linear;-ms-transition:-ms-transform 0.4s linear;transition:transform 0.4s linear;position:absolute;top:0px;left:0px;width:100%;height:5000px;overflow:hidden;-webkit-transform:translate3d(0px, 0px, 0px);-webkit-backface-visibility:hidden;-moz-transform:translate(0px, 0px);-ms-transform:translate(0px, 0px);transform:translate(0px, 0px);} +.bodydivunloaded{-webkit-transition:-webkit-transform 0.4s linear;-moz-transition:-moz-transform 0.4s linear;-ms-transition:-ms-transform 0.4s linear;transition:transform 0.4s linear;position:absolute;top:0px;left:0px;width:100%;height:5000px;overflow:hidden;-webkit-transform:translate3d(-100%, 0px, 0px);-webkit-backface-visibility:hidden;-moz-transform:translate(-100%, 0px);-ms-transform:translate(-100%, 0px);transform:translate(-100%, 0px);} table{border:0px;border-collapse:collapse;border-color:#a2bae7;border-style:solid;font-family:"Helvetica Neue", Helvetica;font-style:normal;font-variant:normal;font-size:13px;overflow:visible;} .trb{border-bottom:1px;border-bottom-style:solid;border-color:#dcdcdc;} -th{font-weight:bold;background-color:#e5ecf9;color:#000000;height:18px;text-align:left;padding-left:2px;padding-right:8px;padding-top:0px;padding-bottom:0px;vertical-align:middle;white-space:nowrap;border-top:1px;border-bottom:1px;border-left:1px;border-right:1px;border-style:solid;border-top-color:#a2bae7;border-bottom-color:#d1d3d4;border-left-color:#a2bae7;border-right-color:#a2bae7;overflow:hidden;} -.section{font-weight:bold;background-color:#e5ecf9;color:#000000;height:24px;padding-top:1px;padding-bottom:0px;padding-left:2px;padding-right:2px;border-top:1px;border-bottom:1px;border-left:0px;border-right:0px;border-style:solid;border-top-color:#a2bae7;border-bottom-color:#d1d3d4;border-left-color:#a2bae7;border-right-color:#a2bae7;overflow:hidden;} -.hsection{width:100%;height:50px;border-top:0px;border-bottom:1px;border-left:0px;border-right:0px;border-style:solid;border-bottom-color:#000000;background-color:#ffffff;padding:0px;margin-bottom:4px;margin-left:auto;margin-right:auto;text-align:center;} -.fsection{width:100%;height:50px;border-top:0px;border-bottom:0px;border-left:0px;border-right:0px;border-style:solid;border-top-color:#a2bae7;padding:0px;margin-top:4px;margin-left:auto;margin-right:auto;text-align:center;} -.text{padding-top:3px;padding-bottom:4px;vertical-align:middle;} +th{font-weight:bold;background-color:#d4e6fc;color:#000000;height:18px;text-align:left;padding-left:2px;padding-right:8px;padding-top:0px;padding-bottom:0px;vertical-align:middle;white-space:nowrap;border-top:1px;border-bottom:1px;border-left:1px;border-right:1px;border-style:solid;border-top-color:#a2bae7;border-bottom-color:#d1d3d4;border-left-color:#a2bae7;border-right-color:#a2bae7;overflow:hidden;} +.section{font-weight:bold;background-color:#d4e6fc;color:#000000;height:24px;padding-top:1px;padding-bottom:0px;padding-left:2px;padding-right:2px;border-top:1px;border-bottom:1px;border-left:0px;border-right:0px;border-style:solid;border-top-color:#a2bae7;border-bottom-color:#d1d3d4;border-left-color:#a2bae7;border-right-color:#a2bae7;overflow:hidden;} +.hsection{width:100%;height:50px;border-top:0px;border-bottom:0px;border-left:0px;border-right:0px;border-style:solid;border-bottom-color:#000000;background-color:#ffffff;padding:0px;margin-bottom:0px;margin-left:auto;margin-right:auto;text-align:center;} +.fsection{width:100%;height:50px;border-top:0px;border-bottom:0px;border-left:0px;border-right:0px;border-style:solid;border-top-color:#a2bae7;padding:0px;margin-top:0px;margin-left:auto;margin-right:auto;text-align:center;} +.text{padding-top:3px;padding-bottom:4px;vertical-align:middle;white-space:nowrap;} .thl{border-left:0px;} .thr{border-right:0px;} .ths{padding:0px;} @@ -26,28 +30,31 @@ iframe{border:0px;margin:0px;padding:0px input{vertical-align:middle;font-family:"Helvetica Neue", Helvetica;font-style:normal;font-variant:normal;font-size:13px;-webkit-text-size-adjust:100%;} textarea{font-family:"Helvetica Neue", Helvetica;font-style:normal;font-variant:normal;font-size:13px;overflow:auto;resize:none;} .editable{background-color:transparent;font-family:inherit;font-style:inherit;font-variant:inherit;font-size:inherit;font-weight:inherit;padding:0px;margin:0px;overflow:auto;resize:none;outline:none;-webkit-appearance:none;-moz-outline-style:none;-webkit-text-size-adjust:100%;border:0px;} -a:link{color:#598edd;text-decoration:none;} -a:visited{color:#598edd;text-decoration:none;} -.amenu{color:#598edd;text-decoration:none;} -.smenu{font-weight:bold;color:#000000;text-decoration:none;} -h1{font-size:150%;font-weight:bold;vertical-align:middle;margin-top:5px;margin-bottom:5px;margin-left:2px;margin-right:2px;} -h2{font-size:120%;font-weight:bold;vertical-align:middle;margin-top:5px;margin-bottom:5px;margin-left:2px;margin-right:2px;} -.hd1{font-size:150%;font-weight:bold;} -.hd2{font-size:120%;font-weight:bold;} +a:link{color:#598edd;text-decoration:none;white-space:nowrap;} +a:visited{color:#598edd;text-decoration:none;white-space:nowrap;} +.amenu{color:#598edd;text-decoration:none;white-space:nowrap;} +.smenu{font-weight:bold;color:#000000;text-decoration:none;white-space:nowrap;} +h1{font-size:150%;font-weight:bold;vertical-align:middle;margin-top:5px;margin-bottom:5px;margin-left:2px;margin-right:2px;white-space:nowrap;} +h2{font-size:120%;font-weight:bold;vertical-align:middle;margin-top:5px;margin-bottom:5px;margin-left:2px;margin-right:2px;white-space:nowrap;} +.hd1{font-size:150%;font-weight:bold;white-space:nowrap;} +.hd2{font-size:120%;font-weight:bold;white-space:nowrap;} img{border:0px;} .imgbutton{width:142px;height:64px;margin-left:20px;margin-right:20px;padding:0px;border:1px;cursor:pointer;} .toolbutton{font-weight:bold;font-size:16px;display:inline-block;width:24px;height:20px;padding:0px;vertical-align:middle;text-align:center;margin-left:0px;margin-right:0px;padding-left:0px;padding-right:0px;padding-top:0px;padding-bottom:0px;} -.greenbutton{-webkit-border-radius:4px;border-radius:4px;background:#96d333;background:-moz-linear-gradient(top, #f8f8f8 0%, #96d333 100%);background:-webkit-gradient(linear, left top, left bottom, color-stop(0%,#f8f8f8), color-stop(100%,#96d333));filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f8f8f8', endColorstr='#96d333',GradientType=0);background:-o-linear-gradient(top, #f8f8f8 0%,#96d333 100%);border:1px outset #dcdcdc;padding-left:4px;padding-right:4px;padding-top:2px;padding-bottom:2px;margin:2px;cursor:pointer;} -.tgreenbutton{-webkit-border-radius:4px;border-radius:4px;background:#96d333;background:-moz-linear-gradient(top, #f8f8f8 0%, #96d333 100%);background:-webkit-gradient(linear, left top, left bottom, color-stop(0%,#f8f8f8), color-stop(100%,#96d333));filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f8f8f8', endColorstr='#96d333',GradientType=0);background:-o-linear-gradient(top, #f8f8f8 0%,#96d333 100%);border:1px outset #dcdcdc;padding-left:4px;padding-right:4px;padding-top:2px;padding-bottom:2px;margin:2px;cursor:pointer;} -.bluebutton{-webkit-border-radius:4px;border-radius:4px;background:#598edd;background:-moz-linear-gradient(top, #f8f8f8 0%, #598edd 100%);background:-webkit-gradient(linear, left top, left bottom, color-stop(0%,#f8f8f8), color-stop(100%,#598edd));filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f8f8f8', endColorstr='#598edd',GradientType=0);background:-o-linear-gradient(top, #f8f8f8 0%,#598edd 100%);border:1px outset #dcdcdc;padding-left:4px;padding-right:4px;padding-top:2px;padding-bottom:2px;margin:2px;cursor:pointer;} -.redbutton{-webkit-border-radius:4px;border-radius:4px;background:#d03f41;background:-moz-linear-gradient(top, #f8f8f8 0%, #d03f41 100%);background:-webkit-gradient(linear, left top, left bottom, color-stop(0%,#f8f8f8), color-stop(100%,#d03f41));filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f8f8f8', endColorstr='#d03f41',GradientType=0);background:-o-linear-gradient(top, #f8f8f8 0%,#d03f41 100%);border:1px outset #dcdcdc;padding-left:4px;padding-right:4px;padding-top:2px;padding-bottom:2px;margin:2px;cursor:pointer;} -.orangebutton{-webkit-border-radius:4px;border-radius:4px;background:#ffbb00;background:-moz-linear-gradient(top, #f8f8f8 0%, #ffbb00 100%);background:-webkit-gradient(linear, left top, left bottom, color-stop(0%,#f8f8f8), color-stop(100%,#ffbb00));filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f8f8f8', endColorstr='#ffbb00',GradientType=0);background:-o-linear-gradient(top, #f8f8f8 0%,#ffbb00 100%);border:1px outset #dcdcdc;padding-left:4px;padding-right:4px;padding-top:2px;padding-bottom:2px;margin:2px;cursor:pointer;} -.graybutton{-webkit-border-radius:4px;border-radius:4px;background:#dcdcdc;background:-moz-linear-gradient(top, #f8f8f8 0%, #dcdcdc 100%);background:-webkit-gradient(linear, left top, left bottom, color-stop(0%,#f8f8f8), color-stop(100%,#dcdcdc));filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f8f8f8', endColorstr='#dcdcdc',GradientType=0);background:-o-linear-gradient(top, #f8f8f8 0%,#dcdcdc 100%);border:1px outset #dcdcdc;padding-left:4px;padding-right:4px;padding-top:2px;padding-bottom:2px;margin:2px;margin:2px;cursor:pointer;} -.tbar{margin:0px;width:100%;padding-top:0px;padding-left:0px;padding-right:0px;padding-bottom:3px;border-bottom:1px solid #a2bae7;border-collapse:separate;} -.ltbar{padding-left:2px;padding-top:2px;padding-right:6px;white-space:nowrap;vertical-align:middle;} -.dtbar{padding-left:0px;padding-right:0px;padding-top:2px;white-space:nowrap;vertical-align:middle;text-align:right;} -.rtbar{padding-left:6px;padding-right:2px;padding-top:2px;white-space:nowrap;vertical-align:middle;text-align:right;} -.suggest{background-color:#e5ecf9;color:#598edd;border-top:1px;border-bottom:1px;border-left:1px;border-right:1px;border-style:solid;border-top-color:#a2bae7;border-bottom-color:#d1d3d4;border-left-color:#d1d3d4;border-right-color:#d1d3d4;position:absolute;overflow:auto;overflow-x:hidden;padding:0px;margin:0px;cursor:default;} +.greenbutton{-webkit-border-radius:4px;border-radius:4px;background:#96d333;background:-moz-linear-gradient(top, #f8f8f8 0%, #96d333 80%);background:-webkit-gradient(linear, left top, left bottom, color-stop(0%,#f8f8f8), color-stop(80%,#96d333));filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f8f8f8', endColorstr='#96d333',GradientType=0);background:-o-linear-gradient(top, #f8f8f8 0%,#96d333 80%);border:1px outset #dcdcdc;padding-left:4px;padding-right:4px;padding-top:2px;padding-bottom:2px;margin:2px;cursor:pointer;} +.tgreenbutton{-webkit-border-radius:4px;border-radius:4px;background:#96d333;background:-moz-linear-gradient(top, #f8f8f8 0%, #96d333 80%);background:-webkit-gradient(linear, left top, left bottom, color-stop(0%,#f8f8f8), color-stop(80%,#96d333));filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f8f8f8', endColorstr='#96d333',GradientType=0);background:-o-linear-gradient(top, #f8f8f8 0%,#96d333 80%);border:1px outset #dcdcdc;padding-left:4px;padding-right:4px;padding-top:2px;padding-bottom:2px;margin:2px;cursor:pointer;} +.bluebutton{-webkit-border-radius:4px;border-radius:4px;background:#598edd;background:-moz-linear-gradient(top, #f8f8f8 0%, #598edd 80%);background:-webkit-gradient(linear, left top, left bottom, color-stop(0%,#f8f8f8), color-stop(80%,#598edd));filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f8f8f8', endColorstr='#598edd',GradientType=0);background:-o-linear-gradient(top, #f8f8f8 0%,#598edd 80%);border:1px outset #dcdcdc;padding-left:4px;padding-right:4px;padding-top:2px;padding-bottom:2px;margin:2px;cursor:pointer;} +.redbutton{-webkit-border-radius:4px;border-radius:4px;background:#d03f41;background:-moz-linear-gradient(top, #f8f8f8 0%, #d03f41 80%);background:-webkit-gradient(linear, left top, left bottom, color-stop(0%,#f8f8f8), color-stop(80%,#d03f41));filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f8f8f8', endColorstr='#d03f41',GradientType=0);background:-o-linear-gradient(top, #f8f8f8 0%,#d03f41 80%);border:1px outset #dcdcdc;padding-left:4px;padding-right:4px;padding-top:2px;padding-bottom:2px;margin:2px;cursor:pointer;} +.orangebutton{-webkit-border-radius:4px;border-radius:4px;background:#ffbb00;background:-moz-linear-gradient(top, #f8f8f8 0%, #ffbb00 80%);background:-webkit-gradient(linear, left top, left bottom, color-stop(0%,#f8f8f8), color-stop(80%,#ffbb00));filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f8f8f8', endColorstr='#ffbb00',GradientType=0);background:-o-linear-gradient(top, #f8f8f8 0%,#ffbb00 80%);border:1px outset #dcdcdc;padding-left:4px;padding-right:4px;padding-top:2px;padding-bottom:2px;margin:2px;cursor:pointer;} +.graybutton{-webkit-border-radius:4px;border-radius:4px;background:#dcdcdc;background:-moz-linear-gradient(top, #f8f8f8 0%, #dcdcdc 80%);background:-webkit-gradient(linear, left top, left bottom, color-stop(0%,#f8f8f8), color-stop(80%,#dcdcdc));filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f8f8f8', endColorstr='#dcdcdc',GradientType=0);background:-o-linear-gradient(top, #f8f8f8 0%,#dcdcdc 80%);border:1px outset #dcdcdc;padding-left:4px;padding-right:4px;padding-top:2px;padding-bottom:2px;margin:2px;margin:2px;cursor:pointer;} +.tbar{margin:0px;width:100%;padding-top:0px;padding-left:0px;padding-right:0px;padding-bottom:0px;border-collapse:separate;background-color:#2c2c2c;} +.ltbar{padding-left:2px;padding-right:6px;padding-top:3px;padding-bottom:4px;white-space:nowrap;vertical-align:middle;} +.dtbar{padding-left:0px;padding-right:0px;padding-top:3px;padding-bottom:4px;white-space:nowrap;vertical-align:middle;text-align:right;} +.rtbar{padding-left:6px;padding-right:2px;padding-top:3px;padding-bottom:4px;white-space:nowrap;vertical-align:middle;text-align:right;} +.tbaramenu{color:#cccccc;text-decoration:none;white-space:nowrap;} +.tbarsmenu{font-weight:bold;color:#ffffff;text-decoration:none;white-space:nowrap;} +.suggest{background-color:#d4e6fc;color:#598edd;border-top:1px;border-bottom:1px;border-left:1px;border-right:1px;border-style:solid;border-top-color:#a2bae7;border-bottom-color:#d1d3d4;border-left-color:#d1d3d4;border-right-color:#d1d3d4;position:absolute;overflow:auto;overflow-x:hidden;padding:0px;margin:0px;cursor:default;} .suggestTable{border:0px;border-collapse:separate;padding-left:5px;padding-right:5px;padding-top:2px;padding-bottom:2px;margin:0px;} -.suggestItem{padding-left:2px;padding-top:0px;padding-bottom:0px;padding-right:2px;vertical-align:middle;background-color:#e5ecf9;color:#598edd;} -.suggestHilighted{padding-left:2px;padding-top:0px;padding-bottom:0px;padding-right:2px;vertical-align:middle;background-color:#598edd;color:#e5ecf9;} \ No newline at end of file +.suggestItem{padding-left:2px;padding-top:0px;padding-bottom:0px;padding-right:2px;vertical-align:middle;background-color:#d4e6fc;color:#598edd;} +.suggestHilighted{padding-left:2px;padding-top:0px;padding-bottom:0px;padding-right:2px;vertical-align:middle;background-color:#598edd;color:#d4e6fc;} +.svgtitle{margin:0px;padding:0px;font-family:"Helvetica Neue", Helvetica;font-style:normal;font-variant:normal;font-size:10px;cursor:default;} \ No newline at end of file Modified: tuscany/sca-cpp/trunk/modules/js/htdocs/ui.css URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/js/htdocs/ui.css?rev=1154447&r1=1154446&r2=1154447&view=diff ============================================================================== --- tuscany/sca-cpp/trunk/modules/js/htdocs/ui.css (original) +++ tuscany/sca-cpp/trunk/modules/js/htdocs/ui.css Sat Aug 6 05:59:32 2011 @@ -18,10 +18,10 @@ */ body { -margin: 2px; font-family: "Helvetica Neue", Helvetica; font-style: normal; font-variant: normal; font-size: 13px; +margin-top: 0px; margin-bottom: 2px; margin-left: 2px; margin-right: 2px; +font-family: "Helvetica Neue", Helvetica; font-style: normal; font-variant: normal; font-size: 13px; -webkit-text-size-adjust: none; -webkit-touch-callout: none; --webkit-tap-highlight-color: rgba(0,0,0,0); -webkit-user-select: none; } @@ -30,7 +30,43 @@ visibility: hidden; } .devicewidth { -position: absolute; top: 0px; left: 0px; right: 0px; height: 5000px; overflow: hidden; +position: absolute; top: 0px; left: 0px; width: 100%; height: 5000px; overflow: hidden; +} + +.bodydiv { +position: absolute; top: 0px; left: 0px; width: 100%; height: 5000px; overflow: hidden; +} + +.bodydivloading { +position: absolute; top: 0px; left: 0px; width: 100%; height: 5000px; overflow: hidden; +-webkit-transform: translate(100%, 0px); -webkit-backface-visibility: hidden; +-moz-transform: translate(100%, 0px); +-ms-transform: translate(100%, 0px); +transform: translate(100%, 0px); +} + +.bodydivloaded { +-webkit-transition: -webkit-transform 0.4s linear; +-moz-transition: -moz-transform 0.4s linear; +-ms-transition: -ms-transform 0.4s linear; +transition: transform 0.4s linear; +position: absolute; top: 0px; left: 0px; width: 100%; height: 5000px; overflow: hidden; +-webkit-transform: translate3d(0px, 0px, 0px); -webkit-backface-visibility: hidden; +-moz-transform: translate(0px, 0px); +-ms-transform: translate(0px, 0px); +transform: translate(0px, 0px); +} + +.bodydivunloaded { +-webkit-transition: -webkit-transform 0.4s linear; +-moz-transition: -moz-transform 0.4s linear; +-ms-transition: -ms-transform 0.4s linear; +transition: transform 0.4s linear; +position: absolute; top: 0px; left: 0px; width: 100%; height: 5000px; overflow: hidden; +-webkit-transform: translate3d(-100%, 0px, 0px); -webkit-backface-visibility: hidden; +-moz-transform: translate(-100%, 0px); +-ms-transform: translate(-100%, 0px); +transform: translate(-100%, 0px); } table { @@ -44,31 +80,31 @@ border-bottom: 1px; border-bottom-style: } th { -font-weight: bold; background-color: #e5ecf9; color: #000000; height: 18px; +font-weight: bold; background-color: #d4e6fc; color: #000000; height: 18px; text-align: left; padding-left: 2px; padding-right: 8px; padding-top: 0px; padding-bottom: 0px; vertical-align: middle; white-space: nowrap; border-top: 1px; border-bottom: 1px; border-left: 1px; border-right: 1px; border-style: solid; border-top-color: #a2bae7; border-bottom-color: #d1d3d4; border-left-color: #a2bae7; border-right-color: #a2bae7; overflow: hidden; } .section { -font-weight: bold; background-color: #e5ecf9; color: #000000; height: 24px; padding-top: 1px; padding-bottom: 0px; padding-left: 2px; padding-right: 2px; +font-weight: bold; background-color: #d4e6fc; color: #000000; height: 24px; padding-top: 1px; padding-bottom: 0px; padding-left: 2px; padding-right: 2px; border-top: 1px; border-bottom: 1px; border-left: 0px; border-right: 0px; border-style: solid; border-top-color: #a2bae7; border-bottom-color: #d1d3d4; border-left-color: #a2bae7; border-right-color: #a2bae7; overflow: hidden; } .hsection { width: 100%; height: 50px; -border-top: 0px; border-bottom: 1px; border-left: 0px; border-right: 0px; border-style: solid; border-bottom-color: #000000; background-color: #ffffff; -padding: 0px; margin-bottom: 4px; margin-left: auto; margin-right: auto; text-align: center; +border-top: 0px; border-bottom: 0px; border-left: 0px; border-right: 0px; border-style: solid; border-bottom-color: #000000; background-color: #ffffff; +padding: 0px; margin-bottom: 0px; margin-left: auto; margin-right: auto; text-align: center; } .fsection{ width: 100%; height: 50px; border-top: 0px; border-bottom: 0px; border-left: 0px; border-right: 0px; border-style: solid; border-top-color: #a2bae7; -padding: 0px; margin-top: 4px; margin-left: auto; margin-right: auto; text-align: center; +padding: 0px; margin-top: 0px; margin-left: auto; margin-right: auto; text-align: center; } .text { -padding-top: 3px; padding-bottom: 4px; vertical-align: middle; +padding-top: 3px; padding-bottom: 4px; vertical-align: middle; white-space: nowrap; } .thl { @@ -156,35 +192,35 @@ border: 0px; } a:link { -color: #598edd; text-decoration: none; +color: #598edd; text-decoration: none; white-space: nowrap; } a:visited { -color: #598edd; text-decoration: none; +color: #598edd; text-decoration: none; white-space: nowrap; } .amenu { -color: #598edd; text-decoration: none; +color: #598edd; text-decoration: none; white-space: nowrap; } .smenu { -font-weight: bold; color: #000000; text-decoration: none; +font-weight: bold; color: #000000; text-decoration: none; white-space: nowrap; } h1 { -font-size: 150%; font-weight: bold; vertical-align: middle; margin-top: 5px; margin-bottom: 5px; margin-left: 2px; margin-right: 2px; +font-size: 150%; font-weight: bold; vertical-align: middle; margin-top: 5px; margin-bottom: 5px; margin-left: 2px; margin-right: 2px; white-space: nowrap; } h2 { -font-size: 120%; font-weight: bold; vertical-align: middle; margin-top: 5px; margin-bottom: 5px; margin-left: 2px; margin-right: 2px; +font-size: 120%; font-weight: bold; vertical-align: middle; margin-top: 5px; margin-bottom: 5px; margin-left: 2px; margin-right: 2px; white-space: nowrap; } .hd1 { -font-size: 150%; font-weight: bold; +font-size: 150%; font-weight: bold; white-space: nowrap; } .hd2 { -font-size: 120%; font-weight: bold; +font-size: 120%; font-weight: bold; white-space: nowrap; } img { @@ -206,10 +242,10 @@ padding-left: 0px; padding-right: 0px; p -webkit-border-radius: 4px; border-radius: 4px; background: #96d333; -background: -moz-linear-gradient(top, #f8f8f8 0%, #96d333 100%); -background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f8f8f8), color-stop(100%,#96d333)); +background: -moz-linear-gradient(top, #f8f8f8 0%, #96d333 80%); +background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f8f8f8), color-stop(80%,#96d333)); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f8f8f8', endColorstr='#96d333',GradientType=0 ); -background: -o-linear-gradient(top, #f8f8f8 0%,#96d333 100%); +background: -o-linear-gradient(top, #f8f8f8 0%,#96d333 80%); border: 1px outset #dcdcdc; padding-left: 4px; padding-right: 4px; padding-top: 2px; padding-bottom: 2px; margin: 2px; cursor: pointer; @@ -219,10 +255,10 @@ cursor: pointer; -webkit-border-radius: 4px; border-radius: 4px; background: #96d333; -background: -moz-linear-gradient(top, #f8f8f8 0%, #96d333 100%); -background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f8f8f8), color-stop(100%,#96d333)); +background: -moz-linear-gradient(top, #f8f8f8 0%, #96d333 80%); +background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f8f8f8), color-stop(80%,#96d333)); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f8f8f8', endColorstr='#96d333',GradientType=0 ); -background: -o-linear-gradient(top, #f8f8f8 0%,#96d333 100%); +background: -o-linear-gradient(top, #f8f8f8 0%,#96d333 80%); border: 1px outset #dcdcdc; padding-left: 4px; padding-right: 4px; padding-top: 2px; padding-bottom: 2px; margin: 2px; cursor: pointer; @@ -232,10 +268,10 @@ cursor: pointer; -webkit-border-radius: 4px; border-radius: 4px; background: #598edd; -background: -moz-linear-gradient(top, #f8f8f8 0%, #598edd 100%); -background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f8f8f8), color-stop(100%,#598edd)); +background: -moz-linear-gradient(top, #f8f8f8 0%, #598edd 80%); +background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f8f8f8), color-stop(80%,#598edd)); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f8f8f8', endColorstr='#598edd',GradientType=0 ); -background: -o-linear-gradient(top, #f8f8f8 0%,#598edd 100%); +background: -o-linear-gradient(top, #f8f8f8 0%,#598edd 80%); border: 1px outset #dcdcdc; padding-left: 4px; padding-right: 4px; padding-top: 2px; padding-bottom: 2px; margin: 2px; cursor: pointer; @@ -245,10 +281,10 @@ cursor: pointer; -webkit-border-radius: 4px; border-radius: 4px; background: #d03f41; -background: -moz-linear-gradient(top, #f8f8f8 0%, #d03f41 100%); -background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f8f8f8), color-stop(100%,#d03f41)); +background: -moz-linear-gradient(top, #f8f8f8 0%, #d03f41 80%); +background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f8f8f8), color-stop(80%,#d03f41)); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f8f8f8', endColorstr='#d03f41',GradientType=0 ); -background: -o-linear-gradient(top, #f8f8f8 0%,#d03f41 100%); +background: -o-linear-gradient(top, #f8f8f8 0%,#d03f41 80%); border: 1px outset #dcdcdc; padding-left: 4px; padding-right: 4px; padding-top: 2px; padding-bottom: 2px; margin: 2px; cursor: pointer; @@ -258,10 +294,10 @@ cursor: pointer; -webkit-border-radius: 4px; border-radius: 4px; background: #ffbb00; -background: -moz-linear-gradient(top, #f8f8f8 0%, #ffbb00 100%); -background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f8f8f8), color-stop(100%,#ffbb00)); +background: -moz-linear-gradient(top, #f8f8f8 0%, #ffbb00 80%); +background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f8f8f8), color-stop(80%,#ffbb00)); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f8f8f8', endColorstr='#ffbb00',GradientType=0 ); -background: -o-linear-gradient(top, #f8f8f8 0%,#ffbb00 100%); +background: -o-linear-gradient(top, #f8f8f8 0%,#ffbb00 80%); border: 1px outset #dcdcdc; padding-left: 4px; padding-right: 4px; padding-top: 2px; padding-bottom: 2px; margin: 2px; cursor: pointer; @@ -271,10 +307,10 @@ cursor: pointer; -webkit-border-radius: 4px; border-radius: 4px; background: #dcdcdc; -background: -moz-linear-gradient(top, #f8f8f8 0%, #dcdcdc 100%); -background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f8f8f8), color-stop(100%,#dcdcdc)); +background: -moz-linear-gradient(top, #f8f8f8 0%, #dcdcdc 80%); +background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f8f8f8), color-stop(80%,#dcdcdc)); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f8f8f8', endColorstr='#dcdcdc',GradientType=0 ); -background: -o-linear-gradient(top, #f8f8f8 0%,#dcdcdc 100%); +background: -o-linear-gradient(top, #f8f8f8 0%,#dcdcdc 80%); border: 1px outset #dcdcdc; padding-left: 4px; padding-right: 4px; padding-top: 2px; padding-bottom: 2px; margin: 2px; margin: 2px; @@ -282,23 +318,32 @@ cursor: pointer; } .tbar { -margin: 0px; width: 100%; padding-top: 0px; padding-left: 0px; padding-right: 0px; padding-bottom: 3px; border-bottom: 1px solid #a2bae7; border-collapse: separate; +margin: 0px; width: 100%; padding-top: 0px; padding-left: 0px; padding-right: 0px; padding-bottom: 0px; border-collapse: separate; +background-color: #2c2c2c; } .ltbar { -padding-left: 2px; padding-top: 2px; padding-right: 6px; white-space: nowrap; vertical-align: middle; +padding-left: 2px; padding-right: 6px; padding-top: 3px; padding-bottom: 4px; white-space: nowrap; vertical-align: middle; } .dtbar { -padding-left: 0px; padding-right: 0px; padding-top: 2px; white-space: nowrap; vertical-align: middle; text-align: right; +padding-left: 0px; padding-right: 0px; padding-top: 3px; padding-bottom: 4px; white-space: nowrap; vertical-align: middle; text-align: right; } .rtbar { -padding-left: 6px; padding-right: 2px; padding-top: 2px; white-space: nowrap; vertical-align: middle; text-align: right; +padding-left: 6px; padding-right: 2px; padding-top: 3px; padding-bottom: 4px; white-space: nowrap; vertical-align: middle; text-align: right; +} + +.tbaramenu { +color: #cccccc; text-decoration: none; white-space: nowrap; +} + +.tbarsmenu { +font-weight: bold; color: #ffffff; text-decoration: none; white-space: nowrap; } .suggest { -background-color: #e5ecf9; color: #598edd; +background-color: #d4e6fc; color: #598edd; border-top: 1px; border-bottom: 1px; border-left: 1px; border-right: 1px; border-style: solid; border-top-color: #a2bae7; border-bottom-color: #d1d3d4; border-left-color: #d1d3d4; border-right-color: #d1d3d4; position: absolute; overflow: auto; overflow-x: hidden; padding: 0px; margin: 0px; cursor: default; @@ -309,10 +354,14 @@ border: 0px; border-collapse: separate; } .suggestItem { -padding-left: 2px; padding-top: 0px; padding-bottom: 0px; padding-right: 2px; vertical-align: middle; background-color: #e5ecf9; color: #598edd; +padding-left: 2px; padding-top: 0px; padding-bottom: 0px; padding-right: 2px; vertical-align: middle; background-color: #d4e6fc; color: #598edd; } .suggestHilighted { -padding-left: 2px; padding-top: 0px; padding-bottom: 0px; padding-right: 2px; vertical-align: middle; background-color: #598edd; color: #e5ecf9; +padding-left: 2px; padding-top: 0px; padding-bottom: 0px; padding-right: 2px; vertical-align: middle; background-color: #598edd; color: #d4e6fc; +} + +.svgtitle { +margin: 0px; padding: 0px; font-family: "Helvetica Neue", Helvetica; font-style: normal; font-variant: normal; font-size: 10px; cursor: default; } Modified: tuscany/sca-cpp/trunk/modules/js/htdocs/ui.js URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/js/htdocs/ui.js?rev=1154447&r1=1154446&r2=1154447&view=diff ============================================================================== --- tuscany/sca-cpp/trunk/modules/js/htdocs/ui.js (original) +++ tuscany/sca-cpp/trunk/modules/js/htdocs/ui.js Sat Aug 6 05:59:32 2011 @@ -29,7 +29,7 @@ var ui = {}; ui.ahref = function(loc, target, html) { if (target == '_blank') return '<a href="' + loc + '" target="_blank">' + html + '</a>'; - return '<a href="javascript:void(0)" onclick="window.open(\'' + loc + '\', \'' + target + '\');">' + html + '</a>'; + return '<a href="javascript:void(0)" onclick="ui.navigate(\'' + loc + '\', \'' + target + '\');">' + html + '</a>'; }; /** @@ -43,6 +43,9 @@ ui.menu = function(name, href, target) { this.content = function() { function complete(uri) { + var h = uri.indexOf('#'); + if (h != -1) + return complete(uri.substr(0, h)); var q = uri.indexOf('?'); if (q != -1) return complete(uri.substr(0, q)); @@ -54,8 +57,8 @@ ui.menu = function(name, href, target) { } if (complete(this.href) != complete(window.top.location.pathname)) - return ui.ahref(this.href, this.target, '<span class="amenu">' + this.name + '</span>'); - return ui.ahref(this.href, this.target, '<span class="smenu">' + this.name + '</span>'); + return ui.ahref(this.href, this.target, '<span class="tbaramenu">' + this.name + '</span>'); + return ui.ahref(this.href, this.target, '<span class="tbarsmenu">' + this.name + '</span>'); }; } return new Menu(name, href, target); @@ -179,17 +182,6 @@ ui.suggest = function(input, suggestFunc }; /** - * Return the content document of a window. - */ -ui.content = function(win) { - if (!isNil(win.document)) - return win.document; - if (!isNil(win.contentDocument)) - return win.contentDocument; - return null; -}; - -/** * Return a child element of a node with the given id. */ ui.elementByID = function(node, id) { @@ -231,39 +223,165 @@ ui.queryParams = function() { }; /** + * Return a dictionary of the fragment parameters. + */ +ui.fragmentParams = function() { + var qp = new Array(); + var qs = window.location.hash.substring(1).split('&'); + for (var i = 0; i < qs.length; i++) { + var e = qs[i].indexOf('='); + if (e > 0) + qp[qs[i].substring(0, e)] = unescape(qs[i].substring(e + 1)); + } + return qp; +}; + +/** * Return true if the client is a mobile device. */ +ui.mobiledetected = false; +ui.mobile = false; ui.isMobile = function() { + if (ui.mobiledetected) + return ui.mobile; var ua = navigator.userAgent; if (ua.match(/iPhone/i) || ua.match(/iPad/i) || ua.match(/Android/i) || ua.match(/Blackberry/i) || ua.match(/WebOs/i)) - return true; - return false; + ui.mobile = true; + ui.mobiledetected = true; + return ui.mobile; }; /** - * Initialize a document after it's loaded. + * Initialize a document's body. + */ +ui.pagetransitions = false; + +ui.initbody = function() { + if (ui.isMobile()) { + //log('init', window.location); + + // Position the main body div off screen + if (ui.pagetransitions) { + var bdiv = $('bodydiv'); + if (!isNil(bdiv)) { + bdiv.className = 'bodydivloading'; + } + } + + // Install orientation handler + document.body.onorientationchange = ui.onorientationchange; + } + return true; +} + +/** + * Reload the current document when orientation changes. + */ +ui.onorientationchange = function() { + window.open(window.location, '_self'); + return true; +} + +/** + * Post process a document after it's loaded. */ ui.onload = function() { - // Make the document visible - document.body.style.visibility = 'visible'; + // Save the current page location in local storage + // (except for login and logout pages) + var path = document.location.pathname; + if (path.indexOf('/login/') != 0 && path.indexOf('/logout/') != 0) + localStorage.setItem('ui.lastvisited', '' + document.location); - // Install orientation handler - document.body.onorientationchange = function() { - window.open(window.location, '_self'); - return true; - }; + // Make the document body visible + //log('visible', $('bodydiv').className); + document.body.style.visibility = 'visible'; + if (ui.pagetransitions && ui.isMobile()) { + //log('onload', window.location); + + // Slide the main body div in + setTimeout(function() { + var bdiv = $('bodydiv'); + if (!isNil(bdiv)) { + function transitionend(e) { + bdiv.removeEventListener('webkitTransitionEnd', transitionend, false); + bdiv.removeEventListener('transitionend', transitionend, false); + bdiv.className = 'bodydiv'; + //log('loadtransitionend', window.location); + }; + bdiv.addEventListener('webkitTransitionEnd', transitionend, false); + bdiv.addEventListener('transitionend', transitionend, false); + //log('loadtransitionstart', window.location); + bdiv.className = 'bodydivloaded'; + } + }, 0); + } return true; }; /** + * Navigate to a new document. + */ +ui.navigate = function(url, win) { + + function opendoc(url, win) { + if (win == '_reload') { + window.location = url; + return window.location.reload(); + } + return window.open(url, win); + } + + if (ui.pagetransitions && ui.isMobile() && win != '_blank') { + + // Slide the main body div out, then open the new document + var bdiv = $('bodydiv'); + if (!isNil(bdiv)) { + function transitionend(e) { + bdiv.removeEventListener('webkitTransitionEnd', transitionend, false); + bdiv.removeEventListener('transitionend', transitionend, false); + //log('navigatetransitionend', window.location); + return opendoc(url, win); + }; + bdiv.addEventListener('webkitTransitionEnd', transitionend, false); + bdiv.addEventListener('transitionend', transitionend, false); + //log('navigatetransitionstart', window.location); + bdiv.className = 'bodydivunloaded'; + return true; + } + } + + return opendoc(url, win); +} + +/** + * Pre process a document just before it's unloaded. + */ +ui.onbeforeunload = function() { + + if (ui.pagetransitions && ui.isMobile()) { + + // Slide the main body div out + var bdiv = $('bodydiv'); + if (!isNil(bdiv)) + bdiv.className = 'bodydivunloaded'; + } +}; + + +/** + * Return the last visited page. + */ +ui.lastvisited = function() { + return localStorage.getItem('ui.lastvisited'); +} + +/** * Convert a CSS position to a numeric position. */ ui.numpos = function(p) { - if (p == '') - return 0; - return Number(p.substr(0, p.length - 2)); + return p == ''? 0 : Number(p.substr(0, p.length - 2)); }; /** Modified: tuscany/sca-cpp/trunk/modules/js/htdocs/util.js URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/modules/js/htdocs/util.js?rev=1154447&r1=1154446&r2=1154447&view=diff ============================================================================== --- tuscany/sca-cpp/trunk/modules/js/htdocs/util.js (original) +++ tuscany/sca-cpp/trunk/modules/js/htdocs/util.js Sat Aug 6 05:59:32 2011 @@ -35,7 +35,7 @@ function car(l) { } function first(l) { - return car(l); + return l[0]; } function cdr(l) { @@ -43,27 +43,27 @@ function cdr(l) { } function rest(l) { - return cdr(l); + return l.slice(1); } function cadr(l) { - return car(cdr(l)); + return l[1]; } function cddr(l) { - return cdr(cdr(l)); + return l.slice(2); } function caddr(l) { - return car(cddr(l)); + return l[2]; } function cdddr(l) { - return cdr(cdr(cdr(l))); + return l.slice(3); } function cadddr(l) { - return car(cdddr(l)); + return l[3]; } function append(a, b) { @@ -82,33 +82,23 @@ function range(a, b) { } function isNil(v) { - if (v == null || typeof v == 'undefined' || (v.constructor == Array && v.length == 0)) - return true; - return false; + return (v == null || typeof v == 'undefined' || (v.constructor == Array && v.length == 0)); } function isSymbol(v) { - if (typeof v == 'string' && v.slice(0, 1) == "'") - return true; - return false; + return (typeof v == 'string' && v.slice(0, 1) == "'"); } function isString(v) { - if (typeof v == 'string' && v.slice(0, 1) != "'") - return true; - return false; + return (typeof v == 'string' && v.slice(0, 1) != "'"); } function isList(v) { - if (v != null && typeof v != 'undefined' && v.constructor == Array) - return true; - return false; + return (v != null && typeof v != 'undefined' && v.constructor == Array); } function isTaggedList(v, t) { - if (isList(v) && !isNil(v) && car(v) == t) - return true; - return false; + return (isList(v) && !isNil(v) && car(v) == t); } var emptylist = new Array(); @@ -131,10 +121,13 @@ function length(l) { */ function assoc(k, l) { if (isNil(l)) - return mklist(); - if (k == car(car(l))) - return car(l); - return assoc(k, cdr(l)); + return emptylist; + var n = l.length; + for(var i = 0; i < n; i++) { + if (k == car(l[i])) + return l[i]; + } + return emptylist; } /** @@ -143,15 +136,24 @@ function assoc(k, l) { function map(f, l) { if (isNil(l)) return l; - return cons(f(car(l)), map(f, cdr(l))); + var n = l.length; + var a = new Array(); + for(var i = 0; i < n; i++) { + a.push(f(l[i])); + } + return a; } function filter(f, l) { if (isNil(l)) return l; - if (f(car(l))) - return cons(car(l), filter(f, cdr(l))); - return filter(f, cdr(l)); + var n = l.length; + var a = new Array(); + for(var i = 0; i < n; i++) { + if (f(l[i])) + a.push(l[i]); + } + return a; } function reduce(f, i, l) { @@ -245,7 +247,12 @@ function assert(exp) { function writeStrings(l) { if (isNil(l)) return ''; - return car(l) + writeStrings(cdr(l)); + var s = ''; + var n = l.length; + for(var i = 0; i < n; i++) { + s = s + l[i]; + } + return s; } /**
