From 1765dbcd249da49fd408ad0ab8d22317442e1e49 Mon Sep 17 00:00:00 2001 From: Alexander Kellner Date: Tue, 12 Sep 2023 16:26:04 +0200 Subject: [PATCH 1/7] [FEATURE] Load pagevisits in Analysis/Dashboard via AJAX --- Classes/Backend/Units/AbstractUnit.php | 97 +++++++++++++++++++ .../Units/Analysis/Dashboard/Pagevisits.php | 26 +++++ Classes/Backend/Units/UnitFinder.php | 28 ++++++ Classes/Backend/Units/UnitInterface.php | 10 ++ Classes/Controller/GeneralController.php | 21 ++++ Classes/Utility/StringUtility.php | 13 +++ Configuration/Backend/AjaxRoutes.php | 4 + .../Build/JavaScript/Backend/Diagram.js | 9 +- .../Build/JavaScript/Backend/Module.js | 22 +++++ Resources/Private/Sass/Modules.scss | 15 +++ .../Private/Templates/Analysis/Dashboard.html | 6 +- .../Units/Analysis/Dashboard/Pagevisits.html | 3 + Resources/Public/Css/Modules.min.css | 2 +- .../Public/JavaScript/Lux/Diagram.min.js | 2 +- Resources/Public/JavaScript/Lux/Module.min.js | 2 +- Tests/Unit/Utility/StringUtilityTest.php | 14 +++ 16 files changed, 263 insertions(+), 11 deletions(-) create mode 100644 Classes/Backend/Units/AbstractUnit.php create mode 100644 Classes/Backend/Units/Analysis/Dashboard/Pagevisits.php create mode 100644 Classes/Backend/Units/UnitFinder.php create mode 100644 Classes/Backend/Units/UnitInterface.php create mode 100644 Resources/Private/Templates/Backend/Units/Analysis/Dashboard/Pagevisits.html diff --git a/Classes/Backend/Units/AbstractUnit.php b/Classes/Backend/Units/AbstractUnit.php new file mode 100644 index 00000000..5ad658ec --- /dev/null +++ b/Classes/Backend/Units/AbstractUnit.php @@ -0,0 +1,97 @@ +setTemplateRootPaths([$this->templateRootPath]); + $view->setPartialRootPaths([$this->partialRootPath]); + $view->setTemplate($this->getTemplatePath()); + $view->assignMultiple([ + 'cacheLayerClass' => $this->cacheLayerClass, + 'cacheLayerFunction' => $this->cacheLayerFunction, + 'filterClass' => $this->filterClass, + 'filterFunction' => $this->filterFunction, + ] + $this->assignAdditionalVariables()); + $this->assignCacheLayer($view); + $this->assignFilter($view); + return $view->render(); + } + + protected function assignAdditionalVariables(): array + { + return []; + } + + protected function assignCacheLayer(StandaloneView $view): void + { + if ($this->cacheLayerClass !== '' && $this->cacheLayerFunction !== '') { + $cacheLayer = GeneralUtility::makeInstance(CacheLayer::class); + $cacheLayer->initialize($this->cacheLayerClass, $this->cacheLayerFunction); + $view->assign('cacheLayer', $cacheLayer); + } + } + + protected function assignFilter(StandaloneView $view): void + { + $filter = ObjectUtility::getFilterDto(); + if ($this->filterClass !== '' && $this->filterFunction !== '') { + $filterFromSession = BackendUtility::getSessionValue('filter', $this->filterFunction, $this->filterClass); + if (is_a($filterFromSession, FilterDto::class)) { + $filter = $filterFromSession; + } + } + $view->assign('filter', $filter); + } + + protected function getTemplatePath(): string + { + $path = StringUtility::removeStringPrefix(static::class, $this->classPrefix); + return str_replace('\\', '/', $path); + } +} diff --git a/Classes/Backend/Units/Analysis/Dashboard/Pagevisits.php b/Classes/Backend/Units/Analysis/Dashboard/Pagevisits.php new file mode 100644 index 00000000..ae424dba --- /dev/null +++ b/Classes/Backend/Units/Analysis/Dashboard/Pagevisits.php @@ -0,0 +1,26 @@ + GeneralUtility::makeInstance(PagevisistsDataProvider::class), + ]; + } +} diff --git a/Classes/Backend/Units/UnitFinder.php b/Classes/Backend/Units/UnitFinder.php new file mode 100644 index 00000000..b0356ee7 --- /dev/null +++ b/Classes/Backend/Units/UnitFinder.php @@ -0,0 +1,28 @@ + $performance]); } + + /** + * @param ServerRequestInterface $request + * @return ResponseInterface + * @throws ConfigurationException + */ + public function getUnitAjax(ServerRequestInterface $request): ResponseInterface + { + $path = $request->getQueryParams()['path'] ?? ''; + $unitFinder = GeneralUtility::makeInstance(UnitFinder::class); + return GeneralUtility::makeInstance(HtmlResponse::class, $unitFinder->find($path)->get()); + } } diff --git a/Classes/Utility/StringUtility.php b/Classes/Utility/StringUtility.php index 8322ab47..deffe696 100644 --- a/Classes/Utility/StringUtility.php +++ b/Classes/Utility/StringUtility.php @@ -122,4 +122,17 @@ public static function isShortMd5(string $string, int $length = 6): bool { return preg_replace('~[a-f0-9]{' . $length . '}~', '', $string) === ''; } + + /** + * Example result: + * "CamelCaseString" => ["Camel", "Case", "String"] + * + * @param string $string + * @return array + */ + public static function splitCamelcaseString(string $string): array + { + preg_match_all('~((?:^|[A-Z])[a-z]+)~', $string, $matches); + return $matches[0]; + } } diff --git a/Configuration/Backend/AjaxRoutes.php b/Configuration/Backend/AjaxRoutes.php index d6a05274..908af28f 100644 --- a/Configuration/Backend/AjaxRoutes.php +++ b/Configuration/Backend/AjaxRoutes.php @@ -61,6 +61,10 @@ 'path' => '/lux/pageoverview', 'target' => GeneralController::class . '::showOrHidePageOverviewAjax', ], + '/lux/unitajax' => [ + 'path' => '/lux/unitajax', + 'target' => GeneralController::class . '::getUnitAjax', + ], '/lux/visitorcompany' => [ 'path' => '/lux/visitorcompany', 'target' => LeadController::class . '::detailCompanyrecordAjax', diff --git a/Resources/Private/Build/JavaScript/Backend/Diagram.js b/Resources/Private/Build/JavaScript/Backend/Diagram.js index b4ab8c25..a155b059 100644 --- a/Resources/Private/Build/JavaScript/Backend/Diagram.js +++ b/Resources/Private/Build/JavaScript/Backend/Diagram.js @@ -12,15 +12,16 @@ define(['jquery', 'TYPO3/CMS/Lux/Vendor/Chart.min'], function($) { * * @returns {void} */ - this.initialize = function() { - diagramListener(); + this.initialize = function(dom) { + dom = dom || document; + diagramListener(dom); }; /** * @returns {void} */ - var diagramListener = function() { - var diagrams = document.querySelectorAll('[data-chart]'); + var diagramListener = function(dom) { + var diagrams = dom.querySelectorAll('[data-chart]'); for (var i = 0; i < diagrams.length; i++) { var type = diagrams[i].getAttribute('data-chart'); if (type === 'doughnut') { diff --git a/Resources/Private/Build/JavaScript/Backend/Module.js b/Resources/Private/Build/JavaScript/Backend/Module.js index 0252f635..a1a9684e 100644 --- a/Resources/Private/Build/JavaScript/Backend/Module.js +++ b/Resources/Private/Build/JavaScript/Backend/Module.js @@ -40,6 +40,7 @@ define(['jquery'], function($) { asynchronousLinkListenerPerformanceLoading(); asynchronousCompaniesInformationLoading(); addToggleListener(); + addUnitAjaxListener(); }; /** @@ -288,6 +289,27 @@ define(['jquery'], function($) { }); }; + const addUnitAjaxListener = function() { + const elements = document.querySelectorAll('[data-lux-unitajax]'); + elements.forEach(function(element) { + element.classList.add('luxspinner', 'luxspinner--center'); + const data = new URLSearchParams(); + data.append('path', element.getAttribute('data-lux-unitajax')); + fetch(TYPO3.settings.ajaxUrls['/lux/unitajax'] + '&' + data) + .then((resp) => resp.text()) + .then(function(html) { + element.innerHTML = html; + window.LuxDiagramObject.initialize(element); + }) + .catch(function(error) { + console.log(error); + }) + .finally(() => { + element.classList.remove('luxspinner', 'luxspinner--center') + }); + }); + } + /** * @param {string} elements * @param {string} className diff --git a/Resources/Private/Sass/Modules.scss b/Resources/Private/Sass/Modules.scss index 94723a6a..3eac4902 100644 --- a/Resources/Private/Sass/Modules.scss +++ b/Resources/Private/Sass/Modules.scss @@ -37,6 +37,10 @@ label { display: none; } +.relative { + position: relative; +} + .luxspinner { display: inline-block; width: 20px; @@ -46,6 +50,17 @@ label { border-top-color: $colorMain; animation: spin 1s ease-in-out infinite; -webkit-animation: spin 1s ease-in-out infinite; + + &--center { + top: 50%; + left: 50%; + position: absolute; + width: 50px; + height: 50px; + border: 6px solid rgba(255,255,255,.3); + border-top-color: $colorMain; + margin: -25px 0 0 -25px; + } } @keyframes spin { diff --git a/Resources/Private/Templates/Analysis/Dashboard.html b/Resources/Private/Templates/Analysis/Dashboard.html index acc4db17..86ab1328 100644 --- a/Resources/Private/Templates/Analysis/Dashboard.html +++ b/Resources/Private/Templates/Analysis/Dashboard.html @@ -6,10 +6,8 @@
-
- - - +
+
diff --git a/Resources/Private/Templates/Backend/Units/Analysis/Dashboard/Pagevisits.html b/Resources/Private/Templates/Backend/Units/Analysis/Dashboard/Pagevisits.html new file mode 100644 index 00000000..819465ec --- /dev/null +++ b/Resources/Private/Templates/Backend/Units/Analysis/Dashboard/Pagevisits.html @@ -0,0 +1,3 @@ + + + diff --git a/Resources/Public/Css/Modules.min.css b/Resources/Public/Css/Modules.min.css index 0eb32416..b15205e2 100644 --- a/Resources/Public/Css/Modules.min.css +++ b/Resources/Public/Css/Modules.min.css @@ -1 +1 @@ -.timeline{position:relative;background:#fff}.timeline:before{content:"";display:block;background-color:#ddd;position:absolute}.timeline--vertical{margin:0 0 0 calc(1.5rem + 2rem + 1rem)}.timeline--vertical:before{width:3px;height:100%;top:0;left:calc(-1.5rem / 2 - 3px / 2 - 2rem)}.timeline--vertical .timeline__item:before{background-color:#ddd}.timeline--vertical .timeline__item:first-child:before{background-color:#027aca}.timeline--vertical .timeline__item:first-child:after{width:3px;height:50%;top:0;left:calc(-1.5rem / 2 - 3px / 2 - 2rem)}.timeline--vertical .timeline__item:last-child:after{width:3px;height:50%;bottom:0;left:calc(-1.5rem / 2 - 3px / 2 - 2rem)}.timeline--horizontal{display:flex;justify-content:space-between}.timeline--horizontal:before{width:100%;height:3px;top:34px}.timeline--horizontal .timeline__item{width:100px;text-align:center}.timeline--horizontal .timeline__item:before{left:calc(50% - 1.5rem / 2);top:28px}.timeline--horizontal .timeline__item:first-child:before{background-color:#ddd}.timeline--horizontal .timeline__item:first-child:after{width:50%;height:3px;left:0;top:34px}.timeline--horizontal .timeline__item:last-child:before{background-color:#ddd}.timeline--horizontal .timeline__item:last-child:after{width:50%;height:3px;top:34px;right:0}.timeline__thin{width:85%;margin:10px auto 5px auto}.timeline__item{margin:0 0 1rem 0;max-width:300px;padding:.5rem;position:relative}.timeline__item:before{content:"";display:block;width:1.5rem;height:1.5rem;background-color:#027aca;border-radius:1.5rem;position:absolute;z-index:1;top:calc(50% - 1.5rem / 2);left:calc(-1.5rem - 2rem)}.timeline__item:first-child:after{content:"";display:block;background-color:#fff;position:absolute}.timeline__item:last-child:after{content:"";display:block;background-color:#fff;position:absolute}.nomargin{padding:0 !important;margin:0 !important}.wizard{background-color:#fff;padding:.2em 0em .2em .2em}.wizard a{padding:22px 12px 19px;position:relative;display:inline-block;text-decoration:none;min-width:33%;margin-left:3px;text-align:center;font-size:18px;color:#fff;font-weight:bold;background:#ddd;text-transform:uppercase;cursor:pointer;margin-bottom:20px}.wizard a:hover{text-decoration:none}.wizard a:first-child{margin-left:0}.wizard:not(.left-arrow) a:before{width:0;height:0;border-top:34px inset rgba(0,0,0,0);border-bottom:34px inset rgba(0,0,0,0);border-left:34px solid #fff;position:absolute;content:"";top:0;left:0}.wizard:not(.left-arrow) a:after{width:0;height:0;border-top:34px inset rgba(0,0,0,0);border-bottom:34px inset rgba(0,0,0,0);border-left:34px solid #ddd;position:absolute;content:"";top:0;right:-34px;z-index:2}.wizard.left-arrow a:before{width:0;height:0;border-top:34px inset rgba(0,0,0,0);border-bottom:34px inset rgba(0,0,0,0);border-right:34px solid #ddd;position:absolute;content:"";top:0;left:-34px;z-index:2}.wizard.left-arrow a:after{width:0;height:0;border-top:34px inset rgba(0,0,0,0);border-bottom:34px inset rgba(0,0,0,0);border-right:34px solid #fff;position:absolute;content:"";top:0;right:0;z-index:2}.wizard a:first-child:before,.wizard a:last-child:after{border:none}.wizard a:first-child{-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px}.wizard a:last-child{-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0}.wizard.left-arrow a:last-child:before,.wizard.small.left-arrow a:last-child:before{border-right-color:#027aca}.lux .wizard .badge{margin:0 5px 0 18px;position:relative;top:-1px;border-radius:20px;font-size:18px;background:#fff;color:#ddd}.lux .wizard .badge .number{display:inline-block}.wizard a:first-child .badge{margin-left:0}.wizard .current,.wizard a.progress-current{background:#027aca;color:#fff}.wizard .current .badge,.wizard a.progress-current .badge{color:#027aca}.wizard a.current:after,.wizard a.progress-current:after{border-left-color:#027aca !important}.wizard.left-arrow a.current:before,.wizard.left-arrow a.progress-current:before,.wizard.small.left-arrow a.current:before,.wizard.small.left-arrow a.progress-current:before{border-right-color:#027aca}.wizard.small{margin-bottom:15px}.wizard.small a{padding:5px 12px 5px}.wizard.small:not(.left-arrow) a:before{border-top:15px inset rgba(0,0,0,0);border-bottom:15px inset rgba(0,0,0,0);border-left:15px solid #fff}.wizard.small:not(.left-arrow) a:after{border-top:15px inset rgba(0,0,0,0);border-bottom:15px inset rgba(0,0,0,0);border-left:15px solid #7cc6fe;right:-15px}.wizard.small.left-arrow a:before{border-top:15px inset rgba(0,0,0,0);border-bottom:15px inset rgba(0,0,0,0);border-right:15px solid #7cc6fe;left:-15px;z-index:2}.wizard.small.left-arrow a:after{width:0;height:0;border-top:15px inset rgba(0,0,0,0);border-bottom:15px inset rgba(0,0,0,0);border-right:15px solid #fff}.wizard.small a:first-child:before,.wizard.small a:last-child:after{border:none}_:-ms-fullscreen,:root .wizard.small.left-arrow a:before{left:-14px}_:-ms-fullscreen,:root .wizard.small:not(.left-arrow) a:after{right:-14px}_:-ms-fullscreen,:root .wizard.left-arrow a:before{left:-29px}_:-ms-fullscreen,:root .wizard:not(.left-arrow) a:after{right:-29px}@media all and (min-width: 768px){.g-layout{display:grid;grid-gap:0 18px;grid-template-columns:1fr 1fr}}@media all and (min-width: 1280px){.g-layout{grid-template-columns:1fr 1fr 1fr}}@media all and (min-width: 768px){.g-layout__item--a{grid-column:1/2;grid-row:1/2}.g-layout__item--b{grid-column:2/3;grid-row:1/2}.g-layout__item--c{grid-column:1/2;grid-row:2/3}.g-layout__item--d{grid-column:2/2;grid-row:2/3}.g-layout__item--e{grid-column:1/3;grid-row:3/4}}@media all and (min-width: 1280px){.g-layout__item--e{grid-column:3/4;grid-row:1/3}}.g-layout canvas{max-width:100%;height:auto !important}svg{max-width:100%;height:auto}a:not(.btn):not(.nolink):not(.colorwhite){color:#027aca !important;cursor:pointer !important}hr{border-style:dashed;border-color:#ddd;border-bottom:0;border-left:0;border-right:0;margin:40px 0}label{font-weight:normal}.color-lux{color:#027aca}.color-grey{color:#ddd}.hidden{display:none}.luxspinner{display:inline-block;width:20px;height:20px;border:3px solid rgba(255,255,255,.3);border-radius:50%;border-top-color:#027aca;animation:spin 1s ease-in-out infinite;-webkit-animation:spin 1s ease-in-out infinite}@keyframes spin{to{-webkit-transform:rotate(360deg)}}@-webkit-keyframes spin{to{-webkit-transform:rotate(360deg)}}.lux{--bs-primary-rgb: 165, 231, 255}.lux h3{font-weight:bold}.lux .row+.row:not(.lux-trigger){margin-top:.5rem}@media screen and (min-width: 992px){.lux .row.flex{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;flex-wrap:wrap}}@media screen and (min-width: 992px){.lux .row>.flex[class*=col-]{display:flex;flex-direction:column}}.lux .panel-body{overflow:hidden}.lux .panel.flex{height:100%}.lux .bg-primary{background-color:#7cc6fe;border:1px solid #027aca}.lux .badge{background-color:#5a5a5a;color:#fff;border-radius:10px;font-size:11px;padding:3px 7px}.lux .badge.badge-primary{background-color:#027aca}.lux .alert-lux{background-color:#027aca}.lux .alert-warning{background-color:#f2b602;color:#000}.lux .form-select.form-control-lg{font-size:.9375rem;padding:.5rem 1rem}.lux .input-group-addon{border:none;background-color:#eee}.lux .form-control{border:1px solid #ddd}.lux .collapse-arrow:after{content:"";width:0;height:0;border-left:5px solid rgba(0,0,0,0);border-right:5px solid rgba(0,0,0,0);border-bottom:none;border-top:5px solid #292929;display:inline-block}.lux .collapse-arrow.collapsed:after{border-top:none;border-bottom:5px solid #292929;margin-bottom:1px}.lux .pull-right{float:right !important}.lux .pull-left{float:left !important}.lux .btn-lg-extra{padding:30px 60px;font-size:25px;line-height:2;border-radius:5px}.lux .btn-primary{background-color:#027aca;border-color:#027aca;color:#fff}.lux .btn-primary:hover,.lux .btn-primary:active,.lux .btn-primary:focus,.lux .btn-primary:hover:active{background-color:#027aca;border-color:#027aca}.lux .btn-secondary{background-color:#eee;border-color:#bbb}.lux .btn-primary-extra{appearance:none;-moz-appearance:none;-webkit-appearance:none;left:50%;top:50%;margin-top:-100px;margin-left:-200px;position:fixed;line-height:1.6}.lux .btn-primary-extra>span{display:block;font-size:16px}.lux .btn-add-lg{display:block;width:100%;padding:5px;font-weight:bold;font-size:19px}.lux .pagination{margin:0}.lux .pagination>.active>.page-link{background-color:#027aca;border-color:#ddd}.lux .lb-lg{font-size:20px;margin-bottom:5px}.lux .help-block{margin-top:15px;margin-left:15px;display:inline-block;color:#5a5a5a}.lux .help-block__code{list-style-type:none;padding:0;margin:10px 0 0 0;columns:2}.lux .help-block__code>li{margin:5px 0}.lux .help-block__code>li>span{font-style:italic;background:#ddd;display:inline-block;padding:2px 10px;margin-right:10px;font-weight:bold}.lux .description-block{display:block;margin-top:.5rem;margin-bottom:1rem;color:#5a5a5a}.lux .table{border:1px solid #ccc}.lux .table .soft{color:#737373}.lux .table.min-height-50 td{height:50px}.lux .table-hover>tbody>tr:hover,.lux .table-hover>tbody>tr.lux-action-detail{background-color:#027aca}.lux .table-hover>tbody>tr:hover>td,.lux .table-hover>tbody>tr.lux-action-detail>td{color:#fff}.lux .table-hover>tbody>tr:hover>td .soft,.lux .table-hover>tbody>tr.lux-action-detail>td .soft{color:#ccc}.lux .table-pointer>tbody>tr{cursor:pointer}.lux .close{position:absolute;right:15px;top:15px;width:25px;height:25px;opacity:.3;font-size:0;z-index:2;border:none;background:none}.lux .close:hover{opacity:1}.lux .close:before,.lux .close:after{position:absolute;top:0;content:" ";height:25px;width:2px;background-color:#333}.lux .close:before{transform:rotate(45deg)}.lux .close:after{transform:rotate(-45deg)}.lux .list-group-item>.badge{float:right;font-size:11px}.lux .table>:not(caption)>*>*{background:rgba(0,0,0,0)}.lux-textarea{width:100%;padding:10px;border:1px solid #ccc}.lux-textarea__default{color:#ccc}.lux-workflow-new{background-color:rgba(0,0,0,.8);position:fixed;top:0;right:0;bottom:0;left:0}.lux-workflow-sidbox{opacity:.5;background:#ddd;margin:34px 0 0 0;padding:20px}.lux_triggerarea,.lux_actionarea{position:relative}.lux_triggerarea .lux-trigger,.lux_triggerarea .lux-action,.lux_actionarea .lux-trigger,.lux_actionarea .lux-action{margin:80px 0 20px 0;padding:20px;border-style:dashed;border-color:#ddd;position:relative}.lux_triggerarea .lux-trigger:before,.lux_triggerarea .lux-action:before,.lux_actionarea .lux-trigger:before,.lux_actionarea .lux-action:before{content:"AND";display:block;width:10px;height:50px;border-left:3px solid #ddd;position:absolute;left:50%;margin-top:-87px;padding:13px 0 0 18px;font-size:18px;color:#ddd}.lux_triggerarea .lux-trigger:first-child,.lux_triggerarea .lux-action:first-child,.lux_actionarea .lux-trigger:first-child,.lux_actionarea .lux-action:first-child{margin-top:20px}.lux_triggerarea .lux-trigger:first-child:before,.lux_triggerarea .lux-action:first-child:before,.lux_actionarea .lux-trigger:first-child:before,.lux_actionarea .lux-action:first-child:before{display:none}.lux_triggerarea .lux-trigger-conjunctionOR:before,.lux_actionarea .lux-trigger-conjunctionOR:before{content:"OR"}.lux_triggerarea .lux-trigger-not:after,.lux_actionarea .lux-trigger-not:after{content:"(NOT)";width:10px;height:50px;position:absolute;font-size:26px;color:#ddd;right:115px;top:7px;font-weight:bold}.lux-messages{padding:15px 0;margin:1rem 0 2rem 0;list-style-type:none}.lux-messages>li{margin:5px 30px;font-size:16px}.lux .img-circle{object-fit:cover;border-radius:50%;width:100%;height:auto;aspect-ratio:1/1}.lux-group{display:flex;flex-wrap:wrap;list-style:none;margin:0;padding:20px 0;height:100%;min-height:320px;overflow:hidden}.lux-group>li{flex:0 0 50%;padding:0 5px} \ No newline at end of file +.timeline{position:relative;background:#fff}.timeline:before{content:"";display:block;background-color:#ddd;position:absolute}.timeline--vertical{margin:0 0 0 calc(1.5rem + 2rem + 1rem)}.timeline--vertical:before{width:3px;height:100%;top:0;left:calc(-1.5rem / 2 - 3px / 2 - 2rem)}.timeline--vertical .timeline__item:before{background-color:#ddd}.timeline--vertical .timeline__item:first-child:before{background-color:#027aca}.timeline--vertical .timeline__item:first-child:after{width:3px;height:50%;top:0;left:calc(-1.5rem / 2 - 3px / 2 - 2rem)}.timeline--vertical .timeline__item:last-child:after{width:3px;height:50%;bottom:0;left:calc(-1.5rem / 2 - 3px / 2 - 2rem)}.timeline--horizontal{display:flex;justify-content:space-between}.timeline--horizontal:before{width:100%;height:3px;top:34px}.timeline--horizontal .timeline__item{width:100px;text-align:center}.timeline--horizontal .timeline__item:before{left:calc(50% - 1.5rem / 2);top:28px}.timeline--horizontal .timeline__item:first-child:before{background-color:#ddd}.timeline--horizontal .timeline__item:first-child:after{width:50%;height:3px;left:0;top:34px}.timeline--horizontal .timeline__item:last-child:before{background-color:#ddd}.timeline--horizontal .timeline__item:last-child:after{width:50%;height:3px;top:34px;right:0}.timeline__thin{width:85%;margin:10px auto 5px auto}.timeline__item{margin:0 0 1rem 0;max-width:300px;padding:.5rem;position:relative}.timeline__item:before{content:"";display:block;width:1.5rem;height:1.5rem;background-color:#027aca;border-radius:1.5rem;position:absolute;z-index:1;top:calc(50% - 1.5rem / 2);left:calc(-1.5rem - 2rem)}.timeline__item:first-child:after{content:"";display:block;background-color:#fff;position:absolute}.timeline__item:last-child:after{content:"";display:block;background-color:#fff;position:absolute}.nomargin{padding:0 !important;margin:0 !important}.wizard{background-color:#fff;padding:.2em 0em .2em .2em}.wizard a{padding:22px 12px 19px;position:relative;display:inline-block;text-decoration:none;min-width:33%;margin-left:3px;text-align:center;font-size:18px;color:#fff;font-weight:bold;background:#ddd;text-transform:uppercase;cursor:pointer;margin-bottom:20px}.wizard a:hover{text-decoration:none}.wizard a:first-child{margin-left:0}.wizard:not(.left-arrow) a:before{width:0;height:0;border-top:34px inset rgba(0,0,0,0);border-bottom:34px inset rgba(0,0,0,0);border-left:34px solid #fff;position:absolute;content:"";top:0;left:0}.wizard:not(.left-arrow) a:after{width:0;height:0;border-top:34px inset rgba(0,0,0,0);border-bottom:34px inset rgba(0,0,0,0);border-left:34px solid #ddd;position:absolute;content:"";top:0;right:-34px;z-index:2}.wizard.left-arrow a:before{width:0;height:0;border-top:34px inset rgba(0,0,0,0);border-bottom:34px inset rgba(0,0,0,0);border-right:34px solid #ddd;position:absolute;content:"";top:0;left:-34px;z-index:2}.wizard.left-arrow a:after{width:0;height:0;border-top:34px inset rgba(0,0,0,0);border-bottom:34px inset rgba(0,0,0,0);border-right:34px solid #fff;position:absolute;content:"";top:0;right:0;z-index:2}.wizard a:first-child:before,.wizard a:last-child:after{border:none}.wizard a:first-child{-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px}.wizard a:last-child{-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0}.wizard.left-arrow a:last-child:before,.wizard.small.left-arrow a:last-child:before{border-right-color:#027aca}.lux .wizard .badge{margin:0 5px 0 18px;position:relative;top:-1px;border-radius:20px;font-size:18px;background:#fff;color:#ddd}.lux .wizard .badge .number{display:inline-block}.wizard a:first-child .badge{margin-left:0}.wizard .current,.wizard a.progress-current{background:#027aca;color:#fff}.wizard .current .badge,.wizard a.progress-current .badge{color:#027aca}.wizard a.current:after,.wizard a.progress-current:after{border-left-color:#027aca !important}.wizard.left-arrow a.current:before,.wizard.left-arrow a.progress-current:before,.wizard.small.left-arrow a.current:before,.wizard.small.left-arrow a.progress-current:before{border-right-color:#027aca}.wizard.small{margin-bottom:15px}.wizard.small a{padding:5px 12px 5px}.wizard.small:not(.left-arrow) a:before{border-top:15px inset rgba(0,0,0,0);border-bottom:15px inset rgba(0,0,0,0);border-left:15px solid #fff}.wizard.small:not(.left-arrow) a:after{border-top:15px inset rgba(0,0,0,0);border-bottom:15px inset rgba(0,0,0,0);border-left:15px solid #7cc6fe;right:-15px}.wizard.small.left-arrow a:before{border-top:15px inset rgba(0,0,0,0);border-bottom:15px inset rgba(0,0,0,0);border-right:15px solid #7cc6fe;left:-15px;z-index:2}.wizard.small.left-arrow a:after{width:0;height:0;border-top:15px inset rgba(0,0,0,0);border-bottom:15px inset rgba(0,0,0,0);border-right:15px solid #fff}.wizard.small a:first-child:before,.wizard.small a:last-child:after{border:none}_:-ms-fullscreen,:root .wizard.small.left-arrow a:before{left:-14px}_:-ms-fullscreen,:root .wizard.small:not(.left-arrow) a:after{right:-14px}_:-ms-fullscreen,:root .wizard.left-arrow a:before{left:-29px}_:-ms-fullscreen,:root .wizard:not(.left-arrow) a:after{right:-29px}@media all and (min-width: 768px){.g-layout{display:grid;grid-gap:0 18px;grid-template-columns:1fr 1fr}}@media all and (min-width: 1280px){.g-layout{grid-template-columns:1fr 1fr 1fr}}@media all and (min-width: 768px){.g-layout__item--a{grid-column:1/2;grid-row:1/2}.g-layout__item--b{grid-column:2/3;grid-row:1/2}.g-layout__item--c{grid-column:1/2;grid-row:2/3}.g-layout__item--d{grid-column:2/2;grid-row:2/3}.g-layout__item--e{grid-column:1/3;grid-row:3/4}}@media all and (min-width: 1280px){.g-layout__item--e{grid-column:3/4;grid-row:1/3}}.g-layout canvas{max-width:100%;height:auto !important}svg{max-width:100%;height:auto}a:not(.btn):not(.nolink):not(.colorwhite){color:#027aca !important;cursor:pointer !important}hr{border-style:dashed;border-color:#ddd;border-bottom:0;border-left:0;border-right:0;margin:40px 0}label{font-weight:normal}.color-lux{color:#027aca}.color-grey{color:#ddd}.hidden{display:none}.relative{position:relative}.luxspinner{display:inline-block;width:20px;height:20px;border:3px solid rgba(255,255,255,.3);border-radius:50%;border-top-color:#027aca;animation:spin 1s ease-in-out infinite;-webkit-animation:spin 1s ease-in-out infinite}.luxspinner--center{top:50%;left:50%;position:absolute;width:50px;height:50px;border:6px solid rgba(255,255,255,.3);border-top-color:#027aca;margin:-25px 0 0 -25px}@keyframes spin{to{-webkit-transform:rotate(360deg)}}@-webkit-keyframes spin{to{-webkit-transform:rotate(360deg)}}.lux{--bs-primary-rgb: 165, 231, 255}.lux h3{font-weight:bold}.lux .row+.row:not(.lux-trigger){margin-top:.5rem}@media screen and (min-width: 992px){.lux .row.flex{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;flex-wrap:wrap}}@media screen and (min-width: 992px){.lux .row>.flex[class*=col-]{display:flex;flex-direction:column}}.lux .panel-body{overflow:hidden}.lux .panel.flex{height:100%}.lux .bg-primary{background-color:#7cc6fe;border:1px solid #027aca}.lux .badge{background-color:#5a5a5a;color:#fff;border-radius:10px;font-size:11px;padding:3px 7px}.lux .badge.badge-primary{background-color:#027aca}.lux .alert-lux{background-color:#027aca}.lux .alert-warning{background-color:#f2b602;color:#000}.lux .form-select.form-control-lg{font-size:.9375rem;padding:.5rem 1rem}.lux .input-group-addon{border:none;background-color:#eee}.lux .form-control{border:1px solid #ddd}.lux .collapse-arrow:after{content:"";width:0;height:0;border-left:5px solid rgba(0,0,0,0);border-right:5px solid rgba(0,0,0,0);border-bottom:none;border-top:5px solid #292929;display:inline-block}.lux .collapse-arrow.collapsed:after{border-top:none;border-bottom:5px solid #292929;margin-bottom:1px}.lux .pull-right{float:right !important}.lux .pull-left{float:left !important}.lux .btn-lg-extra{padding:30px 60px;font-size:25px;line-height:2;border-radius:5px}.lux .btn-primary{background-color:#027aca;border-color:#027aca;color:#fff}.lux .btn-primary:hover,.lux .btn-primary:active,.lux .btn-primary:focus,.lux .btn-primary:hover:active{background-color:#027aca;border-color:#027aca}.lux .btn-secondary{background-color:#eee;border-color:#bbb}.lux .btn-primary-extra{appearance:none;-moz-appearance:none;-webkit-appearance:none;left:50%;top:50%;margin-top:-100px;margin-left:-200px;position:fixed;line-height:1.6}.lux .btn-primary-extra>span{display:block;font-size:16px}.lux .btn-add-lg{display:block;width:100%;padding:5px;font-weight:bold;font-size:19px}.lux .pagination{margin:0}.lux .pagination>.active>.page-link{background-color:#027aca;border-color:#ddd}.lux .lb-lg{font-size:20px;margin-bottom:5px}.lux .help-block{margin-top:15px;margin-left:15px;display:inline-block;color:#5a5a5a}.lux .help-block__code{list-style-type:none;padding:0;margin:10px 0 0 0;columns:2}.lux .help-block__code>li{margin:5px 0}.lux .help-block__code>li>span{font-style:italic;background:#ddd;display:inline-block;padding:2px 10px;margin-right:10px;font-weight:bold}.lux .description-block{display:block;margin-top:.5rem;margin-bottom:1rem;color:#5a5a5a}.lux .table{border:1px solid #ccc}.lux .table .soft{color:#737373}.lux .table.min-height-50 td{height:50px}.lux .table-hover>tbody>tr:hover,.lux .table-hover>tbody>tr.lux-action-detail{background-color:#027aca}.lux .table-hover>tbody>tr:hover>td,.lux .table-hover>tbody>tr.lux-action-detail>td{color:#fff}.lux .table-hover>tbody>tr:hover>td .soft,.lux .table-hover>tbody>tr.lux-action-detail>td .soft{color:#ccc}.lux .table-pointer>tbody>tr{cursor:pointer}.lux .close{position:absolute;right:15px;top:15px;width:25px;height:25px;opacity:.3;font-size:0;z-index:2;border:none;background:none}.lux .close:hover{opacity:1}.lux .close:before,.lux .close:after{position:absolute;top:0;content:" ";height:25px;width:2px;background-color:#333}.lux .close:before{transform:rotate(45deg)}.lux .close:after{transform:rotate(-45deg)}.lux .list-group-item>.badge{float:right;font-size:11px}.lux .table>:not(caption)>*>*{background:rgba(0,0,0,0)}.lux-textarea{width:100%;padding:10px;border:1px solid #ccc}.lux-textarea__default{color:#ccc}.lux-workflow-new{background-color:rgba(0,0,0,.8);position:fixed;top:0;right:0;bottom:0;left:0}.lux-workflow-sidbox{opacity:.5;background:#ddd;margin:34px 0 0 0;padding:20px}.lux_triggerarea,.lux_actionarea{position:relative}.lux_triggerarea .lux-trigger,.lux_triggerarea .lux-action,.lux_actionarea .lux-trigger,.lux_actionarea .lux-action{margin:80px 0 20px 0;padding:20px;border-style:dashed;border-color:#ddd;position:relative}.lux_triggerarea .lux-trigger:before,.lux_triggerarea .lux-action:before,.lux_actionarea .lux-trigger:before,.lux_actionarea .lux-action:before{content:"AND";display:block;width:10px;height:50px;border-left:3px solid #ddd;position:absolute;left:50%;margin-top:-87px;padding:13px 0 0 18px;font-size:18px;color:#ddd}.lux_triggerarea .lux-trigger:first-child,.lux_triggerarea .lux-action:first-child,.lux_actionarea .lux-trigger:first-child,.lux_actionarea .lux-action:first-child{margin-top:20px}.lux_triggerarea .lux-trigger:first-child:before,.lux_triggerarea .lux-action:first-child:before,.lux_actionarea .lux-trigger:first-child:before,.lux_actionarea .lux-action:first-child:before{display:none}.lux_triggerarea .lux-trigger-conjunctionOR:before,.lux_actionarea .lux-trigger-conjunctionOR:before{content:"OR"}.lux_triggerarea .lux-trigger-not:after,.lux_actionarea .lux-trigger-not:after{content:"(NOT)";width:10px;height:50px;position:absolute;font-size:26px;color:#ddd;right:115px;top:7px;font-weight:bold}.lux-messages{padding:15px 0;margin:1rem 0 2rem 0;list-style-type:none}.lux-messages>li{margin:5px 30px;font-size:16px}.lux .img-circle{object-fit:cover;border-radius:50%;width:100%;height:auto;aspect-ratio:1/1}.lux-group{display:flex;flex-wrap:wrap;list-style:none;margin:0;padding:20px 0;height:100%;min-height:320px;overflow:hidden}.lux-group>li{flex:0 0 50%;padding:0 5px} \ No newline at end of file diff --git a/Resources/Public/JavaScript/Lux/Diagram.min.js b/Resources/Public/JavaScript/Lux/Diagram.min.js index 1548720e..1b16e36d 100644 --- a/Resources/Public/JavaScript/Lux/Diagram.min.js +++ b/Resources/Public/JavaScript/Lux/Diagram.min.js @@ -1 +1 @@ -define(["jquery","TYPO3/CMS/Lux/Vendor/Chart.min"],function(t){"use strict";function a(t){this.initialize=function(){a()};var a=function(){for(var t=document.querySelectorAll("[data-chart]"),a=0;at.text()).then(function(t){e.innerHTML=t,window.LuxDiagramObject.initialize(e)}).catch(function(t){console.log(t)}).finally(()=>{e.classList.remove("luxspinner","luxspinner--center")})})};var g=function(t,e){for(var n=0;n Date: Wed, 13 Sep 2023 12:30:04 +0200 Subject: [PATCH 2/7] [FEATURE] Add missing diagrams from analysis dashboard --- Classes/Backend/Units/AbstractUnit.php | 28 +++++++--- .../Units/Analysis/Dashboard/Browser.php | 26 +++++++++ .../Units/Analysis/Dashboard/Downloads.php | 26 +++++++++ .../Analysis/Dashboard/Pagevisitsleads.php | 27 ++++++++++ .../Units/Analysis/Dashboard/Socialmedia.php | 26 +++++++++ .../Analysis/Dashboard/Top/Downloads.php | 27 ++++++++++ .../Units/Analysis/Dashboard/Top/News.php | 27 ++++++++++ .../Units/Analysis/Dashboard/Top/Pages.php | 27 ++++++++++ .../Units/Analysis/Dashboard/Top/Search.php | 27 ++++++++++ Classes/Controller/AnalysisController.php | 41 +++++--------- .../Build/JavaScript/Backend/Module.js | 3 +- Resources/Private/Sass/Modules.scss | 33 +++++++----- .../Private/Templates/Analysis/Dashboard.html | 54 ++++++++++--------- .../Units/Analysis/Dashboard/Browser.html | 3 ++ .../Units/Analysis/Dashboard/Downloads.html | 3 ++ .../Analysis/Dashboard/Pagevisitsleads.html | 3 ++ .../Units/Analysis/Dashboard/Socialmedia.html | 3 ++ .../Analysis/Dashboard/Top/Downloads.html | 3 ++ .../Units/Analysis/Dashboard/Top/News.html | 3 ++ .../Units/Analysis/Dashboard/Top/Pages.html | 3 ++ .../Units/Analysis/Dashboard/Top/Search.html | 3 ++ Resources/Public/Css/Modules.min.css | 2 +- Resources/Public/JavaScript/Lux/Module.min.js | 2 +- 23 files changed, 322 insertions(+), 78 deletions(-) create mode 100644 Classes/Backend/Units/Analysis/Dashboard/Browser.php create mode 100644 Classes/Backend/Units/Analysis/Dashboard/Downloads.php create mode 100644 Classes/Backend/Units/Analysis/Dashboard/Pagevisitsleads.php create mode 100644 Classes/Backend/Units/Analysis/Dashboard/Socialmedia.php create mode 100644 Classes/Backend/Units/Analysis/Dashboard/Top/Downloads.php create mode 100644 Classes/Backend/Units/Analysis/Dashboard/Top/News.php create mode 100644 Classes/Backend/Units/Analysis/Dashboard/Top/Pages.php create mode 100644 Classes/Backend/Units/Analysis/Dashboard/Top/Search.php create mode 100644 Resources/Private/Templates/Backend/Units/Analysis/Dashboard/Browser.html create mode 100644 Resources/Private/Templates/Backend/Units/Analysis/Dashboard/Downloads.html create mode 100644 Resources/Private/Templates/Backend/Units/Analysis/Dashboard/Pagevisitsleads.html create mode 100644 Resources/Private/Templates/Backend/Units/Analysis/Dashboard/Socialmedia.html create mode 100644 Resources/Private/Templates/Backend/Units/Analysis/Dashboard/Top/Downloads.html create mode 100644 Resources/Private/Templates/Backend/Units/Analysis/Dashboard/Top/News.html create mode 100644 Resources/Private/Templates/Backend/Units/Analysis/Dashboard/Top/Pages.html create mode 100644 Resources/Private/Templates/Backend/Units/Analysis/Dashboard/Top/Search.html diff --git a/Classes/Backend/Units/AbstractUnit.php b/Classes/Backend/Units/AbstractUnit.php index 5ad658ec..721f5a92 100644 --- a/Classes/Backend/Units/AbstractUnit.php +++ b/Classes/Backend/Units/AbstractUnit.php @@ -14,6 +14,7 @@ abstract class AbstractUnit { + protected ?FilterDto $filter = null; protected string $templateRootPath = 'EXT:lux/Resources/Private/Templates/Backend/Units'; protected string $partialRootPath = 'EXT:lux/Resources/Private/Partials'; protected string $classPrefix = 'In2code\Lux\Backend\Units\\'; @@ -47,6 +48,24 @@ abstract class AbstractUnit protected string $filterFunction = ''; public function get(): string + { + $this->initialize(); + return $this->getHtml(); + } + + protected function initialize(): void + { + $filter = ObjectUtility::getFilterDto(); + if ($this->filterClass !== '' && $this->filterFunction !== '') { + $filterFromSession = BackendUtility::getSessionValue('filter', $this->filterFunction, $this->filterClass); + if (is_a($filterFromSession, FilterDto::class)) { + $filter = $filterFromSession; + } + } + $this->filter = $filter; + } + + protected function getHtml(): string { $view = GeneralUtility::makeInstance(StandaloneView::class); $view->setTemplateRootPaths([$this->templateRootPath]); @@ -79,14 +98,7 @@ protected function assignCacheLayer(StandaloneView $view): void protected function assignFilter(StandaloneView $view): void { - $filter = ObjectUtility::getFilterDto(); - if ($this->filterClass !== '' && $this->filterFunction !== '') { - $filterFromSession = BackendUtility::getSessionValue('filter', $this->filterFunction, $this->filterClass); - if (is_a($filterFromSession, FilterDto::class)) { - $filter = $filterFromSession; - } - } - $view->assign('filter', $filter); + $view->assign('filter', $this->filter); } protected function getTemplatePath(): string diff --git a/Classes/Backend/Units/Analysis/Dashboard/Browser.php b/Classes/Backend/Units/Analysis/Dashboard/Browser.php new file mode 100644 index 00000000..55b2ab0c --- /dev/null +++ b/Classes/Backend/Units/Analysis/Dashboard/Browser.php @@ -0,0 +1,26 @@ + GeneralUtility::makeInstance(BrowserAmountDataProvider::class, $this->filter), + ]; + } +} diff --git a/Classes/Backend/Units/Analysis/Dashboard/Downloads.php b/Classes/Backend/Units/Analysis/Dashboard/Downloads.php new file mode 100644 index 00000000..66e198d5 --- /dev/null +++ b/Classes/Backend/Units/Analysis/Dashboard/Downloads.php @@ -0,0 +1,26 @@ + GeneralUtility::makeInstance(DownloadsDataProvider::class, $this->filter), + ]; + } +} diff --git a/Classes/Backend/Units/Analysis/Dashboard/Pagevisitsleads.php b/Classes/Backend/Units/Analysis/Dashboard/Pagevisitsleads.php new file mode 100644 index 00000000..7924122d --- /dev/null +++ b/Classes/Backend/Units/Analysis/Dashboard/Pagevisitsleads.php @@ -0,0 +1,27 @@ + $pagevisitsRepository->findLatestPagevisits($this->filter), + ]; + } +} diff --git a/Classes/Backend/Units/Analysis/Dashboard/Socialmedia.php b/Classes/Backend/Units/Analysis/Dashboard/Socialmedia.php new file mode 100644 index 00000000..a941712a --- /dev/null +++ b/Classes/Backend/Units/Analysis/Dashboard/Socialmedia.php @@ -0,0 +1,26 @@ + GeneralUtility::makeInstance(SocialMediaDataProvider::class, $this->filter), + ]; + } +} diff --git a/Classes/Backend/Units/Analysis/Dashboard/Top/Downloads.php b/Classes/Backend/Units/Analysis/Dashboard/Top/Downloads.php new file mode 100644 index 00000000..cf0ea2be --- /dev/null +++ b/Classes/Backend/Units/Analysis/Dashboard/Top/Downloads.php @@ -0,0 +1,27 @@ + $downloadRepository->findCombinedByHref($this->filter), + ]; + } +} diff --git a/Classes/Backend/Units/Analysis/Dashboard/Top/News.php b/Classes/Backend/Units/Analysis/Dashboard/Top/News.php new file mode 100644 index 00000000..208fef05 --- /dev/null +++ b/Classes/Backend/Units/Analysis/Dashboard/Top/News.php @@ -0,0 +1,27 @@ + $newsvisitRepository->findCombinedByNewsIdentifier($this->filter), + ]; + } +} diff --git a/Classes/Backend/Units/Analysis/Dashboard/Top/Pages.php b/Classes/Backend/Units/Analysis/Dashboard/Top/Pages.php new file mode 100644 index 00000000..fe922db4 --- /dev/null +++ b/Classes/Backend/Units/Analysis/Dashboard/Top/Pages.php @@ -0,0 +1,27 @@ + $pagevisitsRepository->findCombinedByPageIdentifier($this->filter), + ]; + } +} diff --git a/Classes/Backend/Units/Analysis/Dashboard/Top/Search.php b/Classes/Backend/Units/Analysis/Dashboard/Top/Search.php new file mode 100644 index 00000000..fb6a9285 --- /dev/null +++ b/Classes/Backend/Units/Analysis/Dashboard/Top/Search.php @@ -0,0 +1,27 @@ + $searchRepository->findCombinedBySearchIdentifier($this->filter), + ]; + } +} diff --git a/Classes/Controller/AnalysisController.php b/Classes/Controller/AnalysisController.php index 650cabe2..ff9a3c4b 100644 --- a/Classes/Controller/AnalysisController.php +++ b/Classes/Controller/AnalysisController.php @@ -3,11 +3,11 @@ declare(strict_types=1); namespace In2code\Lux\Controller; +use Doctrine\DBAL\DBALException; use Doctrine\DBAL\Driver\Exception as ExceptionDbalDriver; use Doctrine\DBAL\Exception as ExceptionDbal; use Exception; use In2code\Lux\Domain\DataProvider\AllLinkclickDataProvider; -use In2code\Lux\Domain\DataProvider\BrowserAmountDataProvider; use In2code\Lux\Domain\DataProvider\DomainDataProvider; use In2code\Lux\Domain\DataProvider\DomainNewsDataProvider; use In2code\Lux\Domain\DataProvider\DownloadsDataProvider; @@ -17,7 +17,6 @@ use In2code\Lux\Domain\DataProvider\NewsvisistsDataProvider; use In2code\Lux\Domain\DataProvider\PagevisistsDataProvider; use In2code\Lux\Domain\DataProvider\SearchDataProvider; -use In2code\Lux\Domain\DataProvider\SocialMediaDataProvider; use In2code\Lux\Domain\DataProvider\UtmCampaignDataProvider; use In2code\Lux\Domain\DataProvider\UtmDataProvider; use In2code\Lux\Domain\DataProvider\UtmMediaDataProvider; @@ -26,21 +25,18 @@ use In2code\Lux\Domain\Model\News; use In2code\Lux\Domain\Model\Page; use In2code\Lux\Domain\Model\Transfer\FilterDto; -use In2code\Lux\Exception\ConfigurationException; -use In2code\Lux\Exception\UnexpectedValueException; use In2code\Lux\Utility\FileUtility; use In2code\Lux\Utility\LocalizationUtility; use In2code\Lux\Utility\ObjectUtility; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\StreamInterface; -use TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationExtensionNotConfiguredException; -use TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationPathDoesNotExistException; use TYPO3\CMS\Core\Http\JsonResponse; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Configuration\Exception\InvalidConfigurationTypeException; use TYPO3\CMS\Extbase\Http\ForwardResponse; use TYPO3\CMS\Extbase\Mvc\Exception\NoSuchArgumentException; +use TYPO3\CMS\Extbase\Object\Exception as ExceptionExtbaseObject; use TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException; use TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException; @@ -58,39 +54,18 @@ public function initializeDashboardAction(): void /** * @param FilterDto $filter * @return ResponseInterface - * @throws ConfigurationException * @throws ExceptionDbal * @throws InvalidConfigurationTypeException * @throws InvalidQueryException - * @throws UnexpectedValueException - * @throws ExtensionConfigurationExtensionNotConfiguredException - * @throws ExtensionConfigurationPathDoesNotExistException * @throws ExceptionDbalDriver */ public function dashboardAction(FilterDto $filter): ResponseInterface { - $this->cacheLayer->initialize(__CLASS__, __FUNCTION__); $this->view->assignMultiple([ - 'cacheLayer' => $this->cacheLayer, 'filter' => $filter, 'interestingLogs' => $this->logRepository->findInterestingLogs($filter), ]); - if ($this->cacheLayer->isCacheAvailable('Box/Analysis/Pagevisits/' . $filter->getHash()) === false) { - $this->view->assignMultiple([ - 'numberOfVisitorsData' => GeneralUtility::makeInstance(PagevisistsDataProvider::class, $filter), - 'numberOfDownloadsData' => GeneralUtility::makeInstance(DownloadsDataProvider::class, $filter), - 'pages' => $this->pagevisitsRepository->findCombinedByPageIdentifier($filter), - 'downloads' => $this->downloadRepository->findCombinedByHref($filter), - 'news' => $this->newsvisitRepository->findCombinedByNewsIdentifier($filter), - 'searchterms' => $this->searchRepository->findCombinedBySearchIdentifier($filter), - 'browserData' => GeneralUtility::makeInstance(BrowserAmountDataProvider::class, $filter), - 'domainData' => GeneralUtility::makeInstance(DomainDataProvider::class, $filter), - 'socialMediaData' => GeneralUtility::makeInstance(SocialMediaDataProvider::class, $filter), - 'latestPagevisits' => $this->pagevisitsRepository->findLatestPagevisits($filter), - ]); - } - $this->addDocumentHeaderForCurrentController(); return $this->defaultRendering(); } @@ -111,8 +86,10 @@ public function initializeContentAction(): void * @param string $export * @return ResponseInterface * @throws ExceptionDbal - * @throws InvalidQueryException * @throws ExceptionDbalDriver + * @throws InvalidQueryException + * @throws DBALException + * @throws ExceptionExtbaseObject */ public function contentAction(FilterDto $filter, string $export = ''): ResponseInterface { @@ -142,6 +119,7 @@ public function contentAction(FilterDto $filter, string $export = ''): ResponseI * @throws ExceptionDbal * @throws InvalidQueryException * @throws ExceptionDbalDriver + * @throws ExceptionExtbaseObject */ public function contentCsvAction(FilterDto $filter): ResponseInterface { @@ -193,6 +171,7 @@ public function newsAction(FilterDto $filter, string $export = ''): ResponseInte * @return ResponseInterface * @throws ExceptionDbal * @throws ExceptionDbalDriver + * @throws DBALException */ public function newsCsvAction(FilterDto $filter): ResponseInterface { @@ -218,6 +197,7 @@ public function initializeUtmAction(): void * @throws ExceptionDbalDriver * @throws InvalidQueryException * @throws ExceptionDbal + * @throws DBALException */ public function utmAction(FilterDto $filter, string $export = ''): ResponseInterface { @@ -347,6 +327,7 @@ public function deleteLinkListenerAction(LinkListener $linkListener): ResponseIn * @return ResponseInterface * @throws ExceptionDbal * @throws ExceptionDbalDriver + * @throws DBALException */ public function detailPageAction(Page $page): ResponseInterface { @@ -365,6 +346,7 @@ public function detailPageAction(Page $page): ResponseInterface * @return ResponseInterface * @throws ExceptionDbalDriver * @throws ExceptionDbal + * @throws DBALException */ public function detailNewsAction(News $news): ResponseInterface { @@ -442,6 +424,7 @@ public function detailSearchAction(string $searchterm): ResponseInterface * @return ResponseInterface * @noinspection PhpUnused * @throws ExceptionDbalDriver + * @throws DBALException */ public function detailAjaxPage(ServerRequestInterface $request): ResponseInterface { @@ -471,6 +454,7 @@ public function detailAjaxPage(ServerRequestInterface $request): ResponseInterfa * @return ResponseInterface * @noinspection PhpUnused * @throws ExceptionDbalDriver + * @throws DBALException */ public function detailNewsAjaxPage(ServerRequestInterface $request): ResponseInterface { @@ -499,6 +483,7 @@ public function detailNewsAjaxPage(ServerRequestInterface $request): ResponseInt * * @param ServerRequestInterface $request * @return ResponseInterface + * @throws Exception */ public function detailUtmAjaxPage(ServerRequestInterface $request): ResponseInterface { diff --git a/Resources/Private/Build/JavaScript/Backend/Module.js b/Resources/Private/Build/JavaScript/Backend/Module.js index a1a9684e..ab80f13b 100644 --- a/Resources/Private/Build/JavaScript/Backend/Module.js +++ b/Resources/Private/Build/JavaScript/Backend/Module.js @@ -292,7 +292,6 @@ define(['jquery'], function($) { const addUnitAjaxListener = function() { const elements = document.querySelectorAll('[data-lux-unitajax]'); elements.forEach(function(element) { - element.classList.add('luxspinner', 'luxspinner--center'); const data = new URLSearchParams(); data.append('path', element.getAttribute('data-lux-unitajax')); fetch(TYPO3.settings.ajaxUrls['/lux/unitajax'] + '&' + data) @@ -305,7 +304,7 @@ define(['jquery'], function($) { console.log(error); }) .finally(() => { - element.classList.remove('luxspinner', 'luxspinner--center') + element.classList.remove('unitajax') }); }); } diff --git a/Resources/Private/Sass/Modules.scss b/Resources/Private/Sass/Modules.scss index 3eac4902..0629242e 100644 --- a/Resources/Private/Sass/Modules.scss +++ b/Resources/Private/Sass/Modules.scss @@ -37,8 +37,28 @@ label { display: none; } -.relative { +.unitajax { position: relative; + overflow: hidden; + min-height: 300px; + background-color: $colorGrey; + border: 2px dashed $colorGreyBright; + margin-bottom: 1.125rem; +} + +.unitajax-spinner { + display: inline-block; + border-radius: 50%; + border: 6px solid rgba(255,255,255,.3); + border-top-color: $colorMain; + animation: spin 1s ease-in-out infinite; + -webkit-animation: spin 1s ease-in-out infinite; + top: 50%; + left: 50%; + position: absolute; + width: 50px; + height: 50px; + margin: -25px 0 0 -25px; } .luxspinner { @@ -50,17 +70,6 @@ label { border-top-color: $colorMain; animation: spin 1s ease-in-out infinite; -webkit-animation: spin 1s ease-in-out infinite; - - &--center { - top: 50%; - left: 50%; - position: absolute; - width: 50px; - height: 50px; - border: 6px solid rgba(255,255,255,.3); - border-top-color: $colorMain; - margin: -25px 0 0 -25px; - } } @keyframes spin { diff --git a/Resources/Private/Templates/Analysis/Dashboard.html b/Resources/Private/Templates/Analysis/Dashboard.html index 86ab1328..0426a59f 100644 --- a/Resources/Private/Templates/Analysis/Dashboard.html +++ b/Resources/Private/Templates/Analysis/Dashboard.html @@ -6,25 +6,27 @@
-
-
+
+
+
+
- - - +
+
+
- - - +
+
+
- - - +
+
+
@@ -37,31 +39,31 @@
- - - +
+
+
- - - +
+
+
- - - +
+
+
- - - +
+
+
- - - +
+
+
diff --git a/Resources/Private/Templates/Backend/Units/Analysis/Dashboard/Browser.html b/Resources/Private/Templates/Backend/Units/Analysis/Dashboard/Browser.html new file mode 100644 index 00000000..702a7f2b --- /dev/null +++ b/Resources/Private/Templates/Backend/Units/Analysis/Dashboard/Browser.html @@ -0,0 +1,3 @@ + + + diff --git a/Resources/Private/Templates/Backend/Units/Analysis/Dashboard/Downloads.html b/Resources/Private/Templates/Backend/Units/Analysis/Dashboard/Downloads.html new file mode 100644 index 00000000..e465b1e9 --- /dev/null +++ b/Resources/Private/Templates/Backend/Units/Analysis/Dashboard/Downloads.html @@ -0,0 +1,3 @@ + + + diff --git a/Resources/Private/Templates/Backend/Units/Analysis/Dashboard/Pagevisitsleads.html b/Resources/Private/Templates/Backend/Units/Analysis/Dashboard/Pagevisitsleads.html new file mode 100644 index 00000000..7283f33e --- /dev/null +++ b/Resources/Private/Templates/Backend/Units/Analysis/Dashboard/Pagevisitsleads.html @@ -0,0 +1,3 @@ + + + diff --git a/Resources/Private/Templates/Backend/Units/Analysis/Dashboard/Socialmedia.html b/Resources/Private/Templates/Backend/Units/Analysis/Dashboard/Socialmedia.html new file mode 100644 index 00000000..95e204ce --- /dev/null +++ b/Resources/Private/Templates/Backend/Units/Analysis/Dashboard/Socialmedia.html @@ -0,0 +1,3 @@ + + + diff --git a/Resources/Private/Templates/Backend/Units/Analysis/Dashboard/Top/Downloads.html b/Resources/Private/Templates/Backend/Units/Analysis/Dashboard/Top/Downloads.html new file mode 100644 index 00000000..593b173a --- /dev/null +++ b/Resources/Private/Templates/Backend/Units/Analysis/Dashboard/Top/Downloads.html @@ -0,0 +1,3 @@ + + + diff --git a/Resources/Private/Templates/Backend/Units/Analysis/Dashboard/Top/News.html b/Resources/Private/Templates/Backend/Units/Analysis/Dashboard/Top/News.html new file mode 100644 index 00000000..b5769ec9 --- /dev/null +++ b/Resources/Private/Templates/Backend/Units/Analysis/Dashboard/Top/News.html @@ -0,0 +1,3 @@ + + + diff --git a/Resources/Private/Templates/Backend/Units/Analysis/Dashboard/Top/Pages.html b/Resources/Private/Templates/Backend/Units/Analysis/Dashboard/Top/Pages.html new file mode 100644 index 00000000..2ac09843 --- /dev/null +++ b/Resources/Private/Templates/Backend/Units/Analysis/Dashboard/Top/Pages.html @@ -0,0 +1,3 @@ + + + diff --git a/Resources/Private/Templates/Backend/Units/Analysis/Dashboard/Top/Search.html b/Resources/Private/Templates/Backend/Units/Analysis/Dashboard/Top/Search.html new file mode 100644 index 00000000..28d8cc14 --- /dev/null +++ b/Resources/Private/Templates/Backend/Units/Analysis/Dashboard/Top/Search.html @@ -0,0 +1,3 @@ + + + diff --git a/Resources/Public/Css/Modules.min.css b/Resources/Public/Css/Modules.min.css index b15205e2..ab33fff0 100644 --- a/Resources/Public/Css/Modules.min.css +++ b/Resources/Public/Css/Modules.min.css @@ -1 +1 @@ -.timeline{position:relative;background:#fff}.timeline:before{content:"";display:block;background-color:#ddd;position:absolute}.timeline--vertical{margin:0 0 0 calc(1.5rem + 2rem + 1rem)}.timeline--vertical:before{width:3px;height:100%;top:0;left:calc(-1.5rem / 2 - 3px / 2 - 2rem)}.timeline--vertical .timeline__item:before{background-color:#ddd}.timeline--vertical .timeline__item:first-child:before{background-color:#027aca}.timeline--vertical .timeline__item:first-child:after{width:3px;height:50%;top:0;left:calc(-1.5rem / 2 - 3px / 2 - 2rem)}.timeline--vertical .timeline__item:last-child:after{width:3px;height:50%;bottom:0;left:calc(-1.5rem / 2 - 3px / 2 - 2rem)}.timeline--horizontal{display:flex;justify-content:space-between}.timeline--horizontal:before{width:100%;height:3px;top:34px}.timeline--horizontal .timeline__item{width:100px;text-align:center}.timeline--horizontal .timeline__item:before{left:calc(50% - 1.5rem / 2);top:28px}.timeline--horizontal .timeline__item:first-child:before{background-color:#ddd}.timeline--horizontal .timeline__item:first-child:after{width:50%;height:3px;left:0;top:34px}.timeline--horizontal .timeline__item:last-child:before{background-color:#ddd}.timeline--horizontal .timeline__item:last-child:after{width:50%;height:3px;top:34px;right:0}.timeline__thin{width:85%;margin:10px auto 5px auto}.timeline__item{margin:0 0 1rem 0;max-width:300px;padding:.5rem;position:relative}.timeline__item:before{content:"";display:block;width:1.5rem;height:1.5rem;background-color:#027aca;border-radius:1.5rem;position:absolute;z-index:1;top:calc(50% - 1.5rem / 2);left:calc(-1.5rem - 2rem)}.timeline__item:first-child:after{content:"";display:block;background-color:#fff;position:absolute}.timeline__item:last-child:after{content:"";display:block;background-color:#fff;position:absolute}.nomargin{padding:0 !important;margin:0 !important}.wizard{background-color:#fff;padding:.2em 0em .2em .2em}.wizard a{padding:22px 12px 19px;position:relative;display:inline-block;text-decoration:none;min-width:33%;margin-left:3px;text-align:center;font-size:18px;color:#fff;font-weight:bold;background:#ddd;text-transform:uppercase;cursor:pointer;margin-bottom:20px}.wizard a:hover{text-decoration:none}.wizard a:first-child{margin-left:0}.wizard:not(.left-arrow) a:before{width:0;height:0;border-top:34px inset rgba(0,0,0,0);border-bottom:34px inset rgba(0,0,0,0);border-left:34px solid #fff;position:absolute;content:"";top:0;left:0}.wizard:not(.left-arrow) a:after{width:0;height:0;border-top:34px inset rgba(0,0,0,0);border-bottom:34px inset rgba(0,0,0,0);border-left:34px solid #ddd;position:absolute;content:"";top:0;right:-34px;z-index:2}.wizard.left-arrow a:before{width:0;height:0;border-top:34px inset rgba(0,0,0,0);border-bottom:34px inset rgba(0,0,0,0);border-right:34px solid #ddd;position:absolute;content:"";top:0;left:-34px;z-index:2}.wizard.left-arrow a:after{width:0;height:0;border-top:34px inset rgba(0,0,0,0);border-bottom:34px inset rgba(0,0,0,0);border-right:34px solid #fff;position:absolute;content:"";top:0;right:0;z-index:2}.wizard a:first-child:before,.wizard a:last-child:after{border:none}.wizard a:first-child{-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px}.wizard a:last-child{-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0}.wizard.left-arrow a:last-child:before,.wizard.small.left-arrow a:last-child:before{border-right-color:#027aca}.lux .wizard .badge{margin:0 5px 0 18px;position:relative;top:-1px;border-radius:20px;font-size:18px;background:#fff;color:#ddd}.lux .wizard .badge .number{display:inline-block}.wizard a:first-child .badge{margin-left:0}.wizard .current,.wizard a.progress-current{background:#027aca;color:#fff}.wizard .current .badge,.wizard a.progress-current .badge{color:#027aca}.wizard a.current:after,.wizard a.progress-current:after{border-left-color:#027aca !important}.wizard.left-arrow a.current:before,.wizard.left-arrow a.progress-current:before,.wizard.small.left-arrow a.current:before,.wizard.small.left-arrow a.progress-current:before{border-right-color:#027aca}.wizard.small{margin-bottom:15px}.wizard.small a{padding:5px 12px 5px}.wizard.small:not(.left-arrow) a:before{border-top:15px inset rgba(0,0,0,0);border-bottom:15px inset rgba(0,0,0,0);border-left:15px solid #fff}.wizard.small:not(.left-arrow) a:after{border-top:15px inset rgba(0,0,0,0);border-bottom:15px inset rgba(0,0,0,0);border-left:15px solid #7cc6fe;right:-15px}.wizard.small.left-arrow a:before{border-top:15px inset rgba(0,0,0,0);border-bottom:15px inset rgba(0,0,0,0);border-right:15px solid #7cc6fe;left:-15px;z-index:2}.wizard.small.left-arrow a:after{width:0;height:0;border-top:15px inset rgba(0,0,0,0);border-bottom:15px inset rgba(0,0,0,0);border-right:15px solid #fff}.wizard.small a:first-child:before,.wizard.small a:last-child:after{border:none}_:-ms-fullscreen,:root .wizard.small.left-arrow a:before{left:-14px}_:-ms-fullscreen,:root .wizard.small:not(.left-arrow) a:after{right:-14px}_:-ms-fullscreen,:root .wizard.left-arrow a:before{left:-29px}_:-ms-fullscreen,:root .wizard:not(.left-arrow) a:after{right:-29px}@media all and (min-width: 768px){.g-layout{display:grid;grid-gap:0 18px;grid-template-columns:1fr 1fr}}@media all and (min-width: 1280px){.g-layout{grid-template-columns:1fr 1fr 1fr}}@media all and (min-width: 768px){.g-layout__item--a{grid-column:1/2;grid-row:1/2}.g-layout__item--b{grid-column:2/3;grid-row:1/2}.g-layout__item--c{grid-column:1/2;grid-row:2/3}.g-layout__item--d{grid-column:2/2;grid-row:2/3}.g-layout__item--e{grid-column:1/3;grid-row:3/4}}@media all and (min-width: 1280px){.g-layout__item--e{grid-column:3/4;grid-row:1/3}}.g-layout canvas{max-width:100%;height:auto !important}svg{max-width:100%;height:auto}a:not(.btn):not(.nolink):not(.colorwhite){color:#027aca !important;cursor:pointer !important}hr{border-style:dashed;border-color:#ddd;border-bottom:0;border-left:0;border-right:0;margin:40px 0}label{font-weight:normal}.color-lux{color:#027aca}.color-grey{color:#ddd}.hidden{display:none}.relative{position:relative}.luxspinner{display:inline-block;width:20px;height:20px;border:3px solid rgba(255,255,255,.3);border-radius:50%;border-top-color:#027aca;animation:spin 1s ease-in-out infinite;-webkit-animation:spin 1s ease-in-out infinite}.luxspinner--center{top:50%;left:50%;position:absolute;width:50px;height:50px;border:6px solid rgba(255,255,255,.3);border-top-color:#027aca;margin:-25px 0 0 -25px}@keyframes spin{to{-webkit-transform:rotate(360deg)}}@-webkit-keyframes spin{to{-webkit-transform:rotate(360deg)}}.lux{--bs-primary-rgb: 165, 231, 255}.lux h3{font-weight:bold}.lux .row+.row:not(.lux-trigger){margin-top:.5rem}@media screen and (min-width: 992px){.lux .row.flex{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;flex-wrap:wrap}}@media screen and (min-width: 992px){.lux .row>.flex[class*=col-]{display:flex;flex-direction:column}}.lux .panel-body{overflow:hidden}.lux .panel.flex{height:100%}.lux .bg-primary{background-color:#7cc6fe;border:1px solid #027aca}.lux .badge{background-color:#5a5a5a;color:#fff;border-radius:10px;font-size:11px;padding:3px 7px}.lux .badge.badge-primary{background-color:#027aca}.lux .alert-lux{background-color:#027aca}.lux .alert-warning{background-color:#f2b602;color:#000}.lux .form-select.form-control-lg{font-size:.9375rem;padding:.5rem 1rem}.lux .input-group-addon{border:none;background-color:#eee}.lux .form-control{border:1px solid #ddd}.lux .collapse-arrow:after{content:"";width:0;height:0;border-left:5px solid rgba(0,0,0,0);border-right:5px solid rgba(0,0,0,0);border-bottom:none;border-top:5px solid #292929;display:inline-block}.lux .collapse-arrow.collapsed:after{border-top:none;border-bottom:5px solid #292929;margin-bottom:1px}.lux .pull-right{float:right !important}.lux .pull-left{float:left !important}.lux .btn-lg-extra{padding:30px 60px;font-size:25px;line-height:2;border-radius:5px}.lux .btn-primary{background-color:#027aca;border-color:#027aca;color:#fff}.lux .btn-primary:hover,.lux .btn-primary:active,.lux .btn-primary:focus,.lux .btn-primary:hover:active{background-color:#027aca;border-color:#027aca}.lux .btn-secondary{background-color:#eee;border-color:#bbb}.lux .btn-primary-extra{appearance:none;-moz-appearance:none;-webkit-appearance:none;left:50%;top:50%;margin-top:-100px;margin-left:-200px;position:fixed;line-height:1.6}.lux .btn-primary-extra>span{display:block;font-size:16px}.lux .btn-add-lg{display:block;width:100%;padding:5px;font-weight:bold;font-size:19px}.lux .pagination{margin:0}.lux .pagination>.active>.page-link{background-color:#027aca;border-color:#ddd}.lux .lb-lg{font-size:20px;margin-bottom:5px}.lux .help-block{margin-top:15px;margin-left:15px;display:inline-block;color:#5a5a5a}.lux .help-block__code{list-style-type:none;padding:0;margin:10px 0 0 0;columns:2}.lux .help-block__code>li{margin:5px 0}.lux .help-block__code>li>span{font-style:italic;background:#ddd;display:inline-block;padding:2px 10px;margin-right:10px;font-weight:bold}.lux .description-block{display:block;margin-top:.5rem;margin-bottom:1rem;color:#5a5a5a}.lux .table{border:1px solid #ccc}.lux .table .soft{color:#737373}.lux .table.min-height-50 td{height:50px}.lux .table-hover>tbody>tr:hover,.lux .table-hover>tbody>tr.lux-action-detail{background-color:#027aca}.lux .table-hover>tbody>tr:hover>td,.lux .table-hover>tbody>tr.lux-action-detail>td{color:#fff}.lux .table-hover>tbody>tr:hover>td .soft,.lux .table-hover>tbody>tr.lux-action-detail>td .soft{color:#ccc}.lux .table-pointer>tbody>tr{cursor:pointer}.lux .close{position:absolute;right:15px;top:15px;width:25px;height:25px;opacity:.3;font-size:0;z-index:2;border:none;background:none}.lux .close:hover{opacity:1}.lux .close:before,.lux .close:after{position:absolute;top:0;content:" ";height:25px;width:2px;background-color:#333}.lux .close:before{transform:rotate(45deg)}.lux .close:after{transform:rotate(-45deg)}.lux .list-group-item>.badge{float:right;font-size:11px}.lux .table>:not(caption)>*>*{background:rgba(0,0,0,0)}.lux-textarea{width:100%;padding:10px;border:1px solid #ccc}.lux-textarea__default{color:#ccc}.lux-workflow-new{background-color:rgba(0,0,0,.8);position:fixed;top:0;right:0;bottom:0;left:0}.lux-workflow-sidbox{opacity:.5;background:#ddd;margin:34px 0 0 0;padding:20px}.lux_triggerarea,.lux_actionarea{position:relative}.lux_triggerarea .lux-trigger,.lux_triggerarea .lux-action,.lux_actionarea .lux-trigger,.lux_actionarea .lux-action{margin:80px 0 20px 0;padding:20px;border-style:dashed;border-color:#ddd;position:relative}.lux_triggerarea .lux-trigger:before,.lux_triggerarea .lux-action:before,.lux_actionarea .lux-trigger:before,.lux_actionarea .lux-action:before{content:"AND";display:block;width:10px;height:50px;border-left:3px solid #ddd;position:absolute;left:50%;margin-top:-87px;padding:13px 0 0 18px;font-size:18px;color:#ddd}.lux_triggerarea .lux-trigger:first-child,.lux_triggerarea .lux-action:first-child,.lux_actionarea .lux-trigger:first-child,.lux_actionarea .lux-action:first-child{margin-top:20px}.lux_triggerarea .lux-trigger:first-child:before,.lux_triggerarea .lux-action:first-child:before,.lux_actionarea .lux-trigger:first-child:before,.lux_actionarea .lux-action:first-child:before{display:none}.lux_triggerarea .lux-trigger-conjunctionOR:before,.lux_actionarea .lux-trigger-conjunctionOR:before{content:"OR"}.lux_triggerarea .lux-trigger-not:after,.lux_actionarea .lux-trigger-not:after{content:"(NOT)";width:10px;height:50px;position:absolute;font-size:26px;color:#ddd;right:115px;top:7px;font-weight:bold}.lux-messages{padding:15px 0;margin:1rem 0 2rem 0;list-style-type:none}.lux-messages>li{margin:5px 30px;font-size:16px}.lux .img-circle{object-fit:cover;border-radius:50%;width:100%;height:auto;aspect-ratio:1/1}.lux-group{display:flex;flex-wrap:wrap;list-style:none;margin:0;padding:20px 0;height:100%;min-height:320px;overflow:hidden}.lux-group>li{flex:0 0 50%;padding:0 5px} \ No newline at end of file +.timeline{position:relative;background:#fff}.timeline:before{content:"";display:block;background-color:#ddd;position:absolute}.timeline--vertical{margin:0 0 0 calc(1.5rem + 2rem + 1rem)}.timeline--vertical:before{width:3px;height:100%;top:0;left:calc(-1.5rem / 2 - 3px / 2 - 2rem)}.timeline--vertical .timeline__item:before{background-color:#ddd}.timeline--vertical .timeline__item:first-child:before{background-color:#027aca}.timeline--vertical .timeline__item:first-child:after{width:3px;height:50%;top:0;left:calc(-1.5rem / 2 - 3px / 2 - 2rem)}.timeline--vertical .timeline__item:last-child:after{width:3px;height:50%;bottom:0;left:calc(-1.5rem / 2 - 3px / 2 - 2rem)}.timeline--horizontal{display:flex;justify-content:space-between}.timeline--horizontal:before{width:100%;height:3px;top:34px}.timeline--horizontal .timeline__item{width:100px;text-align:center}.timeline--horizontal .timeline__item:before{left:calc(50% - 1.5rem / 2);top:28px}.timeline--horizontal .timeline__item:first-child:before{background-color:#ddd}.timeline--horizontal .timeline__item:first-child:after{width:50%;height:3px;left:0;top:34px}.timeline--horizontal .timeline__item:last-child:before{background-color:#ddd}.timeline--horizontal .timeline__item:last-child:after{width:50%;height:3px;top:34px;right:0}.timeline__thin{width:85%;margin:10px auto 5px auto}.timeline__item{margin:0 0 1rem 0;max-width:300px;padding:.5rem;position:relative}.timeline__item:before{content:"";display:block;width:1.5rem;height:1.5rem;background-color:#027aca;border-radius:1.5rem;position:absolute;z-index:1;top:calc(50% - 1.5rem / 2);left:calc(-1.5rem - 2rem)}.timeline__item:first-child:after{content:"";display:block;background-color:#fff;position:absolute}.timeline__item:last-child:after{content:"";display:block;background-color:#fff;position:absolute}.nomargin{padding:0 !important;margin:0 !important}.wizard{background-color:#fff;padding:.2em 0em .2em .2em}.wizard a{padding:22px 12px 19px;position:relative;display:inline-block;text-decoration:none;min-width:33%;margin-left:3px;text-align:center;font-size:18px;color:#fff;font-weight:bold;background:#ddd;text-transform:uppercase;cursor:pointer;margin-bottom:20px}.wizard a:hover{text-decoration:none}.wizard a:first-child{margin-left:0}.wizard:not(.left-arrow) a:before{width:0;height:0;border-top:34px inset rgba(0,0,0,0);border-bottom:34px inset rgba(0,0,0,0);border-left:34px solid #fff;position:absolute;content:"";top:0;left:0}.wizard:not(.left-arrow) a:after{width:0;height:0;border-top:34px inset rgba(0,0,0,0);border-bottom:34px inset rgba(0,0,0,0);border-left:34px solid #ddd;position:absolute;content:"";top:0;right:-34px;z-index:2}.wizard.left-arrow a:before{width:0;height:0;border-top:34px inset rgba(0,0,0,0);border-bottom:34px inset rgba(0,0,0,0);border-right:34px solid #ddd;position:absolute;content:"";top:0;left:-34px;z-index:2}.wizard.left-arrow a:after{width:0;height:0;border-top:34px inset rgba(0,0,0,0);border-bottom:34px inset rgba(0,0,0,0);border-right:34px solid #fff;position:absolute;content:"";top:0;right:0;z-index:2}.wizard a:first-child:before,.wizard a:last-child:after{border:none}.wizard a:first-child{-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px}.wizard a:last-child{-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0}.wizard.left-arrow a:last-child:before,.wizard.small.left-arrow a:last-child:before{border-right-color:#027aca}.lux .wizard .badge{margin:0 5px 0 18px;position:relative;top:-1px;border-radius:20px;font-size:18px;background:#fff;color:#ddd}.lux .wizard .badge .number{display:inline-block}.wizard a:first-child .badge{margin-left:0}.wizard .current,.wizard a.progress-current{background:#027aca;color:#fff}.wizard .current .badge,.wizard a.progress-current .badge{color:#027aca}.wizard a.current:after,.wizard a.progress-current:after{border-left-color:#027aca !important}.wizard.left-arrow a.current:before,.wizard.left-arrow a.progress-current:before,.wizard.small.left-arrow a.current:before,.wizard.small.left-arrow a.progress-current:before{border-right-color:#027aca}.wizard.small{margin-bottom:15px}.wizard.small a{padding:5px 12px 5px}.wizard.small:not(.left-arrow) a:before{border-top:15px inset rgba(0,0,0,0);border-bottom:15px inset rgba(0,0,0,0);border-left:15px solid #fff}.wizard.small:not(.left-arrow) a:after{border-top:15px inset rgba(0,0,0,0);border-bottom:15px inset rgba(0,0,0,0);border-left:15px solid #7cc6fe;right:-15px}.wizard.small.left-arrow a:before{border-top:15px inset rgba(0,0,0,0);border-bottom:15px inset rgba(0,0,0,0);border-right:15px solid #7cc6fe;left:-15px;z-index:2}.wizard.small.left-arrow a:after{width:0;height:0;border-top:15px inset rgba(0,0,0,0);border-bottom:15px inset rgba(0,0,0,0);border-right:15px solid #fff}.wizard.small a:first-child:before,.wizard.small a:last-child:after{border:none}_:-ms-fullscreen,:root .wizard.small.left-arrow a:before{left:-14px}_:-ms-fullscreen,:root .wizard.small:not(.left-arrow) a:after{right:-14px}_:-ms-fullscreen,:root .wizard.left-arrow a:before{left:-29px}_:-ms-fullscreen,:root .wizard:not(.left-arrow) a:after{right:-29px}@media all and (min-width: 768px){.g-layout{display:grid;grid-gap:0 18px;grid-template-columns:1fr 1fr}}@media all and (min-width: 1280px){.g-layout{grid-template-columns:1fr 1fr 1fr}}@media all and (min-width: 768px){.g-layout__item--a{grid-column:1/2;grid-row:1/2}.g-layout__item--b{grid-column:2/3;grid-row:1/2}.g-layout__item--c{grid-column:1/2;grid-row:2/3}.g-layout__item--d{grid-column:2/2;grid-row:2/3}.g-layout__item--e{grid-column:1/3;grid-row:3/4}}@media all and (min-width: 1280px){.g-layout__item--e{grid-column:3/4;grid-row:1/3}}.g-layout canvas{max-width:100%;height:auto !important}svg{max-width:100%;height:auto}a:not(.btn):not(.nolink):not(.colorwhite){color:#027aca !important;cursor:pointer !important}hr{border-style:dashed;border-color:#ddd;border-bottom:0;border-left:0;border-right:0;margin:40px 0}label{font-weight:normal}.color-lux{color:#027aca}.color-grey{color:#ddd}.hidden{display:none}.unitajax{position:relative;overflow:hidden;min-height:300px;background-color:#ddd;border:2px dashed #ccc;margin-bottom:1.125rem}.unitajax-spinner{display:inline-block;border-radius:50%;border:6px solid rgba(255,255,255,.3);border-top-color:#027aca;animation:spin 1s ease-in-out infinite;-webkit-animation:spin 1s ease-in-out infinite;top:50%;left:50%;position:absolute;width:50px;height:50px;margin:-25px 0 0 -25px}.luxspinner{display:inline-block;width:20px;height:20px;border:3px solid rgba(255,255,255,.3);border-radius:50%;border-top-color:#027aca;animation:spin 1s ease-in-out infinite;-webkit-animation:spin 1s ease-in-out infinite}@keyframes spin{to{-webkit-transform:rotate(360deg)}}@-webkit-keyframes spin{to{-webkit-transform:rotate(360deg)}}.lux{--bs-primary-rgb: 165, 231, 255}.lux h3{font-weight:bold}.lux .row+.row:not(.lux-trigger){margin-top:.5rem}@media screen and (min-width: 992px){.lux .row.flex{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;flex-wrap:wrap}}@media screen and (min-width: 992px){.lux .row>.flex[class*=col-]{display:flex;flex-direction:column}}.lux .panel-body{overflow:hidden}.lux .panel.flex{height:100%}.lux .bg-primary{background-color:#7cc6fe;border:1px solid #027aca}.lux .badge{background-color:#5a5a5a;color:#fff;border-radius:10px;font-size:11px;padding:3px 7px}.lux .badge.badge-primary{background-color:#027aca}.lux .alert-lux{background-color:#027aca}.lux .alert-warning{background-color:#f2b602;color:#000}.lux .form-select.form-control-lg{font-size:.9375rem;padding:.5rem 1rem}.lux .input-group-addon{border:none;background-color:#eee}.lux .form-control{border:1px solid #ddd}.lux .collapse-arrow:after{content:"";width:0;height:0;border-left:5px solid rgba(0,0,0,0);border-right:5px solid rgba(0,0,0,0);border-bottom:none;border-top:5px solid #292929;display:inline-block}.lux .collapse-arrow.collapsed:after{border-top:none;border-bottom:5px solid #292929;margin-bottom:1px}.lux .pull-right{float:right !important}.lux .pull-left{float:left !important}.lux .btn-lg-extra{padding:30px 60px;font-size:25px;line-height:2;border-radius:5px}.lux .btn-primary{background-color:#027aca;border-color:#027aca;color:#fff}.lux .btn-primary:hover,.lux .btn-primary:active,.lux .btn-primary:focus,.lux .btn-primary:hover:active{background-color:#027aca;border-color:#027aca}.lux .btn-secondary{background-color:#eee;border-color:#bbb}.lux .btn-primary-extra{appearance:none;-moz-appearance:none;-webkit-appearance:none;left:50%;top:50%;margin-top:-100px;margin-left:-200px;position:fixed;line-height:1.6}.lux .btn-primary-extra>span{display:block;font-size:16px}.lux .btn-add-lg{display:block;width:100%;padding:5px;font-weight:bold;font-size:19px}.lux .pagination{margin:0}.lux .pagination>.active>.page-link{background-color:#027aca;border-color:#ddd}.lux .lb-lg{font-size:20px;margin-bottom:5px}.lux .help-block{margin-top:15px;margin-left:15px;display:inline-block;color:#5a5a5a}.lux .help-block__code{list-style-type:none;padding:0;margin:10px 0 0 0;columns:2}.lux .help-block__code>li{margin:5px 0}.lux .help-block__code>li>span{font-style:italic;background:#ddd;display:inline-block;padding:2px 10px;margin-right:10px;font-weight:bold}.lux .description-block{display:block;margin-top:.5rem;margin-bottom:1rem;color:#5a5a5a}.lux .table{border:1px solid #ccc}.lux .table .soft{color:#737373}.lux .table.min-height-50 td{height:50px}.lux .table-hover>tbody>tr:hover,.lux .table-hover>tbody>tr.lux-action-detail{background-color:#027aca}.lux .table-hover>tbody>tr:hover>td,.lux .table-hover>tbody>tr.lux-action-detail>td{color:#fff}.lux .table-hover>tbody>tr:hover>td .soft,.lux .table-hover>tbody>tr.lux-action-detail>td .soft{color:#ccc}.lux .table-pointer>tbody>tr{cursor:pointer}.lux .close{position:absolute;right:15px;top:15px;width:25px;height:25px;opacity:.3;font-size:0;z-index:2;border:none;background:none}.lux .close:hover{opacity:1}.lux .close:before,.lux .close:after{position:absolute;top:0;content:" ";height:25px;width:2px;background-color:#333}.lux .close:before{transform:rotate(45deg)}.lux .close:after{transform:rotate(-45deg)}.lux .list-group-item>.badge{float:right;font-size:11px}.lux .table>:not(caption)>*>*{background:rgba(0,0,0,0)}.lux-textarea{width:100%;padding:10px;border:1px solid #ccc}.lux-textarea__default{color:#ccc}.lux-workflow-new{background-color:rgba(0,0,0,.8);position:fixed;top:0;right:0;bottom:0;left:0}.lux-workflow-sidbox{opacity:.5;background:#ddd;margin:34px 0 0 0;padding:20px}.lux_triggerarea,.lux_actionarea{position:relative}.lux_triggerarea .lux-trigger,.lux_triggerarea .lux-action,.lux_actionarea .lux-trigger,.lux_actionarea .lux-action{margin:80px 0 20px 0;padding:20px;border-style:dashed;border-color:#ddd;position:relative}.lux_triggerarea .lux-trigger:before,.lux_triggerarea .lux-action:before,.lux_actionarea .lux-trigger:before,.lux_actionarea .lux-action:before{content:"AND";display:block;width:10px;height:50px;border-left:3px solid #ddd;position:absolute;left:50%;margin-top:-87px;padding:13px 0 0 18px;font-size:18px;color:#ddd}.lux_triggerarea .lux-trigger:first-child,.lux_triggerarea .lux-action:first-child,.lux_actionarea .lux-trigger:first-child,.lux_actionarea .lux-action:first-child{margin-top:20px}.lux_triggerarea .lux-trigger:first-child:before,.lux_triggerarea .lux-action:first-child:before,.lux_actionarea .lux-trigger:first-child:before,.lux_actionarea .lux-action:first-child:before{display:none}.lux_triggerarea .lux-trigger-conjunctionOR:before,.lux_actionarea .lux-trigger-conjunctionOR:before{content:"OR"}.lux_triggerarea .lux-trigger-not:after,.lux_actionarea .lux-trigger-not:after{content:"(NOT)";width:10px;height:50px;position:absolute;font-size:26px;color:#ddd;right:115px;top:7px;font-weight:bold}.lux-messages{padding:15px 0;margin:1rem 0 2rem 0;list-style-type:none}.lux-messages>li{margin:5px 30px;font-size:16px}.lux .img-circle{object-fit:cover;border-radius:50%;width:100%;height:auto;aspect-ratio:1/1}.lux-group{display:flex;flex-wrap:wrap;list-style:none;margin:0;padding:20px 0;height:100%;min-height:320px;overflow:hidden}.lux-group>li{flex:0 0 50%;padding:0 5px} \ No newline at end of file diff --git a/Resources/Public/JavaScript/Lux/Module.min.js b/Resources/Public/JavaScript/Lux/Module.min.js index 3d1e1eed..b7decd9a 100644 --- a/Resources/Public/JavaScript/Lux/Module.min.js +++ b/Resources/Public/JavaScript/Lux/Module.min.js @@ -1 +1 @@ -define(["jquery"],function(t){"use strict";function e(t){var l=this,e=(this.initialize=function(){e("leadlistdetail","visitor"),e("companydetail","company"),e("analysiscontentdetailpage","page"),e("analysisnewsdetailpage","news"),e("analysisutmdetailpage","visitor"),e("analysissearchdetailpage","searchterm"),e("analysiscontentdetaildownload","download"),e("analysislinklistenerdetail","linkListener"),e("workflowdetail","workflow","luxenterprise"),e("abtestingdetail","abTesting","luxenterprise"),e("workflowurlshortenerdetail","urlShortener","luxenterprise"),n(),a(),i(),o(),r(),c(),u(),s(),d(),m()},function(e,n,a){a=a||"lux";for(var i=document.querySelectorAll("[data-lux-action-"+e+"]"),t=0;tt.text()).then(function(t){e.innerHTML=t,window.LuxDiagramObject.initialize(e)}).catch(function(t){console.log(t)}).finally(()=>{e.classList.remove("luxspinner","luxspinner--center")})})};var g=function(t,e){for(var n=0;nt.text()).then(function(t){e.innerHTML=t,window.LuxDiagramObject.initialize(e)}).catch(function(t){console.log(t)}).finally(()=>{e.classList.remove("unitajax")})})};var g=function(t,e){for(var n=0;n Date: Wed, 13 Sep 2023 14:21:03 +0200 Subject: [PATCH 3/7] [FEATURE] Add ajax requests for lead dashboard diagrams --- .../Units/Lead/Dashboard/Countrylist.php | 27 +++++++++++ .../Backend/Units/Lead/Dashboard/Hottest.php | 27 +++++++++++ .../Units/Lead/Dashboard/Identified.php | 28 +++++++++++ .../Lead/Dashboard/Identifiedpermethod.php | 29 +++++++++++ .../Lead/Dashboard/Identifiedpermonth.php | 27 +++++++++++ Classes/Backend/Units/Lead/Dashboard/Map.php | 27 +++++++++++ .../Units/Lead/Dashboard/Recurring.php | 28 +++++++++++ .../Backend/Units/Lead/Dashboard/Referrer.php | 26 ++++++++++ Classes/Controller/LeadController.php | 35 ++------------ .../Box/Leads/IdentifiedPerMonth.html | 2 +- .../Units/Lead/Dashboard/Countrylist.html | 3 ++ .../Backend/Units/Lead/Dashboard/Hottest.html | 3 ++ .../Units/Lead/Dashboard/Identified.html | 3 ++ .../Lead/Dashboard/Identifiedpermethod.html | 3 ++ .../Lead/Dashboard/Identifiedpermonth.html | 3 ++ .../Backend/Units/Lead/Dashboard/Map.html | 3 ++ .../Units/Lead/Dashboard/Recurring.html | 3 ++ .../Units/Lead/Dashboard/Referrer.html | 3 ++ .../Private/Templates/Lead/Dashboard.html | 48 +++++++++---------- 19 files changed, 272 insertions(+), 56 deletions(-) create mode 100644 Classes/Backend/Units/Lead/Dashboard/Countrylist.php create mode 100644 Classes/Backend/Units/Lead/Dashboard/Hottest.php create mode 100644 Classes/Backend/Units/Lead/Dashboard/Identified.php create mode 100644 Classes/Backend/Units/Lead/Dashboard/Identifiedpermethod.php create mode 100644 Classes/Backend/Units/Lead/Dashboard/Identifiedpermonth.php create mode 100644 Classes/Backend/Units/Lead/Dashboard/Map.php create mode 100644 Classes/Backend/Units/Lead/Dashboard/Recurring.php create mode 100644 Classes/Backend/Units/Lead/Dashboard/Referrer.php create mode 100644 Resources/Private/Templates/Backend/Units/Lead/Dashboard/Countrylist.html create mode 100644 Resources/Private/Templates/Backend/Units/Lead/Dashboard/Hottest.html create mode 100644 Resources/Private/Templates/Backend/Units/Lead/Dashboard/Identified.html create mode 100644 Resources/Private/Templates/Backend/Units/Lead/Dashboard/Identifiedpermethod.html create mode 100644 Resources/Private/Templates/Backend/Units/Lead/Dashboard/Identifiedpermonth.html create mode 100644 Resources/Private/Templates/Backend/Units/Lead/Dashboard/Map.html create mode 100644 Resources/Private/Templates/Backend/Units/Lead/Dashboard/Recurring.html create mode 100644 Resources/Private/Templates/Backend/Units/Lead/Dashboard/Referrer.html diff --git a/Classes/Backend/Units/Lead/Dashboard/Countrylist.php b/Classes/Backend/Units/Lead/Dashboard/Countrylist.php new file mode 100644 index 00000000..31813312 --- /dev/null +++ b/Classes/Backend/Units/Lead/Dashboard/Countrylist.php @@ -0,0 +1,27 @@ + $ipinformationRepository->findAllCountryCodesGrouped($this->filter), + ]; + } +} diff --git a/Classes/Backend/Units/Lead/Dashboard/Hottest.php b/Classes/Backend/Units/Lead/Dashboard/Hottest.php new file mode 100644 index 00000000..89d5aac9 --- /dev/null +++ b/Classes/Backend/Units/Lead/Dashboard/Hottest.php @@ -0,0 +1,27 @@ + $visitorRepository->findByHottestScorings($this->filter), + ]; + } +} diff --git a/Classes/Backend/Units/Lead/Dashboard/Identified.php b/Classes/Backend/Units/Lead/Dashboard/Identified.php new file mode 100644 index 00000000..78b4da17 --- /dev/null +++ b/Classes/Backend/Units/Lead/Dashboard/Identified.php @@ -0,0 +1,28 @@ + $visitorRepository->findIdentified($this->filter)->count(), + 'numberOfUnknownVisitors' => $visitorRepository->findUnknown($this->filter)->count(), + ]; + } +} diff --git a/Classes/Backend/Units/Lead/Dashboard/Identifiedpermethod.php b/Classes/Backend/Units/Lead/Dashboard/Identifiedpermethod.php new file mode 100644 index 00000000..25b7cce8 --- /dev/null +++ b/Classes/Backend/Units/Lead/Dashboard/Identifiedpermethod.php @@ -0,0 +1,29 @@ + GeneralUtility::makeInstance( + IdentificationMethodsDataProvider::class, + $this->filter + ), + ]; + } +} diff --git a/Classes/Backend/Units/Lead/Dashboard/Identifiedpermonth.php b/Classes/Backend/Units/Lead/Dashboard/Identifiedpermonth.php new file mode 100644 index 00000000..7f4c568a --- /dev/null +++ b/Classes/Backend/Units/Lead/Dashboard/Identifiedpermonth.php @@ -0,0 +1,27 @@ + $logRepository->findIdentifiedLogsFromMonths(), + ]; + } +} diff --git a/Classes/Backend/Units/Lead/Dashboard/Map.php b/Classes/Backend/Units/Lead/Dashboard/Map.php new file mode 100644 index 00000000..a04b6bc7 --- /dev/null +++ b/Classes/Backend/Units/Lead/Dashboard/Map.php @@ -0,0 +1,27 @@ + $ipinformationRepository->findAllCountryCodesGrouped($this->filter), + ]; + } +} diff --git a/Classes/Backend/Units/Lead/Dashboard/Recurring.php b/Classes/Backend/Units/Lead/Dashboard/Recurring.php new file mode 100644 index 00000000..9368e11e --- /dev/null +++ b/Classes/Backend/Units/Lead/Dashboard/Recurring.php @@ -0,0 +1,28 @@ + $visitorRepository->findByRecurringSiteVisits($this->filter)->count(), + 'numberOfUniqueSiteVisitors' => $visitorRepository->findByUniqueSiteVisits($this->filter)->count(), + ]; + } +} diff --git a/Classes/Backend/Units/Lead/Dashboard/Referrer.php b/Classes/Backend/Units/Lead/Dashboard/Referrer.php new file mode 100644 index 00000000..9c9c77f9 --- /dev/null +++ b/Classes/Backend/Units/Lead/Dashboard/Referrer.php @@ -0,0 +1,26 @@ + GeneralUtility::makeInstance(ReferrerAmountDataProvider::class, $this->filter), + ]; + } +} diff --git a/Classes/Controller/LeadController.php b/Classes/Controller/LeadController.php index bf9e8bc7..8fb467ef 100644 --- a/Classes/Controller/LeadController.php +++ b/Classes/Controller/LeadController.php @@ -4,16 +4,15 @@ namespace In2code\Lux\Controller; use DateTime; +use Doctrine\DBAL\DBALException; use Doctrine\DBAL\Driver\Exception as ExceptionDbalDriver; use Doctrine\DBAL\Exception as ExceptionDbal; use Exception; use In2code\Lux\Domain\DataProvider\CompanyAmountPerMonthDataProvider; use In2code\Lux\Domain\DataProvider\CompanyCategoryScoringsDataProvider; use In2code\Lux\Domain\DataProvider\CompanyScoringWeeksDataProvider; -use In2code\Lux\Domain\DataProvider\IdentificationMethodsDataProvider; use In2code\Lux\Domain\DataProvider\LeadsPerTimeDataProvider; use In2code\Lux\Domain\DataProvider\PagevisistsDataProvider; -use In2code\Lux\Domain\DataProvider\ReferrerAmountDataProvider; use In2code\Lux\Domain\DataProvider\RevenueClassDataProvider; use In2code\Lux\Domain\DataProvider\VisitorCategoryScoringsDataProvider; use In2code\Lux\Domain\DataProvider\VisitorScoringWeeksDataProvider; @@ -24,15 +23,11 @@ use In2code\Lux\Domain\Repository\CompanyRepository; use In2code\Lux\Domain\Repository\VisitorRepository; use In2code\Lux\Domain\Service\CompanyConfigurationService; -use In2code\Lux\Exception\ConfigurationException; -use In2code\Lux\Exception\UnexpectedValueException; use In2code\Lux\Utility\LocalizationUtility; use In2code\Lux\Utility\ObjectUtility; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Throwable; -use TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationExtensionNotConfiguredException; -use TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationPathDoesNotExistException; use TYPO3\CMS\Core\Http\JsonResponse; use TYPO3\CMS\Core\Messaging\AbstractMessage; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -58,42 +53,17 @@ public function initializeDashboardAction(): void /** * @param FilterDto $filter * @return ResponseInterface - * @throws ConfigurationException - * @throws ExceptionDbal - * @throws ExceptionDbalDriver - * @throws ExtensionConfigurationExtensionNotConfiguredException - * @throws ExtensionConfigurationPathDoesNotExistException * @throws InvalidConfigurationTypeException * @throws InvalidQueryException - * @throws UnexpectedValueException */ public function dashboardAction(FilterDto $filter): ResponseInterface { - $this->cacheLayer->initialize(__CLASS__, __FUNCTION__); $this->view->assignMultiple([ - 'cacheLayer' => $this->cacheLayer, 'filter' => $filter, 'interestingLogs' => $this->logRepository->findInterestingLogs($filter, 10), 'whoisonline' => $this->visitorRepository->findOnline(8), ]); - if ($this->cacheLayer->isCacheAvailable('Box/Leads/Recurring/' . $filter->getHash()) === false) { - $this->view->assignMultiple([ - 'numberOfUniqueSiteVisitors' => $this->visitorRepository->findByUniqueSiteVisits($filter)->count(), - 'numberOfRecurringSiteVisitors' => - $this->visitorRepository->findByRecurringSiteVisits($filter)->count(), - 'identifiedPerMonth' => $this->logRepository->findIdentifiedLogsFromMonths(6), - 'numberOfIdentifiedVisitors' => $this->visitorRepository->findIdentified($filter)->count(), - 'numberOfUnknownVisitors' => $this->visitorRepository->findUnknown($filter)->count(), - 'identificationMethods' => - GeneralUtility::makeInstance(IdentificationMethodsDataProvider::class, $filter), - 'referrerAmountData' => GeneralUtility::makeInstance(ReferrerAmountDataProvider::class, $filter), - 'countries' => $this->ipinformationRepository->findAllCountryCodesGrouped($filter), - 'hottestVisitors' => $this->visitorRepository->findByHottestScorings($filter), - 'renderingTime' => $this->renderingTimeService->getTime(), - ]); - } - $this->addDocumentHeaderForCurrentController(); return $this->defaultRendering(); } @@ -167,6 +137,7 @@ public function downloadCsvAction(FilterDto $filter): ResponseInterface * * @param Visitor $visitor * @return ResponseInterface + * @throws DBALException */ public function removeAction(Visitor $visitor): ResponseInterface { @@ -180,6 +151,7 @@ public function removeAction(Visitor $visitor): ResponseInterface * @return ResponseInterface * @throws IllegalObjectTypeException * @throws UnknownObjectException + * @throws DBALException */ public function deactivateAction(Visitor $visitor): ResponseInterface { @@ -285,6 +257,7 @@ public function companyAction(Company $company): ResponseInterface * @param FilterDto $filter * @return ResponseInterface * @throws ExceptionDbal + * @throws ExceptionDbalDriver */ public function downloadCsvCompaniesAction(FilterDto $filter): ResponseInterface { diff --git a/Resources/Private/Partials/Box/Leads/IdentifiedPerMonth.html b/Resources/Private/Partials/Box/Leads/IdentifiedPerMonth.html index 3c34231b..4085a79a 100644 --- a/Resources/Private/Partials/Box/Leads/IdentifiedPerMonth.html +++ b/Resources/Private/Partials/Box/Leads/IdentifiedPerMonth.html @@ -5,7 +5,7 @@

- + + + diff --git a/Resources/Private/Templates/Backend/Units/Lead/Dashboard/Hottest.html b/Resources/Private/Templates/Backend/Units/Lead/Dashboard/Hottest.html new file mode 100644 index 00000000..b4737a07 --- /dev/null +++ b/Resources/Private/Templates/Backend/Units/Lead/Dashboard/Hottest.html @@ -0,0 +1,3 @@ + + + diff --git a/Resources/Private/Templates/Backend/Units/Lead/Dashboard/Identified.html b/Resources/Private/Templates/Backend/Units/Lead/Dashboard/Identified.html new file mode 100644 index 00000000..46d14405 --- /dev/null +++ b/Resources/Private/Templates/Backend/Units/Lead/Dashboard/Identified.html @@ -0,0 +1,3 @@ + + + diff --git a/Resources/Private/Templates/Backend/Units/Lead/Dashboard/Identifiedpermethod.html b/Resources/Private/Templates/Backend/Units/Lead/Dashboard/Identifiedpermethod.html new file mode 100644 index 00000000..ad3c6f4b --- /dev/null +++ b/Resources/Private/Templates/Backend/Units/Lead/Dashboard/Identifiedpermethod.html @@ -0,0 +1,3 @@ + + + diff --git a/Resources/Private/Templates/Backend/Units/Lead/Dashboard/Identifiedpermonth.html b/Resources/Private/Templates/Backend/Units/Lead/Dashboard/Identifiedpermonth.html new file mode 100644 index 00000000..734a59e5 --- /dev/null +++ b/Resources/Private/Templates/Backend/Units/Lead/Dashboard/Identifiedpermonth.html @@ -0,0 +1,3 @@ + + + diff --git a/Resources/Private/Templates/Backend/Units/Lead/Dashboard/Map.html b/Resources/Private/Templates/Backend/Units/Lead/Dashboard/Map.html new file mode 100644 index 00000000..f7557660 --- /dev/null +++ b/Resources/Private/Templates/Backend/Units/Lead/Dashboard/Map.html @@ -0,0 +1,3 @@ + + + diff --git a/Resources/Private/Templates/Backend/Units/Lead/Dashboard/Recurring.html b/Resources/Private/Templates/Backend/Units/Lead/Dashboard/Recurring.html new file mode 100644 index 00000000..9846b052 --- /dev/null +++ b/Resources/Private/Templates/Backend/Units/Lead/Dashboard/Recurring.html @@ -0,0 +1,3 @@ + + + diff --git a/Resources/Private/Templates/Backend/Units/Lead/Dashboard/Referrer.html b/Resources/Private/Templates/Backend/Units/Lead/Dashboard/Referrer.html new file mode 100644 index 00000000..45a048f4 --- /dev/null +++ b/Resources/Private/Templates/Backend/Units/Lead/Dashboard/Referrer.html @@ -0,0 +1,3 @@ + + + diff --git a/Resources/Private/Templates/Lead/Dashboard.html b/Resources/Private/Templates/Lead/Dashboard.html index 078d8294..e5977fc9 100644 --- a/Resources/Private/Templates/Lead/Dashboard.html +++ b/Resources/Private/Templates/Lead/Dashboard.html @@ -7,26 +7,26 @@
- - - +
+
+
- - - +
+
+
- - - +
+
+
- - - +
+
+
@@ -37,14 +37,14 @@
- - - +
+
+
- - - +
+
+
@@ -53,14 +53,14 @@
- - - +
+
+
- - - +
+
+
From 49595b5ca01b1a01c449645648be343687080b7d Mon Sep 17 00:00:00 2001 From: Alexander Kellner Date: Thu, 14 Sep 2023 21:25:19 +0200 Subject: [PATCH 4/7] [BUGFIX] Remove unneeded div container when using data-lux-unitajax for AJAX requests --- Resources/Private/Build/JavaScript/Backend/Module.js | 5 +++-- Resources/Public/JavaScript/Lux/Module.min.js | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Resources/Private/Build/JavaScript/Backend/Module.js b/Resources/Private/Build/JavaScript/Backend/Module.js index ab80f13b..6a7f834f 100644 --- a/Resources/Private/Build/JavaScript/Backend/Module.js +++ b/Resources/Private/Build/JavaScript/Backend/Module.js @@ -297,8 +297,9 @@ define(['jquery'], function($) { fetch(TYPO3.settings.ajaxUrls['/lux/unitajax'] + '&' + data) .then((resp) => resp.text()) .then(function(html) { - element.innerHTML = html; - window.LuxDiagramObject.initialize(element); + const parent = element.parentNode; + parent.innerHTML = html; + window.LuxDiagramObject.initialize(parent); }) .catch(function(error) { console.log(error); diff --git a/Resources/Public/JavaScript/Lux/Module.min.js b/Resources/Public/JavaScript/Lux/Module.min.js index b7decd9a..4466831d 100644 --- a/Resources/Public/JavaScript/Lux/Module.min.js +++ b/Resources/Public/JavaScript/Lux/Module.min.js @@ -1 +1 @@ -define(["jquery"],function(t){"use strict";function e(t){var l=this,e=(this.initialize=function(){e("leadlistdetail","visitor"),e("companydetail","company"),e("analysiscontentdetailpage","page"),e("analysisnewsdetailpage","news"),e("analysisutmdetailpage","visitor"),e("analysissearchdetailpage","searchterm"),e("analysiscontentdetaildownload","download"),e("analysislinklistenerdetail","linkListener"),e("workflowdetail","workflow","luxenterprise"),e("abtestingdetail","abTesting","luxenterprise"),e("workflowurlshortenerdetail","urlShortener","luxenterprise"),n(),a(),i(),o(),r(),c(),u(),s(),d(),m()},function(e,n,a){a=a||"lux";for(var i=document.querySelectorAll("[data-lux-action-"+e+"]"),t=0;tt.text()).then(function(t){e.innerHTML=t,window.LuxDiagramObject.initialize(e)}).catch(function(t){console.log(t)}).finally(()=>{e.classList.remove("unitajax")})})};var g=function(t,e){for(var n=0;nt.text()).then(function(t){var e=n.parentNode;e.innerHTML=t,window.LuxDiagramObject.initialize(e)}).catch(function(t){console.log(t)}).finally(()=>{n.classList.remove("unitajax")})})};var g=function(t,e){for(var n=0;n Date: Thu, 14 Sep 2023 23:02:56 +0200 Subject: [PATCH 5/7] [TASK] Pageoverview now via AJAX --- Classes/Backend/Units/AbstractUnit.php | 20 ++++++ .../Units/Pageoverview/Analysis/Body.php | 69 ++++++++++++++++++ .../Units/Pageoverview/Analysis/Title.php | 43 +++++++++++ .../Backend/Units/Pageoverview/Leads/Body.php | 29 ++++++++ .../Units/Pageoverview/Leads/Title.php | 31 ++++++++ Classes/Backend/Units/UnitFinder.php | 9 ++- Classes/Controller/GeneralController.php | 3 +- Classes/Hooks/PageOverview.php | 72 ++----------------- .../Build/JavaScript/Backend/Module.js | 14 +++- .../Build/JavaScript/Backend/PageOverview.js | 12 ++-- Resources/Private/Sass/Modules.scss | 7 +- Resources/Private/Sass/PageOverview.scss | 31 +++++++- .../Templates/Backend/PageOverview.html | 13 ++-- .../Units/Pageoverview/Analysis/Body.html | 3 + .../Units/Pageoverview/Analysis/Title.html | 3 + .../Units/Pageoverview/Leads/Body.html | 3 + .../Units/Pageoverview/Leads/Title.html | 3 + Resources/Public/Css/Modules.min.css | 2 +- Resources/Public/Css/PageOverview.min.css | 2 +- Resources/Public/JavaScript/Lux/Module.min.js | 2 +- .../Public/JavaScript/Lux/PageOverview.min.js | 2 +- 21 files changed, 278 insertions(+), 95 deletions(-) create mode 100644 Classes/Backend/Units/Pageoverview/Analysis/Body.php create mode 100644 Classes/Backend/Units/Pageoverview/Analysis/Title.php create mode 100644 Classes/Backend/Units/Pageoverview/Leads/Body.php create mode 100644 Classes/Backend/Units/Pageoverview/Leads/Title.php create mode 100644 Resources/Private/Templates/Backend/Units/Pageoverview/Analysis/Body.html create mode 100644 Resources/Private/Templates/Backend/Units/Pageoverview/Analysis/Title.html create mode 100644 Resources/Private/Templates/Backend/Units/Pageoverview/Leads/Body.html create mode 100644 Resources/Private/Templates/Backend/Units/Pageoverview/Leads/Title.html diff --git a/Classes/Backend/Units/AbstractUnit.php b/Classes/Backend/Units/AbstractUnit.php index 721f5a92..4ecd0916 100644 --- a/Classes/Backend/Units/AbstractUnit.php +++ b/Classes/Backend/Units/AbstractUnit.php @@ -14,6 +14,7 @@ abstract class AbstractUnit { + protected array $arguments = []; protected ?FilterDto $filter = null; protected string $templateRootPath = 'EXT:lux/Resources/Private/Templates/Backend/Units'; protected string $partialRootPath = 'EXT:lux/Resources/Private/Partials'; @@ -47,6 +48,11 @@ abstract class AbstractUnit */ protected string $filterFunction = ''; + public function __construct(array $arguments = []) + { + $this->arguments = $arguments; + } + public function get(): string { $this->initialize(); @@ -79,6 +85,7 @@ protected function getHtml(): string ] + $this->assignAdditionalVariables()); $this->assignCacheLayer($view); $this->assignFilter($view); + $this->assignArguments($view); return $view->render(); } @@ -101,6 +108,19 @@ protected function assignFilter(StandaloneView $view): void $view->assign('filter', $this->filter); } + protected function assignArguments(StandaloneView $view): void + { + $view->assign('arguments', $this->arguments); + } + + protected function getArgument(string $key): string + { + if (array_key_exists($key, $this->arguments)) { + return $this->arguments[$key]; + } + return ''; + } + protected function getTemplatePath(): string { $path = StringUtility::removeStringPrefix(static::class, $this->classPrefix); diff --git a/Classes/Backend/Units/Pageoverview/Analysis/Body.php b/Classes/Backend/Units/Pageoverview/Analysis/Body.php new file mode 100644 index 00000000..f6a4faab --- /dev/null +++ b/Classes/Backend/Units/Pageoverview/Analysis/Body.php @@ -0,0 +1,69 @@ +setSearchterm($this->getArgument('pageidentifier')); + + return [ + 'conversionAmount' => $logRepository->findAmountOfIdentifiedLogsByPageIdentifierAndTimeFrame( + (int)$this->getArgument('pageidentifier'), + $filter + ), + 'downloadAmount' => $downloadRepository->findAmountByPageIdentifierAndTimeFrame( + (int)$this->getArgument('pageidentifier'), + $filter + ), + 'gotinExternal' => GeneralUtility::makeInstance(GotinExternalDataProvider::class, $filter)->get(), + 'gotinInternal' => GeneralUtility::makeInstance(GotinInternalDataProvider::class, $filter)->get(), + 'gotoutInternal' => GeneralUtility::makeInstance(GotoutInternalDataProvider::class, $filter)->get(), + 'linkclickAmount' => $linkclickRepository->getAmountOfLinkclicksByPageIdentifierAndTimeframe( + (int)$this->getArgument('pageidentifier'), + $filter + ), + 'numberOfVisitorsData' => GeneralUtility::makeInstance( + PagevisistsDataProvider::class, + ObjectUtility::getFilterDto()->setSearchterm($this->getArgument('pageidentifier')) + ), + 'pageIdentifier' => $this->getArgument('pageidentifier'), + 'view' => ucfirst(ConfigurationUtility::getPageOverviewView()), + 'visits' => $pagevisitRepository->findAmountPerPage( + (int)$this->getArgument('pageidentifier'), + $filter + ), + 'visitsLastWeek' => $pagevisitRepository->findAmountPerPage( + (int)$this->getArgument('pageidentifier'), + ObjectUtility::getFilterDto(FilterDto::PERIOD_7DAYSBEFORELAST7DAYS) + ), + ]; + } +} diff --git a/Classes/Backend/Units/Pageoverview/Analysis/Title.php b/Classes/Backend/Units/Pageoverview/Analysis/Title.php new file mode 100644 index 00000000..67ec8bd1 --- /dev/null +++ b/Classes/Backend/Units/Pageoverview/Analysis/Title.php @@ -0,0 +1,43 @@ +setSearchterm($this->getArgument('pageidentifier')); + $delta = $pagevisitRepository->compareAmountPerPage( + (int)$this->getArgument('pageidentifier'), + $filter, + ObjectUtility::getFilterDto(FilterDto::PERIOD_7DAYSBEFORELAST7DAYS) + ); + $session = BackendUtility::getSessionValue('toggle', 'pageOverview', 'General'); + + return [ + 'abandons' => $pagevisitRepository->findAbandonsForPage((int)$this->getArgument('pageidentifier'), $filter), + 'delta' => $delta, + 'deltaIconPath' => $delta >= 0 ? 'Icons/increase.svg' : 'Icons/decrease.svg', + 'status' => $session['status'] ?? 'show', + 'view' => ucfirst(ConfigurationUtility::getPageOverviewView()), + 'visits' => $pagevisitRepository->findAmountPerPage((int)$this->getArgument('pageidentifier'), $filter), + ]; + } +} diff --git a/Classes/Backend/Units/Pageoverview/Leads/Body.php b/Classes/Backend/Units/Pageoverview/Leads/Body.php new file mode 100644 index 00000000..4b598348 --- /dev/null +++ b/Classes/Backend/Units/Pageoverview/Leads/Body.php @@ -0,0 +1,29 @@ + $this->getArgument('pageidentifier'), + 'view' => ucfirst(ConfigurationUtility::getPageOverviewView()), + 'visitors' => $visitorRepository->findByVisitedPageIdentifier((int)$this->getArgument('pageidentifier')), + ]; + } +} diff --git a/Classes/Backend/Units/Pageoverview/Leads/Title.php b/Classes/Backend/Units/Pageoverview/Leads/Title.php new file mode 100644 index 00000000..2b537c72 --- /dev/null +++ b/Classes/Backend/Units/Pageoverview/Leads/Title.php @@ -0,0 +1,31 @@ + $visitorRepository->findByVisitedPageIdentifier((int)$this->getArgument('pageidentifier')), + 'status' => $session['status'] ?? 'show', + 'view' => ucfirst(ConfigurationUtility::getPageOverviewView()), + ]; + } +} diff --git a/Classes/Backend/Units/UnitFinder.php b/Classes/Backend/Units/UnitFinder.php index b0356ee7..2207a7f7 100644 --- a/Classes/Backend/Units/UnitFinder.php +++ b/Classes/Backend/Units/UnitFinder.php @@ -10,6 +10,13 @@ class UnitFinder { + protected array $arguments = []; + + public function __construct(array $arguments = []) + { + $this->arguments = $arguments; + } + /** * @param string $path * @return UnitInterface @@ -23,6 +30,6 @@ public function find(string $path): UnitInterface throw new ConfigurationException('Given class ' . $classNameUnit . ' does not exists', 1694522397); } /** @noinspection PhpParamsInspection */ - return GeneralUtility::makeInstance($classNameUnit); + return GeneralUtility::makeInstance($classNameUnit, $this->arguments); } } diff --git a/Classes/Controller/GeneralController.php b/Classes/Controller/GeneralController.php index 81d4526e..87d51511 100644 --- a/Classes/Controller/GeneralController.php +++ b/Classes/Controller/GeneralController.php @@ -143,7 +143,8 @@ public function getLinkListenerPerformanceAjax(ServerRequestInterface $request): public function getUnitAjax(ServerRequestInterface $request): ResponseInterface { $path = $request->getQueryParams()['path'] ?? ''; - $unitFinder = GeneralUtility::makeInstance(UnitFinder::class); + $arguments = $request->getQueryParams()['arguments'] ?? []; + $unitFinder = GeneralUtility::makeInstance(UnitFinder::class, $arguments); return GeneralUtility::makeInstance(HtmlResponse::class, $unitFinder->find($path)->get()); } } diff --git a/Classes/Hooks/PageOverview.php b/Classes/Hooks/PageOverview.php index 55813368..834bb1a0 100644 --- a/Classes/Hooks/PageOverview.php +++ b/Classes/Hooks/PageOverview.php @@ -2,14 +2,9 @@ namespace In2code\Lux\Hooks; +use Doctrine\DBAL\DBALException; use Doctrine\DBAL\Driver\Exception as ExceptionDbalDriver; use Doctrine\DBAL\Exception as ExceptionDbal; -use In2code\Lux\Domain\Cache\CacheLayer; -use In2code\Lux\Domain\DataProvider\PageOverview\GotinExternalDataProvider; -use In2code\Lux\Domain\DataProvider\PageOverview\GotinInternalDataProvider; -use In2code\Lux\Domain\DataProvider\PageOverview\GotoutInternalDataProvider; -use In2code\Lux\Domain\DataProvider\PagevisistsDataProvider; -use In2code\Lux\Domain\Model\Transfer\FilterDto; use In2code\Lux\Domain\Repository\DownloadRepository; use In2code\Lux\Domain\Repository\LinkclickRepository; use In2code\Lux\Domain\Repository\LogRepository; @@ -20,7 +15,6 @@ use In2code\Lux\Exception\UnexpectedValueException; use In2code\Lux\Utility\BackendUtility; use In2code\Lux\Utility\ConfigurationUtility; -use In2code\Lux\Utility\ObjectUtility; use TYPO3\CMS\Backend\Controller\Event\ModifyPageLayoutContentEvent; use TYPO3\CMS\Backend\Controller\PageLayoutController; use TYPO3\CMS\Backend\Utility\BackendUtility as BackendUtilityCore; @@ -43,7 +37,6 @@ class PageOverview protected DownloadRepository $downloadRepository; protected LogRepository $logRepository; protected RenderingTimeService $renderingTimeService; - protected CacheLayer $cacheLayer; public function __construct( VisitorRepository $visitorRepository, @@ -51,8 +44,7 @@ public function __construct( LinkclickRepository $linkclickRepository, DownloadRepository $downloadRepository, LogRepository $logRepository, - RenderingTimeService $renderingTimeService, - CacheLayer $cacheLayer + RenderingTimeService $renderingTimeService ) { $this->visitorRepository = $visitorRepository; $this->pagevisitRepository = $pagevisitRepository; @@ -60,7 +52,6 @@ public function __construct( $this->downloadRepository = $downloadRepository; $this->logRepository = $logRepository; $this->renderingTimeService = $renderingTimeService; // initialize renderingTimes - $this->cacheLayer = $cacheLayer; } /** @@ -74,6 +65,7 @@ public function __construct( * @throws ExtensionConfigurationExtensionNotConfiguredException * @throws ExtensionConfigurationPathDoesNotExistException * @throws UnexpectedValueException + * @throws DBALException */ public function eventRegistration(ModifyPageLayoutContentEvent $event): void { @@ -95,6 +87,7 @@ public function eventRegistration(ModifyPageLayoutContentEvent $event): void * @throws ExtensionConfigurationPathDoesNotExistException * @throws UnexpectedValueException * @throws ExceptionDbalDriver + * @throws DBALException */ public function render(array $parameters, PageLayoutController $plController): string { @@ -111,10 +104,10 @@ public function render(array $parameters, PageLayoutController $plController): s * @throws ExtensionConfigurationExtensionNotConfiguredException * @throws ExtensionConfigurationPathDoesNotExistException * @throws UnexpectedValueException + * @throws DBALException */ protected function renderContent(int $pageIdentifier): string { - $this->cacheLayer->initialize(__CLASS__, 'render'); $content = ''; if ($this->isPageOverviewEnabled($pageIdentifier)) { $session = BackendUtility::getSessionValue('toggle', 'pageOverview', 'General'); @@ -129,68 +122,15 @@ protected function renderContent(int $pageIdentifier): string * @param int $pageIdentifier * @param array $session * @return array - * @throws ExceptionDbal - * @throws ExtensionConfigurationExtensionNotConfiguredException - * @throws ExtensionConfigurationPathDoesNotExistException - * @throws ConfigurationException - * @throws UnexpectedValueException - * @throws ExceptionDbalDriver */ protected function getArguments(string $view, int $pageIdentifier, array $session): array { - $arguments = [ + return [ 'pageIdentifier' => $pageIdentifier, - 'cacheLayer' => $this->cacheLayer, 'status' => $session['status'] ?? 'show', 'view' => ucfirst($view), 'visitors' => $this->visitorRepository->findByVisitedPageIdentifier($pageIdentifier), ]; - - if ($this->cacheLayer->isCacheAvailable('PageOverviewTitle' . $pageIdentifier) === false) { - $filter = ObjectUtility::getFilterDto(FilterDto::PERIOD_LAST7DAYS)->setSearchterm($pageIdentifier); - $delta = $this->pagevisitRepository->compareAmountPerPage( - $pageIdentifier, - $filter, - ObjectUtility::getFilterDto(FilterDto::PERIOD_7DAYSBEFORELAST7DAYS) - ); - $arguments += [ - 'abandons' => $this->pagevisitRepository->findAbandonsForPage($pageIdentifier, $filter), - 'delta' => $delta, - 'deltaIconPath' => $delta >= 0 ? 'Icons/increase.svg' : 'Icons/decrease.svg', - 'visits' => $this->pagevisitRepository->findAmountPerPage($pageIdentifier, $filter), - 'visitsLastWeek' => $this->pagevisitRepository->findAmountPerPage( - $pageIdentifier, - ObjectUtility::getFilterDto(FilterDto::PERIOD_7DAYSBEFORELAST7DAYS) - ), - 'gotinInternal' => GeneralUtility::makeInstance( - GotinInternalDataProvider::class, - $filter - )->get(), - 'gotinExternal' => GeneralUtility::makeInstance( - GotinExternalDataProvider::class, - $filter - )->get(), - 'gotoutInternal' => GeneralUtility::makeInstance(GotoutInternalDataProvider::class, $filter)->get(), - 'gotout' => '', - 'numberOfVisitorsData' => GeneralUtility::makeInstance( - PagevisistsDataProvider::class, - ObjectUtility::getFilterDto()->setSearchterm((string)$pageIdentifier) - ), - 'downloadAmount' => $this->downloadRepository->findAmountByPageIdentifierAndTimeFrame( - $pageIdentifier, - $filter - ), - 'conversionAmount' => $this->logRepository->findAmountOfIdentifiedLogsByPageIdentifierAndTimeFrame( - $pageIdentifier, - $filter - ), - 'linkclickAmount' => $this->linkclickRepository->getAmountOfLinkclicksByPageIdentifierAndTimeframe( - $pageIdentifier, - $filter - ), - ]; - } - return $arguments; } protected function getContent(array $arguments): string diff --git a/Resources/Private/Build/JavaScript/Backend/Module.js b/Resources/Private/Build/JavaScript/Backend/Module.js index 6a7f834f..133bd3e8 100644 --- a/Resources/Private/Build/JavaScript/Backend/Module.js +++ b/Resources/Private/Build/JavaScript/Backend/Module.js @@ -294,18 +294,26 @@ define(['jquery'], function($) { elements.forEach(function(element) { const data = new URLSearchParams(); data.append('path', element.getAttribute('data-lux-unitajax')); + + // add any parameters to request from data-lux-unitajax-parameter-key="value" + for (var key in element.dataset) { + if (key.indexOf('luxUnitajaxParameter') === 0) { + data.append('arguments[' + key.substring('luxUnitajaxParameter'.length).toLowerCase() + ']', element.dataset[key]); + } + } + fetch(TYPO3.settings.ajaxUrls['/lux/unitajax'] + '&' + data) .then((resp) => resp.text()) .then(function(html) { const parent = element.parentNode; parent.innerHTML = html; window.LuxDiagramObject.initialize(parent); + if (parent.querySelector('[data-lux-toggle]') !== null) { + LuxPageOverviewObject.initialize(parent); + } }) .catch(function(error) { console.log(error); - }) - .finally(() => { - element.classList.remove('unitajax') }); }); } diff --git a/Resources/Private/Build/JavaScript/Backend/PageOverview.js b/Resources/Private/Build/JavaScript/Backend/PageOverview.js index f32bec52..aaddb0c0 100644 --- a/Resources/Private/Build/JavaScript/Backend/PageOverview.js +++ b/Resources/Private/Build/JavaScript/Backend/PageOverview.js @@ -12,19 +12,19 @@ function LuxPageOverview() { var that = this; /** - * Initialize - * + * @param {Document} optional * @returns {void} */ - this.initialize = function() { - toggleListener(); + this.initialize = function(dom) { + dom = dom || document; + toggleListener(dom); }; /** * @returns {void} */ - var toggleListener = function() { - var elements = document.querySelectorAll('[data-lux-toggle]'); + var toggleListener = function(dom) { + var elements = dom.querySelectorAll('[data-lux-toggle]'); for (var i = 0; i < elements.length; i++) { elements[i].addEventListener('click', function(event) { var thisElement = event.currentTarget; diff --git a/Resources/Private/Sass/Modules.scss b/Resources/Private/Sass/Modules.scss index 0629242e..0f9c3726 100644 --- a/Resources/Private/Sass/Modules.scss +++ b/Resources/Private/Sass/Modules.scss @@ -52,7 +52,6 @@ label { border: 6px solid rgba(255,255,255,.3); border-top-color: $colorMain; animation: spin 1s ease-in-out infinite; - -webkit-animation: spin 1s ease-in-out infinite; top: 50%; left: 50%; position: absolute; @@ -69,14 +68,10 @@ label { border-radius: 50%; border-top-color: $colorMain; animation: spin 1s ease-in-out infinite; - -webkit-animation: spin 1s ease-in-out infinite; } @keyframes spin { - to { -webkit-transform: rotate(360deg); } -} -@-webkit-keyframes spin { - to { -webkit-transform: rotate(360deg); } + to { transform: rotate(360deg); } } /** diff --git a/Resources/Private/Sass/PageOverview.scss b/Resources/Private/Sass/PageOverview.scss index ba05982c..34657253 100644 --- a/Resources/Private/Sass/PageOverview.scss +++ b/Resources/Private/Sass/PageOverview.scss @@ -15,7 +15,7 @@ transition: all .1s ease-in; } .lux-pageoverview-box:hover { - background: #4DE7FF; + background: $colorMain; } .lux-pageoverview-box p { margin: 0 0 5px; @@ -41,7 +41,7 @@ margin: 25px auto; } .badge-primary { - background: #4DE7FF; + background: $colorMain; } .lux-arrow-up { content: ""; @@ -68,3 +68,30 @@ border: 1px solid $colorGreyBright; } } + +.unitajax { + position: relative; + overflow: hidden; + min-height: 280px; + background-color: $colorGrey; + border: 2px dashed $colorGreyBright; + margin-bottom: 1.125rem; +} + +.unitajax-spinner { + display: inline-block; + border-radius: 50%; + border: 6px solid rgba(255,255,255,.3); + border-top-color: $colorMain; + animation: spin 1s ease-in-out infinite; + top: 50%; + left: 50%; + position: absolute; + width: 50px; + height: 50px; + margin: -25px 0 0 -25px; +} + +@keyframes spin { + to { transform: rotate(360deg); } +} diff --git a/Resources/Private/Templates/Backend/PageOverview.html b/Resources/Private/Templates/Backend/PageOverview.html index 83a99e74..6571962c 100644 --- a/Resources/Private/Templates/Backend/PageOverview.html +++ b/Resources/Private/Templates/Backend/PageOverview.html @@ -10,15 +10,16 @@

- - - +

- - - +
+
+
+
+
+