1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
<template>
<studip-dialog
:title="$gettext('Seite exportieren')"
:closeText="$gettext('Schließen')"
closeClass="cancel"
height="320"
width="610"
@close="showElementExportChooserDialog(false)"
>
<template v-slot:dialogContent>
<div class="square-button-panel">
<studip-square-button
v-if="showExportArchiv"
icon="file-archive"
:title="$gettext('ZIP Datei herunterladen')"
@click="selectType('archiv')"
/>
<studip-square-button
v-if="showExportPdf"
icon="file-pdf"
:title="$gettext('PDF Datei herunterladen')"
@click="selectType('pdf')"
/>
<studip-square-button
v-if="showOer"
icon="oer-campus"
:title="$gettext('Auf OER Campus veröffentlichen')"
@click="selectType('oer')"
/>
</div>
<courseware-companion-box
v-if="!showExportArchiv && !showExportPdf && !showOer"
mood="pointing"
:msgCompanion="$gettext('Keine Exportoptionen verfügbar')"
/>
</template>
</studip-dialog>
</template>
<script>
import CoursewareCompanionBox from '../layouts/CoursewareCompanionBox.vue';
import StudipSquareButton from './../../StudipSquareButton.vue';
import { mapActions, mapGetters } from 'vuex';
export default {
name: 'courseware-structural-element-dialog-export-chooser',
props: ['canEdit', 'canVisit'],
components: {
CoursewareCompanionBox,
StudipSquareButton,
},
computed: {
...mapGetters({
context: 'context',
oerCampusEnabled: 'oerCampusEnabled',
userIsTeacher: 'userIsTeacher',
}),
inCourseContext() {
return this.context.type === 'courses';
},
showExportArchiv() {
if (this.context.type === 'users') {
return true;
}
return this.canEdit;
},
showExportPdf() {
if (this.context.type === 'users') {
return true;
}
return this.canVisit;
},
showOer() {
if (!this.oerCampusEnabled) {
return false;
}
if (this.context.type === 'users') {
return true;
}
return this.userIsTeacher && this.canVisit;
},
},
methods: {
...mapActions({
showElementExportDialog: 'showElementExportDialog',
showElementExportChooserDialog: 'showElementExportChooserDialog',
showElementPdfExportDialog: 'showElementPdfExportDialog',
showElementOerExportDialog: 'showElementOerExportDialog',
}),
selectType(type) {
switch (type) {
case 'archiv':
this.showElementExportDialog(true);
break;
case 'pdf':
this.showElementPdfExportDialog(true);
break;
case 'oer':
this.showElementOerExportDialog(true);
break;
}
this.showElementExportChooserDialog(false);
},
},
};
</script>
|