Changeset 2510
- Timestamp:
- 01/28/10 16:41:54 (7 weeks ago)
- Location:
- branches/0.9/pylucid_project
- Files:
-
- 3 modified
-
media/PyLucid/OpenStreetMap.js (modified) (3 diffs)
-
pylucid_plugins/OpenStreetMap/admin.py (modified) (1 diff)
-
pylucid_plugins/OpenStreetMap/templates/OpenStreetMap/OpenStreetMap.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/0.9/pylucid_project/media/PyLucid/OpenStreetMap.js
r2487 r2510 4 4 var layer_markers; 5 5 6 function drawmap( lang_code, popuptext, lon, lat, zoom, marker_lon, marker_lat, marker_width, marker_height) {6 function drawmap(map_id, lang_code, popuptext, lon, lat, zoom, marker_lon, marker_lat, marker_width, marker_height) { 7 7 log("draw OpenStreetMap:"); 8 log("map_id:" + map_id); 8 9 log("lang_code:" + lang_code); 9 10 log("popuptext:" + popuptext); … … 14 15 OpenLayers.Lang.setCode(lang_code); 15 16 16 map = new OpenLayers.Map( 'map', {17 map = new OpenLayers.Map(map_id, { 17 18 projection: new OpenLayers.Projection("EPSG:900913"), 18 19 displayProjection: new OpenLayers.Projection("EPSG:4326"), … … 81 82 } 82 83 83 //~ function getCycleTileURL(bounds) {84 //~ var res = this.map.getResolution();85 //~ var x = Math.round((bounds.left - this.maxExtent.left) / (res * this.tileSize.w));86 //~ var y = Math.round((this.maxExtent.top - bounds.top) / (res * this.tileSize.h));87 //~ var z = this.map.getZoom();88 //~ var limit = Math.pow(2, z);89 90 //~ if (y < 0 || y >= limit) {91 //~ return null;92 //~ } else {93 //~ x = ((x % limit) + limit) % limit;94 95 //~ return this.url + z + "/" + x + "/" + y + "." + this.type;96 //~ }97 //~ } -
branches/0.9/pylucid_project/pylucid_plugins/OpenStreetMap/admin.py
r2487 r2510 15 15 """ 16 16 17 from django.utils.translation import ugettext_lazy as _ 18 17 19 from reversion.admin import VersionAdmin 18 20 19 from pylucid.base_admin import BaseAdmin 20 from pylucid_admin.admin_site import pylucid_admin_site 21 from pylucid_project.apps.pylucid_admin.admin_site import pylucid_admin_site 21 22 22 from OpenStreetMap.models import MapEntry23 from pylucid_project.pylucid_plugins.OpenStreetMap.models import MapEntry 23 24 24 25 25 class MapEntryAdmin(BaseAdmin, VersionAdmin): 26 list_display = ("name", "lon", "lat", "marker_text") 26 class MapEntryAdmin(VersionAdmin): 27 def lucidTag_example(self, obj): 28 return '{%% lucidTag OpenStreetMap name="%s" %%}' % obj.name 29 30 lucidTag_example.short_description = _("lucidTag example") 31 lucidTag_example.allow_tags = False 32 33 list_display = ("name", "lucidTag_example", "lon", "lat", "marker_text") 27 34 list_display_links = ("name",) 28 35 list_filter = ("createby", "lastupdateby",) -
branches/0.9/pylucid_project/pylucid_plugins/OpenStreetMap/templates/OpenStreetMap/OpenStreetMap.html
r2487 r2510 10 10 {% endextrahead %} 11 11 <div id="map_container"> 12 <div id="map " class="{{ map.name }}" style="width: {{ map.width }}px; height: {{ map.height }}px;">12 <div id="map_{{ map.name }}" class="{{ map.name }}" style="width: {{ map.width }}px; height: {{ map.height }}px;"> 13 13 <noscript><h2>JavaScript is needed!</h2></noscript> 14 14 </div> 15 {% if perms.OpenStreetMap.change_mapentry %} 16 <div class="admin_links"> 17 <a href="{% url admin:OpenStreetMap_mapentry_change map.id %}" title="{% trans 'edit in django admin site' %}" class="add_openinwindow">{% trans 'edit this map entry' %}</a> 18 </div> 19 {% endif %} 15 20 <a href="http://www.openstreetmap.org/?lat={{ map.lat }}&lon={{ map.lon }}&zoom={{ map.zoom }}" id="osm" class="add_openinwindow">www.openstreetmap.org</a> 16 <script type="text/javascript">drawmap(" {{ lang_code }}", "{{ map.get_html }}", {{ map.lon }}, {{ map.lat }}, {{ map.zoom }}, {{ map.marker_lon }}, {{ map.marker_lat }}, {{ map.marker_width }}, {{ map.marker_height }});</script>21 <script type="text/javascript">drawmap("map_{{ map.name }}", "{{ lang_code }}", "{{ map.get_html }}", {{ map.lon }}, {{ map.lat }}, {{ map.zoom }}, {{ map.marker_lon }}, {{ map.marker_lat }}, {{ map.marker_width }}, {{ map.marker_height }});</script> 17 22 </div> 18 23 {% endblock %}