Merge pull request #2558 from FinnStutzenstein/Issue2462

change all isProjected functions (closes #2462)
This commit is contained in:
Emanuel Schütze 2016-11-11 15:57:56 +01:00 committed by GitHub
commit e49411250a
14 changed files with 141 additions and 140 deletions

View File

@ -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;
}
};
}

View File

@ -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

View File

@ -13,32 +13,30 @@
<translate>Manage list</translate>
</button>
<!-- project -->
<div class="form-inline button">
<div os-perms="core.can_manage_projector" class="btn-group" uib-dropdown
uib-tooltip="{{ 'Projector' | translate }} {{ isCurrentLoSProjected() }}"
tooltip-enable="isCurrentLoSProjected() > 0">
<button type="button" class="btn btn-default btn-sm"
title="{{ 'Project current list of speakers' | translate }}"
ng-click="projectCurrentLoS(defaultProjectorId)"
ng-class="{ 'btn-primary': isCurrentLoSProjected() > 0 && isCurrentLoSProjected() == defaultProjectorId}">
<i class="fa fa-video-camera"></i>
<translate>Current list of speakers</translate>
</button>
<button type="button" class="btn btn-default btn-sm" uib-dropdown-toggle
ng-class="{ 'btn-primary': isCurrentLoSProjected() > 0 && isCurrentLoSProjected() != defaultProjectorId}">
<span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu" aria-labelledby="split-button">
<li role="menuitem" ng-repeat="projector in projectors">
<a href="" ng-click="projectCurrentLoS(projector.id)"
ng-class="{ 'projected': isCurrentLoSProjected() == projector.id }">
<i class="fa fa-video-camera" ng-show="isCurrentLoSProjected() == projector.id"></i>
{{ projector.name }}
<span ng-if="projector.id == defaultProjectorId">(<translate>Default</translate>)</span>
</a>
</li>
</ul>
</div>
<div os-perms="core.can_manage_projector" class="btn-group" uib-dropdown
uib-tooltip="{{ 'Projector' | translate }} {{ isCurrentLoSProjected()[0] || '' }}"
tooltip-enable="isCurrentLoSProjected().length">
<button type="button" class="btn btn-default btn-sm"
title="{{ 'Project current list of speakers' | translate }}"
ng-click="projectCurrentLoS(defaultProjectorId)"
ng-class="{ 'btn-primary': isCurrentLoSProjected().length && inArray(isCurrentLoSProjected(), defaultProjectorId) }">
<i class="fa fa-video-camera"></i>
<translate>Current list of speakers</translate>
</button>
<button type="button" class="btn btn-default btn-sm" uib-dropdown-toggle
ng-class="{ 'btn-primary': isCurrentLoSProjected().length && !inArray(isCurrentLoSProjected(), defaultProjectorId) }">
<span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu" aria-labelledby="split-button">
<li role="menuitem" ng-repeat="projector in projectors">
<a href="" ng-click="projectCurrentLoS(projector.id)"
ng-class="{ 'projected': inArray(isCurrentLoSProjected(), projector.id) }">
<i class="fa fa-video-camera" ng-show="inArray(isCurrentLoSProjected(), projector.id) "></i>
{{ projector.name }}
<span ng-if="projector.id == defaultProjectorId">(<translate>Default</translate>)</span>
</a>
</li>
</ul>
</div>
</div>
<h1 translate>Current list of speakers</h1>

View File

