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 = request.compatible_language_from(Potlatch2::LOCALES.keys) || "en" %>
15 <script type="text/javascript" defer="defer">
16 var brokenContentSize = $("content").offsetWidth == 0;
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) {
29 if (lat) { flashvars.lat = lat; }
30 if (lon) { flashvars.lon = lon; }
31 flashvars.zoom = zoom;
32 flashvars.locale = "<%= Potlatch2::LOCALES[locale] %>";
33 <% if params['gpx'] %>
34 flashvars.gpx = '<%= h(params['gpx']) %>';
36 <% if params['tileurl'] %>
37 flashvars.tileurl = '<%= h(params['tileurl']) %>';
39 flashvars.api = "<%= request.protocol + request.host_with_port %>/api/<%= API_VERSION %>/";
40 flashvars.policy = "<%= request.protocol + request.host_with_port %>/api/crossdomain.xml";
41 flashvars.connection = "XML";
42 flashvars.show_help = "once";
44 flashvars.oauth_token = "<%= token.token %>";
45 flashvars.oauth_token_secret = "<%= token.secret %>";
46 flashvars.oauth_consumer_key = "<%= token.client_application.key %>";
47 flashvars.oauth_consumer_secret = "<%= token.client_application.secret %>";
49 flashvars.maximise_function = "maximiseMap";
50 flashvars.minimise_function = "minimiseMap";
51 flashvars.move_function = "mapMoved";
54 params.base = "/potlatch2";
57 attributes.id = "potlatch";
58 attributes.bgcolor = "#FFFFFF";
60 swfobject.embedSWF("<%= asset_path("/potlatch2/potlatch2.swf") %>", "potlatch", "100%", "100%", "10.1.85","<%= asset_path("expressInstall.swf") %>", flashvars, params, attributes);
61 // 700,600 for fixed size, 100%,100% for resizable
64 doSWF(<%= @lat || 'null' %>,<%= @lon || 'null' %>,<%= @zoom %>);
66 function setPosition(lat, lon, zoom) {
67 $("potlatch").setPosition(lat, lon, Math.max(zoom || 15, 13));
70 function mapMoved(lon, lat, zoom, minlon, minlat, maxlon, maxlat) {
71 updatelinks(lon, lat, zoom, null, minlon, minlat, maxlon, maxlat);