summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoretienne <etienne@9215b0d5-fb2c-4bbd-8d3e-bd2e9090e864>2010-04-05 16:27:14 +0000
committeretienne <etienne@9215b0d5-fb2c-4bbd-8d3e-bd2e9090e864>2010-04-05 16:27:14 +0000
commit04371d1191f094eb6a2e1c16a37fe2f6a590ee36 (patch)
treef8b6b396338dc706c195e183ed4ee70c116b9463
parent64004ac6382cc439dcd07876db95e5e85b9b2e0c (diff)
downloadChimère-04371d1191f094eb6a2e1c16a37fe2f6a590ee36.tar.bz2
Chimère-04371d1191f094eb6a2e1c16a37fe2f6a590ee36.zip
Make available a simple version of the site #91 - Permalink don't check the categories anymore with dynamic categories #90
git-svn-id: http://www.peacefrogs.net/svn/chimere/trunk@75 9215b0d5-fb2c-4bbd-8d3e-bd2e9090e864
-rw-r--r--chimere/main/views.py7
-rw-r--r--chimere/static/base.js11
-rw-r--r--chimere/static/main_map.js32
-rw-r--r--chimere/static/styles.css90
-rw-r--r--chimere/templates/base.html6
-rw-r--r--chimere/templates/main_map_simple.html20
-rw-r--r--chimere/urls.py7
7 files changed, 119 insertions, 54 deletions
diff --git a/chimere/main/views.py b/chimere/main/views.py
index 6cd335d..7556610 100644
--- a/chimere/main/views.py
+++ b/chimere/main/views.py
@@ -59,7 +59,7 @@ def get_base_response(area_name=""):
base_response_dct['area_name'] = area_name
return base_response_dct
-def index(request, area_name=None, default_area=None):
+def index(request, area_name=None, default_area=None, simple=False):
"""
Main page
"""
@@ -102,7 +102,10 @@ def index(request, area_name=None, default_area=None):
response_dct['p_checked_categories'] = ",".join(cats)
else:
response_dct['p_checked_categories'] = '';
- return render_to_response('main_map.html', response_dct)
+ tpl = 'main_map.html'
+ if simple:
+ tpl = 'main_map_simple.html'
+ return render_to_response(tpl, response_dct)
def edit(request, area_name=""):
"""
diff --git a/chimere/static/base.js b/chimere/static/base.js
index 1eba699..91710af 100644
--- a/chimere/static/base.js
+++ b/chimere/static/base.js
@@ -42,6 +42,17 @@ function hide(id){
document.getElementById(id).style.display = 'None';
}
+/* show or hide a panel */
+function showHide(id){
+ var item = document.getElementById(id);
+ if (item.style.display == 'block'){
+ hide(id);
+ } else {
+ show(id);
+ }
+}
+
+
function saveExtent() {
/* save the current extent in a cookie */
if(!map) return;
diff --git a/chimere/static/main_map.js b/chimere/static/main_map.js
index 67d1bee..fb736f5 100644
--- a/chimere/static/main_map.js
+++ b/chimere/static/main_map.js
@@ -115,6 +115,9 @@ var markers = new Array();
var layerMarkers;
var layerVectors;
+var simple = false;
+var first = true;
+
var currentPopup;
var currentFeature;
var clicked = false;
@@ -239,7 +242,8 @@ function updateCategories(response){
/* load geo objects with an AJAX request */
function loadGeoObjects(){
- updateCheckedCategories();
+ if (!first){ updateCheckedCategories(); }
+ first = false;
/* 0 stand for all categories */
if (!checked_categories) checked_categories = '0';
var uri = extra_url + "getGeoObjects/" + checked_categories;
@@ -255,7 +259,9 @@ function setGeoObjects(response){
/* clean the marker layer */
if (currentPopup) {
currentPopup.hide();
- hide('detail');
+ if (!simple){
+ hide('detail');
+ }
}
layerVectors = new OpenLayers.Layer.Vector("Vector Layer");
map.addLayer(layerVectors);
@@ -329,7 +335,9 @@ function putMarker(layer, mark) {
if (currentPopup == this.popup) {
this.popup.hide();
clicked = false;
- hide('detail');
+ if (!simple){
+ hide('detail');
+ }
} else {
currentPopup.hide();
showPop(this);
@@ -359,9 +367,11 @@ function putMarker(layer, mark) {
var hidePopUp = function (evt) {
if (clicked) {
- currentPopup.hide();
- clicked = false;
- hide('detail');
+ currentPopup.hide();
+ clicked = false;
+ if (!simple){
+ hide('detail');
+ }
}
}
@@ -378,8 +388,13 @@ function updateDetail(pk){
/* update the detail panel from an http response */
function setDetail(response){
if (response.responseText.indexOf('no results') == -1) {
- document.getElementById('detail').innerHTML = response.responseText;
- show('detail');
+ if (!simple){
+ document.getElementById('detail').innerHTML = response.responseText;
+ show('detail');
+ } else {
+ currentPopup.setContentHTML("<div class='cloud'>" +
+ response.responseText + "</div>");
+ }
}
}
@@ -491,6 +506,7 @@ function init(){
}
}
}
+ checked_categories = p_checked_categories.join('_');
}
}
/* if not zoom to the extent in cookies */
diff --git a/chimere/static/styles.css b/chimere/static/styles.css
index 217cba3..8094bba 100644
--- a/chimere/static/styles.css
+++ b/chimere/static/styles.css
@@ -145,11 +145,9 @@ padding:2px;
#panel{
padding:0;
border:1px solid #888;
-height:200px;
position:absolute;
z-index:5;
top:50px;
-bottom:20px;
right:18px;
width:300px;
background-color:#FFF;
@@ -159,6 +157,10 @@ opacity:0.8;
border-radius:10px;
}
+.simple #panel{
+top:5px;
+}
+
#areas{
padding:0;
border:1px solid #888;
@@ -297,6 +299,19 @@ right:8px;
z-index:0;
}
+.simple #map{
+margin:0px;
+padding:0px;
+height:100%;
+margin:0;
+padding:0;
+top:0;
+bottom:0;
+left:0;
+right:0;
+z-index:0;
+}
+
.news{
}
@@ -311,12 +326,17 @@ padding:10px;
margin:0;
}
-#categories{
+#panel #categories{
margin:0;
padding:0;
width:290px;
height:160px;
overflow:auto;
+z-index:5;
+}
+
+.simple #panel #categories{
+display:None;
}
#categories input {
@@ -392,42 +412,6 @@ p.warning{
text-align:center;
}
-#logos{
-text-align:center;
-z-index:5;
-position: absolute;
-bottom:46px;
-left:18px;
-}
-
-#logos ul{
-margin:0;
-margin-right:20px;
-padding:4px;
-border:1px solid #888;
--moz-border-radius: 10px;
--webkit-border-radius: 10px;
-border-radius: 10px;
-background-color:white;
-height:40px;
-float:left;
-}
-
-#logos li{
-display:inline;
-}
-
-#logos img{
-height:40px;
-text-decoration:None;
-border-width:0;
-}
-
-#logos li a{
-text-decoration:None;
-border-width:0;
-}
-
#welcome_button {
display: block;
position: absolute;
@@ -459,6 +443,10 @@ background-color:#b488ff;
text-align:center;
}
+.simple .olControlPermalink {
+display:None;
+}
+
.olControlPermalink a{
color:white;
font-size:14px;
@@ -470,3 +458,27 @@ text-decoration:none;
bottom:12px;
left:220px;
}
+
+.simple .olControlScaleLine {
+bottom:50px;
+left:10px;
+}
+
+.simple .olControlPanPanel{
+top:40px;
+}
+
+.simple .olControlZoomPanel{
+top:100px;
+}
+
+.simple .cloud h2{
+font-size:14px;
+text-align:center;
+margin:0;
+padding:0;
+background-color:transparent;
+color:#b488ff;
+}
+.simple .cloud img{display:None;}
+
diff --git a/chimere/templates/base.html b/chimere/templates/base.html
index 0d40c4c..9be4573 100644
--- a/chimere/templates/base.html
+++ b/chimere/templates/base.html
@@ -14,9 +14,9 @@
{% block head %}{% endblock %}
</head>
-<body>
+{% block bodyhead %}<body>{% endblock %}
{% block top %}{% endblock %}
- <div id="topbar">
+ {% block actions %}<div id="topbar">
<ul id='action'>
{% for action, subactions in actions %}
<li{% ifequal action.id action_selected.0 %} class='selected'{% endifequal %}>
@@ -29,7 +29,7 @@
</li>
{% endfor %}
</ul>
- </div>
+ </div>{% endblock %}
{% block sidebar %}{% endblock %}
{% block message_map %}{% endblock %}
{% block message_edit %}{% endblock %}
diff --git a/chimere/templates/main_map_simple.html b/chimere/templates/main_map_simple.html
new file mode 100644
index 0000000..d43436e
--- /dev/null
+++ b/chimere/templates/main_map_simple.html
@@ -0,0 +1,20 @@
+{% extends "main_map.html" %}
+{% load i18n %}
+{% block bodyhead %}<body class='simple'>{% endblock %}
+{% block actions %}{% endblock %}
+{% block message_edit %}{% endblock %}
+{% block sidebar %}
+<div id='panel'><a href='#' onclick='showHide("categories")'>
+<h2>{% trans "Topics"%}</h2></a>
+<form method='post' name='frm_categories' id='frm_categories'>
+<div id='categories' name='categories'>
+{{categories|safe}}
+</div>
+</form>
+</div>
+{% endblock %}
+{% block content %}<script type='text/javascript'><!--
+var simple = true;
+// --> </script>
+{{ block.super }}
+{% endblock %}
diff --git a/chimere/urls.py b/chimere/urls.py
index f8a47d8..db1df5f 100644
--- a/chimere/urls.py
+++ b/chimere/urls.py
@@ -46,11 +46,14 @@ urlpatterns += patterns('chimere.main.views',
)
url_areas = Area.objects.filter(urn__isnull=False)
-urlpatterns += patterns('chimere.main.views', (base + r'$', 'index'),)
+urlpatterns += patterns('chimere.main.views', (base + r'$', 'index'),
+ (base + r'simple/?$', 'index', {'simple':True}) )
for area in url_areas:
urlpatterns += patterns('chimere.main.views',
- (base + '(' + area.urn + ')/?$', 'index', {'default_area':area}),)
+ (base + '(' + area.urn + ')/?$', 'index', {'default_area':area}),
+ (base + '(' + area.urn + ')/simple/?$', 'index', {'default_area':area,
+ 'simple':True}),)
extra = "|".join([area.urn for area in url_areas])
if extra: