[IMP]event-track: implement color code for event and added color in demo data of event_track.

bzr revid: dka@tinyerp.com-20140311104223-whztnya4fwf8i0c9
This commit is contained in:
Darshan Kalola (OpenERP) 2014-03-11 16:12:23 +05:30
parent 346fd24b1d
commit 13c55facde
4 changed files with 55 additions and 8 deletions

View File

@ -124,12 +124,13 @@ class website_event(http.Controller):
unsort_tracks[track[2][:8]] = {}
if not unsort_tracks[track[2][:8]].has_key(track[5]):
unsort_tracks[track[2][:8]][track[5]] = []
start_time = datetime.datetime.strptime(track[5], '%Y-%m-%d %H:%M:%S')
end_time = start_time + datetime.timedelta(minutes = int(track[3]))
new_schedule = algo_for_timetable(start_time, end_time, new_schedule)
speaker = event_track_obj.browse(request.cr, request.uid, track[0], context=request.context)['speaker_ids']
event_track = event_track_obj.browse(request.cr, request.uid, track[0], context=request.context)
if event_track.color > 9 : color = 0;
else: color = event_track.color
unsort_tracks[track[2][:8]][track[5]].append({
'id': track[0],
'title': track[4],
@ -138,7 +139,8 @@ class website_event(http.Controller):
'duration':track[3],
'location_id': track[1],
'end_time': end_time,
'speaker_ids': [s.name for s in speaker],
'speaker_ids': [s.name for s in event_track.speaker_ids],
'color': color,
})
#Get All Locations
room_list = list(set(room_list))

View File

@ -27,6 +27,7 @@
<field name="location_id" ref="website_event_track.event_track_location5"/>
<field name="duration" eval="80"/>
<field eval="[(4, ref('base.res_partner_2')),(4, ref('base.res_partner_3'))]" name="speaker_ids"/>
<field name="color">3</field>
</record>
<record id="event_track2" model="event.track">

View File

@ -52,3 +52,43 @@
background-image: -ms-linear-gradient(top, #C2792A, #DB9141);
background-image: -o-linear-gradient(top, #C2792A, #DB9141);
}
.event_color_0 {
background-color: white;
color: #5a5a5a;
}
.event_color_1 {
background-color: #cccccc;
color: #424242;
}
.event_color_2 {
background-color: #ffc7c7;
color: #7a3737;
}
.event_color_3 {
background-color: #fff1c7;
color: #756832;
}
.event_color_4 {
background-color: #e3ffc7;
color: #5d6937;
}
.event_color_5 {
background-color: #c7ffd5;
color: #1a7759;
}
.event_color_6 {
background-color: #c7ffff;
color: #1a5d83;
}
.event_color_7 {
background-color: #c7d5ff;
color: #3b3e75;
}
.event_color_8 {
background-color: #e3c7ff;
color: #4c3668;
}
.event_color_9 {
background-color: #ffc7f1;
color: #6d2c70;
}

View File

@ -90,8 +90,12 @@
</td>
</t>
<t t-if="days[day][slot][index]['location_id']" >
<td t-attf-style="width: #{td_width}px;" id="seach_enable">
<t t-if="days[day][slot][index]['location_id'] == room[0]" >
<t t-if="days[day][slot][index]['location_id'] != room[0]">
<td t-attf-style="width: #{td_width}px;">
</td>
</t>
<t t-if="days[day][slot][index]['location_id'] == room[0]" >
<td t-attf-style="width: #{td_width}px;" t-attf-class="event_color_#{days[day][slot][index]['color']}" id="seach_enable">
<t t-esc="days[day][slot][index]['title']" />
<t t-foreach="days[day][slot][index]['speaker_ids']" t-as="speaker">
<t t-if="speaker == days[day][slot][index]['speaker_ids'][:1][0]">By </t>
@ -101,8 +105,8 @@
<t t-if="days[day][slot][index]['id'] != days[day][slot][-1]['id']" >
<t t-set="index" t-value="index + 1"/>
</t>
</t>
</td>
</td>
</t>
</t>
</t>
</tr>