summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/modules/js
diff options
context:
space:
mode:
Diffstat (limited to 'sca-cpp/trunk/modules/js')
-rw-r--r--sca-cpp/trunk/modules/js/htdocs/component.js30
-rw-r--r--sca-cpp/trunk/modules/js/htdocs/ui.js15
-rw-r--r--sca-cpp/trunk/modules/js/htdocs/util.js9
3 files changed, 44 insertions, 10 deletions
diff --git a/sca-cpp/trunk/modules/js/htdocs/component.js b/sca-cpp/trunk/modules/js/htdocs/component.js
index d991f9aa61..10b4535470 100644
--- a/sca-cpp/trunk/modules/js/htdocs/component.js
+++ b/sca-cpp/trunk/modules/js/htdocs/component.js
@@ -265,13 +265,16 @@ HTTPBindingClient.prototype.get = function(id, cb) {
if (http.getResponseHeader("X-Login") != null) {
// Detect redirect to a login page
try {
- cb(null, new HTTPBindingClient.Exception(403, 'X-Login'));
+ var le = new HTTPBindingClient.Exception(403, 'X-Login');
+ if (window.onloginredirect)
+ window.onloginredirect(le);
+ return cb(null, le);
} catch(cbe) {}
} else if (http.responseText == '' || http.getResponseHeader("Content-Type") == null) {
// Report empty response
try {
- cb(null, new HTTPBindingClient.Exception(403, 'No-Content'));
+ return cb(null, new HTTPBindingClient.Exception(403, 'No-Content'));
} catch(cbe) {}
} else {
@@ -282,7 +285,7 @@ HTTPBindingClient.prototype.get = function(id, cb) {
localStorage.setItem(u, http.responseText);
}
try {
- cb(http.responseText);
+ return cb(http.responseText);
} catch(cbe) {}
}
}
@@ -291,7 +294,7 @@ HTTPBindingClient.prototype.get = function(id, cb) {
// Pass exception if we didn't have a local result
if (item == null) {
try {
- cb(null, new HTTPBindingClient.Exception(http.status, http.statusText));
+ return cb(null, new HTTPBindingClient.Exception(http.status, http.statusText));
} catch(cbe) {}
}
}
@@ -309,7 +312,10 @@ HTTPBindingClient.prototype.get = function(id, cb) {
if (http.getResponseHeader("X-Login") != null) {
// Detect redirect to a login page
- throw new HTTPBindingClient.Exception(403, 'X-Login');
+ var le = new HTTPBindingClient.Exception(403, 'X-Login');
+ if (window.onloginredirect)
+ window.onloginredirect(le);
+ throw le;
} else if (http.responseText == '' || http.getResponseHeader("Content-Type") == null) {
@@ -341,7 +347,10 @@ HTTPBindingClient.prototype.getnocache = function(id, cb) {
if (http.getResponseHeader("X-Login") != null) {
// Detect redirect to a login page
try {
- return cb(null, new HTTPBindingClient.Exception(403, 'X-Login'));
+ var le = new HTTPBindingClient.Exception(403, 'X-Login');
+ if (window.onloginredirect)
+ window.onloginredirect(le);
+ return cb(null, le);
} catch(cbe) {}
} else if (http.responseText == '' || http.getResponseHeader("Content-Type") == null) {
@@ -352,12 +361,12 @@ HTTPBindingClient.prototype.getnocache = function(id, cb) {
} else {
try {
- cb(http.responseText);
+ return cb(http.responseText);
} catch(cbe) {}
}
} else {
try {
- cb(null, new HTTPBindingClient.Exception(http.status, http.statusText));
+ return cb(null, new HTTPBindingClient.Exception(http.status, http.statusText));
} catch(cbe) {}
}
}
@@ -374,7 +383,10 @@ HTTPBindingClient.prototype.getnocache = function(id, cb) {
if (http.getResponseHeader("X-Login") != null) {
// Detect redirect to a login page
- throw new HTTPBindingClient.Exception(403, 'X-Login');
+ var le = new HTTPBindingClient.Exception(403, 'X-Login');
+ if (window.onloginredirect)
+ window.onloginredirect(le);
+ throw le;
} else if (http.responseText == '' || http.getResponseHeader("Content-Type") == null) {
diff --git a/sca-cpp/trunk/modules/js/htdocs/ui.js b/sca-cpp/trunk/modules/js/htdocs/ui.js
index ee65d62e56..eabf851b55 100644
--- a/sca-cpp/trunk/modules/js/htdocs/ui.js
+++ b/sca-cpp/trunk/modules/js/htdocs/ui.js
@@ -274,6 +274,21 @@ ui.menu = function(name, href, target, hilight) {
return new Menu();
};
+ui.menufunc = function(name, fun, hilight) {
+ function Menu() {
+ this.content = function() {
+ function href(fun, html) {
+ return '<a href="javascript:void(0)" onclick="' + fun + '">' + html + '</a>';
+ }
+
+ if (hilight)
+ return href(fun, '<span class="tbarsmenu">' + name + '</span>');
+ return href(fun, '<span class="tbaramenu">' + name + '</span>');
+ };
+ }
+ return new Menu();
+};
+
ui.menubar = function(left, right) {
var bar = '<table cellpadding="0" cellspacing="0" width="100%" class="tbar"><tr>' +
'<td class="dtbar"><table border="0" cellspacing="0" cellpadding="0"><tr>';
diff --git a/sca-cpp/trunk/modules/js/htdocs/util.js b/sca-cpp/trunk/modules/js/htdocs/util.js
index 86e17c4f60..60c8a0c8e6 100644
--- a/sca-cpp/trunk/modules/js/htdocs/util.js
+++ b/sca-cpp/trunk/modules/js/htdocs/util.js
@@ -315,8 +315,15 @@ function properties(o) {
* Convert a host name to a domain name.
*/
function domainname(host) {
+ var ds = host.indexOf('//');
+ if (ds != -1)
+ return domainname(host.substring(ds + 2));
+ var s = host.indexOf('/');
+ if (s != -1)
+ return domainname(host.substring(0, s));
var h = reverse(host.split('.'));
- return reverse(mklist(car(h), cadr(h))).join('.');
+ var d = (!isNil(cddr(h)) && caddr(h) == 'www')? mklist(car(h), cadr(h), caddr(h)) : mklist(car(h), cadr(h));
+ return reverse(d).join('.');
}
/**