summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@peacefrogs.net>2013-09-16 20:48:13 +0200
committerÉtienne Loks <etienne.loks@peacefrogs.net>2013-09-16 20:48:13 +0200
commit4763fc9734cb243fbabed3ec7f52203a484a00d2 (patch)
tree708644d6c121f1e3cd01663d11c10a3c7372eaf3
parent0fee41aba66ab32abcf4970790d8fbd5fe07600f (diff)
downloadChimère - projet Saclay-4763fc9734cb243fbabed3ec7f52203a484a00d2.tar.bz2
Chimère - projet Saclay-4763fc9734cb243fbabed3ec7f52203a484a00d2.zip
Allow manual edition of routes
-rw-r--r--settings.py2
-rw-r--r--static/saclay/css/styles-saclay.css35
-rw-r--r--static/saclay/js/interface.js28
-rw-r--r--templates/chimere/blocks/map.html1
-rw-r--r--templates/chimere/edit.html6
-rw-r--r--templates/chimere/main_map.html12
6 files changed, 62 insertions, 22 deletions
diff --git a/settings.py b/settings.py
index b4ff1ec..0cd2b5f 100644
--- a/settings.py
+++ b/settings.py
@@ -78,6 +78,8 @@ CHIMERE_SHAPEFILE_ENCODING = 'ISO-8859-1'
# it could be a good idea to hide it to an admin who could'nt do that
CHIMERE_HIDE_PROPERTYMODEL = False
+CHIMERE_ENABLE_CLUSTERING = False
+
# enable routing in Chimère
CHIMERE_ENABLE_ROUTING = False
diff --git a/static/saclay/css/styles-saclay.css b/static/saclay/css/styles-saclay.css
index a270636..3db40f9 100644
--- a/static/saclay/css/styles-saclay.css
+++ b/static/saclay/css/styles-saclay.css
@@ -11,17 +11,9 @@ html, h1, h2,
}
/* light */
-h2,
-.cloud h4,
-#layer_selection,
-#layer_selection h4,
-#chimere_itinerary_panel label,
-.ui-menu .ui-menu-item a,
-#submited-window,
-#welcome .footer a,
-label,
-#marker_hover_content,
-.notice{
+h2, .cloud h4, #layer_selection, #layer_selection h4,
+#chimere_itinerary_panel label, .ui-menu .ui-menu-item a, #submited-window,
+#welcome .footer a, label, .map_button a, #marker_hover_content, .notice{
color:#929288;
}
@@ -31,13 +23,8 @@ label,
}
/* activated */
-.small-galery p.legend,
-#detail_footer,
-#detail_footer a,
-#chimere_itinerary h4,
-h3.warn,
-.itinerary_label.itinerary_start,
-.itinerary_label.itinerary_end,
+.small-galery p.legend, #detail_footer, #detail_footer a, #chimere_itinerary h4,
+h3.warn, .itinerary_label.itinerary_start, .itinerary_label.itinerary_end,
.action li.ui-state-active{
color:#fff;
}
@@ -1104,6 +1091,18 @@ ul#ul_categories{
visibility:hidden;
}
+.map_button{
+ display:none;
+ z-index:20;
+ top:40px;
+ left:350px;
+ position:absolute;
+ background-color:#fff;
+ padding:2px 20px;
+ border:1px solid;
+ border-color:#c1c1b0;
+}
+
.main_category > span > label{
display:block;
width:100%;
diff --git a/static/saclay/js/interface.js b/static/saclay/js/interface.js
index 0d6edac..76a63da 100644
--- a/static/saclay/js/interface.js
+++ b/static/saclay/js/interface.js
@@ -5,6 +5,8 @@ $(function(){
'dialogClass':'no-titlebar'});
var update_editmarker = function(){
+ $("#main-map").chimere('cleanRoute');
+ $('.map_button').hide();
if($('#multimedia_form').length) $('#multimedia_form').remove();
$('#action-edit-event').removeClass('state-active');
$('#action-edit-route').removeClass('state-active');
@@ -28,6 +30,8 @@ $(function(){
};
var update_editevent = function(){
+ $("#main-map").chimere('cleanRoute');
+ $('.map_button').hide();
if($('#multimedia_form').length) $('#multimedia_form').remove();
$('#action-edit-marker').removeClass('state-active');
$('#action-edit-route').removeClass('state-active');
@@ -51,6 +55,7 @@ $(function(){
};
var update_editroute = function(){
+ $('.map_button').show();
if($('#multimedia_form').length) $('#multimedia_form').remove();
$('#action-edit-marker').removeClass('state-active');
$('#action-edit-event').removeClass('state-active');
@@ -66,6 +71,7 @@ $(function(){
$('#frm-edit-marker').html('');
$('#frm-edit-event').html('');
$('#frm-edit-route').html(data);
+ $("#main-map").chimere('cleanMarker');
$("#main-map").chimere('activateRouteEdit');
},
error: function (data) {
@@ -78,6 +84,9 @@ $(function(){
$('#news').dialog('open');
});
$("#action-carte").click(function(){
+ $('.map_button').hide();
+ $("#main-map").chimere('cleanRoute');
+ $("#main-map").chimere('cleanMarker');
$("#main-map").chimere('activateContextMenu');
if($("#itinerary_field").html()){
$("#chimere_itinerary_form").appendTo("#chimere_itinerary_panel");
@@ -94,6 +103,7 @@ $(function(){
});
$("#action-participate").click(function(){
+ $('.map_button').hide();
$('#action-carte').removeClass('state-active');
$('#action-participate').addClass('state-active');
$('#map-actions').hide();
@@ -146,7 +156,9 @@ $(function(){
par.removeClass('opened');
}
});
+
});
+
function display_feature_detail(data, settings){
settings.current_popup.setContentHTML("<div class='cloud'>" + data + "</div>");
$('.detail_zoomin').bind("click", function(event){
@@ -202,3 +214,19 @@ function display_feature_detail(data, settings){
$('div.media-player').jmeEmbedControls();
});
}
+
+function toggleDrawOn() {
+ $('#button-move-map').removeClass('toggle-button-active'
+ ).addClass('toggle-button-inactive');
+ $('#button-draw-map').removeClass('toggle-button-inactive'
+ ).addClass('toggle-button-active');
+ $("#main-map").chimere("activateCurrentControl");
+}
+
+function toggleDrawOff() {
+ $('#button-draw-map').removeClass('toggle-button-active'
+ ).addClass('toggle-button-inactive');
+ $('#button-move-map').removeClass('toggle-button-inactive'
+ ).addClass('toggle-button-active');
+ $("#main-map").chimere("deactivateCurrentControl");
+}
diff --git a/templates/chimere/blocks/map.html b/templates/chimere/blocks/map.html
index 0a5d785..df14aba 100644
--- a/templates/chimere/blocks/map.html
+++ b/templates/chimere/blocks/map.html
@@ -55,6 +55,7 @@
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(
diff --git a/templates/chimere/edit.html b/templates/chimere/edit.html
index 2416cde..de60dc5 100644
--- a/templates/chimere/edit.html
+++ b/templates/chimere/edit.html
@@ -100,7 +100,9 @@ Les évènements à caractère politique, confessionnel ainsi que ceux relevant
<div id='itinerary_field_contener'>
<input id='id_route' name='route' type='hidden'/>
<label class='error'>{% trans "Select a route for this new site (have you submit the search?)" %}</label>
- <div id='itinerary_field'></div>
+ <div id='itinerary_field'>{% if not itinerary_form %}
+ <div class='notice'><p>Cliquez sur la carte pour dessiner le trajet.</p></div>
+ {% endif %}</div>
<hr class='clean'/>
</div>
{% endif %}
@@ -142,7 +144,7 @@ Les évènements à caractère politique, confessionnel ainsi que ceux relevant
theme_advanced_buttons3 : ""
});
- {% if route %}
+ {% if route and itinerary_form %}
$("#chimere_itinerary_form").appendTo($("#itinerary_field"));
$('#main_map').chimere('updateRoutingInput');
{% else %}$('#main_map').chimere('updateMarkerInput');{% endif %}
diff --git a/templates/chimere/main_map.html b/templates/chimere/main_map.html
index f72c050..fe07aa9 100644
--- a/templates/chimere/main_map.html
+++ b/templates/chimere/main_map.html
@@ -28,10 +28,10 @@
<ul id='map-actions' class='action'>
<li id='action-categories' class='state-active'>
<label>{% trans "Categories" %}</label>
- </li>
+ </li>{% if itinerary_form %}
<li id='action-routing'>
<label>{% trans "Routing" %}</label>
- </li>
+ </li>{% endif %}
</ul>
<ul id='edit-actions' class='action'>
<li id='action-edit-marker' class='state-active'>
@@ -79,6 +79,14 @@
<div class='sidebar-handler' id='sidebar-handler-show'>
</div>
<div id='detail' class='ui-widget ui-corner-all'></div>
+ {% if not itinerary_form %}<div class='map_button'>
+ <a href='#' id='button-move-map' class='toggle-button toggle-button-active' onclick='toggleDrawOff();return false;'>
+ {% trans "Move on the map" %}
+ </a>
+ <a href='#' id='button-draw-map' class='toggle-button toggle-button-inactive' onclick='toggleDrawOn();return false;'>
+ {% trans "Draw" %}
+ </a>
+ </div>{% endif %}
<div id='permalink' style='display:none'></div>
{% display_welcome news_visible %}
{% display_news news_visible %}