diff --git a/addons/website_event_track/__openerp__.py b/addons/website_event_track/__openerp__.py index 338477eeb8e..418e049cec9 100644 --- a/addons/website_event_track/__openerp__.py +++ b/addons/website_event_track/__openerp__.py @@ -28,7 +28,8 @@ Adds support for: ], 'qweb': ['static/src/xml/*.xml'], 'demo': [ - 'data/event_demo.xml' + 'data/event_demo.xml', + 'data/website_event_track_demo.xml' ], 'installable': True, } diff --git a/addons/website_event_track/controllers/event.py b/addons/website_event_track/controllers/event.py index 466e3d37a40..86c9fd4862a 100644 --- a/addons/website_event_track/controllers/event.py +++ b/addons/website_event_track/controllers/event.py @@ -23,11 +23,14 @@ import openerp from openerp.addons.web import http from openerp.addons.web.http import request from openerp.addons.website.controllers.main import Website as controllers +import datetime import re import werkzeug.utils controllers = controllers() +import pytz +from pytz import timezone class website_event(http.Controller): @http.route(['/event//track/'], type='http', auth="public", website=True, multilang=True) @@ -37,14 +40,65 @@ class website_event(http.Controller): values = { 'track': track, 'event': track.event_id, 'main_object': track } return request.website.render("website_event_track.track_view", values) + def _prepare_calendar(self, event, event_track_ids): + local_tz = pytz.timezone(event.timezone_of_event or 'UTC') + locations = {} # { location: [track, start_date, end_date, rowspan]} + dates = [] # [ (date, {}) ] + for track in event_track_ids: + locations.setdefault(track.location_id or False, []) + + forcetr = True + for track in event_track_ids: + start_date = (datetime.datetime.strptime(track.date, '%Y-%m-%d %H:%M:%S')).replace(tzinfo=pytz.utc).astimezone(local_tz) + end_date = start_date + datetime.timedelta(minutes = (track.duration or 30)) + location = track.location_id or False + locations.setdefault(location, []) + + # New TR, align all events + if forcetr or (start_date>dates[-1][0]) or not location: + dates.append((start_date, {}, bool(location))) + for loc in locations.keys(): + if locations[loc] and (locations[loc][-1][2] > start_date): + locations[loc][-1][3] += 1 + elif not locations[loc] or locations[loc][-1][2] < start_date: + locations[loc].append([False, locations[loc] and locations[loc][-1][2] or dates[0][0], start_date, 1]) + dates[-1][1][loc] = locations[loc][-1] + forcetr = not bool(location) + + # Add event + if locations[location] and locations[location][-1][1] > start_date: + locations[location][-1][3] -= 1 + locations[location].append([track, start_date, end_date, 1]) + dates[-1][1][location] = locations[location][-1] + return { + 'locations': locations, + 'dates': dates + } + + # TODO: not implemented @http.route(['/event//agenda'], type='http', auth="public", website=True, multilang=True) def event_agenda(self, event, tag=None, **post): - values = { + comp = lambda x: (x.date, bool(x.location_id)) + event.track_ids.sort(lambda x,y: cmp(comp(x), comp(y))) + + days = {} + days_nbr = {} + for track in event.track_ids: + if not track.date: continue + days.setdefault(track.date[:10], []) + days[track.date[:10]].append(track) + + for d in days: + days_nbr[d] = len(days[d]) + days[d] = self._prepare_calendar(event, days[d]) + + return request.website.render("website_event_track.agenda", { 'event': event, - 'main_object': event, - } - return request.website.render("website_event_track.agenda", values) + 'days': days, + 'days_nbr': days_nbr, + 'tag': tag + }) @http.route([ '/event//track', diff --git a/addons/website_event_track/data/event_demo.xml b/addons/website_event_track/data/event_demo.xml index 5bdd302649b..784d962e471 100644 --- a/addons/website_event_track/data/event_demo.xml +++ b/addons/website_event_track/data/event_demo.xml @@ -24,20 +24,6 @@ Round Table - - - Room 1 - - - Room 2 - - - Room 3 - - - Room 4 - - @@ -83,68 +69,6 @@ - - - A Better Future With OpenERP eCommerce - - - - - - - - - -
-
-
-
-

