3 if (typeof (console) === 'undefined') console = { debug: function() {} }; // mock console.debug
5 function Registration($resource){
8 name: '', surname: '', inst: '', email: '',
10 type: '', // just attending
14 authors:[ { name:'', surname:'', inst:'', email:'' } ],
16 symposium: { organizers: [ {name:'', surname:'', inst:'', email:'' } ], work_nr: 1, },
19 this.Registration = $resource( '/data/conference/Registration/:id', { id:'' } );
20 this.Symposium = $resource( '/data/conference/Symposium/:id', { id:'' } );
22 this.$watch('$location.hashPath', this.hash_change);
24 Registration.$inject=['$resource'];
26 Registration.prototype = {
27 hash_change: function() {
28 var id = this.$location.hashPath;
29 console.debug( 'hash_change', id, this.registration.$id );
30 if ( id != this.registration.$id ) {
33 this.registration = this.Registration.get({ id: id }, function(registration) {
34 self.last_saved = angular.copy(registration);
35 if ( registration.type == 'symposium' ) {
36 var s_id = registration.symposium.$id || registration.$id;
37 // first registration doesn't have symposium.$id, but we used same $id
38 console.debug( 'load symposium ', s_id );
39 self.symposium = self.Symposium.get({ id: s_id });
47 console.debug( this.Registration );
48 var current_symposium = null;
49 var current_person = null;
50 if ( this.registration && this.registration.type == 'symposium' ) {
51 current_symposium = this.registration.symposium;
52 current_person = this.registration.person;
53 if ( this.registration.$id ) current_symposium.work_nr++; // only if saved
54 console.debug( 'current_symposium', current_symposium, this.registration )
56 this.registration = new this.Registration( this.master );
57 if ( current_symposium ) {
58 this.registration.symposium = current_symposium;
59 this.registration.type = 'symposium';
60 this.registration.person = current_person;
63 console.debug( 'reset', current_symposium, this.registration, this.$location.hashPath );
67 this.registration.$save(function(registration){
68 self.$location.hashPath = registration.$id;
70 // save symposium to separate resource
71 if ( registration.type == 'symposium' ) {
72 if ( ! self.symposium ) {
73 self.registration.symposium.$id = registration.$id; // reuse $id of first work for symposium
74 self.symposium = new self.Symposium( registration.symposium );
75 self.symposium.works = [];
77 self.symposium.works[ work.symposium.work_nr - 1 ] = registration.work;
78 console.debug('save_symposium', self.symposium );
79 self.symposium.$save();
82 self.last_saved = angular.copy(registration);
91 <style type="text/css">
131 .authors-label .name, .authors-label .surname, .authors-label .inst, .authors-label .email {
138 .name, .surname, .email {
169 border: solid 1px #dedede;
174 input:focus, textarea:focus
180 border: 1px solid #46d0fe;
183 input.ng-validation-error {
184 border: 1px solid #D74F25;
185 border: 1px solid #FF6666;
186 border: 1px solid #FF9966;
187 border: 1px solid #EDC8BC;
207 text-decoration: none;
224 <h1>Registration and Proposal Submission</h1>
226 <div ng:controller="Registration" ng:init="$window.$root = this;">
228 <div id="registration">
230 <input class="name" name="registration.person.name" ng:required>
231 <input class="name" name="registration.person.surname" ng:required>
233 <input name="registration.person.inst">
234 <input name="registration.person.email" ng:validate="email">
238 <div id="submission">
240 <h2>Type of conference submission:</h2>
242 <input type="radio" name="registration.type" value="">Just attending conference<br/>
243 <input type="radio" name="registration.type" value="symposium">Symposia<br/>
244 <input type="radio" name="registration.type" value="lecture">Oral presentation<br/>
245 <input type="radio" name="registration.type" value="poster">Poster presentation<br/>
246 <input type="radio" name="registration.type" value="round">Round table discussion<br/>
248 <div id="submit_work" ng:show="registration.type">
250 <div ng:show="registration.type == 'symposium'" style="background:#f0f0f0">
252 <label>Topic of symposium: <input name="registration.symposium.title" size="60" ng:required></label><br/>
254 <label>Summary: <br/>
255 <textarea name="registration.symposium.abstract" cols="50" rows="5"></textarea>
260 <div ng:repeat="organizer in registration.symposium.organizers">
261 [<a href="" ng:click="registration.symposium.organizer.$remove(author)">X</a>]
262 <input name="organizer.name" ng:required>
263 <input name="organizer.surname" ng:required>
264 <input name="organizer.inst" >
265 <input name="organizer.email" ng:required>
267 [<a href="" ng:click="registration.symposium.organizer.$add()">Add another organizer</a>]
272 <div ng:show="symposium">
273 Works which are part of this symposium:
275 <li ng:repeat="w in symposium.works"><a href="#{{w.$id}}">{{w.title}}</a></li>
280 <h2>Autors<span ng:show="registration.type == 'symposium'"> of {{registration.symposium.work_nr}}. work </span></h2>
282 <div ng:repeat="author in registration.work.authors">
283 [<a href="" ng:click="registration.work.authors.$remove(author)">X</a>]
284 <input name="author.name" ng:required>
285 <input name="author.surname" ng:required>
286 <input name="author.inst" >
287 <input name="author.email" ng:required>
289 [<a href="" ng:click="registration.work.authors.$add()">Add another author</a>]
293 <label>Title: <input name="registration.work.title" size="60" ng:required></label><br/>
296 <textarea name="registration.work.abstract" cols="50" rows="5"></textarea>
304 <span ng:show="$invalidWidgets.visible() == 0">
305 <input type="submit" value="Save" ng:click="save();" ng:show="! last_saved.$equals(registration)">
306 <input type="reset" value="Add another work" ng:click="reset()" ng:show="registration && registration.$id">
309 <b ng:show="$invalidWidgets.visible() > 0" style="color:#800">{{$invalidWidgets.visible()}} errors to fix in submission form</b>
313 <div ng:show="registration.$id">
314 Permalink to <a href="#{{registration.$id}}">DRZB2011 registration</a> which you can bookmark
317 </div><!-- registration.type == just attending -->
321 {{$window.location.href}}
323 registration = {{registration}}
325 dirty={{! last_saved.$equals(registration)}}
327 last_saved = {{last_saved}}
332 registration.$id={{registration.$id}}