diff options
Diffstat (limited to 'chimere/templates')
23 files changed, 324 insertions, 99 deletions
diff --git a/chimere/templates/chimere/base.html b/chimere/templates/chimere/base.html index 894cb01..9cc7870 100644 --- a/chimere/templates/chimere/base.html +++ b/chimere/templates/chimere/base.html @@ -3,8 +3,8 @@ {% block extra_head %} <link rel="stylesheet" href="{{ STATIC_URL }}chimere/css/styles.css" /> <link rel="stylesheet" href="{{ STATIC_URL }}chimere/css/print.css" media='print'/> -{% if css_area %} -<link rel="stylesheet" href="{{ css_area }}" />{% endif %} +{% if css_map %} +<link rel="stylesheet" href="{{ css_map }}" />{% endif %} {% if MOBILE %} <link rel="stylesheet" href="{{ STATIC_URL }}chimere/css/mobile.css" /> <script src="{{ STATIC_URL }}chimere/js/mobile.chimere.js" type="text/javascript"></script>{%endif%} @@ -24,6 +24,7 @@ {% endblock %} {% block content %} {% block top %}{% endblock %} + {% if has_search %} {% block search_box %}{% endblock %} {% endif %} {% block message_map %}{% endblock %} {% block message_edit %}{% endblock %} {% block bottom %}{% endblock %} diff --git a/chimere/templates/chimere/blocks/actions.html b/chimere/templates/chimere/blocks/actions.html index 93debb0..b00666f 100644 --- a/chimere/templates/chimere/blocks/actions.html +++ b/chimere/templates/chimere/blocks/actions.html @@ -1,3 +1,4 @@ +{% if actions.1 %} <div id="topbar"> <ul id='action' class='action'> {% for action, subactions in actions %} @@ -18,3 +19,4 @@ {% endfor %} </ul> </div> +{% endif %} diff --git a/chimere/templates/chimere/blocks/areas.html b/chimere/templates/chimere/blocks/areas.html index a1ebe76..0883da9 100644..120000 --- a/chimere/templates/chimere/blocks/areas.html +++ b/chimere/templates/chimere/blocks/areas.html @@ -1,25 +1 @@ -{% load i18n %} -{% if areas and areas.count > 1 %} - <div id='areas-div'> - <label for='areas-select'>{% trans "Areas:" %}</label> - <select id='areas-select'> - {% if not has_default_area %}<option value=''>--</option>{% endif %} - {% for area in areas %} - <option value='{{area.urn}}'{% if area_name and area.urn == area_name %} selected='selected'{% endif %}{% if not area_name and area.default %} selected='selected'{% endif %}>{{area.name}}</option> - {% endfor %} - </select> - </div> - <script language='javascript' type='text/javascript'> - jQuery('#areas-select').change( - function (){ - val = jQuery(this).val(); - if(val){ - window.location = "{{ base_url }}" + jQuery(this).val(); - } - else{ - window.location = "{{ base_url }}"; - } - } - ); - </script> -{% endif %} +maps.html
\ No newline at end of file diff --git a/chimere/templates/chimere/blocks/areas_alternative.html b/chimere/templates/chimere/blocks/areas_alternative.html deleted file mode 100644 index 837bf45..0000000 --- a/chimere/templates/chimere/blocks/areas_alternative.html +++ /dev/null @@ -1,11 +0,0 @@ -{% load i18n unlocalize_point %} -{% if areas %} - <div id='areas'> - <h2>{% trans "Shortcuts"%}</h2> - <ul> - {% for area in areas %} - <li><img class="zoom_image" alt="{% trans 'Zoom to' %} {{area.name}}" src="{{ STATIC_URL }}chimere/img/zoom.png" onclick="$('#maps').chimere('zoom', {'area': [{{area.upper_left_corner.x|unlocalize_point}}, {{area.upper_left_corner.y|unlocalize_point}}, {{area.lower_right_corner.x|unlocalize_point }}, {{area.lower_right_corner.y|unlocalize_point}}]});" /> {{area.name}}</li> - {% endfor %} - </ul> - </div> -{% endif %} diff --git a/chimere/templates/chimere/blocks/footer.html b/chimere/templates/chimere/blocks/footer.html index a783939..f5830ed 100644 --- a/chimere/templates/chimere/blocks/footer.html +++ b/chimere/templates/chimere/blocks/footer.html @@ -1,3 +1,3 @@ {% load i18n %} -{% trans "This site uses Chimère"%} - <img src="{{STATIC_URL}}chimere/img/copyleft.png" alt="copyleft"/> 2008-2013 <a href='http://www.chymeres.net/'>Chimère project</a> - {% trans "Map"%} <img src="{{STATIC_URL}}chimere/img/copyleft.png" alt="copyleft"/> <a href='http://openstreetmap.org/'>OpenStreetMap</a> +{% trans "This site uses Chimère"%} <img src="{{STATIC_URL}}chimere/img/copyleft.png" alt="copyleft"/> 2008-2015 <a href='http://www.chymeres.net/'>Chimère project</a> - {% trans "Map"%} <img src="{{STATIC_URL}}chimere/img/copyleft.png" alt="copyleft"/> <a href='http://openstreetmap.org/'>OpenStreetMap</a> diff --git a/chimere/templates/chimere/blocks/head_chimere.html b/chimere/templates/chimere/blocks/head_chimere.html index 7ed2b54..133192c 100644 --- a/chimere/templates/chimere/blocks/head_chimere.html +++ b/chimere/templates/chimere/blocks/head_chimere.html @@ -1,10 +1,9 @@ -{% for css_url in OSM_CSS_URLS %} -<link rel="stylesheet" href="{{ css_url }}" />{% endfor %} -{% for js_url in OSM_JS_URLS %} +{% for css_url, condition in MAP_CONDITIONNAL_CSS_URLS %} +{% if condition %}<!--[if {{condition}}]>{%endif%}<link rel="stylesheet" href="{{ css_url }}" />{% if condition %}<![endif]-->{%endif%}{% endfor %} +{% if enable_clustering %}<script src="{{ STATIC_URL }}chimere/js/clustering.js" type="text/javascript"></script>{% endif %} +{% for js_url in MAP_JS_URLS %} <script src="{{ js_url }}" type="text/javascript"></script>{% endfor %} {% if routing %}<script src="{{ STATIC_URL }}chimere/js/routing-widget.js" type="text/javascript"></script>{% endif %} -{% if enable_clustering %}<script src="{{ STATIC_URL }}chimere/js/clustering.js" type="text/javascript"></script>{% endif %} -<script src="{{ STATIC_URL }}chimere/js/jquery.chimere.js" type="text/javascript"></script> <script type="text/javascript"> /* Global variables */ var STATIC_URL = static_url = "{{ STATIC_URL }}"; @@ -15,14 +14,15 @@ <script src="{{ STATIC_URL }}chimere/js/base.js" type="text/javascript"></script> <script type="text/javascript"> var DEFAULT_ZOOM = {{ DEFAULT_ZOOM }}; + {% ifequal CHIMERE_VIEW_RENDERER 'openlayers' %} var EPSG_DISPLAY_PROJECTION = epsg_display_projection = new OpenLayers.Projection('EPSG:{{ EPSG_DISPLAY_PROJECTION }}'); OpenLayers.ImgPath = '{{ STATIC_URL }}chimere/img/'; var EPSG_PROJECTION = epsg_projection = new OpenLayers.Projection('EPSG:{{ EPSG_PROJECTION }}'); var CENTER_LONLAT = centerLonLat = new OpenLayers.LonLat{{ DEFAULT_CENTER }}.transform(epsg_display_projection, epsg_projection); - /*var map_layer = {{ MAP_LAYER|safe }};*/ + {% endifequal %} var restricted_extent; - {% if area_name %} - var area_name = '{{ area_name }}';{% endif %} + {% if map_name %} + var map_name = '{{ map_name }}';{% endif %} $(function() {$( ".draggable" ).draggable({handle:"h2"});}); var get_share_url = '{% url chimere:get-share-url %}'; diff --git a/chimere/templates/chimere/blocks/live_coordinates.html b/chimere/templates/chimere/blocks/live_coordinates.html index 6d0dfb4..82166c8 100644 --- a/chimere/templates/chimere/blocks/live_coordinates.html +++ b/chimere/templates/chimere/blocks/live_coordinates.html @@ -13,12 +13,9 @@ chimere_init_options['dynamic_categories'] = false; chimere_init_options['edition'] = true; chimere_init_options["checked_categories"] = []; - if({{default_area}}) chimere_init_options['selected_map_layer'] = {{default_area}}; + if({{default_map}}) chimere_init_options['selected_map_layer'] = {{default_map}}; </script> -</div> - - <div id='map_edit'></div> <div id='live_lonlat'> <p> @@ -30,6 +27,7 @@ <input type='text' name='live_longitude' id='live_longitude' size='8' adisabled='true' value='{{value_x|stringformat:"f"}}'/> </p> <input type='hidden' name='{{name}}' id='id_{{name}}' value='{{val}}'/> +</div> <script type="text/javascript"> function init_map_edit(){ diff --git a/chimere/templates/chimere/blocks/map.html b/chimere/templates/chimere/blocks/map.html index 764d07b..a1faebf 100644 --- a/chimere/templates/chimere/blocks/map.html +++ b/chimere/templates/chimere/blocks/map.html @@ -25,17 +25,22 @@ $(function(){ {% if single_category %} $(function() {$('#panel').hide()});{% endif %} var chimere_init_options = {}; + if (typeof simple != 'undefined'){ + chimere_init_options['simple'] = simple; + } {% if MOBILE %}chimere_init_options["mobile"] = true;{% endif %} {% if enable_clustering %}chimere_init_options["enable_clustering"] = true;{% endif %} chimere_init_options["default_icon"] = '{{STATIC_URL}}img/marker-green.png'; chimere_init_options["map_layers"] = [{{js_map_layers|safe|escape}}]; + chimere_init_options["map_layer_names"] = [{{js_map_layer_names|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}}); + {% if default_map %} + chimere_init_options["default_map"] = new Array({{default_map.upper_left_corner.x}}, {{default_map.upper_left_corner.y}}, {{default_map.lower_right_corner.x}}, {{default_map.lower_right_corner.y}}); {% endif %} + {% if clustering_map %}chimere_init_options["clustering_map"] = true;{% 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 %} @@ -46,12 +51,13 @@ $(function(){ {% 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 %} + {% ifequal map_renderer 'openlayers' %} chimere_init_options["icon_offset"] = new OpenLayers.Pixel({{icon_offset_x}}, - {{icon_offset_y}}); + {{icon_offset_y}});{% endifequal %} 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 map_id %}chimere_init_options['map_id'] = "{{map_id}}";{% endif %} {% if p_current_feature %} chimere_init_options["display_feature"] = {{ p_current_feature }};{% endif %} {% if p_current_route %} @@ -59,12 +65,13 @@ $(function(){ {% if restricted_extent %}{{ restricted_extent }} chimere_init_options["restricted_extent"] = bounds; {% endif %} + {% if enable_clustering %}chimere_init_options['enable_clustering'] = true;{% endif%} {% if selected_map_layer %} chimere_init_options["selected_map_layer"] = {{selected_map_layer}}; {% endif %} - $("#main-map").chimere(chimere_init_options); + $("#{{map_id}}").chimere(chimere_init_options); {% if zoom %} - $('#maps').chimere('zoom', {'area':{{zoom}} }); + $('#{{map_id}}').chimere('zoom', {'area':{{zoom}} }); {% endif %} // init layer selection diff --git a/chimere/templates/chimere/blocks/maps.html b/chimere/templates/chimere/blocks/maps.html new file mode 100644 index 0000000..92bcfdc --- /dev/null +++ b/chimere/templates/chimere/blocks/maps.html @@ -0,0 +1,29 @@ +{% load i18n %} +{% if maps %} + <div id='maps-div'> + {% if maps|length > 1 %} + <label for='maps-select'>{% trans "Maps:" %}</label> + <select id='maps-select'> + {% if not has_default_map %}<option value=''>--</option>{% endif %} + {% for map in maps %} + <option value='{{map.urn}}'{% if map_name and map.urn == map_name %} selected='selected'{% endif %}{% if not map_name and map.default %} selected='selected'{% endif %}>{{map.name}}</option> + {% endfor %} + </select> + <script language='javascript' type='text/javascript'> + jQuery('#maps-select').change( + function (){ + val = jQuery(this).val(); + if(val){ + window.location = "{{ base_url }}" + jQuery(this).val(); + } + else{ + window.location = "{{ base_url }}"; + } + } + ); + </script> + {% else %} + <label for='maps-select'>{{maps.0.name}}</label> + {% endif %} + </div> +{% endif %} diff --git a/chimere/templates/chimere/blocks/maps_alternative.html b/chimere/templates/chimere/blocks/maps_alternative.html new file mode 100644 index 0000000..c91d75a --- /dev/null +++ b/chimere/templates/chimere/blocks/maps_alternative.html @@ -0,0 +1,11 @@ +{% load i18n unlocalize_point %} +{% if maps %} + <div id='maps'> + <h2>{% trans "Shortcuts"%}</h2> + <ul> + {% for map in maps %} + <li><img class="zoom_image" alt="{% trans 'Zoom to' %} {{map.name}}" src="{{ STATIC_URL }}chimere/img/zoom.png" onclick="$('#maps').chimere('zoom', {'map': [{{map.upper_left_corner.x|unlocalize_point}}, {{map.upper_left_corner.y|unlocalize_point}}, {{map.lower_right_corner.x|unlocalize_point }}, {{map.lower_right_corner.y|unlocalize_point}}]});" /> {{map.name}}</li> + {% endfor %} + </ul> + </div> +{% endif %} diff --git a/chimere/templates/chimere/blocks/news.html b/chimere/templates/chimere/blocks/news.html index fa581f7..07c2bbb 100644 --- a/chimere/templates/chimere/blocks/news.html +++ b/chimere/templates/chimere/blocks/news.html @@ -39,7 +39,7 @@ $(function(){ {% for property in news.getProperties %} <p class='{{news.propertymodel.getNamedId}}'>{{ property.value|sanitize:"p b i br hr strong em span:style a:href:target ul li ol h1 h2 h3 h4 table td th tr"|safe }}</p> {% endfor %} - <p class='marker_link'><a href='{% get_tinyfied_url news area_name %}'>{% trans "See it on the map"%}</a></p> + <p class='marker_link'><a href='{% get_tinyfied_url news map_name %}'>{% trans "See it on the map"%}</a></p> {% endif %} </div> {%endfor%} diff --git a/chimere/templates/chimere/blocks/nominatim_widget.html b/chimere/templates/chimere/blocks/nominatim_widget.html new file mode 100644 index 0000000..2971e60 --- /dev/null +++ b/chimere/templates/chimere/blocks/nominatim_widget.html @@ -0,0 +1,17 @@ +{% load i18n %} +<div class='nominatim-widget'> +<input type='hidden' name='nominatim_{{id}}_lat' id='nominatim_{{id}}_lat'/> +<input type='hidden' name='nominatim_{{id}}_lon' id='nominatim_{{id}}_lon'/> +<label for='nominatim_{{id}}' class='nominatim-search'>{% trans "Search:"%}</label> +<input type='text' class='nominatim-widget' name='nominatim_{{id}}' id='nominatim_{{id}}' value=""/> +<label class='nominatim-label' id='nominatim_{{id}}_label'> </label> +</div> +<script type='text/javascript'> +var default_nominatim_lbl = "{% trans 'Street, City, Country'%}"; +var nominatim_url = "{{nominatim_url}}"; +$("#nominatim_{{id}}").val(default_nominatim_lbl); +$("#nominatim_{{id}}").click(function(){ + $("#nominatim_{{id}}").val(''); +}); +</script> + diff --git a/chimere/templates/chimere/blocks/submited.html b/chimere/templates/chimere/blocks/submited.html index 5e4e546..7692d79 100644 --- a/chimere/templates/chimere/blocks/submited.html +++ b/chimere/templates/chimere/blocks/submited.html @@ -1,6 +1,19 @@ {% load i18n %} +{% load url from future %} <div class='edit' id='submited-window'> - <p>{% trans "Your new proposition/modification has been submited. A moderator will treat your submission shortly. Thanks!" %}</p> + {% if is_modification %} + {% if can_write %} + <p>{% trans "Your modification has been taken into account." %}</p> + {% else %} + <p>{% trans "Your modification has been submited. A moderator will treat your submission shortly. Thanks!" %}</p> + {% endif %} + {% else %} + {% if can_write %} + <p>{% trans "Your new proposition has been added." %}</p> + {% else %} + <p>{% trans "Your new proposition has been submited. A moderator will treat your submission shortly. Thanks!" %}</p> + {% endif %} + {% endif %} </div> <script type='text/javascript'> $(function(){ @@ -11,7 +24,7 @@ buttons:{ "{% trans "Add a new item" %}": function() { - window.location = "{{edit_url}}"; + window.location = "{% url "chimere:edit" %}"; }, "{% trans "Continue edition of this item" %}": function() { @@ -19,7 +32,7 @@ }, "{% trans "Return to the map" %}": function() { - window.location = "{{index_url}}"; + window.location = "{% url "chimere:index" %}"; } } }); diff --git a/chimere/templates/chimere/blocks/welcome.html b/chimere/templates/chimere/blocks/welcome.html index 3ec2ccf..a0052f5 100644 --- a/chimere/templates/chimere/blocks/welcome.html +++ b/chimere/templates/chimere/blocks/welcome.html @@ -49,7 +49,7 @@ $(function(){ {% for property in news.getProperties %} <p class='{{news.propertymodel.getNamedId}}'>{{ property.value|sanitize:"p b i br hr strong em img:src:alt span:style a:href:target ul li ol h1 h2 h3 h4 table td th tr"|safe }}</p> {% endfor %} - <p class='marker_link'><a href='{% get_tinyfied_url news area_name %}'>{% trans "See it on the map"%}</a></p> + <p class='marker_link'><a href='{% get_tinyfied_url news map_name %}'>{% trans "See it on the map"%}</a></p> {% endif %} </div> {%endfor%} diff --git a/chimere/templates/chimere/detail.html b/chimere/templates/chimere/detail.html index ed0ea5c..259df31 100644 --- a/chimere/templates/chimere/detail.html +++ b/chimere/templates/chimere/detail.html @@ -20,7 +20,7 @@ <p class='description'>{{ marker.description|sanitize:"p b i br hr strong em img:src:alt span:style a:href:target ul li ol h1 h2 h3 h4 table td tr th"|safe}}</p> {% endif %} {% for property in marker.getProperties %} - <p class='{{property.propertymodel.getNamedId}}'>{{ property.value|sanitize:"p b i br hr strong em img:src:alt span:style a:href:target ul li ol h1 h2 h3 h4 table td tr th"|safe}}</p> + <p class='property_{{property.propertymodel.slug}}'>{{ property.label|sanitize:"p b i br hr strong em img:src:alt span:style a:href:target ul li ol h1 h2 h3 h4 table td tr th"|safe}}</p> {% endfor %} {% if marker.origin %}<p class='detail_source'><strong>{% trans "Source:" %}</strong> <span>{{marker.origin}}</span></p>{% endif %} {% if marker.license %}<p class='detail_license'><strong>{% trans "License:" %}</strong> <span>{{marker.license}}</span></p>{% endif %} @@ -28,9 +28,12 @@ <a href='#' class='show_gallery_link'>{% trans "Show multimedia gallery" %}</a> </p>{% endif %} </div> - <p class='detail_amendment'><a href='{% if marker.route %}{% url chimere:editroute-item area_name_slash|default_if_none:"" marker.route.pk "" %}{%else%}{% url chimere:edit-item area_name_slash|default_if_none:"" marker.pk "" %}{%endif%}'> - {% trans "Submit an amendment" %} + {% if can_edit or can_propose %} + <p class='detail_amendment'><a href='{% if marker.route %}{% url chimere:editroute-item map_name_slash|default_if_none:"" marker.route.pk "" %}{%else%}{% url chimere:edit-item map_name_slash|default_if_none:"" marker.pk "" %}{%endif%}'> + {% if can_write %}{% trans "Edit" %}{%else%} + {% trans "Submit an amendment" %}{%endif%} </a> + {% endif %} {% if moderator_emails %} <a href="mailto:?from={{moderator_emails}}&subject={% trans "Propose amendment" %}&body={% trans "I would like to propose an amendment for this item:"%} {{share_url}}"> {% trans "Propose amendment" %} diff --git a/chimere/templates/chimere/edit.html b/chimere/templates/chimere/edit.html index f9706d3..8322c50 100644 --- a/chimere/templates/chimere/edit.html +++ b/chimere/templates/chimere/edit.html @@ -1,9 +1,9 @@ {% extends "chimere/base.html" %} {% load i18n chimere_tags adminmedia inline_formset%} {% block extra_head %} - {{ form.media }} + {{ extra_head }} {{ block.super }} - {% head_chimere %} + {% head_chimere False %} {% if dated %} <!--script type="text/javascript" src="{{extra_url}}media/js/core.js"></script--> <script type="text/javascript" src="{{ STATIC_URL }}chimere/js/utils.js"></script> @@ -13,17 +13,20 @@ {% endif %} {% endblock %} +{% block body_class %}class='edit'{% endblock %} + {% block content %} {{ block.super }} - {% if submited %}{% submited %}{% endif %} + {% if submited %}{% include "chimere/blocks/submited.html" %}{% endif %} {% if error_message %}<fieldset class='edit errorlist'> <legend>{% trans "Error" %}</legend> <p>{{ error_message }}</p> - {% endif %}</fieldset> - {% if is_modification and is_superuser %}<div class='warning'><p>{% trans "You are logged as an administrator. Your modifications will be taking into account immediately." %}</p></div>{% endif %} + </fieldset>{% endif %} + {% if is_modification and can_write %}<div class='warning'><p>{% trans "You have write rights for this map. Your modifications will be taking into account immediately." %}</p></div>{% endif %} <fieldset class='edit'> <legend>{% if is_modification %}{% trans "Modify a point of interest" %}{% else %}{% trans "Add a point of interest" %}{% endif %}</legend> <form enctype="multipart/form-data" method='post' action='.'> + <p class='submit'><input type='submit' onclick='saveExtent();displayProgress();' value="{% if can_write%}{% trans 'Add/modify'%}{%else%}{% trans 'Propose'%}{%endif%}"/></p> {% csrf_token %} <div class='rightWrapper'> <div class='rightform'> @@ -31,6 +34,7 @@ <label for="id_point">{% trans "Point"%} *</label> {%if form.point.errors %}<ul class="errorlist"><li>{% trans "Select a location for this new site" %}</li></ul>{%endif%} {{point_widget}} + {{nominatim_widget}} </div> </div> </div> @@ -53,13 +57,13 @@ <p class="help">{{ form.description.help_text }}</p> </div> {% if dated %} - <div class="fieldWrapper"> + <div class="fieldWrapper dated_field"> <label for="id_start_date">{% trans "Start date" %}</label> {{ form.start_date.errors }} {{ form.start_date }} <p class="help">{{ form.start_date.help_text }}</p> </div> - <div class="fieldWrapper"> + <div class="fieldWrapper dated_field"> <label for="id_end_date">{% trans "End date" %}</label> {{ form.end_date.errors }} {{ form.end_date }} @@ -94,7 +98,7 @@ cat_filters['{{subcat.id}}'].push('#id_{{property.getNamedId}}'); {% endfor %} {% endfor %} - $('#id_categories').change(function(){ + function checkFilteredProperties(){ for (idx in cat_to_hide){ $(cat_to_hide[idx]).parent().hide(); } @@ -105,11 +109,13 @@ $(cat_filters[val][ids]).parent().show(); } } - }); + } + $('#id_categories').change(checkFilteredProperties); $('#id_categories').change(); </script> {% endif %} </div> + {% if not is_authenticated %} <div class='personalform'> <h3>{% trans "Personal information"%}</h3> <div class='warning'> @@ -130,28 +136,48 @@ {% if form.submiter_comment.errors %}<div class='errors'>{{ form.submiter_comment.errors }}</div>{% endif %} {{ form.submiter_comment }} </div> - </div> + </div>{% endif %} <div id='upload_in_progress'> <p>{% trans "Upload in progress. Please wait..." %}</p> <p><img alt='Ajax loader' src='{{STATIC_URL}}chimere/img/ajax-loader.gif'/></p> </div> <script text='text/javascript'> - $( "#upload_in_progress" ).dialog({ - modal: true, - resizable:false, - height:110, - autoOpen:false, - dialogClass:'alert-box' - } - ); + $( "#upload_in_progress" ).dialog({ + modal: true, + resizable:false, + height:110, + autoOpen:false, + dialogClass:'alert-box' + } + ); $(".ui-dialog-titlebar").hide(); function displayProgress(){ $("#upload_in_progress").dialog('open'); return true; } + {% if dated %} + var dated_cats = new Array(); + {% for cat in sub_categories %}{% for subcat in cat.1 %}{% if subcat.dated %}dated_cats.push('{{subcat.pk}}');{% endif %}{% endfor %}{% endfor %} + function checkDatedFields(){ + {% if filtered_properties %}checkFilteredProperties();{% endif %} + var values = $('#id_categories').val(); + displayed = false; + if (values){ + for (idx=0;idx < values.length;idx++){ + if (dated_cats.indexOf(values[idx]) != -1 ) displayed = true; + } + } + if (displayed){ + $('.dated_field').show(); + } else { + $('.dated_field').hide(); + } + } + $('#id_categories').change(checkDatedFields); + $('#id_categories').change(); + {% endif %} </script> - <p><input type='submit' onclick='saveExtent();displayProgress();' value="{% trans 'Propose'%}"/></p> + <p class='submit'><input type='submit' onclick='saveExtent();displayProgress();' value="{% if can_write%}{% trans 'Add/modify'%}{%else%}{% trans 'Propose'%}{%endif%}"/></p> </form> </fieldset> - </div> {% endblock %} diff --git a/chimere/templates/chimere/edit_route.html b/chimere/templates/chimere/edit_route.html index 10f4d5e..669be7a 100644 --- a/chimere/templates/chimere/edit_route.html +++ b/chimere/templates/chimere/edit_route.html @@ -13,9 +13,11 @@ {% endif %} {% endblock %} +{% block body_class %}class='edit'{% endblock %} + {% block content %} {{ block.super }} - {% if submited %}{% submited %}{% endif %} + {% if submited %}{% include "chimere/blocks/submited.html" %}{% endif %} {% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %} {% if is_modification and is_superuser %}<div class='warning'><p>{% trans "You are logged as an administrator. Your modifications will be taking into account immediately." %}</p></div>{% endif %} <fieldset class='edit'> @@ -49,13 +51,13 @@ {{ form.description }} </div> {% if dated %} - <div class="fieldWrapper"> + <div class="fieldWrapper dated_field"> <label for="id_start_date">{% trans "Start date" %}</label> {{ form.start_date.errors }} {{ form.start_date }} <p class="help">{{ form.start_date.help_text }}</p> </div> - <div class="fieldWrapper"> + <div class="fieldWrapper dated_field"> <label for="id_end_date">{% trans "End date" %}</label> {{ form.end_date.errors }} {{ form.end_date }} @@ -75,7 +77,30 @@ {% inline_formset "Multimedia files" formset_multi %} {% inline_formset "Picture files" formset_picture %} - <p><input type='submit' onclick='saveExtent();' value="{% trans 'Propose'%}"/></p> + <script text='text/javascript'> + {% if dated %} + var dated_cats = new Array(); + {% for cat in sub_categories %}{% for subcat in cat.1 %}{% if subcat.dated %}dated_cats.push('{{subcat.pk}}');{% endif %}{% endfor %}{% endfor %} + function checkDatedFields(){ + var values = $('#id_categories').val(); + displayed = false; + if (values){ + for (idx=0;idx < values.length;idx++){ + if (dated_cats.indexOf(values[idx]) != -1 ) displayed = true; + } + } + if (displayed){ + $('.dated_field').show(); + } else { + $('.dated_field').hide(); + } + } + $('#id_categories').change(checkDatedFields); + $('#id_categories').change(); + {% endif %} + </script> + + <p class='submit'><input type='submit' onclick='saveExtent();' value="{% trans 'Propose'%}"/></p> </div> </form> </fieldset> diff --git a/chimere/templates/chimere/feeds/rss.html b/chimere/templates/chimere/feeds/rss.html index 53b0a49..df8bb26 100644 --- a/chimere/templates/chimere/feeds/rss.html +++ b/chimere/templates/chimere/feeds/rss.html @@ -46,13 +46,13 @@ {%ifequal category_rss_feed "area" %} <h3>{% trans "New points of interest by area" %}</h3> -{% if area_id %} +{% if map_id %} <div class="fieldWrapper"> - <h4>{% trans "Choose a pre-defined areas" %}</h4> - <select name='id_area' id='id_area' onchange='document.forms["rss_form"].submit();'> + <h4>{% trans "Choose a pre-defined map" %}</h4> + <select name='id_map' id='id_map' onchange='document.forms["rss_form"].submit();'> <option value="" selected="selected"> ---- </option> - {% for areaID in area_id %} - <option value="{{areaID.id}}">{{areaID.name}}</option> + {% for mapID in map_id %} + <option value="{{mapID.pk}}">{{mapID.name}}</option> {% endfor %} </select> </div> diff --git a/chimere/templates/chimere/main_map.html b/chimere/templates/chimere/main_map.html index b7aa868..7f19e79 100644 --- a/chimere/templates/chimere/main_map.html +++ b/chimere/templates/chimere/main_map.html @@ -1,14 +1,30 @@ {% extends "chimere/base.html" %} {% load i18n unlocalize_point chimere_tags %} +{% load url from future %} {% block extra_head %} {% head_jquery %} {% head_chimere %} {% head_jme %} -<script src="{{ STATIC_URL }}chimere/js/jquery.chimere.js" type="text/javascript"></script> +{% if has_search %} +<script src="{{ STATIC_URL }}chimere/js/search.js" type="text/javascript"></script> +<script src="{{ STATIC_URL }}chimere/js/search-autocomplete.js" type="text/javascript"></script>{% endif %} {{ block.super }} {% endblock %} {% block message_edit %}{% endblock %} {% block sidebar %} + {{block.super}} + <div id='auth'> + {% if not is_authenticated %} + <form action='.' method='post'> + <table> + {{auth_form.as_table}} + <tr><td></td><td><input type='submit' value='Ok'/></td></tr> + </table> + </form> + {% else %} + <p>{% trans "Identified as: " %}{{user}} - <a href='{% url "chimere:logout" %}'>{% trans "Logout"%}</a></p> + {% endif %} + </div> <div id='panel' class='draggable ui-widget ui-corner-all'> <h2 class='ui-widget ui-state-default ui-corner-all ui-widget-header'>{% trans "Categories"%}</h2> <form method='post' name='frm_categories' id='frm_categories'> @@ -25,17 +41,21 @@ </script> <div id='utils-div' class='ui-widget ui-state-default ui-corner-all'> - {% if areas_visible %} - {% display_areas %} + {% if maps_visible %} + {% display_maps %} {% endif %} {% routing %} {% display_welcome %} {% display_news news_visible %} <div id='permalink' class='ui-widget ui-button ui-state-default ui-corner-all'></div> - <a id='simple_button' class='ui-widget ui-button ui-state-default ui-corner-all' href='{% url chimere:simple_index area_name_slash %}'>{% trans "Simple map" %}</a> + <a id='simple_button' class='ui-widget ui-button ui-state-default ui-corner-all' href='{% url "chimere:simple_index" map_name_slash %}'>{% trans "Simple map" %}</a> </div> <div id='detail' class='ui-widget ui-corner-all'></div> {% endblock %} +{% block search_box %} +<div id='search-box' class='ui-widget ui-corner-all'> +</div> +{% endblock %} {% block content %} {{block.super}} <div id='main-map'></div> @@ -46,7 +66,16 @@ {% map 'main-map' %} <div id='chimere_message'></div> <script type='text/javascript'> - $(function(){$('#chimere_message').dialog({'autoOpen':false});}); + var has_search = {% if has_search %}true{% else %}false{% endif %}; + // array to keep trace of already displayed items + var search_result = new Array(); + var search_url = "/search/"; + $(function(){ + $('#chimere_message').dialog({'autoOpen':false}); + if (has_search){ + load_search_box(); + } + }); </script> {% endblock %} {% block footer %} diff --git a/chimere/templates/chimere/no_map.html b/chimere/templates/chimere/no_map.html new file mode 100644 index 0000000..a078e5e --- /dev/null +++ b/chimere/templates/chimere/no_map.html @@ -0,0 +1,41 @@ +{% extends "chimere/base.html" %} +{% load i18n unlocalize_point chimere_tags %} +{% load url from future %} +{% block extra_head %} +{% head_jquery %} +{% head_chimere %} +{% head_jme %} +{{ block.super }} +{% endblock %} +{% block sidebar %} + {{block.super}} + <div id='auth'> + {% if not is_authenticated %} + <form action='.' method='post'> + <table> + {{auth_form.as_table}} + <tr><td></td><td><input type='submit' value='Ok'/></td></tr> + </table> + </form> + {% else %} + <p>{% trans "Identified as: " %}{{user}} - <a href='{% url "chimere:logout" %}'>{% trans "Logout"%}</a></p> + {% endif %} + </div> +{% endblock %} +{% block content %} + {{block.super}} + <div id='no-content'> + <div class='alert'> + <p> + {% if is_authenticated %} + {% trans "No map are currently available for your account." %} + {% else %} + {% trans "No map are currently available for public access. If you have an account identify yourself." %} + {% endif %} + </p> + </div> + </div> +{% endblock %} +{% block footer %} + <p class='map-footer'>{% include "chimere/blocks/footer.html" %}</p> +{% endblock %} diff --git a/chimere/templates/search/indexes/chimere/marker_text.txt b/chimere/templates/search/indexes/chimere/marker_text.txt new file mode 100644 index 0000000..ad5bae1 --- /dev/null +++ b/chimere/templates/search/indexes/chimere/marker_text.txt @@ -0,0 +1,3 @@ +{% load unescape %} +{{object.name}} +{{object.description|safe|striptags|unescape}} diff --git a/chimere/templates/search/indexes/chimere/route_text.txt b/chimere/templates/search/indexes/chimere/route_text.txt new file mode 100644 index 0000000..2fad18d --- /dev/null +++ b/chimere/templates/search/indexes/chimere/route_text.txt @@ -0,0 +1 @@ +{{object.name}} diff --git a/chimere/templates/search/search.html b/chimere/templates/search/search.html new file mode 100644 index 0000000..b40359a --- /dev/null +++ b/chimere/templates/search/search.html @@ -0,0 +1,54 @@ +{% load url from future %}{% load i18n %} +{% if query %} +<script type='text/javascript'> +var geo_objects = [{% for result in page.object_list %}{{result.object.getGeoJSON|safe}}{% if not forloop.last %}, {% endif %}{% endfor %}]; +var geo_features = {}; +for (idx=0 ; idx < geo_objects.length ; idx++){ + var c_idx = geo_objects[idx].properties.pk; + if (search_result.indexOf(c_idx) == -1){ + search_result.push(c_idx); + geo_features[c_idx] = $('#main-map').chimere('addMarker', + geo_objects[idx]); + } +} +{% if page.object_list.count %}$("#main-map").chimere("zoomToMarkerExtent");{% endif %} +</script> +<div id='search-listing'> + <ul> +{% for result in page.object_list %} + <li> + <img src='{{MEDIA_URL}}{{result.object.default_category.icon.image}}'/><a href="#" onclick="$('#main-map').chimere('showPopup', {{result.object.pk}});return false;">{{ result.object }}</a> + </li> +{% empty %} + <li>{% trans "No results found." %}</li> +{% endfor %} + </ul> +</div> +{% if page.has_previous or page.has_next %} + <div id='search-nav'> + {% if page.has_previous %}<a href="#" onclick="haystack_search(this, {{ page.previous_page_number }});">{% trans "Previous" %}</a>{% endif %} + {% if page.has_next %}<a href="#" onclick="haystack_search(this, {{ page.next_page_number }});">{% trans "More results..." %}</a>{% endif %} + </div> +{% endif %} + +{% else %} +<form id='search-form' class='autocomplete-me'> + <input type="text" id="id_q" name="q" autocomplete="off"/> + <button name='haystack-search' id='haystack-search' type='button' disabled='disabled' class="btn btn-default">{% trans "Search" %}</button> +</form> +<div id='search-result'></div> +<script type='text/javascript'> +no_result_message = "{% trans 'No exact match.' %}"; +$(function(){ + $('#haystack-search').click( + function(evt){ + $("#main-map").chimere("razMap"); + haystack_search(evt); + }); + window.autocomplete = new Autocomplete({ + form_selector: '.autocomplete-me' + }); + window.autocomplete.setup(); +}); +</script> +{% endif %} |
