Permalink
Browse files

Merge branch 'mapstory' of github.com:opengeo/geonode into mapstory

  • Loading branch information...
2 parents 153e4a1 + 278656e commit 466800fedd46b0ae27460e0f345999e5d4d08154 @mpriour mpriour committed Apr 5, 2012
View
@@ -1,3 +1,5 @@
+--extra-index-url=http://dist.pinaxproject.com/dev
+
PIL
OWSLib==0.4.0
Django==1.2
@@ -11,4 +13,6 @@ https://bitbucket.org/ubernostrum/django-registration/get/d36a38202ee3.zip
django-profiles
-e git+https://github.com/ericflo/django-avatar.git#egg=avatar
django-staticfiles
+dialogos==0.1.dev4
+agon-ratings==0.2
South==0.7.3
@@ -8,4 +8,5 @@ def resource_urls(request):
GOOGLE_API_KEY = settings.GOOGLE_API_KEY,
SITENAME = settings.SITENAME,
REGISTRATION_OPEN = settings.REGISTRATION_OPEN,
+ request = request,
)
@@ -833,7 +833,6 @@ def layer_data(req, layername):
return HttpResponse(status=204)
-@csrf_exempt
def layer_detail(request, layername):
layer = get_object_or_404(Layer, typename=layername)
if not request.user.has_perm('maps.view_layer', obj=layer):

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -750,3 +750,38 @@ cursor: pointer;
float: right;
padding-top: 3px;
}
+
+/*-----------------------
+Comments
+-----------------------*/
+.comments_container {
+ margin-left: 10px;
+}
+
+.comment_author {
+ margin:0;
+ font-size: 1.2em;
+}
+.comment_content {
+ margin-bottom: 1.5em;
+}
+
+.comment_box textarea {
+ height: 80px;
+ width: 100%;
+}
+
+.comment_post input {
+ border: 1px solid #000;
+ font-size: 1.1em;
+ margin-top: 10px;
+ padding: 5px;
+}
+
+.comment_post input:hover {
+ background-color: #F2FFE6;
+}
+
+#preview_map {
+ margin-bottom: 1em;
+}
@@ -130,6 +130,7 @@
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
+ "django.core.context_processors.request",
"geonode.maps.context_processors.resource_urls",
)
@@ -233,12 +234,17 @@
'django.contrib.sites',
'django.contrib.admin',
'django.contrib.sitemaps',
+
'staticfiles',
'django_extensions',
'registration',
'profiles',
'avatar',
+ 'dialogos',
+ 'agon_ratings',
+
'south',
+
'geonode.core',
'geonode.maps',
'geonode.proxy',
@@ -274,6 +280,16 @@ def get_user_url(u):
DB_DATASTORE_PORT = ''
DB_DATASTORE_TYPE=''
+# Agon Ratings
+AGON_RATINGS_CATEGORY_CHOICES = {
+ "maps.Map": {
+ "map": "How good is this map?"
+ },
+ "maps.Layer": {
+ "layer": "How good is this layer?"
+ },
+}
+
SOUTH_MIGRATION_MODULES = {
'registration': 'geonode.migrations.registration',
'avatar': 'geonode.migrations.avatar',
@@ -4,4 +4,14 @@
<script type="text/javascript">
Ext.BLANK_IMAGE_URL = "{{ GEONODE_CLIENT_LOCATION }}externals/ext/resources/images/default/s.gif";
+
+Ext.Ajax.on('beforerequest', function (conn, options) {
+ if (!(/^http:.*/.test(options.url) || /^https:.*/.test(options.url))) {
+ if (typeof(options.headers) == "undefined") {
+ options.headers = {'X-CSRFToken': Ext.util.Cookies.get('csrftoken')};
+ } else {
+ options.headers.extend({'X-CSRFToken': Ext.util.Cookies.get('csrftoken')});
+ }
+ }
+}, this);
</script>
@@ -1,6 +1,9 @@
{% extends "page_layout.html" %}
{% load geonode_auth %}
{% load i18n %}
+{% load dialogos_tags %}
+{% load agon_ratings_tags %}
+{% load phileo_tags %}
{% block title %} {{ layer.resource.title|default:layer.typename }} - {{ block.super }} {% endblock %}
@@ -10,7 +13,7 @@
{% include "geonode/geo_header.html" %}
<link rel="stylesheet" type="text/css" href="{{ GEONODE_CLIENT_LOCATION }}theme/ux/colorpicker/color-picker.ux.css" />
-
+{% phileo_css %}
{{ block.super }}
<script type="text/javascript">
@@ -115,15 +118,38 @@
}
{% endautoescape %}
</script>
+{% phileo_js %}
+{% endblock %}
+
+{% block start_body_js %}
+<div id="fb-root"></div>
+<script>(function(d, s, id) {
+ var js, fjs = d.getElementsByTagName(s)[0];
+ if (d.getElementById(id)) {return;}
+ js = d.createElement(s); js.id = id;
+ js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
+ fjs.parentNode.insertBefore(js, fjs);
+}(document, 'script', 'facebook-jssdk'));</script>
{% endblock %}
+
{% block main %}
<div class="twocol">
-<div id="description"> <h3> {{ layer.resource.title|default:layer.typename }} </h3> </div>
+{% overall_rating layer "layer" as layer_rating %}
+<div class="overall_rating" data-rating="{{ layer_rating }}"></div>
+
+ <div id="description">
+ <h3>{{ layer.resource.title|default:layer.typename }}</h3>
+ <g:plusone size="small" href="http://{{ request.get_host }}{{ request.get_full_path }}"></g:plusone>
+ <div class="fb-like" data-href="http://{{ request.get_host }}{{ request.get_full_path }}" data-send="false" data-width="50" data-layout="button_count" data-show-faces="false"></div>
+{% phileo_widget request.user layer %}
+ </div>
<p> <strong>{% trans "Abstract" %}:</strong> {{ layer.abstract|default:_("No abstract for this layer.") }} </p>
<div id="preview_map"></div>
+
+<h3>{% trans "Layer Information" %}</h3>
{% if layer.display_type %}<p> <strong>{% trans "Type" %}:</strong> {{ layer.display_type }} </p>{% endif %}
{% if layer.keywords %}<p> <strong>{% trans "Keywords" %}:</strong> {{ layer.keywords }}</p>{% endif %}
{% if layer.edition %}<p> <strong>{% trans "Edition" %}:</strong> {{ layer.edition }}</p>{% endif %}
@@ -183,6 +209,46 @@
{% if layer.geographic_bounding_box %}<p> <strong>{% trans "Bounding Box" %}:</strong> {{ layer.geographic_bounding_box }} </p>{% endif %}
{% if layer.resource.projection %}<p> <strong>{% trans "Native SRS" %}:</strong> {{ layer.resource.projection|default:_("No SRS specified.") }} </p>{% endif %}
+<h3>{% trans "Comments" %}</h3>
+<div class="comments_container">
+ {% comments layer as comments %}
+ {% for comment in comments %}
+ <div class="comment">
+ <p class="comment_author">{{ comment.author.get_full_name|default:comment.author|capfirst }}</p>
+ <div class="comment_content">
+ {{ comment.comment|escape|urlize|safe }} &mdash;
+ <span class="comment_ago">
+ {% blocktrans with comment.submit_date|timesince as age %}
+ {{ age }} ago
+ {% endblocktrans %}
+ </span>
+ </div>
+ </div>
+ {% endfor %}
+
+ {% if request.user.is_authenticated %}
+ <h3>{% trans "Post a comment" %}</h3>
+ {% comment_form layer as comment_form %}
+ <form method="POST" action="{% comment_target layer %}">
+ {% csrf_token %}
+ <div class="comment_box">
+ {{ comment_form.comment }}
+ </div>
+ <div class="comment_post">
+ <input type="submit" value="{% trans "Submit" %}" />
+ </div>
+ <input type="hidden" name="next" value="{{ request.path }}" />
+ </form>
+ {% else %}
+ <p><a href="{% url auth_login %}">{% trans "Login to add a comment" %}</a></p>
+ {% endif %}
+</div>
+
+{% if request.user.is_authenticated %}
+ <h3>{% trans "Rate this layer" %}</h3>
+ {% user_rating request.user layer "layer" as user_layer_rating %}
+ <div id="user_rating" class="category-layer"></div>
+{% endif %}
</div>
{% endblock %}
@@ -264,7 +330,7 @@
<h3> {% trans "Manage" %} </h3>
<ul>
- {% if user.is_authenticated %}
+ {% if user.is_authenticated %}
{% if can_change %}
<li><a href="?describe">{% trans "Update the description of this data" %}</a></li>
<li><a href="?update">{% trans "Upload a new version of this data" %}</a></li>
@@ -279,10 +345,10 @@
<li><a href="{% url layer_remove layer.typename %}">
{% trans "Remove" %}
</a></li>
- {% endif %}
- {% else %}
+ {% endif %}
+ {% else %}
<li>{% trans "Please authenticate to update or remove layers" %}</li>
- {% endif %}
+ {% endif %}
</ul>
{% endif %}
{% has_obj_perm user layer "maps.change_layer_permissions" as can_change_permissions %}
@@ -293,3 +359,27 @@
{% endif %}
</div>
{% endblock %}
+
+{% block end_body_js %}
+{% if user.is_authenticated %}
+ {% user_rating_js user layer "layer" %}
+{% else %}
+ <script src="{{ STATIC_URL }}agon_ratings/js/jquery.raty.js"></script>
+{% endif %}
+<script>
+ $(function() {
+ $('div.overall_rating').raty({
+ half: true,
+ readOnly: true,
+ start: $('div.overall_rating').data('rating'),
+ path: "{{ STATIC_URL }}agon_ratings/img/"
+ });
+ });
+
+ (function() {
+ var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
+ po.src = 'https://apis.google.com/js/plusone.js';
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
+ })();
+</script>
+{% endblock %}
@@ -1,6 +1,8 @@
{% extends "page_layout.html" %}
{% load i18n %}
{% load geonode_auth %}
+{% load dialogos_tags %}
+{% load agon_ratings_tags %}
{% block extra_head %}
{% include "geonode/ext_header.html" %}
@@ -51,14 +53,78 @@
</script>
{% endblock %}
+{% block start_body_js %}
+<div id="fb-root"></div>
+<script>(function(d, s, id) {
+ var js, fjs = d.getElementsByTagName(s)[0];
+ if (d.getElementById(id)) {return;}
+ js = d.createElement(s); js.id = id;
+ js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
+ fjs.parentNode.insertBefore(js, fjs);
+}(document, 'script', 'facebook-jssdk'));</script>
+{% endblock %}
+
{% block main %}
<div class="twocol">
+ {% overall_rating map "map" as map_rating %}
+ <h3>{{map.title}}</h3>
+ <div class="overall_rating" data-rating="{{ map_rating }}"></div>
+
+
+
<h3>{{map.title}}</h3>
+ <g:plusone size="small" href="http://{{ request.get_host }}{{ request.get_full_path }}"></g:plusone>
+ <div class="fb-like" data-href="http://{{ request.get_host }}{{ request.get_full_path }}" data-send="false" data-width="50" data-layout="button_count" data-show-faces="false"></div>
<p><strong>{% trans "Abstract:" %}</strong> {{map.abstract}}</p>
<div id="embedded_map">
</div>
<p><strong>{% trans "Contact:" %}</strong> <a href="{{ map.owner.get_profile.get_absolute_url }}">{{ map.owner }}</a></a></p>
+
+ <h3>{% trans "Comments" %}</h1>
+ <div class="comments_container">
+ {% comments map as comments %}
+ {% for comment in comments %}
+ <div class="comment">
+ <p class="comment_author">{{ comment.author.get_full_name|default:comment.author|capfirst }}</p>
+ <div class="comment_content">
+ {{ comment.comment|escape|urlize|safe }} &mdash;
+ <span class="comment_ago">
+ {% blocktrans with comment.submit_date|timesince as age %}
+ {{ age }} ago
+ {% endblocktrans %}
+ </span>
+ </div>
+ </div>
+ {% endfor %}
+
+ {% if request.user.is_authenticated %}
+ <h3>{% trans "Post a comment" %}</h3>
+ {% comment_form map as comment_form %}
+ <form method="POST" action="{% comment_target map %}">
+ {% csrf_token %}
+ <div class="comment_box">
+ {{ comment_form.comment }}
+ </div>
+ <div class="comment_post">
+ <input type="submit" value="{% trans "Submit" %}" />
+ </div>
+ <input type="hidden" name="next" value="{{ request.path }}" />
+ </form>
+ {% else %}
+ <p><a href="{% url auth_login %}">{% trans "Login to add a comment" %}</a></p>
+ {% endif %}
+ </div>
+ {% if request.user.is_authenticated %}
+ <h3>{% trans "Rate this map" %}</h3>
+ {% user_rating request.user map "map" as user_map_rating %}
+ <div id="user_rating" class="category-map"></div>
+ {% endif %}
+
+
+=======
+ <h3>Social</h3>
+>>>>>>> 8211953377229cb55e9536d85ff7fe01e825ef4f
</div>
{% endblock %}
{% block sidebar %}
@@ -100,3 +166,28 @@
{% endif %}
</div>
{% endblock %}
+
+{% block end_body_js %}
+{% if request.user.is_authenticated %}
+ {% user_rating_js request.user map "map" %}
+{% else %}
+ <script src="{{ STATIC_URL }}agon_ratings/js/jquery.raty.js"></script>
+{% endif %}
+<script>
+ $(function() {
+ $('div.overall_rating').raty({
+ half: true,
+ readOnly: true,
+ start: $('div.overall_rating').data('rating'),
+ path: "{{ STATIC_URL }}agon_ratings/img/"
+ });
+ });
+<script type="text/javascript">
+ (function() {
+ var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
+ po.src = 'https://apis.google.com/js/plusone.js';
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
+ })();
+>>>>>>> 8211953377229cb55e9536d85ff7fe01e825ef4f
+</script>
+{% endblock %}
Oops, something went wrong.

0 comments on commit 466800f

Please sign in to comment.