Foros del Web » Programando para Internet » Javascript » Frameworks JS »

Sajax y SAfari

Estas en el tema de Sajax y SAfari en el foro de Frameworks JS en Foros del Web. hola, me interesaria mucho saber si han tendio problemas con SAjax, php y safari.Tengo un script que anda en todo menos en Safari, de MAC ...
  #1 (permalink)  
Antiguo 14/02/2008, 16:22
 
Fecha de Ingreso: diciembre-2002
Mensajes: 473
Antigüedad: 21 años, 4 meses
Puntos: 0
Sajax y SAfari

hola, me interesaria mucho saber si han tendio problemas con SAjax, php y safari.Tengo un script que anda en todo menos en Safari, de MAC y es un dramon.Si alguien puede ayudarme y/o tirarme algun truco, le agradeceria mucho.
Saludos!
tico
  #2 (permalink)  
Antiguo 14/02/2008, 16:59
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 11 meses
Puntos: 2135
Re: Sajax y SAfari

¿Que problema tienes?

Saludos.
  #3 (permalink)  
Antiguo 14/02/2008, 17:18
 
Fecha de Ingreso: diciembre-2002
Mensajes: 473
Antigüedad: 21 años, 4 meses
Puntos: 0
Re: Sajax y SAfari

Hola gatorV, gracias por responder.En uan intranet hago que cuando se pulsa en delete se elimina el nombre de la imagen en la BD asi como la imagen en el directorio.En IE , Firefox,etc adna bien pero en Safari no pasa nada.Puede ser el tema del tipo de codificacion, pro ahi lei necesita UTF pero el agregue una linea* y no pasa nada.
* header("Content-type:text/html; charset=utf-8");
Te paso el codigo en 2 partes por si ves algo raro:
Código PHP:
<?

//Sajax
    
require("Sajax.php");
    function 
veophp($nombre,$idrow$valor$elCombo$tipoMedia){
            require(
"funciones_conexion_lib.php");
            
            if(
$tipoMedia == "1"){
                
$tipoMedia "logos"
            }
            if(
$tipoMedia == "2"){
                
$tipoMedia "images"
            }
            if(
$tipoMedia == "3"){
                
$tipoMedia "video"
            }
            if(
$tipoMedia == "4"){
                
$tipoMedia "audio"
            }
            
            if (
$valor == "1"){
                    
$cadenaDelArchivo="../uploads/".$elCombo."/multimedia/".$tipoMedia."/".$nombre;
                    
$sql_upd "UPDATE multimedia SET upload='' WHERE id=".$idrow;
            }
                                
            if (
$valor == "2"){
                    
$cadenaDelArchivo="../uploads/".$elCombo."/thumbnails/multimedia/".$nombre;
                    
$sql_upd "UPDATE multimedia SET thumbnail='' WHERE id=".$idrow;
            }
                                
            
            if (
file_exists($cadenaDelArchivo)) {//if 
                    //ok, existe, lo intento borrar
                    
                    
if (!unlink($cadenaDelArchivo)){    //if 2    
                                
$mensaje "Problem on the delete process".$nombre;
                    }else{
                                
                                
//lo borre, ahora ataco la base de datos                            
                                
                                
                                
if(!mysql_query($sql_upd)){//if 4
                                    
$mensaje mysql_error();
                                }else{
                                    
//Todo ok, mano un mensaje segun el cambio
                                    //esto tamibne m ayuda a filtrar y poner la variable control (1,2 o 3) con valor 1
                                    
if ($valor == "1"){
                                    
$mensaje "Deletion complete (Multimedia File)";
                                    }
                                    if (
$valor == "2"){
                                    
$mensaje "Deletion complete (Thumbnail)";
                                    }
                                    
                                }
//if 4
                    
}//if 2

             
}else{
             
                    
//El fichero no existe
                    
$mensaje "Sorry, no file available.";
             
             }    
//if     
            
            
             //esta seria la respuesta
             
return $mensaje;
    }
    
    
sajax_init();    
    
// $sajax_debug_mode = 1;
    
sajax_export("veophp");
    
sajax_handle_client_request();
//sajax    
include 'funciones_conexion_lib.php';
include 
'funciones.php';
?>

