Преглед на файлове

restore opentalent backend modules

Olivier Massot преди 1 година
родител
ревизия
edd25bee9b

+ 0 - 7
ot_core/Classes/Controller/SelectedSiteController.php

@@ -2,16 +2,10 @@
 
 namespace Opentalent\OtCore\Controller;
 
-use Opentalent\OtAdmin\Controller\SiteController;
 use Opentalent\OtCore\Exception\NoSiteSelected;
 use Opentalent\OtCore\Exception\NoSuchWebsiteException;
-use Opentalent\OtCore\Website\OtPageRepository;
 use Psr\Http\Message\ResponseInterface;
-use TYPO3\CMS\Core\Database\ConnectionPool;
-use TYPO3\CMS\Extbase\Mvc\Controller\Arguments;
-use TYPO3\CMS\Extbase\Mvc\Exception\StopActionException;
 use TYPO3\CMS\Extbase\Mvc\RequestInterface;
-use TYPO3\CMS\Extbase\Object\ObjectManager;
 
 /**
  * Base class for all controllers of backend modules that need
@@ -45,7 +39,6 @@ class SelectedSiteController extends ActionController
 
     /**
      *
-     * @throws StopActionException
      * @throws NoSuchWebsiteException
      * @throws \Exception
      */

+ 27 - 0
ot_stats/Configuration/Backend/Modules.php

@@ -0,0 +1,27 @@
+<?php
+
+use Opentalent\OtStats\Controller\OtStatsController;
+
+/**
+ * Registers the statistics backend module
+ */
+return [
+    'web_OtStatsOtStats' => [
+        'parent' => 'web',
+        'position' => ['after' => 'web_OtTemplatingOtcustomizer'],
+        'access' => 'user,group',
+        'icon' => 'EXT:ot_stats/Resources/Public/Icons/pie-chart.png',
+        'path' => '/module/web/OtStats',
+        'labels' => 'LLL:EXT:ot_stats/Resources/Private/Language/locallang_mod.xlf',
+        'extensionName' => 'OtStats',
+        'controllerActions' => [
+            OtStatsController::class => [
+                'index',
+                'askForActivationConfirmation',
+                'askForDeactivationConfirmation',
+                'enableStats',
+                'disableStats',
+            ],
+        ],
+    ],
+];

+ 7 - 6
ot_stats/Resources/Private/Layouts/Backend/Default.html

@@ -1,8 +1,9 @@
 {namespace v=FluidTYPO3\Vhs\ViewHelpers}
 
-<f:be.container includeCssFiles="{ot_core: '{f:uri.resource(path:\'assets/Backend/style/ot_be_module.css\', extensionName:\'ot_core\')}',
-                                  ot_stats: '{f:uri.resource(path:\'assets/Backend/style/ot_stats.css\')}'}"
-                includeJsFiles="{iframeresizer: '{f:uri.resource(path:\'assets/Backend/script/iframeResizer.min.js\')}'}">
-    <f:flashMessages />
-    <f:render section="content" />
-</f:be.container>
+<link rel="stylesheet" type="text/css" href="{f:uri.resource(path: 'EXT:backend/Resources/Public/Css/backend.css')}" />
+<link rel="stylesheet" type="text/css" href="{f:uri.resource(path: 'EXT:ot_core/Resources/Public/assets/Backend/style/ot_be_module.css')}" />
+<link rel="stylesheet" type="text/css" href="{f:uri.resource(path: 'EXT:ot_stats/Resources/Public/assets/Backend/style/ot_stats.css')}" />
+
+<f:flashMessages />
+
+<f:render section="content" />

+ 0 - 30
ot_stats/ext_tables.php

