- composer updates

- consistent repository identifier in OAI requests
- open default formats in browser
- open files in new tab
This commit is contained in:
Arno Kaimbacher 2020-04-16 22:29:26 +02:00
parent 17fcdec50e
commit 8208558e8c
4 changed files with 48 additions and 54 deletions

View file

@ -20,7 +20,7 @@ class RequestController extends Controller
* @var array
*/
private $deliveringDocumentStates = array('published', 'deleted'); // maybe deleted documents too
private $xMetaDissRestriction = array('doctoralthesis', 'habilitation');
//private $xMetaDissRestriction = array('doctoralthesis', 'habilitation');
const SET_SPEC_PATTERN = '[A-Za-z0-9\-_\.!~\*\'\(\)]+';
/**
@ -169,6 +169,8 @@ class RequestController extends Controller
*/
private function handleGetRecord(array &$oaiRequest)
{
$repIdentifier = "tethys.at";
$this->proc->setParameter('', 'repIdentifier', $repIdentifier);
// Identifier references metadata Urn, not plain Id!
// Currently implemented as 'oai:foo.bar.de:{docId}' or 'urn:nbn...-123'
$dataId = $this->getDocumentIdByIdentifier($oaiRequest['identifier']);
@ -194,7 +196,8 @@ class RequestController extends Controller
if (is_null($dataset)
//or (false === in_array($dataset->getServerState(), $this->_deliveringDocumentStates))
or (false === $dataset->whereIn('server_state', $this->deliveringDocumentStates))
or (false === $dataset->hasEmbargoPassed())) {
//or (false === $dataset->hasEmbargoPassed())
) {
throw new OaiModelException('Document is not available for OAI export!', OaiModelError::NORECORDSMATCH);
}
@ -280,7 +283,7 @@ class RequestController extends Controller
*/
private function handleListSets()
{
$repIdentifier = "tethys.geologie.ac.at";
$repIdentifier = "tethys.at";
$this->proc->setParameter('', 'repIdentifier', $repIdentifier);
$this->xml->appendChild($this->xml->createElement('Datasets'));
@ -329,7 +332,7 @@ class RequestController extends Controller
$maxRecords = 100;
}
$repIdentifier = "tethys.geologie.ac.at";
$repIdentifier = "tethys.at";
$tokenTempPath = storage_path('app/resumption'); //$this->_configuration->getResumptionTokenPath();
$this->proc->setParameter('', 'repIdentifier', $repIdentifier);

View file

@ -2,8 +2,8 @@
namespace App\Http\Controllers\Settings;
use App\Http\Controllers\Controller;
use Illuminate\View\View;
use Illuminate\Http\Request;
// use Illuminate\View\View;
// use Illuminate\Http\Request;
use App\Models\File;
class FileController extends Controller
@ -14,7 +14,24 @@ class FileController extends Controller
$file = File::findOrFail($id);
$file_path = public_path('storage/' . $file->path_name);
$ext = \Illuminate\Support\Facades\File::extension($file_path);
return response()->download($file_path, $file->label . "." . $ext, ['Content-Type:' . $file->mime_type]);
// return response()
// ->download(
// $file_path,
// $file->label . "." . $ext,
// ['Content-Type:' . $file->mime_type],
// 'inline'
// );
$pdf = $file->label . "." . $ext;
$download_file = \Illuminate\Support\Facades\File::get($file_path);
return response()->file($file_path, [
'Cache-Control' => 'no-cache private',
'Content-Description' => 'File Transfer',
'Content-Type' => $file->mime_type,
'Content-length' => strlen($download_file),
'Content-Disposition' => 'inline; filename=' . $pdf,
'Content-Transfer-Encoding' => 'binary'
]);
// return response()->download($file_path, $file->label, ['Content-Type:' . $file->mime_type]);
}
}