Changeset 8501 for extensions/edit_gmaps/admin
- Timestamp:
- Jan 7, 2011, 6:13:48 PM (13 years ago)
- Location:
- extensions/edit_gmaps/admin
- Files:
-
- 4 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/edit_gmaps/admin/admin.php
r4558 r8501 24 24 $template->assign_var_from_handle( 'ADMIN_CONTENT', 'plugin_admin_content'); 25 25 26 if ( empty($conf['gmaps_api_key']) )27 $page['infos'][] = 'Please define the Google maps api key';28 26 29 27 ?> -
extensions/edit_gmaps/admin/admin_edit.php
r8466 r8501 1 1 <?php 2 2 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 3 4 if (!defined('EDIT_RV_ROOT'))5 define( 'EDIT_RV_ROOT', PHPWG_PLUGINS_PATH.'edit_gmaps/admin/' );6 7 3 global $lang; 8 4 load_language('lang', dirname(__FILE__).'/../'); 9 5 $admin_url = PHPWG_ROOT_PATH.'admin.php'; 10 if (file_exists ( 'themes/default/js/jquery.packed.js')) 11 { 12 //version 2.1 13 14 $icon_path = 'themes/default/icon/help.png'; 15 $path_js= 'themes/default/js/' ; 16 17 } 18 else 19 { 20 // version < 1.9 21 $path_js= "template-common/lib/"; 22 $icon_path = "admin/template/goto/theme/clear/icon/help.png"; 23 } 24 $sql="SELECT * 25 FROM `".$prefixeTable."plugins` 26 WHERE `id` LIKE 'edit_gmaps' 27 "; 28 $result = @pwg_query($sql); 29 if ($result) { 30 $versions = mysql_fetch_array($result,MYSQL_ASSOC); 31 } 32 $version= $versions['version']; 33 34 if ( !isset($_GET['cat']) ) 35 $_GET['cat'] = 'caddie'; 6 7 if ( !isset($_GET['cat']) ) $_GET['cat'] = 'caddie'; 36 8 $_GET['mode'] = 'map'; 37 9 include (PHPWG_ROOT_PATH.'admin/element_set.php'); 38 39 40 $template->concat('TABSHEET_TITLE', ' '.l10n_dec('%d element', '%d elements', count($page['cat_elements_id'])).' - '.$page['title']); 41 42 43 $template->assign( 44 array( 45 'EDIT_RV_ROOT' => EDIT_RV_ROOT) 46 ); 47 48 10 $template->concat('TABSHEET_TITLE', ' '.l10n_dec('%d image', '%d images', count($page['cat_elements_id'])).' - '.$page['title']); 49 11 if ( isset($_POST['submit']) and !is_adviser() ) 50 12 { 51 52 53 13 $collection = array(); 54 $_POST['target']=isset($_POST['target']) ? $_POST['target']: "" ; 14 if( !isset ($_POST['target'])) 15 { 16 $_POST['submit'] == l10n('Submit') ; 17 $_POST['target']='selection'; 18 $collection = $_POST['selection']; 19 20 } 21 55 22 switch ($_POST['target']) 56 23 { … … 65 32 break; 66 33 } 67 //=========================================================================== 68 $match=""; 69 70 if ( count($collection)>0 ) 71 { 72 73 $lat = trim($_POST['lat']); 74 $lon = trim($_POST['lon']); 75 76 if ( strlen($lat)>0 and strlen($lon)>0 ) 34 35 36 // test si mise à jour (valider) 37 if ( isset($_POST['submit']) and $_POST['submit'] == l10n('Submit') ) 77 38 { 78 if ( (double)$lat<=90 and (double)$lat>=-90 79 and (double)$lon<=180 and (double)$lat>=-180 ) 80 $update_query = 'lat='.$lat.', lon='.$lon; 81 else 82 $page['errors'][] = 'Invalid lat or lon value'; 83 } 84 elseif ( strlen($lat)==0 and strlen($lon)==0 ) 85 $update_query = 'lat=NULL, lon=NULL'; 86 else 87 $page['errors'][] = 'Both lat/lon must be empty or not empty'; 88 89 if ($_POST['submit']=='Valider' ) 90 { 91 if (isset($update_query)) 92 { 93 $update_query = ' 94 UPDATE '.IMAGES_TABLE.' SET '.$update_query.' 95 WHERE id IN ('.implode(',',$collection).')'; 96 pwg_query($update_query); 97 rvm_invalidate_cache(); 98 } 99 $_POST['selection']=array(); 100 unset($collection); 101 39 if ( count($collection)>0 ) 40 { 41 $lat = trim($_POST['lat']); 42 $lon = trim($_POST['lon']); 43 44 if ( strlen($lat)>0 and strlen($lon)>0 ) 45 { 46 if ( (double)$lat<=90 and (double)$lat>=-90 47 and (double)$lon<=180 and (double)$lat>=-180 ) 48 $update_query = 'lat='.$lat.', lon='.$lon; 49 else 50 $page['errors'][] = 'Invalid lat or lon value'; 51 } 52 elseif ( strlen($lat)==0 and strlen($lon)==0 ) 53 $update_query = 'lat=NULL, lon=NULL'; 54 else 55 $page['errors'][] = 'Both lat/lon must be empty or not empty'; 56 57 if (isset($update_query)) 58 { 59 $update_query = ' 60 UPDATE '.IMAGES_TABLE.' SET '.$update_query.' 61 WHERE id IN ('.implode(',',$collection).')'; 62 pwg_query($update_query); 63 rvm_invalidate_cache(); 64 } 65 } 102 66 } 103 } 104 //=========================================================================== 105 106 if ($_POST['submit']==l10n('reset' ) ) 107 { 108 $_POST['selection']=array(); 109 unset($collection); 110 } 111 112 113 114 if ($_POST['submit']==l10n('search_title' )) 115 { 116 117 $match = $_POST['match'] ; 118 119 120 } 121 } 122 67 } 68 69 123 70 $template->append( 124 71 'specials', … … 167 114 $page['nb_images'] 168 115 ); 169 $template->assign(' NAV_BAR', $nav_bar);170 } 171 116 $template->assign('navbar', $nav_bar); 117 } 118 172 119 $images=array(); 173 120 if ( !empty($page['cat_elements_id']) ) 174 121 { 175 122 $query=' 176 177 178 179 180 181 182 183 184 } 185 //================================================================================= 123 SELECT id,tn_ext,name,path,file,lat,lon FROM '.IMAGES_TABLE.' 124 WHERE id IN ('.implode(',',$page['cat_elements_id']).') 125 '.$conf['order_by'].' 126 LIMIT '.$page['start'].', '.$page['nb_images'].' 127 ;'; 128 $result = pwg_query($query); 129 while ( $row=mysql_fetch_assoc($result) ) 130 $images[] = $row; 131 } 132 186 133 foreach ($images as $image) 187 134 { … … 192 139 ) 193 140 ); 194 195 141 if ( isset($image['lat']) ) 196 142 $tpl_var['U_MAP'] = rvm_make_map_picture_url( array('image_id'=>$image['id'], 'image_file'=>$image['file']) ); … … 198 144 } 199 145 200 //===================================================================================201 146 $template->assign( 202 array( 'path_js' => $path_js, 203 'U_DISPLAY'=> $admin_url.get_query_string_diff(array('display')), 204 'VERSION'=> $version, 147 array( 148 'U_DISPLAY'=> $admin_url.get_query_string_diff(array('display')) 149 ) 150 ); 151 152 //========================================================== 153 if (!defined('EDIT_RV_ROOT')) define( 'EDIT_RV_ROOT', PHPWG_PLUGINS_PATH.'edit_gmaps/admin/' ); 154 $path = EDIT_RV_PATH; 155 $plg_data = implode( '', file($path.'main.inc.php') ); 156 if (preg_match("|Version: (.*)|", $plg_data, $val)) 157 { $edit_rv_plugin['version'] = trim($val[1]); } 158 $edit_rv_plugin = array_map('htmlspecialchars', $edit_rv_plugin); 159 $version= $edit_rv_plugin['version'] ; 160 $icon_path = 'themes/default/icon/help.png'; 161 $path_js= 'themes/default/js/' ; 162 163 //================================================================================== 164 $match=""; 165 if ( isset($_POST['submit']) and !is_adviser() ) 166 { 167 168 if ($_POST['submit']==l10n('Submit') ) 169 { 170 $_POST['selection']=array(); 171 $collection =array(); 172 unset($collection); 173 } 174 175 176 if ($_POST['submit']==l10n('reset' ) ) 177 { 178 $_POST['selection']=array(); 179 unset($collection); 180 } 181 182 183 } 184 //================================================================================= 185 $src=""; 186 $template->assign( 187 array( 'EDIT_RV_ROOT' => EDIT_RV_ROOT, 188 'path_js' => $path_js, 189 'VERSION'=> $version, 205 190 ) 206 191 ); 207 //================================================================================== 208 $template->assign( 209 array( 210 'GMAPS_API_KEY' => $conf['gmaps_api_key'], 211 ) 212 ); 213 //================================================================================== 214 $src=""; 192 global $lang_info; 193 if (date_default_timezone_get()) { $adresse = date_default_timezone_get() ;} 194 else{ 195 196 } 197 $adresse = $lang_info['country']; ; 198 $adresse=str_replace("/",", ",$adresse); 199 $template->assign( 'coordinates', 200 array('LAT' => '100', 201 'LON' => '100', 202 'ADRESSE' => $adresse, 203 'ZOOM' => 18, 204 ) 205 ); 206 if (isset($_POST['submit']) and $_POST['submit']==l10n('selection' )) 207 { 215 208 216 209 if (isset($collection)) 217 210 { 218 211 $lat =1000; 219 220 if ($match<>"" && $match<>"/" ) 221 { 222 $match=str_replace(" ","+",$match); 223 $src="http://maps.google.com/maps/geo?q=".$match."&output=xml&sensor=true_or_false&key=".$conf['gmaps_api_key']; 224 //json,kml,xml,csv 225 226 $location = file_get_contents($src); 227 $location = explode("coordinates>",$location ); 228 $location = explode(",",$location[1]); 229 $lat=$location[1]; 230 $lon=$location[0]; 231 $adresse ="Europe"; 232 if (date_default_timezone_get()) { 233 $adresse = date_default_timezone_get() ; 234 } 235 236 237 $template->assign( array('lat' => $lat , 238 'lon' => $lon ,)); 212 foreach ($collection as $id_0) { 213 foreach ($images as $image) { 214 if (array_search($id_0,$image)) { 215 $_POST['selection'] = $collection ; 216 217 if ($lat==1000) { 218 $lat1= ($image['lat'] <> '') ? $image['lat'] : '100' ; 219 $lon1= ($image['lon'] <> '') ? $image['lon'] : '3.0' ; 220 if($lat1 != '100') $lat=$image['lat']; 221 239 222 $template->assign( 'coordinates', 240 array('LAT' => $lat, 241 'LON' => $lon, 242 'ADRESSE' => $adresse, 223 array('LAT' => $lat1 , 224 'LON' => $lon1 , 225 'ADRESSE' => $adresse , 226 'ZOOM' => 4, 243 227 ) 244 228 ); 245 }246 247 foreach ($collection as $id_0) {248 $adresse ="Europe/Paris";249 if (date_default_timezone_get()) {250 $adresse ="'" . date_default_timezone_get() ."'" ;251 }252 253 254 foreach ($images as $image) {255 256 if (array_search($id_0,$image)) {257 if ($lat==1000) {258 $lat= ($image['lat'] <> '') ? $image['lat'] : '100' ;259 $lon= ($image['lon'] <> '') ? $image['lon'] : '3.0' ;260 261 $template->assign( array('zoom' => 4,'lat' => $lat , 'lon' => $lon , ) );262 $template->assign( 'coordinates',263 array('LAT' => $lat,264 'LON' => $lon,265 'ADRESSE' => $adresse,266 )267 );268 229 269 230 } 270 231 271 232 $tpl_var = array_merge( 272 233 $image, 273 234 array( 274 'src' => $src,275 ' match' => $_POST['match'],276 ' check' => $_POST['submit'],235 'lat' => $image['lat'] , 236 'lon' => $image['lon'] , 237 'adresse' => $adresse , 277 238 'U_TN' => get_thumbnail_url($image), 278 239 'TITLE' => get_thumbnail_title($image), … … 286 247 ) 287 248 ); 288 289 $template->append('Selectthumbnails', $tpl_var); 290 291 } 292 } 293 } 294 295 296 } 297 if (isset($_POST['submit']) ) 298 { if ($_POST['submit']==l10n('Submit') ) 299 { 300 $_POST['selection']=array(); 301 $collection =array(); 302 } 303 } 249 250 $template->append('Selectthumbnails', $tpl_var); 251 } 252 } 253 } 254 } 255 } 256 304 257 //======================================================================= 305 258 -
extensions/edit_gmaps/admin/admin_edit.tpl
r8466 r8501 1 1 {html_head} 2 2 {* $Id: admin_edit.tpl 2011-01-03 *} 3 4 3 {known_script id="jquery" src=$ROOT_URL|@cat:"themes/default/js/jquery.packed.js" } 5 4 {known_script id="jquery.cluetip" src=$ROOT_URL|@cat:"themes/default/js/plugins/jquery.cluetip.packed.js"} … … 8 7 {known_script id="jquery.ui.resizable" src=$ROOT_URL|@cat:"themes/default/js/ui/ui.resizable.js"} 9 8 {known_script id="EDIT_RV_script" src=$EDIT_RV_ROOT|@cat:"js/JScript.js"} 10 11 <script src="http://maps.google.com/maps/api/js?sensor=false&hl={$lang_info.code}" type="text/javascript"></script> 12 <script src="http://ajax.googleapis.com/ajax/libs/prototype/1.6.1.0/prototype.js" type="text/javascript"></script> 13 14 15 <style type="text/css">{literal} 16 #cadre{ background-color:Beige; border-width:5px; 17 left:0px; 18 width:500px; 19 height:500px; 20 21 } 22 9 {known_script id="fieldset" src=$EDIT_RV_ROOT|@cat:"js/fieldset.js"} 10 11 {assign var='visible' value = true } 12 {if not empty($Selectthumbnails) } 13 <script src="http://maps.google.com/maps/api/js?sensor=false&hl={$lang_info.code}" type="text/javascript"></script> 14 <script src="http://ajax.googleapis.com/ajax/libs/prototype/1.6.1.0/prototype.js" type="text/javascript"></script> 15 16 17 <script type="text/javascript"> 18 {if isset($coordinates) && $coordinates.LAT <= 90 } 19 var coordinates={ldelim} 20 LAT:'{$coordinates.LAT}', 21 LON:'{$coordinates.LON}', 22 ADRESSE:'{$coordinates.ADRESSE}', 23 ZOOM:18 24 }; 25 {else} 26 var coordinates={ldelim} 27 LAT:' ', 28 LON:' ', 29 ADRESSE:'{$coordinates.ADRESSE}', 30 ZOOM:4 31 }; 32 {/if} 33 34 Event.observe(window, 'load', onLoad ); 35 36 </script> 37 {/if} 38 39 <style type="text/css">{literal} 23 40 #map{ 24 41 left:0px; … … 27 44 border:outset; 28 45 } 29 46 30 47 31 48 {/literal} … … 35 52 36 53 {/html_head} 37 38 <fieldset> 39 <legend>{'Display options'|@translate}</legend> 40 <table ><td class="cluetip" title="{'set'|translate}|{'hlp_line1'|@translate}." align="left" > 41 <form> 42 Set: 43 <select onchange="document.location = this.options[this.selectedIndex].value;" > 44 <optgroup label="Specials"> 45 {html_options options=$specials} 46 </optgroup> 47 <optgroup label="{'Categories'|@translate}"> 48 {html_options options=$categories selected=$categories_selected} 49 </optgroup> 50 <!-- <optgroup label="{'Tags'|@translate}"></optgroup> --> 51 </select> 52 </form> 53 </td> 54 <td > {'hlp_line2'|@translate} </td> 55 56 </table> 57 58 59 <p>{'elements per page'|@translate}: 60 <a href="{$U_DISPLAY}&display=20">20</a> 61 | <a href="{$U_DISPLAY}&display=50">50</a> 62 | <a href="{$U_DISPLAY}&display=100">100</a> 63 | <a href="{$U_DISPLAY}&display=all">{'all'|@translate}</a> 64 </p> 54 55 56 57 58 <fieldset class="fieldset"> 59 <legend>{'Display options'|@translate}</legend> 60 <table ><td class="cluetip" title="{'set'|translate}|{'hlp_line1'|@translate}." align="left" > 61 <form> 62 Set: 63 <select onchange="document.location = this.options[this.selectedIndex].value;" > 64 <optgroup label="Specials"> 65 {html_options options=$specials} 66 </optgroup> 67 <optgroup label="{'Categories'|@translate}"> 68 {html_options options=$categories selected=$categories_selected} 69 </optgroup> 70 <!-- <optgroup label="{'Tags'|@translate}"></optgroup> --> 71 </select> 72 </form> 73 </td> 74 <td > {'hlp_line2'|@translate} </td> 75 </table> 76 <p>{'elements per page'|@translate}: 77 <a href="{$U_DISPLAY}&display=20">20</a> 78 | <a href="{$U_DISPLAY}&display=50">50</a> 79 | <a href="{$U_DISPLAY}&display=100">100</a> 80 | <a href="{$U_DISPLAY}&display=all">{'all'|@translate}</a> 81 </p> 82 </fieldset> 83 {if empty($Selectthumbnails) }{/if} 84 85 86 <form action="" method="post" id="Envoie" name="Envoie" > 87 {if not empty($thumbnails) && empty($Selectthumbnails) } {/if} 88 89 <fieldset id="Elements" class="fieldset"> 90 <legend>{'Elements'|@translate}</legend> 91 92 {if !empty($navbar) }{include file='navigation_bar.tpl'} {/if} 93 <fieldset > 94 <ul class="thumbnails"> 95 {foreach from=$thumbnails item=thumbnail} 96 <li><span class="wrap1"> 97 <label> 98 <span class="wrap2"><span> 99 <img src="{$thumbnail.U_TN}" alt="{$thumbnail.file}" title="{$thumbnail.TITLE}" class="thumbnail" /> 100 </span></span> 101 <input type="checkbox" name="selection[]" value="{$thumbnail.id}" /> 102 </label> 103 <span class="thumbLegend"> 104 {if isset($thumbnail.U_MAP)} 105 <a href="{$thumbnail.U_MAP}" target="_blank">{$thumbnail.lat},{$thumbnail.lon}</a> 106 {/if} 107 {$thumbnail.file} 108 </span> 109 110 </span> 111 </li> 112 {/foreach} 113 </ul> 114 </fieldset> 115 116 <fieldset> 117 <label> {'target'|@translate}</label> 118 <table> 119 <td><label><input type="radio" name="target" value="all" /> {'all'|@translate}</label></td> 120 <td><label><input type="radio" name="target" value="selection" checked="checked" /> {'selection'|@translate}</label></td> 121 <td><input class="cluetip submit " title="{'selection'|@translate}|{'hlp_line3'|@translate}." type="submit" name="submit" value="{'selection'|@translate}" {$tag_input_enabled} /></td> 122 </table> 123 </fieldset> 65 124 </fieldset> 66 67 68 <form action="" method="post" id="Envoie" name="Envoie" > 69 {if !$lat} 70 <fieldset > 71 <legend>{'Elements'|@translate}</legend> 72 73 <div class="navigationBar">{$NAV_BAR}</div> 74 {if not empty($thumbnails)} 75 <ul class="thumbnails"> 76 {foreach from=$thumbnails item=thumbnail} 77 <li><span class="wrap1"> 78 <label> 79 <span class="wrap2"><span> 80 <img src="{$thumbnail.U_TN}" alt="{$thumbnail.file}" title="{$thumbnail.TITLE}" class="thumbnail" /> 81 </span></span> 82 <input type="checkbox" name="selection[]" value="{$thumbnail.id}" /> 83 </label> 84 85 <span class="thumbLegend"> 86 {if isset($thumbnail.U_MAP)} 87 <a href="{$thumbnail.U_MAP}" target="_blank">{$thumbnail.lat},{$thumbnail.lon}</a> 88 {/if} 89 </span> 90 91 </span> 92 </li> 93 {/foreach} 94 </ul> 95 {/if} 96 </fieldset> 97 {/if} 98 99 100 <fieldset> 101 <legend>{'map'|@translate}</legend> 102 103 <input class="cluetip" title="{'selection'|@translate}|{'hlp_line3'|@translate}." type="submit" name="submit" value="{'selection'|@translate}" /> 104 <input class="cluetip" title="{'reset'|@translate}|{'hlp_line4'|@translate}." type="submit" name="submit" value="{'reset'|@translate}" /><br /> 105 106 <input class="cluetip" title="{'search_title'|@translate}|{'hlp_line6'|@translate}." type="submit" name="submit" value="{'search_title'|@translate}" onclick="codeAddress()" /> 107 <input class="cluetip" title="{'lieu'|@translate}|{'hlp_line5'|@translate}." type="text" size="70" value="{$match}" name="match" id="match" /> 108 109 {if $lat} 110 <fieldset> 111 <table> 112 <td><div id="markerStatus"></div></td> 113 <td><div id="markerAdress"></div></td> 114 </table> 115 116 117 <div id="map"></div> 118 119 {if not empty($Selectthumbnails)} 125 <script> 126 {if empty($Selectthumbnails) } 127 128 var no_affiche=true ; 129 {else} 130 var no_affiche=false ; 131 {/if} </script> 132 <fieldset id ="geoposition" class="fieldset"> 133 <legend>{'Selection'|@translate}</legend> 134 135 <fieldset> 120 136 <ul class="thumbnails"> 121 137 {foreach from=$Selectthumbnails item=thumbnail} … … 135 151 {$thumbnail.file} 136 152 </span> 137 138 153 </span> 139 </li> 140 154 </li> 141 155 {/foreach} 142 156 </ul> 143 {/if}144 <script type="text/javascript">145 {if isset($coordinates) && $coordinates.LAT != 100 }146 var coordinates={ldelim}147 LAT:{$coordinates.LAT},148 LON:{$coordinates.LON},149 ADRESSE:{$coordinates.ADRESSE}150 };151 152 {else}153 var coordinates={ldelim}154 LAT:100,155 LON:100,156 ADRESSE:{$coordinates.ADRESSE}157 };158 {/if}159 160 161 162 163 Event.observe(window, 'load', onLoad );164 if (typeof $Moot == "undefined") $Moot = [];165 $Moot.push(Window.$);166 167 168 </script>169 170 157 </fieldset> 171 {/if} 172 173 <fieldset> 174 <legend>{'Form'|@translate}</legend> 175 <label>Latitude (-90=S to 90=N) 176 <input type="text" size="8" value="{$lat}" name="lat" /> 177 </label> 178 <label>Longitude (-180=E to 180=W) 179 <input type="text" size="9"value="{$lon}" name="lon" /> 180 </label> 181 <p> 182 {'target'|@translate} 183 <label><input type="radio" name="target" value="all" /> {'all'|@translate}</label> 184 <label><input type="radio" name="target" value="selection" checked="checked" /> {'selection'|@translate}</label> 185 </p> 186 187 <p><input class="submit" type="submit" value="{'Submit'|@translate}" name="submit" {$tag_input_enabled} /></p> 188 </fieldset> 189 190 </fieldset> 158 <fieldset> 159 <label>{'command'|@translate}</label> 160 161 <table> 162 <td> 163 <input class="cluetip" title="{'reset'|@translate}|{'hlp_line4'|@translate}." type="submit" name="submit" value="{'reset'|@translate}" /><br /> 164 </td> 165 <td> 166 <input class="cluetip" title="{'selection'|@translate}|{'hlp_line3'|@translate}." type="submit" name="submit" value="{'selection'|@translate}" /> 167 </td> 168 </table> 169 170 <label>{'Form'|@translate}</label> 171 <table> 172 <td > 173 174 <input class="cluetip" title="{'search_title'|@translate}|{'hlp_line6'|@translate}." type=button value="{'search_title'|@translate}" id="search" /> 175 176 <input class="cluetip" title="{'lieu'|@translate}|{'hlp_line5'|@translate}." type="text" size="70" value="{$match}" name="match" id="match" /> 177 </td> 178 <tr> 179 <td> 180 <label>Latitude (-90=S to 90=N)</label> 181 <input type="text" size="8" value="{$lat}" name="lat" /> 182 </td> 183 <td> 184 <label>Longitude (-180=E to 180=W) </label> 185 <input type="text" size="9"value="{$lon}" name="lon" /> 186 </td> 187 </tr><tr> 188 189 <td><input class="submit" type="submit" value="{'Submit'|@translate}" name="submit" {$tag_input_enabled} /></td> 190 </td></tr> 191 </table> 192 </fieldset> 193 194 <fieldset> 195 <label>{'map'|@translate}</label> 196 <table> 197 <td><div id="markerStatus"></div></td> 198 <td><div id="markerAdress"></div></td> 199 </table> 200 <div id="map"></div> 201 </fieldset> 202 </fieldset> 203 191 204 </form> 192 193 -
extensions/edit_gmaps/admin/js/JScript.js
r8466 r8501 9 9 function onLoad() { 10 10 var reg = new RegExp('/', "g"); 11 12 coordinates.ADRESSE= coordinates.ADRESSE.replace("/",", "); 11 12 if (coordinates.ADRESSE) 13 coordinates.ADRESSE = coordinates.ADRESSE.replace("/", ", "); 13 14 14 15 document.getElementById("match").value = coordinates.ADRESSE; 15 16 geocoder = new google.maps.Geocoder(); 16 17 var mapElement = document.getElementById("map"); 17 if ( coordinates.LAT <= 90 ) { 18 19 n = coordinates.ADRESSE.indexOf("/"); 20 if (n>0) 21 zoom = 5; 22 else 23 zoom = 18 ; 18 if (coordinates.LAT <= 90 && coordinates.LAT != " " && coordinates.LAT != "" ) { 19 24 20 } else { 25 21 coordinates.LAT=49 ;coordinates.LON = 3; 26 22 coordinates.ZOOM = coordinates.ZOOM | 18; 27 23 geocoder.geocode({ 'address': coordinates.ADRESSE }, function (results, status) { 28 24 /* Si l'adresse a pu être géolocalisée */ … … 36 32 } 37 33 }); 38 39 zoom = 4;34 35 40 36 } 41 37 zoom = coordinates.ZOOM; 42 38 LatLng = new google.maps.LatLng(coordinates.LAT, coordinates.LON); 43 39 … … 113 109 document.Envoie.lat.value=latLng.lat() ; 114 110 document.Envoie.lon.value = latLng.lng(); 111 115 112 116 113 } 117 114 118 function updateMarkerAddress(str) { 119 document.getElementById('markerAdress').innerHTML = str; 120 115 function updateMarkerAddress(str) { 116 document.getElementById('markerAdress').innerHTML = str; 117 118 jQuery("#match").val(str); 121 119 } 122 120 … … 161 159 } 162 160 }); 163 } 164 165 166 167 168 jQuery().ready(function () { 169 170 171 jQuery('.cluetip').cluetip({ 172 width: 300, height: 100, 173 splitTitle: '|' 174 } 161 } 162 163 //======================================================= 164 function On_Click(a, b, c) { 165 document.Envoie.lat.value = b; 166 document.Envoie.lon.value = c; 167 168 coordinates = {LAT:a, 169 LON : b} ; 170 LatLng = new google.maps.LatLng(coordinates.LAT, coordinates.LON); 171 updateMarkerPosition(LatLng); 172 173 174 } 175 176 jQuery(window).load( 177 178 function () { 179 //Récupérer tous les inputs radios appartenant à un même groupe 180 /* a = jQuery('input[type=hidden][name=Selectthumbnail]'); 181 b = a.length; 182 c = jQuery('input[type=hidden]:checked').length; 183 d = jQuery('input[type=hidden][name="Selectthumbnail"]').attr('value'); 184 */ 185 186 // onLoad(); 187 }); 188 189 jQuery(document).ready(function () { 190 191 192 jQuery('.cluetip').cluetip({ 193 width: 300, height: 100, 194 splitTitle: '|' 195 } 175 196 ); 176 177 // Resize possible 178 jQuery("#cadre").resizable({ 179 handles: "all", 180 animate: true, 181 animateDuration: "slow", 182 animateEasing: "swing", 183 preventDefault: true, 184 preserveCursor: true, 185 autoHide: true, 186 ghost: true 187 }); 188 189 jQuery("#match").keydown(function (e) { 190 191 // e.target pour FireFox 192 // event.srcElement pour IE 193 var Obj = e ? e.target : event.srcElement; 194 if (Obj.tagName != "INPUT") return false; 195 196 197 var Code = e.keyCode || e.which; 198 if (Code != 13) return true; 199 coordinates.ADRESSE= document.getElementById("match").value ; 200 codeAddress(); 201 return false; 202 }); 203 204 205 }); 206 197 jQuery("#search").click(function (e) { 198 199 coordinates = { ADRESSE: jQuery("#match").val(), 200 LAT:0,LON:0,ZOOM: 18 201 }; 202 codeAddress(); 203 return false; 204 }); 205 206 jQuery("#match").keydown(function (e) { 207 // e.target pour FireFox 208 // event.srcElement pour IE 209 var Obj = e ? e.target : event.srcElement; 210 if (Obj.tagName != "INPUT") return false; 211 var Code = e.keyCode || e.which; 212 if (Code != 13) return true; 213 coordinates = { ADRESSE: jQuery("#match").val(), 214 LAT:0,LON:0,ZOOM: 18 215 }; 216 codeAddress(); 217 return false; 218 }); 219 220 221 }); 222
Note: See TracChangeset
for help on using the changeset viewer.