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, },
18 this.Registration = $resource( '/data/conference/Registration/:id', { id:'' } );
19 this.Symposium = $resource( '/data/conference/Symposium/:id', { id:'' } );
21 this.$watch('$location.hashPath', this.hash_change);
23 Registration.$inject=['$resource'];
25 Registration.prototype = {
26 hash_change: function() {
27 var id = this.$location.hashPath;
28 console.debug( 'hash_change', id, this.registration.$id );
29 if ( id != this.registration.$id ) {
32 this.registration = this.Registration.get({ id: id }, function(registration) {
33 self.last_saved = angular.copy(registration);
34 if ( registration.type == 'symposium' ) {
35 var s_id = registration.symposium.$id || registration.$id;
36 // first registration doesn't have symposium.$id, but we used same $id
37 console.debug( 'load symposium ', s_id );
38 self.symposium = self.Symposium.get({ id: s_id });
46 console.debug( this.Registration );
47 var last = this.registration;
48 if ( last && last.type == 'symposium' ) {
49 if ( last.$id ) last.symposium.work_nr++; // only if saved
51 this.registration = new this.Registration( this.master );
53 this.registration.category = last.category;
54 this.registration.type = last.type;
55 this.registration.person = last.person;
57 if ( last.type == 'symposium' )
58 this.registration.symposium = last.symposium;
61 console.debug( 'reset', this.registration, this.$location.hashPath, last );
65 this.registration.$save(function(registration){
66 self.$location.hashPath = registration.$id;
68 // save symposium to separate resource
69 if ( registration.type == 'symposium' ) {
70 if ( ! self.symposium ) {
71 self.registration.symposium.$id = registration.$id; // reuse $id of first work for symposium
72 self.symposium = new self.Symposium( registration.symposium );
73 self.symposium.works = [];
75 registration.work.$id = registration.$id; // preserve $id
76 self.symposium.works[ registration.symposium.work_nr - 1 ] = registration.work;
77 console.debug('save_symposium', self.symposium );
78 self.symposium.$save();
81 self.last_saved = angular.copy(registration);
86 angular.validator.max_length = function(input, len) {
87 var ok = input.length <= len;
88 console.debug( 'max_length', ok, input.length, len );
89 return ok ? '' : 'must be shorter than '+len+' characters';
95 <style type="text/css">
152 .labelTop .pname, .labelTop .name, .labelTop .surname, .labelTop .pinst, .labelTop .email, .labelTop .city, .labelTop .address, .labelTop .contact {
159 .pname, .name, .surname, .email {
199 border: solid 1px #dedede;
204 input:focus, textarea:focus
210 border: 1px solid #46d0fe;
213 input.ng-validation-error {
214 border: 1px solid #D74F25;
215 border: 1px solid #FF6666;
216 border: 1px solid #EDC8BC;
217 border: 1px solid #FF9966;
218 border: 1px solid #EAB3A2;
238 text-decoration: none;
262 <h1>Registration and Proposal Submission</h1>
264 <div ng:controller="Registration" ng:init="$window.$root = this;">
267 <div id="choose"> <!-- ng:show="! registration.symposium.$id"> -->
268 <h2>Please choose:</h2>
269 <label><input type="radio" name="registration.category" value="participant" ng:required>Just attending the conference</label>
270 <label><input type="radio" name="registration.category" value="submission">I want to submit a work</label>
274 <div id="participant" ng:show="registration.category">
275 <h2>Contact Information</h2>
276 <div class="labelTop">
277 <div class="pname">First name</div>
278 <div class="pname">Surname</div>
280 <div style="clear: both">
281 <input class="pname" name="registration.person.name" ng:required>
282 <input class="pname" name="registration.person.surname">
284 <div class="labelTop">
285 <div class="pinst">Institution</div>
287 <div style="clear: both">
288 <input class="pinst" name="registration.person.inst">
290 <div class="labelTop">
291 <div class="address">Address</div>
293 <div style="clear: both">
294 <input class="address" name="registration.person.address1">
295 <input class="address" name="registration.person.address2">
297 <div class="labelTop">
298 <div class="city">City</div>
299 <div class="city">ZIP</div>
300 <div class="city">Country</div>
302 <div style="clear: both">
303 <input class="city" name="registration.person.city">
304 <input class="city" name="registration.person.zip">
305 <input class="city" name="registration.person.country">
307 <div class="labelTop">
308 <div class="contact">E-mail</div>
309 <div class="contact">Phone number</div>
311 <div style="clear: both">
312 <input class="contact" name="registration.person.email" ng:validate="email" ng:required>
313 <input class="contact" name="registration.person.phone">
318 <div id="submission" ng:show="registration.category == 'submission'">
320 <h2>Choose submittion type:</h2>
321 <input type="radio" name="registration.type" value="symposium" ng:required>Symposia<br/>
322 <input type="radio" name="registration.type" value="lecture" ng:required>Oral presentation<br/>
323 <input type="radio" name="registration.type" value="poster" ng:required>Poster presentation<br/>
324 <input type="radio" name="registration.type" value="round" ng:required>Round table discussion<br/>
331 <div id="work" ng:show="registration.categegory == 'submission'">
332 <div ng:show="registration.type == 'symposium'">
334 <h2>Symposia Submission</h2>
335 <label>Topic:</label>
336 <input class="fl1" name="registration.symposium.title" ng:required>
337 <label>Organizer:</label>
339 <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>
341 <div class="flClear" ng:repeat="organizer in registration.symposium.organizers">
342 <input class="fl2" name="organizer.name" ng:required>
343 <input class="fl2" name="organizer.surname" ng:required>
344 <input class="fl3" name="organizer.inst" >
345 <input class="fl2" name="organizer.email" ng:required>
346 <a href="" ng:click="registration.symposium.organizers.$remove(organizer)">X</a>
348 <a class="addPerson" href="" ng:click="registration.symposium.organizers.$add()">Add another organizer</a>
349 <label>Summary:</label>
350 <textarea class="fl1" name="registration.symposium.abstract" rows="5" ng:validate="max_length:2000"></textarea>
351 <div ng:show="symposium">
352 <label>List of already submitted works</label>
354 <li ng:repeat="w in symposium.works">
355 <a ng:show="registration.$id != w.$id" href="#{{w.$id}}" >{{w.title}}</a>
356 <b ng:show="registration.$id == w.$id">{{w.title}}</b>
361 <h2 ng:show="registration.type == 'symposium'">Work no. {{registration.symposium.work_nr}}. in <i>{{registration.symposium.title}}</i> </h2>
362 <h2 ng:show="registration.type == 'lecture'">Oral Presentation Sumbission</h2>
363 <h2 ng:show="registration.type == 'poster'">Poster Presentation Sumbission</h2>
364 <h2 ng:show="registration.type == 'round'">Round Table Disscussion Sumbission</h2>
366 <label>Title:</label>
367 <input class="fl1" name="registration.work.title" ng:required>
368 <label>Authors</label>
370 <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>
372 <div class="flClear" ng:repeat="author in registration.work.authors">
373 <input class="fl2" name="author.name" ng:required>
374 <input class="fl2" name="author.surname" ng:required>
375 <input class="fl3" name="author.inst" >
376 <input class="fl2" name="author.email" ng:required>
377 <a href="" ng:click="registration.work.authors.$remove(author)">X</a>
379 <a class="addPerson" href="" ng:click="registration.work.authors.$add()">Add another author</a>
382 <label>Summary:</label>
383 <textarea class="fl1" name="registration.work.abstract" rows="5" ng:validate="max_length:2000"></textarea>
386 <div ng:show="registration.$id" class="saved">
387 <i>{{registration.work.title}}</i> has been submited successfully.<br>
392 <input type="submit" value="Save" ng:click="save();" ng:show="! last_saved.$equals(registration) && $invalidWidgets.visible() == 0">
394 <div ng:show="$invalidWidgets.visible() > 0" style="color:red; margin-top: 20px">Please fill all required fields ({{$invalidWidgets.visible()}} fields left).
400 <div style="margin-bottom: 40px" ng:show="registration.$id && last_saved.$equals(registration)">
401 <div class="saved" ng:show="registration.category == 'participant'">
402 Your registration has been submitted successfully.
404 Please review your data, correct and save if needed or <a href="http://psihologija.ffzg.hr/drzb2011/">go to conference home page</a>.
406 Registration ID: <a href="#{{registration.$id}}">{{registration.$id}}</a>.<br>You can bookmark this page and review it later.
411 <input type="reset" value="Another work proposal to submit?" ng:click="reset()" ng:show="registration.$id && registration.category == 'submission'">
414 <div ng:show="registration.$id">
415 Permalink to <a href="#{{registration.$id}}">DRZB2011 registration</a> which you can bookmark
421 {{$window.location.href}}
423 registration = {{registration}}
425 dirty={{! last_saved.$equals(registration)}}
427 last_saved = {{last_saved}}
431 symposium = {{symposium}}
434 registration.$id={{registration.$id}}