136 } |
136 } |
137 } |
137 } |
138 }; |
138 }; |
139 } |
139 } |
140 |
140 |
141 $scope.sendAnnotation = function(eventCode, c){ |
141 $scope.sendAnnotation = function(label, code, c){ |
142 if($scope.username==='' || typeof $scope.username==='undefined'){ |
142 if($scope.username==='' || typeof $scope.username==='undefined'){ |
143 showAlert('Vous devez indiquer un nom d\'utilisateur.', false); |
143 showAlert('Vous devez indiquer un nom d\'utilisateur.', false); |
144 return; |
144 return; |
145 } |
145 } |
146 if(eventCode==='' || typeof eventCode==='undefined'){ |
146 if(label==='' || typeof label==='undefined'){ |
147 showAlert('Vous devez indiquer un nom de catégorie.', false); |
147 showAlert('Vous devez indiquer un nom de catégorie.', false); |
148 return; |
148 return; |
149 } |
149 } |
150 // Send query |
150 // Send query |
151 if (sock) { |
151 if (sock) { |
|
152 if(typeof code==='undefined' || code===''){ |
|
153 code = window.S(label).slugify().s; |
|
154 } |
152 var new_annot = { |
155 var new_annot = { |
153 categories : eventCode, |
156 category: {code: code, label: label}, |
154 user : $scope.username |
157 user : $scope.username |
155 }; |
158 }; |
156 sock.send(JSON.stringify(new_annot)); |
159 sock.send(JSON.stringify(new_annot)); |
157 if(context.logging===true){ |
160 if(context.logging===true){ |
158 log('Sent: ' + JSON.stringify(new_annot)); |
161 log('Sent: ' + JSON.stringify(new_annot)); |
170 } |
173 } |
171 } |
174 } |
172 }; |
175 }; |
173 |
176 |
174 // Interface management |
177 // Interface management |
175 $scope.selectLevel = function(eventCode, c){ |
178 $scope.selectLevel = function(label, code, c){ |
176 if(typeof c==='undefined'){ |
179 if(typeof c==='undefined'){ |
177 $scope.returnVisStyle = {visibility:'hidden'}; |
180 $scope.returnVisStyle = {visibility:'hidden'}; |
178 $scope.selectedlevel = false; |
181 $scope.selectedlevel = false; |
179 return; |
182 return; |
180 } |
183 } |