1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399
| function CreationPage(P_Terrain) {
WTaille1 = "25%";
WTaille2 = "25%";
WFichier = G_RepXML + G_TERRAIN + ".xml";
$(document).ready( function(){
$.ajax( {
type: "GET",
url: WFichier,
dataType: "xml",
error: function (jqXHR, textStatus, errorThrown)
{
alert("Problème avec le fichier XML, veuillez v&érifier le fichier '" + WFichier + "'." + G_CrLf + "Traitement impossible.")
window.close();
},
success: function(xml)
{
$(xml).find('TERRAINS').each(
function() {
var WCode_Terrain = $(this).attr('code_terrain');
var WNom_Terrain = $(this).attr('nom_terrain');
// Application de la classe pour le nom de l'aérodrome.
var ObjTerrain = document.getElementById("Cell_Terrain");
ObjTerrain.className = "Effet3D1";
Cell_Terrain.innerHTML = "Aérodrome de " + WNom_Terrain;
})
var WIndex = 1;
var WIndexTab = 0;
$(xml).find('SECTIONS').find('SECTION').each(
function() {
var WNom_Section = $(this).attr('nom_section');
var WCell_Section = $(this).attr('cell_section');
//Création de la DIV dans la div DIVTAB_00
WDivTAB_00 = document.getElementById("DivTAB_00");
WNomDIV = "DivTAB" + WIndex;
WDiv = document.createElement("div");
WDiv.setAttribute("id", WNomDIV);
WDiv.setAttribute("class", G_CLASSE_TAB);
WDiv.setAttribute("margin-bottom", "150px");
WDivTAB_00.appendChild(WDiv);
WDivID = document.getElementById(WNomDIV);
//Création de la table dans la DIV
WNomTAB = "Tab_PotAG" + WIndex;
WTable = document.createElement("table");
WTable.setAttribute("id", WNomTAB);
WDivID.appendChild(WTable);
// Ajout d'un ligne à la table / 4 colonnes
$('#'+WNomTAB).append($('<tr><td id="' + WCell_Section + '" colspan="4">'+WNom_Section+"</td></tr>"));
$(this).find('ZONE_SAISIE:even').each(
function() {
var WNomChamp1 = $(this).find('NAME').text();
var WNomChamp2 = $(this).next('ZONE_SAISIE').find('NAME').text();
var WLib1 = $(this).find('LIB').text();
var WLib2 = $(this).next('ZONE_SAISIE').find('LIB').text();
var WElement1 = $(this).find('ELEMENT').text();
var WElement2 = $(this).next('ZONE_SAISIE').find('ELEMENT').text();
var WType1 = $(this).find('TYPE').text();
var WType2 = $(this).next('ZONE_SAISIE').find('TYPE').text();
var WSize1 = $(this).find('SIZE').text();
var WSize2 = $(this).next('ZONE_SAISIE').find('SIZE').text();
var WMax_Car1 = $(this).find('MAX_CAR').text();
var WMax_Car2 = $(this).next('ZONE_SAISIE').find('MAX_CAR').text();
var WVal_Min1 = $(this).find('VAL_MIN').text();
var WVal_Min2 = $(this).next('ZONE_SAISIE').find('VAL_MIN').text();
var WVal_Max1 = $(this).find('VAL_MAX').text();
var WVal_Max2 = $(this).next('ZONE_SAISIE').find('VAL_MAX').text();
var WInit1 = $(this).find('VAL_INIT').text();
var WInit2 = $(this).next('ZONE_SAISIE').find('VAL_INIT').text();
var WClasse1 = $(this).find('CLASSE').text();
var WClasse2 = $(this).next('ZONE_SAISIE').find('CLASSE').text();
if (WNomChamp1 != "")
{
WIndexTab = WIndexTab + 1;
G_TAB_NOM[WIndexTab] = WNomChamp1;
G_TAB_TYPE[WIndexTab] = WType1;
G_TAB_VALMIN[WIndexTab] = WVal_Min1;
G_TAB_VALMAX[WIndexTab] = WVal_Max1;
G_TAB_VALINIT[WIndexTab] = WInit1;
G_TAB_SECTION[WIndexTab] = WNom_Section;
G_TAB_IDSECTION[WIndexTab] = WCell_Section;
};
if (WNomChamp2 != "")
{
WIndexTab = WIndexTab + 1;
G_TAB_NOM[WIndexTab] = WNomChamp2;
G_TAB_TYPE[WIndexTab] = WType2;
G_TAB_VALMIN[WIndexTab] = WVal_Min2;
G_TAB_VALMAX[WIndexTab] = WVal_Max2;
G_TAB_VALINIT[WIndexTab] = WInit2;
G_TAB_SECTION[WIndexTab] = WNom_Section;
G_TAB_IDSECTION[WIndexTab] = WCell_Section;
};
...
...
...
var WLigne = "";
if (WNom_Section != "Divers") // Ces sections NE PEUVENT AVOIR QUE DES INPUTs DE TYPE NUMBER
{
...
...
...
}
else // Traitement de la section DIVERS
{
// INSERER ICI LE TRAITEMENT TYPE PAR TYPE DE LA SECTION DIVERS
if (WLib2 != "") // => il y a au moins 2 champs à traiter...
{
if (WElement1 == "INPUT" && WType1 == "number")
{
G_NbINPUT = G_NbINPUT + 1;
WId1 = "Input" + G_NbINPUT;
WLigne = "<tr><td width='"+WTaille1+"'>";
WLigne = WLigne + WLib1 + "</td>";
WTaille = 100 - parseInt(WTaille1) + "%";
WLigne = WLigne + "<td colspan='4' width='" + WTaille + "'>";
WLigne = WLigne + "<input type='"+WType1+"' id='" + WId1 + "' size='"+WSize1+"' class='"+WClasse1+" 'value='"+WInit1+"' ";
// WLigne = WLigne + "placeholder='"+WId1+"' ";
WLigne = WLigne + "min='"+WVal_Min1+"' max='"+WVal_Max1+"' ";
WLimite = "Numbers"; // Indique le type de caractères autorisés dans les INPUTs
WOnKeyPress = " onkeypress='return inputLimiter(event,WLimite)'"; // Seuls les chiffres sont autorisés
WLigne = WLigne + WOnKeyPress;
WOnBlur = " onblur='ControlesINPUT(" + G_NbINPUT + ")'";
WLigne = WLigne + WOnBlur;
WLigne = WLigne + " />";
WLigne = WLigne + WBornes1;
WLigne = WLigne + "</td></tr>";
$('#'+WNomTAB).append($(WLigne));
};
if (WElement1 == "TEXTAREA")
{
G_NbINPUT = G_NbINPUT + 1;
WId1 = "Input" + G_NbINPUT;
WLigne = "<tr><td width='"+WTaille1+"'>";
WLigne = WLigne + WLib1 + "</td>";
WTaille = 100 - parseInt(WTaille1) + "%";
WLigne = WLigne + "<td colspan='4' width='" + WTaille + "'>";
WLig = "rows='" + $(this).find('ELEMENT').attr('LIG') + "' ";
WCol = "cols='" + $(this).find('ELEMENT').attr('COL') + "' ";
WLigne = WLigne + "<textarea id='"+ WId1 + "' " + WLig + WCol + "' class='"+WClasse1+"'";
WLigne = WLigne + ">"; // + WId1;
WLigne = WLigne + "</textarea>";
WLigne = WLigne + "</td></tr>";
$('#'+WNomTAB).append($(WLigne));
};
if (WElement1 == "RADIO3")
{
G_NbINPUT = G_NbINPUT + 1;
WId1 = "Input" + G_NbINPUT;
WLigne = "<tr><td width='"+WTaille1+"'>";
WLigne = WLigne + WLib1 + "</td>";
WTaille = 100 - parseInt(WTaille1) + "%";
WLigne = WLigne + "<td colspan='4' width='" + WTaille + "'>";
WRadio1 = $(this).find('TYPE').attr('RADIO1');
WRadio2 = $(this).find('TYPE').attr('RADIO2');
WRadio3 = $(this).find('TYPE').attr('RADIO3');
WLigne = WLigne + "NON <input type='radio' class='regular-radio big-radio' id='C_Qgo1' name='" + WId1 + "' value='" + WRadio1 +"' checked>";
WLigne = WLigne + "<label for='C_Qgo1'></label>";
WLigne = WLigne + "OUI <input type='radio' class='regular-radio big-radio' id='C_Qgo2' name='" + WId1 + "' value='" + WRadio2 + "' >";
WLigne = WLigne + "<label for='C_Qgo2'></label>";
WLigne = WLigne + "PARTIEL <input type='radio' class='regular-radio big-radio' id='C_Qgo3' name='" + WId1 + "' value='" + WRadio3 + "'>";
WLigne = WLigne + "<label for='C_Qgo3'></label>";
var WInfo = "<span class='" + G_CLASSE_INFO + "'> (Choisissez une option) </span>";
WLigne = WLigne + WInfo;
WLigne = WLigne + "</td></tr>";
$('#'+WNomTAB).append($(WLigne));
};
if (WElement1 == "SELECT")
{
G_NbINPUT = G_NbINPUT + 1;
WId1 = "Input" + G_NbINPUT;
WLigne = "<tr><td width='"+WTaille1+"'>";
WLigne = WLigne + WLib1 + "</td>";
WTaille = 100 - parseInt(WTaille1) + "%";
WNb_Option = $(this).find('TYPE').attr('NB_OPTION');
WSelected = WInit1;
WLigne = WLigne + "<td colspan='4' width='" + WTaille + "'>";
WLigne = WLigne + "<select id='" + WId1 + "'>";
tt = 1;
while (tt <= WNb_Option)
{
WNomOption = "OPTION" + tt;
WValOption = $(this).find(WNomOption).text();
if (tt == WSelected)
{
WLigne = WLigne + "<option value='" + WValOption + "' selected>" + WValOption + "</option>";
}
else
{
WLigne = WLigne + "<option value='" + WValOption + "'>" + WValOption + "</option>";
};
tt = tt + 1;
};
WLigne = WLigne + "</select>";
var WInfo = "<span class='" + G_CLASSE_INFO + "'> (Choisissez un QFU) </span>";
WLigne = WLigne + WInfo;
WLigne = WLigne + "</td></tr>";
$('#'+WNomTAB).append($(WLigne));
// Ca ne fonctionne pas non plus !!!
WTab = document.createElement(WNomTAB);
WTab.setAttribute("align", "left");
};
if (WElement2 == "INPUT" && WType2 == "number")
{
G_NbINPUT = G_NbINPUT + 1;
WId2 = "Input" + G_NbINPUT;
WLigne = "<tr><td width='"+WTaille2+"'>";
WLigne = WLigne + WLib2 + "</td>";
WTaille = 100 - parseInt(WTaille2) + "%";
WLigne = WLigne + "<td colspan='4' width='" + WTaille + "'>";
WLigne = WLigne + "<input type='"+WType2+"' id='" + WId2 + "' size='"+WSize2+"' class='"+WClasse2+" 'value='"+WInit2+"' ";
// WLigne = WLigne + "placeholder='"+WId2+"' ";
WLigne = WLigne + "min='"+WVal_Min2+"' max='"+WVal_Max2+"' ";
WLimite = "Numbers"; // Indique le type de caractères autorisés dans les INPUTs
WOnKeyPress = " onkeypress='return inputLimiter(event,WLimite)'"; // Seuls les chiffres sont autorisés
WLigne = WLigne + WOnKeyPress;
WOnBlur = " onblur='ControlesINPUT(" + G_NbINPUT + ")'";
WLigne = WLigne + WOnBlur;
WLigne = WLigne + " />";
WLigne = WLigne + WBornes2;
WLigne = WLigne + "</td></tr>";
$('#'+WNomTAB).append($(WLigne));
};
if (WElement2 == "TEXTAREA")
{
G_NbINPUT = G_NbINPUT + 1;
WId2 = "Input" + G_NbINPUT;
WLigne = "<tr><td width='"+WTaille2+"'>";
WLigne = WLigne + WLib2 + "</td>";
WTaille = 100 - parseInt(WTaille2) + "%";
WLigne = WLigne + "<td colspan='4' width='" + WTaille + "'>";
WLig = "rows='" + $(this).next('ZONE_SAISIE').find('ELEMENT').attr('LIG') + "' ";
WCol = "cols='" + $(this).next('ZONE_SAISIE').find('ELEMENT').attr('COL') + "' ";
WLigne = WLigne + "<textarea id='"+ WId2 + "' " + WLig + WCol + "' class='"+WClasse2+"'";
WLigne = WLigne + ">"; // + WId2;
WLigne = WLigne + "</textarea>";
WLigne = WLigne + "</td></tr>";
$('#'+WNomTAB).append($(WLigne));
};
if (WElement2 == "RADIO3")
{
G_NbINPUT = G_NbINPUT + 1;
WId2 = "Input" + G_NbINPUT;
WLigne = "<tr><td width='"+WTaille2+"'>";
WLigne = WLigne + WLib2 + "</td>";
WTaille = 100 - parseInt(WTaille2) + "%";
WLigne = WLigne + "<td colspan='4' width='" + WTaille + "'>";
WRadio1 = $(this).next('ZONE_SAISIE').find('TYPE').attr('RADIO1');
WRadio2 = $(this).next('ZONE_SAISIE').find('TYPE').attr('RADIO2');
WRadio3 = $(this).next('ZONE_SAISIE').find('TYPE').attr('RADIO3');
WLigne = WLigne + "<input type='radio' id='C_Qgo1' name='" + WId2 + "' value='" + WRadio1 +"' checked />";
WLigne = WLigne + "<label for='C_Qgo1'>" + WRadio1 + "</label> ";
WLigne = WLigne + "<input type='radio' id='C_Qgo2' name='" + WId2 + "' value='" + WRadio2 + "' />";
WLigne = WLigne + "<label for='C_Qgo2'>" + WRadio2 + "</label> ";
WLigne = WLigne + "<input type='radio' id='C_Qgo3' name='" + WId2 + "' value='" + WRadio3 + "' />";
WLigne = WLigne + "<label for='C_Qgo3'>" + WRadio3 + "</label>";
// var WInfo = "<span class='" + G_CLASSE_INFO + "'> (Choisissez une option) </span>";
// WLigne = WLigne + WInfo;
WLigne = WLigne + "</td></tr>";
$('#'+WNomTAB).append($(WLigne));
};
if (WElement2 == "SELECT")
{
G_NbINPUT = G_NbINPUT + 1;
WId2 = "Input" + G_NbINPUT;
WLigne = "<tr><td width='"+WTaille2+"'>";
WLigne = WLigne + WLib2 + "</td>";
WTaille = 100 - parseInt(WTaille2) + "%";
WNb_Option = $(this).next('ZONE_SAISIE').find('TYPE').attr('NB_OPTION');
WSelected = WInit2;
WLigne = WLigne + "<td colspan='4' width='" + WTaille + "'>";
WLigne = WLigne + "<select id='" + WId2 + "'>";
tt = 1;
while (tt <= WNb_Option)
{
WNomOption = "OPTION" + tt;
WValOption = $(this).next('ZONE_SAISIE').find(WNomOption).text();
if (tt == WSelected)
{
WLigne = WLigne + "<option value='" + WValOption + "' selected>" + WValOption + "</option>";
}
else
{
WLigne = WLigne + "<option value='" + WValOption + "'>" + WValOption + "</option>";
};
tt = tt + 1;
};
WLigne = WLigne + "</select>";
var WInfo = "<span class='" + G_CLASSE_INFO + "'> (Choisissez un QFU) </span>";
WLigne = WLigne + WInfo;
WLigne = WLigne + "</td></tr>";
$('#'+WNomTAB).append($(WLigne));
};
}
else // => il n'y a qu'un seul champ à traiter
{
if (WElement1 == "INPUT" && WType1 == "number")
{
G_NbINPUT = G_NbINPUT + 1;
WId1 = "Input" + G_NbINPUT;
WLigne = "<tr><td width='"+WTaille1+"'>";
WLigne = WLigne + WLib1 + "</td>";
WTaille = 100 - parseInt(WTaille1) + "%";
WLigne = WLigne + "<td colspan='4' width='" + WTaille + "'>";
WLigne = WLigne + "<input type='"+WType1+"' id='" + WId1 + "' size='"+WSize1+"' class='"+WClasse1+" 'value='"+WInit1+"' ";
// WLigne = WLigne + "placeholder='"+WId1+"' ";
WLigne = WLigne + "min='"+WVal_Min1+"' max='"+WVal_Max1+"' ";
WLimite = "Numbers"; // Indique le type de caractères autorisés dans les INPUTs
WOnKeyPress = " onkeypress='return inputLimiter(event,WLimite)'"; // Seuls les chiffres sont autorisés
WLigne = WLigne + WOnKeyPress;
WOnBlur = " onblur='ControlesINPUT(" + G_NbINPUT + ")'";
WLigne = WLigne + WOnBlur;
WLigne = WLigne + " />";
WLigne = WLigne + WBornes1;
WLigne = WLigne + "</td></tr>";
$('#'+WNomTAB).append($(WLigne));
};
if (WElement1 == "TEXTAREA")
{
G_NbINPUT = G_NbINPUT + 1;
WId1 = "Input" + G_NbINPUT;
WLigne = "<tr><td width='"+WTaille1+"'>";
WLigne = WLigne + WLib1 + "</td>";
WTaille = 100 - parseInt(WTaille1) + "%";
WLigne = WLigne + "<td colspan='4' width='" + WTaille + "'>";
WLig = "rows='" + $(this).find('ELEMENT').attr('LIG') + "' ";
WCol = "cols='" + $(this).find('ELEMENT').attr('COL') + "' ";
WLigne = WLigne + "<textarea id='"+ WId1 + "' " + WLig + WCol + "' class='"+WClasse1+"'";
WLigne = WLigne + ">"; // + WId1;
WLigne = WLigne + "</textarea>";
WLigne = WLigne + "</td></tr>";
$('#'+WNomTAB).append($(WLigne));
};
if (WElement1 == "RADIO3")
{
G_NbINPUT = G_NbINPUT + 1;
WId1 = "Input" + G_NbINPUT;
WLigne = "<tr><td width='"+WTaille1+"'>";
WLigne = WLigne + WLib1 + "</td>";
WTaille = 100 - parseInt(WTaille1) + "%";
WLigne = WLigne + "<td colspan='4' width='" + WTaille + "'>";
WRadio1 = $(this).find('TYPE').attr('RADIO1');
WRadio2 = $(this).find('TYPE').attr('RADIO2');
WRadio3 = $(this).find('TYPE').attr('RADIO3');
WLigne = WLigne + "NON <input type='radio' class='regular-radio big-radio' id='C_Qgo1' name='" + WId1 + "' value='" + WRadio1 +"' checked>";
WLigne = WLigne + "<label for='C_Qgo1'></label>";
WLigne = WLigne + "OUI <input type='radio' class='regular-radio big-radio' id='C_Qgo2' name='" + WId1 + "' value='" + WRadio2 + "' >";
WLigne = WLigne + "<label for='C_Qgo2'></label>";
WLigne = WLigne + "PARTIEL <input type='radio' class='regular-radio big-radio' id='C_Qgo3' name='" + WId1 + "' value='" + WRadio3 + "'>";
WLigne = WLigne + "<label for='C_Qgo3'></label>";
var WInfo = "<span class='" + G_CLASSE_INFO + "'> (Choisissez une option) </span>";
WLigne = WLigne + WInfo;
WLigne = WLigne + "</td></tr>";
$('#'+WNomTAB).append($(WLigne));
};
if (WElement1 == "SELECT")
{
G_NbINPUT = G_NbINPUT + 1;
WId1 = "Input" + G_NbINPUT;
WLigne = "<tr><td width='"+WTaille1+"'>";
WLigne = WLigne + WLib1 + "</td>";
WTaille = 100 - parseInt(WTaille1) + "%";
WNb_Option = $(this).find('TYPE').attr('NB_OPTION');
WSelected = WInit1;
WLigne = WLigne + "<td colspan='4' width='" + WTaille + "'>";
WLigne = WLigne + "<select id='" + WId1 + "'>";
tt = 1;
while (tt <= WNb_Option)
{
WNomOption = "OPTION" + tt;
WValOption = $(this).find(WNomOption).text();
if (tt == WSelected)
{
WLigne = WLigne + "<option value='" + WValOption + "' selected>" + WValOption + "</option>";
}
else
{
WLigne = WLigne + "<option value='" + WValOption + "'>" + WValOption + "</option>";
};
tt = tt + 1;
};
WLigne = WLigne + "</select>";
var WInfo = "<span class='" + G_CLASSE_INFO + "'> (Choisissez un QFU) </span>";
WLigne = WLigne + WInfo;
WLigne = WLigne + "</td></tr>";
$('#'+WNomTAB).append($(WLigne));
};
};
};
})
WIndex = WIndex + 1;
})
} // FIN SUCCES
});
});
} |
Partager