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 <script type="text/javascript" defer="defer">
14 var brokenContentSize = $("content").offsetWidth == 0;
15 var fo = new SWFObject("<%= asset_path("/potlatch2/potlatch2.swf") %>", "potlatch", "100%", "100%", "9", "#FFFFFF");
16 // 700,600 for fixed size, 100%,100% for resizable
19 window.onbeforeunload=function() {
21 return '<%= escape_javascript(t('site.edit.potlatch2_unsaved_changes')) %>';
25 function markChanged(a) { changesaved=a; }
27 function doSWF(lat,lon,zoom) {
28 fo.addParam("base","/potlatch2");
29 if (lat) { fo.addVariable("lat",lat); }
30 if (lon) { fo.addVariable("lon",lon); }
31 <% if params['gpx'] %>
32 fo.addVariable('gpx' ,'<%= h(params['gpx']) %>');
34 <% if params['tileurl'] %>
35 fo.addVariable('tileurl' ,'<%= h(params['tileurl']) %>');
37 fo.addVariable("zoom",zoom);
38 fo.addVariable("api","<%= request.protocol + request.host_with_port %>/api/<%= API_VERSION %>/");
39 fo.addVariable("policy","<%= request.protocol + request.host_with_port %>/api/crossdomain.xml");
40 fo.addVariable("connection","XML");
42 fo.addVariable("oauth_token","<%= token.token %>");
43 fo.addVariable("oauth_token_secret","<%= token.secret %>");
44 fo.addVariable("oauth_consumer_key","<%= token.client_application.key %>");
45 fo.addVariable("oauth_consumer_secret","<%= token.client_application.secret %>");
47 fo.addVariable("maximise_function","maximiseMap");
48 fo.addVariable("minimise_function","minimiseMap");
49 fo.addVariable("move_function","mapMoved");
53 doSWF(<%= @lat || 'null' %>,<%= @lon || 'null' %>,<%= @zoom %>);
55 function setPosition(lat, lon, zoom) {
56 $("potlatch").setPosition(lat, lon, Math.max(zoom || 15, 13));
59 function mapMoved(lon, lat, zoom, minlon, minlat, maxlon, maxlat) {
60 updatelinks(lon, lat, zoom, null, minlon, minlat, maxlon, maxlat);