Browse Source

Add Live page

master
tr4ck3ur des JM2L 9 years ago
parent
commit
9a2eda2c99
3 changed files with 50 additions and 1 deletions
  1. +1
    -0
      jm2l/__init__.py
  2. +36
    -0
      jm2l/templates/Live.mako
  3. +13
    -1
      jm2l/views.py

+ 1
- 0
jm2l/__init__.py View File

@@ -108,6 +108,7 @@ def main(global_config, **settings):
config.add_route('vote_logo', '/vote_logo/{num:\d+}')
# HTML Routes - Staff
config.add_route('Live', '/Live')
config.add_route('list_task', '/Staff')
config.add_route('handle_pole', '/Staff/poles{sep:/*}{pole_id:(\d+)?}')
config.add_route('handle_task', '/Staff/tasks{sep:/*}{task_id:(\d+)?}')


+ 36
- 0
jm2l/templates/Live.mako View File

@@ -0,0 +1,36 @@
<%inherit file="jm2l:templates/layout.mako"/>
<%namespace name="helpers" file="jm2l:templates/helpers.mako"/>
<%def name="jsAddOn_head()">
<script src="/vendor/leaflet/js/leaflet.js"></script>
</%def>
<%def name="cssAddOn()">
<link rel="stylesheet" href="/vendor/leaflet/css/leaflet.css" />
<style>
#come_map {
height: 300px;
}
</style>
</%def>

<div class="span10 offset1">


<h3>Live JM2L</h3>
<p>
Voici les liens vers les conférences Live:
<h4>En ce moment:</h4>
</p>
<p>
% for ev in events:
<a href="http://jm2l.linux-azur.org:8081/${ev.Salle.phy_salle_id}.webm" target="_blank"> Live Vidéo</a> -
<a href="http://jm2l.linux-azur.org/event/${ev.for_year}/${ev.slug}"> ${ev.event_type} </a> - ${ev.name}
</br>
% endfor
</p>
<p>
Réalisé avec le concours des admins réseau Polytech'Nice. Encore merci pour leur disponibilité .. <br/>
Rechargez la page pour voir les évenements en cours en fonction de l'heure...<br/>
Vous avez le droit de vous plaindre, c'est du Do It Yourself ;)
</p>

</div>

+ 13
- 1
jm2l/views.py View File

@@ -11,7 +11,7 @@ from .forms import *
# Database access imports
from .models import *
from .helpers import Orga_helpers
from sqlalchemy import func, or_, text
from sqlalchemy import func, or_, text, and_
from os import path, makedirs, listdir
# Usefull tools
from slugify import slugify
@@ -43,6 +43,18 @@ def embeed_video(mime_type, link):
return Container


@view_config(route_name='Live', renderer="jm2l:templates/Live.mako")
def Live(request):
year = int(request.matchdict.get('year', CurrentYear))
tz = timezone('Europe/Paris')
curtime = datetime.datetime.now().replace(tzinfo=tz, day=28) #, hour=10, minute=00 )
Events = DBSession.query(Event)\
.filter(Event.for_year == year)\
.filter(Event.event_type != 'Stand')\
.filter(and_(Event.start_time <= curtime, Event.end_time >= curtime) )\
.order_by(Event.start_time)
return {'year': year, "DisplayYear": year, 'events':Events, "logged_in":request.authenticated_userid }

## =-=- Here, We handle ICal requests -=-=
@view_config(route_name='progr_iCal', renderer="string")
def ICal_Progamme_Request(request):


Loading…
Cancel
Save