@ -11,17 +11,17 @@
</a>
<!-- project list of speakers -->
<span class="btn-group" style="min-width:54px;" uib-dropdown
uib-tooltip="{{ 'Projector' | translate }} {{ item.isListOfSpeakersProjected() }}"
tooltip-enable="item.isListofSpeakersProjected() > 0"
uib-tooltip="{{ 'Projector' | translate }} {{ item.isListOfSpeakersProjected()[0] || '' }}"
tooltip-enable="item.isListofSpeakersProjected().length"
os-perms="core.can_manage_projector">
<button type="button" class="btn btn-default btn-sm"
ng-click="item.projectListOfSpeakers(defaultProjectorListOfSpeakersId)"
ng-class="{ 'btn-primary': item.isListOfSpeakersProjected() == defaultProjectorListOfSpeakersId }">
ng-class="{ 'btn-primary': inArray(item.isListOfSpeakersProjected(), defaultProjectorListOfSpeakersId) }">
<i class="fa fa-video-camera"></i>
<translate>List of speakers</translate>
</button>
<button type="button" class="btn btn-default btn-sm slimDropDown"
ng-class="{ 'btn-primary': (item.isListOfSpeakersProjected() > 0 && item.isListOfSpeakersProjected() != defaultProjectorListOfSpeakersId) }"
ng-class="{ 'btn-primary': (item.isListOfSpeakersProjected().length && !inArray(item.isListOfSpeakersProjected(), defaultProjectorListOfSpeakersId) ) }"
ng-if="projectors.length > 1"
uib-dropdown-toggle>
<span class="caret"></span>
@ -29,8 +29,8 @@
<ul class="dropdown-menu" ng-if="projectors.length > 1">
<li role="menuitem" ng-repeat="projector in projectors">
<a href="" ng-click="item.projectListOfSpeakers(projector.id)"
ng-class="{ 'projected': (item.isListOfSpeakersProjected() == projector.id) }">
<i class="fa fa-video-camera" ng-show="item.isListOfSpeakersProjected() == projector.id"></i>
ng-class="{ 'projected': inArray(item.isListOfSpeakersProjected(), projector.id) }">
<i class="fa fa-video-camera" ng-show="inArray(item.isListOfSpeakersProjected(), projector.id) "></i>
{{ projector.name }}
<span ng-if="defaultProjectorListOfSpeakersId == projector.id">(<translate>Default</translate>)</span>
</a>

View File

