Ensure Staff permission is ok for data modification

Added extrernal documents on tiers
This commit is contained in:
2015-04-06 14:12:43 +02:00
parent d475e03b0d
commit 4ff1ca66be
12 changed files with 84 additions and 43 deletions
+15 -1
View File
@@ -111,6 +111,13 @@ class JM2L_Year(Base):
date_list = filter(lambda x: x.hour<12 or x.hour>=13, date_list) date_list = filter(lambda x: x.hour<12 or x.hour>=13, date_list)
return date_list return date_list
@property
def DocLinks(self):
from .upload import MediaPath
return zip( MediaPath().get_list('presse', self.year_uid, 'Other'),
MediaPath().get_thumb('presse', self.year_uid, 'Other')
)
class User(Base): class User(Base):
__tablename__ = 'users' __tablename__ = 'users'
uid = Column(Integer, primary_key=True) uid = Column(Integer, primary_key=True)
@@ -272,10 +279,17 @@ class Tiers(Base):
.filter(Media.media_type == 'Image') \ .filter(Media.media_type == 'Image') \
.filter(Media.link_id == self.uid) .filter(Media.link_id == self.uid)
@property
def DocLinks(self):
from .upload import MediaPath
return zip( MediaPath().get_list('tiers', self.uid, 'Other'),
MediaPath().get_thumb('tiers', self.uid, 'Other')
)
@property @property
def PhotosLinks(self): def PhotosLinks(self):
from .upload import MediaPath from .upload import MediaPath
return MediaPath().get_list('tiers', self.uid) return MediaPath().get_list('tiers', self.uid, 'Image')
@property @property
def ThumbLinks(self): def ThumbLinks(self):
+4 -4
View File
@@ -14,19 +14,19 @@
</filter> </filter>
<linearGradient id="BoxGradient-Conference" spreadMethod="pad" x1="100%" y1="0%" x2="50%" y2="100%"> <linearGradient id="BoxGradient-Conference" spreadMethod="pad" x1="100%" y1="0%" x2="50%" y2="100%">
<stop offset="0%" stop-color="#EEE" stop-opacity="0"/> <stop offset="0%" stop-color="#EEE" stop-opacity="0"/>
<stop offset="15%" stop-color="#f9fde8" stop-opacity="1"/> <stop offset="15%" stop-color="#BDF86B" stop-opacity=".5"/>
</linearGradient> </linearGradient>
<linearGradient id="BoxGradient-Atelier" spreadMethod="pad" x1="100%" y1="0%" x2="50%" y2="100%"> <linearGradient id="BoxGradient-Atelier" spreadMethod="pad" x1="100%" y1="0%" x2="50%" y2="100%">
<stop offset="0%" stop-color="#EEE" stop-opacity="0"/> <stop offset="0%" stop-color="#EEE" stop-opacity="0"/>
<stop offset="15%" stop-color="#faebeb" stop-opacity="1"/> <stop offset="15%" stop-color="#FF856E" stop-opacity=".5"/>
</linearGradient> </linearGradient>
<linearGradient id="BoxGradient-Table-ronde" spreadMethod="pad" x1="100%" y1="0%" x2="50%" y2="100%"> <linearGradient id="BoxGradient-Table-ronde" spreadMethod="pad" x1="100%" y1="0%" x2="50%" y2="100%">
<stop offset="0%" stop-color="#EEE" stop-opacity="0"/> <stop offset="0%" stop-color="#EEE" stop-opacity="0"/>
<stop offset="15%" stop-color="#fff4e5" stop-opacity="1"/> <stop offset="15%" stop-color="#F369A5" stop-opacity=".5"/>
</linearGradient> </linearGradient>
<linearGradient id="BoxGradient-Concert" spreadMethod="pad" x1="100%" y1="0%" x2="50%" y2="100%"> <linearGradient id="BoxGradient-Concert" spreadMethod="pad" x1="100%" y1="0%" x2="50%" y2="100%">
<stop offset="0%" stop-color="#EEE" stop-opacity="0"/> <stop offset="0%" stop-color="#EEE" stop-opacity="0"/>
<stop offset="15%" stop-color="#2EE" stop-opacity="1"/> <stop offset="15%" stop-color="#65EA92" stop-opacity=".5"/>
</linearGradient> </linearGradient>
</defs> </defs>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

