source: admin/ogAdmSources/ogAdmWebCon/jscripts/colasacciones.js @ e42f34e

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 e42f34e was 8964f9b, checked in by ramon <ramongomez@…>, 16 years ago

Resstructuración de trunk.

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

  • Property mode set to 100644
File size: 39.3 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                o=o.parentNode
545                o.childNodes[sw].style.display="none"
546                sw++
547                if(sw>1)sw=0
548                o.childNodes[sw].style.display="block"
549
550                while (o.tagName!="TBODY"){
551                        o=o.parentNode
552                }
553                var oTRs=o.getElementsByTagName('TR')
554                for(var i=0;i<oTRs.length;i++){
555                        if(oTRs[i].getAttribute("id")=='NOT_'+ida || oTRs[i].getAttribute("id")=='PAR_'+ida)
556                                if (oTRs[i].style.display=="none") oTRs[i].style.display="block"
557                                else
558                                        oTRs[i].style.display="none"
559                }
560        }
561//________________________________________________________________________________________________________
562        function vertabla_calendario(ofecha){
563                currentFecha=ofecha;
564                url="../varios/calendario_ventana.php?fecha="+ofecha.value
565                window.open(url,"vf","top=160,left=250,height=220,width=150,scrollbars=no")
566        }
567//________________________________________________________________________________________________________
568        function vertabla_horario(ohora){
569                currentHora=ohora;
570                url="../varios/horario_ventana.php?hora="+ohora.value
571                window.open(url,"vh","top=120,left=115,height=180,width=580,scrollbars=no")
572        }
573//________________________________________________________________________________________________________
574        function anade_fecha(fecha){
575                currentFecha.value=fecha
576        }
577//________________________________________________________________________________________________________
578        function anade_hora(hora){
579                currentHora.value=hora
580        }
581//________________________________________________________________________________________________________
582        function filtrar_accion(){
583                document.fdatos.idcmdtskwrk.value=currentIdcmdtskwrk
584                document.fdatos.codtipoaccion.value=currentCodtipoaccion
585                document.fdatos.submit()
586        }
587//________________________________________________________________________________________________________
588        function quitar_filtro(){
589                document.fdatos.idcmdtskwrk.value=""
590                document.fdatos.codtipoaccion.value=""
591                document.fdatos.idambcmdtskwrk.value=""
592                document.fdatos.submit()
593        }
594//________________________________________________________________________________________________________
595        function filtrar_porambito(){
596                document.fdatos.idcmdtskwrk.value=currentIdcmdtskwrk
597                document.fdatos.codtipoaccion.value=currentCodtipoaccion
598                document.fdatos.idambcmdtskwrk.value=currentIdambcmdtskwrk
599                document.fdatos.submit()
600        }
601//________________________________________________________________________________________________________
602        function modificar_resultado_notificacion(resultadoNot){
603                var oIMGs=currentNotTR.getElementsByTagName('IMG')
604                var ultimgale=oIMGs.length-1
605                var resimg=oIMGs[ultimgale].value
606                if(resimg==ACCION_EXITOSA && resultadoNot==ACCION_EXITOSA){
607                        alert(TbMsg[14]);
608                        return
609                }
610                if(resimg==ACCION_FALLIDA && resultadoNot==ACCION_FALLIDA){
611                        alert(TbMsg[15]);
612                        return
613                }
614                reset_contextual(-1,-1);
615
616                currentResultadoNot=resultadoNot;
617                ifr=document.getElementById("iframes_comodin"); // Toma objeto Iframe
618
619                var gestorcolas="";
620                switch(currentTipoNotificador){
621                                case NOTIFICADOR_ORDENADOR :
622                                        gestorcolas="../gestores/gestor_colasacciones.php";
623                                        break;
624                                case NOTIFICADOR_COMANDO :
625                                        gestorcolas="../gestores/gestor_colasacciones.php";
626                                        break;
627                                case NOTIFICADOR_TAREA :
628                                        gestorcolas="../gestores/gestor_colasacciones.php";
629                                        break;
630                }
631                wurl=gestorcolas+"?opcion="+op_modificar_resultado_notificacion+"&idaccion="+currentAccion+"&idnotificacion="+currentNotificacion+"&resultadoNot="+resultadoNot
632                ifr.src=wurl; // LLama a la página gestora
633        }
634//________________________________________________________________________________________________________
635        function resultado_modificar_resultado_notificacion(resul,descrierror,id){
636                if (!resul){
637                        alert(descrierror)
638                        return
639                }
640                // Cambia imagen resultado de la notificación
641                var oIMGs=currentNotTR.getElementsByTagName('IMG')
642                ultimgale=oIMGs.length-1
643                switch(currentResultadoNot){
644                                case ACCION_EXITOSA :
645                                        oIMGs[ultimgale].src="../images/iconos/acExitosa.gif"
646                                        oIMGs[ultimgale].value=ACCION_EXITOSA
647                                        if(currentTipoNotificador==NOTIFICADOR_ORDENADOR){
648                                                oIMGs[0].src="../images/iconos/ordenadornot_ok.gif"
649                                                var imgordnot=document.getElementById("ORDNOT_"+currentAccion+"_"+currentNotificacion);
650                                                imgordnot.src="../images/iconos/ordenadornot_ok.gif";
651                                        }
652                                        break;
653                                case ACCION_FALLIDA :
654                                        oIMGs[ultimgale].src="../images/iconos/acFallida.gif"
655                                        oIMGs[ultimgale].value=ACCION_FALLIDA
656                                        if(currentTipoNotificador==NOTIFICADOR_ORDENADOR){
657                                                oIMGs[0].src="../images/iconos/ordenadornot_ko.gif"
658                                                var imgordnot=document.getElementById("ORDNOT_"+currentAccion+"_"+currentNotificacion);
659                                                imgordnot.src="../images/iconos/ordenadornot_ko.gif";
660                                        }
661                                        break;
662                }
663
664                // Cambia imagen resultado de la acción
665                var oIMGs=currentTR.getElementsByTagName('IMG')
666                ultimgale=oIMGs.length-2
667                var imgestacc=oIMGs[ultimgale] // Imagen del estado de la acción
668                ultimgale=oIMGs.length-1
669                var imgresacc=oIMGs[ultimgale] // Imagen del resultado de la acción
670
671                if(currentResultadoNot==ACCION_FALLIDA){ // Si se notificó a Fallida
672                        if(imgestacc.value==ACCION_FINALIZADA){ // Si estado era Finalizada
673                                imgresacc.src="../images/iconos/acFallida.gif"; // queda como fallida
674                                imgresacc.value=ACCION_FALLIDA;
675                        }
676                        else{ // Si estado era Iniciada
677                                imgresacc.src="../images/iconos/acConErrores.gif"; // queda con errores
678                                imgresacc.value=ACCION_CONERRORES
679                        }
680                        alert(TbMsg[16])
681                        return
682                }
683
684                // Si se notificó a Exitosa, depende si hay alguna fallida  ...
685                if(AlgunaNotificacionFallidas()){
686                        alert(TbMsg[16])
687                        return // Existen más fallidas
688                }
689                // Actulización de la imagen
690                if(imgestacc.value==ACCION_FINALIZADA){ // Si estado era Finalizada
691                        imgresacc.src="../images/iconos/acExitosa.gif"; // queda como Exitosa
692                        imgresacc.value=ACCION_EXITOSA;
693                }
694                else {// Si estado era Iniciada
695                        imgresacc.src="../images/iconos/acSinErrores.gif"; // queda sinerrores
696                        imgresacc.value=ACCION_SINERRORES;
697                }
698
699                alert(TbMsg[16])
700
701        }
702//________________________________________________________________________________________________________
703        function reiniciar_notificacion(){
704                reset_contextual(-1,-1);
705
706                ifr=document.getElementById("iframes_comodin"); // Toma objeto Iframe
707                var gestorcolas="";
708                switch(currentTipoNotificador){
709                                case NOTIFICADOR_ORDENADOR :
710                                        gestorcolas="../gestores/gestor_colasacciones.php";
711                                        break;
712                                case NOTIFICADOR_COMANDO :
713                                        gestorcolas="../gestores/gestor_colasacciones.php";
714                                        break;
715                                case NOTIFICADOR_TAREA :
716                                        gestorcolas="../gestores/gestor_colasacciones.php";
717                                        break;
718                }
719                var wurl=gestorcolas+"?opcion="+op_reiniciar_notificacion+"&idaccion="+currentAccion+"&idnotificacion="+currentNotificacion+"&idnotificador="+currentIdNotificador
720                ifr.src=wurl; // LLama a la página gestora
721        }
722//________________________________________________________________________________________________________
723        function resultado_reiniciar_notificacion(resul,descrierror,id){
724                if (!resul){
725                                alert(descrierror)
726                        return
727                }
728                var oIMGs=currentNotTR.getElementsByTagName('IMG')
729                ultimgale=oIMGs.length-1
730                oIMGs[ultimgale].src="../images/iconos/reiniciar.gif"
731                oIMGs[ultimgale].value=ACCION_REINICIADA
732
733                if(currentTipoNotificador==NOTIFICADOR_ORDENADOR){
734                        oIMGs[0].src="../images/iconos/ordenadornot.gif"
735                        var imgordnot=document.getElementById("ORDNOT_"+currentAccion+"_"+currentNotificacion);
736                        imgordnot.src="../images/iconos/ordenadornot.gif";
737                }
738                // Cambia imagen resultado de la acción
739                var oIMGs=currentTR.getElementsByTagName('IMG')
740                ultimgale=oIMGs.length-2
741                var imgestacc=oIMGs[ultimgale] // Imagen del estado de la acción
742                ultimgale=oIMGs.length-1
743                var imgresacc=oIMGs[ultimgale] // Imagen del resultado de la acción
744
745                imgestacc.src="../images/iconos/acIniciada.gif"; // queda como iniciada
746                imgestacc.value=ACCION_INICIADA;
747
748                //  AL eliminar la notificación se consultan las que quedan ...
749                if(AlgunaNotificacionFallidas()){
750                        imgresacc.src="../images/iconos/acConErrores.gif"; // queda conerrores
751                        imgresacc.value=ACCION_CONERRORES;
752                }
753                else
754                        {
755                        imgresacc.src="../images/iconos/acSinErrores.gif"; // queda sinerrores
756                        imgresacc.value=ACCION_SINERRORES;
757                }
758
759                alert(TbMsg[17])
760        }
761//________________________________________________________________________________________________________
762        function AlgunaNotificacion(){
763                var idTR=currentNotTR.getAttribute("id"); // Toma id del TR de notificación
764                o=currentNotTR.parentNode
765                while (o.tagName!="TBODY"){
766                        o=o.parentNode
767                }
768                var oTRs=o.getElementsByTagName('TR') // Toma la colección de TR's
769                for(var i=0;i<oTRs.length;i++){
770                        if(oTRs[i].getAttribute("id")==idTR){ // Si es un TR de la notificación implicada
771                                var oIMGs=oTRs[i].getElementsByTagName('IMG')
772                                for(var j=0;j<oIMGs.length;j++){
773                                        var ultimgale=oIMGs.length-1
774                                        var imgresnot=oIMGs[ultimgale] // Imagen del resultado de la notificación
775                                        if(imgresnot.value==ACCION_EXITOSA || imgresnot.value==ACCION_FALLIDA || imgresnot.value==ACCION_REINICIADA )
776                                                return(true); // Hay al menos una notificación
777                                }
778                        }
779                }
780                return(false);
781        }
782//________________________________________________________________________________________________________
783        function AlgunaNotificacionFallidas(){
784                var idTR=currentNotTR.getAttribute("id"); // Toma id del TR de notificación
785                o=currentNotTR.parentNode
786                while (o.tagName!="TBODY"){
787                        o=o.parentNode
788                }
789                var oTRs=o.getElementsByTagName('TR') // Toma la colección de TR's
790                for(var i=0;i<oTRs.length;i++){
791                        if(oTRs[i].getAttribute("id")==idTR){ // Si es un TR de la notificación implicada
792                                var oIMGs=oTRs[i].getElementsByTagName('IMG')
793                                for(var j=0;j<oIMGs.length;j++){
794                                        var ultimgale=oIMGs.length-1
795                                        var imgresnot=oIMGs[ultimgale] // Imagen del resultado de la notificación
796                                        if(imgresnot.value==ACCION_FALLIDA)
797                                                return(true); // Hay al menos una notificación con error
798                                }
799                        }
800                }
801                return(false);
802        }
803//________________________________________________________________________________________________________
804        function CambiaImg_Notificaciones(srcimg,vacc){
805                o=currentTR;
806                while (o.tagName!="TBODY"){
807                        o=o.parentNode
808                }
809                var oTRs=o.getElementsByTagName('TR')
810                for(var i=0;i<oTRs.length;i++){
811                        if(oTRs[i].getAttribute("id")=='NOT_'+currentAccion){
812                                var oIMGs=oTRs[i].getElementsByTagName('IMG')
813                                var ultimgale=oIMGs.length-1
814                                if(ultimgale>0){
815                                        var ultimgale=oIMGs.length-1
816                                        oIMGs[ultimgale].src=srcimg
817                                        oIMGs[ultimgale].value=vacc
818                                        if(currentTipoAccion==EJECUCION_COMANDO){
819                                                oIMGs[0].src="../images/iconos/ordenadornot.gif"
820                                                var idnotif=oIMGs[0].name
821                                                var imgordnot=document.getElementById("ORDNOT_"+currentAccion+"_"+idnotif);
822                                                imgordnot.src="../images/iconos/ordenadornot.gif";
823                                        }
824                                }
825                        }
826                }
827        }
828
829//________________________________________________________________________________________________________
830        function ver_accion(){
831                switch(currentTipoAccion){
832                                case EJECUCION_COMANDO :
833                                        break;
834                                case EJECUCION_TAREA :
835                                                document.fdatos.tsk_ambito.value=document.fdatos.ambito.value
836                                                document.fdatos.tsk_idambito.value=document.fdatos.idambito.value
837                                                document.fdatos.tsk_nombreambito.value=document.fdatos.nombreambito.value
838
839                                                document.fdatos.tsk_fechainicio.value=document.fdatos.fechainicio.value
840                                                document.fdatos.tsk_fechafin.value=document.fdatos.fechafin.value
841                                                document.fdatos.tsk_horainicio.value=document.fdatos.horainicio.value
842                                                document.fdatos.tsk_horafin.value=document.fdatos.horafin.value
843                                                document.fdatos.tsk_tiposacciones.value=document.fdatos.tiposacciones.value
844                                                document.fdatos.tsk_estados.value=document.fdatos.estados.value
845                                                document.fdatos.tsk_resultados.value=document.fdatos.resultados.value
846                                                document.fdatos.tsk_porcendesde.value=document.fdatos.porcendesde.value
847                                                document.fdatos.tsk_porcenhasta.value=document.fdatos.porcenhasta.value
848
849                                                document.fdatos.tsk_idcmdtskwrk.value=document.fdatos.idcmdtskwrk.value
850                                                document.fdatos.tsk_codtipoaccion.value=document.fdatos.codtipoaccion.value
851                                                document.fdatos.tsk_idambcmdtskwrk.value=document.fdatos.idambcmdtskwrk.value
852
853                                                document.fdatos.tsk_accionid.value=document.fdatos.accionid.value
854                                                document.fdatos.tsk_idTipoAccion.value=document.fdatos.idTipoAccion.value
855                                                document.fdatos.tsk_TipoAccion.value=document.fdatos.TipoAccion.value
856                                                document.fdatos.tsk_NombreTipoAccion.value=document.fdatos.NombreTipoAccion.value
857
858                                                marca_accion(EJECUCION_COMANDO,true);
859                                        break;
860                                case EJECUCION_TRABAJO :
861                                                document.fdatos.wrk_ambito.value=document.fdatos.ambito.value
862                                                document.fdatos.wrk_idambito.value=document.fdatos.idambito.value
863                                                document.fdatos.wrk_nombreambito.value=document.fdatos.nombreambito.value
864
865                                                document.fdatos.wrk_fechainicio.value=document.fdatos.fechainicio.value
866                                                document.fdatos.wrk_fechafin.value=document.fdatos.fechafin.value
867                                                document.fdatos.wrk_horainicio.value=document.fdatos.horainicio.value
868                                                document.fdatos.wrk_horafin.value=document.fdatos.horafin.value
869                                                document.fdatos.wrk_tiposacciones.value=document.fdatos.tiposacciones.value
870                                                document.fdatos.wrk_estados.value=document.fdatos.estados.value
871                                                document.fdatos.wrk_resultados.value=document.fdatos.resultados.value
872                                                document.fdatos.wrk_porcendesde.value=document.fdatos.porcendesde.value
873                                                document.fdatos.wrk_porcenhasta.value=document.fdatos.porcenhasta.value
874
875                                                document.fdatos.wrk_idcmdtskwrk.value=document.fdatos.idcmdtskwrk.value
876                                                document.fdatos.wrk_codtipoaccion.value=document.fdatos.codtipoaccion.value
877                                                document.fdatos.wrk_idambcmdtskwrk.value=document.fdatos.idambcmdtskwrk.value
878
879                                                document.fdatos.wrk_accionid.value=document.fdatos.accionid.value
880                                                document.fdatos.wrk_idTipoAccion.value=document.fdatos.idTipoAccion.value
881                                                document.fdatos.wrk_TipoAccion.value=document.fdatos.TipoAccion.value
882                                                document.fdatos.wrk_NombreTipoAccion.value=document.fdatos.NombreTipoAccion.value
883
884                                                marca_accion(EJECUCION_TAREA,true);
885                                        break;
886                }
887                document.fdatos.accionid.value=currentAccion
888                document.fdatos.idTipoAccion.value=currentidTipoAccion
889                document.fdatos.TipoAccion.value=currentTipoAccion
890                document.fdatos.NombreTipoAccion.value=currentNombreTipoAccion
891
892                marca_estado(ACCION_DETENIDA,true);
893                marca_estado(ACCION_INICIADA,true);
894                marca_estado(ACCION_FINALIZADA,true);
895       
896                marca_resultado(ACCION_EXITOSA,true);
897                marca_resultado(ACCION_FALLIDA,true);
898                marca_resultado(ACCION_TERMINADA,false);
899                marca_resultado(ACCION_ABORTADA,false);
900                marca_resultado(ACCION_SINERRORES,true);
901                marca_resultado(ACCION_CONERRORES,true);
902                document.fdatos.submit()
903        }
904//________________________________________________________________________________________________________
905        function ver_accionpadre(tipoaccion){
906                                switch(tipoaccion){
907                                case EJECUCION_COMANDO :
908                                        break;
909                                case EJECUCION_TAREA :
910                                                document.fdatos.ambito.value=document.fdatos.tsk_ambito.value
911                                                document.fdatos.idambito.value=document.fdatos.tsk_idambito.value
912                                                document.fdatos.nombreambito.value=document.fdatos.tsk_nombreambito.value
913
914                                                document.fdatos.fechainicio.value=document.fdatos.tsk_fechainicio.value
915                                                document.fdatos.fechafin.value=document.fdatos.tsk_fechafin.value
916                                                document.fdatos.horainicio.value=document.fdatos.tsk_horainicio.value
917                                                document.fdatos.horafin.value=document.fdatos.tsk_horafin.value
918                                                document.fdatos.tiposacciones.value=document.fdatos.tsk_tiposacciones.value
919                                                document.fdatos.estados.value=document.fdatos.tsk_estados.value
920                                                document.fdatos.resultados.value=document.fdatos.tsk_resultados.value
921                                                document.fdatos.porcendesde.value=document.fdatos.tsk_porcendesde.value
922                                                document.fdatos.porcenhasta.value=document.fdatos.tsk_porcenhasta.value
923
924                                                document.fdatos.idcmdtskwrk.value=document.fdatos.tsk_idcmdtskwrk.value
925                                                document.fdatos.codtipoaccion.value=document.fdatos.tsk_codtipoaccion.value
926                                                document.fdatos.idambcmdtskwrk.value=document.fdatos.tsk_idambcmdtskwrk.value
927
928                                                document.fdatos.accionid.value=document.fdatos.tsk_accionid.value
929                                                document.fdatos.idTipoAccion.value=document.fdatos.tsk_idTipoAccion.value
930                                                document.fdatos.TipoAccion.value=document.fdatos.tsk_TipoAccion.value
931                                                document.fdatos.NombreTipoAccion.value=document.fdatos.tsk_NombreTipoAccion.value
932                                        break;
933                                case EJECUCION_TRABAJO :
934                                                document.fdatos.ambito.value=document.fdatos.wrk_ambito.value
935                                                document.fdatos.idambito.value=document.fdatos.wrk_idambito.value
936                                                document.fdatos.nombreambito.value=document.fdatos.wrk_nombreambito.value
937
938                                                document.fdatos.fechainicio.value=document.fdatos.wrk_fechainicio.value
939                                                document.fdatos.fechafin.value=document.fdatos.wrk_fechafin.value
940                                                document.fdatos.horainicio.value=document.fdatos.wrk_horainicio.value
941                                                document.fdatos.horafin.value=document.fdatos.wrk_horafin.value
942                                                document.fdatos.tiposacciones.value=document.fdatos.wrk_tiposacciones.value
943                                                document.fdatos.estados.value=document.fdatos.wrk_estados.value
944                                                document.fdatos.resultados.value=document.fdatos.wrk_resultados.value
945                                                document.fdatos.porcendesde.value=document.fdatos.wrk_porcendesde.value
946                                                document.fdatos.porcenhasta.value=document.fdatos.wrk_porcenhasta.value
947
948                                                document.fdatos.idcmdtskwrk.value=document.fdatos.wrk_idcmdtskwrk.value
949                                                document.fdatos.codtipoaccion.value=document.fdatos.wrk_codtipoaccion.value
950                                                document.fdatos.idambcmdtskwrk.value=document.fdatos.wrk_idambcmdtskwrk.value
951
952                                                document.fdatos.accionid.value=document.fdatos.wrk_accionid.value
953                                                document.fdatos.idTipoAccion.value=document.fdatos.wrk_idTipoAccion.value
954                                                document.fdatos.TipoAccion.value=document.fdatos.wrk_TipoAccion.value
955                                                document.fdatos.NombreTipoAccion.value=document.fdatos.wrk_NombreTipoAccion.value
956                                        break;
957                }
958                document.fdatos.submit()
959
960        }
961//________________________________________________________________________________________________________
962        function reset_seleccion(){
963                if(currentTR!=null){
964                        var oTDs=currentTR.getElementsByTagName('TD')
965                        for(var i=0;i<oTDs.length;i++){
966                                oTDs[i].style.backgroundColor="#EEEECC"
967                                oTDs[i].style.color="#003300"
968                        }
969                        currentTR=null;
970                }
971                if(currentNotTR!=null){
972                        var oTDs=currentNotTR.getElementsByTagName('TD')
973                        oTDs[0].style.backgroundColor="#EEEECC"
974                        for(var i=1;i<oTDs.length;i++){
975                                oTDs[i].style.backgroundColor="#E3D8C6"
976                                oTDs[i].style.color="#003300"
977                        }
978                        currentNotTR=null;
979                }
980        }
981//________________________________________________________________________________________________________
982// Captura la triada idaccion,estado,resultado para lactualizaciones de operaciones de acciones multiples
983//________________________________________________________________________________________________________
984        function toma_triada(oTriada,wmulaccion){
985                patron=";"+currentAccion+":";
986                var re = new RegExp (";"+currentAccion+":", 'gi') ;
987                var pos=wmulaccion.search(re)
988                if(pos<0){ // Comprueba si está el primero
989                        patron=currentAccion+":";
990                        var re = new RegExp (";"+currentAccion+":", 'gi') ;
991                        var pos=wmulaccion.search(re)
992                        if(pos>0) pos=-1; // No  está el primero , asi que no está
993                }
994                if(pos<0) oTriada.swexst=false; // No  está el primero , asi que no está
995                pos++;
996                var posa=pos;
997                while(pos<wmulaccion.length){
998                        if(wmulaccion.charAt(pos)==";") break;
999                        pos++;
1000                }
1001                var posb=pos;
1002                var triada=wmulaccion.substr(posa,posb-posa)
1003                var auxsplit=triada.split(":");
1004                oTriada.posini=posa
1005                oTriada.posifi=posb
1006                oTriada.idaccion=auxsplit[0];
1007                oTriada.estado=auxsplit[1];
1008                oTriada.resultado=auxsplit[2];
1009                oTriada.swexst=true;
1010        }
1011//________________________________________________________________________________________________________
1012        function actualiza_triadas(oTriada,wmulaccion){
1013                var nwtriada=oTriada.idaccion+":"+oTriada.estado+":"+oTriada.resultado
1014                var lon=wmulaccion.length;
1015                var string1=wmulaccion.substr(0,mitriada.posini) // Primera parte de la cadena
1016                var string2=wmulaccion.substr(mitriada.posifi,lon) // Primera parte de la cadena
1017                var oMulaccion=document.getElementById("mulaccion");// Toma los identificadores de todas las acciones
1018                oMulaccion.value=string1+nwtriada+string2;
1019        }
1020//________________________________________________________________________________________________________
1021// definicion dela clase triada
1022//________________________________________________________________________________________________________
1023        function TRIADA(){
1024                this.posini=0;
1025                this.posifi=0;
1026                this.idaccion;
1027                this.estado;
1028                this.resultado;
1029                this.swexst;
1030        }
Note: See TracBrowser for help on using the repository browser.