function Registration($resource){
this.master = {
- name: '', surname: '', inst: '', email: '',
-
+ person: {
+ name: '', surname: '', inst: '', email: '',
+ },
+ type: 'participant',
work: {
- type: '',
title: '',
abstract: '',
authors:[ { name:'', surname:'', inst:'', email:'' } ],
},
symposium: { organizers: [ {name:'', surname:'', inst:'', email:'' } ], work_nr: 1, },
};
- this.last_saved = {};
this.Registration = $resource( '/data/conference/Registration/:id', { id:'' } );
this.Symposium = $resource( '/data/conference/Symposium/:id', { id:'' } );
this.reset();
var self = this;
this.registration = this.Registration.get({ id: id }, function(registration) {
self.last_saved = angular.copy(registration);
- if ( registration.work.type == 'symposium' ) {
+ if ( registration.type == 'symposium' ) {
var s_id = registration.symposium.$id || registration.$id;
// first registration doesn't have symposium.$id, but we used same $id
console.debug( 'load symposium ', s_id );
},
reset: function() {
console.debug( this.Registration );
- var current_symposium = null;
- if ( this.registration && this.registration.work.type == 'symposium' ) {
- current_symposium = this.registration.symposium;
- if ( this.registration.$id ) current_symposium.work_nr++; // only if saved
-console.debug( 'current_symposium', current_symposium, this.registration )
+ var last = this.registration;
+ if ( last && last.type == 'symposium' ) {
+ if ( last.$id ) last.symposium.work_nr++; // only if saved
}
this.registration = new this.Registration( this.master );
- if ( current_symposium ) {
- this.registration.symposium = current_symposium;
- this.registration.work.type = 'symposium';
+ if ( last ) {
+ this.registration.type = last.type;
+ this.registration.person = last.person;
+
+ if ( last.type == 'symposium' )
+ this.registration.symposium = last.symposium;
}
- this.last_saved = {};
-console.debug( 'reset', current_symposium, this.registration, this.$location.hashPath );
+ this.last_saved = angular.copy( this.registration ); // FIXME was: {};
+console.debug( 'reset', this.registration, this.$location.hashPath, last );
},
save: function(){
var self = this;
self.$location.hashPath = registration.$id;
// save symposium to separate resource
- if ( registration.work.type == 'symposium' ) {
+ if ( registration.type == 'symposium' ) {
if ( ! self.symposium ) {
self.registration.symposium.$id = registration.$id; // reuse $id of first work for symposium
self.symposium = new self.Symposium( registration.symposium );
self.symposium.works = [];
}
- self.symposium.works[ work.symposium.work_nr - 1 ] = registration.work;
+ registration.work.$id = registration.$id; // preserve $id
+ self.symposium.works[ registration.symposium.work_nr - 1 ] = registration.work;
console.debug('save_symposium', self.symposium );
self.symposium.$save();
}
},
};
+angular.validator.max_length = function(input, len) {
+ var ok = input.length <= len;
+console.debug( 'max_length', ok, input.length, len );
+ return ok ? '' : 'must be shorter than '+len+' characters';
+}
</script>
margin-top: 10px;
font-size: 14px;
font-family: Arial;
- font-weight: normal;
}
h2 {
a {
color: #D74F25;
- font-size: 80%;
-}
-
-.symposium, .work {
- width: 615px;
}
label {
color: #374E5A;
}
-.authors-label .name, .authors-label .surname, .authors-label .inst, .authors-label .email {
+.fl {
color: #afafaf;
float: left;
margin: 2px;
padding: 0 6px;
}
-.name, .surname, .email {
- width: 18%;
+.fl1 {
+ width: 40.8em;
}
-.inst {
- width: 30%;
+.fl2 {
+ width: 8em;
}
-.title, .summary {
- width: 93%;
+.fl3 {
+ width: 13em;
}
-.authors {
+.flClear {
clear: both;
- margin-bottom: 6px;
}
-.authors-label {
- clear: right;
+.labelTop .pname, .labelTop .name, .labelTop .surname, .labelTop .pinst, .labelTop .email, .labelTop .city, .labelTop .address, .labelTop .contact {
+ color: #afafaf;
+ float: left;
+ margin: 2px;
+ padding: 0 6px;
+}
+
+.pname, .name, .surname, .email {
+ width: 10em;
+}
+
+.pinst {
+ width: 21.4em;
+}
+
+.address {
+ width: 14.1em;
}
+.city {
+ width: 9em;
+}
+.contact {
+ width: 10em;
+}
+
+.title, .summary {
+ width: 93%;
+}
-.addNew {
- padding-right: 30px;
+.authors {
+ clear: both;
+ margin-bottom: 6px;
+}
+
+.addPerson {
+ color: #D74F25;
+ color: #EDC8BC;
+ color: #EAB3A2;
+ font-size: 90%;
}
input, textarea
border: 1px solid #46d0fe;
}
-input.ng-validation-error {
+.ng-validation-error {
border: 1px solid #D74F25;
border: 1px solid #FF6666;
- border: 1px solid #FF9966;
border: 1px solid #EDC8BC;
+ border: 1px solid #FF9966;
+ border: 1px solid #EAB3A2;
}
-.warrning {
- color: #FF6666;
-}
-
-.sworks {
- margin-top: 20px;
-}
-
-.save {
- margin-top: 10px;
+#work, #submission {
+ margin-bottom: 20px;
}
-.save input
-{
+.button input {
float: left;
color: #ffffff;
display: block;
background: #d74f25;
}
-.save input:hover
-{
+.button input:hover {
background: #dc6844;
}
+.warrning {
+ color: #FF6666;
+}
+
+.sworks {
+ margin-top: 20px;
+}
+
+
.newWork {
clear: left;
margin-top: 50px;
}
+.saved {
+ color: #D74F25;
+ margin-top: 20px;
+ margin-bottom: 20px;
+}
</style>
<div ng:controller="Registration" ng:init="$window.$root = this;">
-<div id="registration">
-
-<input class="name" name="registration.name" ng:required>
-<input class="name" name="registration.surname" ng:required>
-
-<input name="registration.inst">
-<input name="registration.email" ng:validate="email">
+<div id="participant">
+ <h2>Contact Information</h2>
+ <div class="labelTop">
+ <div class="pname">First name</div>
+ <div class="pname">Surname</div>
+ </div>
+ <div style="clear: both">
+ <input class="pname" name="registration.person.name" ng:required>
+ <input class="pname" name="registration.person.surname" ng:required>
+ </div>
+ <div class="labelTop">
+ <div class="pinst">Institution</div>
+ </div>
+ <div style="clear: both">
+ <input class="pinst" name="registration.person.inst">
+ </div>
+ <div class="labelTop">
+ <div class="address">Address</div>
+ </div>
+ <div style="clear: both">
+ <input class="address" name="registration.person.address1" ng:required>
+ <input class="address" name="registration.person.address2">
+ </div>
+ <div class="labelTop">
+ <div class="city">City</div>
+ <div class="city">ZIP</div>
+ <div class="city">Country</div>
+ </div>
+ <div style="clear: both">
+ <input class="city" name="registration.person.city" ng:required>
+ <input class="city" name="registration.person.zip">
+ <input class="city" name="registration.person.country">
+ </div>
+ <div class="labelTop">
+ <div class="contact">E-mail</div>
+ <div class="contact">Phone number</div>
+ </div>
+ <div style="clear: both">
+ <input class="contact" name="registration.person.email" ng:validate="email" ng:required>
+ <input class="contact" name="registration.person.phone">
+ </div>
</div>
-<div id="submission">
-
-<h2>Type of conference submission:</h2>
-<input type="radio" name="registration.work.type" value="symposium">Symposia<br/>
-<input type="radio" name="registration.work.type" value="lecture">Oral presentation<br/>
-<input type="radio" name="registration.work.type" value="poster">Poster presentation<br/>
-<input type="radio" name="registration.work.type" value="round">Round table discussion<br/>
+<div id="submission">
+ <div>
+ <h2>Please choose:</h2>
+ <label><input type="radio" name="registration.type" value="participant" ng:required>Just attending or my work was submitted by another person</label>
+ <label><input type="radio" name="registration.type" value="symposium" ng:required>Symposia paper</label>
+ <label><input type="radio" name="registration.type" value="lecture" ng:required>Oral presentation</label>
+ <label><input type="radio" name="registration.type" value="poster" ng:required>Poster presentation</label>
+ <label><input type="radio" name="registration.type" value="round" ng:required>Round table discussion</label>
+ </div>
+</div>
-<div ng:show="registration.work.type == 'symposium'" style="background:#f0f0f0">
-<label>Topic of symposium: <input name="registration.symposium.title" size="60" ng:required></label><br/>
-
-<label>Summary: <br/>
-<textarea name="registration.symposium.abstract" cols="50" rows="5"></textarea>
-</label>
-<br/>
-Organizer:
-<div ng:repeat="organizer in registration.symposium.organizers">
-[<a href="" ng:click="registration.symposium.organizer.$remove(author)">X</a>]
-<input name="organizer.name" ng:required>
-<input name="organizer.surname" ng:required>
-<input name="organizer.inst" >
-<input name="organizer.email" ng:required>
+<div id="work" ng:show="registration.type != 'participant'">
+ <div ng:show="registration.type == 'symposium'">
+
+ <h2>Symposia</h2>
+ <label>Topic:</label>
+ <input class="fl1" name="registration.symposium.title" ng:required>
+ <label>Organizer:</label>
+ <div>
+ <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>
+ </div>
+ <div class="flClear" ng:repeat="organizer in registration.symposium.organizers">
+ <input class="fl2" name="organizer.name" ng:required>
+ <input class="fl2" name="organizer.surname" ng:required>
+ <input class="fl3" name="organizer.inst" >
+ <input class="fl2" name="organizer.email" ng:required ng:validate="email">
+ <a href="" ng:click="registration.symposium.organizers.$remove(organizer)">X</a>
+ </div>
+ <a class="addPerson" href="" ng:click="registration.symposium.organizers.$add()">Add another organizer</a>
+ <label>Summary:</label>
+ <textarea class="fl1" name="registration.symposium.abstract" rows="5" ng:validate="max_length:2000" ng:required></textarea>
+ <div ng:show="symposium">
+ <label>List of already submitted works</label>
+ <ol>
+ <li ng:repeat="w in symposium.works">
+ <a ng:show="registration.$id != w.$id" href="#{{w.$id}}" >{{w.title}}</a>
+ <b ng:show="registration.$id == w.$id">{{w.title}}</b>
+ </li>
+ </ol>
+ </div>
+ </div>
+
+
+ <h2 ng:show="registration.type == 'symposium'">Symposia paper ({{registration.symposium.work_nr}})</h2>
+ <h2 ng:show="registration.type == 'lecture'">Oral Presentation Sumbission</h2>
+ <h2 ng:show="registration.type == 'poster'">Poster Presentation Sumbission</h2>
+ <h2 ng:show="registration.type == 'round'">Round Table Disscussion Sumbission</h2>
+
+
+ <div ng:show="registration.type">
+
+ <label>Title:</label>
+ <input class="fl1" name="registration.work.title" ng:required>
+ <label>Authors</label>
+ <div>
+ <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>
+ </div>
+ <div class="flClear" ng:repeat="author in registration.work.authors">
+ <input class="fl2" name="author.name" ng:required>
+ <input class="fl2" name="author.surname" ng:required>
+ <input class="fl3" name="author.inst" >
+ <input class="fl2" name="author.email" ng:required ng:validate="email">
+ <a href="" ng:click="registration.work.authors.$remove(author)">X</a>
+ </div>
+ <a class="addPerson" href="" ng:click="registration.work.authors.$add()">Add another author</a>
+
+
+ <label>Abstract:</label>
+ <textarea class="fl1" name="registration.work.abstract" rows="5" ng:validate="max_length:2000" ng:required></textarea>
+
+
+ </div> <!-- ng:show="registration.type" -->
</div>
-[<a href="" ng:click="registration.symposium.organizer.$add()">Add another organizer</a>]
+<div class="button">
+<input type="submit" value="Save" ng:click="save();" ng:show="! last_saved.$equals(registration) && $invalidWidgets.visible() == 0">
</div>
-<hr>
-
-<div ng:show="symposium">
-Works which are part of this symposium:
-<ol>
-<li ng:repeat="w in symposium.works"><a href="#{{w.$id}}">{{w.title}}</a></li>
-</ol>
+<div ng:show="$invalidWidgets.visible() > 0" style="color:red; margin-top: 20px">Please fill all required fields ({{$invalidWidgets.visible()}} fields left).
</div>
-<h2>Autors<span ng:show="registration.work.type == 'symposium'"> of {{registration.symposium.work_nr}}. work </span></h2>
-
-<div ng:repeat="author in registration.work.authors">
-[<a href="" ng:click="registration.work.authors.$remove(author)">X</a>]
-<input name="author.name" ng:required>
-<input name="author.surname" ng:required>
-<input name="author.inst" >
-<input name="author.email" ng:required>
-</div>
-[<a href="" ng:click="registration.work.authors.$add()">Add another author</a>]
-<hr>
-<label>Title: <input name="registration.work.title" size="60" ng:required></label><br/>
+<div style="margin-bottom: 40px" ng:show="registration.$id && last_saved.$equals(registration)">
+ <div class="saved" ng:show="registration.type == 'participant'">
+ Your registration has been submitted successfully.
+ </div>
-<label>Summary:<br>
-<textarea name="registration.work.abstract" cols="50" rows="5"></textarea>
-</label>
-<br/>
+ <div class="saved" ng:show="registration.type != 'participant'" class="saved">
+ <i>{{registration.work.title}}</i> submitted successfully.<br>
+ </div>
+ Please review your data, correct and save if needed.
+
+ <div>
+ Registration ID: <a href="#{{registration.$id}}">{{registration.$id}}</a>. You can bookmark this page and review it later.
+ </div>
</div>
-<div id="buttons">
-
-<span ng:show="$invalidWidgets.visible() == 0">
-<input type="submit" value="Save" ng:click="save();" ng:show="! last_saved.$equals(registration)">
-<input type="reset" value="Add another work" ng:click="reset()" ng:show="registration && registration.$id">
-</span>
-
-<b ng:show="$invalidWidgets.visible() > 0" style="color:#800">{{$invalidWidgets.visible()}} errors to fix in submission form</b>
+<div class="button" ng:show="registration.$id && registration.type != 'participant' && last_saved.$equals(registration)">
+<input type="reset" value="Submit another paper" ng:click="reset()">
+<div style="margin-left: 10px; margin-top: 8px; float: left;"> or <a href="http://psihologija.ffzg.hr/drzb2011/">Go to conference home page</a></div>
</div>
-
+<!--
<div ng:show="registration.$id">
Permalink to <a href="#{{registration.$id}}">DRZB2011 registration</a> which you can bookmark
</div>
+-->
-<hr>
-Debug Information:
-{{$window.location.href}}
-<pre>
-registration = {{registration}}
-dirty={{! last_saved.$equals(registration)}}
+<input type=checkbox name=debug style="float: right; clear: both">
+<pre ng:show="debug">
+
+dirty={{! last_saved.$equals(registration)}} invalid={{$invalidWidgets.visible()}}
+
+registration = {{registration}}
last_saved = {{last_saved}}
master = {{master}}
+symposium = {{symposium}}
+
$id={{$id}}
registration.$id={{registration.$id}}
</pre>
-</div>