diff -r 46cd7ba5bbec -r 2df551ebddef src/hdalab/views/profile.py --- a/src/hdalab/views/profile.py Wed Sep 24 16:03:14 2014 +0200 +++ b/src/hdalab/views/profile.py Wed Sep 24 17:53:59 2014 +0200 @@ -21,6 +21,7 @@ from django.template.response import TemplateResponse from django.templatetags.static import static from django.utils.http import is_safe_url +from django.utils.translation import ugettext as _ from django.views.decorators.cache import never_cache from django.views.decorators.csrf import csrf_exempt, csrf_protect from django.views.decorators.debug import sensitive_post_parameters @@ -325,6 +326,7 @@ # Get tags and countries labels = request.GET.get("label", "").split(",") countries = request.GET.get("country", "").split(",") + period = request.GET.get("period", None) # Tags arrive with french label, countries with dbpedia uri label_list = [t for t in labels if t!=""] country_list = [c for c in countries if c!=""] @@ -332,7 +334,7 @@ # Get datasheets from ajax filter search - filter_output = filter_generic(lang, None, ",".join(label_list), ",".join(country_list), content_count=10) + filter_output = filter_generic(lang, period, ",".join(label_list), ",".join(country_list), content_count=10) filter_output = json.loads(filter_output) #logger.debug("COUCOU") #logger.debug(json.dumps(filter_output, indent=2)) @@ -378,7 +380,10 @@ np = LineNodePlacer() if shape=="circle": np = CircleNodePlacer() - np.init({"tags": (1, len(all_tags)), "datasheet": (2, len(filter_output["contents"])), "related": (3, len(related_tags))}) + len_tags = len(all_tags) + if period: + len_tags += 1 + np.init({"tags": (1, len_tags), "datasheet": (2, len(filter_output["contents"])), "related": (3, len(related_tags))}) for t in all_tags: img_url = t.dbpedia_fields.thumbnail if hasattr(t, 'dbpedia_fields') and t.dbpedia_fields and t.dbpedia_fields.thumbnail else None @@ -398,6 +403,20 @@ #"created_by": "roster_user-84fe909f-ba37-48e6-a25f-9d2f129a95b7", "shape": shapes["tag1"] }) + if period: + content["nodes"].append({ + "id": unicode(uuid.uuid1()), + "title": _("Period") + " : " + period, + "description": "", + "uri": "", + "position": np.get_place("tags"), + "image": cat_dict[u"Datation"], + "size": 0, + "project_id": project_id, + "color": None, + #"created_by": "roster_user-84fe909f-ba37-48e6-a25f-9d2f129a95b7", + "shape": shapes["tag1"] + }) for c in filter_output["contents"]: content["nodes"].append({