use App\Models\FluidbookPublication;
use Cubist\Backpack\Http\Controllers\Base\XSendFileController;
use Cubist\Util\Files\Files;
+use Cubist\Util\Gzip;
use Cubist\Util\Str;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Session;
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');
}
protected function setupCompositionDefaults()
{
}
+ protected function getPageText($fluidbook_id, $type, $page)
+ {
+ $types = ['texts' => FluidbookDocument::TEXT_PLAIN, 'index' => FluidbookDocument::TEXT_INDEX];
+ if (!isset($types[$type])) {
+ abort(404, 'Text type not found');
+ }
+ if (!FluidbookPublication::hasPermission($fluidbook_id)) {
+ abort(401);
+ }
+ /** @var FluidbookPublication $fb */
+ $fb = FluidbookPublication::find($fluidbook_id);
+ $document = $fb->getDocument($page);
+ $path = $document->getTextFile($page, $types[$type], $fb->textExtraction, $fb->ignoreSearchSeparators);
+ return response(Gzip::file_get_contents($path), 200, ['content-type' => 'text/plain']);
+ }
+
protected function getThumb($doc_id, $doc_page)
{
window.open('/fluidbook-publication/' + {{$entry->id}} + '/edit/links#' + ($(opt.$trigger[0]).index() + 1))
},
},
- }, compositionContextConversionSettings());
+ }, compositionContextConversionSettings(), compositionContextSee());
+ }
+
+ function compositionContextSee() {
+ return {
+ sepsee: "---------",
+ foldsee: {
+ name: "{{__('Visualiser')}}",
+ items: {
+ seetexts: {
+ name: "{{__('Textes extraits')}}",
+ callback: function (key, opt) {
+ window.open('/fluidbook-publication/' + {{$entry->id}} + '/texts/' + ($(opt.$trigger[0]).index() + 1) + '.txt');
+ },
+ },
+ seeindex: {
+ name: "{{__('Index de recherche')}}",
+ callback: function (key, opt) {
+ window.open('/fluidbook-publication/' + {{$entry->id}} + '/index/' + ($(opt.$trigger[0]).index() + 1) + '.txt');
+ },
+ }
+ }
+ }
+ };
}
function getPageNumber() {