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 flashvars.intro_image = "<%= asset_path "help/introduction.jpg" %>";
36 flashvars.intro_video = "<%= asset_path "help/introduction.mp4" %>";
37 <% if params['gpx'] %>
38 flashvars.gpx = '<%= h(params['gpx']) %>';
40 <% if params['tileurl'] %>
41 flashvars.tileurl = '<%= h(params['tileurl']) %>';
43 flashvars.api = "<%= request.protocol + request.host_with_port %>/api/<%= API_VERSION %>/";
44 flashvars.policy = "<%= request.protocol + request.host_with_port %>/api/crossdomain.xml";
45 flashvars.connection = "XML";
46 flashvars.show_help = "once";
47 flashvars.user_check = "warn";
49 flashvars.oauth_token = "<%= token.token %>";
50 flashvars.oauth_token_secret = "<%= token.secret %>";
51 flashvars.oauth_consumer_key = "<%= token.client_application.key %>";
52 flashvars.oauth_consumer_secret = "<%= token.client_application.secret %>";
54 flashvars.maximise_function = "maximiseMap";
55 flashvars.minimise_function = "minimiseMap";
56 flashvars.move_function = "mapMoved";
59 params.base = "/potlatch2";
62 attributes.id = "potlatch";
63 attributes.bgcolor = "#FFFFFF";
65 swfobject.embedSWF("<%= asset_path("potlatch2.swf") %>", "potlatch", "100%", "100%", "10.1.102","<%= asset_path("expressInstall.swf") %>", flashvars, params, attributes);
66 // 700,600 for fixed size, 100%,100% for resizable
69 updateLinks({ lon: lon, lat: lat }, zoom);
73 <% if @lat && @lon -%>
74 doSWF(<%= @lat %>, <%= @lon %>, <%= @zoom %>);
76 var mapParams = OSM.mapParams();
77 doSWF(mapParams.lat, mapParams.lon, mapParams.zoom || 17);
80 var mapMoved = $.throttle(250, function(lon, lat, zoom) {
81 updateLinks({ lon: lon, lat: lat }, zoom);
83 var hash = OSM.formatHash({ lon: lon, lat: lat, zoom: zoom });
84 if (hash !== location.hash) {
85 location.replace(hash);