Task: Module Typo3 8 compatible 85/51485/1
authorMario Matzulla <mario@matzullas.de>
Tue, 31 Jan 2017 10:52:17 +0000 (11:52 +0100)
committerMario Matzulla <mario@matzullas.de>
Tue, 31 Jan 2017 10:52:17 +0000 (11:52 +0100)
Change-Id: Ie29aa3acfab2c69b2cb7e8e013b75a0716aa62f7

Classes/Backend/Modul/IcsGeneratorModul.php
Classes/Backend/Modul/IcsGeneratorModulOld.php [new file with mode: 0644]
Classes/Backend/Modul/icon_tx_caldav_ics_generator.svg [new file with mode: 0644]
Classes/Backend/Modul/index.php
ext_tables.php

index dbf546a..a191b74 100644 (file)
@@ -25,10 +25,15 @@ namespace TYPO3\CMS\Caldav\Backend\Modul;
  * This copyright notice MUST APPEAR in all copies of the script!
  * *************************************************************
  */
+use Psr\Http\Message\ResponseInterface;
+use Psr\Http\Message\ServerRequestInterface;
+use TYPO3\CMS\Backend\Template\ModuleTemplate;
+use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Messaging\FlashMessage;
-use TYPO3\CMS\Core\Messaging\FlashMessageQueue;
 use TYPO3\CMS\Core\Messaging\FlashMessageService;
