search node in renkan
authorcavaliet
Thu, 25 Sep 2014 12:10:37 +0200
changeset 339 8a5d0b987541
parent 338 2df551ebddef
child 340 6a7bc9190de5
search node in renkan
src/hdalab/views/profile.py
--- a/src/hdalab/views/profile.py	Wed Sep 24 17:53:59 2014 +0200
+++ b/src/hdalab/views/profile.py	Thu Sep 25 12:10:37 2014 +0200
@@ -344,6 +344,8 @@
         related_tags = []
         all_labels = [t.label for t in all_tags]
         title = "Recherche " + ", ".join(all_labels)
+        if period:
+            title += ", " + _("Period") + " " + period
         content["title"] = title
         related_tags_dict = {}
         for c in filter_output["contents"]:
@@ -383,7 +385,7 @@
         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))})
+        np.init({"tags": (1, len_tags), "datasheet": (2, len(filter_output["contents"])), "related": (3, len(related_tags)), "northwest":(1, 1)})
         
         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
@@ -406,7 +408,7 @@
         if period:
             content["nodes"].append({
               "id": unicode(uuid.uuid1()),
-              "title": _("Period") + " : " + period,
+              "title": _("Period") + " " + period,
               "description": "",
               "uri": "",
               "position": np.get_place("tags"),
@@ -462,6 +464,21 @@
                     #"created_by": "de68xf75y6hs5rgjhgghxbm217xk"
                 })
         
+        # Add search node
+        content["nodes"].append({
+          "id": unicode(uuid.uuid1()),
+          "title": title,
+          "description": "",
+          "uri": reverse("facettes") + "?" + request.META['QUERY_STRING'],
+          "position": np.get_place("northwest"),
+          "image": "",
+          "size": 0,
+          "project_id": project_id,
+          "color": None,
+          #"created_by": "roster_user-84fe909f-ba37-48e6-a25f-9d2f129a95b7",
+          "shape": "circle"
+        })
+        
         response = json.dumps(content)
         
         return HttpResponse(response, content_type="application/json")