Add rule for 'body' container and QLink property 'target'
QLinks can now define the target for their link. Additionally, the targte 'body' is now always the <body> tag. This allows the modulemanager to reload the whole page (with the navigation bar). refs #4092
This commit is contained in:
parent
e9ade7a339
commit
beaac3a68d
|
@ -3,15 +3,14 @@
|
|||
"use strict";
|
||||
var asyncMgrInstance = null;
|
||||
|
||||
define(['icinga/container','logging','jquery'],function(containerMgr,log,$) {
|
||||
var headerListeners = {};
|
||||
define(['icinga/container','logging','icinga/behaviour','jquery'],function(containerMgr,log,behaviour,$) {
|
||||
|
||||
var pending = {
|
||||
|
||||
};
|
||||
var getDOMForDestination = function(destination) {
|
||||
var target = destination;
|
||||
if (typeof destination === "string") {
|
||||
if(typeof destination === "string") {
|
||||
target = containerMgr.getContainer(destination)[0];
|
||||
} else if(typeof destination.context !== "undefined") {
|
||||
target = destination[0];
|
||||
|
@ -19,30 +18,12 @@
|
|||
return target;
|
||||
};
|
||||
|
||||
var applyHeaderListeners = function(headers) {
|
||||
for (var header in headerListeners) {
|
||||
if (headers.getResponseHeader(header) === null) {
|
||||
// see if the browser/server converts headers to lowercase
|
||||
if (headers.getResponseHeader(header.toLowerCase()) === null) {
|
||||
continue;
|
||||
}
|
||||
header = header.toLowerCase();
|
||||
}
|
||||
var value = headers.getResponseHeader(header);
|
||||
var listeners = headerListeners[header];
|
||||
for (var i=0;i<listeners.length;i++) {
|
||||
listeners[i].fn.apply(listeners[i].scope, [value, header, headers]);
|
||||
}
|
||||
}
|
||||
};
|
||||
var handleResponse = function(html) {
|
||||
|
||||
var handleResponse = function(html, status, response) {
|
||||
applyHeaderListeners(response);
|
||||
if(this.destination) {
|
||||
containerMgr.updateContainer(this.destination,html,this);
|
||||
} else {
|
||||
// tbd
|
||||
// containerMgr.createPopupContainer(html,this);
|
||||
containerMgr.createPopupContainer(html,this);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -68,8 +49,6 @@
|
|||
|
||||
var CallInterface = function() {
|
||||
|
||||
this.__internalXHRImplementation = $.ajax;
|
||||
|
||||
this.clearPendingRequestsFor = function(destination) {
|
||||
if(!$.isArray(pending)) {
|
||||
pending = [];
|
||||
|
@ -89,7 +68,7 @@
|
|||
};
|
||||
|
||||
this.createRequest = function(url,data) {
|
||||
var req = this.__internalXHRImplementation({
|
||||
var req = $.ajax({
|
||||
type : data ? 'POST' : 'GET',
|
||||
url : url,
|
||||
data : data,
|
||||
|
@ -110,7 +89,7 @@
|
|||
if(destination) {
|
||||
pending.push({
|
||||
request: req,
|
||||
DOM: getDOMForDestination(destination)
|
||||
DOM: getDOMForDestination(destination)
|
||||
});
|
||||
req.destination = destination;
|
||||
}
|
||||
|
@ -122,11 +101,6 @@
|
|||
this.loadCSS = function(name) {
|
||||
|
||||
};
|
||||
|
||||
this.registerHeaderListener = function(header, fn, scope) {
|
||||
headerListeners[header] = headerListeners[header] || [];
|
||||
headerListeners[header].push({fn: fn, scope:scope});
|
||||
};
|
||||
};
|
||||
return new CallInterface();
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue