download files with window.open instead of window.location; fix signature mail student_modal info loading; check length of every entry field when doing endupload and force user to accept or cancel upon notification; berechtigung check für Abgabetool.php controller; phrasen everywhere;

This commit is contained in:
Johann Hoffmann
2025-10-06 13:58:26 +02:00
parent dab34eff35
commit 1e23b6de61
8 changed files with 230 additions and 51 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ class Abgabetool extends Auth_Controller
{
parent::__construct([
'index' => self::PERM_LOGGED,
'getStudentProjektarbeitAbgabeFile' => self::PERM_LOGGED,
'getStudentProjektarbeitAbgabeFile' => array('basis/abgabe_student:rw', 'basis/abgabe_lektor:rw', 'basis/abgabe_assistenz:rw'),
'Mitarbeiter' => self::PERM_LOGGED,
'Student' => self::PERM_LOGGED,
'Deadlines' => self::PERM_LOGGED
@@ -287,18 +287,24 @@ class Abgabe extends FHCAPI_Controller
private function signaturFehltEmail($student_uid) {
$this->load->model('crm/Student_model', 'StudentModel');
$this->load->model('education/Studiengang_model', 'StudiengangModel');
$this->load->model('organisation/Studiengang_model', 'StudiengangModel');
$this->StudentModel->addJoin('public.tbl_benutzer', 'ON (public.tbl_benutzer.uid = public.tbl_student.student_uid)');
$this->StudentModel->addJoin('public.tbl_person', 'person_id');
// $this->StudentModel->load($student_uid); -> this loads all students for some reason
$result = $this->StudentModel->loadWhere(array('student_uid' => $student_uid));
$this->StudentModel->resetQuery();
$result = $this->StudentModel->load($student_uid);
$studentArr = $this->getDataOrTerminateWithError($result);
if(count($studentArr) > 0) {
$student = $studentArr[0];
} else {
$this->terminateWithError($this->p->t('global','userNichtGefunden'), 'general');
}
$result = $this->Studiengang_model->load($student->studiengang_kz);
$result = $this->StudiengangModel->load($student->studiengang_kz);
$studiengangArr = $this->getDataOrTerminateWithError($result);
if(count($studiengangArr) > 0) {
@@ -341,7 +347,6 @@ class Abgabe extends FHCAPI_Controller
$this->terminateWithError($this->p->t('global','projektarbeitNichtGefunden'), 'general');
}
$this->load->model('education/Projektarbeit_model', 'ProjektarbeitModel');
$projektarbeitIsCurrent = $this->ProjektarbeitModel->projektarbeitIsCurrent($projektarbeit_id);
if(!$projektarbeitIsCurrent) {
$this->terminateWithError($this->p->t('abgabetool','c4fehlerAktualitaetProjektarbeit'), 'general');
+1 -3
View File
@@ -36,11 +36,9 @@ export default {
};
},
getStudentProjektarbeitAbgabeFile(paabgabe_id, student_uid) {
// TODO: check if this is fine with new api scheme
const url = `/Cis/Abgabetool/getStudentProjektarbeitAbgabeFile?paabgabe_id=${paabgabe_id}&student_uid=${student_uid}`;
window.location = FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + url
window.open(FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + url)
},
getMitarbeiterProjektarbeiten(all) {
return {
@@ -420,7 +420,7 @@ export const AbgabeMitarbeiterDetail = {
</div>
</template>
<template v-slot:footer>
<button type="button" class="btn btn-primary" @click="handleSaveNewAbgabe(newTermin)">{{ $p.t('global/c4saveNewAbgabetermin') }}</button>
<button type="button" class="btn btn-primary" @click="handleSaveNewAbgabe(newTermin)">{{ $p.t('abgabetool/c4saveNewAbgabetermin') }}</button>
</template>
</bs-modal>
@@ -530,9 +530,9 @@ export const AbgabeMitarbeiterDetail = {
<div class="col-4 col-md-3 fw-bold">{{$p.t('abgabetool/c4abgabedatum')}}</div>
<div class="col-8 col-md-9">
{{ termin.abgabedatum?.split("-").reverse().join(".") }}
<a v-if="termin?.abgabedatum" @click="downloadAbgabe(termin)" style="margin-left:4px; cursor: pointer;">
<i class="fa-solid fa-2x fa-file-pdf"></i>
</a>
<button v-if="termin?.abgabedatum" @click="downloadAbgabe(termin)" class="btn btn-primary">
<a> {{$p.t('abgabetool/c4downloadAbgabe')}} <i class="fa fa-file-pdf" style="margin-left:4px; cursor: pointer;"></i></a>
</button>
</div>
</div>
<div class="row mt-2">
@@ -52,21 +52,54 @@ export const AbgabeStudentDetail = {
return false
}
// TODO: refine these
// TODO: define these
if(endupload) {
// check these input fields for length of entry ? standard fallback '' anyways
// this.form['abstract']
// this.form['abstract_en']
// this.form['schlagwoerter']
// this.form['schlagwoerter_en']
// this.form['seitenanzahl']
if(this.form['abstract'].length < 10 && await this.$fhcAlert.confirm({
message: 'Abstract is very short, wirklich speichern?',
acceptLabel: 'Verstanden und Fortfahren',
// check these input fields for length of entry
if(this.form['abstract'].length < 100 && await this.$fhcAlert.confirm({
message: this.$p.t('abgabetool/warningShortAbstract'),
acceptLabel: this.$p.t('abgabetool/c4AcceptAndProceed'),
acceptClass: 'btn btn-danger',
rejectLabel: 'Zurück',
rejectLabel: this.$p.t('abgabetool/c4Cancel'),
rejectClass: 'btn btn-outline-secondary'
}) === false) {
return false
}
if(this.form['abstract_en'].length < 100 && await this.$fhcAlert.confirm({
message: this.$p.t('abgabetool/warningShortAbstractEn'),
acceptLabel: this.$p.t('abgabetool/c4AcceptAndProceed'),
acceptClass: 'btn btn-danger',
rejectLabel: this.$p.t('abgabetool/c4Cancel'),
rejectClass: 'btn btn-outline-secondary'
}) === false) {
return false
}
if(this.form['schlagwoerter'].length < 50 && await this.$fhcAlert.confirm({
message: this.$p.t('abgabetool/warningShortSchlagwoerter'),
acceptLabel: this.$p.t('abgabetool/c4AcceptAndProceed'),
acceptClass: 'btn btn-danger',
rejectLabel: this.$p.t('abgabetool/c4Cancel'),
rejectClass: 'btn btn-outline-secondary'
}) === false) {
return false
}
if(this.form['schlagwoerter_en'].length < 50 && await this.$fhcAlert.confirm({
message: this.$p.t('abgabetool/warningShortSchlagwoerterEn'),
acceptLabel: this.$p.t('abgabetool/c4AcceptAndProceed'),
acceptClass: 'btn btn-danger',
rejectLabel: this.$p.t('abgabetool/c4Cancel'),
rejectClass: 'btn btn-outline-secondary'
}) === false) {
return false
}
if(this.form['seitenanzahl'] <= 5 && await this.$fhcAlert.confirm({
message: this.$p.t('abgabetool/warningSmallSeitenanzahl'),
acceptLabel: this.$p.t('abgabetool/c4AcceptAndProceed'),
acceptClass: 'btn btn-danger',
rejectLabel: this.$p.t('abgabetool/c4Cancel'),
rejectClass: 'btn btn-outline-secondary'
}) === false) {
return false
@@ -159,13 +192,13 @@ export const AbgabeStudentDetail = {
},
handleUploadRes(res, termin) {
if(res.meta.status == "success") {
this.$fhcAlert.alertSuccess('File erfolgreich hochgeladen')
this.$fhcAlert.alertSuccess(this.$p.t('abgabetool/c4fileUploadSuccess'))
// update 'abgabedatum' for successful upload -> shows the pdf icon and date once set
termin.abgabedatum = new Date().toISOString().split('T')[0];
} else {
this.$fhcAlert.alertError('File upload error')
this.$fhcAlert.alertError(this.$p.t('abgabetool/c4fileUploadError'))
}
if(res.meta.signaturInfo) {
@@ -316,7 +349,7 @@ export const AbgabeStudentDetail = {
</div>
</div>
<div class="row mt-2">
<div v-if="termin.kurzbz && termin.kurzbz.length > 0" class="row mt-2">
<div class="col-4 col-md-3 fw-bold">{{$p.t('abgabetool/c4abgabekurzbz')}}</div>
<div class="col-8 col-md-9">
<Textarea style="margin-bottom: 4px;" v-model="termin.kurzbz" :rows=" isMobile ? 2 : 4" :cols=" isMobile ? 25 : 90" :disabled="true"></Textarea>
@@ -327,9 +360,9 @@ export const AbgabeStudentDetail = {
<div class="col-4 col-md-3 fw-bold">{{$p.t('abgabetool/c4abgabedatum')}}</div>
<div class="col-8 col-md-9">
{{ termin.abgabedatum?.split("-").reverse().join(".") }}
<a v-if="termin?.abgabedatum" @click="downloadAbgabe(termin)" style="margin-left:4px; cursor: pointer;">
<i class="fa-solid fa-2x fa-file-pdf"></i>
</a>
<button v-if="termin?.abgabedatum" @click="downloadAbgabe(termin)" class="btn btn-primary">
<a> {{$p.t('abgabetool/c4downloadAbgabe')}} <i class="fa fa-file-pdf" style="margin-left:4px; cursor: pointer;"></i></a>
</button>
</div>
</div>
@@ -391,6 +391,10 @@ export const AbgabetoolMitarbeiter = {
this.setupMounted()
},
template: `
<div id="loadingOverlay" v-show="loading || saving" style="position: absolute; width: 100vw; height: 100vh; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.5); z-index: 99999999999;">
<i class="fa-solid fa-spinner fa-pulse fa-5x"></i>
</div>
<bs-modal ref="modalContainerAddSeries" class="bootstrap-prompt"
dialogClass="modal-lg">
<template v-slot:title>
@@ -487,13 +491,6 @@ export const AbgabetoolMitarbeiter = {
{{ $p.t('abgabetool/showDeadlines') }}
</button>
<div v-show="saving">
{{ $p.t('abgabetool/currentlySaving') }} <i class="fa-solid fa-spinner fa-pulse fa-3x"></i>
</div>
<div v-show="loading">
{{ $p.t('abgabetool/currentlyLoading') }} <i class="fa-solid fa-spinner fa-pulse fa-3x"></i>
</div>
</template>
</core-filter-cmpt>
@@ -48,7 +48,7 @@ export const AbgabetoolStudent = {
let qgate2Passed = false
termine.forEach(t => {
const noteOption = this.notenOptions.find(opt => opt.note == t.note)
const noteOption = this.notenOptions?.find(opt => opt.note == t.note)
if(noteOption && noteOption.positiv) {
if(t.paabgabetyp_kurzbz == 'qualgate1') {
qgate1Passed = true
@@ -196,12 +196,15 @@ export const AbgabetoolStudent = {
} else return ''
},
getNoteBezeichnung(projektarbeit) {
if(projektarbeit.note) {
if(projektarbeit.note && this.notenOptions) {
const noteOpt = this.notenOptions.find(opt => opt.note == projektarbeit.note)
return noteOpt?.bezeichnung
} else {
return ''
}
},
handleDownloadBeurteilung(projektarbeit) {
window.open(projektarbeit.beurteilung)
}
},
watch: {
@@ -212,9 +215,10 @@ export const AbgabetoolStudent = {
return this.student_uid !== this.viewData.uid
}
},
created() {
async created() {
this.loading = true
//TODO: SWITCH TO NOTEN API ONCE NOTENTOOL IS IN MASTER TO AVOID DUPLICATE API
this.$api.call(ApiAbgabe.getNoten()).then(res => {
await this.$api.call(ApiAbgabe.getNoten()).then(res => {
this.notenOptions = res.data
}).catch(e => {
this.loading = false
@@ -272,7 +276,9 @@ export const AbgabetoolStudent = {
<div class="row mt-2">
<div class="col-4 col-md-3 fw-bold">{{$p.t('abgabetool/c4beurteilung')}}</div>
<div class="col-8 col-md-9">
<a v-if="projektarbeit.beurteilung"><i class="fa fa-file-pdf" style="color:#00649C"></i></a>
<button v-if="projektarbeit.beurteilung" @click="handleDownloadBeurteilung(projektarbeit)" class="btn btn-primary">
<a> {{$p.t('abgabetool/c4downloadBeurteilung')}} <i class="fa fa-file-pdf" style="margin-left:4px; cursor: pointer;"></i></a>
</button>
<a v-else>{{$p.t('abgabetool/c4nobeurteilungVorhanden')}}</a>
</div>
</div>
+146 -6
View File
@@ -33898,6 +33898,46 @@ array(
)
)
),
array(
'app' => 'anwesenheiten',
'category' => 'global',
'phrase' => 'c4fileUploadSuccess',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Datei erfolgreich hochgeladen!',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'File upload successful',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'anwesenheiten',
'category' => 'global',
'phrase' => 'c4fileUploadError',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Fehler beim hochladen der Datei!',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'File upload error!',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'anwesenheiten',
'category' => 'global',
@@ -41944,7 +41984,7 @@ array(
'phrases' => array(
array(
'sprache' => 'German',
'text' => "Betreuer",
'text' => "BetreuerIn",
'description' => '',
'insertvon' => 'system'
),
@@ -42004,7 +42044,7 @@ array(
'phrases' => array(
array(
'sprache' => 'German',
'text' => "Dokumentabgabe - Studentenbereich",
'text' => "Dokumentabgabe - Studierendenbereich",
'description' => '',
'insertvon' => 'system'
),
@@ -42664,7 +42704,7 @@ array(
'phrases' => array(
array(
'sprache' => 'German',
'text' => "Studentenansicht",
'text' => "Studierendenansicht",
'description' => '',
'insertvon' => 'system'
),
@@ -42844,13 +42884,13 @@ array(
'phrases' => array(
array(
'sprache' => 'German',
'text' => "Möchten Sie w",
'text' => "Möchten Sie wirklich Löschen?",
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'No projects found!',
'text' => 'Do you really want to delete?',
'description' => '',
'insertvon' => 'system'
)
@@ -42924,7 +42964,7 @@ array(
'phrases' => array(
array(
'sprache' => 'German',
'text' => "Emailkontakt Betreuer",
'text' => "Emailkontakt BetreuerIn",
'description' => '',
'insertvon' => 'system'
),
@@ -42956,6 +42996,26 @@ array(
)
)
),
array(
'app' => 'core',
'category' => 'abgabetool',
'phrase' => 'c4downloadBeurteilung',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => "Beurteilung herunterladen",
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Download Evaluation',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'abgabetool',
@@ -42976,6 +43036,86 @@ array(
)
)
),
array(
'app' => 'core',
'category' => 'abgabetool',
'phrase' => 'c4AcceptAndProceed',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => "Akzeptieren und Fortfahren",
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Accept and proceed',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'abgabetool',
'phrase' => 'c4Cancel',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => "Abbrechen",
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Cancel',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'abgabetool',
'phrase' => 'c4downloadAbgabe',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => "Abgabe herunterladen",
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Download Abgabe',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'abgabetool',
'phrase' => 'warningShortAbstract',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => "Ihr Abstract ist sehr kurz, möchten Sie den Endupload trotzdem durchführen?",
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Your abstract is very short. Would you still like to complete the final upload?',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'abgabetool',