3 if (typeof (console) === 'undefined') console = { debug: function() {} }; // mock console.debug
5 function Registration($resource){
7 name: '', surname: '', inst: '', email: '',
13 authors:[ { name:'', surname:'', inst:'', email:'' } ],
15 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.work.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 current_symposium = null;
48 if ( this.registration && this.registration.work.type == 'symposium' ) {
49 current_symposium = this.registration.symposium;
50 if ( this.registration.$id ) current_symposium.work_nr++; // only if saved
51 console.debug( 'current_symposium', current_symposium, this.registration )
53 this.registration = new this.Registration( this.master );
54 if ( current_symposium ) {
55 this.registration.symposium = current_symposium;
56 this.registration.work.type = 'symposium';
59 console.debug( 'reset', current_symposium, this.registration, this.$location.hashPath );
63 this.registration.$save(function(registration){
64 self.$location.hashPath = registration.$id;
66 // save symposium to separate resource
67 if ( registration.work.type == 'symposium' ) {
68 if ( ! self.symposium ) {
69 self.registration.symposium.$id = registration.$id; // reuse $id of first work for symposium
70 self.symposium = new self.Symposium( registration.symposium );
71 self.symposium.works = [];
73 self.symposium.works[ work.symposium.work_nr - 1 ] = registration.work;
74 console.debug('save_symposium', self.symposium );
75 self.symposium.$save();
78 self.last_saved = angular.copy(registration);
87 <style type="text/css">
127 .authors-label .name, .authors-label .surname, .authors-label .inst, .authors-label .email {
134 .name, .surname, .email {
165 border: solid 1px #dedede;
170 input:focus, textarea:focus
176 border: 1px solid #46d0fe;
179 input.ng-validation-error {
180 border: 1px solid #D74F25;
181 border: 1px solid #FF6666;
182 border: 1px solid #FF9966;
183 border: 1px solid #EDC8BC;
203 text-decoration: none;
220 <h1>Registration and Proposal Submission</h1>
222 <div ng:controller="Registration" ng:init="$window.$root = this;">
224 <div id="registration">
226 <input class="name" name="registration.name" ng:required>
227 <input class="name" name="registration.surname" ng:required>
229 <input name="registration.inst">
230 <input name="registration.email" ng:validate="email">
234 <div id="submission">
236 <h2>Type of conference submission:</h2>
238 <input type="radio" name="registration.work.type" value="symposium">Symposia<br/>
239 <input type="radio" name="registration.work.type" value="lecture">Oral presentation<br/>
240 <input type="radio" name="registration.work.type" value="poster">Poster presentation<br/>
241 <input type="radio" name="registration.work.type" value="round">Round table discussion<br/>
244 <div ng:show="registration.work.type == 'symposium'" style="background:#f0f0f0">
246 <label>Topic of symposium: <input name="registration.symposium.title" size="60" ng:required></label><br/>
248 <label>Summary: <br/>
249 <textarea name="registration.symposium.abstract" cols="50" rows="5"></textarea>
254 <div ng:repeat="organizer in registration.symposium.organizers">
255 [<a href="" ng:click="registration.symposium.organizer.$remove(author)">X</a>]
256 <input name="organizer.name" ng:required>
257 <input name="organizer.surname" ng:required>
258 <input name="organizer.inst" >
259 <input name="organizer.email" ng:required>
261 [<a href="" ng:click="registration.symposium.organizer.$add()">Add another organizer</a>]
266 <div ng:show="symposium">
267 Works which are part of this symposium:
269 <li ng:repeat="w in symposium.works"><a href="#{{w.$id}}">{{w.title}}</a></li>
274 <h2>Autors<span ng:show="registration.work.type == 'symposium'"> of {{registration.symposium.work_nr}}. work </span></h2>
276 <div ng:repeat="author in registration.work.authors">
277 [<a href="" ng:click="registration.work.authors.$remove(author)">X</a>]
278 <input name="author.name" ng:required>
279 <input name="author.surname" ng:required>
280 <input name="author.inst" >
281 <input name="author.email" ng:required>
283 [<a href="" ng:click="registration.work.authors.$add()">Add another author</a>]
288 <label>Title: <input name="registration.work.title" size="60" ng:required></label><br/>
291 <textarea name="registration.work.abstract" cols="50" rows="5"></textarea>
299 <span ng:show="$invalidWidgets.visible() == 0">
300 <input type="submit" value="Save" ng:click="save();" ng:show="! last_saved.$equals(registration)">
301 <input type="reset" value="Add another work" ng:click="reset()" ng:show="registration && registration.$id">
304 <b ng:show="$invalidWidgets.visible() > 0" style="color:#800">{{$invalidWidgets.visible()}} errors to fix in submission form</b>
308 <div ng:show="registration.$id">
309 Permalink to <a href="#{{registration.$id}}">DRZB2011 registration</a> which you can bookmark
314 {{$window.location.href}}
316 registration = {{registration}}
318 dirty={{! last_saved.$equals(registration)}}
320 last_saved = {{last_saved}}
325 registration.$id={{registration.$id}}