source: admin/WebConsole/jscripts/colasacciones.js @ 49c6891

918-git-images-111dconfigfileconfigure-oglivegit-imageslgromero-new-oglivemainmaint-cronmount-efivarfsmultivmmultivm-ogboot-installerogClonningEngineogboot-installer-jenkinsoglive-ipv6test-python-scriptsticket-301ticket-50ticket-50-oldticket-577ticket-585ticket-611ticket-612ticket-693ticket-700ubu24tplunification2use-local-agent-oglivevarios-instalacionwebconsole3
Last change on this file since 49c6891 was 902e3b6, checked in by alonso <alonso@…>, 15 years ago

primeros archivos de administración

git-svn-id: https://opengnsys.es/svn/trunk@522 a21b9725-9963-47de-94b9-378ad31fedc9

  • Property mode set to 100644
File size: 39.8 KB
Line 
1// *************************************************************************************************************************************************
2//      Libreria de scripts de Javascript
3// Autor: José Manuel Alonso (E.T.S.I.I.) Universidad de Sevilla
4// Fecha Creación:2003-2004
5// Fecha Última modificación: Febrero-2005
6// Nombre del fichero: colasacciones.js
7// Descripción :
8//              Este fichero implementa las funciones javascript del fichero colasacciones.php
9// *************************************************************************************************************************************************
10        var currentNotTR=null; 
11        var currentTR=null; 
12        var currentAccion=null; 
13
14        var currentResultado=null; 
15        var currentEstado=null; 
16        var currentFecha=null; 
17        var currentHora=null; 
18
19        var currentIdcmdtskwrk=null;
20        var currentCodtipoaccion=null;
21        var currentIdambcmdtskwrk=null;
22       
23        var currentTipoAccion=null; 
24        var currentidTipoAccion=null; 
25        var currentNombreTipoAccion=null; 
26
27        var currentNotificacion=null; 
28        var currentIdNotificador=null;
29        var currentResultadoNot=null;
30        var currentTipoNotificador=null;
31
32        var op_modificar_resultado=1;
33        var op_modificar_estado=2;
34        var op_reiniciar_accion=3;
35        var op_eliminar_accion=4;
36        var op_modificar_resultado_notificacion=5
37        var op_reiniciar_notificacion=6;
38
39        var op_eliminar_mulaccion=7;
40        var op_modificar_mulresultado=8;
41        var op_modificar_mulestado=9;
42        var op_reiniciar_mulaccion=10;
43
44        var ACCION_ELIMINADA=-1; // Acción eliminada
45        var ACCION_REINICIADA=-2; // Acción reiniciada
46
47        var NOTIFICADOR_ORDENADOR=1;
48        var NOTIFICADOR_COMANDO=2;
49        var NOTIFICADOR_TAREA=3;
50
51        var currentOp=null;
52//____________________________________________________________________________
53//
54//      Recupera el navegador utilizado
55//____________________________________________________________________________
56var IE=(navigator.appName=="Microsoft Internet Explorer");
57var NS=(navigator.appName=="Netscape");
58
59//________________________________________________________________________________________________________
60        function resaltar(o){
61                if (o==currentOp) return
62                o.style.borderBottomColor="#5a86b5"
63                o.style.borderRightColor="#5a86b5"
64                o.style.borderTopColor="#5a86b5"
65                o.style.borderLeftColor="#5a86b5"
66                o.style.color="#5a86b5"
67                o.style.fontWeight="bold"
68
69        }
70//________________________________________________________________________________________________________
71        function desresaltar(o){
72                if (o==currentOp) return
73                o.style.borderBottomColor="#999999"
74                o.style.borderRightColor="#999999"
75                o.style.borderTopColor="#999999"
76                o.style.borderLeftColor="#999999"
77                o.style.color="#999999"
78                o.style.fontWeight="normal"
79        }
80//________________________________________________________________________________________________________
81        function eleccion(o,op){
82                switch(op){
83                        case 1:
84                                        eliminar_mulaccion();
85                                        break;
86                        case 2:
87                                        reiniciar_mulaccion();
88                                        break;
89                        case 3:
90                                        modificar_mulestado(ACCION_DETENIDA)
91                                        break;
92                        case 4:
93                                        modificar_mulestado(ACCION_INICIADA)
94                                        break;
95                        case 5:
96                                        modificar_mulresultado(ACCION_ABORTADA);
97                                        break;
98                        case 6:
99                                        modificar_mulresultado(ACCION_TERMINADA);
100                                        break;
101                }
102        }
103//________________________________________________________________________________________________________
104        function chgdespleacciones(o){
105                var otip="";
106                for (var i=0; i< o.options.length; i++){
107                        if(o.options[i].selected)
108                                otip+=o.options[i].value+"="+o.options[i].text+";"
109                }
110                document.fdatos.tiposacciones.value=otip
111        }
112//________________________________________________________________________________________________________
113        function chgdespleestados(o,swevt){
114                var otip="";
115                for (var i=0; i< o.options.length; i++){
116                        if(o.options[i].selected)
117                                otip+=o.options[i].value+"="+o.options[i].text+";"
118                }
119                document.fdatos.estados.value=otip
120       
121                if(swevt==null){
122                        // Implicaciones
123                        var marca=false
124                        if (o.options[0].selected || o.options[1].selected)  marca=true;
125                        marca_resultado(ACCION_SINERRORES,marca);
126                        marca_resultado(ACCION_CONERRORES,marca);
127
128                        marca=false
129                        if (o.options[2].selected) marca=true;
130                        marca_resultado(ACCION_EXITOSA,marca);
131                        marca_resultado(ACCION_FALLIDA,marca);
132                        marca_resultado(ACCION_TERMINADA,marca);
133                        marca_resultado(ACCION_ABORTADA,marca);
134                }
135        }
136//________________________________________________________________________________________________________
137        function chgdespleresultados(o,swevt){
138                var otip="";
139                for (var i=0; i< o.options.length; i++){
140                        if(o.options[i].selected)
141                                otip+=o.options[i].value+"="+o.options[i].text+";"
142                }
143                document.fdatos.resultados.value=otip
144
145                if(swevt==null){
146                        // Implicaciones
147                        var marca=false
148                        if (o.options[0].selected || o.options[1].selected || o.options[2].selected || o.options[3].selected)  marca=true;
149                        marca_estado(ACCION_FINALIZADA,marca);
150
151                        marca=false
152                        if (o.options[4].selected || o.options[5].selected ) marca=true;
153                        marca_estado(ACCION_DETENIDA,marca);
154                        marca_estado(ACCION_INICIADA,marca);
155                }
156        }
157//________________________________________________________________________________________________________
158        function marca_accion(tipoaccion,marca){
159                var o=document.fdatos.wtiposacciones
160                var otip="";
161                for (var i=0; i< o.options.length; i++){
162                        if(o.options[i].value==tipoaccion)
163                                otip+=o.options[i].selected=marca
164                }
165                chgdespleacciones(o);
166        }
167//________________________________________________________________________________________________________
168        function marca_resultado(resultado,marca){
169                var o=document.fdatos.wresultados
170                var otip="";
171                for (var i=0; i< o.options.length; i++){
172                        if(o.options[i].value==resultado)
173                                otip+=o.options[i].selected=marca
174                }
175                chgdespleresultados(o,false);
176        }
177//________________________________________________________________________________________________________
178        function marca_estado(estado,marca){
179                var o=document.fdatos.westados
180                var otip="";
181                for (var i=0; i< o.options.length; i++){
182                        if(o.options[i].value==estado)
183                                otip+=o.options[i].selected=marca
184                }
185                chgdespleestados(o,false);
186        }
187//________________________________________________________________________________________________________
188        function modificar_resultado(resultado){
189
190                var oIMGs=currentTR.getElementsByTagName('IMG')
191                var ultimgale=oIMGs.length-1
192                var resimg=oIMGs[ultimgale].value
193                if(resimg==ACCION_EXITOSA || resimg==ACCION_FALLIDA){
194                        alert(TbMsg[0]);
195                        return
196                }
197                if(resimg==ACCION_TERMINADA && resultado==ACCION_TERMINADA){
198                        alert(TbMsg[2]);
199                        return
200                }
201                if(resimg==ACCION_ABORTADA && resultado==ACCION_ABORTADA){
202                        alert(TbMsg[3]);
203                        return
204                }
205                reset_contextual(-1,-1);
206                currentResultado=resultado;
207                ifr=document.getElementById("iframes_comodin"); // Toma objeto Iframe
208                var gestorcolas="";
209                switch(currentTipoAccion){
210                                case EJECUCION_COMANDO :
211                                        gestorcolas="../gestores/gestor_colasacciones.php";
212                                        break;
213                                case EJECUCION_TAREA :
214                                        gestorcolas="../gestores/gestor_colasacciones.php";
215                                        break;
216                                case EJECUCION_TRABAJO :
217                                        gestorcolas="../gestores/gestor_colasacciones.php";
218                                        break;
219                }
220                wurl=gestorcolas+"?opcion="+op_modificar_resultado+"&idaccion="+currentAccion+"&resultado="+resultado
221                ifr.src=wurl; // LLama a la página gestora
222        }
223//________________________________________________________________________________________________________
224        function modificar_estado(estado){
225                var oIMGs=currentTR.getElementsByTagName('IMG')
226                var ultimgale=oIMGs.length-2
227                var resimg=oIMGs[ultimgale].value
228                if(resimg==ACCION_FINALIZADA){
229                        alert(TbMsg[1]);
230                        return
231                }
232                if(resimg==ACCION_INICIADA && estado==ACCION_INICIADA){
233                        alert(TbMsg[4]);
234                        return
235                }
236                if(resimg==ACCION_DETENIDA && estado==ACCION_DETENIDA){
237                        alert(TbMsg[5]);
238                        return
239                }
240                reset_contextual(-1,-1);
241                currentEstado=estado;
242                ifr=document.getElementById("iframes_comodin"); // Toma objeto Iframe
243                var gestorcolas="";
244                switch(currentTipoAccion){
245                                case EJECUCION_COMANDO :
246                                        gestorcolas="../gestores/gestor_colasacciones.php";
247                                        break;
248                                case EJECUCION_TAREA :
249                                        gestorcolas="../gestores/gestor_colasacciones.php";
250                                        break;
251                                case EJECUCION_TRABAJO :
252                                        gestorcolas="../gestores/gestor_colasacciones.php";
253                                        break;
254                }
255                var wurl=gestorcolas+"?opcion="+op_modificar_estado+"&idaccion="+currentAccion+"&estado="+estado
256                ifr.src=wurl; // LLama a la página gestora
257        }
258//________________________________________________________________________________________________________
259        function reiniciar_accion(){
260                reset_contextual(-1,-1);
261
262                ifr=document.getElementById("iframes_comodin"); // Toma objeto Iframe
263                var gestorcolas="";
264                switch(currentTipoAccion){
265                                case EJECUCION_COMANDO :
266                                        gestorcolas="../gestores/gestor_colasacciones.php";
267                                        break;
268                                case EJECUCION_TAREA :
269                                        gestorcolas="../gestores/gestor_colasacciones.php";
270                                        break;
271                                case EJECUCION_TRABAJO :
272                                        gestorcolas="../gestores/gestor_colasacciones.php";
273                                        break;
274                }
275                var wurl=gestorcolas+"?opcion="+op_reiniciar_accion+"&idaccion="+currentAccion;
276                ifr.src=wurl; // LLama a la página gestora
277        }
278//________________________________________________________________________________________________________
279        function eliminar_accion(){
280                reset_contextual(-1,-1);
281                ifr=document.getElementById("iframes_comodin"); // Toma objeto Iframe
282                var gestorcolas="";
283                switch(currentTipoAccion){
284                                case EJECUCION_COMANDO :
285                                        gestorcolas="../gestores/gestor_colasacciones.php";
286                                        break;
287                                case EJECUCION_TAREA :
288                                        gestorcolas="../gestores/gestor_colasacciones.php";
289                                        break;
290                                case EJECUCION_TRABAJO :
291                                        gestorcolas="../gestores/gestor_colasacciones.php";
292                                        break;
293                }
294                var wurl=gestorcolas+"?opcion="+op_eliminar_accion+"&idaccion="+currentAccion
295                ifr.src=wurl; // LLama a la página gestora
296        }
297//________________________________________________________________________________________________________
298        function eliminar_mulaccion(){
299                reset_contextual(-1,-1);
300                if(confirm("ATENCIÓN.-Se van a eliminar todas las acciones que están actualmente seleccionadas. ¿ Está seguro de querer hacerlo ?")){
301                        var mulaccion=document.getElementById("mulaccion").value; // Toma los identificadores de todas las acciones
302                        var wurl="../gestores/gestor_colasacciones.php?opcion="+op_eliminar_mulaccion+"&mulaccion="+mulaccion
303                        ifr=document.getElementById("iframes_comodin"); // Toma objeto Iframe
304                        ifr.src=wurl; // LLama a la página gestora
305                }
306        }
307//________________________________________________________________________________________________________
308        function reiniciar_mulaccion(){
309                reset_contextual(-1,-1);
310                if(confirm("ATENCIÓN.-Se van a reiniciar todas las acciones que están actualmente seleccionadas. ¿ Está seguro de querer hacerlo ?")){
311                        var mulaccion=document.getElementById("mulaccion").value; // Toma los identificadores de todas las acciones
312                        var wurl="../gestores/gestor_colasacciones.php?opcion="+op_reiniciar_mulaccion+"&mulaccion="+mulaccion
313                        ifr=document.getElementById("iframes_comodin"); // Toma objeto Iframe
314                        ifr.src=wurl; // LLama a la página gestora
315                }
316        }
317//________________________________________________________________________________________________________
318        function modificar_mulestado(estado){
319                reset_contextual(-1,-1);
320                if(estado==ACCION_DETENIDA) msg="ATENCIÓN.-Se van a detener todas las acciones que están actualmente seleccionadas y no hayan finalizado. ¿ Está seguro de querer hacerlo ?"
321                if(estado==ACCION_INICIADA) msg="ATENCIÓN.-Van a proseguir todas las acciones que están actualmente seleccionadas y estén detenidas. ¿ Está seguro de querer hacerlo ?"
322                if(confirm(msg)){
323                        var mulaccion=document.getElementById("mulaccion").value; // Toma los identificadores de todas las acciones
324                        var wurl="../gestores/gestor_colasacciones.php?opcion="+op_modificar_mulestado+"&mulaccion="+mulaccion+"&estado="+estado
325                        ifr=document.getElementById("iframes_comodin"); // Toma objeto Iframe
326                        ifr.src=wurl; // LLama a la página gestora
327                }
328        }
329//________________________________________________________________________________________________________
330        function modificar_mulresultado(resultado){
331                reset_contextual(-1,-1);
332                if(resultado==ACCION_ABORTADA) msg="ATENCIÓN.-Se van a abortar todas las acciones que están actualmente seleccionadas y no hayan finalizado. ¿ Está seguro de querer hacerlo ?"
333                if(resultado==ACCION_TERMINADA) msg="ATENCIÓN.-Van a terminar todas las acciones que están actualmente seleccionadas y no hayan finalizado. ¿ Está seguro de querer hacerlo ?"
334                if(confirm(msg)){
335                        var mulaccion=document.getElementById("mulaccion").value; // Toma los identificadores de todas las acciones
336                        var wurl="../gestores/gestor_colasacciones.php?opcion="+op_modificar_mulresultado+"&mulaccion="+mulaccion+"&resultado="+resultado
337                        ifr=document.getElementById("iframes_comodin"); // Toma objeto Iframe
338                        ifr.src=wurl; // LLama a la página gestora
339                }
340        }
341//________________________________________________________________________________________________________
342        function resultado_multipleaccion(resul,descrierror){
343                if (!resul){
344                        alert(descrierror)
345                        return
346                }
347                quitar_filtro();
348        }
349//________________________________________________________________________________________________________
350        function resultado_modificar_resultado(resul,descrierror,id){
351                if (!resul){
352                        alert(descrierror)
353                        return
354                }
355                var mulaccion=document.getElementById("mulaccion").value;// Toma los identificadores de todas las acciones
356                mitriada=new TRIADA;
357                toma_triada(mitriada,mulaccion);
358
359                var oIMGs=currentTR.getElementsByTagName('IMG')
360                ultimgale=oIMGs.length-1
361                switch(currentResultado){
362                                case ACCION_TERMINADA :
363                                        oIMGs[ultimgale].src="../images/iconos/acTerminada.gif"
364                                        oIMGs[ultimgale].value=ACCION_TERMINADA
365                                        mitriada.resultado=ACCION_TERMINADA
366                                        break;
367                                case ACCION_ABORTADA :
368                                        oIMGs[ultimgale].src="../images/iconos/acAbortada.gif"
369                                        oIMGs[ultimgale].value=ACCION_ABORTADA
370                                        mitriada.resultado=ACCION_ABORTADA
371                                        break;
372                }
373                ultimgale=oIMGs.length-2
374                oIMGs[ultimgale].src="../images/iconos/acFinalizada.gif"
375                oIMGs[ultimgale].value=ACCION_FINALIZADA
376                mitriada.estado=ACCION_FINALIZADA
377
378                actualiza_triadas(mitriada,mulaccion);
379
380                alert(TbMsg[7])
381        }
382//________________________________________________________________________________________________________
383        function resultado_modificar_estado(resul,descrierror,id){
384                if (!resul){
385                        alert(descrierror)
386                        return
387                }
388
389                var mulaccion=document.getElementById("mulaccion").value;// Toma los identificadores de todas las acciones
390                mitriada=new TRIADA;
391                toma_triada(mitriada,mulaccion);
392
393                var oIMGs=currentTR.getElementsByTagName('IMG')
394                ultimgale=oIMGs.length-2
395                switch(currentEstado){
396                                case ACCION_DETENIDA :
397                                        oIMGs[ultimgale].src="../images/iconos/acDetenida.gif"
398                                        oIMGs[ultimgale].value=ACCION_DETENIDA
399                                        mitriada.estado=ACCION_TERMINADA
400
401                                        break;
402                                case ACCION_INICIADA :
403                                        oIMGs[ultimgale].src="../images/iconos/acIniciada.gif"
404                                        oIMGs[ultimgale].value=ACCION_INICIADA
405                                        mitriada.estado=ACCION_INICIADA
406                                        break;
407                }
408                actualiza_triadas(mitriada,mulaccion);
409                alert(TbMsg[8])
410        }
411//________________________________________________________________________________________________________
412        function resultado_reiniciar_accion(resul,descrierror,id){
413                if (!resul){
414                        alert(descrierror)
415                        return
416                }
417                var mulaccion=document.getElementById("mulaccion").value;// Toma los identificadores de todas las acciones
418                mitriada=new TRIADA;
419                toma_triada(mitriada,mulaccion);
420
421                var oIMGs=currentTR.getElementsByTagName('IMG')
422                ultimgale=oIMGs.length-2
423                oIMGs[ultimgale].src="../images/iconos/acIniciada.gif"
424                oIMGs[ultimgale].value=ACCION_INICIADA
425                mitriada.estado=ACCION_INICIADA
426
427                ultimgale=oIMGs.length-1
428                oIMGs[ultimgale].src="../images/iconos/acSinErrores.gif"
429                oIMGs[ultimgale].value=ACCION_SINERRORES
430                mitriada.resultado=ACCION_SINERRORES
431
432                var oTDPORCEN=document.getElementById("PORCEN-"+currentAccion);
433                oTDPORCEN.innerHTML="0%";
434
435                CambiaImg_Notificaciones("../images/iconos/reiniciar.gif",ACCION_REINICIADA)
436                actualiza_triadas(mitriada,mulaccion);
437
438                alert(TbMsg[9])
439        }
440//________________________________________________________________________________________________________
441        function resultado_eliminar_accion(resul,descrierror,id){
442                if (!resul){
443                        alert(descrierror)
444                        return
445                }
446                var oIMGs=currentTR.getElementsByTagName('IMG')
447                ultimgale=oIMGs.length-1
448                oIMGs[ultimgale].src="../images/iconos/eliminar.gif"
449                oIMGs[ultimgale].value="-1"
450
451                CambiaImg_Notificaciones("../images/iconos/eliminar.gif",ACCION_ELIMINADA)
452
453                alert(TbMsg[10])
454        }
455//________________________________________________________________________________________________________
456        function resalta(o,tipac,nombreac){
457                var wobj=o
458                // Toma el objeto TR de la acción
459                while (wobj.tagName!="TR"){
460                        wobj=wobj.parentNode
461                }
462                var woIMGs=wobj.getElementsByTagName('IMG')
463                var wultimgale=woIMGs.length-1
464                var wresimg=woIMGs[wultimgale].value
465                if(wresimg==ACCION_ELIMINADA){
466                        alert(TbMsg[6]);
467                        event.returnValue=false;
468                        return
469                }
470                currentIdcmdtskwrk=o.getAttribute("name"); // Toma el identificador del comando,tarea o trabajo
471                currentCodtipoaccion=tipac // Toma el tipo de acción: comando,tarea o trabajo
472                currentAccion=o.getAttribute("id")
473
474                currentidTipoAccion=currentIdcmdtskwrk; 
475                currentTipoAccion=currentCodtipoaccion; 
476                currentNombreTipoAccion=nombreac; 
477
478                reset_seleccion();
479
480                currentTR=wobj;
481                currentIdambcmdtskwrk=currentTR.value  // comando,tarea o trabajo
482                var oTDs=currentTR.getElementsByTagName('TD')
483                for(var i=0;i<oTDs.length;i++){
484                        oTDs[i].style.backgroundColor="E2007F";
485                        oTDs[i].style.color="#ffffff"
486                }
487
488                switch(currentTipoAccion){
489                        case EJECUCION_COMANDO:
490                                        menu_contextual(null,'flo_comandos');
491                                        break;
492                        case EJECUCION_TAREA:
493                                        menu_contextual(null,'flo_tareas');
494                                        break;
495                        case EJECUCION_TRABAJO:
496                                        menu_contextual(null,'flo_trabajos');
497                                        break;
498                }
499        }
500//________________________________________________________________________________________________________
501        function resaltanot(o,tiponot){
502                var wobj=o
503                // Toma el objeto TR de la acción
504                while (wobj.tagName!="TR"){
505                        wobj=wobj.parentNode
506                }
507                var woIMGs=wobj.getElementsByTagName('IMG')
508                var wultimgale=woIMGs.length-1
509                var wresimg=woIMGs[wultimgale].value
510                if(wresimg==ACCION_ELIMINADA){
511                        alert(TbMsg[12]);
512                        event.returnValue=false;
513                        return
514                }
515                if(wresimg==ACCION_REINICIADA){
516                        alert(TbMsg[13]);
517                        event.returnValue=false;
518                        return
519                }
520
521                currentAccion=o.getAttribute("id") // Toma el identificador de la acción
522                currentNotificacion=o.name //  Toma el identificador de la notificación
523                currentIdNotificador=o.value // Toma el identificador del ordenador que notifica
524                currentTipoNotificador=tiponot // Toma el tipo de notificador ( ordenador, comando o tarea )
525
526                reset_seleccion();
527
528                currentNotTR=wobj;
529                var oTDs=currentNotTR.getElementsByTagName('TD')
530
531                for(var i=0;i<oTDs.length;i++){
532                        oTDs[i].style.backgroundColor="E2007F"; // Rojo
533                        oTDs[i].style.color="#ffffff"
534                }
535                // Toma el objeto TR de la acción
536                var auxSplit=currentNotTR.getAttribute("id").split("_"); // Toma identificación del nodo notificación
537                var idTR='ACC_'+auxSplit[1];
538                currentTR=document.getElementById(idTR);
539                currentTipoAccion=currentTR.name
540                menu_contextual(null,'flo_notificaciones');
541        }
542//________________________________________________________________________________________________________
543        function ver_notificaciones(o,sw,ida){
544                return;
545               
546                o=o.parentNode // Elemento HREF
547                o=o.parentNode // Elemento TD
548                var IMG=o.childNodes[0].childNodes[sw] // Imagen
549                IMG.style.display="none"
550                sw++
551                if(sw>1)sw=0
552
553                IMG.style.display="block"
554
555                while (o.tagName!="TBODY"){
556                        o=o.parentNode
557                }
558                var oTRs=o.getElementsByTagName('TR')
559                for(var i=0;i<oTRs.length;i++){
560                        if(oTRs[i].getAttribute("id")=='NOT_'+ida || oTRs[i].getAttribute("id")=='PAR_'+ida)
561                                if (oTRs[i].style.visibility=="hidden") oTRs[i].style.visibility="visible"
562                                else
563                                        oTRs[i].style.visibility="hidden"
564                }
565                /*
566                for(var i=0;i<oTRs.length;i++){
567                        if(oTRs[i].getAttribute("id")=='NOT_'+ida || oTRs[i].getAttribute("id")=='PAR_'+ida)
568                                if (oTRs[i].style.display=="none") oTRs[i].style.display="block"
569                                else
570                                        oTRs[i].style.display="none"
571                }               
572                */
573        }
574//________________________________________________________________________________________________________
575        function vertabla_calendario(ofecha){
576                currentFecha=ofecha;
577                url="../varios/calendario_ventana.php?fecha="+ofecha.value
578                window.open(url,"vf","top=160,left=250,height=220,width=150,scrollbars=no")
579        }
580//________________________________________________________________________________________________________
581        function vertabla_horario(ohora){
582                currentHora=ohora;
583                url="../varios/horario_ventana.php?hora="+ohora.value
584                window.open(url,"vh","top=120,left=115,height=180,width=580,scrollbars=no")
585        }
586//________________________________________________________________________________________________________
587        function anade_fecha(fecha){
588                currentFecha.value=fecha
589        }
590//________________________________________________________________________________________________________
591        function anade_hora(hora){
592                currentHora.value=hora
593        }
594//________________________________________________________________________________________________________
595        function filtrar_accion(){
596                document.fdatos.idcmdtskwrk.value=currentIdcmdtskwrk
597                document.fdatos.codtipoaccion.value=currentCodtipoaccion
598                document.fdatos.submit()
599        }
600//________________________________________________________________________________________________________
601        function quitar_filtro(){
602                document.fdatos.idcmdtskwrk.value=""
603                document.fdatos.codtipoaccion.value=""
604                document.fdatos.idambcmdtskwrk.value=""
605                document.fdatos.submit()
606        }
607//________________________________________________________________________________________________________
608        function filtrar_porambito(){
609                document.fdatos.idcmdtskwrk.value=currentIdcmdtskwrk
610                document.fdatos.codtipoaccion.value=currentCodtipoaccion
611                document.fdatos.idambcmdtskwrk.value=currentIdambcmdtskwrk
612                document.fdatos.submit()
613        }
614//________________________________________________________________________________________________________
615        function modificar_resultado_notificacion(resultadoNot){
616                var oIMGs=currentNotTR.getElementsByTagName('IMG')
617                var ultimgale=oIMGs.length-1
618                var resimg=oIMGs[ultimgale].value
619                if(resimg==ACCION_EXITOSA && resultadoNot==ACCION_EXITOSA){
620                        alert(TbMsg[14]);
621                        return
622                }
623                if(resimg==ACCION_FALLIDA && resultadoNot==ACCION_FALLIDA){
624                        alert(TbMsg[15]);
625                        return
626                }
627                reset_contextual(-1,-1);
628
629                currentResultadoNot=resultadoNot;
630                ifr=document.getElementById("iframes_comodin"); // Toma objeto Iframe
631
632                var gestorcolas="";
633                switch(currentTipoNotificador){
634                                case NOTIFICADOR_ORDENADOR :
635                                        gestorcolas="../gestores/gestor_colasacciones.php";
636                                        break;
637                                case NOTIFICADOR_COMANDO :
638                                        gestorcolas="../gestores/gestor_colasacciones.php";
639                                        break;
640                                case NOTIFICADOR_TAREA :
641                                        gestorcolas="../gestores/gestor_colasacciones.php";
642                                        break;
643                }
644                wurl=gestorcolas+"?opcion="+op_modificar_resultado_notificacion+"&idaccion="+currentAccion+"&idnotificacion="+currentNotificacion+"&resultadoNot="+resultadoNot
645                ifr.src=wurl; // LLama a la página gestora
646        }
647//________________________________________________________________________________________________________
648        function resultado_modificar_resultado_notificacion(resul,descrierror,id){
649                if (!resul){
650                        alert(descrierror)
651                        return
652                }
653                // Cambia imagen resultado de la notificación
654                var oIMGs=currentNotTR.getElementsByTagName('IMG')
655                ultimgale=oIMGs.length-1
656                switch(currentResultadoNot){
657                                case ACCION_EXITOSA :
658                                        oIMGs[ultimgale].src="../images/iconos/acExitosa.gif"
659                                        oIMGs[ultimgale].value=ACCION_EXITOSA
660                                        if(currentTipoNotificador==NOTIFICADOR_ORDENADOR){
661                                                oIMGs[0].src="../images/iconos/ordenadornot_ok.gif"
662                                                var imgordnot=document.getElementById("ORDNOT_"+currentAccion+"_"+currentNotificacion);
663                                                imgordnot.src="../images/iconos/ordenadornot_ok.gif";
664                                        }
665                                        break;
666                                case ACCION_FALLIDA :
667                                        oIMGs[ultimgale].src="../images/iconos/acFallida.gif"
668                                        oIMGs[ultimgale].value=ACCION_FALLIDA
669                                        if(currentTipoNotificador==NOTIFICADOR_ORDENADOR){
670                                                oIMGs[0].src="../images/iconos/ordenadornot_ko.gif"
671                                                var imgordnot=document.getElementById("ORDNOT_"+currentAccion+"_"+currentNotificacion);
672                                                imgordnot.src="../images/iconos/ordenadornot_ko.gif";
673                                        }
674                                        break;
675                }
676
677                // Cambia imagen resultado de la acción
678                var oIMGs=currentTR.getElementsByTagName('IMG')
679                ultimgale=oIMGs.length-2
680                var imgestacc=oIMGs[ultimgale] // Imagen del estado de la acción
681                ultimgale=oIMGs.length-1
682                var imgresacc=oIMGs[ultimgale] // Imagen del resultado de la acción
683
684                if(currentResultadoNot==ACCION_FALLIDA){ // Si se notificó a Fallida
685                        if(imgestacc.value==ACCION_FINALIZADA){ // Si estado era Finalizada
686                                imgresacc.src="../images/iconos/acFallida.gif"; // queda como fallida
687                                imgresacc.value=ACCION_FALLIDA;
688                        }
689                        else{ // Si estado era Iniciada
690                                imgresacc.src="../images/iconos/acConErrores.gif"; // queda con errores
691                                imgresacc.value=ACCION_CONERRORES
692                        }
693                        alert(TbMsg[16])
694                        return
695                }
696
697                // Si se notificó a Exitosa, depende si hay alguna fallida  ...
698                if(AlgunaNotificacionFallidas()){
699                        alert(TbMsg[16])
700                        return // Existen más fallidas
701                }
702                // Actulización de la imagen
703                if(imgestacc.value==ACCION_FINALIZADA){ // Si estado era Finalizada
704                        imgresacc.src="../images/iconos/acExitosa.gif"; // queda como Exitosa
705                        imgresacc.value=ACCION_EXITOSA;
706                }
707                else {// Si estado era Iniciada
708                        imgresacc.src="../images/iconos/acSinErrores.gif"; // queda sinerrores
709                        imgresacc.value=ACCION_SINERRORES;
710                }
711
712                alert(TbMsg[16])
713
714        }
715//________________________________________________________________________________________________________
716        function reiniciar_notificacion(){
717                reset_contextual(-1,-1);
718
719                ifr=document.getElementById("iframes_comodin"); // Toma objeto Iframe
720                var gestorcolas="";
721                switch(currentTipoNotificador){
722                                case NOTIFICADOR_ORDENADOR :
723                                        gestorcolas="../gestores/gestor_colasacciones.php";
724                                        break;
725                                case NOTIFICADOR_COMANDO :
726                                        gestorcolas="../gestores/gestor_colasacciones.php";
727                                        break;
728                                case NOTIFICADOR_TAREA :
729                                        gestorcolas="../gestores/gestor_colasacciones.php";
730                                        break;
731                }
732                var wurl=gestorcolas+"?opcion="+op_reiniciar_notificacion+"&idaccion="+currentAccion+"&idnotificacion="+currentNotificacion+"&idnotificador="+currentIdNotificador
733                ifr.src=wurl; // LLama a la página gestora
734        }
735//________________________________________________________________________________________________________
736        function resultado_reiniciar_notificacion(resul,descrierror,id){
737                if (!resul){
738                                alert(descrierror)
739                        return
740                }
741                var oIMGs=currentNotTR.getElementsByTagName('IMG')
742                ultimgale=oIMGs.length-1
743                oIMGs[ultimgale].src="../images/iconos/reiniciar.gif"
744                oIMGs[ultimgale].value=ACCION_REINICIADA
745
746                if(currentTipoNotificador==NOTIFICADOR_ORDENADOR){
747                        oIMGs[0].src="../images/iconos/ordenadornot.gif"
748                        var imgordnot=document.getElementById("ORDNOT_"+currentAccion+"_"+currentNotificacion);
749                        imgordnot.src="../images/iconos/ordenadornot.gif";
750                }
751                // Cambia imagen resultado de la acción
752                var oIMGs=currentTR.getElementsByTagName('IMG')
753                ultimgale=oIMGs.length-2
754                var imgestacc=oIMGs[ultimgale] // Imagen del estado de la acción
755                ultimgale=oIMGs.length-1
756                var imgresacc=oIMGs[ultimgale] // Imagen del resultado de la acción
757
758                imgestacc.src="../images/iconos/acIniciada.gif"; // queda como iniciada
759                imgestacc.value=ACCION_INICIADA;
760
761                //  AL eliminar la notificación se consultan las que quedan ...
762                if(AlgunaNotificacionFallidas()){
763                        imgresacc.src="../images/iconos/acConErrores.gif"; // queda conerrores
764                        imgresacc.value=ACCION_CONERRORES;
765                }
766                else
767                        {
768                        imgresacc.src="../images/iconos/acSinErrores.gif"; // queda sinerrores
769                        imgresacc.value=ACCION_SINERRORES;
770                }
771
772                alert(TbMsg[17])
773        }
774//________________________________________________________________________________________________________
775        function AlgunaNotificacion(){
776                var idTR=currentNotTR.getAttribute("id"); // Toma id del TR de notificación
777                o=currentNotTR.parentNode
778                while (o.tagName!="TBODY"){
779                        o=o.parentNode
780                }
781                var oTRs=o.getElementsByTagName('TR') // Toma la colección de TR's
782                for(var i=0;i<oTRs.length;i++){
783                        if(oTRs[i].getAttribute("id")==idTR){ // Si es un TR de la notificación implicada
784                                var oIMGs=oTRs[i].getElementsByTagName('IMG')
785                                for(var j=0;j<oIMGs.length;j++){
786                                        var ultimgale=oIMGs.length-1
787                                        var imgresnot=oIMGs[ultimgale] // Imagen del resultado de la notificación
788                                        if(imgresnot.value==ACCION_EXITOSA || imgresnot.value==ACCION_FALLIDA || imgresnot.value==ACCION_REINICIADA )
789                                                return(true); // Hay al menos una notificación
790                                }
791                        }
792                }
793                return(false);
794        }
795//________________________________________________________________________________________________________
796        function AlgunaNotificacionFallidas(){
797                var idTR=currentNotTR.getAttribute("id"); // Toma id del TR de notificación
798                o=currentNotTR.parentNode
799                while (o.tagName!="TBODY"){
800                        o=o.parentNode
801                }
802                var oTRs=o.getElementsByTagName('TR') // Toma la colección de TR's
803                for(var i=0;i<oTRs.length;i++){
804                        if(oTRs[i].getAttribute("id")==idTR){ // Si es un TR de la notificación implicada
805                                var oIMGs=oTRs[i].getElementsByTagName('IMG')
806                                for(var j=0;j<oIMGs.length;j++){
807                                        var ultimgale=oIMGs.length-1
808                                        var imgresnot=oIMGs[ultimgale] // Imagen del resultado de la notificación
809                                        if(imgresnot.value==ACCION_FALLIDA)
810                                                return(true); // Hay al menos una notificación con error
811                                }
812                        }
813                }
814                return(false);
815        }
816//________________________________________________________________________________________________________
817        function CambiaImg_Notificaciones(srcimg,vacc){
818                o=currentTR;
819                while (o.tagName!="TBODY"){
820                        o=o.parentNode
821                }
822                var oTRs=o.getElementsByTagName('TR')
823                for(var i=0;i<oTRs.length;i++){
824                        if(oTRs[i].getAttribute("id")=='NOT_'+currentAccion){
825                                var oIMGs=oTRs[i].getElementsByTagName('IMG')
826                                var ultimgale=oIMGs.length-1
827                                if(ultimgale>0){
828                                        var ultimgale=oIMGs.length-1
829                                        oIMGs[ultimgale].src=srcimg
830                                        oIMGs[ultimgale].value=vacc
831                                        if(currentTipoAccion==EJECUCION_COMANDO){
832                                                oIMGs[0].src="../images/iconos/ordenadornot.gif"
833                                                var idnotif=oIMGs[0].name
834                                                var imgordnot=document.getElementById("ORDNOT_"+currentAccion+"_"+idnotif);
835                                                imgordnot.src="../images/iconos/ordenadornot.gif";
836                                        }
837                                }
838                        }
839                }
840        }
841
842//________________________________________________________________________________________________________
843        function ver_accion(){
844                switch(currentTipoAccion){
845                                case EJECUCION_COMANDO :
846                                        break;
847                                case EJECUCION_TAREA :
848                                                document.fdatos.tsk_ambito.value=document.fdatos.ambito.value
849                                                document.fdatos.tsk_idambito.value=document.fdatos.idambito.value
850                                                document.fdatos.tsk_nombreambito.value=document.fdatos.nombreambito.value
851
852                                                document.fdatos.tsk_fechainicio.value=document.fdatos.fechainicio.value
853                                                document.fdatos.tsk_fechafin.value=document.fdatos.fechafin.value
854                                                document.fdatos.tsk_horainicio.value=document.fdatos.horainicio.value
855                                                document.fdatos.tsk_horafin.value=document.fdatos.horafin.value
856                                                document.fdatos.tsk_tiposacciones.value=document.fdatos.tiposacciones.value
857                                                document.fdatos.tsk_estados.value=document.fdatos.estados.value
858                                                document.fdatos.tsk_resultados.value=document.fdatos.resultados.value
859                                                document.fdatos.tsk_porcendesde.value=document.fdatos.porcendesde.value
860                                                document.fdatos.tsk_porcenhasta.value=document.fdatos.porcenhasta.value
861
862                                                document.fdatos.tsk_idcmdtskwrk.value=document.fdatos.idcmdtskwrk.value
863                                                document.fdatos.tsk_codtipoaccion.value=document.fdatos.codtipoaccion.value
864                                                document.fdatos.tsk_idambcmdtskwrk.value=document.fdatos.idambcmdtskwrk.value
865
866                                                document.fdatos.tsk_accionid.value=document.fdatos.accionid.value
867                                                document.fdatos.tsk_idTipoAccion.value=document.fdatos.idTipoAccion.value
868                                                document.fdatos.tsk_TipoAccion.value=document.fdatos.TipoAccion.value
869                                                document.fdatos.tsk_NombreTipoAccion.value=document.fdatos.NombreTipoAccion.value
870
871                                                marca_accion(EJECUCION_COMANDO,true);
872                                        break;
873                                case EJECUCION_TRABAJO :
874                                                document.fdatos.wrk_ambito.value=document.fdatos.ambito.value
875                                                document.fdatos.wrk_idambito.value=document.fdatos.idambito.value
876                                                document.fdatos.wrk_nombreambito.value=document.fdatos.nombreambito.value
877
878                                                document.fdatos.wrk_fechainicio.value=document.fdatos.fechainicio.value
879                                                document.fdatos.wrk_fechafin.value=document.fdatos.fechafin.value
880                                                document.fdatos.wrk_horainicio.value=document.fdatos.horainicio.value
881                                                document.fdatos.wrk_horafin.value=document.fdatos.horafin.value
882                                                document.fdatos.wrk_tiposacciones.value=document.fdatos.tiposacciones.value
883                                                document.fdatos.wrk_estados.value=document.fdatos.estados.value
884                                                document.fdatos.wrk_resultados.value=document.fdatos.resultados.value
885                                                document.fdatos.wrk_porcendesde.value=document.fdatos.porcendesde.value
886                                                document.fdatos.wrk_porcenhasta.value=document.fdatos.porcenhasta.value
887
888                                                document.fdatos.wrk_idcmdtskwrk.value=document.fdatos.idcmdtskwrk.value
889                                                document.fdatos.wrk_codtipoaccion.value=document.fdatos.codtipoaccion.value
890                                                document.fdatos.wrk_idambcmdtskwrk.value=document.fdatos.idambcmdtskwrk.value
891
892                                                document.fdatos.wrk_accionid.value=document.fdatos.accionid.value
893                                                document.fdatos.wrk_idTipoAccion.value=document.fdatos.idTipoAccion.value
894                                                document.fdatos.wrk_TipoAccion.value=document.fdatos.TipoAccion.value
895                                                document.fdatos.wrk_NombreTipoAccion.value=document.fdatos.NombreTipoAccion.value
896
897                                                marca_accion(EJECUCION_TAREA,true);
898                                        break;
899                }
900                document.fdatos.accionid.value=currentAccion
901                document.fdatos.idTipoAccion.value=currentidTipoAccion
902                document.fdatos.TipoAccion.value=currentTipoAccion
903                document.fdatos.NombreTipoAccion.value=currentNombreTipoAccion
904
905                marca_estado(ACCION_DETENIDA,true);
906                marca_estado(ACCION_INICIADA,true);
907                marca_estado(ACCION_FINALIZADA,true);
908       
909                marca_resultado(ACCION_EXITOSA,true);
910                marca_resultado(ACCION_FALLIDA,true);
911                marca_resultado(ACCION_TERMINADA,false);
912                marca_resultado(ACCION_ABORTADA,false);
913                marca_resultado(ACCION_SINERRORES,true);
914                marca_resultado(ACCION_CONERRORES,true);
915                document.fdatos.submit()
916        }
917//________________________________________________________________________________________________________
918        function ver_accionpadre(tipoaccion){
919                                switch(tipoaccion){
920                                case EJECUCION_COMANDO :
921                                        break;
922                                case EJECUCION_TAREA :
923                                                document.fdatos.ambito.value=document.fdatos.tsk_ambito.value
924                                                document.fdatos.idambito.value=document.fdatos.tsk_idambito.value
925                                                document.fdatos.nombreambito.value=document.fdatos.tsk_nombreambito.value
926
927                                                document.fdatos.fechainicio.value=document.fdatos.tsk_fechainicio.value
928                                                document.fdatos.fechafin.value=document.fdatos.tsk_fechafin.value
929                                                document.fdatos.horainicio.value=document.fdatos.tsk_horainicio.value
930                                                document.fdatos.horafin.value=document.fdatos.tsk_horafin.value
931                                                document.fdatos.tiposacciones.value=document.fdatos.tsk_tiposacciones.value
932                                                document.fdatos.estados.value=document.fdatos.tsk_estados.value
933                                                document.fdatos.resultados.value=document.fdatos.tsk_resultados.value
934                                                document.fdatos.porcendesde.value=document.fdatos.tsk_porcendesde.value
935                                                document.fdatos.porcenhasta.value=document.fdatos.tsk_porcenhasta.value
936
937                                                document.fdatos.idcmdtskwrk.value=document.fdatos.tsk_idcmdtskwrk.value
938                                                document.fdatos.codtipoaccion.value=document.fdatos.tsk_codtipoaccion.value
939                                                document.fdatos.idambcmdtskwrk.value=document.fdatos.tsk_idambcmdtskwrk.value
940
941                                                document.fdatos.accionid.value=document.fdatos.tsk_accionid.value
942                                                document.fdatos.idTipoAccion.value=document.fdatos.tsk_idTipoAccion.value
943                                                document.fdatos.TipoAccion.value=document.fdatos.tsk_TipoAccion.value
944                                                document.fdatos.NombreTipoAccion.value=document.fdatos.tsk_NombreTipoAccion.value
945                                        break;
946                                case EJECUCION_TRABAJO :
947                                                document.fdatos.ambito.value=document.fdatos.wrk_ambito.value
948                                                document.fdatos.idambito.value=document.fdatos.wrk_idambito.value
949                                                document.fdatos.nombreambito.value=document.fdatos.wrk_nombreambito.value
950
951                                                document.fdatos.fechainicio.value=document.fdatos.wrk_fechainicio.value
952                                                document.fdatos.fechafin.value=document.fdatos.wrk_fechafin.value
953                                                document.fdatos.horainicio.value=document.fdatos.wrk_horainicio.value
954                                                document.fdatos.horafin.value=document.fdatos.wrk_horafin.value
955                                                document.fdatos.tiposacciones.value=document.fdatos.wrk_tiposacciones.value
956                                                document.fdatos.estados.value=document.fdatos.wrk_estados.value
957                                                document.fdatos.resultados.value=document.fdatos.wrk_resultados.value
958                                                document.fdatos.porcendesde.value=document.fdatos.wrk_porcendesde.value
959                                                document.fdatos.porcenhasta.value=document.fdatos.wrk_porcenhasta.value
960
961                                                document.fdatos.idcmdtskwrk.value=document.fdatos.wrk_idcmdtskwrk.value
962                                                document.fdatos.codtipoaccion.value=document.fdatos.wrk_codtipoaccion.value
963                                                document.fdatos.idambcmdtskwrk.value=document.fdatos.wrk_idambcmdtskwrk.value
964
965                                                document.fdatos.accionid.value=document.fdatos.wrk_accionid.value
966                                                document.fdatos.idTipoAccion.value=document.fdatos.wrk_idTipoAccion.value
967                                                document.fdatos.TipoAccion.value=document.fdatos.wrk_TipoAccion.value
968                                                document.fdatos.NombreTipoAccion.value=document.fdatos.wrk_NombreTipoAccion.value
969                                        break;
970                }
971                document.fdatos.submit()
972
973        }
974//________________________________________________________________________________________________________
975        function reset_seleccion(){
976                if(currentTR!=null){
977                        var oTDs=currentTR.getElementsByTagName('TD')
978                        for(var i=0;i<oTDs.length;i++){
979                                oTDs[i].style.backgroundColor="#EEEECC"
980                                oTDs[i].style.color="#003300"
981                        }
982                        currentTR=null;
983                }
984                if(currentNotTR!=null){
985                        var oTDs=currentNotTR.getElementsByTagName('TD')
986                        oTDs[0].style.backgroundColor="#EEEECC"
987                        for(var i=1;i<oTDs.length;i++){
988                                oTDs[i].style.backgroundColor="#E3D8C6"
989                                oTDs[i].style.color="#003300"
990                        }
991                        currentNotTR=null;
992                }
993        }
994//________________________________________________________________________________________________________
995// Captura la triada idaccion,estado,resultado para lactualizaciones de operaciones de acciones multiples
996//________________________________________________________________________________________________________
997        function toma_triada(oTriada,wmulaccion){
998                patron=";"+currentAccion+":";
999                var re = new RegExp (";"+currentAccion+":", 'gi') ;
1000                var pos=wmulaccion.search(re)
1001                if(pos<0){ // Comprueba si está el primero
1002                        patron=currentAccion+":";
1003                        var re = new RegExp (";"+currentAccion+":", 'gi') ;
1004                        var pos=wmulaccion.search(re)
1005                        if(pos>0) pos=-1; // No  está el primero , asi que no está
1006                }
1007                if(pos<0) oTriada.swexst=false; // No  está el primero , asi que no está
1008                pos++;
1009                var posa=pos;
1010                while(pos<wmulaccion.length){
1011                        if(wmulaccion.charAt(pos)==";") break;
1012                        pos++;
1013                }
1014                var posb=pos;
1015                var triada=wmulaccion.substr(posa,posb-posa)
1016                var auxsplit=triada.split(":");
1017                oTriada.posini=posa
1018                oTriada.posifi=posb
1019                oTriada.idaccion=auxsplit[0];
1020                oTriada.estado=auxsplit[1];
1021                oTriada.resultado=auxsplit[2];
1022                oTriada.swexst=true;
1023        }
1024//________________________________________________________________________________________________________
1025        function actualiza_triadas(oTriada,wmulaccion){
1026                var nwtriada=oTriada.idaccion+":"+oTriada.estado+":"+oTriada.resultado
1027                var lon=wmulaccion.length;
1028                var string1=wmulaccion.substr(0,mitriada.posini) // Primera parte de la cadena
1029                var string2=wmulaccion.substr(mitriada.posifi,lon) // Primera parte de la cadena
1030                var oMulaccion=document.getElementById("mulaccion");// Toma los identificadores de todas las acciones
1031                oMulaccion.value=string1+nwtriada+string2;
1032        }
1033//________________________________________________________________________________________________________
1034// definicion dela clase triada
1035//________________________________________________________________________________________________________
1036        function TRIADA(){
1037                this.posini=0;
1038                this.posifi=0;
1039                this.idaccion;
1040                this.estado;
1041                this.resultado;
1042                this.swexst;
1043        }
Note: See TracBrowser for help on using the repository browser.