|
@@ -36,6 +36,14 @@ def remove_accents(input_str): |
|
|
only_ascii = nkfd_form.encode('ASCII', 'ignore') |
|
|
only_ascii = nkfd_form.encode('ASCII', 'ignore') |
|
|
return only_ascii |
|
|
return only_ascii |
|
|
|
|
|
|
|
|
|
|
|
def embeed_video(mime_type, link): |
|
|
|
|
|
Container = "<video controls='controls' preload='metadata' style='width:60%'>" |
|
|
|
|
|
Container += "<source type='%s' " % mime_type |
|
|
|
|
|
Container += "src='%s' />" % link |
|
|
|
|
|
Container += "</video>" |
|
|
|
|
|
return Container |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## =-=- Here, We handle ICal requests -=-= |
|
|
## =-=- Here, We handle ICal requests -=-= |
|
|
@view_config(route_name='progr_iCal', renderer="string") |
|
|
@view_config(route_name='progr_iCal', renderer="string") |
|
|
def ICal_Progamme_Request(request): |
|
|
def ICal_Progamme_Request(request): |
|
@@ -65,6 +73,7 @@ def ICal_Progamme_Request(request): |
|
|
event.add('url', "http://www.linux-azur.org/event/%s/%s" % (ev.for_year, ev.slug) ) |
|
|
event.add('url', "http://www.linux-azur.org/event/%s/%s" % (ev.for_year, ev.slug) ) |
|
|
event.add('priority', 5) |
|
|
event.add('priority', 5) |
|
|
cal.add_component(event) |
|
|
cal.add_component(event) |
|
|
|
|
|
request.response.content_type = "text/calendar" |
|
|
return cal.to_ical() |
|
|
return cal.to_ical() |
|
|
|
|
|
|
|
|
## =-=- Here, We handle Json requests -=-= |
|
|
## =-=- Here, We handle Json requests -=-= |
|
@@ -149,6 +158,9 @@ def JSON_Progamme_Request(request): |
|
|
"status":ev.event_type |
|
|
"status":ev.event_type |
|
|
} ) |
|
|
} ) |
|
|
DicResult[Day.day] = ListEv |
|
|
DicResult[Day.day] = ListEv |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return { 'all':DicResult } |
|
|
return { 'all':DicResult } |
|
|
|
|
|
|
|
|
@view_config(route_name='timeline_json', renderer="json") |
|
|
@view_config(route_name='timeline_json', renderer="json") |
|
@@ -195,7 +207,7 @@ def JSON_TimeLine_Request(request): |
|
|
"credit": ",".join(["%s %s" % (i.prenom, i.nom) for i in ev.intervenants]), |
|
|
"credit": ",".join(["%s %s" % (i.prenom, i.nom) for i in ev.intervenants]), |
|
|
"caption":"" } |
|
|
"caption":"" } |
|
|
} ) |
|
|
} ) |
|
|
if year=="2015": |
|
|
|
|
|
|
|
|
if year==2015: |
|
|
DicResult = { |
|
|
DicResult = { |
|
|
"lang":"fr", |
|
|
"lang":"fr", |
|
|
"headline":"JM2L 2015", |
|
|
"headline":"JM2L 2015", |
|
@@ -209,6 +221,33 @@ def JSON_TimeLine_Request(request): |
|
|
"caption":"" |
|
|
"caption":"" |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
elif year==2011: |
|
|
|
|
|
DicResult = { |
|
|
|
|
|
"lang":"fr", |
|
|
|
|
|
"headline":"JM2L 2011", |
|
|
|
|
|
"type":"default", |
|
|
|
|
|
"startDate":"2011,11,25,10", |
|
|
|
|
|
"text":"<i><span class='c1'>6ème Édition</span></i>", |
|
|
|
|
|
"asset": |
|
|
|
|
|
{ |
|
|
|
|
|
"media":"https://www.youtube.com/embed/rcaNeXuAEhs", |
|
|
|
|
|
"credit":"JM2L", |
|
|
|
|
|
"caption":"Reportage FR3" |
|
|
|
|
|
}, |
|
|
|
|
|
} |
|
|
|
|
|
elif year==2010: |
|
|
|
|
|
DicResult = { |
|
|
|
|
|
"lang":"fr", |
|
|
|
|
|
"headline":"JM2L 2010", |
|
|
|
|
|
"type":"default", |
|
|
|
|
|
"text":"<i><span class='c1'>5ème Édition</span></i>", |
|
|
|
|
|
"asset": |
|
|
|
|
|
{ |
|
|
|
|
|
"media":embeed_video("video/ogg","http://jm2l.linux-azur.org/resources/2010/Video/reportages/JM2L2010-PleinSudTV.ogv"), |
|
|
|
|
|
"credit":"JM2L", |
|
|
|
|
|
"caption":"reportage Plein-sud TV" |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
else: |
|
|
else: |
|
|
DicResult = { |
|
|
DicResult = { |
|
|
"lang":"fr", |
|
|
"lang":"fr", |
|
@@ -252,6 +291,9 @@ def index_page(request): |
|
|
@view_config(route_name='edit_index', renderer="jm2l:templates/Staff/EditIndex.mako") |
|
|
@view_config(route_name='edit_index', renderer="jm2l:templates/Staff/EditIndex.mako") |
|
|
def edit_index(request): |
|
|
def edit_index(request): |
|
|
year = int(request.matchdict.get('year', None)) |
|
|
year = int(request.matchdict.get('year', None)) |
|
|
|
|
|
if not request.user.Staff: |
|
|
|
|
|
# Don't answer to users that aren't logged |
|
|
|
|
|
raise HTTPForbidden(u'Vous n\'avez pas l\'autorité suffisante pour effectuer cette action.') |
|
|
content = DBSession.query(JM2L_Year).filter(JM2L_Year.year_uid==year).first() |
|
|
content = DBSession.query(JM2L_Year).filter(JM2L_Year.year_uid==year).first() |
|
|
form = IndexForm(request.POST, content, meta={'csrf_context': request.session}) |
|
|
form = IndexForm(request.POST, content, meta={'csrf_context': request.session}) |
|
|
if request.method == 'POST' and form.validate(): |
|
|
if request.method == 'POST' and form.validate(): |
|
@@ -293,6 +335,12 @@ def static_presse(request): |
|
|
@view_config(route_name='edit_presse', renderer="jm2l:templates/Staff/EditPresse.mako") |
|
|
@view_config(route_name='edit_presse', renderer="jm2l:templates/Staff/EditPresse.mako") |
|
|
def edit_presse(request): |
|
|
def edit_presse(request): |
|
|
year = int(request.matchdict.get('year', None)) |
|
|
year = int(request.matchdict.get('year', None)) |
|
|
|
|
|
if request.user is None: |
|
|
|
|
|
# Don't answer to users that aren't logged |
|
|
|
|
|
raise HTTPForbidden(u'Vous devez vous identifier pour obtenir une réponse.') |
|
|
|
|
|
if not request.user.Staff: |
|
|
|
|
|
# Don't answer to users that aren't logged |
|
|
|
|
|
raise HTTPForbidden(u'Vous n\'avez pas l\'autorité suffisante pour effectuer cette action.') |
|
|
content = DBSession.query(JM2L_Year).filter(JM2L_Year.year_uid==year).first() |
|
|
content = DBSession.query(JM2L_Year).filter(JM2L_Year.year_uid==year).first() |
|
|
form = DossPresse(request.POST, content, meta={'csrf_context': request.session}) |
|
|
form = DossPresse(request.POST, content, meta={'csrf_context': request.session}) |
|
|
if request.method == 'POST' and form.validate(): |
|
|
if request.method == 'POST' and form.validate(): |
|
@@ -430,6 +478,12 @@ def action_task(request): |
|
|
|
|
|
|
|
|
@view_config(route_name='action_task_area') |
|
|
@view_config(route_name='action_task_area') |
|
|
def action_task_area(request): |
|
|
def action_task_area(request): |
|
|
|
|
|
if request.user is None: |
|
|
|
|
|
# Don't answer to users that aren't logged |
|
|
|
|
|
raise HTTPForbidden(u'Vous devez vous identifier pour obtenir une réponse.') |
|
|
|
|
|
if not request.user.Staff: |
|
|
|
|
|
# Don't answer to users that aren't logged |
|
|
|
|
|
raise HTTPForbidden(u'Vous n\'avez pas l\'autorité suffisante pour effectuer cette action.') |
|
|
action = request.matchdict.get('action') |
|
|
action = request.matchdict.get('action') |
|
|
pole_id = request.matchdict.get('pole_id') |
|
|
pole_id = request.matchdict.get('pole_id') |
|
|
Pole = TasksArea.by_id(int(pole_id)) |
|
|
Pole = TasksArea.by_id(int(pole_id)) |
|
@@ -962,7 +1016,7 @@ def link_event_tiers(request): |
|
|
TargetEvent = Event.by_id(form.event_uid.data) |
|
|
TargetEvent = Event.by_id(form.event_uid.data) |
|
|
Exist = Tiers.by_id(form.tiers.data) |
|
|
Exist = Tiers.by_id(form.tiers.data) |
|
|
if not Exist: |
|
|
if not Exist: |
|
|
request.session.flash(('error',u"Une erreur s'est produite lors de l'ajout de votre entitée !")) |
|
|
|
|
|
|
|
|
request.session.flash(('error',u"Une erreur s'est produite lors de l'ajout de votre entité !")) |
|
|
return HTTPFound(location=request.route_url('edit_event', sep='/', |
|
|
return HTTPFound(location=request.route_url('edit_event', sep='/', |
|
|
year=str(year), intervention=intervention, event_id=str(TargetEvent.uid))) |
|
|
year=str(year), intervention=intervention, event_id=str(TargetEvent.uid))) |
|
|
else: |
|
|
else: |
|
@@ -1173,13 +1227,13 @@ def delete_tiers(request): |
|
|
if TheTiers is None: |
|
|
if TheTiers is None: |
|
|
raise HTTPNotFound() |
|
|
raise HTTPNotFound() |
|
|
if len(TheTiers.membership)!=0: |
|
|
if len(TheTiers.membership)!=0: |
|
|
request.session.flash(('error', u"Vous devez supprimer tous les membres liés avant la suppression d'une entitée.")) |
|
|
|
|
|
|
|
|
request.session.flash(('error', u"Vous devez supprimer tous les membres liés avant la suppression d'une entité.")) |
|
|
return HTTPFound(location=request.route_url('show_entity', entity_id=TheTiers.slug, tiers_type=TheTiers.get_entity_type.slug_entity_type)) |
|
|
return HTTPFound(location=request.route_url('show_entity', entity_id=TheTiers.slug, tiers_type=TheTiers.get_entity_type.slug_entity_type)) |
|
|
if len(TheTiers.membership)!=0: |
|
|
if len(TheTiers.membership)!=0: |
|
|
request.session.flash(('error', u"Vous devez supprimer tous les roles liés avant la suppression d'une entitée.")) |
|
|
|
|
|
|
|
|
request.session.flash(('error', u"Vous devez supprimer tous les roles liés avant la suppression d'une entité.")) |
|
|
return HTTPFound(location=request.route_url('show_entity', entity_id=TheTiers.slug, tiers_type=TheTiers.get_entity_type.slug_entity_type)) |
|
|
return HTTPFound(location=request.route_url('show_entity', entity_id=TheTiers.slug, tiers_type=TheTiers.get_entity_type.slug_entity_type)) |
|
|
DBSession.delete(TheTiers) |
|
|
DBSession.delete(TheTiers) |
|
|
request.session.flash(('info', u"L'entitée a bien été supprimée")) |
|
|
|
|
|
|
|
|
request.session.flash(('info', u"L'entité a bien été supprimée")) |
|
|
return HTTPFound(location=request.route_url('entities')) |
|
|
return HTTPFound(location=request.route_url('entities')) |
|
|
else: |
|
|
else: |
|
|
raise HTTPNotFound() |
|
|
raise HTTPNotFound() |
|
|