source: branches/2.2.0.1/calendar/js/dhtmlx/samples/06_timeline/05_drag.html @ 4001

Revision 4001, 5.3 KB checked in by rafaelraymundo, 13 years ago (diff)

Ticket #1615 - Componente novo para agenda......................................

Line 
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3<head>
4        <meta http-equiv="Content-type" content="text/html; charset=utf-8">
5        <title>For demo purpose only :: &1</title>
6       
7        <script src='../../codebase/dhtmlxscheduler.js' type="text/javascript" charset="utf-8"></script>
8        <script src='../../codebase/ext/dhtmlxscheduler_timeline.js' type="text/javascript" charset="utf-8"></script>
9        <script src='../../codebase/ext/dhtmlxscheduler_outerdrag.js' type="text/javascript" charset="utf-8"></script>
10       
11       
12       
13        <link rel='stylesheet' type='text/css' href='../../codebase/dhtmlxscheduler.css'>
14        <link rel="stylesheet" href="../../codebase/ext/dhtmlxscheduler_ext.css" type="text/css" media="screen" title="no title" charset="utf-8">
15       
16        <script src='../../../dhtmlxTree/codebase/dhtmlxtree.js' type="text/javascript" charset="utf-8"></script>
17        <link rel='stylesheet' type='text/css' href='../../../dhtmlxTree/codebase/dhtmlxtree.css'>
18       
19</head>
20
21       
22<style type="text/css" media="screen">
23        html, body{
24                margin:0px;
25                padding:0px;
26                height:100%;
27                overflow:hidden;
28        }       
29</style>
30
31<script type="text/javascript" charset="utf-8">
32        function init() {
33                if (!window.dhtmlXTreeObject){
34                        alert("Sample requires dhtmlxTree");
35                        return;
36                }
37               
38                var tree = new dhtmlXTreeObject("treebox","100%","100%",0);
39                tree.enableDragAndDrop(true);
40                tree.attachEvent("onDrag", function(){ return false; });
41                tree.setImagePath("../../../dhtmlxTree/codebase/imgs/csh_yellowbooks/");
42                tree.loadXML("../../../dhtmlxTree/samples/common/tree.xml");
43               
44               
45                //key point!
46                //convert data from tree in property of event
47                //similar approach can be used for any other dhtmlx component
48                scheduler.attachEvent("onExternalDragIn", function(id, source, e){
49                        var label = tree.getItemText(tree._dragged[0].id);
50                        scheduler.getEvent(id).text = label;
51                        return true;
52                });
53
54                       
55
56                scheduler.locale.labels.timeline_tab = "Timeline";
57                scheduler.locale.labels.section_custom="Section";
58               
59                scheduler.config.details_on_create=true;
60                scheduler.config.details_on_dblclick=true;
61                scheduler.config.xml_date="%Y-%m-%d %H:%i";
62               
63               
64                //===============
65                //Configuration
66                //===============
67                var sections=[
68                        {key:1, label:"James Smith"},
69                        {key:2, label:"John Williams"},
70                        {key:3, label:"David Miller"},
71                        {key:4, label:"Linda Brown"}
72                ];
73               
74                scheduler.createTimelineView({
75                        name:   "timeline",
76                        x_unit: "minute",
77                        x_date: "%H:%i",
78                        x_step: 30,
79                        x_size: 24,
80                        x_start: 16,
81                        x_length:       48,
82                        y_unit: sections,
83                        y_property:     "section_id",
84                        render:"bar"
85                });
86               
87
88               
89               
90                //===============
91                //Data loading
92                //===============
93                scheduler.config.lightbox.sections=[   
94                        {name:"description", height:130, map_to:"text", type:"textarea" , focus:true},
95                        {name:"custom", height:23, type:"select", options:sections, map_to:"section_id" },
96                        {name:"time", height:72, type:"time", map_to:"auto"}
97                ]
98               
99                scheduler.init('scheduler_here',new Date(2009,5,30),"timeline");
100                scheduler.parse([
101                        { start_date: "2009-06-30 09:00", end_date: "2009-06-30 12:00", text:"Task A-12458", section_id:1},
102                        { start_date: "2009-06-30 10:00", end_date: "2009-06-30 16:00", text:"Task A-89411", section_id:1},
103                        { start_date: "2009-06-30 10:00", end_date: "2009-06-30 14:00", text:"Task A-64168", section_id:1},
104                        { start_date: "2009-06-30 16:00", end_date: "2009-06-30 17:00", text:"Task A-46598", section_id:1},
105                       
106                        { start_date: "2009-06-30 12:00", end_date: "2009-06-30 20:00", text:"Task B-48865", section_id:2},
107                        { start_date: "2009-06-30 14:00", end_date: "2009-06-30 16:00", text:"Task B-44864", section_id:2},
108                        { start_date: "2009-06-30 16:30", end_date: "2009-06-30 18:00", text:"Task B-46558", section_id:2},
109                        { start_date: "2009-06-30 18:30", end_date: "2009-06-30 20:00", text:"Task B-45564", section_id:2},
110                       
111                        { start_date: "2009-06-30 08:00", end_date: "2009-06-30 12:00", text:"Task C-32421", section_id:3},
112                        { start_date: "2009-06-30 14:30", end_date: "2009-06-30 16:45", text:"Task C-14244", section_id:3},
113                       
114                        { start_date: "2009-06-30 09:20", end_date: "2009-06-30 12:20", text:"Task D-52688", section_id:4},
115                        { start_date: "2009-06-30 11:40", end_date: "2009-06-30 16:30", text:"Task D-46588", section_id:4},
116                        { start_date: "2009-06-30 12:00", end_date: "2009-06-30 18:00", text:"Task D-12458", section_id:4}
117                ],"json");
118               
119        }
120       
121</script>
122
123<body onload="init();">
124        <div id="treebox" style="position:absolute; top:0px; left:0px; width:250px; height:100%;"></div>
125        <div id="scheduler_here" class="dhx_cal_container" style='width:1000px; height:100%; position:absolute; top:0px; left:250px'>
126                <div class="dhx_cal_navline">
127                        <div class="dhx_cal_prev_button">&nbsp;</div>
128                        <div class="dhx_cal_next_button">&nbsp;</div>
129                        <div class="dhx_cal_today_button"></div>
130                        <div class="dhx_cal_date"></div>
131                        <div class="dhx_cal_tab" name="day_tab" style="right:204px;"></div>
132                        <div class="dhx_cal_tab" name="week_tab" style="right:140px;"></div>
133                        <div class="dhx_cal_tab" name="timeline_tab" style="right:280px;"></div>
134                        <div class="dhx_cal_tab" name="month_tab" style="right:76px;"></div>
135                </div>
136                <div class="dhx_cal_header">
137                </div>
138                <div class="dhx_cal_data">
139                </div>         
140        </div>
141</body>
Note: See TracBrowser for help on using the repository browser.