@ -21,18 +21,18 @@
</a>
<!-- project agenda button -->
<div class="btn-group button" uib-dropdown
uib-tooltip="{{ 'Projector' | translate }} {{ isAgendaProjected(mainListTree) }}"
tooltip-enable="isAgendaProjected(mainListTree) > 0"
uib-tooltip="{{ 'Projector' | translate }} {{ isAgendaProjected(mainListTree)[0] || '' }}"
tooltip-enable="isAgendaProjected(mainListTree).length"
os-perms="core.can_manage_projector">
<button type="button" class="btn btn-default btn-sm"
title="{{ 'Project agenda' | translate }}"
ng-click="projectAgenda(defaultProjectorId_all_items, mainListTree)"
ng-class="{ 'btn-primary': isAgendaProjected(mainListTree) > 0 && isAgendaProjected(mainListTree) == defaultProjectorId_all_items}">
ng-class="{ 'btn-primary': isAgendaProjected(mainListTree).length && inArray(isAgendaProjected(mainListTree), defaultProjectorId_all_items)}">
<i class="fa fa-video-camera"></i>
<translate>Agenda</translate>
</button>
<button type="button" class="btn btn-default btn-sm" uib-dropdown-toggle
ng-class="{ 'btn-primary': isAgendaProjected(mainListTree) > 0 && isAgendaProjected(mainListTree) != defaultProjectorId_all_items}"
ng-class="{ 'btn-primary': isAgendaProjected(mainListTree).length && !inArray(isAgendaProjected(mainListTree), defaultProjectorId_all_items)}"
ng-if="agendaHasSubitems || projectors.length > 1">
<span class="caret"></span>
</button>
@ -46,8 +46,8 @@
<li class="divider" ng-show="agendaHasSubitems && projectors.length > 1"></li>
<li role="menuitem" ng-repeat="projector in projectors" ng-show="projectors.length > 1">
<a href="" ng-click="projectAgenda(projectorId=projector.id, tree=mainListTree)"
ng-class="{ 'projected': isAgendaProjected(mainListTree) == projector.id }">
<i class="fa fa-video-camera" ng-show="isAgendaProjected(mainListTree) == projector.id"></i>
ng-class="{ 'projected': inArray(isAgendaProjected(mainListTree), projector.id) }">
<i class="fa fa-video-camera" ng-show="inArray(isAgendaProjected(mainListTree), projector.id) "></i>
{{ projector.name }}
<span ng-if="projector.id == defaultProjectorId_all_items">(<translate>Default</translate>)</span>
</a>
@ -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}">
<!-- projector column -->
<td ng-show="!isDeleteMode" os-perms="core.can_manage_projector">
<div class="btn-group" style="min-width:{{ (item.hasSubitems(items) || projectors.length > 1) ? '54' : '34' }}px;" uib-dropdown
uib-tooltip="{{ 'Projector' | translate }} {{ item.isProjected(item.tree) }}"
tooltip-enable="item.isProjected(item.tree) > 0">
uib-tooltip="{{ 'Projector' | translate }} {{ item.isProjected(item.tree)[0] || '' }}"
tooltip-enable="item.isProjected(item.tree).length">
<button class="btn btn-default btn-sm"
title="{{ 'Project item' | translate }}"
ng-click="item.project(getProjectionDefault(item), item.tree)"
ng-class="{ 'btn-primary': item.isProjected(item.tree) > 0 && item.isProjected(item.tree) == getProjectionDefault(item)}">
ng-class="{ 'btn-primary': item.isProjected(item.tree).length && inArray(item.isProjected(item.tree), getProjectionDefault(item))}">
<i class="fa fa-video-camera"></i>
</button>
<button type="button" class="btn btn-default btn-sm slimDropDown"
ng-class="{ 'btn-primary': item.isProjected(item.tree) > 0 && item.isProjected(item.tree) != getProjectionDefault(item)}"
ng-class="{ 'btn-primary': item.isProjected(item.tree).length && !inArray(item.isProjected(item.tree), getProjectionDefault(item))}"
ng-if="item.hasSubitems(items) || projectors.length > 1"
uib-dropdown-toggle>
<span class="caret"></span>
@ -191,8 +191,8 @@
<li class="divider" ng-show="item.hasSubitems(items)"></li>
<li role="menuitem" ng-repeat="projector in projectors">
<a href="" ng-click="item.project(projector.id, item.tree)"
ng-class="{ 'projected': item.isProjected(item.tree) == projector.id }">
<i class="fa fa-video-camera" ng-show="item.isProjected(item.tree) == projector.id"></i>
ng-class="{ 'projected': inArray(item.isProjected(item.tree), projector.id) }">
<i class="fa fa-video-camera" ng-show="inArray(item.isProjected(item.tree), projector.id)"></i>
{{ projector.name }}
<span ng-if="projector.id == getProjectionDefault(item)">(<translate>Default</translate>)</span>
</a>

View File

@ -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}]
@ -281,8 +281,8 @@ angular.module('OpenSlidesApp.assignments', [])
},
// override isProjected function of jsDataModel factory
isProjected: function (poll_id) {
// Returns the id of the last projector found with an element
// with the name 'assignments/assignment'.
// Returns the ids of all projectors with an element
// with the name 'assignments/assignment'. Else returns an empty list.
var self = this;
var predicate = function (element) {
var value;
@ -302,13 +302,13 @@ angular.module('OpenSlidesApp.assignments', [])
}
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;
}
},
relations: {

View File

@ -117,7 +117,7 @@
<tr ng-repeat="assignment in assignmentsFiltered = (assignments | osFilter: filter.search : getFilterString |
filter: {phase: phaseFilter} | orderBy: sortColumn:reverse)"
class="animate-item"
ng-class="{ 'activeline': assignment.isProjected(), 'selected': assignment.selected }">
ng-class="{ 'activeline': assignment.isProjected().length, 'selected': assignment.selected }">
<!-- projector -->
<td ng-show="!isDeleteMode" os-perms="core.can_manage_projector">

View File

