From 770ccdf380bfbbf7ae995e11b62bd8e61d2d998c Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Thu, 9 Mar 2023 12:44:18 +0100 Subject: [PATCH] wait #5750 @1.5 --- app/Fields/FluidbookLinkEditor/Action.php | 3 - .../FluidbookLinkEditor/RolloverAnimation.php | 6 +- app/Fields/SCORMVersion.php | 6 +- .../FluidbookPublication/StatsOperation.php | 262 +++++++++--------- .../Operations/Tools/DockerWebContainer.php | 2 +- .../Admin/Operations/Tools/GitReposCreate.php | 2 +- app/Jobs/FluidbookCompiler.php | 2 +- app/Models/File.php | 4 +- app/Models/ToolSVGSprite.php | 2 +- app/Models/Traits/PublicationSettings.php | 40 +-- 10 files changed, 153 insertions(+), 176 deletions(-) diff --git a/app/Fields/FluidbookLinkEditor/Action.php b/app/Fields/FluidbookLinkEditor/Action.php index f19a1b071..528751c9a 100644 --- a/app/Fields/FluidbookLinkEditor/Action.php +++ b/app/Fields/FluidbookLinkEditor/Action.php @@ -21,15 +21,12 @@ class Action extends SelectFromArray 'notes' => __('Notes'), 'fullscreen' => __('Basculer entre le mode plein écran et le mode normal'), 'sound' => __('Activer / Couper le son'), - //'2dmode'=>__('Basculer du mode 2D au mode 3D'), 'archives' => __('Afficher les archives'), 'basket' => __('Ouvrir le panier'), 'form' => __('Ouvrir le formulaire'), 'facebook' => __('Partager sur Facebook'), 'twitter' => __('Partager sur Twitter'), - //'googleplus'=>__('Partager sur Google+'), 'linkedin' => __('Partager sur LinkedIn'), - //'viadeo'=>__('Partager sur Viadeo'), 'whatsapp' => __('Partager sur Whatsapp'), 'pinterest' => __('Partager sur Pinterest'), ]; diff --git a/app/Fields/FluidbookLinkEditor/RolloverAnimation.php b/app/Fields/FluidbookLinkEditor/RolloverAnimation.php index 8c69904fa..d5e34df32 100644 --- a/app/Fields/FluidbookLinkEditor/RolloverAnimation.php +++ b/app/Fields/FluidbookLinkEditor/RolloverAnimation.php @@ -14,9 +14,9 @@ class RolloverAnimation extends SelectFromArray { return [ 'none' => __('Aucune'), - 'upanddown' => __('Up and down'), - 'fadein' => __('Fade In'), - 'fadeout' => __('Fade Out'), + 'upanddown' => 'Up and down', + 'fadein' => 'Fade In', + 'fadeout' => 'Fade Out', ]; } } diff --git a/app/Fields/SCORMVersion.php b/app/Fields/SCORMVersion.php index 3e68e012a..70930aff4 100644 --- a/app/Fields/SCORMVersion.php +++ b/app/Fields/SCORMVersion.php @@ -13,9 +13,9 @@ class SCORMVersion extends SelectFromArray public function getOptions() { return [ - Version::SCORM_1_2 => __('SCORM 1.2'), - Version::SCORM_2004_3 => __('SCORM 2004 3rd edition'), - Version::SCORM_2004 => __('SCORM 2004 4th edition'), + Version::SCORM_1_2 => 'SCORM 1.2', + Version::SCORM_2004_3 => 'SCORM 2004 3rd edition', + Version::SCORM_2004 => 'SCORM 2004 4th edition', ]; } diff --git a/app/Http/Controllers/Admin/Operations/FluidbookPublication/StatsOperation.php b/app/Http/Controllers/Admin/Operations/FluidbookPublication/StatsOperation.php index 97cb954a6..5ae8f5c60 100644 --- a/app/Http/Controllers/Admin/Operations/FluidbookPublication/StatsOperation.php +++ b/app/Http/Controllers/Admin/Operations/FluidbookPublication/StatsOperation.php @@ -9,6 +9,7 @@ use Carbon\CarbonInterface; use Cubist\Matomo\Reporting; use Illuminate\Support\Facades\Route; use NumberFormatter; + // __('!! Statistiques') trait StatsOperation { @@ -52,7 +53,8 @@ trait StatsOperation ]; } - protected function getMatomoServer($fluidbook_id) { + protected function getMatomoServer($fluidbook_id) + { // Get the appropriate server based on the Fluidbook ID // Stats are split across different servers depending on the ID: // ID < 21210 = stats3.fluidbook.com @@ -69,18 +71,21 @@ trait StatsOperation return 'stats5.fluidbook.com'; } - protected function getMatomoToken($server) : bool|string { + protected function getMatomoToken($server): bool|string + { $tokens = $this->getMatomoTokens(); return $tokens[$server] ?? false; } - private function getReporting($fluidbook_id) : Reporting { + private function getReporting($fluidbook_id): Reporting + { $server = $this->getMatomoServer($fluidbook_id); $token = $this->getMatomoToken($server); return new Reporting("https://{$server}/", $token, $fluidbook_id); } - private function parseDate($date) { + private function parseDate($date) + { // Match possible date strings: // - YYYY // - YYYY-MM @@ -94,7 +99,7 @@ trait StatsOperation extract($date_matches); // Just for easier access to match variables // Bail out on nonsensical dates - if(isset($start_date) && isset($end_date) && ($start_date > $end_date)) { + if (isset($start_date) && isset($end_date) && ($start_date > $end_date)) { return false; } @@ -104,7 +109,8 @@ trait StatsOperation // Since the report date can be in different formats (ie. YYYY, YYYY-MM or a full range) // and this format determines the report mode (range, month or year), we have to figure out // the mode and full starting and ending dates, as necessary - public function getReportSettings($date, $fluidbook) { + public function getReportSettings($date, $fluidbook) + { $date_matches = $this->parseDate($date); // ... @@ -115,7 +121,8 @@ trait StatsOperation } // Figure out the best period to use for the stats according to the date range - public function determinePeriod($dates, $fluidbook) { + public function determinePeriod($dates, $fluidbook) + { // TODO: refactor this into getReportSettings() so that this function can simply take the determined start and end dates, calculate the number of days and give an answer based on that. No extra logic to try to figure out which mode it is... @@ -159,12 +166,14 @@ trait StatsOperation return 'year'; } - protected function statsLoader($fluidbook_id, $hash, $date = null, $period_override = null) { + protected function statsLoader($fluidbook_id, $hash, $date = null, $period_override = null) + { $report_URL = route('stats-report', compact('fluidbook_id', 'hash', 'date', 'period_override')); return view('fluidbook_stats.loader', compact('report_URL')); } - protected function statsSummary($fluidbook_id, $hash, $date = null, $period_override = null) { + protected function statsSummary($fluidbook_id, $hash, $date = null, $period_override = null) + { $locale = app()->getLocale(); $base_URL = route('stats', compact('fluidbook_id', 'hash')); // Used by date range picker to update report URL @@ -192,21 +201,21 @@ trait StatsOperation // Translatable list of labels for the available periods $period_map = [ - 'day' => [ - 'singular' => __('Day'), - 'periodic' => __('Daily'), + 'day' => [ + 'singular' => __('Jour'), + 'periodic' => __('Quotidien'), ], - 'week' => [ - 'singular' => __('Week'), - 'periodic' => __('Weekly'), + 'week' => [ + 'singular' => __('Semaine'), + 'periodic' => __('Hebdomadaire'), ], 'month' => [ - 'singular' => __('Month'), - 'periodic' => __('Monthly'), + 'singular' => __('Mois'), + 'periodic' => __('Mensuel'), ], - 'year' => [ - 'singular' => __('Year'), - 'periodic' => __('Annual'), + 'year' => [ + 'singular' => __('Année'), + 'periodic' => __('Annuel'), ], ]; @@ -216,7 +225,7 @@ trait StatsOperation $period_override = in_array($period_override, array_keys($period_map)) ? $period_override : null; $period = $period_override ?? $this->determinePeriod($dates, $fluidbook); - $chart_heading = sprintf(__('%s Details'), $period_map[$period]['periodic']); + $chart_heading = __('Détails :period', ['period' => $period_map[$period]['periodic']]); $report_timespan = ''; // Which mode are we in? @@ -263,7 +272,7 @@ trait StatsOperation $start_date = $fluidbook->created_at->isoFormat('YYYY-MM-DD'); $end_date = now()->isoFormat('YYYY-MM-DD'); $date_range = "{$start_date},{$end_date}"; // All data up until today's date - $chart_heading = __('Overview'); + $chart_heading = __('Aperçu'); } $formatted_date_range = $this->formatDateRange($start_date, $end_date); @@ -299,7 +308,7 @@ trait StatsOperation // They are converted to be keyed by the event category name, allowing easier access // Note: this API request includes the expanded subtable data, which is only needed for the "menu" category // because it contains the "Download" and "Print" events as children and this structure can't be changed. - $eventsByPeriod = collect($report->getEventsByCategory(['expanded' => 1]))->map(function($item, $key) { + $eventsByPeriod = collect($report->getEventsByCategory(['expanded' => 1]))->map(function ($item, $key) { return collect($item)->keyBy('label'); }); @@ -307,24 +316,24 @@ trait StatsOperation // While this could probably be calculated from the $eventsByPeriod data, it's cleaner to use the API $eventsByPage = collect($report->getEventsByCategory(['expanded' => 1, 'period' => 'range'])) ->keyBy('label') - ->map(function($item, $key) { + ->map(function ($item, $key) { // Make subtable data easier to lookup by keying them with the labels (ie. page numbers) for certain events if (in_array($item['label'], ['zoom', 'bookmark', 'share']) && isset($item['subtable'])) { - $item['subtable'] = collect($item['subtable'])->keyBy(function($item, $key) { + $item['subtable'] = collect($item['subtable'])->keyBy(function ($item, $key) { // Since there's some inconsistency in the way labels are stored (some have "page x" instead // of just the number), we strip out any non-numeric values when making the keys return preg_replace('~\D~', '', $item['label']); }); } return $item; - }); + }); //=== PER-PAGE STATISTICS // Fetch stats for pages, separated by their URLs. // Since we're interested in per-page not per-period stats, we fetch the report flattened for the full date range $pageUrls = collect($report->getPageUrls(['period' => 'range', 'flat' => 1])) ->keyBy('label') - ->reject(function($value, $key) { + ->reject(function ($value, $key) { // Remove the '/' URL because it's not a real page (it's created by the "Open Fluidbook" // event and a separate, "real" page view is recorded at the same time) return $key === '/'; @@ -340,14 +349,14 @@ trait StatsOperation $page_group = $page_number; $pages[$page_group] = [ - 'page_group' => $page_group, - 'page_number' => $page_number, // Used by table column sorter - 'nb_visits' => $pageUrls["/page/$page_number"]['nb_visits'] ?? 0, + 'page_group' => $page_group, + 'page_number' => $page_number, // Used by table column sorter + 'nb_visits' => $pageUrls["/page/$page_number"]['nb_visits'] ?? 0, 'nb_uniq_visitors' => $pageUrls["/page/$page_number"]['sum_daily_nb_uniq_visitors'] ?? 0, - 'nb_pageviews' => $pageUrls["/page/$page_number"]['nb_hits'] ?? 0, - 'nb_zooms' => data_get($eventsByPage, "zoom.subtable.$page_number.nb_events", 0), - 'nb_bookmarks' => data_get($eventsByPage, "bookmark.subtable.$page_number.nb_events", 0), - 'nb_shares' => data_get($eventsByPage, "share.subtable.$page_number.nb_events", 0), + 'nb_pageviews' => $pageUrls["/page/$page_number"]['nb_hits'] ?? 0, + 'nb_zooms' => data_get($eventsByPage, "zoom.subtable.$page_number.nb_events", 0), + 'nb_bookmarks' => data_get($eventsByPage, "bookmark.subtable.$page_number.nb_events", 0), + 'nb_shares' => data_get($eventsByPage, "share.subtable.$page_number.nb_events", 0), ]; // Special case: the first page of double-page Fluidbooks is tracked as "page 0", meaning that @@ -365,20 +374,20 @@ trait StatsOperation } elseif ($page_number % 2 === 0) { // Only stats for even pages are considered when grouped (except for bookmarks / shares) $following_page = $page_number + 1; // By logic, there should always be a following page - $page_group = $page_number .'—'. $following_page; + $page_group = $page_number . '—' . $following_page; $pages[$page_group] = [ - 'page_group' => $page_group, - 'page_number' => $page_number, // Used by table column sorter - 'nb_visits' => $pageUrls["/page/$page_number"]['nb_visits'] ?? 0, + 'page_group' => $page_group, + 'page_number' => $page_number, // Used by table column sorter + 'nb_visits' => $pageUrls["/page/$page_number"]['nb_visits'] ?? 0, 'nb_uniq_visitors' => $pageUrls["/page/$page_number"]['sum_daily_nb_uniq_visitors'] ?? 0, - 'nb_pageviews' => $pageUrls["/page/$page_number"]['nb_hits'] ?? 0, - 'nb_zooms' => data_get($eventsByPage, "zoom.subtable.$page_number.nb_events", 0), + 'nb_pageviews' => $pageUrls["/page/$page_number"]['nb_hits'] ?? 0, + 'nb_zooms' => data_get($eventsByPage, "zoom.subtable.$page_number.nb_events", 0), // Bookmarks and shares are counted and summed for both pages in the spread - 'nb_bookmarks' => data_get($eventsByPage, "bookmark.subtable.$page_number.nb_events", 0) - + data_get($eventsByPage, "bookmark.subtable.$following_page.nb_events", 0), - 'nb_shares' => data_get($eventsByPage, "share.subtable.$page_number.nb_events", 0) - + data_get($eventsByPage, "share.subtable.$following_page.nb_events", 0), + 'nb_bookmarks' => data_get($eventsByPage, "bookmark.subtable.$page_number.nb_events", 0) + + data_get($eventsByPage, "bookmark.subtable.$following_page.nb_events", 0), + 'nb_shares' => data_get($eventsByPage, "share.subtable.$page_number.nb_events", 0) + + data_get($eventsByPage, "share.subtable.$following_page.nb_events", 0), ]; } } @@ -435,74 +444,74 @@ trait StatsOperation $pagesByPeriod = collect($report->getPageUrls(['expanded' => $expanded_stats])) ->map(function ($item, $date) use ($period, $fluidbook_id, $hash, $eventsByPeriod, $new_stats_cutoff) { - if (empty($item)) { - return $item; // Some periods might have no data - } + if (empty($item)) { + return $item; // Some periods might have no data + } - // Key results by their label to make it easier to isolate the "page" stats - // More specifically, we want to get rid of the "/index" data because these aren't true page views - $labelled = collect($item)->keyBy('label'); + // Key results by their label to make it easier to isolate the "page" stats + // More specifically, we want to get rid of the "/index" data because these aren't true page views + $labelled = collect($item)->keyBy('label'); - if (!isset($labelled['page'])) { - // If there's are no page stats, we treat it is if there's no data for this period - // This is necessary because it's possible that there will be an '/index' item but no 'page' - return []; - } + if (!isset($labelled['page'])) { + // If there's are no page stats, we treat it is if there's no data for this period + // This is necessary because it's possible that there will be an '/index' item but no 'page' + return []; + } - // By returning the page data directly (if available), it makes - // the returned data flatter and easier to process later for sums etc. - $data = $labelled['page']; - - //== Unique Visitors - // Matomo doesn't provide an aggregate of unique visitors, so we must do the sum ourselves. - // If the period is "day", the number of unique visitors will be in the key 'nb_uniq_visitors' - // but if it is a longer period (week, month, year) then the key becomes 'sum_daily_nb_uniq_visitors' - if($fluidbook_id >= $new_stats_cutoff) { - $unique_visitors_key = $period === 'day' ? 'nb_uniq_visitors' : 'sum_daily_nb_uniq_visitors'; - $subpages = collect($data['subtable'] ?? []); - $data['nb_uniq_visitors'] = $subpages->sum($unique_visitors_key); - } + // By returning the page data directly (if available), it makes + // the returned data flatter and easier to process later for sums etc. + $data = $labelled['page']; + + //== Unique Visitors + // Matomo doesn't provide an aggregate of unique visitors, so we must do the sum ourselves. + // If the period is "day", the number of unique visitors will be in the key 'nb_uniq_visitors' + // but if it is a longer period (week, month, year) then the key becomes 'sum_daily_nb_uniq_visitors' + if ($fluidbook_id >= $new_stats_cutoff) { + $unique_visitors_key = $period === 'day' ? 'nb_uniq_visitors' : 'sum_daily_nb_uniq_visitors'; + $subpages = collect($data['subtable'] ?? []); + $data['nb_uniq_visitors'] = $subpages->sum($unique_visitors_key); + } - $data['raw_date'] = $date; // We still need the raw date for sorting and other formatting purposes + $data['raw_date'] = $date; // We still need the raw date for sorting and other formatting purposes - // Formatting of date changes depending on the period - $formatted_date = $this->formatDateForPeriod($date, $period); + // Formatting of date changes depending on the period + $formatted_date = $this->formatDateForPeriod($date, $period); - // When segregated by month or year, the periods become links - if (in_array($period, ['month', 'year'])) { - // Generate URL using the named route - $URL = route('stats', compact('fluidbook_id', 'hash', 'date')); - $data['formatted_date'] = "{$formatted_date}"; - } else { - $data['formatted_date'] = $formatted_date; - } + // When segregated by month or year, the periods become links + if (in_array($period, ['month', 'year'])) { + // Generate URL using the named route + $URL = route('stats', compact('fluidbook_id', 'hash', 'date')); + $data['formatted_date'] = "{$formatted_date}"; + } else { + $data['formatted_date'] = $formatted_date; + } - // Add certain event category data - $period_events = $eventsByPeriod->get($date); - $data['nb_zooms'] = data_get($period_events, 'zoom.nb_events', 0); - $data['nb_shares'] = data_get($period_events, 'share.nb_events', 0); - $data['nb_links'] = data_get($period_events, 'link.nb_events', 0); // Used instead of standard outlinks count + // Add certain event category data + $period_events = $eventsByPeriod->get($date); + $data['nb_zooms'] = data_get($period_events, 'zoom.nb_events', 0); + $data['nb_shares'] = data_get($period_events, 'share.nb_events', 0); + $data['nb_links'] = data_get($period_events, 'link.nb_events', 0); // Used instead of standard outlinks count - // Download and Print events are stored differently and can't be changed now - // (see https://redmine.cubedesigners.com/issues/5431#note-2) - // If 'menu' event exists, collect and key it by label so we can use data_get() for cleaner access - $menu_events = $period_events->has('menu') ? collect($period_events['menu']['subtable'])->keyBy('label') : []; - $data['nb_downloads'] = data_get($menu_events, 'download.nb_events', 0); - $data['nb_prints'] = data_get($menu_events, 'print.nb_events', 0); + // Download and Print events are stored differently and can't be changed now + // (see https://redmine.cubedesigners.com/issues/5431#note-2) + // If 'menu' event exists, collect and key it by label so we can use data_get() for cleaner access + $menu_events = $period_events->has('menu') ? collect($period_events['menu']['subtable'])->keyBy('label') : []; + $data['nb_downloads'] = data_get($menu_events, 'download.nb_events', 0); + $data['nb_prints'] = data_get($menu_events, 'print.nb_events', 0); - return $data; - }); + return $data; + }); //=== SUMMARY BY PERIOD // Generate a list of available periods, based on the visits API data. // If there are no visits for a certain period, we can assume that there won't be any data for other metrics. // The goal is to find the non-empty results and create a list of Carbon date classes from those // This list is used to generate the links / formatted dates list + detailed data table - $period_details = $pagesByPeriod->filter(fn ($value, $key) => !empty($value)); // Remove any empty periods + $period_details = $pagesByPeriod->filter(fn($value, $key) => !empty($value)); // Remove any empty periods //=== CHART PREPARATION // Format dates for display as labels on the x-axis and in the tooltips / tables - $tooltip_labels = $pagesByPeriod->keys()->mapWithKeys(function($date, $index) use ($period, $start_date, $end_date) { + $tooltip_labels = $pagesByPeriod->keys()->mapWithKeys(function ($date, $index) use ($period, $start_date, $end_date) { $short_label = $this->formatDateForXAxis($date, $period, $start_date, $end_date); $full_label = $this->formatDateForPeriod($date, $period); return [$short_label => $full_label]; @@ -510,7 +519,7 @@ trait StatsOperation $chart_datasets = [ [ - 'label' => __('Visits'), + 'label' => __('Visites'), 'backgroundColor' => 'hsl(72 100% 38% / 100%)', // Could make bars semi-transparent if desired // borderColor: 'hsl(72 100% 38%)', // borderWidth: 1, @@ -519,7 +528,7 @@ trait StatsOperation 'bar_offset' => -5, // Negative offset shifts bar to left ], [ - 'label' => __('Page Views'), + 'label' => __('Pages vues'), 'backgroundColor' => 'hsl(0 0% 53%)', 'data' => $pagesByPeriod->pluck('nb_hits')->toArray(), 'order' => 2, @@ -531,7 +540,7 @@ trait StatsOperation // Insert the unique visitors dataset at the beginning of the array $chart_datasets = array_merge([ [ - 'label' => __('Unique Visitors'), + 'label' => __('Visiteurs uniques'), 'backgroundColor' => 'hsl(19 100% 48% / 100%)', 'data' => $pagesByPeriod->pluck('nb_uniq_visitors')->toArray(), 'order' => 1, @@ -553,24 +562,24 @@ trait StatsOperation $table_map = [ // Main summary table 'summary' => [ - 'formatted_date' => $period_map[$period]['singular'], - 'nb_uniq_visitors' => __('Unique Visitors'), - 'nb_visits' => __('Visits'), - 'nb_hits' => __('Pages Viewed'), - 'nb_links' => __('Outgoing Links'), - 'nb_downloads' => __('Downloads'), - 'nb_prints' => __('Prints'), - 'nb_zooms' => __('Zooms'), + 'formatted_date' => $period_map[$period]['singular'], + 'nb_uniq_visitors' => __('Visiteurs uniques'), + 'nb_visits' => __('Visites'), + 'nb_hits' => __('Pages vues'), + 'nb_links' => __('Liens sortants'), + 'nb_downloads' => __('Téléchargements'), + 'nb_prints' => __('Impressions'), + 'nb_zooms' => __('Zooms'), ], // Per-page detail table 'per-page' => [ - 'page_group' => __('Pages'), - 'nb_uniq_visitors' => __('Unique Visits'), - 'nb_visits' => __('Visits'), - 'nb_pageviews' => __('Views'), - 'nb_zooms' => __('Zooms'), - 'nb_bookmarks' => __('Bookmarks'), - 'nb_shares' => __('Shares'), + 'page_group' => __('Pages'), + 'nb_uniq_visitors' => __('Visites uniques'), + 'nb_visits' => __('Visites'), + 'nb_pageviews' => __('Vues'), + 'nb_zooms' => __('Zooms'), + 'nb_bookmarks' => __('Pages marquées'), + 'nb_shares' => __('Partages'), ], ]; @@ -619,7 +628,8 @@ trait StatsOperation // This was added as a convenience when quickly switching between stats views for Fluidbooks // If the current user has sufficient permissions, they will be redirected to the hashed URL. // If not, the FluidbookPublication lookup will fail and further execution will halt. - protected function statsRedirect($fluidbook_id) { + protected function statsRedirect($fluidbook_id) + { $fluidbook = FluidbookPublication::where('id', $fluidbook_id)->firstOrFail(); $settings = json_decode($fluidbook->settings); @@ -633,7 +643,8 @@ trait StatsOperation } // https://toolbox.fluidbook.com/fluidbook-publication/stats/API - protected function statsAPI() { + protected function statsAPI() + { if (!can('superadmin')) { // Only allow superadmin access because this is a dev tool, and it exposes the API tokens @@ -645,7 +656,8 @@ trait StatsOperation } // Format a date range for display in the interface - protected function formatDateRange($start_date, $end_date): string { + protected function formatDateRange($start_date, $end_date): string + { $start = Carbon::parse($start_date); $end = Carbon::parse($end_date); @@ -672,7 +684,8 @@ trait StatsOperation // Format dates depending on the segregation period (used for tooltips and stats detail tables) - protected function formatDateForPeriod($date, $period): string { + protected function formatDateForPeriod($date, $period): string + { // Weeks are a special case because they contain two dates if ($period === 'week') { @@ -682,11 +695,11 @@ trait StatsOperation $crosses_month_boundary = $week_end->isoFormat('YYYY-MM') > $week_start->isoFormat('YYYY-MM'); $crosses_year_boundary = $week_end->isoFormat('YYYY') > $week_start->isoFormat('YYYY'); if ($crosses_year_boundary) { - $week_formatted = $week_start->isoFormat('Do MMMM, YYYY') .' — '. $week_end->isoFormat('Do MMMM, YYYY'); + $week_formatted = $week_start->isoFormat('Do MMMM, YYYY') . ' — ' . $week_end->isoFormat('Do MMMM, YYYY'); } elseif ($crosses_month_boundary) { - $week_formatted = $week_start->isoFormat('Do MMMM') .' — '. $week_end->isoFormat('Do MMMM, YYYY'); + $week_formatted = $week_start->isoFormat('Do MMMM') . ' — ' . $week_end->isoFormat('Do MMMM, YYYY'); } else { - $week_formatted = $week_start->isoFormat('Do') .'—'. $week_end->isoFormat('Do MMMM, YYYY'); + $week_formatted = $week_start->isoFormat('Do') . '—' . $week_end->isoFormat('Do MMMM, YYYY'); } } @@ -699,7 +712,8 @@ trait StatsOperation } // Dates displayed in the x-axis of chart need different formatting - protected function formatDateForXAxis($date, $period, $start_date, $end_date): string { + protected function formatDateForXAxis($date, $period, $start_date, $end_date): string + { // The labels on the x-axis should be as concise as possible but when the date range crosses // a boundary for the larger period (eg. period = day but the range crosses more than one month), @@ -717,11 +731,11 @@ trait StatsOperation $crosses_month_boundary = $week_end->isoFormat('YYYY-MM') > $week_start->isoFormat('YYYY-MM'); $crosses_year_boundary = $week_end->isoFormat('YYYY') > $week_start->isoFormat('YYYY'); if ($crosses_year_boundary) { - $week_formatted = $week_start->isoFormat('D MMM YYYY') .' — '. $week_end->isoFormat('D MMM YYYY'); + $week_formatted = $week_start->isoFormat('D MMM YYYY') . ' — ' . $week_end->isoFormat('D MMM YYYY'); } elseif ($crosses_month_boundary) { - $week_formatted = $week_start->isoFormat('D MMM') .' — '. $week_end->isoFormat('D MMM'); + $week_formatted = $week_start->isoFormat('D MMM') . ' — ' . $week_end->isoFormat('D MMM'); } else { - $week_formatted = $week_start->isoFormat('D') .'—'. $week_end->isoFormat('D MMM'); + $week_formatted = $week_start->isoFormat('D') . '—' . $week_end->isoFormat('D MMM'); } } elseif ($period === 'year') { // Years also need special handling because if we try to use Carbon::parse() @@ -733,7 +747,7 @@ trait StatsOperation return match ($period) { 'day' => $crosses_year_boundary ? $date->isoFormat('DD MMM YYYY') - : ($crosses_month_boundary ? $date->isoFormat('DD MMM') : $date->isoFormat('DD')), + : ($crosses_month_boundary ? $date->isoFormat('DD MMM') : $date->isoFormat('DD')), 'week' => $week_formatted, 'month' => $crosses_year_boundary ? $date->isoFormat('MMM YYYY') : $date->isoFormat('MMM'), default => $date, diff --git a/app/Http/Controllers/Admin/Operations/Tools/DockerWebContainer.php b/app/Http/Controllers/Admin/Operations/Tools/DockerWebContainer.php index 0fdb47c2a..d28d53c12 100644 --- a/app/Http/Controllers/Admin/Operations/Tools/DockerWebContainer.php +++ b/app/Http/Controllers/Admin/Operations/Tools/DockerWebContainer.php @@ -37,7 +37,7 @@ trait DockerWebContainer '8.2' => '8.2', ], 'value' => '8.2']); $form->addField('mysql', Checkbox::class, __('Serveur Mariadb') . ' (MySQL)', ['default' => true]); - $form->addField('redis', Checkbox::class, __('Redis server'), ['default' => true]); + $form->addField('redis', Checkbox::class, __('Serveur Redis'), ['default' => true]); return view('tools.form', ['form' => $form]); } diff --git a/app/Http/Controllers/Admin/Operations/Tools/GitReposCreate.php b/app/Http/Controllers/Admin/Operations/Tools/GitReposCreate.php index d057af693..22af142b1 100644 --- a/app/Http/Controllers/Admin/Operations/Tools/GitReposCreate.php +++ b/app/Http/Controllers/Admin/Operations/Tools/GitReposCreate.php @@ -16,7 +16,7 @@ trait GitReposCreate { $form = new Form(backpack_url('tools/dogitreposcreate')); $form->setTitle(__('Créer un répertoire GIT')); - $form->setSubmitLabel(__('Create')); + $form->setSubmitLabel(__('Créer')); $form->setSubmitIcon('la-git'); $form->addField('repos', \Cubist\Backpack\Magic\Fields\Text::class, __('Nom du répertoire'), ['prefix' => 'git@git.cubedesigners.com:', 'suffix' => '.git']); diff --git a/app/Jobs/FluidbookCompiler.php b/app/Jobs/FluidbookCompiler.php index ca4fd3df7..4cfe398da 100644 --- a/app/Jobs/FluidbookCompiler.php +++ b/app/Jobs/FluidbookCompiler.php @@ -1720,7 +1720,7 @@ height="0" width="0" style="display:none;visibility:hidden"> } $print = $this->writePrint(); - $message = sprintf($this->__('Your browser is not up to date and is not able to run this publication. %sLearn more%s'), ''); + $message = ''; $this->log('Got index vars 4'); diff --git a/app/Models/File.php b/app/Models/File.php index b93a8a4ea..095fea46f 100644 --- a/app/Models/File.php +++ b/app/Models/File.php @@ -24,8 +24,8 @@ class File extends ToolboxModel protected $table = 'files'; protected $_options = ['name' => 'file', - 'singular' => 'file', - 'plural' => 'files']; + 'singular' => 'fichier', + 'plural' => 'fichiers']; protected static $_permissionBase = 'files'; diff --git a/app/Models/ToolSVGSprite.php b/app/Models/ToolSVGSprite.php index dbc61aa11..7b619fe20 100644 --- a/app/Models/ToolSVGSprite.php +++ b/app/Models/ToolSVGSprite.php @@ -32,7 +32,7 @@ class ToolSVGSprite extends ToolboxModel $this->addField('name', Text::class, __('Nom'), ['column' => true]); $this->addField('prefix', Text::class, __('Préfixe'), ['column' => true]); $this->addField('convertColorsToCurrentColor', Checkbox::class, __('Convertir les couleurs en "currentColor"'), ['default' => true]); - $this->addField('icons', BunchOfFieldsMultiple::class, __('Icônes'), ['bunch' => ToolSVGSpriteIcon::class, 'edit_label' => __('Edit :icon :name', ['name' => '%iconname', 'icon' => '
%svgcode
']), 'add_label' => __('Ajouter une icône')]); + $this->addField('icons', BunchOfFieldsMultiple::class, __('Icônes'), ['bunch' => ToolSVGSpriteIcon::class, 'edit_label' => __('Éditer :icon :name', ['name' => '%iconname', 'icon' => '
%svgcode
']), 'add_label' => __('Ajouter une icône')]); } public function preSave() diff --git a/app/Models/Traits/PublicationSettings.php b/app/Models/Traits/PublicationSettings.php index 1ec168092..44908440f 100644 --- a/app/Models/Traits/PublicationSettings.php +++ b/app/Models/Traits/PublicationSettings.php @@ -2064,14 +2064,14 @@ trait PublicationSettings 'translatable' => false, ]); $this->addField('', FormSeparator::class); - $this->addField('brightcovePlayerId', LongText::class, $this->__('Brightcove Player Id'), [ + $this->addField('brightcovePlayerId', LongText::class, $this->__('Identifiant du player Brightcove'), [ 'v2' => '{"type":"text","default":"","editable":true,"label":"\\u00a7!\\u00a7Brightcove Player Id!\\u00a7!","grade":3}', 'default' => '', 'fake' => true, 'store_in' => 'settings', 'translatable' => false, ]); - $this->addField('brightcovePlayerSecret', LongText::class, $this->__('Brightcove Player Secret'), [ + $this->addField('brightcovePlayerSecret', LongText::class, $this->__('Secret du player Brightcove'), [ 'v2' => '{"type":"text","default":"","editable":true,"label":"\\u00a7!\\u00a7Brightcove Player Secret!\\u00a7!","grade":3}', 'default' => '', 'fake' => true, @@ -2726,44 +2726,10 @@ trait PublicationSettings 'store_in' => 'settings', 'translatable' => false, ]); - $this->addField('section_phonegap', FormSection::class, $this->__('Applications mobile')); - $this->addField('phonegapId', LongText::class, $this->__('Identifiant de l\'identifiant'), [ - 'v2' => '{"type":"text","default":"com.fluidbook.phonegap.$id","editable":true,"label":"\\u00a7!\\u00a7Identifiant de l\'identifiant!\\u00a7!","grade":5,"hint":"\\u00a7!\\u00a7De la forme!\\u00a7! com.fluidbook.phonegap.xxxxx"}', - 'hint' => $this->__('De la forme') . ' com.fluidbook.phonegap.xxxxx', - 'default' => 'com.fluidbook.phonegap.$id', - 'fake' => true, - 'store_in' => 'settings', - 'translatable' => false, - ]); - $this->addField('phonegapVersion', LongText::class, $this->__('Version de l\'application'), [ - 'v2' => '{"type":"text","default":"1.0.0","editable":true,"label":"\\u00a7!\\u00a7Version de l\'application!\\u00a7!","grade":5,"hint":"\\u00a7!\\u00a7De la forme!\\u00a7! 1.2.3"}', - 'hint' => $this->__('De la forme') . ' 1.2.3', - 'default' => '1.0.0', - 'fake' => true, - 'store_in' => 'settings', - 'translatable' => false, - ]); - $this->addField('phonegapPlugins', Textarea::class, $this->__('Plugins Phonegap'), [ - 'v2' => '{"type":"textarea","default":"ChildBrowser","editable":true,"label":"\\u00a7!\\u00a7Plugins Phonegap!\\u00a7!","grade":5}', - 'default' => 'ChildBrowser', - 'fake' => true, - 'store_in' => 'settings', - 'translatable' => false, - ]); - $this->addField('appScreenshots', Textarea::class, 'Générer les screenshots', [ - 'v2' => '{"type":"textarea","default":"P,0\\nL,2\\nL,index","editable":true,"label":"G\\u00e9n\\u00e9rer les screenshots","grade":5,"hint":"\\u00a7!\\u00a7Une ligne par vue \\u00e0 g\\u00e9n\\u00e9rer de la forme X,Y (X : P(ortrait) ou L(andscape), Y : num\\u00e9ro de page ou vue (1, index))!\\u00a7!"}', - 'hint' => $this->__('Une ligne par vue à générer de la forme X,Y (X : P(ortrait) ou L(andscape), Y : numéro de page ou vue (1, index))'), - 'default' => 'P,0 -L,2 -L,index', - 'fake' => true, - 'store_in' => 'settings', - 'translatable' => false, - ]); $this->addField('section_secure', FormSection::class, $this->__('Sécurisation')); $this->addField('secureURL', LongText::class, $this->__('URL de sécurisation'), [ 'v2' => '{"type":"text","default":"http:\\/\\/","editable":true,"label":"\\u00a7!\\u00a7URL de s\\u00e9curisation!\\u00a7!","grade":5,"hint":"\\u00a7!\\u00a7URL int\\u00e9rrog\\u00e9 pour v\\u00e9rifier si le visiteur \\u00e0 les droits pour consulter la publication!\\u00a7!"}', - 'hint' => $this->__('URL intérrogé pour vérifier si le visiteur à les droits pour consulter la publication'), + 'hint' => $this->__('URL interrogée pour vérifier si le visiteur à les droits pour consulter la publication'), 'default' => 'http://', 'fake' => true, 'store_in' => 'settings', -- 2.39.5