Commit aa2260ff72437bfd4aa7723b6832abaec44a7479

Annotation tree changed

  Modular annotation tree code now, fetched using ajax calls.
Changes in the way annotation was handled internally and sweeting it.
fetch.py
(15 / 2)
  
5656 except:
5757 response = make_response()
5858 response.status = "500"
59 respose.data = "Your post could not be saved. Try posting again."
59 response.data = "Your post could not be saved. Try posting again."
6060 return response
6161
6262
7373 pass
7474 root = lxml.html.parse(StringIO.StringIO(page)).getroot()
7575 root.make_links_absolute(request.args['url'], resolve_base_href = True)
76
77 # inject the JS toolbar to annotate text
78 script = root.makeelement('script')
79 script.set('src', 'static/text-annotation.js')
80 link = root.makeelement('link')
81 link.set('href', 'static/text-annotation.css')
82 link.set('type', 'text/css')
83 link.set('rel', 'stylesheet')
84
85 root.body.append(script)
86 root.head.append(link)
87
7688 return lxml.html.tostring(root)
89
7790#Log the errors, don't depend on apache to log it for you.
78 fil = FileHandler(os.path.join(os.path.dirname(__file__), 'logme'), mode='a')
91 fil = FileHandler(os.path.join(os.path.dirname(__file__), 'logme'),mode='a')
7992 fil.setLevel(logging.ERROR)
8093 app.logger.addHandler(fil)
8194
  
