source: admin/WebConsole/comandos/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: 1.5 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// ***********************************************************************************************************
10 function confirmar(){
11        if (comprobar_datos()){
12                document.fdatosejecucion.atributos.value="scp="+escape(document.fdatos.codigo.value);
13                filtrado();
14                // Incluimos el modo de ejecución en fdatosejecucion.
15                var modoejecucion=document.createElement('input');
16                modoejecucion.name="modoejecucion";
17                modoejecucion.value=document.fdatos.modoejecucion.value;
18                document.fdatosejecucion.appendChild(modoejecucion);
19
20                document.fdatosejecucion.submit();
21        }
22 }
23//________________________________________________________________________________________________________
24
25  function cancelar()
26{
27        alert(CTbMsg[0]);
28        location.href="../nada.php"
29 }
30//________________________________________________________________________________________________________
31
32  function comprobar_datos()
33{
34        if (document.fdatos.codigo.value==="") {
35                alert(TbMsg[1]);
36                document.fdatos.codigo.focus();
37                return(false);
38        }
39        return(comprobar_datosejecucion())
40}
Note: See TracBrowser for help on using the repository browser.