2 <div id="potlatch"><%= raw t 'site.edit.flash_player_required' %></div>
5 <%= javascript_include_tag 'swfobject.js' %>
7 <% if defined? POTLATCH2_KEY %>
8 <% token = @user.access_token(POTLATCH2_KEY) %>
10 <script type="text/javascript">alert("<%= t 'site.edit.potlatch2_not_configured' %>")</script>
13 <% locale = request.compatible_language_from(Potlatch2::LOCALES.keys) || "en" %>
15 <script type="text/javascript" defer="defer">
18 window.onbeforeunload=function() {
20 return '<%= escape_javascript(t('site.edit.potlatch2_unsaved_changes')) %>';
24 function markChanged(a) { changesaved=a; }
26 function doSWF(lat,lon,zoom) {
28 if (lat) { flashvars.lat = lat; }
29 if (lon) { flashvars.lon = lon; }
30 flashvars.zoom = zoom;
31 flashvars.assets = "<%= asset_path "potlatch2/assets.zip" %>";
32 flashvars.font_library = "<%= asset_path "potlatch2/FontLibrary.swf" %>";
33 flashvars.locale = "<%= Potlatch2::LOCALES[locale] %>";
34 flashvars.locale_paths = "<%= Potlatch2::LOCALES[locale] %>=<%= asset_path("potlatch2/locales/#{Potlatch2::LOCALES[locale]}.swf") %>";
35 <% if params['gpx'] %>
36 flashvars.gpx = '<%= h(params['gpx']) %>';
38 <% if params['tileurl'] %>
39 flashvars.tileurl = '<%= h(params['tileurl']) %>';
41 flashvars.api = "<%= request.protocol + request.host_with_port %>/api/<%= API_VERSION %>/";
42 flashvars.policy = "<%= request.protocol + request.host_with_port %>/api/crossdomain.xml";
43 flashvars.connection = "XML";
44 flashvars.show_help = "once";
46 flashvars.oauth_token = "<%= token.token %>";
47 flashvars.oauth_token_secret = "<%= token.secret %>";
48 flashvars.oauth_consumer_key = "<%= token.client_application.key %>";
49 flashvars.oauth_consumer_secret = "<%= token.client_application.secret %>";
51 flashvars.maximise_function = "maximiseMap";
52 flashvars.minimise_function = "minimiseMap";
53 flashvars.move_function = "mapMoved";
56 params.base = "/potlatch2";
59 attributes.id = "potlatch";
60 attributes.bgcolor = "#FFFFFF";
62 swfobject.embedSWF("<%= asset_path("potlatch2.swf") %>", "potlatch", "100%", "100%", "10.1.102","<%= asset_path("expressInstall.swf") %>", flashvars, params, attributes);
63 // 700,600 for fixed size, 100%,100% for resizable
66 <% if @lat && @lon -%>
67 doSWF(<%= @lat %>,<%= @lon %>,16);
69 var params = OSM.mapParams();
70 doSWF(params.lat, params.lon, params.zoom || 17);
73 $(document).ready(function () {
74 $("body").on("click", "a.set_position", function () {
75 var data = $(this).data();
77 $("#potlatch").each(function () {
78 this.setPosition(data.lat, data.lon, Math.max(data.zoom || 15, 13));
83 function mapMoved(lon, lat, zoom, minlon, minlat, maxlon, maxlat) {
84 updatelinks(lon, lat, zoom, null, minlon, minlat, maxlon, maxlat);