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