2 <%= t 'site.edit.flash_player_required' %>
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">
16 var brokenContentSize = $("content").offsetWidth == 0;
17 var fo = new SWFObject("<%= asset_path("/potlatch2/potlatch2.swf") %>", "potlatch", "100%", "100%", "10", "#FFFFFF");
18 // 700,600 for fixed size, 100%,100% for resizable
21 window.onbeforeunload=function() {
23 return '<%= escape_javascript(t('site.edit.potlatch2_unsaved_changes')) %>';
27 function markChanged(a) { changesaved=a; }
29 function doSWF(lat,lon,zoom) {
30 fo.addParam("base","/potlatch2");
31 if (lat) { fo.addVariable("lat",lat); }
32 if (lon) { fo.addVariable("lon",lon); }
33 fo.addVariable("locale", "<%= Potlatch2::LOCALES[locale] %>");
34 <% if params['gpx'] %>
35 fo.addVariable('gpx' ,'<%= h(params['gpx']) %>');
37 <% if params['tileurl'] %>
38 fo.addVariable('tileurl' ,'<%= h(params['tileurl']) %>');
40 fo.addVariable("zoom",zoom);
41 fo.addVariable("api","<%= request.protocol + request.host_with_port %>/api/<%= API_VERSION %>/");
42 fo.addVariable("policy","<%= request.protocol + request.host_with_port %>/api/crossdomain.xml");
43 fo.addVariable("connection","XML");
44 fo.addVariable("show_help","once");
46 fo.addVariable("oauth_token","<%= token.token %>");
47 fo.addVariable("oauth_token_secret","<%= token.secret %>");
48 fo.addVariable("oauth_consumer_key","<%= token.client_application.key %>");
49 fo.addVariable("oauth_consumer_secret","<%= token.client_application.secret %>");
51 fo.addVariable("maximise_function","maximiseMap");
52 fo.addVariable("minimise_function","minimiseMap");
53 fo.addVariable("move_function","mapMoved");
57 doSWF(<%= @lat || 'null' %>,<%= @lon || 'null' %>,<%= @zoom %>);
59 function setPosition(lat, lon, zoom) {
60 $("potlatch").setPosition(lat, lon, Math.max(zoom || 15, 13));
63 function mapMoved(lon, lat, zoom, minlon, minlat, maxlon, maxlat) {
64 updatelinks(lon, lat, zoom, null, minlon, minlat, maxlon, maxlat);