@@ -55,6 +55,7 @@ def main(global_config, **settings): | |||||
# HTML Routes - Staff | # HTML Routes - Staff | ||||
config.add_route('list_task', '/Staff') | 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+)?}') | config.add_route('handle_task', '/Staff/tasks{sep:/*}{task_id:(\d+)?}') | ||||
config.add_route('action_task', '/Staff/{action:(\w+)}/{task_id:(\d+)}') | config.add_route('action_task', '/Staff/{action:(\w+)}/{task_id:(\d+)}') | ||||
@@ -47,17 +47,19 @@ ATELIER_DURATION = [ (15,u'Lighting talk ( 5 min)'), | |||||
class StaffArea(MyBaseForm): | class StaffArea(MyBaseForm): | ||||
uid = HiddenField() | |||||
name = TextField(u'Pôle') | name = TextField(u'Pôle') | ||||
description = TextAreaField('Description', [validators.optional(), validators.Length(max=1000000)], | description = TextAreaField('Description', [validators.optional(), validators.Length(max=1000000)], | ||||
filters=[strip_filter] | filters=[strip_filter] | ||||
) | ) | ||||
class EditStaffArea(StaffArea): | |||||
uid = HiddenField() | |||||
class StaffTasks(MyBaseForm): | class StaffTasks(MyBaseForm): | ||||
name = TextField(u'Nom de la tâche') | name = TextField(u'Nom de la tâche') | ||||
area_uid = SelectField(u'Pôle concerné', coerce=int ) | area_uid = SelectField(u'Pôle concerné', coerce=int ) | ||||
due_date = DateField(u'Date prévue', format='%d/%m/%Y') | |||||
closed_by = SelectField(u'Assigné à', coerce=int ) | closed_by = SelectField(u'Assigné à', coerce=int ) | ||||
due_date = DateField(u'Date prévue', format='%d/%m/%Y') | |||||
description = TextAreaField('Description', [validators.optional(), validators.Length(max=1000000)], | description = TextAreaField('Description', [validators.optional(), validators.Length(max=1000000)], | ||||
filters=[strip_filter]) | filters=[strip_filter]) | ||||
@@ -111,29 +113,13 @@ class AddIntervenant(MyBaseForm): | |||||
u"son inscription sur le site.") | u"son inscription sur le site.") | ||||
add = SubmitField('Ajouter des intervenants') | add = SubmitField('Ajouter des intervenants') | ||||
class InterventionForm(MyBaseForm): | |||||
class ConfCreateForm(MyBaseForm): | |||||
event_type = HiddenField() | event_type = HiddenField() | ||||
for_year = HiddenField() | for_year = HiddenField() | ||||
start_time = HiddenField() | start_time = HiddenField() | ||||
end_time = HiddenField() | end_time = HiddenField() | ||||
name = TextField(u'Le nom de votre ', | |||||
[validators.DataRequired(u'Vous devez spécifier un nom pour votre intérvention'), | |||||
validators.Length(min=1, max=80, message='entre 1 et 80 car')], | |||||
filters=[strip_filter]) | |||||
description = TextAreaField(u'Décrivez ici quelques détails à propos de votre intervention ', | |||||
[validators.Optional(), validators.Length(max=1000000)], | |||||
filters=[strip_filter] | |||||
) | |||||
class ConfCreateForm(InterventionForm): | |||||
salle_uid = SelectField(u'Salle', coerce=int, | |||||
description=u"Choisissez ici la salle en fonction " | |||||
u"du nombres de personnes potentiellement intéressé par votre intervention "+ | |||||
u"l'organisation se réserve le droit de changer la salle (avec votre accord)." | |||||
) | |||||
start_sel = SelectField(u'Début', coerce=int, | start_sel = SelectField(u'Début', coerce=int, | ||||
description=u"C'est une heure indicative correspondant au mieux à vos préférences "+ | description=u"C'est une heure indicative correspondant au mieux à vos préférences "+ | ||||
u"personnelles. Vous pouvez prendre un créneau horaire déjà réservé si vous avez des contraintes " | u"personnelles. Vous pouvez prendre un créneau horaire déjà réservé si vous avez des contraintes " | ||||
@@ -144,6 +130,22 @@ class ConfCreateForm(InterventionForm): | |||||
description=u"Précisez ici la durée de votre intervention" | description=u"Précisez ici la durée de votre intervention" | ||||
) | ) | ||||
salle_uid = SelectField(u'Salle', coerce=int, | |||||
description=u"Choisissez ici la salle en fonction " | |||||
u"du nombres de personnes potentiellement intéressé par votre intervention "+ | |||||
u"l'organisation se réserve le droit de changer la salle (avec votre accord)." | |||||
) | |||||
name = TextField(u'Le nom de votre ', | |||||
[validators.DataRequired(u'Vous devez spécifier un nom pour votre intérvention'), | |||||
validators.Length(min=1, max=80, message='entre 1 et 80 car')], | |||||
filters=[strip_filter]) | |||||
description = TextAreaField(u'Décrivez ici quelques détails à propos de votre intervention ', | |||||
[validators.Optional(), validators.Length(max=1000000)], | |||||
filters=[strip_filter] | |||||
) | |||||
class ConfUpdateForm(ConfCreateForm): | class ConfUpdateForm(ConfCreateForm): | ||||
uid = HiddenField() | uid = HiddenField() | ||||
@@ -46,6 +46,10 @@ class TasksArea(Base): | |||||
name = Column(Unicode(80)) | name = Column(Unicode(80)) | ||||
description = Column(UnicodeText) | description = Column(UnicodeText) | ||||
@classmethod | |||||
def by_id(cls, id): | |||||
return DBSession.query(cls).filter(cls.uid == id).first() | |||||
class Tasks(Base): | class Tasks(Base): | ||||
__tablename__ = 'staff_tasks' | __tablename__ = 'staff_tasks' | ||||
uid = Column(Integer, primary_key=True) | uid = Column(Integer, primary_key=True) | ||||
@@ -4,7 +4,7 @@ import sys | |||||
import transaction | import transaction | ||||
import time | import time | ||||
import lxml.etree as ET | import lxml.etree as ET | ||||
from datetime import datetime | |||||
from sqlalchemy import engine_from_config | from sqlalchemy import engine_from_config | ||||
from sqlalchemy import create_engine | from sqlalchemy import create_engine | ||||
import unicodedata | import unicodedata | ||||
@@ -13,14 +13,13 @@ import urllib | |||||
from slugify import slugify | from slugify import slugify | ||||
from sqlite3 import dbapi2 as sqlite | from sqlite3 import dbapi2 as sqlite | ||||
from os import path | from os import path | ||||
from pyramid.paster import ( | from pyramid.paster import ( | ||||
get_appsettings, | get_appsettings, | ||||
setup_logging, | setup_logging, | ||||
) | ) | ||||
from jm2l.models import * | from jm2l.models import * | ||||
from datetime import datetime | |||||
def usage(argv): | def usage(argv): | ||||
cmd = os.path.basename(argv[0]) | cmd = os.path.basename(argv[0]) | ||||
@@ -39,5 +38,30 @@ def main(argv=sys.argv): | |||||
DBSession.configure(bind=engine) | DBSession.configure(bind=engine) | ||||
Base.metadata.create_all(engine) | Base.metadata.create_all(engine) | ||||
with transaction.manager: | with transaction.manager: | ||||
admin = User(nom=u'jm2l', prenom='contact', slug='contact jm2l', password=u'jm2l', mail=u'contact@jm2l.linux-azur.org') | |||||
DBSession.add(admin) | |||||
admin = User(nom=u'jm2l', prenom='contact', | |||||
slug='contact jm2l', password=u'jm2l', | |||||
mail=u'contact@jm2l.linux-azur.org', | |||||
Staff=1 | |||||
) | |||||
DBSession.add(admin) | |||||
# Create 2015 year event | |||||
jm2l = JM2L_Year(year_uid=2015, | |||||
state="Ongoing", | |||||
description=u"%d, %dème édition des JM2L." % ( 2015, 9 ), | |||||
start_time=datetime.strptime("28-11-2015 10:00","%d-%m-%Y %H:%M"), | |||||
end_time=datetime.strptime("28-11-2015 19:00","%d-%m-%Y %H:%M") | |||||
) | |||||
DBSession.add(jm2l) | |||||
# Create 2015 Physic room event | |||||
phy_salle = SallePhy( name=u"Polytech salle 211", | |||||
description=u"Salle informatique, présence de postes de travail",) | |||||
DBSession.add(phy_salle) | |||||
DBSession.flush() | |||||
# Create matching room place (Name could change each year) | |||||
salle = Salles(name=u"Mystère", description=u"Salle Mystère", | |||||
phy_salle_id = phy_salle.uid, | |||||
year_uid = jm2l.year_uid) | |||||
DBSession.add(salle) |
@@ -298,7 +298,10 @@ ListWrap = ["Co-voiturage",u"Hébergement","Matos"] | |||||
## Handle the Javascript Refresh to live update Current Page | ## Handle the Javascript Refresh to live update Current Page | ||||
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= | ## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= | ||||
% if reload: | % if reload: | ||||
<% DicExch = Exchanges.get_overview( request.user.uid ) %> | |||||
<% | |||||
DicExch = Exchanges.get_overview( request.user.uid ) | |||||
context._kwargs['postpone_js'] = [] | |||||
%> | |||||
${Route_wrapper(DicExch)} | ${Route_wrapper(DicExch)} | ||||
${Exchange_wrapper(Type, DicExch[Type])} | ${Exchange_wrapper(Type, DicExch[Type])} | ||||
%endif | %endif |
@@ -41,12 +41,18 @@ fieldset:disabled { | |||||
% endfor | % endfor | ||||
</select> | </select> | ||||
<script type="text/javascript"> | |||||
<% | |||||
context._kwargs['postpone_js'].append( "$('#Arrival\\\\:Place').select2({width:'resolve'});" % jsitem ) | |||||
context._kwargs['postpone_js'].append( "$('#Arrival\\\\:Day').select2({width:'resolve'});" % jsitem ) | |||||
context._kwargs['postpone_js'].append( "$('#Arrival\\\\:Confidence').select2({width:'resolve'});" % jsitem ) | |||||
context._kwargs['postpone_js'].append( "$('#Arrival\\\\:Hour').select2({width:'resolve'});" % jsitem ) | |||||
%> | |||||
##<script type="text/javascript"> | |||||
## $("#Arrival\\:Place").select2({}); | ## $("#Arrival\\:Place").select2({}); | ||||
## $("#Arrival\\:Day").select2({}); | ## $("#Arrival\\:Day").select2({}); | ||||
## $("#Arrival\\:Confidence").select2({}); | ## $("#Arrival\\:Confidence").select2({}); | ||||
## $("#Arrival\\:Hour").select2({}); | ## $("#Arrival\\:Hour").select2({}); | ||||
</script> | |||||
##</script> | |||||
</div> | </div> | ||||
<p> | <p> | ||||
<div class="control-group" style="background-color: #fafafa;padding: 10px 50px; width:60%"> | <div class="control-group" style="background-color: #fafafa;padding: 10px 50px; width:60%"> | ||||
@@ -114,13 +120,20 @@ fieldset:disabled { | |||||
% endfor | % endfor | ||||
% endfor | % endfor | ||||
</select> | </select> | ||||
<script type="text/javascript"> | |||||
<% | |||||
context._kwargs['postpone_js'].append( "$('#Departure\\\\:Place').select2({width:'resolve'});" % jsitem ) | |||||
context._kwargs['postpone_js'].append( "$('#Departure\\\\:Day').select2({width:'resolve'});" % jsitem ) | |||||
context._kwargs['postpone_js'].append( "$('#Departure\\\\:Confidence').select2({width:'resolve'});" % jsitem ) | |||||
context._kwargs['postpone_js'].append( "$('#Departure\\\\:Hour').select2({width:'resolve'});" % jsitem ) | |||||
%> | |||||
##<script type="text/javascript"> | |||||
## $("#Departure\\:Place").select2({}); | ## $("#Departure\\:Place").select2({}); | ||||
## $("#Departure\\:Day").select2({}); | ## $("#Departure\\:Day").select2({}); | ||||
## $("#Departure\\:Confidence").select2({}); | ## $("#Departure\\:Confidence").select2({}); | ||||
## $("#Departure\\:Hour").select2({}); | ## $("#Departure\\:Hour").select2({}); | ||||
</script> | |||||
##</script> | |||||
</div> | </div> | ||||
<p> | <p> | ||||
@@ -1,35 +1,45 @@ | |||||
# -*- coding: utf-8 -*- | # -*- coding: utf-8 -*- | ||||
<%inherit file="jm2l:templates/layout.mako"/> | <%inherit file="jm2l:templates/layout.mako"/> | ||||
<% | |||||
from slugify import slugify | |||||
%> | |||||
<a style="float:right;" class="btn btn-mini btn-info" role="button" href="/Staff/poles"> | |||||
<i class="icon-plus-sign icon-white"></i> Ajouter un Pôle d'activité | |||||
</a> | |||||
<h3>Liste des tâches JM2L Staff</h3> | <h3>Liste des tâches JM2L Staff</h3> | ||||
<div class="tabbable" id="main_tab"> | <div class="tabbable" id="main_tab"> | ||||
<ul class="nav nav-tabs" style="margin-bottom: 5px;"> | <ul class="nav nav-tabs" style="margin-bottom: 5px;"> | ||||
% for Num, Entity_Type in enumerate(tasks.keys()): | |||||
% for Num, Entity in enumerate(sorted(tasks.keys(), key=lambda x:x.name)): | |||||
<li class="${["","active"][Num==0]}"> | <li class="${["","active"][Num==0]}"> | ||||
<a href="#${Entity_Type}" id="Map_${Entity_Type}" data-toggle="tab">${Entity_Type}</a> | |||||
<a href="#${slugify(Entity.name)}" id="Map_Pole_${slugify(Entity.name)}" data-toggle="tab">${Entity.name}</a> | |||||
</li> | </li> | ||||
% endfor | % endfor | ||||
</ul> | </ul> | ||||
<div class="tab-content" style="padding:0 10px"> | <div class="tab-content" style="padding:0 10px"> | ||||
% for Num, Entity_Type in enumerate(tasks.keys()): | |||||
<div class="tab-pane fade ${["","active "][Num==0]} in" id="${Entity_Type}"> | |||||
% for Num, Entity in enumerate(sorted(tasks.keys(), key=lambda x:x.name)): | |||||
<div class="tab-pane fade ${["","active "][Num==0]} in" id="${slugify(Entity.name)}"> | |||||
<a style="float:right;" class="btn btn-mini btn-info" role="button" href="/Staff/poles/${Entity.uid}"> | |||||
<i class="icon-pencil icon-white"></i> Editer le pôle | |||||
</a> | |||||
<h4>${Entity.name}</h4> | |||||
<div>${Entity.description | n}</div> | |||||
<table width="100%" class="table table-striped table-bordered table-hover"> | <table width="100%" class="table table-striped table-bordered table-hover"> | ||||
<thead> | <thead> | ||||
<tr> | <tr> | ||||
<th colspan="2" style="text-align:center;">Nom | |||||
<th colspan="2" style="text-align:center;"> | |||||
<a style="float:right;" class="btn btn-mini btn-info" role="button" href="/Staff/tasks"> | <a style="float:right;" class="btn btn-mini btn-info" role="button" href="/Staff/tasks"> | ||||
<i class="icon-plus-sign icon-white"></i> Ajouter une tâche | <i class="icon-plus-sign icon-white"></i> Ajouter une tâche | ||||
</a> | </a> | ||||
Liste des tâches | |||||
</th> | </th> | ||||
</tr> | </tr> | ||||
</thead> | </thead> | ||||
<tbody> | <tbody> | ||||
% for task in tasks[Entity_Type]: | |||||
% for task in tasks[Entity]: | |||||
<tr> | <tr> | ||||
<td> | <td> | ||||
% if task.closed: | % if task.closed: | ||||
@@ -63,25 +73,18 @@ | |||||
% endfor | % endfor | ||||
</div> | </div> | ||||
%if 0: | |||||
<ul id="tasks"> | |||||
% if tasks: | |||||
% for task in tasks: | |||||
<li> | |||||
<span class="name">${task.name}</span> | |||||
<div class="actions"> | |||||
[ <a href="/Staff/tasks/${task.uid}">edit</a> - <a href="/Staff/close/${task.uid}">close</a> ] | |||||
</div> | |||||
%if task.description: | |||||
${task.description | n} | |||||
%endif | |||||
</li> | |||||
% endfor | |||||
% else: | |||||
<li>Il n'y a pas de tâches ouverte.</li> | |||||
% endif | |||||
<li class="last"> | |||||
<a href="/Staff/new">Créer une nouvelle tâche</a> | |||||
</li> | |||||
</ul> | |||||
%endif | |||||
<%def name="jsAddOn()"> | |||||
<script> | |||||
$('a[data-toggle="tab"]') | |||||
.on('shown', function(e) { | |||||
//stateObj = { tab: $(e.target).attr('href').substr(1) }; | |||||
//history.replaceState(stateObj, "", "/Staff" + $(e.target).attr('href') ); | |||||
location.hash = $(e.target).attr('href'); | |||||
}); | |||||
if (location.hash !== '') { | |||||
$('a[href="' + location.hash + '"]').tab('show'); | |||||
} | |||||
</script> | |||||
</%def> |
@@ -15,6 +15,7 @@ | |||||
<noscript><link rel="stylesheet" href="/vendor/fileupload/css/jquery.fileupload-noscript.css"></noscript> | <noscript><link rel="stylesheet" href="/vendor/fileupload/css/jquery.fileupload-noscript.css"></noscript> | ||||
<noscript><link rel="stylesheet" href="/vendor/fileupload/css/jquery.fileupload-ui-noscript.css"></noscript> | <noscript><link rel="stylesheet" href="/vendor/fileupload/css/jquery.fileupload-ui-noscript.css"></noscript> | ||||
</%def> | </%def> | ||||
<a style="float:right;" href="/Staff">Retour à la liste</a> | |||||
% if 'uid' in form._fields.keys(): | % if 'uid' in form._fields.keys(): | ||||
<h3>Editer une tâche</h3> | <h3>Editer une tâche</h3> | ||||
% else: | % else: | ||||
@@ -24,9 +25,9 @@ | |||||
DicForm = { | DicForm = { | ||||
'name': {'PlaceHolder':u"Nom de la tâche", "FieldStyle":"width:90%;" }, | 'name': {'PlaceHolder':u"Nom de la tâche", "FieldStyle":"width:90%;" }, | ||||
'area_uid': {'PlaceHolder':u"Pôle", "FieldStyle":"width:16em;", 'ContainerStyle':"float:left;" }, | 'area_uid': {'PlaceHolder':u"Pôle", "FieldStyle":"width:16em;", 'ContainerStyle':"float:left;" }, | ||||
'due_date': {'PlaceHolder':u"27/11/2015", "FieldStyle":"width:8em;", 'ContainerStyle':"float:left;"}, | |||||
'closed_by': {'PlaceHolder':u"Assigné à", "FieldStyle":"width:16em;" }, | |||||
'description': {'PlaceHolder':u"Description", "FieldStyle":"width:95%;min-height:150px;" }, | |||||
'closed_by': {'PlaceHolder':u"Assigné à", "FieldStyle":"width:16em;", 'ContainerStyle':"float:left;" }, | |||||
'due_date': {'PlaceHolder':u"27/11/2015", "FieldStyle":"width:8em;"}, | |||||
'description': {'PlaceHolder':u"Description", "FieldStyle":"width:95%;min-height:150px;", "ckeditor":"1" }, | |||||
} | } | ||||
%> | %> | ||||
@@ -3,7 +3,8 @@ | |||||
<%namespace name="helpers" file="jm2l:templates/helpers.mako"/> | <%namespace name="helpers" file="jm2l:templates/helpers.mako"/> | ||||
<%def name="jsAddOn()"> | <%def name="jsAddOn()"> | ||||
<script src="/vendor/ckeditor/ckeditor.js"></script> | <script src="/vendor/ckeditor/ckeditor.js"></script> | ||||
<script src="/vendor/select2/js/select2.js"></script> | |||||
<script src="/vendor/select2/js/select2.js"></script> | |||||
<script src="/vendor/fileupload/js/jquery-uploader.min.js"></script> | |||||
</%def> | </%def> | ||||
<%def name="cssAddOn()"> | <%def name="cssAddOn()"> | ||||
<link rel="stylesheet" href="/vendor/select2/css/select2.css" type="text/css" media="screen" /> | <link rel="stylesheet" href="/vendor/select2/css/select2.css" type="text/css" media="screen" /> | ||||
@@ -92,13 +93,12 @@ DicForm = { | |||||
'duration': {'PlaceHolder':u"Durée", 'ContainerStyle':"padding-right:15px;float:left;", "FieldStyle":"width:15em;"}, | 'duration': {'PlaceHolder':u"Durée", 'ContainerStyle':"padding-right:15px;float:left;", "FieldStyle":"width:15em;"}, | ||||
'salle_uid': {'PlaceHolder':u"Salle", 'ContainerStyle':"padding-right:15px;", "FieldStyle":"width:15em;"}, | 'salle_uid': {'PlaceHolder':u"Salle", 'ContainerStyle':"padding-right:15px;", "FieldStyle":"width:15em;"}, | ||||
'name': {'PlaceHolder':u"Nom", 'ContainerStyle':"padding-right:5px;", "FieldStyle":"width:95%;"}, | 'name': {'PlaceHolder':u"Nom", 'ContainerStyle':"padding-right:5px;", "FieldStyle":"width:95%;"}, | ||||
'description': {'PlaceHolder':u"Description", 'ContainerStyle':"padding-right:5px;", "FieldStyle":"width:90%;height:500px;" }, | |||||
'description': {'PlaceHolder':u"Description", 'ContainerStyle':"padding-right:5px;", "FieldStyle":"width:90%;height:500px;", "ckeditor":1 }, | |||||
} | } | ||||
%> | %> | ||||
${helpers.DisplayForm(form, DicForm)} | ${helpers.DisplayForm(form, DicForm)} | ||||
<button type="submit">Proposer</button> | |||||
<button type="submit">Proposer</button> | |||||
</form> | </form> | ||||
</fieldset> | </fieldset> | ||||
@@ -116,8 +116,9 @@ DicForm = { | |||||
${helpers.uploader("event", form.uid.data, u"un support de présentation" )} | ${helpers.uploader("event", form.uid.data, u"un support de présentation" )} | ||||
</fieldset> | </fieldset> | ||||
%else: | %else: | ||||
<br>NB: Vous devez proposer votre conférence avant de pouvoir | |||||
<p>NB: Vous devez proposer votre conférence avant de pouvoir | |||||
téléverser votre support de présentation. | téléverser votre support de présentation. | ||||
</p> | |||||
% endif | % endif | ||||
% if 'uid' in form._fields: | % if 'uid' in form._fields: | ||||
@@ -174,7 +175,8 @@ TabFields = [ | |||||
## Then the submit for this form | ## Then the submit for this form | ||||
${formAdd.add} | ${formAdd.add} | ||||
</form> | </form> | ||||
</fieldset> | |||||
</fieldset> | |||||
<div class="clearfix"> </div> | |||||
<p style="float:right;">Créé le ${event.created.strftime('%d %b %Y').decode('utf-8')}</p> | <p style="float:right;">Créé le ${event.created.strftime('%d %b %Y').decode('utf-8')}</p> | ||||
%else: | %else: | ||||
<p style="float:right;">Créé le | <p style="float:right;">Créé le | ||||
@@ -205,13 +207,14 @@ TabFields = [ | |||||
var editor = CKEDITOR.replace('description', { autoGrow_onStartup: true, language: 'fr' } ); | var editor = CKEDITOR.replace('description', { autoGrow_onStartup: true, language: 'fr' } ); | ||||
</script> | </script> | ||||
% else: | % else: | ||||
<% | |||||
for jsitem in form._fields.keys(): | |||||
<% | |||||
for jsitem in form._fields.keys(): | |||||
context._kwargs['postpone_js'].append( "$('#%s-help').popover();" % jsitem ) | |||||
if form._fields[jsitem].type=='SelectField': | |||||
context._kwargs['postpone_js'].append( "$('#%s').select2({width:'resolve'});" % jsitem ) | |||||
if formAdd: | |||||
for jsitem in formAdd._fields.keys(): | |||||
context._kwargs['postpone_js'].append( "$('#%s-help').popover();" % jsitem ) | context._kwargs['postpone_js'].append( "$('#%s-help').popover();" % jsitem ) | ||||
if form._fields[field].type=='SelectField': | |||||
context._kwargs['postpone_js'].append( "$('#%s').select2({width:'resolve'});" % jsitem ) | |||||
if formAdd: | |||||
for jsitem in formAdd._fields.keys(): | |||||
%> | |||||
%> | |||||
${helpers.uploader_js()} | |||||
% endif | % endif |
@@ -1,10 +1,5 @@ | |||||
<%inherit file="jm2l:templates/layout.mako"/> | <%inherit file="jm2l:templates/layout.mako"/> | ||||
<%namespace name="helpers" file="jm2l:templates/helpers.mako"/> | <%namespace name="helpers" file="jm2l:templates/helpers.mako"/> | ||||
<%def name="jsAddOn()"> | |||||
<script src="/vendor/select2/js/select2.js"></script> | |||||
<script src="/vendor/repeatable-fields/js/repeatable-fields.js"></script> | |||||
<script src="/vendor/ckeditor/ckeditor.js"></script> | |||||
</%def> | |||||
<%def name="cssAddOn()"> | <%def name="cssAddOn()"> | ||||
<link rel="stylesheet" href="/vendor/select2/css/select2.css" type="text/css" media="screen" /> | <link rel="stylesheet" href="/vendor/select2/css/select2.css" type="text/css" media="screen" /> | ||||
<link rel="stylesheet" href="/vendor/fileupload/css/jquery.fileupload.css"> | <link rel="stylesheet" href="/vendor/fileupload/css/jquery.fileupload.css"> | ||||
@@ -148,9 +143,15 @@ DicForm = { | |||||
<br> | <br> | ||||
<br> | <br> | ||||
<br> | <br> | ||||
% if 'uid' in form._fields: | % if 'uid' in form._fields: | ||||
${helpers.uploader_js()} | ${helpers.uploader_js()} | ||||
% endif | % endif | ||||
<%def name="jsAddOn()"> | |||||
<script src="/vendor/select2/js/select2.js"></script> | |||||
<script src="/vendor/repeatable-fields/js/repeatable-fields.js"></script> | |||||
<script src="/vendor/ckeditor/ckeditor.js"></script> | |||||
<script type="text/javascript"> | <script type="text/javascript"> | ||||
var year_data = Array(); | var year_data = Array(); | ||||
var editor = CKEDITOR.replace('description', { autoGrow_onStartup: true, language: 'fr' } ); | var editor = CKEDITOR.replace('description', { autoGrow_onStartup: true, language: 'fr' } ); | ||||
@@ -195,3 +196,4 @@ jQuery(function() { | |||||
}); | }); | ||||
}); | }); | ||||
</script> | </script> | ||||
</%def> |
@@ -1,7 +1,20 @@ | |||||
<%inherit file="jm2l:templates/layout.mako"/> | <%inherit file="jm2l:templates/layout.mako"/> | ||||
<%namespace name="helpers" file="jm2l:templates/helpers.mako"/> | <%namespace name="helpers" file="jm2l:templates/helpers.mako"/> | ||||
<%def name="jsAddOn()"> | <%def name="jsAddOn()"> | ||||
<script src="/vendor/repeatable-fields/js/repeatable-fields.js"></script> | |||||
<script src="/vendor/repeatable-fields/js/repeatable-fields.js"></script> | |||||
<script type="text/javascript"> | |||||
jQuery(function() { | |||||
jQuery('.repeat').each(function() { | |||||
jQuery(this).repeatable_fields({ | |||||
wrapper: 'table', | |||||
container: 'tbody', | |||||
row: 'tr', | |||||
cell: 'td', | |||||
}); | |||||
}); | |||||
}); | |||||
</script> | |||||
</%def> | </%def> | ||||
<h2>Gestion des catégories pour les entités</h2> | <h2>Gestion des catégories pour les entités</h2> | ||||
@@ -101,15 +114,3 @@ | |||||
<input type="submit" class="btn btn-primary" value="Enregistrer les modifications" /> | <input type="submit" class="btn btn-primary" value="Enregistrer les modifications" /> | ||||
</form> | </form> | ||||
<script type="text/javascript"> | |||||
jQuery(function() { | |||||
jQuery('.repeat').each(function() { | |||||
jQuery(this).repeatable_fields({ | |||||
wrapper: 'table', | |||||
container: 'tbody', | |||||
row: 'tr', | |||||
cell: 'td', | |||||
}); | |||||
}); | |||||
}); | |||||
</script> |
@@ -36,15 +36,12 @@ TabJs = {'select':[], 'desc':[]} | |||||
</label> | </label> | ||||
% endif | % endif | ||||
% if DicFormat.has_key(Field.name): | % if DicFormat.has_key(Field.name): | ||||
% if DicFormat[Field.name].has_key("PlaceHolder") and DicFormat[Field.name].has_key("FieldStyle"): | |||||
${Field(placeholder=DicFormat[Field.name].get("PlaceHolder"), style=DicFormat[Field.name].get("FieldStyle"))} | |||||
% elif DicFormat[Field.name].has_key("PlaceHolder"): | |||||
${Field(placeholder=DicFormat[Field.name].get("PlaceHolder"))} | |||||
% elif DicFormat[Field.name].has_key("FieldStyle"): | |||||
${Field(style=DicFormat[Field.name].get("FieldStyle"))} | |||||
% else: | |||||
${Field()} | |||||
% endif | |||||
<% | |||||
PlaceHolder = DicFormat[Field.name].get("PlaceHolder") | |||||
FieldStyle = DicFormat[Field.name].get("FieldStyle") | |||||
Class = [None,"ckeditor"][ DicFormat[Field.name].has_key("ckeditor") ] | |||||
%> | |||||
${Field(placeholder=PlaceHolder, style=FieldStyle, class_=Class)} | |||||
% else: | % else: | ||||
${Field()} | ${Field()} | ||||
% endif | % endif | ||||
@@ -61,24 +58,12 @@ TabJs = {'select':[], 'desc':[]} | |||||
</div> | </div> | ||||
% endif | % endif | ||||
% endfor | % endfor | ||||
% if 0: | |||||
## Then Auto Handle Javascript calls | |||||
<script> | |||||
% for jsitem in TabJs['select']: | |||||
$("#${jsitem}").select2({}); | |||||
% endfor | |||||
% for jsitem in TabJs['desc']: | |||||
$('#${jsitem}-help').popover(); | |||||
% endfor | |||||
</script> | |||||
% else: | |||||
<% | <% | ||||
for jsitem in TabJs['select']: | for jsitem in TabJs['select']: | ||||
context._kwargs['postpone_js'].append( "$('#%s').select2({});" % jsitem ) | context._kwargs['postpone_js'].append( "$('#%s').select2({});" % jsitem ) | ||||
for jsitem in TabJs['desc']: | for jsitem in TabJs['desc']: | ||||
context._kwargs['postpone_js'].append( "$('#%s-help').popover();" % jsitem ) | context._kwargs['postpone_js'].append( "$('#%s-help').popover();" % jsitem ) | ||||
%> | %> | ||||
% endif | |||||
</%def> | </%def> | ||||
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= | ## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= | ||||
@@ -260,7 +245,7 @@ TabJs = {'select':[], 'desc':[]} | |||||
{% } %} | {% } %} | ||||
</script> | </script> | ||||
%if 1: | %if 1: | ||||
##<script src="/vendor/fileupload/js/jquery-uploader.min.js"></script> | |||||
<script src="/vendor/fileupload/js/jquery-uploader.min.js"></script> | |||||
<script src="/js/main.js"></script> | <script src="/js/main.js"></script> | ||||
% else: | % else: | ||||
<script src="/static/jquery.min.js"></script> | <script src="/static/jquery.min.js"></script> | ||||
@@ -45,9 +45,7 @@ DisplayYear = request.session.get('year', 2015) | |||||
<small>${DisplayYear}</small> <span class="caret"></span></a> | <small>${DisplayYear}</small> <span class="caret"></span></a> | ||||
<ul class="dropdown-menu"> | <ul class="dropdown-menu"> | ||||
% for tmpyear in range(2015, 2005, -1): | % for tmpyear in range(2015, 2005, -1): | ||||
% if tmpyear==2014: | |||||
<li class="disabled"><a href="#">Pas d'édition 2014</a></li> | |||||
% else: | |||||
% if tmpyear!=2014: | |||||
<li><a href="/year/${tmpyear}">${tmpyear}</a></li> | <li><a href="/year/${tmpyear}">${tmpyear}</a></li> | ||||
% endif | % endif | ||||
% endfor | % endfor | ||||
@@ -64,6 +62,9 @@ DisplayYear = request.session.get('year', 2015) | |||||
</a> | </a> | ||||
<ul class="dropdown-menu"> | <ul class="dropdown-menu"> | ||||
% if request.user: | % if request.user: | ||||
% if request.user.Staff: | |||||
<li><a href="/Staff">Partie Staff</a></li> | |||||
% endif | |||||
<li><a href="/sign/out">Me déconnecter</a></li> | <li><a href="/sign/out">Me déconnecter</a></li> | ||||
% else: | % else: | ||||
<li><a href="/participer-l-evenement#inscription">Je m'inscris</a></li> | <li><a href="/participer-l-evenement#inscription">Je m'inscris</a></li> | ||||
@@ -112,8 +113,42 @@ DisplayYear = request.session.get('year', 2015) | |||||
## Then Handle Javascript | ## Then Handle Javascript | ||||
<script> | <script> | ||||
% for jsitem in context._kwargs['postpone_js']: | % for jsitem in context._kwargs['postpone_js']: | ||||
${jsitem} | |||||
${jsitem | n} | |||||
% endfor | % endfor | ||||
$.each( $('.fileupload'), | |||||
function( NumCtrl, Ctrl ) { | |||||
$("#"+Ctrl.id).fileupload({ | |||||
// Uncomment the following to send cross-domain cookies: | |||||
//xhrFields: {withCredentials: true}, | |||||
//url: '/uploader/proceed/' | |||||
url: this.action | |||||
}); | |||||
// Enable iframe cross-domain access via redirect option: | |||||
$("#"+Ctrl.id).fileupload( | |||||
'option', | |||||
'redirect', | |||||
window.location.href.replace( | |||||
/\/[^\/]*$/, | |||||
'/cors/result.html?%s' | |||||
) | |||||
); | |||||
$("#"+Ctrl.id).addClass('fileupload-processing'); | |||||
$.ajax({ | |||||
// Uncomment the following to send cross-domain cookies: | |||||
//xhrFields: {withCredentials: true}, | |||||
//url: this.action, | |||||
url: $("#"+Ctrl.id).fileupload('option', 'url'), | |||||
//url: "uploader/proceed/", | |||||
dataType: 'json', | |||||
context: $("#"+Ctrl.id)[0] | |||||
}).always(function () { | |||||
$(this).removeClass('fileupload-processing'); | |||||
}).done(function (result) { | |||||
$(this).fileupload('option', 'done') | |||||
.call(this, $.Event('done'), {result: result}); //$(this)}); | |||||
}); | |||||
} | |||||
); | |||||
</script> | </script> | ||||
</body> | </body> | ||||
</html> | </html> |
@@ -282,6 +282,6 @@ context._kwargs['postpone_js']=[] | |||||
## Then Handle Javascript | ## Then Handle Javascript | ||||
<script> | <script> | ||||
% for jsitem in context._kwargs['postpone_js']: | % for jsitem in context._kwargs['postpone_js']: | ||||
${jsitem} | |||||
${jsitem | n} | |||||
% endfor | % endfor | ||||
</script> | </script> |
@@ -276,7 +276,7 @@ def list_view(request): | |||||
tasks = DBSession.query( Tasks )\ | tasks = DBSession.query( Tasks )\ | ||||
.filter( Tasks.area_uid==grp.uid )\ | .filter( Tasks.area_uid==grp.uid )\ | ||||
.order_by(Tasks.closed, Tasks.due_date).all() | .order_by(Tasks.closed, Tasks.due_date).all() | ||||
DicTask[grp.name] = tasks | |||||
DicTask[grp] = tasks | |||||
return {'tasks': DicTask } | return {'tasks': DicTask } | ||||
@@ -312,10 +312,31 @@ def tasks(request): | |||||
return {'form':form } | return {'form':form } | ||||
@view_config(route_name='handle_pole', renderer='jm2l:templates/Staff/pole.mako') | |||||
def tasks_area(request): | |||||
pole_id = request.matchdict.get('pole_id') | |||||
if pole_id: | |||||
Pole = TasksArea.by_id(int(pole_id)) | |||||
if not Pole: | |||||
raise HTTPNotFound() | |||||
form = EditStaffArea(request.POST, Pole, meta={'csrf_context': request.session}) | |||||
else: | |||||
Pole = TasksArea() | |||||
form = StaffArea(request.POST, Pole, meta={'csrf_context': request.session}) | |||||
if request.method == 'POST' and form.validate(): | |||||
form.populate_obj(Pole) | |||||
if 'uid' in form._fields.keys(): | |||||
DBSession.merge(Pole) | |||||
else: | |||||
DBSession.add(Pole) | |||||
return HTTPFound(location=request.route_url('list_task')) | |||||
return {'form':form } | |||||
@view_config(route_name='action_task') | @view_config(route_name='action_task') | ||||
def action_task(request): | def action_task(request): | ||||
action = request.matchdict.get('action') | action = request.matchdict.get('action') | ||||
task_id = request.matchdict.get('task_id') | task_id = request.matchdict.get('task_id') | ||||
raise 'test' | |||||
Task = Tasks.by_id(int(task_id)) | Task = Tasks.by_id(int(task_id)) | ||||
if action=='close': | if action=='close': | ||||
Task.closed = True | Task.closed = True | ||||
@@ -695,7 +716,7 @@ def edit_event(request): | |||||
raise HTTPNotFound(u"Cette année n'est pas pris en charge") | raise HTTPNotFound(u"Cette année n'est pas pris en charge") | ||||
# Generate Timeslots for current year | # Generate Timeslots for current year | ||||
TimeSlots = list(enumerate( [ x.strftime('%a %d %b %H:%M') for x in | TimeSlots = list(enumerate( [ x.strftime('%a %d %b %H:%M') for x in | ||||
TheYear.AvailableTimeSlots ] )) | |||||
TheYear[0].AvailableTimeSlots ] )) | |||||
if event_id: | if event_id: | ||||
# We try to update an existing record | # We try to update an existing record | ||||
@@ -711,8 +732,8 @@ def edit_event(request): | |||||
if not (request.user.uid==1 or request.user in TheEvent.intervenants): | if not (request.user.uid==1 or request.user in TheEvent.intervenants): | ||||
return HTTPForbidden(u"Vous n'êtes pas identifié comme étant un participant à cette intervention.") | return HTTPForbidden(u"Vous n'êtes pas identifié comme étant un participant à cette intervention.") | ||||
# Compute some field value from selected event | # Compute some field value from selected event | ||||
if TheEvent.start_time in TheYear.AvailableTimeSlots: | |||||
start_sel = TheYear.AvailableTimeSlots.index(TheEvent.start_time) | |||||
if TheEvent.start_time in TheYear[0].AvailableTimeSlots: | |||||
start_sel = TheYear[0].AvailableTimeSlots.index(TheEvent.start_time) | |||||
else: | else: | ||||
start_sel = len(TimeSlots) | start_sel = len(TimeSlots) | ||||
TimeSlots.append( (len(TimeSlots), TheEvent.start_time.strftime('%a %d %b %H:%M'))) | TimeSlots.append( (len(TimeSlots), TheEvent.start_time.strftime('%a %d %b %H:%M'))) | ||||
@@ -778,7 +799,7 @@ def edit_event(request): | |||||
if request.method == 'POST' and form.validate(): | if request.method == 'POST' and form.validate(): | ||||
form.populate_obj(TheEvent) | form.populate_obj(TheEvent) | ||||
TheEvent.start_time = TheYear.AvailableTimeSlots[form.start_sel.data] | |||||
TheEvent.start_time = TheYear[0].AvailableTimeSlots[form.start_sel.data] | |||||
TheEvent.end_time = TheEvent.start_time + datetime.timedelta(minutes=form.duration.data) | TheEvent.end_time = TheEvent.start_time + datetime.timedelta(minutes=form.duration.data) | ||||
# Ok, time to put in database | # Ok, time to put in database | ||||
if not form._fields.has_key("uid"): | if not form._fields.has_key("uid"): | ||||
@@ -814,7 +835,6 @@ def list_tiers(request): | |||||
'entities':Entities, 'logged_in':request.authenticated_userid } | 'entities':Entities, 'logged_in':request.authenticated_userid } | ||||
return MainTab | return MainTab | ||||
@view_config(route_name='show_entity', renderer="jm2l:templates/view_tiers.mako") | @view_config(route_name='show_entity', renderer="jm2l:templates/view_tiers.mako") | ||||
def show_tiers(request): | def show_tiers(request): | ||||
tiers_type = request.matchdict.get('tiers_type') | tiers_type = request.matchdict.get('tiers_type') | ||||
@@ -831,6 +851,7 @@ def show_tiers(request): | |||||
'entity':TheTiers, 'logged_in':request.authenticated_userid } | 'entity':TheTiers, 'logged_in':request.authenticated_userid } | ||||
return MainTab | return MainTab | ||||
@view_config(route_name='add_entity', renderer="jm2l:templates/edit_tiers.mako") | |||||
@view_config(route_name='edit_entity', renderer="jm2l:templates/edit_tiers.mako", | @view_config(route_name='edit_entity', renderer="jm2l:templates/edit_tiers.mako", | ||||
permission='edit') | permission='edit') | ||||
def edit_tiers(request): | def edit_tiers(request): | ||||
@@ -892,7 +913,7 @@ def edit_tiers(request): | |||||
DBSession.add(TheTiers) | DBSession.add(TheTiers) | ||||
DBSession.flush() | DBSession.flush() | ||||
return HTTPFound(location=request.route_url('edit_entity', sep='/', | return HTTPFound(location=request.route_url('edit_entity', sep='/', | ||||
uid=str(TheTiers.uid), Nature=TheTiers.tiers_type)) | |||||
entity_id=str(TheTiers.slug), tiers_type=TheTiers.get_entity_type.entity_type)) | |||||
DBSession.merge(TheTiers) | DBSession.merge(TheTiers) | ||||
return HTTPFound(location=request.route_url('entities')) | return HTTPFound(location=request.route_url('entities')) | ||||
MainTab = {'programme':'','presse':'', 'plan':'', 'participer':'', | MainTab = {'programme':'','presse':'', 'plan':'', 'participer':'', | ||||