Un abrazo y mil gracias por la molestia amigo.
tico
  #4 (permalink)  
Antiguo 14/02/2008, 17:19
 
Fecha de Ingreso: diciembre-2002
Mensajes: 473
Antigüedad: 21 años, 4 meses
Puntos: 0
Re: Sajax y SAfari

Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Newsroom Administration</title>
<link href="layout.css" rel="stylesheet" type="text/css"><script language="javascript" type="text/javascript" src="tinymce/jscripts/tiny_mce/plugins/filemanager/jscripts/mcfilemanager.js"></script>
<script language="javascript" type="text/javascript" src="tinymce/jscripts/tiny_mce/plugins/filemanager/jscripts/mcfilemanager.js">
</script>

<script language="JavaScript" src="js/tigra_calendar/calendar2.js"></script>
<script>
    <?
    sajax_show_javascript
();
    
?>

    function gestora(respuesta) {
    //es la gestora, carga el valor en la capa o objeto destino
    alert(respuesta)
        if (respuesta == 'Deletion complete (Multimedia File)'){
            document.getElementById("control1").value = "1";
            document.getElementById('DivPdfCargada1').innerHTML= respuesta;
        }
        if (respuesta == 'Deletion complete (Thumbnail)'){
            document.getElementById("control2").value = "1";
            document.getElementById('DivPdfCargada2').innerHTML= respuesta;
        }
    
    }
    
    function Borro(valor) {
        // get the folder name
        var x, y;
        combo = document.getElementById("cid").value;
        mediaType = document.getElementById("mediaType").value;
                
        if (valor=="1"){
        x = document.getElementById("Ajaxupload").value;        
        }
    
        if (valor=="2"){
        x = document.getElementById("Ajaximage").value;
        }
        
        y = document.getElementById("elid").value;
        //alert("Combo"+combo+"Valor es"+valor+"Ajax file es "+x+" y el id es:"+ y);
        x_veophp(x, y, valor, combo, mediaType, gestora);
    }

</script>
<SCRIPT>
function testform(){
      var image, control;
       estado = document.getElementById("estado").value;
       mediaType = document.getElementById("mediaType").value;
      
      //upload 
      upload = document.getElementById("upload").value;
      Ajaxupload = document.getElementById("Ajaxupload").value;      
      control1 = document.getElementById("control1").value;

      //thumbnail
      thumbnail = document.getElementById("thumbnail").value;
      Ajaximage = document.getElementById("Ajaximage").value;      
      control2 = document.getElementById("control2").value;
      
      //si controles cero es que no hubo borrado de imagenes
      //si encima notamos que imagen no esta vacio es porque el usuario 
      //quiere cargar nueva imagen sin haber borrado la anterior.


      //consulto si elegio un archivo multimedia y no tiene elegido el combo
      if (mediaType == "0" && upload != "") 
      {
         alert("You must click in a media type first");
         return false;             
      }

      
      //consulto si hay uno elegido y  ya existe un archivo en la BD
      if (estado == "edit" && control1 == "0" &&  upload != "" && Ajaxupload != "") 
      {
         alert("You must delete current multimedia first");
         return false;             
      }
      else if (estado == "edit" && control2 == "0" &&  thumbnail != "" && Ajaximage != "") 
      {
                 alert("You must delete current thumbnail first");
                 return false;
      }
      else
      {
             document.getElementById("myform").submit()
      }
      
      
    

  
}
</SCRIPT>
</head>

<body>
<?

 
if (($_GET['id']!= "") || ($_GET['state'] != "")){
         
//Recibo variables por GET///
                 
$estado trim($_GET['state']);  
                 
$elidtrim($_GET['id']); 
}
                                
if (
$estado != "new"){
            
$cadena_edit "SELECT * FROM multimedia WHERE id=".$elid;                                
            
$result_edit=mysql_db_query($database,$cadena_edit);
            while(
$fila_edit mysql_fetch_array($result_edit)) {
                
$cid $fila_edit["cid"];
                
$mediaType $fila_edit["mediaType"];
                
$title $fila_edit["title"];
                
$multimediaDate $fila_edit["multimediaDate"];
                
$upload $fila_edit["upload"];
                
$thumbnail $fila_edit["thumbnail"];
                
$active $fila_edit["active"];                            
            }
 }
 
 switch (
$estado){
 case 
"new":
 
$accion "Add ";
 
$accion2 "adding";
 break;
 case 
"delete":
 
$accion "Delete ";
 
$accion2 "deleting";
 break;
 case 
"edit":
 
$accion "Edit ";
 
$accion2 "editing";
 break;
 case 
"clone":
 
$accion "Clone ";
 
$accion2 "cloning";
 break;
 }
