Changeset 1226
- Timestamp:
- 09/19/10 19:05:05 (3 years ago)
- Location:
- g-map
- Files:
-
- 2 added
- 1 removed
- 13 modified
- 3 moved
-
de.xml (modified) (1 diff)
-
en.xml (modified) (1 diff)
-
files/icon/gmap32.png (deleted)
-
files/icon/gmapL.png (moved) (moved from g-map/files/icon/gmap48.png)
-
files/icon/gmapM.png (moved) (moved from g-map/files/icon/gmap24.png)
-
files/icon/gmapS.png (moved) (moved from g-map/files/icon/gmap16.png)
-
files/lib/data/gmap/GmapApi.class.php (modified) (3 diffs)
-
files/lib/data/gmap/GmapCluster.class.php (modified) (1 diff)
-
files/lib/page/MapAjaxPage.class.php (modified) (3 diffs)
-
files/lib/system/event/listener/GMapUserPageListener.class.php (modified) (2 diffs)
-
files/style/g-map.css (modified) (1 diff)
-
install.sql (modified) (1 diff)
-
optionals/de.gmap.wbb/de.xml (added)
-
optionals/de.gmap.wbb/en.xml (added)
-
optionals/de.gmap.wbb/package.xml (modified) (3 diffs)
-
optionals/de.gmap.wcf.data.message.bbcode.map/files/lib/data/message/bbcode/MapBBCode.class.php (modified) (5 diffs)
-
optionals/de.gmap.wcf.data.message.bbcode.map/package.xml (modified) (1 diff)
-
templates/mapOverview.tpl (modified) (1 diff)
-
templates/userProfileMapSide.tpl (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
g-map/de.xml
r1222 r1226 21 21 <item name="wcf.acp.group.option.user.profile.gmap.personalMap.description"><![CDATA[Kann der Benutzer eigene Karten anlegen? Wenn ja, wieviele?]]></item> 22 22 </category> 23 <category name="wcf.map"> 24 <item name="wcf.map.copyright.small"><![CDATA[Karten Erweiterung, easy-coding.de]]></item> 25 </category> 23 26 </language> -
g-map/en.xml
r1222 r1226 21 21 <item name="wcf.acp.group.option.user.profile.gmap.personalMap.description"><![CDATA[Can the user add personal maps? If true, how many maps can he add?]]></item> 22 22 </category> 23 <category name="wcf.map"> 24 <item name="wcf.map.copyright.small"><![CDATA[Map Extension, easy-coding.de]]></item> 25 </category> 23 26 </language> -
g-map/files/lib/data/gmap/GmapApi.class.php
r1224 r1226 23 23 $apikey = explode(":", $apikey); 24 24 if(count($apikey) == 2) { 25 $this->apikey = $apikey ;25 $this->apikey = $apikey[1]; 26 26 } 27 27 } … … 43 43 return; 44 44 } 45 46 $res = array(); 45 47 46 48 $lookupstring = urlencode(StringUtil::trim($location)); … … 52 54 $io = @fsockopen($req_url, 80, $errno, $errstr, 5 ); 53 55 if ($io) { 54 $send = "GET /maps/geo?q=".$lookupstring."&key=".$ apikey."&output=csv HTTP/1.1\r\n";56 $send = "GET /maps/geo?q=".$lookupstring."&key=".$this->apikey."&output=csv HTTP/1.1\r\n"; 55 57 $send .= "Host: maps.google.com\r\n"; 56 58 $send .= "Accept-Language: de, en;q=0.50\r\n"; -
g-map/files/lib/data/gmap/GmapCluster.class.php
r1224 r1226 81 81 /* Compare against all markers which are left. */ 82 82 foreach ($markers as $key => $target) { 83 $pixels = $this->pixelDistance($marker['lat'], $marker['lon'], $target['lat'], $target['lon'], $ zoom);83 $pixels = $this->pixelDistance($marker['lat'], $marker['lon'], $target['lat'], $target['lon'], $this->zoom); 84 84 85 85 /* If two markers are closer than given distance remove */ 86 86 /* target marker from array and add it to cluster. */ 87 if ($ distance > $pixels) {87 if ($this->distance > $pixels) { 88 88 unset($markers[$key]); 89 89 $cluster[] = $target; -
g-map/files/lib/page/MapAjaxPage.class.php
r1223 r1226 14 14 */ 15 15 class MapAjaxPage extends AbstractPage { 16 protected $zoom; 17 protected $distance = 30; 16 protected $zoom = 0; 17 protected $distance = 10; 18 protected $bounds= array(); 19 protected $initialized = false; 18 20 19 21 protected $markers = array(); … … 25 27 parent::readParameters(); 26 28 27 $this->zoom = min(max(21, $_GET['zoom']), 0); 29 $this->zoom = max(min(21, isset($_GET['zoom']) ? $_GET['zoom'] : 0), 0); 30 31 // ((50.08930948264218, 10.298652648925781), (50.14434619645057, 10.506362915039062)) 32 if(isset($_GET['bounds'])) { 33 if(preg_match('\((\d+\.?\d*), (\d+\.?\d*)\), \((\d+\.?\d*), (\d+\.?\d*)\)', $_GET['bounds'], $match)) { 34 $this->bounds = $match; 35 } 36 } 37 38 // just get bounds 39 $this->initialized = isset($_GET['initialized']) && $_GET['initialized']; 28 40 } 29 41 … … 39 51 Y(pt) AS lat 40 52 FROM wcf'.WCF_N.'_gmap_user'; 53 54 if(!$this->initialized) { 55 $sql = 'SELECT AVG(lon) AS lon, 56 AVG(lat) AS lat 57 FROM ( 58 '.$sql.' 59 ) x'; 60 } 41 61 42 62 $result = WCF::getDB()->sendQuery($sql); -
g-map/files/lib/system/event/listener/GMapUserPageListener.class.php
r1222 r1226 11 11 */ 12 12 class GMapUserPageListener implements EventListener { 13 protected $coordinate = null; 14 protected $personal_maps = array(); 15 protected $userID = 0; 13 16 14 17 /** … … 16 19 */ 17 20 public function execute($eventObj, $className, $eventName) { 18 19 20 return; // TODO: disabled 21 21 $this->eventObj = $eventObj; 22 $this->className = $className; 23 22 24 $this->$eventName(); 23 25 } 24 26 25 27 protected function readData() { 28 $this->userID = $this->eventObj->frame->getUserID(); 26 29 30 // read user location 31 $sql = 'SELECT X(pt) AS lon, 32 Y(pt) AS lat 33 FROM wcf'.WCF_N.'_gmap_user 34 WHERE userID = '.intval($this->userID); 35 $result = WCF::getDB()->sendQuery($sql); 36 $this->coordinate = WCF::getDB()->fetchArray($result); 37 38 // read personal maps 39 if(false) { // TODO: feature disabled for the moment 40 $sql = 'SELECT mapID 41 FROM wcf'.WCF_N.'_gmap_personal 42 WHERE userID = '.intval($this->userID); 43 $result = WCF::getDB()->sendQuery($sql); 44 while ($row = WCF::getDB()->fetchArray($result)) { 45 $this->personal_maps[] = $row; 46 } 47 } 27 48 } 28 49 29 50 protected function assignVariables() { 30 31 WCF::getTPL()->assign(array( 32 'user' => $user, 33 'gmap_map_key' => $this->map_key 34 )); 35 36 // if user position exists 37 WCF::getTPL()->append('additionalBoxes2', WCF::getTPL()->fetch('userProfileMapSide')); 51 if($this->coordinate) { 52 WCF::getTPL()->assign(array( 53 'coordinate' => $this->coordinate 54 )); 55 // if user position exists 56 WCF::getTPL()->append('additionalBoxes2', WCF::getTPL()->fetch('userProfileMapSide')); 57 } 38 58 39 59 // if user is owner or user has personal maps 40 WCF::getTPL()->append('additionalContents3', WCF::getTPL()->fetch('userProfileMapCenter')); 60 if(WCF::getUser()->userID == $this->userID || $this->personal_maps) { 61 WCF::getTPL()->append('additionalContents3', WCF::getTPL()->fetch('userProfileMapCenter')); 62 } 41 63 } 42 64 } -
g-map/files/style/g-map.css
r1029 r1226 5 5 * @license GNU General Public License <http://opensource.org/licenses/gpl-3.0.html> 6 6 */ 7 #mapAdministration { 8 width:250px; 9 float:right; 10 text-align:right; 11 } 12 #gmapAdminButtons { 13 display:none; 14 } 15 #map { 16 color:#000000; 17 } 18 #map a { 19 color:#154268; 20 } 21 #map .markerLabel { 22 color:#ffffff; 23 } 24 .LabeledMarker_markerLabel { 25 color:#ffffff; 26 } 27 .gmap_b { 28 color:#000; 29 width:250px; 30 } 31 .gmap_h { 32 font-weight:bold; 33 background-color:#efefef; 34 background-repeat:no-repeat; 35 background-position:left center; 36 padding:5px; 37 padding-left:25px; 38 cursor:pointer; 39 } 40 #gmap_notice { 41 display:none; 42 position:absolute; 43 padding:8px 0px 8px 0px; 44 top:0px; 45 left:0px; 46 width:100%; 47 text-align:center; 48 background-color:#ffff00; 49 opacity:0.75; 50 filter:alpha(opacity=75); 51 } 52 #gmap_controls div { 53 position:absolute; 54 left:7px; 55 top:0px; 56 width:175px; 57 height:20px; 58 border:1px solid #000000; 59 background-color:#ffffff; 60 overflow:hidden; 61 } 62 #gmap_loading { 63 display:none; 64 position:absolute; 65 top:0px; 66 left:0px; 67 width:100%; 68 height:100%; 69 background-color:#000000; 70 opacity:0.45; 71 filter:alpha(opacity=45); 72 } 73 #gmap_loading_img, #gmap_loading_message { 74 display:none; 75 position:absolute; 76 top:175px; 77 left:0px; 78 width:100%; 79 text-align:center; 80 color:#ffffff; 81 font-size:14pt; 82 } 7 -
g-map/install.sql
r1223 r1226 2 2 mapID int(10) UNSIGNED NOT NULL auto_increment, 3 3 userID int(10) UNSIGNED NOT NULL DEFAULT 0, 4 PRIMARY KEY (mapID) ,4 PRIMARY KEY (mapID) 5 5 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 6 6 -
g-map/optionals/de.gmap.wbb/package.xml
r1221 r1226 8 8 <packagedescription language="fr"><![CDATA[Ce paquet ajoute quelques optimisations WBB Ã la G-Map pour le WCF.]]></packagedescription> 9 9 <packagedescription language="tr"><![CDATA[Bu Paket G-Mapin Bazi Ãzelliklerini WBB Uyarliyor.]]></packagedescription> 10 <isunique> 1</isunique>10 <isunique>0</isunique> 11 11 <version>2.0.0 RC 1</version> 12 12 <date>DATE</date> … … 21 21 <requiredpackages> 22 22 <requiredpackage minversion="3.1.0 RC 1">com.woltlab.wbb</requiredpackage> 23 <requiredpackage minversion=" 1.3.0">de.gmap.wcf.data.page.map</requiredpackage>23 <requiredpackage minversion="2.0.0 RC 1">de.gmap.wcf.data.page.map</requiredpackage> 24 24 </requiredpackages> 25 25 … … 27 27 <files>files.tar</files> 28 28 <eventlistener>eventlistener.xml</eventlistener> 29 <languages languagecode="de">de.xml</languages> 30 <languages languagecode="en">en.xml</languages> 29 31 </instructions> 30 32 -
g-map/optionals/de.gmap.wcf.data.message.bbcode.map/files/lib/data/message/bbcode/MapBBCode.class.php
r763 r1226 2 2 require_once(WCF_DIR.'lib/data/message/bbcode/BBCodeParser.class.php'); 3 3 require_once(WCF_DIR.'lib/data/message/bbcode/BBCode.class.php'); 4 require_once(WCF_DIR.'lib/util/MapDiscover.class.php');5 require_once(WCF_DIR.'lib/util/BoundsUtil.class.php');6 4 7 5 /** … … 13 11 */ 14 12 class MapBBCode implements BBCode { 15 // map key default setting16 public $map_key = MAP_API;17 13 18 14 /** … … 84 80 * e.g. Berlin deutschland 85 81 */ 86 private function parseGeocoder( $data, &$stream, &$zoom) {82 private function parseGeocoder(&$data, &$stream, &$zoom) { 87 83 $first = array_shift($data); 88 89 $google = new MapDiscover(); 90 $res = $google->search($first); 91 $stream[] = $res['x'].','.$res['y']; 84 85 require_once(WCF_DIR.'lib/data/gmap/GmapApi.class.php'); 86 $api = new GmapApi(); 87 $res = $api->search($first); 88 if($res) { 89 $stream[] = $res['lat'].','.$res['lon']; 90 } 92 91 93 92 if(count($data) > 0) { … … 102 101 $bounds = new BoundsUtil(); 103 102 $id = rand(); 103 104 104 $code = '<div id="map'.$id.'" style="width: 100%; height: 300px;"></div> 105 105 <script src="http://maps.google.com/maps?file=api&v=2.118&key='.$this->map_key.'&oe='.CHARSET.'" type="text/javascript"></script> … … 154 154 */ 155 155 public function getParsedTag($openingTag, $content, $closingTag, BBCodeParser $parser) { 156 157 // TODO: feature disabled 158 return $content; 159 156 160 $zoom = isset($openingTag['attributes'][0]) ? $openingTag['attributes'][0] : null; 157 161 $content = explode("\n", StringUtil::unifyNewlines($content)); -
g-map/optionals/de.gmap.wcf.data.message.bbcode.map/package.xml
r1221 r1226 17 17 <requiredpackages> 18 18 <requiredpackage minversion="1.0.0">com.woltlab.wcf.data.message.bbcode</requiredpackage> 19 <requiredpackage minversion=" 1.3.0">de.gmap.wcf.data.page.map</requiredpackage>19 <requiredpackage minversion="2.0.0 RC 1">de.gmap.wcf.data.page.map</requiredpackage> 20 20 </requiredpackages> 21 21 -
g-map/templates/mapOverview.tpl
r1222 r1226 6 6 {include file='gmapConstants'} 7 7 <script src="{@RELATIVE_WCF_DIR}js/gmap/Map.class.js" type="text/javascript"></script> 8 <script type="text/javascript" src="{@RELATIVE_WCF_DIR}js/AjaxRequest.class.js"></script> 8 9 <script type="text/javascript"> 9 10 //<![CDATA[ 10 11 if (GMAP_API_KEY != '') { 11 document.write('<script src="http://maps.google.com/maps?file=api&v=2.118&hl={@$this->language->getLanguageCode()}&key=' + GMAP_API_KEY + '&oe={CHARSET}" type="text/javascript"><\/script>'); 12 onloadEvents.push(function() { 13 if (GBrowserIsCompatible()) { 14 var gmap = new Map('{@$id}'); 15 {if $location|isset}gmap.setLocation('{$location|encodeJS}'); 16 {elseif $latitude|isset && $longitude|isset} 17 var coordinates = new GLatLng({@$latitude}, {@$longitude}); 18 gmap.setCoordinates(coordinates); 19 {/if} 20 21 // init route 22 var gmapRoute = new MapRoute(gmap); 23 } 24 }); 12 document.write('<script src="http://maps.google.com/maps?file=api&v=2.118&hl={@$this->language->getLanguageCode()}&key=' + GMAP_API_KEY + '&oe={CHARSET}" type="text/javascript"><\/script>'); 13 onloadEvents.push(function() { 14 if (GBrowserIsCompatible()) { 15 16 var AjaxMap = function(url, divID, switchable) { 17 this.url = url; 18 this.constructor(divID, switchable); 19 20 this.update = function() { 21 url = this.url; 22 23 if(this.mapInitialized) { 24 url += '&zoom='+this.gmap.getZoom(); 25 url += '&bounds='+this.gmap.getBounds(); 26 url += '&initialized=1'; 27 } 28 29 var ajaxRequest = new AjaxRequest(); 30 ajaxRequest.openGet(url + SID_ARG_2ND, function(map) { 31 return function() { 32 if(ajaxRequest.xmlHttpRequest.readyState == 4 && ajaxRequest.xmlHttpRequest.status == 200) { 33 var data = eval('(' + ajaxRequest.xmlHttpRequest.responseText + ')'); 34 var coordinates; 35 36 if(map.mapInitialized) { 37 map.gmap.clearOverlays(); 38 for(var i in data) { 39 coordinates = new GLatLng(data[i].lat, data[i].lon); 40 map.gmap.addOverlay(new GMarker(coordinates)); 41 } 42 } else { 43 coordinates = new GLatLng(data[0].lat, data[0].lon); 44 map.setCoordinates(coordinates); 45 map.gmap.clearOverlays(); 46 47 map.update(); 48 map.setEvents(); 49 } 50 } 51 }; 52 }(this)); 53 }; 54 55 this.setEvents = function() { 56 GEvent.addListener(this.gmap, "moveend", function(map) { 57 return function() { 58 map.update(); 59 } 60 }(this)); 61 } 62 }; 63 AjaxMap.prototype = new Map(); 64 65 gmap = new AjaxMap('index.php?page=MapAjax', 'gmap'); 66 gmap.update(); 67 } 68 }); 25 69 } 26 70 //]]> 27 71 </script> 28 29 <script type="text/javascript" src="{@RELATIVE_WCF_DIR}js/AjaxRequest.class.js"></script>30 72 </head> 31 <body >73 <body{if $templateName|isset} id="tpl{$templateName|ucfirst}"{/if}> 32 74 {include file="header" sandbox=false} 33 75 <div id="main"> 34 76 <ul class="breadCrumbs"> 35 <li><a href="index.php {@SID_ARG_1ST}"><img src="icon/indexS.png" alt="" /> <span>{PAGE_TITLE}</span></a> »</li>77 <li><a href="index.php?page=Index{@SID_ARG_2ND}"><img src="{icon}indexS.png{/icon}" alt="" /> <span>{lang}{PAGE_TITLE}{/lang}</span></a> »</li> 36 78 </ul> 37 79 38 {if $gmap_admin}<div id="mapAdministration"> 39 <a href="#" onclick="return gAdministrate(this, '{lang}wcf.map.administrateOn{/lang}', '{lang}wcf.map.administrateOff{/lang}')">{lang}wcf.map.administrateOn{/lang}</a> 40 <div class="largeButtons" id="gmapAdminButtons"> 41 <ul> 42 <li><a href="#" onclick="return gRequestAdd('{lang}wcf.map.markerClickToAdd{/lang}');"><img src="icon/g-map/markerAddM.png" alt="" /> <span>{lang}wcf.map.markerAdd{/lang}</span></a></li> 43 </ul> 44 </div> 45 </div>{/if} 46 47 <div class="mainHeadline" style="clear:none"> 48 <img src="icon/glob48.png" alt="" title="{lang}wcf.map.copyright{/lang}" /> 80 <div class="mainHeadline"> 81 <img src="{icon}gmapL.png{/icon}" alt="" /> 49 82 <div class="headlineContainer"> 50 <h2> {lang}wcf.header.menu.map{/lang}</h2> 51 <b id="gmap_usercount">...</b> {lang}wcf.map.counter_user{/lang} / <b id="gmap_markercount">..</b> {lang}wcf.map.counter_marker{/lang} 83 <h2>{lang}wcf.header.menu.map{/lang}</h2> 52 84 </div> 53 85 </div> 54 <div class="border"> 86 87 {if $userMessages|isset}{@$userMessages}{/if} 88 89 <div class="border content"> 55 90 <div class="container-1"> 56 91 <div style="position:relative"> 57 <!-- Map //--> 58 <div id="map" style="width: 100%; height: 500px"></div> 59 60 <!-- GroupFilter sub //--> 61 <div id="gmap_controls_sub"></div> 62 63 <!-- Controls //--> 64 <form method="post" action="" onsubmit="return false"> 65 <div id="gmap_controls"></div> 66 </form> 67 68 <!-- Messages //--> 69 <div id="gmap_notice"></div> 70 71 <!-- Loading //--> 72 <div id="gmap_loading"> </div> 73 <div id="gmap_loading_message"> </div> 74 75 <div id="gmap_loading_img"> 76 <img src="icon/g-map/loading.gif" alt="" /> 77 </div> 92 <div id="gmap"><div id="gmapCanvas" style="width: 100%; height: 500px"></div></div> 78 93 </div> 79 94 </div> 80 <a href="http://trac.easy-coding.de/trac/ g-map" class="externalURL" style="float:right">{lang}wcf.map.copyright_small{/lang}</a>95 <a href="http://trac.easy-coding.de/trac/wcf/wiki/Gmap" class="externalURL" style="float:right">{lang}wcf.map.copyright.small{/lang}</a> 81 96 </div> 97 </div> 82 98 83 </div>84 99 {include file="footer" sandbox=false} 85 86 100 </body> 87 101 </html> -
g-map/templates/userProfileMapSide.tpl
r1028 r1226 2 2 <div class="border"> 3 3 <div class="containerHead"> 4 <div class="containerIcon"><img src="{@RELATIVE_WCF_DIR}icon/ glob24.png" alt="" title="{lang}wcf.map.copyright{/lang}"/></div>4 <div class="containerIcon"><img src="{@RELATIVE_WCF_DIR}icon/mapM.png" alt="" title="{lang}wcf.map.copyright{/lang}"/></div> 5 5 <h3 class="containerContent">{lang}wcf.user.profile.map{/lang} </h3> 6 6 </div> 7 <div class="container-1" >8 <div id=" map" style="width: 100%; height: 260px; overflow:hidden"></div>7 <div class="container-1" id="userMap"> 8 <div id="userMapCanvas" style="width: 100%; height: 260px; overflow:hidden"></div> 9 9 </div> 10 10 </div> … … 18 18 onloadEvents.push(function() { 19 19 if (GBrowserIsCompatible()) { 20 var gmap = new Map('{@$id}'); 21 gmap.setLocation('{$user->location|encodeJS}'); 20 var map = new Map('userMap'); 21 coordinates = new GLatLng({$coordinate.lat}, {$coordinate.lon}); 22 map.setCoordinates(coordinates); 22 23 } 23 24 });
