1 | // ************************************************************************************************************************************************* |
---|
2 | // Libreria de scripts de Javascript |
---|
3 | // Autor: José Manuel Alonso (E.T.S.I.I.) Universidad de Sevilla |
---|
4 | // Fecha Creación: 2009-2010 |
---|
5 | // Fecha Última modificación: Agosto-2010 |
---|
6 | // Nombre del fichero: RestaurarImagen.js |
---|
7 | // Descripción : |
---|
8 | // Este fichero implementa las funciones javascript del fichero RestaurarImagen.php (Comandos) |
---|
9 | // ************************************************************************************************************************************************* |
---|
10 | function confirmar(){ |
---|
11 | if(comprobar_datos()){ |
---|
12 | var RC="@"; |
---|
13 | // UHU - Ahora puede ser cualquier disco |
---|
14 | var disco; |
---|
15 | var atributos=""; |
---|
16 | var tb_conf=document.getElementById("tabla_conf"); |
---|
17 | var ochecks=tb_conf.getElementsByTagName('INPUT') |
---|
18 | for(var i=0;i<ochecks.length;i++){ |
---|
19 | if(ochecks[i].checked){ |
---|
20 | var idradio=ochecks[i].id; |
---|
21 | var diskPart = ochecks[i].value.split(";"); |
---|
22 | disco = diskPart[0]; |
---|
23 | var numpar= diskPart[1]; |
---|
24 | atributos+="dsk="+disco+RC; // Numero de disco |
---|
25 | atributos+="par="+numpar+RC; // Número de partición |
---|
26 | var despleimagenizda=document.getElementById("despleimagen_"+idradio+"_1"); |
---|
27 | var despleimagendrcha=document.getElementById("despleimagen_"+idradio+"_0"); |
---|
28 | var despleimagen; |
---|
29 | |
---|
30 | var protoclonacion=document.getElementById("protoclonacion_"+idradio); |
---|
31 | |
---|
32 | if(despleimagenizda.selectedIndex>0) despleimagen=despleimagenizda; |
---|
33 | if(despleimagendrcha.selectedIndex>0) despleimagen=despleimagendrcha; |
---|
34 | var imgcanrepo=despleimagen.value.split("_"); |
---|
35 | atributos+="idi="+imgcanrepo[0]+RC; // Identificador de la imagen |
---|
36 | atributos+="nci="+imgcanrepo[1]+RC; // Nombre canónico |
---|
37 | atributos+="ipr="+imgcanrepo[2]+RC; // Ip del repositorio donde está alojada |
---|
38 | atributos+="ifs="+imgcanrepo[3]+RC; // Identificador del perfil soft contenido en la imagen |
---|
39 | atributos+="ptc="+protoclonacion.value+RC; // Identificador del protocolo de clonación |
---|
40 | document.fdatosejecucion.atributos.value=atributos; |
---|
41 | |
---|
42 | var cc=ochecks[i].getAttribute('idcfg'); // Toma identificador del bloque de configuración |
---|
43 | var tbOrd=document.getElementById("tbOrd_"+cc); |
---|
44 | var iptabla=tbOrd.getAttribute('value'); // Toma identificadores de los ordenadores |
---|
45 | filtrado(); |
---|
46 | var ipfiltro=document.fdatosejecucion.filtro.value; |
---|
47 | |
---|
48 | // Elimino los ordenadores del filtro que no estén en la tabla |
---|
49 | if (ipfiltro!=''){ |
---|
50 | var arraytabla = iptabla.split(","); |
---|
51 | var arrayfiltro =ipfiltro.split(";"); |
---|
52 | arrayfiltro = array_interset (arrayfiltro.sort(), arraytabla.sort()); |
---|
53 | ipfiltro = arrayfiltro.join(";"); |
---|
54 | if (ipfiltro ==''){ |
---|
55 | alert(TbMsg["FILTER"]); |
---|
56 | return(false); |
---|
57 | } |
---|
58 | } else { |
---|
59 | ipfiltro=iptabla.replace(/,/g, ";"); |
---|
60 | } |
---|
61 | document.fdatosejecucion.filtro.value=ipfiltro; |
---|
62 | |
---|
63 | document.fdatosejecucion.submit(); |
---|
64 | } |
---|
65 | } |
---|
66 | } |
---|
67 | } |
---|
68 | //________________________________________________________________________________________________________ |
---|
69 | function cancelar(){ |
---|
70 | alert(TbMsg[0]); |
---|
71 | location.href="../nada.php" |
---|
72 | } |
---|
73 | //________________________________________________________________________________________________________ |
---|
74 | function comprobar_datos() |
---|
75 | { |
---|
76 | tb_conf=document.getElementById("tabla_conf"); |
---|
77 | var ochecks=tb_conf.getElementsByTagName('INPUT') |
---|
78 | var op=0 |
---|
79 | for(var i=0;i<ochecks.length;i++){ |
---|
80 | if(ochecks[i].checked){ |
---|
81 | op++; |
---|
82 | var idradio=ochecks[i].id; // Toma idemtificador del desplegable de imagenes |
---|
83 | despleimagenizda=document.getElementById("despleimagen_"+idradio+"_1"); // Desplegable izda. |
---|
84 | despleimagendcha=document.getElementById("despleimagen_"+idradio+"_0"); // Desplegable derecha. |
---|
85 | |
---|
86 | var p1=despleimagenizda.selectedIndex // Toma índice seleccionado |
---|
87 | var p2=despleimagendcha.selectedIndex // Toma índice seleccionado |
---|
88 | |
---|
89 | if (p1==0 && p2==0){ |
---|
90 | alert(TbMsg[0]) |
---|
91 | despleimagenizda.focus() |
---|
92 | return(false) |
---|
93 | } |
---|
94 | if (p1==p2){ |
---|
95 | alert(TbMsg[6]) |
---|
96 | despleimagenizda.focus() |
---|
97 | return(false) |
---|
98 | } |
---|
99 | } |
---|
100 | } |
---|
101 | if(op==0){ |
---|
102 | alert(TbMsg[1]) |
---|
103 | return(false); |
---|
104 | } |
---|
105 | return(comprobar_datosejecucion()) |
---|
106 | } |
---|