fluidbookpublication/final
fluidbookpublication/seo
fluidbookpublication/pdf
+fluidbookcollection/final
collection/final
elearningpackage/final
elearningmedia/final
quiz/final
debugbar
+app/public/elearningmedia
+app/public/elearningpackage
+app/public/fluidbookcollection
+app/public/quiz
rsync -avz --delete --exclude-from /home/toolbox/dev/.docker/syncprodtodev.exclude --delete-excluded /data/toolbox/storage/ /data/toolbox/dev/storage/
# Sync database
docker stop fluidbook-toolbox-dev-mariadb
+rm -rf /docker/fluidbook-toolbox-dev/database/data/*
rsync -avz /docker/fluidbook-toolbox/database/data/ /docker/fluidbook-toolbox-dev/database/data/
docker stop fluidbook-toolbox-mariadb
rsync -avz /docker/fluidbook-toolbox/database/data/ /docker/fluidbook-toolbox-dev/database/data/
+sleep 1
+rsync -avz /docker/fluidbook-toolbox/database/data/ /docker/fluidbook-toolbox-dev/database/data/
docker start fluidbook-toolbox-mariadb
# Update and restart dev containers
/docker/fluidbook-toolbox-dev/update
--- /dev/null
+<?php
+
+namespace App\Fields;
+
+class FluidbookProjectManager extends CubedesignersTeamMember
+{
+ protected $_columnType = 'fluidbook_project_manager';
+ protected $_columnViewNamespace = 'columns';
+
+ public function _postSetAttributes()
+ {
+ parent::_postSetAttributes();
+ $this->setAttribute('optionsmodel_scope', 'currentTeam');
+ }
+}
protected function setupEditRoutes($segment, $routeName, $controller)
{
Route::match(['get'], $segment . '/{id}/changestatus/{status}', $controller . '@changeStatus');
+ Route::match(['get'], $segment . '/{id}/changeprojectmanager/{status}', $controller . '@changeProjectManager');
}
protected function changeStatus($fluidbook_id, $newStatus)
abort(401);
}
$fluidbook = FluidbookPublication::find($fluidbook_id);
- if (!$fluidbook) {
+ if (!$fluidbook || !$fluidbook->allowsEdit()) {
abort(404);
}
if ($fluidbook->status != $newStatus) {
Alert::add('success', __('Status de la publication modifié'))->flash();
return redirect(backpack_url('fluidbook-publication'));
}
+
+ protected function changeProjectManager($fluidbook_id, $user)
+ {
+ if (!can('fluidbook-publication:admin')) {
+ abort(401);
+ }
+ if (!FluidbookPublication::hasPermission($fluidbook_id)) {
+ abort(401);
+ }
+ $fluidbook = FluidbookPublication::find($fluidbook_id);
+ if (!$fluidbook || !$fluidbook->allowsEdit()) {
+ abort(404);
+ }
+ if ($fluidbook->project_manager != $user) {
+ $fluidbook->project_manager = $user;
+ $fluidbook->save();
+ }
+ Alert::add('success', __('Chef de projet de la publication modifié'))->flash();
+ return redirect(backpack_url('fluidbook-publication'));
+ }
}
namespace App\Models;
use App\Console\Commands\WorkshopMigration;
+use App\Fields\CubedesignersTeamMember;
use App\Fields\FluidbookChapters;
use App\Fields\FluidbookComposition;
use App\Fields\FluidbookID;
use App\Fields\FluidbookIDOptionnal;
use App\Fields\FluidbookLocale;
+use App\Fields\FluidbookProjectManager;
use App\Fields\FluidbookStatus;
use App\Fields\FluidbookV3ID;
use App\Fields\User;
]
);
+ $this->addField('project_manager', FluidbookProjectManager::class, __('Chef de projet'), [
+ 'column' => true,
+ 'filter' => true,
+ 'searchLogic' => false,
+ 'can' => 'fluidbook-publication:admin',
+ ]);
+
$this->addField('section_composition', FormBigSection::class, __('Composition'));
$this->addField('composition_fluidbook', Checkbox::class, __('Utiliser la composition d\'un autre fluidbook'), ['default' => false]);
$this->addField('composition_fluidbook_id', FluidbookV3ID::class, __('Utiliser la composition d\'un autre fluidbook'), ['excluded_options' => $this->id, 'when' => ['composition_fluidbook' => 1]]);
return $l10n;
}
- public function generateThumbnailsPreview($sync = false) {
+ /**
+ * @return mixed
+ */
+ public function getNumbering()
+ {
+ return $this->_getCompositionAttribute('page_numbers');
+ }
+
+ /**
+ * @return array
+ */
+ public function getComposition()
+ {
+ $res = $this->_getCompositionAttribute('composition');
+ return $res;
+ }
+
+ protected function _getCompositionAttribute($name)
+ {
+ if (null === $this->_fluidbookToUseForComposition) {
+ if ($this->composition_fluidbook) {
+ $this->_fluidbookToUseForComposition = FluidbookPublication::withoutGlobalScopes()->find($this->composition_fluidbook_id);
+ } else {
+ $this->_fluidbookToUseForComposition = $this;
+ }
+ }
+ return $this->_fluidbookToUseForComposition->$name;
+ }
+
+
+ public function generateThumbnailsPreview($sync = false)
+ {
$mobilefirstFluidbookId = $this->mobilefirstFluidbookId;
$fm = null;
$fn = 'dispatch';
- if($sync)
+ if ($sync)
$fn = 'dispatchSync';
- if($mobilefirstFluidbookId) {
+ if ($mobilefirstFluidbookId) {
$fm = self::find($mobilefirstFluidbookId);
}
- if($fm) {
- if($sync) {
- GenerateDeliveryThumbnailsPreview::$fn($fm,320, 683, 'mobile');
- }else {
- dispatch(new GenerateDeliveryThumbnailsPreview($fm,320, 683, 'mobile'))->onQueue('theme');
+ if ($fm) {
+ if ($sync) {
+ GenerateDeliveryThumbnailsPreview::$fn($fm, 320, 683, 'mobile');
+ } else {
+ dispatch(new GenerateDeliveryThumbnailsPreview($fm, 320, 683, 'mobile'))->onQueue('theme');
}
}
- if($sync) {
+ if ($sync) {
GenerateDeliveryThumbnailsPreview::$fn($this, 1920, 1201);
GenerateDeliveryThumbnailsPreview::$fn($this, 320, 683, 'mobile');
- }else {
+ } else {
dispatch(new GenerateDeliveryThumbnailsPreview($this, 1920, 1201))->onQueue('theme');
dispatch(new GenerateDeliveryThumbnailsPreview($this, 320, 683, 'mobile'))->onQueue('theme');
}
}
+
+ public function getProjectManagerEmail()
+ {
+ if (null !== $this->project_manager) {
+ $u = \App\Models\User::withoutGlobalScopes()->find($this->project_manager);
+ if ($u !== null) {
+ return $u->email;
+ }
+ }
+ return false;
+ }
}
$query->where('company', 7);
$query->orderBy('enabled', 'ASC');
$query->orderBy('id', 'ASC');
+ }
+ public function scopeCurrentTeam($query)
+ {
+ $query->where('company', 7);
+ $query->whereNotIn('id', [5963, 7]);
+ $query->where('enabled', 1);
+ $query->orderBy('id', 'ASC');
}
public function avatar()
action.disabled = action.disabled || (key == disabledOption);
action.isHtmlName = true;
}
- actions[key] = action;
+ actions[key+""] = action;
});
$.each(actions, function (key, action) {
if (action !== sep) {
- items[key] = {name: action.label, isHtmlName: action.isHtmlName, disabled: action.disabled,};
+ items[key+""] = {name: action.label, isHtmlName: action.isHtmlName, disabled: action.disabled,};
} else {
- items[key] = action;
+ items[key+""] = action;
}
});
--- /dev/null
+{{-- select_from_array column --}}
+@php
+ $values = data_get($entry, $column['name']);
+ $me=backpack_user()->id;
+ if($me==$values){
+ $v=__('Moi');
+ }else{
+ $v=isset($column['options'][$values])?e($column['options'][$values]):'<i>'.__('Indéfini').'</i>';
+ }
+
+ $options=$column['options'];
+ if(isset($options[$me])){
+ unset($options[$me]);
+ $options=[$me=>'<b>'.__('Moi').'</b>'] + $options;
+ }
+@endphp
+
+@if($entry->allowsEdit())
+ <span data-{{$entry->getOption('name')}}-{{$column['name']}}="{{$values}}">
+ <a href="#"
+ data-toggle="tooltip"
+ data-context-disabled-action="{{$values}}"
+ data-context-actions="{{json_encode($options)}}"
+ data-context-route="{{$crud->route}}/$id/changeprojectmanager/$action"
+ data-context-id="{{$entry->getKey()}}"
+ title="{{__('Attribuer le chef de projet')}}"
+ >{!! $v !!}</a>
+</span>
+@else
+ {!! $v !!}
+@endif
@endphp
@can('fluidbook-publication:admin')
- <span data-{{$entry->getOption('name')}}-{{$column['name']}}="{{$values}}">
+ @if($entry->allowsEdit())
+ <span data-{{$entry->getOption('name')}}-{{$column['name']}}="{{$values}}">
<a href="#"
data-toggle="tooltip"
data-context-disabled-action="{{$values}}"
data-context-id="{{$entry->getKey()}}"
title="{{__('Changer le status')}}"
>{{$v}}</a>
+ @else
+ {{$v}}
+ @endif
</span>
@endcan
@cannot('fluidbook-publication:admin')
-// $actions['delivery']=[
-// 'label'=>__('Page de téléchargement'),
-// 'url'=>$base.'/delivery',
-// ];
-//
-// $actions['sep_download']='---------';
+ $actions['delivery']=[
+ 'label'=>__('Page de téléchargement'),
+ 'url'=>$base.'/delivery',
+ ];
+
+ $actions['sep_download']='---------';
foreach (\App\Models\FluidbookPublication::getDownloadVersions() as $k=>$v) {
if($k==='scorm'){
continue;