source: admin/WebConsole/asistentes/jscripts/EjecutarScripts.js @ 5d05b06

Last change on this file since 5d05b06 was ce83ea4, checked in by OpenGnSys Support Team <soporte-og@…>, 5 years ago

#1001 Remove trailing \r and \n in some scripts

We find that scripts sent by "Assistants"/"Asistentes" are losing the
last character and scripts send by "Run Script"/"Ejecutar Script" have a
trailing line feed (\n).

This is happening because shell() function, which calls "/shell/run" of
ogServer REST API, expects scripts send by "Asistentes" and "Run Script"
to have two trailing characters and removes them. But "Assistants" only
put one trailing char (\r) and "Run Script" put three trailing chars
(\n\n\r).

To avoid problems when running scripts without the last char or with
trailing line feed this patch updates WebConsole? to:

1) "Assistants" no longer put one trailing character at the end

of the script

2) "Run Script" no longer puts three trailing characters at the

end of the script

3) shell() expects no trailing chars in scripts sent by

"Assistants" and "Run Script".

  • Property mode set to 100644
File size: 2.1 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: 2009-2010
5// Fecha Última modificación: Agosto-2010
6// Nombre del fichero: EjecutarScripts.js
7// Descripción :
8//              Este fichero implementa las funciones javascript del fichero EjecutarScripts.php (Comandos)
9// version 1.1: Para el deploy imagen se envía al comando RestaurarImagen del ogclient.
10// autor: Irina Gomez, ETSII Universidad de Sevilla
11// fecha: 2016-10-27
12// ***********************************************************************************************************
13 function confirmar(){
14        if (comprobar_datos()){
15                document.fdatosejecucion.atributos.value="scp="+escape(document.fdatos.codigo.value);
16                // Pedir confirmación si clonación masiva por Unicast.
17                if (document.fdatosejecucion.ambito.value!=16 && document.fdatos.idmetodo !== undefined &&
18                   (document.fdatos.idmetodo.value=="UNICAST" || document.fdatos.idmetodo.value=="UNICAST-DIRECT")) {
19                        if (confirm(TbMsg[4]) !== true) {
20                                cancelar();
21                                return false;
22                        }
23                }
24
25                // Si deployImagen y no se ha modificado el codigo cambio a RestaurarImagen
26                if (document.getElementById("codigo").disabled == true &&  document.fdatos.modo.value == "deployImage") {
27                        document.fdatosejecucion.idcomando.value = 3;
28                        document.fdatosejecucion.funcion.value = "RestaurarImagen";
29                        document.fdatosejecucion.atributos.value = document.fdatos.atrib_restore.value;
30                }
31
32                document.fdatosejecucion.submit();
33        }
34 }
35//________________________________________________________________________________________________________
36
37  function cancelar()
38{
39        alert(CTbMsg[0]);
40        location.href="../nada.php"
41 }
42//________________________________________________________________________________________________________
43
44  function comprobar_datos()
45{
46        if (document.fdatos.codigo.value=="") {
47                alert(TbMsg[1]);
48                document.fdatos.codigo.focus();
49                return(false);
50        }
51        return(comprobar_datosejecucion())
52}
Note: See TracBrowser for help on using the repository browser.