Changeset 26331
- Timestamp:
- Dec 29, 2013, 3:14:42 PM (10 years ago)
- Location:
- extensions/rv_gmaps/trunk
- Files:
-
- 2 deleted
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/rv_gmaps/trunk/admin/admin.php
r17286 r26331 14 14 $tabsheet = new tabsheet(); 15 15 $tabsheet->add( 'config', 'Configuration', add_url_params( $my_base_url, array('tab'=>'config') ) ); 16 $tabsheet->add( 'sync', 'Synchronize', add_url_params( $my_base_url, array('tab'=>'sync') ) );17 16 $tabsheet->select($page['tab']); 18 17 -
extensions/rv_gmaps/trunk/admin/admin_boot.php
r18951 r26331 31 31 { 32 32 if ($prefilter==="geotagged") 33 $query = 'lat IS NOT NULL AND lonIS NOT NULL';33 $query = 'latitude IS NOT NULL AND longitude IS NOT NULL'; 34 34 elseif ($prefilter==="not geotagged") 35 $query = 'lat IS NULL OR lonIS NULL';35 $query = 'latitude IS NULL OR longitude IS NULL'; 36 36 37 37 if ( isset($query) ) … … 74 74 if ( (double)$lat<=90 and (double)$lat>=-90 75 75 and (double)$lon<=180 and (double)$lon>=-180 ) 76 $update_query = 'lat ='.$lat.', lon='.$lon;76 $update_query = 'latitude='.$lat.', longitude='.$lon; 77 77 else 78 78 $page['errors'][] = 'Invalid lat or lon value'; 79 79 } 80 80 elseif ( strlen($lat)==0 and strlen($lon)==0 ) 81 $update_query = 'lat =NULL, lon=NULL';81 $update_query = 'latitude=NULL, longitude=NULL'; 82 82 else 83 83 $page['errors'][] = 'Both lat/lon must be empty or not empty'; … … 124 124 $data = array( 125 125 'id' => $row['id'], 126 'lat ' => trim($_POST['lat-'.$row['id']]),127 'lon ' => trim($_POST['lon-'.$row['id']])126 'latitude' => trim($_POST['lat-'.$row['id']]), 127 'longitude' => trim($_POST['lon-'.$row['id']]) 128 128 ); 129 129 130 if ( strlen($data['lat '])>0 and strlen($data['lon'])>0 )130 if ( strlen($data['latitude'])>0 and strlen($data['longitude'])>0 ) 131 131 { 132 if ( (double)$data['lat ']>90 or (double)$data['lat']<-90133 or (double)$data['lon ']>180 or (double)$data['lon']<-180 )132 if ( (double)$data['latitude']>90 or (double)$data['latitude']<-90 133 or (double)$data['longitude']>180 or (double)$data['longitude']<-180 ) 134 134 $error = true; 135 135 } 136 elseif ( strlen($data['lat '])==0 and strlen($data['lon'])==0 )136 elseif ( strlen($data['latitude'])==0 and strlen($data['longitude'])==0 ) 137 137 { 138 138 // nothing … … 153 153 array( 154 154 'primary' => array('id'), 155 'update' => array('lat ', 'lon')155 'update' => array('latitude', 'longitude') 156 156 ), 157 157 $datas … … 183 183 <td> 184 184 <label>{\'Latitude\'|@translate} 185 <input type="text" size="8" name="lat-{$element.id}" value="{$element.lat }">185 <input type="text" size="8" name="lat-{$element.id}" value="{$element.latitude}"> 186 186 </label> 187 187 <label>{\'Longitude\'|@translate} 188 <input type="text" size="9" name="lon-{$element.id}" value="{$element.lon }">188 <input type="text" size="9" name="lon-{$element.id}" value="{$element.longitude}"> 189 189 </label> 190 190 </td> -
extensions/rv_gmaps/trunk/admin/admin_config.php
r23083 r26331 17 17 } 18 18 19 if (isset($_POST['gmaps_auto_sync']))20 {21 conf_update_param('gmaps_auto_sync', "1");22 $conf['gmaps_auto_sync']=1;23 }24 else25 {26 $query = 'DELETE FROM '.CONFIG_TABLE.' WHERE param="gmaps_auto_sync"';27 pwg_query($query);28 unset($conf['gmaps_auto_sync']);29 }30 31 19 $gm_config = rvm_get_config(); 32 20 … … 52 40 } 53 41 54 $query = 'SELECT COUNT(*) FROM '.IMAGES_TABLE.' WHERE lat IS NOT NULL';42 $query = 'SELECT COUNT(*) FROM '.IMAGES_TABLE.' WHERE latitude IS NOT NULL'; 55 43 list($nb_geotagged) = pwg_db_fetch_array( pwg_query($query) ); 56 44 … … 59 47 'NB_GEOTAGGED' => $nb_geotagged, 60 48 'GMAPS_API_KEY' => $conf['gmaps_api_key'], 61 'GMAPS_AUTO_SYNC' => isset($conf['gmaps_auto_sync']) ? 1:0,62 49 'NB_MARKERS' => rvm_get_config_var('nb_markers',40), 63 50 'NB_IMAGES_PER_MARKER' => rvm_get_config_var('nb_images_per_marker',20), -
extensions/rv_gmaps/trunk/admin/admin_config.tpl
r23083 r26331 16 16 <br/> --> 17 17 18 < li>18 <!--<li> 19 19 <label> 20 20 Automatically sync from exif … … 23 23 <br/><small>When metadata is synchronized, tour manual set coordinates might be overriden.</small> 24 24 </li> 25 <br/> 25 <br/> --> 26 26 27 27 <li> -
extensions/rv_gmaps/trunk/include/functions.php
r23519 r26331 29 29 $query = ' 30 30 SELECT id FROM '.IMAGES_TABLE.' 31 WHERE lat IS NOT NULL31 WHERE latitude IS NOT NULL 32 32 AND id IN ('.implode(',', $items).') 33 33 ORDER BY NULL -
extensions/rv_gmaps/trunk/include/functions_map.php
r22180 r26331 129 129 if ( !isset($b) or empty($b) ) 130 130 return null; 131 $sql_where = 'i.lat BETWEEN '.$b['s'].' AND '.($b['n']);131 $sql_where = 'i.latitude BETWEEN '.$b['s'].' AND '.($b['n']); 132 132 $sql_where .= ' AND '; 133 133 if ($b['e'] >= $b['w']) 134 $sql_where .= 'i.lon BETWEEN '.$b['w'].' AND '.($b['e']);134 $sql_where .= 'i.longitude BETWEEN '.$b['w'].' AND '.($b['e']); 135 135 else 136 $sql_where .= 'i.lon NOT BETWEEN '.($b['e']+1e-7).' AND '.($b['w']-1e-7);136 $sql_where .= 'i.longitude NOT BETWEEN '.($b['e']+1e-7).' AND '.($b['w']-1e-7); 137 137 return $sql_where; 138 138 } … … 172 172 if ($bounds['e']>180) $bounds['e']-=360; 173 173 $where_sql = rvm_bounds_to_sql( $bounds ); 174 $order_by = 'ORDER BY POW('.$ll['lat'].'-i.lat ,2)+POW('.$cos_lat.'*('.$ll['lon'].'-i.lon),2)';174 $order_by = 'ORDER BY POW('.$ll['lat'].'-i.latitude,2)+POW('.$cos_lat.'*('.$ll['lon'].'-i.longitude),2)'; 175 175 return $where_sql; 176 176 } … … 300 300 301 301 $query = ' 302 SELECT category_id cat_id, uppercats, MAX(lat ) AS n, MIN(lat) AS s, MAX(lon) AS e, MIN(lon) AS w, COUNT(i.id) count, MIN(i.date_creation) min_date, MAX(i.date_creation) max_date302 SELECT category_id cat_id, uppercats, MAX(latitude) AS n, MIN(latitude) AS s, MAX(longitude) AS e, MIN(longitude) AS w, COUNT(i.id) count, MIN(i.date_creation) min_date, MAX(i.date_creation) max_date 303 303 FROM 304 304 '.CATEGORIES_TABLE.' as c … … 369 369 370 370 if (empty($where_sql)) 371 $where_sql .= 'i.lat IS NOT NULL';371 $where_sql .= 'i.latitude IS NOT NULL'; 372 372 $where_sql_images_only = $where_sql; 373 373 $where_sql .= get_sql_condition_FandF( -
extensions/rv_gmaps/trunk/include/picture_map.inc.php
r24745 r26331 36 36 'MAP_TYPE' => rvm_get_config_var('map_type', 'ROADMAP'), 37 37 'U_NO_MAP' => duplicate_picture_url(), 38 'U_BLOWUP' => rvm_make_blowup_url( array('ll'=> $picture), array('start','box') ),38 'U_BLOWUP' => rvm_make_blowup_url( array('ll'=> array('lat'=>$picture['latitude'],'lon'=>$picture['longitude'])), array('start','box') ), 39 39 'COMMENT_IMG' => trigger_event('render_element_description', $picture['comment']) 40 40 ) 41 41 ); 42 if ( isset($picture['lat ']) )42 if ( isset($picture['latitude']) ) 43 43 { 44 44 $template->assign( 'coordinates', 45 45 array( 46 'LAT' => $picture['lat '],47 'LON' => $picture['lon '],46 'LAT' => $picture['latitude'], 47 'LON' => $picture['longitude'], 48 48 ) 49 49 ); -
extensions/rv_gmaps/trunk/kml.php
r20461 r26331 44 44 45 45 46 $img_fields = ' i.id,i.representative_ext,i.name,i.comment,i.file,i.path,i.lat ,i.lon,i.date_creation';46 $img_fields = ' i.id,i.representative_ext,i.name,i.comment,i.file,i.path,i.latitude AS lat,i.longitude AS lon,i.date_creation'; 47 47 48 48 rvm_build_section_items($img_fields, $where_sql, RVM_BUILD_ARRAY, $order_by); -
extensions/rv_gmaps/trunk/main.inc.php
r25367 r26331 21 21 22 22 global $conf; 23 if (@$conf['gmaps_auto_sync'])24 {25 $conf['use_exif_mapping']['lat'] = 'lat';26 $conf['use_exif_mapping']['lon'] = 'lon';27 add_event_handler('format_exif_data', 'rvm_format_exif', EVENT_HANDLER_PRIORITY_NEUTRAL, 3);28 }29 23 30 24 function rvm_index_cat_thumbs_displayed() … … 90 84 function rvm_picture_pictures_data($pictures) 91 85 { 92 if ( isset($pictures['current']['lat ']) and isset($pictures['current']['lon']) )86 if ( isset($pictures['current']['latitude']) and isset($pictures['current']['longitude']) ) 93 87 { 94 88 global $template; 95 $template->append('head_elements', '<meta name=geo.position content='.$pictures['current']['lat '].';'.$pictures['current']['lon'].'>' );89 $template->append('head_elements', '<meta name=geo.position content='.$pictures['current']['latitude'].';'.$pictures['current']['longitude'].'>' ); 96 90 include_once( dirname(__FILE__) .'/include/functions.php'); 97 91 rvm_load_language(); … … 132 126 } 133 127 134 function rvm_format_exif($exif, $file, $map)135 {136 if (isset($map['lat']))137 {138 include_once( dirname(__FILE__) .'/include/functions_metadata.php');139 $ll = exif_to_lat_lon($exif);140 if (is_array($ll))141 {142 $exif[$map['lat']] = $ll[0];143 $exif[$map['lon']] = $ll[1];144 }145 }146 return $exif;147 }148 149 128 if (defined('IN_ADMIN')) { 150 129 include_once(dirname(__FILE__).'/admin/admin_boot.php'); -
extensions/rv_gmaps/trunk/maintain.inc.php
r16974 r26331 1 1 <?php 2 function rvgm_drop_old_columns() 3 { 4 $q = ' 5 ALTER TABLE '.IMAGES_TABLE.' DROP COLUMN `lat`'; 6 pwg_query( $q ); 7 8 $q = ' 9 ALTER TABLE '.IMAGES_TABLE.' DROP COLUMN `lon`'; 10 pwg_query( $q ); 11 } 12 2 13 function plugin_install() 3 14 { 4 $q = '5 ALTER TABLE '.IMAGES_TABLE.' ADD COLUMN `lat` DOUBLE(8,6)';6 pwg_query($q);7 8 $q = '9 ALTER TABLE '.IMAGES_TABLE.' ADD INDEX images_lat(`lat`)';10 pwg_query($q);11 12 $q = '13 ALTER TABLE '.IMAGES_TABLE.' ADD COLUMN `lon` DOUBLE(9,6)';14 pwg_query($q);15 16 15 $q = ' 17 16 INSERT INTO '.CONFIG_TABLE.' (param,value,comment) … … 25 24 { 26 25 global $conf; 26 27 $query = 'SHOW COLUMNS FROM '. IMAGES_TABLE .' LIKE "latitude";'; 28 29 if (pwg_db_num_rows(pwg_query($query))) 30 rvgm_drop_old_columns(); 31 pwg_query('DELETE FROM '.CONFIG_TABLE.' WHERE param IN("gmaps_auto_sync")'); 27 32 28 33 if (!isset($conf['rv_gmaps_add_map.php']) or $conf['rv_gmaps_add_map.php']) … … 68 73 function plugin_uninstall() 69 74 { 70 $q = ' 71 ALTER TABLE '.IMAGES_TABLE.' DROP COLUMN `lat`'; 72 pwg_query( $q ); 73 74 $q = ' 75 ALTER TABLE '.IMAGES_TABLE.' DROP COLUMN `lon`'; 76 pwg_query( $q ); 75 rvgm_drop_old_columns(); 77 76 78 77 $q = ' -
extensions/rv_gmaps/trunk/map.php
r25922 r26331 50 50 if ( !isset($_GET['ll']) /*and ($page['section']!='categories' or isset($page['category']) )*/ ) 51 51 { 52 $img_fields = 'MIN(i.lat ) s, MIN(i.lon) w, MAX(i.lat) n, MAX(i.lon) e';52 $img_fields = 'MIN(i.latitude) s, MIN(i.longitude) w, MAX(i.latitude) n, MAX(i.longitude) e'; 53 53 $page['flat']=true; 54 54 rvm_build_section_items($img_fields, null, RVM_BUILD_AGGREGATE); -
extensions/rv_gmaps/trunk/map_data.php
r25792 r26331 31 31 $where_sql = rvm_bounds_to_sql( $page['box'] ); 32 32 33 $img_fields = ' i.id,i.representative_ext,i.name,i.comment,i.file,i.path,i.lat ,i.lon,i.width,i.height,i.rotation';33 $img_fields = ' i.id,i.representative_ext,i.name,i.comment,i.file,i.path,i.latitude AS lat,i.longitude AS lon,i.width,i.height,i.rotation'; 34 34 35 35 $was_flat = @$page['flat'];
Note: See TracChangeset
for help on using the changeset viewer.