annot-server/webapp/templates/annotviz.html
changeset 131 0bb70072a56f
parent 119 e6605fecb175
child 132 16c2ba3b02c3
--- a/annot-server/webapp/templates/annotviz.html	Fri Jan 23 01:08:34 2015 +0100
+++ b/annot-server/webapp/templates/annotviz.html	Fri Jan 23 02:00:19 2015 +0100
@@ -18,63 +18,9 @@
     <script src="{{ config['STATIC_URL'] }}/js/annotviz.min.js"></script>
     <script>
 
-    var PIXI = require('pixi');
-    var annotCategories = [
-        {
-            "ts": 1421928213000,
-            "colors": {
-                "transgressions": "#b90000",
-                "rythmique": "#af931e",
-                "narration": "#4bdd71",
-                "relation": "#1c28ba"
-            },
-            "order": [
-                "transgressions",
-                "rythmique",
-                "narration",
-                "relation"
-            ],
-            "defaultColor": "#536991"
-        }
-    ];
-
-    function getAnnotCategories(ecode, serverUrl) {
-
-        var url = serverUrl+"/p/api/v1/event/" + ecode;
-
-        var jsonLoader = new PIXI.JsonLoader(url, true);
-        jsonLoader.on('loaded', function(res) {
-            var data = res.target.json;
-
-            while(annotCategories.length > 0) {
-                annotCategories.pop();
-            }
-
-            data.sessions.forEach(function(session) {
-                var annotCat = {
-                    ts: session.start_ts === null ? new Date(0) : Date.parse(session.start_ts),
-                    colors: {}
-                }
-                var categoriesJson = session.categories_json;
-                annotCat.order = categoriesJson.order;
-                categoriesJson.categories.forEach(function(cat) {
-                    annotCat.colors[cat.code] = annotviz.colorToHex(cat.color);
-                });
-                annotCat.defaultColor = categoriesJson.defaultColor || "#536991";
-                annotCategories.push(annotCat);
-            });
-            console.log(JSON.stringify(annotCategories, null, '  '));
-        });
-
-        jsonLoader.load();
-    }
-
-
-
     var pianorollChannel  = 'PIANOROLL';
     var annotationChannel = 'ANNOT';
     var eventCode = '{{event.code}}';
-    getAnnotCategories(eventCode, 'http://' + window.location.hostname + ':8080');
     var wsUri = 'ws://' + window.location.hostname + ':8090/broadcast';
 
     wsUriPianoroll = wsUri + '?channel=' + pianorollChannel + '&event_code=' + eventCode;
@@ -88,13 +34,15 @@
 
 
     var annotsvizview = new annotviz.AnnotsVizView({
+        urlCategories: serverUrl + "/p/api/v1/event/" + eventCode,
         logger: logger,
         stageView: stageView,
         wsPianoroll: new annotviz.WsWrapper(wsUriPianoroll, logger),
         wsAnnot: new annotviz.WsWrapper(wsUriAnnotation, logger),
-        annotCategories: annotCategories,
-        timeBegin: 1421919000000,
-    	timeEnd: 1421951400000
+        timeBegin: Date.parse("2015-01-23T09:30:00+01:00"),
+        timeEnd: Date.parse("2015-01-23T18:30:00+01:00"),
+        eventCode: eventCode,
+        channel: annotationChannel        
     });