Route::match(['post'], $segment . '/uploaddocument', $controller . '@upload');
Route::match(['get'], $segment . '/uploadProgress/{uploadID}', $controller . '@uploadProgress');
Route::match(['get'], $segment . '/docInfos/{doc_id}', $controller . '@docInfos');
- Route::match(['get'], $segment . '/{fluidbook_id}/{type}/{page}.txt', $controller . '@getPageText');
+ Route::match(['get'], $segment . '/{fluidbook_id}/{type}/{page}.{ext}', $controller . '@getPageAsset');
}
protected function setupCompositionDefaults()
{
}
- protected function getPageText($fluidbook_id, $type, $page)
+ protected function getPageAsset($fluidbook_id, $type, $page, $ext)
{
- $types = ['texts' => FluidbookDocument::TEXT_PLAIN, 'index' => FluidbookDocument::TEXT_INDEX, 'layout' => FluidbookDocument::TEXT_LAYOUT];
- if (!isset($types[$type])) {
- abort(404, 'Text type not found');
- }
if (!FluidbookPublication::hasPermission($fluidbook_id)) {
abort(401);
}
/** @var FluidbookPublication $fb */
$fb = FluidbookPublication::withoutGlobalScopes()->find($fluidbook_id);
+ if ($type === 'originalpdf') {
+ $doc = $fb->getDocument($page);
+ return XSendFileController::sendfile(protected_path('fluidbookpublication/docs/' . $doc->id . '/original.pdf'), 86400, ['Content-Disposition', 'attachment; filename="' . $doc->id . '.pdf"']);
+ }
+ $types = ['texts' => FluidbookDocument::TEXT_PLAIN, 'index' => FluidbookDocument::TEXT_INDEX, 'layout' => FluidbookDocument::TEXT_LAYOUT];
+ if (!isset($types[$type])) {
+ abort(404, 'Text type not found');
+ }
$contentType = 'text/plain';
if ($type == FluidbookDocument::TEXT_LAYOUT) {
$path = $fb->getHightlightFile($page);
foldsee: {
name: "{{__('Visualiser')}}",
items: {
+ originalpdf: {
+ name: "{{__('PDF Original')}}",
+ callback: function (key, opt) {
+ window.open('/fluidbook-publication/' + {{$entry->id}} + '/originalpdf/' + ($(opt.$trigger[0]).index() + 1) + '.pdf');
+ },
+ },
seetexts: {
name: "{{__('Textes extraits')}}",
callback: function (key, opt) {