unfold: better management of static files thanks to finders for plugins and third...
[myslice.git] / plugins / pres_view / static / js / dynamic.js
1 function ape_initialize(){
2         client = new APE.Controller();
3 };
4                 
5 function ape_load(){
6         client.load({
7                 identifier: 'action'
8         })
9 }
10
11
12 APE.Controller = new Class({
13         Extends: APE.Client,    
14         Implements: Options,    
15         options: {
16                 container: null
17         },      
18         initialize: function(options){
19                 var j = jQuery.noConflict();
20                 this.setOptions(options);
21                 this.addEvent('load',this.start);
22                 this.onRaw('postmsg', this.onMsg);
23                 this.addEvent('ape_join',this.ape_join);
24                 this.addEvent('ape_leave',this.ape_leave);
25                 this.addEvent('ape_quit',this.ape_quit);
26                 this.addEvent('multiPipeCreate', function( pipe,options) {
27                 console.log(pipe.getPubid());
28                 console.log(options.pipe.properties.name);
29                         var myCookie = Cookie.write(options.pipe.properties.name,pipe.getPubid());
30                         });
31         },
32         
33         start: function(core){
34                 this.core.start({'name': $time().toString()});
35                 channel_name = [];
36                 channel_id = [];
37         },
38         
39
40         
41         ape_join: function(channel_id){
42                 // il faut aussi initialier le tableau du canal
43                 // TODO 
44                 this.core.join(channel_id);             
45         },
46         
47         ape_leave: function(channel_id){
48                 var myCookie = Cookie.read(channel_id);
49                 this.core.left(myCookie);
50                 Cookie.dispose(channel_id);             
51         },
52         
53         ape_quit: function(){
54                 this.core.quit();               
55         },
56         
57         
58         onMsg: function(raw){
59                 /**console.log(raw);
60                 console.log(raw.data.message);
61                 console.log(raw.data.message['ape_position']);
62                 console.log(raw.data.message[0].ape_position[0].latitude);**/
63                 recup_direct(raw,channel_id,"dynamic")
64                 /**switch(raw.data.print_method)
65                 {
66                         case 'line':
67                                 j("#test").append("line");
68                                 g_map_printLine(raw);
69                                 break;
70                         case 'circle':
71                                  j("#test").append("circle");
72                                 //g_map_printCircle(data.item[i]);
73                                 break;
74                         case 'marker':
75                                 j("#test").append("marker");
76                                 g_map_printMarker(raw);
77                                 break;
78                 }**/
79         
80                 
81                 
82                 
83                 
84         }
85         
86         
87         
88         
89 });