mirror of
https://github.com/Karaka-Management/jsOMS.git
synced 2026-02-14 00:18:40 +00:00
Fix media upload
This commit is contained in:
parent
727fee799a
commit
577af40f56
|
|
@ -56,6 +56,8 @@
|
||||||
return 'application/json';
|
return 'application/json';
|
||||||
case jsOMS.Message.Request.RequestType.URL_ENCODE:
|
case jsOMS.Message.Request.RequestType.URL_ENCODE:
|
||||||
return 'application/x-www-form-urlencoded';
|
return 'application/x-www-form-urlencoded';
|
||||||
|
case jsOMS.Message.Request.RequestType.FILE:
|
||||||
|
return '';
|
||||||
default:
|
default:
|
||||||
return 'text/plain';
|
return 'text/plain';
|
||||||
}
|
}
|
||||||
|
|
@ -308,7 +310,8 @@
|
||||||
*/
|
*/
|
||||||
setType(type)
|
setType(type)
|
||||||
{
|
{
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
this.requestHeader['Content-Type'] = this.setContentTypeBasedOnType(this.type);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -365,12 +368,14 @@
|
||||||
this.xhr.open(this.method, jsOMS.Uri.UriFactory.build(this.uri));
|
this.xhr.open(this.method, jsOMS.Uri.UriFactory.build(this.uri));
|
||||||
|
|
||||||
for (let p in this.requestHeader) {
|
for (let p in this.requestHeader) {
|
||||||
if (this.requestHeader.hasOwnProperty(p)) {
|
if (this.requestHeader.hasOwnProperty(p) && this.requestHeader[p] !== '') {
|
||||||
this.xhr.setRequestHeader(p, this.requestHeader[p]);
|
this.xhr.setRequestHeader(p, this.requestHeader[p]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(this.xhr);
|
||||||
|
|
||||||
this.xhr.onreadystatechange = function()
|
this.xhr.onreadystatechange = function()
|
||||||
{
|
{
|
||||||
switch (self.xhr.readyState) {
|
switch (self.xhr.readyState) {
|
||||||
|
|
@ -381,12 +386,6 @@
|
||||||
self.result[self.xhr.status](self.xhr);
|
self.result[self.xhr.status](self.xhr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
|
||||||
// todo: handle server received request
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
// todo: server is handling request
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
// todo: create handler for error returns
|
// todo: create handler for error returns
|
||||||
}
|
}
|
||||||
|
|
@ -394,7 +393,9 @@
|
||||||
|
|
||||||
if (this.type === jsOMS.Message.Request.RequestType.JSON) {
|
if (this.type === jsOMS.Message.Request.RequestType.JSON) {
|
||||||
this.xhr.send(JSON.stringify(this.data));
|
this.xhr.send(JSON.stringify(this.data));
|
||||||
} else if (this.type === jsOMS.Message.Request.RequestType.RAW) {
|
} else if (this.type === jsOMS.Message.Request.RequestType.RAW
|
||||||
|
|| this.type === jsOMS.Message.Request.RequestType.FILE
|
||||||
|
) {
|
||||||
this.xhr.send(this.data);
|
this.xhr.send(this.data);
|
||||||
} else if (this.type === jsOMS.Message.Request.RequestType.URL_ENCODE) {
|
} else if (this.type === jsOMS.Message.Request.RequestType.URL_ENCODE) {
|
||||||
this.xhr.send(this.queryfy(this.data));
|
this.xhr.send(this.queryfy(this.data));
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
jsOMS.Message.Request.RequestType = Object.freeze({
|
jsOMS.Message.Request.RequestType = Object.freeze({
|
||||||
JSON: 'json',
|
JSON: 'json',
|
||||||
RAW: 'raw',
|
RAW: 'raw',
|
||||||
|
FILE: 'file',
|
||||||
URL_ENCODE: 'url'
|
URL_ENCODE: 'url'
|
||||||
});
|
});
|
||||||
}(window.jsOMS = window.jsOMS || {}));
|
}(window.jsOMS = window.jsOMS || {}));
|
||||||
|
|
|
||||||
|
|
@ -177,7 +177,9 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.app.eventManager.trigger(form.getId());
|
if (counter < 1) {
|
||||||
|
this.app.eventManager.trigger(form.getId());
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -93,9 +93,9 @@
|
||||||
getSubmit ()
|
getSubmit ()
|
||||||
{
|
{
|
||||||
return document.querySelectorAll(
|
return document.querySelectorAll(
|
||||||
'#' + this.id + ' input[type=submit],'
|
'#' + this.id + ' input[type=submit], '
|
||||||
+ ' button[form=' + this.id + '][type=submit],'
|
+ 'button[form=' + this.id + '][type=submit], '
|
||||||
+ ' #' + this.id + ' button[type=submit]'
|
+ '#' + this.id + ' button[type=submit]'
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user