Commit da171fd4 authored by Sven Franck's avatar Sven Franck

fixed display of status loader, added generic JIO POST

parent 19c141a9
......@@ -3595,6 +3595,8 @@
var property,
replace,
i,
obj,
value,
form_elements,
form_element,
pass = false,
......@@ -3644,20 +3646,39 @@
// valid form and no spam
if (pass) {
replace = form_to_submit.id.split("_")[0] + "_";
obj = {};
for (property in valid) {
if (valid.hasOwnProperty(property)) {
formData.append(property.replace(replace, ""), valid[property]);
value = valid[property];
// prepare for storage
// TODO: check for portal-type in field name and skip if missing
if (property !== "undefined") {
obj[property] = value;
}
// prepare for form submit
formData.append(property.replace(replace, ""), value);
}
}
// report to ERP5
// create ERP5 event
// TODO: remove once normal access is possible
util.updateStatus("show", "", "global.status_dict.uploading");
util.ajax({
"url": "https://nexedi.erp5.net/" +
"ERP5Site_addApplicationSubmissionRequest",
"type": "POST",
"data": formData
})
// .then(function () {
// // TODO: a post should always include all required fields
// // TODO: find a way to set default fields, like timestamp etc
// return app.postDataToStorage({
// "response": [obj],
// "baggage": {"type": config.portal_type_source}
// })
// })
.then(function() {
$.mobile.changePage("#thanks");
})
......@@ -4129,8 +4150,8 @@
// ===== SAMPLE DATA ========
.then(app.testStorageForData)
.then(app.retrieveSampleData)
.then(app.storeSampleDataInStorage)
// ===== SAMPLE DATA ========
.then(app.postDataToStorage)
.then(app.fetchDataTotal)
.then(app.fetchDataQuery)
.then(app.generateGadgetContent)
......@@ -4355,7 +4376,7 @@
* @param {object} parcel object containing storage, type and baggage
* @return {object} promise object/baggage
*/
app.storeSampleDataInStorage = function (reply) {
app.postDataToStorage = function (reply) {
var i,
obj,
key,
......@@ -4977,20 +4998,21 @@
* @param {string} icon Which icon to display when overriding the loader
*/
util.updateStatus = function (show, message, msg_i18n, icon) {
var text_to_display = i18n ?
var text_to_display = i18n && msg_i18n ?
factory.map_actions.translateLookup(msg_i18n) : message;
// hm... jQuery...
// hm... jQuery... hm string building
// TODO: better way?
if (app.default_dict.loader) {
$.mobile.loading(
show ? "show" : "hide",
"show",
{
"text": "",
"textVisible": true,
"theme": app.default_dict.loader_theme,
"text": icon === undefined ? message : "",
"html": icon === undefined ? "" :
'<span class="ui-icon-' + icon + ' loader_icon> </span>'+
'<h1 class="loader_message">' + text_to_display + '</h1>'
"html": "<span class='ui-icon-" +
(icon ? (icon + " loading_icon") : "loading") + "'> </span>" +
"<h1 class='loader_message'>" + text_to_display + "</h1>"
}
);
......
......@@ -21,6 +21,10 @@
"back": "Back",
"clear": "Delete"
},
"status_dict": {
"uploading": "Uploading",
"sync": "Sychronizing"
},
"form_helpers": {
"secure_blank": "Please do not fill out this field",
"secure_filled": "Please leave this value unchanged"
......
......@@ -21,6 +21,10 @@
"back": "后退",
"clear": "删除"
},
"status_dict": {
"uploading": "Uploading",
"sync": "Sychronizing"
},
"form_helpers": {
"secure_blank": "Please do not fill out this field",
"secure_filled": "Please leave this value unchanged"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment