source: admin/WebConsole/asistentes/jscripts/asistentes.js @ 9f31169

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 9f31169 was 9f31169, checked in by ramon <ramongomez@…>, 13 years ago

Versión 1.0.4, #526: Tipos de particiones GPT en asistente de particionado.

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

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