Commit 329ff483 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_jio: Replace getAttachment to putAttachement

parent 504d008d
/*global window, rJS, RSVP */
/*global window, rJS, RSVP, jIO */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS, RSVP) {
(function (window, rJS, RSVP, jIO) {
"use strict";
rJS(window)
......@@ -10,9 +10,10 @@
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("updatePanel", "updatePanel")
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("getSettingList", "getSettingList")
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")
.declareAcquiredMethod("jio_putAttachment", "jio_putAttachment")
.declareAcquiredMethod("notifySubmitting", "notifySubmitting")
.declareAcquiredMethod("notifySubmitted", 'notifySubmitted')
.declareAcquiredMethod("getTranslationList", "getTranslationList")
......@@ -32,15 +33,20 @@
})
.push(function (form_gadget) {
return RSVP.all([form_gadget.getContent(),
gadget.getSetting('me')]);
gadget.getSettingList(['me', 'hateoas_url'])]);
})
.push(function (result) {
var doc = result[0], me = result[1];
return gadget.getSetting("hateoas_url")
.push(function (url) {
return gadget.jio_getAttachment(me,
url + me + "/Person_requestNetwork?title=" + doc.title);
});
var doc = result[0],
me = result[1][0],
url = result[1][1];
return gadget.jio_putAttachment(me,
url + me + "/Person_requestNetwork", {title: doc.title});
})
.push(function (attachment) {
return jIO.util.readBlobAsText(attachment.target.response);
})
.push(function (response) {
return JSON.parse(response.target.result);
})
.push(function (result) {
return gadget.notifySubmitted({message: gadget.message_translation, status: 'success'})
......@@ -124,4 +130,4 @@
});
});
});
}(window, rJS, RSVP));
\ No newline at end of file
}(window, rJS, RSVP, jIO));
\ No newline at end of file
......@@ -279,7 +279,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>996.48626.19826.13090</string> </value>
<value> <string>996.64461.17044.24763</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -297,7 +297,7 @@
</tuple>
<state>
<tuple>
<float>1639166593.8</float>
<float>1640118847.62</float>
<string>UTC</string>
</tuple>
</state>
......
/*global window, rJS, RSVP */
/*global window, rJS, RSVP, jIO */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS, RSVP) {
(function (window, rJS, RSVP, jIO) {
"use strict";
rJS(window)
......@@ -10,9 +10,10 @@
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("updatePanel", "updatePanel")
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("getSettingList", "getSettingList")
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")
.declareAcquiredMethod("jio_putAttachment", "jio_putAttachment")
.declareAcquiredMethod("notifySubmitting", "notifySubmitting")
.declareAcquiredMethod("notifySubmitted", 'notifySubmitted')
.declareAcquiredMethod("getTranslationList", "getTranslationList")
......@@ -32,15 +33,20 @@
})
.push(function (form_gadget) {
return RSVP.all([form_gadget.getContent(),
gadget.getSetting('me')]);
gadget.getSettingList(['me', 'hateoas_url'])]);
})
.push(function (result) {
var doc = result[0], me = result[1];
return gadget.getSetting("hateoas_url")
.push(function (url) {
return gadget.jio_getAttachment(me,
url + me + "/Person_requestSite?title=" + doc.title);
});
var doc = result[0],
me = result[1][0],
url = result[1][1];
return gadget.jio_putAttachment(me,
url + me + "/Person_requestSite", {title: doc.title});
})
.push(function (attachment) {
return jIO.util.readBlobAsText(attachment.target.response);
})
.push(function (response) {
return JSON.parse(response.target.result);
})
.push(function (result) {
return gadget.notifySubmitted({message: gadget.message_translation, status: 'success'})
......@@ -128,4 +134,4 @@
});
});
});
}(window, rJS, RSVP));
\ No newline at end of file
}(window, rJS, RSVP, jIO));
\ No newline at end of file
......@@ -147,7 +147,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>SlapOS Add Organisation JS</string> </value>
<value> <string>SlapOS Add Organisation Site JS</string> </value>
</item>
<item>
<key> <string>url_string</string> </key>
......@@ -290,7 +290,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>996.47007.31595.62890</string> </value>
<value> <string>996.64499.26395.1621</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -308,7 +308,7 @@
</tuple>
<state>
<tuple>
<float>1639070506.86</float>
<float>1640118973.31</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -20,7 +20,6 @@
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="gadget_slapos_utils.js" type="text/javascript"></script>
<script src="gadget_erp5_page_slap_add_project.js"></script>
</head>
......
......@@ -283,7 +283,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>994.61547.14201.59494</string> </value>
<value> <string>996.45665.13466.27972</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -301,7 +301,7 @@
</tuple>
<state>
<tuple>
<float>1638988872.31</float>
<float>1640183877.21</float>
<string>UTC</string>
</tuple>
</state>
......
/*global window, rJS, RSVP */
/*global window, rJS, RSVP, jIO*/
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS, RSVP) {
(function (window, rJS, RSVP, jIO) {
"use strict";
rJS(window)
......@@ -10,9 +10,10 @@
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("updatePanel", "updatePanel")
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("getSettingList", "getSettingList")
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")
.declareAcquiredMethod("jio_putAttachment", "jio_putAttachment")
.declareAcquiredMethod("notifySubmitting", "notifySubmitting")
.declareAcquiredMethod("notifySubmitted", 'notifySubmitted')
.declareAcquiredMethod("getTranslationList", "getTranslationList")
......@@ -32,15 +33,20 @@
})
.push(function (form_gadget) {
return RSVP.all([form_gadget.getContent(),
gadget.getSetting('me')]);
gadget.getSettingList(['me', 'hateoas_url'])]);
})
.push(function (result) {
var doc = result[0], me = result[1];
return gadget.getSetting("hateoas_url")
.push(function (url) {
return gadget.jio_getAttachment(me,
url + me + "/Person_requestProject?title=" + doc.title);
});
var doc = result[0],
me = result[1][0],
url = result[1][1];
return gadget.jio_putAttachment(me,
url + me + "/Person_requestProject", {title: doc.title});
})
.push(function (attachment) {
return jIO.util.readBlobAsText(attachment.target.response);
})
.push(function (response) {
return JSON.parse(response.target.result);
})
.push(function (result) {
return gadget.notifySubmitted({message: gadget.message_translation, status: 'success'})
......@@ -123,4 +129,4 @@
});
});
});
}(window, rJS, RSVP));
\ No newline at end of file
}(window, rJS, RSVP, jIO));
\ No newline at end of file
......@@ -279,7 +279,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>996.45661.39570.44526</string> </value>
<value> <string>996.45681.58470.58709</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -297,7 +297,7 @@
</tuple>
<state>
<tuple>
<float>1638989873.52</float>
<float>1640118896.01</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -19,7 +19,6 @@
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="gadget_slapos_utils.js" type="text/javascript"></script>
<script src="gadget_erp5_page_slap_person_add_organisation.js"></script>
</head>
......
......@@ -281,7 +281,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>994.61547.14201.59494</string> </value>
<value> <string>996.45665.56224.23449</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -299,7 +299,7 @@
</tuple>
<state>
<tuple>
<float>1638988911.46</float>
<float>1640183701.65</float>
<string>UTC</string>
</tuple>
</state>
......
/*global window, rJS, RSVP */
/*global window, rJS, RSVP, jIO*/
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS, RSVP) {
(function (window, rJS, RSVP, jIO) {
"use strict";
rJS(window)
......@@ -10,9 +10,10 @@
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("updatePanel", "updatePanel")
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("getSettingList", "getSettingList")
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")
.declareAcquiredMethod("jio_putAttachment", "jio_putAttachment")
.declareAcquiredMethod("notifySubmitting", "notifySubmitting")
.declareAcquiredMethod("notifySubmitted", 'notifySubmitted')
.declareAcquiredMethod("getTranslationList", "getTranslationList")
......@@ -32,15 +33,20 @@
})
.push(function (form_gadget) {
return RSVP.all([form_gadget.getContent(),
gadget.getSetting('me')]);
gadget.getSettingList(['me', 'hateoas_url'])]);
})
.push(function (result) {
var doc = result[0], me = result[1];
return gadget.getSetting("hateoas_url")
.push(function (url) {
return gadget.jio_getAttachment(me,
url + me + "/Person_requestOrganisation?title=" + doc.title);
});
var doc = result[0],
me = result[1][0],
url = result[1][1];
return gadget.jio_putAttachment(me,
url + me + "/Person_requestOrganisation", {title: doc.title});
})
.push(function (attachment) {
return jIO.util.readBlobAsText(attachment.target.response);
})
.push(function (response) {
return JSON.parse(response.target.result);
})
.push(function (result) {
return gadget.notifySubmitted({message: gadget.message_translation, status: 'success'})
......@@ -127,4 +133,4 @@
});
});
});
}(window, rJS, RSVP));
\ No newline at end of file
}(window, rJS, RSVP, jIO));
\ No newline at end of file
......@@ -288,7 +288,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>996.45677.54455.28313</string> </value>
<value> <string>996.64494.45558.13687</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -306,7 +306,7 @@
</tuple>
<state>
<tuple>
<float>1638989850.16</float>
<float>1640191658.53</float>
<string>UTC</string>
</tuple>
</state>
......
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