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("<%= asset_path("/potlatch2/potlatch2.swf") %>", "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 <% if params['tileurl'] %>
31 fo.addVariable('tileurl' ,'<%= h(params['tileurl']) %>');
33 fo.addVariable("zoom",zoom);
34 fo.addVariable("api","<%= request.protocol + request.host_with_port %>/api/<%= API_VERSION %>/");
35 fo.addVariable("policy","<%= request.protocol + request.host_with_port %>/api/crossdomain.xml");
36 fo.addVariable("connection","XML");
37 fo.addVariable("oauth_token","<%= token.token %>");
38 fo.addVariable("oauth_token_secret","<%= token.secret %>");
39 fo.addVariable("oauth_consumer_key","<%= token.client_application.key %>");
40 fo.addVariable("oauth_consumer_secret","<%= token.client_application.secret %>");
41 fo.addVariable("maximise_function","maximiseMap");
42 fo.addVariable("minimise_function","minimiseMap");
43 fo.addVariable("move_function","mapMoved");
47 doSWF(<%= @lat || 'null' %>,<%= @lon || 'null' %>,<%= @zoom %>);
49 function setPosition(lat, lon, zoom) {
50 $("potlatch").setPosition(lat, lon, Math.max(zoom || 15, 13));
53 function mapMoved(lon, lat, zoom, minlon, minlat, maxlon, maxlat) {
54 updatelinks(lon, lat, zoom, null, minlon, minlat, maxlon, maxlat);