+ $scope.symposium_work_remove = function(work_index) {
+ if ( ! angular.isNumber(work_index) ) {
+ $log.error("work_index", work_index);
+ return;
+ }
+ var works = $scope.work.symposium_works;
+ $log.info('symposium_work_remove', works, work_index);
+ var removed = works.splice( work_index, 1 );
+ if ( angular.isArray(removed) && removed[0] ) {
+ removed = removed[0];
+ removed.deleted = true;
+ if ( ! angular.isArray( $scope.work.symposium_works_deleted ) )
+ $scope.work.symposium_works_deleted = [];
+ $scope.work.symposium_works_deleted.push( removed );
+ $log.info("work deleted", works);
+ } else {
+ $log.warn("symposium_work_remove no work to remove", works, work);
+ }
+ }
+
+ $scope.abstract_class = function(work) {
+ if ( work === undefined ) return;
+ var abstract = work.abstract;
+ return angular.isString(abstract) && abstract.length <= 2000 ? 'ok' : 'ng-invalid';
+ }
+ $scope.abstract_length = function(work) {
+ if ( work === undefined ) return;
+ var abstract = work.abstract;
+ if ( ! abstract ) return 0;
+ return abstract.length <= 2000 ? abstract.length : 2000 - abstract.length;
+ }
+
+ $scope.change_state = function(new_state) {
+ if ( new_state == $scope.registration.state ) return;
+ $scope.info = { css_class: 'alert-warning', message: 'Changed state from "'+$scope.registration.state+'" to "'+new_state+'"' };
+ $scope.registration.state = new_state;
+ }
+
+ $scope.show_submission_type = function() {
+ // FIXME check if all submission are allowed by date and allow them!
+ if ( angular.isUndefined( $scope.user ) || angular.isUndefined( $scope.registration ) ) return false;
+ return (
+ angular.isUndefined( $scope.user.registration_type ) // new registration
+ || angular.isUndefined( $scope.registration.state ) // not saved yet
+ || $scope.registration.state == 'draft'
+ || $scope.registration.state == 'confirmation'
+ ) ? false : true;
+ }
+ $scope.show_registration_type = function() {
+ return true;
+ }
+