summaryrefslogtreecommitdiff
path: root/chimere/static
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@peacefrogs.net>2013-10-29 20:06:11 +0100
committerÉtienne Loks <etienne.loks@peacefrogs.net>2013-10-29 20:12:36 +0100
commit07eff011922affd5733814c13236fe149cd64fd1 (patch)
treea642e391b82ec397e6648e1512281e6171271fe5 /chimere/static
parentfda62e9b16ff53c20880bd2ebbe34ce55d633c2d (diff)
downloadChimère-07eff011922affd5733814c13236fe149cd64fd1.tar.bz2
Chimère-07eff011922affd5733814c13236fe149cd64fd1.zip
Importer HTML-XSLT: model - admin
* new fields for Importer model: alt source file (2 XSLT files can be used), default location (these pages doesn't provide adresses) * adapt admin to manage 2 type of hidden OpenLayers maps on the same page
Diffstat (limited to 'chimere/static')
-rw-r--r--chimere/static/chimere/css/forms.css5
-rw-r--r--chimere/static/chimere/js/edit_area.js23
-rw-r--r--chimere/static/chimere/js/importer_interface.js25
3 files changed, 35 insertions, 18 deletions
diff --git a/chimere/static/chimere/css/forms.css b/chimere/static/chimere/css/forms.css
index 7ceaa58..2c852d7 100644
--- a/chimere/static/chimere/css/forms.css
+++ b/chimere/static/chimere/css/forms.css
@@ -35,14 +35,15 @@ div.bottomform{
width: 100%;
}
-#map_edit{
+#map_edit, #map_edit_area{
margin:0;
border: 1px solid black;
width:100%;
height:350px;
}
-#map_edit #OpenLayers_Control_MaximizeDiv{
+#map_edit #OpenLayers_Control_MaximizeDiv,
+#map_edit_area #OpenLayers_Control_MaximizeDiv{
display:none;
}
diff --git a/chimere/static/chimere/js/edit_area.js b/chimere/static/chimere/js/edit_area.js
index 9c3384f..c2faa11 100644
--- a/chimere/static/chimere/js/edit_area.js
+++ b/chimere/static/chimere/js/edit_area.js
@@ -21,7 +21,7 @@ See the file COPYING for details.
var bbox_style = {fill: true, fillColor: "#FFFFFF", fillOpacity: 0.5,
stroke: true, strokeOpacity: 0.8, strokeColor: "#FF0000", strokeWidth: 2};
-var map;
+var area_map;
var box_layer;
function initForm(bounds){
@@ -44,8 +44,9 @@ function updateForm(bounds){
}
/* main initialisation function */
-function init(){
- map = new OpenLayers.Map ('map_edit', {
+function init(map_edit){
+ map_edit = typeof map_edit !== 'undefined' ? map_edit : 'map_edit';
+ area_map = new OpenLayers.Map (map_edit, {
controls:[new OpenLayers.Control.Navigation(),
new OpenLayers.Control.SimplePanZoom()],
maxResolution: 156543.0399,
@@ -54,7 +55,7 @@ function init(){
displayProjection: epsg_display_projection
} );
box_layer = new OpenLayers.Layer.Vector("Box layer");
- map.addLayers([map_layer, box_layer]);
+ area_map.addLayers([map_layer, box_layer]);
var selectControl = new OpenLayers.Control();
OpenLayers.Util.extend(selectControl, {
draw: function() {
@@ -66,9 +67,9 @@ function init(){
},
notice: function(pxbounds) {
- ltpixel = map.getLonLatFromPixel(
+ ltpixel = area_map.getLonLatFromPixel(
new OpenLayers.Pixel(pxbounds.left, pxbounds.top));
- rbpixel = map.getLonLatFromPixel(
+ rbpixel = area_map.getLonLatFromPixel(
new OpenLayers.Pixel(pxbounds.right, pxbounds.bottom));
if (ltpixel.equals(rbpixel))
return;
@@ -79,12 +80,12 @@ function init(){
updateForm(bounds);
}
});
- map.addControl(selectControl);
+ area_map.addControl(selectControl);
- map.events.register('zoomend', map, updateForm);
- map.events.register('moveend', map, updateForm);
+ area_map.events.register('zoomend', area_map, updateForm);
+ area_map.events.register('moveend', area_map, updateForm);
/* zoom to the appropriate extent */
- if (!zoomToCurrentExtent(map)){
- map.setCenter(centerLonLat, 12);
+ if (!zoomToCurrentExtent(area_map)){
+ area_map.setCenter(centerLonLat, 12);
}
}
diff --git a/chimere/static/chimere/js/importer_interface.js b/chimere/static/chimere/js/importer_interface.js
index b14b986..f66b306 100644
--- a/chimere/static/chimere/js/importer_interface.js
+++ b/chimere/static/chimere/js/importer_interface.js
@@ -15,9 +15,15 @@ django.jQuery(function($) {
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-get_description'),
+ 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')
}
- var map_initialized;
+ var osm_map_initialized;
+ var edit_map_initialized;
function refresh_importer_form(){
$('.form-row').not('.field-importer_type').hide();
var importer_val = $('.field-importer_type select').val();
@@ -33,20 +39,29 @@ django.jQuery(function($) {
}
if (importer_val == 'OSM'){
$('.form-row.field-filtr').addClass('field-map');
- $('#map_edit').show();
+ $('#map_edit_area').show();
if(!$('#id_source').val()){
$('#id_source').val(default_xapi);
}
$('#id_filtr').attr('readonly', true);
$('.help-osm').show();
$('.input-osm').show();
- if (!map_initialized){
+ if (!osm_map_initialized){
init_map_form();
- map_initialized = true;
+ osm_map_initialized = true;
+ }
+ }
+ else if (importer_val == 'XSLT'){
+ $('.form-row.field-filtr').addClass('field-map');
+ $('#map_edit').show();
+ if (!edit_map_initialized){
+ init_map_edit();
+ edit_map_initialized = true;
}
} else {
$('.form-row.field-filtr').removeClass('field-map');
$('#id_filtr').attr('readonly', false);
+ $('#map_edit_area').hide();
$('#map_edit').hide();
$('.help-osm').hide();
$('.input-osm').hide();