diff --git a/openslides/agenda/static/js/agenda/base.js b/openslides/agenda/static/js/agenda/base.js index a114268e7..38a4a1ced 100644 --- a/openslides/agenda/static/js/agenda/base.js +++ b/openslides/agenda/static/js/agenda/base.js @@ -113,13 +113,12 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users']) }, // override project function of jsDataModel factory project: function (projectorId, tree) { - var isProjectedId = this.isProjected(tree); - if (isProjectedId > 0) { - // Deactivate - $http.post('/rest/core/projector/' + isProjectedId + '/clear_elements/'); - } + var isProjectedIds = this.isProjected(tree); + _.forEach(isProjectedIds, function (id) { + $http.post('/rest/core/projector/' + id + '/clear_elements/'); + }); // Activate, if the projector_id is a new projector. - if (isProjectedId != projectorId) { + if (_.indexOf(isProjectedIds, projectorId) == -1) { var name = tree ? 'agenda/item-list' : this.content_object.collection; var id = tree ? this.id : this.content_object.id; return $http.post( @@ -160,13 +159,11 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users']) }, // project list of speakers projectListOfSpeakers: function(projectorId) { - var isProjectedId = this.isListOfSpeakersProjected(); - if (isProjectedId > 0) { - // Deactivate - $http.post('/rest/core/projector/' + isProjectedId + '/clear_elements/'); - } - // Activate - if (isProjectedId != projectorId) { + var isProjectedIds = this.isListOfSpeakersProjected(); + _.forEach(isProjectedIds, function (id) { + $http.post('/rest/core/projector/' + id + '/clear_elements/'); + }); + if (_.indexOf(isProjectedIds, projectorId) == -1) { return $http.post( '/rest/core/projector/' + projectorId + '/prune_elements/', [{name: 'agenda/list-of-speakers', id: this.id}] diff --git a/openslides/agenda/static/js/agenda/site.js b/openslides/agenda/static/js/agenda/site.js index 4526f4850..c2406a58f 100644 --- a/openslides/agenda/static/js/agenda/site.js +++ b/openslides/agenda/static/js/agenda/site.js @@ -255,12 +255,11 @@ angular.module('OpenSlidesApp.agenda.site', [ }; // project agenda $scope.projectAgenda = function (projectorId, tree, id) { - var isAgendaProjectedId = $scope.isAgendaProjected($scope.mainListTree); - if (isAgendaProjectedId > 0) { - // Deactivate - $http.post('/rest/core/projector/' + isAgendaProjectedId + '/clear_elements/'); - } - if (isAgendaProjectedId != projectorId) { + var isAgendaProjectedIds = $scope.isAgendaProjected($scope.mainListTree); + _.forEach(isAgendaProjectedIds, function (id) { + $http.post('/rest/core/projector/' + id + '/clear_elements/'); + }); + if (_.indexOf(isAgendaProjectedIds, projectorId) == -1) { $http.post('/rest/core/projector/' + projectorId + '/prune_elements/', [{name: 'agenda/item-list', tree: tree, id: id}]); } @@ -568,12 +567,11 @@ angular.module('OpenSlidesApp.agenda.site', [ // Project current list of speakers // same logic as in core/base.js $scope.projectCurrentLoS = function (projectorId) { - var isCurrentLoSProjectedId = $scope.isCurrentLoSProjected($scope.mainListTree); - if (isCurrentLoSProjectedId > 0) { - // Deactivate - $http.post('/rest/core/projector/' + isCurrentLoSProjectedId + '/clear_elements/'); - } - if (isCurrentLoSProjectedId != projectorId) { + var isCurrentLoSProjectedIds = $scope.isCurrentLoSProjected($scope.mainListTree); + _.forEach(isCurrentLoSProjectedIds, function (id) { + $http.post('/rest/core/projector/' + id + '/clear_elements/'); + }); + if (_.indexOf(isCurrentLoSProjectedIds, projectorId) == -1) { $http.post('/rest/core/projector/' + projectorId + '/prune_elements/', [{name: 'agenda/current-list-of-speakers'}]); } diff --git a/openslides/assignments/static/js/assignments/base.js b/openslides/assignments/static/js/assignments/base.js index b727454b8..c362db260 100644 --- a/openslides/assignments/static/js/assignments/base.js +++ b/openslides/assignments/static/js/assignments/base.js @@ -268,11 +268,11 @@ angular.module('OpenSlidesApp.assignments', []) }, // override project function of jsDataModel factory project: function (projectorId, pollId) { - var isProjectedId = this.isProjected(pollId); - if (isProjectedId > 0) { - $http.post('/rest/core/projector/' + isProjectedId + '/clear_elements/'); - } - if (isProjectedId != projectorId) { + var isProjectedIds = this.isProjected(pollId); + _.forEach(isProjectedIds, function (id) { + $http.post('/rest/core/projector/' + id + '/clear_elements/'); + }); + if (_.indexOf(isProjectedIds, projectorId) == -1) { return $http.post( '/rest/core/projector/' + projectorId + '/prune_elements/', [{name: 'assignments/assignment', id: this.id, poll: pollId}] diff --git a/openslides/core/static/js/core/base.js b/openslides/core/static/js/core/base.js index ddb20759e..5e17c8720 100644 --- a/openslides/core/static/js/core/base.js +++ b/openslides/core/static/js/core/base.js @@ -391,11 +391,11 @@ angular.module('OpenSlidesApp.core', [ BaseModel.prototype.project = function(projectorId) { // if this object is already projected on projectorId, delete this element from this projector var isProjectedIds = this.isProjected(); - if (isProjectedIds.length > 0) { - $http.post('/rest/core/projector/' + isProjectedIds[0] + '/clear_elements/'); - } - // if it was the same projector before, just delete it but not show again - if (isProjectedIds[0] != projectorId) { + _.forEach(isProjectedIds, function (id) { + $http.post('/rest/core/projector/' + id + '/clear_elements/'); + }); + // Show the element, if it was not projected before on the given projector + if (_.indexOf(isProjectedIds, projectorId) == -1) { return $http.post( '/rest/core/projector/' + projectorId + '/prune_elements/', [{name: this.getResourceName(), id: this.id}] diff --git a/openslides/mediafiles/static/js/mediafiles/site.js b/openslides/mediafiles/static/js/mediafiles/site.js index 883f49809..ea33a45e8 100644 --- a/openslides/mediafiles/static/js/mediafiles/site.js +++ b/openslides/mediafiles/static/js/mediafiles/site.js @@ -156,11 +156,11 @@ angular.module('OpenSlidesApp.mediafiles.site', ['ngFileUpload', 'OpenSlidesApp. // ** PDF presentation functions **/ // show document on projector $scope.showMediafile = function (projectorId, mediafile) { - var isProjectedId = mediafile.isProjected(); - if (isProjectedId > 0) { - $http.post('/rest/core/projector/' + isProjectedId + '/clear_elements/'); - } - if (isProjectedId != projectorId) { + var isProjectedIds = mediafile.isProjected(); + _.forEach(isProjectedIds, function (id) { + $http.post('/rest/core/projector/' + id + '/clear_elements/'); + }); + if (_.indexOf(isProjectedIds, projectorId) == -1) { var postUrl = '/rest/core/projector/' + projectorId + '/prune_elements/'; var data = [{ name: 'mediafiles/mediafile',