3 if (typeof (console) === 'undefined') console = { debug: function() {} }; // mock console.debug
5 function Registration($resource){
8 name: '', surname: '', inst: '', email: ''
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.type = last.type;
54 this.registration.person = last.person;
56 if ( last.type == 'symposium' )
57 this.registration.symposium = last.symposium;
59 this.last_saved = angular.copy( this.registration ); // FIXME was: {};
60 console.debug( 'reset', this.registration, this.$location.hashPath, last );
64 this.registration.$save(function(registration){
65 self.$location.hashPath = registration.$id;
67 // save symposium to separate resource
68 if ( registration.type == 'symposium' ) {
69 if ( ! self.symposium ) {
70 self.registration.symposium.$id = registration.$id; // reuse $id of first work for symposium
71 self.symposium = new self.Symposium( registration.symposium );
72 self.symposium.works = [];
74 registration.work.$id = registration.$id; // preserve $id
75 self.symposium.works[ registration.symposium.work_nr - 1 ] = registration.work;
76 console.debug('save_symposium', self.symposium );
77 self.symposium.$save();
80 self.last_saved = angular.copy(registration);
85 angular.validator.max_length = function(input, len) {
86 var ok = input.length <= len;
87 console.debug( 'max_length', ok, input.length, len );
88 return ok ? '' : 'must be shorter than '+len+' characters';
94 <style type="text/css">
116 /* margin-bottom: 6px; */
120 text-decoration: none;
122 background: url(http://mjesec.ffzg.hr/drzb2011/images/kvadrat.gif) no-repeat left;
123 border-bottom: 1px solid #CCC;
129 border-bottom: 2px solid #D74F25;
130 border-bottom: 1px solid #46d0fe;
187 input, textarea, .gohome {
190 border: solid 1px #dedede;
195 input:focus, textarea:focus
201 /* border: 1px solid #46d0fe; */
204 .ng-validation-error {
205 border: 1px solid #FF6666;
206 border: 1px solid #EDC8BC;
207 border: 1px solid #FF9966;
208 border: 1px solid #EAB3A2;
209 border: 1px solid #D74F25;
210 border: 1px solid #DC6844;
211 border: 1px solid #DE7F61;
228 text-decoration: none;
232 .button input:hover, .gohome:hover {
240 text-decoration: none;
247 text-decoration: none;
273 <h1>Registration and Proposal Submission</h1>
275 <div ng:controller="Registration" ng:init="$window.$root = this;">
278 <div id="participant">
279 <h2>Contact Information</h2>
280 <div class="labelTop">
281 <div class="input input4">First name</div>
282 <div class="input input4">Surname</div>
284 <div style="clear: both">
285 <input class="input4" name="registration.person.name" ng:required>
286 <input class="input4" name="registration.person.surname" ng:required>
288 <div class="labelTop">
289 <div class="input input5">Institution</div>
291 <div style="clear: both">
292 <input class="input5" name="registration.person.inst">
294 <div class="labelTop">
295 <div class="input input5">Address</div>
297 <div style="clear: both">
298 <input class="input5" name="registration.person.address1" ng:required>
300 <div class="labelTop">
301 <div class="input input6">City</div>
302 <div class="input input6">ZIP</div>
303 <div class="input input6">Country</div>
305 <div style="clear: both">
306 <input class="input6" name="registration.person.city" ng:required>
307 <input class="input6" name="registration.person.zip">
308 <input class="input6" name="registration.person.country">
310 <div class="labelTop">
311 <div class="input input4">E-mail</div>
312 <div class="input input4">Phone number</div>
314 <div style="clear: both">
315 <input class="input4" name="registration.person.email" ng:validate="email" ng:required>
316 <input class="input4" name="registration.person.phone">
321 <div id="submission">
323 <h2>Registration Type</h2>
324 <label><input type="radio" name="registration.type" value="participant" ng:required>Attendance with no presentation</label>
325 <label><input type="radio" name="registration.type" value="participant" ng:required>Symposium participant</label>
326 <label><input type="radio" name="registration.type" value="symposium" ng:required>Symposium organizer</label>
327 <label><input type="radio" name="registration.type" value="lecture" ng:required>Oral presentation</label>
328 <label><input type="radio" name="registration.type" value="poster" ng:required>Poster presentation</label>
329 <label><input type="radio" name="registration.type" value="round" ng:required>Round table discussion</label>
336 <div id="work" ng:show="registration.type != 'participant'">
337 <div ng:show="registration.type == 'symposium'">
340 <label for="registration.symposium.title">Topic:</label>
341 <input class="input1" name="registration.symposium.title" ng:required>
342 <label>Organizer:</label>
343 <div class="input input2">First name</div><div class="input input2">Surname</div><div class="input input3">Institution</div><div class="input input2">E-mail</div>
344 <div class="clear" ng:repeat="organizer in registration.symposium.organizers">
345 <input class="input2" name="organizer.name" ng:required>
346 <input class="input2" name="organizer.surname" ng:required>
347 <input class="input3" name="organizer.inst" >
348 <input class="input2" name="organizer.email" ng:required ng:validate="email">
349 <a href="" ng:click="registration.symposium.organizers.$remove(organizer)">X</a>
351 <a class="addPerson" href="" ng:click="registration.symposium.organizers.$add()">Add another organizer</a>
352 <label>Summary (2000 characters max.)</label>
353 <textarea class="input1" name="registration.symposium.abstract" rows="10" ng:validate="max_length:2000" ng:required></textarea>
354 <div ng:show="symposium">
355 <label>List of already submitted works</label>
357 <li ng:repeat="w in symposium.works">
358 <a ng:show="registration.$id != w.$id" href="#{{w.$id}}" >{{w.title}}</a>
359 <b ng:show="registration.$id == w.$id">{{w.title}}</b>
366 <h2 ng:show="registration.type == 'symposium'">Symposia paper ({{registration.symposium.work_nr}})</h2>
367 <h2 ng:show="registration.type == 'lecture'">Oral Presentation Sumbission</h2>
368 <h2 ng:show="registration.type == 'poster'">Poster Presentation Sumbission</h2>
369 <h2 ng:show="registration.type == 'round'">Round Table Disscussion Sumbission</h2>
372 <div ng:show="registration.type">
374 <label>Title:</label>
375 <input class="input1" name="registration.work.title" ng:required>
376 <label>Authors</label>
378 <div class="input input2">First name</div><div class="input input2">Surname</div><div class="input input3">Institution</div><div class="input input2">E-mail</div>
380 <div class="clear" ng:repeat="author in registration.work.authors">
381 <input class="input2" name="author.name" ng:required>
382 <input class="input2" name="author.surname" ng:required>
383 <input class="input3" name="author.inst" >
384 <input class="input2" name="author.email" ng:required ng:validate="email">
385 <a href="" ng:click="registration.work.authors.$remove(author)">X</a>
387 <a class="addPerson" href="" ng:click="registration.work.authors.$add()">Add another author</a>
390 <label>Abstract (2000 characters max.):</label>
391 <textarea class="input1" name="registration.work.abstract" rows="5" ng:validate="max_length:2000" ng:required></textarea>
394 </div> <!-- ng:show="registration.type" -->
398 <input type="submit" value="Save" ng:click="save();" ng:show="! last_saved.$equals(registration) && $invalidWidgets.visible() == 0">
401 <div ng:show="$invalidWidgets.visible() > 0" style="color:red; margin-top: 20px">Please fill all required fields correctly ({{$invalidWidgets.visible()}} fields left). Red colored fields call for your attention.
407 <div style="margin-bottom: 40px" ng:show="registration.$id && last_saved.$equals(registration)">
408 <div class="saved" ng:show="registration.type == 'participant'">
409 Your registration has been submitted successfully.
412 <div class="saved" ng:show="registration.type != 'participant'" class="saved">
413 <i>{{registration.work.title}}</i> submitted successfully.
416 Please review your data, correct and save if needed (just start typing and Save button will show automatically).
420 Registration ID: {{registration.$id}}. You can bookmark this page and review it later.
425 <div class="button" ng:show="registration.$id && registration.type != 'participant' && last_saved.$equals(registration)">
426 <input type="reset" value="Submit another paper" ng:click="reset()">
427 <div class="gohome"><a href="http://psihologija.ffzg.hr/drzb2011/">Finish and go to the conference home page</a></div>
431 <div ng:show="registration.$id">
432 Permalink to <a href="#{{registration.$id}}">DRZB2011 registration</a> which you can bookmark
437 <input type=checkbox name=debug style="float: right; clear: both">
438 <pre ng:show="debug">
440 dirty={{! last_saved.$equals(registration)}} invalid={{$invalidWidgets.visible()}}
442 registration = {{registration}}
444 last_saved = {{last_saved}}
448 symposium = {{symposium}}
451 registration.$id={{registration.$id}}