Commit 88bfb6c0 authored by Jérome Perrin's avatar Jérome Perrin

update static version

parent b2d0aa6e
......@@ -31,9 +31,13 @@
doc = document_list[i];
parameter_list[i] = {
link: doc[0],
title: doc[1] + " (" + doc[2] + ")"
title: doc[1] + " (" + doc[2] + ")",
date: new Date(doc[2])
};
}
parameter_list.sort(function(a, b) {
return b.date - a.date;
});
// gadget.props.element.querySelector('a').href = document_list[0];
gadget.props.element.querySelector(".document_list").innerHTML = table_template({
documentlist: parameter_list
......
......@@ -5,7 +5,9 @@
var gadget = this, editor_data, editor_gadget;
return new RSVP.Queue().push(function() {
// Prevent double click
evt.target.getElementsByClassName("ui-btn")[0].disabled = true;
if (evt) {
evt.target.getElementsByClassName("ui-btn")[0].disabled = true;
}
return gadget.getDeclaredGadget("tableeditor");
}).push(function(tablegadget) {
editor_gadget = tablegadget;
......@@ -27,7 +29,9 @@
_mimetype: "application/json"
});
}).push(function() {
evt.target.getElementsByClassName("ui-btn")[0].disabled = false;
if (evt) {
evt.target.getElementsByClassName("ui-btn")[0].disabled = false;
}
});
}
function waitForSave(gadget) {
......@@ -46,7 +50,13 @@
}).push(function(result_list) {
return result_list[1].render(JSON.stringify(JSON.parse(result_list[0]).capacity_by_station_spreadsheet), {
minSpareCols: 1,
minSpareRows: 1
minSpareRows: 1,
onChange: function() {
if (gadget.timeout) {
window.clearTimeout(gadget.timeout);
}
gadget.timeout = window.setTimeout(saveSpreadsheet.bind(gadget), 100);
}
});
});
}).declareMethod("startService", function() {
......
......@@ -5,7 +5,9 @@
var gadget = this, editor_data, editor_gadget;
return new RSVP.Queue().push(function() {
// Prevent double click
evt.target.getElementsByClassName("ui-btn")[0].disabled = true;
if (evt) {
evt.target.getElementsByClassName("ui-btn")[0].disabled = true;
}
return gadget.getDeclaredGadget("tableeditor");
}).push(function(tablegadget) {
editor_gadget = tablegadget;
......@@ -27,7 +29,9 @@
_mimetype: "application/json"
});
}).push(function() {
evt.target.getElementsByClassName("ui-btn")[0].disabled = false;
if (evt) {
evt.target.getElementsByClassName("ui-btn")[0].disabled = false;
}
});
}
function waitForSave(gadget) {
......@@ -46,7 +50,13 @@
}).push(function(result_list) {
return result_list[1].render(JSON.stringify(JSON.parse(result_list[0]).dp_capacity_spreadsheet), {
minSpareCols: 1,
minSpareRows: 1
minSpareRows: 1,
onChange: function() {
if (gadget.timeout) {
window.clearTimeout(gadget.timeout);
}
gadget.timeout = window.setTimeout(saveSpreadsheet.bind(gadget), 100);
}
});
});
}).declareMethod("startService", function() {
......
......@@ -5,7 +5,9 @@
var gadget = this, editor_data, editor_gadget;
return new RSVP.Queue().push(function() {
// Prevent double click
evt.target.getElementsByClassName("ui-btn")[0].disabled = true;
if (evt) {
evt.target.getElementsByClassName("ui-btn")[0].disabled = true;
}
return gadget.getDeclaredGadget("tableeditor");
}).push(function(tablegadget) {
editor_gadget = tablegadget;
......@@ -27,7 +29,9 @@
_mimetype: "application/json"
});
}).push(function() {
evt.target.getElementsByClassName("ui-btn")[0].disabled = false;
if (evt) {
evt.target.getElementsByClassName("ui-btn")[0].disabled = false;
}
});
}
function waitForSave(gadget) {
......@@ -46,7 +50,13 @@
}).push(function(result_list) {
return result_list[1].render(JSON.stringify(JSON.parse(result_list[0]).dp_route_spreadsheet), {
minSpareCols: 1,
minSpareRows: 1
minSpareRows: 1,
onChange: function() {
if (gadget.timeout) {
window.clearTimeout(gadget.timeout);
}
gadget.timeout = window.setTimeout(saveSpreadsheet.bind(gadget), 100);
}
});
});
}).declareMethod("startService", function() {
......
......@@ -6,6 +6,7 @@
<title>Edit table</title>
<script src="../lib/rsvp.min.js" type="text/javascript"></script>
<script src="../lib/renderjs.min.js" type="text/javascript"></script>
<script src="../lib/pubsub.js" type="text/javascript"></script>
<script src="mixin_promise.js" type="text/javascript"></script>
......
......@@ -3,13 +3,14 @@
"use strict";
var gadget_klass = rJS(window);
function saveGraph(evt) {
var gadget = this, graph_data, graph_gadget;
var gadget = this, graph_data;
return new RSVP.Queue().push(function() {
// Prevent double click
evt.target.getElementsByClassName("ui-btn")[0].disabled = true;
if (evt) {
evt.target.getElementsByClassName("ui-btn")[0].disabled = true;
}
return gadget.getDeclaredGadget("productionline_graph");
}).push(function(graphgadget) {
graph_gadget = graphgadget;
}).push(function(graph_gadget) {
return graph_gadget.getData();
}).push(function(data) {
graph_data = data;
......@@ -19,10 +20,10 @@
_attachment: "body.json"
});
}).push(function(body) {
var data = JSON.parse(body);
data.nodes = JSON.parse(graph_data).nodes;
data.edges = JSON.parse(graph_data).edges;
data.preference = JSON.parse(graph_data).preference;
var data = JSON.parse(body), json_graph_data = JSON.parse(graph_data);
data.nodes = json_graph_data.nodes;
data.edges = json_graph_data.edges;
data.preference = json_graph_data.preference;
return gadget.aq_putAttachment({
_id: gadget.props.jio_key,
_attachment: "body.json",
......@@ -30,7 +31,9 @@
_mimetype: "application/json"
});
}).push(function() {
evt.target.getElementsByClassName("ui-btn")[0].disabled = false;
if (evt) {
evt.target.getElementsByClassName("ui-btn")[0].disabled = false;
}
});
}
function waitForSave(gadget) {
......@@ -60,6 +63,13 @@
});
}).declareMethod("startService", function() {
var g = this, graph;
// save automatically
window.$.subscribe("Dream.Gui.onDataChange", function() {
if (g.timeout) {
window.clearTimeout(g.timeout);
}
g.timeout = window.setTimeout(saveGraph.bind(g), 100);
});
return g.getDeclaredGadget("productionline_graph").push(function(graph_gadget) {
graph = graph_gadget;
return g.getDeclaredGadget("productionline_toolbox");
......
......@@ -5,7 +5,9 @@
var gadget = this, editor_data, editor_gadget;
return new RSVP.Queue().push(function() {
// Prevent double click
evt.target.getElementsByClassName("ui-btn")[0].disabled = true;
if (evt) {
evt.target.getElementsByClassName("ui-btn")[0].disabled = true;
}
return gadget.getDeclaredGadget("tableeditor");
}).push(function(tablegadget) {
editor_gadget = tablegadget;
......@@ -27,7 +29,9 @@
_mimetype: "application/json"
});
}).push(function() {
evt.target.getElementsByClassName("ui-btn")[0].disabled = false;
if (evt) {
evt.target.getElementsByClassName("ui-btn")[0].disabled = false;
}
});
}
function waitForSave(gadget) {
......@@ -45,7 +49,13 @@
}), gadget.getDeclaredGadget("tableeditor") ]);
}).push(function(result_list) {
return result_list[1].render(JSON.stringify(JSON.parse(result_list[0]).capacity_by_project_spreadsheet), {
minSpareRows: 1
minSpareRows: 1,
onChange: function() {
if (gadget.timeout) {
window.clearTimeout(gadget.timeout);
}
gadget.timeout = window.setTimeout(saveSpreadsheet.bind(gadget), 100);
}
});
});
}).declareMethod("startService", function() {
......
......@@ -5,7 +5,9 @@
var gadget = this, editor_data, editor_gadget;
return new RSVP.Queue().push(function() {
// Prevent double click
evt.target.getElementsByClassName("ui-btn")[0].disabled = true;
if (evt) {
evt.target.getElementsByClassName("ui-btn")[0].disabled = true;
}
return gadget.getDeclaredGadget("tableeditor");
}).push(function(tablegadget) {
editor_gadget = tablegadget;
......@@ -27,7 +29,9 @@
_mimetype: "application/json"
});
}).push(function() {
evt.target.getElementsByClassName("ui-btn")[0].disabled = false;
if (evt) {
evt.target.getElementsByClassName("ui-btn")[0].disabled = false;
}
});
}
function waitForSave(gadget) {
......@@ -45,7 +49,13 @@
}), gadget.getDeclaredGadget("tableeditor") ]);
}).push(function(result_list) {
return result_list[1].render(JSON.stringify(JSON.parse(result_list[0]).shift_spreadsheet), {
minSpareRows: 1
minSpareRows: 1,
onChange: function() {
if (gadget.timeout) {
window.clearTimeout(gadget.timeout);
}
gadget.timeout = window.setTimeout(saveSpreadsheet.bind(gadget), 100);
}
});
});
}).declareMethod("startService", function() {
......
......@@ -19,7 +19,7 @@
<script src="Input_viewSimulation.js" type="text/javascript"></script>
</head>
<body>
<form class="save_form">
<form class="run_form">
<fieldset>
<div data-gadget-url="../fieldset/index.html"
data-gadget-scope="fieldset"></div>
......
......@@ -60,7 +60,7 @@
function waitForRunSimulation(gadget) {
var submit_evt;
return new RSVP.Queue().push(function() {
return promiseEventListener(gadget.props.element.getElementsByClassName("save_form")[0], "submit", false);
return promiseEventListener(gadget.props.element.getElementsByClassName("run_form")[0], "submit", false);
}).push(function(evt) {
submit_evt = evt;
// Prevent double click
......
......@@ -5,7 +5,9 @@
var gadget = this, editor_data, editor_gadget;
return new RSVP.Queue().push(function() {
// Prevent double click
evt.target.getElementsByClassName("ui-btn")[0].disabled = true;
if (evt) {
evt.target.getElementsByClassName("ui-btn")[0].disabled = true;
}
return gadget.getDeclaredGadget("tableeditor");
}).push(function(tablegadget) {
editor_gadget = tablegadget;
......@@ -27,7 +29,9 @@
_mimetype: "application/json"
});
}).push(function() {
evt.target.getElementsByClassName("ui-btn")[0].disabled = false;
if (evt) {
evt.target.getElementsByClassName("ui-btn")[0].disabled = false;
}
});
}
function waitForSave(gadget) {
......@@ -45,7 +49,13 @@
}), gadget.getDeclaredGadget("tableeditor") ]);
}).push(function(result_list) {
return result_list[1].render(JSON.stringify(JSON.parse(result_list[0]).wip_part_spreadsheet), {
minSpareRows: 1
minSpareRows: 1,
onChange: function() {
if (gadget.timeout) {
window.clearTimeout(gadget.timeout);
}
gadget.timeout = window.setTimeout(saveSpreadsheet.bind(gadget), 100);
}
});
});
}).declareMethod("startService", function() {
......
@media (min-width:110em){.jqm-navmenu-panel.ui-panel-closed{visibility:visible!important;width:17em;-webkit-transition:none!important;-moz-transition:none!important;transition:none!important;-webkit-transform:none!important;-moz-transform:none!important;transform:none!important;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;height:100%;position:absolute;display:block}.ui-panel-page-content-open{width:auto}.ui-panel-page-content-open.ui-panel-page-content-position-left{margin-right:17em}.ui-panel-dismiss,.menu_link{display:none!important}.gadget_container,header,nav{margin-left:17em}.close-entry{display:none!important}.gadget_container{padding:1em}}[data-gadget-scope=productionline_toolbox]{position:relative;width:19.5%;float:left}[data-gadget-scope=productionline_graph]{position:relative;width:79.5%;float:right}
\ No newline at end of file
@media (min-width:110em){.jqm-navmenu-panel.ui-panel-closed{visibility:visible!important;width:17em;-webkit-transition:none!important;-moz-transition:none!important;transition:none!important;-webkit-transform:none!important;-moz-transform:none!important;transform:none!important;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;height:100%;position:absolute;display:block}.ui-panel-page-content-open{width:auto}.ui-panel-page-content-open.ui-panel-page-content-position-left{margin-right:17em}.ui-panel-dismiss,.menu_link{display:none!important}.gadget_container,header,nav{margin-left:17em}.close-entry{display:none!important}.gadget_container{padding:1em}}[data-gadget-scope=productionline_toolbox]{position:relative;width:19.5%;float:left}[data-gadget-scope=productionline_graph]{position:relative;width:79.5%;float:right}form.save_form{display:none}
\ No newline at end of file
......@@ -11,6 +11,7 @@
<script src="../lib/renderjs.min.js"></script>
<script src="../lib/jquery.jsplumb.min.js"></script>
<script src="../lib/handlebars.min.js"></script>
<script src="../lib/pubsub.js" type="text/javascript"></script>
<script id="node-template" type="text/x-handlebars-template">
<div class="window {{class}}"
......
......@@ -84,12 +84,18 @@
}
return "DreamNode_" + n;
}
function onDataChange(g) {
g.getData().then(function(data) {
$.publish("Dream.Gui.onDataChange", data);
});
}
function updateConnectionData(gadget, connection, remove, edge_data) {
if (remove) {
delete gadget.props.edge_container[connection.id];
} else {
gadget.props.edge_container[connection.id] = [ getNodeId(gadget.props.node_container, connection.sourceId), getNodeId(gadget.props.node_container, connection.targetId), edge_data || {} ];
}
onDataChange(gadget);
}
// bind to connection/connectionDetached events,
// and update the list of connections on screen.
......@@ -129,6 +135,7 @@
}
coordinates[node_id] = coordinate;
gadget.props.preference_container.coordinates = coordinates;
onDataChange(gadget);
return coordinate;
}
function draggable(gadget) {
......@@ -190,6 +197,7 @@
// return undefined;
// });
// split in 2 methods ? one for events one for manip
onDataChange(gadget);
draggable(gadget);
}
function updateNodeStyle(gadget, element_id) {
......@@ -268,6 +276,7 @@
// 1.1111;
// setZoom(gadget, zoom_level);
// gadget.props.preference_container.zoom_level = zoom_level;
// onDataChange();
// redraw(gadget);
// }
// function zoom_out(gadget) {
......@@ -275,6 +284,7 @@
// 0.9;
// setZoom(gadget, zoom_level);
// gadget.props.preference_container.zoom_level = zoom_level;
// onDataChange();
// redraw(gadget);
// }
function removeElement(gadget, node_id) {
......@@ -288,6 +298,7 @@
delete gadget.props.edge_container[k];
}
});
onDataChange(gadget);
}
function updateElementData(gadget, node_id, data) {
var element_id = gadget.props.node_container[node_id].element_id, new_id = data.id;
......@@ -312,6 +323,7 @@
gadget.props.preference_container.coordinates[new_id] = gadget.props.preference_container.coordinates[node_id];
delete gadget.props.preference_container.coordinates[node_id];
}
onDataChange(gadget);
}
// function clearAll(gadget) {
// $.each(gadget.props.node_container, function (node_id) {
......@@ -353,9 +365,11 @@
// }
// function setGeneralProperties(gadget, properties) {
// gadget.props.general_container = properties;
// onDataChange();
// }
// function updateGeneralProperties(gadget, properties) {
// $.extend(gadget.props.general_container, properties);
// onDataChange();
// }
function openNodeDialog(gadget, element, config_dict) {
var node_id = getNodeId(gadget.props.node_container, element.id), node_data = gadget.props.node_container[node_id], element_type = node_data._class.replace(".", "-"), property_list = config_dict[element_type].property_list || [], node_edit_popup = $(gadget.props.element).find("#popup-edit-template"), fieldset_element, delete_promise;
......@@ -454,6 +468,7 @@
box.css("left", absolute_position[0]);
updateNodeStyle(gadget, element.element_id);
draggable(gadget);
onDataChange(gadget);
}
function waitForDragover(gadget) {
return loopEventListener(gadget.props.main, "dragover", false, function() {
......
/*global jQuery */
/* jQuery Tiny Pub/Sub - v0.7 - 10/27/2011
* http://benalman.com/
* Copyright (c) 2011 "Cowboy" Ben Alman; Licensed MIT, GPL */
(function($) {
"use strict";
var o = $({});
$.subscribe = function() {
o.on.apply(o, arguments);
};
$.unsubscribe = function() {
o.off.apply(o, arguments);
};
$.publish = function() {
o.trigger.apply(o, arguments);
};
})(jQuery);
\ 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