This repository has been archived by the owner on Apr 8, 2019. It is now read-only.
/
PortalHttpRequest.js
722 lines (658 loc) · 23.9 KB
/
PortalHttpRequest.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
/**
* Copyright (C) 2009 eXo Platform SAS.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
/***********************************************************************************************
* Portal Ajax Response Data Structure
* {PortalResponse}
* |
* |--->{PortletResponse}
* |
* |--->{PortletResponse}
* | |-->{portletId}
* | |
* | |-->{PortletResponseData}
* | |
* | |--->{BlockToUpdate}
* | | |-->{BlockToUpdateId}
* | | |-->{BlockToUpdateData}
* | |
* | |--->{BlockToUpdate}
* |
* |--->{PortalResponseData}
* | |
* | |--->{BlockToUpdate}
* | | |-->{BlockToUpdateId}
* | | |-->{BlockToUpdateData}
* | |
* | |--->{BlockToUpdate}
* |--->{PortalResponseScript}
*
**************************************************************************************************/
/*
* This object is wrapper on the value of each HTML block
* returned by an eXo Portal AJAX call.
*
* This includes:
* - the portle ID
* - the portlet title
* - the portlet mode
* - the portlet state
* - the portlet content
* - the updated scripts to dynamically load in the browser
*
* Then each block to update within the portlet are place in a object
* which is itself placed inside an array to provide an OO view of the
* AJAX response
*/
function PortletResponse(responseDiv) {
var div = $(responseDiv).children("div");
this.portletId = div[0].innerHTML;
this.portletData = div[1].innerHTML;
this.blocksToUpdate = null;
var blocks = $(div[1]).children(".BlockToUpdate");
if(blocks.length > 0 ) {
var updates = this.blocksToUpdate = new Array() ;
blocks.each(function() {
var div = $(this).children("div");
updates[updates.length] = {blockId : div[0].innerHTML, data : div[1]};
updates[updates.length - 1].scripts = $(div[1]).find("script");
});
} else {
/*
* If there is no block to update it means we are in a JSR 286 / 168 portlet
* In that case we need to find all the script tags and dynamically execute them.
*
* Indeed, when being in an AJAX call that return some <script> tag, local functions are
* lost when calling the eval() methods. When the code is written by eXo we use
* global scoped funstions like "instance.myFunction = function(arguments)".
*
* But when the code is provided by a third party portlet, it is not possible to
* force that good practise. Hence we have to dynamically reference the embedded
* script in the head tag
*/
this.scripts = $(div[1]).find("script");
}
};
/*****************************************************************************************/
/*
* This object is an OO wrapper on top of the returning HTML included in the PortalResponse
* tag.
*
* It allows to split in two different arrays the portletResponse blocks and the one and the
* PortalResponseData one
*
* It also extract from the HTML the javascripts script to then be dynamically evaluated
*/
function PortalResponse(responseDiv) {
//jquery always remove script tag from the source
var temp = document.createElement("div") ;
temp.innerHTML = responseDiv;
var div = $(temp).children().first(), portalResp = this;
portalResp.portletResponses = new Array() ;
//Portlet Response
div.children("div.PortletResponse").each(function() {
portalResp.portletResponses[portalResp.portletResponses.length] = new PortletResponse(this);
});
//Portal Response
div.children("div.PortalResponseData").each(function() {
portalResp.data = this;
portalResp.blocksToUpdate = new Array();
$(this).children(".BlockToUpdate").each(function() {
var dataBlocks = $(this).children("div");
var i = portalResp.blocksToUpdate.length;
portalResp.blocksToUpdate[i] = {blockId : dataBlocks[0].innerHTML, data : dataBlocks[1]};
/*
* handle embedded javascripts to dynamically add them to the page head
*
* This is needed when we refresh an entire portal page that contains some
* standard JSR 168 / 286 portlets with embeded <script> tag
*/
portalResp.blocksToUpdate[i].scripts = $(dataBlocks[1]).find("script");
});
});
//Extra Markup Header
div.children("div.MarkupHeadElements").each(function() {
portalResp.markupHeadElements = new MarkupHeadElements(this);
});
//Loading Scripts
div.children("div.LoadingScripts").each(function() {
portalResp.loadingScripts = new LoadingScripts(this);
});
//Portal Response Script
div.children("div.PortalResponseScript").each(function() {
portalResp.script = this.innerHTML;
$(this).css("display", "none");
});
};
function MarkupHeadElements(fragment) {
var jObj = $(fragment);
this.titles = jObj.find("title");
this.bases = jObj.find("base") ;
this.links = jObj.find("link") ;
this.metas = jObj.find("meta") ;
this.scripts = jObj.find("script") ;
this.styles = jObj.find("style") ;
//Recreate tag to make sure browser will execute it
for (var i = 0; i < this.scripts.length; i++) {
this.scripts[i] = createScriptNode(this.scripts[i]);
}
}
function LoadingScripts(fragment) {
this.immediateScripts = [];
var jFragment = $(fragment);
var headers = jFragment.children(".ImmediateScripts").first().html();
headers = headers.replace(/^\s*/, '').split(",");
for (var i = 0; i < headers.length; i++) {
if (headers[i] !== "") {
this.immediateScripts.push(headers[i]);
}
}
}
/*
* This function is used to dynamically append a script to the head tag
* of the page
*/
function appendScriptToHead(scriptId, scriptElement) {
var head = $("head");
head.find("#" + scriptId).remove();
var script = $(scriptElement);
script.attr("id", scriptId);
head[0].appendChild(script[0]);
};
function createScriptNode(elem) {
var script = document.createElement('script');
script.type = 'text/javascript';
script.className = elem.className;
if (elem.defer) {
script.defer = elem.defer;
}
//check if contains source attribute
if(elem.src) {
script.src = elem.src;
} else {
script.text = elem.innerHTML;
}
return script;
};
/*****************************************************************************************/
/*
* This is the main object that acts both as a field wrapper and a some status method wrapper
*
* It is also the object that has the reference to the XHR request thanks to a reference to
* the eXo.core.Browser object
*/
function AjaxRequest(method, url, queryString) {
var instance = new Object() ;
instance.request = null;
instance.timeout = 80000 ;
instance.aborted = false ;
if(method != null) instance.method = method; else instance.method = "GET" ;
if(url != null) instance.url = url; else instance.url = window.location.href ;
if(queryString != null) instance.queryString = queryString; else instance.queryString = null ;
instance.responseReceived = false ;
instance.status = null ;
instance.statusText = null ;
instance.responseText = null ;
instance.responseXML = null ;
instance.onTimeout = null ;
instance.onLoading = null ;
instance.onComplete = null ;
instance.onSuccess = null ;
instance.callBack = null ;
instance.onError = null;
instance.isAsynchronize = function() {
var isASync = false;
var name = "ajax_async";
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( instance.url );
if( results != null ) {
isASync = (results[1] == "true") ? true : false;
}
return isASync;
};
instance.onLoadingInternalHandled = false ;
instance.onCompleteInternalHandled = false ;
/*
* This method is executed only if the boolean "onLoadingInternalHandled" is set to false
* The method delegate the call to the ajaxLoading() method of the HttpResponseHandler
*/
instance.onLoadingInternal = function() {
if (instance.onLoadingInternalHandled) return ;
if (typeof(instance.onLoading) == "function") instance.onLoading(instance) ;
instance.onLoadingInternalHandled = true ;
};
/**
* evaluate the response and return an object
*/
instance.evalResponse = function() {
try {
return eval((instance.responseText || ''));
} catch (e) {
throw (new Error('Cannot eval the response')) ;
}
};
/*
* This method is executed only if the boolean "onCompleteInternalHandled" is set to false
* The method delegate the call to the ajaxResponse() method of the HttpResponseHandler after
* calling the onSuccess() method of the current object
*
* During the processof this method, all the instance fields are filled with the content coming
* back from the AJAX call. Once the ajaxResponse() is called then the callback object is called
* if not null
*/
instance.onCompleteInternal = function(xhr, statusText) {
if (instance.onCompleteInternalHandled || instance.aborted) return;
if (statusText == "timeout") {
instance.onTimeoutInternal();
} else {
try {
instance.responseReceived = true;
instance.status = xhr.status;
instance.statusText = statusText;
instance.responseText = xhr.responseText;
instance.responseXML = xhr.responseXML;
} catch(err) {
instance.status = 0;
}
if(typeof(instance.onComplete) == "function") instance.onComplete(instance);
if (statusText == "success" && typeof(instance.onSuccess) == "function") {
instance.onSuccess(instance) ;
instance.onCompleteInternalHandled = true ;
if (typeof(instance.callBack) == "function") {
instance.callBack(instance) ;
} else if (instance.callBack) { // Modified by Uoc Nguyen: allow user use custom javascript code for callback
try {
eval(instance.callBack) ;
}
catch (e) {
throw (new Error('Can not execute callback...')) ;
}
}
} else if (typeof(instance.onError) == "function") {
instance.onError(instance) ;
instance.onCompleteInternalHandled = false ;
}
}
};
/*
* This method is executed only if the boolean "onLoadingInternalHandled" is set to false
* The method delegate the call to the ajaxTimeout() method of the HttpResponseHandler
*/
instance.onTimeoutInternal = function() {
if (instance == null || instance.request == null || instance.onCompleteInternalHandled) return;
instance.aborted = true;
if (typeof(instance.onTimeout) == "function") instance.onTimeout(instance);
} ;
/*
* This method is directly called from the doRequest() method. It opens a connection to the server,
* set up the handlers and sends the query to it. Status methods are then called on the request object
* during the entire lifecycle of the call
*
* It also sets up the time out and its call back to the method of the current instance onTimeoutInternal()
*/
instance.process = function() {
var contentType;
if (instance.method == "POST") {
contentType = "application/x-www-form-urlencoded; charset=UTF-8";
} else {
contentType = "text/plain;charset=UTF-8";
}
instance.request = $.ajax(instance.url, {
type : instance.method,
beforeSend : instance.onLoadingInternal,
complete : instance.onCompleteInternal,
contentType : contentType,
data : instance.queryString,
timeout : instance.timeout,
cache : false
});
};
return instance ;
} ;
/*****************************************************************************************/
/*
* This object is also a wrapper object on top of several methods:
* - executeScript
* - updateBlocks
* - ajaxTimeout
* - ajaxResponse
* - ajaxLoading
*
* Those methods are executed during the process of the AJAX call
*/
function HttpResponseHandler() {
var instance = new Object() ;
/*
* instance.to stores a timeout object used to postpone the display of the loading popup
* the timeout is defined later in the instance.ajaxLoading function
*/
instance.to = null;
/*
* This internal method is used to dynamically load JS scripts in the
* browser by using the eval() method;
*/
instance.executeScript = function(script) {
if(script == null || script == "") return ;
try {
eval($("<div />").html(script).text());
return;
} catch(err) {
}
var elements = script.split(';') ;
if(elements != null && elements.length > 0) {
for(var i = 0; i < elements.length; i++) {
try {
eval(elements[i]) ;
} catch(err) {
alert(err +" : "+elements[i] + " -- " + i) ;
}
}
}
} ;
instance.updateHtmlHead = function(response) {
if (!response) return;
cleanHtmlHead(response);
var head = $("head");
var markupHeadElements = response.markupHeadElements;
if (!markupHeadElements) return;
if (markupHeadElements.titles && markupHeadElements.titles.length != 0) {
var oldTitle = head.children("title");
var newTitle = markupHeadElements.titles[markupHeadElements.titles.length - 1];
if (oldTitle.length) {
oldTitle.replaceWith(newTitle);
} else {
head[0].appendChild(newTitle);
}
}
appendElementsToHead(head, markupHeadElements.metas);
appendElementsToHead(head, markupHeadElements.bases);
appendElementsToHead(head, markupHeadElements.links);
appendElementsToHead(head, markupHeadElements.styles);
appendElementsToHead(head, markupHeadElements.scripts);
};
function cleanHtmlHead(response)
{
var head = $("head");
if (response)
{
var portletResponses = response.portletResponses;
if (portletResponses)
{
for (var i = 0; i < portletResponses.length; i++)
{
head.find(".ExHead-" + portletResponses[i].portletId + ":not(title)").remove();
}
}
if (response.data)
{
$(response.data).find(".PORTLET-FRAGMENT").each(function()
{
head.find(".ExHead-" + this.parentNode.id.replace("EditMode-", "") + ":not(title)").remove();
});
}
}
else
{
//This code will be run after we've finished update html
var portlets = $("body .PORTLET-FRAGMENT");
var exHeads = head.find("[class^='ExHead-']:not(title)");
exHeads.each(function()
{
var portletId = this.className.substring(7);
var del = true;
portlets.each(function() {
if (this.parentNode.id.replace("EditMode-", "") === portletId) {
del = false;
}
});
if (del)
{
$(this).remove();
}
});
}
}
function appendElementsToHead(head, elements) {
if (!elements) return;
elements.each(function() {
head[0].appendChild(this);
});
}
/*
* This methods will replace some block content by new one.
* This is the important concept in any AJAX call where JS is used to dynamically
* refresh a part of the page.
*
* The first argument is an array of blocks to update while the second argument is
* the id of the html component that is the parent of the block to update
*
* Each block in the array contains the exact id to update, hence a loop is executed
* for each block and the HTML is then dynamically replaced by the new one
*/
instance.updateBlocks = function(blocksToUpdate, parentId) {
if(!blocksToUpdate) return;
var parentBlock = null;
if(parentId && parentId != "") parentBlock = $("#" + parentId);
parentBlock = !parentBlock ? $(document) : parentBlock;
$.each(blocksToUpdate, function() {
var blockToUpdate = this;
var target = parentBlock.find("#" + blockToUpdate.blockId);
if(target.length == 0) alert(_module.I18NMessage.getMessage("TargetBlockNotFound", new Array (blockToUpdate.blockId))) ;
var newData = $(blockToUpdate.data).find("#" + blockToUpdate.blockId);
if(newData.length == 0) alert(_module.I18NMessage.getMessage("BlockUpdateNotFound", new Array (blockToUpdate.blockId))) ;
// target.parentNode.replaceChild(newData, target);
target.html(newData.html());
//update embedded scripts
if(blockToUpdate.scripts) {
for(var k = 0 ; k < blockToUpdate.scripts.length; k++) {
var encodedName = 'script_' + k + '_' + blockToUpdate.blockId;
appendScriptToHead(encodedName, blockToUpdate.scripts[k]);
}
}
});
};
/*
* This method is called when the AJAX call was too long to be executed
*/
instance.ajaxTimeout = function(request) {
_module.UIMaskLayer.removeMasks(eXo.portal.AjaxRequest.maskLayer) ;
eXo.portal.AjaxRequest.maskLayer = null ;
eXo.portal.CurrentRequest = null ;
window.location.reload() ;
};
/*
* This method is called when the AJAX call is completed and that the request.responseText
* has been filled with the returning HTML. Hence the goal of this method is to update the
* diffent blocks dynamically.
*
* 1) Create a temporary div element and set the response HTML text to its innerHTML variable of the
temp object
* 2) Use the DOMUtil.findFirstDescendantByClass() method to get the div with the Id "PortalResponse"
* out of the returned HTML
* 3) Create the PortalResponse object by passing the previous DOM element as an argumen, it will
* provide an OO view of the PortletResponse and other portal response blocks to update
* 4) Each portlet response block is the updated using the naming convention "UIPortlet-" + portletId;
* and then the script are loaded
* 5) Then it is each portal block which is updated and the assocaited scripts are evaluated
*/
instance.ajaxResponse = function(request, response) {
var that = this;
if (!response) {
var response = new PortalResponse(that.responseText) ;
instance.updateHtmlHead(response);
}
var loadingScripts = response.loadingScripts;
var immediateScripts = loadingScripts ? loadingScripts.immediateScripts : [];
if (immediateScripts.length) {
require(immediateScripts, function() {
immediateScripts.length = 0;
instance.ajaxResponse.apply(that, [request, response]);
});
return;
}
//Handle the portlet responses
var portletResponses = response.portletResponses ;
if(portletResponses) {
$.each(portletResponses, function() {
var portletResponse = this;
if(!portletResponse.blocksToUpdate) {
/*
* This means that the entire portlet fragment is included in the portletResponse.portletData
* and that it does not contain any finer block to update. Hence replace the innerHTML inside the
* id="PORTLET-FRAGMENT" block
*/
var parentBlock = $("#" + portletResponse.portletId) ;
var target = $("#" + portletResponse.portletId + " .PORTLET-FRAGMENT").first();
target.html(portletResponse.portletData);
//update embedded scripts
if(portletResponse.scripts) {
portletResponse.scripts.each(function(index) {
var encodedName = 'script_' + index + '_' + portletResponse.portletId;
appendScriptToHead(encodedName, this);
});
}
} else {
/*
* Else updates each block with the portlet
*/
instance.updateBlocks(portletResponse.blocksToUpdate, portletResponse.portletId) ;
}
});
}
if(!response.blocksToUpdate && request.responseText !== "") {
if(confirm(_module.I18NMessage.getMessage("SessionTimeout"))) instance.ajaxTimeout(request) ;
}
try {
//Handle the portal responses
instance.updateBlocks(response.blocksToUpdate) ;
//After handle html response. We need to remove extra markup header of removed portlets
cleanHtmlHead();
instance.executeScript(response.script);
/**
* Clears the instance.to timeout if the request takes less time than expected to get response
* Removes the transparent mask so the UI is available again, with cursor "auto"
*/
clearTimeout(instance.to);
_module.UIMaskLayer.removeMasks(eXo.portal.AjaxRequest.maskLayer) ;
eXo.portal.AjaxRequest.maskLayer = null ;
eXo.portal.CurrentRequest = null ;
} catch (error) {
alert(error.message) ;
}
};
/*
* This method is called when doing an AJAX call, it will put the "Loading" image in the
* middle of the page for the entire call of the request
*/
instance.ajaxLoading = function(request) {
if (request.isAsynchronize()) return;
/**
* Waits 2 seconds (2000 ms) to display the loading popup
* if the response comes before this timeout, the loading popup won't appear at all
* Displays a transparent mask with the "wait" cursor to tell the user something is processing
*
* Modified by Truong LE to avoid double click problem
*/
if(eXo.portal.AjaxRequest.maskLayer == null ){
eXo.portal.AjaxRequest.maskLayer = _module.UIMaskLayer.createTransparentMask();
}
instance.to = setTimeout(function() {
if(eXo.portal.AjaxRequest.maskLayer != null) {
_module.UIMaskLayer.showAjaxLoading(eXo.portal.AjaxRequest.maskLayer);
}
}, 2000);
};
return instance ;
}
/*
* The doRequest() method takes incoming request from GET and POST calls
* The second argument is the URL to target on the server
* The third argument is the query string object which is created out of
* a form element, this value is not null only when there is a POST request.
*
* 1) An AjaxRequest object is instanciated, it holds the reference to the
* XHR method
* 2) An HttpResponseHandler object is instantiated and its methods like
* ajaxResponse, ajaxLoading, ajaxTimeout are associated with the one from
* the AjaxRequest and will be called by the XHR during the process method
*/
window.doRequest = function(method, url, queryString, callback) {
request = new AjaxRequest(method, url, queryString) ;
handler = new HttpResponseHandler() ;
request.onSuccess = handler.ajaxResponse ;
request.onLoading = handler.ajaxLoading ;
request.onTimeout = handler.ajaxTimeout ;
request.callBack = callback ;
eXo.portal.CurrentRequest = request ;
request.process() ;
eXo.session.startItv();
}
/**
* Abort an ajax request
* @return
*/
function ajaxAbort() {
_module.UIMaskLayer.removeMasks(eXo.portal.AjaxRequest.maskLayer) ;
eXo.portal.AjaxRequest.maskLayer = null ;
eXo.portal.CurrentRequest.request.abort() ;
eXo.portal.CurrentRequest.aborted = true ;
eXo.portal.CurrentRequest = null ;
}
/**
* Create an ajax GET request
* @param {String} url - Url
* @param {boolean} async - asynchronous or none
* @return {String} response text if request is not async
*/
window.ajaxAsyncGetRequest = function(url, async) {
return ajaxRequest("GET", url, async);
}
/**
* Create an ajax request
* @param {String} method - GET, POST, etc
* @param {String} url - Url
* @param {boolean} async - asynchronous or none
* @return {String} response text if request is not async
*/
window.ajaxRequest = function(method, url, async, queryString) {
if(async == undefined) async = true ;
var resp;
$.ajax(url, {
type: method,
async : async,
data : queryString,
headers : {"Cache-Control" : "max-age=86400"},
complete : function(jqXHR) {
resp = jqXHR.responseText;
}
});
eXo.session.startItv();
if(!async) return resp ;
}
/**
* Redirect browser to url
* @param url
* @return
*/
function ajaxRedirect(url) {
url = url.replace(/&/g, "&") ;
window.location.href = url ;
}
eXo.portal.AjaxRequest = AjaxRequest.prototype.constructor ;