Changeset 250

Show
Ignore:
Timestamp:
04/02/10 05:00:34 (23 months ago)
Author:
horaciogd
Message:

complete new version
oop oriented
cookies pasword and user
new db structure
new rss structure including notours:object namespace

Location:
notours/noTours editor
Files:
27 added
2 removed
13 modified

Legend:

Unmodified
Added
Removed
  • notours/noTours editor/inc/actualizar_marcador.php

    r222 r250  
    33include ("cb-library.php"); 
    44include ("config.php"); 
     5include ("db.php"); 
     6include ("lang_es.php"); 
    57 
    68// leemos las variables recibidas desde el formulario mediante el metodo POST 
    7 $id = $_POST['hidden_id']; 
     9//$project_id = $_POST['hidden_id']; 
    810 
    911header("Content-type: text/html; charset=utf-8"); 
    1012 
    11 $datos = array(); 
     13$object_data = array(); 
     14 
     15//notours_object        id      project_id      title   description     class   atributes       geodata         modified        sounds 
     16//notours_file  id      url     length  type    volume  angles 
     17/* 
     18$object_data = array ( 
     19        'id' => '', 
     20        'project_id' => '', 
     21        'title' => '', 
     22        'description' => '', 
     23        'class' => '', 
     24        'atributes' => '', 
     25        'geodata' => '', 
     26        'modified' => '', 
     27        'sounds' => '', 
     28); 
     29db_update_query($db_tables['objects'], array('project_id' => , 'title' => , 'description' => , 'class' => , 'atributes' => , 'geodata' => , 'modified' => , 'sounds' => ), $id); 
     30$id = db_insert_query($db_tables['objects'], array('project_id' => , 'title' => , 'description' => , 'class' => , 'atributes' => , 'geodata' => , 'modified' => , 'sounds' => )); 
     31 
     32$file_data = array ( 
     33        'id' => '', 
     34        'url' => '', 
     35        'length' => '', 
     36        'type' => '', 
     37        'volume' => '', 
     38        'angles' => '', 
     39); 
     40db_update_query($db_tables['files'], array('url' => , 'length' => , 'type' => , 'volume' => , 'angles' => ,), $id); 
     41$id = db_insert_query($db_tables['objects'], array('url' => , 'length' => , 'type' => , 'volume' => , 'angles' => )); 
     42 
     43*/ 
    1244 
    1345// leemos las variables recibidas desde el formulario mediante el metodo POST 
    1446if ( (isset($_POST['hidden_id'])) && ($_POST['hidden_id']!="") ) { 
    15         $id = $_POST['hidden_id']; 
     47        $object_id = $_POST['hidden_id']; 
    1648} 
    1749if ( (isset($_POST['hidden_titulo'])) && ($_POST['hidden_titulo']!="") ) { 
    18         $datos['title'] = $_POST['hidden_titulo']; 
     50        $object_data['title'] = $_POST['hidden_titulo']; 
    1951} 
    2052if ( (isset($_POST['hidden_texto'])) && ($_POST['hidden_texto']!="") ) { 
    21         $datos['description'] = $_POST['hidden_texto']; 
     53        $object_data['description'] = $_POST['hidden_texto']; 
    2254} 
    2355if ( (isset($_POST['hidden_proyecto'])) && ($_POST['hidden_proyecto']!="") ) { 
    24         $datos['project'] = $_POST['hidden_proyecto']; 
     56        $object_data['project_id'] = $_POST['hidden_proyecto']; 
    2557        $actualProjectFolder = $_POST['hidden_proyecto'].'/'; 
    2658} 
    2759if ( (isset($_POST['hidden_lat'])) && ($_POST['hidden_lat']!="") && (isset($_POST['hidden_lonx'])) && ($_POST['hidden_lonx']!="") && (isset($_POST['hidden_radio'])) && ($_POST['hidden_radio']!="") ) { 
    28         $datos['class'] = "circle"; 
    29         $datos['data'] = $_POST['hidden_lat']." ".$_POST['hidden_lonx']." ".$_POST['hidden_radio']; 
     60        $object_data['class'] = "soundpoint"; 
     61        $object_data['geodata'] = $_POST['hidden_lat']." ".$_POST['hidden_lonx']." ".$_POST['hidden_radio']; 
    3062} 
    3163 
    32 $datos['modified'] = date("Y-m-d");    
     64$object_data['modified'] = date("Y-m-d");    
    3365 
    34 if (count($datos)>0) { 
    35         if ($id==0) { 
    36                 $id = nuevaEntrada("notours", $datos); 
    37                 $datos['id'] = $id; 
     66if (count($object_data)>0) { 
     67        // si la id es cero creamos un nuevo marcador 
     68        if ($object_id==0) { 
     69                //$id = nuevaEntrada("notours", $datos); 
     70                $object_id = db_insert_query($db_tables['objects'], $object_data); 
     71                $object_data['id'] = $object_id; 
     72        //si tiene una id definida quiere decir que se esta modificando un maracador ya existente 
    3873        } else { 
    39                 actualizaEntrada("notours", $datos, $id); 
    40                 $datos['id'] = $id; 
     74                $old_data = db_select_one_query($db_tables['objects'], 'id', $object_id); 
     75                db_update_query($db_tables['objects'], $object_data, $object_id); 
     76                $object_data['id'] = $object_id; 
    4177        } 
    4278        if ( (isset($_POST['hidden_son'])) && ($_POST['hidden_son']!="") ) { 
    4379                $son = $_POST['hidden_son']; 
    44                 $newSound = "../".$projectFolder.$actualProjectFolder.$soundFolder."sound_".$datos['project']."_".$id.extension($son); 
    45                 // include getID3() library (can be in a different directory if full path is specified) 
    46                 require_once('getid3/getid3.php'); 
    47                 // Initialize getID3 engine 
    48                 $getID3 = new getID3; 
    49                 if (mueve('../'.$tmpSoundFolder.$son, $newSound)) { 
    50                         // Analyze file and store returned data in $soundInfo 
    51                         $soundInfo = $getID3->analyze($newSound); 
    52                         actualizaEntrada("notours", array('enclousure' => $soundInfo['filename'], 'length' => $soundInfo['filesize'], 'type' => $soundInfo['mime_type']), $id); 
    53                         $datos['son'] = $soundInfo['filename']; 
     80                $sound_id = db_insert_query($db_tables['files'], array('url' => '', 'length' => '', 'type' => '', 'volume' => '', 'angles' => '')); 
     81                $newSound = $projectFolder.$actualProjectFolder.$soundFolder."sound_".$object_data['project_id']."_".$sound_id.".".extension($son); 
     82                if (mueve('../'.$tmpSoundFolder.$son, '../'.$newSound)) { 
     83                        $url = "sound_".$object_data['project_id']."_".$sound_id.".".extension($son); 
     84                        $length = filesize('../'.$newSound); 
     85                        $type = new_mime_type($son); 
     86                        db_update_query($db_tables['files'], array('url' => $url, 'length' => $length, 'type' => $type), $sound_id); 
     87                        db_update_query($db_tables['objects'], array('sounds'=> $sound_id), $object_id); 
     88                        if (($object_id!=0)&&($old_data['sounds']!=''))  { 
     89                                db_delete_files(split(',', $old_data['sounds']), $object_data['project_id']); 
     90                        } 
     91                        $object_data['son'] = $newSound; 
    5492                } 
    5593        } 
    5694        if ( (isset($_POST['hidden_imaxe'])) && ($_POST['hidden_imaxe']!="") ) { 
    5795                $imaxe = $_POST['hidden_imaxe']; 
    58                 $newImg = "../".$projectFolder.$actualProjectFolder.$imagesFolder."img_".$datos['project']."_".$id.extension($imaxe); 
    59                 if (mueve('../'.$tmpImageFolder.$imaxe, $newImg)) { 
    60                         actualizaEntrada("notours", array('img' => "img_".$datos['project']."_".$id.extension($imaxe)), $id); 
    61                         $datos['imaxe'] = "img_".$datos['project']."_".$id.extension($imaxe); 
     96                $imaxe_id = db_insert_query($db_tables['files'], array('url' => '', 'length' => '', 'type' => '', 'volume' => '', 'angles' => '')); 
     97                $newImg = $projectFolder.$actualProjectFolder.$imagesFolder."img_".$datos['project']."_".$imaxe_id.".".extension($imaxe); 
     98                if (mueve('../'.$tmpImageFolder.$imaxe, '../'.$newImg)) { 
     99                        $url = "img_".$datos['project']."_".$imaxe_id.".".extension($imaxe); 
     100                        $length = filesize('../'.$newImg); 
     101                        $type = new_mime_type($imaxe); 
     102                        db_update_query($db_tables['files'], array('url' => $url, 'length' => $length, 'type' => $type), $imaxe_id); 
     103                        db_update_query($db_tables['objects'], array('images'=> $imaxe_id), $object_id); 
     104                        if (($object_id!=0)&&($old_data['images']!=''))  { 
     105                                db_delete_files(split(',', $old_data['images']), $object_data['project_id']); 
     106                        } 
     107                        $object_data['imaxe'] = $newImg; 
    62108                } 
    63109        } 
    64         echo json_encode($datos); 
     110        echo json_encode($object_data); 
    65111} else { 
    66         echo "<p>datos: ".count($datos)."<br />Algo va mal!</p>\n"; 
     112        $error = array ( 
     113                "msg" => "<p>datos: ".count($object_data)."<br />Algo va mal!</p>\n" 
     114        ); 
     115        echo json_encode($error); 
    67116} 
    68117 
  • notours/noTours editor/inc/actualizar_proyecto.php

    r217 r250  
    33include ("cb-library.php"); 
    44include ("config.php"); 
     5include ("db.php"); 
    56 
    67header("Content-type: text/html; charset=utf-8"); 
     
    1011// leemos las variables recibidas desde el formulario mediante el metodo POST 
    1112if ( (isset($_POST['hidden_id'])) && ($_POST['hidden_id']!="") ) { 
    12         $id = $_POST['hidden_id']; 
     13        $project_id = $_POST['hidden_id']; 
     14} 
     15if ( (isset($_POST['hidden_autor'])) && ($_POST['hidden_autor']!="") ) { 
     16        $project_data['author_id'] = $_POST['hidden_autor']; 
    1317} 
    1418if ( (isset($_POST['hidden_nombre'])) && ($_POST['hidden_nombre']!="") ) { 
    15         $datos['nombre'] = $_POST['hidden_nombre']; 
     19        $project_data['name'] = $_POST['hidden_nombre']; 
    1620} 
    17 if ( (isset($_POST['hidden_texto'])) && ($_POST['hidden_texto']!="") ) { 
    18         $datos['descripcion'] = $_POST['hidden_texto']; 
     21if ( (isset($_POST['hidden_descripcion'])) && ($_POST['hidden_descripcion']!="") ) { 
     22        $project_data['description'] = $_POST['hidden_descripcion']; 
    1923} 
    2024if ( (isset($_POST['hidden_lat'])) && ($_POST['hidden_lat']!="") && (isset($_POST['hidden_lonx'])) && ($_POST['hidden_lonx']!="") && (isset($_POST['hidden_zoom'])) && ($_POST['hidden_zoom']!="") ) { 
    21         $datos['latitud'] = $_POST['hidden_lat']; 
    22         $datos['longitud'] = $_POST['hidden_lonx']; 
    23         $datos['zoom'] = $_POST['hidden_zoom']; 
     25        $project_data['latitude'] = $_POST['hidden_lat']; 
     26        $project_data['longitude'] = $_POST['hidden_lonx']; 
     27        $project_data['zoom'] = $_POST['hidden_zoom']; 
    2428} 
    2529if ((isset($_POST['hidden_icono'])) && ($_POST['hidden_icono']!="")) { 
    2630        $icono = $_POST['hidden_icono']; 
    27         $datos['icono'] = "logo_notours_screen.png"; 
     31        $project_data['icon'] = "logo_notours_screen.png"; 
    2832} else { 
    29         if ($id==0) { 
     33        if ($project_id==0) { 
    3034                $icono = "logo_notours_screen.png"; 
    31                 $datos['icono'] = "logo_notours_screen.png"; 
     35                $project_data['icon'] = "logo_notours_screen.png"; 
    3236        } 
    3337} 
    3438 
    35 if (count($datos)>0) { 
    36         if ($id==0) { 
    37                 $id = nuevaEntrada("proyectos_notours", $datos); 
    38                 $datos['id'] = $id; 
    39                 mkdir("../".$projectFolder.$id, 0775); 
     39if (count($project_data)>0) { 
     40        if ($project_id==0) { 
     41                //$project_id = nuevaEntrada("proyectos_notours", $datos); 
     42                $project_id = db_insert_query($db_tables['projects'], $project_data); 
     43                $project_data['id'] = $project_id; 
     44                mkdir("../".$projectFolder.$project_id, 0775); 
     45                mkdir("../".$projectFolder.$project_id."/sound", 0775); 
     46                mkdir("../".$projectFolder.$project_id."/images", 0775); 
    4047        } else { 
    41                 actualizaEntrada("proyectos_notours", $datos, $id); 
    42                 $datos['id'] = $id; 
     48                db_update_query($db_tables['projects'], $project_data, $project_id); 
     49                //actualizaEntrada("proyectos_notours", $datos, $id); 
     50                $project_data['id'] = $project_id; 
    4351        } 
    4452        if(isset($icono)) { 
    4553                $img = imagecreatefrompng("../".$tmpImageFolder.$icono); 
    46                 imagepng($img, "../".$projectFolder.$id."/logo_notours_screen.png"); 
    47                 chmod ("../".$projectFolder.$id."/logo_notours_screen.png", 0775); 
     54                imagepng($img, "../".$projectFolder.$project_id."/logo_notours_screen.png"); 
     55                chmod ("../".$projectFolder.$project_id."/logo_notours_screen.png", 0775); 
    4856                if($icono!="logo_notours_screen.png") { 
    4957                        unlink("../".$tmpImageFolder.$icono); 
    5058                } 
    5159        } 
    52         echo json_encode($datos); 
     60        echo json_encode($project_data); 
    5361} else { 
    54         echo "<p>Algo va mal!</p>\n"; 
     62        $error = array ( 
     63                "msg" => "<p>Algo va mal!</p>\n" 
     64        ); 
     65        echo json_encode($error); 
    5566} 
    5667?> 
  • notours/noTours editor/inc/actualizar_rss.php

    r216 r250  
    11<?php 
    2 // incluimos el documento que contiene todas las funciones 
    3 include ("cb-library.php"); 
    4 include ("config.php"); 
     2        // incluimos el documento que contiene todas las funciones 
     3        include ("cb-library.php"); 
     4        include ("config.php"); 
     5        include ("db.php"); 
     6        include ("feed.php"); 
    57 
    6 // leemos la id del proxecto que imos recargar 
    7 $id = $_GET['proyecto']; 
     8        header("Content-type: text/html; charset=utf-8"); 
    89 
    9 header("Content-type: text/html; charset=utf-8"); 
    10  
    11 $marcadores = db_marcadores($id); 
    12 $proyecto = db_proyecto($id); 
    13  
    14 feed($proyecto, $marcadores, "rss", true); 
    15 comprimir("../".$projectFolder.$id); 
    16  
     10        if ((isset($_POST['proyecto']))&&($_POST['proyecto']!="")) { 
     11                // leemos la id del proxecto que imos recargar 
     12                $id = $_POST['proyecto']; 
     13                //$proyecto = db_proyecto($id); 
     14                $project = db_project('id', $id); 
     15                 
     16                if (isset($project['error'])) { 
     17                        echo json_encode($project); 
     18                }       else { 
     19                        //$marcadores = db_marcadores($id); 
     20                        $objects = db_objects($id); 
     21                        if (isset($objects['error'])) { 
     22                                echo json_encode($objects); 
     23                        }       else { 
     24                                //feed($proyecto, $marcadores, "rss", true); 
     25                                $feed = objects_feed($project, $objects, 'rss0'); 
     26                                escribe("../".$projectFolder.$project['id']."/soundscape-v0.rss", $feed, "w"); 
     27                                 
     28                                $feed = objects_feed($project, $objects, 'rss1'); 
     29                                escribe("../".$projectFolder.$project['id']."/soundscape-v1.rss", $feed, "w"); 
     30                                 
     31                                $result = comprimir("../".$projectFolder.$id); 
     32                                echo json_encode($result); 
     33                        } 
     34                } 
     35        } else { 
     36                $error = array ( 
     37                        "error" => true, 
     38                        "msg" => 'No se ha especificado ningun proyecto para actualizar' 
     39                ); 
     40                echo json_encode($error); 
     41        } 
    1742?> 
  • notours/noTours editor/inc/cb-library.php

    r222 r250  
    11<?php 
    2  
    3 /*function engadirMarcador($folderId, $x, $y, $lat, $lonx, $rad, $img, $sound, $tit , $text) { 
    4          
    5         // variables globales 
    6         global $incFolder; 
    7         global $soundFolder; 
    8         global $imagesFolder; 
    9         global $tmpSoundFolder; 
    10         global $tmpImageFolder; 
    11          
    12         global $claves; 
    13         global $claves_contenido; 
    14          
    15         // docs/markers.tsv 
    16         $doc = $docFolder.$docTabs.$extension; 
    17         if (is_dir("../".$projectFolder.$folderId)) { 
    18          
    19         } else { 
    20                 //si no existe creamos la carpeta del proyecto 
    21                 mkdir("../".$projectFolder.$folderId, 0755); 
    22                 mkdir("../".$projectFolder.$folderId.$soundFolder, 0755); 
    23                 mkdir("../".$projectFolder.$folderId.$imagesFolder, 0755); 
    24         } 
    25          
    26         // contamos las lineas que ya hay en el documento 
    27         $insertId = mysqlInsert(); 
    28          
    29         $newImg = "../".$projectFolder.$folderId.$imagesFolder."/img_".$folderId."_".$insertId.extension($img); 
    30         $newSound = "../".$projectFolder.$folderId.$soundFolder."/sound_".$folderId."_".$insertId.extension($sound); 
    31          
    32          
    33         // include getID3() library (can be in a different directory if full path is specified) 
    34         require_once('getid3/getid3.php'); 
    35         // Initialize getID3 engine 
    36         $getID3 = new getID3; 
    37  
    38         if ( (mueve($tmpImageFolder.$img, $newImg)) && (mueve($tmpSoundFolder.$sound, $newSound)) ) { 
    39                  
    40                 // Analyze file and store returned data in $soundInfo 
    41                 $soundInfo = $getID3->analyze($newSound); 
    42                 if (escribeBD ($folderId, $insertId, $lat, $lonx, $rad, "img_".$folderId."_".$insertId.extension($img), $soundInfo, $tit , $text)) { 
    43                         escribeFeed($folderId, "rss", true); 
    44                         comprimir("../".$projectFolder.$folderId); 
    45                 } 
    46         } else { 
    47                 echo "error"; 
    48         } 
    49 }*/ 
    502 
    513function leer($doc, $claves) { 
     
    10456 
    10557function extension($file) { 
    106         $posicion = strpos($file, '.'); 
     58        $posicion = strpos($file, '.') + 1; 
    10759        $extension = substr($file, $posicion); 
    108         return $extension; 
     60        return strtolower($extension); 
     61} 
     62 
     63function new_mime_type($file) { 
     64        $extension = extension($file); 
     65        switch ($extension) { 
     66                case 'mp3': 
     67                        $mine_type = 'audio/mpeg';  
     68                break; 
     69                case 'aif': 
     70                        $mine_type = 'audio/x-aiff ';  
     71                break; 
     72                case 'aiff': 
     73                        $mine_type = 'audio/x-aiff ';  
     74                break; 
     75                case 'wav': 
     76                        $mine_type = 'audio/x-wav';  
     77                break; 
     78                case 'm3u': 
     79                        $mine_type = 'audio/x-mpegurl';  
     80                break; 
     81                case 'gif': 
     82                        $mine_type = 'image/gif';  
     83                break; 
     84                case 'jpeg': 
     85                        $mine_type = 'image/jpeg';  
     86                break; 
     87                case 'jpg': 
     88                        $mine_type = 'image/jpeg';  
     89                break; 
     90                case 'tif': 
     91                        $mine_type = 'image/tiff';  
     92                break; 
     93                case 'tiff': 
     94                        $mine_type = 'image/tiff';  
     95                break; 
     96                case 'png': 
     97                        $mine_type = 'image/png';  
     98                break; 
     99        } 
     100        return $mine_type; 
    109101} 
    110102 
     
    121113} 
    122114 
    123 function feedHeader($proyecto, $class) { 
    124         global $root; 
    125         global $projectFolder; 
    126         $return = ""; 
    127         if ($class=="rss") { 
    128                 $return .= "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; 
    129                 $return .= "<rss version=\"2.0\" xmlns:georss=\"http://www.georss.org/georss\">\n"; 
    130                 $return .= "<channel>\n"; 
    131                 $return .= "\t<title>".$proyecto["nombre"]."</title>\n"; 
    132                 $return .= "\t<link>".$root.$projectFolder.$proyecto["id"]."/</link>\n"; 
    133                 $return .= "\t<description>".$proyecto["descripcion"]."</description>\n"; 
    134                 $return .= "\t<language>es</language>\n"; 
    135                 $return .= "\t<georss:relationshiptag>is-centered-at</georss:relationshiptag>\n"; 
    136                 $return .= "\t<georss:point>".$proyecto["latitud"]." ".$proyecto["longitud"]."</georss:point>\n"; 
    137         } else if ($class=="atom") { 
    138         } 
    139         return $return; 
    140 }        
    141  
    142 function feedHeader2($proyecto, $class) { 
    143         global $root; 
    144         global $projectFolder; 
    145         $return = ""; 
    146         if ($class=="rss") { 
    147                 $return .= "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; 
    148                 $return .= "<rss version=\"2.0\" xmlns:georss=\"http://www.georss.org/georss\">\n"; 
    149                 $return .= "<channel>\n"; 
    150                 $return .= "\t<title>".$proyecto["nombre"]."</title>\n"; 
    151                 $return .= "\t<link>".$root.$projectFolder."/</link>\n"; 
    152                 $return .= "\t<description>".$proyecto["descripcion"]."</description>\n"; 
    153                 $return .= "\t<language>es</language>\n"; 
    154         } else if ($class=="atom") { 
    155         } 
    156         return $return; 
    157 } 
    158  
    159 function entradas($entradas, $proyecto, $class) { 
    160         global $root; 
    161         global $projectFolder; 
    162         global $soundFolder; 
    163         global $imagesFolder; 
    164         $return = ""; 
    165         if ($class=="rss") { 
    166                 for ($i=0; $i<count($entradas); $i++) { 
    167                         $return .= "\t<item>\n"; 
    168                         $return .= "\t\t<guid>".$entradas[$i]["id"]."</guid>\n"; 
    169                         $return .= "\t\t<title>".$entradas[$i]["title"]."</title>\n"; 
    170                         $return .= "\t\t<description>".$entradas[$i]["description"]."</description>\n"; 
    171                         $return .= "\t\t<enclosure url=\"".$root.$projectFolder.$proyecto["id"]."/".$soundFolder.$entradas[$i]["enclousure"]."\" length=\"".$entradas[$i]["length"]."\" type=\"".$entradas[$i]["type"]."\" />\n"; 
    172                         $return .= "\t\t<enclosure url=\"".$root.$projectFolder.$proyecto["id"]."/".$imagesFolder.$entradas[$i]["img"]."\" length=\"\" type=\"image/jpg\" />\n"; 
    173                         $return .= "\t\t<pubDate>".$entradas[$i]["modified"]."</pubDate>\n"; 
    174                         $return .= "\t\t<georss:".$entradas[$i]["class"].">".$entradas[$i]["data"]."</georss:".$entradas[$i]["class"].">\n"; 
    175                         $return .= "\t</item>\n"; 
    176                 } 
    177         } else if ($class=="atom") { 
    178         } 
    179         return $return; 
    180 } 
    181  
    182 function entradas2($entradas, $class) { 
    183         global $root; 
    184         global $projectFolder; 
    185         global $soundFolder; 
    186         global $imagesFolder; 
    187         $return = ""; 
    188         if ($class=="rss") { 
    189                 for ($i=0; $i<count($entradas); $i++) { 
    190                         $return .= "\t<item>\n"; 
    191                         $return .= "\t\t<guid>".$entradas[$i]["id"]."</guid>\n"; 
    192                         $return .= "\t\t<title>".$entradas[$i]["nombre"]."</title>\n"; 
    193                         $return .= "\t\t<description>".$entradas[$i]["descripcion"]."</description>\n"; 
    194                         $return .= "\t\t<enclosure url=\"".$root.$projectFolder.$entradas[$i]["id"]."/".$entradas[$i]["icono"]."\" length=\"\" type=\"image/png\" />\n"; 
    195                         $return .= "\t\t<georss:point>".$entradas[$i]['latitud']." ".$entradas[$i]['longitud']."</georss:point>\n"; 
    196                         $return .= "\t\t<pubDate>Mon, 23 Nov 2009 00:34:19 +0100</pubDate>\n"; 
    197                         $return .= "\t</item>\n"; 
    198                 } 
    199         } else if ($class=="atom") { 
    200         } 
    201         return $return; 
    202 } 
    203  
    204 function feedFooter($class) { 
    205         $return = ""; 
    206         if ($class=="rss") { 
    207                 $return .= "</channel>\n"; 
    208                 $return .= "</rss>\n"; 
    209         } else if ($class=="atom") { 
    210          
    211         } 
    212         return $return; 
    213 } 
    214  
    215 function feed($proyecto, $marcadores, $class, $write) { 
    216         global $projectFolder; 
    217         $return = ""; 
    218         $return .= feedHeader($proyecto, $class); 
    219         $return .= entradas($marcadores, $proyecto, $class); 
    220         $return .= feedFooter($class); 
    221         if ($write) { 
    222                 $url = "../".$projectFolder.$proyecto['id'].'/soundscape.'.$class; 
    223                 escribe($url, $return, "w"); 
    224         } 
    225         return $return; 
    226 } 
    227  
    228 function feed2($channel, $proyectos, $class, $write) { 
    229         global $projectFolder; 
    230         $return = ""; 
    231         $return .= feedHeader2($channel, $class); 
    232         $return .= entradas2($proyectos, $class); 
    233         $return .= feedFooter($class); 
    234         if ($write) { 
    235                 $url = "../".$projectFolder.'soundscapes.'.$class; 
    236                 escribe($url, $return, "w"); 
    237         } 
    238         return $return; 
    239 } 
    240  
    241 function mysqlInsert() { 
    242         global $db; 
    243         $link = mysql_connect ($db['host'],$db['user'],$db['pass']); 
    244         if (!$link) { 
    245                 echo "error conecatndo a la BD para isertar"; 
    246                 return false; 
    247         } else { 
    248                 mysql_select_db ($db['data'], $link); 
    249                 $dosql = "INSERT INTO ".$db['table']." 
    250                 (`title`, `description`, `class`, `data`, `enclousure`, `img`, `length`, `type`, `modified`) 
    251                 VALUES 
    252                 ('', '', '', '', '', '', '', '', '')"; 
    253                 mysql_query ($dosql); 
    254                 $return = mysql_insert_id(); 
    255                 mysql_close ($link); 
    256                 return $return; 
    257         } 
    258 } 
    259  
    260 /*function escribeBD ($folderId, $id, $lat, $lonx, $rad, $img, $soundInfo, $tit , $text) { 
    261         global $db; 
    262         $link = mysql_connect ($db['host'],$db['user'],$db['pass']); 
    263         if (!$link) { 
    264                 echo "error conecatndo a la BD para escribir"; 
    265                 return false; 
    266         } else { 
    267                 mysql_select_db ($db['data'], $link); 
    268                 $dosql = "UPDATE ".$db['table']." SET  
    269                 `project` = '".$folderId."', 
    270                 `title` = '".$tit."', 
    271                 `description` = '".$text."', 
    272                 `class`= 'point', 
    273                 `data`= '".$lat." ".$lonx." ".$rad."', 
    274                 `enclousure`= '".$soundInfo['filename']."', 
    275                 `img`= '".$img."', 
    276                 `length`= '".$soundInfo['filesize']."', 
    277                 `type`= '".$soundInfo['mime_type']."', 
    278                 `modified`= '".date(r)."' 
    279                 WHERE `id`=".$id." LIMIT 1"; 
    280                 mysql_query ($dosql); 
    281                 mysql_close ($link); 
    282                 return true; 
    283         } 
    284         echo $dosql; 
    285 }*/ 
    286 function db_nuevo_proyecto ($nombre, $autor, $icono, $latitud, $longitud, $zoom) { 
    287         global $db; 
    288         $link = mysql_connect ($db['host'],$db['user'],$db['pass']); 
    289         if (!$link) { 
    290                 echo "error conectando a la BD para isertar"; 
    291                 return false; 
    292         } else { 
    293                 mysql_select_db ($db['data'], $link); 
    294                 $dosql = "INSERT INTO proyectos_notours 
    295                 (`nombre`, `autor`, `icono`, `latitud`, `longitud`, `zoom`) 
    296                 VALUES 
    297                 ('".$nombre."', '".$autor."', '".$icono."', '".$latitud."', '".$longitud."', '".$zoom."')"; 
    298                 mysql_query ($dosql); 
    299                 $return = mysql_insert_id(); 
    300                 mysql_close ($link); 
    301                 return $return; 
    302         } 
    303 } 
    304  
    305 function db_proyectos() { 
    306         global $db; 
    307         $proyectos = array(); 
    308         $link = mysql_connect ($db['host'],$db['user'],$db['pass']); 
    309         if (!$link) { 
    310                 echo "error conecatndo a la BD para hacer el feed"; 
    311                 return false; 
    312         } else { 
    313                 mysql_select_db ($db['data'], $link); 
    314                 $dosql = "SELECT * FROM proyectos_notours ORDER BY id DESC"; 
    315                 $result = mysql_query ($dosql); 
    316                 while ($row = mysql_fetch_array($result)) { 
    317                         $proyecto = array ( 
    318                                 "id" => $row['id'], 
    319                                 "nombre" => $row['nombre'], 
    320                                 "descripcion" => $row['descripcion'], 
    321                                 "autor" => $row['autor'], 
    322                                 "icono" => $row['icono'], 
    323                                 "latitud" => $row['latitud'], 
    324                                 "longitud" => $row['longitud'], 
    325                                 "zoom" => $row['zoom'] 
    326                         ); 
    327                         array_push($proyectos, $proyecto); 
    328                 } 
    329                 mysql_close ($link); 
    330                 return $proyectos; 
    331         } 
    332 } 
    333  
    334 function db_proyecto($id) { 
    335         global $db; 
    336         $link = mysql_connect ($db['host'],$db['user'],$db['pass']); 
    337         if (!$link) { 
    338                 echo "error conecatndo a la BD para hacer el feed"; 
    339                 return false; 
    340         } else { 
    341                 mysql_select_db ($db['data'], $link); 
    342                 $dosql = "SELECT * FROM proyectos_notours WHERE id=".$id." ORDER BY id DESC"; 
    343                 $result = mysql_query ($dosql); 
    344                 while ($row = mysql_fetch_array($result)) { 
    345                         $proyecto = array ( 
    346                                 "id" => $row['id'], 
    347                                 "nombre" => $row['nombre'], 
    348                                 "descripcion" => $row['descripcion'], 
    349                                 "autor" => $row['autor'], 
    350                                 "icono" => $row['icono'], 
    351                                 "latitud" => $row['latitud'], 
    352                                 "longitud" => $row['longitud'], 
    353                                 "zoom" => $row['zoom'] 
    354                         ); 
    355                         //array_push($proyectos, $proyecto); 
    356                 } 
    357                 mysql_close ($link); 
    358                 return $proyecto; 
    359         } 
    360 } 
    361  
    362 function db_marcadores($id) { 
    363         global $db; 
    364         $marcadores = array(); 
    365         $link = mysql_connect ($db['host'],$db['user'],$db['pass']); 
    366         if (!$link) { 
    367                 echo "error conecatndo a la BD para hacer el feed"; 
    368                 return false; 
    369         } else { 
    370                 mysql_select_db ($db['data'], $link); 
    371                 $dosql = "SELECT * FROM notours WHERE project=".$id." ORDER BY id DESC"; 
    372                 $result = mysql_query ($dosql); 
    373                 while ($row = mysql_fetch_array($result)) { 
    374                         $marcador = array ( 
    375                                 "id" => $row['id'], 
    376                                 "project" => $row['project'], 
    377                                 "title" => $row['title'], 
    378                                 "description" => $row['description'], 
    379                                 "class" => $row['class'], 
    380                                 "data" => $row['data'], 
    381                                 "enclousure" => $row['enclousure'], 
    382                                 "img" => $row['img'], 
    383                                 "length" => $row['length'], 
    384                                 "type" => $row['type'], 
    385                                 "modified" => $row['modified'] 
    386                         ); 
    387                         array_push($marcadores, $marcador); 
    388                 } 
    389                 mysql_close ($link); 
    390                 return $marcadores; 
    391         } 
    392 } 
    393  
    394  
    395115function geoData($class, $data) { 
    396116        if ($class=="point") { 
    397117                $return = explode(" ", $data); 
    398118        } 
    399         return $return; 
    400 } 
    401  
    402 function eliminaEntrada($id, $tabla) { 
    403         global $db; 
    404         global $soundFolder; 
    405         global $imagesFolder; 
    406         global $projectFolder; 
    407         $return  = array(false, ""); 
    408          
    409         $link = mysql_connect ($db['host'],$db['user'],$db['pass']); 
    410         if (!$link) { 
    411                 $return[1] .= "error conecatndo a la BD para borrar<br />"; 
    412         } else { 
    413                 mysql_select_db ($db['data'], $link); 
    414                 $dosql = "SELECT * FROM `".$tabla."` WHERE `id` = ".$id." LIMIT 1"; 
    415                 $result = mysql_query ($dosql); 
    416                 if (!$result) { 
    417                         $return[1] .= "el elemento ".$id." no fue encontrado en la tabla `".$tabla."`<br />"; 
    418                 } else { 
    419                         $row = mysql_fetch_array($result); 
    420                         if (($row['img']!=null)&&($row['img']!="")) { 
    421                                 $img = "../".$projectFolder.$row['project']."/".$imagesFolder.$row['img']; 
    422                                 $return[1] .= $img."<br />"; 
    423                                 unlink($img); 
    424                         } 
    425                         if (($row['enclousure']!=null)&&($row['enclousure']!="")) { 
    426                                 $sound = "../".$projectFolder.$row['project']."/".$soundFolder.$row['enclousure']; 
    427                                 $return[1] .= $sound."<br />"; 
    428                                 unlink($img); 
    429                         } 
    430                         $dosql = "DELETE FROM `".$tabla."` WHERE `id` = ".$id." LIMIT 1"; 
    431                         if (mysql_query ($dosql)) { 
    432                                 $return[0] = true; 
    433                                 $return[1] .= $dosql."<br />"; 
    434                         } else { 
    435                                 $return[1] .= $dosql."<br />"; 
    436                         } 
    437                 } 
    438                 mysql_close ($link); 
    439         } 
    440         return $return; 
    441 } 
    442  
    443 function actualizaEntrada($table, $data, $id) { 
    444         global $db; 
    445         $dosql = ""; 
    446         $link = mysql_connect ($db['host'],$db['user'],$db['pass']); 
    447         if (!$link) { 
    448                 echo "error conecatndo a la BD para escribir"; 
    449                 return false; 
    450         } else { 
    451                 mysql_select_db ($db['data'], $link); 
    452                 $dosql .= "UPDATE ".$table." SET "; 
    453                 $campos = array_keys($data); 
    454                 $values = array_values($data); 
    455                 $dosql .= "`".$campos[0]."` = '".$values[0]."'"; 
    456                 for($i=1; $i<count($data); $i++) { 
    457                         $dosql .= ", `".$campos[$i]."` = '".$values[$i]."'"; 
    458                 } 
    459                 $dosql .= " WHERE `id`=".$id." LIMIT 1"; 
    460                 //echo $dosql; 
    461                 mysql_query ($dosql); 
    462                 mysql_close ($link); 
    463                 return true; 
    464         } 
    465 } 
    466  
    467 function nuevaEntrada($table, $data) { 
    468         global $db; 
    469         $link = mysql_connect ($db['host'],$db['user'],$db['pass']); 
    470         $dosql = ""; 
    471         if (!$link) { 
    472                 echo "error conectando a la BD para isertar"; 
    473                 return false; 
    474         } else { 
    475                 mysql_select_db ($db['data'], $link); 
    476                 $campos = array_keys($data); 
    477                 $values = array_values($data); 
    478                 $dosql .= "INSERT INTO `".$table."` (`".$campos[0]."`"; 
    479                 for($i=1; $i<count($campos); $i++) { 
    480                         $dosql .= ", `".$campos[$i]."`"; 
    481                 } 
    482                 $dosql .= ") VALUES ('".$values[0]."'"; 
    483                 for($i=1; $i<count($values); $i++) { 
    484                         $dosql .= ", '".$values[$i]."'"; 
    485                 } 
    486                 $dosql .= ")"; 
    487                 //echo $dosql; 
    488                 mysql_query ($dosql); 
    489                 $return = mysql_insert_id(); 
    490                 mysql_close ($link); 
    491                 return $return; 
    492         } 
    493 } 
    494  
    495 function head() { 
    496         $return = ''; 
    497         return $return; 
    498 } 
    499  
    500 function foot() { 
    501         $return = ''; 
    502119        return $return; 
    503120} 
     
    670287        fun_dir($folderId."/", $contenido); 
    671288        createzip($contenido,"../projects/".$folderId.".zip") or die("Error: al construir el ZIP."); 
    672         echo "<a href=\"".$folderId.".zip\">Bajar este proyecto</a>"; 
     289        $result = array ( 
     290                "msg" => "el proyecto ha sido comprimido correctamente" 
     291        ); 
     292        return $result; 
    673293} 
    674294 
  • notours/noTours editor/inc/config.php

    r216 r250  
    77"data" => "Sql76814_2", 
    88"user" => "Sql76814", 
    9 "pass" => "98a14376", 
    10 "table"=> "notours", 
     9"pass" => "98a14376" 
     10); 
     11 
     12$db_tables = array( 
     13"authors" => "notours_author", 
     14"projects" => "notours_project", 
     15"objects" => "notours_object", 
     16"files" => "notours_file" 
    1117); 
    1218 
  • notours/noTours editor/inc/css/estilo_form.css

    r223 r250  
    1616        line-height: 200%; 
    1717} 
    18 #mapa_marcadores { 
    19         position: absolute; 
    20         top: 0; 
    21         bottom: 0; 
    22         right: 0; 
    23         left: 400px; 
     18ul { 
     19        list-style-type: none; 
     20        margin: 0; 
     21        padding: 0 8px; 
     22} 
     23li { 
     24        background-color: #fff; 
     25        margin-top: 8px; 
     26        padding: 8px; 
     27} 
     28 
     29li.proyecto { 
     30        padding: 0; 
     31        height: 52px; 
     32} 
     33li.proyecto input, li.proyecto label { 
     34        line-height: 52px; 
     35        vertical-align: middle; 
     36        display: block; 
     37        float: left; 
     38} 
     39li.proyecto input { 
     40        height: 50px; 
     41        margin: 0 5px; 
     42} 
     43li.proyecto .icono { 
     44        width: 52px; 
     45        height: 52px; 
     46        float: left; 
     47} 
     48 
     49fieldset{ 
     50        border: none; 
     51} 
     52/*fieldset de formularios con texto azul agochado*/ 
     53.corregir_proyecto .enviar_formulario { 
     54        /*background-color: #bdd1e2;*/ 
     55        min-height: 28px; 
     56} 
     57.corregir_proyecto .submit { 
     58        border:1px solid #fff; 
     59} 
     60.submit { 
     61        border:1px solid #ccc; 
     62        background-color: #bdd1e2; 
     63        float: right; 
     64} 
     65.eliminar_marcador { 
     66        height: 20px; 
     67} 
     68.eliminar { 
     69        border:1px solid #ccc; 
     70        background-color: #d3795e; 
     71        float: right; 
     72} 
     73 
     74#panel_control { 
     75} 
     76#proyectos, #marcadores { 
     77        width: 391px; 
     78        margin: 8px; 
    2479        background-color: #ccc; 
    25 } 
    26 #panel_control { 
    27 } 
    28 #proyectos, #marcadores { 
    29         border: 1px #ccc dotted; 
    30         width: 396px; 
    31         background-color: #fff; 
    3280} 
    3381#marcadores { 
    3482        overflow: auto; 
    3583        position: absolute; 
    36         top: 320px; 
     84        top: 30px; 
    3785        bottom: 0; 
    3886        left: 0; 
    3987} 
    40  
    41 #proyectos .contenedor_nombre { 
    42         border:1px solid #777; 
     88#pestanhaMapa { 
     89        position: absolute; 
     90        top: 8px; 
     91        right: 8px; 
     92        left: 408px; 
     93} 
     94#cajaMapa { 
     95        position: absolute; 
     96        top: 34px; 
     97        bottom: 128px; 
     98        right: 8px; 
     99        left: 408px; 
     100        padding: 8px; 
     101        background-color: #ccc; 
     102} 
     103#terminal { 
     104        color: #ccc; 
     105        font-size: 0.8em; 
     106        padding: 4px; 
     107        position: absolute; 
     108        background-color: #000; 
     109        height: 120px; 
     110        bottom: 8px; 
     111        right: 8px; 
     112        left: 408px; 
     113        overflow: scroll; 
     114} 
     115 
     116#mapa_marcadores { 
     117        width: 100%; 
     118        height: 100%; 
     119} 
     120 
     121.pestanha { 
    43122        height: 26px; 
    44123        overflow: hidden; 
     124        background-color: #000; 
     125        font-weight: bold; 
     126        color: #ccc; 
     127} 
     128.pestanha span { 
     129        line-height: 26px; 
     130        vertical-align: middle; 
     131        margin-left: 8px; 
    45132} 
    46133#proyectos .contenedor_nombre div { 
     
    48135        float: left; 
    49136        padding: 3px 0; 
     137        width: 240px; 
    50138} 
    51139#proyectos .contenedor_nombre div .valor { 
     
    58146        margin-left: 3px; 
    59147        height: 20px; 
    60         width: 200px; 
     148        width: 240px; 
    61149} 
    62150#proyectos .contenedor_nombre div.agochado { 
     
    64152        float: left; 
    65153} 
    66 #proyectos .contenedor_nombre span { 
    67         display: block; 
    68         float: right; 
    69         padding: 0px 10px; 
     154/*#proyectos .contenedor_nombre span*/ 
     155.toogle, .next, .back, .novo { 
     156        display: block; 
     157        float: right; 
     158        padding: 0; 
     159        margin:0; 
    70160        cursor: pointer; 
    71161        /*float: left;*/ 
     
    73163.contenedor { 
    74164        position: relative; 
    75         background: #fff; 
     165        /*background: #fff;*/ 
    76166        overflow: hidden; 
    77167        height: 285px; 
    78168} 
     169.recuadro { 
     170        border:1px solid #ccc; 
     171} 
     172.recuadro input { 
     173        display: block; 
     174} 
     175 
    79176#proyectos .contenedor_icono { 
    80177        position: relative; 
     
    108205        display: none; 
    109206} 
     207#password, #crearAutor{ 
     208        margin: 20px; 
     209        padding: 8px; 
     210} 
     211#password label, #crearAutor label { 
     212        display: inline; 
     213} 
     214 
    110215label { 
    111216        font-size: 0.8em; 
     
    125230.corregir_proyecto { 
    126231        position: absolute; 
    127         background: #fff; 
     232        /*background: #fff;*/ 
    128233        bottom: -15px; 
    129234        width: 394px; 
     
    136241 display inline; 
    137242} 
    138  
    139 .agochado { 
     243.mark { 
     244        cursor: pointer; 
     245        margin-right: 8px; 
     246        float: left; 
     247} 
     248.agochado, .corregir_nombre, .corregir_descripcion, .corregir_coordenadas, .corregir_titulo, .corregir_texto, .corregir_imagen, .corregir_sonido, .corregir_icono { 
    140249        display: none; 
    141250} 
    142251 
    143252/* Listaxe procesar formulario*/ 
    144 .valor { 
     253.valor, .eliminar_proyecto, .actualizar_proyecto{ 
    145254        cursor: pointer; 
     255} 
     256.aciones a{ 
     257        /*float: left;*/ 
     258        border:1px solid #fff; 
     259        background-color: #d3795e; 
     260        padding: 2px; 
     261        margin: 5px 0; 
     262        font-size: 0.8em; 
     263        color: #000; 
     264        text-decoration: none; 
     265} 
     266.corregir_localizacion { 
     267        padding: 8px 0; 
     268        display: block; 
    146269} 
    147270.new { 
  • notours/noTours editor/inc/js/Gmaps.js

    r224 r250  
    1 //************************** 
    2 // MPolyDragControl modifier 
    3 //************************** 
    4  
    5 MPolyDragControl.prototype.target = ""; 
    6 MPolyDragControl.prototype.infoFormulario = function() { 
    7         var point = this.dragMarker0.getLatLng(); 
    8         $("#marcador_"+ this.target +" .corregir_coordenadas").empty(); 
    9         $("#marcador_"+ this.target +" .corregir_coordenadas").append(hidden_coordenadas_html(this.target, point.y, point.x, this.radius)); 
    10         $("#marcador_"+ this.target +" .contenedor_lat .valor").text(point.y); 
    11         $("#marcador_"+ this.target +" .contenedor_lat .valor").attr("class","valor editar_marcador new"); 
    12         $("#marcador_"+ this.target +" .contenedor_lonx .valor").text(point.x); 
    13         $("#marcador_"+ this.target +" .contenedor_lonx .valor").attr("class","valor editar_marcador new"); 
    14         $("#marcador_"+ this.target +" .contenedor_radio .valor").text(this.radius); 
    15         $("#marcador_"+ this.target +" .contenedor_radio .valor").attr("class","valor editar_marcador new");             
    16 } 
     1//****************************** 
     2// Map soundscape Custom Control 
     3//****************************** 
     4 
     5function engadeSoundscape(map) { 
     6        var center = map.getCenter(); 
     7        var geo = Array(center.lat(), center.lng(), 50); 
     8        //NotoursSoundscape(id, proyecto, title, description, sons, imgs, modified, geodata, angles)  
     9        marcador_0 = new NotoursSoundscape(); 
     10        marcador_0.initialize(0, proyectoActual, "nuevo", "descripcion de la nueva entrada", "", "", "", geo, new Array(0,90,90,180,180,270,270,360)); 
     11        polyDragControl2.target = 0; 
     12        polyDragControl2.mapClick(new GLatLng(geo[0], geo[1])); 
     13        first = false; 
     14        marcador_0.Gmarker.hide(); 
     15        marcador_0.Gpolygons[0].hide(); 
     16        marcador_0.Gpolygons[1].hide(); 
     17        marcador_0.Gpolygons[2].hide(); 
     18        marcador_0.Gpolygons[3].hide(); 
     19                 
     20        $("ul").prepend(li_html(0,"marcador")); 
     21        $("#marcador_0").append(editar_marcador_html(0, proyectoActual)); 
     22        inicia_jquery(); 
     23        $("#marcador_0 .valor").attr("class","valor new"); 
     24        var html = '\t\t<input name="hidden_proyecto" type="hidden" value="'+proyectoActual+'" />\n'; 
     25        $("#marcador_0 .corregir_marcador").prepend(html); 
     26        $("#marcador_0 .corregir_titulo").append(hidden_imput_html ("titulo", 0, "nuevo")); 
     27        $("#marcador_0 .corregir_texto").append(hidden_imput_html ("texto", 0, "descripcion de la nueva entrada")); 
     28        $("#marcador_0 .corregir_coordenadas").append(hidden_coordenadas_html(0, geo[0], geo[1], geo[2])); 
     29} 
     30function mapSoundscapeControl() { 
     31} 
     32mapSoundscapeControl.prototype = new GControl(); 
     33mapSoundscapeControl.prototype.initialize = function(map) { 
     34        var container = document.createElement("div"); 
     35    var addSoundscape = document.createElement("div"); 
     36    addSoundscape.style.cursor = "pointer"; 
     37        GEvent.addDomListener(addSoundscape, "click", function(overlay, latlng) { 
     38                $("#terminal").append('mapSoundscapeControl.click(); <br />'); 
     39                //si ya hay yn marcador abierto para editar el mejor cerrarlo antes 
     40                if($("#marcador_0").attr("class")=="marcador") { 
     41                        $("#terminal").append($("#marcador_0").attr("class") + '<br />'); 
     42                        if (confirm("Primero debe guardar el marcador que estaba editando, " + String.fromCharCode(191) +"desea hacerlo ahora?")) { 
     43                                enviarMarcador($("#marcador_0 .corregir_marcador"), function() { 
     44                                        engadeSoundscape(map); 
     45                                }); 
     46                        } 
     47                } else { 
     48                        engadeSoundscape(map); 
     49                } 
     50        }); 
     51         
     52        var addSoundscapeImg = document.createElement("img"); 
     53        addSoundscapeImg.src = root + "inc/pix/Bmu.png"; 
     54         
     55        addSoundscape.appendChild(addSoundscapeImg); 
     56    container.appendChild(addSoundscape); 
     57        map.getContainer().appendChild(container); 
     58        return container; 
     59} 
     60mapSoundscapeControl.prototype.getDefaultPosition = function() { 
     61        return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(95, 15)); 
     62} 
     63 
    1764 
    1865//************************ 
     
    2067//************************ 
    2168 
     69function engadeMarker(map) { 
     70        var center = map.getCenter(); 
     71        var geo = Array(center.lat(), center.lng(), 50); 
     72        marcador_0 = new NotoursSoundpoint(); 
     73        marcador_0.initialize(0, proyectoActual, "nuevo", "descripcion de la nueva entrada", "", "", "", geo); 
     74        polyDragControl.target = 0; 
     75        polyDragControl.mapClick(new GLatLng(geo[0], geo[1])); 
     76        first = false; 
     77        marcador_0.Gmarker.hide(); 
     78        marcador_0.Gpolygon.hide(); 
     79        $("ul").prepend(li_html(0,"marcador")); 
     80        $("#marcador_0").append(editar_marcador_html(0, proyectoActual)); 
     81        inicia_jquery(); 
     82        $("#marcador_0 .valor").attr("class","valor new"); 
     83        var html = '\t\t<input name="hidden_proyecto" type="hidden" value="'+proyectoActual+'" />\n'; 
     84        $("#marcador_0 .corregir_marcador").prepend(html); 
     85        $("#marcador_0 .corregir_titulo").append(hidden_imput_html ("titulo", 0, "nuevo")); 
     86        $("#marcador_0 .corregir_texto").append(hidden_imput_html ("texto", 0, "descripcion de la nueva entrada")); 
     87        $("#marcador_0 .corregir_coordenadas").append(hidden_coordenadas_html(0, geo[0], geo[1], geo[2])); 
     88} 
     89 
    2290function mapEditControl() { 
    2391} 
     
    2593mapEditControl.prototype.initialize = function(map) { 
    2694        var container = document.createElement("div"); 
    27                  
    28         var addMarker = document.createElement("div"); 
    29         addMarker.style.cursor = "pointer"; 
     95    var addMarker = document.createElement("div"); 
     96    addMarker.style.cursor = "pointer"; 
    3097        GEvent.addDomListener(addMarker, "click", function(overlay, latlng) { 
    31                 var center = map.getCenter(); 
    32                 var geo = Array(center.lat(), center.lng(), 50); 
    33                 notours_marker_data(0, proyectoActual, "nuevo", "descripcion de la nueva entrada", "", "", "", geo); 
    34                 polyDragControl.target = 0; 
    35                 polyDragControl.mapClick(new GLatLng(geo[0], geo[1])); 
    36                 first = false; 
    37                 marcador_0.Gmarker.hide(); 
    38                 marcador_0.Gpolygon.hide(); 
    39                 $("ul").prepend(li_html(0,"marcador")); 
    40                 $("#marcador_0").append(editar_marcador_html(0, proyectoActual)); 
    41                 inicia_jquery(); 
    42                 $("#marcador_0 .valor").attr("class","valor new"); 
    43                 var html = '\t\t<input name="hidden_proyecto" type="hidden" value="'+proyectoActual+'" />\n'; 
    44                 $("#marcador_0 .corregir_marcador").prepend(html); 
    45                 $("#marcador_0 .corregir_titulo").append(hidden_imput_html ("titulo", 0, "nuevo")); 
    46                 $("#marcador_0 .corregir_texto").append(hidden_imput_html ("texto", 0, "descripcion de la nueva entrada")); 
    47                 $("#marcador_0 .corregir_coordenadas").append(hidden_coordenadas_html(0, geo[0], geo[1], geo[2])); 
     98                $("#terminal").append('mapEditControl.click(); <br />'); 
     99                //si ya hay yn marcador abierto para editar el mejor cerrarlo antes 
     100                if($("#marcador_0").attr("class")=="marcador") { 
     101                        $("#terminal").append($("#marcador_0").attr("class") + '<br />'); 
     102                        if (confirm("Primero debe guardar el marcador que estaba editando, " + String.fromCharCode(191) +"desea hacerlo ahora?")) { 
     103                                enviarMarcador($("#marcador_0 .corregir_marcador"), function() { 
     104                                        engadeMarker(map); 
     105                                }); 
     106                        } 
     107                } else { 
     108                        engadeMarker(map); 
     109                } 
    48110        }); 
    49111         
     
    58120mapEditControl.prototype.getDefaultPosition = function() { 
    59121        return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(55, 15)); 
     122} 
     123 
     124function newCircle(lat, lng, radius, color) { 
     125        var points = Array(); 
     126        with (Math) { 
     127                var d = radius/6378800; // circle radius / meters of Earth radius = radians 
     128                var lat1 = (PI/180)* lat; // radians 
     129                var lng1 = (PI/180)* lng; // radians 
     130 
     131                for (var a = 0 ; a < 361 ; a+=10 ) { 
     132                        var tc = (PI/180)*a; 
     133                        var y = asin(sin(lat1)*cos(d)+cos(lat1)*sin(d)*cos(tc)); 
     134                        var dlng = atan2(sin(tc)*sin(d)*cos(lat1),cos(d)-sin(lat1)*sin(y)); 
     135                        var x = ((lng1-dlng+PI) % (2*PI)) - PI ; // MOD function 
     136                        points.push(new GLatLng(parseFloat(y*(180/PI)),parseFloat(x*(180/PI)))); 
     137                } 
     138        } 
     139        var polygon = new GPolygon(points,color,1,1,color,0.2); 
     140        return polygon; 
     141} 
     142 
     143function newArc(lat, lng, radius, color, minangle, maxangle) { 
     144        var points = Array(); 
     145        with (Math) { 
     146                var d = radius/6378800; // circle radius / meters of Earth radius = radians 
     147                var lat1 = (PI/180)* lat; // radians 
     148                var lng1 = (PI/180)* lng; // radians 
     149                 
     150                points.push(new GLatLng(lat,lng)); 
     151                for (var a = minangle ; a < maxangle+1 ; a+=10 ) { 
     152                        var tc = (PI/180)*a; 
     153                        var y = asin(sin(lat1)*cos(d)+cos(lat1)*sin(d)*cos(tc)); 
     154                        var dlng = atan2(sin(tc)*sin(d)*cos(lat1),cos(d)-sin(lat1)*sin(y)); 
     155                        var x = ((lng1-dlng+PI) % (2*PI)) - PI ; // MOD function 
     156                        points.push(new GLatLng(parseFloat(y*(180/PI)),parseFloat(x*(180/PI)))); 
     157                } 
     158                points.push(new GLatLng(lat,lng)); 
     159        } 
     160        var polygon = new GPolygon(points,color,1,1,color,0.2); 
     161        return polygon; 
     162} 
     163function newArcPoints(lat, lng, radius, minangle, maxangle) { 
     164        var points = Array(); 
     165        with (Math) { 
     166                var d = radius/6378800; // circle radius / meters of Earth radius = radians 
     167                var lat1 = (PI/180)* lat; // radians 
     168                var lng1 = (PI/180)* lng; // radians 
     169                points.push(new GLatLng(lat,lng)); 
     170                for (var a = minangle ; a < maxangle+1 ; a+=10 ) { 
     171                        var tc = (PI/180)*a; 
     172                        var y = asin(sin(lat1)*cos(d)+cos(lat1)*sin(d)*cos(tc)); 
     173                        var dlng = atan2(sin(tc)*sin(d)*cos(lat1),cos(d)-sin(lat1)*sin(y)); 
     174                        var x = ((lng1-dlng+PI) % (2*PI)) - PI ; // MOD function 
     175                        points.push(new GLatLng(parseFloat(y*(180/PI)),parseFloat(x*(180/PI)))); 
     176                } 
     177                points.push(new GLatLng(lat,lng)); 
     178        } 
     179        return points; 
    60180} 
    61181 
     
    79199                //marcador.openInfoWindowHtml(html); 
    80200                //eval("marcador_"+id+".Gmarker.openInfoWindowHtml(html);"); 
     201                inicia_jquery(); 
    81202        }); 
    82203        return marcador; 
     
    85206        var html = editar_marcador_html(id); 
    86207        eval("marcador_"+id+".Gmarker.openInfoWindowHtml(html);"); 
     208        inicia_jquery(); 
    87209} 
    88210function showAddress(address) { 
     
    168290        map.addOverlay(polygon); 
    169291} 
     292 
     293function iniciaMapa(lat, lng, zoom) { 
     294        if (GBrowserIsCompatible()) { 
     295                map = new GMap2(document.getElementById("mapa_marcadores")); 
     296                map.setCenter(new GLatLng(lat, lng), zoom, G_SATELLITE_MAP); 
     297            map.addMapType(G_PHYSICAL_MAP); 
     298                map.addControl(new GMapTypeControl()); 
     299                map.addControl(new GSmallMapControl()); 
     300                map.addControl(new mapEditControl()); 
     301                map.addControl(new mapSoundscapeControl()); 
     302                marcadoresProyecto = new GMarkerManager(map); 
     303                polyDragControl = new MPolyDragControl({map:map,type:'circle'}); 
     304                polyDragControl2 = new MPolyDragControl({map:map,type:'quadrant'}); 
     305        } 
     306} 
     307function iniciaMiniMap(id, lat, lng, zoom) { 
     308        if (GBrowserIsCompatible()) { 
     309                miniMap = new GMap2(document.getElementById("mapa_proyecto")); 
     310                miniMap.setCenter(new GLatLng(lat, lng), zoom, G_NORMAL_MAP); 
     311                miniMap.addControl(new GSmallZoomControl()); 
     312                miniMap.enableScrollWheelZoom(); 
     313                GEvent.addListener(miniMap, "moveend", function(overlay, point){ 
     314                        var center = miniMap.getCenter(); 
     315                        var zoom = miniMap.getZoom(); 
     316                        var content = ""; 
     317                        $("#proyecto_"+ proyectoActual +" .corregir_localizacion").empty(); 
     318                        var latitud = "" + center.lat(); 
     319                        var longitud = "" + center.lng(); 
     320                        content += hidden_imput_html ("lat", proyectoActual, latitud.substring(0,8)) + " "; 
     321                        content += hidden_imput_html ("lonx", proyectoActual, longitud.substring(0,8)) + " "; 
     322                        content += hidden_imput_html ("zoom", proyectoActual, zoom); 
     323                        $("#proyecto_"+ proyectoActual +" .corregir_localizacion").append(content); 
     324                }); 
     325        } 
     326} 
     327//gmaps zoom seems no to be working! 
     328function zoomifi (map, zoom) { 
     329        actual = map.getZoom(); 
     330        dif = zoom - actual; 
     331        if (dif>=0) { 
     332                for (i=actual; i<zoom; i++) { 
     333                        map.zoomIn(); 
     334                } 
     335        } else if (dif<=0) { 
     336                for (i=dif; i<0; i++) { 
     337                        map.zoomOut(); 
     338                } 
     339        } 
     340} 
  • notours/noTours editor/inc/js/MPolyDragControl.js

    r219 r250  
     1//****************************** 
     2// MPolyDragControl 
     3// Based on http://maps.forum.nu/gm_drag_polygon.html 
     4// Copyright 2008 - Marcelo Montagna  - http://maps.forum.nu 
     5//****************************** 
     6 
    17MPolyDragControl = function(MOptions) { 
    28        MOptions = MOptions ? MOptions : {}; 
     
    612        this.unitDivisor = 2589988.11; 
    713        this.initialize() 
    8 }; 
    9  
     14        this.target = ""; 
     15        this.polygons = new Array(); 
     16 
     17}; 
    1018 
    1119MPolyDragControl.prototype.initialize = function() { 
     
    4149}; 
    4250 
    43  
    4451MPolyDragControl.prototype.addListener = function(latlon) { 
    4552        //var self = this.self; 
     
    6471        GEvent.addListener(self.dragMarker1,'dragend',function(){self.dragEnd(this)}); 
    6572 
    66         this.poly = new GPolygon([latlon,latlon,latlon,latlon,latlon],'#0000ff',1,1,'#0000ff',0.3); 
    67         this.map.addOverlay(this.poly); 
     73        this.polygons.push(new GPolygon([latlon,latlon,latlon,latlon,latlon],'#0000ff',1,1,'#0000ff',0.3)); 
     74        this.map.addOverlay(this.polygons[0]); 
    6875         
    6976        //GEvent.removeListener(this.map); 
     
    7279}; 
    7380 
    74  
    75  
    76  
    77  
    7881MPolyDragControl.prototype.dragStart = function() { 
    7982}; 
     
    8184MPolyDragControl.prototype.drag = function() { 
    8285        var self = this.self; 
    83  
    8486        if (self.type == 'circle') { 
    8587                self.updateCircle(); 
    86         } 
    87         else if (self.type == 'rectangle') { 
     88        } else if (self.type == 'rectangle') { 
    8889                self.updateRectangle(); 
     90        } else if (self.type == 'quadrant') { 
     91                self.updateQuadrant(); 
    8992        } 
    9093};       
     
    9699        } 
    97100        self.infoFormulario(); 
    98 //      GLog.write('Search parameters: ' + self.getParams()); 
    99 }; 
    100  
     101}; 
     102 
     103/* 
    101104MPolyDragControl.prototype.infoFormulario = function() { 
    102105        var point = this.dragMarker0.getLatLng(); 
     
    118121                $("#enviar_formulario").show("slow"); 
    119122        } 
     123}*/ 
     124MPolyDragControl.prototype.infoFormulario = function() { 
     125        var point = this.dragMarker0.getLatLng(); 
     126        $("#marcador_"+ this.target +" .corregir_coordenadas").empty(); 
     127        $("#marcador_"+ this.target +" .corregir_coordenadas").append(hidden_coordenadas_html(this.target, point.y, point.x, this.radius)); 
     128        $("#marcador_"+ this.target +" .contenedor_lat .valor").text(point.y); 
     129        $("#marcador_"+ this.target +" .contenedor_lat .valor").attr("class","valor editar_marcador new"); 
     130        $("#marcador_"+ this.target +" .contenedor_lonx .valor").text(point.x); 
     131        $("#marcador_"+ this.target +" .contenedor_lonx .valor").attr("class","valor editar_marcador new"); 
     132        $("#marcador_"+ this.target +" .contenedor_radio .valor").text(this.radius); 
     133        $("#marcador_"+ this.target +" .contenedor_radio .valor").attr("class","valor editar_marcador new");             
    120134} 
    121135 
     
    154168        var points = Array(p1,p2,p3,p4,p1); 
    155169 
    156         self.drawPoly(points); 
    157  
    158 }; 
    159  
     170        self.drawPoly(points, 0); 
     171 
     172}; 
    160173 
    161174MPolyDragControl.prototype.updateCircle = function() { 
     
    180193        } 
    181194 
    182         this.drawPoly(points); 
    183 }; 
    184  
    185  
    186  
    187  
    188 MPolyDragControl.prototype.drawPoly = function(points) { 
    189         if (this.poly) { 
    190                 this.map.removeOverlay(this.poly); 
    191                 this.poly = null; 
    192         } 
    193         this.poly = new GPolygon(points,'#0000ff',1,1,'#0000ff',0.2); 
    194         this.map.addOverlay(this.poly); 
     195        this.drawPoly(points, 0); 
     196}; 
     197 
     198MPolyDragControl.prototype.updateQuadrant = function() { 
     199        this.circleCenter = this.dragMarker0.getLatLng(); 
     200        var soundscape = eval('marcador_' + this.target); 
     201        var angles = soundscape.angles; 
     202        var points = Array(); 
     203        this.radius = this.dragMarker0.getLatLng().distanceFrom(this.dragMarker1.getLatLng()); // meters 
     204        var points = newArcPoints(this.circleCenter.lat(), this.circleCenter.lng(), this.radius, 0, 90); 
     205        this.drawPoly(points, 0); 
     206        var points = newArcPoints(this.circleCenter.lat(), this.circleCenter.lng(), this.radius, 90, 180); 
     207        this.drawPoly(points, 1); 
     208        var points = newArcPoints(this.circleCenter.lat(), this.circleCenter.lng(), this.radius, 180, 270); 
     209        this.drawPoly(points, 2); 
     210        var points = newArcPoints(this.circleCenter.lat(), this.circleCenter.lng(), this.radius, 270, 360); 
     211        this.drawPoly(points, 3); 
     212}; 
     213 
     214MPolyDragControl.prototype.drawPoly = function(points, i) { 
     215 
     216        if (this.polygons[i]) { 
     217                this.map.removeOverlay(this.polygons[i]); 
     218                this.polygons[i] = null; 
     219        } 
     220        this.polygons[i] = new GPolygon(points,'#0000ff',1,1,'#0000ff',0.2); 
     221        this.map.addOverlay(this.polygons[i]); 
     222         
    195223 
    196224        var html = ''; 
     
    198226                html += 'Center:&nbsp;' + this.circleCenter.lat().toFixed(5) + ',' + this.circleCenter.lng().toFixed(5) + '<br>'; 
    199227                html += 'Radius:&nbsp;' + (this.radius / 1609).toFixed(2) + '&nbsp;mi.<br>'; 
    200         } 
    201         else { 
     228        } else if (this.type == 'rectangle') { 
    202229                html += 'Lat:&nbsp;' + this.bounds.getSouthWest().lat().toFixed(5) + '&nbsp;to&nbsp;' + this.bounds.getNorthEast().lat().toFixed(5) + '<br>'; 
    203230                html += 'Lon:&nbsp;' + this.bounds.getSouthWest().lng().toFixed(5) + '&nbsp;to&nbsp;' + this.bounds.getNorthEast().lng().toFixed(5) + '<br>'; 
    204231        } 
    205         html += 'Area:&nbsp;' + (this.poly.getArea()/ this.unitDivisor).toFixed(2) + '&nbsp;sq.mi.'; 
     232        html += 'Area:&nbsp;' + (this.polygons[i].getArea()/ this.unitDivisor).toFixed(2) + '&nbsp;sq.mi.'; 
    206233 
    207234         
     
    211238} 
    212239 
    213  
    214  
    215  
    216240MPolyDragControl.prototype.clear = function() { 
    217         if (this.poly) { 
    218                 this.map.removeOverlay(this.poly); 
    219                 this.poly = null; 
     241        for(i=0; i<this.polygons.length; i++) { 
     242                this.map.removeOverlay(this.polygons[i]); 
     243                this.polygons[i] = null; 
    220244        } 
    221245        if (this.dragMarker0) { 
     
    239263                str += 'centerLat=' + this.circleCenter.lat().toFixed(5) + '&centerLon=' + this.circleCenter.lng().toFixed(5); 
    240264                str += '&radius=' + (this.radius / 1609).toFixed(2); 
    241         } 
    242         else { 
     265        } else if (this.type == 'rectangle') { 
    243266                str += 'lat1=' + this.bounds.getSouthWest().lat().toFixed(5) + '&lat2=' + this.bounds.getNorthEast().lat().toFixed(5); 
    244267                str += '&lon1=' + this.bounds.getSouthWest().lng().toFixed(5) + '&lon2=' + this.bounds.getNorthEast().lng().toFixed(5); 
  • notours/noTours editor/inc/js/notours-ajax.js

    r224 r250  
    33 
    44var proyectoActual = null; 
     5var usuario = null; 
     6 
    57var proyectos = Array(); 
    6 var desplagable = true; 
     8var desplagable = false; 
    79var first = true; 
    810var map = null; 
     
    1113var marcadoresProyecto = null; 
    1214 
    13 function contenedor_html(contexto, type, campo, id, texto_valor, texto_campo, value, clase, extra) { 
    14         var html = "";  
    15         html += '\t<div class="contenedor_'+ campo +'">\n'; 
    16         html += valor_html(contexto, campo, id, texto_valor, value, clase); 
    17         html += campo_html(contexto, type, campo, id, texto_campo, value, clase); 
    18         if (extra) { 
    19                 html += extra; 
    20         } 
    21         html += '\t</div>\n'; 
    22         return html; 
    23 } 
    24 function valor_html(contexto, campo, id, texto_valor, value, clase) { 
    25         if ((clase)&&(clase!="")) { 
    26                 extraClass = " " + clase; 
    27         } else { 
    28                 extraClass = ""; 
    29         } 
    30         var html = "";  
    31         html += '\t\t<div class="caja_valor">\n'; 
    32         if (texto_valor!='') { 
    33                 html += '\t\t\t<h4>'+ texto_valor +'</h4>\n'; 
    34         } 
    35         if ((campo=="imaxe")||(campo=="icono")) { 
    36                 html += '\t\t\t<span class="valor'+ extraClass +'" name="'+ contexto +'_'+ campo +'_'+ id +'">(editar)</span>\n'; 
    37                 if (value == "") { 
    38                         value = root+"inc/pix/photo.png" 
    39                 } 
    40                 html += '\t\t\t<img src="'+ value +'" />\n'; 
    41         } else if (campo=="son") { 
    42                 html += '\t\t\t<span class="valor'+ extraClass +'" name="'+ contexto +'_'+ campo +'_'+ id +'">(editar)</span>\n'; 
    43                 if (value == "") { 
    44                         html += '\t\t\t<img src="'+ root +'inc/pix/sound.png" />\n'; 
    45                 } else { 
    46                         html += '\t\t\t<object data="'+ root +'inc/playerwpress.swf" type="application/x-shockwave-flash" height="24" width="290">\n'; 
    47                         html += '\t\t\t\t<param value="'+ root +'inc/playerwpress.swf" name="movie">\n'; 
    48                         html += '\t\t\t\t<param value="high" name="quality">\n'; 
    49                         html += '\t\t\t\t<param value="true" name="menu">\n'; 
    50                         html += '\t\t\t\t<param value="transparent" name="wmode">\n'; 
    51                         html += '\t\t\t\t<param value="soundFile='+ value +'" name="flashvars">\n'; 
    52                         html += '\t\t\t</object>\n'; 
    53                 } 
    54         } else { 
    55                 html += '\t\t\t<span class="valor'+ extraClass +'" name="'+ contexto +'_'+ campo +'_'+ id +'">'+ value +'</span>\n'; 
    56         } 
    57         html += '\t\t</div>\n'; 
    58         return html; 
    59 } 
    60 function campo_html(contexto, type, campo, id, texto_campo, value, clase) { 
    61         if ((clase)&&(clase!="")) { 
    62                 extraClass = 'class="'+ clase +'" '; 
    63         } else { 
    64                 extraClass = ""; 
    65         } 
    66         var html = "";  
    67         html += '\t\t<div class="caja_campo agochado">\n'; 
    68         if (texto_campo!='') { 
    69                 html += '\t\t\t<label for="'+ campo +'_'+id+'">'+ texto_campo +'</label>\n'; 
    70         } 
    71         switch (type) { 
    72                 case 'input': 
    73                         html += '\t\t\t<input '+ extraClass +'name="'+ contexto +'_'+ campo +'_'+ id +'" type="text" value="'+value+'" size="35" />\n'; 
    74                         break; 
    75                 case 'textarea': 
    76                         html += '\t\t\t<textarea '+ extraClass +'name="'+ contexto +'_'+ campo +'_'+ id +'">'+value+'</textarea>\n'; 
    77                         break; 
    78                 case 'iframe': 
    79                         html += '\t\t\t<iframe '+ extraClass +'src="'+root+'inc/iframe_subir_'+ campo +'.html" id="iframe_'+ campo +'_'+ id +'" name="'+ id +'"></iframe>\n'; 
    80                         break; 
    81                 case '': 
    82                         return ''; 
    83                         break; 
    84         } 
    85         html += '\t\t</div>\n'; 
    86         return html; 
    87 } 
    88 function hidden_imput_html(campo, id, value) { 
    89         var html = ""; 
    90         html += '\t\t\t<span class="new">'+ campo +': '+ value +'<'+'/span>\n'; 
    91         html += '\t\t\t<input name="hidden_'+ campo +'" id="hidden_'+ campo +'_'+ id +'" type="hidden" value="'+ value +'" />\n'; 
    92         return html;             
    93 } 
    94 function hidden_coordenadas_html(id, lat, lonx, radius) { 
    95         var html = ""; 
    96         html += '\t\t\t<span class="new">latitud: '+ lat +'<'+'/span>\n'; 
    97         html += '\t\t\t<span class="new">longitud: '+ lonx +'<'+'/span>\n'; 
    98         html += '\t\t\t<span class="new">Radio: '+ radius +'<'+'/span>\n'; 
    99         html += '\t\t\t<input name="hidden_lat" id="hidden_lat_'+ id +'" type="hidden" value="'+ lat +'" />\n'; 
    100         html += '\t\t\t<input name="hidden_lonx" id="hidden_lonx_'+ id +'" type="hidden" value="'+ lonx +'" />\n'; 
    101         html += '\t\t\t<input name="hidden_radio" id="hidden_radio_'+ id +'" type="hidden" value="'+ radius +'" />\n'; 
    102         return html;             
    103 } 
    104 function editar_html(id){ 
    105         var html = '\t<a name="marcador_'+id+'"></a> <a class="editar_marcador" name="editar_marcador_'+id+'">Marcador</a>\n'; 
    106         return html; 
    107 } 
    108 function li_html(id, clase) { 
    109         var html = '\n';  
    110         html += '<li class="'+clase+'" id="'+clase+'_'+id+'">\n'; 
    111         html += '</li><!-- fin '+clase+'_'+id+' -->\n'; 
    112         return html; 
    113 } 
    114 function form_corregir_html(id, proyecto) { 
    115         var html = "";  
    116         html += '\t<form class="corregir_marcador" action="inc/actualizar_marcador.php" method="post" enctype="multipart/form-data">\n'; 
    117         html += '\t\t<fieldset class="enviar_formulario">\n'; 
    118         html += '\t\t\t<input name="hidden_id" type="hidden" value="'+id+'" />\n'; 
    119         html += '\t\t\t<input name="hidden_proyecto" type="hidden" value="'+proyecto+'" />\n'; 
    120         html += '\t\t\t<div class="corregir_coordenadas"></div>\n'; 
    121         html += '\t\t\t<div class="corregir_titulo"></div>\n'; 
    122         html += '\t\t\t<div class="corregir_texto"></div>\n'; 
    123         html += '\t\t\t<div class="corregir_imagen"></div>\n'; 
    124         html += '\t\t\t<div class="corregir_sonido"></div>\n'; 
    125         html += '\t\t\t<input type="submit" name="valider" value="ok" />\n'; 
    126         html += '\t\t</fieldset>\n'; 
    127         html += '\t</form>\n'; 
    128         return html; 
    129 } 
    130  
    131 function form_proyecto_html(id) { 
    132         var html = "";  
    133         html += '\t<form class="corregir_proyecto" action="inc/actualizar_proyecto.php" method="post"  name="corregir_proyecto_'+id+'" enctype="multipart/form-data">\n'; 
    134         html += '\t\t<fieldset class="enviar_formulario">\n'; 
    135         html += '\t\t\t<input type="submit" name="valider" value="ok" />\n'; 
    136         html += '\t\t\t<input name="hidden_id" type="hidden" value="'+id+'" />\n'; 
    137         html += '\t\t\t<div class="corregir_localizacion"></div>\n'; 
    138         html += '\t\t\t<div class="corregir_nombre"></div>\n'; 
    139         html += '\t\t\t<div class="corregir_descripcion"></div>\n'; 
    140         html += '\t\t\t<div class="corregir_icono"></div>\n'; 
    141         html += '\t\t</fieldset>\n'; 
    142         html += '\t</form>\n'; 
    143         return html; 
    144 } 
    145  
    146 function form_nuevo_proyecto() { 
    147         var html = "";  
    148         html += '<form class="nuevo_proyecto" action="" method="post"  name="nuevo_proyecto" id="nuevo_proyecto" enctype="multipart/form-data">\n'; 
    149         html += '<fieldset class="data">\n'; 
    150         html += '<label for="titulo_proyecto">O escribe un nombre para crear un proyecto nuevo:</label>\n'; 
    151         html += '<input name="titulo_proyecto" id="titulo_proyecto" type="text" value="" size="35" />\n'; 
    152         html += '</fieldset>\n'; 
    153         html += '</form>\n'; 
    154         return html; 
    155 } 
    156  
    157 function form_eliminar_html(id) { 
    158         var html = ""; 
    159         html += '\t<form class="eliminar_marcador" action="inc/eliminar.php" method="post" enctype="multipart/form-data">\n'; 
    160         html += '\t\t<input name="hidden_id" type="hidden" value="'+id+'" />\n'; 
    161         html += '\t\t<div class="enviar_formulario">\n'; 
    162         html += '\t\t\t<input type="submit" name="valider" value="eliminar este marcador" />\n'; 
    163         html += '\t\t</div>\n'; 
    164         html += '\t</form>\n'; 
    165         html += '\t<div id="mensage_'+id+'" class=""></div>\n'; 
    166         return html; 
    167  
    168 } 
    169  
    170 function newCircle(lat, lng, radius, color) { 
    171         var points = Array(); 
    172         with (Math) { 
    173                 var d = radius/6378800; // circle radius / meters of Earth radius = radians 
    174                 var lat1 = (PI/180)* lat; // radians 
    175                 var lng1 = (PI/180)* lng; // radians 
    176  
    177                 for (var a = 0 ; a < 361 ; a+=10 ) { 
    178                         var tc = (PI/180)*a; 
    179                         var y = asin(sin(lat1)*cos(d)+cos(lat1)*sin(d)*cos(tc)); 
    180                         var dlng = atan2(sin(tc)*sin(d)*cos(lat1),cos(d)-sin(lat1)*sin(y)); 
    181                         var x = ((lng1-dlng+PI) % (2*PI)) - PI ; // MOD function 
    182                         points.push(new GLatLng(parseFloat(y*(180/PI)),parseFloat(x*(180/PI)))); 
    183                 } 
    184         } 
    185         var polygon = new GPolygon(points,color,1,1,color,0.2); 
    186         return polygon; 
    187 } 
    188  
    189 function notours_marker() { 
    190         this.id = false; 
    191         this.title = false; 
    192         this.descripcion = false; 
    193         this.son = false; 
    194         this.img = false; 
    195         this.pubDate = false; 
    196         this.lat = false; 
    197         this.lonx = false; 
    198         this.radius = false; 
    199         this.Gmarker = false; 
    200         this.Gpolygon = false; 
    201 } 
    202                  
     15var hexadecimal = new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F") 
     16function convierteHexadecimal(num){ 
     17    var hexaDec = Math.floor(num/16) 
     18    var hexaUni = num - (hexaDec * 16) 
     19    return hexadecimal[hexaDec] + hexadecimal[hexaUni] 
     20} 
     21function degradado(color_inicio, color_fin, pasos) { 
     22 
     23        var incremento_r = parseInt((color_fin[0] - color_inicio[0])/pasos); 
     24        var incremento_g = parseInt((color_fin[0] - color_inicio[1])/pasos); 
     25        var incremento_b = parseInt((color_fin[0] - color_inicio[2])/pasos); 
     26         
     27        var r = convierteHexadecimal((color_inicio[0] + incremento_r)); 
     28        var g = convierteHexadecimal((color_inicio[1] + incremento_g)); 
     29        var b = convierteHexadecimal((color_inicio[2] + incremento_b)); 
     30         
     31        var color = "#" + r + "" + g + "" + b; 
     32        return color; 
     33} 
     34function oscurece(inicial, objetivo, id) { 
     35        var marcador = eval('marcador_' + id); 
     36        alpha = inicial + 0.02; 
     37        if (alpha<objetivo) { 
     38                setTimeout("oscurece("+alpha+", "+objetivo+", "+id+")",100); 
     39                marcador.Gpolygon.setFillStyle({opacity:alpha}); 
     40        } 
     41} 
     42function aclara(inicial, objetivo, id) { 
     43        var marcador = eval('marcador_' + id); 
     44        alpha = inicial - 0.02; 
     45        if (alpha>objetivo) { 
     46                setTimeout("aclara("+alpha+", "+objetivo+", "+id+")",100); 
     47                marcador.Gpolygon.setFillStyle({opacity:alpha}); 
     48        } 
     49} 
     50 
     51function setCookie(c_name,value,expiredays) { 
     52        var exdate=new Date(); 
     53        exdate.setDate(exdate.getDate()+expiredays); 
     54        document.cookie=c_name+ "=" +escape(value)+ 
     55        ((expiredays==null) ? "" : ";expires="+exdate.toGMTString()); 
     56} 
     57function getCookie(c_name) { 
     58        if (document.cookie.length>0) { 
     59                c_start = document.cookie.indexOf(c_name + "="); 
     60                if (c_start!=-1) { 
     61                c_start=c_start + c_name.length+1; 
     62                        c_end=document.cookie.indexOf(";",c_start); 
     63                if (c_end==-1) { 
     64                        c_end=document.cookie.length; 
     65                } 
     66                return unescape(document.cookie.substring(c_start,c_end)); 
     67                } 
     68                return ""; 
     69        } 
     70} 
     71function checkCookie() { 
     72        usuario = getCookie('userid'); 
     73        var nombre = getCookie('username'); 
     74        if (usuario!=null && usuario!="") { 
     75                $("#proyectos").prepend('<div class="pestanha"><span>benvido ' + nombre + '!</span></div>'); 
     76                leerRssProyectos(usuario); 
     77                setCookie('userid',usuario,7); 
     78                setCookie('username',nombre,7); 
     79        } else { 
     80                login(); 
     81        } 
     82} 
     83 
    20384function agregarMarcador(item, proyecto) { 
    20485        //almacenamos en distintas variables la informacion contenida nen los chilNodes de cada item-marcador do xml 
     
    20889                switch  (tag) { 
    20990                        case 'guid': 
    210                                 var xmlId = itemtags[j].firstChild.data; 
     91                                if(itemtags[j].firstChild != null){ 
     92                                        var xmlId = itemtags[j].firstChild.data; 
     93                                } else { 
     94                                        var xmlId = ""; 
     95                                } 
    21196                                break; 
    21297                        case 'title': 
    213                                 var xmlTitle = itemtags[j].firstChild.data; 
     98                                if(itemtags[j].firstChild != null){ 
     99                                        var xmlTitle = itemtags[j].firstChild.data; 
     100                                } else { 
     101                                        var xmlTitle = ""; 
     102                                } 
    214103                                break; 
    215104                        case 'description': 
    216                                 var xmlDesc = itemtags[j].firstChild.data; 
     105                                if(itemtags[j].firstChild != null){ 
     106                                        var xmlDesc = itemtags[j].firstChild.data; 
     107                                } else { 
     108                                        var xmlDesc = ""; 
     109                                } 
    217110                                break; 
    218111                        case 'pubdate': 
    219                                 var xmlDate = itemtags[j].firstChild.data; 
     112                                if(itemtags[j].firstChild != null){ 
     113                                        var xmlDate = itemtags[j].firstChild.data; 
     114                                } else { 
     115                                        var xmlDate = ""; 
     116                                } 
    220117                                break; 
    221118                        case 'georss:circle': 
    222                                 var xmlGeo = itemtags[j].firstChild.data.split(" "); 
     119                                if(itemtags[j].firstChild != null){ 
     120                                        var xmlGeo = itemtags[j].firstChild.data.split(" "); 
     121                                } else { 
     122                                        var xmlGeo = new Array(); 
     123                                } 
    223124                                break; 
    224125                        case 'enclosure': 
     
    233134        } 
    234135        // creamos el marcador con los datos almacenados en las variables 
    235         return notours_marker_data(xmlId, proyecto, xmlTitle, xmlDesc, xmlSon, xmlIMG, xmlDate, xmlGeo); 
    236 } 
    237  
    238 function notours_marker_data(id, proyecto, title, descripcion, son, img, pubDate, geo) { 
    239         eval('marcador_' + id + ' = new notours_marker();'); 
    240         var marcador = eval('marcador_' + id); 
    241          
    242         marcador.id = id; 
    243         marcador.title = title; 
    244         marcador.descripcion = descripcion; 
    245          
    246         if (son) marcador.son = son; 
    247         if (img) marcador.img = img; 
    248          
    249         marcador.pubDate = pubDate; 
    250          
    251         if ((geo[0].length == 0) || (geo[1].length == 0)) { 
    252                 marcador.lat = 0; 
    253                 marcador.lonx = 0; 
    254                 marcador.radius = 0; 
    255         } else { 
    256                 marcador.lat = parseFloat(geo[0]); 
    257                 marcador.lonx = parseFloat(geo[1]); 
    258                 if (geo[2].length == 0) { 
    259                         marcador.radius = 50; 
    260                 } else { 
    261                         marcador.radius = parseFloat(geo[2]); 
    262                 } 
    263                  
    264                 // creamos el marcador con los datos almacenados en las variables 
    265                 var html = editar_marcador_html(marcador.id, proyecto); 
    266                 marcador.Gmarker = newMarker(marcador.lat, marcador.lonx, marcador.id, marcador.son); 
    267                 //marcadoresProyecto.addMarker(marcador.Gmarker,0,17); 
    268                 map.addOverlay(marcador.Gmarker); 
    269                  
    270                 // creamos o poligono que rodea o marcador 
    271                 marcador.Gpolygon = newCircle(marcador.lat, marcador.lonx, marcador.radius, '#ff00cc'); 
    272                 map.addOverlay(marcador.Gpolygon); 
    273         } 
    274         return marcador.id; 
    275 } 
    276  
    277 function editar_marcador_html(id, proyecto) { 
    278         var lat = eval('marcador_'+ id +'.lat'); 
    279         var lonx = eval('marcador_'+ id +'.lonx'); 
    280         var radio = eval('marcador_'+ id +'.radius'); 
    281         var son = eval('marcador_'+ id +'.son'); 
    282         var img = eval('marcador_'+ id +'.img'); 
    283         var titulo = eval('marcador_'+ id +'.title'); 
    284         var descripcion = eval('marcador_'+ id +'.descripcion'); 
    285         var html = ""; 
    286         html += editar_html(id); 
    287         html += contenedor_html("marcador", "", "lat", id, "latitude:", "", lat, "editar_coordenadas"); 
    288         html += contenedor_html("marcador", "", "lonx", id, "lonxitude:", "", lonx, "editar_coordenadas"); 
    289         html += contenedor_html("marcador", "", "radio", id, "radio:", "", radio, "editar_coordenadas"); 
    290         html += contenedor_html("marcador", "iframe", "imaxe", id, "Imaxe:", "Sube unha nova imaxe:", img, ""); 
    291         html += contenedor_html("marcador", "iframe", "son", id, "Son:", "Sube unha nova gravaci&oacute;n:", son, ""); 
    292         html += contenedor_html("marcador", "input", "titulo", id, "T&iacute;tulo:", "&iquest;C&oacute;mo queres que se chame o teu artigo?:", titulo, ""); 
    293         html += contenedor_html("marcador", "textarea", "texto", id, "Descripci&oacute;n da grabaci&oacute;n:", "Escribe unha pequena descripci&oacute;n da gravaci&oacute;n:", descripcion, ""); 
    294         html += form_corregir_html(id, proyecto); 
    295         html += form_eliminar_html(id); 
    296         return html; 
    297 } 
    298  
    299 function notours_project() { 
    300         this.id = false; 
    301         this.numero = false; 
    302         this.nombre = false; 
    303         this.descripcion = false; 
    304         this.icono = false; 
    305         this.type = false; 
    306         this.pubDate = false; 
    307         this.lat = false; 
    308         this.lonx = false; 
    309         this.zoom = false 
    310 } 
    311  
    312 function editar_proyecto_html(id, nom) { 
    313         var nombre; 
    314         var numero; 
    315         var descripcion; 
    316         var icono; 
    317         var pubDate; 
    318         var lat; 
    319         var lonx; 
    320         var zoom; 
    321         if (id==0) { 
    322                 nombre = nom; 
    323                 numero = proyectos.length; 
    324                 descripcion = ""; 
    325                 icono = root +'inc/logo_notours_screen.png'; 
    326                 lat = 43.331; 
    327                 lonx = -2.97298; 
    328                 zoom = 16; 
    329         } else { 
    330                 nombre = eval('proyecto_'+id+'.nombre'); 
    331                 //numero = eval('proyecto_'+id+'.numero'); 
    332                 descripcion = eval('proyecto_'+id+'.descripcion'); 
    333                 icono = eval('proyecto_'+id+'.icono'); 
    334                 pubDate = eval('proyecto_'+id+'.pubDate'); 
    335                 lat = eval('proyecto_'+id+'.lat'); 
    336                 lonx = eval('proyecto_'+id+'.lonx'); 
    337                 zoom = eval('proyecto_'+id+'.zoom'); 
    338         } 
    339         $("#proyectos").append('\n<div id="proyecto_'+ id +'">\n</div><!-- fin proyecto_'+ id +' -->\n'); 
    340         $("#proyecto_"+ id).append(contenedor_html("proyecto", 'input', 'nombre', id, '', 'nome do proxecto:', nombre, "", '\t\t<span class="toogle"><img src="'+ root +'inc/pix/desplegar.gif" alt="desplegar" /></span> <span class="next"><img src="'+root+'inc/pix/adelante.gif" alt="siguiente" /></span> <span class="back"><img src="'+ root +'inc/pix/atras.gif" alt="anterior" /></span> <span class="novo"><img src="'+ root +'inc/pix/nuevo.gif" alt="nuevo" /></span>\n')); 
    341         $("#proyecto_"+ id).append('\t<div class="contenedor">\n\t</div><!-- fin .contenedor -->\n'); 
    342         $("#proyecto_"+ id +" .contenedor").append(contenedor_html("proyecto", 'iframe', 'icono', id, '', '', icono, "")); 
    343         $("#proyecto_"+ id +" .contenedor").append('<div class="mapa" id="mapa_proyecto_'+ id +'"></div>\n'); 
    344         $("#proyecto_"+ id +" .contenedor").append(contenedor_html("proyecto", 'textarea', 'descripcion', id, '', 'Escribe unha pequena descripci&oacute;n do proxecto:', descripcion, "")); 
    345         $("#proyecto_"+ id +" .contenedor").append(form_proyecto_html (id)); 
    346         $("#proyecto_"+ id +" .contenedor").append('<a href="inc/actualizar_rss.php?proyecto='+ id +'">actualizar rss</a> <a href="'+ root + projectFolder + id +'.zip">descargar</a>\n'); 
    347         if (GBrowserIsCompatible()) { 
    348                 miniMap = new GMap2(document.getElementById("mapa_proyecto_"+ id)); 
    349                 miniMap.setCenter(new GLatLng(lat, lonx), zoom, G_NORMAL_MAP); 
    350                 miniMap.addControl(new GSmallZoomControl()); 
    351                 GEvent.addListener(miniMap, "moveend", function(overlay, point){ 
    352                         var center = miniMap.getCenter(); 
    353                         var zoom = miniMap.getZoom(); 
    354                         var content = ""; 
    355                         $("#proyecto_"+ id +" .corregir_localizacion").empty(); 
    356                         content += hidden_imput_html ("lat", id, center.lat()) + " "; 
    357                         content += hidden_imput_html ("lonx", id, center.lng()) + " "; 
    358                         content += hidden_imput_html ("zoom", id, zoom); 
    359                         $("#proyecto_"+ id +" .corregir_localizacion").append(content); 
    360                 }); 
    361         } 
    362         if (descripcion==""){ 
    363                 $("#proyecto_"+ id +" .contenedor_descripcion .caja_valor").hide(); 
    364                 $("#proyecto_"+ id +" .contenedor_descripcion .caja_campo").show("slow"); 
    365         } 
    366         if (nombre==""){ 
    367                 $("#proyecto_"+ id +" .contenedor_nombre .caja_valor").hide(); 
    368                 $("#proyecto_"+ id +" .contenedor_nombre .caja_campo").show("slow"); 
    369         } 
     136        eval('marcador_' + xmlId + ' = new NotoursSoundpoint();'); 
     137        var marcador = eval('marcador_' + xmlId); 
     138        marcador.initialize(xmlId, proyecto, xmlTitle, xmlDesc, xmlSon, xmlIMG, xmlDate, xmlGeo); 
     139        return xmlId; 
    370140} 
    371141 
     
    414184                } 
    415185        } 
     186        // creamos el proyecto con los datos almacenados en las variables 
     187        //return notours_project_data(xmlId, xmlTitle, xmlDesc, xmlIMG, xmlType, xmlDate, xmlGeo); 
     188         
    416189        // creamos el marcador con los datos almacenados en las variables 
    417         eval('proyecto_' + xmlId + ' = new notours_project();'); 
     190        eval('proyecto_' + xmlId + ' = new NotoursProject();'); 
    418191        var proyecto = eval('proyecto_' + xmlId); 
    419         proyecto.id = xmlId; 
    420         proyecto.nombre = xmlTitle; 
    421         proyecto.descripcion = xmlDesc; 
    422         if (xmlIMG) { 
    423                 proyecto.icono = xmlIMG; 
    424                 proyecto.type = xmlType.substr(6); 
    425         } 
    426         proyecto.pubDate = xmlDate; 
    427         if ((xmlGeo[0].length == 0) || (xmlGeo[1].length == 0)) { 
    428                 proyecto.lat = 0; 
    429                 proyecto.lonx = 0; 
    430                 proyecto.zoom = 16; 
    431         } else { 
    432                 proyecto.lat = parseFloat(xmlGeo[0]); 
    433                 proyecto.lonx = parseFloat(xmlGeo[1]); 
    434                 proyecto.zoom = 16; 
    435         } 
    436         return proyecto.id; 
    437 } 
    438  
    439 function proyecto_html (id) { 
    440  
    441         var nombre = eval('proyecto_'+id+'.nombre'); 
    442         var descripcion = eval('proyecto_'+id+'.descripcion'); 
    443         var img = eval('proyecto_'+id+'.img'); 
    444         var lat = eval('proyecto_'+id+'.lat'); 
    445         var lonx = eval('proyecto_'+id+'.lonx'); 
    446         var zoom = eval('proyecto_'+id+'.zoom'); 
     192        proyecto.initialize(xmlId, xmlTitle, xmlDesc, xmlIMG, xmlType, xmlDate, xmlGeo); 
     193        return xmlId; 
    447194         
    448         $("ul").append(li_html(id,"proyecto")); 
    449         var html = '<input class="radio" type="radio" name="project" id="project_"'+id+'" value="'+id+'" /> <label for="project_'+id+'">'+nombre+'</label><input name="hidden_lat" id="hidden_lat_'+id+'" type="hidden" value="'+lat+'" /><input name="hidden_lonx" id="hidden_lonx_'+id+'" type="hidden" value="'+lonx+'" /><input name="hidden_zoom" id="hidden_zoom_'+id+'" type="hidden" value="'+zoom+'" />'; 
    450         $("#proyecto_"+id).append(html); 
    451  
    452195} 
    453196 
    454197function leerRss(proyecto) { 
    455198        var url = root + "marcadores.php?id="+proyecto; 
     199        $("#terminal").append(url+ '<br><br>'); 
    456200        //leemos el rss que contiene los marcadores 
    457201        jQuery.get(url, function(xml_marcadores){ 
     
    459203                // cada elemento item vamos a agregar un marcador en el mapa 
    460204                jQuery("item", xml_marcadores).each(function(i, item_marcadores){ 
     205                        $("#terminal").append('marcador: ' + i + '<br />'); 
    461206                        var id_marcador = agregarMarcador (item_marcadores, proyecto); 
    462207                        $("ul").append(li_html(id_marcador,"marcador")); 
    463208                        $("#marcador_"+ id_marcador).append(editar_marcador_html(id_marcador, proyecto)); 
     209                        $("#marcador_"+ id_marcador + " .eliminar_marcador").toggle(); 
     210                        $("#marcador_"+ id_marcador + " .corregir_marcador").toggle(); 
     211                        $("#marcador_"+ id_marcador + " .contenedor_imaxe").toggle(); 
     212                        $("#marcador_"+ id_marcador + " .contenedor_son").toggle(); 
     213                        $("#marcador_"+ id_marcador + " .contenedor_texto").toggle(); 
     214                        $("#marcador_"+ id_marcador + " .contenedor_radio").toggle(); 
     215                        $("#marcador_"+ id_marcador + " .contenedor_lonx").toggle(); 
     216                        $("#marcador_"+ id_marcador + " .contenedor_lat").toggle(); 
    464217                }); 
     218                $("#terminal").append('<br />'); 
    465219                inicia_jquery(); 
    466220        }); 
     
    486240} 
    487241 
    488 function leerRssProyectos() { 
    489         var url = root + "proyectos.php"; 
     242function login() { 
     243        $("#marcadores ul").append(form_pass_html()); 
     244        $("#marcadores ul").append(form_new_html()); 
     245        $("#password").submit(function() { 
     246                var nombre = $("#user").attr("value"); 
     247                var password = $("#pass").attr("value"); 
     248                if ((nombre!="")&&(password!="")) { 
     249                        var values = $(this).serialize(); 
     250                        var url = root + "inc/pass.php"; 
     251                        jQuery.post( url, values, function(data){ 
     252                                if (typeof data.msg == "undefined") { 
     253                                        $("#marcadores ul").empty(); 
     254                                        $("#proyectos").prepend('<div class="pestanha"><span>benvido ' + data.nombre + '!</span></div>'); 
     255                                        usuario = data.id; 
     256                                        leerRssProyectos(usuario); 
     257                                        setCookie('userid',usuario,7); 
     258                                        setCookie('username',data.nombre,7); 
     259                                } else { 
     260                                        alert(data.msg); 
     261                                } 
     262                        }, "json" ); 
     263                } 
     264                return false; 
     265    }); 
     266    $("#crearAutor").submit(function() { 
     267                var nombre = $("#newuser").attr("value"); 
     268                var password = $("#newpass").attr("value"); 
     269                var check = $("#twice").attr("value"); 
     270                if ((nombre != "")&&(password != "")&&(check != "")) { 
     271                        if (password!=check) { 
     272                                alert("las dos claves no coinciden"); 
     273                        } else { 
     274                                var values = $(this).serialize(); 
     275                                var url = root + "inc/new.php"; 
     276                                jQuery.post( url, values, function(data){ 
     277                                        if (typeof data.msg == "undefined") { 
     278                                                $("#marcadores ul").empty(); 
     279                                                $("#proyectos").prepend('<div class="pestanha"><span>benvido ' + data.nombre + '!</span></div>'); 
     280                                                usuario = data.id; 
     281                                                leerRssProyectos(usuario); 
     282                                                setCookie('userid',usuario,30); 
     283                                                setCookie('username',data.nombre,7); 
     284                                        } else { 
     285                                                alert(data.msg); 
     286                                        } 
     287                                }, "json" ); 
     288                         
     289                        } 
     290                } 
     291                return false; 
     292    }); 
     293     
     294} 
     295 
     296function leerRssProyectos(autor) { 
     297        if (typeof autor == "undefined") { 
     298                var url = root + "proyectos.php"; 
     299        } else { 
     300                var url = root + "proyectos.php?id_autor="+autor; 
     301        } 
     302        $("#terminal").append(url+ '<br><br>'); 
    490303        //leemos el rss que contiene los proyectos 
    491304        jQuery.get(url, function(xml_proyectos){ 
     
    496309                        var num_proyecto = proyectos.push(id_proyecto)-1; 
    497310                        eval('proyecto_'+id_proyecto+'.numero='+num_proyecto); 
    498                         proyecto_html (id_proyecto, num_proyecto); 
     311                        proyecto_html (id_proyecto); 
    499312                }); 
    500313                $("ul").after(form_nuevo_proyecto()); 
    501                 inicia_jquery_1(); 
    502         }); 
    503 } 
    504  
     314                inicia_jquery_selector_proyectos(); 
     315        }); 
     316} 
     317function cargarProyectos() { 
     318        for (i=0;i<proyectos.length;i++) { 
     319                proyecto_html (proyectos[i]); 
     320        } 
     321        $("ul").after(form_nuevo_proyecto()); 
     322        inicia_jquery_selector_proyectos(); 
     323} 
     324function enviarMarcador(formulario, callBack){ 
     325        var values = $(formulario).serialize(); 
     326        var id = $(formulario.hidden_id).attr("value"); 
     327        var url = root + "inc/actualizar_marcador.php"; 
     328        $("#terminal").append('Se va a modificar un marcador:' + '<br />'); 
     329        $("#terminal").append(url +'?'+ values +'<br /><br />'); 
     330        jQuery.post( url, values, function(data){ 
     331                 
     332                // cuando la cadena de datos contiene un mensage se ha producido un error 
     333                if (typeof data.msg!="undefined") { 
     334                        $("#terminal").append(data.msg + '<br /><br />'); 
     335                                 
     336                // si la variable marcador_id no existe se trata de un nuevo marcador 
     337                } else if (eval('typeof marcador_' + data.id)=="undefined") { 
     338                        var campos = new Array("title", "description", "son", "imaxe", "modified", "project_id"); 
     339                        var values = new Array("", "", "", "", "", ""); 
     340                        for(i=0; i<campos.length; i++) { 
     341                                if(eval("typeof data."+campos[i]) != "undefined") { 
     342                                        values[i] = eval("data."+campos[i]); 
     343                                        $("#terminal").append(campos[i] +" = '"+ values[i] +"';" + '<br />'); 
     344                                } 
     345                        } 
     346                        var geo = data.geodata.split(" "); 
     347                        $("#terminal").append("geodata = '"+ data.geodata +"';" + '<br />'); 
     348                         
     349                        eval('marcador_' + data.id + ' = new NotoursSoundpoint();'); 
     350                        var marcador = eval('marcador_' + data.id); 
     351                        marcador.initialize(data.id, values[5], values[0], values[1], values[2], values[3], values[4], geo); 
     352                         
     353                        $("#marcador_0").remove(); 
     354                        map.removeOverlay(marcador_0.Gmarker); 
     355                        map.removeOverlay(marcador_0.Gpolygon); 
     356                        $("ul").prepend(li_html(data.id,"marcador")); 
     357                        $("#marcador_"+ data.id).append(editar_marcador_html(data.id, values[0])); 
     358                        inicia_jquery(); 
     359                                         
     360                // por el contario si existe acabamos de modificar un marcador existente 
     361                } else { 
     362                        var marcador = eval('marcador_' + id); 
     363                        if (typeof data.son != "undefined") { 
     364                                marcador.son = data.son; 
     365                                $("#marcador_"+ data.id +" .contenedor_son .caja_valor object").remove(); 
     366                                $("#marcador_"+ data.id +" .contenedor_son .caja_valor").append(sound_html(data.son,"")); 
     367                                $("#marcador_"+ data.id +" .corregir_sonido").empty(); 
     368                                $("#terminal").append("Sonido = '"+ data.son +"';" + '<br />'); 
     369                        } 
     370                        if (typeof data.imaxe != "undefined") { 
     371                                marcador.img = data.imaxe; 
     372                                $("#marcador_"+ data.id +" .contenedor_imaxe .caja_valor img").fadeTo("fast", 1); 
     373                                $("#marcador_"+ data.id +" .corregir_imagen").empty(); 
     374                                $("#terminal").append("Imaxe = '"+ data.imaxe +"';" + '<br />'); 
     375                        } 
     376                        if (typeof data.title != "undefined") { 
     377                                $("#marcador_"+ data.id +" .contenedor_titulo .valor").attr("class","valor"); 
     378                                marcador.title = data.title; 
     379                                $("#marcador_"+ data.id +" .corregir_titulo").empty(); 
     380                                $("#terminal").append("T&iacute;tulo = '"+ data.title +"';" + '<br />'); 
     381                        } 
     382                        if (typeof data.description != "undefined") { 
     383                                $("#marcador_"+ data.id +" .contenedor_texto .valor").attr("class","valor"); 
     384                                marcador.description = data.description; 
     385                                $("#marcador_"+ data.id +" .corregir_texto").empty(); 
     386                                $("#terminal").append("Descripci&oacute;n = '"+ data.description +"';" + '<br />'); 
     387                        } 
     388                        if (typeof data.geodata != "undefined") { 
     389                                var jsonGeo = data.geodata.split(" "); 
     390                                marcador.lat = jsonGeo[0]; 
     391                                marcador.lonx = jsonGeo[1]; 
     392                                marcador.radius = jsonGeo[2]; 
     393                                marcador.Gmarker.setLatLng(new GLatLng(jsonGeo[0], jsonGeo[1])); 
     394                                map.removeOverlay(marcador.Gpolygon); 
     395                                marcador.Gpolygon = newCircle(jsonGeo[0], jsonGeo[1], jsonGeo[2], '#ff00cc'); 
     396                                map.addOverlay(marcador.Gpolygon); 
     397                                $("#marcador_"+ data.id +" .corregir_coordenadas").empty(); 
     398                                $("#marcador_"+ data.id +" .contenedor_lat .valor").attr("class","valor editar_marcador"); 
     399                                $("#marcador_"+ data.id +" .contenedor_lonx .valor").attr("class","valor editar_marcador"); 
     400                                $("#marcador_"+ data.id +" .contenedor_radio .valor").attr("class","valor editar_marcador"); 
     401                                $("#terminal").append("GeoData = '"+ data.geodata +"';" + '<br />'); 
     402                        } 
     403                } 
     404                //alert("aqui"); 
     405                first = true; 
     406                polyDragControl.clear(); 
     407                 
     408                if (callBack) { 
     409                        callBack(); 
     410                } 
     411        }, "json" ); 
     412} 
     413function enviarProyecto(formulario, callBack){ 
     414        var values = $(formulario).serialize(); 
     415        var id = $(formulario.hidden_id).attr("value"); 
     416        var url = root + "inc/actualizar_proyecto.php"; 
     417        $("#terminal").append("Sendding data to create new proyect...<br>"); 
     418        $("#terminal").append(url +'?'+ values +'<br /><br />'); 
     419        jQuery.post( url, values, function(data){ 
     420                 
     421                // cuando la cadena de datos contiene un mensage se ha producido un error 
     422                if (typeof data.msg!="undefined") { 
     423                        $("#terminal").append(data.msg + '<br /><br />'); 
     424                         
     425                // si la variable marcador_id no existe se trata de un nuevo marcador 
     426                } else if (eval('typeof proyecto_' + data.id)=="undefined") { 
     427                        var campos = new Array("name", "description", "modified", "icon", "type"); 
     428                                var values = new Array("", "", "", "", ""); 
     429                        for(i=0; i<campos.length; i++) { 
     430                                if(eval("typeof data."+campos[i]) != "undefined") { 
     431                                        values[i] = eval("data."+campos[i]); 
     432                                        $("#terminal").append(campos[i] +" = '"+ values[i] +"';" + '<br />'); 
     433                                } 
     434                        } 
     435                        if ((typeof data.latitude == "undefined")||(typeof data.longitude == "undefined")||(typeof data.zoom == "undefined")) { 
     436                                geo = ""; 
     437                        } else { 
     438                                geo = Array(data.latitude, data.longitude, data.zoom); 
     439                                $("#terminal").append("geodata = '"+ data.latitude +" "+ data.longitude +" "+ data.zoom +"';" + '<br />'); 
     440                        } 
     441                        eval('proyecto_' + data.id + ' = new NotoursProject();'); 
     442                        var proyecto = eval('proyecto_' + data.id); 
     443                        proyecto.initialize(data.id, values[0], values[1], values[3], values[4], values[2], geo); 
     444                        var num_proyecto = proyectos.push(data.id)-1; 
     445                        eval('proyecto_'+data.id+'.numero = '+num_proyecto); 
     446                        proyectoActual = data.id; 
     447                        editar_proyecto_html(data.id); 
     448                        inicia_jquery_botones_proyecto(); 
     449                        alert("Acaba de crear un nuevo proyecto"); 
     450                                 
     451                // por el contario si existe acabamos de modificar un marcador existente 
     452                } else { 
     453                        var proyecto = eval('proyecto_' + data.id); 
     454                        if (typeof data.name != "undefined") { 
     455                                $("#proyecto_"+ data.id +" .contenedor_nombre .valor").attr("class","valor"); 
     456                                proyecto.name = data.name; 
     457                                $("#proyecto_"+ data.id +" .corregir_nombre").empty(); 
     458                        } 
     459                        if (typeof data.descripcion != "undefined") { 
     460                                $("#proyecto_"+ data.id +" .contenedor_descripcion .valor").attr("class","valor"); 
     461                                proyecto.description = data.description; 
     462                                $("#proyecto_"+ data.id +" .corregir_descripcion").empty(); 
     463                        } 
     464                        if ((typeof data.latitude != "undefined")&&(typeof data.longitude != "undefined")&&(typeof data.zoom != "undefined")) { 
     465                                proyecto.lat = data.latitude; 
     466                                proyecto.lonx = data.longitude; 
     467                                proyecto.zoom = data.zoom; 
     468                                map.setCenter(new GLatLng(data.latitude, data.longitude), data.zoom, G_HYBRID_MAP); 
     469                                zoomifi(map, data.zoom); 
     470                                $("#proyecto_"+ data.id +" .corregir_localizacion").empty(); 
     471                        } 
     472                        if (typeof data.icon != "undefined") { 
     473                                proyecto.icon = data.icon; 
     474                                $("#proyecto_"+ data.id +" .corregir_icono").empty(); 
     475                        } 
     476                } 
     477                if (callBack) { 
     478                        callBack(); 
     479                } 
     480        }, "json" ); 
     481} 
    505482function inicia_jquery() { 
     483        $(".mark").click( function(){ 
     484                var id = $(this.parentNode).attr("id"); 
     485                $("#" + id + " .eliminar_marcador").toggle(); 
     486                $("#" + id + " .corregir_marcador").toggle(); 
     487                $("#" + id + " .contenedor_imaxe").toggle(); 
     488                $("#" + id + " .contenedor_son").toggle(); 
     489                $("#" + id + " .contenedor_texto").toggle(); 
     490                $("#" + id + " .contenedor_radio").toggle(); 
     491                $("#" + id + " .contenedor_lonx").toggle(); 
     492                $("#" + id + " .contenedor_lat").toggle(); 
     493        }); 
     494        $(".marcador").mouseover( function(){ 
     495                var data = $(this).attr("id").split("_"); 
     496                var marcador = eval('marcador_' + data[1]); 
     497                marcador.rollover(); 
     498                //marcador.Gpolygon.setFillStyle({color:'#bdd1e2'}); 
     499                //marcador.Gpolygon.setFillStyle({opacity:0.4});  
     500                //oscurece(0.2, 0.8, data[1]); 
     501        }); 
     502        $(".marcador").mouseout( function(){ 
     503                var data = $(this).attr("id").split("_"); 
     504                var marcador = eval('marcador_' + data[1]); 
     505                marcador.rollout(); 
     506                //marcador.Gpolygon.setFillStyle({color:'#ff00cc'}); 
     507                //marcador.Gpolygon.setFillStyle({opacity:0.2});  
     508                //aclara(0.8, 0.2, data[1]); 
     509        }); 
    506510        $(".valor").dblclick( function(){ 
    507511                var data = $(this).attr("name").split("_"); 
     
    521525        $(".editar_coordenadas").dblclick( function(){ 
    522526                var data = $(this).attr("name").split("_"); 
    523                 var id = data[1]; 
     527                var id = data[2]; 
    524528                var marcador = eval('marcador_' + id); 
    525529                var center = new GLatLng(marcador.lat, marcador.lonx); 
    526530                polyDragControl.target = id; 
    527531                if (!first) { 
    528                         polyDragControl.map.removeOverlay(polyDragControl.dragMarker0); 
    529                         polyDragControl.map.removeOverlay(polyDragControl.dragMarker1); 
    530                         polyDragControl.map.removeOverlay(polyDragControl.poly); 
     532                        polyDragControl.clear(); 
    531533                } 
    532534                polyDragControl.mapClick(center); 
     
    545547        }); 
    546548        $("form.corregir_marcador").submit(function() { 
    547                 var values = $(this).serialize(); 
    548                 var id = $(this.hidden_id).attr("value"); 
    549549                if (confirm(String.fromCharCode(191) +"Est"+ String.fromCharCode(225) +" seguro que desea modificar este marcador?")) { 
    550                         var url = root + "inc/actualizar_marcador.php"; 
    551                         jQuery.post( url, values, function(data){ 
    552                                 if (eval('typeof marcador_' + data.id)=="undefined") { 
    553                                         if (typeof data.title == "undefined") { 
    554                                                 title = ""; 
    555                                         } else { 
    556                                                 title = data.title; 
    557                                         } 
    558                                         if (typeof data.description=="undefined") { 
    559                                                 description = ""; 
    560                                         } else { 
    561                                                 description = data.description; 
    562                                         } 
    563                                         if (typeof data.pubDate=="undefined") { 
    564                                                 pubDate = ""; 
    565                                         } else { 
    566                                                 pubDate = data.pubDate; 
    567                                         } 
    568                                         if (typeof data.project=="undefined") { 
    569                                                 proyecto = ""; 
    570                                         } else { 
    571                                                 proyecto = data.project; 
    572                                         } 
    573                                         var geo = data.data.split(" "); 
    574                                         notours_marker_data(data.id, proyecto, title, description, "", "", pubDate, geo); 
    575                                         $("#marcador_0").remove(); 
    576                                         //marcador_0.Gmarker.setLatLng(new GLatLng(0,0)); 
    577                                         map.removeOverlay(marcador_0.Gmarker); 
    578                                         map.removeOverlay(marcador_0.Gpolygon); 
    579                                         $("ul").prepend(li_html(data.id,"marcador")); 
    580                                         $("#marcador_"+ data.id).append(editar_marcador_html(data.id, proyecto)); 
    581                                         inicia_jquery(); 
    582                                 } else { 
    583                                         var marcador = eval('marcador_' + id); 
    584                                         if (typeof data.son != "undefined") { 
    585                                                 marcador.son = data.son; 
    586                                                 $("#marcador_"+ data.id +" .contenedor_son .caja_valor object").fadeTo("fast", 1); 
    587                                                 $("#marcador_"+ data.id +" .corregir_sonido").empty(); 
    588                                         } 
    589                                         if (typeof data.imaxe != "undefined") { 
    590                                                 marcador.img = data.imaxe; 
    591                                                 $("#marcador_"+ data.id +" .contenedor_imaxe .caja_valor img").fadeTo("fast", 1); 
    592                                                 $("#marcador_"+ data.id +" .corregir_imagen").empty(); 
    593                                         } 
    594                                          
    595                                         if (typeof data.title != "undefined") { 
    596                                                 $("#marcador_"+ data.id +" .contenedor_titulo .valor").attr("class","valor"); 
    597                                                 marcador.title = data.title; 
    598                                                 //eval('marcador_' + data.id + ".title = data.title"); 
    599                                                 $("#marcador_"+ data.id +" .corregir_titulo").empty(); 
    600                                         } 
    601                                         if (typeof data.description != "undefined") { 
    602                                                 $("#marcador_"+ data.id +" .contenedor_texto .valor").attr("class","valor"); 
    603                                                 marcador.description = data.description; 
    604                                                 //eval('marcador_' + data.id + ".description = data.description"); 
    605                                                 $("#marcador_"+ data.id +" .corregir_texto").empty(); 
    606                                         } 
    607                                         if (typeof data.data != "undefined") { 
    608                                                 var jsonGeo = data.data.split(" "); 
    609                                                 marcador.lat = jsonGeo[0]; 
    610                                                 marcador.lonx = jsonGeo[1]; 
    611                                                 marcador.radius = jsonGeo[2]; 
    612                                                 marcador.Gmarker.setLatLng(new GLatLng(jsonGeo[0], jsonGeo[1])); 
    613                                                 map.removeOverlay(marcador.Gpolygon); 
    614                                                 marcador.Gpolygon = newCircle(jsonGeo[0], jsonGeo[1], jsonGeo[2], '#ff00cc'); 
    615                                                 map.addOverlay(marcador.Gpolygon); 
    616                                                 $("#marcador_"+ data.id +" .corregir_coordenadas").empty(); 
    617                                                 $("#marcador_"+ data.id +" .contenedor_lat .valor").attr("class","valor editar_marcador"); 
    618                                                 $("#marcador_"+ data.id +" .contenedor_lonx .valor").attr("class","valor editar_marcador"); 
    619                                                 $("#marcador_"+ data.id +" .contenedor_radio .valor").attr("class","valor editar_marcador");             
    620                                         } 
    621                                 } 
    622                         }, "json" ); 
     550                        enviarMarcador(this); 
    623551                } 
    624552                return false; 
     
    626554        $("form.eliminar_marcador").submit(function() { 
    627555                var value = $(this.hidden_id).attr("value"); 
     556                var values = $(this).serialize(); 
     557                 
    628558                if (confirm(String.fromCharCode(191) +"Est"+ String.fromCharCode(225) +" seguro que desea eliminar este marcador?")) { 
    629                         var url= root + "inc/eliminar.php"; 
    630                         jQuery.post(url,{hidden_id: value}, function(data){ 
     559                        var url= root + "inc/eliminar_marcador.php"; 
     560                        $("#terminal").append('Se va a eliminar un marcador:' + '<br />'); 
     561                        $("#terminal").append(url+"?"+values + '<br />'); 
     562                        jQuery.post(url, values, function(data){ 
     563                                $("#terminal").append(data.msg); 
    631564                                if (data.id) { 
    632565                                        $("#marcador_" + data.id).remove(); 
     
    640573                return false; 
    641574        }); 
    642          
    643          $("form.corregir_proyecto").submit(function() { 
    644                 var url = root + "inc/actualizar_proyecto.php"; 
    645                 var values = $(this).serialize(); 
    646                 jQuery.post( url, values, function(data){ 
    647                         if (data.nombre) { 
    648                                 $("#valor_nombre_" + data.id + " .valor").attr("class","valor"); 
    649                                 eval('proyecto_' + data.id + ".nombre = data.nombre"); 
    650                                 $("#proyecto_"+ data.id +" .corregir_nombre").empty(); 
    651                         } 
    652                         if (data.descripcion) { 
    653                                 $("#valor_descripcion_" + data.id + " .valor").attr("class","valor"); 
    654                                 eval('proyecto_' + data.id + ".descripcion = data.descripcion"); 
    655                                 $("#proyecto_"+ data.id +" .corregir_descripcion").empty(); 
    656                         } 
    657                         if ((data.latitud)&&(data.longitud)&&(data.zoom)) { 
    658                                 eval('proyecto_' + data.id + ".latitud = data.latitud"); 
    659                                 eval('proyecto_' + data.id + ".longitud = data.longitud"); 
    660                                 eval('proyecto_' + data.id + ".zoom = data.zoom"); 
    661                                 map.setCenter(new GLatLng(data.latitud, data.longitud), data.zoom, G_HYBRID_MAP); 
    662                                 $("#proyecto_"+ data.id +" .corregir_localizacion").empty(); 
    663                         } 
    664                         if (data.icono) { 
    665                                 //$("#valor_icono_" + data.id + " .valor").attr("class","valor"); 
    666                                 eval('proyecto_' + data.id + ".icono = data.icono"); 
    667                                 $("#proyecto_"+ data.id +" .corregir_icono").empty(); 
    668                         } 
    669                 }, "json" ); 
    670                 return false; 
    671         }); 
    672 } 
    673  
    674 function inicia_jquery_1() { 
     575} 
     576 
     577function inicia_jquery_selector_proyectos() { 
    675578        $("input[name='project']").change( function(){ 
    676         var variable = $(this).attr("value"); 
    677         var latitudbase = $("#hidden_lat_"+variable).attr("value"); 
    678         var longitudbase = $("#hidden_lonx_"+variable).attr("value"); 
    679         var zoombase = parseInt($("#hidden_zoom_"+variable).attr("value")); 
    680         if ((variable)&&(variable != "")) { 
     579                var variable = $(this).attr("value"); 
     580        if (variable != "") { 
    681581                        editar_proyecto_html(variable); 
    682                         if (GBrowserIsCompatible()) { 
    683                                 map = new GMap2(document.getElementById("mapa_marcadores")); 
    684                                 map.setCenter(new GLatLng(latitudbase, longitudbase), zoombase, G_HYBRID_MAP); 
    685                         map.addMapType(G_PHYSICAL_MAP); 
    686                                 map.addControl(new GMapTypeControl()); 
    687                                 map.addControl(new GSmallMapControl()); 
    688                                 map.addControl(new mapEditControl()); 
    689                                 marcadoresProyecto = new GMarkerManager(map); 
    690                                 polyDragControl = new MPolyDragControl({map:map,type:'circle'}); 
    691                         } 
    692                         inicia_jquery_2(); 
     582                        $("#proyecto_"+ variable +" .contenedor").hide(); 
     583                        inicia_jquery_botones_proyecto(); 
    693584                        $("#marcadores").empty(); 
    694585                        $("#marcadores").append("<ul></ul>"); 
     
    702593         
    703594        $("#titulo_proyecto").blur( function(){ 
    704         var variable = $("#titulo_proyecto").attr("value"); 
    705                 if ((variable)&&(variable != "")) { 
    706                         $("#marcadores").empty(); 
    707                         $("#marcadores").append("<ul></ul>"); 
    708                         editar_proyecto_html(0, variable); 
    709                         $("#proyecto_0 .corregir_nombre").append(hidden_imput_html ("nombre", 0, variable)); 
    710                         $("#proyecto_0 .contenedor_nombre .valor").attr("class","valor new"); 
    711                         var geoData = ""; 
    712                         geoData += hidden_imput_html ("lat", 0, 43.331) + " "; 
    713                         geoData += hidden_imput_html ("lonx", 0, -2.97298) + " "; 
    714                         geoData += hidden_imput_html ("zoom", 0, 16); 
    715                         $("#proyecto_0 .corregir_localizacion").append(geoData); 
    716                         inicia_jquery(); 
    717                         inicia_jquery_2(); 
    718                         if (GBrowserIsCompatible()) { 
    719                                 map = new GMap2(document.getElementById("mapa_marcadores")); 
    720                                 map.setCenter(new GLatLng(43.331, -2.97298), 16, G_SATELLITE_MAP); 
    721                         map.addMapType(G_PHYSICAL_MAP); 
    722                                 map.addControl(new GMapTypeControl()); 
    723                                 map.addControl(new GSmallMapControl()); 
    724                                 map.addControl(new mapEditControl()); 
    725                                 marcadoresProyecto = new GMarkerManager(map); 
    726                                 polyDragControl = new MPolyDragControl({map:map,type:'circle'}); 
    727                         } 
    728                 } 
    729                 proyectoActual = 0; 
     595                var variable = $("#titulo_proyecto").attr("value"); 
     596                nuevo_proyecto(variable); 
    730597    }); 
    731598     
    732599    $("form.nuevo_proyecto").submit(function() { 
    733                 var variable = $("#titulo_proyecto").attr("value"); 
    734                 if ((variable)&&(variable != "")) { 
    735                         $("#marcadores").empty(); 
    736                         $("#marcadores").append("<ul></ul>"); 
    737                         editar_proyecto_html(0, variable); 
    738                         $("#proyecto_0 .corregir_nombre").append(hidden_imput_html ("nombre", 0, variable)); 
    739                         $("#proyecto_0 .contenedor_nombre .valor").attr("class","valor new"); 
    740                         var geoData = ""; 
    741                         geoData += hidden_imput_html ("lat", 0, 43.331) + " "; 
    742                         geoData += hidden_imput_html ("lonx", 0, -2.97298) + " "; 
    743                         geoData += hidden_imput_html ("zoom", 0, 16); 
    744                         $("#proyecto_0 .corregir_localizacion").append(geoData); 
    745                         inicia_jquery(); 
    746                         inicia_jquery_2(); 
    747                         if (GBrowserIsCompatible()) { 
    748                                 map = new GMap2(document.getElementById("mapa_marcadores")); 
    749                                 map.setCenter(new GLatLng(43.331, -2.97298), 16, G_SATELLITE_MAP); 
    750                         map.addMapType(G_PHYSICAL_MAP); 
    751                                 map.addControl(new GMapTypeControl()); 
    752                                 map.addControl(new GSmallMapControl()); 
    753                                 map.addControl(new mapEditControl()); 
    754                                 marcadoresProyecto = new GMarkerManager(map); 
    755                                 polyDragControl = new MPolyDragControl({map:map,type:'circle'}); 
    756                         } 
    757                         proyectoActual = 0; 
    758                 } 
     600        var variable = $("#titulo_proyecto").attr("value"); 
     601                nuevo_proyecto(variable); 
    759602                return false; 
    760603    }); 
    761604} 
    762 function inicia_jquery_2() { 
     605function nuevo_proyecto(nombre) { 
     606        if (nombre != "") { 
     607                $("#marcadores").empty(); 
     608                $("#marcadores").append("<ul></ul>"); 
     609                editar_proyecto_html(0, nombre); 
     610                $("#proyecto_0 .corregir_nombre").append(hidden_imput_html ("nombre", 0, nombre)); 
     611                $("#proyecto_0 .contenedor_nombre .valor").attr("class","valor new"); 
     612                var geoData = ""; 
     613                geoData += hidden_imput_html ("lat", 0, miniMap.getCenter().lat()) + " "; 
     614                geoData += hidden_imput_html ("lonx", 0, miniMap.getCenter().lng()) + " "; 
     615                geoData += hidden_imput_html ("zoom", 0, miniMap.getZoom()); 
     616                $("#proyecto_0 .corregir_localizacion").append(geoData); 
     617                $("#proyecto_0 .corregir_localizacion").before('<input name="hidden_autor" id="hidden_autor_0" value="'+usuario+'" type="hidden">\n'); 
     618                inicia_jquery(); 
     619                inicia_jquery_botones_proyecto(); 
     620                $("#proyecto_0 .contenedor").slideDown("slow"); 
     621                $('#marcadores').animate({top: "320px"}, "slow"); 
     622                $(".aciones").hide(); 
     623                proyectoActual = 0; 
     624                desplagable = true; 
     625        } 
     626} 
     627 
     628function inicia_jquery_botones_proyecto() { 
    763629        $(".novo").click( function(){ 
    764                 $(this.parentNode.parentNode).remove(); 
    765                 $("ul").empty(); 
    766                 editar_proyecto_html(0, ""); 
    767                 if (GBrowserIsCompatible()) { 
    768                         map.setCenter(new GLatLng(43.331, -2.97298), 16, G_SATELLITE_MAP); 
    769                 } 
    770                 inicia_jquery(); 
    771                 inicia_jquery_2(); 
    772                 proyectoActual = 0; 
     630                var ok = confirm("Desea crear un nuevo proyecto?"); 
     631                if (ok==true) { 
     632                        $(this.parentNode.parentNode).remove(); 
     633                        $("ul").empty(); 
     634                        $("#mapa_marcadores").empty(); 
     635                        editar_proyecto_html(0, ""); 
     636                        $("#proyecto_0 .corregir_localizacion").prepend('<input name="hidden_autor" id="hidden_autor_0" value="'+usuario+'" type="hidden">'); 
     637                        inicia_jquery(); 
     638                        inicia_jquery_botones_proyecto(); 
     639                        if (!desplagable) { 
     640                                $("#proyecto_"+ proyectoActual +" .contenedor").slideToggle("slow"); 
     641                                $('#marcadores').animate({top: "320px"}, "slow"); 
     642                                desplagable = true; 
     643                        } 
     644                        proyectoActual = 0; 
     645                } 
    773646        }); 
    774647        $(".toogle").click( function(){ 
    775                 var data = $(this.parentNode.parentNode).attr("id").split("_"); 
    776                 $("#proyecto_"+ data[1] +" .contenedor").slideToggle("slow"); 
     648                $("#proyecto_"+ proyectoActual +" .contenedor").slideToggle("slow"); 
    777649                if (desplagable) { 
    778650                        $('#marcadores').animate({top: "30px"}, "slow"); 
     
    782654                desplagable = !desplagable; 
    783655        }); 
     656        $(".next").click( function(){ 
     657                var siguiente; 
     658                if (proyectoActual==0) { 
     659                        siguiente = 0; 
     660                } else { 
     661                        siguiente = eval('proyecto_'+proyectoActual+'.numero') + 1; 
     662                } 
     663                if(siguiente<proyectos.length) { 
     664                        var idSiguiente = proyectos[siguiente]; 
     665                        $(this.parentNode.parentNode).remove(); 
     666                        editar_proyecto_html(idSiguiente); 
     667                        if (!desplagable){ 
     668                                $("#proyecto_"+ idSiguiente +" .contenedor").hide(); 
     669                        } 
     670                        if (GBrowserIsCompatible()) { 
     671                                map.setCenter(new GLatLng(eval('proyecto_'+idSiguiente+'.lat'), eval('proyecto_'+idSiguiente+'.lonx')), parseInt(eval('proyecto_'+ idSiguiente +'.zoom')), G_SATELLITE_MAP); 
     672                        } 
     673                        inicia_jquery_botones_proyecto(); 
     674                $("ul").empty(); 
     675                leerRss(eval('proyecto_'+ idSiguiente +'.id')); 
     676                proyectoActual = idSiguiente; 
     677                } else { 
     678                        alert("este es el ultimo proyecto") 
     679                } 
     680        }); 
    784681        $(".back").click( function(){ 
    785                 var data = $(this.parentNode.parentNode).attr("id").split("_"); 
    786                 var numero = eval('proyecto_'+data[1]+'.numero'); 
    787                 var idAnterior = proyectos[(numero - 1)]; 
    788                 if(numero>0) { 
     682                var anterior; 
     683                if (proyectoActual==0) { 
     684                        anterior = (proyectos.length-1); 
     685                } else { 
     686                        anterior = eval('proyecto_'+proyectoActual+'.numero') - 1; 
     687                } 
     688                if(anterior>=0) { 
     689                        var idAnterior = proyectos[anterior]; 
    789690                        $(this.parentNode.parentNode).remove(); 
    790691                        editar_proyecto_html(idAnterior); 
     692                        if (!desplagable){ 
     693                                $("#proyecto_"+ idAnterior +" .contenedor").hide(); 
     694                        } 
    791695                        if (GBrowserIsCompatible()) { 
    792696                                map.setCenter(new GLatLng(eval('proyecto_'+ idAnterior +'.lat'), eval('proyecto_'+ idAnterior +'.lonx')), parseInt(eval('proyecto_'+ idAnterior +'.zoom')), G_SATELLITE_MAP); 
    793697                        } 
    794                         inicia_jquery_2(); 
     698                        inicia_jquery_botones_proyecto(); 
    795699                $("ul").empty(); 
    796700                leerRss(eval('proyecto_'+ idAnterior +'.id')); 
     
    800704                } 
    801705        }); 
    802         $(".next").click( function(){ 
    803                 var data = $(this.parentNode.parentNode).attr("id").split("_"); 
    804                 var numero = eval('proyecto_'+data[1]+'.numero'); 
    805                 var idSiguiente = proyectos[(numero + 1)]; 
    806                 if(idSiguiente<proyectos.length) { 
    807                         $(this.parentNode.parentNode).remove(); 
    808                         editar_proyecto_html(idSiguiente); 
    809                         if (GBrowserIsCompatible()) { 
    810                                 map.setCenter(new GLatLng(eval('proyecto_'+idSiguiente+'.lat'), eval('proyecto_'+idSiguiente+'.lonx')), parseInt(eval('proyecto_'+ idSiguiente +'.zoom')), G_SATELLITE_MAP); 
    811                         } 
    812                         inicia_jquery_2(); 
    813                 $("ul").empty(); 
    814                 leerRss(eval('proyecto_'+ idSiguiente +'.id')); 
    815                 proyectoActual = idSiguiente; 
    816                 } else { 
    817                         alert("este es el ultimo proyecto") 
    818                 } 
    819         }); 
    820 } 
     706        $(".eliminar_proyecto").click(function() { 
     707                var url = root + "inc/eliminar_proyecto.php"; 
     708                var value = $(this).attr("id").split("_"); 
     709                var ok = confirm("Esta seguro que desea eliminar el proyecto completo!"); 
     710                if (ok==true) { 
     711                        jQuery.post(url, { hidden_id: value[2] }, function(data){ 
     712                                if (typeof data.error!="undefined") { 
     713                                        alert(data.error); 
     714                                } else { 
     715                                        proyectoActual = null; 
     716                                        eval('proyecto_'+value[2]+'=null'); 
     717                                        $("#proyecto_"+ proyectoActual +" .contenedor").hide(); 
     718                                        $('#marcadores').css('top', '30px'); 
     719                                        desplagable = false; 
     720                                $("#mapa_marcadores").empty(); 
     721                                $("#proyectos").empty(); 
     722                                $("ul").empty(); 
     723                                        alert(data.msg); 
     724                                        cargarProyectos(); 
     725                                        $("#proyectos").prepend('<div class="pestanha"></div>'); 
     726                                        //checkCookie(); 
     727                                } 
     728                        }, "json" ); 
     729                } 
     730        }); 
     731        $(".actualizar_proyecto").click(function() { 
     732                var url = root + "inc/actualizar_rss.php"; 
     733                var data = $(this).attr("id").split("_"); 
     734                jQuery.post(url, { proyecto: data[2] }, function(data){ 
     735                        if (typeof data.error!="undefined") { 
     736                                alert(data.msg); 
     737                        } else { 
     738                                alert(data.msg); 
     739                        } 
     740                }, "json" ); 
     741        }); 
     742        $("form.corregir_proyecto").submit(function() { 
     743                if (confirm(String.fromCharCode(191) +"Est"+ String.fromCharCode(225) +" seguro que desea modificar este proyecto?")) { 
     744                        enviarProyecto(this); 
     745                } 
     746                return false; 
     747        }); 
     748} 
  • notours/noTours editor/inc/procesar_icono.php

    r222 r250  
    5757        //<![CDATA[ 
    5858        var target; 
     59         
     60        var box, proyecto, id, contenedor, contenedor_icono, formulario, valor, campo; 
     61         
    5962        var content = ""; 
     63        content += \'<spam class="new">icono: '.$array_nombre[0].'.png</spam>\'; 
     64        content += \'<input name="hidden_icono" id="hidden_icono_\' + id + \'" type="hidden" value="'.$array_nombre[0].'.png" />\'; 
     65         
     66         
    6067        $(document).ready(function() { 
    61                 target = parent.window.document.getElementById("iframe_icono"); 
    62                 var id = $(target).attr("name"); 
    63                 target = parent.window.document.getElementById("campo_icono_" + id); 
    64                 $(target).hide(); 
    65                 target = parent.window.document.getElementById("valor_icono_" + id); 
    66                 for(i=0; i<target.childNodes.length; i++) { 
    67                         if(target.childNodes[i].nodeName=="IMG"){ 
    68                                 target.childNodes[i].src = "'.$root.'/'.$tmpImageFolder.$array_nombre[0].'.png"; 
     68                box = parent.window.document.getElementById("proyectos"); 
     69                for(i=0; i<box.childNodes.length; i++) { 
     70                        if(box.childNodes[i].nodeName=="DIV"){ 
     71                                proyecto = box.childNodes[i]; 
     72                                var str = proyecto.id.split("_"); 
     73                                id = str[1]; 
    6974                                break; 
    7075                        } 
    7176                } 
    72                 $(target).show(); 
    73                 target = parent.window.document.getElementById("corregir_icono_" + id); 
    74                 content = \'\'; 
    75                 content += \'<spam class="new">icono: '.$array_nombre[0].'.png</spam>\'; 
    76                 content += \'<input name="hidden_icono" id="hidden_icono_\' + id + \'" type="hidden" value="'.$array_nombre[0].'.png" />\'; 
    77                 $(target).empty(); 
    78                 $(target).append(content); 
     77                for (i=0; i<proyecto.childNodes.length; i++) { 
     78                        if ($(proyecto.childNodes[i]).attr("class")=="contenedor") { 
     79                                contenedor = proyecto.childNodes[i]; 
     80                                for (u=0; u<contenedor.childNodes.length; u++) { 
     81                                        if ($(contenedor.childNodes[u]).attr("class")=="contenedor_icono") { 
     82                                                contenedor_icono = contenedor.childNodes[u]; 
     83                                        } else if ($(contenedor.childNodes[u]).attr("class")=="corregir_proyecto") { 
     84                                                formulario = contenedor.childNodes[u]; 
     85                                                break; 
     86                                        } 
     87                                } 
     88                        }  
     89                } 
     90                for (i=0; i<contenedor_icono.childNodes.length; i++) { 
     91                        if ($(contenedor_icono.childNodes[i]).attr("class")=="caja_valor") { 
     92                                valor = contenedor_icono.childNodes[i]; 
     93                                for(u=0; u<valor.childNodes.length; u++) { 
     94                                        if(valor.childNodes[u].nodeName=="IMG"){ 
     95                                                valor.childNodes[u].src = "'.$root.$tmpImageFolder.$array_nombre[0].'.png"; 
     96                                                //$(valor.childNodes[u]).css("background-color","#7dbeec"); 
     97                                                //$(valor.childNodes[u]).fadeTo("fast", 0.6); 
     98                                                break; 
     99                                        } 
     100                                } 
     101                        } else if ($(contenedor_icono.childNodes[i]).attr("class")=="caja_campo agochado") { 
     102                                campo = contenedor_icono.childNodes[i]; 
     103                                break; 
     104                        } 
     105                } 
     106                for(i=0; i<formulario.childNodes.length; i++) { 
     107                        if(formulario.childNodes[i].nodeName=="FIELDSET"){ 
     108                                fieldset = formulario.childNodes[i]; 
     109                                for(u=0; u<fieldset.childNodes.length; u++) { 
     110                                        if($(fieldset.childNodes[u]).attr("class")=="corregir_icono"){ 
     111                                                $(fieldset.childNodes[u]).empty(); 
     112                                                $(fieldset.childNodes[u]).append(content); 
     113                                                break; 
     114                                        } 
     115                                } 
     116                                break; 
     117                        } 
     118                } 
     119                $(campo).hide(); 
     120                $(valor).show(); 
    79121                window.location = "'.$root.'/inc/iframe_subir_icono.html"; 
     122                 
    80123        }); 
    81124        //]]> 
  • notours/noTours editor/inc/procesar_son.php

    r222 r250  
    1010        <HEAD> 
    1111                <script src="js/jquery-1.2.6.min.js" type="text/javascript"></script> 
     12                <script src="js/notours-ajax-html.js" type="text/javascript"></script> 
     13                <script src="js/notours-ajax.js" type="text/javascript"></script> 
    1214        </HEAD> 
    1315        <script language="javascript"> 
     
    3941                                        } 
    4042                                } 
    41                                 nuevoValor =\'\'; 
    42                                 nuevoValor += \'<object data="inc/playerwpress.swf?soundFile='.$root.$tmpSoundFolder.$nombre.'" type="application/x-shockwave-flash" height="24" width="290">\\n\'; 
    43                                 nuevoValor += \'<param value="inc/playerwpress.swf?soundFile='.$root.$tmpSoundFolder.$nombre.'" name="movie">\\n\'; 
    44                                 nuevoValor += \'<param value="high" name="quality">\\n\'; 
    45                                 nuevoValor += \'<param value="true" name="menu">\\n\'; 
    46                                 nuevoValor += \'<param value="transparent" name="wmode"></object>\\n\'; 
    47                                 $(valor).append(nuevoValor); 
     43                                $(valor).append(sound_html("'.$root.$tmpSoundFolder.$nombre.'","&bg=c2dbec&leftbg=7dbeec&rightbg=7193d1&rightbghover=3b65b0")); 
    4844                                for(u=0; u<valor.childNodes.length; u++) { 
    4945                                        if(valor.childNodes[u].nodeName=="OBJECT"){ 
  • notours/noTours editor/marcadores.php

    r216 r250  
    11<?php 
    2 header("Content-type: text/xml; charset=utf-8"); 
     2        header("Content-type: text/xml; charset=utf-8"); 
    33 
    4 // incluimos el documento que contiene todas las funciones 
    5 include ("inc/cb-library.php"); 
    6 include ("inc/config.php"); 
     4        // incluimos el documento que contiene todas las funciones 
     5        include ("inc/cb-library.php"); 
     6        include ("inc/config.php"); 
     7        include ("inc/db.php"); 
     8        include ("inc/feed.php"); 
    79 
    8 $id = $_GET['id']; 
     10        $id = $_GET['id']; 
    911 
    10 $marcadores = db_marcadores($id); 
    11 $proyecto = db_proyecto($id); 
     12        $project = db_project('id', $id); 
     13        $objects = db_objects($id); 
     14        $return = objects_feed($project, $objects, 'rss1'); 
    1215 
    13 $return = feed($proyecto, $marcadores, "rss", false); 
    14  
    15 echo $return; 
     16        echo $return; 
    1617?> 
  • notours/noTours editor/proyectos.php

    r216 r250  
    55include ("inc/cb-library.php"); 
    66include ("inc/config.php"); 
     7include ("inc/db.php"); 
     8include ("inc/feed.php"); 
    79 
    8 $channel = array(); 
    9 $channel["nombre"] = "noTours android project list"; 
    10 $channel["descripcion"] = "noTours android project list"; 
    11 $proyectos = db_proyectos(); 
     10if (isset($_GET["id_autor"])) { 
     11        $autor = $_GET["id_autor"]; 
     12        $proyectos = db_project('author_id', $autor); 
     13} else { 
     14        $proyectos = db_project('', ''); 
     15} 
    1216 
    13 $return = feed2($channel, $proyectos, "rss", false); 
     17$return = projects_feed($proyectos); 
    1418 
    1519echo $return; 
    16  
    1720?>