Pārlūkot izejas kodu

Ensure Staff permission is ok for data modification

Added extrernal documents on tiers
master
tr4ck3ur des JM2L pirms 9 gadiem
vecāks
revīzija
4ff1ca66be
12 mainītis faili ar 84 papildinājumiem un 43 dzēšanām
  1. +17
    -3
      jm2l/models.py
  2. +4
    -4
      jm2l/static/img/shadow.svg
  3. +8
    -3
      jm2l/templates/Logistique/Logistique.mako
  4. +11
    -5
      jm2l/templates/Profil/Sejour.mako
  5. +1
    -0
      jm2l/templates/Public/Presse.mako
  6. +2
    -14
      jm2l/templates/Public/Programme.mako
  7. +13
    -2
      jm2l/templates/helpers.mako
  8. +1
    -1
      jm2l/templates/jm2l.mako
  9. +1
    -0
      jm2l/templates/layout.mako
  10. +5
    -5
      jm2l/templates/view_event.mako
  11. +5
    -2
      jm2l/templates/view_tiers.mako
  12. +16
    -4
      jm2l/upload.py

+ 17
- 3
jm2l/models.py Parādīt failu

@@ -111,6 +111,13 @@ class JM2L_Year(Base):
date_list = filter(lambda x: x.hour<12 or x.hour>=13, 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):
__tablename__ = 'users'
uid = Column(Integer, primary_key=True)
@@ -271,16 +278,23 @@ class Tiers(Base):
.filter(Media.media_table == 'tiers') \
.filter(Media.media_type == 'Image') \
.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
def PhotosLinks(self):
from .upload import MediaPath
return MediaPath().get_list('tiers', self.uid)
return MediaPath().get_list('tiers', self.uid, 'Image')

@property
def ThumbLinks(self):
from .upload import MediaPath
return MediaPath().get_thumb('tiers', self.uid)
return MediaPath().get_thumb('tiers', self.uid)

class Role_Tiers(Base):
""" Créer le lien entre le tiers et son rôle dans l'évenement en fonction de l'année"""


+ 4
- 4
jm2l/static/img/shadow.svg Parādīt failu

@@ -14,19 +14,19 @@
</filter>
<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="15%" stop-color="#f9fde8" stop-opacity="1"/>
<stop offset="15%" stop-color="#BDF86B" stop-opacity=".5"/>
</linearGradient>
<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="15%" stop-color="#faebeb" stop-opacity="1"/>
<stop offset="15%" stop-color="#FF856E" stop-opacity=".5"/>
</linearGradient>
<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="15%" stop-color="#fff4e5" stop-opacity="1"/>
<stop offset="15%" stop-color="#F369A5" stop-opacity=".5"/>
</linearGradient>
<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="15%" stop-color="#2EE" stop-opacity="1"/>
<stop offset="15%" stop-color="#65EA92" stop-opacity=".5"/>
</linearGradient>
</defs>
</svg>

+ 8
- 3
jm2l/templates/Logistique/Logistique.mako Parādīt failu

@@ -1,7 +1,7 @@
<%namespace name="h" file="jm2l:templates/helpers.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 )
%>
@@ -17,7 +17,7 @@ DicExch = Exchanges.get_overview( request.user.uid )
<div class="tab-content">
<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="Hebergement">${Exchange_wrapper('H', DicExch['H'])}</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>
</%def>
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
<%def name="Miam_wrapper()">
<%def name="Miam_wrapper(miam_form)">
<fieldset>
<legend>Qu'est ce qu'on mange ?</legend>
<%
DicForm = {
}
%>
${h.DisplayForm(miam_form, DicForm)}
</fieldset>
</%def>
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


+ 11
- 5
jm2l/templates/Profil/Sejour.mako Parādīt failu

