diff --git a/mindplot/src/main/javascript/libraries/moodialog/MooDialog.Request.js b/mindplot/src/main/javascript/libraries/moodialog/MooDialog.Request.js index 101fa6e1..a5b5cf17 100644 --- a/mindplot/src/main/javascript/libraries/moodialog/MooDialog.Request.js +++ b/mindplot/src/main/javascript/libraries/moodialog/MooDialog.Request.js @@ -15,17 +15,47 @@ MooDialog.Request = new Class({ initialize: function(url, requestOptions, options) { this.parent(options); - this.requestOptions = requestOptions || {method:'get'}; - this.requestOptions.url = url; + this.requestOptions = requestOptions || {}; this.requestOptions.update = this.content; this.requestOptions.evalScripts = true; + this.requestOptions.noCache = true; + + this.requestOptions.onFailure = function(xhr) { + // Intercept form requests ... + console.log("Failure:"); + console.log(xhr); + }.bind(this); + + this.requestOptions.onSuccess = function() { + // Intercept form requests ... + var forms = this.content.getElements('form'); + forms.forEach(function(form) { + form.addEvent('submit', function(event) { + // Intercept form ... + this.requestOptions.url = form.action; + this.requestOptions.method = form.method ? form.method : 'post'; + var request = new Request.HTML(this.requestOptions); + request.post(form); + event.stopPropagation(); + return false; + }.bind(this)) + }.bind(this)); + }.bind(this); + this.addEvent('open', function() { - var request = new Request.HTML(this.requestOptions).send(); + this.requestOptions.url = url; + this.requestOptions.method = 'get'; + var request = new Request.HTML(this.requestOptions); + request.send(); + MooDialog.Request.active = this; }.bind(this)); - if (this.options.autoOpen) this.open(); + this.addEvent('close', function() { + MooDialog.Request.active = null; + }.bind(this)); + if (this.options.autoOpen) this.open(); }, setRequestOptions: function(options) { diff --git a/wise-doc/src/main/webapp/html/editor.html b/wise-doc/src/main/webapp/html/editor.html index 62e3ba93..492a0729 100644 --- a/wise-doc/src/main/webapp/html/editor.html +++ b/wise-doc/src/main/webapp/html/editor.html @@ -196,7 +196,7 @@