@@ -1,30 +0,0 @@
-<?php
-
-use Opentalent\OtStats\Controller\OtStatsController;
-
-defined('TYPO3') || die('Access denied.');
-
-// ext_tables.php contient les directives permettant de configurer le backend
-
-call_user_func(
-    function()
-    {
-        /**
-         * Registers the statistics backend module
-         */
-        \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
-            'OtStats',
-            'web', // Make module a submodule of 'web'
-            'otstats', // Submodule key
-            'after:OtTemplatingOtcustomizer', // Position
-            array(
-                OtStatsController::class => 'index,askForActivationConfirmation,askForDeactivationConfirmation,enableStats,disableStats'
-            ),
-            array(
-                'access' => 'user,group',
-                'icon' => 'EXT:ot_stats/Resources/Public/Icons/pie-chart.png',
-                'labels' => 'LLL:EXT:ot_stats/Resources/Private/Language/locallang_mod.xlf',
-            )
-        );
-    }
-);

+ 2 - 2
ot_templating/Classes/Controller/OtCustomizerController.php

@@ -51,7 +51,7 @@ class OtCustomizerController extends SelectedSiteController {
         $queryBuilder->update('ot_websites')
             ->where($queryBuilder->expr()->eq('uid', $this->currentWebsite['uid']))
             ->set('template', $templateKey)
-            ->execute();
+            ->executeQuery();
 
         // Clear the site's cache
         $this->otCacheManager->clearSiteCache($this->currentRootUid);
@@ -89,7 +89,7 @@ class OtCustomizerController extends SelectedSiteController {
         $queryBuilder->update('ot_websites')
             ->where($queryBuilder->expr()->eq('uid', $this->currentWebsite['uid']))
             ->set('template_preferences', json_encode($prefs))
-            ->execute();
+            ->executeQuery();
 
         // Clear the site's cache
         $this->otCacheManager->clearSiteCache($this->currentRootUid);

+ 25 - 0
ot_templating/Configuration/Backend/Modules.php

@@ -0,0 +1,25 @@
+<?php
+
+use Opentalent\OtTemplating\Controller\OtCustomizerController;
+
+/**
+ * Registers the customizer backend module
+ */
+return [
+    'web_OtTemplatingOtcustomizer' => [
+        'parent' => 'web',
+        'position' => ['before' => 'web_OtStatsOtStats'],
+        'access' => 'user,group',
+        'icon' => 'EXT:ot_templating/Resources/Public/Icons/Extension.png',
+        'path' => '/module/web/Otcustomizer',
+        'labels' => 'LLL:EXT:ot_templating/Resources/Private/Language/locallang_mod.xlf',
+        'extensionName' => 'OtCustomizer',
+        'controllerActions' => [
+            OtCustomizerController::class => [
+                'index',
+                'selectTemplate',
+                'updatePreferences',
+            ],
+        ],
+    ],
+];

+ 1 - 1
ot_templating/Configuration/TypoScript/constants.txt → ot_templating/Configuration/TypoScript/constants.typoscript

@@ -7,7 +7,7 @@ plugin.tx_ottemplating {
     view {
         templateRootPaths.0 = EXT:ot_templating/Resources/Private/Templates/
         partialRootPaths.0 = EXT:ot_templating/Resources/Private/Partials/
-        layoutRootPaths.0 = EXT:ot_templating/Resources/Public/Layouts/
+        layoutRootPaths.0 = EXT:ot_templating/Resources/Private/Layouts/
     }
     settings {
         opentalent {

+ 8 - 0
ot_templating/Configuration/TypoScript/setup.txt → ot_templating/Configuration/TypoScript/setup.typoscript

@@ -108,6 +108,14 @@ plugin.tx_ottemplating {
     }
 }
 
+module.tx_otcustomizer {
+    view {
+        templateRootPaths.0 = {$templateRootPath}
+        partialRootPaths.0 = {$partialRootPath}
+        layoutRootPaths.0 = {$layoutRootPath}
+    }
+}
+
 # * Form extension
 # @see https://docs.typo3.org/c/typo3/cms-form/9.5/en-us/Introduction/Index.html
 

+ 4 - 5
ot_templating/Resources/Private/Layouts/Backend/Default.html

@@ -1,8 +1,7 @@
 {namespace v=FluidTYPO3\Vhs\ViewHelpers}
 
-<f:be.container includeCssFiles="{ot_core: '{f:uri.resource(path:\'assets/Backend/style/ot_be_module.css\', extensionName:\'ot_core\')}',
-                                  ot_customizer: '{f:uri.resource(path:\'assets/Backend/style/ot_customizer.css\')}'}">
-    <f:render section="content" />
-</f:be.container>
-
+<link rel="stylesheet" type="text/css" href="{f:uri.resource(path: 'EXT:backend/Resources/Public/Css/backend.css')}" />
+<link rel="stylesheet" type="text/css" href="{f:uri.resource(path: 'EXT:ot_core/Resources/Public/assets/Backend/style/ot_be_module.css')}" />
+<link rel="stylesheet" type="text/css" href="{f:uri.resource(path: 'EXT:ot_templating/Resources/Public/assets/Backend/style/ot_customizer.css')}" />
 
+<f:render section="content" />

+ 16 - 16
ot_templating/Resources/Private/Templates/OtCustomizer/Index.html

@@ -6,7 +6,7 @@
 <f:section name="content">
     <div class="ot-be-module ot-customizer">
         <div class="templates">
-            <h3><f:translate key="available_themes"/></h3>
+            <h3><f:translate key="LLL:EXT:ot_templating/Resources/Private/Language/locallang.xlf:available_themes"/></h3>
             <div class="templates-gallery">
                 <f:for each="{templates}" as="template" key="template_key">
 
@@ -24,7 +24,7 @@
 
                             <f:if condition="{template_key}=={currentTemplate}">
                                 <f:then>
-                                    <div class="active"><f:translate key="active_theme"/></div>
+                                    <div class="active"><f:translate key="LLL:EXT:ot_templating/Resources/Private/Language/locallang.xlf:active_theme"/></div>
                                 </f:then>
                                 <f:else>
                                     <f:link.action
@@ -33,7 +33,7 @@
                                             title="select"
                                             class="ot-btn"
                                     >
-                                        <f:translate key="use_this_theme"/>
+                                        <f:translate key="LLL:EXT:ot_templating/Resources/Private/Language/locallang.xlf:use_this_theme"/>
                                     </f:link.action>
                                 </f:else>
                             </f:if>
@@ -46,41 +46,41 @@
 
         <div class="customizer">
 
-            <h3><f:translate key="other_customization_settings"/></h3>
+            <h3><f:translate key="LLL:EXT:ot_templating/Resources/Private/Language/locallang.xlf:other_customization_settings"/></h3>
 
             <f:form action="updatePreferences">
                 <div class="form-group">
                     <label>Couleur du thème</label>
                     <f:form.select class="form-control"
                                    name="themeColor"
-                                   options="{light-blue: '{f:translate(key: \'light_blue\')}',
-                                               blue: '{f:translate(key: \'blue\')}',
-                                               green: '{f:translate(key: \'green\')}',
-                                               orange: '{f:translate(key: \'orange\')}',
-                                               grey: '{f:translate(key: \'grey\')}',
-                                               red: '{f:translate(key: \'red\')}',
-                                               light-red: '{f:translate(key: \'light_red\')}',
-                                               purple: '{f:translate(key: \'purple\')}'}"
+                                   options="{light-blue: '{f:translate(key: \'LLL:EXT:ot_templating/Resources/Private/Language/locallang.xlf:light_blue\')}',
+                                               blue: '{f:translate(key: \'LLL:EXT:ot_templating/Resources/Private/Language/locallang.xlf:blue\')}',
+                                               green: '{f:translate(key: \'LLL:EXT:ot_templating/Resources/Private/Language/locallang.xlf:green\')}',
+                                               orange: '{f:translate(key: \'LLL:EXT:ot_templating/Resources/Private/Language/locallang.xlf:orange\')}',
+                                               grey: '{f:translate(key: \'LLL:EXT:ot_templating/Resources/Private/Language/locallang.xlf:grey\')}',
+                                               red: '{f:translate(key: \'LLL:EXT:ot_templating/Resources/Private/Language/locallang.xlf:red\')}',
+                                               light-red: '{f:translate(key: \'LLL:EXT:ot_templating/Resources/Private/Language/locallang.xlf:light_red\')}',
+                                               purple: '{f:translate(key: \'LLL:EXT:ot_templating/Resources/Private/Language/locallang.xlf:purple\')}'}"
                                    value="{preferences.themeColor}">
                     </f:form.select>
                 </div>
 
                 <div class="form-group">
-                    <label><f:translate key="display_carousel"/></label>
+                    <label><f:translate key="LLL:EXT:ot_templating/Resources/Private/Language/locallang.xlf:display_carousel"/></label>
                     <f:form.checkbox name="displayCarousel"
                                      value="1"
                                      checked="{preferences.displayCarousel}"
                     />
                 </div>
                 <div class="form-group">
-                    <label><f:translate key="display_breadcrumb"/></label>
+                    <label><f:translate key="LLL:EXT:ot_templating/Resources/Private/Language/locallang.xlf:display_breadcrumb"/></label>
                     <f:form.checkbox name="displayBreadcrumb"
                                      value="2"
                                      checked="{preferences.displayBreadcrumb}"
                     />
                 </div>
                 <div class="form-group">
-                    <label><f:translate key="static_donors"/></label>
+                    <label><f:translate key="LLL:EXT:ot_templating/Resources/Private/Language/locallang.xlf:static_donors"/></label>
                     <f:form.checkbox name="staticDonors"
                                      value="3"
                                      checked="{preferences.staticDonors}"
@@ -89,7 +89,7 @@
 
                 <div class="actions">
                     <f:form.button type="submit" class="ot-btn">
-                        <f:translate key="apply"/>
+                        <f:translate key="LLL:EXT:ot_templating/Resources/Private/Language/locallang.xlf:apply"/>
                     </f:form.button>
                 </div>
 

+ 2 - 1
ot_templating/Resources/Public/assets/Backend/style/ot_customizer.css

@@ -13,6 +13,7 @@
     min-height: 100vh;
     box-shadow: 2px 3px 3px #bfbfbf;
     z-index: 1;
+    padding-top: 30px;
 }
 
 .ot-customizer .templates-gallery {
@@ -70,9 +71,9 @@
 
 .ot-customizer .customizer {
     flex: 1;
-    padding: 0 3%;
     min-height: 100vh;
     background-color: #e6e6e6;
+    padding: 30px 3%;
 }
 
 .ot-customizer .customizer form {

+ 0 - 38
ot_templating/ext_tables.php

@@ -1,38 +0,0 @@
-<?php
-
-use Opentalent\OtTemplating\Controller\OtCustomizerController;
-use Psr\Http\Message\ServerRequestInterface;
-use TYPO3\CMS\Core\Http\ApplicationType;
-
-defined('TYPO3') || die('Access denied.');
-
-// ext_tables.php contient les directives permettant de configurer le backend
-
-call_user_func(
-    function()
-    {
-        // Include the configuration files
-        \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile(
-            'ot_templating',
-            'Configuration/TypoScript',
-            'Templating');
-
-        /**
-         * Registers the customizer backend module
-         */
-        \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
-            'OtTemplating',
-            'web', // Make module a submodule of 'web'
-            'otcustomizer', // Submodule key
-            'before:OtStatsOtstats', // Position
-            array(
-                OtCustomizerController::class => 'index,selectTemplate,updatePreferences',
-            ),
-            array(
-                'access' => 'user,group',
-                'icon' => 'EXT:ot_templating/Resources/Public/Icons/Extension.png',
-                'labels' => 'LLL:EXT:ot_templating/Resources/Private/Language/locallang_mod.xlf',
-            )
-        );
-    }
-);