[3ec149c] | 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: comunescomandos.js |
---|
| 7 | // Descripción : |
---|
| 8 | // Este fichero implementa las funciones javascript comunes a todos los comandos |
---|
| 9 | // ************************************************************************************************************************************************* |
---|
| 10 | function comprobar_datosejecucion(){ |
---|
| 11 | /* Comprobación de las opciones de ejecución */ |
---|
| 12 | var sw_ejya=document.fdatosejecucion.sw_ejya.checked; |
---|
| 13 | var sw_ejprg=document.fdatosejecucion.sw_ejprg.checked; |
---|
| 14 | |
---|
| 15 | var sw_seguimientocon=document.fdatosejecucion.sw_seguimiento[0].checked; |
---|
| 16 | var sw_seguimientosin=document.fdatosejecucion.sw_seguimiento[1].checked; |
---|
| 17 | |
---|
| 18 | var sw_mkprocedimiento=document.fdatosejecucion.sw_mkprocedimiento.checked; |
---|
| 19 | var sw_nuevaprocedimiento=document.fdatosejecucion.sw_procedimiento[0].checked; |
---|
| 20 | var descripcion_nuevaprocedimiento=document.fdatosejecucion.nombreprocedimiento.value; |
---|
| 21 | var sw_procedimientoexistente=document.fdatosejecucion.sw_procedimiento[1].checked; |
---|
| 22 | |
---|
| 23 | var sw_mktarea=document.fdatosejecucion.sw_mktarea.checked; |
---|
| 24 | var sw_nuevatarea=document.fdatosejecucion.sw_tarea[0].checked; |
---|
| 25 | var descripcion_nuevatarea=document.fdatosejecucion.nombretarea.value; |
---|
| 26 | var sw_tareaexistente=document.fdatosejecucion.sw_tarea[1].checked; |
---|
| 27 | |
---|
[3806a31] | 28 | var pprocedimiento=document.fdatosejecucion.idprocedimiento.selectedIndex; |
---|
| 29 | var ptarea=document.fdatosejecucion.idtarea.selectedIndex; |
---|
[3ec149c] | 30 | |
---|
| 31 | if(!sw_ejya && !sw_ejprg && !sw_mkprocedimiento && !sw_mktarea ){ |
---|
[d47323ec] | 32 | //alert("ATENCIÓN.- Debe elegir al menos un modo de ejecución"); |
---|
| 33 | alert(CTbMsg[8]); |
---|
[3ec149c] | 34 | return(false); |
---|
| 35 | } |
---|
| 36 | |
---|
| 37 | // Cuestión procedimiento --------------------------------------------------------------------- |
---|
| 38 | |
---|
| 39 | if(sw_ejya){ |
---|
| 40 | if(!sw_seguimientocon && !sw_seguimientosin){ |
---|
[d47323ec] | 41 | //alert("ATENCIÓN.- Debe elegir un modo de ejecución inmediata"); |
---|
| 42 | alert(CTbMsg[9]); |
---|
[3ec149c] | 43 | return(false); |
---|
| 44 | } |
---|
| 45 | } |
---|
| 46 | // Cuestión procedimiento ----------------------------------------------------------------------- |
---|
| 47 | if(sw_mkprocedimiento){ |
---|
| 48 | if(!sw_nuevaprocedimiento && !sw_procedimientoexistente){ |
---|
[d47323ec] | 49 | //alert("ATENCIÓN.- Debe elegir un modo de inclusión en procedimiento de este comando"); |
---|
| 50 | alert(CTbMsg[10]); |
---|
[3ec149c] | 51 | return(false); |
---|
| 52 | } |
---|
| 53 | if(sw_nuevaprocedimiento && descripcion_nuevaprocedimiento==""){ |
---|
[d47323ec] | 54 | //alert("ATENCIÓN.- Debe especificar el nombre del nuevo procedimiento que se creará y al que se añadirá este comando"); |
---|
| 55 | alert(CTbMsg[11]); |
---|
[3ec149c] | 56 | document.fdatosejecucion.nombreprocedimiento.focus(); |
---|
| 57 | return(false); |
---|
| 58 | } |
---|
| 59 | if(sw_procedimientoexistente && pprocedimiento==0){ |
---|
[d47323ec] | 60 | //alert("ATENCIÓN.- Debe elegir el procedimiento al que se añadirá este comando"); |
---|
| 61 | alert(CTbMsg[12]); |
---|
[3ec149c] | 62 | document.fdatosejecucion.idprocedimiento.focus(); |
---|
| 63 | return(false); |
---|
| 64 | } |
---|
| 65 | } |
---|
| 66 | |
---|
| 67 | // Cuestión tarea ------------------------------------------------------------------------------------------------------------------------------ |
---|
| 68 | if(sw_mktarea){ |
---|
| 69 | if(!sw_nuevatarea && !sw_tareaexistente){ |
---|
[d47323ec] | 70 | //alert("ATENCIÓN.- Debe elegir un modo de inclusión en tarea ejecutable, de este comando"); |
---|
| 71 | alert(CTbMsg[13]); |
---|
[3ec149c] | 72 | return(false); |
---|
| 73 | } |
---|
| 74 | if(sw_nuevatarea && descripcion_nuevatarea==""){ |
---|
[d47323ec] | 75 | //alert("ATENCIÓN.- Debe especificar el nombre de la nueva tarea ejecutable que se creará y a la que se añadirá este comando"); |
---|
| 76 | alert(CTbMsg[14]); |
---|
[3ec149c] | 77 | document.fdatosejecucion.nombretarea.focus(); |
---|
| 78 | return(false); |
---|
| 79 | } |
---|
| 80 | if(sw_tareaexistente && ptarea==0){ |
---|
[d47323ec] | 81 | //alert("ATENCIÓN.- Debe elegir la tarea a la que se añadirá este comando"); |
---|
| 82 | alert(CTbMsg[15]); |
---|
[3ec149c] | 83 | document.fdatosejecucion.idtarea.focus(); |
---|
| 84 | return(false); |
---|
| 85 | } |
---|
| 86 | } |
---|
| 87 | //----------------------------------------------------------------------------------------------------------------------------------------------------- |
---|
| 88 | return(true) |
---|
| 89 | } |
---|
| 90 | //____________________________________________________________________________ |
---|
| 91 | function clic_mktarea(o){ |
---|
| 92 | if(!o.checked){ |
---|
| 93 | document.fdatosejecucion.sw_tarea[0].checked=false; |
---|
| 94 | document.fdatosejecucion.nombretarea.value=""; |
---|
| 95 | document.fdatosejecucion.sw_tarea[1].checked=false; |
---|
| 96 | document.fdatosejecucion.idtarea.selectedIndex=0; |
---|
[12603f8] | 97 | }else{ |
---|
| 98 | // Avisar si el código incluye reinicio o apagado. |
---|
| 99 | if (typeof document.fdatos.codigo !== undefined) { |
---|
| 100 | if (document.fdatos.codigo.value.match(/(poweroff|reboot)/)) { |
---|
| 101 | // AVISO: si el código incluye reinicio o apagado, puede provocar que el cliente no inicie correctamente. |
---|
| 102 | alert(CTbMsg[16]); |
---|
| 103 | } |
---|
| 104 | } |
---|
[3ec149c] | 105 | } |
---|
| 106 | } |
---|
| 107 | function clic_nwtarea(o){ |
---|
| 108 | if(o.checked){ |
---|
| 109 | document.fdatosejecucion.sw_mktarea.checked=true; |
---|
| 110 | document.fdatosejecucion.sw_tarea[1].checked=false; |
---|
| 111 | document.fdatosejecucion.idtarea.selectedIndex=0; |
---|
| 112 | } |
---|
| 113 | } |
---|
| 114 | function clic_extarea(o){ |
---|
| 115 | if(o.checked){ |
---|
| 116 | document.fdatosejecucion.sw_mktarea.checked=true; |
---|
| 117 | document.fdatosejecucion.sw_tarea[0].checked=false; |
---|
| 118 | document.fdatosejecucion.nombretarea.value=""; |
---|
| 119 | } |
---|
| 120 | } |
---|
| 121 | function clic_nomtarea(o){ |
---|
| 122 | document.fdatosejecucion.sw_mktarea.checked=true; |
---|
| 123 | document.fdatosejecucion.sw_tarea[0].checked=true; |
---|
| 124 | document.fdatosejecucion.idtarea.selectedIndex=0; |
---|
| 125 | } |
---|
| 126 | function clic_mkprocedimiento(o){ |
---|
| 127 | if(!o.checked){ |
---|
| 128 | document.fdatosejecucion.sw_procedimiento[0].checked=false; |
---|
| 129 | document.fdatosejecucion.nombreprocedimiento.value=""; |
---|
| 130 | document.fdatosejecucion.sw_procedimiento[1].checked=false; |
---|
| 131 | document.fdatosejecucion.idprocedimiento.selectedIndex=0; |
---|
[12603f8] | 132 | }else{ |
---|
| 133 | // Avisar si el código incluye reinicio o apagado. |
---|
| 134 | if (typeof document.fdatos.codigo !== undefined) { |
---|
| 135 | if (document.fdatos.codigo.value.match(/(poweroff|reboot)/)) { |
---|
| 136 | // AVISO: si el código incluye reinicio o apagado, puede provocar que el cliente no inicie correctamente. |
---|
| 137 | alert(CTbMsg[16]); |
---|
| 138 | } |
---|
| 139 | } |
---|
[3ec149c] | 140 | } |
---|
| 141 | } |
---|
| 142 | function clic_nwprocedimiento(o){ |
---|
| 143 | if(o.checked){ |
---|
| 144 | document.fdatosejecucion.sw_mkprocedimiento.checked=true; |
---|
| 145 | document.fdatosejecucion.sw_procedimiento[1].checked=false; |
---|
| 146 | document.fdatosejecucion.idprocedimiento.selectedIndex=0; |
---|
| 147 | } |
---|
| 148 | } |
---|
| 149 | function clic_exprocedimiento(o){ |
---|
| 150 | if(o.checked){ |
---|
| 151 | document.fdatosejecucion.sw_mkprocedimiento.checked=true; |
---|
| 152 | document.fdatosejecucion.sw_procedimiento[0].checked=false; |
---|
| 153 | document.fdatosejecucion.nombreprocedimiento.value=""; |
---|
| 154 | } |
---|
| 155 | } |
---|
| 156 | function clic_nomprocedimiento(o){ |
---|
| 157 | document.fdatosejecucion.sw_mkprocedimiento.checked=true; |
---|
| 158 | document.fdatosejecucion.sw_procedimiento[0].checked=true; |
---|
| 159 | document.fdatosejecucion.idprocedimiento.selectedIndex=0; |
---|
| 160 | } |
---|
| 161 | |
---|
| 162 | function procedimientoexistente(o){ |
---|
| 163 | document.fdatosejecucion.sw_mkprocedimiento.checked=true; |
---|
| 164 | document.fdatosejecucion.sw_procedimiento[1].checked=true; |
---|
| 165 | document.fdatosejecucion.nombreprocedimiento.value=""; |
---|
| 166 | } |
---|
| 167 | |
---|
| 168 | function tareaexistente(o){ |
---|
| 169 | document.fdatosejecucion.sw_mktarea.checked=true; |
---|
| 170 | document.fdatosejecucion.sw_tarea[1].checked=true; |
---|
| 171 | document.fdatosejecucion.nombretarea.value=""; |
---|
| 172 | } |
---|
| 173 | //____________________________________________________________________________ |
---|
| 174 | function compone_urlejecucion(){ |
---|
| 175 | |
---|
[3806a31] | 176 | var wurl=""; |
---|
[3ec149c] | 177 | |
---|
| 178 | var sw_ejya=document.fdatosejecucion.sw_ejya.checked; |
---|
| 179 | var sw_seguimiento=document.fdatosejecucion.sw_seguimiento[0].checked; |
---|
| 180 | |
---|
| 181 | var sw_ejprg=document.fdatosejecucion.sw_ejprg.checked; |
---|
| 182 | |
---|
| 183 | var sw_mkprocedimiento=document.fdatosejecucion.sw_mkprocedimiento.checked; |
---|
| 184 | if (document.fdatosejecucion.sw_procedimiento[0].checked){ |
---|
[3806a31] | 185 | var nwidprocedimiento=0; |
---|
[3ec149c] | 186 | var nwdescriprocedimiento=document.fdatosejecucion.nombreprocedimiento.value; |
---|
| 187 | } |
---|
| 188 | else{ |
---|
[3806a31] | 189 | var p=document.fdatosejecucion.idprocedimiento.selectedIndex; |
---|
| 190 | var nwidprocedimiento=document.fdatosejecucion.idprocedimiento.options[p].value; |
---|
[3ec149c] | 191 | var nwdescriprocedimiento=document.fdatosejecucion.idprocedimiento.options[p].text |
---|
| 192 | } |
---|
| 193 | |
---|
| 194 | var sw_mktarea=document.fdatosejecucion.sw_mktarea.checked; |
---|
| 195 | if (document.fdatosejecucion.sw_tarea[0].checked){ |
---|
[3806a31] | 196 | var nwidtarea=0; |
---|
[3ec149c] | 197 | var nwdescritarea=document.fdatosejecucion.nombretarea.value; |
---|
| 198 | } |
---|
| 199 | else{ |
---|
[3806a31] | 200 | var p=document.fdatosejecucion.idtarea.selectedIndex; |
---|
| 201 | var nwidtarea=document.fdatosejecucion.idtarea.options[p].value; |
---|
[3ec149c] | 202 | var nwdescritarea=document.fdatosejecucion.idtarea.options[p].text |
---|
| 203 | } |
---|
[3806a31] | 204 | wurl+="sw_ejya="+sw_ejya +"&sw_seguimiento="+sw_seguimiento+"sw_ejprg="+sw_ejprg+"&sw_mktarea="+sw_mktarea+"&nwidtarea="+nwidtarea+"&nwdescritarea="+nwdescritarea; |
---|
| 205 | wurl+="&sw_mkprocedimiento="+sw_mkprocedimiento+"&nwidprocedimiento="+nwidprocedimiento+"&nwdescriprocedimiento="+nwdescriprocedimiento; |
---|
[3ec149c] | 206 | return(wurl) |
---|
| 207 | } |
---|
| 208 | //________________________________________________________________________________________________________ |
---|
| 209 | // |
---|
| 210 | // Resultado ejecución de un comando |
---|
| 211 | //________________________________________________________________________________________________________ |
---|
| 212 | function resultado_comando(resul){ |
---|
| 213 | alert(CTbMsg[resul]); |
---|
| 214 | } |
---|