#601: Integrar código revisión r3853, con mejoras en asistente de particionado.

git-svn-id: https://opengnsys.es/svn/branches/version1.0@3854 a21b9725-9963-47de-94b9-378ad31fedc9
remotes/github/debian-pkg
ramon 2013-06-05 12:52:59 +00:00
parent 83980a0e13
commit 2e699496b5
3 changed files with 66 additions and 58 deletions

View File

@ -58,21 +58,16 @@ if (!$cmd)
//indicamos al objeto xajax se encargue de generar el javascript de las funciones registradas por ejm: ListarParticionesXip
$xajax->printJavascript('../xajax/');
?>
<script>
function doOnload(){
calculateFreeDisk(document.fdatos);
}
</script>
</head>
<body onload="
var disks=document.getElementsByName('disksize');
var min=null;
for (var i=0; i<disks.length; i++) {
var val=parseInt(disks[i].textContent);
if (min==null || val<min) {
min=val;
}
}
document.getElementById('minsize').value=min;
document.getElementById('freedisk').value=min;
">
<body onload="doOnload()">
<?php
switch($ambito){
case $AMBITO_CENTROS :
@ -112,7 +107,7 @@ $xajax->printJavascript('../xajax/');
<tr>
<td>
<?php echo $TbMsg[35].":\n"; // Disco ?>
<input type="text" name="n_disk" value="1">
<input type="text" id="n_disk" name="n_disk" value="1" onchange="calculateFreeDisk(document.fdatos)">
</td>
</tr>
<tr>

View File

@ -63,15 +63,29 @@ command + " | tee -a $OGLOGCOMMAND";
}
function codeParticionado(form){
var errorMsg = "¡El espacio libre en disco no puede ser menor que 0!";
var n_disk = form.n_disk.value;
var tipo_part_table = form.tipo_part_table.value;
// Comprobamos si la opcion elejida es GPT o MSDOS para llamar a una funcion u otra
if(tipo_part_table == "GPT"){
codeParticionadoGPT(form);
// Comprobamos que el espacio libre en el disco no sea negativo, si lo es, dar aviso
if(parseInt(document.getElementById("freediskGPT").value) < 0){
alert(errorMsg);
}
else{
codeParticionadoGPT(form);
}
}
else{
codeParticionadoMSDOS(form);
// Comprobamos que el espacio libre en el disco no sea negativo, si lo es, dar aviso
if(parseInt(document.getElementById("freedisk").value) < 0){
alert(errorMsg);
}
else{
codeParticionadoMSDOS(form);
}
}
}
@ -357,8 +371,13 @@ function calculateFreeDisk(form) {
if(document.getElementById("tipo_part_table").value == "GPT"){
calculateFreeGPTDisk(form);
}
// Capturamos el disco seleccionado
var disk = document.getElementById("n_disk").value;
// Buscamos el input hidden para el disco seleccionado
var diskSize = document.getElementById("disksize_"+disk).value;
var freeDisk=document.getElementById("freedisk");
freeDisk.value=form.minsize.value;
freeDisk.value=diskSize;
for (npart=1; npart<=4; npart++) {
var partCheck=eval("form.check"+npart);
var partSize=eval("form.size"+npart);
@ -386,36 +405,40 @@ function calculateFreeDisk(form) {
// Código para calcular el espacio libre del disco. en el formulario GPT
function calculateFreeGPTDisk(form) {
// Si esta seleccionada la opcion MSDOS, se llama a la funcion correspondiente
if(document.getElementById("tipo_part_table").value == "MSDOS"){
calculateFreeDisk(form);
}
if(document.getElementById("tipo_part_table").value == "MSDOS"){
calculateFreeDisk(form);
}
// Capturamos el disco seleccionado
var disk = document.getElementById("n_disk").value;
// Buscamos el input hidden para el disco seleccionado
var diskSize = document.getElementById("disksize_"+disk).value;
document.getElementById('freediskGPT').value=diskSize;
var freeDisk=document.getElementById("freediskGPT");
freeDisk.value=form.minsize.value;
// Capturamos el numero de particiones que hay hechas
numParts=document.getElementById("numGPTpartitions").value;
for (npart=1; npart<=numParts; npart++) {
var partCheck=eval("form.checkGPT"+npart);
var partSize=eval("form.sizeGPT"+npart);
var partSizeCustom=eval("form.sizeGPT"+npart+"custom");
if (partCheck.checked) {
if (partSize.options[partSize.selectedIndex].value == "CUSTOM") {
freeDisk.value -= parseInt(partSizeCustom.value);
} else {
freeDisk.value -= parseInt(partSize.options[partSize.selectedIndex].value);
}
}
}
if (parseInt(freeDisk.value) < 0) {
freeDisk.style.fontWeight = "bold";
freeDisk.style.fontStyle = "italic";
} else {
freeDisk.style.fontWeight = "normal";
freeDisk.style.fontStyle = "normal";
}
if (form.size4.value == 0) {
freeDisk.value += " (- cache)"; // Aviso de caché sin modificar.
}
for (npart=1; npart<=numParts; npart++) {
var partCheck=eval("form.checkGPT"+npart);
var partSize=eval("form.sizeGPT"+npart);
var partSizeCustom=eval("form.sizeGPT"+npart+"custom");
if (partCheck.checked) {
if (partSize.options[partSize.selectedIndex].value == "CUSTOM") {
freeDisk.value -= parseInt(partSizeCustom.value);
} else {
freeDisk.value -= parseInt(partSize.options[partSize.selectedIndex].value);
}
}
}
if (parseInt(freeDisk.value) < 0) {
freeDisk.style.fontWeight = "bold";
freeDisk.style.fontStyle = "italic";
} else {
freeDisk.style.fontWeight = "normal";
freeDisk.style.fontStyle = "normal";
}
if (form.size4.value == 0) {
freeDisk.value += " (- cache)"; // Aviso de caché sin modificar.
}
}
// Agrega una nueva fila a la tabla de particiones con una nueva particion

View File

@ -60,8 +60,6 @@ function pintaParticiones($cmd,$configuraciones,$idordenadores,$cc)
echo '<th align="center">&nbsp;'.$TbMsg["IMAGE"].'&nbsp;</th>'; // Imagen instalada
echo '<th align="center">&nbsp;'.$TbMsg["SOFT_PROFILE"].'&nbsp;</th>'; // Perfil software
echo '<th align="center">&nbsp;'.$TbMsg["CACHE_CONTENT"].'&nbsp;</th>';
echo '</TR>';
echo '</tr>';
// Recorremos todas las configuraciones encontradas para cada disco
@ -153,7 +151,9 @@ function pintaParticiones($cmd,$configuraciones,$idordenadores,$cc)
echo'<td></td>'.chr(13);
echo'<td></td>'.chr(13);
echo'<td></td>'.chr(13);
echo'<td align="right">&nbsp;<strong>'.$disksize[$disk].'</strong>&nbsp;</td>'.chr(13);
echo'<td align="right">&nbsp;<strong>'.$disksize[$disk].'</span></strong>&nbsp;</td>'.chr(13);
// Creamos un campo oculto para guardar información sobre el disco y su tamaño separados por ;
echo "<input type='hidden' id='disksize_".$disk."' value='".$disksize[$disk]."'/>";
echo'<td></td>'.chr(13);
echo'<td></td>'.chr(13);
echo'<td></td>'.chr(13);
@ -367,7 +367,7 @@ function pintaParticionesRestaurarImagenSincronizacion1($cmd,$configuraciones,$i
// Separamos las configuraciones segun el disco al que pertenezcan
$diskConfigs = splitConfigurationsByDisk($configuraciones);
$columns=13;
$columns=9;
echo '<TR>';
echo '<TH align=center>&nbsp;&nbsp;</TH>';
echo '<th align="center">&nbsp;'.$TbMsg["DISK"].'&nbsp;</th>'; // Número de disco
@ -378,11 +378,6 @@ function pintaParticionesRestaurarImagenSincronizacion1($cmd,$configuraciones,$i
echo '<th align="center">&nbsp;'.$TbMsg["SIZE_KB"].'&nbsp;</th>'; // Tamaño
echo '<TH align=center>&nbsp;'.$TbMsg[10].'&nbsp;</TH>';
echo '<TH align=center>&nbsp;'.$TbMsg[16].'&nbsp;</TH>';
echo '<TH align=center>&nbsp;'.$TbMsg[39].'&nbsp;</TH>';
echo '<TH align=center>&nbsp;W&nbsp;</TH>';
echo '<TH align=center>&nbsp;E&nbsp;</TH>';
echo '<TH align=center>&nbsp;C&nbsp;</TH>';
echo '</TR>';
@ -412,12 +407,7 @@ function pintaParticionesRestaurarImagenSincronizacion1($cmd,$configuraciones,$i
$metodos="CACHE=".$TbMsg[13].chr(13);
$metodos.="REPO=".$TbMsg[9];
echo '<TD align=center>'.HTMLCTESELECT($metodos,"desplemet_".$icp,"estilodesple","",1,100).'</TD>';
$tipotran="0=".$TbMsg[40].chr(13);
$tipotran.="1=".$TbMsg[41];
echo '<TD align=center>'.HTMLCTESELECT($tipotran,"despletipotran_".$icp,"estilodesple","",1,100).'</TD>';
echo'<td align=center><input type=checkbox name="whole" id="whl-'.$tbKeys[$k]["numpar"].'"></td>';
echo '<td align=center><input type=checkbox name="paramb" checked id="eli-'.$tbKeys[$k]["numpar"].'"></td>';
echo '<td align=center><input type=checkbox name="compres" id="cmp-'.$tbKeys[$k]["numpar"].'"></td>';
}
echo '</TR>'.chr(13);
}