Index: /extensions/edit_gmaps/admin/admin.php
===================================================================
--- /extensions/edit_gmaps/admin/admin.php (revision 8500)
+++ /extensions/edit_gmaps/admin/admin.php (revision 8501)
@@ -24,6 +24,4 @@
$template->assign_var_from_handle( 'ADMIN_CONTENT', 'plugin_admin_content');
-if ( empty($conf['gmaps_api_key']) )
- $page['infos'][] = 'Please define the Google maps api key';
?>
Index: /extensions/edit_gmaps/admin/admin_edit.php
===================================================================
--- /extensions/edit_gmaps/admin/admin_edit.php (revision 8500)
+++ /extensions/edit_gmaps/admin/admin_edit.php (revision 8501)
@@ -1,56 +1,23 @@
concat('TABSHEET_TITLE', ' '.l10n_dec('%d element', '%d elements', count($page['cat_elements_id'])).' - '.$page['title']);
-
-
-$template->assign(
- array(
- 'EDIT_RV_ROOT' => EDIT_RV_ROOT)
- );
-
-
+$template->concat('TABSHEET_TITLE', ' '.l10n_dec('%d image', '%d images', count($page['cat_elements_id'])).' - '.$page['title']);
if ( isset($_POST['submit']) and !is_adviser() )
{
-
-
$collection = array();
-$_POST['target']=isset($_POST['target']) ? $_POST['target']: "" ;
+ if( !isset ($_POST['target']))
+ {
+ $_POST['submit'] == l10n('Submit') ;
+ $_POST['target']='selection';
+ $collection = $_POST['selection'];
+
+ }
+
switch ($_POST['target'])
{
@@ -65,60 +32,40 @@
break;
}
-//===========================================================================
-$match="";
-
- if ( count($collection)>0 )
- {
-
- $lat = trim($_POST['lat']);
- $lon = trim($_POST['lon']);
-
- if ( strlen($lat)>0 and strlen($lon)>0 )
+
+
+ // test si mise à jour (valider)
+ if ( isset($_POST['submit']) and $_POST['submit'] == l10n('Submit') )
{
- if ( (double)$lat<=90 and (double)$lat>=-90
- and (double)$lon<=180 and (double)$lat>=-180 )
- $update_query = 'lat='.$lat.', lon='.$lon;
- else
- $page['errors'][] = 'Invalid lat or lon value';
- }
- elseif ( strlen($lat)==0 and strlen($lon)==0 )
- $update_query = 'lat=NULL, lon=NULL';
- else
- $page['errors'][] = 'Both lat/lon must be empty or not empty';
-
- if ($_POST['submit']=='Valider' )
- {
- if (isset($update_query))
- {
- $update_query = '
- UPDATE '.IMAGES_TABLE.' SET '.$update_query.'
- WHERE id IN ('.implode(',',$collection).')';
- pwg_query($update_query);
- rvm_invalidate_cache();
- }
- $_POST['selection']=array();
- unset($collection);
-
+ if ( count($collection)>0 )
+ {
+ $lat = trim($_POST['lat']);
+ $lon = trim($_POST['lon']);
+
+ if ( strlen($lat)>0 and strlen($lon)>0 )
+ {
+ if ( (double)$lat<=90 and (double)$lat>=-90
+ and (double)$lon<=180 and (double)$lat>=-180 )
+ $update_query = 'lat='.$lat.', lon='.$lon;
+ else
+ $page['errors'][] = 'Invalid lat or lon value';
+ }
+ elseif ( strlen($lat)==0 and strlen($lon)==0 )
+ $update_query = 'lat=NULL, lon=NULL';
+ else
+ $page['errors'][] = 'Both lat/lon must be empty or not empty';
+
+ if (isset($update_query))
+ {
+ $update_query = '
+ UPDATE '.IMAGES_TABLE.' SET '.$update_query.'
+ WHERE id IN ('.implode(',',$collection).')';
+ pwg_query($update_query);
+ rvm_invalidate_cache();
+ }
+ }
}
- }
-//===========================================================================
-
- if ($_POST['submit']==l10n('reset' ) )
- {
- $_POST['selection']=array();
- unset($collection);
- }
-
-
-
- if ($_POST['submit']==l10n('search_title' ))
- {
-
- $match = $_POST['match'] ;
-
-
- }
- }
-
+}
+
+
$template->append(
'specials',
@@ -167,21 +114,21 @@
$page['nb_images']
);
- $template->assign('NAV_BAR', $nav_bar);
-}
-
+ $template->assign('navbar', $nav_bar);
+}
+
$images=array();
if ( !empty($page['cat_elements_id']) )
{
$query='
- SELECT id,tn_ext,name,path,file,lat,lon FROM '.IMAGES_TABLE.'
- WHERE id IN ('.implode(',',$page['cat_elements_id']).')
- '.$conf['order_by'].'
- LIMIT '.$page['start'].', '.$page['nb_images'].'
- ;';
- $result = pwg_query($query);
- while ( $row=mysql_fetch_assoc($result) )
- $images[] = $row;
-}
-//=================================================================================
+SELECT id,tn_ext,name,path,file,lat,lon FROM '.IMAGES_TABLE.'
+ WHERE id IN ('.implode(',',$page['cat_elements_id']).')
+ '.$conf['order_by'].'
+ LIMIT '.$page['start'].', '.$page['nb_images'].'
+;';
+ $result = pwg_query($query);
+ while ( $row=mysql_fetch_assoc($result) )
+ $images[] = $row;
+}
+
foreach ($images as $image)
{
@@ -192,5 +139,4 @@
)
);
-
if ( isset($image['lat']) )
$tpl_var['U_MAP'] = rvm_make_map_picture_url( array('image_id'=>$image['id'], 'image_file'=>$image['file']) );
@@ -198,81 +144,96 @@
}
-//===================================================================================
$template->assign(
- array( 'path_js' => $path_js,
- 'U_DISPLAY'=> $admin_url.get_query_string_diff(array('display')),
- 'VERSION'=> $version,
+ array(
+ 'U_DISPLAY'=> $admin_url.get_query_string_diff(array('display'))
+ )
+ );
+
+//==========================================================
+ if (!defined('EDIT_RV_ROOT')) define( 'EDIT_RV_ROOT', PHPWG_PLUGINS_PATH.'edit_gmaps/admin/' );
+ $path = EDIT_RV_PATH;
+ $plg_data = implode( '', file($path.'main.inc.php') );
+ if (preg_match("|Version: (.*)|", $plg_data, $val))
+ { $edit_rv_plugin['version'] = trim($val[1]); }
+ $edit_rv_plugin = array_map('htmlspecialchars', $edit_rv_plugin);
+ $version= $edit_rv_plugin['version'] ;
+ $icon_path = 'themes/default/icon/help.png';
+ $path_js= 'themes/default/js/' ;
+
+//==================================================================================
+$match="";
+if ( isset($_POST['submit']) and !is_adviser() )
+{
+
+ if ($_POST['submit']==l10n('Submit') )
+ {
+ $_POST['selection']=array();
+ $collection =array();
+ unset($collection);
+ }
+
+
+ if ($_POST['submit']==l10n('reset' ) )
+ {
+ $_POST['selection']=array();
+ unset($collection);
+ }
+
+
+ }
+//=================================================================================
+$src="";
+$template->assign(
+ array( 'EDIT_RV_ROOT' => EDIT_RV_ROOT,
+ 'path_js' => $path_js,
+ 'VERSION'=> $version,
)
);
-//==================================================================================
-$template->assign(
- array(
- 'GMAPS_API_KEY' => $conf['gmaps_api_key'],
- )
- );
-//==================================================================================
-$src="";
+ global $lang_info;
+if (date_default_timezone_get()) { $adresse = date_default_timezone_get() ;}
+else{
+
+}
+$adresse = $lang_info['country']; ;
+$adresse=str_replace("/",", ",$adresse);
+$template->assign( 'coordinates',
+ array('LAT' => '100',
+ 'LON' => '100',
+ 'ADRESSE' => $adresse,
+ 'ZOOM' => 18,
+ )
+ );
+if (isset($_POST['submit']) and $_POST['submit']==l10n('selection' ))
+{
if (isset($collection))
{
$lat =1000;
-
-if ($match<>"" && $match<>"/" )
-{
-$match=str_replace(" ","+",$match);
- $src="http://maps.google.com/maps/geo?q=".$match."&output=xml&sensor=true_or_false&key=".$conf['gmaps_api_key'];
-//json,kml,xml,csv
-
- $location = file_get_contents($src);
- $location = explode("coordinates>",$location );
- $location = explode(",",$location[1]);
- $lat=$location[1];
- $lon=$location[0];
- $adresse ="Europe";
- if (date_default_timezone_get()) {
- $adresse = date_default_timezone_get() ;
- }
-
-
- $template->assign( array('lat' => $lat ,
- 'lon' => $lon ,));
+ foreach ($collection as $id_0) {
+ foreach ($images as $image) {
+ if (array_search($id_0,$image)) {
+ $_POST['selection'] = $collection ;
+
+ if ($lat==1000) {
+ $lat1= ($image['lat'] <> '') ? $image['lat'] : '100' ;
+ $lon1= ($image['lon'] <> '') ? $image['lon'] : '3.0' ;
+ if($lat1 != '100') $lat=$image['lat'];
+
$template->assign( 'coordinates',
- array('LAT' => $lat,
- 'LON' => $lon,
- 'ADRESSE' => $adresse,
+ array('LAT' => $lat1 ,
+ 'LON' => $lon1 ,
+ 'ADRESSE' => $adresse ,
+ 'ZOOM' => 4,
)
);
- }
-
- foreach ($collection as $id_0) {
- $adresse ="Europe/Paris";
- if (date_default_timezone_get()) {
- $adresse ="'" . date_default_timezone_get() ."'" ;
- }
-
-
- foreach ($images as $image) {
-
- if (array_search($id_0,$image)) {
- if ($lat==1000) {
- $lat= ($image['lat'] <> '') ? $image['lat'] : '100' ;
- $lon= ($image['lon'] <> '') ? $image['lon'] : '3.0' ;
-
- $template->assign( array('zoom' => 4,'lat' => $lat , 'lon' => $lon , ) );
- $template->assign( 'coordinates',
- array('LAT' => $lat,
- 'LON' => $lon,
- 'ADRESSE' => $adresse,
- )
- );
}
-
+
$tpl_var = array_merge(
$image,
array(
- 'src' => $src ,
- 'match' => $_POST['match'] ,
- 'check' => $_POST['submit'] ,
+ 'lat' => $image['lat'] ,
+ 'lon' => $image['lon'] ,
+ 'adresse' => $adresse ,
'U_TN' => get_thumbnail_url($image),
'TITLE' => get_thumbnail_title($image),
@@ -286,20 +247,12 @@
)
);
-
- $template->append('Selectthumbnails', $tpl_var);
-
- }
- }
-}
-
-
-}
-if (isset($_POST['submit']) )
-{ if ($_POST['submit']==l10n('Submit') )
- {
- $_POST['selection']=array();
- $collection =array();
- }
-}
+
+ $template->append('Selectthumbnails', $tpl_var);
+ }
+ }
+ }
+ }
+}
+
//=======================================================================
Index: /extensions/edit_gmaps/admin/admin_edit.tpl
===================================================================
--- /extensions/edit_gmaps/admin/admin_edit.tpl (revision 8500)
+++ /extensions/edit_gmaps/admin/admin_edit.tpl (revision 8501)
@@ -1,5 +1,4 @@
{html_head}
{* $Id: admin_edit.tpl 2011-01-03 *}
-
{known_script id="jquery" src=$ROOT_URL|@cat:"themes/default/js/jquery.packed.js" }
{known_script id="jquery.cluetip" src=$ROOT_URL|@cat:"themes/default/js/plugins/jquery.cluetip.packed.js"}
@@ -8,17 +7,35 @@
{known_script id="jquery.ui.resizable" src=$ROOT_URL|@cat:"themes/default/js/ui/ui.resizable.js"}
{known_script id="EDIT_RV_script" src=$EDIT_RV_ROOT|@cat:"js/JScript.js"}
-
-
-
-
-
-