<%namespace name="h" file="jm2l:templates/helpers.mako"/> ## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= <%def name="Main(Exchanges)">
${Route_wrapper(Exchanges)}
${Miam_wrapper()}
${Exchange_wrapper('C', Exchanges)}
${Exchange_wrapper('H', Exchanges)}
${Exchange_wrapper('M', Exchanges)}
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= <%def name="Exchange_wrapper(Type, Exchanges)"> <% AllSelection = Exchanges.get_pub_list( Type ) DicExch = Exchanges.get_my_list( request.user.uid, Type ) %> ${Ask(Type, DicExch)} ${Proposal(Type, DicExch)}
Tous les échanges ${Missing(Type, AllSelection)}
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= <%def name="Miam_wrapper()">
Qu'est ce qu'on mange ?
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= <%def name="Missing(Type, Selection)"> <% if Type=='H': CurTitle = u"d'hébergement" CurIcon = "icon-home" elif Type=='C': CurTitle = "de co-voiturage" CurIcon = "icon-road" elif Type=='M': CurTitle = u"de prêt de matériel" CurIcon = "icon-shopping-cart" %> % if len(Selection)==0: % else: % for item in Selection: <% if (item.provider_id and item.asker_id): continue %> % if item.exch_state=='Ask': % elif item.exch_state=='Proposal': % endif % endfor % endif
Les échanges ${CurTitle} % if 0: % endif
Détails
Il n'y a aucun échange ${CurTitle} proposé actuellement...

%if item.asker and item.exch_state=='Ask': ${item.asker.prenom} ${item.asker.nom} demande %elif item.provider and item.exch_state=='Proposal': ${item.provider.prenom} ${item.provider.nom} offre % endif % if item.exch_type=="C": un co-voiturage le ${item.start_time.strftime('%a %d %b vers %Hh%M')} de ${item.Itin.start.display_name} à ${item.Itin.arrival.display_name} % elif item.exch_type=="M": % if item.Category: ${item.Category.exch_subtype} % endif % if item.description: ${item.description[:30]} % endif de ${item.start_time.strftime('%a %d %b %Hh%M')} à ${item.end_time.strftime('%a %d %b %Hh%M')} % else: % if item.Category: ${item.Category.exch_subtype} % endif % if item.description: ${item.description[:30]} % endif ${item.start_time.strftime('%a %d %b')} soir % endif

% if item.provider_id==request.user.uid or item.asker_id==request.user.uid: % elif (item.provider_id and item.asker_id):

## ## ## ## % else:

## ## ## % endif
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= <%def name="Ask(Type, Selection)"> <% if Type=='H': CurTitle = u"d'hébergement" CurIcon = "icon-home" elif Type=='C': CurTitle = "de co-voiturage" CurIcon = "icon-road" elif Type=='M': CurTitle = u"de prêt de matériel" CurIcon = "icon-shopping-cart" %> % if len(Selection['Ask'])==0 and len(Selection['Proposal'])==0: % else: % for type in ['Ask', 'Proposal']: % for item in Selection[type]: <% if item.provider_id==request.user.uid: continue %> % endfor % endfor % endif
Mes demandes ${CurTitle} Ajouter
Vous n'avez fait aucune demande ${CurTitle}
Etat Details
% if item.exch_done:
Validé % elif item.provider_id is None:
Publié % elif item.asker_id==request.user.uid and type=="Ask": Je demande
Proposition % elif item.asker_id==request.user.uid and type=="Proposal": Je demande
%if Type=='C': ${item.start_time.strftime('%A %d %b %Y')} vers ${item.start_time.strftime('%Hh%M')} de ${item.Itin.start.display_name} à ${item.Itin.arrival.display_name} %elif Type=='H': ${item.Category.exch_subtype}, La nuit du ${item.start_time.strftime('%A %d %b %Y')}
%elif Type=='M': de ${item.start_time.strftime('%A %d %b %Y')} vers ${item.start_time.strftime('%Hh%M')} à ${item.end_time.strftime('%A %d %b %Y')} vers ${item.end_time.strftime('%Hh%M')}
${item.Category.exch_subtype} %endif %if item.description: ${item.description} %endif
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= <%def name="Proposal(Type, Selection)"> <% if Type=='H': CurTitle = u"d'hébergement" CurIcon = "icon-home" elif Type=='C': CurTitle = "de co-voiturage" CurIcon = "icon-road" elif Type=='M': CurTitle = u"de prêt de matériel" CurIcon = "icon-shopping-cart" %> % if len(Selection['Ask'])==0 and len(Selection['Proposal'])==0: % else: % for type in ['Ask', 'Proposal']: % for item in Selection[type]: <% if item.asker_id==request.user.uid: continue %> % endfor % endfor % endif
Mes offres ${CurTitle} Ajouter
Vous n'avez fait aucune offre ${CurTitle}
Etat Détails
% if item.exch_done:
Validé % elif item.asker_id is None:
Publié % elif item.provider_id==request.user.uid and type=="Ask": Je propose
Négociation % elif item.provider_id==request.user.uid and type=="Proposal": Je propose
%if Type=='C': ${item.start_time.strftime('%A %d %b %Y')} vers ${item.start_time.strftime('%Hh%M')} de ${item.Itin.start.display_name} à ${item.Itin.arrival.display_name} %elif Type=='H': ${item.Category.exch_subtype}, La nuit du ${item.start_time.strftime('%A %d %b %Y')}
%elif Type=='M': de ${item.start_time.strftime('%A %d %b %Y')} vers ${item.start_time.strftime('%Hh%M')} à ${item.end_time.strftime('%A %d %b %Y')} vers ${item.end_time.strftime('%Hh%M')}
${item.Category.exch_subtype} %endif %if item.description: ${item.description} %endif
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= <%def name="Route_wrapper(Exchanges)"> <% AskSelection = Exchanges.get_my_counters( int(request.user.uid) ) AllSelection = Exchanges.get_counters() ListWrap = ["Co-voiturage",u"Hébergement","Matos"] %>
% for Wrap in ListWrap: <% RecA = filter( lambda (A, B, C, D): A=='Ask' and B==Wrap[0] and C==0, AskSelection ) RecP = filter( lambda (A, B, C, D): A=='Proposal' and B==Wrap[0] and C==0, AskSelection ) RecD = filter( lambda (A, B, C, D): B==Wrap[0] and C==1, AskSelection ) %> % for item in [RecA, RecP, RecD]: % endfor % endfor
Section Mes demandes Mes Propositions Accords
Miam ? - ?
${Wrap | h} % if item: ${item[0][3]} % else: 0 % endif
% for Wrap in ListWrap: <% AllA = filter( lambda (A,B,C,D): A=='Ask' and B==Wrap[0] and C==0, AllSelection ) AllP = filter( lambda (A,B,C,D): A=='Proposal' and B==Wrap[0] and C==0, AllSelection ) AllD = filter( lambda (A,B,C,D): B==Wrap[0] and C==1, AllSelection ) %> % for item in [AllA, AllP, AllD]: % endfor % endfor
Section Les demandes Les propositions Les Accords
Miam ? - ?
${Wrap | h} % if item: ${item[0][3]} % else: 0 % endif
Mon Badge
% if reload: ${Route_wrapper(Exchanges)} ${Exchange_wrapper(Type, Exchanges)} %endif