webbuild.js: fixes

This commit is contained in:
Silvan Calarco 2016-07-03 19:58:41 +02:00
parent 81153435c1
commit 61960704b0
2 changed files with 21 additions and 15 deletions

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
WEBBUILD_HOST=mambanana WEBBUILD_HOST=mambanana
if [ "$QUERY_STRING" ]; then if [ "$QUERY_STRING" ]; then
# get (download, preserve content-type and content-disposition headrs) # get (download, preserve content-type and content-disposition headers)
contentdisposition=`curl -4 --connect-timeout 40 -sI "http://$WEBBUILD_HOST/cgi-bin/webbuild?$QUERY_STRING" -H "Content-Type: $CONTENT_TYPE" | grep Content-Disposition` contentdisposition=`curl -4 --connect-timeout 40 -sI "http://$WEBBUILD_HOST/cgi-bin/webbuild?$QUERY_STRING" -H "Content-Type: $CONTENT_TYPE" | grep Content-Disposition`
echo "\ echo "\
$contentdisposition $contentdisposition

View File

@ -185,14 +185,21 @@ function getDownload(request) {
// ajaxFileUpload // ajaxFileUpload
jQuery.extend({ jQuery.extend({
handleError: function( s, xhr, status, e ) {
// If a local callback was specified, fire it
if ( s.error )
s.error( xhr, status, e );
// If we have some XML response text (e.g. from an AJAX call) then log it in the console
else if(xhr.responseText)
console.log(xhr.responseText);
},
createUploadIframe: function(id, uri) createUploadIframe: function(id, uri)
{ {
//create frame //create frame
var frameId = 'jUploadFrame' + id; var frameId = 'jUploadFrame' + id;
var iframeHtml = '<iframe id="' + frameId + '" name="' + frameId + '" style="position:absolute; top:-9999px; left:-9999px"'; var iframeHtml = '<iframe id="' + frameId + '" name="' + frameId + '" style="position:absolute; top:-9999px; left:-9999px"';
if(window.ActiveXObject) if(window.ActiveXObject)
{ {
if(typeof uri== 'boolean'){ if(typeof uri== 'boolean'){
iframeHtml += ' src="' + 'javascript:false' + '"'; iframeHtml += ' src="' + 'javascript:false' + '"';
@ -238,13 +245,13 @@ jQuery.extend({
}, },
ajaxFileUpload: function(s) { ajaxFileUpload: function(s) {
// TODO introduce global settings, allowing the client to modify them for all requests, not only timeout // TODO introduce global settings, allowing the client to modify them for all requests, not only timeout
s = jQuery.extend({}, jQuery.ajaxSettings, s); s = jQuery.extend({}, jQuery.ajaxSettings, s);
var id = new Date().getTime() var id = new Date().getTime();
var form = $.createUploadForm(id, s.fileElementId, (typeof(s.data)=='undefined'?false:s.data)); var form = $.createUploadForm(id, s.fileElementId, (typeof(s.data)=='undefined'?false:s.data));
var io = $.createUploadIframe(id, s.secureuri); var io = $.createUploadIframe(id, s.secureuri);
var frameId = 'jUploadFrame' + id; var frameId = 'jUploadFrame' + id;
var formId = 'jUploadForm' + id; var formId = 'jUploadForm' + id;
// Watch for a new set of requests // Watch for a new set of requests
if ( s.global && ! jQuery.active++ ) if ( s.global && ! jQuery.active++ )
{ {
@ -263,14 +270,13 @@ jQuery.extend({
{ {
if(io.contentWindow) if(io.contentWindow)
{ {
xml.responseText = io.contentWindow.document.body?io.contentWindow.document.body.innerHTML:null; xml.responseText = io.contentWindow.document.body?io.contentWindow.document.body.innerHTML:null;
xml.responseXML = io.contentWindow.document.XMLDocument?io.contentWindow.document.XMLDocument:io.contentWindow.document; xml.responseXML = io.contentWindow.document.XMLDocument?io.contentWindow.document.XMLDocument:io.contentWindow.document;
}else if(io.contentDocument) }else if(io.contentDocument)
{ {
xml.responseText = io.contentDocument.document.body?io.contentDocument.document.body.innerHTML:null; xml.responseText = io.contentDocument.document.body?io.contentDocument.document.body.innerHTML:null;
xml.responseXML = io.contentDocument.document.XMLDocument?io.contentDocument.document.XMLDocument:io.contentDocument.document; xml.responseXML = io.contentDocument.document.XMLDocument?io.contentDocument.document.XMLDocument:io.contentDocument.document;
} }
}catch(e) }catch(e)
{ {
$.handleError(s, xml, null, e); $.handleError(s, xml, null, e);