} else if ($this->option('documents') === 'v2') {
DB::update('DELETE FROM fluidbook_document WHERE id<' . self::WS3_DOC_ID);
- } else if ($this->option('documents') === 'all') {
- FluidbookDocument::truncate();
} else {
$range = ArrayUtil::parseRange($this->option('documents'));
FluidbookDocument::withoutGlobalScopes()->whereIn('id', $range)->delete();
$c->bookmarks = $this->_migrateBookmarks($e->bookmarks);
$c->saveWithoutFlushingCache();
}
- if ($this->option('documents') === 'all') {
- DB::update('ALTER TABLE ' . $c->getTable() . ' AUTO_INCREMENT = ' . self::WS3_DOC_ID . ';');
- }
+
}
protected function _migrateBookmarks($bookmarks, $default = [])
return $res;
}
- protected function importPublications($reset = false)
+ protected function importPublications()
{
if ($this->option('publications') === 'none') {
return;
PHP::neverStop();
-
$map = self::mapNames();
$mapValues = self::mapValues();
+ $v3 = FluidbookPublication::withoutGlobalScopes()->where('version', 3)->pluck('id');
+
$ignore = [];
$this->line('Begin publications migration');
$q = DB::table($this->_oldDB . '.books')->orderBy('book_id', 'asc');
if ($this->option('publications') === 'v2') {
- DB::update('DELETE FROM fluidbook_publication WHERE id<' . self::WS3_BOOK_ID);
- } else if ($this->option('publications') === 'all') {
- FluidbookPublication::truncate();
+ DB::update('DELETE FROM fluidbook_publication WHERE version=2 AND id<' . self::WS3_BOOK_ID);
} else if ($this->option('publications') === 'missing') {
// Get highest fluidbook on toolbox with a number less thant WS3_BOOK_ID
$f = FluidbookPublication::withoutGlobalScopes()->where('id', '<', self::WS3_BOOK_ID)->orderBy('id', 'DESC')->first();
$q->where('book_id', '>', $f->id);
} else {
$range = ArrayUtil::parseRange($this->option('publications'));
- FluidbookPublication::withoutGlobalScopes()->whereIn('id', $range)->delete();
+ FluidbookPublication::withoutGlobalScopes()->where('version', 2)->whereIn('id', $range)->delete();
$q->whereIn('book_id', $range);
}
foreach ($q->get() as $e) {
$this->line('Import ' . $e->book_id);
+ if (in_array($e->book_id, $v3)) {
+ continue;
+ }
$c = new FluidbookPublication();
$c->setIncrementing(false);
$c->id = $e->book_id;
$e->compiledate = max($e->compiledate, $e->compile1date, $e->compilehtml5date);
+ $e->version = 2;
foreach ($e as $k => $v) {
$new = $map[$k] ?? $k;
if (!$c->hasField($new)) {
dd($e);
}
}
- if ($reset) {
- DB::update('ALTER TABLE ' . $c->getTable() . ' AUTO_INCREMENT = ' . self::WS3_BOOK_ID . ';');
- }
}
public function _normalizeChapters($value)
$this->addField('hash', Hidden::class);
$this->addField('cid', Hidden::class);
+
$this->addField('extranet_task', Hidden::class, __('Tâche de l\'extranet'));
$this->addField('export_data', Hidden::class, __('Paramètres d\'export'));
// Composed fields
$this->addField('compilation_date', Datetime::class, __('Dernière compilation'), ['read_only' => true]);
$this->addField('composition_updated_at', Datetime::class, __('Dernière modification de la composition'), ['read_only' => true]);
$this->addField('status_date', Datetime::class, __('Date de changement de status'), ['read_only' => true]);
+ $this->addField('version', Hidden::class, 'Version', ['column' => true, 'default' => 3, 'databaseDefault' => 3, 'column_label' => '<i class="las la-code-branch" title="' . __('Version du Fluidbook') . '"></i>']);
}
if (!can('fluidbook-publication:admin')) {
return false;
}
- if ($this->id < WorkshopMigration::WS3_BOOK_ID) {
+ if ($this->version < 3) {
return false;
}
if ($this->status >= 1) {
if (!can('fluidbook-publication:write')) {
return false;
}
- if ($this->id < WorkshopMigration::WS3_BOOK_ID) {
+ if ($this->version < 3) {
return false;
}
return true;
public function allowsDownload()
{
- if ($this->id < WorkshopMigration::WS3_BOOK_ID) {
+ if ($this->version < 3) {
return false;
}
if (can('fluidbook-publication:write')) {
public function replicateFull(array $except = null)
{
$new = $this->_baseReplicate($except);
- if (!$this->composition_fluidbook && $this->id >= 30000) {
+ if (!$this->composition_fluidbook && $this->version >= 3) {
$new->composition_fluidbook = true;
$new->composition_fluidbook_id = $this->id;
$new->composition_fluidbook_links = true;
public function syncFromWorkshop()
{
- if ($this->id >= WorkshopMigration::WS3_BOOK_ID) {
+ if ($this->version >= 3) {
return false;
}
Artisan::call('ws:migrate --publications=' . $this->id . ' --documents=missing --quick');
border-color: #9ec400 !important;
color: #9ec400 !important;
}
+
+.context-menu-subtitle {
+ color: #2f2f2f;
+ font-weight: 600;
+ text-align: center;
+}
font-size: 120%;
}
+@import 'context-menu';
var disabledOption = $($trigger).data('context-disabled-action');
var actions = {};
+
$.each(rawActions, function (key, action) {
+ console.log(action);
if (action != sep) {
if (typeof action === 'string') {
action = {'label': action};
if (action.target === undefined) {
action.target = '_self';
}
- action.disabled = (key == disabledOption);
+ action.disabled = action.disabled || (key == disabledOption);
action.isHtmlName = true;
}
actions[key] = action;
{{-- __('!! Paramètres des fluidbooks') --}}
@php
- $actions=['preview'=>['label'=>__('Version online'),'url'=>$crud->route.'/preview/'.$entry->getKey().'_'.$entry->hash,'target'=>'_blank']];
+ $actions=[];
+ $suffixv3='';
+ if($entry->version==2){
+ $actions['compilev2']=['label'=>'<span class="context-menu-subtitle">'.__('Compilateur V2').'</span>','disabled'=>true,'url'=>'#'];
+ $actions['preview_v2'] = ['label'=>__('Version online'),'url'=>'https://workshop.fluidbook.com/viewerh/'.$entry->getKey().'_'.$entry->hash,'target'=>'_blank'];
+ if($entry->isSCORMEnabled()){
+ $actions['scorm_v2'] = ['label'=>__('Version SCORM'),'url'=>'https://workshop.fluidbook.com/viewers/'.$entry->getKey().'_'.$entry->hash,'target'=>'_blank'];
+ }
+ $actions['sep']='---------';
+ $actions['testv3']=['label'=>'<span class="context-menu-subtitle">'.__('Tester le compilateur V3').'</span>','disabled'=>true,'url'=>'#'];
+ }
+ $actions['preview']=['label'=>__('Version online'),'url'=>$crud->route.'/preview/'.$entry->getKey().'_'.$entry->hash,'target'=>'_blank'];
if($entry->isSCORMEnabled()){
$actions['scorm']=['label'=>__('Version SCORM'),'url'=>$crud->route.'/preview/scorm/'.$entry->getKey().'_'.$entry->hash,'target'=>'_blank'];
}
+
@endphp
@if($entry->allowsPreview())