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.
 
 
 
 
 

268 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">Pour modifier le mot de passe actuel,
  155. entrez un nouveau mot de passe dans chacune des deux zones de texte.
  156. </div>
  157. ${ helpers.DisplayForm(form, {}) }
  158. <div id="pswd_info" style="display: block;">
  159. Pour renforcer la sécurité de votre mot de passe :
  160. <ul>
  161. <li id="length" class="invalid">Saisissez au moins 6 caractères</li>
  162. <li id="ltrMin" class="invalid">Ajoutez des lettres minuscules</li>
  163. <li id="ltrMaj" class="invalid">Ajoutez des lettres majuscules</li>
  164. <li id="number" class="invalid">Ajoutez des chiffres</li>
  165. <li id="ponctu" class="invalid">Ajoutez des caractères de ponctuation</li>
  166. </ul>
  167. </div>
  168. </form>
  169. <script>
  170. $('input[type=password]').keyup(function() {
  171. // set password variable
  172. var pswd = $(this).val();
  173. if ( pswd.length < 6 ) {
  174. $('#length').removeClass('valid').addClass('invalid');
  175. } else {
  176. $('#length').removeClass('invalid').addClass('valid');
  177. }
  178. //validate min letter
  179. if ( pswd.match(/[a-z]/) ) {
  180. $('#ltrMin').removeClass('invalid').addClass('valid');
  181. } else {
  182. $('#ltrMin').removeClass('valid').addClass('invalid');
  183. }
  184. //validate capital letter
  185. if ( pswd.match(/[A-Z]/) ) {
  186. $('#ltrMaj').removeClass('invalid').addClass('valid');
  187. } else {
  188. $('#ltrMaj').removeClass('valid').addClass('invalid');
  189. }
  190. //validate number
  191. if ( pswd.match(/\d/) ) {
  192. $('#number').removeClass('invalid').addClass('valid');
  193. } else {
  194. $('#number').removeClass('valid').addClass('invalid');
  195. }
  196. //validate Ponct
  197. var patren=/^[A-Za-z0-9\s]+$/;
  198. if ( !(patren.test(pswd)) && pswd.length>0 ) {
  199. $('#ponctu').removeClass('invalid').addClass('valid');
  200. } else {
  201. $('#ponctu').removeClass('valid').addClass('invalid');
  202. }
  203. });
  204. </script>
  205. </div>
  206. <div class="modal-footer">
  207. <button class="btn" data-dismiss="modal" aria-hidden="true">Annuler</button>
  208. <button class="btn btn-primary" onclick="javascript:document.forms['ModalForm'].submit();">Changer</button>
  209. </div>
  210. </div>
  211. </%def> \
  212. ## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  213. <%
  214. context._kwargs['postpone_js']=[]
  215. %>
  216. %if modtype=='Password':
  217. ${ModalPassword(uid, DisplayYear, session)}
  218. %elif modtype=='Place':
  219. ${ModalAddPlace(form, update)}
  220. %elif modtype=='UserPicture':
  221. ${ModalPictureChange(uid, DisplayYear, session)}
  222. %elif modtype=='PropH':
  223. ${Dialog.AddProposal('H', form)}
  224. %elif modtype=='AskH':
  225. ${Dialog.AddAsk('H', form)}
  226. %elif modtype=='PropC':
  227. ${Dialog.AddProposal('C', form)}
  228. %elif modtype=='AskC':
  229. ${Dialog.AddAsk('C', form)}
  230. %elif modtype=='PropM':
  231. ${Dialog.AddProposal('M', form)}
  232. %elif modtype=='AskM':
  233. ${Dialog.AddAsk('M', form)}
  234. %elif modtype=='ShowC':
  235. ${Dialog.Show('C',Exch)}
  236. %elif modtype=='ShowM':
  237. ${Dialog.Show('M',Exch)}
  238. %elif modtype=='ShowH':
  239. ${Dialog.Show('H',Exch)}
  240. %endif
  241. ## Then Handle Javascript
  242. <script>
  243. % for jsitem in context._kwargs['postpone_js']:
  244. ${jsitem | n}
  245. % endfor
  246. HandleControls();
  247. </script>