Merge pull request #1966 from emanuelschuetze/mediafile

Use prune_elements for activate mediafile. (Fixed #1910)
This commit is contained in:
Norman Jäckel 2016-02-09 23:22:42 +01:00
commit ad7653fb76
5 changed files with 69 additions and 53 deletions

View File

@ -22,7 +22,9 @@
title="{{ 'Edit current slide' | translate}}"> title="{{ 'Edit current slide' | translate}}">
<i class="fa fa-pencil"></i> <i class="fa fa-pencil"></i>
</a> </a>
&nbsp;
<!-- scale -->
<div class="btn-group">
<a ng-click="controlProjector('scale', 'down')" <a ng-click="controlProjector('scale', 'down')"
class="btn btn-default btn-sm" class="btn btn-default btn-sm"
title="{{ 'Smaller' | translate}}"> title="{{ 'Smaller' | translate}}">
@ -33,8 +35,16 @@
title="{{ 'Bigger' | translate}}"> title="{{ 'Bigger' | translate}}">
<i class="fa fa-search-plus"></i> <i class="fa fa-search-plus"></i>
</a> </a>
<a ng-click="controlProjector('scale', 'reset')"
class="btn btn-default btn-sm"
title="{{ 'Reset scaling' | translate}}">
<i class="fa fa-undo"></i>
</a>
</div>
<span ng-class="{ 'notNull': scaleLevel != 0 }">{{ scaleLevel }}</span> <span ng-class="{ 'notNull': scaleLevel != 0 }">{{ scaleLevel }}</span>
&nbsp;
<!-- scroll -->
<div class="btn-group">
<a ng-click="controlProjector('scroll', 'down')" <a ng-click="controlProjector('scroll', 'down')"
class="btn btn-default btn-sm" class="btn btn-default btn-sm"
title="{{ 'Scroll up' | translate}}"> title="{{ 'Scroll up' | translate}}">
@ -50,6 +60,7 @@
title="{{ 'Reset scrolling' | translate}}"> title="{{ 'Reset scrolling' | translate}}">
<i class="fa fa-undo"></i> <i class="fa fa-undo"></i>
</a> </a>
</div>
<span ng-class="{ 'notNull': scrollLevel != 0 }">{{ scrollLevel }}</span> <span ng-class="{ 'notNull': scrollLevel != 0 }">{{ scrollLevel }}</span>
</div> </div>
</div> </div>

View File

@ -15,7 +15,13 @@
<div class="searchresults spacer-top-lg"> <div class="searchresults spacer-top-lg">
<ol ng-show="results"> <ol ng-show="results">
<li ng-repeat="result in results"> <li ng-repeat="result in results">
<a ui-sref="{{ result.urlState }}({{ result.urlParam }})">{{ result.getSearchResultName() }}</a><br> <a ng-if="!result.mediafileUrl" ui-sref="{{ result.urlState }}({{ result.urlParam }})">
{{ result.getSearchResultName() }}
</a>
<a ng-if="result.mediafileUrl" href="{{ result.mediafileUrl }}" target="_blank">
{{ result.getSearchResultName() }}
</a>
<br>
<span class="grey">{{ result.getSearchResultSubtitle() | translate }}</span> <span class="grey">{{ result.getSearchResultSubtitle() | translate }}</span>
</ol> </ol>
<p ng-show="!results" translate>No results.</p> <p ng-show="!results" translate>No results.</p>

View File

@ -15,7 +15,15 @@ angular.module('OpenSlidesApp.mediafiles', [])
methods: { methods: {
getResourceName: function () { getResourceName: function () {
return name; return name;
} },
// link name which is shown in search result
getSearchResultName: function () {
return this.title;
},
// subtitle of search result
getSearchResultSubtitle: function () {
return "File";
},
}, },
computed: { computed: {
is_presentable: ['filetype', function (filetype) { is_presentable: ['filetype', function (filetype) {

View File

@ -135,24 +135,8 @@ angular.module('OpenSlidesApp.mediafiles.site', ['ngFileUpload', 'OpenSlidesApp.
// ** PDF presentation functions **/ // ** PDF presentation functions **/
// show document on projector // show document on projector
$scope.showPdf = function (mediafile) { $scope.showPdf = function (mediafile) {
var postUrl, var postUrl = '/rest/core/projector/1/prune_elements/';
data; var data = [{
if ($scope.presentedMediafiles.length > 0) {
// update first mediafile, at the moment there should not be more
var uuid = $scope.presentedMediafiles[0].uuid;
postUrl = '/rest/core/projector/1/update_elements/';
data = {};
data[uuid] = {
id: mediafile.id,
numPages: mediafile.mediafile.pages,
page: 1,
scale: 1,
rotate: 0,
visible: true
};
} else {
postUrl = '/rest/core/projector/1/prune_elements/';
data = [{
name: 'mediafiles/mediafile', name: 'mediafiles/mediafile',
id: mediafile.id, id: mediafile.id,
numPages: mediafile.mediafile.pages, numPages: mediafile.mediafile.pages,
@ -161,7 +145,6 @@ angular.module('OpenSlidesApp.mediafiles.site', ['ngFileUpload', 'OpenSlidesApp.
rotate: 0, rotate: 0,
visible: true visible: true
}]; }];
}
$http.post(postUrl, data); $http.post(postUrl, data);
}; };
@ -192,19 +175,27 @@ angular.module('OpenSlidesApp.mediafiles.site', ['ngFileUpload', 'OpenSlidesApp.
}; };
$scope.mediafileZoomIn = function () { $scope.mediafileZoomIn = function () {
var mediafileElement = getCurrentlyPresentedMediafile(); var mediafileElement = getCurrentlyPresentedMediafile();
var scale = 1;
if (parseFloat(mediafileElement.scale)) {
scale = mediafileElement.scale;
}
sendMediafileCommand({ sendMediafileCommand({
scale: parseFloat(mediafileElement.scale) + 0.2 scale: scale + 0.2
}); });
}; };
$scope.mediafileFit = function () { $scope.mediafileFit = function () {
sendMediafileCommand({ sendMediafileCommand({
scale: 1 scale: 'page-fit'
}); });
}; };
$scope.mediafileZoomOut = function () { $scope.mediafileZoomOut = function () {
var mediafileElement = getCurrentlyPresentedMediafile(); var mediafileElement = getCurrentlyPresentedMediafile();
var scale = 1;
if (parseFloat(mediafileElement.scale)) {
scale = mediafileElement.scale;
}
sendMediafileCommand({ sendMediafileCommand({
scale: parseFloat(mediafileElement.scale) - 0.2 scale: scale - 0.2
}); });
}; };
$scope.mediafileChangePage = function(pageNum) { $scope.mediafileChangePage = function(pageNum) {

View File

@ -92,7 +92,7 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
resolve: { resolve: {
motion: function() { motion: function() {
return Motion.find($stateParams.id).then(function(motion) { return Motion.find($stateParams.id).then(function(motion) {
Motion.loadRelations(motion, 'agenda_item'); return Motion.loadRelations(motion, 'agenda_item');
}); });
}, },
}, },