]> _ Git - fluidbook-toolbox.git/commitdiff
wip #6555 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 5 Dec 2023 13:15:35 +0000 (14:15 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 5 Dec 2023 13:15:35 +0000 (14:15 +0100)
app/Models/FluidbookExternalInstallServer.php

index c18fef4b7239f8eb66454a12ab5df8f9d38429df..a74f42caee09402ecda6c25b0bb7ddfd3d5e7b8c 100644 (file)
@@ -5,6 +5,7 @@ namespace App\Models;
 use App\Http\Controllers\Admin\Operations\ServerOperation;
 use Cubist\Backpack\Magic\Fields\Checkbox;
 use Cubist\Backpack\Magic\Fields\Table;
+use Cubist\Backpack\Magic\Fields\Textarea;
 use Cubist\Backpack\Magic\Models\ExternalServer;
 use Cubist\Net\Transfer\Local;
 use Cubist\Util\Files\Files;
@@ -23,6 +24,8 @@ class FluidbookExternalInstallServer extends ExternalServer
 
     protected static $_permissionBase = 'fluidbook-external-install-server';
 
+    protected static $hostingProtocols = ['hosting', 'ushosting'];
+
     protected $_operations = [ServerOperation::class];
 
     private static $id;
@@ -35,7 +38,12 @@ class FluidbookExternalInstallServer extends ExternalServer
     public function setFields()
     {
 
+        $nothostingProtocols = array_diff(array_keys($this->getProtocols(), static::$hostingProtocols));
+
         parent::setFields();
+        $this->getField('base_url')->setAttribute('when', ['protocol' => $nothostingProtocols]);
+        $this->addField('subdomains', Textarea::class, __('Sous-domaines'), ['when' => ['protocol' => static::$hostingProtocols]]);
+        $this->addField('php', Checkbox::class, __('Activer le support de PHP'), ['default' => false, 'when' => ['protocol' => static::$hostingProtocols]]);
         $this->addField('redirections', Table::class, __('Redirections'), ['entity_singular' => __('redirection'), 'columns' => ['from' => __('De'), 'to' => __('Vers')], 'when' => ['protocol' => 'hosting']]);
         $this->addField('allows_root', Checkbox::class, __('Autoriser le chargement à la racine (sur le chemin de base)'), ['default' => false]);
     }
@@ -106,7 +114,7 @@ class FluidbookExternalInstallServer extends ExternalServer
         ];
 
         $result = static::find($id)->getTransferDriver()->checkConnexion($data);
-        if($result === true) {
+        if ($result === true) {
             $result_['success'] = true;
         } else {
             $result_['error'] = true;
@@ -123,7 +131,8 @@ class FluidbookExternalInstallServer extends ExternalServer
             ->toArray();
     }
 
-    public static function messages() {
+    public static function messages()
+    {
         return [
             __("L'hôte est manquant"),
             __("L'hôte ou le mot de passe est invalide"),