diff options
Diffstat (limited to 'chimere/static')
| -rw-r--r-- | chimere/static/chimere/css/styles.css | 23 | ||||
| -rw-r--r-- | chimere/static/chimere/js/importer_interface.js | 35 | ||||
| -rw-r--r-- | chimere/static/chimere/js/jquery.chimere-ol.js | 77 |
3 files changed, 107 insertions, 28 deletions
diff --git a/chimere/static/chimere/css/styles.css b/chimere/static/chimere/css/styles.css index dd27d95..52832b0 100644 --- a/chimere/static/chimere/css/styles.css +++ b/chimere/static/chimere/css/styles.css @@ -501,6 +501,11 @@ ul.share li{ margin:0; } +span.icon{ + display:inline-block; + width:70px; +} + #frm_categories{ padding:0; margin:0; @@ -837,6 +842,7 @@ table.inline-table td input[type=file]{ list-style-type:none; margin:0; padding:4px; + padding-bottom: 70px; } #search-listing ul li{ @@ -1138,11 +1144,25 @@ div.pp_default .pp_expand{ padding:0 6px; } +#category-directory ul{ + padding:0; +} + +.category-directory-category{ + font-variant: small-caps; + font-weight: bold; +} + .olControlSimplePanZoom { top: 20px; right: 10px; } +.olControlSimplePanZoom #zoombar, +.olControlSimplePanZoom #slider{ + display: none; +} + .olControlSimplePanZoom .button { background-image: url('../img/map_sprite.png'); position:absolute; @@ -1189,11 +1209,12 @@ div.pp_default .pp_expand{ } .olControlSimplePanZoom #zoomout { - top:210px; + top:70px; width:25px; height:20px; left:10px; background-position: -15px -220px; + border-top:1px solid #ccc; } .olControlSimplePanZoom #slider { diff --git a/chimere/static/chimere/js/importer_interface.js b/chimere/static/chimere/js/importer_interface.js index 65bcf8c..1b95fb0 100644 --- a/chimere/static/chimere/js/importer_interface.js +++ b/chimere/static/chimere/js/importer_interface.js @@ -2,35 +2,42 @@ django.jQuery(function($) { var importer_form_filter = { OSM:new Array('field-filtr', 'field-default_name', 'field-categories', 'field-source', 'field-overwrite', - 'field-automatic_update'), + 'field-automatic_update', 'field-default_status'), KML:new Array('field-source', 'field-source_file', 'field-default_name', 'field-filtr', 'field-zipped', 'field-origin', 'field-license', 'field-categories', 'field-overwrite', - 'field-get_description', 'field-automatic_update'), + 'field-get_description', 'field-automatic_update', + 'field-default_status'), SHP:new Array('field-source', 'field-source_file', 'field-default_name', 'field-zipped', 'field-origin', 'field-srid', 'field-license', 'field-categories', 'field-overwrite', - 'field-automatic_update'), + 'field-automatic_update', 'field-default_status'), RSS:new Array('field-source', 'field-default_name', 'field-origin', 'field-srid', 'field-license', 'field-categories', 'field-overwrite', 'field-get_description', - 'field-automatic_update'), + 'field-automatic_update', 'field-default_status'), CSV:new Array('field-source', 'field-source_file', 'field-default_name', 'field-origin', 'field-srid', 'field-license', 'field-categories', 'field-overwrite', - 'field-get_description', 'field-automatic_update'), + 'field-get_description', 'field-automatic_update', + 'field-default_status'), XSLT:new Array('field-source', 'field-source_file', 'field-source_file_alt', 'field-default_name', 'field-origin', 'field-srid', 'field-license', 'field-categories', 'field-overwrite', 'field-get_description', 'field-default_localisation', - 'field-automatic_update'), + 'field-automatic_update', 'field-default_status'), XXLT:new Array('field-source', 'field-source_file', 'field-source_file_alt', 'field-default_name', 'field-origin', 'field-srid', 'field-license', 'field-categories', 'field-overwrite', 'field-get_description', 'field-default_localisation', - 'field-automatic_update') + 'field-automatic_update', 'field-default_status'), + JSON:new Array('field-source', 'field-source_file', 'field-default_name', + 'field-filtr', 'field-zipped', 'field-origin', + 'field-license', 'field-categories', 'field-overwrite', + 'field-get_description', 'field-automatic_update', + 'field-default_status', 'field-default_localisation') } var osm_map_initialized; var edit_map_initialized; @@ -63,13 +70,17 @@ django.jQuery(function($) { osm_map_initialized = true; } } - else if (importer_val == 'XSLT' || importer_val == 'XXLT'){ + else if (importer_val == 'XSLT' || importer_val == 'XXLT' + || importer_val == 'JSON'){ $('#importerkeycategories_set-group').show(); $('#key_categories-group').show(); $('#importerkeycategories_set-group .form-row').show(); $('#key_categories-group .form-row').show(); $('.form-row.field-filtr').addClass('field-map'); $('#map_edit').show(); + $('#map_edit_area').hide(); + $('.help-osm').hide(); + $('.input-osm').hide(); if (!edit_map_initialized){ init_map_edit(); edit_map_initialized = true; @@ -118,10 +129,10 @@ django.jQuery(function($) { value = $('input[name=id_filtr_type]:checked').val(); value += '[' + $("#id_filtr_tag").val() + ']'; value += '[bbox='; - value += $('#upper_left_lon').val() + ','; - value += $('#lower_right_lat').val() + ','; - value += $('#lower_right_lon').val() + ','; - value += $('#upper_left_lat').val(); + value += Number($('#upper_left_lon').val()).toFixed(6) + ','; + value += Number($('#lower_right_lat').val()).toFixed(6) + ','; + value += Number($('#lower_right_lon').val()).toFixed(6) + ','; + value += Number($('#upper_left_lat').val()).toFixed(6); value += ']'; $('#id_filtr').val(value); return false; diff --git a/chimere/static/chimere/js/jquery.chimere-ol.js b/chimere/static/chimere/js/jquery.chimere-ol.js index 9346964..1599e1d 100644 --- a/chimere/static/chimere/js/jquery.chimere-ol.js +++ b/chimere/static/chimere/js/jquery.chimere-ol.js @@ -45,7 +45,6 @@ if (typeof(OpenLayers) != 'undefined'){ else return v; }; })( jQuery ); - (function ($) { /* * Chimere jQuery plugin @@ -84,6 +83,7 @@ if (typeof(OpenLayers) != 'undefined'){ // Provide this function for overriding the getSubcategories default get_subcategories_fx: null, hide_popup_fx: null, + open_dialog_fx: null, // if leave to false every click on the map hide the pop-up explicit_popup_hide: false, controls:null, @@ -594,6 +594,7 @@ if (typeof(OpenLayers) != 'undefined'){ content += "</ul></div>"; $('#cluster_list').html(content); $('#cluster_list').dialog('open'); + $("#cluster_list").on("dialogclose", methods.cleanCluster); settings.map.setCenter( feature.geometry.getBounds().getCenterLonLat()); // register after the display @@ -687,8 +688,16 @@ if (typeof(OpenLayers) != 'undefined'){ }); }, razMap: function() { + methods.hidePopup(); + methods.uncheckCategories(); settings.layerMarkers.clearMarkers(); settings.layerVectors.removeAllFeatures(); + if (settings.enable_clustering){ + settings.layerCluster.removeAllFeatures(); + settings.cluster_array = []; + settings.layerCluster.addFeatures(settings.cluster_array); + methods.cleanCluster(); + } }, /* * Update the categories div in ajax @@ -714,7 +723,7 @@ if (typeof(OpenLayers) != 'undefined'){ _init_categories(); _reCheckCategories(); if (settings.current_category) { - // TODO : add a force mode + // TODO : add a force mode // (in case the category is yet visible in HTML...) methods.toggle_category(); } @@ -774,7 +783,6 @@ if (typeof(OpenLayers) != 'undefined'){ } else { par.removeClass('selected'); } - methods.hidePopup(e); methods.loadGeoObjects(); _toggle_categories($(this)); settings.permalink.updateLink(); @@ -782,6 +790,7 @@ if (typeof(OpenLayers) != 'undefined'){ $('#layer_cat_'+c_name).prop("checked", this.checked); } + methods.hidePopup(e); }); $('#display_submited_check').bind("click", function () { methods.loadGeoObjects(); @@ -796,8 +805,8 @@ if (typeof(OpenLayers) != 'undefined'){ var id = this.id.substr(this.id.lastIndexOf("_")+1); helpers.zoom_to_subcategories([id]); }); - $(".toggle_category").bind("click", function (e) { - var item = $(this); + $(".toggle_category").parent().bind("click", function (e) { + var item = $(this).children('.toggle_category'); var id = item.attr('id').substr(item.attr('id').lastIndexOf("_")+1); methods.toggle_category(id); }); @@ -823,6 +832,18 @@ if (typeof(OpenLayers) != 'undefined'){ } }, /* + * + */ + uncheckCategories: function (){ + $('#frm_categories .subcategories input:checkbox').each(function(index){ + $(this).attr("checked", false); + $(this).removeAttr("checked", false); + }); + $('#frm_categories .selected').each(function(index){ + $(this).removeClass("selected"); + }); + }, + /* * Hide clusterized markers */ cleanCluster: function (){ @@ -1046,6 +1067,28 @@ if (typeof(OpenLayers) != 'undefined'){ cleanRoute: function(){ settings.layerVectors.removeAllFeatures(); }, + // add json layer + addJSON: function(json_url){ + var jsonStyle = new OpenLayers.Style({ + 'strokeWidth':1, + 'fillColor':'#BBBBBB', + 'strokeColor':'#AAAAAA' + }); + + var jsonStyleMap = new OpenLayers.StyleMap({'default': jsonStyle}); + settings.layerJson = new OpenLayers.Layer.Vector("GeoJSON", { + projection: EPSG_DISPLAY_PROJECTION, + strategies: [new OpenLayers.Strategy.Fixed()], + protocol: new OpenLayers.Protocol.HTTP({ + url: json_url, + format: new OpenLayers.Format.GeoJSON() + }), + styleMap: jsonStyleMap + }); + settings.map.addLayer(settings.layerJson); + settings.map.setLayerIndex(settings.layerJson, 0); + settings.layerJson.setOpacity(0.4); + }, // Put a route on the map addRoute: function(route) { var polyline = route.geometry; @@ -1441,16 +1484,23 @@ if (typeof(OpenLayers) != 'undefined'){ helpers.zoom_to_area(options["area"]); } }, + open_dialog: function(title, content){ + if(settings.open_dialog_fx){ + settings.open_dialog_fx(title, content); + } else { + $("#category_description").html(content).dialog(); + $("#category_description").dialog("option", "title", title); + $('#category_description').dialog('open'); + } + }, category_detail: function (category_id) { /* show the detail of a category */ var uri = extra_url + "getDescriptionDetail/" + category_id; $.ajax({url:uri, - success: function (data) { - $("#category_description").html(data).dialog(); - $("#category_description").dialog( "option", "title", - $("#category_title").html()); - } - }); + success: function (data) { + methods.open_dialog($("#category_title").html(), data); + } + }); }, /* * Load the subcategory description if available @@ -1462,10 +1512,7 @@ if (typeof(OpenLayers) != 'undefined'){ dataType: "json", success: function (data) { if (!data.description){return} - $('#category_description').html(data.description); - $("#category_description").dialog("option", "title", - data.name); - $('#category_description').dialog('open'); + methods.open_dialog(data.name, data.description); }, error: function (data) { // fail silently |
