protected $_subject = 'Fluidbook ":title" (#:nb) prêt au téléchargement';
// __('Fluidbook ":title" (#:nb) installé sur hosting')
protected $_installHostingSubject = 'Fluidbook ":title" (#:nb) installé sur hosting';
+ // __('Fluidbook ":title" (#:nb) installé sur un serveur FTP')
+ protected $_installFTPSubject = 'Fluidbook ":title" (#:nb) installé sur hosting';
public function __construct($entry, $version, $action, $user)
{
$actions = ['Voir sur hosting' => 'https://hosting.fluidbook.com/' . $dest . '/'];
} else if ($this->action === 'install_ftp') {
+ $dest = self::_cleanInstallDir($this->entry->install_online_ftp);
+ if (!$dest) {
+ throw new \Exception('No path defined for ftp installation');
+ }
+ $subject = __($this->_installFTPSubject, ['title' => $this->_title(), 'nb' => $this->_id()]);
+ $path = $this->_compileandpackage(false);
+ $actions = [];
}
} catch (\Exception $e) {
$subject = __('Erreur lors de la compilation du :type :nb', ['nb' => $this->_id(), 'type' => $this->type]);
--- /dev/null
+<?php
+
+namespace App\Models;
+
+use Cubist\Backpack\Magic\Fields\Checkbox;
+use Cubist\Backpack\Magic\Fields\Integer;
+use Cubist\Backpack\Magic\Fields\Password;
+use Cubist\Backpack\Magic\Fields\SelectFromArray;
+use Cubist\Backpack\Magic\Fields\Text;
+use Cubist\Backpack\Magic\Fields\URL;
+use Cubist\Backpack\Magic\Models\CubistMagicAbstractModel;
+
+class FluidbookExternalInstallServer extends CubistMagicAbstractModel
+{
+ protected $table = 'fluidbook_external_install_server';
+ protected $_options = ['name' => 'fluidbook-external-install-server',
+ 'singular' => 'serveur',
+ 'plural' => 'serveurs'];
+
+ protected static $_permissionBase = 'fluidbook-external-install-server';
+
+ public function setFields()
+ {
+ parent::setFields();
+
+ $ftpProtocols = ['FTP', 'FTPS', 'FTPES'];
+ $hostProtocols = ['FTP', 'FTPS', 'FTPES', 'SFTP'];
+ $portProtocols = $hostProtocols;
+ $userProtocols = $hostProtocols;
+ $passwordProtocols = $hostProtocols;
+
+ $this->addField('name', Text::class, __('Nom'), ['column' => true]);
+ $this->addField('protocol', SelectFromArray::class, __('Protocole'), ['options' => ['FTP' => __('FTP non sécurisé'), 'FTPS' => __('FTP sécurisé explicite sur TLS'), 'FTPES' => __('FTP sécurisé implicite sur TLS'), 'SFTP' => 'SFTP', 'hosting' => 'Hosting'], 'default' => 'FTP', 'column' => true, 'allows_null' => false]);
+ $this->addField('ftp_mode', SelectFromArray::class, __('Mode de transfert'), ['options' => ['0' => __('Mode passif'), '1' => __('Mode actif')], 'default' => '1', 'when' => ['protocol' => $ftpProtocols], 'allows_null' => false,]);
+ $this->addField('host', Text::class, __('Hôte'), ['default' => '', 'column' => true, 'when' => ['protocol' => $hostProtocols]]);
+ $this->addField('port', Integer::class, __('Port'), ['hint' => __('Laisser vide pour utiliser le port par défaut'), 'default' => '', 'min' => 1, 'max' => 65536, 'when' => ['protocol' => $portProtocols]]);
+ $this->addField('username', Text::class, __('Nom d\'utilisateur'), ['when' => ['protocol' => $userProtocols]]);
+ $this->addField('password', Password::class, __('Mot de passe'), ['when' => ['protocol' => $passwordProtocols]]);
+ $this->addField('base_path', Text::class, __('Chemin de base'), ['default' => '/']);
+ $this->addField('base_url', URL::class, __('URL de base'), ['default' => 'https://']);
+ }
+}
use App\Fields\FluidbookDevelopmentVersion;
use App\Fields\FluidbookSignature;
use App\Fields\SCORMVersion;
+use App\Models\FluidbookExternalInstallServer;
use Cubist\Backpack\Magic\Fields\Checkbox;
use Cubist\Backpack\Magic\Fields\FilesOrURL;
use Cubist\Backpack\Magic\Fields\FormSection;
'translatable' => false,
]);
if ($downloadVersion['install']) {
- $installFields = [
- 'hosting' => ['prefix' => 'https://hosting.fluidbook.com/', 'label' => __('Chemin sur le serveur hosting'), 'hint' => null],
- 'ftp' => ['prefix' => 'ftp://', 'label' => __('Chemin de connexion au serveur FTP'), 'hint' => __('username:password@host/path/to/install/folder')],
- ];
- foreach ($installFields as $iname => $installField) {
- $this->addField('install_' . $name . '_' . $iname, Text::class, $installField['label'], ['default' => '', 'fake' => true, 'translatable' => false, 'store_in' => 'settings', 'prefix' => $installField['prefix'], 'hint' => $installField['hint'], 'when' => ['download_' . $name => 1]]);
- }
-
+ $this->addField('install_' . $name, ExternalPath::class, $installField['label'], ['default' => '', 'fake' => true, 'translatable' => false, 'store_in' => 'settings', 'servers_model' => FluidbookExternalInstallServer::class, 'when' => ['download_' . $name => 1]]);
}
}
<li class="nav-item"><a class="nav-link" href="{{ backpack_url('signature') }}"><i
class="la la-signature nav-icon"></i> {{__('Signatures')}}</a></li>
@endcan
+ @can('fluidbook-external-install-server:read')
+ <li class="nav-item"><a class="nav-link" href="{{ backpack_url('fluidbook-external-install-server') }}"><i
+ class="la las la-server"></i> {{__('Serveurs externes')}}</a></li>
+ @endcan
@can('fluidbook-quote:read')
<li class="nav-item"><a class="nav-link" href="{{ backpack_url('fluidbook-quote') }}"><i
class="la la-wpforms nav-icon"></i> {{__('Demandes de devis')}}</a></li>
@endcan
@can('team-pay:read')
<li class="nav-item"><a class="nav-link"
- href='{{ backpack_url('team-pay') }}'><i class="nav-icon las la-file-invoice-dollar"></i>
+ href='{{ backpack_url('team-pay') }}'><i
+ class="nav-icon las la-file-invoice-dollar"></i>
<span>{{__('Bulletins de salaire')}}</span></a>
</li>
@endcan
@endcan
@can('team-overtime:read')
<li class="nav-item"><a class="nav-link"
- href='{{ backpack_url('team-overtime') }}'><i class="nav-icon las la-stopwatch"></i>
+ href='{{ backpack_url('team-overtime') }}'><i
+ class="nav-icon las la-stopwatch"></i>
<span>{{__('Heures supp')}}</span></a>
</li>
@endcan