Added feature #10138: htmlArea RTE: add Clear RTE cache option to BE Clear cache...
authorStanislas Rolland <typo3@sjbr.ca>
Wed, 14 Jan 2009 18:46:58 +0000 (18:46 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Wed, 14 Jan 2009 18:46:58 +0000 (18:46 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@4715 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/rtehtmlarea/ChangeLog
typo3/sysext/rtehtmlarea/ext_localconf.php
typo3/sysext/rtehtmlarea/hooks/clearrtecache/class.tx_rtehtmlarea_clearcachemenu.php [new file with mode: 0644]
typo3/sysext/rtehtmlarea/hooks/clearrtecache/class.tx_rtehtmlarea_clearrtecache.php [new file with mode: 0644]
typo3/sysext/rtehtmlarea/hooks/clearrtecache/clearrtecache.png [new file with mode: 0644]
typo3/sysext/rtehtmlarea/hooks/clearrtecache/ext_localconf.php [new file with mode: 0644]
typo3/sysext/rtehtmlarea/hooks/clearrtecache/locallang.xml [new file with mode: 0644]

index 32cbc82..5f85c02 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-01-14  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Added feature #10138: htmlArea RTE: add Clear RTE cache option to BE Clear cache menu
+
 2009-01-14  Steffen Kamper  <info@sk-typo3.de> 
 
        * Fixed bug #9885: Add Hook to ClearCacheMenu
index c68ddc1..aa51f4f 100644 (file)
@@ -1,3 +1,7 @@
+2009-01-14  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Added feature #10138: htmlArea RTE: add Clear RTE cache option to BE Clear cache menu
+
 2009-01-12  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Follow-up to bug #9932: htmlArea RTE Spellcheck does not work when TYPO3 is installed in subdir
index 025fa0b..b7302a7 100644 (file)
@@ -62,6 +62,9 @@ t3lib_extMgm::addPageTSConfig('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:' . $_EXTKE
        // Add default User TSonfig RTE configuration
 t3lib_extMgm::addUserTSConfig('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:' . $_EXTKEY . '/res/' . strtolower($TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['defaultConfiguration']) . '/userTSConfig.txt">');
 
+       // Add Clear RTE Cache to Clear Cache menu
+require_once(t3lib_extMgm::extPath('rtehtmlarea').'hooks/clearrtecache/ext_localconf.php');
+
        // Troubleshooting and experimentation
 $TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['enableDebugMode'] = $_EXTCONF['enableDebugMode'] ? $_EXTCONF['enableDebugMode'] : 0;
 $TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]['enableCompressedScripts'] = $_EXTCONF['enableCompressedScripts'] ? $_EXTCONF['enableCompressedScripts'] : 0;
diff --git a/typo3/sysext/rtehtmlarea/hooks/clearrtecache/class.tx_rtehtmlarea_clearcachemenu.php b/typo3/sysext/rtehtmlarea/hooks/clearrtecache/class.tx_rtehtmlarea_clearcachemenu.php
new file mode 100644 (file)
index 0000000..d374740
--- /dev/null
@@ -0,0 +1,62 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2007 Ingo Renner <ingo@typo3.org>
+*  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.
+*  A copy is found in the textfile GPL.txt and important notices to the license
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  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!
+***************************************************************/
+/**
+ * Extending class to render the menu for the cache clearing actions, and adding Clear RTE cache option
+ *
+ * @author     Ingo Renner <ingo@typo3.org>
+ * @author     Steffen kamper <info@sk-typo3.de>
+ * @package    TYPO3
+ */
+
+require_once (PATH_typo3.'interfaces/interface.backend_cacheActionsHook.php');
+
+class tx_rtehtmlarea_clearcachemenu implements backend_cacheActionsHook {
+       /**
+        * modifies CacheMenuItems array
+        *
+        * @param       array   array of CacheMenuItems
+        * @param       array   array of AccessConfigurations-identifiers (typically  used by userTS with options.clearCache.identifier)
+        * @return      void
+        */
+        public function manipulateCacheActions(&$cacheActions, &$optionValues) {
+                       // Add new cache menu item
+               $title = $GLOBALS['LANG']->sL('LLL:EXT:rtehtmlarea/hooks/clearrtecache/locallang.xml:title');
+               $cacheActions[] = array(
+                       'id'    => 'clearRTECache',
+                       'title' => $title,
+                       'href'  => $GLOBALS['BACK_PATH'] . 'ajax.php?ajaxID=rtehtmlarea::clearTempDir',
+                       'icon'  => '<img'.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'sysext/rtehtmlarea/hooks/clearrtecache/clearrtecache.png', 'width="16" height="16"').' title="'.$title.'" alt="'.$title.'" />'
+                       //'icon'  => '<img src="' . t3lib_extMgm::extRelPath('rtehtmlarea') . 'hooks/clearrtecache/clearrtecache.png" width="16" height="16" title="'.htmlspecialchars($title).'" alt="" />'
+               );
+               $optionValues[] = 'clearRTECache';
+        }
+}
+
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/hooks/clearrtecache/class.tx_rtehtmlarea_clearcachemenu.php']) {
+       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/hooks/clearrtecache/class.tx_rtehtmlarea_clearcachemenu.php']);
+}
+?>
diff --git a/typo3/sysext/rtehtmlarea/hooks/clearrtecache/class.tx_rtehtmlarea_clearrtecache.php b/typo3/sysext/rtehtmlarea/hooks/clearrtecache/class.tx_rtehtmlarea_clearrtecache.php
new file mode 100644 (file)
index 0000000..49fe676
--- /dev/null
@@ -0,0 +1,49 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2008 Steffen Kamper <info@sk-typo3.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.
+*  A copy is found in the textfile GPL.txt and important notices to the license
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  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!
+***************************************************************/
+/**
+ * Class to clear temp files of htmlArea RTE
+ *
+ * @author     Steffen kamper <info@sk-typo3.de>
+ * @package TYPO3
+ */
+class tx_rtehtmlarea_clearrtecache {
+       function clearTempDir() {
+               $tempPath = PATH_typo3.'../typo3temp/rtehtmlarea/';
+               $handle=opendir($tempPath);
+               while ($data=readdir($handle)) {
+                       if (!is_dir($data) && $data!="." && $data!="..") {
+                               unlink($tempPath.$data);
+                       }
+               }
+               closedir($handle);
+       }
+}
+
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/hooks/clearrtecache/class.tx_rtehtmlarea_clearrtecache.php']) {
+       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/hooks/clearrtecache/class.tx_rtehtmlarea_clearrtecache.php']);
+}
+?>
diff --git a/typo3/sysext/rtehtmlarea/hooks/clearrtecache/clearrtecache.png b/typo3/sysext/rtehtmlarea/hooks/clearrtecache/clearrtecache.png
new file mode 100644 (file)
index 0000000..3977bc6
Binary files /dev/null and b/typo3/sysext/rtehtmlarea/hooks/clearrtecache/clearrtecache.png differ
diff --git a/typo3/sysext/rtehtmlarea/hooks/clearrtecache/ext_localconf.php b/typo3/sysext/rtehtmlarea/hooks/clearrtecache/ext_localconf.php
new file mode 100644 (file)
index 0000000..2afb62b
--- /dev/null
@@ -0,0 +1,8 @@
+<?php
+       // Register Clear Cache Menu hook
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['additionalBackendItems']['cacheActions']['clearRTECache'] = 'EXT:rtehtmlarea/hooks/clearrtecache/class.tx_rtehtmlarea_clearcachemenu.php:&tx_rtehtmlarea_clearcachemenu';
+
+       // Register Ajax call
+$TYPO3_CONF_VARS['BE']['AJAX']['rtehtmlarea::clearTempDir'] = 'EXT:rtehtmlarea/hooks/clearrtecache/class.tx_rtehtmlarea_clearrtecache.php:tx_rtehtmlarea_clearrtecache->clearTempDir';
+
+?>
diff --git a/typo3/sysext/rtehtmlarea/hooks/clearrtecache/locallang.xml b/typo3/sysext/rtehtmlarea/hooks/clearrtecache/locallang.xml
new file mode 100644 (file)
index 0000000..3d2b2fb
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<T3locallang>
+       <meta type="array">
+               <generator>ClearRTECache</generator>
+               <type>module</type>
+               <authorName>Steffen Kamper</authorName>
+               <authorEmail>info@sk-typo3.de</authorEmail>
+               <description>Clears the temp dir of htmlArea RTE</description>
+       </meta>
+       <data type="array">
+               <languageKey index="default" type="array">
+                       <label index="title">Clear RTE Cache</label>
+               </languageKey>
+       </data>
+</T3locallang>