Changeset 61429 in spip-zone
- Timestamp:
- May 19, 2012, 11:40:08 AM (9 years ago)
- Location:
- _plugins_/hydraulic/branches/v0.3/formulaires
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
_plugins_/hydraulic/branches/v0.3/formulaires/calcul_ouvrages.html
r60951 r61429 11 11 var glob = []; 12 12 13 function initGlob(){ 14 <BOUCLE_globChOuv(POUR){tableau #ENV{saisie_equat}}> 15 glob['#CLE'] = '#ENV{choix_champs_#CLE}'; 16 </BOUCLE_globChOuv> 17 18 <BOUCLE_globSurverse(POUR){tableau #ENV{surverse}}> 19 <BOUCLE_pasLoiDeb(CONDITION){si #CLE|!= {'loi_debit'}}> 20 glob['#CLE'] = '#ENV{choix_champs_#CLE}'; 21 </BOUCLE_pasLoiDeb> 22 </BOUCLE_globSurverse> 23 24 <BOUCLE_globCaractFixes(POUR){tableau #ENV{caract_fixes}}> 25 #SET{caractFixes, #VALEUR|table_valeur{1}} 26 <BOUCLE_siCaractFixes(CONDITION){si #VALEUR|table_valeur{0}|== {'caract_globale'}}> 27 <BOUCLE_Fixes(POUR){tableau #GET{caractFixes}}> 28 glob['#CLE'] = '#ENV{choix_champs_#CLE}'; 29 </BOUCLE_Fixes> 30 </BOUCLE_siCaractFixes> 31 </BOUCLE_globCaractFixes> 32 } 33 34 initGlob(); 13 35 function setVarGlob(){ 14 36 globSelectOuv = getSelectValue('choix_ouvrage'); 15 affSurvCheck = document.getElementById("affSurverse").checked;16 37 for(var i in glob){ 17 38 glob[i] = getRadioValue('choix_champs_'+i); 18 39 } 40 } 41 42 function inArray(array, p_val) { 43 var l = array.length; 44 for(var i = 0; i < l; i++) { 45 if(array[i] == p_val) { 46 return true; 47 } 48 } 49 return false; 19 50 } 20 51 … … 31 62 } 32 63 64 function retourneIndiceSuivant(tabIndice, nom){ 65 var indice = ''; 66 for(var i = 0; i < tabIndice.length; i++){ 67 if(tabIndice[i] == nom){ 68 // Si on est pas arrivé au dernier élément 69 if(i+1 <= tabIndice.length-1){ 70 indice = tabIndice[i+1]; 71 } 72 else{ 73 indice = tabIndice[0]; 74 } 75 } 76 } 77 return indice; 78 } 79 33 80 function affichageEtValeur(){ 34 81 afficher_cacher_champs_select(); … … 65 112 66 113 function afficher_cacher_champs_ouv(){ 67 setVarGlob(); 114 115 for(var i in glob){ 116 if(document.getElementById('varier_val_'+i).checked){ 117 var cacher = elementsParClasse('champs_var_'+i, 'tr'); 118 for(var j in cacher){ 119 cacher[j].style.display='none'; 120 } 121 document.getElementById('val_fixe_'+i).checked=true; 122 document.getElementById('caract_'+i).disabled=false; 123 } 124 if(document.getElementById('calcul_val_'+i).checked){ 125 document.getElementById('val_fixe_'+i).checked=true; 126 } 127 } 128 129 <BOUCLE_initGlob(POUR){tableau #ENV{mes_saisies}}> 130 <BOUCLE_initGlob1(POUR){tableau #VALEUR|table_valeur{1}}> 131 #SET{compteur, #COMPTEUR_BOUCLE} 132 <BOUCLE_premiereVal(CONDITION){si #GET{compteur}|== {1}}> 133 document.getElementById('calcul_val_#CLE').checked=true; 134 </BOUCLE_premiereVal> 135 document.getElementById('val_fixe_#CLE').checked=true; 136 <//B_premiereVal> 137 </BOUCLE_initGlob1> 138 </BOUCLE_initGlob> 139 68 140 var tabOuvrageAfficher = []; 69 141 var tabOuvrageCacher = []; … … 132 204 // Gére le comportement des boutons radios 133 205 function gestion_radios(nom,valeur){ 134 // Ce tableau contiendra tous les indices , ainsi que leur valeur, excepté celle qui a été cliquée 135 var tabPartiel = []; 136 206 tabPartiel = []; 207 tabIndice = []; 208 209 <BOUCLE_chOuv(POUR){tableau #ENV{mes_saisies}}> 210 if(globSelectOuv == '#CLE'){ 211 <BOUCLE_chOuv2(POUR){tableau #VALEUR|table_valeur{1}}> 212 tabPartiel['#CLE'] = '#ENV{choix_champs_#CLE}'; 213 tabIndice.push('#CLE'); 214 </BOUCLE_chOuv2> 215 } 216 </BOUCLE_chOuv> 217 218 if(document.getElementById('affSurverse').checked){ 219 <BOUCLE_surverseCoche(POUR){tableau #ENV{surverse}}> 220 <BOUCLE_pasLoi(CONDITION){si #CLE|!= {'loi_debit'}}> 221 tabPartiel['#CLE'] = '#ENV{choix_champs_#CLE}'; 222 tabIndice.push('#CLE'); 223 </BOUCLE_pasLoi> 224 </BOUCLE_surverseCoche> 225 } 226 227 <BOUCLE_globCaractFixes2(POUR){tableau #ENV{caract_fixes}}> 228 #SET{caractFixes2, #VALEUR|table_valeur{1}} 229 <BOUCLE_siCaractFixes2(CONDITION){si #VALEUR|table_valeur{0}|== {'caract_globale'}}> 230 <BOUCLE_Fixes2(POUR){tableau #GET{caractFixes2}}> 231 tabPartiel['#CLE'] = '#ENV{choix_champs_#CLE}'; 232 tabIndice.push('#CLE'); 233 </BOUCLE_Fixes2> 234 </BOUCLE_siCaractFixes2> 235 </BOUCLE_globCaractFixes2> 236 137 237 // On supprime du tableau l'élément sur lequel on a cliqué 138 238 delete(tabPartiel[nom]); 139 239 140 // Tableau des indices141 var tabIndice = [];142 143 240 if(valeur.substr(0,3) == 'cal'){ 144 /* 145 * Pour toutes les lignes autres que celle passée en paramètre, 146 * on contrôle si il y a déjà une valeur à calculer. 147 * Si oui, alors on fais les modifications adéquates sur les champs: 148 * sélection, visibilité 149 */ 241 document.getElementById('caract_'+nom).disabled=false; 150 242 for(var cle in tabPartiel){ 151 243 if(document.getElementById('calcul_val_'+cle).checked){ 152 244 document.getElementById('val_fixe_'+cle).checked=true; 153 document.getElementById('caract_'+cle).disabled=false;154 document.getElementById('caract_'+nom).disabled=true;155 245 setVarGlob(); 156 246 } 157 247 } 158 248 } 159 249 160 250 // Si on appuit sur un bouton de type "varier_val" ou "val_fixe" 161 251 else if(valeur.substr(0,3) == 'var' || valeur.substr(0,3)=='val'){ … … 164 254 if(document.getElementById('varier_val_'+nom).checked){ 165 255 document.getElementById('val_fixe_'+cle).checked=true; 256 document.getElementById('caract_'+nom).disabled=true; 166 257 } 167 258 setVarGlob(); … … 169 260 else if(document.getElementById('varier_val_'+cle).checked && (glob[nom] == "calcul_val_"+nom) && valeur.substr(0,3) == 'var'){ 170 261 document.getElementById('calcul_val_'+cle).checked=true; 171 document.getElementById('caract_'+cle).disabled=true; 172 document.getElementById('caract_'+nom).disabled=false; 262 document.getElementById('caract_'+cle).disabled=false; 173 263 setVarGlob(); 174 264 } … … 178 268 var cptValCal = 0; 179 269 for(var cle in glob){ 180 if(document.getElementById('calcul_val_'+cle).checked){ 181 cptValCal++; 270 if(inArray(tabIndice, cle)){ 271 if(document.getElementById('calcul_val_'+cle).checked){ 272 cptValCal++; 273 } 182 274 } 183 275 } … … 200 292 // ... et on le met a calcul_val 201 293 document.getElementById('calcul_val_'+indice).checked=true; 294 document.getElementById('caract_'+indice).disabled=false; 202 295 document.getElementById('caract_'+nom).disabled=false; 203 document.getElementById('caract_'+indice).disabled=true;204 296 var cacher = elementsParClasse('champs_var_'+indice, 'tr'); 205 297 for(var i in cacher){ … … 215 307 document.getElementById('caract_'+nom).disabled=true; 216 308 for(var cle in glob){ 217 if(glob[cle].substr(0,3) == 'val'){ 218 document.getElementById('caract_'+cle).disabled=false; 219 } 309 if(inArray(tabIndice, cle)){ 310 if(glob[cle].substr(0,3) == 'val'){ 311 document.getElementById('caract_'+cle).disabled=false; 312 } 313 } 220 314 } 221 315 … … 239 333 var cptVarVal = 0; 240 334 for(var cle in glob){ 241 if(document.getElementById('varier_val_'+cle).checked){ 242 cptVarVal++; 335 if(inArray(tabIndice, cle)){ 336 if(document.getElementById('varier_val_'+cle).checked){ 337 cptVarVal++; 338 } 243 339 } 244 340 } … … 246 342 if(cptVarVal == 0){ 247 343 for(var cle in glob){ 248 if(glob[cle].substr(0,3) != 'cal'){ 249 document.getElementById('caract_'+cle).disabled=false; 250 } 344 if(inArray(tabIndice, cle)){ 345 if(glob[cle].substr(0,3) != 'cal'){ 346 document.getElementById('caract_'+cle).disabled=false; 347 } 348 } 251 349 } 252 350 var cacher = elementsParClasse('champs_var_'+nom, 'tr'); … … 346 444 347 445 <td> 348 <input id="caract_#CLE" type="text" value="#ENV{#CLE}" maxlength="30" name="#CLE" [(#ENV{choix_champs_#CLE}|match{^((calcul_val_#CLE)|(varier_val_#CLE))$}|?{'disabled="true"',''})]/>446 <input id="caract_#CLE" type="text" value="#ENV{#CLE}" maxlength="30" name="#CLE"/> 349 447 [<div class='hyd_erreur'>(#ENV**{erreurs}|table_valeur{#CLE})</div>] 350 448 </td> … … 432 530 433 531 <td> 434 <input id="caract_#CLE" type="text" value="#ENV{#CLE}" maxlength="30" name="#CLE" [(#ENV{choix_champs_#CLE}|match{^((calcul_val_#CLE)|(varier_val_#CLE))$}|?{'disabled="true"',''})]/>532 <input id="caract_#CLE" type="text" value="#ENV{#CLE}" maxlength="30" name="#CLE"/> 435 533 [<div class='hyd_erreur'>(#ENV**{erreurs}|table_valeur{#CLE})</div>] 436 534 </td> … … 489 587 490 588 <td> 491 <input id="caract_#CLE" type="text" value="#ENV{#CLE}" maxlength="30" name="#CLE" [(#ENV{choix_champs_#CLE}|match{^((calcul_val_#CLE)|(varier_val_#CLE))$}|?{'disabled="true"',''})]/>589 <input id="caract_#CLE" type="text" value="#ENV{#CLE}" maxlength="30" name="#CLE"/> 492 590 [<div class='hyd_erreur'>(#ENV**{erreurs}|table_valeur{#CLE})</div>] 493 591 </td> -
_plugins_/hydraulic/branches/v0.3/formulaires/calcul_ouvrages.php
r60951 r61429 118 118 'sTrap' => array( 119 119 'seuil_trap', 120 array( 'LF', ' F', 'CR', 'CT'),120 array( 'LF', 'CR', 'CT', 'F'), 121 121 array(8,9), 122 122 false … … 125 125 'vTrap' => array( 126 126 'vanne_trap', 127 array( 'LF', ' F', 'CR', 'CT'),127 array( 'LF', 'CR', 'CT', 'F'), 128 128 array(8,9), 129 129 true -
_plugins_/hydraulic/branches/v0.3/formulaires/courbe_remous.php
r60709 r61429 108 108 $datas = array(); 109 109 $tChOblig= champs_obligatoires(); 110 110 111 // On vérifie que les champs obligatoires sont bien là : 111 112 foreach($tChOblig as $obligatoire) { … … 122 123 } 123 124 125 // On compte s'il y a des erreurs. Si oui, alors on affiche un message 124 126 if (count($erreurs)) { 125 127 $erreurs['message_erreur'] = _T('hydraulic:saisie_erreur'); -
_plugins_/hydraulic/branches/v0.3/formulaires/lechapt_calmon.php
r60951 r61429 460 460 </table>'; 461 461 462 // Si la première valeur est infinie alors on la supprime et on tasse le tableau462 // Si la première valeur est infinie alors ... 463 463 if(is_infinite($result[0])){ 464 // ... on supprime cette valeur 464 465 unset($result[0]); 466 // ... on tasse le tableau des résultats 465 467 $result = array_values($result); 468 // ... on supprime l'abscisse correspond 466 469 unset($tabAbs[0]); 470 // ... on tasse le tableau des abscisses 467 471 $tabAbs = array_values($tabAbs); 468 472 }
Note: See TracChangeset
for help on using the changeset viewer.