From: soufiane Date: Mon, 27 Nov 2023 13:27:08 +0000 (+0100) Subject: wait #6479 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=6b6f017c97bc2be0c546d9113b6e431c2d62fce0;p=fluidbook-toolbox.git wait #6479 --- diff --git a/app/Models/FluidbookExternalInstallServer.php b/app/Models/FluidbookExternalInstallServer.php index cefbe5ba7..32022e19e 100644 --- a/app/Models/FluidbookExternalInstallServer.php +++ b/app/Models/FluidbookExternalInstallServer.php @@ -26,6 +26,8 @@ class FluidbookExternalInstallServer extends ExternalServer protected $_operations = [ServerOperation::class]; + private static $id; + protected static function _getOneServer($server) { return array_merge(parent::_getOneServer($server), ['allows_root' => $server->allows_root]); @@ -105,7 +107,6 @@ class FluidbookExternalInstallServer extends ExternalServer ]; $result = static::find($id)->getTransferDriver()->checkConnexion($data); - //dump($result); if($result === true) { $result_['success'] = true; } else { @@ -115,10 +116,10 @@ class FluidbookExternalInstallServer extends ExternalServer return $result_; } - public function listFluidbook() + public static function getListFluidbook($id) { - $id = $this->id; - $results = DB::table('fluidbook_publication') + $id = strval($id); + return DB::table('fluidbook_publication') ->whereJsonContains('settings->install_online->server', $id) ->get() ->toArray(); diff --git a/resources/views/vendor/backpack/crud/edit-external-server.blade.php b/resources/views/vendor/backpack/crud/edit-external-server.blade.php index b15eb674f..8019a3336 100644 --- a/resources/views/vendor/backpack/crud/edit-external-server.blade.php +++ b/resources/views/vendor/backpack/crud/edit-external-server.blade.php @@ -10,9 +10,6 @@ window.location.href = $(this).attr('href') + document.location.hash; }); - //$("#saveActions").prepend("") - $("#saveActions").prepend("Tester la connexion") - function removeBtn() { setTimeout(() => { $("#message").remove() @@ -57,5 +54,116 @@ @endpush @include('cubist_back::when') -@include('crud::edit') +@php + + start_measure('Render edit form'); +@endphp + +@extends(backpack_view('blank')) +@include('cubist_back::form.additional_edit_views') + +@push('crud_fields_scripts') + +@endpush + +@push('after_styles') + +@endpush + +@include('cubist_back::when') + +@php + $defaultBreadcrumbs = [ + trans('backpack::crud.admin') => backpack_url('dashboard'), + $crud->entity_name_plural => url($crud->route), + trans('backpack::crud.edit') => false, + ]; + + // if breadcrumbs aren't defined in the CrudController, use the default breadcrumbs + $breadcrumbs = $breadcrumbs ?? $defaultBreadcrumbs; +@endphp + +@section('header') +
+

+ {!! $crud->getHeading() ?? $crud->entity_name_plural !!} + {!! $crud->getSubheading() ?? trans('backpack::crud.edit').' '.$crud->entity_name !!}. + + @if ($crud->hasAccess('list')) + {{ trans('backpack::crud.back_to_all') }} + {{ $crud->entity_name_plural }} + @endif +

+
+@endsection + +@section('content') +
+
+ {{-- Default box --}} + + @include('crud::inc.grouped_errors') + +
hasUploadFields('update', $entry->getKey())) + enctype="multipart/form-data" + @endif + > + {!! csrf_field() !!} + {!! method_field('PUT') !!} + + @if ($crud->model->translationEnabled()) +
+ {{-- Single button --}} +
+ + +
+
+ @endif + {{-- load the view from the application if it exists, otherwise load the one in the package --}} + @if(view()->exists('vendor.backpack.crud.form_content')) + @include('vendor.backpack.crud.form_content', ['fields' => $crud->fields(), 'action' => 'edit']) + @else + @include('crud::form_content', ['fields' => $crud->fields(), 'action' => 'edit']) + @endif + {{-- This makes sure that all field assets are loaded. --}} +
{{ json_encode(Assets::loaded()) }}
+ @include('crud::inc.form_save_buttons') +
+ @include('vendor.backpack.crud.list-fluidbook') +
+ @include('cubist_back::form.shortcuts') +
+ + @stack('after_form') +@endsection +@php + + stop_measure('Render edit form'); +@endphp diff --git a/resources/views/vendor/backpack/crud/inc/form_save_buttons.blade.php b/resources/views/vendor/backpack/crud/inc/form_save_buttons.blade.php index 1375623ed..f797f6aad 100644 --- a/resources/views/vendor/backpack/crud/inc/form_save_buttons.blade.php +++ b/resources/views/vendor/backpack/crud/inc/form_save_buttons.blade.php @@ -8,7 +8,9 @@ @endphp @if(isset($saveAction['active']) && !is_null($saveAction['active']['value']))
- + @if($crud->entry->getTable() === "fluidbook_external_install_server") + Tester la connexion + @endif @if(!empty($saveAction['options']))
diff --git a/resources/views/vendor/backpack/crud/list-fluidbook.blade.php b/resources/views/vendor/backpack/crud/list-fluidbook.blade.php new file mode 100644 index 000000000..2b7fd8c16 --- /dev/null +++ b/resources/views/vendor/backpack/crud/list-fluidbook.blade.php @@ -0,0 +1,29 @@ +@php + $tableClasses='stats-details sortable bg-white table table-striped table-hover nowrap rounded shadow-xs border-xs mt-2 dataTable dtr-inline'; + + $id = $crud->entry->id; + + $fluidbooks= \App\Models\FluidbookExternalInstallServer::getListFluidbook($id); +@endphp + +@if($fluidbooks) +
+

Liste des fluidbooks installés sur ce serveur

+ + + + + + + + + @foreach($fluidbooks as $fluidbook) + + + + + @endforeach + +
#TitreChemin d'installationURL finale du fluidbook
{{$fluidbook->id}}{{$fluidbook->c_title}}{{json_decode($fluidbook->settings, true)['install_online']['path']}}{{$crud->entry->base_url.json_decode($fluidbook->settings, true)['install_online']['path']}}
+
+@endif