Skip to content
Snippets Groups Projects
Commit ac88ca6e authored by David Siegfried's avatar David Siegfried
Browse files

prevent php-errors, closes #3188

Closes #3188

Merge request studip/studip!2157
parent eca369df
No related branches found
No related tags found
No related merge requests found
...@@ -1445,6 +1445,15 @@ class FileController extends AuthenticatedController ...@@ -1445,6 +1445,15 @@ class FileController extends AuthenticatedController
User::findCurrent() User::findCurrent()
); );
if (is_array($newfile)) {
PageLayout::postError(
_('Beim Kopieren ist ein Fehler aufgetreten'),
array_map('htmlReady', $newfile)
);
$this->redirectToFolder($this->to_folder_type);
return;
}
if (Request::isXhr()) { if (Request::isXhr()) {
$this->current_folder = $this->to_folder_type; $this->current_folder = $this->to_folder_type;
$this->marked_element_ids = []; $this->marked_element_ids = [];
...@@ -1468,57 +1477,13 @@ class FileController extends AuthenticatedController ...@@ -1468,57 +1477,13 @@ class FileController extends AuthenticatedController
'X-Dialog-Execute', 'X-Dialog-Execute',
'STUDIP.Files.addFile' 'STUDIP.Files.addFile'
); );
return $this->render_json($payload); $this->render_json($payload);
return;
} else { } else {
PageLayout::postSuccess(_('Datei wurde hinzugefügt.')); PageLayout::postSuccess(_('Datei wurde hinzugefügt.'));
return $this->redirectToFolder($this->to_folder_type); $this->redirectToFolder($this->to_folder_type);
return;
} }
/*if ($file_ref instanceof FileRef) {
if (in_array($this->to_folder_type->range_type, ['course', 'institute']) && !$file_ref->content_terms_of_use_id) {
$this->redirect($this->url_for(
"file/edit_license/{$this->to_folder_type->getId()}",
['file_refs' => [$file_ref->id]]
));
return;
} elseif (Request::isXhr()) {
$this->file = $file_ref->getFileType();
$this->current_folder = $this->to_folder_type;
$this->marked_element_ids = [];
$plugins = PluginManager::getInstance()->getPlugins('FileUploadHook');
$redirects = [];
foreach ($plugins as $plugin) {
$url = $plugin->getAdditionalUploadWizardPage($file_ref);
if ($url) {
$redirects[] = $url;
}
}
$payload = [
'html' => FilesystemVueDataManager::getFileVueData($this->file, $this->current_folder),
'redirect' => $redirects[0],
'url' => $this->generateFilesUrl($this->current_folder, $this->file_ref),
];
$this->response->add_header(
'X-Dialog-Execute',
'STUDIP.Files.addFile'
);
return $this->render_json($payload);
} else {
PageLayout::postSuccess(_('Datei wurde hinzugefügt.'));
return $this->redirectToFolder($this->to_folder_type);
}
} else {
if (is_array($file_ref)) {
$error = $file_ref;
}
if(!is_array($error)) {
$error = [$error];
}
PageLayout::postError(_('Konnte die Datei nicht hinzufügen.'), array_map('htmlReady', $error));
}*/
} }
if (Request::get('from_plugin')) { if (Request::get('from_plugin')) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment