2 <%= t 'site.edit.flash_player_required' %>
5 <%= javascript_include_tag 'swfobject.js' %>
7 <% token = @user.access_token(POTLATCH2_KEY) %>
9 <script type="text/javascript" defer="defer">
10 var brokenContentSize = $("content").offsetWidth == 0;
11 var fo = new SWFObject("/potlatch2/potlatch2.swf?d="+Math.round(Math.random()*1000), "potlatch", "100%", "100%", "9", "#FFFFFF");
12 // 700,600 for fixed size, 100%,100% for resizable
15 window.onbeforeunload=function() {
17 return '<%= escape_javascript(t('site.edit.potlatch2_unsaved_changes')) %>';
21 function markChanged(a) { changesaved=a; }
23 function doSWF(lat,lon,zoom) {
24 fo.addParam("base","/potlatch2");
25 if (lat) { fo.addVariable("lat",lat); }
26 if (lon) { fo.addVariable("lon",lon); }
27 <% if params['gpx'] %>
28 fo.addVariable('gpx' ,'<%= h(params['gpx']) %>');
30 fo.addVariable("zoom",zoom);
31 fo.addVariable("api","<%= request.protocol + request.host_with_port %>/api/<%= API_VERSION %>/");
32 fo.addVariable("policy","<%= request.protocol + request.host_with_port %>/api/crossdomain.xml");
33 fo.addVariable("connection","XML");
34 fo.addVariable("oauth_token","<%= token.token %>");
35 fo.addVariable("oauth_token_secret","<%= token.secret %>");
36 fo.addVariable("oauth_consumer_key","<%= token.client_application.key %>");
37 fo.addVariable("oauth_consumer_secret","<%= token.client_application.secret %>");
38 fo.addVariable("maximise_function","maximiseMap");
39 fo.addVariable("minimise_function","minimiseMap");
40 fo.addVariable("move_function","mapMoved");
44 doSWF(<%= @lat || 'null' %>,<%= @lon || 'null' %>,<%= @zoom %>);
46 function setPosition(lat, lon, zoom) {
47 $("potlatch").setPosition(lat, lon, Math.max(zoom || 15, 13));
50 function mapMoved(lon, lat, zoom, minlon, minlat, maxlon, maxlat) {
51 updatelinks(lon, lat, zoom, null, minlon, minlat, maxlon, maxlat);