@@ -84,26 +84,26 @@ fieldset:disabled {
<legend>D&eacute;part</legend>
<div class="form-inline">
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:
<option value="${place.place_id}">${place.display_name}</option>
% endfor
</select>
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="29">Dimanche</option>
<option value="30">Lundi</option>
</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="Approximative">approximativement</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>
</select>
&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 minutes in range(0,60,10):
<option value="${hour}h${minutes}"
@@ -156,9 +156,15 @@ fieldset:disabled {
</p>
</fieldset>
<center>
% if 1:
<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>
% else:
<button type="submit" class="btn btn-large btn-primary" />
<i class="icon-ok icon-white"></i> Enregistrer les modifications
</button>
% endif
</center>
</form>



+ 1
- 0
jm2l/templates/Public/Presse.mako Parādīt failu

@@ -10,6 +10,7 @@ DisplayYear = request.session.get('year',2015)
% if content and content.doss_presse:
<div class="span8 offset1">
${content.doss_presse | n}
${helpers.medias(content)}
</div>
% endif
<div class="span3">


+ 2
- 14
jm2l/templates/Public/Programme.mako Parādīt failu

@@ -29,20 +29,8 @@ TabDisplay = [
padding:5px;
height:100%;
}
.Conference {
fill: #f9fde8;
}
.Concert {
fill: #2EE;
}
.Atelier {
fill: #faebeb;
}
.Table-ronde {
fill: #fff4e5;
}
.Repas {
fill: #2EE;
.EvtBox a {
color: #666;
}
svg {
font: 10px sans-serif;


+ 13
- 2
jm2l/templates/helpers.mako Parādīt failu

@@ -200,8 +200,19 @@ TabJs = {'select':[], 'desc':[]}
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
## 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>
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
## Wrapper pour uploader


+ 1
- 1
jm2l/templates/jm2l.mako Parādīt failu

@@ -112,7 +112,7 @@
</div>
<div class="tab-pane fade" id="Logistique">
${intendance.Main(Exchanges)}
${intendance.Main(Exchanges, miam_form)}
</div>
<div class="tab-pane fade" id="Frais">


+ 1
- 0
jm2l/templates/layout.mako Parādīt failu

@@ -124,6 +124,7 @@ ${helpers.uploader_js()}
% if request.user:
% if request.user.Staff:
<li><a href="/Staff">Partie Staff</a></li>
<li><a href="/ListSalles">Gérer les salles</a></li>
% endif
<li><a href="/sign/out">Me déconnecter</a></li>
% else:


+ 5
- 5
jm2l/templates/view_event.mako Parādīt failu

@@ -17,11 +17,11 @@ ${event.start_time.strftime('%H:%M')} à ${event.end_time.strftime('%H:%M')}
- <strong>Salle</strong>: ${event.Salle.name}
%endif
</div>
%if event.event_uid:
<a href="http://jm2l.linux-azur.org/node/${event.event_uid}">Link</a> -
%endif
##%if event.event_uid:
## <a href="http://jm2l.linux-azur.org/node/${event.event_uid}">Link</a> -
##%endif
% 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:
<a href="/MesJM2L/${event.for_year}/${event.event_type}/${event.slug}">Editer</a>
% endif
@@ -111,7 +111,7 @@ ${event.start_time.strftime('%H:%M')} à ${event.end_time.strftime('%H:%M')}
<div class="footborderbox">
% if iterv.website:
<div style="float:right;">
<a href="http://${iterv.website}">${iterv.website}</a>
<a href="${iterv.website}">${iterv.website}</a>
</div>
% endif
</div>


+ 5
- 2
jm2l/templates/view_tiers.mako Parādīt failu

@@ -28,7 +28,7 @@ ${The_entity_type.entity_subtype}
% if entity.PhotosLinks:
<div style="float:right;padding:5px;border: 1px solid #eee;background-color:white;">
% 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
</div>
% endif
@@ -37,6 +37,9 @@ ${The_entity_type.entity_subtype}
% else:
<p>Cette entité n'a pas de description.</p>
% endif
% if entity.DocLinks:
${helpers.medias(entity)}
% endif
</div>
<div class="footborderbox">
% if entity.website:
@@ -88,7 +91,7 @@ ${The_entity_type.entity_subtype}
<div class="footborderbox">
% if iterv.website:
<div style="float:right;">
<a href="http://${iterv.website}">${iterv.website}</a>
<a href="${iterv.website}">${iterv.website}</a>
</div>
% endif
</div>


+ 16
- 4
jm2l/upload.py Parādīt failu

@@ -43,7 +43,7 @@ mimetypes.init()

class MediaPath():
def get_list(self, media_table, linked_id):
def get_list(self, media_table, linked_id, MediaType=None):
filelist = list()
curpath = self.get_mediapath(media_table, linked_id, None)
if not os.path.isdir(curpath):
@@ -54,24 +54,36 @@ class MediaPath():
if f.endswith('.type'):
continue
if f:
filename, ext = os.path.splitext( f )
tmpurl = '/image/%s/%d/%s' % (media_table, linked_id, f)
filelist.append(tmpurl)
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)
return filelist
def get_thumb(self, media_table, linked_id):
def get_thumb(self, media_table, linked_id, MediaType=None):
filelist = list()
curpath = self.get_mediapath(media_table, linked_id, None)
curpath = os.path.join( curpath, 'thumbnails')
if not os.path.isdir(curpath):
return list()
for f in os.listdir(curpath):
filename, ext = os.path.splitext( f )
if os.path.isdir(os.path.join(curpath,f)):
continue
if f.endswith('.type'):
continue
if f:
tmpurl = '/image/%s/%d/thumbnails/%s' % (media_table, linked_id, f)
filelist.append(tmpurl)
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)
return filelist
def get_mediapath(self, media_table, linked_id, name):


Notiek ielāde…
Atcelt
Saglabāt