+use TYPO3\CMS\Core\Page\PageRenderer;
+use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 
 /**
  * Module 'Indexer' for the 'cal' extension.
@@ -36,109 +41,180 @@ use TYPO3\CMS\Core\Messaging\FlashMessageService;
  * @author Mario Matzulla <mario(at)matzullas.de>
  */
 class IcsGeneratorModul extends \TYPO3\CMS\Backend\Module\BaseScriptClass {
+       
+       /**
+        * Array containing submitted data when editing or adding a task
+        *
+        * @var array
+        */
+       protected $submittedData = [];
+       
+       /**
+        * Array containing all messages issued by the application logic
+        * Contains the error's severity and the message itself
+        *
+        * @var array
+        */
+       protected $messages = [];
+       
+       /**
+        * @var string Key of the CSH file
+        */
+       protected $cshKey;
+       
+       /**
+        * @var string
+        */
+       protected $backendTemplatePath = '';
+       
+       /**
+        * @var \TYPO3\CMS\Fluid\View\StandaloneView
+        */
+       protected $view;
+       
+       /**
+        * The name of the module
+        *
+        * @var string
+        */
+       protected $moduleName = 'tools_txcaldavM1';
+       
+       /**
+        * @var string Base URI of scheduler module
+        */
+       protected $moduleUri;
+       
+       /**
+        * ModuleTemplate Container
+        *
+        * @var ModuleTemplate
+        */
+       protected $moduleTemplate;
+       
        var $pageinfo;
        
        /**
+        * @return \TYPO3\CMS\Caldav\Backend\Modul\IcsGeneratorModul
         */
-       function init() {
-               global $BE_USER, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS;
-               
-               parent::init ();
+       public function __construct()
+       {
+               $this->moduleTemplate = GeneralUtility::makeInstance(ModuleTemplate::class);
+               $this->getLanguageService()->includeLLFile('EXT:caldav/Resources/Private/Language/locallang_ics_generator.xml');
+               $this->MCONF = [
+                               'name' => $this->moduleName,
+               ];
+               $this->cshKey = '_MOD_' . $this->moduleName;
+               $this->backendTemplatePath = ExtensionManagementUtility::extPath('cal') . 'Resources/Private/Templates/Backend/IcsGenerator/';
+               $this->view = GeneralUtility::makeInstance(\TYPO3\CMS\Fluid\View\StandaloneView::class);
+               $this->view->getRequest()->setControllerExtensionName('caldav');
+               $this->view->setPartialRootPaths([ExtensionManagementUtility::extPath('caldav') . 'Resources/Private/Templates/Backend/IcsGenerator/Partials/']);
+               $this->moduleUri = BackendUtility::getModuleUrl($this->moduleName);
+       
+               $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
+               $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/Modal');
+               $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/SplitButtons');
        }
        
        /**
         * Adds items to the ->MOD_MENU array.
         * Used for the function menu selector.
         */
-       function menuConfig() {
+       public function menuConfig() {
                $this->MOD_MENU = Array (
                                'function' => Array (
-                                               '1' => $GLOBALS ['LANG']->getLL ( 'function1' ),
-                                               '2' => $GLOBALS ['LANG']->getLL ( 'function2' ),
-                                               '3' => $GLOBALS ['LANG']->getLL ( 'function3' ) 
+                                               '1' => $this->getLanguageService()->getLL ( 'function1' ),
+                                               '2' => $this->getLanguageService()->getLL ( 'function2' ),
+                                               '3' => $this->getLanguageService()->getLL ( 'function3' ) 
                                ) 
                );
                parent::menuConfig ();
        }
        
+       /**
+        * Injects the request object for the current request or subrequest
+        * Simply calls main() and init() and outputs the content
+        *
+        * @param ServerRequestInterface $request the current request
+        * @param ResponseInterface $response
+        * @return ResponseInterface the response with the content
+        */
+       public function mainAction(ServerRequestInterface $request, ResponseInterface $response) {
+               $GLOBALS['SOBE'] = $this;
+               $this->init();
+               $this->main();
+       
+               $this->moduleTemplate->setContent($this->content);
+               $response->getBody()->write($this->moduleTemplate->renderContent());
+               return $response;
+       }
+       
+       /**
+        * Generates the action menu
+        */
+       protected function getModuleMenu() {
+               $menu = $this->moduleTemplate->getDocHeaderComponent()->getMenuRegistry()->makeMenu();
+               $menu->setIdentifier('CaldavJumpMenu');
+       
+               foreach ($this->MOD_MENU['function'] as $controller => $title) {
+                               
+                       $item = $menu
+                       ->makeMenuItem()
+                       ->setHref(
+                                       BackendUtility::getModuleUrl(
+                                                       $this->moduleName,
+                                                       [
+                                                                       'id' => $this->id,
+                                                                       'SET' => [
+                                                                                       'function' => $controller
+                                                                       ]
+                                                       ]
+                                                       )
+                                       )
+                                       ->setTitle($title);
+                                               
+                                       if (intval($controller) == intval($this->MOD_SETTINGS['function'])) {
+                                               $item->setActive(true);
+                                       }
+                                       $menu->addMenuItem($item);
+               }
+               $this->moduleTemplate->getDocHeaderComponent()->getMenuRegistry()->addMenu($menu);
+       }
+       
        // If you chose 'web' as main module, you will need to consider the $this->id parameter which will contain the uid-number of the page clicked in the page tree
        /**
         * Main function of the module.
         * Write the content to $this->content
         */
        function main() {
-               global $BE_USER, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS;
                
                // Access check!
                // The page will show only if there is a valid page and if this page may be viewed by the user
                $this->pageinfo = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess ( $this->id, $this->perms_clause );
                $access = is_array ( $this->pageinfo ) ? 1 : 0;
                
-               if (($this->id && $access) || ($BE_USER->user ['admin'] && ! $this->id)) {
-                       
-                       // Draw the header.
-                       $this->doc = GeneralUtility::makeInstance ( 'TYPO3\\CMS\\Backend\\Template\\DocumentTemplate' );
-                       $this->doc->backPath = $BACK_PATH;
-                       $this->doc->form = '<form action="" method="POST">';
-                       
-                       // JavaScript
-                       $this->doc->JScode = '
-                               <script language="javascript" type="text/javascript">
-                                       script_ended = 0;
-                                       function jumpToUrl(URL) {
-                                               document.location = URL;
-                                       }
-                               </script>
-                       ';
-                       $this->doc->postCode = '
-                               <script language="javascript" type="text/javascript">
-                                       script_ended = 1;
-                                       if (top.fsMod) top.fsMod.recentIds["web"] = ' . intval ( $this->id ) . ';
-                               </script>
-                       ';
-                       
-                       $headerSection = $this->doc->getHeader ( 'pages', $this->pageinfo, $this->pageinfo ['_thePath'] ) . '<br>' . $GLOBALS ['LANG']->sL ( 'LLL:EXT:lang/locallang_core.php:labels.path' ) . ': ' . GeneralUtility::fixed_lgd_cs ( $this->pageinfo ['_thePath'], - 50 );
+               if (($this->id && $access) || ($this->getBackendUser()->isAdmin() && ! $this->id)) {
                        
-                       $this->content .= $this->doc->startPage ( $GLOBALS ['LANG']->getLL ( 'title' ) );
-                       $this->content .= $this->doc->header ( $GLOBALS ['LANG']->getLL ( 'title' ) );
-                       $this->content .= $this->doc->spacer ( 5 );
-                       $this->content .= $this->doc->section ( '', $this->doc->funcMenu ( $headerSection, \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu ( $this->id, 'SET[function]', $this->MOD_SETTINGS ['function'], $this->MOD_MENU ['function'] ) ) );
-                       $this->content .= $this->doc->divider ( 5 );
-                       
-                       // Render content:
-                       $this->moduleContent ();
-                       
-                       // ShortCut
-                       if ($BE_USER->mayMakeShortcut ()) {
-                               $this->content .= $this->doc->spacer ( 20 ) . $this->doc->section ( '', $this->doc->makeShortcutIcon ( 'id', implode ( ',', array_keys ( $this->MOD_MENU ) ), $this->MCONF ['name'] ) );
-                       }
-                       
-                       $this->content .= $this->doc->spacer ( 10 );
+                       // Set the form
+                       $this->content = '<form name="tx_cal_form" id="tx_cal_form" method="post" action="">';
+               
+                       // Prepare main content
+                       $this->content .= '<h1>' . $this->getLanguageService()->getLL('function.' . $this->MOD_SETTINGS['function']) . '</h1>';
+                       $this->content .= $this->getModuleContent();
+                       $this->content .= '</form>';
                } else {
                        // If no access or if ID == zero
-                       
-                       $this->doc = GeneralUtility::makeInstance ( 'TYPO3\\CMS\\Backend\\Template\\DocumentTemplate' );
-                       $this->doc->backPath = $BACK_PATH;
-                       
-                       $this->content .= $this->doc->startPage ( $GLOBALS ['LANG']->getLL ( 'title' ) );
-                       $this->content .= $this->doc->header ( $GLOBALS ['LANG']->getLL ( 'title' ) );
-                       $this->content .= $this->doc->spacer ( 5 );
-                       $this->content .= $this->doc->spacer ( 10 );
+                       $this->content = '<h1>' . $this->getLanguageService()->getLL('title.') . '</h1>';
+                       $this->content .='<div style="padding-top: 5px;"></div>';
                }
-       }
-       
-       /**
-        * Prints out the module HTML
-        */
-       function printContent() {
-               $this->content .= $this->doc->endPage ();
-               echo $this->content;
+               
+               $this->getModuleMenu();
        }
        
        /**
         * Generates the module content
         */
-       function moduleContent() {
+       protected function getModuleContent() {
+               $content = '';
                switch (intval ( $this->MOD_SETTINGS ['function'] )) {
                        case 2 :
                                $postVarArray = GeneralUtility::_POST ();
@@ -150,13 +226,16 @@ class IcsGeneratorModul extends \TYPO3\CMS\Backend\Module\BaseScriptClass {
                                }
                                
                                if (! empty ( $pageIds )) {
-                                       $content = $GLOBALS ['LANG']->getLL ( 'generateIcs' ) . '<br/>';
+                                       $content = $this->getLanguageService()->getLL ( 'generateIcs' ) . '<br/>';
                                        $rgc = new \TYPO3\CMS\Caldav\Service\IcsGenerator (0);
-                                       $this->content .= $this->doc->section ( $GLOBALS ['LANG']->getLL ( 'found' ), $rgc->countEventsWithoutIcs (), 0, 1 );
-                                       $this->content .= $GLOBALS ['LANG']->getLL ( 'toBeProcessed' );
+                                       $content .= $this->getLanguageService()->getLL ( 'found' ) . $rgc->countEventsWithoutIcs ();
+                                       $content .= $this->getLanguageService()->getLL ( 'toBeProcessed' ).'<br /><br />';
                                        foreach ( $pageIds as $eventPage => $pluginPage ) {
                                                $rgc->pageIDForPlugin = $pluginPage;
-                                               $this->content .= $this->doc->section ( 'PID ' . $eventPage . $GLOBALS ['LANG']->getLL ( 'generateIcs' ), $rgc->generateIcs (), 0, 1 );
+                                               $content .= 'PID ' . $eventPage;
+                                               $content .= '<br /><br />'.$this->getLanguageService()->getLL ( 'generateIcs' );
+                                               $rgc->generateIcs ();
+                                               $content .= '<br />'.$rgc->getInfo();
                                        }
                                } else {
                                        $extConf = unserialize ( $GLOBALS ['TYPO3_CONF_VARS'] ['EXT'] ['extConf'] ['cal'] );
@@ -164,42 +243,43 @@ class IcsGeneratorModul extends \TYPO3\CMS\Backend\Module\BaseScriptClass {
                                        
                                        $pid = 0;
                                        $selectFieldIds = Array ();
-                                       $content .= '<table><tbody>';
-                                       $content .= '<tr><td>';
-                                       $content .= '"' . $GLOBALS ['LANG']->getLL ( 'tableHeader2' ) . ' :';
-                                       $content .= '</td><td>';
-                                       // $content.='<select id="tceforms-multiselect-'.$pid.'" style="width:250px;" name="pageId'.$pid.'_list" class="formField tceforms-multiselect" size="1"></select>';
-                                       // $content.='<a href="#" onclick="setFormValueOpenBrowser(\'db\',\'pageId'.$pid.'|||pages|\'); return false;"><img src="sysext/t3skin/icons/gfx/insert3.gif" alt="'.$GLOBALS['LANG']->getLL('browse').'" title="'.$GLOBALS['LANG']->getLL('browse').'" border="0" height="15" width="15"></a>';
-                                       $content .= '<input type="text" value="" name="pageId">';
-                                       $content .= '</td></tr>';
-                                       $selectFieldIds [] = 'pageId' . $pid;
-                                       $content .= '<tbody></table>';
-                                       // $content.='<input name="pageId_list" id="pageId" type="text" value="" size="5" maxlength="5"><br />';
-                                       $scontent .= '<input type="submit" value="' . $GLOBALS ['LANG']->getLL ( 'submit' ) . '" onclick="return markSelections();"/>';
+                                       $content .= $this->getLanguageService()->getLL ( 'selectPage' ). '<br /><br />';
+                                       
+                                       $label = '<label>' . $this->getLanguageService()->getLL('tableHeader2') . '</label>';
+                                       
+                                       $table[] =
+                                                       '<div class="form-group col-sm-12" id="pageId_colId'.$pid.'">'
+                                                                       . $label
+                                                                       . '<div class="form-control-wrap">'
+                                                                                       . '<div class="input-group" id="pageId_colId'.$pid.'_row-wrapper">'
+                                                                                                       . '<input name="pageId" value="' . $value . '" class="form-control  t3js-clearable" data-date-type="date" data-date-offset="0" type="text" id="tceforms-pageId_colId'.$pid.'_row">'
+                                                                                                                       . '</div>'
+                                                                                                                                       . '</div>'
+                                                                                                                                                       . '</div>';
+                                       $content .= implode(LF, $table);
+                                       $scontent .= '<br /><br /><input type="submit" value="' . $this->getLanguageService()->getLL ( 'submit' ) . '" onclick="return markSelections();"/>';
                                        
                                        $selectFields = '';
                                        foreach ( $selectFieldIds as $selectFieldId ) {
                                                $selectFields .= ' var o' . $selectFieldId . ' = document.getElementById("' . $selectFieldId . '");if(o' . $selectFieldId . '.options.length > 0){o' . $selectFieldId . '.options[0].selected = "selected";} else {notComplete = 1;}';
                                        }
-                                       $content .= '<script type="text/javascript">function markSelections(){ var notComplete = 0;' . $selectFields . ' if(notComplete == 1){alert("' . $GLOBALS ['LANG']->getLL ( 'notAllPagesAssigned' ) . '");return false;}return true;}</script>';
+                                       $content .= '<script type="text/javascript">function markSelections(){ var notComplete = 0;' . $selectFields . ' if(notComplete == 1){alert("' . $this->getLanguageService()->getLL ( 'notAllPagesAssigned' ) . '");return false;}return true;}</script>';
                                        
-                                       $this->content .= $this->doc->section ( $GLOBALS ['LANG']->getLL ( 'selectPage' ), $content, 0, 1 );
-                                       $this->content .= $this->doc->section ( $GLOBALS ['LANG']->getLL ( 'startIndexing' ), $scontent, 0, 1 );
+                                       $content .= $this->getLanguageService()->getLL ( 'startIndexing' ) . $scontent;
                                }
                                break;
                        case 3 :
                                $rgc = new \TYPO3\CMS\Caldav\Service\IcsGenerator (0);
-                               $this->content .= $this->doc->section ( 'Check', $rgc->check (), 0, 1 );
+                               $content .= '<h2>Check</h2>'. $rgc->check ();
                                break;
                        default :
-                               $this->content .= $this->doc->section ( $GLOBALS ['LANG']->getLL ( 'notice_header' ), $GLOBALS ['LANG']->getLL ( 'notice' ), 0, 1 );
-                               $this->content .= $this->doc->section ( $GLOBALS ['LANG']->getLL ( 'capabilities_header' ), $GLOBALS ['LANG']->getLL ( 'capabilities' ), 0, 1 );
+                               $content .= '<h2>'.$this->getLanguageService()->getLL ( 'notice_header' ).'</h2>';
+                               $content .= '<p>'.$this->getLanguageService()->getLL ( 'notice' ).'</p>';
+                               $content .= '<h2>'.$this->getLanguageService()->getLL ( 'capabilities_header' ).'</h2>';
+                               $content .= '<p>'.$this->getLanguageService()->getLL ( 'capabilities' ).'</p>';
                                break;
                }
-       }
-       private function getJScode() {
-               $forms = new \TYPO3\CMS\Backend\Form\FormEngine();
-               $forms->backPath = $GLOBALS['BACK_PATH'];
+               return $content;
        }
 }
 ?>
\ No newline at end of file
diff --git a/Classes/Backend/Modul/IcsGeneratorModulOld.php b/Classes/Backend/Modul/IcsGeneratorModulOld.php
new file mode 100644 (file)
index 0000000..4218406
--- /dev/null
@@ -0,0 +1,205 @@
+<?php
+namespace TYPO3\CMS\Caldav\Backend\Modul;
+
+/**
+ * *************************************************************
+ * Copyright notice
+ *
+ * (c) 2010-2015 Mario Matzulla (mario(at)matzullas.de)
+ * All rights reserved
+ *
+ * This script is part of the TYPO3 project. The TYPO3 project is
+ * free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * The GNU General Public License can be found at
+ * http://www.gnu.org/copyleft/gpl.html.
+ *
+ * This script is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * This copyright notice MUST APPEAR in all copies of the script!
+ * *************************************************************
+ */
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Messaging\FlashMessage;
+use TYPO3\CMS\Core\Messaging\FlashMessageQueue;
+use TYPO3\CMS\Core\Messaging\FlashMessageService;
+
+/**
+ * Module 'Indexer' for the 'cal' extension.
+ *
+ * @author Mario Matzulla <mario(at)matzullas.de>
+ */
+class IcsGeneratorModulOld extends \TYPO3\CMS\Backend\Module\BaseScriptClass {
+       var $pageinfo;
+       
+       /**
+        */
+       function init() {
+               global $BE_USER, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS;
+               
+               parent::init ();
+       }
+       
+       /**
+        * Adds items to the ->MOD_MENU array.
+        * Used for the function menu selector.
+        */
+       function menuConfig() {
+               $this->MOD_MENU = Array (
+                               'function' => Array (
+                                               '1' => $GLOBALS ['LANG']->getLL ( 'function1' ),
+                                               '2' => $GLOBALS ['LANG']->getLL ( 'function2' ),
+                                               '3' => $GLOBALS ['LANG']->getLL ( 'function3' ) 
+                               ) 
+               );
+               parent::menuConfig ();
+       }
+       
+       // If you chose 'web' as main module, you will need to consider the $this->id parameter which will contain the uid-number of the page clicked in the page tree
+       /**
+        * Main function of the module.
+        * Write the content to $this->content
+        */
+       function main() {
+               global $BE_USER, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS;
+               
+               // Access check!
+               // The page will show only if there is a valid page and if this page may be viewed by the user
+               $this->pageinfo = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess ( $this->id, $this->perms_clause );
+               $access = is_array ( $this->pageinfo ) ? 1 : 0;
+               
+               if (($this->id && $access) || ($BE_USER->user ['admin'] && ! $this->id)) {
+                       
+                       // Draw the header.
+                       $this->doc = GeneralUtility::makeInstance ( 'TYPO3\\CMS\\Backend\\Template\\DocumentTemplate' );
+                       $this->doc->backPath = $BACK_PATH;
+                       $this->doc->form = '<form action="" method="POST">';
+                       
+                       // JavaScript
+                       $this->doc->JScode = '
+                               <script language="javascript" type="text/javascript">
+                                       script_ended = 0;
+                                       function jumpToUrl(URL) {
+                                               document.location = URL;
+                                       }
+                               </script>
+                       ';
+                       $this->doc->postCode = '
+                               <script language="javascript" type="text/javascript">
+                                       script_ended = 1;
+                                       if (top.fsMod) top.fsMod.recentIds["web"] = ' . intval ( $this->id ) . ';
+                               </script>
+                       ';
+                       
+                       $headerSection = $this->doc->getHeader ( 'pages', $this->pageinfo, $this->pageinfo ['_thePath'] ) . '<br>' . $GLOBALS ['LANG']->sL ( 'LLL:EXT:lang/locallang_core.php:labels.path' ) . ': ' . GeneralUtility::fixed_lgd_cs ( $this->pageinfo ['_thePath'], - 50 );
+                       
+                       $this->content .= $this->doc->startPage ( $GLOBALS ['LANG']->getLL ( 'title' ) );
+                       $this->content .= $this->doc->header ( $GLOBALS ['LANG']->getLL ( 'title' ) );
+                       $this->content .= $this->doc->spacer ( 5 );
+                       $this->content .= $this->doc->section ( '', $this->doc->funcMenu ( $headerSection, \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu ( $this->id, 'SET[function]', $this->MOD_SETTINGS ['function'], $this->MOD_MENU ['function'] ) ) );
+                       $this->content .= $this->doc->divider ( 5 );
+                       
+                       // Render content:
+                       $this->moduleContent ();
+                       
+                       // ShortCut
+                       if ($BE_USER->mayMakeShortcut ()) {
+                               $this->content .= $this->doc->spacer ( 20 ) . $this->doc->section ( '', $this->doc->makeShortcutIcon ( 'id', implode ( ',', array_keys ( $this->MOD_MENU ) ), $this->MCONF ['name'] ) );
+                       }
+                       
+                       $this->content .= $this->doc->spacer ( 10 );
+               } else {
+                       // If no access or if ID == zero
+                       
+                       $this->doc = GeneralUtility::makeInstance ( 'TYPO3\\CMS\\Backend\\Template\\DocumentTemplate' );
+                       $this->doc->backPath = $BACK_PATH;
+                       
+                       $this->content .= $this->doc->startPage ( $GLOBALS ['LANG']->getLL ( 'title' ) );
+                       $this->content .= $this->doc->header ( $GLOBALS ['LANG']->getLL ( 'title' ) );
+                       $this->content .= $this->doc->spacer ( 5 );
+                       $this->content .= $this->doc->spacer ( 10 );
+               }
+       }
+       
+       /**
+        * Prints out the module HTML
+        */
+       function printContent() {
+               $this->content .= $this->doc->endPage ();
+               echo $this->content;
+       }
+       
+       /**
+        * Generates the module content
+        */
+       function moduleContent() {
+               switch (intval ( $this->MOD_SETTINGS ['function'] )) {
+                       case 2 :
+                               $postVarArray = GeneralUtility::_POST ();
+                               $pageIds = Array ();
+                               foreach ( $postVarArray as $name => $value ) {
+                                       if ($name == 'pageId') {
+                                               $pageIds [intval ( $value )] = intval ( $value );
+                                       }
+                               }
+                               
+                               if (! empty ( $pageIds )) {
+                                       $content = $GLOBALS ['LANG']->getLL ( 'generateIcs' ) . '<br/>';
+                                       $rgc = new \TYPO3\CMS\Caldav\Service\IcsGenerator (0);
+                                       $this->content .= $this->doc->section ( $GLOBALS ['LANG']->getLL ( 'found' ), $rgc->countEventsWithoutIcs (), 0, 1 );
+                                       $this->content .= $GLOBALS ['LANG']->getLL ( 'toBeProcessed' );
+                                       foreach ( $pageIds as $eventPage => $pluginPage ) {
+                                               $rgc->pageIDForPlugin = $pluginPage;
+                                               $this->content .= $this->doc->section ( 'PID ' . $eventPage . $GLOBALS ['LANG']->getLL ( 'generateIcs' ), $rgc->generateIcs (), 0, 1 );
+                                       }
+                               } else {
+                                       $extConf = unserialize ( $GLOBALS ['TYPO3_CONF_VARS'] ['EXT'] ['extConf'] ['cal'] );
+                                       //$this->content .= '<script type="text/javascript">' . $this->getJScode () . '</script>';
+                                       
+                                       $pid = 0;
+                                       $selectFieldIds = Array ();
+                                       $content .= '<table><tbody>';
+                                       $content .= '<tr><td>';
+                                       $content .= $GLOBALS ['LANG']->getLL ( 'tableHeader2' ) . ' :';
+                                       $content .= '</td><td>';
+                                       // $content.='<select id="tceforms-multiselect-'.$pid.'" style="width:250px;" name="pageId'.$pid.'_list" class="formField tceforms-multiselect" size="1"></select>';
+                                       // $content.='<a href="#" onclick="setFormValueOpenBrowser(\'db\',\'pageId'.$pid.'|||pages|\'); return false;"><img src="sysext/t3skin/icons/gfx/insert3.gif" alt="'.$GLOBALS['LANG']->getLL('browse').'" title="'.$GLOBALS['LANG']->getLL('browse').'" border="0" height="15" width="15"></a>';
+                                       $content .= '<input type="text" value="" name="pageId">';
+                                       $content .= '</td></tr>';
+                                       $selectFieldIds [] = 'pageId' . $pid;
+                                       $content .= '<tbody></table>';
+                                       // $content.='<input name="pageId_list" id="pageId" type="text" value="" size="5" maxlength="5"><br />';
+                                       $scontent .= '<input type="submit" value="' . $GLOBALS ['LANG']->getLL ( 'submit' ) . '" onclick="return markSelections();"/>';
+                                       
+                                       $selectFields = '';
+                                       foreach ( $selectFieldIds as $selectFieldId ) {
+                                               $selectFields .= ' var o' . $selectFieldId . ' = document.getElementById("' . $selectFieldId . '");if(o' . $selectFieldId . '.options.length > 0){o' . $selectFieldId . '.options[0].selected = "selected";} else {notComplete = 1;}';
+                                       }
+                                       $content .= '<script type="text/javascript">function markSelections(){ var notComplete = 0;' . $selectFields . ' if(notComplete == 1){alert("' . $GLOBALS ['LANG']->getLL ( 'notAllPagesAssigned' ) . '");return false;}return true;}</script>';
+                                       
+                                       $this->content .= $this->doc->section ( $GLOBALS ['LANG']->getLL ( 'selectPage' ), $content, 0, 1 );
+                                       $this->content .= $this->doc->section ( $GLOBALS ['LANG']->getLL ( 'startIndexing' ), $scontent, 0, 1 );
+                               }
+                               break;
+                       case 3 :
+                               $rgc = new \TYPO3\CMS\Caldav\Service\IcsGenerator (0);
+                               $this->content .= $this->doc->section ( 'Check', $rgc->check (), 0, 1 );
+                               break;
+                       default :
+                               $this->content .= $this->doc->section ( $GLOBALS ['LANG']->getLL ( 'notice_header' ), $GLOBALS ['LANG']->getLL ( 'notice' ), 0, 1 );
+                               $this->content .= $this->doc->section ( $GLOBALS ['LANG']->getLL ( 'capabilities_header' ), $GLOBALS ['LANG']->getLL ( 'capabilities' ), 0, 1 );
+                               break;
+               }
+       }
+       private function getJScode() {
+               $forms = new \TYPO3\CMS\Backend\Form\FormEngine();
+               $forms->backPath = $GLOBALS['BACK_PATH'];
+       }
+}
+?>
\ No newline at end of file
diff --git a/Classes/Backend/Modul/icon_tx_caldav_ics_generator.svg b/Classes/Backend/Modul/icon_tx_caldav_ics_generator.svg
new file mode 100644 (file)
index 0000000..7093789
--- /dev/null
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<svg viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg">
+  <rect x="8.903" y="5.414" width="484.097" height="475.849" style="fill-rule: evenodd; fill: rgb(88, 154, 224);"/>
+  <rect x="51.412" y="59.343" width="411.134" height="377.507" style="fill: rgb(255, 255, 255);" rx="12.055" ry="12.055"/>
+  <rect x="65.371" y="142.885" width="384.486" height="285.29" rx="5.076" ry="5.076" style="fill: rgb(88, 154, 224);"/>
+  <rect x="89.232" y="220.043" width="45.047" height="32.564" style="fill: rgb(255, 255, 255);"/>
+  <rect x="146.81" y="220.043" width="45.047" height="32.564" style="fill: rgb(255, 255, 255);"/>
+  <rect x="203.714" y="220.043" width="45.047" height="32.564" style="fill: rgb(255, 255, 255);"/>
+  <rect x="260.714" y="220.043" width="45.047" height="32.564" style="fill: rgb(255, 255, 255);"/>
+  <rect x="319.335" y="219.947" width="45.047" height="32.564" style="fill: rgb(255, 255, 255);"/>
+  <rect x="376.093" y="219.678" width="45.047" height="32.564" style="fill: rgb(255, 255, 255);"/>
+  <rect x="89.39" y="263.294" width="45.047" height="32.564" style="fill: rgb(86, 86, 86);"/>
+  <rect x="146.968" y="263.294" width="45.047" height="32.564" style="fill: rgb(255, 255, 255);"/>
+  <rect x="203.872" y="263.294" width="45.047" height="32.564" style="stroke: rgb(218, 89, 85); fill: rgb(218, 89, 85); stroke-width: 0;"/>
+  <rect x="260.872" y="263.294" width="45.047" height="32.564" style="fill: rgb(255, 255, 255);"/>
+  <rect x="319.493" y="263.198" width="45.047" height="32.564" style="fill: rgb(255, 255, 255);"/>
+  <rect x="376.251" y="262.929" width="45.047" height="32.564" style="fill: rgb(255, 255, 255);"/>
+  <rect x="90.024" y="309.996" width="45.047" height="32.564" style="fill: rgb(255, 255, 255);"/>
+  <rect x="147.602" y="309.996" width="45.047" height="32.564" style="fill: rgb(255, 255, 255);"/>
+  <rect x="204.506" y="309.996" width="45.047" height="32.564" style="fill: rgb(255, 255, 255);"/>
+  <rect x="261.506" y="309.996" width="45.047" height="32.564" style="fill: rgb(255, 255, 255);"/>
+  <rect x="320.127" y="309.9" width="45.047" height="32.564" style="fill: rgb(86, 86, 86);"/>
+  <rect x="376.885" y="309.631" width="45.047" height="32.564" style="fill: rgb(255, 255, 255);"/>
+  <rect x="90.969" y="355.852" width="45.047" height="32.564" style="fill: rgb(255, 255, 255);"/>
+  <rect x="148.547" y="355.852" width="45.047" height="32.564" style="fill: rgb(255, 255, 255);"/>
+  <rect x="205.451" y="355.852" width="45.047" height="32.564" style="fill: rgb(255, 255, 255);"/>
+  <rect x="260.902" y="176.792" width="45.047" height="32.564" style="fill: rgb(255, 255, 255);"/>
+  <rect x="319.523" y="176.696" width="45.047" height="32.564" style="fill: rgb(86, 86, 86);"/>
+  <rect x="376.281" y="176.427" width="45.047" height="32.564" style="fill: rgb(255, 255, 255);"/>
+  <rect x="90.749" y="39.04" width="16.496" height="38.702" style="fill: rgb(255, 255, 255);" rx="8.248" ry="8.248"/>
+  <rect x="401.338" y="37.841" width="16.496" height="38.702" style="fill: rgb(255, 255, 255);" rx="8.248" ry="8.248"/>
+  <rect x="247.922" y="38.916" width="16.496" height="38.702" style="fill: rgb(255, 255, 255);" rx="8.248" ry="8.248"/>
+  <path id="" d="M 318.463 121.821 L 301.437 121.821 C 296.197 129.236 295.87 136.95 295.543 143.776 L 279.17 149.706 C 274.259 143.477 269.019 140.807 257.558 136.95 L 245.443 147.928 C 249.7 158.309 252.646 163.056 259.522 167.506 L 252.974 182.339 C 245.443 182.635 236.93 182.933 228.742 187.68 L 228.742 203.105 C 236.93 207.85 245.443 208.148 252.974 208.445 L 259.522 223.278 C 252.646 227.726 249.7 232.473 245.443 242.857 L 257.558 253.831 C 269.019 249.975 274.259 247.306 279.17 241.075 L 295.543 247.009 C 295.87 253.831 296.197 261.545 301.437 268.961 L 318.463 268.961 C 323.702 261.545 324.03 253.831 324.358 247.009 L 340.729 241.075 C 345.642 247.306 350.88 249.975 362.341 253.831 L 374.456 242.857 C 370.2 232.473 367.252 227.726 360.377 223.278 L 366.925 208.445 C 374.456 208.148 382.969 207.85 391.157 203.105 L 391.157 187.68 C 382.969 182.933 374.456 182.635 366.925 182.339 L 360.377 167.506 C 367.252 163.056 370.2 158.309 374.456 147.928 L 362.341 136.95 C 350.88 140.807 345.642 143.477 340.729 149.706 L 324.358 143.776 C 324.03 136.95 323.702 129.236 318.463 121.821 Z M 309.951 171.659 C 324.358 171.659 336.145 182.339 336.145 195.392 C 336.145 208.445 324.358 219.123 309.951 219.123 C 295.543 219.123 283.756 208.445 283.756 195.392 C 283.756 182.339 295.543 171.659 309.951 171.659 Z" style="stroke: rgb(74, 76, 68); fill: rgb(43, 43, 43);"/>
+  <path id="" d="M 423.435 211.315 L 406.631 211.315 C 400.935 218.829 400.066 226.644 399.259 233.56 L 382.683 239.572 C 378.278 233.26 373.296 230.555 362.26 226.644 L 349.528 237.769 C 352.993 248.291 355.564 253.101 362.034 257.609 L 354.521 272.64 C 347.067 272.943 338.645 273.242 330.23 278.054 L 329.138 293.684 C 336.878 298.494 345.26 298.795 352.669 299.096 L 358.081 314.129 C 350.981 318.637 347.736 323.446 342.8 333.97 L 353.975 345.092 C 365.559 341.184 370.92 338.478 376.207 332.166 L 391.942 338.177 C 391.781 345.092 391.558 352.909 396.202 360.423 L 413.005 360.423 C 418.699 352.907 419.569 345.092 420.376 338.177 L 436.953 332.166 C 441.357 338.478 446.339 341.184 457.374 345.092 L 470.108 333.97 C 466.644 323.446 464.073 318.638 457.601 314.129 L 465.115 299.096 C 472.567 298.796 480.992 298.495 489.405 293.684 L 490.499 278.054 C 482.758 273.242 474.378 272.943 466.965 272.64 L 461.554 257.609 C 468.657 253.101 471.901 248.291 476.836 237.769 L 465.659 226.646 C 454.077 230.555 448.718 233.26 443.43 239.572 L 427.693 233.56 C 427.853 226.646 428.078 218.829 423.435 211.315 Z M 411.5 261.819 C 425.717 261.819 436.593 272.64 435.667 285.869 C 434.743 299.096 422.352 309.92 408.135 309.92 C 393.919 309.92 383.044 299.096 383.968 285.869 C 384.894 272.64 397.282 261.819 411.5 261.819 Z" style="fill: rgb(88, 84, 84); stroke: rgb(0, 0, 0); stroke-width: 3;" transform="matrix(0.936248, 0.351339, -0.351339, 0.936248, 126.56359, -125.760609)"/>
+  <path id="" d="M 318.463 302.779 L 301.437 302.779 C 296.197 310.195 295.87 317.909 295.543 324.734 L 279.17 330.665 C 274.259 324.435 269.019 321.765 257.558 317.909 L 245.443 328.886 C 249.7 339.269 252.646 344.014 259.522 348.464 L 252.974 363.298 C 245.443 363.592 236.93 363.891 228.742 368.637 L 228.742 384.063 C 236.93 388.81 245.443 389.106 252.974 389.402 L 259.522 404.236 C 252.646 408.684 249.7 413.432 245.443 423.815 L 257.558 434.79 C 269.019 430.934 274.259 428.263 279.17 422.035 L 295.543 427.968 C 295.87 434.79 296.197 442.504 301.437 449.92 L 318.463 449.92 C 323.702 442.504 324.03 434.79 324.358 427.968 L 340.729 422.035 C 345.642 428.263 350.88 430.934 362.341 434.79 L 374.456 423.815 C 370.2 413.432 367.252 408.684 360.377 404.236 L 366.925 389.402 C 374.456 389.106 382.969 388.81 391.157 384.063 L 391.157 368.637 C 382.969 363.891 374.456 363.592 366.925 363.298 L 360.377 348.464 C 367.252 344.014 370.2 339.269 374.456 328.886 L 362.341 317.909 C 350.88 321.765 345.642 324.435 340.729 330.665 L 324.358 324.734 C 324.03 317.909 323.702 310.195 318.463 302.779 Z M 309.951 352.617 C 324.358 352.617 336.145 363.298 336.145 376.352 C 336.145 389.402 324.358 400.083 309.951 400.083 C 295.543 400.083 283.756 389.402 283.756 376.352 C 283.756 363.298 295.543 352.617 309.951 352.617 Z" style="fill: rgb(144, 136, 136); stroke: rgb(4, 4, 4); stroke-width: 3;"/>
+</svg>
\ No newline at end of file
index 629bfcf..e12d98e 100644 (file)
@@ -39,7 +39,7 @@ $BE_USER->modAccess ($MCONF, 1); // This checks permissions and exits if the use
 // DEFAULT initialization of a module [END]
 
 // Make instance:
-$SOBE = new \TYPO3\CMS\Caldav\Backend\Modul\IcsGeneratorModul ();
+$SOBE = new \TYPO3\CMS\Caldav\Backend\Modul\IcsGeneratorModulOld ();
 $SOBE->init ();
 
 $SOBE->main ();
index 8240857..efb7dfe 100755 (executable)
@@ -9,5 +9,26 @@ if (TYPO3_MODE=="BE")  {
        \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModule("tools","calicsgenerator","",$extPath."Classes/Backend/Modul/");
 }
 
+if (TYPO3_MODE == "BE") {
+       if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger ( TYPO3_version ) < '8000000') {
+               \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModule( "tools", "calicsgenerator", "", $extPath . "Classes/Backend/Modul/" );
+       } else {
+               // Add module
+               \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModule(
+                               'tools',
+                               'txcaldavM1',
+                               '',
+                               '',
+                               [
+                                               'routeTarget' => \TYPO3\CMS\Caldav\Backend\Modul\IcsGeneratorModul::class . '::mainAction',
+                                               'access' => 'admin',
+                                               'name' => 'tools_txcaldavM1',
+                                               'icon' => 'EXT:' . $_EXTKEY . '/Classes/Backend/Modul/icon_tx_caldav_ics_generator.svg',
+                                               'labels' => 'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang_ics_generator_mod.xml'
+                               ]
+                               );
+       }
+}
+
 
 ?>
\ No newline at end of file