Commit 183d09a0 authored by Sven Franck's avatar Sven Franck

add missing actions for tickets. missing ERP5 handlers

parent d3b66663
......@@ -1533,6 +1533,62 @@
storage.add(obj);
},
/**
* Start a software instance
* @method start_instance
* @param {object} obj Action Object
**/
"update_ticket": function (obj) {
var element = obj.element, formData, valid, replace, property, value, id,
decode;
id = obj.state.fragment_list[1];
formData = new FormData();
valid = storage.validate(obj.gadget);
decode = /^[^\/]*%2[^\/]*$/.test(id);
if (valid === undefined) {
util.loader("", "validation_dict.general", "ban-circle");
// form is valid and not "spam"
} else {
replace = obj.gadget.id + "_";
for (property in valid) {
if (valid.hasOwnProperty(property)) {
value = valid[property];
// prepare to store
// TODO: add id to captcha fields missing it...
if (property !== "undefined") {
if (property !== "identifier") {
formData.append(property.replace(replace, ""), value);
}
}
}
}
util.loader("", "status_dict.updating");
storage["items"].get({"_id": obj.state.fragment_list[1]},{"_view": "web_view"})
.then(function(response) {
return jIO.util.ajax({
"url": util.parse(response).data._actions.update_allocation_scope.href,
"type": "POST",
"data": formData
});
})
.then(function (answer) {
util.loader("", "status_dict.success", "check");
$.mobile.changePage("#services");
})
.fail(function(error) {
util.error(error);
if (util.parse(error.target).responseText === "" && id && obj.state.callback) {
$.mobile.changePage(obj.state.callback.replace("__id__", decode ? id : window.encodeURIComponent(id)));
}
});
}
},
/**
* Add a server
* @method submit
......
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