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

Publish static version.

parent c061d214
...@@ -6,7 +6,9 @@ ...@@ -6,7 +6,9 @@
<title>Create Document</title> <title>Create Document</title>
<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="create_document.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="InputModule_viewAddDocumentDialog.js" type="text/javascript"></script>
</head> </head>
<body> <body>
<form class="import_form"> <form class="import_form">
......
/*global console, rJS, RSVP, FileReader */ /*global rJS, RSVP, promiseEventListener, promiseReadAsText,
(function(window, rJS, RSVP, FileReader) { initGadgetMixin */
(function(window, rJS, RSVP, promiseEventListener, promiseReadAsText, initGadgetMixin) {
"use strict"; "use strict";
function promiseEventListener(target, type, useCapture) { var gadget_klass = rJS(window);
////////////////////////// initGadgetMixin(gadget_klass);
// Resolve the promise as soon as the event is triggered gadget_klass.declareAcquiredMethod("aq_post", "jio_post").declareAcquiredMethod("aq_putAttachment", "jio_putAttachment").declareAcquiredMethod("pleaseRedirectMyHash", "pleaseRedirectMyHash").declareAcquiredMethod("whoWantToDisplayThisDocument", "whoWantToDisplayThisDocument").declareMethod("startService", function() {
// eventListener is removed when promise is cancelled/resolved/rejected
//////////////////////////
var handle_event_callback;
function canceller() {
target.removeEventListener(type, handle_event_callback, useCapture);
}
function resolver(resolve) {
handle_event_callback = function(evt) {
canceller();
evt.stopPropagation();
evt.preventDefault();
resolve(evt);
return false;
};
target.addEventListener(type, handle_event_callback, useCapture);
}
return new RSVP.Promise(resolver, canceller);
}
function promiseReadAsText(file) {
return new RSVP.Promise(function(resolve, reject) {
var reader = new FileReader();
reader.onload = function(evt) {
resolve(evt.target.result);
};
reader.onerror = function(evt) {
reject(evt);
};
reader.readAsText(file);
});
}
rJS(window).declareAcquiredMethod("aq_post", "jio_post").declareAcquiredMethod("aq_putAttachment", "jio_putAttachment").declareAcquiredMethod("pleaseRedirectMyHash", "pleaseRedirectMyHash").declareAcquiredMethod("whoWantToDisplayThisDocument", "whoWantToDisplayThisDocument").ready(function(g) {
g.props = {};
}).ready(function(g) {
return g.getElement().push(function(element) {
g.props.element = element;
});
}).declareMethod("startService", function() {
var gadget = this, json_data, name; var gadget = this, json_data, name;
return new RSVP.Queue().push(function() { return new RSVP.Queue().push(function() {
return promiseEventListener(gadget.props.element.getElementsByClassName("import_form")[0], "submit", false); return promiseEventListener(gadget.props.element.getElementsByClassName("import_form")[0], "submit", false);
...@@ -75,4 +39,4 @@ ...@@ -75,4 +39,4 @@
return gadget.pleaseRedirectMyHash(url); return gadget.pleaseRedirectMyHash(url);
}); });
}); });
})(window, rJS, RSVP, FileReader); })(window, rJS, RSVP, promiseEventListener, promiseReadAsText, initGadgetMixin);
\ No newline at end of file \ No newline at end of file
...@@ -16,7 +16,8 @@ ...@@ -16,7 +16,8 @@
</ul> </ul>
</script> </script>
<script src="document_list.js" type="text/javascript"></script> <script src="mixin_gadget.js" type="text/javascript"></script>
<script src="InputModule_viewInputList.js" type="text/javascript"></script>
</head> </head>
<body> <body>
<section class="document_list"></section> <section class="document_list"></section>
......
/*global console, rJS, RSVP, Handlebars */ /*global console, rJS, RSVP, Handlebars, initGadgetMixin */
/*jslint nomen: true */ /*jslint nomen: true */
(function(window, rJS, RSVP, Handlebars) { (function(window, rJS, RSVP, Handlebars, initGadgetMixin) {
"use strict"; "use strict";
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// Handlebars // Handlebars
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// 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);
gadget_klass.ready(function(g) { initGadgetMixin(gadget_klass);
g.props = {}; gadget_klass.declareAcquiredMethod("aq_allDocs", "allDocs").declareAcquiredMethod("pleaseRedirectMyHash", "pleaseRedirectMyHash").declareAcquiredMethod("whoWantToDisplayThisPage", "whoWantToDisplayThisPage").declareAcquiredMethod("whoWantToDisplayThisDocument", "whoWantToDisplayThisDocument").declareMethod("render", function(options) {
}).ready(function(g) {
return g.getElement().push(function(element) {
g.props.element = element;
});
}).declareAcquiredMethod("aq_allDocs", "allDocs").declareAcquiredMethod("pleaseRedirectMyHash", "pleaseRedirectMyHash").declareAcquiredMethod("whoWantToDisplayThisPage", "whoWantToDisplayThisPage").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("create_document") ], doc, i; var result_list = [ gadget.whoWantToDisplayThisPage("InputModule_viewAddDocumentDialog") ], 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 ]));
...@@ -43,11 +38,11 @@ ...@@ -43,11 +38,11 @@
}); });
}); });
}).declareMethod("getNavigationList", function() { }).declareMethod("getNavigationList", function() {
return this.whoWantToDisplayThisPage("create_document").push(function(url) { return this.whoWantToDisplayThisPage("InputModule_viewAddDocumentDialog").push(function(url) {
return [ { return [ {
title: "New Document", title: "New Document",
link: url link: url
} ]; } ];
}); });
}); });
})(window, rJS, RSVP, Handlebars); })(window, rJS, RSVP, Handlebars, initGadgetMixin);
\ No newline at end of file \ No newline at end of file
...@@ -9,8 +9,10 @@ ...@@ -9,8 +9,10 @@
<script src="../lib/jquery.js" type="text/javascript"></script> <script src="../lib/jquery.js" type="text/javascript"></script>
<script src="../lib/jquerymobile.js" type="text/javascript"></script> <script src="../lib/jquerymobile.js" type="text/javascript"></script>
<script src="document_page_mixin.js" type="text/javascript"></script> <script src="mixin_gadget.js" type="text/javascript"></script>
<script src="manage_document.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>
</head> </head>
<body> <body>
<a class="export_link ui-btn ui-btn-inline ui-icon-action ui-btn-icon-right">Export</a> <a class="export_link ui-btn ui-btn-inline ui-icon-action ui-btn-icon-right">Export</a>
......
/*global console, rJS, RSVP, initDocumentPageMixin, jQuery */ /*global console, rJS, RSVP, initDocumentPageMixin, jQuery,
(function(window, rJS, RSVP, initDocumentPageMixin, $) { promiseEventListener, initGadgetMixin */
(function(window, rJS, RSVP, initDocumentPageMixin, $, promiseEventListener, initGadgetMixin) {
"use strict"; "use strict";
function datatouri(data, mime_type) { function datatouri(data, mime_type) {
var result = "data:"; var result = "data:";
...@@ -8,27 +9,6 @@ ...@@ -8,27 +9,6 @@
} }
return result + ";base64," + window.btoa(data); return result + ";base64," + window.btoa(data);
} }
function promiseEventListener(target, type, useCapture) {
//////////////////////////
// Resolve the promise as soon as the event is triggered
// eventListener is removed when promise is cancelled/resolved/rejected
//////////////////////////
var handle_event_callback;
function canceller() {
target.removeEventListener(type, handle_event_callback, useCapture);
}
function resolver(resolve) {
handle_event_callback = function(evt) {
canceller();
evt.stopPropagation();
evt.preventDefault();
resolve(evt);
return false;
};
target.addEventListener(type, handle_event_callback, useCapture);
}
return new RSVP.Promise(resolver, canceller);
}
function disableAllButtons(gadget) { function disableAllButtons(gadget) {
// Prevent double click // Prevent double click
var i, button_list = gadget.props.element.getElementsByClassName("ui-btn"); var i, button_list = gadget.props.element.getElementsByClassName("ui-btn");
...@@ -94,14 +74,9 @@ ...@@ -94,14 +74,9 @@
}); });
} }
var gadget_klass = rJS(window); var gadget_klass = rJS(window);
initGadgetMixin(gadget_klass);
initDocumentPageMixin(gadget_klass); initDocumentPageMixin(gadget_klass);
gadget_klass.ready(function(g) { 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) {
g.props = {};
}).ready(function(g) {
return g.getElement().push(function(element) {
g.props.element = element;
});
}).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;
return new RSVP.Queue().push(function() { return new RSVP.Queue().push(function() {
...@@ -119,4 +94,4 @@ ...@@ -119,4 +94,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); })(window, rJS, RSVP, initDocumentPageMixin, jQuery, promiseEventListener, initGadgetMixin);
\ No newline at end of file \ No newline at end of file
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
<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="document_page_mixin.js" type="text/javascript"></script> <script src="mixin_document_page.js" type="text/javascript"></script>
<script src="production_line.js" type="text/javascript"></script> <script src="Input_viewProductionLine.js" type="text/javascript"></script>
</head> </head>
<body> <body>
<div data-gadget-url="../jsplumb/index.html" <div data-gadget-url="../jsplumb/index.html"
......
...@@ -14,8 +14,10 @@ ...@@ -14,8 +14,10 @@
<label>{{label}}</label> <label>{{label}}</label>
</script> </script>
<script src="document_page_mixin.js" type="text/javascript"></script> <script src="mixin_gadget.js" type="text/javascript"></script>
<script src="run_simulation.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>
</head> </head>
<body> <body>
<form> <form>
......
/*global rJS, RSVP, initDocumentPageMixin, jQuery, Handlebars */ /*global rJS, RSVP, initDocumentPageMixin, jQuery, Handlebars,
/*jslint nomen: true, maxlen: 200 */ promiseEventListener, initGadgetMixin */
(function(window, rJS, RSVP, initDocumentPageMixin, $, Handlebars) { /*jslint nomen: true */
(function(window, rJS, RSVP, initDocumentPageMixin, $, Handlebars, promiseEventListener, initGadgetMixin) {
"use strict"; "use strict";
function promiseEventListener(target, type, useCapture) {
//////////////////////////
// Resolve the promise as soon as the event is triggered
// eventListener is removed when promise is cancelled/resolved/rejected
//////////////////////////
var handle_event_callback;
function canceller() {
target.removeEventListener(type, handle_event_callback, useCapture);
}
function resolver(resolve) {
handle_event_callback = function(evt) {
canceller();
evt.stopPropagation();
evt.preventDefault();
resolve(evt);
return false;
};
target.addEventListener(type, handle_event_callback, useCapture);
}
return new RSVP.Promise(resolver, canceller);
}
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// Handlebars // Handlebars
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// 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);
initDocumentPageMixin(gadget_klass); initDocumentPageMixin(gadget_klass);
gadget_klass.ready(function(g) { 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) {
g.props = {};
}).ready(function(g) {
return g.getElement().push(function(element) {
g.props.element = element;
});
}).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, property_list = options.configuration_dict["Dream-Configuration"].property_list; 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({ queue = gadget.aq_getAttachment({
...@@ -114,9 +89,9 @@ ...@@ -114,9 +89,9 @@
_mimetype: "application/json" _mimetype: "application/json"
}); });
}).push(function(result) { }).push(function(result) {
return gadget.whoWantToDisplayThisDocumentPage("debug_json", gadget.props.jio_key); return gadget.whoWantToDisplayThisDocumentPage("Output_viewDebugJson", gadget.props.jio_key);
}).push(function(url) { }).push(function(url) {
return gadget.pleaseRedirectMyHash(url); return gadget.pleaseRedirectMyHash(url);
}); });
}); });
})(window, rJS, RSVP, initDocumentPageMixin, jQuery, Handlebars); })(window, rJS, RSVP, initDocumentPageMixin, jQuery, Handlebars, promiseEventListener, initGadgetMixin);
\ No newline at end of file \ No newline at end of file
...@@ -7,8 +7,9 @@ ...@@ -7,8 +7,9 @@
<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="document_page_mixin.js" type="text/javascript"></script> <script src="mixin_gadget.js" type="text/javascript"></script>
<script src="edit_table.js" type="text/javascript"></script> <script src="mixin_document_page.js" type="text/javascript"></script>
<script src="Input_viewTable.js" type="text/javascript"></script>
</head> </head>
<body> <body>
<div data-gadget-url="../handsontable/index.html" <div data-gadget-url="../handsontable/index.html"
......
/*global console, rJS, RSVP, initDocumentPageMixin */ /*global console, rJS, RSVP, initDocumentPageMixin, initGadgetMixin */
(function(window, rJS, RSVP, initDocumentPageMixin) { (function(window, rJS, RSVP, initDocumentPageMixin, initGadgetMixin) {
"use strict"; "use strict";
var gadget_klass = rJS(window); var gadget_klass = rJS(window);
initDocumentPageMixin(gadget_klass); initDocumentPageMixin(gadget_klass);
gadget_klass.ready(function(g) { initGadgetMixin(gadget_klass);
g.props = {}; gadget_klass.declareAcquiredMethod("aq_getAttachment", "jio_getAttachment").declareMethod("render", function(options) {
}).ready(function(g) {
return g.getElement().push(function(element) {
g.props.element = element;
});
}).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;
return new RSVP.Queue().push(function() { return new RSVP.Queue().push(function() {
...@@ -25,4 +20,4 @@ ...@@ -25,4 +20,4 @@
return tableeditor.startService(); return tableeditor.startService();
}); });
}); });
})(window, rJS, RSVP, initDocumentPageMixin); })(window, rJS, RSVP, initDocumentPageMixin, initGadgetMixin);
\ No newline at end of file \ No newline at end of file
...@@ -6,8 +6,9 @@ ...@@ -6,8 +6,9 @@
<title>Debug JSON</title> <title>Debug JSON</title>
<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="document_page_mixin.js" type="text/javascript"></script> <script src="mixin_gadget.js" type="text/javascript"></script>
<script src="debug_json.js" type="text/javascript"></script> <script src="mixin_document_page.js" type="text/javascript"></script>
<script src="Output_viewDebugJson.js" type="text/javascript"></script>
</head> </head>
<body> <body>
<label for="json_input">Input</label> <label for="json_input">Input</label>
......
/*global console, rJS, RSVP, initDocumentPageMixin */ /*global console, rJS, RSVP, initDocumentPageMixin, initGadgetMixin */
(function(window, rJS, RSVP, initDocumentPageMixin) { (function(window, rJS, RSVP, initDocumentPageMixin, initGadgetMixin) {
"use strict"; "use strict";
var gadget_klass = rJS(window); var gadget_klass = rJS(window);
initGadgetMixin(gadget_klass);
initDocumentPageMixin(gadget_klass); initDocumentPageMixin(gadget_klass);
gadget_klass.ready(function(g) { gadget_klass.declareAcquiredMethod("aq_getAttachment", "jio_getAttachment").declareMethod("render", function(options) {
g.props = {};
}).ready(function(g) {
return g.getElement().push(function(element) {
g.props.element = element;
});
}).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() { return new RSVP.Queue().push(function() {
...@@ -26,4 +21,4 @@ ...@@ -26,4 +21,4 @@
gadget.props.element.querySelector(".json_output").textContent = JSON.stringify(JSON.parse(result_list[1])[0].result); gadget.props.element.querySelector(".json_output").textContent = JSON.stringify(JSON.parse(result_list[1])[0].result);
}); });
}); });
})(window, rJS, RSVP, initDocumentPageMixin); })(window, rJS, RSVP, initDocumentPageMixin, initGadgetMixin);
\ No newline at end of file \ No newline at end of file
...@@ -7,8 +7,9 @@ ...@@ -7,8 +7,9 @@
<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="../lib/handlebars.min.js" type="text/javascript"></script> <script src="../lib/handlebars.min.js" type="text/javascript"></script>
<script src="document_page_mixin.js" type="text/javascript"></script> <script src="mixin_gadget.js" type="text/javascript"></script>
<script src="exit_stat.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 id="interval-through-metric-template" type="text/x-handlebars-template"> <script id="interval-through-metric-template" type="text/x-handlebars-template">
<tr> <tr>
......
/*global console, rJS, RSVP, initDocumentPageMixin, Handlebars */ /*global console, rJS, RSVP, initDocumentPageMixin, Handlebars,
initGadgetMixin */
/*jslint nomen: true */ /*jslint nomen: true */
(function(window, rJS, RSVP, initDocumentPageMixin, Handlebars) { (function(window, rJS, RSVP, initDocumentPageMixin, Handlebars, initGadgetMixin) {
"use strict"; "use strict";
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// Handlebars // Handlebars
...@@ -83,14 +84,9 @@ ...@@ -83,14 +84,9 @@
} }
return result; return result;
} }
initGadgetMixin(gadget_klass);
initDocumentPageMixin(gadget_klass); initDocumentPageMixin(gadget_klass);
gadget_klass.ready(function(g) { gadget_klass.declareAcquiredMethod("aq_getAttachment", "jio_getAttachment").declareMethod("render", function(options) {
g.props = {};
}).ready(function(g) {
return g.getElement().push(function(element) {
g.props.element = element;
});
}).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;
return gadget.aq_getAttachment({ return gadget.aq_getAttachment({
...@@ -102,4 +98,4 @@ ...@@ -102,4 +98,4 @@
gadget.props.element.innerHTML = result; gadget.props.element.innerHTML = result;
}); });
}); });
})(window, rJS, RSVP, initDocumentPageMixin, Handlebars); })(window, rJS, RSVP, initDocumentPageMixin, Handlebars, initGadgetMixin);
\ No newline at end of file \ No newline at end of file
...@@ -10,8 +10,9 @@ ...@@ -10,8 +10,9 @@
<script src="../lib/renderjs.min.js" type="text/javascript"></script> <script src="../lib/renderjs.min.js" type="text/javascript"></script>
<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="document_page_mixin.js" type="text/javascript"></script> <script src="mixin_gadget.js" type="text/javascript"></script>
<script src="job_gantt.js" type="text/javascript"></script> <script src="mixin_document_page.js" type="text/javascript"></script>
<script src="Output_viewJobGantt.js" type="text/javascript"></script>
</head> </head>
<body> <body>
<div class="gant_container" style="height: 800px;"></div> <div class="gant_container" style="height: 800px;"></div>
......
/*global console, rJS, RSVP, initDocumentPageMixin, jQuery, gantt */ /*global console, rJS, RSVP, initDocumentPageMixin, jQuery, gantt,
initGadgetMixin */
/*jslint nomen: true */ /*jslint nomen: true */
(function(window, rJS, RSVP, initDocumentPageMixin, $, gantt) { (function(window, rJS, RSVP, initDocumentPageMixin, $, 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" : "";
...@@ -159,14 +160,9 @@ ...@@ -159,14 +160,9 @@
return gantt_data; return gantt_data;
} }
var gadget_klass = rJS(window); var gadget_klass = rJS(window);
initGadgetMixin(gadget_klass);
initDocumentPageMixin(gadget_klass); initDocumentPageMixin(gadget_klass);
gadget_klass.ready(function(g) { gadget_klass.declareAcquiredMethod("aq_getAttachment", "jio_getAttachment").declareMethod("render", function(options) {
g.props = {};
}).ready(function(g) {
return g.getElement().push(function(element) {
g.props.element = element;
});
}).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;
return gadget.aq_getAttachment({ return gadget.aq_getAttachment({
...@@ -204,4 +200,4 @@ ...@@ -204,4 +200,4 @@
throw error; throw error;
}); });
}); });
})(window, rJS, RSVP, initDocumentPageMixin, jQuery, gantt); })(window, rJS, RSVP, initDocumentPageMixin, jQuery, gantt, initGadgetMixin);
\ No newline at end of file \ No newline at end of file
...@@ -8,8 +8,9 @@ ...@@ -8,8 +8,9 @@
<script src="../lib/renderjs.min.js" type="text/javascript"></script> <script src="../lib/renderjs.min.js" type="text/javascript"></script>
<script src="../lib/moment.js" type="text/javascript"></script> <script src="../lib/moment.js" type="text/javascript"></script>
<script src="document_page_mixin.js" type="text/javascript"></script> <script src="mixin_gadget.js" type="text/javascript"></script>
<script src="job_schedule_spreadsheet.js" type="text/javascript"></script> <script src="mixin_document_page.js" type="text/javascript"></script>
<script src="Output_viewJobScheduleSpreadsheet.js" type="text/javascript"></script>
</head> </head>
<body> <body>
<div data-gadget-url="../handsontable/index.html" <div data-gadget-url="../handsontable/index.html"
......
/*global console, rJS, RSVP, initDocumentPageMixin, moment */ /*global console, rJS, RSVP, initDocumentPageMixin, moment, initGadgetMixin */
/*jslint nomen: true */ /*jslint nomen: true */
(function(window, rJS, RSVP, initDocumentPageMixin, moment) { (function(window, rJS, RSVP, initDocumentPageMixin, 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;
...@@ -89,14 +89,9 @@ ...@@ -89,14 +89,9 @@
return spreadsheet_header.concat(spreadsheet_data); return spreadsheet_header.concat(spreadsheet_data);
} }
var gadget_klass = rJS(window); var gadget_klass = rJS(window);
initGadgetMixin(gadget_klass);
initDocumentPageMixin(gadget_klass); initDocumentPageMixin(gadget_klass);
gadget_klass.ready(function(g) { gadget_klass.declareAcquiredMethod("aq_getAttachment", "jio_getAttachment").declareMethod("render", function(options) {
g.props = {};
}).ready(function(g) {
return g.getElement().push(function(element) {
g.props.element = element;
});
}).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;
return new RSVP.Queue().push(function() { return new RSVP.Queue().push(function() {
...@@ -113,4 +108,4 @@ ...@@ -113,4 +108,4 @@
return tableeditor.startService(); return tableeditor.startService();
}); });
}); });
})(window, rJS, RSVP, initDocumentPageMixin, moment); })(window, rJS, RSVP, initDocumentPageMixin, moment, initGadgetMixin);
\ No newline at end of file \ No newline at end of file
...@@ -8,8 +8,9 @@ ...@@ -8,8 +8,9 @@
<script src="../lib/renderjs.min.js" type="text/javascript"></script> <script src="../lib/renderjs.min.js" type="text/javascript"></script>
<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="document_page_mixin.js" type="text/javascript"></script> <script src="mixin_gadget.js" type="text/javascript"></script>
<script src="queue_stat_graph.js" type="text/javascript"></script> <script src="mixin_document_page.js" type="text/javascript"></script>
<script src="Output_viewQueueStatGraph.js" type="text/javascript"></script>
</head> </head>
<body> <body>
<div class="graph_container" style="width: 100%;height:300px"></div> <div class="graph_container" style="width: 100%;height:300px"></div>
......
/*global console, rJS, RSVP, initDocumentPageMixin, jQuery */ /*global console, rJS, RSVP, initDocumentPageMixin, jQuery, initGadgetMixin */
/*jslint nomen: true */ /*jslint nomen: true */
(function(window, rJS, RSVP, initDocumentPageMixin, $) { (function(window, rJS, RSVP, initDocumentPageMixin, $, 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.
...@@ -18,14 +18,9 @@ ...@@ -18,14 +18,9 @@
return series; return series;
} }
var gadget_klass = rJS(window); var gadget_klass = rJS(window);
initGadgetMixin(gadget_klass);
initDocumentPageMixin(gadget_klass); initDocumentPageMixin(gadget_klass);
gadget_klass.ready(function(g) { gadget_klass.declareAcquiredMethod("aq_getAttachment", "jio_getAttachment").declareMethod("render", function(options) {
g.props = {};
}).ready(function(g) {
return g.getElement().push(function(element) {
g.props.element = element;
});
}).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;
return gadget.aq_getAttachment({ return gadget.aq_getAttachment({
...@@ -39,4 +34,4 @@ ...@@ -39,4 +34,4 @@
// 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); })(window, rJS, RSVP, initDocumentPageMixin, jQuery, initGadgetMixin);
\ No newline at end of file \ No newline at end of file
...@@ -9,8 +9,9 @@ ...@@ -9,8 +9,9 @@
<script src="../lib/jquery.js" type="text/javascript"></script> <script src="../lib/jquery.js" type="text/javascript"></script>
<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="document_page_mixin.js" type="text/javascript"></script> <script src="mixin_gadget.js" type="text/javascript"></script>
<script src="station_utilisation_graph.js" type="text/javascript"></script> <script src="mixin_document_page.js" type="text/javascript"></script>
<script src="Output_viewStationUtilisationGraph.js" type="text/javascript"></script>
</head> </head>
<body> <body>
<div class="graph_container" style="width: 100%;height:300px"></div> <div class="graph_container" style="width: 100%;height:300px"></div>
......
/*global console, rJS, RSVP, initDocumentPageMixin, jQuery */ /*global console, rJS, RSVP, initDocumentPageMixin, jQuery, initGadgetMixin */
(function(window, rJS, RSVP, initDocumentPageMixin, $) { (function(window, rJS, RSVP, initDocumentPageMixin, $, 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;
...@@ -96,14 +96,9 @@ ...@@ -96,14 +96,9 @@
return [ series, options ]; return [ series, options ];
} }
var gadget_klass = rJS(window); var gadget_klass = rJS(window);
initGadgetMixin(gadget_klass);
initDocumentPageMixin(gadget_klass); initDocumentPageMixin(gadget_klass);
gadget_klass.ready(function(g) { gadget_klass.declareAcquiredMethod("aq_getAttachment", "jio_getAttachment").declareMethod("render", function(options) {
g.props = {};
}).ready(function(g) {
return g.getElement().push(function(element) {
g.props.element = element;
});
}).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;
return gadget.aq_getAttachment({ return gadget.aq_getAttachment({
...@@ -117,4 +112,4 @@ ...@@ -117,4 +112,4 @@
// 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); })(window, rJS, RSVP, initDocumentPageMixin, jQuery, initGadgetMixin);
\ No newline at end of file \ No newline at end of file
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
<script src="../lib/handlebars.min.js" type="text/javascript"></script> <script src="../lib/handlebars.min.js" type="text/javascript"></script>
<script src="../lib/jquery.js" type="text/javascript"></script> <script src="../lib/jquery.js" type="text/javascript"></script>
<script src="../lib/jquerymobile.js" type="text/javascript"></script> <script src="../lib/jquerymobile.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="navigation-template" type="text/x-handlebars-template">
......
/*global console, jQuery, rJS, RSVP, alert, Handlebars */ /*global console, jQuery, rJS, RSVP, alert, Handlebars, initGadgetMixin */
/*jslint nomen: true */ /*jslint nomen: true */
(function(window, $, rJS, RSVP, Handlebars) { (function(window, $, rJS, RSVP, Handlebars, initGadgetMixin) {
"use strict"; "use strict";
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// Desactivate jQuery Mobile URL management // Desactivate jQuery Mobile URL management
...@@ -9,8 +9,9 @@ ...@@ -9,8 +9,9 @@
$.mobile.linkBindingEnabled = false; $.mobile.linkBindingEnabled = false;
$.mobile.hashListeningEnabled = false; $.mobile.hashListeningEnabled = false;
$.mobile.pushStateEnabled = false; $.mobile.pushStateEnabled = false;
var navigation_template; var navigation_template, gadget_klass = rJS(window);
rJS(window).declareAcquiredMethod("pleaseRedirectMyHash", "pleaseRedirectMyHash").allowPublicAcquisition("allDocs", function(param_list) { initGadgetMixin(gadget_klass);
gadget_klass.declareAcquiredMethod("pleaseRedirectMyHash", "pleaseRedirectMyHash").allowPublicAcquisition("allDocs", function(param_list) {
return this.getDeclaredGadget("jio").push(function(jio_gadget) { return this.getDeclaredGadget("jio").push(function(jio_gadget) {
return jio_gadget.allDocs.apply(jio_gadget, param_list); return jio_gadget.allDocs.apply(jio_gadget, param_list);
}); });
...@@ -49,7 +50,7 @@ ...@@ -49,7 +50,7 @@
}).allowPublicAcquisition("whoWantToDisplayThisDocument", function(param_list) { }).allowPublicAcquisition("whoWantToDisplayThisDocument", function(param_list) {
// Hey, I want to display some jIO document // Hey, I want to display some jIO document
return this.aq_pleasePublishMyState({ return this.aq_pleasePublishMyState({
page: "edit_table", page: "Input_viewTable",
id: param_list[0] id: param_list[0]
}); });
}).allowPublicAcquisition("whoWantToDisplayThisDocumentPage", function(param_list) { }).allowPublicAcquisition("whoWantToDisplayThisDocumentPage", function(param_list) {
...@@ -58,12 +59,6 @@ ...@@ -58,12 +59,6 @@
page: param_list[0], page: param_list[0],
id: param_list[1] id: param_list[1]
}); });
}).ready(function(g) {
g.props = {};
}).ready(function(g) {
return g.getElement().push(function(element) {
g.props.element = element;
});
}).ready(function(g) { }).ready(function(g) {
return g.aq_pleasePublishMyState({}).push(function(link) { return g.aq_pleasePublishMyState({}).push(function(link) {
g.props.element.getElementsByClassName("home_link")[0].href = link; g.props.element.getElementsByClassName("home_link")[0].href = link;
...@@ -97,7 +92,7 @@ ...@@ -97,7 +92,7 @@
if (options.page === undefined) { if (options.page === undefined) {
// Redirect to the about page // Redirect to the about page
return gadget.aq_pleasePublishMyState({ return gadget.aq_pleasePublishMyState({
page: "document_list" page: "InputModule_viewInputList"
}).push(gadget.pleaseRedirectMyHash.bind(gadget)); }).push(gadget.pleaseRedirectMyHash.bind(gadget));
} }
return gadget.declareGadget(options.page + ".html").push(function(g) { return gadget.declareGadget(options.page + ".html").push(function(g) {
...@@ -137,4 +132,4 @@ ...@@ -137,4 +132,4 @@
} }
}); });
}); });
})(window, jQuery, rJS, RSVP, Handlebars); })(window, jQuery, rJS, RSVP, Handlebars, initGadgetMixin);
\ No newline at end of file \ No newline at end of file
/*global console, rJS, RSVP */ /*global console, RSVP */
(function(window, rJS, RSVP) { (function(window, RSVP) {
"use strict"; "use strict";
window.initDocumentPageMixin = function(gadget_klass) { window.initDocumentPageMixin = function(gadget_klass) {
gadget_klass.declareAcquiredMethod("whoWantToDisplayThisDocumentPage", "whoWantToDisplayThisDocumentPage").declareMethod("getNavigationList", function() { gadget_klass.declareAcquiredMethod("whoWantToDisplayThisDocumentPage", "whoWantToDisplayThisDocumentPage").declareMethod("getNavigationList", function() {
var key = this.props.jio_key, gadget = this; var key = this.props.jio_key, gadget = this;
return new RSVP.Queue().push(function() { return new RSVP.Queue().push(function() {
// XXX Conditional simulation menu // XXX Conditional simulation menu
return RSVP.all([ gadget.whoWantToDisplayThisDocumentPage("production_line", key), gadget.whoWantToDisplayThisDocumentPage("edit_table", key), gadget.whoWantToDisplayThisDocumentPage("run_simulation", key), gadget.whoWantToDisplayThisDocumentPage("manage_document", key), gadget.whoWantToDisplayThisDocumentPage("station_utilisation_graph", key), gadget.whoWantToDisplayThisDocumentPage("queue_stat_graph", key), gadget.whoWantToDisplayThisDocumentPage("exit_stat", key), gadget.whoWantToDisplayThisDocumentPage("job_gantt", key), gadget.whoWantToDisplayThisDocumentPage("job_schedule_spreadsheet", key), gadget.whoWantToDisplayThisDocumentPage("debug_json", key) ]); return RSVP.all([ gadget.whoWantToDisplayThisDocumentPage("Input_viewProductionLine", key), gadget.whoWantToDisplayThisDocumentPage("Input_viewTable", key), gadget.whoWantToDisplayThisDocumentPage("Input_viewSimulation", key), gadget.whoWantToDisplayThisDocumentPage("Input_viewDocumentManagement", key), gadget.whoWantToDisplayThisDocumentPage("Output_viewStationUtilisationGraph", key), gadget.whoWantToDisplayThisDocumentPage("Output_viewQueueStatGraph", key), gadget.whoWantToDisplayThisDocumentPage("Output_viewExitStatistics", key), gadget.whoWantToDisplayThisDocumentPage("Output_viewJobGantt", key), gadget.whoWantToDisplayThisDocumentPage("Output_viewJobScheduleSpreadsheet", key), gadget.whoWantToDisplayThisDocumentPage("Output_viewDebugJson", key) ]);
}).push(function(result_list) { }).push(function(result_list) {
return [ { return [ {
link: result_list[0], link: result_list[0],
...@@ -42,4 +42,4 @@ ...@@ -42,4 +42,4 @@
}); });
}); });
}; };
})(window, rJS, RSVP); })(window, RSVP);
\ No newline at end of file \ No newline at end of file
(function(window) {
"use strict";
window.initGadgetMixin = function(gadget_klass) {
gadget_klass.ready(function(g) {
g.props = {};
}).ready(function(g) {
return g.getElement().push(function(element) {
g.props.element = element;
});
});
};
})(window);
\ No newline at end of file
/*global console, RSVP, FileReader */
(function(window, RSVP, FileReader) {
"use strict";
window.promiseEventListener = function(target, type, useCapture) {
//////////////////////////
// Resolve the promise as soon as the event is triggered
// eventListener is removed when promise is cancelled/resolved/rejected
//////////////////////////
var handle_event_callback;
function canceller() {
target.removeEventListener(type, handle_event_callback, useCapture);
}
function resolver(resolve) {
handle_event_callback = function(evt) {
canceller();
evt.stopPropagation();
evt.preventDefault();
resolve(evt);
return false;
};
target.addEventListener(type, handle_event_callback, useCapture);
}
return new RSVP.Promise(resolver, canceller);
};
window.promiseReadAsText = function(file) {
return new RSVP.Promise(function(resolve, reject) {
var reader = new FileReader();
reader.onload = function(evt) {
resolve(evt.target.result);
};
reader.onerror = function(evt) {
reject(evt);
};
reader.readAsText(file);
});
};
})(window, RSVP, FileReader);
\ 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