diff --git a/openslides/agenda/static/js/agenda/base.js b/openslides/agenda/static/js/agenda/base.js index 132f01b7a..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( @@ -130,7 +129,7 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users']) }, // override isProjected function of jsDataModel factory isProjected: function (tree) { - // Returns the id of the last projector with an agenda-item element. Else return 0. + // Returns all ids of all projectors with an agenda-item element. Otherwise an empty list. if (typeof tree === 'undefined') { tree = false; } @@ -150,23 +149,21 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users']) } return value; }; - var isProjected = 0; + var isProjectedIds = []; Projector.getAll().forEach(function (projector) { if (typeof _.findKey(projector.elements, predicate) === 'string') { - isProjected = projector.id; + isProjectedIds.push(projector.id); } }); - return isProjected; + return isProjectedIds; }, // 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}] @@ -175,21 +172,21 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users']) }, // check if list of speakers is projected isListOfSpeakersProjected: function () { - // Returns the id of the last projector with an element with the - // name 'agenda/list-of-speakers' and the same id. + // Returns all ids of all projectors with an element with the + // name 'agenda/list-of-speakers' and the same id. Else returns an empty list. var self = this; var predicate = function (element) { return element.name == 'agenda/list-of-speakers' && typeof element.id !== 'undefined' && element.id == self.id; }; - var isProjected = 0; + var isProjecteds = []; Projector.getAll().forEach(function (projector) { if (typeof _.findKey(projector.elements, predicate) === 'string') { - isProjected = projector.id; + isProjecteds.push(projector.id); } }); - return isProjected; + return isProjecteds; }, hasSubitems: function(items) { var self = this; @@ -358,9 +355,9 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users']) verboseName: gettext('List of speakers overlay'), project: function (projectorId, overlay) { var isProjectedId = this.isProjected(overlay); - if (isProjectedId > 0) { + if (isProjectedId.length > 0) { // Deactivate - var projector = Projector.get(isProjectedId); + var projector = Projector.get(isProjectedId[0]); var uuid; _.forEach(projector.elements, function (element) { if (element.name == 'agenda/current-list-of-speakers-overlay') { @@ -378,19 +375,19 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users']) } }, isProjected: function () { - // Returns the id of the last projector with an agenda-item element. Else return 0. - var isProjected = 0; + // Returns the ids of all projectors with an agenda-item element. Else return an empty list. var predicate = function (element) { var value; value = element.name == 'agenda/current-list-of-speakers-overlay'; return value; }; + var isProjectedIds = []; Projector.getAll().forEach(function (projector) { if (typeof _.findKey(projector.elements, predicate) === 'string') { - isProjected = projector.id; + isProjectedIds.push(projector.id); } }); - return isProjected; + return isProjectedIds; } }; } diff --git a/openslides/agenda/static/js/agenda/site.js b/openslides/agenda/static/js/agenda/site.js index fa6b7d85f..8bd801e51 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}]); } @@ -285,8 +284,8 @@ angular.module('OpenSlidesApp.agenda.site', [ }; // check if agenda is projected $scope.isAgendaProjected = function (tree) { - // Returns true if there is a projector element with the name - // 'agenda/item-list'. + // Returns the ids of all projectors with an element with + // the name 'agenda/item-list'. Else returns an empty list. var predicate = function (element) { var value; if (tree) { @@ -302,13 +301,13 @@ angular.module('OpenSlidesApp.agenda.site', [ } return value; }; - var projectorId = 0; + var projectorIds = []; $scope.projectors.forEach(function (projector) { if (typeof _.findKey(projector.elements, predicate) === 'string') { - projectorId = projector.id; + projectorIds.push(projector.id); } }); - return projectorId; + return projectorIds; }; // auto numbering of agenda items $scope.autoNumbering = function() { @@ -571,30 +570,29 @@ 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'}]); } }; // same logic as in core/base.js $scope.isCurrentLoSProjected = function () { - // Returns the projector id if there is a projector element with the name - // 'agenda/current-list-of-speakers'. Elsewise returns 0. - var projectorId = 0; + // Returns the ids of all projectors with an element with the name + // 'agenda/current-list-of-speakers'. Elsewise returns an empty list. + var projectorIds = []; $scope.projectors.forEach(function (projector) { var key = _.findKey(projector.elements, function (element) { return element.name == 'agenda/current-list-of-speakers'; }); if (typeof key === 'string') { - projectorId = projector.id; + projectorIds.push(projector.id); } }); - return projectorId; + return projectorIds; }; // go to the list of speakers (management) of the currently diff --git a/openslides/agenda/static/templates/agenda/current-list-of-speakers.html b/openslides/agenda/static/templates/agenda/current-list-of-speakers.html index cd0473467..4610c8eac 100644 --- a/openslides/agenda/static/templates/agenda/current-list-of-speakers.html +++ b/openslides/agenda/static/templates/agenda/current-list-of-speakers.html @@ -13,32 +13,30 @@ Manage list -
-
- - - -
+
+ + +

Current list of speakers

diff --git a/openslides/agenda/static/templates/agenda/item-detail.html b/openslides/agenda/static/templates/agenda/item-detail.html index 41103ff97..85f9128e2 100644 --- a/openslides/agenda/static/templates/agenda/item-detail.html +++ b/openslides/agenda/static/templates/agenda/item-detail.html @@ -11,17 +11,17 @@ @@ -46,8 +46,8 @@
  • - + ng-class="{ 'projected': inArray(isAgendaProjected(mainListTree), projector.id) }"> + {{ projector.name }} (Default) @@ -162,20 +162,20 @@ filter: {is_hidden: filter.showHiddenItems} | filter: {closed: filter.showClosedItems}) | limitTo : itemsPerPage : limitBegin" class="animate-item" - ng-class="{ 'activeline': item.isProjected(), 'selected': item.selected, 'hiddenrow': item.is_hidden}"> + ng-class="{ 'activeline': item.isProjected().length, 'selected': item.selected, 'hiddenrow': item.is_hidden}">
    + uib-tooltip="{{ 'Projector' | translate }} {{ item.isProjected(item.tree)[0] || '' }}" + tooltip-enable="item.isProjected(item.tree).length">