Ignore:
Timestamp:
Apr 5, 2011, 12:45:03 PM (13 years ago)
Author:
cljosse
Message:

[extensions] edit_gmaps compatibility with piwigo 2.2

Location:
extensions/edit_gmaps/admin
Files:
6 edited

Legend:

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

    r9412 r10060  
    55$admin_url = PHPWG_ROOT_PATH.'admin.php';
    66
     7if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
     8 
     9/***********************************************************************************/
     10if (!defined('TOOL_KIT_PATH')) define(  'TOOL_KIT_PATH',   EDIT_CL_PATH."admin/");
     11if (!defined('INCLUDE_PATH')) define(  'INCLUDE_PATH',   TOOL_KIT_PATH.'include/' );                     
     12$Toolkit_Dir =INCLUDE_PATH           ;   
     13 
     14include $Toolkit_Dir . 'fonctions.php';
     15/***********************************************************************************/
     16$info_message="" ;
     17$error_message="";
     18 
     19/************* Mise à jour des meta données ***************/
     20if ( isset($_POST['update']) && $_POST['update']==l10n('update_exif')){
     21  $exif = @read_exif_data( $exif );     
     22  $exif = @array_intersect_key( $exif, array_flip( array('GPSLatitudeRef', 'GPSLatitude', 'GPSLongitudeRef', 'GPSLongitude', 'GPSAltitudeRef', 'GPSAltitude') ) );
     23
     24  // error_reporting ( 0 );
     25  // Hide any unknown EXIF tags       
     26  $GLOBALS['HIDE_UNKNOWN_TAGS'] = FALSE;
     27  include $Toolkit_Dir.'Toolkit_Version.php';   // Change: added as of version 1.11
     28    // Include the required files for reading and writing Photoshop File Info
     29  include  $Toolkit_Dir.'JPEG.php';
     30  include  $Toolkit_Dir.'XMP.php';
     31  include  $Toolkit_Dir.'Photoshop_IRB.php';
     32  include  $Toolkit_Dir.'EXIF.php';
     33  include  $Toolkit_Dir.'GPS_File_Info.php';
     34  $GLOBALS['HTTP_POST_VARS']=$_POST ;
     35  // Copy all of the HTML Posted variables into an array
     36  $new_ps_file_info_array = $GLOBALS['HTTP_POST_VARS'];
     37  // Some characters are escaped with backslashes in HTML Posted variable
     38  // Cycle through each of the HTML Posted variables, and strip out the slashes '
     39  foreach( $new_ps_file_info_array as $var_key => $var_val ){
     40    if ($var_key !="selection")
     41        $new_ps_file_info_array[ $var_key ] = stripslashes( $var_val );                           
     42  }         
     43  $new_ps_file_info_array['selection'] = explode(";",$new_ps_file_info_array['filename']);
     44  foreach( $new_ps_file_info_array['selection']  as $filename )   {
     45    //======================================================
     46    //= $new_ps_file_info_array[ 'filename' ];
     47    if($filename!="") {   // Protect against hackers editing other files                               
     48      // copy( $filename,  $filename.".bak" ); 
     49      $path_parts = pathinfo( $filename );   
     50      if(1) {
     51        if ( strcasecmp( $path_parts["extension"], "jpg" ) != 0 ) {
     52          $error_message .= $filename ;                                 
     53          $error_message .="Incorrect File Type - JPEG Only\n";
     54          $filename="";
     55          //  exit( );
     56         }
     57        // Change: removed limitation on file being in current directory - as of version 1.11
     58        // Retrieve the header information
     59        $jpeg_header_data = get_jpeg_header_data( $filename );
     60        // Retreive the EXIF, XMP and Photoshop IRB information from
     61        // the existing file, so that it can be updated
     62        $Exif_array = get_EXIF_JPEG( $filename );
     63        $XMP_array = read_XMP_array_from_text( get_XMP_text( $jpeg_header_data ) );
     64        $IRB_array = get_Photoshop_IRB( $jpeg_header_data );
     65
     66        // Update the JPEG header information with the new Photoshop File Info
     67        $jpeg_header_data = put_GPS_file_info( $jpeg_header_data, $new_ps_file_info_array, $Exif_array, $XMP_array, $IRB_array );
     68        // Check if the Update worked
     69        if ( $jpeg_header_data == FALSE ) {
     70            // Update of file info didn''t work - output error message
     71            $error_message .= "jpeg_header_data
     72            Error - Failure update Photoshop File Info : $filename <br>\n";
     73            // Output HTML with the form and data which was
     74            // sent, to allow the user to fix it
     75          }else if ( FALSE == put_jpeg_header_data(  $filename, $filename, $jpeg_header_data ) ) {
     76            // Attempt to write the new JPEG file
     77            // Writing of the new file didn''t work - output error message
     78            $error_message .= "Error - Failure to write new JPEG : $filename <br>\n";
     79            // Output HTML with the form and data which was
     80            // sent, to allow the user to fix it
     81          }else{
     82            $info_message .= l10n('update') . " Exif: " . $filename . " " .  l10n('OK') ."<br />" ;
     83          }   
     84          $_POST['submit']= l10n('update_database') ;
     85        }
     86      }
     87    }
     88    $_POST['update'] ="ok";
     89  }
     90/****************************************************************/
    791if ( !isset($_GET['cat']) )   $_GET['cat'] = 'caddie';
    892$_GET['mode'] = 'map';
    9 if (PHPWG_VERSION < 2.2 )
    10  include (PHPWG_ROOT_PATH.'admin/element_set.php');
    11 else
    12 include (dirname(__FILE__).'\element_set.php');
    13 
    14 
    15                                
    16 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    17 
    18 
    19 /***********************************************************************************/
    20   if (!defined('TOOL_KIT_PATH')) define(  'TOOL_KIT_PATH',   EDIT_CL_PATH."admin/");
    21   if (!defined('INCLUDE_PATH')) define(  'INCLUDE_PATH',   TOOL_KIT_PATH.'include/' );                     
    22   $Toolkit_Dir =INCLUDE_PATH           ;   
    23 
    24    include $Toolkit_Dir . 'fonctions.php';
    25 /***********************************************************************************/
    26 
    27  
    28 $template->concat('TABSHEET_TITLE', ' '.l10n_dec('%d image', '%d images', count($page['cat_elements_id'])).' - '.$page['title']);
    29 $info_message="" ;
    30 $error_message="";
    31 
    32 /************* Mise à jour des meta données ***************/
    33 if ( 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();
     93if (PHPWG_VERSION < 2.2 ) {
     94 include (PHPWG_ROOT_PATH.'admin/element_set.php');                             
     95 } else {
     96if (!isset($page['title'])) $page['title']="";
     97    include (PHPWG_ROOT_PATH.'admin/batch_manager.php');                 
     98    $template->concat('TABSHEET_TITLE', ' '.l10n_dec('%d image', '%d images', count($page['cat_elements_id'])).' - '.$page['title']);
     99   }   
     100
     101if ( isset($_POST['submit'])  ) {
     102        $collection = array();
    118103                if( !isset ($_POST['target'])) {
    119104                    $_POST['submit'] = l10n('Submit') ;
     
    122107               }
    123108
    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']);
    145  
    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)
     109  switch ($_POST['target'])
     110  {
     111    case 'all' :
     112      $collection = $page['cat_elements_id'];
     113      break;
     114    case 'selection' :
     115      if (!isset($_POST['selection']) or count($_POST['selection']) == 0)
     116        array_push($page['errors'], l10n('Select at least one photo'));
     117      else
     118        $collection = $_POST['selection'];
     119      break;
     120  }
     121
     122  /******** Mise à jour base de données *****/
     123   if (   $_POST['submit'] == l10n('update_database') ){
     124        if ( count($collection)>0 ){
     125    $lat = trim($_POST['lat']);
     126    $lon = trim($_POST['lon']);
     127        $alt = trim($_POST['alt']);
     128
     129    if ( strlen($lat)>0 and strlen($lon)>0 ) {
     130      if ( (double)$lat<=90 and (double)$lat>=-90
     131          and (double)$lon<=180 and (double)$lat>=-180 )
     132        $update_query = 'lat='.$lat.', lon='.$lon;
     133      else
     134        $page['errors'][] = 'Invalid lat or lon value';
     135    }
     136    elseif ( strlen($lat)==0 and strlen($lon)==0 )
     137      $update_query = 'lat=NULL, lon=NULL';
     138    else
     139      $page['errors'][] = 'Both lat/lon must be empty or not empty';
     140
     141              if ( strlen($alt)==0)
    160142                     $update_query .= ', alt=NULL';
    161143                  else
    162144                     $update_query .= ', alt=' .$alt ;
    163145
    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                 }
    177 }
    178 
    179 
    180 $template->append(
    181   'specials',
    182   array(
    183                 $admin_url.get_query_string_diff(array('start','cat')).'&amp;cat=caddie' => l10n('Caddie')
    184     ),
    185         true
    186   );
    187 
     146        if (isset($update_query)){
     147      $update_query = '
     148                UPDATE '.IMAGES_TABLE.' SET '.$update_query.'
     149                WHERE id IN ('.implode(',',$collection).')';
     150        pwg_query($update_query);
     151                cl_meta_invalidate_cache();
     152                $info_message .= l10n('update') . " " . IMAGES_TABLE . " : " .  l10n('OK') ;
     153                $_POST['submit'] = l10n('Submit') ;
     154     }
     155    }
     156  }
     157 }
     158/**************************************/
     159$specials_selected = null;
     160foreach( array('caddie'=>'Caddie', 'recent'=>'Recent photos') as $k => $v)
     161{
     162        $link = $admin_url.get_query_string_diff(array('start','cat')).'&amp;cat='.$k;
     163        $template->append(
     164                'specials',
     165                array(
     166                        $link => l10n($v),
     167                        ),
     168                true
     169                );
     170        if ($k == $_GET['cat']) $specials_selected = $link;
     171}
     172$template->assign('specials_selected', $specials_selected);
     173/****************************************/
    188174$query = '
    189175SELECT id,name,uppercats,global_rank
     
    321307if (isset($_POST['submit']) and $_POST['submit']==l10n('selection' ))
    322308{
    323     if (isset($collection))     
    324         {  $lat =1000;$first_image="";
    325                            
    326             foreach ($collection as $id_0)  {
    327                         foreach ($images as $image)  {
    328                                 if (array_search($id_0,$image)) {
    329                                     $_POST['selection'] = $collection ;   
    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) {
    336                             $lat= ($image['lat'] <> '') ? $image['lat'] : '100'  ;
    337                                 $lon= ($image['lon']  <> '') ? $image['lon'] : '3.0'  ;
    338                 $alt= ($image['alt']  <> '') ? $image['alt'] : '0'  ;
    339                                 if($lat != '100') $lat=$image['lat'];
    340                                 //=====================================================
    341                                 $template->assign( 'coordinates',
    342                                                    array('FILE' => $image['path'],
    343                                          'LAT' =>   $lat  ,
     309  if (isset($collection)) { 
     310    $lat =1000;$first_image="";                           
     311    foreach ($collection as $id_0)  {
     312                foreach ($images as $image) {
     313                        if (array_search($id_0,$image)) {
     314            $_POST['selection'] = $collection ;   
     315            $infos_gps=  Get_exif_gps( $image['path'],$image) ;   
     316            $image['lat']=$infos_gps['lat'];
     317            $image['lon']=$infos_gps['lon'];
     318            $image['alt']=$infos_gps['alt'];
     319            if ($lat==1000) {
     320                                $lat= ($image['lat'] <> '') ? $image['lat'] : '100'  ;
     321                                      $lon= ($image['lon']  <> '') ? $image['lon'] : '3.0'  ;
     322              $alt= ($image['alt']  <> '') ? $image['alt'] : '0'  ;
     323                                      if($lat != '100') $lat=$image['lat'];
     324                                      //=====================================================
     325                                      $template->assign( 'coordinates',
     326                                             array('FILE' => $image['path'],
     327                     'LAT' =>   $lat  ,
    344328                                                                                 'LON' =>   $lon  ,
    345329                                                                                 'ADRESSE' =>  $adresse ,
    346330                                                                                 'ZOOM' => 4,
    347                                          'ALT' =>   $alt ,
     331                     'ALT' =>   $alt ,
    348332                                                                                )
    349333                                                                        );
     
    361345                                    $image,
    362346                                        array(
    363                            'filename' =>  $image['path'],
    364                            'exif' => $infos_gps['is_exif'] ,
    365                                                    'lat'  =>    $image['lat']    ,
    366                                                    'lon' =>     $image['lon']    ,
    367                            'alt' =>     $image['alt']    ,
    368                            'latDMS' =>    $latDMS[3]     ,
    369                            'lonDMS' =>   "-->".$lonDMS[3]     ,
    370                                                    'adresse' =>  $adresse   ,
    371                                                 'U_TN' => get_thumbnail_url($image),
    372                                                 'TITLE' => get_thumbnail_title($image),
    373                                                         'U_MAP' => cl_make_map_picture_url(
     347                  'filename' =>  $image['path'],
     348                  'exif' => $infos_gps['is_exif'] ,
     349                  'lat'  =>    $image['lat']    ,
     350                  'lon' =>     $image['lon']    ,
     351                  'alt' =>     $image['alt']    ,
     352                  'latDMS' =>    $latDMS[3]     ,
     353                  'lonDMS' =>   "-->".$lonDMS[3]     ,
     354                  'adresse' =>  $adresse   ,
     355                  'U_TN' => get_thumbnail_url($image),
     356                  'TITLE' => get_thumbnail_title($image),
     357                                                            'U_MAP' => cl_make_map_picture_url(
    374358                                                                                            array(
    375359                                                                                                 'image_id'=>$image['id'],
    376360                                                                                                 'image_file'=>$image['file'],
    377361                                                                                                 )
    378 
    379362                                                                                    ),
    380                                                                 )                                                               
    381                                                 );
    382          
     363                                                                  )                                                             
     364                                                );       
    383365                                $template->append('Selectthumbnails', $tpl_var);                       
    384366                        }
     
    392374 if ( !empty($first_image))
    393375 { $error_message .= cl_edit_controler::Memo_Vars($first_image);
    394  if (isset($_POST['update']))
    395  {
     376 if (isset($_POST['update'])) {
    396377// document.Envoie.latDMS.value
    397        
    398 
    399378        $image= first_image ;
    400379        $filename=$image['path'] ;
    401380        $Val_exif="";
    402         $Val_XMP="";   
    403 
    404  
    405        
     381        $Val_XMP="";           
    406382   /*  */   
    407383     if (!empty($infos_gps))
    408384     $Position = $infos_gps ;
    409 
    410385     else  $Position =  Get_exif_gps($filename,$image) ;
    411 
    412 
    413 
    414386
    415387  $jpeg_header_data = get_jpeg_header_data($filename );
  • extensions/edit_gmaps/admin/admin_edit.tpl

    r9412 r10060  
    11{html_head}
    22{* $Id: admin_edit.tpl  2011-01-03   *}
    3 {if PHPWG_VERSION < 2.2 } {include
    4 file=$EDIT_CL_PATH_ABS|@cat:'header_2_1.tpl'} {else} {include file= $EDIT_CL_PATH_ABS|@cat:'header_2_2.tpl'}
     3{if PHPWG_VERSION < 2.2 }
     4{include file=$EDIT_CL_PATH_ABS|@cat:'header_2_1.tpl'}
     5{else}
     6{include file= $EDIT_CL_PATH_ABS|@cat:'header_2_2.tpl'}
    57{/if}
    68
     
    8183        | <a href="{$U_DISPLAY}&amp;display=all">{'all'|@translate}</a>
    8284        </p>
    83     </fieldset>
    84  {if  empty($Selectthumbnails) }{/if}
    85 
     85    </fieldset>
    8686
    8787<form action="" method="post" id="Envoie" name="Envoie"   >
     
    8989
    9090<fieldset  id="Elements"  class="fieldset">
    91         <legend>{'Elements'|@translate}</legend>
    92 
    93     {if !empty($navbar) }{include file='navigation_bar.tpl'} {/if}
     91        <legend>{'Elements'|@translate}
     92    {if !empty($navbar) }{include file='navigation_bar.tpl'} {/if}</legend>
    9493        <fieldset >   
    9594                <ul class="thumbnails">
     
    121120        <td><label><input type="radio" name="target" value="all" /> {'all'|@translate}</label></td>
    122121        <td><label><input type="radio" name="target" value="selection" checked="checked" /> {'selection'|@translate}</label></td>
    123         <td><input class="cluetip submit " title="{'selection'|@translate}|{'hlp_line3'|@translate}." type="submit" name="submit" value="{'selection'|@translate}"  {$tag_input_enabled} /></td>
    124         </table>
    125     </fieldset>
     122        <input class="cluetip submit" title="{'selection'|@translate}|{'hlp_line3'|@translate}." type="submit" name="submit" value="{'selection'|@translate}"   />
     123</table>
     124        </fieldset>
    126125</fieldset>
    127126 <script>
    128    {if empty($Selectthumbnails)  }
    129  
    130    var no_affiche=true ;
    131    {else}
    132    var no_affiche=false ;
    133    {/if} </script>
    134 <fieldset   id ="geoposition"  class="fieldset">
     127
     128   {if empty($Selectthumbnails)  }   
     129   var no_affiche="false" ;
     130   {else} 
     131   var no_affiche="true" ;
     132   {/if}
     133   </script>
     134
     135<fieldset   id ="geoposition"  class="fieldset" >
    135136<legend>{'Selection'|@translate}</legend>
    136137 
     
    166167                <table>
    167168                        <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}" />
     169                        <input class="cluetip submit" title="{'reset'|@translate}|{'hlp_line4'|@translate}."
     170        type="submit" name="submit" value="{'reset'|@translate}" /><br />
     171                        </td>
     172                        <td>
     173                        <input class="cluetip submit" title="{'selection'|@translate}|{'hlp_line3'|@translate}."
     174        type="submit" name="submit" value="{'selection'|@translate}" />
    172175                        </td>
    173176                </table>
     
    233236                <table>
    234237                        <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>
     238                        <input class="cluetip submit" title="{'update_database'|@translate}|{'hlp_update_database'|@translate}." type="submit" value="{'update_database'|@translate}" name="submit" {$tag_input_enabled} /></td>
     239                        </td>
     240                        <td>
     241                        <input class="cluetip submit" title="{'update_exif'|@translate}|{'hlp_update_exif'|@translate}." type="submit" value="{'update_exif'|@translate}" name="update" {$tag_input_enabled} /></td>
    239242                        </td>           
    240243        </table>
  • extensions/edit_gmaps/admin/header_2_2.tpl

    r9665 r10060  
    11{combine_script id="jquery" load="header" path = $ROOT_URL|@cat:"themes/default/js/jquery.min.js "}
    2 {combine_script id="jquery.cluetip" path = $ROOT_URL|@cat:"themes/default/js/plugins/jquery.cluetip.js" require="jquery" }
    3 
    4 {combine_script id="EDIT_RV_script" path=$EDIT_CL_PATH|@cat:"admin/js/JScript.js" require="jquery"}
    5 {combine_script id="fieldset" path=$EDIT_CL_PATH|@cat:"admin/js/fieldset.js" require="jquery"}
     2{combine_script id="jquery.cluetip" path = $ROOT_URL|@cat:"themes/default/js/plugins/jquery.cluetip.js" require="jquery" }
     3{combine_script id="EDIT_RV_script" load="footer" path=$EDIT_CL_PATH|@cat:"admin/js/JScript.js" require="jquery"}
     4 {combine_script id="fieldset" load="footer" path=$EDIT_CL_PATH|@cat:"admin/js/fieldset.js" require="jquery"}
  • extensions/edit_gmaps/admin/include/EXIF.php

    r9412 r10060  
    118118function get_EXIF_JPEG( $filename )
    119119{
     120global $error_message ;
    120121        // Change: Added as of version 1.11
    121122        // Check if a wrapper is being used - these are not currently supported (see notes at top of file)
     
    123124        {
    124125                // A HTTP or FTP wrapper is being used - show a warning and abort
    125                 echo "HTTP and FTP wrappers are currently not supported with EXIF - See EXIF functionality documentation - a local file must be specified<br>";
    126                 echo "To work on an internet file, copy it locally to start with:<br><br>\n";
    127                 echo "\$newfilename = tempnam ( \$dir, \"tmpexif\" );<br>\n";
    128                 echo "copy ( \"http://whatever.com\", \$newfilename );<br><br>\n";
     126                $error_message .= "HTTP and FTP wrappers are currently not supported with EXIF - See EXIF functionality documentation - a local file must be specified<br>";
     127                $error_message .= "To work on an internet file, copy it locally to start with:<br><br>\n";
     128                $error_message .= "\$newfilename = tempnam ( \$dir, \"tmpexif\" );<br>\n";
     129                $error_message .= "copy ( \"http://whatever.com\", \$newfilename );<br><br>\n";
    129130                return FALSE;
    130131        }
     
    167168        {
    168169                // Could't open the file - exit
    169                 echo "<p>Could not open file $filename</p>\n";
     170                $error_message .= "<p>Could not open file $filename</p>\n";
    170171                return FALSE;
    171172        }
     
    296297function get_Meta_JPEG( $filename )
    297298{
     299global $error_message ;
    298300        // Change: Added as of version 1.11
    299301        // Check if a wrapper is being used - these are not currently supported (see notes at top of file)
     
    301303        {
    302304                // A HTTP or FTP wrapper is being used - show a warning and abort
    303                 echo "HTTP and FTP wrappers are currently not supported with Meta - See EXIF/Meta functionality documentation - a local file must be specified<br>";
    304                 echo "To work on an internet file, copy it locally to start with:<br><br>\n";
    305                 echo "\$newfilename = tempnam ( \$dir, \"tmpmeta\" );<br>\n";
    306                 echo "copy ( \"http://whatever.com\", \$newfilename );<br><br>\n";
     305                $error_message .= "HTTP and FTP wrappers are currently not supported with Meta - See EXIF/Meta functionality documentation - a local file must be specified<br>";
     306                $error_message .= "To work on an internet file, copy it locally to start with:<br><br>\n";
     307                $error_message .= "\$newfilename = tempnam ( \$dir, \"tmpmeta\" );<br>\n";
     308                $error_message .= "copy ( \"http://whatever.com\", \$newfilename );<br><br>\n";
    307309                return FALSE;
    308310        }
     
    345347        {
    346348                // Could't open the file - exit
    347                 echo "<p>Could not open file $filename</p>\n";
     349                $error_message .= "<p>Could not open file $filename</p>\n";
    348350                return FALSE;
    349351        }
     
    472474function get_EXIF_TIFF( $filename )
    473475{
     476global $error_message ;
    474477        // Change: Added as of version 1.11
    475478        // Check if a wrapper is being used - these are not currently supported (see notes at top of file)
     
    477480        {
    478481                // A HTTP or FTP wrapper is being used - show a warning and abort
    479                 echo "HTTP and FTP wrappers are currently not supported with TIFF - See EXIF/TIFF functionality documentation - a local file must be specified<br>";
    480                 echo "To work on an internet file, copy it locally to start with:<br><br>\n";
    481                 echo "\$newfilename = tempnam ( \$dir, \"tmptiff\" );<br>\n";
    482                 echo "copy ( \"http://whatever.com\", \$newfilename );<br><br>\n";
     482                $error_message .= "HTTP and FTP wrappers are currently not supported with TIFF - See EXIF/TIFF functionality documentation - a local file must be specified<br>";
     483                $error_message .= "To work on an internet file, copy it locally to start with:<br><br>\n";
     484                $error_message .= "\$newfilename = tempnam ( \$dir, \"tmptiff\" );<br>\n";
     485                $error_message .= "copy ( \"http://whatever.com\", \$newfilename );<br><br>\n";
    483486                return FALSE;
    484487        }
     
    491494        {
    492495                // Could't open the file - exit
    493                 echo "<p>Could not open file $filename</p>\n";
     496                $error_message .= "<p>Could not open file $filename</p>\n";
    494497                return FALSE;
    495498        }
     
    11281131function read_Multiple_IFDs( $filehnd, $Tiff_offset, $Byte_Align, $Tag_Definitions_Name, $local_offsets = FALSE, $read_next_ptr = TRUE )
    11291132{
     1133global $error_message ;
    11301134        // Start at the offset of the first IFD
    11311135        $Next_Offset = 0;
     
    11401144                {
    11411145                        // Error seeking to position of next IFD
    1142                         echo "<p>Error: Corrupted EXIF</p>\n";
     1146                        $error_message .= "<p>Error: Corrupted EXIF</p>\n";
    11431147                        return FALSE;
    11441148                }
     
    11891193function read_IFD_universal( $filehnd, $Tiff_offset, $Byte_Align, $Tag_Definitions_Name, $local_offsets = FALSE, $read_next_ptr = TRUE )
    11901194{
     1195global $error_message ;
     1196
    11911197        if ( ( $filehnd == NULL ) || ( feof( $filehnd ) ) )
    11921198        {
     
    12101216        {
    12111217                // Huge number of entries - abort
    1212                 echo "<p>Error: huge number of EXIF entries - EXIF is probably Corrupted</p>\n";
     1218                $error_message .= "<p>".$No_Entries."Error: huge number of EXIF entries - EXIF is probably Corrupted</p>\n";
    12131219
    12141220                return array ( FALSE , 0);
     
    12351241        {
    12361242                // Couldn't read the IFD Data properly, Some Casio files have no Next IFD pointer, hence cause this error
    1237                 echo "<p>Error: EXIF Corrupted</p>\n";
     1243                $error_message .= "<p>Error: EXIF Corrupted</p>\n";
    12381244                return array(FALSE, 0);
    12391245        }
     
    12911297                if ( $Data_Count > 100000 )
    12921298                {
    1293                      //   echo "<p>Error: huge EXIF data count - EXIF is probably Corrupted</p>\n";
     1299                     //   $error_message .= "<p>Error: huge EXIF data count - EXIF is probably Corrupted</p>\n";
    12941300
    12951301                        // Some Casio files have no Next IFD pointer, hence cause errors
     
    22022208******************************************************************************/
    22032209
    2204 function get_IFD_Data_Type( $input_data, $data_type, $Byte_Align )
    2205 {
     2210function get_IFD_Data_Type( $input_data, $data_type, $Byte_Align ){
     2211global $error_message ;
    22062212        // Check if this is a Unsigned Byte, Unsigned Short or Unsigned Long
    22072213        if (( $data_type == 1 ) || ( $data_type == 3 ) || ( $data_type == 4 ))
     
    22282234                // to return multiple values instead of a single value
    22292235
    2230                 echo "<p>Error - ASCII Strings should not be processed in get_IFD_Data_Type</p>\n";
     2236                $error_message .= "<p>Error - ASCII Strings should not be processed in get_IFD_Data_Type</p>\n";
    22312237                return "Error Should never get here"; //explode( "\x00", $input_data );
    22322238        }
  • extensions/edit_gmaps/admin/js/JScript.js

    r9412 r10060  
    279279jQuery(document).ready(function () {
    280280
    281 
    282281    jQuery('.cluetip').cluetip({
    283282        width: 300, height: 100,
    284         splitTitle: '|'
     283        splitTitle: '|',
     284        clickThrough: true
    285285    }
    286286  );
  • extensions/edit_gmaps/admin/js/fieldset.js

    r8501 r10060  
    1  if (typeof ef_animate_fast == "undefined")
    2       var ef_animate_fast = true;
     1if (typeof ef_animate_fast == "undefined")
     2  var ef_animate_fast = true;
    33
    4       // Smart Fieldsets initialization/
    5       if (typeof ef_plus_bullet_path == "undefined")
    6       {       
    7          var ef_plus_bullet_path = './plugins/edit_gmaps/admin/icon/plus.png';
    8          var ef_minus_bullet_path = './plugins/edit_gmaps/admin/icon/minus.png';
    9  
    10       }
     4// Smart Fieldsets initialization/
     5if (typeof ef_plus_bullet_path == "undefined") {
     6  var ef_plus_bullet_path = './plugins/edit_gmaps/admin/icon/plus.png';
     7  var ef_minus_bullet_path = './plugins/edit_gmaps/admin/icon/minus.png';
    118
    12      if (typeof ef_separator == "undefined") 
    13      var ef_separator = '&nbsp;: ';
     9}
    1410
    15       function ef_reduce(fieldset_id, fast) {
    16           var l_m = jQuery('#' + fieldset_id + ' legend');
    17           if (ef_reduce.arguments.length < 2) fast = ef_animate_fast;
    18           if (!l_m.is('.ef_command')) l_m.addClass('ef_command');
    19           if (!jQuery('#' + fieldset_id).is(':hidden'))
    20               l_m.trigger('ef_reduce_private', fast);
    21           l_m.removeClass('ef_command');
     11if (typeof ef_separator == "undefined")
     12  var ef_separator = '&nbsp;: ';
    2213
    23       }
     14function ef_reduce(fieldset_id, fast) {
     15  l_m = jQuery('#' + fieldset_id + ' legend');
     16  if (ef_reduce.arguments.length < 2) fast = ef_animate_fast;
     17  if (!l_m.is('.ef_command')) l_m.addClass('ef_command');
     18  if (!jQuery('#' + fieldset_id).is(':hidden'))
     19    l_m.trigger('ef_reduce_private', fast.fast,this);
     20  l_m.removeClass('ef_command');
    2421
    25       function ef_maximize(fieldset_id, fast) {
    26           var l_r = jQuery('#' + fieldset_id + '_reduced_legend');
    27           if (ef_maximize.arguments.length < 2) fast = ef_animate_fast;
    28           if (!l_r.is('.ef_command')) l_r.addClass('ef_command');
    29           if (jQuery('#' + fieldset_id).is(':hidden'))
    30               l_r.trigger('ef_maximize_private', fast);
    31           l_r.removeClass('ef_command');
    32       }
     22}
    3323
    34    
    35       function ef_init(fieldset_id, cache_id) {
    36           jQuery(document).ready(function () {
    37               var f_m = jQuery('#' + fieldset_id);
    38               var l_m = jQuery('#' + fieldset_id + ' legend');
    39               var l_txt = l_m.text();
    40               var f_r = f_m;
    41               var l_r = l_m;
     24function ef_maximize(fieldset_id, fast) {
     25  l_r = jQuery('#' + fieldset_id + '_reduced_legend');
     26  if (ef_maximize.arguments.length < 2) fast = ef_animate_fast;
     27  if (!l_r.is('.ef_command')) l_r.addClass('ef_command');
     28  if (jQuery('#' + fieldset_id).is(':hidden'))
     29    l_r.trigger('ef_maximize_private', fast);
     30  l_r.removeClass('ef_command');
     31   
     32}
    4233
    43               if (ef_minus_bullet_path != '') l_m.prepend(
     34var l_m, l_r;
     35function ef_init(fieldset_id, cache_id) {
     36  jQuery(document).ready(function () {
     37    var f_m = jQuery('#' + fieldset_id);
     38    l_m = jQuery('#' + fieldset_id + ' legend');
     39    var l_txt = l_m.text();
     40    var f_r = f_m;
     41    l_r = l_m;
     42
     43    if (ef_minus_bullet_path != '') l_m.prepend(
    4444          '<img alt = "" title = ""' +
    4545          'src = "' + ef_minus_bullet_path + '"' + '>&nbsp;'
    4646        );
    47               l_m.addClass('ef_legends');
    48               l_m.addClass('ef_click_ok');
    49    
     47    l_m.addClass('ef_legends');
     48    l_m.addClass('ef_click_ok');
    5049
    51               f_r = jQuery('#' + fieldset_id + " ").clone();
    52               l_r = jQuery('#' + fieldset_id + " LEGEND").clone();
    53               f_r.empty();
    54               l_r.appendTo(f_r);
    55  
    56               f_r.attr('id', fieldset_id + '_reduced');
    57               f_r.insertAfter(f_m);
    58                f_r.css({display: 'none'   });
    59              
    60    
    61               l_r.attr('id', fieldset_id + '_reduced_legend');
    62               l_r.addClass('ef_legends');
    63               l_r.addClass('ef_click_ok');
    6450
    65                
     51    f_r = jQuery('#' + fieldset_id + " ").clone();
     52    l_r = jQuery('#' + fieldset_id + " LEGEND").clone();
     53    f_r.empty();
     54    l_r.appendTo(f_r);
    6655
    67               l_r.css({               
    68                   outlineColor: "invert",
    69                   opacity: 0
    70               }); 
    71                        
    72      if (ef_plus_bullet_path == '')
    73          l_r.append(
     56    f_r.attr('id', fieldset_id + '_reduced');
     57    f_r.insertAfter(f_m);
     58    f_r.css({ display: 'none' });
     59
     60
     61    l_r.attr('id', fieldset_id + '_reduced_legend');
     62    l_r.addClass('ef_legends');
     63    l_r.addClass('ef_click_ok');
     64
     65
     66
     67    l_r.css({
     68      outlineColor: "invert",
     69      opacity: 0
     70    });
     71
     72    if (ef_plus_bullet_path == '')
     73      l_r.append(
    7474          '<span style = "padding-left:' + l_m.css('padding-left') + ';">' +
    7575          l_txt + '</' + 'span>' + ef_separator
    7676         );
    77               else
    78               {
     77    else {
    7978
    80               lg= jQuery(l_r).find("img") ;
    81               if(lg.length>0)
    82                   lg.get(0).src = ef_plus_bullet_path ;
     79      lg = jQuery(l_r).find("img");
     80      if (lg.length > 0)
     81        lg.get(0).src = ef_plus_bullet_path;
    8382
    84               l_r.append('&nbsp;' + ef_separator  );
    85          }
     83      l_r.append('&nbsp;' + ef_separator);
     84    }
    8685
    87              f_r.append('<span id="' + cache_id +'" > </span>') ;
    88                    jQuery('.ef_legends').css('cursor', 'pointer');
    89               l_m.bind('ef_reduce_private', function (event, fast) { // Reduce
    90              
    91                   if (l_m.is('.ef_command, .ef_click_ok')) {
    92                       if (fast) {
    93                           f_m.hide();
    94                           f_r.show();
    95                           f_r.find('*').css({opacity: 1});
    96                       }
    97                       else {
    98                           f_m.find('*').not('.ef_legends, img').animate(
    99                                  {opacity: 0} ,
    100                                 200,
     86    f_r.append('<span id="' + cache_id + '" > </span>');
     87    jQuery('.ef_legends').css('cursor', 'pointer');
     88
     89    l_m.bind('ef_reduce_private', function (event, fast) { // Reduce
     90
     91      if (l_m.is('.ef_command, .ef_click_ok')) {
     92        if (fast) {
     93          f_m.hide();
     94          f_r.show();
     95          f_r.find('*').css({ opacity: 1 });
     96        }
     97        else {
     98          f_m.find('*').not('.ef_legends, img').animate(
     99                                 { opacity: 0 }, 200,
    101100                                function () {
    102                                     f_m.slideUp(400);
    103                                     f_r.slideDown(400, function () {
    104                                             f_r.find('*').css({opacity: 1});
    105                                     });
     101                                  f_m.slideUp(400);
     102                                  f_r.slideDown(400, function () {
     103                                    f_r.find('*').css({ opacity: 1 });
     104                                  });
    106105                                }
    107106                            );
    108                       }
    109                   }
    110               });
    111               l_r.bind('ef_maximize_private', function (event, fast) { // Maximize
    112                   if (l_r.is('.ef_command, .ef_click_ok')) {
    113                       if (fast) {
    114                           f_r.hide();
    115                           f_m.show();
    116                       } else {
    117                           f_r.find('*').css({opacity: 0});
    118                           f_r.slideUp(400);
    119                           f_m.slideDown(400, function () {
    120                               f_m.find('*').not('.ef_legends, img').animate(
    121                                                                     {opacity: 1},
    122                                                                             200
    123                                                                               );
    124                                  });
    125                         }
    126                   }
    127               });
    128               l_m.click(function () { // Reduce
    129                   l_m.trigger('ef_reduce_private', ef_animate_fast);
    130               });
    131               l_r.click(function () { // Maximize
    132                   l_r.trigger('ef_maximize_private', ef_animate_fast);
    133               });
     107        }
     108      }
     109    });
     110
     111    l_r.bind('ef_maximize_private', function (event, fast) { // Maximize
     112      if (l_r.is('.ef_command, .ef_click_ok')) {
     113        if (fast) {
     114          f_r.hide();
     115          f_m.show();
     116        } else {
     117          f_r.find('*').css({ opacity: 0 });
     118          f_r.slideUp(400);
     119          f_m.slideDown(400, function () {
     120            f_m.find('*').not('.ef_legends, img').animate({ opacity: 1 },200 );
    134121          });
     122        }
    135123      }
     124    });
     125
     126    l_m.click(function () { // Reduce
     127      l_m.trigger('ef_reduce_private', ef_animate_fast);
     128    });
     129
     130    l_r.click(function () { // Maximize
     131      l_r.trigger('ef_maximize_private', ef_animate_fast);
     132    });
     133    if (no_affiche!="true") {
     134      ef_reduce("geoposition", { fast: true })
     135      // jQuery("#Envoie").trigger("submit");
     136    } else {
     137      ef_reduce("Elements", { fast: true })
     138    }
     139  });
     140}
    136141
    137142
    138       jQuery(document).ready(function () {
    139           if (jQuery(".fieldset").length >= 1)
    140               jQuery(".fieldset").each(
     143jQuery(document).ready(function () {
     144  if (jQuery(".fieldset").length >= 1)
     145    jQuery(".fieldset").each(
    141146                function (i) {
    142                     id0 = jQuery(this).attr("id");
    143                     if (id0 == "") jQuery(this).attr("id", "Cadre_" + i);
    144                     id0 = jQuery(this).attr("id");
    145                     // Update of the '#cache' value when changing the selected value in the fieldset
    146                     jQuery("#" + id0 + ' .inputs').click(function () {
    147                         jQuery("#" + id0).text(jQuery("#" + id0 + ' .inputs:checked').next().text());
    148                     });
     147                  id0 = jQuery(this).attr("id");
     148                  if (id0 == "") jQuery(this).attr("id", "Cadre_" + i);
     149                  id0 = jQuery(this).attr("id");
     150                  // Update of the '#cache' value when changing the selected value in the fieldset
     151                  jQuery("#" + id0 + ' .inputs').click(function () {
     152                    jQuery("#" + id0).text(jQuery("#" + id0 + ' .inputs:checked').next().text());
     153                  });
    149154                });
    150           // Some changes of the defaults, nothing to see with Smart Fieldsets
    151           //   jQuery('input').attr('checked', 'true');
    152           jQuery('code').css('font-size', 'larger');
    153           jQuery('#ef_presentation label, #ef_presentation input').css('cursor', 'pointer');
    154       });
     155  // Some changes of the defaults, nothing to see with Smart Fieldsets
     156  //   jQuery('input').attr('checked', 'true');
     157  jQuery('code').css('font-size', 'larger');
     158  jQuery('#ef_presentation label, #ef_presentation input').css('cursor', 'pointer');
     159});
    155160
    156161
    157162
    158       jQuery(document).ready(function () {
    159           if (jQuery(".fieldset").length >= 1) {
    160               jQuery(".fieldset").each(
     163jQuery(document).ready(function () {
     164  if (jQuery(".fieldset").length >= 1) {
     165    jQuery(".fieldset").each(
    161166              function (i) {
    162                   id0 = jQuery(this).attr("id");
    163                   ef_init(id0, 'cache' + i);
     167                id0 = jQuery(this).attr("id");
     168                ef_init(id0, 'cache' + i);
    164169
    165170              })
    166           }
    167           if (no_affiche) {
    168               ef_reduce("geoposition", true)
    169           } else {
    170               ef_reduce("Elements", true)
    171           }
    172171
    173       })
     172  }
     173
     174})
    174175
    175176             
Note: See TracChangeset for help on using the changeset viewer.