?>


<DIV id=container>
<DIV id=header></DIV>
<? include("menu.php"?>
<DIV id=content>
<DIV id=main>
<DIV id=main-left>
<DIV class=lb>
<H2><?=$accion ?> a Multimedia Item </H2>
<p>You are <?=$accion2 ?> a multimedia item.</p>
<form id="myform" class="cssform" action="modMultimediaProcess.php" onSubmit="return testform()" method="post" enctype="multipart/form-data">
<input name="elid" id="elid" type="hidden" value="<? echo($elid?>" />
<input name="estado" id="estado"  type="hidden" value="<? echo($estado?>" />
<input name="control1" id="control1" type="hidden" value="0" />
<input name="control2" id="control2" type="hidden" value="0" />
<input name="Ajaxupload" id="Ajaxupload" type="hidden" value="<? echo($upload?>" />
<input name="Ajaximage" id="Ajaximage" type="hidden" value="<? echo($thumbnail?>" />
<? //si es edit o new muestro form
    
if (($estado=="new") || ($estado=="edit") || ($estado=="clone")) { 
        
//si es mas de 1 compañia
        
if ($_SESSION['OneCompany'] != 1) {
?>
        <p>
        <label for="cid">Company:</label>
        <?
              $cadena_comp 
"SELECT * FROM companies WHERE cid=".$cid;
                                          
              
$result_comp=mysql_db_query($database,$cadena_comp);
              while(
$fila_comp mysql_fetch_array($result_comp)) {                
                
$cidname $fila_comp["companyName"];
                
              }
              
                  echo(
$cidname);         
         
?>
         <input name="cid" type="hidden" value="<? echo($cid?>" />
        </p>
        <?
        
}else{
        
?>
         <input name="cid" type="hidden" value="1" />
        <?
        
}
        
?>
<p>
<label for="mediaType">Media Type:</label>
<select name="mediaType" id="mediaType" style='font-family:verdana;font-size:8pt;color:#000000' >
<option value="0">Select</option>
<option value="1" <? comparo($mediaType"1"?>>Logo</option>
<option value="2" <? comparo($mediaType"2"?>>Image</option>
<option value="3" <? comparo($mediaType"3"?>>Video</option>
<option value="4" <? comparo($mediaType"4"?>>Audio</option>
</select>
</p>

<p>
<label for="title">Title:</label>
<input name="title" type="text" id="title" style='font-family:verdana;font-size:8pt;color:#000000;width:360px' value="<? echo(htmlspecialchars($title)); ?>" />
</p>
<?
function CleanDateSmall($value){
//clean the =="0000-00-00 00:00:00" stuff
    
if ($value == "0000-00-00"){
     
$value"";
     return 
$value;
    }else{
     return 
$value;
    }
}
?>
<p>
<label for="date">Date:</label>
<input name="multimediaDate" type="text" id="multimediaDate" style='font-family:verdana;font-size:8pt;color:#000000;width:260px' value="<? echo(CleanDateSmall($multimediaDate)); ?>" /><a href="javascript:calendario1.popup();"><img src="js/tigra_calendar/img/cal.gif" alt="Click Here to Pick up the date" width="16" height="16" hspace="4" border="0"></a></p>

<p>
<label for="upload">Multimedia Upload:</label>
<input name="upload" type="file" id="upload" value="<? echo($upload); ?>" style='font-family:verdana;font-size:8pt;color:#000000;width:260px' />
<br><img  src="images/spacer.gif" height="2" width="1" /><br>
<? if ($estado != "new"){ ?>
<div id="DivPdfCargada1">
<strong>Current multimedia File:</strong> <? echo(htmlspecialchars($upload)); ?>
<br>
<img src="images/spacer.gif" height="2" width="1" />
<br>
<? if ($upload != ""): ?>
<img id="imagenCargada1" src="images/spacer.gif" height="2" width="1" >
<a href="#" onClick="Borro('1');return false;">Delete</a>
<? endif; ?>
</div>
<? ?>
</p>

<p>
<label for="thumbnail">Thumbnail: (optional):</label>
<input name="thumbnail" type="file" id="thumbnail" value="<? echo($thumbnail); ?>" style='font-family:verdana;font-size:8pt;color:#000000;width:260px' />72px x 72px
<br><img  src="images/spacer.gif" height="2" width="1" /><br>
<? if ($estado != "new"){ ?>
<div id="DivPdfCargada2">
<strong>Current File:</strong> <? echo(htmlspecialchars($thumbnail)); ?>
<br>
<img src="images/spacer.gif" height="2" width="1" />
<br>
<? if ($thumbnail != ""): ?>
<img src="../uploads/<? echo($cid); ?>/thumbnails/multimedia/<? echo($thumbnail); ?>" >
<a href="#" onClick="Borro('2');return false;">Delete</a>
<? endif; ?>
</div>
<? ?>



</p>

<div style="margin-left: 186px;">
<input type="image" value="Submit" src="images/submit1.gif" />
</div>

<?       
 
}else{                                              
        
//pregunto si hay delete 
        
if($estado == "delete"){        
?>
<p>
<div id="notation">Are you sure you want to delete this multimedia item?</div>
</p>

<div style="margin-left: 186px;">
<input name="Submit" type="submit"  value="Yes" />
<input name="Submit3" type="button" value="No" onclick="javascript:history.back()" />
</div>
<?       // id delete                      
    
//cierro if principal        
?>
</form>
            <script language="JavaScript">
            
                var calendario1 = new calendar2(document.forms['myform'].elements['multimediaDate']);
                calendario1.year_scroll = false;
                calendario1.time_comp = false;

            
            </script>
</DIV>
</DIV>
<div></div>
<DIV><img src="images/spacer.gif" width="1" height="10" /></DIV>
<BR style="CLEAR: both">
</DIV>
<? include("footer.php"?>
</DIV></DIV>
</body>
</html>[/QUOTE]
  #5 (permalink)  
Antiguo 14/02/2008, 17:53
 
Fecha de Ingreso: diciembre-2002
Mensajes: 473
Antigüedad: 21 años, 4 meses
Puntos: 0
Re: Sajax y SAfari

El safari ahora parece estar cargando un web inspector.
El mismo se traba en linea 113 y me dice valor nulo:

combo = document.getElementById("cid").value;

Raro,no? Porque ese select box tiene un valor
  #6 (permalink)  
Antiguo 15/02/2008, 10:10
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 11 meses
Puntos: 2135
Re: Sajax y SAfari

El problema es que Safari no soporta descargar directo el valor de esa forma, tienes que hacerlo asi:
Código:
var combo1 = document.getElementById("cid");
combo = combo1.options[combo1.selectedIndex].value;
Saludos.
  #7 (permalink)  
Antiguo 15/02/2008, 16:35
Avatar de Panino5001
Me alejo de Omelas
 
Fecha de Ingreso: mayo-2004
Ubicación: -34.637167,-58.462984
Mensajes: 5.148
Antigüedad: 19 años, 11 meses
Puntos: 834
Re: Sajax y SAfari

Cita:
Iniciado por GatorV Ver Mensaje
El problema es que Safari no soporta descargar directo el valor de esa forma, tienes que hacerlo asi:
Código:
var combo1 = document.getElementById("cid");
combo = combo1.options[combo1.selectedIndex].value;
Saludos.
Qué raro! Estás seguro? Porque en Safari de MAC esto funciona perfectamente:
Código PHP:
<form id="form1" name="form1" method="post" action="">
  <
select name="select" id="pp" onchange="alert(document.getElementById('pp').value)">
    <
option value="1">1</option>
    <
option value="2">2</option>
    <
option value="3">3</option>
  </
select>
</
form
  #8 (permalink)  
Antiguo 15/02/2008, 16:38
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 11 meses
Puntos: 2135
Re: Sajax y SAfari

Yo creo depende de la versión del Safari, yo recuerdo haber tenido ese problema hace tiempo, y así lo solucione.

Saludos.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 19:52.