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: IniciarSesion.js |
---|
7 | // Descripción : |
---|
8 | // Este fichero implementa las funciones javascript del fichero IniciarSesion.php (Comandos) |
---|
9 | // Version: 0.1 - el valor del filtro = ips de los equipos comunes entre la seleccion de la configuración y el filtro. |
---|
10 | // Nota: no se utiliza document.fdatosejecucion.idambito.value. Su valor no es correcto. |
---|
11 | // Fecha: 2014-10-23 |
---|
12 | // Autora: Irina Gomez, ETSII Universidad de Sevilla |
---|
13 | // ************************************************************************************************************************************************* |
---|
14 | function confirmar(){ |
---|
15 | if (comprobar_datos()){ |
---|
16 | var RC="@"; |
---|
17 | // UHU - Ahora puede ser cualquier disco |
---|
18 | var atributos=""; |
---|
19 | // devuelve las ip de los ordenadores del filtro o vacio si estan todos seleccionados. |
---|
20 | filtrado(); |
---|
21 | var ipfiltro=document.fdatosejecucion.filtro.value; |
---|
22 | // Compone atributos del comando |
---|
23 | var tb_conf=document.getElementById("tabla_conf"); |
---|
24 | var ochecks=tb_conf.getElementsByTagName('INPUT'); |
---|
25 | for(var i=0;i<ochecks.length;i++){ |
---|
26 | if(ochecks[i].checked){ |
---|
27 | var diskPart = ochecks[i].value.split(";"); |
---|
28 | var disco = diskPart[0]; |
---|
29 | var numpar= diskPart[1]; |
---|
30 | atributos+="dsk="+disco+RC; |
---|
31 | atributos+="par="+numpar+RC; |
---|
32 | // Datos bloque de configuracion: ip equipos. |
---|
33 | var cc=ochecks[i].getAttribute('idcfg'); |
---|
34 | var tbOrd=document.getElementById("tbOrd_"+cc); |
---|
35 | var iptabla=tbOrd.getAttribute('value'); |
---|
36 | |
---|
37 | // Elimino los ordenadores del filtro que no estén en la tabla. |
---|
38 | if (ipfiltro!==''){ |
---|
39 | var arraytabla = iptabla.split(","); |
---|
40 | var arrayfiltro =ipfiltro.split(";"); |
---|
41 | arrayfiltro = array_interset (arrayfiltro.sort(), arraytabla.sort()); |
---|
42 | ipfiltro = arrayfiltro.join(";"); |
---|
43 | if (ipfiltro===''){ |
---|
44 | alert(TbMsg["FILTER"]); |
---|
45 | return(false); |
---|
46 | } |
---|
47 | } |
---|
48 | else { |
---|
49 | ipfiltro=iptabla.replace(/,/g, ";"); |
---|
50 | } |
---|
51 | document.fdatosejecucion.filtro.value=ipfiltro; |
---|
52 | document.fdatosejecucion.atributos.value=atributos; |
---|
53 | document.fdatosejecucion.submit(); |
---|
54 | break; |
---|
55 | |
---|
56 | |
---|
57 | } |
---|
58 | } |
---|
59 | |
---|
60 | } |
---|
61 | } |
---|
62 | //________________________________________________________________________________________________________ |
---|
63 | function cancelar() |
---|
64 | { |
---|
65 | alert(CTbMsg[0]); |
---|
66 | location.href="../nada.php" |
---|
67 | } |
---|
68 | //________________________________________________________________________________________________________ |
---|
69 | function comprobar_datos() |
---|
70 | { |
---|
71 | var tb_conf=document.getElementById("tabla_conf"); |
---|
72 | var ochecks=tb_conf.getElementsByTagName('INPUT'); |
---|
73 | var op=0; |
---|
74 | for(var i=0;i<ochecks.length;i++){ |
---|
75 | if(ochecks[i].checked) op++; |
---|
76 | } |
---|
77 | if(op===0){ |
---|
78 | alert(TbMsg[1]); |
---|
79 | return(false); |
---|
80 | } |
---|
81 | return(comprobar_datosejecucion()) |
---|
82 | } |
---|
83 | |
---|