+8 -3
View File
@@ -1,7 +1,7 @@
<%namespace name="h" file="jm2l:templates/helpers.mako"/> <%namespace name="h" file="jm2l:templates/helpers.mako"/>
<%namespace name="tables" file="jm2l:templates/Logistique/Tables.mako"/> <%namespace name="tables" file="jm2l:templates/Logistique/Tables.mako"/>
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
<%def name="Main(Exchanges)"> <%def name="Main(Exchanges, miam_form)">
<% <%
DicExch = Exchanges.get_overview( request.user.uid ) DicExch = Exchanges.get_overview( request.user.uid )
%> %>
@@ -17,7 +17,7 @@ DicExch = Exchanges.get_overview( request.user.uid )
<div class="tab-content"> <div class="tab-content">
<div class="tab-pane fade active in" id="ResumeInt">${Route_wrapper(DicExch)}</div> <div class="tab-pane fade active in" id="ResumeInt">${Route_wrapper(DicExch)}</div>
<div class="tab-pane fade" id="Miam">${Miam_wrapper()}</div> <div class="tab-pane fade" id="Miam">${Miam_wrapper(miam_form)}</div>
<div class="tab-pane fade" id="Covoiturage">${Exchange_wrapper('C', DicExch['C'])}</div> <div class="tab-pane fade" id="Covoiturage">${Exchange_wrapper('C', DicExch['C'])}</div>
<div class="tab-pane fade" id="Hebergement">${Exchange_wrapper('H', DicExch['H'])}</div> <div class="tab-pane fade" id="Hebergement">${Exchange_wrapper('H', DicExch['H'])}</div>
<div class="tab-pane fade" id="Materiel">${Exchange_wrapper('M', DicExch['M'])}</div> <div class="tab-pane fade" id="Materiel">${Exchange_wrapper('M', DicExch['M'])}</div>
@@ -35,9 +35,14 @@ DicExch = Exchanges.get_overview( request.user.uid )
</fieldset> </fieldset>
</%def> </%def>
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
<%def name="Miam_wrapper()"> <%def name="Miam_wrapper(miam_form)">
<fieldset> <fieldset>
<legend>Qu'est ce qu'on mange ?</legend> <legend>Qu'est ce qu'on mange ?</legend>
<%
DicForm = {
}
%>
${h.DisplayForm(miam_form, DicForm)}
</fieldset> </fieldset>
</%def> </%def>
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+11 -5
View File
@@ -84,26 +84,26 @@ fieldset:disabled {
<legend>D&eacute;part</legend> <legend>D&eacute;part</legend>
<div class="form-inline"> <div class="form-inline">
Je repars Je repars
<select style="width:12em;" id="Departure:Place" class="formforform-field" name="field_7" title="Alors, j'arrive"> <select style="width:12em;" id="Departure:Place" class="formforform-field" name="Departure:Place" title="Alors, j'arrive">
% for place in Places: % for place in Places:
<option value="${place.place_id}">${place.display_name}</option> <option value="${place.place_id}">${place.display_name}</option>
% endfor % endfor
</select> </select>
le le
<select style="width:7em;" id="Departure:Day" class="formforform-field" name="field_8" title="Le"> <select style="width:7em;" id="Departure:Day" class="formforform-field" name="Departure:Day" title="Le">
<option value="28">Samedi</option> <option value="28">Samedi</option>
<option value="29">Dimanche</option> <option value="29">Dimanche</option>
<option value="30">Lundi</option> <option value="30">Lundi</option>
</select> </select>
, ,
<select style="width:14em;" id="Departure:Confidence" class="formforform-field" name="field_8" title="Le"> <select style="width:14em;" id="Departure:Confidence" class="formforform-field" name="Departure:Confidence" title="Le">
<option value="Exacte" selected="selected">exactement</option> <option value="Exacte" selected="selected">exactement</option>
<option value="Approximative">approximativement</option> <option value="Approximative">approximativement</option>
<option value="à peu près">à peu près (5 à 15 min)</option> <option value="à peu près">à peu près (5 à 15 min)</option>
<option value="à une vache près">à une vache près (1h)</option> <option value="à une vache près">à une vache près (1h)</option>
</select> </select>
&agrave; &agrave;
<select style="width:6em;" id="Departure:Hour" class="formforform-field" name="field_8" title="&agrave;"> <select style="width:6em;" id="Departure:Hour" class="formforform-field" name="Departure:Hour" title="&agrave;">
% for hour in range(24): % for hour in range(24):
% for minutes in range(0,60,10): % for minutes in range(0,60,10):
<option value="${hour}h${minutes}" <option value="${hour}h${minutes}"
@@ -156,9 +156,15 @@ fieldset:disabled {
</p> </p>
</fieldset> </fieldset>
<center> <center>
% if 1:
<button type="submit" class="btn btn-large btn-primary" /> <button type="submit" class="btn btn-large btn-primary" />
<i class="icon-ok icon-white"></i> Enregistrer <i class="icon-ok icon-white"></i> Je viens aux JM2L 2015
</button> </button>
% else:
<button type="submit" class="btn btn-large btn-primary" />
<i class="icon-ok icon-white"></i> Enregistrer les modifications
</button>
% endif
</center> </center>
</form> </form>
+1
View File
@@ -10,6 +10,7 @@ DisplayYear = request.session.get('year',2015)
% if content and content.doss_presse: % if content and content.doss_presse:
<div class="span8 offset1"> <div class="span8 offset1">
${content.doss_presse | n} ${content.doss_presse | n}
${helpers.medias(content)}
</div> </div>
% endif % endif
<div class="span3"> <div class="span3">
+2 -14
View File
@@ -29,20 +29,8 @@ TabDisplay = [
padding:5px; padding:5px;
height:100%; height:100%;
} }
.Conference { .EvtBox a {
fill: #f9fde8; color: #666;
}
.Concert {
fill: #2EE;
}
.Atelier {
fill: #faebeb;
}
.Table-ronde {
fill: #fff4e5;
}
.Repas {
fill: #2EE;
} }
svg { svg {
font: 10px sans-serif; font: 10px sans-serif;
+13 -2
View File
@@ -200,8 +200,19 @@ TabJs = {'select':[], 'desc':[]}
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
## Wrapper pour afficher les fichiers ## Wrapper pour afficher les fichiers
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
<%def name="medias(MediaType, UID, desc=None)"> \ <%def name="medias(Entity, UID=None, desc=None)"> \
<hr>
<ul class="thumbnails">
% for filelink, thumb in Entity.DocLinks:
<li class="span2">
<div class="media">
<a class="pull-left" href="${filelink}">
<img class="media-object" src="${thumb}" />
</a>
</div>
</li>
% endfor
</ul>
</%def> </%def>
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
## Wrapper pour uploader ## Wrapper pour uploader
+1 -1
View File
@@ -112,7 +112,7 @@
</div> </div>
<div class="tab-pane fade" id="Logistique"> <div class="tab-pane fade" id="Logistique">
${intendance.Main(Exchanges)} ${intendance.Main(Exchanges, miam_form)}
</div> </div>
<div class="tab-pane fade" id="Frais"> <div class="tab-pane fade" id="Frais">
+1
View File
@@ -124,6 +124,7 @@ ${helpers.uploader_js()}
% if request.user: % if request.user:
% if request.user.Staff: % if request.user.Staff:
<li><a href="/Staff">Partie Staff</a></li> <li><a href="/Staff">Partie Staff</a></li>
<li><a href="/ListSalles">Gérer les salles</a></li>
% endif % endif
<li><a href="/sign/out">Me déconnecter</a></li> <li><a href="/sign/out">Me déconnecter</a></li>
% else: % else:
+5 -5
View File
@@ -17,11 +17,11 @@ ${event.start_time.strftime('%H:%M')} à ${event.end_time.strftime('%H:%M')}
- <strong>Salle</strong>: ${event.Salle.name} - <strong>Salle</strong>: ${event.Salle.name}
%endif %endif
</div> </div>
%if event.event_uid: ##%if event.event_uid:
<a href="http://jm2l.linux-azur.org/node/${event.event_uid}">Link</a> - ## <a href="http://jm2l.linux-azur.org/node/${event.event_uid}">Link</a> -
%endif ##%endif
% if event.for_year==2015 and request.user and (request.user.Staff or request.user in event.intervenants): % if event.for_year==2015 and request.user and (request.user.Staff or request.user in event.intervenants):
<a href="/MesJM2L/${event.for_year}/${event.event_type}/${event.slug}">Editer</a> <a href="/MesJM2L/${event.for_year}/${event.event_type}/${event.slug}">Modifier</a>
% elif request.user and request.user.Staff: % elif request.user and request.user.Staff:
<a href="/MesJM2L/${event.for_year}/${event.event_type}/${event.slug}">Editer</a> <a href="/MesJM2L/${event.for_year}/${event.event_type}/${event.slug}">Editer</a>
% endif % endif
@@ -111,7 +111,7 @@ ${event.start_time.strftime('%H:%M')} à ${event.end_time.strftime('%H:%M')}
<div class="footborderbox"> <div class="footborderbox">
% if iterv.website: % if iterv.website:
<div style="float:right;"> <div style="float:right;">
<a href="http://${iterv.website}">${iterv.website}</a> <a href="${iterv.website}">${iterv.website}</a>
</div> </div>
% endif % endif
</div> </div>
+5 -2
View File
@@ -28,7 +28,7 @@ ${The_entity_type.entity_subtype}
% if entity.PhotosLinks: % if entity.PhotosLinks:
<div style="float:right;padding:5px;border: 1px solid #eee;background-color:white;"> <div style="float:right;padding:5px;border: 1px solid #eee;background-color:white;">
% for img_path in entity.PhotosLinks: % for img_path in entity.PhotosLinks:
<img src="${img_path}" alt="logo" /> <img src="${img_path}" style="max-height:205px;max-width:335px;" alt="logo" />
% endfor % endfor
</div> </div>
% endif % endif
@@ -37,6 +37,9 @@ ${The_entity_type.entity_subtype}
% else: % else:
<p>Cette entité n'a pas de description.</p> <p>Cette entité n'a pas de description.</p>
% endif % endif
% if entity.DocLinks:
${helpers.medias(entity)}
% endif
</div> </div>
<div class="footborderbox"> <div class="footborderbox">
% if entity.website: % if entity.website:
@@ -88,7 +91,7 @@ ${The_entity_type.entity_subtype}
<div class="footborderbox"> <div class="footborderbox">
% if iterv.website: % if iterv.website:
<div style="float:right;"> <div style="float:right;">
<a href="http://${iterv.website}">${iterv.website}</a> <a href="${iterv.website}">${iterv.website}</a>
</div> </div>
% endif % endif
</div> </div>
+14 -2
View File
@@ -43,7 +43,7 @@ mimetypes.init()
class MediaPath(): class MediaPath():
def get_list(self, media_table, linked_id): def get_list(self, media_table, linked_id, MediaType=None):
filelist = list() filelist = list()
curpath = self.get_mediapath(media_table, linked_id, None) curpath = self.get_mediapath(media_table, linked_id, None)
if not os.path.isdir(curpath): if not os.path.isdir(curpath):
@@ -54,23 +54,35 @@ class MediaPath():
if f.endswith('.type'): if f.endswith('.type'):
continue continue
if f: if f:
filename, ext = os.path.splitext( f )
tmpurl = '/image/%s/%d/%s' % (media_table, linked_id, f) tmpurl = '/image/%s/%d/%s' % (media_table, linked_id, f)
if MediaType is None:
filelist.append(tmpurl)
elif MediaType=='Image' and ext.lower() in ['.gif','.jpg','.png','.svg','.jpeg']:
filelist.append(tmpurl)
elif MediaType=='Other' and ext.lower() not in ['.gif','.jpg','.png','.svg','.jpeg']:
filelist.append(tmpurl) filelist.append(tmpurl)
return filelist return filelist
def get_thumb(self, media_table, linked_id): def get_thumb(self, media_table, linked_id, MediaType=None):
filelist = list() filelist = list()
curpath = self.get_mediapath(media_table, linked_id, None) curpath = self.get_mediapath(media_table, linked_id, None)
curpath = os.path.join( curpath, 'thumbnails') curpath = os.path.join( curpath, 'thumbnails')
if not os.path.isdir(curpath): if not os.path.isdir(curpath):
return list() return list()
for f in os.listdir(curpath): for f in os.listdir(curpath):
filename, ext = os.path.splitext( f )
if os.path.isdir(os.path.join(curpath,f)): if os.path.isdir(os.path.join(curpath,f)):
continue continue
if f.endswith('.type'): if f.endswith('.type'):
continue continue
if f: if f:
tmpurl = '/image/%s/%d/thumbnails/%s' % (media_table, linked_id, f) tmpurl = '/image/%s/%d/thumbnails/%s' % (media_table, linked_id, f)
if MediaType is None:
filelist.append(tmpurl)
elif MediaType=='Image' and len( os.path.splitext(filename)[1] )==0:
filelist.append(tmpurl)
elif MediaType=='Other' and len( os.path.splitext(filename)[1] ):
filelist.append(tmpurl) filelist.append(tmpurl)
return filelist return filelist