@ -264,6 +264,16 @@ angular.module('OpenSlidesApp.core', [
}
])
// Make the indexOf available in every scope; needed for the projectorbuttons
.run([
'$rootScope',
function ($rootScope) {
$rootScope.inArray = function (array, value) {
return _.indexOf(array, value) > -1;
};
}
])
.factory('loadGlobalData', [
'ChatMessage',
'Config',
@ -388,12 +398,12 @@ angular.module('OpenSlidesApp.core', [
var BaseModel = function() {};
BaseModel.prototype.project = function(projectorId) {
// if this object is already projected on projectorId, delete this element from this projector
var isProjectedId = this.isProjected();
if (isProjectedId > 0) {
$http.post('/rest/core/projector/' + isProjectedId + '/clear_elements/');
}
// if it was the same projector before, just delete it but not show again
if (isProjectedId != projectorId) {
var isProjectedIds = this.isProjected();
_.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}]
@ -401,23 +411,21 @@ angular.module('OpenSlidesApp.core', [
}
};
BaseModel.prototype.isProjected = function() {
// Returns the projector id if there is a projector element
// with the same name and the same id. Else returns 0.
// Attention: if this element is projected multiple times, only the
// id of the last projector is returned.
// Returns the ids of all projectors if there is a projector element
// with the same name and the same id. Else returns an empty list.
var self = this;
var predicate = function (element) {
return element.name == self.getResourceName() &&
typeof element.id !== 'undefined' &&
element.id == self.id;
};
var isProjectedId = 0;
var isProjectedIds = [];
Projector.getAll().forEach(function (projector) {
if (typeof _.findKey(projector.elements, predicate) === 'string') {
isProjectedId = projector.id;
isProjectedIds.push(projector.id);
}
});
return isProjectedId;
return isProjectedIds;
};
return BaseModel;
}

View File

@ -1,15 +1,15 @@
<div class="btn-group" style="min-width:{{ projectors.length > 1 ? '54' : '34' }}px;" uib-dropdown
uib-tooltip="{{ 'Projector' | translate }} {{ model.isProjected(arg) }}"
tooltip-enable="model.isProjected(arg) > 0"
uib-tooltip="{{ 'Projector' | translate }} {{ model.isProjected(arg)[0] || '' }}"
tooltip-enable="model.isProjected(arg).length"
os-perms="core.can_manage_projector">
<button type="button" class="btn btn-default btn-sm"
ng-click="model.project(defaultProjectorId, arg)"
ng-class="{ 'btn-primary': model.isProjected(arg) == defaultProjectorId }">
ng-class="{ 'btn-primary': inArray(model.isProjected(arg), defaultProjectorId) }">
<i class="fa fa-video-camera"></i>
{{ content }}
</button>
<button type="button" class="btn btn-default btn-sm slimDropDown"
ng-class="{ 'btn-primary': (model.isProjected(arg) > 0 && model.isProjected(arg) != defaultProjectorId) }"
ng-class="{ 'btn-primary': (model.isProjected(arg).length && !inArray(model.isProjected(arg), defaultProjectorId)) }"
ng-if="projectors.length > 1"
uib-dropdown-toggle>
<span class="caret"></span>
@ -17,8 +17,8 @@
<ul class="dropdown-menu" ng-if="projectors.length > 1">
<li role="menuitem" ng-repeat="projector in projectors">
<a href="" ng-click="model.project(projector.id, arg)"
ng-class="{ 'projected': (model.isProjected(arg) == projector.id) }">
<i class="fa fa-video-camera" ng-show="model.isProjected(arg) == projector.id"></i>
ng-class="{ 'projected': inArray(model.isProjected(arg), projector.id) }">
<i class="fa fa-video-camera" ng-show="inArray(model.isProjected(arg), projector.id)"></i>
{{ projector.name }}
<span ng-if="defaultProjectorId == projector.id">(<translate>Default</translate>)</span>
</a>

View File

@ -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',

View File

@ -197,21 +197,21 @@
<tr ng-repeat="mediafile in mediafilesFiltered = (mediafiles | privateFilter | osFilter: filter.search : getFilterString |
filter: {filetype: filter.showPDFs} | orderBy: sortColumn:reverse )"
class="animate-item"
ng-class="{ 'activeline': mediafile.isProjected(), 'selected': mediafile.selected }">
ng-class="{ 'activeline': mediafile.isProjected().length, 'selected': mediafile.selected }">
<!-- projector column -->
<td ng-show="!isDeleteMode"
os-perms="core.can_manage_projector">
<div class="btn-group" style="min-width:{{ projectors.length > 1 ? '54' : '34' }}px;" uib-dropdown
ng-if="mediafile.is_presentable"
uib-tooltip="{{ 'Projector' | translate }} {{ mediafile.isProjected() }}"
tooltip-enable="mediafile.isProjected() > 0">
uib-tooltip="{{ 'Projector' | translate }} {{ mediafile.isProjected()[0] || '' }}"
tooltip-enable="mediafile.isProjected().length">
<button type="button" class="btn btn-default btn-sm"
ng-click="showMediafile(defaultProjectorId, mediafile)"
ng-class="{ 'btn-primary': mediafile.isProjected() == defaultProjectorId }">
ng-class="{ 'btn-primary': inArray(mediafile.isProjected(), defaultProjectorId) }">
<i class="fa fa-video-camera"></i>
</button>
<button type="button" class="btn btn-default btn-sm slimDropDown"
ng-class="{ 'btn-primary': (mediafile.isProjected() > 0 && mediafile.isProjected() != defaultProjectorId) }"
ng-class="{ 'btn-primary': (mediafile.isProjected().length && !inArray(mediafile.isProjected(), defaultProjectorId) ) }"
ng-if="projectors.length > 1"
uib-dropdown-toggle>
<span class="caret"></span>
@ -219,8 +219,8 @@
<ul class="dropdown-menu" ng-if="projectors.length > 1">
<li role="menuitem" ng-repeat="projector in projectors">
<a href="" ng-click="showMediafile(projector.id, mediafile)"
ng-class="{ 'projected': (mediafile.isProjected() == projector.id) }">
<i class="fa fa-video-camera" ng-show="mediafile.isProjected() == projector.id"></i>
ng-class="{ 'projected': inArray(mediafile.isProjected(), projector.id) }">
<i class="fa fa-video-camera" ng-show="inArray(mediafile.isProjected(), projector.id) "></i>
{{ projector.name }}
<span ng-if="defaultProjectorId == projector.id">(<translate>Default</translate>)</span>
</a>

View File

@ -63,7 +63,7 @@
<translate>go</translate>
</button>
<button type="button" class="btn btn-sm btn-default" os-perms="core.can_manage_projector"
ng-show="lineNumberMode != 'none' && motion.isProjected()"
ng-show="lineNumberMode != 'none' && motion.isProjected().length"
ng-click="toggleLinesForProjector()"
uib-tooltip="{{ 'Show highlighted line also on projector.' | translate }}">
<i class="fa" ng-class="linesForProjector ? 'fa-check-square-o' : 'fa-square-o'"></i>&nbsp;

View File

@ -352,7 +352,7 @@
<!-- data row -->
<div class="row data-row" ng-mouseover="motion.hover=true"
ng-mouseleave="motion.hover=false"
ng-class="{'projected': motion.isProjected()}"
ng-class="{'projected': motion.isProjected().length}"
ng-repeat="motion in motionsFiltered = (motions
| osFilter: filter.search : getFilterString
| SelectMultipleFilter: multiselectFilter.state : getItemId.state

View File

@ -182,7 +182,7 @@
</i>
<tbody>
<tr ng-repeat="user in usersFiltered | limitTo : itemsPerPage : limitBegin" class="animate-item"
ng-class="{ 'activeline': user.isProjected(), 'selected': user.selected }">
ng-class="{ 'activeline': user.isProjected().length, 'selected': user.selected }">
<!-- projector column -->
<td ng-show="!isSelectMode" os-perms="core.can_manage_projector">
<projector-button model="user" default-projector-id="defaultProjectorId">