* Add RTE_insert hook for insertion of text into RTE editing area.
authorstan <stan@735d13b6-9817-0410-8766-e36946ffe9aa>
Mon, 19 Dec 2005 15:22:14 +0000 (15:22 +0000)
committerstan <stan@735d13b6-9817-0410-8766-e36946ffe9aa>
Mon, 19 Dec 2005 15:22:14 +0000 (15:22 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/lorem_ipsum/trunk@887 735d13b6-9817-0410-8766-e36946ffe9aa

ChangeLog [new file with mode: 0644]
class.tx_loremipsum_wiz.php
doc/TODO.txt

diff --git a/ChangeLog b/ChangeLog
new file mode 100644 (file)
index 0000000..533dcf8
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,3 @@
+2005-12-19  Stanislas Rolland  <stanislas.rolland(arobas)fructifor.ca>
+       * Add RTE_insert hook for insertion of text into RTE editing area.
+
index 2cdc2fd..418823b 100755 (executable)
@@ -84,7 +84,6 @@ class tx_loremipsum_wiz {
         * @return      string          HTML for the wizard.
         */
        function main($PA,$pObj)        {
-               #debug($PA);
 
                        // Detect proper LR file source:
                $this->setLRfile($PA);
@@ -100,6 +99,7 @@ class tx_loremipsum_wiz {
                        case 'paragraph':
                        case 'loremipsum':
                                $onclick = $this->getHeaderTitleJS(
+                                                               "document.".$PA['formName']."['".$PA['itemName']."']",
                                                                "document.".$PA['formName']."['".$PA['itemName']."'].value",
                                                                $PA['params']['type'],
                                                                $PA['params']['endSequence'],
@@ -155,6 +155,7 @@ class tx_loremipsum_wiz {
         * Create rotating Lipsum text for JS variable
         * Can be used by other non TCEform fields as well.
         *
+        * @param       string          Reference to the form field
         * @param       string          JavaScript variable name, eg. a form field value property reference.
         * @param       string          Type = key from $this->lindex array
         * @param       string          List of character numbers to end sequence with.
@@ -162,7 +163,7 @@ class tx_loremipsum_wiz {
         * @param       integer         Number of texts to cycle through
         * @return      string          JavaScript applying a lipsum string to input javascript variable.
         */
-       function getHeaderTitleJS($varName, $type, $endSequence='', $add=FALSE, $count=10)      {
+       function getHeaderTitleJS($varElement, $varName, $type, $endSequence='', $add=FALSE, $count=10) {
 
                        // Load data:
                $this->loadLoremIpsumArray();
@@ -205,7 +206,19 @@ class tx_loremipsum_wiz {
                        $code.="
                                ".$varName.($add?'+':'')."=lipsum_temp_strings[lipsum_temp_pointer];
                        ";
-
+                               
+                               // Hook for insertion into RTE
+                       if ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['lorem_ipsum']['RTE_insert']) {
+                               $_params = array (
+                                       'element' => &$varElement,
+                               ); 
+                               
+                               foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['lorem_ipsum']['RTE_insert'] as $_funcRef)    {
+                                       if ($_funcRef) {
+                                               $code .= t3lib_div::callUserFunction($_funcRef,$_params,$this);
+                                       }
+                               }
+                       }
                                // Return:
                        return $code;
                }
@@ -282,7 +295,6 @@ class tx_loremipsum_wiz {
                } else {
                        $this->lindex = $T3_VAR['ext']['lorem_ipsum'][$this->LRfile]['lindex'];
                }
-#debug($this->lindex);
        }
 
        /**
@@ -307,7 +319,6 @@ class tx_loremipsum_wiz {
        }
 }
 
-// Include extension?
 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/lorem_ipsum/class.tx_loremipsum_wiz.php'])    {
        include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/lorem_ipsum/class.tx_loremipsum_wiz.php']);
 }
index 0d3ade9..62c8a41 100755 (executable)
@@ -1,4 +1,3 @@
 - Different wizard for form/table/bullet list usage
-- RTE content? / Disable for RTE
 - Translate the few labels from english to LL.
 - Support more than UTF-8 for non-LR content.
\ No newline at end of file