Le repo des sources pour le site web des JM2L
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

269 lines
11 KiB

  1. <%namespace name="Dialog" file="jm2l:templates/Logistique/Dialog.mako"/> \
  2. <%namespace name="helpers" file="jm2l:templates/helpers.mako"/>
  3. ## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  4. <%def name="ModalAddPlace(form, update)">
  5. <div>
  6. <div class="modal-header">
  7. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
  8. % if update:
  9. <h3>Mettre à jour un lieu</h3>
  10. % else:
  11. <h3>Ajouter un lieu</h3>
  12. % endif
  13. </div>
  14. <div class="modal-body">
  15. <div class="tabbable" id="place_tab">
  16. <ul class="nav nav-tabs">
  17. <li class="active"><a href="#Place_Address" id="Map_Address" data-toggle="tab">Adresse</a></li>
  18. <li><a href="#Place_Info" id="Map_Info" data-toggle="tab">Informations</a></li>
  19. % if update:
  20. <li><a href="#Place_Photo" id="Map_Photo" data-toggle="tab">Photographies</a></li>
  21. % endif
  22. <li><a href="#Place_Plan" id="Map_Plan" data-toggle="tab">Plan</a></li>
  23. </ul>
  24. ${form.csrf_token}
  25. <div class="tab-content">
  26. <div class="tab-pane fade active in" id="Place_Address">
  27. % if update:
  28. <form id="ModalPlaceForm" action="javascript:DoPostLieu('/2015/modal/Place/${form.place_id.data}');" style='margin:0;'>
  29. ${form.place_id()}
  30. ${form.csrf_token}
  31. % else:
  32. <form id="ModalPlaceForm" action="javascript:DoPostLieu('/2015/modal/Place/0');" style='margin:0;'>
  33. ${form.csrf_token}
  34. % endif
  35. <div style="float:left;padding-right:5px;">
  36. % for error in form.place_type.errors:
  37. <div class="error">${ error }</div>
  38. % endfor
  39. <label>${form.place_type.label}</label>${form.place_type(style='width:8em')}</div>
  40. <div style="float:left;padding-right:5px;">
  41. % for error in form.display_name.errors:
  42. <div class="error">${ error }</div>
  43. % endfor
  44. <label>${form.display_name.label}</label>${form.display_name(style='width:10em')}</div>
  45. <div>
  46. % for error in form.name.errors:
  47. <div class="error">${ error }</div>
  48. % endfor
  49. <label>${form.name.label}</label>${form.name(style='width:16em')}</div>
  50. <div>
  51. % for error in form.adresse.errors:
  52. <div class="error">${ error }</div>
  53. % endfor
  54. <label>${form.adresse.label}</label>${form.adresse(style='width:95%;height:3em;')}</div>
  55. <div style="float:left;padding-right:5px;">
  56. % for error in form.codePostal.errors:
  57. <div class="error">${ error }</div>
  58. % endfor
  59. <label>${form.codePostal.label}</label>${form.codePostal(style='width:5em')}</div>
  60. <div style="float:left;padding-right:5px;">
  61. % for error in form.ville.errors:
  62. <div class="error">${ error }</div>
  63. % endfor
  64. <label>${form.ville.label}</label>${form.ville(style='width:12em')}</div>
  65. <div>
  66. % for error in form.gps_coord.errors:
  67. <div class="error">${ error }</div>
  68. % endfor
  69. <label>${form.gps_coord.label}</label>${form.gps_coord(style='width:12em')}</div>
  70. </form>
  71. </div>
  72. <div class="tab-pane fade in" id="Place_Info">
  73. <div>
  74. % for error in form.website.errors:
  75. <div class="error">${ error }</div>
  76. % endfor
  77. <label>${form.website.label}</label>${form.website(style='width:95%;')}</div>
  78. <div>
  79. % for error in form.description.errors:
  80. <div class="error">${ error }</div>
  81. % endfor
  82. <label>${form.description.label}</label>${form.description(style='width:95%;height:10em;')}</div>
  83. </div>
  84. <div class="tab-pane fade in" id="Place_Plan">
  85. %if form.gps_coord.data:
  86. <div id="map"></div>
  87. <script type="text/javascript">
  88. var map = L.map('map');
  89. // create the tile layer with correct attribution
  90. var osmUrl='http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
  91. var osmAttrib='Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors';
  92. var osm = new L.TileLayer(osmUrl, {minZoom: 8, maxZoom: 18, attribution: osmAttrib});
  93. // start the map on specified GPS Coords
  94. map.setView(new L.LatLng(${form.gps_coord.data}),15);
  95. marker = L.marker([${form.gps_coord.data}]).addTo(map);
  96. map.addLayer(osm);
  97. </script>
  98. %else:
  99. <div class="alert">
  100. <button type="button" class="close" data-dismiss="alert">&times;</button>
  101. <strong>Non disponible!</strong> Vous devez d'abord compléter le champs GPS pour activer cette fonctionalité.
  102. </div>
  103. %endif
  104. </div>
  105. % if update:
  106. <div class="tab-pane fade in" id="Place_Photo">
  107. ${helpers.uploader("place", form.place_id.data, "une Photo")}
  108. <div style="clear:both"></div>
  109. </div>
  110. % endif
  111. </div>
  112. </div>
  113. ##${helpers.uploader_js()}
  114. <script>
  115. $("#place_type").select2({});
  116. </script>
  117. </div>
  118. <div class="modal-footer">
  119. <button class="btn" data-dismiss="modal" aria-hidden="true">Annuler</button>
  120. ##<button class="btn btn-warning" data-loading-text="Suppression...">Supprimer l'image</button>
  121. <button class="btn btn-primary" onclick="javascript:document.forms['ModalPlaceForm'].submit();">Enregistrer les modifications</button>
  122. </div>
  123. </div>
  124. </%def> \
  125. ## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  126. <%def name="ModalPictureChange(uid, DisplayYear, session)">
  127. <div>
  128. <div class="modal-header">
  129. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
  130. <h3 id="myModalPictureChangeLabel">Mon portrait</h3>
  131. </div>
  132. <div class="modal-body">
  133. <div>
  134. <i class="icon-question-sign"></i>
  135. Les images de taille supérieure à 300x300 pixels seront redimensionnés.
  136. </div>
  137. ${helpers.uploader("users", uid, "une Photo")}
  138. </div>
  139. <div class="modal-footer">
  140. <button class="btn" data-dismiss="modal" aria-hidden="true">Annuler</button>
  141. <button class="btn btn-primary" onclick="javascript:DoPost('/2015/modal/UserPicture/${uid}');">Enregistrer les modifications</button>
  142. </div>
  143. </div>
  144. </%def> \
  145. ## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  146. <%def name="ModalPassword(uid, DisplayYear, session)"> \
  147. <div>
  148. <div class="modal-header">
  149. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
  150. <h3>Changer mon mot de passe</h3>
  151. </div>
  152. <div class="modal-body">
  153. <form id="ModalForm" action="javascript:DoPost('/2015/modal/Password/${uid}');" style='margin:0;'>
  154. <div class="description">Votre identifiant est <b>${request.user.slug}</b>
  155. <div class="description">Pour modifier le mot de passe actuel,
  156. entrez un nouveau mot de passe dans chacune des deux zones de texte.
  157. </div>
  158. ${ helpers.DisplayForm(form, {}) }
  159. <div id="pswd_info" style="display: block;">
  160. Pour renforcer la sécurité de votre mot de passe :
  161. <ul>
  162. <li id="length" class="invalid">Saisissez au moins 6 caractères</li>
  163. <li id="ltrMin" class="invalid">Ajoutez des lettres minuscules</li>
  164. <li id="ltrMaj" class="invalid">Ajoutez des lettres majuscules</li>
  165. <li id="number" class="invalid">Ajoutez des chiffres</li>
  166. <li id="ponctu" class="invalid">Ajoutez des caractères de ponctuation</li>
  167. </ul>
  168. </div>
  169. </form>
  170. <script>
  171. $('input[type=password]').keyup(function() {
  172. // set password variable
  173. var pswd = $(this).val();
  174. if ( pswd.length < 6 ) {
  175. $('#length').removeClass('valid').addClass('invalid');
  176. } else {
  177. $('#length').removeClass('invalid').addClass('valid');
  178. }
  179. //validate min letter
  180. if ( pswd.match(/[a-z]/) ) {
  181. $('#ltrMin').removeClass('invalid').addClass('valid');
  182. } else {
  183. $('#ltrMin').removeClass('valid').addClass('invalid');
  184. }
  185. //validate capital letter
  186. if ( pswd.match(/[A-Z]/) ) {
  187. $('#ltrMaj').removeClass('invalid').addClass('valid');
  188. } else {
  189. $('#ltrMaj').removeClass('valid').addClass('invalid');
  190. }
  191. //validate number
  192. if ( pswd.match(/\d/) ) {
  193. $('#number').removeClass('invalid').addClass('valid');
  194. } else {
  195. $('#number').removeClass('valid').addClass('invalid');
  196. }
  197. //validate Ponct
  198. var patren=/^[A-Za-z0-9\s]+$/;
  199. if ( !(patren.test(pswd)) && pswd.length>0 ) {
  200. $('#ponctu').removeClass('invalid').addClass('valid');
  201. } else {
  202. $('#ponctu').removeClass('valid').addClass('invalid');
  203. }
  204. });
  205. </script>
  206. </div>
  207. <div class="modal-footer">
  208. <button class="btn" data-dismiss="modal" aria-hidden="true">Annuler</button>
  209. <button class="btn btn-primary" onclick="javascript:document.forms['ModalForm'].submit();">Changer</button>
  210. </div>
  211. </div>
  212. </%def> \
  213. ## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  214. <%
  215. context._kwargs['postpone_js']=[]
  216. %>
  217. %if modtype=='Password':
  218. ${ModalPassword(uid, DisplayYear, session)}
  219. %elif modtype=='Place':
  220. ${ModalAddPlace(form, update)}
  221. %elif modtype=='UserPicture':
  222. ${ModalPictureChange(uid, DisplayYear, session)}
  223. %elif modtype=='PropH':
  224. ${Dialog.AddProposal('H', form)}
  225. %elif modtype=='AskH':
  226. ${Dialog.AddAsk('H', form)}
  227. %elif modtype=='PropC':
  228. ${Dialog.AddProposal('C', form)}
  229. %elif modtype=='AskC':
  230. ${Dialog.AddAsk('C', form)}
  231. %elif modtype=='PropM':
  232. ${Dialog.AddProposal('M', form)}
  233. %elif modtype=='AskM':
  234. ${Dialog.AddAsk('M', form)}
  235. %elif modtype=='ShowC':
  236. ${Dialog.Show('C',Exch)}
  237. %elif modtype=='ShowM':
  238. ${Dialog.Show('M',Exch)}
  239. %elif modtype=='ShowH':
  240. ${Dialog.Show('H',Exch)}
  241. %endif
  242. ## Then Handle Javascript
  243. <script>
  244. % for jsitem in context._kwargs['postpone_js']:
  245. ${jsitem | n}
  246. % endfor
  247. HandleControls();
  248. </script>