Jump to content

ozwolverine

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ozwolverine's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello everybody, I have a problem javascript related. I have a popup that has: one textbox and a select list, when the select changes I throw a submit(); I have a javascript function that first checks if both the textbox was filled and the select has change its value, and depending on that it constructs (using java script) another pop up that will show some number sequences. The problem is that in my environment (Linux, php5.2.0, Oracle9i) it works perfectly well, so I mounted on another (in our client's machines) environment (Linux, php5.0.4, mssql) and it doesn't work. In client's system, after I make a selection in the select, it submits the page, but it returns some of the javascript code in the same popup. Let me explain with some code: this is the whole page code: <? /** * Metodo alternativo para radicacion masiva * @author Johnny Gonzalez * @version 1.0 */ error_reporting(7); session_start(); $ruta_raiz = "../../"; //include( "$ruta_raiz/debugger.php" ); require_once("$ruta_raiz/include/db/ConnectionHandler.php"); //Si no llega la dependencia recupera la sesi�n if(!isset($_SESSION['dependencia'])) { include "$ruta_raiz/rec_session.php"; } if (!$db) $db = new ConnectionHandler($ruta_raiz); //$db->conn->debug = true; $phpsession = session_name()."=".session_id(); ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link rel="stylesheet" href="../../estilos/orfeo.css"> <script language="JavaScript"> <!-- function advertencia( cantidadRegistros, form ) { var confirmaSecuencias = confirm( "Seguro que desea generar " + cantidadRegistros + " secuencias para radicacion masiva?\nEl proceso no se puede revertir y seria necesario realizar la anulacion manual de todos los radicados generados." ); if( confirmaSecuencias ){ <? $arreglo = array(); //var_dump("Tipo rad" . $tipoRad); if ( $tipoRad && ( $cantidadRegistros != '' || $cantidadRegistros != null ) ){ require_once("$ruta_raiz/class_control/Dependencia.php"); $objDependecia = new Dependencia($db); $objDependecia->Dependencia_codigo($dependencia); $cursor = & $db; $cuenta = 0; // var_dump( "Cantidad" . $cantidadRegistros ); while ( $cuenta < $cantidadRegistros ) { // var_dump("Cuenta" . $cuenta ); $secRadicacion="secr_tp".$tipoRad."_".$objDependecia->getSecRadicTipDepe($dependencia,$tipoRad); $sec=$cursor->nextId($secRadicacion); $sec = str_pad($sec,6,"0",STR_PAD_LEFT); $arreglo[] = date("Y").$dependencia.$sec.substr($secRadicacion,7,1); $cuenta++; } $cadena = ""; ?> alert( "Se generaron las " + cantidadRegistros + " secuencias entre el <?=$arreglo[ 0 ] ?> y el <?=$arreglo[ $cuenta - 1 ] ?>, a continuacion apareceran en una ventana aparte,\npara que las copie a una hoja de calculo."); ventana=window.open(' ','secuenciasMasiva','menubar=no,scrollbars=yes,width=300,height=500'); ventana.opener=self; ventana.document.write("<HTML>"); ventana.document.write("<HEAD><TITLE>Secuencias para Radicación Masiva</TITLE></HEAD>"); ventana.document.write("<BODY><CENTER>"); <? foreach ( $arreglo as $numeroRadicado ) { $cadena.="<br>$numeroRadicado"; } ?> ventana.document.write("<?=$cadena?>"); ventana.document.write("</CENTER></BODY>"); ventana.document.write("</HTML>"); ventana.document.close(); <? $confirmado = true; require_once $ruta_raiz."/class_control/class_controlExcel.php"; $controlSec = new CONTROL_ORFEO($db); if ($arreglo[ 1 ] != null || $arreglo[ 1 ] != '') { $intervaloSecuencia = $arreglo[ 1 ] - $arreglo[ 0 ]; }else { $intervaloSecuencia = 0; } $resultadoInsertaSec = $controlSec -> insertaSecuencias( $arreglo[ 0 ], $arreglo[ $cuenta - 1 ], $intervaloSecuencia, $dependencia, $codusuario, $tipoRad ); if( !$resultadoInsertaSec ){ ?> alert("Se produjo un error insertando los datos de las secuencias."); <? } }else{ ?> alert("Debe seleccionar el tipo de radicacion."); return false; <? } ?> }else{ // alert("No confirma"); // submit(); } // alert("Sale"); form.submit(); } function valida( form ){ // alert("entra" + document.frmGeneraSecuenciasMasiva.cantidadRegistros.value); // alert("entra 2"); var cantidad = document.frmGeneraSecuenciasMasiva.cantidadRegistros.value; if( cantidad == "" ){ alert( "Para generar las secuencias debe ingresar la cantidad." ); return false; }else{ // alert("no NULL"); advertencia( cantidad, form ); return true; } } function f_close(){ window.close(); } function Start(URL, WIDTH, HEIGHT) { windowprops = "top=0,left=0,location=no,status=no, menubar=no,scrollbars=yes, resizable=yes,width="; windowprops += WIDTH + ",height=" + HEIGHT; preview = window.open(URL , "preview", windowprops); } //--> </script> </head> <body bgcolor="#FFFFFF" topmargin="0"> <form name="frmGeneraSecuenciasMasiva" action='generarSecuencias.php?<?=$phpsession ?>&krd=<?=$krd?>&<? echo "fechah=$fechah"; ?>' method="POST"> <table width="75%" align="center" border="0" cellpadding="0" cellspacing="5" class="borde_tab"> <tr> <td height="25" class="titulos4" colspan="2">RADICACIÓN MASIVA DE DOCUMENTOS (Generación de Secuencias)</td> </tr> <tr align="center" > <td class="listado2" colspan="2"> La radicación requiere la generación de las secuencias para los radicados, si desea generarlas, <br>ingrese la cantidad de registros a procesar y haga click en Generar, de lo contario en Cerrar. </td> </tr> <tr align="center"> <td class="listado2" > Cantidad de Registros </a> </td> <td class="listado2" > <input type="text" name="cantidadRegistros" value="<?=$cantidadRegistros?>" size="5" maxlength="3"> </td> </tr> <tr align="center"> <td class="listado2" colspan="2" > <table width="31%" align="center" border="0" cellpadding="0" cellspacing="5" class="borde_tab"> <tr align="center"> <td height="25" colspan="2" class="titulos4">TIPO DE RADICACIóN</td> </tr> <tr align="center"> <td width="16%" class="titulos2">Seleccione: </td> <td width="84%" height="30" class="listado2"> <?php $cad = "USUA_PRAD_TP"; // Creacion del combo de Tipos de radicado habilitados seg�n permisos $sql = "SELECT SGD_TRAD_CODIGO,SGD_TRAD_DESCR FROM SGD_TRAD_TIPORAD WHERE SGD_TRAD_GENRADSAL > 0"; //Buscamos los TRAD En la entidad $Vec_Trad = $db->conn->GetAssoc($sql); $Vec_Perm = array(); while (list($id, $val) = each($Vec_Trad)) { $sql = "SELECT ".$cad.$id." FROM USUARIO WHERE USUA_LOGIN='".$krd."'"; $rs2 = $db->conn->Execute($sql); if ($rs2->fields[$cad.$id] > 0) { $Vec_Perm[$id] = $val; } } //print_r($Vec_Perm); reset($Vec_Perm); ?> <select name="tipoRad" id="Slc_Trd" class="select" onchange="submit();"> <option value="0">Seleccione una opción</option> <? while (list($id, $val) = each($Vec_Perm)) { if($tipoRad==$id) $datoss = " selected "; else $datoss=""; echo " <option value=".$id." $datoss>$val</option>"; } ?> </select> </td> </tr> </table> </td> </tr> <tr align="center"> <td class="listado2" colspan="2" > <center> <input type="button" value="Generar" class="botones" onclick="valida(this.form);"> </center> </td> </tr> <tr align="center"> <td class="listado2" colspan="2" > <center> <input class="botones" type=button name=Cerrar id=Cerrar Value=Cerrar onclick='f_close()'> </center> </td> </tr> </table> </form> </body> </html> The generated code of the page when the popup is loaded for the first time is: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link rel="stylesheet" href="../../estilos/orfeo.css"> <script language="JavaScript"> <!-- function advertencia( cantidadRegistros, form ) { var confirmaSecuencias = confirm( "Seguro que desea generar " + cantidadRegistros + " secuencias para radicacion masiva?\nEl proceso no se puede revertir y seria necesario realizar la anulacion manual de todos los radicados generados." ); if( confirmaSecuencias ){ alert("Debe seleccionar el tipo de radicacion."); return false; }else{ } form.submit(); } function valida( form ){ var cantidad = document.frmGeneraSecuenciasMasiva.cantidadRegistros.value; if( cantidad == "" ){ alert( "Para generar las secuencias debe ingresar la cantidad." ); return false; }else{ advertencia( cantidad, form ); return true; } } function f_close(){ window.close(); } function Start(URL, WIDTH, HEIGHT) { windowprops = "top=0,left=0,location=no,status=no, menubar=no,scrollbars=yes, resizable=yes,width="; windowprops += WIDTH + ",height=" + HEIGHT; preview = window.open(URL , "preview", windowprops); } //--> </script> </head> <body bgcolor="#FFFFFF" topmargin="0"> <form name="frmGeneraSecuenciasMasiva" action='generarSecuencias.php?PHPSESSID=172o16o0o121oUSUARIO2&krd=USUARIO2&fechah=20070209040210' method="POST"> <table width="75%" align="center" border="0" cellpadding="0" cellspacing="5" class="borde_tab"> <tr> <td height="25" class="titulos4" colspan="2">RADICACIÓN MASIVA DE DOCUMENTOS (Generación de Secuencias)</td> </tr> <tr align="center" > <td class="listado2" colspan="2"> La radicación requiere la generación de las secuencias para los radicados, si desea generarlas, <br>ingrese la cantidad de registros a procesar y haga click en Generar, de lo contario en Cerrar. </td> </tr> <tr align="center"> <td class="listado2" > Cantidad de Registros </a> </td> <td class="listado2" > <input type="text" name="cantidadRegistros" value="" size="5" maxlength="3"> </td> </tr> <tr align="center"> <td class="listado2" colspan="2" > <table width="31%" align="center" border="0" cellpadding="0" cellspacing="5" class="borde_tab"> <tr align="center"> <td height="25" colspan="2" class="titulos4">TIPO DE RADICACIóN</td> </tr> <tr align="center"> <td width="16%" class="titulos2">Seleccione: </td> <td width="84%" height="30" class="listado2"> <select name="tipoRad" id="Slc_Trd" class="select" onchange="submit();"> <option value="0">Seleccione una opción</option> <option value=2 >Entrada</option> <option value=5 >Resolucion</option> </select> </td> </tr> </table> </td> </tr> <tr align="center"> <td class="listado2" colspan="2" > <center> <input type="button" value="Generar" class="botones" onclick="valida(this.form);"> </center> </td> </tr> <tr align="center"> <td class="listado2" colspan="2" > <center> <input class="botones" type=button name=Cerrar id=Cerrar Value=Cerrar onclick='f_close()'> </center> </td> </tr> </table> </form> </body> </html> but when I change the value of the select, after submit it shows me this code, see screenshot: It seems like instead of creating the javascript source it tries to put it as part of the actual page (html) code. The original popup is: The popup after the submit of the onchange is: What could the problem be? I guess it is not a client problem, because after the code didn't work I used the same machine in the client company to connect to the version I have working in my company, and it worked, so I think it is a problem of the PHP version, in my environment I have 5.2.0 the client has 5.0.4, A friend tried in php 5.1.6 and it didn't work there either Any ideas?? Could this be a possible bug? Thanks a lot, Johnny
  2. Thanks a lot, I got very valuable information on it.
  3. Hello, I have to work with an OpenOffice 2 xml file like the shown below, I was wondering what is the best way (what libraries, packages to use) to be able to read it, look for certain tags, remove tags, add tags, and save the file again to disk? [code]<?xml version="1.0" encoding="UTF-8"?> <office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" office:version="1.0"> <office:scripts/> <office:font-face-decls> <style:font-face style:name="DejaVu Sans" svg:font-family="&apos;DejaVu Sans&apos;" style:font-pitch="variable"/> <style:font-face style:name="Nimbus Roman No9 L" svg:font-family="&apos;Nimbus Roman No9 L&apos;" style:font-family-generic="roman" style:font-pitch="variable"/> <style:font-face style:name="Nimbus Sans L" svg:font-family="&apos;Nimbus Sans L&apos;" style:font-family-generic="swiss" style:font-pitch="variable"/> </office:font-face-decls> <office:automatic-styles/> <office:body> <office:text> <office:forms form:automatic-focus="false" form:apply-design-mode="false"/> <text:sequence-decls> <text:sequence-decl text:display-outline-level="0" text:name="Illustration"/> <text:sequence-decl text:display-outline-level="0" text:name="Table"/> <text:sequence-decl text:display-outline-level="0" text:name="Text"/> <text:sequence-decl text:display-outline-level="0" text:name="Drawing"/> </text:sequence-decls> <text:p text:style-name="Standard">página unica</text:p> <text:p text:style-name="P1">Hoja2</text:p> <text:p text:style-name="P1">Hoja3</text:p> <text:p text:style-name="P1">Hoja4</text:p> <text:p text:style-name="P1">Hoja5</text:p> </office:text> </office:body> </office:document-content> [/code] Thanks a lot for any help,
  4. Hello everybody, I'm working with SimpleXMLElement to generate an xml file, but I'm having a problem, because all my tag names (odt xml files) have colons and dashes on it, for example: office:automatic-styles or style:style. the problem is because I use the following 'convention' to create child tags: [code]$vendor = $xml-> mobil[0] -> addChild('vendor', 'Johnny');[/code] where mobil[0] is the first tag named mobil on the root tag. so If I want to add a new tag that has the name: office:automatic-styles, how could I scape the colon and the dash? if I write this: [code]$style = $xml-> office:automatic-styles[0] -> addChild('style:style', '');[/code] I get a bunch of errors. I tried to scape them using a \ before each of these characters, but this didn't help. Does anyone know what should I do? I tryed putting the name of the tag in a string, but this does nothing, doesn't create the tag y the xml, nor throws any error message. Help would be very appreciated. Thanks
  5. Now I'm able to write the full xml structure to a file, using this code that I found in another post: [code]file_put_contents($apuntador, $xml->asXML());[/code] Now the problem is generating the XML tags, They throw me that warning message: [quote]Warning: SimpleXMLElement::addChild() [function.SimpleXMLElement-addChild]: Node no longer exists in[/quote] What is wrong in the tags generation code? thanks a lot,
  6. Hello everybody, I have this question: I need to read (load) an xml file I have on disk, so I'm reading it with something like this: [code]                   $xml = simplexml_load_file($this->stylesXml); [/code] Now I need to add other tags to the already existent tags, So I to get that I wrote this code: [code]                       //New XML Tags $documentContentTag = 'office:document-content'; $stylesTag = 'office:automatic-styles'; $styleTag = 'style:style'; $styleProps = 'style:paragraph-properties'; //Attributes (Name , value) $styleAttrName = 'style:name'; $styleAttrVal = 'P1'; $styleAttrFamName = 'style:family'; $styleAttrFamVal = 'paragraph'; $styleAttrParentName = 'style:parent-style-name'; $styleAttrParentVal = 'Standard'; $stylePropsAttrName = 'fo:break-before'; $stylePropsAttrVal = 'page'; //Add tags to existent xml $styles = $xml->$documentContentTag -> addChild($stylesTag, ''); //echo $xml->asXML();                       $style = $styles -> addChild($styleTag,''); $style->addAttribute($styleAttrName, $styleAttrVal); $style->addAttribute($styleAttrFamName, $styleAttrFamVal); $style->addAttribute($styleAttrParentName, $styleAttrParentVal); $stylePropsChild = $style->addChild($styleProps,''); $stylePropsChild->addAttribute($stylePropsAttrName, $stylePropsAttrVal); [/code] What I want to create is this structure: [code] <office:automatic-styles> <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Standard"> <style:paragraph-properties fo:break-before="page"/> </style:style> </office:automatic-styles>[/code] in a existent tag (root tag) of the xml called: [code]</office:document-content>[/code] But I have three problems: 1. I get this warning in the browser: [tt]Warning: SimpleXMLElement::addChild() [function.SimpleXMLElement-addChild]: Node no longer exists in[/tt] After the execution of the line:  [code]$style = $styles -> addChild($styleTag,'');[/code] is executed Why? 2. If I try to echo the XML file (including tags), I just get literals without tags :(. How could I do it? 3. If I write and XML file using something like: [code]   if ($this->fp = fopen($fileName, 'w')) {             $this->fileSize = fwrite($this->fp,$this->content);             fclose($this->fp);   }[/code] or read it in a similar way I just get literals without tags What should I do? Thanks a lot.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.