- Apart from being an enterprise management software, OpenERP is - used nowadays for a great variety of enterprise frontends. -

- The talk illustrates the impact of OpenERP in areas such as the - company website, online events management, eCommerce, online - recruitments, social media marketing, etc. -

-
-
-
-
-
-
- - - How To Drive Sales With OpenERP CRM - - - - 1 - - - - - - -
-
-
-
-

- Apart from being an enterprise management software, OpenERP is - used nowadays for a great variety of enterprise frontends. -

- The talk illustrates the impact of OpenERP in areas such as the - company website, online events management, eCommerce, online - recruitments, social media marketing, etc. -

-
-
-
-
-
-
- http://facebook.com/openerp @@ -160,35 +84,5 @@

- - - Social Marketing As a Source of Leads - - - - 0 - - - - - - -
-
-
-

- Apart from being an enterprise management software, OpenERP is - used nowadays for a great variety of enterprise frontends. -

- The talk illustrates the impact of OpenERP in areas such as the - company website, online events management, eCommerce, online - recruitments, social media marketing, etc. -

-
-
-
-
-
- diff --git a/addons/website_event_track/data/website_event_track_demo.xml b/addons/website_event_track/data/website_event_track_demo.xml new file mode 100644 index 00000000000..6d62cc5aaf6 --- /dev/null +++ b/addons/website_event_track/data/website_event_track_demo.xml @@ -0,0 +1,325 @@ + + + + + Le Foyer du lac + + + Theatre + + + Lauzelle + + + Foyer Royal + + + Biereau + + + Bruyère + + + How to develop a website module. + + + + + + + 3 + + + + + How to integrate hardware materials with the OpenERP point of sale. + + + + + + + + + + How to develop real time apps, the live chat module explained. + + + + + + + + + + How to develop automated tests in the OpenERP web client. + + + + + + + + + + The new way to promote your modules in the Apps platform and OpenERP website. + + + + + + + + + + Detailed roadmap of accounting new modules and improvements for version 8. + + + + + + + + + + A technical explanation of OpenERP as a CMS and a eCommerce platform for version 8. + + + + + + + + + + Discover OpenERP CRM: How to optimize your sales, from leads to sales orders. + + + + + + 2 + + + + + How to use OpenERP for your HR process: recruitment, leaves management, appraisals, expenses, etc. + + + + + + + 2 + + + + + Raising qualitive insights with the survey app + + + + + + 5 + + + + Discover OpenERP Point-of-Sale: Your shop ready to use in 30 minutes. + + + + + + + + + + Manage your events with OpenERP, the new training modules. + + + + + + + + + + Advanced reporting with Google Spreadsheets integration. + + + + + + + + + + New Paypal modules (portal, handling, installments). + + + + + + + + + + OpenERP Mobile for Notes, Meetings and Messages. + + + + + + + + + + OpenERP as your Enterprise Social Network. + + + + + + + + + + The Art of Making an OpenERP Demo. + + + + + + + + + + How to build your marketing strategy for the purpose of generating leads with OpenERP. + + + + + + 5 + + + + + Advanced lead management with OpenERP: tips and tricks from the fields + + + + + + 5 + + + + + New Certification Program (valid from Oct. 2013). + + + + + + + + + + Recruiting high skilled talents with OpenERP HR apps + + + + + + 7 + + + + Manage your KPIs (recomended to openERP partners). + + + + + + + + + + Key Success factors selling OpenERP. + + + + + + + + + + Merge proposals review, code sprint (entire day). + + + + + + + + + + Merge proposals review, code sprint (entire afternoon) + + + + + + + + + + OpenERP in 2014 + + + + + + + 3 + + + OpenERP Status & Strategy 2014 + + + + + + + + + The new marketing strategy. + + + + + + + 6 + + + Morning break + + + + + + + + Lunch + + + + + + + + diff --git a/addons/website_event_track/models/event.py b/addons/website_event_track/models/event.py index 359b7df0067..ee9877a523c 100644 --- a/addons/website_event_track/models/event.py +++ b/addons/website_event_track/models/event.py @@ -23,6 +23,8 @@ from openerp.osv import fields, osv from openerp.tools.translate import _ from openerp.addons.website.models.website import slug +import pytz + class event_track_tag(osv.osv): _name = "event.track.tag" _order = 'name' @@ -103,6 +105,7 @@ class event_track(osv.osv): 'stage_id': _default_stage_id, 'priority': '2' } + def _read_group_stage_ids(self, cr, uid, ids, domain, read_group_order=None, access_rights_uid=None, context=None): stage_obj = self.pool.get('event.track.stage') result = stage_obj.name_search(cr, uid, '', context=context) @@ -117,6 +120,10 @@ class event_track(osv.osv): # class event_event(osv.osv): _inherit = "event.event" + def _tz_get(self,cr,uid, context=None): + # put POSIX 'Etc/*' entries at the end to avoid confusing users - see bug 1086728 + return [(tz,tz) for tz in sorted(pytz.all_timezones, key=lambda tz: tz if not tz.startswith('Etc/') else '_')] + def _get_tracks_tag_ids(self, cr, uid, ids, field_names, arg=None, context=None): res = dict.fromkeys(ids, []) for event in self.browse(cr, uid, ids, context=context): @@ -134,11 +141,13 @@ class event_event(osv.osv): 'show_blog': fields.boolean('News'), 'tracks_tag_ids': fields.function(_get_tracks_tag_ids, type='one2many', relation='event.track.tag', string='Tags of Tracks'), 'allowed_track_tag_ids': fields.many2many('event.track.tag', string='Accepted Tags', help="List of available tags for track proposals."), + 'timezone_of_event': fields.selection(_tz_get, 'Event Timezone', size=64), } _defaults = { 'show_track_proposal': False, 'show_tracks': False, 'show_blog': False, + 'timezone_of_event':lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).tz, } def _get_new_menu_pages(self, cr, uid, event, context=None): context = context or {} diff --git a/addons/website_event_track/static/src/css/website_event_track.css b/addons/website_event_track/static/src/css/website_event_track.css index 7862175ec27..f6c01f8f19e 100644 --- a/addons/website_event_track/static/src/css/website_event_track.css +++ b/addons/website_event_track/static/src/css/website_event_track.css @@ -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; +} diff --git a/addons/website_event_track/static/src/js/website_event_track.js b/addons/website_event_track/static/src/js/website_event_track.js new file mode 100644 index 00000000000..8093b9e7bca --- /dev/null +++ b/addons/website_event_track/static/src/js/website_event_track.js @@ -0,0 +1,24 @@ +$(document).ready(function() { + + jQuery.expr[":"].Contains = jQuery.expr.createPseudo(function(arg) { + return function( elem ) { + return jQuery(elem).text().toUpperCase().indexOf(arg.toUpperCase()) >= 0; + }; + }); + + $("#event_track_search").bind('keyup', function(e){ + var change_text = $(this).val(); + $('.event_track').removeClass('invisible'); + + $("#search_summary").removeClass('invisible'); + if (change_text) { + $("#search_number").text($(".event_track:Contains("+change_text+")").length); + $(".event_track:not(:Contains("+change_text+"))").addClass('invisible'); + } else { + $("#search_number").text(30); + } + + event.preventDefault(); + }); + +}); diff --git a/addons/website_event_track/views/event_backend.xml b/addons/website_event_track/views/event_backend.xml index ad262b6122e..eb30f1fa423 100644 --- a/addons/website_event_track/views/event_backend.xml +++ b/addons/website_event_track/views/event_backend.xml @@ -162,6 +162,9 @@