diff options
Diffstat (limited to 'templates/chimere/blocks/map.html')
-rw-r--r-- | templates/chimere/blocks/map.html | 469 |
1 files changed, 236 insertions, 233 deletions
diff --git a/templates/chimere/blocks/map.html b/templates/chimere/blocks/map.html index 037d5a8..ebb7403 100644 --- a/templates/chimere/blocks/map.html +++ b/templates/chimere/blocks/map.html @@ -1,233 +1,236 @@ -{% load i18n %} -<div id='{{map_id}}'></div> -<script type="text/javascript"> - <!-- -$("#{{map_id}}").show(); -$(function(){ - $('#cluster_list').dialog({'autoOpen':false, - 'resizable':false, - 'width':340, - 'dialogClass':'no-titlebar-small'}); -}); - // --> -</script> -<div id="waiting"> - <div id="waiting-content"> - <img src='{{STATIC_URL}}chimere/img/ajax-loader.gif' alt='Ajax loader'/> - <p>{% trans "Loading of the map in progress" %}</p> - </div> -</div> -<div id="layer_selection"> - <h4>{% trans "Display options" %}</h4> - <ul id='layer_list'> - <li class='head layer_map_type'>{% trans "Map type"%}</li> - </ul> -</div> -<script type="text/javascript"> - <!-- - //LIB iOS - var connectWebViewJavascriptBridge = function(callback) { - if (window.WebViewJavascriptBridge) { - callback(WebViewJavascriptBridge); - } else { - document.addEventListener('WebViewJavascriptBridgeReady', function() { - callback(WebViewJavascriptBridge); - }, false); - } - }; - $('#sidebar-handler-hide').click(function(){ - $('#sidebar').hide(); - // Added for mobile - START // - //iOS - connectWebViewJavascriptBridge( - function(bridge) { - if(!bridge){ - bridge.init(function(message, responseCallback) { - if (responseCallback) { - responseCallback("Right back atcha"); - } - }); - } - bridge.send('sidebarHide'); - }); - }); - $('#sidebar-handler-show').click(function(){ - $('#sidebar').show(); - // Added for mobile - START // - //iOS - connectWebViewJavascriptBridge( - function(bridge) { - if(!bridge){ - bridge.init(function(message, responseCallback) { - if (responseCallback) { - responseCallback("Right back atcha"); - } - }); - } - bridge.send('sidebarShow'); - }); - - }); - //fin lib ios - var routing_panel_open = function(){ - $('#frm_categories').hide(); - $('#search-box').hide(); - $('#chimere_itinerary_panel').show(); - $('#action-categories').removeClass('state-active'); - $('#action-search').removeClass('state-active'); - $('#action-routing').addClass('state-active'); - }; - - $('#action-routing').click(routing_panel_open); - - var category_panel_open = function(){ - $('#chimere_itinerary_panel').hide(); - $('#search-box').hide(); - $('#frm_categories').show(); - $('#action-routing').removeClass('state-active'); - $('#action-search').removeClass('state-active'); - $('#action-categories').addClass('state-active'); - }; - - $('#action-categories').click(category_panel_open); - - var search_panel_open = function(){ - $('#chimere_itinerary_panel').hide(); - $('#frm_categories').hide(); - $('#search-box').show(); - $('#action-routing').removeClass('state-active'); - $('#action-categories').removeClass('state-active'); - $('#action-search').addClass('state-active'); - }; - - $('#action-search').click(search_panel_open); - - {% if single_category %} - $(function() {$('#panel').hide()});{% endif %} - var chimere_init_options = {}; - {% if MOBILE %}chimere_init_options["mobile"] = true;{% endif %} - {% if enable_clustering %}chimere_init_options["enable_clustering"] = true;{% endif %} - chimere_init_options["routing_panel_open"] = routing_panel_open; - chimere_init_options["category_accordion"] = false; - chimere_init_options["cluster_icon"] = new OpenLayers.Icon( - STATIC_URL + "saclay/images/cluster_icon.png", - new OpenLayers.Size(39, 46), - new OpenLayers.Pixel(-(39/2), -(46/2))); - chimere_init_options["category_plus"] = STATIC_URL + "saclay/images/plus.png"; - chimere_init_options["category_minus"] = STATIC_URL + "saclay/images/minus.png"; - chimere_init_options["popupClass"] = OpenLayers.Popup.SaclayCloud; - chimere_init_options["popupClass"].imageSrc = "{{STATIC_URL}}/saclay/js/cloud-popup-saclay.png"; - chimere_init_options["popupContentFull"] = true; - chimere_init_options["explicit_popup_hide"] = true; - chimere_init_options["edition_type_is_route"] = true; - chimere_init_options["display_feature_detail_fx"] = display_feature_detail; - - chimere_init_options["default_icon"] = new OpenLayers.Icon( - '{{STATIC_URL}}saclay/images/default_icon.png', - new OpenLayers.Size(37, 42), - new OpenLayers.Pixel(-(37/2), -42)); - chimere_init_options["icon_start"] = new OpenLayers.Icon( - '{{STATIC_URL}}saclay/images/routing_start.png', - new OpenLayers.Size(37, 42), - new OpenLayers.Pixel(-(37/2), -42)); - chimere_init_options["icon_end"] = new OpenLayers.Icon( - '{{STATIC_URL}}saclay/images/routing_end.png', - new OpenLayers.Size(37, 42), - new OpenLayers.Pixel(-(37/2), -42)); - chimere_init_options["icon_step"] = new OpenLayers.Icon( - '{{STATIC_URL}}saclay/images/routing_step.png', - new OpenLayers.Size(37, 42), - new OpenLayers.Pixel(-(37/2), -42)); - var numZoomLevels = 7; - var maxZoomLevel = 19; - var resolutions; - var zoomOffset; - if (numZoomLevels && maxZoomLevel){ - // variables set to be used in layer definition - var minZoomLevel = maxZoomLevel - numZoomLevels; - resolutions = - OpenLayers.Layer.Bing.prototype.serverResolutions.slice( - maxZoomLevel - numZoomLevels, - maxZoomLevel); - zoomOffset = minZoomLevel; - } - - chimere_init_options["map_layers"] = [{{js_map_layers|safe|escape}}]; - chimere_init_options['permalink_label'] = '{%trans "Permalink"%}'; - chimere_init_options['permalink_element'] = document.getElementById('permalink'); - chimere_init_options['routing'] = {{routing}}; - {% if dynamic_categories %}chimere_init_options['dynamic_categories'] = true;{% endif %} - {% if default_area %} - chimere_init_options["default_area"] = new Array({{default_area.upper_left_corner.x}}, {{default_area.upper_left_corner.y}}, {{default_area.lower_right_corner.x}}, {{default_area.lower_right_corner.y}}); - {% endif %} - {% if p_zoom %}chimere_init_options["zoom"] = {{ p_zoom }};{% endif %} - {% if p_lat %}chimere_init_options["lat"] = {{ p_lat }};{% endif %} - {% if p_lon %}chimere_init_options["lon"] = {{ p_lon }};{% endif %} - {% if p_routing_start_lon %}chimere_init_options["routing_start_lon"] = {{ p_routing_start_lon }};{% endif %} - {% if p_routing_start_lat %}chimere_init_options["routing_start_lat"] = {{ p_routing_start_lat }};{% endif %} - {% if p_routing_end_lon %}chimere_init_options["routing_end_lon"] = {{ p_routing_end_lon }};{% endif %} - {% if p_routing_end_lat %}chimere_init_options["routing_end_lat"] = {{ p_routing_end_lat }};{% endif %} - {% if p_routing_steps %}chimere_init_options["routing_steps_lonlat"] = [{{ p_routing_steps }}];{% endif %} - {% if p_routing_transport %}chimere_init_options["routing_transport"] = "{{ p_routing_transport }}";{% endif %} - {% if p_routing_speed %}chimere_init_options["routing_speed"] = "{{ p_routing_speed }}";{% endif %} - chimere_init_options["icon_offset"] = new OpenLayers.Pixel({{icon_offset_x}}, - {{icon_offset_y}}); - chimere_init_options['marker_hover_offset'] = new OpenLayers.Pixel(7, 20); - chimere_init_options["dynamic_categories"] = {{ dynamic_categories }}; - {% if p_display_submited %}chimere_init_options["display_submited"] = {{ p_display_submited }};{% endif %} - chimere_init_options["checked_categories"] = [{% for cc in checked_categories %}{% if forloop.counter0 > 0 %}, {% endif %}{{cc}}{% endfor %}]; - {% if area_id %}chimere_init_options['area_id'] = "{{area_id}}";{% endif %} - {% if p_current_feature %} - chimere_init_options["display_feature"] = {{ p_current_feature }}; - {% endif %} - {% if restricted_extent %}{{ restricted_extent }} - chimere_init_options["restricted_extent"] = bounds; - {% endif %} - {% if selected_map_layer %} - chimere_init_options["selected_map_layer"] = {{selected_map_layer}}; - {% endif %} - $("#{{map_id}}").chimere(chimere_init_options); - {% if zoom %} - $('#maps').chimere('zoom', {'area':{{zoom}} }); - {% endif %} - - $('#{{map_id}}').chimere('addJSON', "{{STATIC_URL}}saclay/json/limites.json"); - - // init layer selection - $(function() { - {% for layer_name, js, def in map_layers %} - $('#layer_list').append("<li class='layer_map{% if def %} selected{%endif%}'><input type='radio' value='{{forloop.counter0}}' name='layer_type' id='layer_{{forloop.counter}}'{% if def %} checked='checked'{% endif %}><label for='layer_{{forloop.counter}}'>{{layer_name}}</li>");{% endfor %} - {% for subcat in subcat_layer %} - {% if not subcat.category %} - $('#layer_list').append("<li class='head layer_category'>{{subcat.name}}</li>");{% else %} - $('#layer_list').append("<li class='layer_subcat{% if subcat.pk in checked_categories %} selected{%endif%}'><input type='checkbox' name='layer_cat' value='category_{{subcat.pk}}' id='layer_cat_{{subcat.pk}}'{% if subcat.pk in checked_categories %} checked='checked'{% endif %}><label for='layer_cat_{{subcat.pk}}'>{{subcat.name}}</li>");{%endif%}{% endfor %} - $('#layer_selection h4').click(function(){ - $('#layer_list').toggle(); - if ($('#layer_list').is(':visible')){ - $('#layer_selection h4').addClass('opened'); - } else { - $('#layer_selection h4').removeClass('opened'); - } - }); - $('#layer_list input[name=layer_type]').change(function(){ - $('#{{map_id}}').chimere('changeMapLayer', $(this).val()); - $('li.layer_map').removeClass('selected'); - $(this).parent().addClass('selected'); - }); - $('#layer_list input[name=layer_cat]').change(function(){ - // the prop has to be called twice not to mess up with the triggered - // click - $('#'+$(this).val()).prop("checked", this.checked); - $('#'+$(this).val()).trigger('click'); - $('#'+$(this).val()).prop("checked", this.checked); - if (this.checked){ - $(this).parent().addClass('selected'); - } else { - $(this).parent().removeClass('selected'); - } - }); - }); - // --> -</script> -<div id='marker_hover'><div id='marker_hover_content'></div></div> -<div id='cluster_list'></div> +{% load i18n %}
+<div id='{{map_id}}'></div>
+<script type="text/javascript">
+ <!--
+$("#{{map_id}}").show();
+$(function(){
+ $('#cluster_list').dialog({'autoOpen':false,
+ 'resizable':false,
+ 'width':340,
+ 'dialogClass':'no-titlebar-small'});
+});
+ // -->
+</script>
+{% if not MOBILE %}
+<div id="waiting">
+ <div id="waiting-content">
+ <img src='{{STATIC_URL}}chimere/img/ajax-loader.gif' alt='Ajax loader'/>
+ <p>{% trans "Loading of the map in progress" %}</p>
+ </div>
+</div>
+<div id="layer_selection">
+ <h4>{% trans "Display options" %}</h4>
+ <ul id='layer_list'>
+ <li class='head layer_map_type'>{% trans "Map type"%}</li>
+ </ul>
+</div>
+{% endif %}
+<script type="text/javascript">
+ <!--
+ //LIB iOS
+ var connectWebViewJavascriptBridge = function(callback) {
+ if (window.WebViewJavascriptBridge) {
+ callback(WebViewJavascriptBridge);
+ } else {
+ document.addEventListener('WebViewJavascriptBridgeReady', function() {
+ callback(WebViewJavascriptBridge);
+ }, false);
+ }
+ };
+ $('#sidebar-handler-hide').click(function(){
+ $('#sidebar').hide();
+ // Added for mobile - START //
+ //iOS
+ connectWebViewJavascriptBridge(
+ function(bridge) {
+ if(!bridge){
+ bridge.init(function(message, responseCallback) {
+ if (responseCallback) {
+ responseCallback("Right back atcha");
+ }
+ });
+ }
+ bridge.send('sidebarHide');
+ });
+ window.JSInterface.sidebarHide();
+ });
+ $('#sidebar-handler-show').click(function(){
+ $('#sidebar').show();
+ // Added for mobile - START //
+ //iOS
+ connectWebViewJavascriptBridge(
+ function(bridge) {
+ if(!bridge){
+ bridge.init(function(message, responseCallback) {
+ if (responseCallback) {
+ responseCallback("Right back atcha");
+ }
+ });
+ }
+ bridge.send('sidebarShow');
+ });
+ window.JSInterface.sidebarShow();
+ });
+ //fin lib ios
+ var routing_panel_open = function(){
+ $('#frm_categories').hide();
+ $('#search-box').hide();
+ $('#chimere_itinerary_panel').show();
+ $('#action-categories').removeClass('state-active');
+ $('#action-search').removeClass('state-active');
+ $('#action-routing').addClass('state-active');
+ };
+
+ $('#action-routing').click(routing_panel_open);
+
+ var category_panel_open = function(){
+ $('#chimere_itinerary_panel').hide();
+ $('#search-box').hide();
+ $('#frm_categories').show();
+ $('#action-routing').removeClass('state-active');
+ $('#action-search').removeClass('state-active');
+ $('#action-categories').addClass('state-active');
+ };
+
+ $('#action-categories').click(category_panel_open);
+
+ var search_panel_open = function(){
+ $('#chimere_itinerary_panel').hide();
+ $('#frm_categories').hide();
+ $('#search-box').show();
+ $('#action-routing').removeClass('state-active');
+ $('#action-categories').removeClass('state-active');
+ $('#action-search').addClass('state-active');
+ };
+
+ $('#action-search').click(search_panel_open);
+
+ {% if single_category %}
+ $(function() {$('#panel').hide()});{% endif %}
+ var chimere_init_options = {};
+ {% if MOBILE %}chimere_init_options["mobile"] = true;{% endif %}
+ {% if enable_clustering %}chimere_init_options["enable_clustering"] = true;{% endif %}
+ chimere_init_options["routing_panel_open"] = routing_panel_open;
+ chimere_init_options["category_accordion"] = false;
+ chimere_init_options["cluster_icon"] = new OpenLayers.Icon(
+ STATIC_URL + "saclay/images/cluster_icon.png",
+ new OpenLayers.Size(39, 46),
+ new OpenLayers.Pixel(-(39/2), -(46/2)));
+ chimere_init_options["category_plus"] = STATIC_URL + "saclay/images/plus.png";
+ chimere_init_options["category_minus"] = STATIC_URL + "saclay/images/minus.png";
+ chimere_init_options["popupClass"] = OpenLayers.Popup.SaclayCloud;
+ chimere_init_options["popupClass"].imageSrc = "{{STATIC_URL}}/saclay/js/cloud-popup-saclay.png";
+ chimere_init_options["popupContentFull"] = true;
+ chimere_init_options["explicit_popup_hide"] = true;
+ chimere_init_options["edition_type_is_route"] = true;
+ chimere_init_options["display_feature_detail_fx"] = display_feature_detail;
+
+ chimere_init_options["default_icon"] = new OpenLayers.Icon(
+ '{{STATIC_URL}}saclay/images/default_icon.png',
+ new OpenLayers.Size(37, 42),
+ new OpenLayers.Pixel(-(37/2), -42));
+ chimere_init_options["icon_start"] = new OpenLayers.Icon(
+ '{{STATIC_URL}}saclay/images/routing_start.png',
+ new OpenLayers.Size(37, 42),
+ new OpenLayers.Pixel(-(37/2), -42));
+ chimere_init_options["icon_end"] = new OpenLayers.Icon(
+ '{{STATIC_URL}}saclay/images/routing_end.png',
+ new OpenLayers.Size(37, 42),
+ new OpenLayers.Pixel(-(37/2), -42));
+ chimere_init_options["icon_step"] = new OpenLayers.Icon(
+ '{{STATIC_URL}}saclay/images/routing_step.png',
+ new OpenLayers.Size(37, 42),
+ new OpenLayers.Pixel(-(37/2), -42));
+ var numZoomLevels = 7;
+ var maxZoomLevel = 19;
+ var resolutions;
+ var zoomOffset;
+ if (numZoomLevels && maxZoomLevel){
+ // variables set to be used in layer definition
+ var minZoomLevel = maxZoomLevel - numZoomLevels;
+ resolutions =
+ OpenLayers.Layer.Bing.prototype.serverResolutions.slice(
+ maxZoomLevel - numZoomLevels,
+ maxZoomLevel);
+ zoomOffset = minZoomLevel;
+ }
+
+ chimere_init_options["map_layers"] = [{{js_map_layers|safe|escape}}];
+ chimere_init_options['permalink_label'] = '{%trans "Permalink"%}';
+ chimere_init_options['permalink_element'] = document.getElementById('permalink');
+ chimere_init_options['routing'] = {{routing}};
+ {% if dynamic_categories %}chimere_init_options['dynamic_categories'] = true;{% endif %}
+ {% if default_area %}
+ chimere_init_options["default_area"] = new Array({{default_area.upper_left_corner.x}}, {{default_area.upper_left_corner.y}}, {{default_area.lower_right_corner.x}}, {{default_area.lower_right_corner.y}});
+ {% endif %}
+ {% if p_zoom %}chimere_init_options["zoom"] = {{ p_zoom }};{% endif %}
+ {% if p_lat %}chimere_init_options["lat"] = {{ p_lat }};{% endif %}
+ {% if p_lon %}chimere_init_options["lon"] = {{ p_lon }};{% endif %}
+ {% if p_routing_start_lon %}chimere_init_options["routing_start_lon"] = {{ p_routing_start_lon }};{% endif %}
+ {% if p_routing_start_lat %}chimere_init_options["routing_start_lat"] = {{ p_routing_start_lat }};{% endif %}
+ {% if p_routing_end_lon %}chimere_init_options["routing_end_lon"] = {{ p_routing_end_lon }};{% endif %}
+ {% if p_routing_end_lat %}chimere_init_options["routing_end_lat"] = {{ p_routing_end_lat }};{% endif %}
+ {% if p_routing_steps %}chimere_init_options["routing_steps_lonlat"] = [{{ p_routing_steps }}];{% endif %}
+ {% if p_routing_transport %}chimere_init_options["routing_transport"] = "{{ p_routing_transport }}";{% endif %}
+ {% if p_routing_speed %}chimere_init_options["routing_speed"] = "{{ p_routing_speed }}";{% endif %}
+ chimere_init_options["icon_offset"] = new OpenLayers.Pixel({{icon_offset_x}},
+ {{icon_offset_y}});
+ chimere_init_options['marker_hover_offset'] = new OpenLayers.Pixel(7, 20);
+ chimere_init_options["dynamic_categories"] = {{ dynamic_categories }};
+ {% if p_display_submited %}chimere_init_options["display_submited"] = {{ p_display_submited }};{% endif %}
+ chimere_init_options["checked_categories"] = [{% for cc in checked_categories %}{% if forloop.counter0 > 0 %}, {% endif %}{{cc}}{% endfor %}];
+ {% if area_id %}chimere_init_options['area_id'] = "{{area_id}}";{% endif %}
+ {% if p_current_feature %}
+ chimere_init_options["display_feature"] = {{ p_current_feature }};
+ {% endif %}
+ {% if restricted_extent %}{{ restricted_extent }}
+ chimere_init_options["restricted_extent"] = bounds;
+ {% endif %}
+ {% if selected_map_layer %}
+ chimere_init_options["selected_map_layer"] = {{selected_map_layer}};
+ {% endif %}
+ $("#{{map_id}}").chimere(chimere_init_options);
+ {% if zoom %}
+ $('#maps').chimere('zoom', {'area':{{zoom}} });
+ {% endif %}
+
+ $('#{{map_id}}').chimere('addJSON', "{{STATIC_URL}}saclay/json/limites.json");
+
+ // init layer selection
+ $(function() {
+ {% for layer_name, js, def in map_layers %}
+ $('#layer_list').append("<li class='layer_map{% if def %} selected{%endif%}'><input type='radio' value='{{forloop.counter0}}' name='layer_type' id='layer_{{forloop.counter}}'{% if def %} checked='checked'{% endif %}><label for='layer_{{forloop.counter}}'>{{layer_name}}</li>");{% endfor %}
+ {% for subcat in subcat_layer %}
+ {% if not subcat.category %}
+ $('#layer_list').append("<li class='head layer_category'>{{subcat.name}}</li>");{% else %}
+ $('#layer_list').append("<li class='layer_subcat{% if subcat.pk in checked_categories %} selected{%endif%}'><input type='checkbox' name='layer_cat' value='category_{{subcat.pk}}' id='layer_cat_{{subcat.pk}}'{% if subcat.pk in checked_categories %} checked='checked'{% endif %}><label for='layer_cat_{{subcat.pk}}'>{{subcat.name}}</li>");{%endif%}{% endfor %}
+ $('#layer_selection h4').click(function(){
+ $('#layer_list').toggle();
+ if ($('#layer_list').is(':visible')){
+ $('#layer_selection h4').addClass('opened');
+ } else {
+ $('#layer_selection h4').removeClass('opened');
+ }
+ });
+ $('#layer_list input[name=layer_type]').change(function(){
+ $('#{{map_id}}').chimere('changeMapLayer', $(this).val());
+ $('li.layer_map').removeClass('selected');
+ $(this).parent().addClass('selected');
+ });
+ $('#layer_list input[name=layer_cat]').change(function(){
+ // the prop has to be called twice not to mess up with the triggered
+ // click
+ $('#'+$(this).val()).prop("checked", this.checked);
+ $('#'+$(this).val()).trigger('click');
+ $('#'+$(this).val()).prop("checked", this.checked);
+ if (this.checked){
+ $(this).parent().addClass('selected');
+ } else {
+ $(this).parent().removeClass('selected');
+ }
+ });
+ });
+ // -->
+</script>
+<div id='marker_hover'><div id='marker_hover_content'></div></div>
+<div id='cluster_list'></div>
|