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 last = this.registration;
49 if ( last && last.type == 'symposium' ) {
50 if ( last.$id ) last.symposium.work_nr++; // only if saved
52 this.registration = new this.Registration( this.master );
54 this.registration.category = last.category;
55 this.registration.type = last.type;
56 this.registration.person = last.person;
58 if ( last.type == 'symposium' )
59 this.registration.symposium = last.symposium;
62 console.debug( 'reset', this.registration, this.$location.hashPath, last );
66 this.registration.$save(function(registration){
67 self.$location.hashPath = registration.$id;
69 // save symposium to separate resource
70 if ( registration.type == 'symposium' ) {
71 if ( ! self.symposium ) {
72 self.registration.symposium.$id = registration.$id; // reuse $id of first work for symposium
73 self.symposium = new self.Symposium( registration.symposium );
74 self.symposium.works = [];
76 registration.work.$id = registration.$id; // preserve $id
77 self.symposium.works[ registration.symposium.work_nr - 1 ] = registration.work;
78 console.debug('save_symposium', self.symposium );
79 self.symposium.$save();
82 self.last_saved = angular.copy(registration);
87 angular.validator.max_length = function(input, len) {
88 var ok = input.length <= len;
89 console.debug( 'max_length', ok, input.length, len );
90 return ok ? '' : 'must be shorter than '+len+' characters';
96 <style type="text/css">
153 .labelTop .pname, .labelTop .name, .labelTop .surname, .labelTop .pinst, .labelTop .email, .labelTop .city, .labelTop .address, .labelTop .contact {
160 .pname, .name, .surname, .email {
200 border: solid 1px #dedede;
205 input:focus, textarea:focus
211 border: 1px solid #46d0fe;
214 input.ng-validation-error {
215 border: 1px solid #D74F25;
216 border: 1px solid #FF6666;
217 border: 1px solid #EDC8BC;
218 border: 1px solid #FF9966;
219 border: 1px solid #EAB3A2;
239 text-decoration: none;
263 <h1>Registration and Proposal Submission</h1>
265 <div ng:controller="Registration" ng:init="$window.$root = this;">
267 <div id="choose" ng:show="! registration.symposium.$id">
268 <h2>Please choose:</h2>
269 <input type="radio" name="registration.category" value="participant">Just attending the conference<br/>
270 <input type="radio" name="registration.category" value="submission">I want to submit a work<br/>
273 <div id="submission" ng:show="registration.category == 'submission'">
274 <div ng:show="! registration.symposium.$id">
275 <h2>Choose submittion type:</h2>
276 <input type="radio" name="registration.type" value="symposium" ng:required>Symposia<br/>
277 <input type="radio" name="registration.type" value="lecture" ng:required>Oral presentation<br/>
278 <input type="radio" name="registration.type" value="poster" ng:required>Poster presentation<br/>
279 <input type="radio" name="registration.type" value="round" ng:required>Round table discussion<br/>
282 <div id="participant" ng:show="registration.category == 'participant' || registration.type">
283 <h2>Participant Registration</h2>
284 <div class="labelTop">
285 <div class="pname">First name</div>
286 <div class="pname">Surname</div>
288 <div style="clear: both">
289 <input class="pname" name="registration.person.name" ng:required>
290 <input class="pname" name="registration.person.surname">
292 <div class="labelTop">
293 <div class="pinst">Institution</div>
295 <div style="clear: both">
296 <input class="pinst" name="registration.person.inst">
298 <div class="labelTop">
299 <div class="address">Address</div>
301 <div style="clear: both">
302 <input class="address" name="registration.person.address1">
303 <input class="address" name="registration.person.address2">
305 <div class="labelTop">
306 <div class="city">City</div>
307 <div class="city">ZIP</div>
308 <div class="city">Country</div>
310 <div style="clear: both">
311 <input class="city" name="registration.person.city">
312 <input class="city" name="registration.person.zip">
313 <input class="city" name="registration.person.country">
315 <div class="labelTop">
316 <div class="contact">E-mail</div>
317 <div class="contact">Phone number</div>
319 <div style="clear: both">
320 <input class="contact" name="registration.person.email" ng:validate="email" ng:required>
321 <input class="contact" name="registration.person.phone">
327 <div id="work" ng:show="registration.type">
328 <div ng:show="registration.type == 'symposium'">
330 <h2>Symposia Submission</h2>
331 <label>Topic:</label>
332 <input class="fl1" name="registration.symposium.title" ng:required>
333 <label>Organizer:</label>
335 <div class="fl fl2">First name</div><div class="fl fl2">Surname</div><div class="fl fl3">Institution</div><div class="fl fl2">E-mail</div>
337 <div class="flClear" ng:repeat="organizer in registration.symposium.organizers">
338 <input class="fl2" name="organizer.name" ng:required>
339 <input class="fl2" name="organizer.surname" ng:required>
340 <input class="fl3" name="organizer.inst" >
341 <input class="fl2" name="organizer.email" ng:required>
342 <a href="" ng:click="registration.symposium.organizers.$remove(organizer)">X</a>
344 <a class="addPerson" href="" ng:click="registration.symposium.organizers.$add()">Add another organizer</a>
345 <label>Summary:</label>
346 <textarea class="fl1" name="registration.symposium.abstract" rows="5" ng:validate="max_length:2000"></textarea>
347 <div ng:show="symposium">
348 <label>List of already submitted works</label>
350 <li ng:repeat="w in symposium.works">
351 <a ng:show="registration.$id != w.$id" href="#{{w.$id}}" >{{w.title}}</a>
352 <b ng:show="registration.$id == w.$id">{{w.title}}</b>
357 <h2 ng:show="registration.type == 'symposium'">Work no. {{registration.symposium.work_nr}}. in <i>{{registration.symposium.title}}</i> </h2>
358 <h2 ng:show="registration.type == 'lecture'">Oral Presentation Sumbission</h2>
359 <h2 ng:show="registration.type == 'poster'">Poster Presentation Sumbission</h2>
360 <h2 ng:show="registration.type == 'round'">Round Table Disscussion Sumbission</h2>
362 <label>Title:</label>
363 <input class="fl1" name="registration.work.title" ng:required>
364 <label>Authors</label>
366 <div class="fl fl2">First name</div><div class="fl fl2">Surname</div><div class="fl fl3">Institution</div><div class="fl fl2">E-mail</div>
368 <div class="flClear" ng:repeat="author in registration.work.authors">
369 <input class="fl2" name="author.name" ng:required>
370 <input class="fl2" name="author.surname" ng:required>
371 <input class="fl3" name="author.inst" >
372 <input class="fl2" name="author.email" ng:required>
373 <a href="" ng:click="registration.work.authors.$remove(author)">X</a>
375 <a class="addPerson" href="" ng:click="registration.work.authors.$add()">Add another author</a>
378 <label>Summary:</label>
379 <textarea class="fl1" name="registration.work.abstract" rows="5" ng:validate="max_length:2000"></textarea>
381 <div ng:show="registration.$id && registration.type == 'symposium'" class="saved">
382 <i>{{registration.symposium.work_nr}}. {{registration.work.title}}</i> has been submited successfully.<br>
386 <div id="buttons" ng:show="registration.category == 'participant' || registration.type">
388 <div id="buttons" ng:show="registration.category == 'participant' || registration.type">
389 <span ng:show="$invalidWidgets.visible() == 0">
390 <input type="submit" value="Save" ng:click="save();" ng:show="! last_saved.$equals(registration)">
391 <span ng:show="registration.work && registration.work.$id">
392 <input type="reset" value="Add another work" ng:click="reset()">
393 or <a href="http://psihologija.ffzg.hr/drzb2011/">go to conference home page</a></span>.<br>
396 <div ng:show="$invalidWidgets.visible() > 0" style="color:red; margin-top: 20px">Please fill all required fields ({{$invalidWidgets.visible()}} fields left).
400 <div ng:show="registration.$id" class="saved">
401 <span ng:show="registration.category == 'participant'">Your registration has been submitted successfully.<br><br>
402 Please review your data, correct and save if needed or <a href="http://psihologija.ffzg.hr/drzb2011/">go to conference home page</a>.<br><br>
406 <input type="reset" value="Another work proposal to submit?" ng:click="reset()" ng:show="registration.$id">
409 <div ng:show="registration.$id">
410 Permalink to <a href="#{{registration.$id}}">DRZB2011 registration</a> which you can bookmark
416 {{$window.location.href}}
418 registration = {{registration}}
420 dirty={{! last_saved.$equals(registration)}}
422 last_saved = {{last_saved}}
426 symposium = {{symposium}}
429 registration.$id={{registration.$id}}