--- a/fetch.py +++ b/fetch.py @@ -56,7 +56,7 @@ except: response = make_response() response.status = "500" - respose.data = "Your post could not be saved. Try posting again." + response.data = "Your post could not be saved. Try posting again." return response @@ -73,9 +73,22 @@ pass root = lxml.html.parse(StringIO.StringIO(page)).getroot() root.make_links_absolute(request.args['url'], resolve_base_href = True) + + # inject the JS toolbar to annotate text + script = root.makeelement('script') + script.set('src', 'static/text-annotation.js') + link = root.makeelement('link') + link.set('href', 'static/text-annotation.css') + link.set('type', 'text/css') + link.set('rel', 'stylesheet') + + root.body.append(script) + root.head.append(link) + return lxml.html.tostring(root) + #Log the errors, don't depend on apache to log it for you. - fil = FileHandler(os.path.join(os.path.dirname(__file__), 'logme'), mode='a') + fil = FileHandler(os.path.join(os.path.dirname(__file__), 'logme'),mode='a') fil.setLevel(logging.ERROR) app.logger.addHandler(fil) --- /dev/null +++ b/static/graphs/Hampi_GirijaKalyana.json @@ -1 +1,716 @@ +[{ +"adjacencies" :[{"nodeTo" :"Mantapa", +"nodeFrom":"TempleElement", +"data":{"$color":"#000"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"TempleElement","name":"TempleElement" +},{ +"adjacencies" :[{"nodeTo" :"KalyanaMantapa", +"nodeFrom":"Mantapa", +"data":{"$color":"#000"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Mantapa","name":"Mantapa" +},{ +"adjacencies" :[{"nodeTo" :"GarbhaGriha", +"nodeFrom":"TempleElement", +"data":{"$color":"#000"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"TempleElement","name":"TempleElement" +},{ +"adjacencies" :[{"nodeTo" :"Date", +"nodeFrom":"TimeAppellation", +"data":{"$color":"#000"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"TimeAppellation","name":"TimeAppellation" +},{ +"adjacencies" :[{"nodeTo" :"City", +"nodeFrom":"Place", +"data":{"$color":"#000"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Place","name":"Place" +},{ +"adjacencies" :[{"nodeTo" :"Village", +"nodeFrom":"Place", +"data":{"$color":"#000"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Place","name":"Place" +},{ +"adjacencies" :[{"nodeTo" :"District", +"nodeFrom":"Place", +"data":{"$color":"#000"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Place","name":"Place" +},{ +"adjacencies" :[{"nodeTo" :"State", +"nodeFrom":"Place", +"data":{"$color":"#000"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Place","name":"Place" +},{ +"adjacencies" :[{"nodeTo" :"Country", +"nodeFrom":"Place", +"data":{"$color":"#000"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Place","name":"Place" +},{ +"adjacencies" :[{"nodeTo" :"Empire", +"nodeFrom":"Event", +"data":{"$color":"#000"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Event","name":"Event" +},{ +"adjacencies" :[{"nodeTo" :"King", +"nodeFrom":"Person", +"data":{"$color":"#000"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Person","name":"Person" +},{ +"adjacencies" :[{"nodeTo" :"MuralTradition", +"nodeFrom":"Tradition", +"data":{"$color":"#000"}}] , +"data":{"$color":"#999","$type":"rectangle", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Tradition","name":"Tradition" +},{ +"adjacencies" :[{"nodeTo" :"Human", +"nodeFrom":"Character", +"data":{"$color":"#000"}}] , +"data":{"$color":"#999","$type":"rectangle", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Character","name":"Character" +},{ +"adjacencies" :[{"nodeTo" :"Animal", +"nodeFrom":"Character", +"data":{"$color":"#000"}}] , +"data":{"$color":"#999","$type":"rectangle", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Character","name":"Character" +},{ +"adjacencies" :[{"nodeTo" :"Male", +"nodeFrom":"Human", +"data":{"$color":"#000"}}] , +"data":{"$color":"#999","$type":"rectangle", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Human","name":"Human" +},{ +"adjacencies" :[{"nodeTo" :"Female", +"nodeFrom":"Human", +"data":{"$color":"#000"}}] , +"data":{"$color":"#999","$type":"rectangle", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Human","name":"Human" +},{ +"adjacencies" :[{"nodeTo" :"Ritual", +"nodeFrom":"Tradition", +"data":{"$color":"#000"}}] , +"data":{"$color":"#999","$type":"rectangle", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Tradition","name":"Tradition" +},{ +"adjacencies" :[{"nodeTo" :"CulturalContent", +"nodeFrom":"MuralContent", +"data":{"$color":"#000"}}] , +"data":{"$color":"#999","$type":"rectangle", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"MuralContent","name":"MuralContent" +},{ +"adjacencies" :[{"nodeTo" :"Fashion", +"nodeFrom":"CulturalContent", +"data":{"$color":"#000"}}] , +"data":{"$color":"#999","$type":"rectangle", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"CulturalContent","name":"CulturalContent" +},{ +"adjacencies" :[{"nodeTo" :"Tattoo", +"nodeFrom":"Fashion", +"data":{"$color":"#000"}}] , +"data":{"$color":"#999","$type":"rectangle", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Fashion","name":"Fashion" +},{ +"adjacencies" :[{"nodeTo" :"Jewellery", +"nodeFrom":"Fashion", +"data":{"$color":"#000"}}] , +"data":{"$color":"#999","$type":"rectangle", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Fashion","name":"Fashion" +},{ +"adjacencies" :[{"nodeTo" :"HairStyle", +"nodeFrom":"Fashion", +"data":{"$color":"#000"}}] , +"data":{"$color":"#999","$type":"rectangle", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Fashion","name":"Fashion" +},{ +"adjacencies" :[{"nodeTo" :"VijayaNagara", +"nodeFrom":"City", +"data":{"$color":"#f00"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#fff","$label-size":"20","$nodecDir":""},"id":"City","name":"City" +},{ +"adjacencies" :[{"nodeTo" :"India", +"nodeFrom":"Country", +"data":{"$color":"#f00"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Country","name":"Country" +},{ +"adjacencies" :[{"nodeTo" :"Bellary", +"nodeFrom":"District", +"data":{"$color":"#f00"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"District","name":"District" +},{ +"adjacencies" :[{"nodeTo" :"VijayanagaraEmpire", +"nodeFrom":"Empire", +"data":{"$color":"#f00"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Empire","name":"Empire" +},{ +"adjacencies" :[{"nodeTo" :"VirupanaNayak", +"nodeFrom":"King", +"data":{"$color":"#f00"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"King","name":"King" +},{ +"adjacencies" :[{"nodeTo" :"GirijaKalyanaMural", +"nodeFrom":"MuralPainting", +"data":{"$color":"#f00"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"MuralPainting","name":"MuralPainting" +},{ +"adjacencies" :[{"nodeTo" :"ShivaPurana", +"nodeFrom":"Scripture", +"data":{"$color":"#f00"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Scripture","name":"Scripture" +},{ +"adjacencies" :[{"nodeTo" :"Karnataka", +"nodeFrom":"State", +"data":{"$color":"#f00"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"State","name":"State" +},{ +"adjacencies" :[{"nodeTo" :"GirijaKalyanaStory", +"nodeFrom":"Story", +"data":{"$color":"#f00"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Story","name":"Story" +},{ +"adjacencies" :[{"nodeTo" :"VirupakshaTemple", +"nodeFrom":"Temple", +"data":{"$color":"#f00"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Temple","name":"Temple" +},{ +"adjacencies" :[{"nodeTo" :"AD_1500", +"nodeFrom":"TimeAppellation", +"data":{"$color":"#f00"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"TimeAppellation","name":"TimeAppellation" +},{ +"adjacencies" :[{"nodeTo" :"AD_1336", +"nodeFrom":"TimeAppellation", +"data":{"$color":"#f00"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"TimeAppellation","name":"TimeAppellation" +},{ +"adjacencies" :[{"nodeTo" :"AD_1646", +"nodeFrom":"TimeAppellation", +"data":{"$color":"#f00"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"TimeAppellation","name":"TimeAppellation" +},{ +"adjacencies" :[{"nodeTo" :"AD_1336_to_AD_1646", +"nodeFrom":"TimeSpan", +"data":{"$color":"#f00"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"TimeSpan","name":"TimeSpan" +},{ +"adjacencies" :[{"nodeTo" :"Hampi", +"nodeFrom":"Village", +"data":{"$color":"#f00"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Village","name":"Village" +},{ +"adjacencies" :[{"nodeTo" :"VijaynagaraTradition", +"nodeFrom":"MuralTradition", +"data":{"$color":"#f00"}}] , +"data":{"$color":"#999","$type":"rectangle", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"MuralTradition","name":"MuralTradition" +},{ +"adjacencies" :[{"nodeTo" :"Nandi", +"nodeFrom":"Animal", +"data":{"$color":"#f00"}}] , +"data":{"$color":"#999","$type":"rectangle", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Animal","name":"Animal" +},{ +"adjacencies" :[{"nodeTo" :"Snake", +"nodeFrom":"Animal", +"data":{"$color":"#f00"}}] , +"data":{"$color":"#999","$type":"rectangle", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Animal","name":"Animal" +},{ +"adjacencies" :[{"nodeTo" :"Pampapathi", +"nodeFrom":"Male", +"data":{"$color":"#f00"}}] , +"data":{"$color":"#999","$type":"rectangle", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Male","name":"Male" +},{ +"adjacencies" :[{"nodeTo" :"Daksha", +"nodeFrom":"Male", +"data":{"$color":"#f00"}}] , +"data":{"$color":"#999","$type":"rectangle", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Male","name":"Male" +},{ +"adjacencies" :[{"nodeTo" :"Hampamma", +"nodeFrom":"Female", +"data":{"$color":"#f00"}}] , +"data":{"$color":"#999","$type":"rectangle", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Female","name":"Female" +},{ +"adjacencies" :[{"nodeTo" :"KalyanUtsav", +"nodeFrom":"Ritual", +"data":{"$color":"#f00"}}] , +"data":{"$color":"#999","$type":"rectangle", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Ritual","name":"Ritual" +},{ +"adjacencies" :[{"nodeTo" :"PalaPuja", +"nodeFrom":"Ritual", +"data":{"$color":"#f00"}}] , +"data":{"$color":"#999","$type":"rectangle", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Ritual","name":"Ritual" +},{ +"adjacencies" :[{"nodeTo" :"GirijaKalyanaTattoo", +"nodeFrom":"Tattoo", +"data":{"$color":"#f00"}}] , +"data":{"$color":"#999","$type":"rectangle", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Tattoo","name":"Tattoo" +},{ +"adjacencies" :[{"nodeTo" :"Anklet", +"nodeFrom":"Jewellery", +"data":{"$color":"#f00"}}] , +"data":{"$color":"#999","$type":"rectangle", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Jewellery","name":"Jewellery" +},{ +"adjacencies" :[{"nodeTo" :"Face", +"nodeFrom":"Person", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Person","name":"Person" +},{ +"adjacencies" :[{"nodeTo" :"GirijaKalyanaEg", +"nodeFrom":"GirijaKalyanaMural", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"GirijaKalyanaMural","name":"GirijaKalyanaMural" +},{ +"adjacencies" :[{"nodeTo" :"Anklet", +"nodeFrom":"GirijaKalyanaMural", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"GirijaKalyanaMural","name":"GirijaKalyanaMural" +},{ +"adjacencies" :[{"nodeTo" :"Pampapathi", +"nodeFrom":"GirijaKalyanaMural", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"GirijaKalyanaMural","name":"GirijaKalyanaMural" +},{ +"adjacencies" :[{"nodeTo" :"Hampamma", +"nodeFrom":"GirijaKalyanaMural", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"GirijaKalyanaMural","name":"GirijaKalyanaMural" +},{ +"adjacencies" :[{"nodeTo" :"Daksha", +"nodeFrom":"GirijaKalyanaMural", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"GirijaKalyanaMural","name":"GirijaKalyanaMural" +},{ +"adjacencies" :[{"nodeTo" :"NandiEg", +"nodeFrom":"Nandi", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#999","$type":"rectangle", +"$label-color":"#fff","$label-size":"20","$nodecDir":""},"id":"Nandi","name":"Nandi" +},{ +"adjacencies" :[{"nodeTo" :"PampapathiEg1", +"nodeFrom":"Pampapathi", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#999","$type":"rectangle", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Pampapathi","name":"Pampapathi" +},{ +"adjacencies" :[{"nodeTo" :"PampapathiEg2", +"nodeFrom":"Pampapathi", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#999","$type":"rectangle", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Pampapathi","name":"Pampapathi" +},{ +"adjacencies" :[{"nodeTo" :"GKTattooExample", +"nodeFrom":"GirijaKalyanaTattoo", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#999","$type":"rectangle", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"GirijaKalyanaTattoo","name":"GirijaKalyanaTattoo" +},{ +"adjacencies" :[{"nodeTo" :"Story", +"nodeFrom":"MuralPainting", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"MuralPainting","name":"MuralPainting" +},{ +"adjacencies" :[{"nodeTo" :"MuralContent", +"nodeFrom":"MuralPainting", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"MuralPainting","name":"MuralPainting" +},{ +"adjacencies" :[{"nodeTo" :"MuralTradition", +"nodeFrom":"MuralPainting", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"MuralPainting","name":"MuralPainting" +},{ +"adjacencies" :[{"nodeTo" :"TimePeriod", +"nodeFrom":"MuralPainting", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"MuralPainting","name":"MuralPainting" +},{ +"adjacencies" :[{"nodeTo" :"Mantapa", +"nodeFrom":"MuralPainting", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"MuralPainting","name":"MuralPainting" +},{ +"adjacencies" :[{"nodeTo" :"MuralPainting", +"nodeFrom":"Story", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Story","name":"Story" +},{ +"adjacencies" :[{"nodeTo" :"Narrative", +"nodeFrom":"Story", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Story","name":"Story" +},{ +"adjacencies" :[{"nodeTo" :"Scripture", +"nodeFrom":"Story", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Story","name":"Story" +},{ +"adjacencies" :[{"nodeTo" :"Story", +"nodeFrom":"Scripture", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Scripture","name":"Scripture" +},{ +"adjacencies" :[{"nodeTo" :"Character", +"nodeFrom":"Story", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Story","name":"Story" +},{ +"adjacencies" :[{"nodeTo" :"Ritual", +"nodeFrom":"Story", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Story","name":"Story" +},{ +"adjacencies" :[{"nodeTo" :"Story", +"nodeFrom":"Character", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#999","$type":"rectangle", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Character","name":"Character" +},{ +"adjacencies" :[{"nodeTo" :"Animal", +"nodeFrom":"Human", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#999","$type":"rectangle", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Human","name":"Human" +},{ +"adjacencies" :[{"nodeTo" :"TimeAppellation", +"nodeFrom":"Temple", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Temple","name":"Temple" +},{ +"adjacencies" :[{"nodeTo" :"TempleElement", +"nodeFrom":"Temple", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Temple","name":"Temple" +},{ +"adjacencies" :[{"nodeTo" :"Temple", +"nodeFrom":"TempleElement", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"TempleElement","name":"TempleElement" +},{ +"adjacencies" :[{"nodeTo" :"TimeAppellation", +"nodeFrom":"TimePeriod", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"TimePeriod","name":"TimePeriod" +},{ +"adjacencies" :[{"nodeTo" :"Empire", +"nodeFrom":"MuralTradition", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#999","$type":"rectangle", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"MuralTradition","name":"MuralTradition" +},{ +"adjacencies" :[{"nodeTo" :"VirupakshaTemple", +"nodeFrom":"KalyanaMantapa", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"KalyanaMantapa","name":"KalyanaMantapa" +},{ +"adjacencies" :[{"nodeTo" :"Narrator", +"nodeFrom":"Narrative", +"data":{"$color":"#000"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Narrative","name":"Narrative" +},{ +"adjacencies" :[{"nodeTo" :"Human", +"nodeFrom":"Human", +"data":{"$color":"#000"}}] , +"data":{"$color":"#999","$type":"rectangle", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Human","name":"Human" +},{ +"adjacencies" :[{"nodeTo" :"Event", +"nodeFrom":"Place", +"data":{"$color":"#000"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Place","name":"Place" +},{ +"adjacencies" :[{"nodeTo" :"Place", +"nodeFrom":"Place", +"data":{"$color":"#000"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Place","name":"Place" +},{ +"adjacencies" :[{"nodeTo" :"Place", +"nodeFrom":"Temple", +"data":{"$color":"#000"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Temple","name":"Temple" +},{ +"adjacencies" :[{"nodeTo" :"Place", +"nodeFrom":"Event", +"data":{"$color":"#000"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Event","name":"Event" +},{ +"adjacencies" :[{"nodeTo" :"LatLons", +"nodeFrom":"Place", +"data":{"$color":"#000"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Place","name":"Place" +},{ +"adjacencies" :[{"nodeTo" :"Empire", +"nodeFrom":"Place", +"data":{"$color":"#000"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Place","name":"Place" +},{ +"adjacencies" :[{"nodeTo" :"TimeAppellation", +"nodeFrom":"TimeSpan", +"data":{"$color":"#000"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"TimeSpan","name":"TimeSpan" +},{ +"adjacencies" :[{"nodeTo" :"Person", +"nodeFrom":"Temple", +"data":{"$color":"#000"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Temple","name":"Temple" +},{ +"adjacencies" :[{"nodeTo" :"Bellary", +"nodeFrom":"VijayaNagara", +"data":{"$color":"#000"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"VijayaNagara","name":"VijayaNagara" +},{ +"adjacencies" :[{"nodeTo" :"VijayanagaraEmpire", +"nodeFrom":"VijayaNagara", +"data":{"$color":"#000"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"VijayaNagara","name":"VijayaNagara" +},{ +"adjacencies" :[{"nodeTo" :"Karnataka", +"nodeFrom":"Bellary", +"data":{"$color":"#000"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Bellary","name":"Bellary" +},{ +"adjacencies" :[{"nodeTo" :"GirijaKalyanaStory", +"nodeFrom":"GirijaKalyanaMural", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#000","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"GirijaKalyanaMural","name":"GirijaKalyanaMural" +},{ +"adjacencies" :[{"nodeTo" :"KalyanaMantapa", +"nodeFrom":"GirijaKalyanaMural", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"GirijaKalyanaMural","name":"GirijaKalyanaMural" +},{ +"adjacencies" :[{"nodeTo" :"VijaynagaraTradition", +"nodeFrom":"GirijaKalyanaMural", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"GirijaKalyanaMural","name":"GirijaKalyanaMural" +},{ +"adjacencies" :[{"nodeTo" :"GirijaKalyanaStory", +"nodeFrom":"ShivaPurana", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"ShivaPurana","name":"ShivaPurana" +},{ +"adjacencies" :[{"nodeTo" :"India", +"nodeFrom":"Karnataka", +"data":{"$color":"#000"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Karnataka","name":"Karnataka" +},{ +"adjacencies" :[{"nodeTo" :"ShivaPurana", +"nodeFrom":"GirijaKalyanaStory", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"GirijaKalyanaStory","name":"GirijaKalyanaStory" +},{ +"adjacencies" :[{"nodeTo" :"Pampapathi", +"nodeFrom":"GirijaKalyanaStory", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"GirijaKalyanaStory","name":"GirijaKalyanaStory" +},{ +"adjacencies" :[{"nodeTo" :"Hampamma", +"nodeFrom":"GirijaKalyanaStory", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"GirijaKalyanaStory","name":"GirijaKalyanaStory" +},{ +"adjacencies" :[{"nodeTo" :"Daksha", +"nodeFrom":"GirijaKalyanaStory", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"GirijaKalyanaStory","name":"GirijaKalyanaStory" +},{ +"adjacencies" :[{"nodeTo" :"GirijaKalyanaMural", +"nodeFrom":"GirijaKalyanaStory", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"GirijaKalyanaStory","name":"GirijaKalyanaStory" +},{ +"adjacencies" :[{"nodeTo" :"PalaPuja", +"nodeFrom":"GirijaKalyanaStory", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"GirijaKalyanaStory","name":"GirijaKalyanaStory" +},{ +"adjacencies" :[{"nodeTo" :"KalyanUtsav", +"nodeFrom":"GirijaKalyanaStory", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"GirijaKalyanaStory","name":"GirijaKalyanaStory" +},{ +"adjacencies" :[{"nodeTo" :"AD_1500", +"nodeFrom":"VirupakshaTemple", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"VirupakshaTemple","name":"VirupakshaTemple" +},{ +"adjacencies" :[{"nodeTo" :"VirupanaNayak", +"nodeFrom":"VirupakshaTemple", +"data":{"$color":"#000"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"VirupakshaTemple","name":"VirupakshaTemple" +},{ +"adjacencies" :[{"nodeTo" :"Hampi", +"nodeFrom":"VirupakshaTemple", +"data":{"$color":"#000"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"VirupakshaTemple","name":"VirupakshaTemple" +},{ +"adjacencies" :[{"nodeTo" :"KalyanaMantapa", +"nodeFrom":"VirupakshaTemple", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"VirupakshaTemple","name":"VirupakshaTemple" +},{ +"adjacencies" :[{"nodeTo" :"GarbhaGriha", +"nodeFrom":"VirupakshaTemple", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"VirupakshaTemple","name":"VirupakshaTemple" +},{ +"adjacencies" :[{"nodeTo" :"AD_1336", +"nodeFrom":"AD_1336_to_AD_1646", +"data":{"$color":"#000"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"AD_1336_to_AD_1646","name":"AD_1336_to_AD_1646" +},{ +"adjacencies" :[{"nodeTo" :"AD_1646", +"nodeFrom":"AD_1336_to_AD_1646", +"data":{"$color":"#000"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"AD_1336_to_AD_1646","name":"AD_1336_to_AD_1646" +},{ +"adjacencies" :[{"nodeTo" :"VijayaNagara", +"nodeFrom":"Hampi", +"data":{"$color":"#000"}}] , +"data":{"$color":"#fff","$type":"ellipse", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Hampi","name":"Hampi" +},{ +"adjacencies" :[{"nodeTo" :"VijayanagaraEmpire", +"nodeFrom":"VijaynagaraTradition", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#999","$type":"rectangle", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"VijaynagaraTradition","name":"VijaynagaraTradition" +},{ +"adjacencies" :[{"nodeTo" :"Snake", +"nodeFrom":"Pampapathi", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#999","$type":"rectangle", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Pampapathi","name":"Pampapathi" +},{ +"adjacencies" :[{"nodeTo" :"Nandi", +"nodeFrom":"Pampapathi", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#999","$type":"rectangle", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Pampapathi","name":"Pampapathi" +},{ +"adjacencies" :[{"nodeTo" :"Hampamma", +"nodeFrom":"Pampapathi", +"data":{"$color":"#000"}}] , +"data":{"$color":"#999","$type":"rectangle", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Pampapathi","name":"Pampapathi" +},{ +"adjacencies" :[{"nodeTo" :"GirijaKalyanaStory", +"nodeFrom":"Pampapathi", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#999","$type":"rectangle", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Pampapathi","name":"Pampapathi" +},{ +"adjacencies" :[{"nodeTo" :"Hampamma", +"nodeFrom":"Daksha", +"data":{"$color":"#000"}}] , +"data":{"$color":"#999","$type":"rectangle", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Daksha","name":"Daksha" +},{ +"adjacencies" :[{"nodeTo" :"GirijaKalyanaStory", +"nodeFrom":"Daksha", +"data":{"$color":"#00f"}}] , +"data":{"$color":"#999","$type":"rectangle", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Daksha","name":"Daksha" +},{ +"adjacencies" :[{"nodeTo" :"Pampapathi", +"nodeFrom":"Hampamma", +"data":{"$color":"#000"}}] , +"data":{"$color":"#999","$type":"rectangle", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Hampamma","name":"Hampamma" +},{ +"adjacencies" :[{"nodeTo" :"Daksha", +"nodeFrom":"Hampamma", +"data":{"$color":"#000"}}] , +"data":{"$color":"#999","$type":"rectangle", +"$label-color":"#000","$label-size":"20","$nodecDir":""},"id":"Hampamma","name":"Hampamma" +},{ +"adjacencies" :[{"nodeTo" :"GirijaKalyanaStory", +"nodeFrom":"Hampamma", + "data":{"$color":"#00f"}}] , +"data":{"$color":"#999","$type":"rectangle", +"$label-color":"#000","$label-size":"20","$nodeDir":""},"id":"Hampamma","name":"Hampamma" +}] --- a/static/myVector.js +++ b/static/myVector.js @@ -373,7 +373,7 @@ map.addLayer(vectorLayer); vectorLayer.drawFeature(labelFeature); vectorLayer.addFeatures([labelFeature]); - annotationTree(); + initAnnotationTree(); attribs = { "top": topValue, "bottom": bottom, @@ -472,7 +472,7 @@ }); } var config = { - 'postTweetUrl':'http://127.0.0.1:5000/add', - 'indexer':'http://192.168.100.56:82' + 'postTweetUrl':'http://192.168.100.14:5001', + 'indexer':'http://localhost:5000' } --- a/static/tree.css +++ b/static/tree.css @@ -1,104 +1,26 @@ -a { - text-decoration:none; - color:#23A4FF; -} +v\:* {behavior:url(#default#VML);} +#map {border: 1px solid #888;} -/* #right-container { */ -/* height:300px; */ -/* /\* overflow-y:scroll; *\/ */ -/* } */ - -/* #right-container { */ -/* margin-left:86%; */ -/* margin-top:-25%; */ -/* width:184.5px; */ -/* color:#686c70; */ -/* text-align: left; */ -/* overflow: auto; */ -/* border-bottom:1px solid #ddd; */ -/* font-size:18px; */ -/* line-height:1.5em; */ -/* } */ - - -/* #right-container h4{ */ -/* text-indent:8px; */ -/* } */ - -/* #center-container { */ -/* width:30%; */ -/* margin-left:55%; */ -/* color:#ccc; */ -/* margin-top:1.2%; */ -/* } */ - -.text { - margin: 7px; +.modal { + width: 1024px; + left: 33%; } - -/* #inner-details { */ -/* font-size:0.8em; */ -/* list-style:none; */ -/* } */ - -/* #log { */ -/* top:10px; */ -/* font-size:1.0em; */ -/* font-weight:bold; */ -/* color:#23A4FF; */ -/* } */ - - -#infovis { - position:relative; - top:6%; - left:20%; - width:60%; - height:80%; - /* overflow:hidden; */ - background-color:#aaa; +#stats { + position: relative; + float: left; + width: 150px; + height: 400px; + padding: 5px; + border: 1px solid #999; + overflow: auto; } - -/* #infovis-canvas { */ -/* position:absolute; */ -/* top:250px; */ -/* } */ -/* #infonar { */ -/* position:relative; */ -/* top:2%; */ -/* left:0; */ -/* width:35%; */ -/* height:90%; */ -/* overflow:show; */ -/* /\* color:#000; *\/ */ -/* /\* background-color: rgba(0,0,0,0.5); *\/ */ -/* } */ - -/* #narrations-div { */ -/* position:fixed; */ -/* top:5%; */ -/* bottom:2% */ -/* right:0.1%; */ -/* width:30%; */ -/* height:93%; */ -/* overflow:show; */ -/* background-color: rgba(0,0,0,0.5); */ -/* z-index:999999999; */ -/* } */ -/*TOOLTIPS*/ -.tip { - color: #fff; - width: 140px; - background-color: rgba(0,0,0,1); - border:1px solid #ccc; - -moz-box-shadow:#555 2px 2px 8px; - -webkit-box-shadow:#555 2px 2px 8px; - -o-box-shadow:#555 2px 2px 8px; - box-shadow:#555 2px 2px 8px; - opacity:1; - /* filter:alpha(opacity=90); */ - font-size:12px; - font-family:Verdana, Geneva, Arial, Helvetica, sans-serif; - padding:7px; +#infovis { + position: relative; + top: 0px; + left: 30px; + width: 800px; + height: 400px; + overflow: hidden; + background-color: #707d48; } --- a/static/tree.js +++ b/static/tree.js @@ -1,109 +1,268 @@ -var labelType, useGradients, nativeTextSupport, animate, ht, tree_json; - +var labelType, animate, useGradients, nativeTextSupport, RGraph; (function() { - var ua = navigator.userAgent, - iStuff = ua.match(/iPhone/i) || ua.match(/iPad/i), - typeOfCanvas = typeof HTMLCanvasElement, - nativeCanvasSupport = (typeOfCanvas == 'object' || typeOfCanvas == 'function'), - textSupport = nativeCanvasSupport + var ua = navigator.userAgent, + iStuff = ua.match(/iPhone/i) || ua.match(/iPad/i), + typeOfCanvas = typeof HTMLCanvasElement, + nativeCanvasSupport = (typeOfCanvas == 'object' || typeOfCanvas == 'function'), + textSupport = nativeCanvasSupport && (typeof document.createElement('canvas').getContext('2d').fillText == 'function'); - //I'm setting this based on the fact that ExCanvas provides text support for IE - //and that as of today iPhone/iPad current text support is lame - labelType = (!nativeCanvasSupport || (textSupport && !iStuff))? 'Native' : 'HTML'; - nativeTextSupport = labelType == 'Native'; - useGradients = nativeCanvasSupport; - animate = !(iStuff || !nativeCanvasSupport); + //I'm setting this based on the fact that ExCanvas provides text support for IE + //and that as of today iPhone/iPad current text support is lame + labelType = (!nativeCanvasSupport || (textSupport && !iStuff))? 'Native' : 'HTML'; + nativeTextSupport = labelType == 'Native'; + useGradients = nativeCanvasSupport; + animate = !(iStuff || !nativeCanvasSupport); +})(); - //load JSON data. - // FIXME: the url is hardcoded, maybe you have to change it - // if the file is a variable one - $.getJSON('static/old.json', function(json) { - console.log('json', json); - tree_json = json; - inits(); - }); +var ontology_json; -})(); +function initAnnotationTree() { + //Log.write('Loading ontology file'); + $('#annotation-tree').modal(); + $('#annotation-tree').on('shown', function() { + loadOntologyJSON(); + }); +} -function inits() { - var infovis = document.getElementById('infovis'); - var w = infovis.offsetWidth + 500; var h = infovis.offsetHeight + 385; +function initNodeListEvents() { +// register event handler for list of nodes that comes in the stats box. +// click on the nodes in the stats box will center them in the graph and +// update the stats box. + $('.list-nodes').unbind('click'); + $('.list-nodes').click(function(event) { + var id = $(event.currentTarget).attr('id').split('-')[1]; + var node = RGraph.graph.getNode(id); + centerNode(event, node); + }); +} - //init Hypertree - ht = new $jit.Hypertree({ - //id of the visualization container - injectInto: 'infovis', - //canvas width and height - width: w, - height: h, - //Change node and edge styles such as - //color, width and dimensions. - Node: { - dim: 2.5, - color: "#555" - }, - Edge: { - lineWidth: 1, - color: "#222" - }, +function loadOntologyJSON() { + // if the file is already loaded, no need to load again + if(typeof ontology_json === 'object') { + drawRGraph(); + return; + } + console.log('Loading ontology file'); + var url = 'static/graphs/Hampi_GirijaKalyana.json' + $.ajax({ + type: 'GET', + url: url, + dataType: 'json', + success: function(data) { + console.log('Ontology JSON loaded'); + ontology_json = data; + drawRGraph(); + }, + error: function(xhr, errtype, errtext) { + console.log('Could not load Ontology JSON!'); + console.log(errtype, ':', errtext); + } + }); +} - // On hover - Tips: { - enable: false, +var Log = { + elem: document.getElementById('status'), + write: function(msg) { + this.elem.innerHTML = msg; + } +}; - onShow: function(tip, node) { - ht.tips.config.offsetX = "10"; - ht.tips.config.offsetY = "10"; -// tip.addEventListener("click", alert('hello'), false); - tip.innerHTML = "