Commit eae682ea authored by Jérome Perrin's avatar Jérome Perrin

publish static version

parent 4a2779c8
...@@ -56,10 +56,14 @@ ...@@ -56,10 +56,14 @@
}); });
}).push(function(data) { }).push(function(data) {
data = JSON.parse(data); data = JSON.parse(data);
if (!data.result.result_list) {
data.result.result_list = [];
}
// XXX option to always add ? // XXX option to always add ?
if (data.general.reset_result_list) { if (data.general.reset_result_list) {
data.result.result_list = []; data.result.result_list = [];
} }
data.result.result_list = [];
data.result.result_list = data.result.result_list.concat(result_json.data.result.result_list); data.result.result_list = data.result.result_list.concat(result_json.data.result.result_list);
return gadget.aq_putAttachment({ return gadget.aq_putAttachment({
_id: gadget.props.jio_key, _id: gadget.props.jio_key,
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<script src="../lib/jquery.js" type="text/javascript"></script> <script src="../lib/jquery.js" type="text/javascript"></script>
<script src="mixin_gadget.js" type="text/javascript"></script> <script src="mixin_gadget.js" type="text/javascript"></script>
<script src="Output_viewDownloadExcelSpreadsheet.js" type="text/javascript"></script> <script src="Output_viewDownloadFile.js" type="text/javascript"></script>
</head> </head>
<body> <body>
<a class="download_link ui-btn ui-btn-inline ui-icon-action ui-btn-icon-right">Download</a> <a class="download_link ui-btn ui-btn-inline ui-icon-action ui-btn-icon-right">Download</a>
......
...@@ -12,9 +12,10 @@ ...@@ -12,9 +12,10 @@
_id: gadget.props.jio_key, _id: gadget.props.jio_key,
_attachment: "body.json" _attachment: "body.json"
}).push(function(simulation_json) { }).push(function(simulation_json) {
var result = JSON.parse(simulation_json)[0].result, download_link = gadget.props.element.querySelector(".download_link"); var result = JSON.parse(simulation_json).result.result_list[options.result], output = result[options.action_definition.configuration.output_id], download_link = gadget.props.element.querySelector(".download_link");
download_link.download = "demandPlannerOutput.xls"; /* XXX this does not work with Internet Explorer */
download_link.href = "data:application/excel;base64," + result["demandPlannerOutput.xls"]; download_link.download = output.name;
download_link.href = "data:" + output.mime_type + ";base64," + output.data;
}); });
}).declareMethod("startService", function() { }).declareMethod("startService", function() {
return new RSVP.Queue().push(function() { return new RSVP.Queue().push(function() {
......
/*global rJS, RSVP, initGadgetMixin, loopEventListener, $ */ /*global rJS, RSVP, initGadgetMixin, $ */
(function(window, rJS, RSVP, initGadgetMixin, loopEventListener, $) { (function(window, rJS, RSVP, initGadgetMixin, $) {
"use strict"; "use strict";
var gadget_klass = rJS(window); var gadget_klass = rJS(window);
initGadgetMixin(gadget_klass); initGadgetMixin(gadget_klass);
...@@ -19,9 +19,8 @@ ...@@ -19,9 +19,8 @@
result_list[1].render(JSON.stringify(content), handsontable_options); result_list[1].render(JSON.stringify(content), handsontable_options);
}); });
}).declareMethod("startService", function() { }).declareMethod("startService", function() {
var gadget = this;
return this.getDeclaredGadget("tableeditor").push(function(tableeditor) { return this.getDeclaredGadget("tableeditor").push(function(tableeditor) {
return tableeditor.startService(); return tableeditor.startService();
}); });
}); });
})(window, rJS, RSVP, initGadgetMixin, loopEventListener, $); })(window, rJS, RSVP, initGadgetMixin, $);
\ No newline at end of file \ No newline at end of file
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