source: admin/WebConsole/asistentes/jscripts/asistentes.js @ 4ff56c5

918-git-images-111dconfigfileconfigure-oglivegit-imageslgromero-new-oglivemainmaint-cronmount-efivarfsmultivmmultivm-ogboot-installerogClonningEngineogboot-installer-jenkinsoglive-ipv6test-python-scriptsticket-301ticket-50ticket-50-oldticket-577ticket-585ticket-611ticket-612ticket-693ticket-700ubu24tplunification2use-local-agent-oglivevarios-instalacionwebconsole3
Last change on this file since 4ff56c5 was a710997, checked in by albertogp <albertogp@…>, 11 years ago

Corrigiendo errores de declaracion de la variable command
#666

git-svn-id: https://opengnsys.es/svn/branches/version1.0@4453 a21b9725-9963-47de-94b9-378ad31fedc9

  • Property mode set to 100644
File size: 20.9 KB
Line 
1// ***********************************************************************************************************
2// Libreria de scripts de Javascript
3// Autor:
4// Fecha Creación: 2011
5// Fecha Última modificación: enero-2011
6// Nombre del fichero: asistentes.js
7// Descripción :
8//              Este fichero implementa las funciones javascript del fichero AsistentesEjecutarScripts.php (Comandos)
9// ***********************************************************************************************************
10
11function codeCloneRemotePartition(form){
12var command ;
13switch (form.idmetodo.value)
14{
15        case "MULTICAST":
16                protocol="MULTICAST " + form.mcastpuerto.value  + ":" + form.mcastmodo.value + ":" + form.mcastdireccion.value + ":" + form.mcastvelocidad.value + "M:" + form.mcastnclien.value + ":" + form.mcastseg.value + " ";
17                break;
18        case "UNICAST":
19                protocol="UNICAST " +  form.ucastport.value + ":" + form.ucastclient.value + " ";
20                break;
21}
22//form.codigo.value="cloneRemoteFromMaster " + form.ipMaster.value + " 1 " + form.PartOrigen.value + "  " + form.mcastpuerto.value  + ":" + form.mcastmodo.value + ":" + form.mcastdireccion.value + ":" + form.mcastvelocidad.value + "M:" + form.mcastnclien.value + ":" + form.mcastseg.value + " 1 " + form.PartOrigen.value + " " + form.tool.value + " " + form.compresor.value;
23command="cloneRemoteFromMaster " + form.ipMaster.value + " " + form.source.value + "  " + protocol  + " " + form.targetpart.value + " " + form.tool.value + " " + form.compresor.value;
24form.codigo.value="\
25ogEcho log session \"[0] $MSG_SCRIPTS_TASK_START " + command + "\"\n \
26ogExecAndLog command " + command + " \n ";
27}
28
29function codeDeployImage(form){
30switch (form.idmetodo.value)
31{
32        case "MULTICAST":
33                protocol="MULTICAST " + form.mcastpuerto.value  + ":" + form.mcastmodo.value + ":" + form.mcastdireccion.value + ":" + form.mcastvelocidad.value + "M:" + form.mcastnclien.value + ":" + form.mcastseg.value + " ";
34                break;
35        case "TORRENT":
36                protocol=" TORRENT " +  form.modp2p.value + ":" + form.timep2p.value;
37                break;
38        case "UNICAST":
39                protocol=" UNICAST";
40                break;
41}
42//form.codigo.value="deployImage REPO /";
43if (form.modo[0].checked)
44{
45        // UHU - Distinguimos entre disco y particion, el valor de idparticion sera disco;particion. eje. 1;1
46        var diskPart = form.idparticion.value.split(";");
47        command="deployImage REPO /" + form.idimagen.value + " "+diskPart[0]+" " + diskPart[1] + " " + protocol  ;
48        form.codigo.value="\
49ogEcho log session \"[0] $MSG_SCRIPTS_TASK_START " + command + "\"\n \ " +
50command + " \n";
51        //form.codigo.value="deployImage REPO /" + form.idimagen.value + " 1 " + form.idparticion.value + " " + protocol  ;
52}
53else
54{
55        command="updateCache REPO /" + form.idimagen.value + ".img" + " " + protocol  ;
56        form.codigo.value="\
57ogEcho log session \"[0] $MSG_SCRIPTS_TASK_START " + command +"\"\n \ " +
58command + " \n";
59        //form.codigo.value="updateCache REPO /" + form.idimagen.value + ".img" + " " + protocol  ;
60}
61
62}
63
64function codeParticionado(form){
65        var errorMsg = "¡El espacio libre en disco no puede ser menor que 0!";
66        var n_disk = form.n_disk.value;
67        var tipo_part_table = form.tipo_part_table.value;
68        // Comprobamos si la opcion elejida es GPT o MSDOS para llamar a una funcion u otra
69        if(tipo_part_table == "GPT"){
70                // Comprobamos que el espacio libre en el disco no sea negativo, si lo es, dar aviso
71                if(parseInt(document.getElementById("freediskGPT").value) < 0){
72                        alert(errorMsg);
73                }
74                else{
75                        codeParticionadoGPT(form);
76                }
77        }
78        else{
79                // Comprobamos que el espacio libre en el disco no sea negativo, si lo es, dar aviso
80                if(parseInt(document.getElementById("freedisk").value) < 0){
81                        alert(errorMsg);
82                }
83                else{
84                        codeParticionadoMSDOS(form);
85                }
86        }
87       
88}
89
90
91function codeParticionadoMSDOS (form) {
92        var partCode="";
93        var logicalCode="";
94        var cacheCode;
95        var cacheSize;
96        var extended=false;
97        var n_disk = form.n_disk.value;
98        var tipo_part_table = form.tipo_part_table.value;
99        var maxParts = 4;
100       
101        // Comprobamos si esta seleccionada la cuarta particion y no es CACHE
102        if(form.check4.checked && form.part4.value != "CACHE")
103                maxParts = 5;
104
105        for (var nPart=1; nPart<maxParts; nPart++) {
106                var partCheck=eval("form.check"+nPart);
107                if (partCheck.checked) {
108                        var partType=eval("form.part"+nPart);
109                        if (partType.value == "CUSTOM" ) {
110                                var partTypeCustom=eval("form.part"+nPart+"custom");
111                                partCode += " " + partTypeCustom.value;
112                                if (partTypeCustom.value == "EXTENDED") {
113                                        extended=true;
114                                }
115                        } else {
116                                partCode += " " + partType.value;
117                                if (partType.value == "EXTENDED") {
118                                        extended=true;
119                                }
120                        }
121                        var partSize=eval("form.size"+nPart);
122                        if (partSize.value == "CUSTOM" ) {
123                                var partSizeCustom=eval("form.size"+nPart+"custom");
124                                partCode += ":" + partSizeCustom.value;
125                        } else {
126                                partCode += ":" + partSize.value;
127                        }
128                } else {
129                        partCode += " EMPTY:0";
130                }
131        }
132
133        var cacheCode="";
134
135        // Si se selecciono la particion 4 y es CACHE
136        if(form.part4.value == "CACHE"){
137                if (form.check4.checked) {
138                        if (form.size4.value == "0") {
139                                cacheCode="\
140ogEcho session \"[20] $MSG_HELP_ogGetCacheSize\"\n \
141sizecache=`ogGetCacheSize` \n \
142ogEcho session \"[30] $MSG_HELP_ogUpdatePartitionTable "+n_disk+"\"\n \
143ogDeletePartitionTable "+n_disk+" \n \
144ogExecAndLog command ogUpdatePartitionTable "+n_disk+" \n \
145ogEcho session \"[50] $MSG_HELP_ogCreateCache\"\n \
146initCache "+n_disk+" $sizecache  &>/dev/null \n ";             
147                        } else {
148                                if (form.size4.value == "CUSTOM") {
149                                        cacheSize = form.size4custom.value;
150                                } else {
151                                        cacheSize = form.size4.value;
152                                }
153                                cacheCode="\
154ogEcho session \"[30] $MSG_HELP_ogUpdatePartitionTable "+n_disk+"\"\n \
155ogDeletePartitionTable "+n_disk+" \n \
156ogUpdatePartitionTable "+n_disk+" \n \
157ogEcho session \"[50] $MSG_HELP_ogCreateCache\"\n \
158initCache " + n_disk + " " + cacheSize + " &>/dev/null";       
159                        }
160                } else {
161                        cacheCode="\
162ogEcho session \"[30] $MSG_HELP_ogUpdatePartitionTable "+n_disk+"\"\n \
163ogDeletePartitionTable "+n_disk+" \n \
164ogUpdatePartitionTable "+n_disk+" \n";
165partCode += " EMPTY:0";
166                }
167        }
168
169        if (extended) {
170                var lastLogical=5;
171                for (var nPart=9; nPart>5; nPart--) {
172                        if (eval ("form.check"+nPart+".checked")) {
173                                lastLogical = nPart;
174                                break;
175                        }
176                }
177                for (var nPart=5; nPart<=lastLogical; nPart++) {
178                        var partCheck=eval("form.check"+nPart);
179                        if (partCheck.checked) {
180                                var partType=eval("form.part"+nPart);
181                                if (partType.value == "CUSTOM" ) {
182                                        var partTypeCustom=eval("form.part"+nPart+"custom");
183                                        logicalCode += " " + partTypeCustom.value;
184                                } else {
185                                        logicalCode += " " + partType.value;
186                                }
187                                var partSize=eval("form.size"+nPart);
188                                if (partSize.value == "CUSTOM" ) {
189                                        var partSizeCustom=eval("form.size"+nPart+"custom");
190                                        logicalCode += ":" + partSizeCustom.value;
191                                } else {
192                                        logicalCode += ":" + partSize.value;
193                                }
194                        } else {
195                                logicalCode += " EMPTY:0";
196                        }
197                }
198                partCode += logicalCode;
199        }
200
201        form.codigo.value="\
202ogCreatePartitionTable "+n_disk+" "+tipo_part_table +" \n \
203ogEcho log session \"[0]  $MSG_HELP_ogCreatePartitions \"\n \
204ogEcho session \"[10] $MSG_HELP_ogUnmountAll "+n_disk+"\"\n \
205ogUnmountCache \n \
206ogUnmountAll "+n_disk+" 2>/dev/null\n  \
207" + cacheCode + " \n \
208ogEcho session \"[60] $MSG_HELP_ogListPartitions "+n_disk+"\"\n \
209ogExecAndLog command session ogListPartitions "+n_disk+" \n \
210ogEcho session \"[70] $MSG_HELP_ogCreatePartitions  " + partCode + "\"\n \
211ogExecAndLog command ogCreatePartitions "+n_disk+" " + partCode + " \n \
212ogEcho session \"[80] $MSG_HELP_ogSetPartitionActive "+n_disk+" 1\"\n \
213ogSetPartitionActive "+n_disk+" 1 \n \
214ogEcho log session \"[100] $MSG_HELP_ogListPartitions  "+n_disk+"\"\n \
215ogUpdatePartitionTable "+n_disk+" \n \
216ms-sys /dev/sda | grep unknow && ms-sys /dev/sda \n \
217ogExecAndLog command session log ogListPartitions "+n_disk+" \n \
218reboot \n";
219}
220
221
222function codeParticionadoGPT (form) {
223        var partCode="";
224        var logicalCode="";
225        var cacheCode="";
226        var cacheSize;
227        var extended=false;
228        var n_disk = form.n_disk.value;
229        var tipo_part_table = form.tipo_part_table.value;
230                numParts=document.getElementById("numGPTpartitions").value;
231               
232        for (var nPart=1; nPart <= numParts; nPart++) {
233                var partCheck=eval("form.checkGPT"+nPart);
234                if (partCheck.checked) {
235                        // Distinguimos entre cache y el resto de particiones
236                        // Solo tratamos la particion 4 como cache, si se selecciono este tipo
237                        if(nPart == 4 && form.partGPT4.value == "CACHE") {
238                                if (form.sizeGPT4.value == "0") {
239                                        cacheCode="\
240ogEcho session \"[20] $MSG_HELP_ogGetCacheSize\"\n \
241sizecache=`ogGetCacheSize` \n \
242ogEcho session \"[30] $MSG_HELP_ogUpdatePartitionTable "+n_disk+"\"\n \
243ogDeletePartitionTable "+n_disk+"  \n \
244ogExecAndLog command ogUpdatePartitionTable "+n_disk+" \n \
245ogEcho session \"[50] $MSG_HELP_ogCreateCache\"\n \
246initCache "+ n_disk +" $sizecache &>/dev/null \n ";
247                                } else {
248                                        if (form.sizeGPT4.value == "CUSTOM") {
249                                                cacheSize = form.sizeGPT4custom.value;
250                                        } else {
251                                                cacheSize = form.sizeGPT4.value;
252                                        }
253                                        cacheCode="\
254ogEcho session \"[30] $MSG_HELP_ogUpdatePartitionTable "+n_disk+"\"\n \
255ogDeletePartitionTable "+n_disk+" \n \
256ogUpdatePartitionTable "+n_disk+" \n \
257ogEcho session \"[50] $MSG_HELP_ogCreateCache\"\n \
258initCache "  + n_disk +" "+ cacheSize + " &>/dev/null";
259                                }
260                        } else{
261                                var partType=eval("form.partGPT"+nPart);
262                                if (partType.value == "CUSTOM" ) {
263                                        var partTypeCustom=eval("form.partGPT"+nPart+"custom");
264                                        partCode += " " + partTypeCustom.value;
265                                } else {
266                                        partCode += " " + partType.value;
267                                }
268                                var partSize=eval("form.sizeGPT"+nPart);
269                                if (partSize.value == "CUSTOM" ) {
270                                        var partSizeCustom=eval("form.sizeGPT"+nPart+"custom");
271                                        partCode += ":" + partSizeCustom.value;
272                                } else {
273                                        partCode += ":" + partSize.value;
274                                }
275                        }
276                } else {
277                        if(nPart == 4){
278                                cacheCode="\
279ogEcho session \"[30] $MSG_HELP_ogUpdatePartitionTable "+n_disk+"\"\n \
280ogDeletePartitionTable "+n_disk+" \n \
281ogUpdatePartitionTable "+n_disk+" \n";
282partCode += " EMPTY:0";
283                        } else{
284                                partCode += " EMPTY:0";
285                        }
286                }
287        }
288        form.codigo.value="\
289ogCreatePartitionTable "+n_disk+" "+tipo_part_table +" \n \
290ogEcho log session \"[0]  $MSG_HELP_ogCreatePartitions "+n_disk+"\"\n \
291ogEcho session \"[10] $MSG_HELP_ogUnmountAll "+n_disk+"\"\n \
292ogUnmountCache \n \
293ogUnmountAll "+n_disk+" \n  \
294" + cacheCode + " \n \
295ogEcho session \"[60] $MSG_HELP_ogListPartitions "+n_disk+"\"\n \
296ogExecAndLog command session ogListPartitions "+n_disk+" \n \
297ogEcho session \"[70] $MSG_HELP_ogCreatePartitions " + partCode + "\"\n \
298ogExecAndLog command ogCreatePartitions "+n_disk+" " + partCode + " \n \
299ogEcho session \"[80] $MSG_HELP_ogSetPartitionActive "+n_disk+" 1\"\n \
300ogSetPartitionActive "+n_disk+" 1 \n \
301ogEcho log session \"[100] $MSG_HELP_ogListPartitions "+n_disk+"\"\n \
302ogUpdatePartitionTable "+n_disk+" \n \
303ms-sys /dev/sda | grep unknow && ms-sys /dev/sda \n \
304ogExecAndLog command session log ogListPartitions "+n_disk+" \n \
305reboot \n";
306}
307
308
309function showPartitionForm (tipo_table_part) {
310        document.getElementById("form"+tipo_table_part).style.display="inline";
311        if(tipo_table_part == "MSDOS"){
312                // De los dos tipos, se oculta el otro
313                document.getElementById("formGPT").style.display="none";
314        } else{
315                document.getElementById("formMSDOS").style.display="none";
316        }
317}
318
319
320// Código de pulsación de selección de partición.
321function clickPartitionCheckbox (form, npart, isGPT) {
322        // Si el parametro no esta definido, se toma como false
323        isGPT = (isGPT)?isGPT:"false";
324        if(isGPT == true){
325                prefix="GPT";
326        } else {
327                prefix="";
328        }
329        var partCheck=eval("form.check"+prefix+npart);
330        var partType=eval("form.part"+prefix+npart);
331        var partSize=eval("form.size"+prefix+npart);
332        var partTypeCustom=eval("form.part"+prefix+npart+"custom");
333        var partSizeCustom=eval("form.size"+prefix+npart+"custom");
334        var freeDisk=document.getElementById("freedisk"+prefix);
335        //var logical=document.getElementById("logicas"+prefix);
336        if (partCheck.checked) {
337                partType.disabled=false;
338                partSize.disabled=false;
339                if(npart != 4){
340                        if (partType.options[partType.selectedIndex].value == "CUSTOM") {
341                                partTypeCustom.disabled=false;
342                        }
343                }
344                if (partSize.options[partSize.selectedIndex].value == "CUSTOM") {
345                        partSizeCustom.disabled=false;
346                } else {
347                        partSizeCustom.disabled=true;
348                }
349        } else {
350                partType.disabled=true;
351                partSize.disabled=true;
352                // El campo TypeCustom no existe para la particion 4
353                if(npart != 4)
354                        partTypeCustom.disabled=true;
355                partSizeCustom.disabled=true;
356        }
357        if (npart <= 4) {
358                // Si el formulario es GPT no hay extendidas
359                if(isGPT != true){
360                        checkExtendedPartition(form);
361                }
362                calculateFreeDisk(form);
363        }
364}
365
366/**
367 * Dado un numero de disco, recorre todos los input hidden con nombre disksize_"disco"
368 * y devuelve el de menor valor
369 */
370function getMinDiskSize(disk){
371        var diskSizeArray = document.getElementsByName("disksize_"+disk);
372        var minSize = diskSizeArray[0].value;
373        for(var i= 1; i < diskSizeArray.length; i++){
374                if(diskSizeArray[i].value < minSize)
375                        minSize = diskSizeArray[i].value;
376        }
377        return minSize;
378}
379
380// Código para calcular el espacio libre del disco.
381function calculateFreeDisk(form) {
382        // Si esta seleccionada la opcion GPT, se llama a la funcion correspondiente
383        if(document.getElementById("tipo_part_table").value == "GPT"){
384                calculateFreeGPTDisk(form);
385        }
386        // Capturamos el disco seleccionado
387        var disk = document.getElementById("n_disk").value;
388        // Buscamos por nombre todos los campos disksize_"disk" y nos quedamos con el de menor valor
389        var diskSize = getMinDiskSize(disk);
390       
391               
392        var freeDisk=document.getElementById("freedisk");
393        freeDisk.value=diskSize;
394        for (npart=1; npart<=4; npart++) {
395                var partCheck=eval("form.check"+npart);
396                var partSize=eval("form.size"+npart);
397                var partSizeCustom=eval("form.size"+npart+"custom");
398                if (partCheck.checked) {
399                        if (partSize.options[partSize.selectedIndex].value == "CUSTOM") {
400                                freeDisk.value -= parseInt(partSizeCustom.value);
401                        } else {
402                                freeDisk.value -= parseInt(partSize.options[partSize.selectedIndex].value);
403                        }
404                }
405        }
406        if (parseInt(freeDisk.value) < 0) {
407                freeDisk.style.fontWeight = "bold";
408                freeDisk.style.fontStyle = "italic";
409        } else {
410                freeDisk.style.fontWeight = "normal";
411                freeDisk.style.fontStyle = "normal";
412        }
413        if (form.size4.value == 0) {
414                freeDisk.value += " (- cache)";         // Aviso de caché sin modificar.
415        }
416}
417
418// Código para calcular el espacio libre del disco. en el formulario GPT
419function calculateFreeGPTDisk(form) {
420        // Si esta seleccionada la opcion MSDOS, se llama a la funcion correspondiente
421    if(document.getElementById("tipo_part_table").value == "MSDOS"){
422            calculateFreeDisk(form);
423    }
424    // Capturamos el disco seleccionado
425        var disk = document.getElementById("n_disk").value;
426        // Buscamos el input hidden para el disco seleccionado
427        var diskSize = getMinDiskSize(disk);
428        document.getElementById('freediskGPT').value=diskSize;
429       
430        var freeDisk=document.getElementById("freediskGPT");
431        // Capturamos el numero de particiones que hay hechas
432        numParts=document.getElementById("numGPTpartitions").value;
433    for (npart=1; npart<=numParts; npart++) {
434            var partCheck=eval("form.checkGPT"+npart);
435            var partSize=eval("form.sizeGPT"+npart);
436            var partSizeCustom=eval("form.sizeGPT"+npart+"custom");
437            if (partCheck.checked) {
438                    if (partSize.options[partSize.selectedIndex].value == "CUSTOM") {
439                            freeDisk.value -= parseInt(partSizeCustom.value);
440                    } else {
441                            freeDisk.value -= parseInt(partSize.options[partSize.selectedIndex].value);
442                    }
443            }
444    }
445    if (parseInt(freeDisk.value) < 0) {
446            freeDisk.style.fontWeight = "bold";
447            freeDisk.style.fontStyle = "italic";
448    } else {
449            freeDisk.style.fontWeight = "normal";
450            freeDisk.style.fontStyle = "normal";
451    }
452    if (form.size4.value == 0) {
453            freeDisk.value += " (- cache)";         // Aviso de caché sin modificar.
454    }
455}
456
457// Agrega una nueva fila a la tabla de particiones con una nueva particion
458function addGPTPartition(){
459        var partitionTypes = "";
460        partitionTypes+='<OPTION value="WINDOWS"> Windows </OPTION>';
461        partitionTypes+='<OPTION value="WIN-RESERV"> Windows Reserved </OPTION>';
462        partitionTypes+='<OPTION value="LINUX"> Linux </OTION>';
463        partitionTypes+='<OPTION value="LINUX-RESERV"> Linux Reserved </OPTION>';
464        partitionTypes+='<OPTION value="LINUX-SWAP"> Linux Swap </OPTION>';
465        partitionTypes+='<OPTION value="LINUX-RAID"> Linux RAID </OPTION>';
466        partitionTypes+='<OPTION value="LINUX-LVM"> Linux LVM </OPTION>';
467        partitionTypes+='<OPTION value="CHROMEOS"> ChromeOS </OTION>';
468        partitionTypes+='<OPTION value="CHROMEOS-KRN"> ChromeOS Kernel </OPTION>';
469        partitionTypes+='<OPTION value="CHROMEOS-RESERV"> ChromeOS Reserved </OPTION>';
470        partitionTypes+='<OPTION value="HFS"> MacOS HFS </OPTION>';
471        partitionTypes+='<OPTION value="HFS-BOOT"> MacOS HFS Boot </OPTION>';
472        partitionTypes+='<OPTION value="HFS-RAID"> MacOS HFS RAID </OPTION>';
473        partitionTypes+='<OPTION value="FREEBSD"> FreeBSD </OPTION>';
474        partitionTypes+='<OPTION value="FREEBSD-DISK"> FreeBSD Disk </OPTION>';
475        partitionTypes+='<OPTION value="FREEBSD-BOOT"> FreeBSD Boot </OPTION>';
476        partitionTypes+='<OPTION value="FREEBSD-SWAP"> FreeBSD Swap </OPTION>';
477        partitionTypes+='<OPTION value="SOLARIS"> Solaris </OPTION>';
478        partitionTypes+='<OPTION value="SOLARIS-DISK"> Solaris Disk </OPTION>';
479        partitionTypes+='<OPTION value="SOLARIS-BOOT"> Solaris Boot </OPTION>';
480        partitionTypes+='<OPTION value="SOLARIS-SWAP"> Solaris Swap </OPTION>';
481        partitionTypes+='<OPTION value="EFI"> EFI </OPTION>';
482        partitionTypes+='<OPTION value="MBR"> MBR </OPTION>';
483        partitionTypes+='<OPTION value="BIOS-BOOT"> BIOS Boot </OPTION>';
484
485
486        table = document.getElementById("particionesGPT");
487        // Capturamos el numero de particiones, antes incrementamos
488        document.getElementById("numGPTpartitions").value = parseInt(document.getElementById("numGPTpartitions").value)+1
489        numPart=document.getElementById("numGPTpartitions").value;
490        partitionRow = table.insertRow(-1);
491        partitionRow.id = "trPartition"+numPart;
492        partitionRow.innerHTML="<td> \
493<input type='checkbox' name='checkGPT"+numPart+"' value='checkGPT"+numPart+"' onclick='clickPartitionCheckbox(this.form, "+numPart+",true);' /> Partici&oacute;n "+numPart+"</td> \
494<td>\
495<select name='partGPT"+numPart+"' id='partGPT"+numPart+"' style='width:220' disabled='true' onclick=' \
496        if (this.options[this.selectedIndex].value == \'CUSTOM\') { \
497                this.form.partGPT"+numPart+"custom.disabled=false; \
498        } else { \
499                this.form.partGPT"+numPart+"custom.disabled=true; \
500        }'><option value='CUSTOM'> Personalizar </option> \
501</select> \
502<br> \
503<select name='partGPT"+numPart+"custom' id='partGPT"+numPart+"custom' style='width:220' disabled='true' >"+partitionTypes+"</select> \
504</td> \
505<td> \
506<select name='sizeGPT"+numPart+"' id='sizeGPT"+numPart+"' style='width:220' disabled='true' onclick=' \
507        if (this.form.size"+numPart+".options[this.form.size"+numPart+".selectedIndex].value == \'CUSTOM\') { \
508                this.form.sizeGPT"+numPart+"custom.disabled=false; \
509        } else { \
510                this.form.sizeGPT"+numPart+"custom.disabled=true; \
511        } \
512' onchange='calculateFreeGPTDisk(this.form);'>0<option value='CUSTOM'> Personalizar </option> \
513</select> \
514<br /> \
515<input type='text' style='width:100' name='sizeGPT"+numPart+"custom' value='0' disabled='true' onchange='calculateFreeDisk(this.form);' /> \
516</td>"
517
518}
519
520// Agrega una nueva fila a la tabla de particiones con una nueva particion
521function deleteGPTPartition(){
522        table = document.getElementById("particionesGPT");
523        // Capturamos el numero de particiones
524        numPart=document.getElementById("numGPTpartitions").value;
525        // Si ya solo quedan 4 particiones, no se elimina ni se decrementa el contador
526        if(numPart > 4){
527                partitionRow = document.getElementById("trPartition"+numPart);
528                table.deleteRow(partitionRow.rowIndex);
529                // Decrementamos el numero de particiones
530                document.getElementById("numGPTpartitions").value = parseInt(document.getElementById("numGPTpartitions").value)-1;
531        }
532}
533
534// Código para comprobar si hay partición extendida activa para mostrar las lógicas.
535function checkExtendedPartition(form) {
536        var logical=document.getElementById("logicas");
537        var visible=false;
538        for (npart=1; npart<=4; npart++) {
539                var partCheck=eval("form.check"+npart);
540                var partType=eval("form.part"+npart);
541                var partTypeCustom=eval("form.part"+npart+"custom");
542                if (partCheck.checked) {
543                        partType.style.fontWeight = "normal";
544
545                        if (partType.value == "EXTENDED") {
546                                visible=true;
547                                partType.style.fontWeight = "bold";
548                        }
549                        // La particion 4 no tiene partTypeCustom
550                        if(npart != 4){
551                                partTypeCustom.style.fontWeight = "normal";
552                                if (partType.value == "CUSTOM" && partTypeCustom.value == "EXTENDED") {
553                                        visible=true;
554                                        partTypeCustom.style.fontWeight = "bold";
555                                }
556                        }
557                }
558        }
559        if (visible) {
560                logical.style.visibility="visible";
561        } else {
562                logical.style.visibility="hidden";
563        }
564}
565
Note: See TracBrowser for help on using the repository browser.