Ignore:
Timestamp:
Feb 28, 2011, 12:53:47 PM (13 years ago)
Author:
cljosse
Message:
 
Location:
extensions/edit_gmaps/admin
Files:
27 added
9 edited

Legend:

Unmodified
Added
Removed
  • extensions/edit_gmaps/admin/admin.php

    r9377 r9412  
    44
    55$colonnes = cl_get_columns_of(IMAGES_TABLE);
     6
     7$key = array_search('lon', $colonnes[IMAGES_TABLE]);
     8if (!$key){
     9    $q = 'ALTER TABLE '.IMAGES_TABLE.' ADD COLUMN `lon` DOUBLE(9,6)';
     10    pwg_query($q);     
     11}       
     12$key = array_search('lat', $colonnes[IMAGES_TABLE]);
     13if (!$key){
     14    $q = 'ALTER TABLE '.IMAGES_TABLE.' ADD COLUMN `lat` DOUBLE(9,6)';
     15    pwg_query($q);     
     16}       
    617$key = array_search('alt', $colonnes[IMAGES_TABLE]);
    718if (!$key){
    819    $q = 'ALTER TABLE '.IMAGES_TABLE.' ADD COLUMN `alt` DOUBLE(9,6)';
    920    pwg_query($q);     
    10 }               
     21}       
     22
     23       
    1124/**
    1225* list all columns of each given table
  • extensions/edit_gmaps/admin/admin_edit.php

    r9377 r9412  
    44load_language('lang', dirname(__FILE__).'/../');
    55$admin_url = PHPWG_ROOT_PATH.'admin.php';
    6 
    7 
    86
    97if ( !isset($_GET['cat']) )   $_GET['cat'] = 'caddie';
     
    2018
    2119/***********************************************************************************/
    22   if (!defined('TOOL_KIT_PATH')) define(  'TOOL_KIT_PATH',   EDIT_RV_PATH."admin/");
     20  if (!defined('TOOL_KIT_PATH')) define(  'TOOL_KIT_PATH',   EDIT_CL_PATH."admin/");
    2321  if (!defined('INCLUDE_PATH')) define(  'INCLUDE_PATH',   TOOL_KIT_PATH.'include/' );                     
    2422  $Toolkit_Dir =INCLUDE_PATH           ;   
     
    2927 
    3028$template->concat('TABSHEET_TITLE', ' '.l10n_dec('%d image', '%d images', count($page['cat_elements_id'])).' - '.$page['title']);
    31 
    32 
    33 if ( isset($_POST['submit'])  )
    34 {
    35   $collection = array();
    36   if( !isset ($_POST['target']))
    37   {
    38         $_POST['submit'] == l10n('Submit') ;
    39         $_POST['target']='selection';
    40         $collection = $_POST['selection'];
    41 
    42   }
    43 
    44   switch ($_POST['target'])
    45   {
    46     case 'all' :
    47       $collection = $page['cat_elements_id'];
    48       break;
    49     case 'selection' :
    50       if (!isset($_POST['selection']) or count($_POST['selection']) == 0)
    51         array_push($page['errors'], l10n('Select at least one picture'));
    52       else
    53         $collection = $_POST['selection'];
    54       break;
    55   }
    56 
    57   // test si mise à jour (valider)
    58   if ( isset($_POST['submit']) and  $_POST['submit'] == l10n('Submit') )
    59     {
    60           if ( count($collection)>0 )
    61           {
    62                 $lat = trim($_POST['lat']);
    63                 $lon = trim($_POST['lon']);
    64         $alt = trim($_POST['alt']);
     29$info_message="" ;
     30$error_message="";
     31
     32/************* Mise à jour des meta données ***************/
     33if ( isset($_POST['update']) && $_POST['update']==l10n('update_exif'))
     34{
     35    $exif = @read_exif_data( $exif );     
     36    $exif = @array_intersect_key( $exif, array_flip( array('GPSLatitudeRef', 'GPSLatitude', 'GPSLongitudeRef', 'GPSLongitude', 'GPSAltitudeRef', 'GPSAltitude') ) );
     37
     38  // error_reporting ( 0 );
     39  // Hide any unknown EXIF tags       
     40 $GLOBALS['HIDE_UNKNOWN_TAGS'] = FALSE;
     41                        include $Toolkit_Dir.'Toolkit_Version.php';   // Change: added as of version 1.11
     42                         // Include the required files for reading and writing Photoshop File Info
     43                        include  $Toolkit_Dir.'JPEG.php';
     44                        include  $Toolkit_Dir.'XMP.php';
     45                        include  $Toolkit_Dir.'Photoshop_IRB.php';
     46                        include  $Toolkit_Dir.'EXIF.php';
     47                        include  $Toolkit_Dir.'GPS_File_Info.php';
     48                        $GLOBALS['HTTP_POST_VARS']=$_POST ;
     49                         // Copy all of the HTML Posted variables into an array
     50                        $new_ps_file_info_array = $GLOBALS['HTTP_POST_VARS'];
     51                        // Some characters are escaped with backslashes in HTML Posted variable
     52                        // Cycle through each of the HTML Posted variables, and strip out the slashes '
     53                        foreach( $new_ps_file_info_array as $var_key => $var_val ){
     54                            if ($var_key !="selection")
     55                                $new_ps_file_info_array[ $var_key ] = stripslashes( $var_val ); 
     56                         
     57                         }         
     58                    $new_ps_file_info_array['selection'] = explode(";",$new_ps_file_info_array['filename']);
     59                    foreach( $new_ps_file_info_array['selection']  as $filename )   {
     60                        //======================================================
     61                        //= $new_ps_file_info_array[ 'filename' ];
     62                        if($filename!="")   
     63                            {       // Protect against hackers editing other files   
     64                             
     65                           //      copy( $filename,  $filename.".bak" ); 
     66                                $path_parts = pathinfo( $filename );   
     67                        if(1) {
     68                               if ( strcasecmp( $path_parts["extension"], "jpg" ) != 0 )
     69                                    {
     70                                                              $error_message .= $filename ;                                     
     71                                       $error_message .="Incorrect File Type - JPEG Only\n";
     72                                       $filename="";
     73                                          //  exit( );
     74                                    }
     75                      // Change: removed limitation on file being in current directory - as of version 1.11
     76                      // Retrieve the header information
     77                      $jpeg_header_data = get_jpeg_header_data( $filename );
     78                        // Retreive the EXIF, XMP and Photoshop IRB information from
     79                        // the existing file, so that it can be updated
     80                        $Exif_array = get_EXIF_JPEG( $filename );
     81                        $XMP_array = read_XMP_array_from_text( get_XMP_text( $jpeg_header_data ) );
     82                        $IRB_array = get_Photoshop_IRB( $jpeg_header_data );
     83
     84                        // Update the JPEG header information with the new Photoshop File Info
     85                        $jpeg_header_data = put_GPS_file_info( $jpeg_header_data, $new_ps_file_info_array, $Exif_array, $XMP_array, $IRB_array );
     86               // Check if the Update worked
     87              if ( $jpeg_header_data == FALSE ) {
     88                                // Update of file info didn''t work - output error message
     89                        $error_message .= "jpeg_header_data
     90                        Error - Failure update Photoshop File Info : $filename <br>\n";
     91
     92                                // Output HTML with the form and data which was
     93                                // sent, to allow the user to fix it
     94
     95                        }else if ( FALSE == put_jpeg_header_data(  $filename, $filename, $jpeg_header_data ) )
     96                        {// Attempt to write the new JPEG file
     97                                // Writing of the new file didn''t work - output error message
     98                           $error_message .= "Error - Failure to write new JPEG : $filename <br>\n";
     99
     100                                // Output HTML with the form and data which was
     101                                // sent, to allow the user to fix it
     102
     103                        }else{
     104                         $info_message .= l10n('update') . " Exif: " . $filename . " " .  l10n('OK') ."<br />" ;
     105                           
     106                        }   
     107                        $_POST['submit']= l10n('update_database') ;
     108                    }
     109                }
     110            }
     111            //================================================
     112             $_POST['update'] ="ok";
     113        }
     114     
     115
     116        if ( isset($_POST['submit'])  ) {
     117            $collection = array();
     118                if( !isset ($_POST['target'])) {
     119                    $_POST['submit'] = l10n('Submit') ;
     120                    $_POST['target']='selection';
     121                    $collection = $_POST['selection'];
     122               }
     123
     124              switch ($_POST['target'])
     125              {
     126                case 'all' :
     127                  $collection = $page['cat_elements_id'];
     128                  break;
     129                case 'selection' :
     130                  if (!isset($_POST['selection']) or count($_POST['selection']) == 0)
     131                    array_push($page['errors'], l10n('Select at least one picture'));
     132                  else
     133                    $collection = $_POST['selection'];
     134                  break;
     135              }
     136
     137            /******** Mise à jour base de données *****/
     138          if (   $_POST['submit'] == l10n('update_database') )
     139            {
     140                  if ( count($collection)>0 )
     141                  {
     142                        $lat = trim($_POST['lat']);
     143                        $lon = trim($_POST['lon']);
     144                $alt = trim($_POST['alt']);
    65145 
    66                 if ( strlen($lat)>0 and strlen($lon)>0 )
    67                 {
    68                   if ( (double)$lat<=90 and (double)$lat>=-90
    69                           and (double)$lon<=180 and (double)$lat>=-180 )
    70                         $update_query = 'lat='.$lat.', lon='.$lon;
    71                   else
    72                         $page['errors'][] = 'Invalid lat or lon value';
    73                 }
    74                 elseif ( strlen($lat)==0 and strlen($lon)==0 )
    75                   $update_query = 'lat=NULL, lon=NULL';
    76                 else
    77                   $page['errors'][] = 'Both lat/lon must be empty or not empty';
    78 
    79         if ( strlen($alt)==0)
    80              $update_query .= ', alt=NULL';
    81           else
    82              $update_query .= ', alt=' .$alt ;
    83 
    84 
    85 
    86                 if (isset($update_query))
    87                 {
    88                   $update_query = '
    89                         UPDATE '.IMAGES_TABLE.' SET '.$update_query.'
    90                         WHERE id IN ('.implode(',',$collection).')';
    91                   pwg_query($update_query);
    92                   cl_meta_invalidate_cache();
    93                 }
    94           }
    95         }
     146                        if ( strlen($lat)>0 and strlen($lon)>0 )
     147                        {
     148                          if ( (double)$lat<=90 and (double)$lat>=-90
     149                                  and (double)$lon<=180 and (double)$lat>=-180 )
     150                                $update_query = 'lat='.$lat.', lon='.$lon;
     151                          else
     152                                $page['errors'][] = 'Invalid lat or lon value';
     153                        }
     154                        elseif ( strlen($lat)==0 and strlen($lon)==0 )
     155                          $update_query = 'lat=NULL, lon=NULL';
     156                        else
     157                          $page['errors'][] = 'Both lat/lon must be empty or not empty';
     158
     159                if ( strlen($alt)==0)
     160                     $update_query .= ', alt=NULL';
     161                  else
     162                     $update_query .= ', alt=' .$alt ;
     163
     164                        if (isset($update_query))
     165                        {
     166                          $update_query = '
     167                                UPDATE '.IMAGES_TABLE.' SET '.$update_query.'
     168                                WHERE id IN ('.implode(',',$collection).')';
     169                            pwg_query($update_query);
     170                            cl_meta_invalidate_cache();
     171                  $info_message .= l10n('update') . " " . IMAGES_TABLE . " : " .  l10n('OK') ;
     172                          $_POST['submit'] = l10n('Submit') ;
     173                }
     174
     175                  }
     176                }
    96177}
    97178
     
    180261
    181262//==========================================================
    182         if (!defined('EDIT_RV_PATH')) define(  'EDIT_RV_PATH',  EDIT_RV_PATH .'admin/' );
    183         $path = EDIT_RV_PATH;
     263        if (!defined('EDIT_CL_PATH')) define(  'EDIT_CL_PATH',  EDIT_CL_PATH .'admin/' );
     264        $path = EDIT_CL_PATH;
    184265    $plg_data = implode( '', file($path.'main.inc.php') );
    185266         if (preg_match("|Version: (.*)|", $plg_data, $val))
    186           { $EDIT_RV_PATH_plugin['version'] = trim($val[1]);  } 
    187             $EDIT_RV_PATH_plugin = array_map('htmlspecialchars', $EDIT_RV_PATH_plugin);
    188             $version= $EDIT_RV_PATH_plugin['version'] ;
     267          { $EDIT_CL_PATH_plugin['version'] = trim($val[1]);  } 
     268            $EDIT_CL_PATH_plugin = array_map('htmlspecialchars', $EDIT_CL_PATH_plugin);
     269            $version= $EDIT_CL_PATH_plugin['version'] ;
    189270            $icon_path = 'themes/default/icon/help.png';
    190271            $path_js=  'themes/default/js/' ;
    191272
    192273//==================================================================================
    193 $match=""; 
     274$match="";
     275     
    194276if ( isset($_POST['submit'])   )
    195277{       
    196 
    197278  if ($_POST['submit']==l10n('Submit') )
    198279   {
     
    209290                }
    210291 
    211 
    212292 }
    213293//=================================================================================
    214294$src="";
     295
    215296$template->assign(
    216     array(      'EDIT_RV_PATH' => EDIT_RV_PATH,
     297    array(      'EDIT_CL_PATH' => EDIT_CL_PATH,
    217298                'path_js' => $path_js,
    218299            'VERSION'=> $version,
    219             'EDIT_RV_PATH_ABS' => dirname(__FILE__).'/',
     300            'EDIT_CL_PATH_ABS' => dirname(__FILE__).'/',
    220301              )
    221302  );
    222303  global $lang_info;
    223 if (date_default_timezone_get()) { $adresse =  date_default_timezone_get()   ;}
    224 else{
    225 
    226 }
    227 $adresse =  $lang_info['country'];   ;
    228 $adresse=str_replace("/",", ",$adresse);
    229 $template->assign( 'coordinates',
    230                                                    array('LAT' => '100',
    231                                                                                  'LON' => '100',
    232                                                                                  'ADRESSE' => $adresse,
    233                                                                                  'ZOOM' => 18,
    234                                          'ALT' => 0
    235                                                                                 )
    236                                                                         );
    237                                     $filename ="";
     304    if (date_default_timezone_get()) {
     305            $adresse =  date_default_timezone_get()   ;
     306        }else{
     307
     308        }
     309    $adresse =  $lang_info['country'];   ;
     310    $adresse=str_replace("/",", ",$adresse);
     311    $template->assign( 'coordinates',
     312                                        array(  'FILE' => '',
     313                                'LAT' => '100',
     314                                                                'LON' => '100',
     315                                                                'ADRESSE' => $adresse,
     316                                                                'ZOOM' => 18,
     317                                'ALT' => 0
     318                                                        )
     319                                                );   
    238320
    239321if (isset($_POST['submit']) and $_POST['submit']==l10n('selection' ))
    240322{
    241323    if (isset($collection))     
    242         {  $lat =1000;
     324        {  $lat =1000;$first_image="";
     325                           
    243326            foreach ($collection as $id_0)  {
    244327                        foreach ($images as $image)  {
    245328                                if (array_search($id_0,$image)) {
    246329                                    $_POST['selection'] = $collection ;   
    247                      
    248                         $infos_gps=  Get_exif_gps( $image['path'],$image) ;   
    249                         if( $image['lat'] == ''){ 
    250                                 $image['lat']=$infos_gps['lat'];
    251                                 $image['lon']=$infos_gps['lon'];
    252                                 $image['alt']=$infos_gps['alt'];
    253                             }else {
    254                                 $image['lat']=$infos_gps['lat'];
    255                                 $image['lon']=$infos_gps['lon'];
    256                                 $image['alt']=$infos_gps['alt'];
    257                             }       
    258       $filename=  $image;
    259    
    260          
    261                 if ($lat==1000) {
     330                        $infos_gps=  Get_exif_gps( $image['path'],$image) ;   
     331                        $image['lat']=$infos_gps['lat'];
     332                        $image['lon']=$infos_gps['lon'];
     333                        $image['alt']=$infos_gps['alt'];   
     334                       
     335              if ($lat==1000) {
    262336                            $lat= ($image['lat'] <> '') ? $image['lat'] : '100'  ;
    263337                                $lon= ($image['lon']  <> '') ? $image['lon'] : '3.0'  ;
     
    266340                                //=====================================================
    267341                                $template->assign( 'coordinates',
    268                                                    array('LAT' =>   $lat  ,
     342                                                   array('FILE' => $image['path'],
     343                                         'LAT' =>   $lat  ,
    269344                                                                                 'LON' =>   $lon  ,
    270345                                                                                 'ADRESSE' =>  $adresse ,
     
    274349                                                                        );
    275350                                }
     351                                               
     352                    $lon=$image['lon'];
     353                    $lat=$image['lat'];   
     354                    if($infos_gps['is_exif'])   $info_message .='EXIF';   
     355
    276356                $lonDMS= dec2dms($lon) ;
    277357                $latDMS= dec2dms($lat) ;
    278                 if ($infos_gps['lat']=="")
    279                   $icon='icon/minus.png';
    280                   else $icon='icon/minus.png';
     358
    281359
    282360                            $tpl_var = array_merge(
    283361                                    $image,
    284362                                        array(
    285                            'icon' => $icon ,
     363                           'filename' =>  $image['path'],
     364                           'exif' => $infos_gps['is_exif'] ,
    286365                                                   'lat'  =>    $image['lat']    ,
    287366                                                   'lon' =>     $image['lon']    ,
    288367                           'alt' =>     $image['alt']    ,
    289368                           'latDMS' =>    $latDMS[3]     ,
    290                            'lonDMS' =>   $lonDMS[3]     ,
     369                           'lonDMS' =>   "-->".$lonDMS[3]     ,
    291370                                                   'adresse' =>  $adresse   ,
    292371                                                'U_TN' => get_thumbnail_url($image),
     
    311390
    312391
    313  if ( !empty($filename))
     392 if ( !empty($first_image))
     393 { $error_message .= cl_edit_controler::Memo_Vars($first_image);
     394 if (isset($_POST['update']))
    314395 {
    315396// document.Envoie.latDMS.value
    316         $image= $filename ;
    317         $filename= $filename['path'] ;
     397       
     398
     399        $image= first_image ;
     400        $filename=$image['path'] ;
    318401        $Val_exif="";
    319402        $Val_XMP="";   
    320           // error_reporting ( 0 );
    321   // Hide any unknown EXIF tags
    322 /*
    323  $GLOBALS['HIDE_UNKNOWN_TAGS'] = FALSE;
    324    include $Toolkit_Dir . 'Toolkit_Version.php';          // Change: added as of version 1.11
    325    include $Toolkit_Dir . 'JPEG.php';                     // Change: Allow this example file to be easily relocatable - as of version 1.11
    326    include $Toolkit_Dir . 'JFIF.php';
    327    include $Toolkit_Dir . 'PictureInfo.php';
    328    include $Toolkit_Dir . 'XMP.php';
    329    include $Toolkit_Dir . 'Photoshop_IRB.php';
    330    include $Toolkit_Dir . 'EXIF.php';
     403
    331404 
    332         $jpeg_header_data = get_jpeg_header_data($filename );
    333      */   
     405       
     406   /*  */   
    334407     if (!empty($infos_gps))
    335408     $Position = $infos_gps ;
     
    339412
    340413
     414
     415  $jpeg_header_data = get_jpeg_header_data($filename );
    341416     $template->assign( array(
    342417      'filename_abs' =>   $filename ,
    343418      'filename' => $filename,
    344419     'datas'    =>    array(
    345      /*     'Val_JPEG_APP'=> Generate_JPEG_APP_Segment_HTML( $jpeg_header_data ),
     420/*       'Val_JPEG_APP'=> Generate_JPEG_APP_Segment_HTML( $jpeg_header_data ),
    346421        'Val_intrinsic'=> Interpret_intrinsic_values_to_HTML( get_jpeg_intrinsic_values( $jpeg_header_data ) ),
    347422        'Val_Comment'=> Interpret_Comment_to_HTML( $jpeg_header_data ),
     
    353428        'Val_exif'=>  Interpret_EXIF_to_HTML( get_EXIF_JPEG( $filename ), $filename),
    354429        'Val_XMP' =>  Interpret_XMP_to_HTML( read_XMP_array_from_text( get_XMP_text( $jpeg_header_data) ) ),
    355           */ 
     430          */
    356431     //
    357432         ),
    358433 'Datadase' =>  ($Position) ,
    359434          ) );
    360 }
    361 
    362 function Memo_vars($variables)
    363 {
    364                 ob_start();
    365                 echo '<pre>';
    366                 print_r($variables);
    367                 echo '</pre>';
    368                 $m= ob_get_contents();
    369 
    370         ob_end_clean();
    371                 return $m;
    372                
    373 }
     435       
     436
     437          }
     438}
     439
     440
    374441  //=======================================================================
    375442function cl_make_map_picture_url($params)
     
    384451
    385452
    386 function Get_exif_gps($filename,$image)
    387 {
     453
     454function Get_exif_gps($firt_image,$image)
     455{
     456
    388457 error_reporting ( 1 );
     458 $filename=$firt_image;
     459 
    389460  $datas = array();
    390461  $errors = array();
    391         //     
    392 
    393      // $Exif_array =    get_EXIF_JPEG( $filename );     
    394      //  if ( empty($Exif_array) ) return;
    395 
    396      $exif = @read_exif_data( $filename ); 
    397462 
     463
     464  $exif = @read_exif_data( $filename ); 
     465global $errors;global $template ;
    398466
    399467      if ( empty($exif) ) return;
    400468         $exif = array_intersect_key( $exif, array_flip( array('GPSLatitudeRef', 'GPSLatitude', 'GPSLongitudeRef', 'GPSLongitude', 'GPSAltitudeRef', 'GPSAltitude') ) );
    401  
    402 
    403        error_reporting ( 1 );
    404        /*
    405  if ( count($exif)<4)
    406                         return;
    407  
    408 
    409      if ( !in_array($exif['GPSLatitudeRef'], array('S', 'N') ) )
    410                 {
    411                         $errors[] = $filename. ': GPSLatitudeRef not S or N';
    412                         return;
    413                 }
    414                 if ( !in_array($exif['GPSLongitudeRef'], array('W', 'E') ) )
    415                 {
    416                         $errors[] = $filename. ': GPSLongitudeRef not W or E';
    417                         return;
    418                 }
    419                 if (!is_array($exif['GPSLatitude']) or !is_array($exif['GPSLongitude']) )
    420                 {
    421                         $errors[] = $filename. ': GPSLatitude and GPSLongitude are not arrays';
    422                         return;
    423                 }       
    424 */
    425 
    426 
     469
     470//====================================================================
    427471    $lat = $image['lat'] ;         
    428472    $lon = $image['lon'] ;
    429     $alt=$image['alt'];
     473    $alt = $image['alt'];
     474    global $info_message ;
     475
     476$is_exif = "'".(is_array($exif['GPSLatitude']) and is_array($exif['GPSLongitude']) )."'" ;
     477 if ($is_exif) {
     478     $lat_exif = parse_lat_lon( $exif['GPSLatitude'] );         
     479     $lon_exif = parse_lat_lon( $exif['GPSLongitude'] );
     480     $alt_exif = Parse_Fract( $exif['GPSAltitude'] ); 
     481 }
    430482
    431483if ($lat =="")
    432 {
     484{  
    433485  $lat = Parse_Lat_Lon( $exif['GPSLatitude'] ); 
    434   if ( $exif['GPSLatitudeRef']=='S' )$lat = -$lat;
    435      $latDMS=$exif['GPSLatitude'][0] . " | " . $exif['GPSLatitude'][1]. " | " . $exif['GPSLatitude'][2] ;
    436 
     486  if ( $exif['GPSLatitudeRef']=='S' ) $lat = -$lat;
     487 
    437488}else{
    438 
     489    $is_exif="false" ;
    439490    if($lat<0)      $exif['GPSLatitudeRef']='S' ;
    440491        else        $exif['GPSLatitudeRef']='N' ;
    441         $latDMS=dec2dms($lat);
    442         $exif['GPSLatitude']= $latDMS ;
    443 }         
    444 global $errors;
    445 if (!is_array($exif['GPSLatitude']) or !is_array($exif['GPSLongitude']) )
    446                 {
    447                         $errors[] = $filename. ': GPSLatitude and GPSLongitude are not arrays';
    448                         //return;
    449                 }       
    450 
    451       if ($lon =="") {
     492       
     493     
     494}   
     495if ($lon =="") {
    452496       
    453             $lon = parse_lat_lon( $exif['GPSLongitude'] );
    454             $lonDMS= $exif['GPSLongitude'][0] . " | " . $exif['GPSLongitude'][1] . " | " . $exif['GPSLongitude'][2] ;
    455   if ( $exif['GPSLongitudeRef']=='W' ) $lon = -$lon;
     497                $lon = parse_lat_lon( $exif['GPSLongitude'] );
     498                if ( $exif['GPSLongitudeRef']=='W' ) $lon = -$lon;
    456499           }else{
    457500             if ($lon<0) $exif['GPSLongitudeRef'] ='W' ;
    458501             else $exif['GPSLongitudeRef'] ='E' ;
    459               $lonDMS=dec2dms($lon);
    460                  $exif['GPSLongitude']=$lonDMS ;
     502                 
    461503           }
    462504
    463            
    464 
     505   
     506 
    465507//=======================================================================         
    466508           $altref = 0;
     
    474516            $altref = $exif['GPSAltitudeRef'];
    475517        }
    476  //========================================================================           
    477 
     518 //========================================================================     
    478519                $datas[] = array (
     520            'is_exif' => $is_exif,
    479521            ' filename=' => $filename ,
    480522                        'id' =>    $image['id'] ,
     
    500542return $datas[0] ;
    501543}
    502 ?>
     544if ($info_message!="")
     545$template->assign('infos',$info_message);
     546if ($error_message!="")
     547$template->assign('errors',$error_message);
     548?>
  • extensions/edit_gmaps/admin/admin_edit.tpl

    r9377 r9412  
    22{* $Id: admin_edit.tpl  2011-01-03   *}
    33{if PHPWG_VERSION < 2.2 } {include
    4 file=$EDIT_RV_PATH_ABS|@cat:'header_2_1.tpl'} {else} {include file= $EDIT_RV_PATH_ABS|@cat:'header_2_2.tpl'}
     4file=$EDIT_CL_PATH_ABS|@cat:'header_2_1.tpl'} {else} {include file= $EDIT_CL_PATH_ABS|@cat:'header_2_2.tpl'}
    55{/if}
    66
     
    1111            {if isset($coordinates) && $coordinates.LAT <= 90 }
    1212                      var   coordinates={ldelim}
    13                  LAT:'{$coordinates.LAT}',
     13                          FILE:'$coordinates.filename',
     14                             LAT:'{$coordinates.LAT}',
    1415                 LON:'{$coordinates.LON}',
    1516                 ADRESSE:'{$coordinates.ADRESSE}',
     
    1920                 {else}
    2021             var    coordinates={ldelim}
    21                  LAT:' ',
     22                             FILE:'',
     23                             LAT:' ',
    2224                 LON:' ',
    2325                 ADRESSE:'{$coordinates.ADRESSE}',
     
    5254{/html_head}
    5355 
    54 
     56 {$file_name}
    5557 
    5658
     
    104106                                   <a href="{$thumbnail.U_MAP}" target="_blank">{$thumbnail.lat},{$thumbnail.lon}</a>
    105107                                 {/if}
    106                      {$thumbnail.file} 
     108                     {$thumbnail.file}
     109                                       
    107110                                </span>
    108111
     
    134137    <fieldset>   
    135138            <ul class="thumbnails">
    136                     {foreach from=$Selectthumbnails item=thumbnail}             
     139
     140                  {foreach from=$Selectthumbnails item=thumbnail}               
    137141                        <li><span class="wrap1">
    138142                                <label>
     
    149153                                {/if}
    150154                                {$thumbnail.file} 
     155                                 
    151156                                </span>
    152157                                </span>
    153                         </li>                   
     158                        </li>           
     159               
    154160                {/foreach}
    155161        </ul>
     
    158164    <label>{'command'|@translate}</label>
    159165
    160         <table>
    161             <td>
    162             <input class="cluetip" title="{'reset'|@translate}|{'hlp_line4'|@translate}."  type="submit" name="submit" value="{'reset'|@translate}" /><br />
    163             </td>
    164             <td>
    165         <input class="cluetip" title="{'selection'|@translate}|{'hlp_line3'|@translate}." type="submit" name="submit" value="{'selection'|@translate}" />
    166             </td>
    167         </table>
     166                <table>
     167                        <td>
     168                        <input class="cluetip" title="{'reset'|@translate}|{'hlp_line4'|@translate}."  type="submit" name="submit" value="{'reset'|@translate}" /><br />
     169                        </td>
     170                        <td>
     171                        <input class="cluetip" title="{'selection'|@translate}|{'hlp_line3'|@translate}." type="submit" name="submit" value="{'selection'|@translate}" />
     172                        </td>
     173                </table>
    168174
    169175        <label>{'Form'|@translate}</label>
    170176        <table >
    171         <td >
    172  
    173         <input class="cluetip" title="{'search_title'|@translate}|{'hlp_line6'|@translate}." type=button  value="{'search_title'|@translate}" id="search" />
    174 
    175         <input class="cluetip" title="{'lieu'|@translate}|{'hlp_line5'|@translate}." type="text" size="70"   value="{$match}"  name="match"   id="match"    />
    176         </td>
    177                 <table >
    178         <tr>   <input type="text" size="15" value="{$filename}"  name="filename" />
    179         <td >
    180         <label>Latitude (-90=S to 90=N)</label>
    181         <input type="text" size="15" value="{$lat}"  name="lat" />
    182         </td>
    183         <td>         
    184         <label>Longitude (-180=E to 180=W) </label>
    185         <input type="text" size="15"value="{$lon}"  name="lon"  />         
    186         </td>
    187         <td>         
    188         <label>Altitude </label>
    189                 <input type="hidden" size="2"value="0"  name="altRef"  />
    190         <input type="text" size="15"value="{$alt}"  name="alt"  /> <label> m </label>         
    191         </td>
    192         </tr>
     177                        <td >
     178 
     179                        <input class="cluetip" title="{'search_title'|@translate}|{'hlp_line6'|@translate}." type=button  value="{'search_title'|@translate}" id="search" />
     180
     181                        <input class="cluetip" title="{'lieu'|@translate}|{'hlp_line5'|@translate}." type="text" size="70"   value="{$match}"  name="match"   id="match"    />
     182                        </td>
    193183                </table>
    194                 <tr>
    195                 <table >
    196         <tr> 
    197         <td >
    198         <label>Latitude DMS</label><input type="text" size="3" value="{$latRef}"  name="latRef" />
    199         <input type="text" size="25" value="{$latDMS}"  name="latDMS" />
    200         </td>
    201         <td>         
    202         <label>Longitude DMS </label><input type="text" size="3" value="{$lonRef}"  name="lonRef" />
    203         <input type="text" size="25"value="{$lonDMS}"  name="lonDMS"  />         
    204         </td>
    205 
    206         </tr>
    207                 </table>
    208                 <tr>
    209 
    210         <td>
    211                 <input class="submit" type="submit" value="{'Submit'|@translate}" name="submit" {$tag_input_enabled} /></td>
    212         </td></tr>
     184                        <table style="display:none" >
     185
     186                                        {assign var="filename" value=""}
     187                                {foreach from=$Selectthumbnails item=thumbnail}
     188                                        {assign var="filename" value=$filename|@cat:$thumbnail.filename|@cat:";"}
     189                                {if  $thumbnail.lat<>0 }
     190                                        {if $thumbnail.lon<>0}
     191                                        {assign var="lon" value=$thumbnail.lon}
     192                                        {assign var="lat" value=$thumbnail.lat}
     193                                        {assign var="alt" value=$thumbnail.alt}
     194                 
     195                                {/if}
     196                                        {/if}
     197                                {/foreach}
     198
     199                                <input type="text" size="89" value="{$filename}"  name="filename" />
     200                        </table>
     201
     202                        <table>
     203                                <td >
     204                                        <label class="cluetip" title="{'latitude'|@translate}|{'hlp_latitude'|@translate}." > {'latitude'|@translate} </label>
     205                                        <input type="text" size="15" value="{$lat}"  name="lat" />
     206                                </td>
     207                                <td>         
     208                                        <label class="cluetip" title="{'longitude'|@translate}|{'hlp_longitude'|@translate}." > {'longitude'|@translate} </label>
     209                                        <input type="text" size="15"value="{$lon}"  name="lon"  />         
     210                                </td>
     211                                <td>         
     212                                <label class="cluetip" title="{'altitude'|@translate}|{'hlp_altitude'|@translate}."> Altitude </label>
     213                                        <input type="hidden" size="2"value="0"  name="altRef"  />
     214                                        <input type="text" size="15"value="{$alt}"  name="alt"  /> <label> m </label>         
     215                                </td>       
     216                        </table>
     217         
     218                        <table style=" display:none">       
     219                                <td  >
     220                                        <label>Latitude DMS</label><input type="text" size="3" value="{$latRef}"  name="latRef" />
     221                                        <input type="text" size="25" value="{$latDMS}"  name="latDMS" />
     222                                </td>
     223                                <td>         
     224                                        <label>Longitude DMS </label><input type="text" size="3" value="{$lonRef}"  name="lonRef" />
     225                                        <input type="text" size="25"value="{$lonDMS}"  name="lonDMS"  />         
     226                                </td>
     227                                <td>         
     228                                        <label>Altitude DMS </label><input type="text" size="3" value="{$altRef}"  name="altRef" />
     229                                        <input type="text" size="25"value="{$altDMS}"  name="altDMS"  />         
     230                                </td>       
     231                        </table>
     232
     233                <table>
     234                        <td>
     235                        <input class="submit cluetip" title="{'update_database'|@translate}|{'hlp_update_database'|@translate}." type="submit" value="{'update_database'|@translate}" name="submit" {$tag_input_enabled} /></td>
     236                        </td>
     237                        <td>
     238                        <input class="submit cluetip" title="{'update_exif'|@translate}|{'hlp_update_exif'|@translate}." type="submit" value="{'update_exif'|@translate}" name="update" {$tag_input_enabled} /></td>
     239                        </td>           
    213240        </table>
    214241    </fieldset>
     
    223250    </fieldset>
    224251  </fieldset>
     252
     253
     254
     255</fieldset>
     256
    225257</form>
    226258
    227  <fieldset style="display:none">
    228 <form name="EditJPEG" id="EditJPEG" action="{$EDIT_RV_PATH}Write_File_Info_Gps.php" method="post">
    229   <input name="filename" size="60" id="filename" name="filename" type="test" value="../../../{$filename}"  />
    230   <table>
    231     <tr>
    232         <td>
    233             Latitude Ref
    234         </td>
    235         <td>
    236               <input size="60" id="latRef" name="GPSLatitudeRef" type="text" value="{$latRef}">
    237         </td>
    238      
    239         <td>
    240             Latitude
    241         </td>
    242         <td>
    243              <input size="60" id="latDMS" name="GPSLatitude" type="text" value="{$latDMS}">   
    244         </td>
    245     </tr>
    246         <tr>
    247         <td>
    248             Longitude Ref
    249         </td>
    250         <td>
    251             <input size="60" id="lonRef" name="GPSLongitudeRef" type="text" value="{$lonRef}">
    252         </td>
    253  
    254         <td>
    255             Longitude
    256         </td>
    257         <td>
    258 <input size=60 id="lonDMS" name="GPSLongitude" type=\"text\" value="{$lonDMS}">
    259         </td>
    260     </tr>
    261         <tr>
    262                        <td>
    263             Altitude Ref
    264         </td>
    265         <td>
    266 <input size=60 id="altRef" name="GPSAltitudeRef" type=\"text\" value="{$altRef}">
    267         </td>
    268         <td>
    269             Altitude
    270         </td>
    271         <td>
    272 <input size=60 id="alt" name="GPSAltitude" type=\"text\" value="{$alt}">
    273         </td>
    274     </tr>
    275 </table>
    276 <br>
    277 <input type="submit" value="Update!">
    278 </form>
    279 </fieldset>
     259 <fieldset >
  • extensions/edit_gmaps/admin/admin_edit_meta.php

    r9377 r9412  
    44load_language('lang', dirname(__FILE__).'/../');
    55$admin_url = PHPWG_ROOT_PATH.'admin.php';
    6 
    7 
    8 
    96if ( !isset($_GET['cat']) )   $_GET['cat'] = 'caddie';
    107$_GET['mode'] = 'map';
     
    2017
    2118/***********************************************************************************/
    22   if (!defined('TOOL_KIT_PATH')) define(  'TOOL_KIT_PATH',   EDIT_RV_PATH."admin/");
     19  if (!defined('TOOL_KIT_PATH')) define(  'TOOL_KIT_PATH',   EDIT_CL_PATH."admin/");
    2320  if (!defined('INCLUDE_PATH')) define(  'INCLUDE_PATH',   TOOL_KIT_PATH.'include/' );                     
    2421  $Toolkit_Dir =INCLUDE_PATH           ;   
    2522
    26    include $Toolkit_Dir . 'fonctions.php';
     23   include_once $Toolkit_Dir . 'fonctions.php';
    2724/***********************************************************************************/
    2825
     
    5552  }
    5653
    57   // test si mise à jour (valider)
    58   if ( isset($_POST['submit']) and  $_POST['submit'] == l10n('Submit') )
    59     {
    60           if ( count($collection)>0 )
    61           {
     54  //**************** mise a jour de la base de données **************************
     55  if (  $_POST['submit'] == l10n('update_database') ) {
     56          if ( count($collection)>0 )  {
    6257                $lat = trim($_POST['lat']);
    6358                $lon = trim($_POST['lon']);
     
    7166                  else
    7267                        $page['errors'][] = 'Invalid lat or lon value';
    73                 }
    74                 elseif ( strlen($lat)==0 and strlen($lon)==0 )
     68                }else if ( strlen($lat)==0 and strlen($lon)==0 )
    7569                  $update_query = 'lat=NULL, lon=NULL';
    7670                else
     
    9286                  cl_meta_invalidate_cache();
    9387                }
    94           }
    95         }
    96 }
     88          } 
     89
     90        }// fin test update
     91
     92} // fin post
    9793
    9894
     
    180176
    181177//==========================================================
    182         if (!defined('EDIT_RV_PATH')) define(  'EDIT_RV_PATH',  EDIT_RV_PATH .'admin/' );
    183         $path = EDIT_RV_PATH;
     178        if (!defined('EDIT_CL_PATH')) define(  'EDIT_CL_PATH',  EDIT_CL_PATH .'admin/' );
     179        $path = EDIT_CL_PATH;
    184180    $plg_data = implode( '', file($path.'main.inc.php') );
    185181         if (preg_match("|Version: (.*)|", $plg_data, $val))
    186           { $EDIT_RV_PATH_plugin['version'] = trim($val[1]);  } 
    187             $EDIT_RV_PATH_plugin = array_map('htmlspecialchars', $EDIT_RV_PATH_plugin);
    188             $version= $EDIT_RV_PATH_plugin['version'] ;
     182          { $EDIT_CL_PATH_plugin['version'] = trim($val[1]);  } 
     183            $EDIT_CL_PATH_plugin = array_map('htmlspecialchars', $EDIT_CL_PATH_plugin);
     184            $version= $EDIT_CL_PATH_plugin['version'] ;
    189185            $icon_path = 'themes/default/icon/help.png';
    190186            $path_js=  'themes/default/js/' ;
     
    194190if ( isset($_POST['submit'])   )
    195191{       
     192
     193  if ($_POST['submit']==l10n('update') )
     194   {
     195      $_POST['selection']=array(); 
     196      $collection =array();
     197          unset($collection);
     198  }
    196199
    197200  if ($_POST['submit']==l10n('Submit') )
     
    214217$src="";
    215218$template->assign(
    216     array(      'EDIT_RV_PATH' => EDIT_RV_PATH,
     219    array(      'EDIT_CL_PATH' => EDIT_CL_PATH,
    217220                'path_js' => $path_js,
    218221            'VERSION'=> $version,
    219             'EDIT_RV_PATH_ABS' => dirname(__FILE__).'/',
     222            'EDIT_CL_PATH_ABS' => dirname(__FILE__).'/',
    220223              )
    221224  );
  • extensions/edit_gmaps/admin/admin_edit_meta.tpl

    r9377 r9412  
    22{* $Id: admin_edit.tpl  2011-01-03   *}
    33{if PHPWG_VERSION < 2.2 } {include
    4 file=$EDIT_RV_PATH_ABS|@cat:'header_2_1.tpl'} {else} {include file= $EDIT_RV_PATH_ABS|@cat:'header_2_2.tpl'}
     4file=$EDIT_CL_PATH_ABS|@cat:'header_2_1.tpl'} {else} {include file= $EDIT_CL_PATH_ABS|@cat:'header_2_2.tpl'}
    55{/if}
    66
     
    226226<fieldset   id ="metadata"  class="fieldset">
    227227<legend>{'Metadata'|@translate}</legend>
    228 <h4><a href="{$EDIT_RV_PATH}Edit_File_gps.php?jpeg_fname={$filename_abs}" >
     228<h4><a href="{$EDIT_CL_PATH}Edit_File_gps.php?jpeg_fname={$filename_abs}" >
    229229Click here to edit the Photoshop File Info for this file</a></h4>{$filename_abs}</fieldset>
    230230<table>
     
    240240
    241241 <fieldset>
    242 <form name="EditJPEG" id="EditJPEG" action="{$EDIT_RV_PATH}Write_File_Info_Gps.php" method="post">
     242<form name="EditJPEG" id="EditJPEG" action="{$EDIT_CL_PATH}Write_File_Info_Gps.php" method="post">
    243243  <input name="filename" size="60" id="filename" name="filename" type="test" value="../../../{$filename}"  />
    244244  <table>
  • extensions/edit_gmaps/admin/header_2_1.tpl

    r9377 r9412  
    1 {known_script id="jquery" src=$ROOT_URL|@cat:"themes/default/js/jquery.packed.js" now=0}
     1{known_script id="jquery" src=$ROOT_URL|@cat:"themes/default/js/jquery.js" now=0}
    22{known_script id="jquery.cluetip" src=$ROOT_URL|@cat:"themes/default/js/plugins/jquery.cluetip.packed.js"}
    33{known_script id="jquery.ui" src=$ROOT_URL|@cat:"themes/default/js/ui/ui.core.js"}
    44{known_script id="jquery.ui.resizable" src=$ROOT_URL|@cat:"themes/default/js/ui/ui.resizable.js"}
    5 {known_script id="EDIT_RV_script" src=$EDIT_RV_PATH|@cat:"admin/js/JScript.js"}
    6 {known_script id="fieldset" src=$EDIT_RV_PATH|@cat:"admin/js/fieldset.js"}
     5{known_script id="EDIT_RV_script" src=$EDIT_CL_PATH|@cat:"admin/js/JScript.js"}
     6{known_script id="fieldset" src=$EDIT_CL_PATH|@cat:"admin/js/fieldset.js"}
  • extensions/edit_gmaps/admin/header_2_2.tpl

    r9377 r9412  
    11{combine_script id="jquery" load="header" path = $ROOT_URL|@cat:"themes/default/js/jquery.js"}
    22{combine_script id="jquery.cluetip" path = $ROOT_URL|@cat:"themes/default/js/plugins/jquery.cluetip.js" require="jquery" }
    3 {combine_script id="jquery.ui" path=$ROOT_URL|@cat:"themes/default/js/ui/ui.core.js" require="jquery"}
    4 {combine_script id="jquery.ui.resizable" path=$ROOT_URL|@cat:"themes/default/js/ui/ui.resizable.js" require="jquery,jquery.ui"}
    5 {combine_script id="jquery.ui.slider" path=$ROOT_URL|@cat:"themes/default/js/ui/ui.slider.js" require="jquery,jquery.ui"}
    6 {combine_script id="jquery.ui.draggable" path=$ROOT_URL|@cat:"themes/default/js/ui/ui.draggable.js" require="jquery,jquery.ui"}
     3{combine_script id="jquery.ui" path=$ROOT_URL|@cat:"themes/default/js/ui/jquery.ui.core.js" require="jquery"}
     4{combine_script id="jquery.ui.resizable" path=$ROOT_URL|@cat:"themes/default/js/ui/jquery.ui.resizable.js" require="jquery,jquery.ui"}
     5{combine_script id="jquery.ui.slider" path=$ROOT_URL|@cat:"themes/default/js/ui/jquery.ui.slider.js" require="jquery,jquery.ui"}
     6{combine_script id="jquery.ui.draggable" path=$ROOT_URL|@cat:"themes/default/js/ui/jquery.ui.draggable.js" require="jquery,jquery.ui"}
    77
    88
    9 {combine_script id="EDIT_RV_script" path=$EDIT_RV_PATH|@cat:"admin/js/JScript.js" require="jquery"}
    10 {combine_script id="fieldset" path=$EDIT_RV_PATH|@cat:"admin/js/fieldset.js" require="jquery"}
     9{combine_script id="EDIT_RV_script" path=$EDIT_CL_PATH|@cat:"admin/js/JScript.js" require="jquery"}
     10{combine_script id="fieldset" path=$EDIT_CL_PATH|@cat:"admin/js/fieldset.js" require="jquery"}
  • extensions/edit_gmaps/admin/include/fonctions.php

    r9377 r9412  
    114114  return $nd[0]/$nd[1];
    115115}
    116 
    117 
     116 
    118117function Parse_Lat_Lon( $arr )
    119118{
  • extensions/edit_gmaps/admin/js/JScript.js

    r9377 r9412  
    8989                                                updateMarkerStatus('Drag ended');
    9090                                                getElevation({ 'latLng': marker.getPosition() });
    91                                                 document.Envoie.alt.value = coordinates.ALT;
     91                                               
    9292
    9393                                            }
     
    103103                       geocodePosition(LatLng);
    104104                       getElevation({ 'latLng': marker.getPosition() });
    105                        document.Envoie.alt.value = coordinates.ALT;
     105                     
    106106                  return false;
    107107   
     
    120120                document.Envoie.lon.value = latLng.lng();
    121121                dms_frac = dec2dms(latLng.lng());
    122                 if (dms_frac.Degre < 0)
    123                     document.Envoie.lonRef.value = "W";
    124                 else
    125                     document.Envoie.lonRef.value = "E";
     122                if (document.Envoie.lon.value < 0) 
     123                document.Envoie.lonRef.value = "W";
     124                else                     
     125                document.Envoie.lonRef.value = "E";
    126126                document.Envoie.lonDMS.value = Math.abs(dms_frac.Degre) +"/1" + " " + dms_frac.Minute +"/1" + " " +    dms_frac.Numerator + "/" + dms_frac.Denominator;
    127127                dms_frac = dec2dms(latLng.lat());
    128                 if (dms_frac.Degre < 0)
     128                if (document.Envoie.lat.value < 0)
    129129                    document.Envoie.latRef.value = "S";
    130130                else
    131131                    document.Envoie.latRef.value = "N";
    132132                document.Envoie.latDMS.value = Math.abs(dms_frac.Degre) + "/1" + " " + dms_frac.Minute + "/1" + " " + dms_frac.Numerator + "/" + dms_frac.Denominator;
    133                 update_datas();
     133              //  update_datas();
    134134            }
    135135
     
    197197                                coordinates.ALT = results[0].elevation;
    198198                                document.Envoie.alt.value = coordinates.ALT;
    199                                 update_datas();
    200                                    //styleIcon.set("text", "Elevation: " + results[0].elevation + "m");
     199                                altDMS = dec2frac(coordinates.ALT);
     200                                document.Envoie.altRef.value = "0";
     201                                document.Envoie.altDMS.value =  altDMS.Numerator + "/" +  altDMS.Denominator;
     202                                //styleIcon.set("text", "Elevation: " + results[0].elevation + "m");
    201203                            } else {
    202                                // alert("No results found");
     204                                // alert("No results found");
    203205                            }
    204206                        } else {
Note: See TracChangeset for help on using the changeset viewer.