// request is directed to current location
//
JsHttpRequest.request= function(trigger, form) {
+ var mark = document.getElementById('ajaxmark');
+ if(mark) mark.style.visibility = 'visible';
if (trigger.tagName=='A') {
var content = {};
var upload = 0;
var url = trigger.href;
+ if (trigger.id) content[trigger.id] = 1;
} else {
var submitObj = typeof(trigger) == "string" ?
document.getElementsByName(trigger)[0] : trigger;
// Function is called when an answer arrives.
function(result, errors) {
// Write the answer.
+ var newwin = 0;
if (result) {
for(var i in result ) {
atom = result[i];
// debug(cmd+':'+property+':'+type+':'+id);
// seek element by id if there is no elemnt with given name
objElement = document.getElementsByName(id)[0] || document.getElementById(id);
+ if(!objElement) continue;
if(cmd=='as') {
eval("objElement.setAttribute('"+property+"',"+data+");");
} else if(cmd=='up') {
} else if(cmd=='rd') { // client-side redirection
window.location = data;
} else if(cmd=='pu') { // pop-up
+ newwin = 1;
window.open(data,'REP_WINDOW','toolbar=no,scrollbar=no,resizable=yes,menubar=no');
} else {
errors = errors+'<br>Unknown ajax function: '+cmd;
// Write errors to the debug div.
document.getElementById('msgbox').innerHTML = errors;
+ var mark = document.getElementById('ajaxmark');
+ if(mark) mark.style.visibility = 'hidden';
Behaviour.apply();
+
if (errors.length>0)
window.scrollTo(0,0);
//document.getElementById('msgbox').scrollIntoView(true);
// Restore focus if we've just lost focus because of DOM element refresh
- setFocus();
+ if(!newwin) {
+ setFocus();
+ }
}
},
false // do not disable caching