forked from extern/egroupware
78 lines
4.6 KiB
HTML
78 lines
4.6 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<head>
|
||
|
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
||
|
<title>Validate lightbox values</title>
|
||
|
</head>
|
||
|
<script src="../../codebase/dhtmlxgantt.js" type="text/javascript" charset="utf-8"></script>
|
||
|
<link rel="stylesheet" href="../../codebase/dhtmlxgantt.css" type="text/css" media="screen" title="no title" charset="utf-8">
|
||
|
|
||
|
<script type="text/javascript" src="../common/testdata.js"></script>
|
||
|
<style type="text/css">
|
||
|
html, body{ height:100%; padding:0px; margin:0px; overflow: hidden;}
|
||
|
</style>
|
||
|
<body>
|
||
|
<div id="gantt_here" style='width:100%; height:100%;'></div>
|
||
|
<script type="text/javascript">
|
||
|
|
||
|
var users_data = {
|
||
|
"data":[
|
||
|
{"id":1, "text":"Project #1", "start_date":"01-04-2013", "duration":"11", "progress": 0.6, "open": true, "user":"", "priority": "2"},
|
||
|
{"id":2, "text":"Task #1", "start_date":"03-04-2013", "duration":"5", "parent":"1", "progress": 1, "open": true, "user": "John", "priority": "1"},
|
||
|
{"id":3, "text":"Task #2", "start_date":"02-04-2013", "duration":"7", "parent":"1", "progress": 0.5, "open": true, "user": "Anna", "priority": "1"},
|
||
|
{"id":4, "text":"Task #3", "start_date":"02-04-2013", "duration":"6", "parent":"1", "progress": 0.8, "open": true, "user": "Mike", "priority": "2"},
|
||
|
{"id":5, "text":"Task #4", "start_date":"02-04-2013", "duration":"5", "parent":"1", "progress": 0.2, "open": true, "user": "John", "priority": "3"},
|
||
|
{"id":6, "text":"Task #5", "start_date":"02-04-2013", "duration":"7", "parent":"1", "progress": 0, "open": true, "user": "John", "priority": "2"},
|
||
|
{"id":7, "text":"Task #2.1", "start_date":"03-04-2013", "duration":"2", "parent":"3", "progress": 1, "open": true, "user": "Mike", "priority": "2"},
|
||
|
{"id":8, "text":"Task #2.2", "start_date":"06-04-2013", "duration":"3", "parent":"3", "progress": 0.8, "open": true, "user": "Anna", "priority": "3"},
|
||
|
{"id":9, "text":"Task #2.3", "start_date":"10-04-2013", "duration":"4", "parent":"3", "progress": 0.2, "open": true, "user": "Mike", "priority": "1"},
|
||
|
{"id":10, "text":"Task #2.4", "start_date":"10-04-2013", "duration":"4", "parent":"3", "progress": 0, "open": true, "user": "John", "priority": "1"},
|
||
|
{"id":11, "text":"Task #4.1", "start_date":"03-04-2013", "duration":"4", "parent":"5", "progress": 0.5, "open": true, "user": "John", "priority": "3"},
|
||
|
{"id":12, "text":"Task #4.2", "start_date":"03-04-2013", "duration":"4", "parent":"5", "progress": 0.1, "open": true, "user":"John", "priority": "3"},
|
||
|
{"id":13, "text":"Task #4.3", "start_date":"03-04-2013", "duration":"5", "parent":"5", "progress": 0, "open": true, "user": "Anna", "priority": "3"}
|
||
|
],
|
||
|
"links":[
|
||
|
{"id":"10","source":"11","target":"12","type":"1"},
|
||
|
{"id":"11","source":"11","target":"13","type":"1"},
|
||
|
{"id":"12","source":"11","target":"14","type":"1"},
|
||
|
{"id":"13","source":"11","target":"15","type":"1"},
|
||
|
{"id":"14","source":"11","target":"16","type":"1"},
|
||
|
|
||
|
{"id":"15","source":"13","target":"17","type":"1"},
|
||
|
{"id":"16","source":"17","target":"18","type":"0"},
|
||
|
{"id":"17","source":"18","target":"19","type":"0"},
|
||
|
{"id":"18","source":"19","target":"20","type":"0"},
|
||
|
{"id":"19","source":"15","target":"21","type":"2"},
|
||
|
{"id":"20","source":"15","target":"22","type":"2"},
|
||
|
{"id":"21","source":"15","target":"23","type":"2"}
|
||
|
]
|
||
|
};
|
||
|
|
||
|
gantt.config.details_on_create = true;
|
||
|
gantt.init("gantt_here");
|
||
|
gantt.parse(users_data);
|
||
|
|
||
|
gantt.config.lightbox.sections = [
|
||
|
{name: "description", height: 38, map_to: "text", type: "textarea", focus: true},
|
||
|
{name: "user", height: 22, map_to: "user", type: "select", options: [
|
||
|
{key:"", label: "Select a worker..."},
|
||
|
{key:"John", label: "John"},
|
||
|
{key:"Mike", label: "Mike"},
|
||
|
{key:"Anna", label: "Anna"}]},
|
||
|
{name: "time", height: 72, type: "duration", map_to: "auto"}
|
||
|
];
|
||
|
|
||
|
gantt.locale.labels["section_user"] = "Worker";
|
||
|
|
||
|
gantt.attachEvent("onLightboxSave", function(id, item){
|
||
|
if(!item.text){
|
||
|
dhtmlx.message({type:"error", text:"Enter task description!"});
|
||
|
return false;
|
||
|
}
|
||
|
if(!item.user){
|
||
|
dhtmlx.message({type:"error", text:"Pick a worker for this task!"});
|
||
|
return false;
|
||
|
}
|
||
|
return true;
|
||
|
});
|
||
|
</script>
|
||
|
</body>
|