git_sitools_idoc / Module_ProjectTimeline_sitools2 / timeline.js @ 20ff13ec
1 |
Ext.namespace('sitools.user.modules.timeline');
|
---|---|
2 |
sitools.user.modules.timeline.prepareTimeline= function (s,list){ |
3 |
var appendTo = Ext.get(s);
|
4 |
var container = Ext.get(Ext.DomHelper.append(appendTo,'<div id="timeline" align="center" class="timeline"></div>')); |
5 |
container=Ext.get(Ext.DomHelper.append(container,"<ul id='lineul' class='timeline'/>"));
|
6 |
sitools.user.modules.timeline.showActivity(list,container); |
7 |
} |
8 |
sitools.user.modules.timeline.addTimeline=function (list){ |
9 |
var container = Ext.get('lineul'); |
10 |
sitools.user.modules.timeline.showActivity(list,container); |
11 |
} |
12 |
sitools.user.modules.timeline.createActivity= function (activity){ |
13 |
this.daynum=activity.daynum;
|
14 |
this.text=activity.text;
|
15 |
this.date=activity.date;
|
16 |
this.day=activity.day;
|
17 |
this.dayCount=activity.daycount;
|
18 |
this.startTime=activity.starttime;
|
19 |
this.endTime=activity.endtime;
|
20 |
this.havedata=activity.data;
|
21 |
this.dataseturl=activity.dataseturl;
|
22 |
this.getDaynum=getDaynum;
|
23 |
function getDaynum(){ |
24 |
return this.daynum; |
25 |
} |
26 |
this.getURL=getURL;
|
27 |
function getURL(){ |
28 |
return this.dataseturl; |
29 |
} |
30 |
this.haveData=haveData;
|
31 |
function haveData(){ |
32 |
//alert(this.havedata);
|
33 |
return this.havedata; |
34 |
} |
35 |
this.getText=getText;
|
36 |
function getText(){ |
37 |
return this.text; |
38 |
} |
39 |
this.getDate=getDate;
|
40 |
function getDate(){ |
41 |
return this.date; |
42 |
} |
43 |
this.getDay=getDay;
|
44 |
function getDay(){ |
45 |
return this.day; |
46 |
} |
47 |
this.getDayCount=getDayCount;
|
48 |
function getDayCount(){ |
49 |
return this.dayCount; |
50 |
} |
51 |
this.getStartTime=getStartTime;
|
52 |
function getStartTime(){ |
53 |
return this.startTime; |
54 |
} |
55 |
this.getEndTime=getEndTime;
|
56 |
function getEndTime(){ |
57 |
return this.endTime; |
58 |
} |
59 |
} |
60 |
|
61 |
sitools.user.modules.timeline.showActivity= function (activityList, ulObj){ |
62 |
var count=0; |
63 |
//var value='/sodism/imagessingulieres/dco';
|
64 |
for(var i=0; i<activityList.length;i++){ |
65 |
var newactivitynodata="<pre class='nodata' style='height:"+((activityList[i].getEndTime().split(':')[0]-activityList[i].getStartTime().split(':')[0])*15-2)+"px;'><div class='activity_name'>"+activityList[i].getText()+/*" "+activityList[i].getStartTime()+"-"+activityList[i].getEndTime()+*/"</div></pre>"; |
66 |
var newactivitydata="<pre class='havedata' style='height:"+((activityList[i].getEndTime().split(':')[0]-activityList[i].getStartTime().split(':')[0])*15-2)+"px;'" |
67 |
+"onClick='sitools.user.clickDatasetIcone(\"/picard\", \"search\",\""+activityList[i].getDate()+"\"+\"*\"+\""+activityList[i].getStartTime()+"\"+\"*\"+\""+activityList[i].getEndTime()+"\"); return false;'><div class='activity_name'>" |
68 |
+activityList[i].getText()+/*" "+activityList[i].getStartTime()+"-"+activityList[i].getEndTime()
|
69 |
+*/"<div class='getdata'><img src='" + loadUrl.get('APP_URL') |
70 |
+ "/common/res/images/icons/32x32/tree_datasets_32'></div>"
|
71 |
/*+"<div class='getdata'><a href='#' onClick='sitools.user.clickDatasetIcone(\""+activityList[i].getURL()+"\", \"data\"); return false;'>"
|
72 |
+"<img class='icongetdata' src='" +loadUrl.get('APP_URL')
|
73 |
+ "/common/res/images/icons/32x32/tree_datasets_32.png'>"
|
74 |
+"</a></div>" */
|
75 |
+"</div></pre>";
|
76 |
var ruler1="<div class='ruler ruler1'>00:00:00</div>"; |
77 |
var ruler2="<div class='ruler ruler2'>06:00:00</div>"; |
78 |
var ruler3="<div class='ruler ruler3'>12:00:00</div>"; |
79 |
var ruler4="<div class='ruler ruler4'>18:00:00</div>"; |
80 |
var ruler5="<div class='ruler ruler5'>24:00:00</div>"; |
81 |
if(i==0 || activityList[i].getDayCount()!=activityList[i-1].getDayCount()){ |
82 |
count++; |
83 |
//if(count%2!=0){
|
84 |
if(activityList[i].getDayCount()==activityList[activityList.length-1].getDayCount()) {var liObj = Ext.DomHelper.append(ulObj, "<li style='margin-left:"+(-1136+(count-1)*224)+"px;' class='lastday'/>");} |
85 |
else {var liObj=Ext.DomHelper.append(ulObj, "<li class='day'/>");} |
86 |
//}else{
|
87 |
// var liObj = Ext.DomHelper.append(ulObj, "<li class='alt day'/>");
|
88 |
//}
|
89 |
Ext.DomHelper.append(liObj, |
90 |
"<div class='time'>"+activityList[i].getDay()+"</div>" |
91 |
+"<div class='date'>"+activityList[i].getDate()+"</div>" |
92 |
+"<div class='number'>"+activityList[i].getDayCount()+"</div>" |
93 |
//+ruler1
|
94 |
/*+ruler2+ruler3+ruler4+ruler5*/
|
95 |
); |
96 |
var contentObj=Ext.DomHelper.append(liObj,"<div class='content'/>"); |
97 |
if(activityList[i].getStartTime().split(':')[0]!=0) |
98 |
Ext.DomHelper.append(contentObj,"<pre style='height:"+((activityList[i].getStartTime().split(':')[0])*15-2)+"px;background-color: #D8D8D8;'></pre>"); |
99 |
|
100 |
|
101 |
} |
102 |
else{
|
103 |
if(activityList[i].getStartTime().split(':')[0]!=activityList[i-1].getEndTime().split(':')[0]) |
104 |
Ext.DomHelper.append(contentObj,"<pre style='height:"+((activityList[i].getStartTime().split(':')[0]-activityList[i-1].getEndTime().split(':')[0])*15-2)+"px;background-color: #D8D8D8;'></pre>"); |
105 |
} |
106 |
//Ext.DomHelper.append(contentObj,newactivity);
|
107 |
if(activityList[i].haveData()){
|
108 |
//alert("hasdata");
|
109 |
Ext.DomHelper.append(contentObj,newactivitydata); |
110 |
}else{
|
111 |
//alert("nodata");
|
112 |
Ext.DomHelper.append(contentObj,newactivitynodata); |
113 |
} |
114 |
if(i==activityList.length-1||activityList[i].getDayCount()!=activityList[i+1].getDayCount()){ |
115 |
/* if(activityList[i].getEndTime().split(':')[0]<=6){
|
116 |
Ext.DomHelper.append(liObj,ruler2);
|
117 |
if(activityList[i].getEndTime().split(':')[0]!=6){
|
118 |
Ext.DomHelper.append(contentObj,"<pre style='height:"+((6-activityList[i].getEndTime().split(':')[0])*15-2)+"px;background-color: #D8D8D8;'></pre>");
|
119 |
}
|
120 |
}
|
121 |
if(activityList[i].getEndTime().split(':')[0]<=12&&activityList[i].getEndTime().split(':')[0]>6){
|
122 |
Ext.DomHelper.append(liObj,ruler2+ruler3);
|
123 |
if(activityList[i].getEndTime().split(':')[0]!=12){
|
124 |
Ext.DomHelper.append(contentObj,"<pre style='height:"+((12-activityList[i].getEndTime().split(':')[0])*15-2)+"px;background-color: #D8D8D8;'></pre>");
|
125 |
}
|
126 |
}
|
127 |
if(activityList[i].getEndTime().split(':')[0]<=18&&activityList[i].getEndTime().split(':')[0]>12){
|
128 |
Ext.DomHelper.append(liObj,ruler2+ruler3+ruler4);
|
129 |
if(activityList[i].getEndTime().split(':')[0]!=18){
|
130 |
Ext.DomHelper.append(contentObj,"<pre style='height:"+((18-activityList[i].getEndTime().split(':')[0])*15-2)+"px;background-color: #D8D8D8;'></pre>");
|
131 |
}
|
132 |
}
|
133 |
if(activityList[i].getEndTime().split(':')[0]<=24&&activityList[i].getEndTime().split(':')[0]>18){
|
134 |
Ext.DomHelper.append(liObj,ruler2+ruler3+ruler4+ruler5);
|
135 |
if(activityList[i].getEndTime().split(':')[0]!=24){
|
136 |
Ext.DomHelper.append(contentObj,"<pre style='height:"+((24-activityList[i].getEndTime().split(':')[0])*15-2)+"px;background-color: #D8D8D8;'></pre>");
|
137 |
}
|
138 |
}*/
|
139 |
|
140 |
if(activityList[i].getEndTime().split(':')[0]!=24){ |
141 |
Ext.DomHelper.append(contentObj,"<pre style='height:"+((24-activityList[i].getEndTime().split(':')[0])*15-2)+"px;background-color: #D8D8D8;'></pre>"); |
142 |
} |
143 |
|
144 |
} |
145 |
} |
146 |
} |