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">
18 window.onbeforeunload=function() {
20 return '<%= escape_javascript(t('site.edit.potlatch2_unsaved_changes')) %>';
24 function markChanged(a) { changesaved=a; }
26 function doSWF(lat,lon,zoom) {
28 if (lat) { flashvars.lat = lat; }
29 if (lon) { flashvars.lon = lon; }
30 flashvars.zoom = zoom;
31 flashvars.locale = "<%= Potlatch2::LOCALES[locale] %>";
32 <% if params['gpx'] %>
33 flashvars.gpx = '<%= h(params['gpx']) %>';
35 <% if params['tileurl'] %>
36 flashvars.tileurl = '<%= h(params['tileurl']) %>';
38 flashvars.api = "<%= request.protocol + request.host_with_port %>/api/<%= API_VERSION %>/";
39 flashvars.policy = "<%= request.protocol + request.host_with_port %>/api/crossdomain.xml";
40 flashvars.connection = "XML";
41 flashvars.show_help = "once";
43 flashvars.oauth_token = "<%= token.token %>";
44 flashvars.oauth_token_secret = "<%= token.secret %>";
45 flashvars.oauth_consumer_key = "<%= token.client_application.key %>";
46 flashvars.oauth_consumer_secret = "<%= token.client_application.secret %>";
48 flashvars.maximise_function = "maximiseMap";
49 flashvars.minimise_function = "minimiseMap";
50 flashvars.move_function = "mapMoved";
53 params.base = "/potlatch2";
56 attributes.id = "potlatch";
57 attributes.bgcolor = "#FFFFFF";
59 swfobject.embedSWF("<%= asset_path("/potlatch2/potlatch2.swf") %>", "potlatch", "100%", "100%", "10.1.102","<%= asset_path("expressInstall.swf") %>", flashvars, params, attributes);
60 // 700,600 for fixed size, 100%,100% for resizable
63 <% if params[:node] -%>
64 <% bbox = Node.find(params[:node]).bbox.to_unscaled -%>
65 doSWF(<%= bbox.centre_lat %>,<%= bbox.centre_lon %>,16);
66 <% elsif params[:way] -%>
67 <% bbox = Way.find(params[:way]).bbox.to_unscaled -%>
68 doSWF(<%= bbox.centre_lat %>,<%= bbox.centre_lon %>,16);
70 doSWF(<%= @lat || 'null' %>,<%= @lon || 'null' %>,<%= @zoom %>);
73 function setPosition(lat, lon, zoom) {
74 $("#potlatch").each(function () {
75 this.setPosition(lat, lon, Math.max(zoom || 15, 13));
79 function mapMoved(lon, lat, zoom, minlon, minlat, maxlon, maxlat) {
80 updatelinks(lon, lat, zoom, null, minlon, minlat, maxlon, maxlat);