Commit 147826e9 authored by Romain Courteaud's avatar Romain Courteaud Committed by Jérome Perrin

Publish static files.

parent 2ae6d546
...@@ -8,12 +8,12 @@ ...@@ -8,12 +8,12 @@
// Precompile the templates while loading the first gadget instance // Precompile the templates while loading the first gadget instance
var gadget_klass = rJS(window), source = gadget_klass.__template_element.getElementById("table-template").innerHTML, table_template = Handlebars.compile(source); var gadget_klass = rJS(window), source = gadget_klass.__template_element.getElementById("table-template").innerHTML, table_template = Handlebars.compile(source);
initGadgetMixin(gadget_klass); initGadgetMixin(gadget_klass);
gadget_klass.declareAcquiredMethod("aq_allDocs", "allDocs").declareAcquiredMethod("pleaseRedirectMyHash", "pleaseRedirectMyHash").declareAcquiredMethod("whoWantToDisplayThisPage", "whoWantToDisplayThisPage").declareAcquiredMethod("whoWantToDisplayThisDocument", "whoWantToDisplayThisDocument").declareMethod("render", function(options) { gadget_klass.declareAcquiredMethod("aq_allDocs", "allDocs").declareAcquiredMethod("pleaseRedirectMyHash", "pleaseRedirectMyHash").declareAcquiredMethod("whoWantToDisplayThisDocument", "whoWantToDisplayThisDocument").declareMethod("render", function(options) {
var gadget = this; var gadget = this;
return gadget.aq_allDocs({ return gadget.aq_allDocs({
select_list: [ "title", "modified" ] select_list: [ "title", "modified" ]
}).push(function(document_list) { }).push(function(document_list) {
var result_list = [ gadget.whoWantToDisplayThisPage("InputModule_viewAddDocumentDialog") ], doc, i; var result_list = [], doc, i;
for (i = 0; i < document_list.data.total_rows; i += 1) { for (i = 0; i < document_list.data.total_rows; i += 1) {
doc = document_list.data.rows[i]; doc = document_list.data.rows[i];
result_list.push(RSVP.all([ gadget.whoWantToDisplayThisDocument(doc.id), doc.value.title, doc.value.modified ])); result_list.push(RSVP.all([ gadget.whoWantToDisplayThisDocument(doc.id), doc.value.title, doc.value.modified ]));
...@@ -21,13 +21,15 @@ ...@@ -21,13 +21,15 @@
return RSVP.all(result_list); return RSVP.all(result_list);
}).push(function(document_list) { }).push(function(document_list) {
// Create new doc if nothing exists // Create new doc if nothing exists
if (document_list.length === 1) { if (document_list.length === 0) {
return gadget.pleaseRedirectMyHash(document_list[0]); return gadget.whoWantToDisplayThisDocument(undefined, "view_fast_input").push(function(url) {
return gadget.pleaseRedirectMyHash(url);
});
} }
var i, parameter_list = [], doc; var i, parameter_list = [], doc;
for (i = 1; i < document_list.length; i += 1) { for (i = 0; i < document_list.length; i += 1) {
doc = document_list[i]; doc = document_list[i];
parameter_list[i - 1] = { parameter_list[i] = {
link: doc[0], link: doc[0],
title: doc[1] + " (" + doc[2] + ")" title: doc[1] + " (" + doc[2] + ")"
}; };
...@@ -37,12 +39,5 @@ ...@@ -37,12 +39,5 @@
documentlist: parameter_list documentlist: parameter_list
}); });
}); });
}).declareMethod("getNavigationList", function() {
return this.whoWantToDisplayThisPage("InputModule_viewAddDocumentDialog").push(function(url) {
return [ {
title: "New Document",
link: url
} ];
});
}); });
})(window, rJS, RSVP, Handlebars, initGadgetMixin); })(window, rJS, RSVP, Handlebars, initGadgetMixin);
\ No newline at end of file
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
<script src="mixin_gadget.js" type="text/javascript"></script> <script src="mixin_gadget.js" type="text/javascript"></script>
<script src="mixin_promise.js" type="text/javascript"></script> <script src="mixin_promise.js" type="text/javascript"></script>
<script src="mixin_document_page.js" type="text/javascript"></script>
<script src="Input_viewDocumentManagement.js" type="text/javascript"></script> <script src="Input_viewDocumentManagement.js" type="text/javascript"></script>
</head> </head>
<body> <body>
......
/*global console, rJS, RSVP, initDocumentPageMixin, jQuery, /*global console, rJS, RSVP, jQuery,
promiseEventListener, initGadgetMixin */ promiseEventListener, initGadgetMixin */
(function(window, rJS, RSVP, initDocumentPageMixin, $, promiseEventListener, initGadgetMixin) { (function(window, rJS, RSVP, $, promiseEventListener, initGadgetMixin) {
"use strict"; "use strict";
function datatouri(data, mime_type) { function datatouri(data, mime_type) {
var result = "data:"; var result = "data:";
...@@ -75,7 +75,6 @@ ...@@ -75,7 +75,6 @@
} }
var gadget_klass = rJS(window); var gadget_klass = rJS(window);
initGadgetMixin(gadget_klass); initGadgetMixin(gadget_klass);
initDocumentPageMixin(gadget_klass);
gadget_klass.declareAcquiredMethod("aq_remove", "jio_remove").declareAcquiredMethod("aq_getAttachment", "jio_getAttachment").declareAcquiredMethod("aq_putAttachment", "jio_putAttachment").declareAcquiredMethod("aq_get", "jio_get").declareAcquiredMethod("aq_ajax", "jio_ajax").declareAcquiredMethod("pleaseRedirectMyHash", "pleaseRedirectMyHash").declareAcquiredMethod("whoWantToDisplayThisDocument", "whoWantToDisplayThisDocument").declareAcquiredMethod("whoWantToDisplayHome", "whoWantToDisplayHome").declareMethod("render", function(options) { gadget_klass.declareAcquiredMethod("aq_remove", "jio_remove").declareAcquiredMethod("aq_getAttachment", "jio_getAttachment").declareAcquiredMethod("aq_putAttachment", "jio_putAttachment").declareAcquiredMethod("aq_get", "jio_get").declareAcquiredMethod("aq_ajax", "jio_ajax").declareAcquiredMethod("pleaseRedirectMyHash", "pleaseRedirectMyHash").declareAcquiredMethod("whoWantToDisplayThisDocument", "whoWantToDisplayThisDocument").declareAcquiredMethod("whoWantToDisplayHome", "whoWantToDisplayHome").declareMethod("render", function(options) {
this.props.jio_key = options.id; this.props.jio_key = options.id;
var gadget = this; var gadget = this;
...@@ -94,4 +93,4 @@ ...@@ -94,4 +93,4 @@
}).declareMethod("startService", function() { }).declareMethod("startService", function() {
return RSVP.all([ waitForDeletion(this), waitForKnowledgeExtraction(this) ]); return RSVP.all([ waitForDeletion(this), waitForKnowledgeExtraction(this) ]);
}); });
})(window, rJS, RSVP, initDocumentPageMixin, jQuery, promiseEventListener, initGadgetMixin); })(window, rJS, RSVP, jQuery, promiseEventListener, initGadgetMixin);
\ No newline at end of file \ No newline at end of file
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
<script src="../lib/rsvp.min.js" type="text/javascript"></script> <script src="../lib/rsvp.min.js" type="text/javascript"></script>
<script src="../lib/renderjs.min.js" type="text/javascript"></script> <script src="../lib/renderjs.min.js" type="text/javascript"></script>
<script src="mixin_document_page.js" type="text/javascript"></script>
<script src="Input_viewProductionLine.js" type="text/javascript"></script> <script src="Input_viewProductionLine.js" type="text/javascript"></script>
</head> </head>
<body> <body>
......
/*global window, rJS, RSVP, initDocumentPageMixin */ /*global window, rJS, RSVP */
/*jslint nomen: true */ (function(window, rJS, RSVP) {
(function(window, rJS, RSVP, initDocumentPageMixin) {
"use strict"; "use strict";
var gadget_klass = rJS(window); var gadget_klass = rJS(window);
initDocumentPageMixin(gadget_klass);
gadget_klass.ready(function(g) { gadget_klass.ready(function(g) {
g.props = {}; g.props = {};
}).ready(function(g) { }).ready(function(g) {
...@@ -14,6 +12,7 @@ ...@@ -14,6 +12,7 @@
var jio_key = options.id, gadget = this; var jio_key = options.id, gadget = this;
gadget.props.jio_key = jio_key; gadget.props.jio_key = jio_key;
return new RSVP.Queue().push(function() { return new RSVP.Queue().push(function() {
/*jslint nomen: true*/
return RSVP.all([ gadget.aq_getAttachment({ return RSVP.all([ gadget.aq_getAttachment({
_id: jio_key, _id: jio_key,
_attachment: "body.json" _attachment: "body.json"
...@@ -26,4 +25,4 @@ ...@@ -26,4 +25,4 @@
return productionline.startService(); return productionline.startService();
}); });
}); });
})(window, rJS, RSVP, initDocumentPageMixin); })(window, rJS, RSVP);
\ No newline at end of file \ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Result List</title>
<script src="../lib/rsvp.min.js" type="text/javascript"></script>
<script src="../lib/renderjs.min.js" type="text/javascript"></script>
<script src="../lib/handlebars.min.js" type="text/javascript"></script>
<script id="table-template" type="text/x-handlebars-template">
<ul data-role="listview" data-inset="true" class="document-listview">
{{#documentlist}}
<li><a href="{{link}}">{{title}}</a></li>
{{/documentlist}}
</ul>
</script>
<script src="mixin_gadget.js" type="text/javascript"></script>
<script src="Input_viewResultList.js" type="text/javascript"></script>
</head>
<body>
<section class="document_list"></section>
</body>
</html>
/*global console, rJS, RSVP, Handlebars, initGadgetMixin */
/*jslint nomen: true */
(function(window, rJS, RSVP, Handlebars, initGadgetMixin) {
"use strict";
/////////////////////////////////////////////////////////////////
// Handlebars
/////////////////////////////////////////////////////////////////
// Precompile the templates while loading the first gadget instance
var gadget_klass = rJS(window), source = gadget_klass.__template_element.getElementById("table-template").innerHTML, table_template = Handlebars.compile(source);
initGadgetMixin(gadget_klass);
gadget_klass.declareAcquiredMethod("aq_getAttachment", "jio_getAttachment").declareAcquiredMethod("whoWantToDisplayThisResult", "whoWantToDisplayThisResult").declareMethod("render", function(options) {
var gadget = this;
this.props.jio_key = options.id;
return gadget.aq_getAttachment({
_id: gadget.props.jio_key,
_attachment: "simulation.json"
}).push(function(sim_json) {
var document_list = JSON.parse(sim_json), result_list = [], i;
for (i = 0; i < document_list.length; i += 1) {
result_list.push(RSVP.all([ gadget.whoWantToDisplayThisResult(gadget.props.jio_key, i), document_list[i].score, document_list[i].key ]));
}
return RSVP.all(result_list);
}).push(function(document_list) {
var i, parameter_list = [], doc;
for (i = 0; i < document_list.length; i += 1) {
doc = document_list[i];
parameter_list[i] = {
link: doc[0],
title: doc[1] + " " + doc[2]
};
}
gadget.props.element.querySelector(".document_list").innerHTML = table_template({
documentlist: parameter_list
});
});
});
})(window, rJS, RSVP, Handlebars, initGadgetMixin);
\ No newline at end of file
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
<script src="mixin_gadget.js" type="text/javascript"></script> <script src="mixin_gadget.js" type="text/javascript"></script>
<script src="mixin_promise.js" type="text/javascript"></script> <script src="mixin_promise.js" type="text/javascript"></script>
<script src="mixin_document_page.js" type="text/javascript"></script>
<script src="Input_viewSimulation.js" type="text/javascript"></script> <script src="Input_viewSimulation.js" type="text/javascript"></script>
</head> </head>
<body> <body>
......
/*global rJS, RSVP, initDocumentPageMixin, jQuery, Handlebars, /*global rJS, RSVP, jQuery, Handlebars,
promiseEventListener, initGadgetMixin */ promiseEventListener, initGadgetMixin */
/*jslint nomen: true */ /*jslint nomen: true */
(function(window, rJS, RSVP, initDocumentPageMixin, $, Handlebars, promiseEventListener, initGadgetMixin) { (function(window, rJS, RSVP, $, Handlebars, promiseEventListener, initGadgetMixin) {
"use strict"; "use strict";
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// Handlebars // Handlebars
...@@ -9,16 +9,9 @@ ...@@ -9,16 +9,9 @@
// Precompile the templates while loading the first gadget instance // Precompile the templates while loading the first gadget instance
var gadget_klass = rJS(window), source = gadget_klass.__template_element.getElementById("label-template").innerHTML, label_template = Handlebars.compile(source); var gadget_klass = rJS(window), source = gadget_klass.__template_element.getElementById("label-template").innerHTML, label_template = Handlebars.compile(source);
initGadgetMixin(gadget_klass); initGadgetMixin(gadget_klass);
initDocumentPageMixin(gadget_klass); gadget_klass.declareAcquiredMethod("aq_getAttachment", "jio_getAttachment").declareAcquiredMethod("aq_putAttachment", "jio_putAttachment").declareAcquiredMethod("aq_ajax", "jio_ajax").declareAcquiredMethod("aq_getConfigurationDict", "getConfigurationDict").declareAcquiredMethod("pleaseRedirectMyHash", "pleaseRedirectMyHash").declareAcquiredMethod("whoWantToDisplayThisDocument", "whoWantToDisplayThisDocument").declareMethod("render", function(options) {
gadget_klass.declareAcquiredMethod("aq_getAttachment", "jio_getAttachment").declareAcquiredMethod("aq_putAttachment", "jio_putAttachment").declareAcquiredMethod("aq_ajax", "jio_ajax").declareAcquiredMethod("pleaseRedirectMyHash", "pleaseRedirectMyHash").declareAcquiredMethod("whoWantToDisplayThisDocumentPage", "whoWantToDisplayThisDocumentPage").declareMethod("render", function(options) { var i, gadget = this, property, parent_element = gadget.props.element.querySelector(".simulation_parameters"), value, queue, data;
var i, gadget = this, property, parent_element = gadget.props.element.querySelector(".simulation_parameters"), value, queue, data, property_list = options.configuration_dict["Dream-Configuration"].property_list;
this.props.jio_key = options.id; this.props.jio_key = options.id;
queue = gadget.aq_getAttachment({
_id: gadget.props.jio_key,
_attachment: "body.json"
}).push(function(json) {
data = JSON.parse(json).general;
});
function addField(property, value) { function addField(property, value) {
var sub_gadget; var sub_gadget;
queue.push(function() { queue.push(function() {
...@@ -42,13 +35,22 @@ ...@@ -42,13 +35,22 @@
parent_element.appendChild(sub_element); parent_element.appendChild(sub_element);
}); });
} }
for (i = 0; i < property_list.length; i += 1) { queue = gadget.aq_getAttachment({
property = property_list[i]; _id: gadget.props.jio_key,
if (property._class === "Dream.Property") { _attachment: "body.json"
value = property._default || ""; }).push(function(json) {
addField(property, value); data = JSON.parse(json).general;
return gadget.aq_getConfigurationDict();
}).push(function(configuration_dict) {
var property_list = configuration_dict["Dream-Configuration"].property_list;
for (i = 0; i < property_list.length; i += 1) {
property = property_list[i];
if (property._class === "Dream.Property") {
value = property._default || "";
addField(property, value);
}
} }
} });
return queue; return queue;
}).declareMethod("startService", function() { }).declareMethod("startService", function() {
var gadget = this; var gadget = this;
...@@ -89,9 +91,9 @@ ...@@ -89,9 +91,9 @@
_mimetype: "application/json" _mimetype: "application/json"
}); });
}).push(function(result) { }).push(function(result) {
return gadget.whoWantToDisplayThisDocumentPage("Output_viewDebugJson", gadget.props.jio_key); return gadget.whoWantToDisplayThisDocument(gadget.props.jio_key, "view_result");
}).push(function(url) { }).push(function(url) {
return gadget.pleaseRedirectMyHash(url); return gadget.pleaseRedirectMyHash(url);
}); });
}); });
})(window, rJS, RSVP, initDocumentPageMixin, jQuery, Handlebars, promiseEventListener, initGadgetMixin); })(window, rJS, RSVP, jQuery, Handlebars, promiseEventListener, initGadgetMixin);
\ No newline at end of file \ No newline at end of file
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
<script src="../lib/renderjs.min.js" type="text/javascript"></script> <script src="../lib/renderjs.min.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="mixin_document_page.js" type="text/javascript"></script>
<script src="Input_viewTable.js" type="text/javascript"></script> <script src="Input_viewTable.js" type="text/javascript"></script>
</head> </head>
<body> <body>
......
/*global console, rJS, RSVP, initDocumentPageMixin, initGadgetMixin */ /*global console, rJS, RSVP, initGadgetMixin */
(function(window, rJS, RSVP, initDocumentPageMixin, initGadgetMixin) { (function(window, rJS, RSVP, initGadgetMixin) {
"use strict"; "use strict";
var gadget_klass = rJS(window); var gadget_klass = rJS(window);
initDocumentPageMixin(gadget_klass);
initGadgetMixin(gadget_klass); initGadgetMixin(gadget_klass);
gadget_klass.declareAcquiredMethod("aq_getAttachment", "jio_getAttachment").declareMethod("render", function(options) { gadget_klass.declareAcquiredMethod("aq_getAttachment", "jio_getAttachment").declareMethod("render", function(options) {
var jio_key = options.id, gadget = this; var jio_key = options.id, gadget = this;
...@@ -20,4 +19,4 @@ ...@@ -20,4 +19,4 @@
return tableeditor.startService(); return tableeditor.startService();
}); });
}); });
})(window, rJS, RSVP, initDocumentPageMixin, initGadgetMixin); })(window, rJS, RSVP, initGadgetMixin);
\ No newline at end of file \ No newline at end of file
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
<script src="../lib/rsvp.min.js" type="text/javascript"></script> <script src="../lib/rsvp.min.js" type="text/javascript"></script>
<script src="../lib/renderjs.min.js" type="text/javascript"></script> <script src="../lib/renderjs.min.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="mixin_document_page.js" type="text/javascript"></script>
<script src="Output_viewDebugJson.js" type="text/javascript"></script> <script src="Output_viewDebugJson.js" type="text/javascript"></script>
</head> </head>
<body> <body>
......
/*global console, rJS, RSVP, initDocumentPageMixin, initGadgetMixin */ /*global console, rJS, RSVP, initGadgetMixin */
(function(window, rJS, RSVP, initDocumentPageMixin, initGadgetMixin) { (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);
initDocumentPageMixin(gadget_klass);
gadget_klass.declareAcquiredMethod("aq_getAttachment", "jio_getAttachment").declareMethod("render", function(options) { gadget_klass.declareAcquiredMethod("aq_getAttachment", "jio_getAttachment").declareMethod("render", function(options) {
var gadget = this; var gadget = this;
this.props.jio_key = options.id; this.props.jio_key = options.id;
return new RSVP.Queue().push(function() { this.props.result = options.result;
return RSVP.all([ gadget.aq_getAttachment({ return gadget.aq_getAttachment({
_id: gadget.props.jio_key, _id: gadget.props.jio_key,
_attachment: "body.json" _attachment: "simulation.json"
}), gadget.aq_getAttachment({ }).push(function(result_json) {
_id: gadget.props.jio_key, var result = JSON.parse(result_json);
_attachment: "simulation.json" gadget.props.element.querySelector(".json_input").textContent = JSON.stringify(result[gadget.props.result].input);
}) ]); gadget.props.element.querySelector(".json_output").textContent = JSON.stringify(result[gadget.props.result].result);
}).push(function(result_list) {
gadget.props.element.querySelector(".json_input").textContent = result_list[0];
// XXX Hardcoded result
gadget.props.element.querySelector(".json_output").textContent = JSON.stringify(JSON.parse(result_list[1])[0].result);
}); });
}); });
})(window, rJS, RSVP, initDocumentPageMixin, initGadgetMixin); })(window, rJS, RSVP, initGadgetMixin);
\ No newline at end of file \ No newline at end of file
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
<script src="../lib/renderjs.min.js" type="text/javascript"></script> <script src="../lib/renderjs.min.js" type="text/javascript"></script>
<script src="../lib/handlebars.min.js" type="text/javascript"></script> <script src="../lib/handlebars.min.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="mixin_document_page.js" type="text/javascript"></script>
<script src="Output_viewExitStatistics.js" type="text/javascript"></script> <script src="Output_viewExitStatistics.js" type="text/javascript"></script>
<script id="interval-through-metric-template" type="text/x-handlebars-template"> <script id="interval-through-metric-template" type="text/x-handlebars-template">
......
/*global console, rJS, RSVP, initDocumentPageMixin, Handlebars, /*global console, rJS, RSVP, Handlebars,
initGadgetMixin */ initGadgetMixin */
/*jslint nomen: true */ /*jslint nomen: true */
(function(window, rJS, RSVP, initDocumentPageMixin, Handlebars, initGadgetMixin) { (function(window, rJS, RSVP, Handlebars, initGadgetMixin) {
"use strict"; "use strict";
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// Handlebars // Handlebars
...@@ -85,17 +85,16 @@ ...@@ -85,17 +85,16 @@
return result; return result;
} }
initGadgetMixin(gadget_klass); initGadgetMixin(gadget_klass);
initDocumentPageMixin(gadget_klass);
gadget_klass.declareAcquiredMethod("aq_getAttachment", "jio_getAttachment").declareMethod("render", function(options) { gadget_klass.declareAcquiredMethod("aq_getAttachment", "jio_getAttachment").declareMethod("render", function(options) {
var jio_key = options.id, gadget = this; var jio_key = options.id, gadget = this;
gadget.props.jio_key = jio_key; gadget.props.jio_key = jio_key;
gadget.props.result = options.result;
return gadget.aq_getAttachment({ return gadget.aq_getAttachment({
_id: gadget.props.jio_key, _id: gadget.props.jio_key,
_attachment: "simulation.json" _attachment: "simulation.json"
}).push(function(simulation_json) { }).push(function(simulation_json) {
var result = calculate_exit_stat(// XXX Hardcoded result var result = calculate_exit_stat(JSON.parse(simulation_json)[gadget.props.result].result);
JSON.parse(simulation_json)[0].result);
gadget.props.element.innerHTML = result; gadget.props.element.innerHTML = result;
}); });
}); });
})(window, rJS, RSVP, initDocumentPageMixin, Handlebars, initGadgetMixin); })(window, rJS, RSVP, Handlebars, initGadgetMixin);
\ No newline at end of file \ No newline at end of file
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
<script src="../lib/jquery.js" type="text/javascript"></script> <script src="../lib/jquery.js" type="text/javascript"></script>
<script src="../lib/dhtmlxgantt.js" type="text/javascript"></script> <script src="../lib/dhtmlxgantt.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="mixin_document_page.js" type="text/javascript"></script>
<script src="Output_viewJobGantt.js" type="text/javascript"></script> <script src="Output_viewJobGantt.js" type="text/javascript"></script>
</head> </head>
<body> <body>
......
/*global console, rJS, RSVP, initDocumentPageMixin, jQuery, gantt, /*global console, rJS, RSVP, jQuery, gantt,
initGadgetMixin */ initGadgetMixin */
/*jslint nomen: true */ /*jslint nomen: true */
(function(window, rJS, RSVP, initDocumentPageMixin, $, gantt, initGadgetMixin) { (function(window, rJS, RSVP, $, gantt, initGadgetMixin) {
"use strict"; "use strict";
gantt.templates.task_class = function(start, end, obj) { gantt.templates.task_class = function(start, end, obj) {
return obj.parent ? "sub_task" : ""; return obj.parent ? "sub_task" : "";
...@@ -161,16 +161,15 @@ ...@@ -161,16 +161,15 @@
} }
var gadget_klass = rJS(window); var gadget_klass = rJS(window);
initGadgetMixin(gadget_klass); initGadgetMixin(gadget_klass);
initDocumentPageMixin(gadget_klass);
gadget_klass.declareAcquiredMethod("aq_getAttachment", "jio_getAttachment").declareMethod("render", function(options) { gadget_klass.declareAcquiredMethod("aq_getAttachment", "jio_getAttachment").declareMethod("render", function(options) {
var jio_key = options.id, gadget = this; var jio_key = options.id, gadget = this;
gadget.props.jio_key = jio_key; gadget.props.jio_key = jio_key;
gadget.props.result = options.result;
return gadget.aq_getAttachment({ return gadget.aq_getAttachment({
_id: gadget.props.jio_key, _id: gadget.props.jio_key,
_attachment: "simulation.json" _attachment: "simulation.json"
}).push(function(simulation_json) { }).push(function(simulation_json) {
gadget.props.result = job_gantt_widget(// XXX Hardcoded result gadget.props.result = job_gantt_widget(JSON.parse(simulation_json)[gadget.props.result]);
JSON.parse(simulation_json)[0]);
}); });
}).declareMethod("startService", function() { }).declareMethod("startService", function() {
$(this.props.element).find(".gant_container").dhx_gantt({ $(this.props.element).find(".gant_container").dhx_gantt({
...@@ -200,4 +199,4 @@ ...@@ -200,4 +199,4 @@
throw error; throw error;
}); });
}); });
})(window, rJS, RSVP, initDocumentPageMixin, jQuery, gantt, initGadgetMixin); })(window, rJS, RSVP, jQuery, gantt, initGadgetMixin);
\ No newline at end of file \ No newline at end of file
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
<script src="../lib/moment.js" type="text/javascript"></script> <script src="../lib/moment.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="mixin_document_page.js" type="text/javascript"></script>
<script src="Output_viewJobScheduleSpreadsheet.js" type="text/javascript"></script> <script src="Output_viewJobScheduleSpreadsheet.js" type="text/javascript"></script>
</head> </head>
<body> <body>
......
/*global console, rJS, RSVP, initDocumentPageMixin, moment, initGadgetMixin */ /*global console, rJS, RSVP, moment, initGadgetMixin */
/*jslint nomen: true */ /*jslint nomen: true */
(function(window, rJS, RSVP, initDocumentPageMixin, moment, initGadgetMixin) { (function(window, rJS, RSVP, moment, initGadgetMixin) {
"use strict"; "use strict";
function job_schedule_spreadsheet_widget(all_data) { function job_schedule_spreadsheet_widget(all_data) {
var now = new Date(), input_data = all_data.input, output_data = all_data.result, spreadsheet_data = [], spreadsheet_header = [ [ "Jobs", "ID", "Project Manager", "Due Date", "Priority", "Entrance Time", "Processing Time", "Station ID", "Step No." ] ], simulation_start_date = new Date(input_data.general.currentDate || now.getTime()), i, j, k, obj, node, component, order, node_id, due_date, entrance_date, duration, schedule, input_job = null, input_order = null; var now = new Date(), input_data = all_data.input, output_data = all_data.result, spreadsheet_data = [], spreadsheet_header = [ [ "Jobs", "ID", "Project Manager", "Due Date", "Priority", "Entrance Time", "Processing Time", "Station ID", "Step No." ] ], simulation_start_date = new Date(input_data.general.currentDate || now.getTime()), i, j, k, obj, node, component, order, node_id, due_date, entrance_date, duration, schedule, input_job = null, input_order = null;
...@@ -90,22 +90,21 @@ ...@@ -90,22 +90,21 @@
} }
var gadget_klass = rJS(window); var gadget_klass = rJS(window);
initGadgetMixin(gadget_klass); initGadgetMixin(gadget_klass);
initDocumentPageMixin(gadget_klass);
gadget_klass.declareAcquiredMethod("aq_getAttachment", "jio_getAttachment").declareMethod("render", function(options) { gadget_klass.declareAcquiredMethod("aq_getAttachment", "jio_getAttachment").declareMethod("render", function(options) {
var jio_key = options.id, gadget = this; var jio_key = options.id, gadget = this;
gadget.props.jio_key = jio_key; gadget.props.jio_key = jio_key;
gadget.props.result = options.result;
return new RSVP.Queue().push(function() { return new RSVP.Queue().push(function() {
return RSVP.all([ gadget.aq_getAttachment({ return RSVP.all([ gadget.aq_getAttachment({
_id: jio_key, _id: jio_key,
_attachment: "simulation.json" _attachment: "simulation.json"
}), gadget.getDeclaredGadget("tableeditor") ]); }), gadget.getDeclaredGadget("tableeditor") ]);
}).push(function(result_list) { }).push(function(result_list) {
// XXX Hardcoded result return result_list[1].render(JSON.stringify(job_schedule_spreadsheet_widget(JSON.parse(result_list[0])[gadget.props.result])));
return result_list[1].render(JSON.stringify(job_schedule_spreadsheet_widget(JSON.parse(result_list[0])[0])));
}); });
}).declareMethod("startService", function() { }).declareMethod("startService", function() {
return this.getDeclaredGadget("tableeditor").push(function(tableeditor) { return this.getDeclaredGadget("tableeditor").push(function(tableeditor) {
return tableeditor.startService(); return tableeditor.startService();
}); });
}); });
})(window, rJS, RSVP, initDocumentPageMixin, moment, initGadgetMixin); })(window, rJS, RSVP, moment, initGadgetMixin);
\ No newline at end of file \ No newline at end of file
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
<script src="../lib/jquery.flot.js"></script> <script src="../lib/jquery.flot.js"></script>
<script src="../lib/jquery.flot.stack.js"></script> <script src="../lib/jquery.flot.stack.js"></script>
<script src="mixin_gadget.js" type="text/javascript"></script> <script src="mixin_gadget.js" type="text/javascript"></script>
<script src="mixin_document_page.js" type="text/javascript"></script>
<script src="Output_viewQueueStatGraph.js" type="text/javascript"></script> <script src="Output_viewQueueStatGraph.js" type="text/javascript"></script>
</head> </head>
<body> <body>
......
/*global console, rJS, RSVP, initDocumentPageMixin, jQuery, initGadgetMixin */ /*global console, rJS, RSVP, jQuery, initGadgetMixin */
/*jslint nomen: true */ /*jslint nomen: true */
(function(window, rJS, RSVP, initDocumentPageMixin, $, initGadgetMixin) { (function(window, rJS, RSVP, $, initGadgetMixin) {
"use strict"; "use strict";
function queue_stat_widget(output_data) { function queue_stat_widget(output_data) {
/* FIXME: does not support more than one replic. /* FIXME: does not support more than one replic.
...@@ -19,19 +19,18 @@ ...@@ -19,19 +19,18 @@
} }
var gadget_klass = rJS(window); var gadget_klass = rJS(window);
initGadgetMixin(gadget_klass); initGadgetMixin(gadget_klass);
initDocumentPageMixin(gadget_klass);
gadget_klass.declareAcquiredMethod("aq_getAttachment", "jio_getAttachment").declareMethod("render", function(options) { gadget_klass.declareAcquiredMethod("aq_getAttachment", "jio_getAttachment").declareMethod("render", function(options) {
var jio_key = options.id, gadget = this; var jio_key = options.id, gadget = this;
gadget.props.jio_key = jio_key; gadget.props.jio_key = jio_key;
gadget.props.result = options.result;
return gadget.aq_getAttachment({ return gadget.aq_getAttachment({
_id: gadget.props.jio_key, _id: gadget.props.jio_key,
_attachment: "simulation.json" _attachment: "simulation.json"
}).push(function(simulation_json) { }).push(function(simulation_json) {
gadget.props.series = queue_stat_widget(// XXX Hardcoded result gadget.props.series = queue_stat_widget(JSON.parse(simulation_json)[gadget.props.result].result);
JSON.parse(simulation_json)[0].result);
}); });
}).declareMethod("startService", function() { }).declareMethod("startService", function() {
// XXX Manually calculate width and height when resizing // XXX Manually calculate width and height when resizing
$.plot(this.props.element.querySelector(".graph_container"), this.props.series); $.plot(this.props.element.querySelector(".graph_container"), this.props.series);
}); });
})(window, rJS, RSVP, initDocumentPageMixin, jQuery, initGadgetMixin); })(window, rJS, RSVP, jQuery, initGadgetMixin);
\ No newline at end of file \ No newline at end of file
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
<script src="../lib/jquery.flot.js"></script> <script src="../lib/jquery.flot.js"></script>
<script src="../lib/jquery.flot.stack.js"></script> <script src="../lib/jquery.flot.stack.js"></script>
<script src="mixin_gadget.js" type="text/javascript"></script> <script src="mixin_gadget.js" type="text/javascript"></script>
<script src="mixin_document_page.js" type="text/javascript"></script>
<script src="Output_viewStationUtilisationGraph.js" type="text/javascript"></script> <script src="Output_viewStationUtilisationGraph.js" type="text/javascript"></script>
</head> </head>
<body> <body>
......
/*global console, rJS, RSVP, initDocumentPageMixin, jQuery, initGadgetMixin */ /*global console, rJS, RSVP, jQuery, initGadgetMixin */
(function(window, rJS, RSVP, initDocumentPageMixin, $, initGadgetMixin) { (function(window, rJS, RSVP, $, initGadgetMixin) {
"use strict"; "use strict";
function station_utilisation_graph_widget(output_data) { function station_utilisation_graph_widget(output_data) {
var blockage_data = [], waiting_data = [], failure_data = [], working_data = [], ticks = [], counter = 1, series, options; var blockage_data = [], waiting_data = [], failure_data = [], working_data = [], ticks = [], counter = 1, series, options;
...@@ -97,19 +97,18 @@ ...@@ -97,19 +97,18 @@
} }
var gadget_klass = rJS(window); var gadget_klass = rJS(window);
initGadgetMixin(gadget_klass); initGadgetMixin(gadget_klass);
initDocumentPageMixin(gadget_klass);
gadget_klass.declareAcquiredMethod("aq_getAttachment", "jio_getAttachment").declareMethod("render", function(options) { gadget_klass.declareAcquiredMethod("aq_getAttachment", "jio_getAttachment").declareMethod("render", function(options) {
var jio_key = options.id, gadget = this; var jio_key = options.id, gadget = this;
gadget.props.jio_key = jio_key; gadget.props.jio_key = jio_key;
gadget.props.result = options.result;
return gadget.aq_getAttachment({ return gadget.aq_getAttachment({
_id: gadget.props.jio_key, _id: gadget.props.jio_key,
_attachment: "simulation.json" _attachment: "simulation.json"
}).push(function(simulation_json) { }).push(function(simulation_json) {
gadget.props.result_list = station_utilisation_graph_widget(// XXX Hardcoded result gadget.props.result_list = station_utilisation_graph_widget(JSON.parse(simulation_json)[gadget.props.result].result);
JSON.parse(simulation_json)[0].result);
}); });
}).declareMethod("startService", function() { }).declareMethod("startService", function() {
// XXX Manually calculate width and height when resizing // XXX Manually calculate width and height when resizing
$.plot(this.props.element.querySelector(".graph_container"), this.props.result_list[0], this.props.result_list[1]); $.plot(this.props.element.querySelector(".graph_container"), this.props.result_list[0], this.props.result_list[1]);
}); });
})(window, rJS, RSVP, initDocumentPageMixin, jQuery, initGadgetMixin); })(window, rJS, RSVP, jQuery, initGadgetMixin);
\ No newline at end of file \ No newline at end of file
This diff is collapsed.
...@@ -16,13 +16,24 @@ ...@@ -16,13 +16,24 @@
<script src="mixin_gadget.js" type="text/javascript"></script> <script src="mixin_gadget.js" type="text/javascript"></script>
<script src="index.js" type="text/javascript"></script> <script src="index.js" type="text/javascript"></script>
<script id="navigation-template" type="text/x-handlebars-template"> <script id="panel-template" type="text/x-handlebars-template">
<ul data-role="listview"> <ul data-role="listview">
<li><a class="home_link ui-btn ui-icon-home ui-btn-icon-left" data-icon="home">Documents</a></li>
<li><a class="fast_input_link ui-btn ui-icon-plus ui-btn-icon-left" data-icon="plus">New Document</a></li>
{{#navigationlist}} {{#navigationlist}}
<li><a href="{{link}}">{{title}}</a></li> <li><a href="{{link}}">{{title}}</a></li>
{{/navigationlist}} {{/navigationlist}}
</ul> </ul>
</script> </script>
<script id="active-navigation-template" type="text/x-handlebars-template">
<li><a class="ui-btn-active ui-state-persist" href="{{link}}">{{title}}</a></li>
</script>
<script id="navigation-template" type="text/x-handlebars-template">
<li><a href="{{link}}">{{title}}</a></li>
</script>
</head> </head>
<body> <body>
...@@ -36,11 +47,14 @@ ...@@ -36,11 +47,14 @@
</div> </div>
<header data-role="header"> <header data-role="header">
<a href="#leftpanel" class="menu_link">Menu</a> <a href="#leftpanel"
data-icon="bars"
class="menu_link ui-btn ui-icon-bars ui-btn-icon-left">Menu</a>
<h1>Dream Simulation</h1> <h1>Dream Simulation</h1>
<a class="home_link ui-btn ui-icon-home ui-btn-icon-left" data-icon="home">Home</a>
</header> </header>
<div class="nav_container"></div>
<article class="gadget_container"></article> <article class="gadget_container"></article>
<aside> <aside>
......
This diff is collapsed.
...@@ -2,14 +2,25 @@ ...@@ -2,14 +2,25 @@
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<!--link rel="stylesheet" href="lib/jquery-ui.css"--> <link rel="stylesheet" href="../lib/jquery-ui.css">
<link rel="stylesheet" href="jsplumb.css">
<!--script src="curl.jquery.relative_dest %>"></script-->
<!--script src="curl.jqueryuijs.relative_dest %>"></script-->
<script src="../lib/rsvp.min.js" type="text/javascript"></script>
<script src="../lib/renderjs.min.js" type="text/javascript"></script>
<script src="../lib/jquery.jsplumb.min.js" type="text/javascript"></script>
<script src="../lib/jquery.js"></script>
<script src="../lib/jquery-ui.js"></script>
<script src="../lib/rsvp.min.js"></script>
<script src="../lib/renderjs.min.js"></script>
<script src="../lib/jquery.jsplumb.min.js"></script>
<script src="../lib/handlebars.min.js"></script>
<script id="node-template" type="text/x-handlebars-template">
<div class="window {{class}}"
id="{{element_id}}"
title="{{title}}">
{{id}}
<div class="ep"></div>
</div>
</script>
<script src="jsplumb.js"></script> <script src="jsplumb.js"></script>
</head> </head>
<body> <body>
......
#main{position:relative;margin:20px auto;font-size:80%;border:1px solid #999;width:100%;height:600px;overflow:hidden;border-radius:10px;background-color:#eaedef;text-align:center}.selected{color:#bd0b0b!important}.window,.label{background-color:#fff;text-align:center;z-index:23;cursor:pointer;box-shadow:2px 2px 19px #aaa;-o-box-shadow:2px 2px 19px #aaa;-webkit-box-shadow:2px 2px 19px #aaa;-moz-box-shadow:2px 2px 19px #aaa}path,._jsPlumb_endpoint{cursor:pointer}._jsPlumb_endpoint_drop_allowed{border:4px solid #123456;box-shadow:6px 6px 19px #444;-o-box-shadow:6px 6px 19px #444;-webkit-box-shadow:6px 6px 19px #444;-moz-box-shadow:6px 6px 19px #444}._jsPlumb_connector{z-index:18}._jsPlumb_endpoint{z-index:19}._jsPlumb_overlay{z-index:23}._jsPlumb_connector._jsPlumb_hover{z-index:21!important}._jsPlumb_endpoint._jsPlumb_hover{z-index:22!important}._jsPlumb_overlay{border:1px solid #346789;opacity:.8;filter:alpha(opacity=80);background-color:#fff;color:#000;font-family:helvetica;padding:.5em}.Dream-Source,.Dream-BatchSource{border:1px solid #bbc;background-color:#ffe;background-image:linear-gradient(to bottom,#ffe 0,#dde 100%)}.Dream-Machine,.Dream-MachineJobShop,.Dream-BatchScrapMachine,.Dream-MachineManagedJob,.Dream-MouldAssembly{border:1px solid #cbc;background-color:#fef;background-image:linear-gradient(to bottom,#fef 0,#ede 100%)}.Dream-Queue,.Dream-QueueJobShop,.Dream-LineClearance,.Dream-QueueManagedJob,.Dream-ConditionalBuffer,.Dream-OrderDecomposition,.Dream-MouldAssemblyBuffer{border:1px solid #bcc;background-color:#eff;background-image:linear-gradient(to bottom,#eff 0,#dee 100%)}.Dream-Exit,.Dream-ExitJobShop{border:1px solid #ccb;background-color:#eef;background-image:linear-gradient(to bottom,#eef 0,#dde 100%)}.Dream-EventGenerator{border:1px solid #cba;background-color:#fdc;background-image:linear-gradient(to bottom,#fdc 0,#ecb 100%)}.Dream-BatchDecomposition,.Dream-BatchDecompositionStartTime,.Dream-BatchReassembly{border:1px solid #bcb;background-color:#dfd;background-image:linear-gradient(to bottom,#dfd 0,#cec 100%)}.Dream-Repairman{border:1px solid #cbb;background-color:#fdd;background-image:linear-gradient(to bottom,#fdd 0,#dcc 100%)}.window,.dummy_window{border:1px solid #d3d3d3;width:100px;height:64px;position:absolute;color:#000;font-family:serif;font-style:italic;padding-top:.9em;font-size:.9em;cursor:move;font-size:11px;-webkit-transition:background-color .1s ease-in;-moz-transition:background-color .1s ease-in;transition:background-color .1s ease-in;border-radius:5px}.window:hover{background-color:#5c96bc;background-image:none;color:#fff}.dummy_window{position:absolute;top:0;left:0;visibility:hidden}.ep{position:absolute;bottom:37%;right:5px;width:1em;height:1em;background-color:orange;cursor:pointer;box-shadow:0 0 2px #000;-webkit-transition:-webkit-box-shadow .25s ease-in;-moz-transition:-moz-box-shadow .25s ease-in;transition:box-shadow .25s ease-in}._jsPlumb_source_hover,._jsPlumb_target_hover,.dragHover{background-color:#1e8151;background-image:none;color:#fff}path{cursor:pointer}
\ No newline at end of file
This diff is collapsed.
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