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 = select_locale(Potlatch2::LOCALES.keys).to_s %>
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";
45 flashvars.user_check = "warn";
47 flashvars.oauth_token = "<%= token.token %>";
48 flashvars.oauth_token_secret = "<%= token.secret %>";
49 flashvars.oauth_consumer_key = "<%= token.client_application.key %>";
50 flashvars.oauth_consumer_secret = "<%= token.client_application.secret %>";
52 flashvars.maximise_function = "maximiseMap";
53 flashvars.minimise_function = "minimiseMap";
54 flashvars.move_function = "mapMoved";
57 params.base = "/potlatch2";
60 attributes.id = "potlatch";
61 attributes.bgcolor = "#FFFFFF";
63 swfobject.embedSWF("<%= asset_path("potlatch2.swf") %>", "potlatch", "100%", "100%", "10.1.102","<%= asset_path("expressInstall.swf") %>", flashvars, params, attributes);
64 // 700,600 for fixed size, 100%,100% for resizable
67 updatelinks(lon, lat, zoom);
71 <% if @lat && @lon -%>
72 doSWF(<%= @lat %>,<%= @lon %>,16);
74 var params = OSM.mapParams();
75 doSWF(params.lat, params.lon, params.zoom || 17);
78 $("body").on("click", "a.set_position", function (e) {
81 var data = $(this).data();
83 $("#potlatch").each(function () {
84 this.setPosition(data.lat, data.lon, Math.max(data.zoom || 15, 13));
88 function mapMoved(lon, lat, zoom, minlon, minlat, maxlon, maxlat) {
89 updatelinks(lon, lat, zoom, null, minlon, minlat, maxlon, maxlat);