1[{
2"adjacencies" :[{"nodeTo" :"Mantapa",
3"nodeFrom":"TempleElement",
4"data":{"$color":"#000"}}] ,
5"data":{"$color":"#fff","$type":"ellipse",
6"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"TempleElement","name":"TempleElement"
7},{
8"adjacencies" :[{"nodeTo" :"KalyanaMantapa",
9"nodeFrom":"Mantapa",
10"data":{"$color":"#000"}}] ,
11"data":{"$color":"#fff","$type":"ellipse",
12"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Mantapa","name":"Mantapa"
13},{
14"adjacencies" :[{"nodeTo" :"GarbhaGriha",
15"nodeFrom":"TempleElement",
16"data":{"$color":"#000"}}] ,
17"data":{"$color":"#fff","$type":"ellipse",
18"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"TempleElement","name":"TempleElement"
19},{
20"adjacencies" :[{"nodeTo" :"Date",
21"nodeFrom":"TimeAppellation",
22"data":{"$color":"#000"}}] ,
23"data":{"$color":"#fff","$type":"ellipse",
24"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"TimeAppellation","name":"TimeAppellation"
25},{
26"adjacencies" :[{"nodeTo" :"City",
27"nodeFrom":"Place",
28"data":{"$color":"#000"}}] ,
29"data":{"$color":"#fff","$type":"ellipse",
30"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Place","name":"Place"
31},{
32"adjacencies" :[{"nodeTo" :"Village",
33"nodeFrom":"Place",
34"data":{"$color":"#000"}}] ,
35"data":{"$color":"#fff","$type":"ellipse",
36"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Place","name":"Place"
37},{
38"adjacencies" :[{"nodeTo" :"District",
39"nodeFrom":"Place",
40"data":{"$color":"#000"}}] ,
41"data":{"$color":"#fff","$type":"ellipse",
42"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Place","name":"Place"
43},{
44"adjacencies" :[{"nodeTo" :"State",
45"nodeFrom":"Place",
46"data":{"$color":"#000"}}] ,
47"data":{"$color":"#fff","$type":"ellipse",
48"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Place","name":"Place"
49},{
50"adjacencies" :[{"nodeTo" :"Country",
51"nodeFrom":"Place",
52"data":{"$color":"#000"}}] ,
53"data":{"$color":"#fff","$type":"ellipse",
54"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Place","name":"Place"
55},{
56"adjacencies" :[{"nodeTo" :"Empire",
57"nodeFrom":"Event",
58"data":{"$color":"#000"}}] ,
59"data":{"$color":"#fff","$type":"ellipse",
60"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Event","name":"Event"
61},{
62"adjacencies" :[{"nodeTo" :"King",
63"nodeFrom":"Person",
64"data":{"$color":"#000"}}] ,
65"data":{"$color":"#fff","$type":"ellipse",
66"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Person","name":"Person"
67},{
68"adjacencies" :[{"nodeTo" :"MuralTradition",
69"nodeFrom":"Tradition",
70"data":{"$color":"#000"}}] ,
71"data":{"$color":"#999","$type":"rectangle",
72"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Tradition","name":"Tradition"
73},{
74"adjacencies" :[{"nodeTo" :"Human",
75"nodeFrom":"Character",
76"data":{"$color":"#000"}}] ,
77"data":{"$color":"#999","$type":"rectangle",
78"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Character","name":"Character"
79},{
80"adjacencies" :[{"nodeTo" :"Animal",
81"nodeFrom":"Character",
82"data":{"$color":"#000"}}] ,
83"data":{"$color":"#999","$type":"rectangle",
84"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Character","name":"Character"
85},{
86"adjacencies" :[{"nodeTo" :"Male",
87"nodeFrom":"Human",
88"data":{"$color":"#000"}}] ,
89"data":{"$color":"#999","$type":"rectangle",
90"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Human","name":"Human"
91},{
92"adjacencies" :[{"nodeTo" :"Female",
93"nodeFrom":"Human",
94"data":{"$color":"#000"}}] ,
95"data":{"$color":"#999","$type":"rectangle",
96"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Human","name":"Human"
97},{
98"adjacencies" :[{"nodeTo" :"Ritual",
99"nodeFrom":"Tradition",
100"data":{"$color":"#000"}}] ,
101"data":{"$color":"#999","$type":"rectangle",
102"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Tradition","name":"Tradition"
103},{
104"adjacencies" :[{"nodeTo" :"CulturalContent",
105"nodeFrom":"MuralContent",
106"data":{"$color":"#000"}}] ,
107"data":{"$color":"#999","$type":"rectangle",
108"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"MuralContent","name":"MuralContent"
109},{
110"adjacencies" :[{"nodeTo" :"Fashion",
111"nodeFrom":"CulturalContent",
112"data":{"$color":"#000"}}] ,
113"data":{"$color":"#999","$type":"rectangle",
114"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"CulturalContent","name":"CulturalContent"
115},{
116"adjacencies" :[{"nodeTo" :"Tattoo",
117"nodeFrom":"Fashion",
118"data":{"$color":"#000"}}] ,
119"data":{"$color":"#999","$type":"rectangle",
120"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Fashion","name":"Fashion"
121},{
122"adjacencies" :[{"nodeTo" :"Jewellery",
123"nodeFrom":"Fashion",
124"data":{"$color":"#000"}}] ,
125"data":{"$color":"#999","$type":"rectangle",
126"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Fashion","name":"Fashion"
127},{
128"adjacencies" :[{"nodeTo" :"HairStyle",
129"nodeFrom":"Fashion",
130"data":{"$color":"#000"}}] ,
131"data":{"$color":"#999","$type":"rectangle",
132"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Fashion","name":"Fashion"
133},{
134"adjacencies" :[{"nodeTo" :"VijayaNagara",
135"nodeFrom":"City",
136"data":{"$color":"#f00"}}] ,
137"data":{"$color":"#fff","$type":"ellipse",
138"$label-color":"#fff","$label-size":"20","$nodecDir":""},"id":"City","name":"City"
139},{
140"adjacencies" :[{"nodeTo" :"India",
141"nodeFrom":"Country",
142"data":{"$color":"#f00"}}] ,
143"data":{"$color":"#fff","$type":"ellipse",
144"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Country","name":"Country"
145},{
146"adjacencies" :[{"nodeTo" :"Bellary",
147"nodeFrom":"District",
148"data":{"$color":"#f00"}}] ,
149"data":{"$color":"#fff","$type":"ellipse",
150"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"District","name":"District"
151},{
152"adjacencies" :[{"nodeTo" :"VijayanagaraEmpire",
153"nodeFrom":"Empire",
154"data":{"$color":"#f00"}}] ,
155"data":{"$color":"#fff","$type":"ellipse",
156"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Empire","name":"Empire"
157},{
158"adjacencies" :[{"nodeTo" :"VirupanaNayak",
159"nodeFrom":"King",
160"data":{"$color":"#f00"}}] ,
161"data":{"$color":"#fff","$type":"ellipse",
162"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"King","name":"King"
163},{
164"adjacencies" :[{"nodeTo" :"GirijaKalyanaMural",
165"nodeFrom":"MuralPainting",
166"data":{"$color":"#f00"}}] ,
167"data":{"$color":"#fff","$type":"ellipse",
168"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"MuralPainting","name":"MuralPainting"
169},{
170"adjacencies" :[{"nodeTo" :"ShivaPurana",
171"nodeFrom":"Scripture",
172"data":{"$color":"#f00"}}] ,
173"data":{"$color":"#fff","$type":"ellipse",
174"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Scripture","name":"Scripture"
175},{
176"adjacencies" :[{"nodeTo" :"Karnataka",
177"nodeFrom":"State",
178"data":{"$color":"#f00"}}] ,
179"data":{"$color":"#fff","$type":"ellipse",
180"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"State","name":"State"
181},{
182"adjacencies" :[{"nodeTo" :"GirijaKalyanaStory",
183"nodeFrom":"Story",
184"data":{"$color":"#f00"}}] ,
185"data":{"$color":"#fff","$type":"ellipse",
186"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Story","name":"Story"
187},{
188"adjacencies" :[{"nodeTo" :"VirupakshaTemple",
189"nodeFrom":"Temple",
190"data":{"$color":"#f00"}}] ,
191"data":{"$color":"#fff","$type":"ellipse",
192"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Temple","name":"Temple"
193},{
194"adjacencies" :[{"nodeTo" :"AD_1500",
195"nodeFrom":"TimeAppellation",
196"data":{"$color":"#f00"}}] ,
197"data":{"$color":"#fff","$type":"ellipse",
198"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"TimeAppellation","name":"TimeAppellation"
199},{
200"adjacencies" :[{"nodeTo" :"AD_1336",
201"nodeFrom":"TimeAppellation",
202"data":{"$color":"#f00"}}] ,
203"data":{"$color":"#fff","$type":"ellipse",
204"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"TimeAppellation","name":"TimeAppellation"
205},{
206"adjacencies" :[{"nodeTo" :"AD_1646",
207"nodeFrom":"TimeAppellation",
208"data":{"$color":"#f00"}}] ,
209"data":{"$color":"#fff","$type":"ellipse",
210"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"TimeAppellation","name":"TimeAppellation"
211},{
212"adjacencies" :[{"nodeTo" :"AD_1336_to_AD_1646",
213"nodeFrom":"TimeSpan",
214"data":{"$color":"#f00"}}] ,
215"data":{"$color":"#fff","$type":"ellipse",
216"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"TimeSpan","name":"TimeSpan"
217},{
218"adjacencies" :[{"nodeTo" :"Hampi",
219"nodeFrom":"Village",
220"data":{"$color":"#f00"}}] ,
221"data":{"$color":"#fff","$type":"ellipse",
222"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Village","name":"Village"
223},{
224"adjacencies" :[{"nodeTo" :"VijaynagaraTradition",
225"nodeFrom":"MuralTradition",
226"data":{"$color":"#f00"}}] ,
227"data":{"$color":"#999","$type":"rectangle",
228"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"MuralTradition","name":"MuralTradition"
229},{
230"adjacencies" :[{"nodeTo" :"Nandi",
231"nodeFrom":"Animal",
232"data":{"$color":"#f00"}}] ,
233"data":{"$color":"#999","$type":"rectangle",
234"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Animal","name":"Animal"
235},{
236"adjacencies" :[{"nodeTo" :"Snake",
237"nodeFrom":"Animal",
238"data":{"$color":"#f00"}}] ,
239"data":{"$color":"#999","$type":"rectangle",
240"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Animal","name":"Animal"
241},{
242"adjacencies" :[{"nodeTo" :"Pampapathi",
243"nodeFrom":"Male",
244"data":{"$color":"#f00"}}] ,
245"data":{"$color":"#999","$type":"rectangle",
246"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Male","name":"Male"
247},{
248"adjacencies" :[{"nodeTo" :"Daksha",
249"nodeFrom":"Male",
250"data":{"$color":"#f00"}}] ,
251"data":{"$color":"#999","$type":"rectangle",
252"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Male","name":"Male"
253},{
254"adjacencies" :[{"nodeTo" :"Hampamma",
255"nodeFrom":"Female",
256"data":{"$color":"#f00"}}] ,
257"data":{"$color":"#999","$type":"rectangle",
258"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Female","name":"Female"
259},{
260"adjacencies" :[{"nodeTo" :"KalyanUtsav",
261"nodeFrom":"Ritual",
262"data":{"$color":"#f00"}}] ,
263"data":{"$color":"#999","$type":"rectangle",
264"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Ritual","name":"Ritual"
265},{
266"adjacencies" :[{"nodeTo" :"PalaPuja",
267"nodeFrom":"Ritual",
268"data":{"$color":"#f00"}}] ,
269"data":{"$color":"#999","$type":"rectangle",
270"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Ritual","name":"Ritual"
271},{
272"adjacencies" :[{"nodeTo" :"GirijaKalyanaTattoo",
273"nodeFrom":"Tattoo",
274"data":{"$color":"#f00"}}] ,
275"data":{"$color":"#999","$type":"rectangle",
276"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Tattoo","name":"Tattoo"
277},{
278"adjacencies" :[{"nodeTo" :"Anklet",
279"nodeFrom":"Jewellery",
280"data":{"$color":"#f00"}}] ,
281"data":{"$color":"#999","$type":"rectangle",
282"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Jewellery","name":"Jewellery"
283},{
284"adjacencies" :[{"nodeTo" :"Face",
285"nodeFrom":"Person",
286"data":{"$color":"#00f"}}] ,
287"data":{"$color":"#fff","$type":"ellipse",
288"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Person","name":"Person"
289},{
290"adjacencies" :[{"nodeTo" :"GirijaKalyanaEg",
291"nodeFrom":"GirijaKalyanaMural",
292"data":{"$color":"#00f"}}] ,
293"data":{"$color":"#fff","$type":"ellipse",
294"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"GirijaKalyanaMural","name":"GirijaKalyanaMural"
295},{
296"adjacencies" :[{"nodeTo" :"Anklet",
297"nodeFrom":"GirijaKalyanaMural",
298"data":{"$color":"#00f"}}] ,
299"data":{"$color":"#fff","$type":"ellipse",
300"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"GirijaKalyanaMural","name":"GirijaKalyanaMural"
301},{
302"adjacencies" :[{"nodeTo" :"Pampapathi",
303"nodeFrom":"GirijaKalyanaMural",
304"data":{"$color":"#00f"}}] ,
305"data":{"$color":"#fff","$type":"ellipse",
306"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"GirijaKalyanaMural","name":"GirijaKalyanaMural"
307},{
308"adjacencies" :[{"nodeTo" :"Hampamma",
309"nodeFrom":"GirijaKalyanaMural",
310"data":{"$color":"#00f"}}] ,
311"data":{"$color":"#fff","$type":"ellipse",
312"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"GirijaKalyanaMural","name":"GirijaKalyanaMural"
313},{
314"adjacencies" :[{"nodeTo" :"Daksha",
315"nodeFrom":"GirijaKalyanaMural",
316"data":{"$color":"#00f"}}] ,
317"data":{"$color":"#fff","$type":"ellipse",
318"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"GirijaKalyanaMural","name":"GirijaKalyanaMural"
319},{
320"adjacencies" :[{"nodeTo" :"NandiEg",
321"nodeFrom":"Nandi",
322"data":{"$color":"#00f"}}] ,
323"data":{"$color":"#999","$type":"rectangle",
324"$label-color":"#fff","$label-size":"20","$nodecDir":""},"id":"Nandi","name":"Nandi"
325},{
326"adjacencies" :[{"nodeTo" :"PampapathiEg1",
327"nodeFrom":"Pampapathi",
328"data":{"$color":"#00f"}}] ,
329"data":{"$color":"#999","$type":"rectangle",
330"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Pampapathi","name":"Pampapathi"
331},{
332"adjacencies" :[{"nodeTo" :"PampapathiEg2",
333"nodeFrom":"Pampapathi",
334"data":{"$color":"#00f"}}] ,
335"data":{"$color":"#999","$type":"rectangle",
336"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Pampapathi","name":"Pampapathi"
337},{
338"adjacencies" :[{"nodeTo" :"GKTattooExample",
339"nodeFrom":"GirijaKalyanaTattoo",
340"data":{"$color":"#00f"}}] ,
341"data":{"$color":"#999","$type":"rectangle",
342"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"GirijaKalyanaTattoo","name":"GirijaKalyanaTattoo"
343},{
344"adjacencies" :[{"nodeTo" :"Story",
345"nodeFrom":"MuralPainting",
346"data":{"$color":"#00f"}}] ,
347"data":{"$color":"#fff","$type":"ellipse",
348"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"MuralPainting","name":"MuralPainting"
349},{
350"adjacencies" :[{"nodeTo" :"MuralContent",
351"nodeFrom":"MuralPainting",
352"data":{"$color":"#00f"}}] ,
353"data":{"$color":"#fff","$type":"ellipse",
354"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"MuralPainting","name":"MuralPainting"
355},{
356"adjacencies" :[{"nodeTo" :"MuralTradition",
357"nodeFrom":"MuralPainting",
358"data":{"$color":"#00f"}}] ,
359"data":{"$color":"#fff","$type":"ellipse",
360"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"MuralPainting","name":"MuralPainting"
361},{
362"adjacencies" :[{"nodeTo" :"TimePeriod",
363"nodeFrom":"MuralPainting",
364"data":{"$color":"#00f"}}] ,
365"data":{"$color":"#fff","$type":"ellipse",
366"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"MuralPainting","name":"MuralPainting"
367},{
368"adjacencies" :[{"nodeTo" :"Mantapa",
369"nodeFrom":"MuralPainting",
370"data":{"$color":"#00f"}}] ,
371"data":{"$color":"#fff","$type":"ellipse",
372"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"MuralPainting","name":"MuralPainting"
373},{
374"adjacencies" :[{"nodeTo" :"MuralPainting",
375"nodeFrom":"Story",
376"data":{"$color":"#00f"}}] ,
377"data":{"$color":"#fff","$type":"ellipse",
378"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Story","name":"Story"
379},{
380"adjacencies" :[{"nodeTo" :"Narrative",
381"nodeFrom":"Story",
382"data":{"$color":"#00f"}}] ,
383"data":{"$color":"#fff","$type":"ellipse",
384"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Story","name":"Story"
385},{
386"adjacencies" :[{"nodeTo" :"Scripture",
387"nodeFrom":"Story",
388"data":{"$color":"#00f"}}] ,
389"data":{"$color":"#fff","$type":"ellipse",
390"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Story","name":"Story"
391},{
392"adjacencies" :[{"nodeTo" :"Story",
393"nodeFrom":"Scripture",
394"data":{"$color":"#00f"}}] ,
395"data":{"$color":"#fff","$type":"ellipse",
396"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Scripture","name":"Scripture"
397},{
398"adjacencies" :[{"nodeTo" :"Character",
399"nodeFrom":"Story",
400"data":{"$color":"#00f"}}] ,
401"data":{"$color":"#fff","$type":"ellipse",
402"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Story","name":"Story"
403},{
404"adjacencies" :[{"nodeTo" :"Ritual",
405"nodeFrom":"Story",
406"data":{"$color":"#00f"}}] ,
407"data":{"$color":"#fff","$type":"ellipse",
408"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Story","name":"Story"
409},{
410"adjacencies" :[{"nodeTo" :"Story",
411"nodeFrom":"Character",
412"data":{"$color":"#00f"}}] ,
413"data":{"$color":"#999","$type":"rectangle",
414"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Character","name":"Character"
415},{
416"adjacencies" :[{"nodeTo" :"Animal",
417"nodeFrom":"Human",
418"data":{"$color":"#00f"}}] ,
419"data":{"$color":"#999","$type":"rectangle",
420"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Human","name":"Human"
421},{
422"adjacencies" :[{"nodeTo" :"TimeAppellation",
423"nodeFrom":"Temple",
424"data":{"$color":"#00f"}}] ,
425"data":{"$color":"#fff","$type":"ellipse",
426"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Temple","name":"Temple"
427},{
428"adjacencies" :[{"nodeTo" :"TempleElement",
429"nodeFrom":"Temple",
430"data":{"$color":"#00f"}}] ,
431"data":{"$color":"#fff","$type":"ellipse",
432"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Temple","name":"Temple"
433},{
434"adjacencies" :[{"nodeTo" :"Temple",
435"nodeFrom":"TempleElement",
436"data":{"$color":"#00f"}}] ,
437"data":{"$color":"#fff","$type":"ellipse",
438"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"TempleElement","name":"TempleElement"
439},{
440"adjacencies" :[{"nodeTo" :"TimeAppellation",
441"nodeFrom":"TimePeriod",
442"data":{"$color":"#00f"}}] ,
443"data":{"$color":"#fff","$type":"ellipse",
444"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"TimePeriod","name":"TimePeriod"
445},{
446"adjacencies" :[{"nodeTo" :"Empire",
447"nodeFrom":"MuralTradition",
448"data":{"$color":"#00f"}}] ,
449"data":{"$color":"#999","$type":"rectangle",
450"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"MuralTradition","name":"MuralTradition"
451},{
452"adjacencies" :[{"nodeTo" :"VirupakshaTemple",
453"nodeFrom":"KalyanaMantapa",
454"data":{"$color":"#00f"}}] ,
455"data":{"$color":"#fff","$type":"ellipse",
456"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"KalyanaMantapa","name":"KalyanaMantapa"
457},{
458"adjacencies" :[{"nodeTo" :"Narrator",
459"nodeFrom":"Narrative",
460"data":{"$color":"#000"}}] ,
461"data":{"$color":"#fff","$type":"ellipse",
462"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Narrative","name":"Narrative"
463},{
464"adjacencies" :[{"nodeTo" :"Human",
465"nodeFrom":"Human",
466"data":{"$color":"#000"}}] ,
467"data":{"$color":"#999","$type":"rectangle",
468"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Human","name":"Human"
469},{
470"adjacencies" :[{"nodeTo" :"Event",
471"nodeFrom":"Place",
472"data":{"$color":"#000"}}] ,
473"data":{"$color":"#fff","$type":"ellipse",
474"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Place","name":"Place"
475},{
476"adjacencies" :[{"nodeTo" :"Place",
477"nodeFrom":"Place",
478"data":{"$color":"#000"}}] ,
479"data":{"$color":"#fff","$type":"ellipse",
480"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Place","name":"Place"
481},{
482"adjacencies" :[{"nodeTo" :"Place",
483"nodeFrom":"Temple",
484"data":{"$color":"#000"}}] ,
485"data":{"$color":"#fff","$type":"ellipse",
486"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Temple","name":"Temple"
487},{
488"adjacencies" :[{"nodeTo" :"Place",
489"nodeFrom":"Event",
490"data":{"$color":"#000"}}] ,
491"data":{"$color":"#fff","$type":"ellipse",
492"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Event","name":"Event"
493},{
494"adjacencies" :[{"nodeTo" :"LatLons",
495"nodeFrom":"Place",
496"data":{"$color":"#000"}}] ,
497"data":{"$color":"#fff","$type":"ellipse",
498"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Place","name":"Place"
499},{
500"adjacencies" :[{"nodeTo" :"Empire",
501"nodeFrom":"Place",
502"data":{"$color":"#000"}}] ,
503"data":{"$color":"#fff","$type":"ellipse",
504"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Place","name":"Place"
505},{
506"adjacencies" :[{"nodeTo" :"TimeAppellation",
507"nodeFrom":"TimeSpan",
508"data":{"$color":"#000"}}] ,
509"data":{"$color":"#fff","$type":"ellipse",
510"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"TimeSpan","name":"TimeSpan"
511},{
512"adjacencies" :[{"nodeTo" :"Person",
513"nodeFrom":"Temple",
514"data":{"$color":"#000"}}] ,
515"data":{"$color":"#fff","$type":"ellipse",
516"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Temple","name":"Temple"
517},{
518"adjacencies" :[{"nodeTo" :"Bellary",
519"nodeFrom":"VijayaNagara",
520"data":{"$color":"#000"}}] ,
521"data":{"$color":"#fff","$type":"ellipse",
522"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"VijayaNagara","name":"VijayaNagara"
523},{
524"adjacencies" :[{"nodeTo" :"VijayanagaraEmpire",
525"nodeFrom":"VijayaNagara",
526"data":{"$color":"#000"}}] ,
527"data":{"$color":"#fff","$type":"ellipse",
528"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"VijayaNagara","name":"VijayaNagara"
529},{
530"adjacencies" :[{"nodeTo" :"Karnataka",
531"nodeFrom":"Bellary",
532"data":{"$color":"#000"}}] ,
533"data":{"$color":"#fff","$type":"ellipse",
534"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Bellary","name":"Bellary"
535},{
536"adjacencies" :[{"nodeTo" :"GirijaKalyanaStory",
537"nodeFrom":"GirijaKalyanaMural",
538"data":{"$color":"#00f"}}] ,
539"data":{"$color":"#000","$type":"ellipse",
540"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"GirijaKalyanaMural","name":"GirijaKalyanaMural"
541},{
542"adjacencies" :[{"nodeTo" :"KalyanaMantapa",
543"nodeFrom":"GirijaKalyanaMural",
544"data":{"$color":"#00f"}}] ,
545"data":{"$color":"#fff","$type":"ellipse",
546"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"GirijaKalyanaMural","name":"GirijaKalyanaMural"
547},{
548"adjacencies" :[{"nodeTo" :"VijaynagaraTradition",
549"nodeFrom":"GirijaKalyanaMural",
550"data":{"$color":"#00f"}}] ,
551"data":{"$color":"#fff","$type":"ellipse",
552"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"GirijaKalyanaMural","name":"GirijaKalyanaMural"
553},{
554"adjacencies" :[{"nodeTo" :"GirijaKalyanaStory",
555"nodeFrom":"ShivaPurana",
556"data":{"$color":"#00f"}}] ,
557"data":{"$color":"#fff","$type":"ellipse",
558"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"ShivaPurana","name":"ShivaPurana"
559},{
560"adjacencies" :[{"nodeTo" :"India",
561"nodeFrom":"Karnataka",
562"data":{"$color":"#000"}}] ,
563"data":{"$color":"#fff","$type":"ellipse",
564"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Karnataka","name":"Karnataka"
565},{
566"adjacencies" :[{"nodeTo" :"ShivaPurana",
567"nodeFrom":"GirijaKalyanaStory",
568"data":{"$color":"#00f"}}] ,
569"data":{"$color":"#fff","$type":"ellipse",
570"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"GirijaKalyanaStory","name":"GirijaKalyanaStory"
571},{
572"adjacencies" :[{"nodeTo" :"Pampapathi",
573"nodeFrom":"GirijaKalyanaStory",
574"data":{"$color":"#00f"}}] ,
575"data":{"$color":"#fff","$type":"ellipse",
576"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"GirijaKalyanaStory","name":"GirijaKalyanaStory"
577},{
578"adjacencies" :[{"nodeTo" :"Hampamma",
579"nodeFrom":"GirijaKalyanaStory",
580"data":{"$color":"#00f"}}] ,
581"data":{"$color":"#fff","$type":"ellipse",
582"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"GirijaKalyanaStory","name":"GirijaKalyanaStory"
583},{
584"adjacencies" :[{"nodeTo" :"Daksha",
585"nodeFrom":"GirijaKalyanaStory",
586"data":{"$color":"#00f"}}] ,
587"data":{"$color":"#fff","$type":"ellipse",
588"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"GirijaKalyanaStory","name":"GirijaKalyanaStory"
589},{
590"adjacencies" :[{"nodeTo" :"GirijaKalyanaMural",
591"nodeFrom":"GirijaKalyanaStory",
592"data":{"$color":"#00f"}}] ,
593"data":{"$color":"#fff","$type":"ellipse",
594"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"GirijaKalyanaStory","name":"GirijaKalyanaStory"
595},{
596"adjacencies" :[{"nodeTo" :"PalaPuja",
597"nodeFrom":"GirijaKalyanaStory",
598"data":{"$color":"#00f"}}] ,
599"data":{"$color":"#fff","$type":"ellipse",
600"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"GirijaKalyanaStory","name":"GirijaKalyanaStory"
601},{
602"adjacencies" :[{"nodeTo" :"KalyanUtsav",
603"nodeFrom":"GirijaKalyanaStory",
604"data":{"$color":"#00f"}}] ,
605"data":{"$color":"#fff","$type":"ellipse",
606"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"GirijaKalyanaStory","name":"GirijaKalyanaStory"
607},{
608"adjacencies" :[{"nodeTo" :"AD_1500",
609"nodeFrom":"VirupakshaTemple",
610"data":{"$color":"#00f"}}] ,
611"data":{"$color":"#fff","$type":"ellipse",
612"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"VirupakshaTemple","name":"VirupakshaTemple"
613},{
614"adjacencies" :[{"nodeTo" :"VirupanaNayak",
615"nodeFrom":"VirupakshaTemple",
616"data":{"$color":"#000"}}] ,
617"data":{"$color":"#fff","$type":"ellipse",
618"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"VirupakshaTemple","name":"VirupakshaTemple"
619},{
620"adjacencies" :[{"nodeTo" :"Hampi",
621"nodeFrom":"VirupakshaTemple",
622"data":{"$color":"#000"}}] ,
623"data":{"$color":"#fff","$type":"ellipse",
624"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"VirupakshaTemple","name":"VirupakshaTemple"
625},{
626"adjacencies" :[{"nodeTo" :"KalyanaMantapa",
627"nodeFrom":"VirupakshaTemple",
628"data":{"$color":"#00f"}}] ,
629"data":{"$color":"#fff","$type":"ellipse",
630"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"VirupakshaTemple","name":"VirupakshaTemple"
631},{
632"adjacencies" :[{"nodeTo" :"GarbhaGriha",
633"nodeFrom":"VirupakshaTemple",
634"data":{"$color":"#00f"}}] ,
635"data":{"$color":"#fff","$type":"ellipse",
636"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"VirupakshaTemple","name":"VirupakshaTemple"
637},{
638"adjacencies" :[{"nodeTo" :"AD_1336",
639"nodeFrom":"AD_1336_to_AD_1646",
640"data":{"$color":"#000"}}] ,
641"data":{"$color":"#fff","$type":"ellipse",
642"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"AD_1336_to_AD_1646","name":"AD_1336_to_AD_1646"
643},{
644"adjacencies" :[{"nodeTo" :"AD_1646",
645"nodeFrom":"AD_1336_to_AD_1646",
646"data":{"$color":"#000"}}] ,
647"data":{"$color":"#fff","$type":"ellipse",
648"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"AD_1336_to_AD_1646","name":"AD_1336_to_AD_1646"
649},{
650"adjacencies" :[{"nodeTo" :"VijayaNagara",
651"nodeFrom":"Hampi",
652"data":{"$color":"#000"}}] ,
653"data":{"$color":"#fff","$type":"ellipse",
654"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Hampi","name":"Hampi"
655},{
656"adjacencies" :[{"nodeTo" :"VijayanagaraEmpire",
657"nodeFrom":"VijaynagaraTradition",
658"data":{"$color":"#00f"}}] ,
659"data":{"$color":"#999","$type":"rectangle",
660"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"VijaynagaraTradition","name":"VijaynagaraTradition"
661},{
662"adjacencies" :[{"nodeTo" :"Snake",
663"nodeFrom":"Pampapathi",
664"data":{"$color":"#00f"}}] ,
665"data":{"$color":"#999","$type":"rectangle",
666"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Pampapathi","name":"Pampapathi"
667},{
668"adjacencies" :[{"nodeTo" :"Nandi",
669"nodeFrom":"Pampapathi",
670"data":{"$color":"#00f"}}] ,
671"data":{"$color":"#999","$type":"rectangle",
672"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Pampapathi","name":"Pampapathi"
673},{
674"adjacencies" :[{"nodeTo" :"Hampamma",
675"nodeFrom":"Pampapathi",
676"data":{"$color":"#000"}}] ,
677"data":{"$color":"#999","$type":"rectangle",
678"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Pampapathi","name":"Pampapathi"
679},{
680"adjacencies" :[{"nodeTo" :"GirijaKalyanaStory",
681"nodeFrom":"Pampapathi",
682"data":{"$color":"#00f"}}] ,
683"data":{"$color":"#999","$type":"rectangle",
684"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Pampapathi","name":"Pampapathi"
685},{
686"adjacencies" :[{"nodeTo" :"Hampamma",
687"nodeFrom":"Daksha",
688"data":{"$color":"#000"}}] ,
689"data":{"$color":"#999","$type":"rectangle",
690"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Daksha","name":"Daksha"
691},{
692"adjacencies" :[{"nodeTo" :"GirijaKalyanaStory",
693"nodeFrom":"Daksha",
694"data":{"$color":"#00f"}}] ,
695"data":{"$color":"#999","$type":"rectangle",
696"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Daksha","name":"Daksha"
697},{
698"adjacencies" :[{"nodeTo" :"Pampapathi",
699"nodeFrom":"Hampamma",
700"data":{"$color":"#000"}}] ,
701"data":{"$color":"#999","$type":"rectangle",
702"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Hampamma","name":"Hampamma"
703},{
704"adjacencies" :[{"nodeTo" :"Daksha",
705"nodeFrom":"Hampamma",
706"data":{"$color":"#000"}}] ,
707"data":{"$color":"#999","$type":"rectangle",
708"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Hampamma","name":"Hampamma"
709},{
710"adjacencies" :[{"nodeTo" :"GirijaKalyanaStory",
711"nodeFrom":"Hampamma",
712 "data":{"$color":"#00f"}}] ,
713"data":{"$color":"#999","$type":"rectangle",
714"$label-color":"#000","$label-size":"20","$nodeDir":""},"id":"Hampamma","name":"Hampamma"
715}]
  
373373 map.addLayer(vectorLayer);
374374 vectorLayer.drawFeature(labelFeature);
375375 vectorLayer.addFeatures([labelFeature]);
376 annotationTree();
376 initAnnotationTree();
377377 attribs = {
378378 "top": topValue,
379379 "bottom": bottom,
472472 });
473473}
474474var config = {
475 'postTweetUrl':'http://127.0.0.1:5000/add',
476 'indexer':'http://192.168.100.56:82'
475 'postTweetUrl':'http://192.168.100.14:5001',
476 'indexer':'http://localhost:5000'
477477}
  
1a {
2 text-decoration:none;
3 color:#23A4FF;
4}
1v\:* {behavior:url(#default#VML);}
2#map {border: 1px solid #888;}
53
6/* #right-container { */
7/* height:300px; */
8/* /\* overflow-y:scroll; *\/ */
9/* } */
10
11/* #right-container { */
12/* margin-left:86%; */
13/* margin-top:-25%; */
14/* width:184.5px; */
15/* color:#686c70; */
16/* text-align: left; */
17/* overflow: auto; */
18/* border-bottom:1px solid #ddd; */
19/* font-size:18px; */
20/* line-height:1.5em; */
21/* } */
22
23
24/* #right-container h4{ */
25/* text-indent:8px; */
26/* } */
27
28/* #center-container { */
29/* width:30%; */
30/* margin-left:55%; */
31/* color:#ccc; */
32/* margin-top:1.2%; */
33/* } */
34
35.text {
36 margin: 7px;
4.modal {
5 width: 1024px;
6 left: 33%;
377}
38
39/* #inner-details { */
40/* font-size:0.8em; */
41/* list-style:none; */
42/* } */
43
44/* #log { */
45/* top:10px; */
46/* font-size:1.0em; */
47/* font-weight:bold; */
48/* color:#23A4FF; */
49/* } */
50
51
52#infovis {
53 position:relative;
54 top:6%;
55 left:20%;
56 width:60%;
57 height:80%;
58 /* overflow:hidden; */
59 background-color:#aaa;
8#stats {
9 position: relative;
10 float: left;
11 width: 150px;
12 height: 400px;
13 padding: 5px;
14 border: 1px solid #999;
15 overflow: auto;
6016}
61
62/* #infovis-canvas { */
63/* position:absolute; */
64/* top:250px; */
65/* } */
66/* #infonar { */
67/* position:relative; */
68/* top:2%; */
69/* left:0; */
70/* width:35%; */
71/* height:90%; */
72/* overflow:show; */
73/* /\* color:#000; *\/ */
74/* /\* background-color: rgba(0,0,0,0.5); *\/ */
75/* } */
76
77/* #narrations-div { */
78/* position:fixed; */
79/* top:5%; */
80/* bottom:2% */
81/* right:0.1%; */
82/* width:30%; */
83/* height:93%; */
84/* overflow:show; */
85/* background-color: rgba(0,0,0,0.5); */
86/* z-index:999999999; */
87/* } */
88/*TOOLTIPS*/
89.tip {
90 color: #fff;
91 width: 140px;
92 background-color: rgba(0,0,0,1);
93 border:1px solid #ccc;
94 -moz-box-shadow:#555 2px 2px 8px;
95 -webkit-box-shadow:#555 2px 2px 8px;
96 -o-box-shadow:#555 2px 2px 8px;
97 box-shadow:#555 2px 2px 8px;
98 opacity:1;
99 /* filter:alpha(opacity=90); */
100 font-size:12px;
101 font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;
102 padding:7px;
17#infovis {
18 position: relative;
19 top: 0px;
20 left: 30px;
21 width: 800px;
22 height: 400px;
23 overflow: hidden;
24 background-color: #707d48;
10325}
static/tree.js
(255 / 96)
  
1var labelType, useGradients, nativeTextSupport, animate, ht, tree_json;
2
1var labelType, animate, useGradients, nativeTextSupport, RGraph;
32(function() {
4 var ua = navigator.userAgent,
5 iStuff = ua.match(/iPhone/i) || ua.match(/iPad/i),
6 typeOfCanvas = typeof HTMLCanvasElement,
7 nativeCanvasSupport = (typeOfCanvas == 'object' || typeOfCanvas == 'function'),
8 textSupport = nativeCanvasSupport
3 var ua = navigator.userAgent,
4 iStuff = ua.match(/iPhone/i) || ua.match(/iPad/i),
5 typeOfCanvas = typeof HTMLCanvasElement,
6 nativeCanvasSupport = (typeOfCanvas == 'object' || typeOfCanvas == 'function'),
7 textSupport = nativeCanvasSupport
98 && (typeof document.createElement('canvas').getContext('2d').fillText == 'function');
10 //I'm setting this based on the fact that ExCanvas provides text support for IE
11 //and that as of today iPhone/iPad current text support is lame
12 labelType = (!nativeCanvasSupport || (textSupport && !iStuff))? 'Native' : 'HTML';
13 nativeTextSupport = labelType == 'Native';
14 useGradients = nativeCanvasSupport;
15 animate = !(iStuff || !nativeCanvasSupport);
9 //I'm setting this based on the fact that ExCanvas provides text support for IE
10 //and that as of today iPhone/iPad current text support is lame
11 labelType = (!nativeCanvasSupport || (textSupport && !iStuff))? 'Native' : 'HTML';
12 nativeTextSupport = labelType == 'Native';
13 useGradients = nativeCanvasSupport;
14 animate = !(iStuff || !nativeCanvasSupport);
15})();
1616
17 //load JSON data.
18 // FIXME: the url is hardcoded, maybe you have to change it
19 // if the file is a variable one
20 $.getJSON('static/old.json', function(json) {
21 console.log('json', json);
22 tree_json = json;
23 inits();
24 });
17var ontology_json;
2518
26})();
19function initAnnotationTree() {
20 //Log.write('Loading ontology file');
21 $('#annotation-tree').modal();
22 $('#annotation-tree').on('shown', function() {
23 loadOntologyJSON();
24 });
25}
2726
28function inits() {
29 var infovis = document.getElementById('infovis');
30 var w = infovis.offsetWidth + 500; var h = infovis.offsetHeight + 385;
27function initNodeListEvents() {
28// register event handler for list of nodes that comes in the stats box.
29// click on the nodes in the stats box will center them in the graph and
30// update the stats box.
31 $('.list-nodes').unbind('click');
32 $('.list-nodes').click(function(event) {
33 var id = $(event.currentTarget).attr('id').split('-')[1];
34 var node = RGraph.graph.getNode(id);
35 centerNode(event, node);
36 });
37}
3138
32 //init Hypertree
33 ht = new $jit.Hypertree({
34 //id of the visualization container
35 injectInto: 'infovis',
36 //canvas width and height
37 width: w,
38 height: h,
39 //Change node and edge styles such as
40 //color, width and dimensions.
41 Node: {
42 dim: 2.5,
43 color: "#555"
44 },
45 Edge: {
46 lineWidth: 1,
47 color: "#222"
48 },
39function loadOntologyJSON() {
40 // if the file is already loaded, no need to load again
41 if(typeof ontology_json === 'object') {
42 drawRGraph();
43 return;
44 }
45 console.log('Loading ontology file');
46 var url = 'static/graphs/Hampi_GirijaKalyana.json'
47 $.ajax({
48 type: 'GET',
49 url: url,
50 dataType: 'json',
51 success: function(data) {
52 console.log('Ontology JSON loaded');
53 ontology_json = data;
54 drawRGraph();
55 },
56 error: function(xhr, errtype, errtext) {
57 console.log('Could not load Ontology JSON!');
58 console.log(errtype, ':', errtext);
59 }
60 });
61}
4962
50 // On hover
51 Tips: {
52 enable: false,
63var Log = {
64 elem: document.getElementById('status'),
65 write: function(msg) {
66 this.elem.innerHTML = msg;
67 }
68};
5369
54 onShow: function(tip, node) {
55 ht.tips.config.offsetX = "10";
56 ht.tips.config.offsetY = "10";
57// tip.addEventListener("click", alert('hello'), false);
58 tip.innerHTML = "<div id=\"value\" class=\"tip-title\" style=\"text-align:center;\">" + node.name + "</div>";
59// + node.data.relation + " style=\"color:#fff;\">" + node.name + "</a></div>";
60 }
61 },
70var Stats = {
71 init: function() {
72 this.node_info = document.getElementById('node-info');
73 this.selected_info = document.getElementById('selected-nodes');
74 },
75 write: function(msg) {
76 this.node_info.innerHTML = msg;
77 },
78 appendSelectedList: function() {
79 var html = '<h4>Selected:</h4>';
80 if(!sweet.nodes.length) {
81 html += '<b>None</b>';
82 }
83 else {
84 html += '<ul>';
85 for(var i in sweet.nodes) {
86 html += '<li>' + sweet.nodes[i] + '</li>';
87 }
88 html += '</ul>';
89 }
90 this.selected_info.innerHTML = html;
91 }
92};
6293
63 //Attach event handlers and add text to the
64 //labels. This method is only triggered on label
65 //creation
66 onCreateLabel: function(domElement, node){
67 domElement.innerHTML = node.name;
68 $jit.util.addEvent(domElement, 'click', function () {
69 ht.onClick(node.id, {
70 onComplete: function() {
71 ht.controller.onComplete();
72 }
73 });
74 });
75 },
76 //Change node styles when labels are placed
77 //or moved.
78 onPlaceLabel: function(domElement, node){
79 var style = domElement.style;
80 style.display = '';
81 style.cursor = 'pointer';
82 ht.controller.Node.transform = false;
83 ht.controller.Edge.alpha = "0.3";
84 if (node._depth == 0) {
85 style.fontSize = "0.8em";
86 style.color = "#111";
87 } else if(node._depth == 1){
88 style.fontSize = "0.9em";
89 style.color = "#222";
90 } // else if(node._depth == 2){
91 // style.fontSize = "0.7em";
92 // style.color = "#444";
93 // }
94 else {
95 style.display = 'none';
96 }
94// return "add node" template button creating an id for it
95var addNodeTemplate = function(node) {
96 return '<button onclick="addNode(event);" class="btn" id="add-'+
97 node +'">Add '+ node +'</button>';
98};
9799
98 var left = parseInt(style.left);
99 var w = domElement.offsetWidth;
100 style.left = (left - w / 2) + 'px';
101 },
100// add node to the selected list to be sweeted.
101function addNode(event) {
102 var id = $(event.currentTarget).attr('id');
103 var node = id.split('-')[1];
104 sweet.add(node);
105 //Log.write('Added node ' + node);
106}
107
108//center the given node in the graph and update the stats box
109function centerNode(event, node) {
110 if(event.stopPropagation) {
111 event.stopPropagation();
112 }
113 //Log.write('centering node ', node.name);
114 RGraph.onClick(node.id, {
115 hideLabels: false,
116 onComplete: function() {
117 //Log.write("done");
118 }
119 });
120 var html = '<h4>' + node.name + '</h4><b>Links To:</b>:<ul>';
121 node.eachAdjacency(function(adj) {
122 html += '<li><a class="list-nodes" href="#" id="list-' + adj.nodeTo.id + '">' +
123 adj.nodeTo.name + '</a></li>';
124 });
125 html += '</ul>';
126 html += addNodeTemplate(node.name);
127 Stats.write(html);
128 Stats.appendSelectedList();
129 initNodeListEvents();
130 return false;
131}
132
133var sweet = {
134 nodes: [],
135 swts: [],
136 type: 'idh-mowl',
137 add: function(node) {
138 if(_.indexOf(node, this.nodes) === -1) {
139 this.nodes.push(node);
140 }
141 Stats.appendSelectedList();
142 },
143 remove: function(node) {
144 },
145 save: function() {
146 var resource = window.location.search ? window.location.search.split('=')[1] :
147 'default';
148 resource = decodeURIComponent(resource).replace('"', '', 'gi');
149 var data = {
150 user: user,
151 type: this.type,
152 uri: resource,
153 top: attribs.top,
154 bottom: attribs.bottom,
155 left: attribs.left,
156 right: attribs.right,
157 nodes: this.nodes,
158 };
159 this.swts.push(data);
160 this.nodes = [];
161 },
162 publish: function() {
163 if(!this.swts.length) {
164 return;
165 }
166 $('#publish').attr('disabled', 'disabled');
167 $.ajax({
168 type: 'POST',
169 url: config.indexer + '/submit',
170 data: JSON.stringify(this.swts),
171 success: function() {
172 $.ajax({
173 type: 'POST',
174 url: config.postTweetUrl,
175 data: {'data': JSON.stringify(this.swts)},
176 success: function() {
177 $('#posted').show();
178 this.swts = [];
179 },
180 error: function() {
181 $('#fail-posting').show();
182 }
183 });
184 },
185 error: function() {
186 $('#fail-posting').show();
187 }
102188 });
103 ht.loadJSON(tree_json);
104 //compute positions and plot.
105 ht.refresh();
106 //end
107 ht.controller.onComplete();
189 }
190};
191
192function closeAnnotationTree() {
193 $('#annotation-tree').modal('hide');
194 $('#infovis').html('');
195 $('#node-info').html('');
196 $('#selected-nodes').html('');
197 sweet.save();
198 $('#publish').attr('disabled', false);
199}
200
201function drawRGraph() {
202 var rgraph = new $jit.RGraph({
203 injectInto: 'infovis',
204 Navigation: {
205 enable: true,
206 panning: 'avoid nodes',
207 zooming: 100
208 },
209 Node: {
210 overridable: true,
211 //span: 5,
212 //height: 40,
213 //width: 150,
214 angularWidth: 100,
215 //autoHeight: true,
216 //autoWidth: true,
217 dim: 10
218 },
219 Edge: {
220 overridable: true
221 },
222 Label: {
223 overridable: true,
224 type: labelType, //Native or HTML
225 size: 14
226 },
227 interpolation: 'polar',
228 transition: $jit.Trans.Sine.easeInOut,
229 levelDistance: 150,
230 onCreateLabel: function(domElement, node) {
231 console.log('oncreatelabel');
232 },
233 onPlaceLabel: function(domElement, node) {
234 console.log('onplacelabel');
235 /*var style = domElement.style;
236 var top = parseInt(style.top);
237 console.log('top :', top);
238 style.top = (top - 40) + 'px';*/
239 },
240 Events: {
241 enable: true,
242 type: 'Native',
243 onMouseEnter: function() {
244 rgraph.canvas.getElement().style.cursor = 'pointer';
245 },
246 onMouseLeave: function() {
247 rgraph.canvas.getElement().style.cursor = '';
248 },
249 onClick: function(node, event_info, e) {
250 console.log(node, event_info, e);
251 if(!node) {
252 return;
253 }
254 centerNode(e, node);
255 }
256 }
257 });
258
259 rgraph.loadJSON(ontology_json);
260 rgraph.refresh();
261 rgraph.controller.onBeforeCompute(rgraph.graph.getNode(rgraph.root));
262 //Log.write('Done');
263 console.log('done drawing');
264
265 RGraph = rgraph;
266 Stats.init();
108267}
  
11<!DOCTYPE html>
22<html>
3<head>
34 <meta charset="utf-8">
4 <head>
5 <script type="text/javascript">
6 function annotationTree() {
7 $('#annotation-tree').modal();
8 }
9 </script>
5 <meta http-equiv='imagetoolbar' content='no'/>
6 <title> Lepakshi Mural Annotation </title>
7 <link rel="stylesheet" type="text/css" href="static/bootstrap.css"></link>
8 <link rel="stylesheet" type="text/css" href="static/tree.css"></link>
109 <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.0.min.js"></script>
1110 <script type="text/javascript" src="http://underscorejs.org/underscore-min.js"></script>
1211 <script type="text/javascript" src="http://backbonejs.org/backbone-min.js"></script>
12 <script src="http://www.openlayers.org/api/2.11/OpenLayers.js" type="text/javascript"></script>
1313 <script type="text/javascript" src="static/jit.js"></script>
1414 <script type="text/javascript" src="static/tree.js"></script>
15 <style type='text/css'>
16 /*#annotation-tree {
17 position:fixed;
18 top:0px;
19 left:0px;
20 width:100%;
21 height:100%;
22 background-color:rgba(0, 0, 0, 0.5);
23 display:none;
24 z-index:99999;
25 }*/
26 </style>
27 <title>Flask Lepakshi Mural</title>
28 <meta http-equiv='imagetoolbar' content='no'/>
29 <link rel="stylesheet" type="text/css" href="static/bootstrap.css"></link>
30 <!--link rel="stylesheet" type="text/css" href="./tree.css"></link-->
31 <style type="text/css"> v\:* {behavior:url(#default#VML);}
32 label { display: inline;}
33 h1 { margin: 0; padding: 6px; border:0; font-size: 20pt; }
34 #header { height: 43px; padding: 0; background-color: #eee; border: 1px solid #888; }
35 #subheader { height: 12px; text-align: right; font-size: 10px; color: #555;}
36 #map {border: 1px solid #888;}
37 </style>
38 <script src="http://www.openlayers.org/api/2.11/OpenLayers.js" type="text/javascript"></script>
3915 <script type="text/javascript" src="static/myVector.js"></script>
4016 <script type="text/javascript" src="static/bootstrap.js"></script>
41 <script type="text/javascript">
42 function treeClose() {
43 $('#annotation-tree').modal('hide');
44 attribs["character"] = $("#character-value").text();
45 attribs["material"] = $("#material-value").text();
46 myJSON.push(attribs);
47 $("#publish").attr("disabled", false);
48 }
49 </script>
5017</head>
5118{% if url %}
5219 <body onload='init({{ url|string|safe }});'>
5320{% else %}
5421 <body onload="init();">
5522{% endif %}
56 <!--div id="header"><h1>Lepakshi Mural</h1></div-->
5723 <div class="fluid-container">
5824
5925 <div class="navbar">
4343 </li>
4444 <li><a></a></li>
4545 <li><a></a></li>
46 <li><button class="btn" onClick="publish();" id="publish" disabled="true"/>Publish</button></li>
46 <li><button class="btn" onClick="sweet.publish();" id="publish" disabled="true"/>Publish</button></li>
4747 </ul>
4848 </div>
4949 </div>
5454 <button type="button" class="close" data-dismiss="alert">&times;</button>
5555 <b>Success!</b> Post successfully posted.
5656 </div>
57 <div id="fail-posting" class="alert alert-error" style="display: none; width: 300px; margin: auto;">
58 <button type="button" class="close" data-dismiss="alert">&times;</button>
59 <b>Error!</b> Something went wrong. Could not post.
60 </div>
5761
58 <div class="btn-group">
62 <!--div class="btn-group">
5963 <button onclick="handler.trigger();" class="btn btn-small">Mural</button>
6064 <button onclick="handler.trigger1();" class="btn btn-small"> Face</button>
6165 <button onclick="handler.trigger2();" class="btn btn-small">Jewellery</button>
62 </div>
66 </div-->
6367 <p></p>
6468 <div id="map"></div>
6569 <div id="subheader">Generated by <a href="http://www.maptiler.org/">MapTiler</a><a href="http://www.klokan.cz/projects/gdal2tiles/">GDAL2Tiles</a>, Copyright &copy; 2008 <a href="http://www.klokan.cz/">Klokan Petr Pridal</a>, <a href="http://www.gdal.org/">GDAL</a> &amp; <a href="http://www.osgeo.org/">OSGeo</a> <a href="http://code.google.com/soc/">GSoC</a>
8383 </div>
8484 </div>
8585 <div class="modal-body">
86 <div id="infovis">
87 <div class="well text-info">
88 <ul>
89 <li><b>Character:</b> <span id="character-value"></span></li>
90 <li>
91 <b>Ornament:</b>
92 <ul>
93 <li><b>Material:</b> <span id="material-value"></span></li>
94 <li><b>Jewellery:</b> <span id="jewellery-value"></span></li>
95 </ul>
96 </li>
97 </ul>
98 </div>
86 <div id="stats">
87 <div id="node-info"></div>
88 <div id="selected-nodes"></div>
9989 </div>
90 <div id="infovis"></div>
91 <div id="status"></div>
10092 </div>
10193 <div class="modal-footer">
10294 <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
103 <button class="btn btn-primary" onclick="treeClose();">Save changes</button>
95 <button class="btn btn-primary" onclick="closeAnnotationTree();">Save changes</button>
10496 </div>
10597 </div>
10698</body>