Commit 21c53205 authored by Jérome Perrin's avatar Jérome Perrin

update static version

parent 8f082775
<!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 src="mixin_gadget.js" type="text/javascript"></script>
<script src="Input_viewResultComparison.js" type="text/javascript"></script>
</head>
<body>
<div data-gadget-url="../handsontable/index.html"
data-gadget-scope="tableeditor"></div>
</body>
</html>
/*global rJS, RSVP, initGadgetMixin, jQuery */
/*jslint loopfunc: true */
/*jslint nomen: true */
(function(window, rJS, RSVP, initGadgetMixin, $) {
"use strict";
var gadget_klass = rJS(window);
initGadgetMixin(gadget_klass);
gadget_klass.declareAcquiredMethod("aq_getAttachment", "jio_getAttachment").declareAcquiredMethod("whoWantsToDisplayThisResult", "whoWantsToDisplayThisResult").declareMethod("render", function(options) {
var gadget = this, order_lateness = {};
this.props.jio_key = options.id;
return gadget.aq_getAttachment({
_id: gadget.props.jio_key,
_attachment: "body.json"
}).push(undefined, function(error) {
if (error.status_code === 404) {
// Simulation not yet generated
return JSON.stringify([]);
}
throw error;
}).push(function(sim_json) {
var result = JSON.parse(sim_json).result, result_list = [], document_list = [], i;
if (result && result.result_list) {
document_list = result.result_list;
}
for (i = 0; i < document_list.length; i += 1) {
result_list.push(RSVP.all([ gadget.whoWantsToDisplayThisResult(gadget.props.jio_key, i), document_list[i] ]));
}
return RSVP.all(result_list);
}).push(function(result_list) {
var i, link, result, calculateOrderLateness = function(order_id) {
var order = result.order_lateness[order_id];
order.link = link;
if (!order_lateness[order_id]) {
order_lateness[order_id] = [];
}
order_lateness[order_id].push(order);
};
for (i = 0; i < result_list.length; i++) {
link = result_list[i][0];
result = result_list[i][1];
Object.keys(result.order_lateness).forEach(calculateOrderLateness);
}
return gadget.getDeclaredGadget("tableeditor");
}).push(function(tableeditor) {
var i, data = [], colHeaders = [ "Project" ], columns = [ {
data: 0
} ];
Object.keys(order_lateness).forEach(function(order_id) {
var order = order_lateness[order_id];
order.unshift(order_id);
data.push(order);
});
function orderHtmlRenderer(instance, td, row, col, prop, value, cellProperties) {
var a, color = "yellow";
if (value.delay < .5) {
color = "green";
}
if (value.delay > .5) {
color = "red";
}
$(td).css({
"background-color": color
});
a = $("<a>").attr("href", value.link).text(value.completionDate + "\n" + (value.delay || 0).toFixed(0)).css({
color: "black",
"text-shadow": "none"
});
a.appendTo(td);
return td;
}
for (i = 1; i < data[0].length; i += 1) {
colHeaders.push("Solution #" + i);
columns.push({
data: i,
renderer: orderHtmlRenderer
});
}
return tableeditor.render(JSON.stringify(data), {
colHeaders: colHeaders,
columns: columns,
readOnly: true
});
});
}).declareMethod("startService", function() {
var gadget = this;
return this.getDeclaredGadget("tableeditor").push(function(tableeditor) {
return tableeditor.startService();
});
});
})(window, rJS, RSVP, initGadgetMixin, jQuery);
\ 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>Gantt</title>
<link rel="stylesheet" href="../lib/dhtmlxscheduler.css">
<style>
.dhx_cal_event.multisection div{
background-color: inherit;
}
.section_1{
background-color: #49A223;
}
.section_2{
background-color: #e29e2e;
}
.section_3{
background-color: #c53b64;
}
.section_4{
background-color: #6e7dc5;
}
</style>
<script src="../lib/rsvp.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/dhtmlxscheduler.js" type="text/javascript"></script>
<script src="mixin_gadget.js" type="text/javascript"></script>
<script src="Output_viewCalendar.js" type="text/javascript"></script>
</head>
<body>
<div id="scheduler_here" class="dhx_cal_container" style='width: 100%; height: 600px; padding:10px;'>
<div class="dhx_cal_navline">
<div class="dhx_cal_prev_button">&nbsp;</div>
<div class="dhx_cal_next_button">&nbsp;</div>
<div class="dhx_cal_today_button"></div>
<div class="dhx_cal_date"></div>
<div class="dhx_cal_tab" name="day_tab" style="right:204px;"></div>
<div class="dhx_cal_tab" name="week_tab" style="right:140px;"></div>
<div class="dhx_cal_tab" name="month_tab" style="right:76px;"></div>
</div>
<div class="dhx_cal_header"></div>
<div class="dhx_cal_data"></div>
</div>
</body>
</html>
/*global rJS, RSVP, jQuery, scheduler,
initGadgetMixin, console */
/*jslint nomen: true, unparam: true */
(function(window, rJS, RSVP, $, scheduler, initGadgetMixin) {
"use strict";
var gadget_klass = rJS(window);
initGadgetMixin(gadget_klass);
gadget_klass.declareAcquiredMethod("aq_getAttachment", "jio_getAttachment").declareMethod("render", function(options) {
var jio_key = options.id, gadget = this;
gadget.props.jio_key = jio_key;
gadget.props.result = options.result;
gadget.props.action_definition = options.action_definition;
return gadget.aq_getAttachment({
_id: gadget.props.jio_key,
_attachment: "body.json"
}).push(function(simulation_json) {
var json_data = JSON.parse(simulation_json);
gadget.props.result = json_data.result.result_list[options.result].sample_gantt;
});
}).declareMethod("xstartService", function() {
scheduler.config.multisection = true;
scheduler.templates.event_class = function(start, end, event) {
var original = scheduler.getEvent(event.id);
if (!scheduler.isMultisectionEvent(original)) {
return "";
}
return "multisection section_" + event.section_id;
};
scheduler.config.xml_date = "%Y-%m-%d %H:%i";
scheduler.locale.labels.timeline_tab = "Timeline";
scheduler.locale.labels.unit_tab = "Unit";
scheduler.locale.labels.section_custom = "Section";
var sections = [ {
key: 1,
label: "James Smith"
}, {
key: 2,
label: "John Williams"
}, {
key: 3,
label: "David Miller"
}, {
key: 4,
label: "Linda Brown"
} ];
scheduler.createTimelineView({
name: "timeline",
x_unit: "hour",
x_date: "%H:%i",
x_step: 8,
x_size: 33,
x_length: 33,
event_dy: 60,
resize_events: false,
y_unit: sections,
y_property: "section_id",
render: "bar",
second_scale: {
x_unit: "day",
// unit which should be used for second scale
x_date: "%F %d"
}
});
scheduler.date.timeline_start = scheduler.date.day_start;
scheduler.createUnitsView({
name: "unit",
property: "section_id",
list: sections
});
scheduler.config.lightbox.sections = [ {
name: "description",
height: 130,
map_to: "text",
type: "textarea",
focus: true
}, {
name: "custom",
height: 22,
map_to: "section_id",
type: "multiselect",
options: sections,
vertical: "false"
}, {
name: "time",
height: 72,
type: "time",
map_to: "auto"
} ];
scheduler.init("scheduler_here", new Date(2012, 5, 30), "timeline");
scheduler.parse([ {
start_date: "2012-06-30 09:00",
end_date: "2012-06-30 18:00",
text: "Task A-12458",
section_id: "1"
}, {
start_date: "2012-06-30 10:00",
end_date: "2012-06-30 16:00",
text: "Task A-89411",
section_id: "1"
}, {
start_date: "2012-06-30 4:00",
end_date: "2012-06-30 15:00",
text: "Task 1,3",
section_id: "1,3"
}, {
start_date: "2012-06-30 16:00",
end_date: "2012-07-01 17:00",
text: "Task A-46598",
section_id: "1"
}, {
start_date: "2012-07-04 00:00",
end_date: "2012-07-04 23:00",
text: "Task 2,3,4",
section_id: "2,3,4"
}, {
start_date: "2012-07-01 02:00",
end_date: "2012-07-01 16:00",
text: "Task B-44864",
section_id: "2"
}, {
start_date: "2012-07-06 02:00",
end_date: "2012-07-06 18:00",
text: "Task C-32421",
section_id: "3"
}, {
start_date: "2012-07-02 08:30",
end_date: "2012-07-02 19:45",
text: "Task 3,1",
section_id: "3,1"
}, {
start_date: "2012-06-30 11:40",
end_date: "2012-07-02 16:30",
text: "Task 4,2,3",
section_id: "4,2,3"
}, {
start_date: "2012-06-30 12:00",
end_date: "2012-06-30 18:00",
text: "Task D-12458",
section_id: "4"
} ], "json");
}).declareMethod("startService", function() {
console.log("start", this.props.result);
scheduler.config.xml_date = "%Y-%m-%d %H:%i";
scheduler.config.time_step = 30;
scheduler.config.multi_day = true;
scheduler.locale.labels.section_subject = "Subject";
scheduler.config.first_hour = 6;
scheduler.config.limit_time_select = true;
scheduler.config.details_on_dblclick = true;
scheduler.config.details_on_create = true;
scheduler.templates.event_class = function(start, end, event) {
var css = "";
if (event.subject) {
// if event has subject property then special class should be assigned
css += "event_" + event.subject;
}
if (event.id === scheduler.getState().select_id) {
css += " selected";
}
return css;
};
var subject = [ {
key: "",
label: "Appointment"
}, {
key: "english",
label: "English"
}, {
key: "math",
label: "Math"
}, {
key: "science",
label: "Science"
} ];
scheduler.config.lightbox.sections = [ {
name: "description",
height: 43,
map_to: "text",
type: "textarea",
focus: true
}, {
name: "subject",
height: 20,
type: "select",
options: subject,
map_to: "subject"
}, {
name: "time",
height: 72,
type: "time",
map_to: "auto"
} ];
scheduler.init($(this.props.element).find("#scheduler_here")[0], new Date(2015, 3, 18), "week");
scheduler.parse([ {
start_date: "2015-04-18 09:00",
end_date: "2015-04-18 12:00",
text: "English lesson",
subject: "english"
}, {
start_date: "2015-04-20 10:00",
end_date: "2015-04-21 16:00",
text: "Math exam",
subject: "math"
}, {
start_date: "2015-04-21 10:00",
end_date: "2015-04-21 14:00",
text: "Science lesson",
subject: "science"
}, {
start_date: "2015-04-23 16:00",
end_date: "2015-04-23 17:00",
text: "English lesson",
subject: "english"
}, {
start_date: "2015-04-24 09:00",
end_date: "2015-04-24 17:00",
text: "Usual event"
} ], "json");
return new RSVP.Queue().push(function() {
// Infinite wait, until cancelled
return new RSVP.defer().promise;
}).push(undefined, function(error) {
scheduler.clearAll();
throw error;
});
});
})(window, rJS, RSVP, jQuery, scheduler, initGadgetMixin);
\ No newline at end of file
......@@ -8,7 +8,10 @@
Gantt expect data in the following format:
time_unit: one of minute, hour, day, week, month or year
time_unit: one of minute, hour, day, week, month or year. This will set gantt.config.scale_unit ( http://docs.dhtmlx.com/gantt/desktop__configuring_time_scale.html#settingthestepofthescale )
subscales: sets gantt.config.subscales ( http://docs.dhtmlx.com/gantt/desktop__configuring_time_scale.html#addingthesecondscales )
task_list: [
{
id: "project_1", # an unique id, different than "0" which is a reserved id
......@@ -58,6 +61,9 @@
links: []
};
gantt.config.duration_unit = this.props.result.time_unit;
if (this.props.result.subscales) {
gantt.config.subscales = this.props.result.subscales;
}
gantt.init($(this.props.element).find(".gant_container")[0]);
gantt.parse(gantt_tasks);
return new RSVP.Queue().push(function() {
......
#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
#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}.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
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