diff --git a/application/controllers/api/frontend/v1/notiz/NotizPerson.php b/application/controllers/api/frontend/v1/notiz/NotizPerson.php index 2cf1f2519..1c5524800 100644 --- a/application/controllers/api/frontend/v1/notiz/NotizPerson.php +++ b/application/controllers/api/frontend/v1/notiz/NotizPerson.php @@ -17,17 +17,27 @@ class NotizPerson extends Notiz_Controller { if($typeId != "person_id") { - return $this->terminateWithError($this->p->t('ui','error_typeNotizIdIncorrect'), self::ERROR_TYPE_GENERAL); + return $this->terminateWithError($this->p->t('ui', 'error_typeNotizIdIncorrect'), self::ERROR_TYPE_GENERAL); } //TODO define permission - if(!$this->permissionlib->isBerechtigt('admin', 'suid') && !$this->permissionlib->isBerechtigt('assistenz', 'suid')) + if (!$this->permissionlib->isBerechtigt('admin', 'suid') && !$this->permissionlib->isBerechtigt('assistenz', 'suid')) { - $result = $this->p->t('lehre','error_keineSchreibrechte'); + $result = $this->p->t('lehre', 'error_keineSchreibrechte'); return $this->terminateWithError($result, self::ERROR_TYPE_GENERAL); } return $this->outputJsonSuccess(true); } + + public function loadDokumente() + { + $notiz_id = $this->input->post('notiz_id'); + + // TODO(chris): make CI variant of endpoint + $this->NotizModel->addSelect($this->NotizModel->escape(base_url('content/notizdokdownload.php?id=' . $notiz_id)) . ' AS preview'); + + return parent::loadDokumente(); + } } \ No newline at end of file diff --git a/application/core/Notiz_Controller.php b/application/core/Notiz_Controller.php index 1b78f15f7..618b6a2ef 100644 --- a/application/core/Notiz_Controller.php +++ b/application/core/Notiz_Controller.php @@ -475,7 +475,6 @@ abstract class Notiz_Controller extends FHCAPI_Controller public function loadDokumente() { - $_POST = json_decode(utf8_encode($this->input->raw_input_stream), true); $notiz_id = $this->input->post('notiz_id'); $this->NotizModel->addSelect('campus.tbl_dms_version.*'); diff --git a/public/js/components/Form/Upload/Dms.js b/public/js/components/Form/Upload/Dms.js index 6ad69848c..47ba168fb 100644 --- a/public/js/components/Form/Upload/Dms.js +++ b/public/js/components/Form/Upload/Dms.js @@ -1,4 +1,9 @@ +import DmsItem from './Dms/Item.js'; + export default { + components: { + DmsItem + }, emits: [ 'update:modelValue' ], @@ -81,13 +86,14 @@ export default {
` } diff --git a/public/js/components/Form/Upload/Dms/Item.js b/public/js/components/Form/Upload/Dms/Item.js new file mode 100644 index 000000000..45c60419e --- /dev/null +++ b/public/js/components/Form/Upload/Dms/Item.js @@ -0,0 +1,37 @@ +export default { + emits: [ + 'delete' + ], + props: { + modelValue: { + type: [File, Object], + required: true + } + }, + data() { + return { + preview: '' + }; + }, + watch: { + modelValue(n) { + if (n.type == 'application/x.fhc-dms+json') { + n.text().then(result => { + const obj = JSON.parse(result); + this.preview = obj.preview || ''; + }); + } + } + }, + template: ` +
  • + + {{ modelValue.name }} + + + + +
  • ` +}