* Added feature: Various enhancements to image dialog in htmlArea RTE
authorStanislas Rolland <typo3@sjbr.ca>
Sun, 20 Jan 2008 05:57:46 +0000 (05:57 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Sun, 20 Jan 2008 05:57:46 +0000 (05:57 +0000)
* Fixed bug #3957: picture drag and drop throws you out of the tab navigation
* Fixed bug #5490: Drag 'n drop javascript error / blank screen in IE
* Added feature #5885: Default image class
* Added feature #5902: Removing style attribute for images
* Added feature #6115: Enabling configuration of the "edit image" dialogue

git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@2925 709f56b5-9817-0410-a4d7-c38de5d9e867

23 files changed:
ChangeLog
typo3/sysext/rtehtmlarea/ChangeLog
typo3/sysext/rtehtmlarea/class.tx_rtehtmlarea_base.php
typo3/sysext/rtehtmlarea/doc/manual.sxw
typo3/sysext/rtehtmlarea/ext_localconf.php
typo3/sysext/rtehtmlarea/extensions/DefaultImage/class.tx_rtehtmlarea_defaultimage.php [new file with mode: 0644]
typo3/sysext/rtehtmlarea/extensions/DefaultImage/skin/htmlarea.css [new file with mode: 0644]
typo3/sysext/rtehtmlarea/extensions/DefaultImage/skin/images/image.gif [new file with mode: 0644]
typo3/sysext/rtehtmlarea/extensions/TYPO3Image/class.tx_rtehtmlarea_typo3image.php [new file with mode: 0644]
typo3/sysext/rtehtmlarea/extensions/TYPO3Image/skin/htmlarea.css [new file with mode: 0644]
typo3/sysext/rtehtmlarea/extensions/TYPO3Image/skin/images/image.gif [new file with mode: 0644]
typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/ContextMenu/context-menu.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/DefaultImage/default-image.js [new file with mode: 0644]
typo3/sysext/rtehtmlarea/htmlarea/plugins/DefaultImage/locallang.xml [new file with mode: 0644]
typo3/sysext/rtehtmlarea/htmlarea/plugins/DefaultImage/popups/insert_image.html [new file with mode: 0644]
typo3/sysext/rtehtmlarea/htmlarea/plugins/TYPO3Browsers/typo3browsers.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/TYPO3Image/locallang.xml [new file with mode: 0644]
typo3/sysext/rtehtmlarea/htmlarea/plugins/TYPO3Image/typo3image.js [new file with mode: 0644]
typo3/sysext/rtehtmlarea/mod4/class.tx_rtehtmlarea_dam_browse_media.php
typo3/sysext/rtehtmlarea/mod4/class.tx_rtehtmlarea_select_image.php
typo3/sysext/rtehtmlarea/mod4/locallang.xml
typo3/sysext/rtehtmlarea/pi3/class.tx_rtehtmlarea_pi3.php

index be524ad..b4aa678 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2008-01-19  Stanislas Rolland  <stanislas.rolland@fructifor.ca>
+
+       * Added feature: Various enhancements to image dialog in htmlArea RTE
+       * Fixed bug #3957: picture drag and drop throws you out of the tab navigation
+       * Fixed bug #5490: Drag 'n drop javascript error / blank screen in IE
+       * Added feature #5885: Default image class
+       * Added feature #5902: Removing style attribute for images
+       * Added feature #6115: Enabling configuration of the "edit image" dialogue
+
 2008-01-19  Ingo Renner  <ingo@typo3.org>
 
        * added a way to overwrite / skin the css files in backend.php
index 516e56e..9caef6e 100644 (file)
@@ -1,3 +1,12 @@
+2008-01-19  Stanislas Rolland  <stanislas.rolland@fructifor.ca>
+
+       * Added feature: Various enhancements to image dialog in htmlArea RTE
+       * Fixed bug #3957: picture drag and drop throws you out of the tab navigation
+       * Fixed bug #5490: Drag 'n drop javascript error / blank screen in IE
+       * Added feature #5885: Default image class
+       * Added feature #5902: Removing style attribute for images
+       * Added feature #6115: Enabling configuration of the "edit image" dialogue
+
 2008-01-17  Stanislas Rolland  <stanislas.rolland@fructifor.ca>
 
        * Fixed bug #7196: Status of block element buttons not updated in htmlArea RTE toolbar
index aa2b5f1..82ae817 100644 (file)
@@ -103,7 +103,6 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
                'line'                  => 'InsertHorizontalRule',
                'link'                  => 'CreateLink',
                'table'                 => 'InsertTable',
-               'image'                 => 'InsertImage',
                'cut'                   => 'Cut',
                'copy'                  => 'Copy',
                'paste'                 => 'Paste',
@@ -914,7 +913,6 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
                ' . '/*<![CDATA[*/') . ($this->is_FE() ? '' : '
                        RTEarea[0]["RTEtsConfigParams"] = "&RTEtsConfigParams=' . rawurlencode($this->RTEtsConfigParams()) . '";
                        RTEarea[0]["pathLinkModule"] = "../../mod3/browse_links.php";
-                       RTEarea[0]["pathImageModule"] = "../../mod4/select_image.php";
                        RTEarea[0]["pathUserModule"] = "../../mod5/user.php";
                        RTEarea[0]["pathParseHtmlModule"] = "' . $this->extHttpPath . 'mod6/parse_html.php";')
                        . $loadPluginCode .  '
index 601ef99..5a0e379 100644 (file)
Binary files a/typo3/sysext/rtehtmlarea/doc/manual.sxw and b/typo3/sysext/rtehtmlarea/doc/manual.sxw differ
index 7ed167c..168922b 100644 (file)
@@ -70,6 +70,13 @@ $TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['plugins']['InlineElements'] = array(
 $TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['plugins']['InlineElements']['objectReference'] = 'EXT:'.$_EXTKEY.'/extensions/InlineElements/class.tx_rtehtmlarea_inlineelements.php:&tx_rtehtmlarea_inlineelements';
 $TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['plugins']['TextStyle'] = array();
 $TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['plugins']['TextStyle']['objectReference'] = 'EXT:'.$_EXTKEY.'/extensions/TextStyle/class.tx_rtehtmlarea_textstyle.php:&tx_rtehtmlarea_textstyle';
+$TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['plugins']['DefaultImage'] = array();
+$TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['plugins']['DefaultImage']['objectReference'] = 'EXT:'.$_EXTKEY.'/extensions/DefaultImage/class.tx_rtehtmlarea_defaultimage.php:&tx_rtehtmlarea_defaultimage';
+$TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['plugins']['DefaultImage']['addIconsToSkin'] = 0;
+$TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['plugins']['TYPO3Image'] = array();
+$TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['plugins']['TYPO3Image']['objectReference'] = 'EXT:'.$_EXTKEY.'/extensions/TYPO3Image/class.tx_rtehtmlarea_typo3image.php:&tx_rtehtmlarea_typo3image';
+$TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['plugins']['TYPO3Image']['addIconsToSkin'] = 0;
+$TYPO3_CONF_VARS['EXTCONF']['rtehtmlarea']['plugins']['TYPO3Image']['disableInFE'] = 1;
 
 $_EXTCONF = unserialize($_EXTCONF);    // unserializing the configuration so we can use it here:
 
diff --git a/typo3/sysext/rtehtmlarea/extensions/DefaultImage/class.tx_rtehtmlarea_defaultimage.php b/typo3/sysext/rtehtmlarea/extensions/DefaultImage/class.tx_rtehtmlarea_defaultimage.php
new file mode 100644 (file)
index 0000000..88846e7
--- /dev/null
@@ -0,0 +1,75 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2008 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
+*  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!
+***************************************************************/
+/**
+ * Image plugin for htmlArea RTE
+ *
+ * @author Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
+ *
+ * TYPO3 SVN ID: $Id:$
+ *
+ */
+
+require_once(t3lib_extMgm::extPath('rtehtmlarea').'class.tx_rtehtmlareaapi.php');
+
+class tx_rtehtmlarea_defaultimage extends tx_rtehtmlareaapi {
+
+       protected $extensionKey = 'rtehtmlarea';        // The key of the extension that is extending htmlArea RTE
+       protected $pluginName = 'DefaultImage';         // The name of the plugin registered by the extension
+       protected $relativePathToLocallangFile = '';    // Path to this main locallang file of the extension relative to the extension dir.
+       protected $relativePathToSkin = 'extensions/DefaultImage/skin/htmlarea.css';            // Path to the skin (css) file relative to the extension dir.
+       protected $htmlAreaRTE;                         // Reference to the invoking object
+       protected $thisConfig;                          // Reference to RTE PageTSConfig
+       protected $toolbar;                             // Reference to RTE toolbar array
+       protected $LOCAL_LANG;                          // Frontend language array
+       
+       protected $pluginButtons = 'image';
+       protected $convertToolbarForHtmlAreaArray = array (
+               'image' => 'InsertImage',
+               );
+       
+       /**
+        * Return JS configuration of the htmlArea plugins registered by the extension
+        *
+        * @param       integer         Relative id of the RTE editing area in the form
+        *
+        * @return string               JS configuration for registered plugins
+        *
+        * The returned string will be a set of JS instructions defining the configuration that will be provided to the plugin(s)
+        * Each of the instructions should be of the form:
+        *      RTEarea['.$RTEcounter.']["buttons"]["button-id"]["property"] = "value";
+        */
+       public function buildJavascriptConfiguration($RTEcounter) {
+               global $TSFE, $LANG;
+               
+               $registerRTEinJavascriptString = '';
+               return $registerRTEinJavascriptString;
+       }
+
+} // end of class
+
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/extensions/DefaultImage/class.tx_rtehtmlarea_defaultimage.php']) {
+       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/extensions/DefaultImage/class.tx_rtehtmlarea_defaultimage.php']);
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/rtehtmlarea/extensions/DefaultImage/skin/htmlarea.css b/typo3/sysext/rtehtmlarea/extensions/DefaultImage/skin/htmlarea.css
new file mode 100644 (file)
index 0000000..6ac0002
--- /dev/null
@@ -0,0 +1,4 @@
+/* Selectors for the Image plugin of htmlArea RTE */
+/* TYPO3 SVN ID: $Id:$ */
+.htmlarea .toolbar .Image {background-image:url("images/image.gif");}
+
diff --git a/typo3/sysext/rtehtmlarea/extensions/DefaultImage/skin/images/image.gif b/typo3/sysext/rtehtmlarea/extensions/DefaultImage/skin/images/image.gif
new file mode 100644 (file)
index 0000000..f32a4a7
Binary files /dev/null and b/typo3/sysext/rtehtmlarea/extensions/DefaultImage/skin/images/image.gif differ
diff --git a/typo3/sysext/rtehtmlarea/extensions/TYPO3Image/class.tx_rtehtmlarea_typo3image.php b/typo3/sysext/rtehtmlarea/extensions/TYPO3Image/class.tx_rtehtmlarea_typo3image.php
new file mode 100644 (file)
index 0000000..fdb64c5
--- /dev/null
@@ -0,0 +1,90 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2008 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
+*  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!
+***************************************************************/
+/**
+ * TYPO3 Image plugin for htmlArea RTE
+ *
+ * @author Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
+ *
+ * TYPO3 SVN ID: $Id:$
+ *
+ */
+
+require_once(t3lib_extMgm::extPath('rtehtmlarea').'class.tx_rtehtmlareaapi.php');
+
+class tx_rtehtmlarea_typo3image extends tx_rtehtmlareaapi {
+
+       protected $extensionKey = 'rtehtmlarea';        // The key of the extension that is extending htmlArea RTE
+       protected $pluginName = 'TYPO3Image';           // The name of the plugin registered by the extension
+       protected $relativePathToLocallangFile = '';    // Path to this main locallang file of the extension relative to the extension dir.
+       protected $relativePathToSkin  = 'extensions/TYPO3Image/skin/htmlarea.css';     // Path to the skin (css) file relative to the extension dir.
+       protected $htmlAreaRTE;                         // Reference to the invoking object
+       protected $thisConfig;                          // Reference to RTE PageTSConfig
+       protected $toolbar;                             // Reference to RTE toolbar array
+       protected $LOCAL_LANG;                          // Frontend language array
+       
+       protected $pluginButtons = 'image';
+       protected $convertToolbarForHtmlAreaArray = array (
+               'image' => 'InsertImage',
+               );
+       
+       public function main($parentObject) {
+                       // Check if this should be enabled based on Page TSConfig
+               return parent::main($parentObject) && !$this->thisConfig['disableTYPO3Browsers'] 
+                               && !(is_array( $this->thisConfig['buttons.']) && is_array($this->thisConfig['buttons.']['image.']) && is_array($this->thisConfig['buttons.']['image.']['TYPO3Browser.']) && $this->thisConfig['buttons.']['image.']['TYPO3Browser.']['disabled']);
+       }
+       
+       /**
+        * Return JS configuration of the htmlArea plugins registered by the extension
+        *
+        * @param       integer         Relative id of the RTE editing area in the form
+        *
+        * @return      string          JS configuration for registered plugins, in this case, JS configuration of block elements
+        *
+        * The returned string will be a set of JS instructions defining the configuration that will be provided to the plugin(s)
+        * Each of the instructions should be of the form:
+        *      RTEarea['.$RTEcounter.']["buttons"]["button-id"]["property"] = "value";
+        */
+       public function buildJavascriptConfiguration($RTEcounter) {
+               
+               $registerRTEinJavascriptString = '';
+               $button = 'image';
+               if (in_array($button, $this->toolbar)) {
+                       if (!is_array( $this->thisConfig['buttons.']) || !is_array( $this->thisConfig['buttons.'][$button.'.'])) {
+                                       $registerRTEinJavascriptString .= '
+                       RTEarea['.$RTEcounter.']["buttons"]["'. $button .'"] = new Object();';
+                       }
+                       $registerRTEinJavascriptString .= '
+                       RTEarea['.$RTEcounter.'].buttons.'. $button .'.pathImageModule = "../../mod4/select_image.php";';
+               }
+               
+               return $registerRTEinJavascriptString;
+       }
+
+} // end of class
+
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/extensions/TYPO3Image/class.tx_rtehtmlarea_typo3image.php']) {
+       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/extensions/TYPO3Image/class.tx_rtehtmlarea_typo3image.php']);
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/rtehtmlarea/extensions/TYPO3Image/skin/htmlarea.css b/typo3/sysext/rtehtmlarea/extensions/TYPO3Image/skin/htmlarea.css
new file mode 100644 (file)
index 0000000..d398ff7
--- /dev/null
@@ -0,0 +1,4 @@
+/* Selectors for the TYPO3 Image plugin of htmlArea RTE */
+/* TYPO3 SVN ID: $Id:$ */
+.htmlarea .toolbar .Image {background-image:url("images/image.gif");}
+
diff --git a/typo3/sysext/rtehtmlarea/extensions/TYPO3Image/skin/images/image.gif b/typo3/sysext/rtehtmlarea/extensions/TYPO3Image/skin/images/image.gif
new file mode 100644 (file)
index 0000000..f32a4a7
Binary files /dev/null and b/typo3/sysext/rtehtmlarea/extensions/TYPO3Image/skin/images/image.gif differ
index 985c8be..437e391 100644 (file)
@@ -3,7 +3,7 @@
 *
 *  (c) 2002-2004, interactivetools.com, inc.
 *  (c) 2003-2004 dynarch.com
-*  (c) 2004-2007 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
+*  (c) 2004-2008 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -303,7 +303,6 @@ HTMLArea.Config = function () {
                HiliteColor:            ["Background Color", "ed_color_bg.gif",false, function(editor) {editor.execCommand("HiliteColor");}],
                InsertHorizontalRule:   ["Horizontal Rule", "ed_hr.gif",false, function(editor) {editor.execCommand("InsertHorizontalRule");}],
                CreateLink:             ["Insert Web Link", "ed_link.gif", false, function(editor) {editor.execCommand("CreateLink", true);}, "a", false, true],
-               InsertImage:            ["Insert/Modify Image", "ed_image.gif", false, function(editor) {editor.execCommand("InsertImage");}],
                InsertTable:            ["Insert Table", "insert_table.gif", false, function(editor) {editor.execCommand("InsertTable");}],
                HtmlMode:               ["Toggle HTML Source", "ed_html.gif", true, function(editor) {editor.execCommand("HtmlMode");}],
                SelectAll:              ["SelectAll", "", true, function(editor) {editor.execCommand("SelectAll");}, null, true, false],
@@ -656,7 +655,7 @@ HTMLArea.prototype.createButton = function (txt,tb_line,first_cell_on_line,label
                HTMLArea._addEvents(newObj["el"],["mouseover", "mouseout", "mousedown", "click"], HTMLArea.toolBarButtonHandler);
                
                newObj["el"].className += " " + txt;
-               if (this.plugins["TYPO3Browsers"] && (txt == "CreateLink" || txt == "InsertImage")) newObj["el"].className += "-TYPO3Browsers";
+               if (this.plugins["TYPO3Browsers"] && txt == "CreateLink") newObj["el"].className += "-TYPO3Browsers";
                
                newObj["created"] = true;
        }
@@ -1524,9 +1523,12 @@ HTMLArea.wordClean = function(ev) {
        while (HTMLArea.is_ie && owner.parentElement ) { // IE5.5 does not report any ownerDocument
                owner = owner.parentElement;
        }
-               // if we dropped an image dragged from the TYPO3 Browser, let's close the browser window
-       if (typeof(browserWin) != "undefined" && browserWin.close) browserWin.close();
-       window.setTimeout("HTMLArea.wordCleanLater(" + owner._editorNo + ", true);", 250);
+               // If we dropped an image dragged from the TYPO3 Image plugin, let's close the dialog window
+       if (typeof(HTMLArea.Dialog) != "undefined" && HTMLArea.Dialog.TYPO3Image) {
+                       HTMLArea.Dialog.TYPO3Image.close();
+       } else {
+               window.setTimeout("HTMLArea.wordCleanLater(" + owner._editorNo + ", true);", 250);
+       }
 };
 
 HTMLArea.prototype.forceRedraw = function() {
@@ -2023,104 +2025,6 @@ HTMLArea.prototype._createLink = function(link) {
 };
 
 /*
- * Get the insert image action function
- */
-HTMLArea.insertImageDialog = function(editor,image) {
-       return (function(param) {
-               if (!param || typeof(param.f_url) == "undefined") return false;
-               var img = image;
-               if (!img) {
-                       var sel = editor._getSelection();
-                       var range = editor._createRange(sel);
-                       editor._doc.execCommand("InsertImage",false,param.f_url);
-                       if (HTMLArea.is_ie) {
-                               img = range.parentElement();
-                               if(img.tagName.toLowerCase() != "img") img = img.previousSibling;
-                       } else {
-                               var sel = editor._getSelection();
-                               var range = editor._createRange(sel);
-                               img = range.startContainer;
-                               if (HTMLArea.is_opera) img = img.parentNode;
-                               img = img.lastChild;
-                               while(img && img.nodeName.toLowerCase() != "img") img = img.previousSibling;
-                       }
-               } else {
-                       img.src = param.f_url;
-               }
-
-               for (var field in param) {
-                       if (param.hasOwnProperty(field)) {
-                               var value = param[field];
-                               switch (field) {
-                                       case "f_alt"    : img.alt = value; break;
-                                       case "f_border" :
-                                               if (parseInt(value)) {
-                                                       img.style.borderWidth = parseInt(value)+"px";
-                                                       img.style.borderStyle = "solid";
-                                               } else {
-                                                       img.style.borderWidth = "";
-                                                       img.style.borderStyle = "none";
-                                               }
-                                               break;
-                                       case "f_align"  :
-                                               img.style.verticalAlign = value;
-                                               break;
-                                       case "f_vert"   :
-                                               if (parseInt(value)) {
-                                                       img.style.marginTop = parseInt(value)+"px";
-                                                       img.style.marginBottom = parseInt(value)+"px";
-                                               } else {
-                                                       img.style.marginTop = "";
-                                                       img.style.marginBottom = "";
-                                               }
-                                               break;
-                                       case "f_horiz"  :
-                                               if (parseInt(value)) {
-                                                       img.style.marginLeft = parseInt(value)+"px";
-                                                       img.style.marginRight = parseInt(value)+"px";
-                                               } else {
-                                                       img.style.marginLeft = "";
-                                                       img.style.marginRight = "";
-                                               }
-                                               break;
-                                       case "f_float"  :
-                                               if (HTMLArea.is_ie) img.style.styleFloat = value;
-                                                       else img.style.cssFloat = value;
-                                               break;
-                               }
-                       }
-               }
-               editor = null;
-               image = null;
-       });
-};
-
-/*
- * Called when the "InsertImage" button is clicked.
- * If an image is already there, it will just modify it's properties.
- */
-HTMLArea.prototype._insertImage = function(image) {
-       var outparam = null;
-       this.focusEditor();
-       if (typeof(image) == "undefined") {
-               var image = this.getParentElement();
-               if(image && !/^img$/i.test(image.tagName)) image = null;
-       }
-       if(image) outparam = {
-               f_base          : this.config.baseURL,
-               f_url           : image.getAttribute("src"),
-               f_alt           : image.alt,
-               f_border        : isNaN(parseInt(image.style.borderWidth))?"":parseInt(image.style.borderWidth),
-               f_align         : image.style.verticalAlign,
-               f_vert          : isNaN(parseInt(image.style.marginTop))?"":parseInt(image.style.marginTop),
-               f_horiz         : isNaN(parseInt(image.style.marginLeft))?"":parseInt(image.style.marginLeft),
-               f_float         : HTMLArea.is_ie ? image.style.styleFloat : image.style.cssFloat
-       };
-       var insertImageDialogFunctRef = HTMLArea.insertImageDialog(this, image);
-       this._popupDialog("insert_image.html", insertImageDialogFunctRef, outparam, 580, 460);
-};
-
-/*
  * Get the insert table action function
  */
 HTMLArea.insertTableDialog = function(editor, sel, range) {
@@ -2236,7 +2140,6 @@ HTMLArea.prototype.execCommand = function(cmdID, UI, param) {
                        else this._doc.execCommand(cmdID,UI,param);
                break;
            case "InsertTable"  : this._insertTable(); break;
-           case "InsertImage"  : this._insertImage(); break;
            case "About"        : this._popupDialog("about.html", null, this, 475, 350); break;
            case "CleanWord"    : HTMLArea._wordClean(this, this._doc.body); break;
            case "Cut"          :
@@ -3577,7 +3480,7 @@ HTMLArea.Plugin = HTMLArea.Base.extend({
         * @return      string          the localization of the label
         */
        localize : function (label) {
-               return this.I18N[label];
+               return HTMLArea.I18N.dialogs[label] || HTMLArea.I18N.tooltips[label] || this.I18N[label];
        },
        
        /**
@@ -3663,7 +3566,7 @@ HTMLArea.Plugin = HTMLArea.Base.extend({
         * @return      string          the url
         */
        makeUrlFromModulePath : function(modulePath, parameters) {
-               return this.editor.popupURL(modulePath + "?" + RTEarea[this.editorNumber]["RTEtsConfigParams"] + parameters);
+               return this.editor.popupURL(modulePath + "?" + RTEarea[this.editorNumber]["RTEtsConfigParams"] + "&editorNo=" + this.editorNumber + "&sys_language_content=" + this.editorConfiguration.sys_language_content + (parameters?parameters:''));
        },
        
        /**
index bdbe14b..3c4f282 100644 (file)
@@ -2,7 +2,7 @@
 *  Copyright notice
 *
 *  Copyright (c) 2003 dynarch.com. Authored by Mihai Bazon. Sponsored by www.americanbible.org.
-*  Copyright (c) 2004-2007 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
+*  Copyright (c) 2004-2008 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -76,9 +76,16 @@ ContextMenu.tableOperationsHandler = function(editor,tbo,opcode) {
        });
 };
 
-ContextMenu.imageHandler = function(editor,img) {
+ContextMenu.imageHandler = function(editor, currentTarget) {
        return (function() {
-               editor._insertImage(img);
+               var obj = editor._toolbarObjects["InsertImage"];
+               obj.cmd(editor, obj.name, currentTarget);
+               if (HTMLArea.is_opera) {
+                       editor._iframe.focus();
+               }
+               if (!editor.config.btnList[obj.name][7]) {
+                       editor.updateToolbar();
+               }
        });
 };
 
diff --git a/typo3/sysext/rtehtmlarea/htmlarea/plugins/DefaultImage/default-image.js b/typo3/sysext/rtehtmlarea/htmlarea/plugins/DefaultImage/default-image.js
new file mode 100644 (file)
index 0000000..99774fd
--- /dev/null
@@ -0,0 +1,233 @@
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2008 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
+*  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 script is a modified version of a script published under the htmlArea License.
+*  A copy of the htmlArea License may be found in the textfile HTMLAREA_LICENSE.txt.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+/*
+ * Image Plugin for TYPO3 htmlArea RTE
+ *
+ * TYPO3 SVN ID: $Id:$
+ */
+DefaultImage = HTMLArea.Plugin.extend({
+       
+       constructor : function(editor, pluginName) {
+               this.base(editor, pluginName);
+       },
+       
+       /*
+        * This function gets called by the class constructor
+        */
+       configurePlugin : function(editor) {
+               
+               this.baseURL = this.editorConfiguration.baseURL;
+               this.pageTSConfiguration = this.editorConfiguration.buttons.image;
+               if (this.pageTSConfiguration && this.pageTSConfiguration.properties && this.pageTSConfiguration.properties.removeItems) {
+                       this.removeItems = this.pageTSConfiguration.properties.removeItems.split(",");
+                               var layout = 0;
+                               var padding = 0;
+                               for (var i = 0, length = this.removeItems.length; i < length; ++i) {
+                                       this.removeItems[i] = this.removeItems[i].replace(/(?:^\s+|\s+$)/g, "");
+                                       if (/^(align|border|float)$/i.test(this.removeItems[i])) ++layout;
+                                       if (/^(paddingTop|paddingRight|paddingBottom|paddingLeft)$/i.test(this.removeItems[i])) ++padding;
+                               }
+                               if (layout == 3) this.removeItems[this.removeItems.length] = "layout";
+                               if (layout == 4) this.removeItems[this.removeItems.length] = "padding";
+               }
+               
+               /*
+                * Registering plugin "About" information
+                */
+               var pluginInformation = {
+                       version         : "1.0",
+                       developer       : "Stanislas Rolland",
+                       developerUrl    : "http://www.fructifor.ca/",
+                       copyrightOwner  : "Stanislas Rolland",
+                       sponsor         : "Fructifor Inc.",
+                       sponsorUrl      : "http://www.fructifor.ca/",
+                       license         : "GPL"
+               };
+               this.registerPluginInformation(pluginInformation);
+               
+               /*
+                * Registering the button
+                */
+               var buttonId = "InsertImage";
+               var buttonConfiguration = {
+                       id              : buttonId,
+                       tooltip         : this.localize("insertimage"),
+                       action          : "onButtonPress",
+                       dialog          : true
+               };
+               this.registerButton(buttonConfiguration);
+               
+               return true;
+        },
+        
+       /*
+        * This function gets called when the button was pressed.
+        *
+        * @param       object          editor: the editor instance
+        * @param       string          id: the button id or the key
+        * @param       object          target: the target element of the contextmenu event, when invoked from the context menu
+        *
+        * @return      boolean         false if action is completed
+        */
+       onButtonPress : function(editor, id, target) {
+               
+                       // Could be a button or its hotkey
+               var buttonId = this.translateHotKey(id);
+               buttonId = buttonId ? buttonId : id;
+               
+               var image, outparam = null;
+               this.editor.focusEditor();
+               
+               if (typeof(target) !== "undefined") {
+                       image = target;
+               } else {
+                       image = this.editor.getParentElement();
+               }
+               if (image && !/^img$/i.test(image.nodeName)) {
+                       image = null;
+               }
+               if (image) {
+                       outparam = {
+                               f_base          : this.baseURL,
+                               f_url           : image.getAttribute("src"),
+                               f_alt           : image.alt,
+                               f_border        : isNaN(parseInt(image.style.borderWidth)) ? "" : parseInt(image.style.borderWidth),
+                               f_align         : image.style.verticalAlign,
+                               f_top           : isNaN(parseInt(image.style.paddingTop)) ? "" : parseInt(image.style.paddingTop),
+                               f_right         : isNaN(parseInt(image.style.paddingRight)) ? "" : parseInt(image.style.paddingRight),
+                               f_bottom        : isNaN(parseInt(image.style.paddingBottom)) ? "" : parseInt(image.style.paddingBottom),
+                               f_left          : isNaN(parseInt(image.style.paddingLeft)) ? "" : parseInt(image.style.paddingLeft),
+                               f_float         : HTMLArea.is_ie ? image.style.styleFloat : image.style.cssFloat
+                       };
+               }
+               this.image = image;
+               
+               this.dialog = this.openDialog("InsertImage", this.makeUrlFromPopupName("insert_image"), "insertImage", outparam, {width:580, height:495});
+               return false;
+       },
+       
+       /*
+        * Insert the image
+        *
+        * @param       object          param: the returned values
+        *
+        * @return      boolean         false
+        */
+       insertImage : function(param) {
+               if (typeof(param) != "undefined" && typeof(param.f_url) != "undefined") {
+                       this.editor.focusEditor();
+                       var image = this.image;
+                       if (!image) {
+                               var selection = this.editor._getSelection();
+                               var range = this.editor._createRange(selection);
+                               this.editor._doc.execCommand("InsertImage", false, param.f_url);
+                               if (HTMLArea.is_ie) {
+                                       image = range.parentElement();
+                                       if (!/^img$/i.test(image.nodeName)) {
+                                               image = image.previousSibling;
+                                       }
+                               } else {
+                                       var selection = this.editor._getSelection();
+                                       var range = this.editor._createRange(selection);
+                                       image = range.startContainer;
+                                       if (HTMLArea.is_opera) {
+                                               image = image.parentNode;
+                                       }
+                                       image = image.lastChild;
+                                       while(image && !/^img$/i.test(image.nodeName)) {
+                                               image = image.previousSibling;
+                                       }
+                               }
+                       } else {
+                               image.src = param.f_url;
+                       }
+                       
+                       for (var field in param) {
+                               if (param.hasOwnProperty(field)) {
+                                       var value = param[field];
+                                       switch (field) {
+                                               case "f_alt"    :
+                                                       image.alt = value;
+                                                       break;
+                                               case "f_border" :
+                                                       if (parseInt(value)) {
+                                                               image.style.borderWidth = parseInt(value)+"px";
+                                                               image.style.borderStyle = "solid";
+                                                       } else {
+                                                               image.style.borderWidth = "";
+                                                               image.style.borderStyle = "none";
+                                                       }
+                                                       break;
+                                               case "f_align"  :
+                                                       image.style.verticalAlign = value;
+                                                       break;
+                                               case "f_top"   :
+                                                       if (parseInt(value)) {
+                                                               image.style.paddingTop = parseInt(value)+"px";
+                                                       } else {
+                                                               image.style.paddingTop = "";
+                                                       }
+                                                       break;
+                                               case "f_right"  :
+                                                       if (parseInt(value)) {
+                                                               image.style.paddingRight = parseInt(value)+"px";
+                                                       } else {
+                                                               image.style.paddingRight = "";
+                                                       }
+                                                       break;
+                                               case "f_bottom"   :
+                                                       if (parseInt(value)) {
+                                                               image.style.paddingBottom = parseInt(value)+"px";
+                                                       } else {
+                                                               image.style.paddingBottom = "";
+                                                       }
+                                                       break;
+                                               case "f_left"  :
+                                                       if (parseInt(value)) {
+                                                               image.style.paddingLeft = parseInt(value)+"px";
+                                                       } else {
+                                                               image.style.paddingLeft = "";
+                                                       }
+                                                       break;
+                                               case "f_float"  :
+                                                       if (HTMLArea.is_ie) {
+                                                               image.style.styleFloat = value;
+                                                       } else {
+                                                               image.style.cssFloat = value;
+                                                       }
+                                                       break;
+                                       }
+                               }
+                       }
+                       this.dialog.close();
+               }
+               return false;
+       }
+});
+
diff --git a/typo3/sysext/rtehtmlarea/htmlarea/plugins/DefaultImage/locallang.xml b/typo3/sysext/rtehtmlarea/htmlarea/plugins/DefaultImage/locallang.xml
new file mode 100644 (file)
index 0000000..89aa064
--- /dev/null
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<!-- TYPO3 SVN ID: $Id:$ -->
+<T3locallang>
+       <meta type="array">
+               <description>Labels for Image plugin of htmlArea RTE</description>
+               <type>module</type>
+       </meta>
+       <data type="array">
+               <languageKey index="default" type="array">
+                       <label index="Top padding">Top padding</label>
+                       <label index="Right padding">Right padding</label>
+                       <label index="Bottom padding">Bottom padding</label>
+                       <label index="Left padding">Left padding</label>
+                       <label index="Top:">Top:</label>
+                       <label index="Right:">Right:</label>
+                       <label index="Bottom:">Bottom:</label>
+                       <label index="Left:">Left:</label>
+               </languageKey>
+       </data>
+       <orig_hash type="array">
+               <languageKey index="default" type="array">
+               </languageKey>
+       </orig_hash>
+       <orig_text type="array">
+               <languageKey index="default" type="array">
+               </languageKey>
+       </orig_text>
+</T3locallang>
\ No newline at end of file
diff --git a/typo3/sysext/rtehtmlarea/htmlarea/plugins/DefaultImage/popups/insert_image.html b/typo3/sysext/rtehtmlarea/htmlarea/plugins/DefaultImage/popups/insert_image.html
new file mode 100644 (file)
index 0000000..7e237ae
--- /dev/null
@@ -0,0 +1,197 @@
+<!--
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2002-2004, interactivetools.com, inc.
+*  (c) 2003-2004 dynarch.com
+*  (c) 2004-2008 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
+*  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 script is a modified version of a script published under the htmlArea License.
+*  A copy of the htmlArea License may be found in the textfile HTMLAREA_LICENSE.txt.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+/*
+ * Insert Image window for TYPO3 htmlArea RTE
+ *
+ * TYPO3 CVS ID: $Id:$
+ */
+-->
+<html class="popupwin">
+<head>
+       <title>Insert Image</title>
+       <meta http-equiv="Content-Style-Type" content="text/css" />
+       <script type="text/javascript">
+               /*<![CDATA[*/
+               <!--
+               var dialog = window.opener.HTMLArea.Dialog["DefaultImage"];
+               function Init() {
+                       dialog.initialize(false, true);
+                       if (dialog.plugin.removeItems) {
+                               var items = dialog.plugin.removeItems;
+                               for (var i = 0, length = items.length; i < length; ++i) {
+                                       if (document.getElementById(items[i])) document.getElementById(items[i]).style.display = "none";
+                               }
+                       }
+                       var param = dialog.arguments;
+                       if (param) {
+                               document.getElementById("f_url").value = param["f_url"];
+                               document.getElementById("f_alt").value = param["f_alt"];
+                               document.getElementById("f_border").value = param["f_border"];
+                               var select = document.getElementById("f_align");
+                               for (var i = select.options.length; --i >= 0;) {
+                                       if (param["f_align"] == select.options[i].value) {
+                                               select.selectedIndex = i;
+                                               break;
+                                       }
+                               }
+                               document.getElementById("f_top").value = param["f_top"];
+                               document.getElementById("f_right").value = param["f_right"];
+                               document.getElementById("f_bottom").value = param["f_bottom"];
+                               document.getElementById("f_left").value = param["f_left"];
+                               var select = document.getElementById("f_float");
+                               for (var i = select.options.length; --i >= 0;) {
+                                       if (param["f_float"] == select.options[i].value) {
+                                               select.selectedIndex = i;
+                                               break;
+                                       }
+                               }
+                               window.ipreview.location.replace(param.f_url);
+                       }
+                       dialog.resize();
+                       document.getElementById("f_url").focus();
+                       return false;
+               };
+               
+               function onOK() {
+                       var required = { "f_url": "image_url_required" };
+                       for (var i in required) {
+                               var el = document.getElementById(i);
+                               if (!el.value) {
+                                       alert(dialog.plugin.localize(required[i]));
+                                       el.focus();
+                                       return false;
+                               }
+                       }
+                               // pass data back to the calling window
+                       var fields = ["f_url", "f_alt", "f_align", "f_border", "f_top", "f_right", "f_bottom", "f_left", "f_float"];
+                       var param = new Object();
+                       for (var i in fields) {
+                               var id = fields[i];
+                               var el = document.getElementById(id);
+                               param[id] = el.value;
+                       }
+                       dialog.performAction(param);
+                       return false;
+               };
+               
+               function onCancel() {
+                       dialog.close();
+                       return false;
+               };
+               
+               function onPreview() {
+                       var f_url = document.getElementById("f_url");
+                       var url = f_url.value;
+                       if (!url) {
+                               alert(dialog.plugin.localize("image_url_first"));
+                               f_url.focus();
+                               return false;
+                       }
+                       window.ipreview.location.replace(url);
+                       return false;
+               };
+               // -->
+               /*]]>*/
+       </script>
+</head>
+<body class="popupwin" onload="Init();">
+<div class="title">Insert Image</div>
+<form action="" method="get">
+       <label for="f_url" class="field">Image URL:</label>
+       <input type="text" id="f_url" name="url" size="65" title="Enter the image URL here" />
+       <button name="preview" onclick="return onPreview();" title="Preview the image in a new window">Preview</button>
+       <div class="space"></div>
+       <div id="alt">
+               <label for="f_alt" class="field">Alternate text:</label>
+               <input type="text" name="alt" id="f_alt" size="80" title="For browsers that dont support images" />
+       </div>
+       <div class="space"></div>
+       <fieldset id="layout" class="floating">
+               <legend>Layout</legend>
+               <ul>
+                       <li id="align">
+                               <label for="f_align" class="fl">Image alignment:</label>
+                               <select class="alignment" size="1" name="align" id="f_align" title="Positioning of this image">
+                                       <option value="bottom">Bottom</option>
+                                       <option value="middle" selected="selected">Middle</option>
+                                       <option value="top">Top</option>
+                               </select>
+                       </li>
+                       <li id="border">
+                               <label for="f_border" class="fl">Border thickness:</label>
+                               <input type="text" name="border" id="f_border" size="5" title="Leave empty for no border" />
+                       </li>
+                       <li id="float">
+                               <label for="f_float" class="fl">Float:</label>   
+                               <select class="float" size="1" name="style" id="f_float" title="Where the image should float">   
+                                       <option value="none">Non-floating</option>
+                                       <option value="left">Left</option>
+                                       <option value="right">Right</option>
+                               </select>
+                       </li>
+               </ul>
+       </fieldset>
+       <fieldset id="padding">
+               <legend>Spacing and padding</legend>
+               <ul>
+                       <li id="paddingTop">
+                               <label for="f_top" class="fl">Top:</label>
+                               <input type="text" name="f_top" id="f_top" size="5" title="Top padding" />
+                       </li>
+                       <li id="paddingRight">
+                               <label for="f_right" class="fl">Right:</label>
+                               <input type="text" name="f_right" id="f_right" size="5" title="Right padding" />
+                       </li>
+                       <li id="paddingBottom">
+                               <label for="f_bottom" class="fl">Bottom:</label>
+                               <input type="text" name="f_bottom" id="f_bottom" size="5" title="Bottom padding" />
+                       </li>
+                       <li id="paddingLeft">
+                               <label for="f_left" class="fl">Left:</label>
+                               <input type="text" name="f_left" id="f_left" size="5" title="Left padding" />
+                       </li>
+               </ul>
+       </fieldset>
+       <div class="space" style="clear: both;"></div>
+       <fieldset>
+               <legend>Image Preview</legend>
+                       <div class="imagepreview">
+                               <iframe name="ipreview" id="ipreview" frameborder="0" src="";></iframe>
+                       </div>
+       </fieldset>
+       <div class="buttons">
+               <button type="button" name="ok" onclick="return onOK();">OK</button>
+               <button type="button" name="cancel" onclick="return onCancel();">Cancel</button>
+       </div>
+</form>
+</body>
+</html>
index af32879..fb5941d 100644 (file)
@@ -32,7 +32,6 @@
 TYPO3Browsers = function(editor,args) {
        this.editor = editor;
        var cfg = this.editor.config;
-       cfg.btnList.InsertImage[1] = this.editor.imgURL("ed_image.gif", "TYPO3Browsers");
        cfg.btnList.CreateLink[1] = this.editor.imgURL("ed_link.gif", "TYPO3Browsers");
 };
 
@@ -50,37 +49,6 @@ TYPO3Browsers._pluginInfo = {
 };
 
 /*
- *  Insert Image TYPO3 RTE function.
- */
-HTMLArea.prototype.renderPopup_image = function() {
-       var editorNumber = this._editorNumber,
-               backreturn,
-               addParams = "?" + RTEarea[editorNumber]["RTEtsConfigParams"],
-               image = this.getParentElement();
-               
-       this._selectedImage = null;
-       if (image && image.tagName.toLowerCase() == "img") {
-               addParams = "?act=image" + RTEarea[editorNumber]["RTEtsConfigParams"];
-               this._selectedImage = image;
-       }
-       
-       this._popupDialog(RTEarea[0]["pathImageModule"] + addParams + "&editorNo=" + editorNumber + "&sys_language_content=" + RTEarea[editorNumber]["sys_language_content"], null, backreturn, 550, 350, null, "yes");
-       return false;
-};
-
-/*
- * Insert the Image.
- * This function is called from the typo3-image-popup.
- */
-HTMLArea.prototype.renderPopup_insertImage = function(image) {
-       this.focusEditor();
-       this.insertHTML(image);
-       this._selectedImage = null;
-       Dialog._modal.close();
-       this.updateToolbar();
-};
-
-/*
  *  CreateLink: Typo3-RTE function, use this instead of the original.
  */
 HTMLArea.prototype.renderPopup_link = function() {
@@ -303,7 +271,7 @@ HTMLArea.prototype.nonStripBaseURL = function(url) {
 
 TYPO3Browsers.prototype.onGenerate = function() {
        var editor = this.editor;
-       editor._insertImage = editor.renderPopup_image;
+       //editor._insertImage = editor.renderPopup_image;
        editor._createLink = editor.renderPopup_link;
        editor.stripBaseURL = editor.nonStripBaseURL;
 };
diff --git a/typo3/sysext/rtehtmlarea/htmlarea/plugins/TYPO3Image/locallang.xml b/typo3/sysext/rtehtmlarea/htmlarea/plugins/TYPO3Image/locallang.xml
new file mode 100644 (file)
index 0000000..08ecff2
--- /dev/null
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<!-- TYPO3 SVN ID: $Id:$ -->
+<T3locallang>
+       <meta type="array">
+               <description>Labels for TYPO3 Image plugin of htmlArea RTE</description>
+               <type>module</type>
+       </meta>
+       <data type="array">
+               <languageKey index="default" type="array">
+                       <label index="InsertImage-Tooltip">Insert/modify image</label>
+               </languageKey>
+       </data>
+       <orig_hash type="array">
+               <languageKey index="default" type="array">
+               </languageKey>
+       </orig_hash>
+       <orig_text type="array">
+               <languageKey index="default" type="array">
+               </languageKey>
+       </orig_text>
+</T3locallang>
\ No newline at end of file
diff --git a/typo3/sysext/rtehtmlarea/htmlarea/plugins/TYPO3Image/typo3image.js b/typo3/sysext/rtehtmlarea/htmlarea/plugins/TYPO3Image/typo3image.js
new file mode 100644 (file)
index 0000000..2fd67b0
--- /dev/null
@@ -0,0 +1,116 @@
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2005-2008 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
+*  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!
+***************************************************************/
+/*
+ * TYPO3Image plugin for htmlArea RTE
+ *
+ * TYPO3 CVS ID: $Id:$
+ */
+TYPO3Image = HTMLArea.Plugin.extend({
+       
+       constructor : function(editor, pluginName) {
+               this.base(editor, pluginName);
+       },
+       
+       /*
+        * This function gets called by the class constructor
+        */
+       configurePlugin : function(editor) {
+               
+               this.pageTSConfiguration = this.editorConfiguration.buttons.image;
+               this.imageModulePath = this.pageTSConfiguration.pathImageModule;
+               
+               /*
+                * Registering plugin "About" information
+                */
+               var pluginInformation = {
+                       version         : "1.0",
+                       developer       : "Stanislas Rolland",
+                       developerUrl    : "http://www.fructifor.ca/",
+                       copyrightOwner  : "Stanislas Rolland",
+                       sponsor         : "Fructifor Inc.",
+                       sponsorUrl      : "http://www.fructifor.ca/",
+                       license         : "GPL"
+               };
+               this.registerPluginInformation(pluginInformation);
+               
+               /*
+                * Registering the button
+                */
+               var buttonId = "InsertImage";
+               var buttonConfiguration = {
+                       id              : buttonId,
+                       tooltip         : this.localize(buttonId + "-Tooltip"),
+                       action          : "onButtonPress",
+                       dialog          : true
+               };
+               this.registerButton(buttonConfiguration);
+               
+               return true;
+        },
+        
+       /*
+        * This function gets called when the button was pressed
+        *
+        * @param       object          editor: the editor instance
+        * @param       string          id: the button id or the key
+        * @param       object          target: the target element of the contextmenu event, when invoked from the context menu
+        *
+        * @return      boolean         false if action is completed
+        */
+       onButtonPress : function(editor, id, target) {
+                       // Could be a button or its hotkey
+               var buttonId = this.translateHotKey(id);
+               buttonId = buttonId ? buttonId : id;
+               
+               var additionalParameter;
+               if (typeof(target) !== "undefined") {
+                       this.image = target;
+               } else {
+                       this.image = this.editor.getParentElement();
+               }
+               if (this.image && !/^img$/i.test(this.image.nodeName)) {
+                       this.image = null;
+               }
+               if (this.image) {
+                       additionalParameter = "&act=image";
+               }
+               
+               this.dialog = this.openDialog("InsertImage", this.makeUrlFromModulePath(this.imageModulePath, additionalParameter), null, null, {width:550, height:350}, "yes");
+               return false;
+       },
+       
+       /*
+        * Insert the image
+        * This function is called from the typo3-image-popup
+        */
+       insertImage : function(image) {
+               this.editor.focusEditor();
+               this.editor.insertHTML(image);
+               this.dialog.close();
+       }
+});
+
index 75cb584..56eaece 100644 (file)
@@ -3,7 +3,7 @@
 *  Copyright notice
 *
 *  (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com)
-*  (c) 2004-2006 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
+*  (c) 2004-2008 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -49,8 +49,12 @@ class tx_rtehtmlarea_dam_browse_media extends tx_dam_browse_media {
        var $content;
        var $act;
        var $allowedItems;
+       var $removedProperties = array();
+       var $defaultClass;
        var $plainMaxWidth;
        var $plainMaxHeight;
+       var $lockPlainWidth;
+       var $lockPlainHeight;
        var $magicMaxWidth;
        var $magicMaxHeight;
        var $imgPath;
@@ -58,6 +62,7 @@ class tx_rtehtmlarea_dam_browse_media extends tx_dam_browse_media {
        var $classesImageJSOptions;
        var $editorNo;
        var $sys_language_content;
+       var $thisConfig;
        var $buttonConfig = array();
        
        /**
@@ -162,9 +167,35 @@ class tx_rtehtmlarea_dam_browse_media extends tx_dam_browse_media {
                
                if (is_array($this->thisConfig['buttons.']) && is_array($this->thisConfig['buttons.']['image.'])) {
                        $this->buttonConfig = $this->thisConfig['buttons.']['image.'];
+                       t3lib_div::loadTCA('tx_dam');
+                       if (is_array($this->buttonConfig['title.']) && is_array($TCA['tx_dam']['columns'][$this->buttonConfig['title.']['useDAMColumn']])) {
+                               $this->imgTitleDAMColumn = $this->buttonConfig['title.']['useDAMColumn'];
+                       }
+                       if (is_array($this->buttonConfig['properties.'])) {
+                               if ($this->buttonConfig['properties.']['removeItems']) {
+                                       $this->removedProperties = t3lib_div::trimExplode(',',$this->buttonConfig['properties.']['removeItems'],1);
+                               }
+                               if (is_array($this->buttonConfig['properties.']['class.']) && trim($this->buttonConfig['properties.']['class.']['default'])) {
+                                       $this->defaultClass = trim($this->buttonConfig['properties.']['class.']['default']);
+                               }
+                       }
+               }
+               
+               if (is_array($this->thisConfig['proc.']) && $this->thisConfig['proc.']['plainImageMode']) {
+                       $plainImageMode = $this->thisConfig['proc.']['plainImageMode'];
+                       $this->lockPlainWidth = ($plainImageMode == 'lockDimensions')?'true':'false';
+                       $this->lockPlainHeight = ($this->lockPlainWidth || $plainImageMode == 'lockRatio' || ($plainImageMode == 'lockRatioWhenSmaller'))?'true':'false';
                }
                
-               $this->allowedItems = explode(',','magic,plain,dragdrop,image,upload');
+               if (!$this->imgTitleDAMColumn) {
+                       $this->imgTitleDAMColumn = 'caption';
+               }
+
+               $this->allowedItems = explode(',','magic,plain,image,upload');
+               $clientInfo = t3lib_div::clientInfo();
+               if ($clientInfo['BROWSER'] !== 'opera') {
+                       $this->allowedItems[] = 'dragdrop';
+               }
                if (is_array($this->buttonConfig['options.']) && $this->buttonConfig['options.']['removeItems']) {
                        $this->allowedItems = array_diff($this->allowedItems,t3lib_div::trimExplode(',',$this->buttonConfig['options.']['removeItems'],1));
                } else {
@@ -198,8 +229,7 @@ class tx_rtehtmlarea_dam_browse_media extends tx_dam_browse_media {
                if ($this->thisConfig['classesImage']) {
                        $classesImageArray = t3lib_div::trimExplode(',',$this->thisConfig['classesImage'],1);
                        $this->classesImageJSOptions = '<option value=""></option>';
-                       reset($classesImageArray);
-                       while(list(,$class)=each($classesImageArray)) {
+                       foreach ($classesImageArray as $class) {
                                $this->classesImageJSOptions .= '<option value="' .$class . '">' . $class . '</option>';
                        }
                }
@@ -219,7 +249,7 @@ class tx_rtehtmlarea_dam_browse_media extends tx_dam_browse_media {
                $this->doc->docType= 'xhtml_trans';
                $this->doc->backPath = $BACK_PATH;
                
-               $this->getJSCode();
+               //$this->getJSCode();
        }
 
        /**
@@ -248,12 +278,6 @@ class tx_rtehtmlarea_dam_browse_media extends tx_dam_browse_media {
                        $imgObj->mayScaleUp=0;
                        $imgObj->tempPath=PATH_site.$imgObj->tempPath;
                        $imgInfo = $imgObj->getImageDimensions($filepath);
-                       
-                       t3lib_div::loadTCA('tx_dam');
-                       if (is_array($this->buttonConfig['title.']) && is_array($TCA['tx_dam']['columns'][$this->buttonConfig['title.']['useDAMColumn']])) {
-                               $this->imgTitleDAMColumn = $this->buttonConfig['title.']['useDAMColumn'];
-                       }
-                       if (!$this->imgTitleDAMColumn) $this->imgTitleDAMColumn = 'caption';
                        $imgMetaData = tx_dam::meta_getDataForFile($filepath,'uid,pid,alt_text,hpixels,vpixels,'.$this->imgTitleDAMColumn.','.$TCA['tx_dam']['ctrl']['languageField']);
                        $imgMetaData = $this->getRecordOverlay('tx_dam',$imgMetaData,$this->sys_language_content);
                        
@@ -266,6 +290,9 @@ class tx_rtehtmlarea_dam_browse_media extends tx_dam_browse_media {
                                                $destPath =PATH_site.$this->rteImageStorageDir();
                                                if (@is_dir($destPath)) {
                                                        $destName = $fileFunc->getUniqueName($basename,$destPath);
+                                                       if (isset($TYPO3_CONF_VARS['BE']['fileCreateMask'])) {
+                                                               @chmod($destName, $TYPO3_CONF_VARS['BE']['fileCreateMask']);
+                                                       }
                                                        @copy($imgInfo[3],$destName);
                                                        
                                                        $cWidth = t3lib_div::intInRange(t3lib_div::_GP('cWidth'),0,$this->magicMaxWidth);
@@ -278,6 +305,9 @@ class tx_rtehtmlarea_dam_browse_media extends tx_dam_browse_media {
                                                                $fI=pathinfo($imgI[3]);
                                                                $mainBase='RTEmagicC_'.substr(basename($destName),10).'.'.$fI['extension'];
                                                                $destName = $fileFunc->getUniqueName($mainBase,$destPath);
+                                                               if (isset($TYPO3_CONF_VARS['BE']['fileCreateMask'])) {
+                                                                       @chmod($destName, $TYPO3_CONF_VARS['BE']['fileCreateMask']);
+                                                               }
                                                                @copy($imgI[3],$destName);
                                                                $iurl = $this->siteUrl.substr($destName,strlen(PATH_site));
                                                                $this->imageInsertJS($iurl,$imgI[0],$imgI[1],$imgMetaData['alt_text'],$imgMetaData[$this->imgTitleDAMColumn],substr($imgInfo[3],strlen(PATH_site)));
@@ -306,32 +336,19 @@ class tx_rtehtmlarea_dam_browse_media extends tx_dam_browse_media {
 <head>
        <title>Untitled</title>
 </head>
-<script language="javascript" type="text/javascript">
+<script type="text/javascript">
 /*<![CDATA[*/
-       var editor = window.opener.RTEarea[' . $this->editorNo . ']["editor"];
-       var HTMLArea = window.opener.HTMLArea;
-       function insertImage(file,width,height,alt,title,origFile)      {
-               var styleWidth, styleHeight;
-               styleWidth = parseInt(width);
-               if (isNaN(styleWidth) || styleWidth == 0) {
-                       styleWidth = "auto";
-               } else {
-                       styleWidth += "px";
-               }
-               styleHeight = parseInt(height);
-               if (isNaN(styleHeight) || styleHeight == 0) {
-                       styleHeight = "auto";
-               } else {
-                       styleHeight += "px";
-               }
-               editor.renderPopup_insertImage(\'<img src="\'+file+\'" alt="\'+alt+\'" title="\'+title+\'" style="width: \'+styleWidth+\'; height: \'+styleHeight+\';"'.(($TYPO3_CONF_VARS['EXTCONF'][$this->extKey]['enableClickEnlarge'] && !(is_array($this->buttonConfig['clickEnlarge.']) && $this->buttonConfig['clickEnlarge.']['disabled']))?' clickenlargesrc="\'+origFile+\'" clickenlarge="0"':'').' />\');
+       var dialog = window.opener.HTMLArea.Dialog["TYPO3Image"];
+       var plugin = dialog.plugin;
+       function insertImage(file,width,height,alt,title)       {
+               plugin.insertImage(\'<img src="\'+file+\'"'  . ($this->defaultClass?(' class="'.$this->defaultClass.'"'):'') . ' alt="\'+alt+\'" title="\'+title+\'" width="\'+parseInt(width)+\'" height="\'+parseInt(height)+\'" />\');
        }
 /*]]>*/
 </script>
 <body>
 <script type="text/javascript">
 /*<![CDATA[*/
-       insertImage('.t3lib_div::quoteJSvalue($url,1).','.$width.','.$height.','.t3lib_div::quoteJSvalue($altText,1).','.t3lib_div::quoteJSvalue($titleText,1).','.t3lib_div::quoteJSvalue($origFile,1).');
+       insertImage('.t3lib_div::quoteJSvalue($url,1).','.$width.','.$height.','.t3lib_div::quoteJSvalue($altText,1).','.t3lib_div::quoteJSvalue($titleText,1).');
 /*]]>*/
 </script>
 </body>
@@ -345,14 +362,15 @@ class tx_rtehtmlarea_dam_browse_media extends tx_dam_browse_media {
         */
        function getJSCode()    {
                global $LANG,$BACK_PATH,$TYPO3_CONF_VARS;
-
+               
                $JScode='
-                       var editor = window.opener.RTEarea[' . $this->editorNo . ']["editor"];
+                       var dialog = window.opener.HTMLArea.Dialog["TYPO3Image"];
+                       var plugin = dialog.plugin;
                        var HTMLArea = window.opener.HTMLArea;
                        function insertElement(table, uid, type, filename,fp,filetype,imagefile,action, close)  {
                                return jumpToUrl(\''.$this->thisScript.'?act='.$this->act.'&mode='.$this->mode.'&bparams='.$this->bparams.'&insertImage='.'\'+fp);
                        }
-                       function jumpToUrl(URL,anchor)  {       //
+                       function jumpToUrl(URL,anchor)  {
                                var add_act = URL.indexOf("act=")==-1 ? "&act='.$this->act.'" : "";
                                var add_editorNo = URL.indexOf("editorNo=")==-1 ? "&editorNo='.$this->editorNo.'" : "";
                                var add_sys_language_content = URL.indexOf("sys_language_content=")==-1 ? "&sys_language_content='.$this->sys_language_content.'" : "";
@@ -373,31 +391,49 @@ class tx_rtehtmlarea_dam_browse_media extends tx_dam_browse_media {
                                }
                        }
                        function getCurrentImageRef() {
-                               if (editor._selectedImage) {
-                                       return editor._selectedImage;
+                               if (plugin.image) {
+                                       return plugin.image;
                                } else {
                                        return null;
                                }
                        }
                        function printCurrentImageOptions() {
                                var classesImage = ' . ($this->thisConfig['classesImage']?'true':'false') . ';
-                               if(classesImage) var styleSelector=\'<select name="iClass" style="width:140px;">' . $this->classesImageJSOptions  . '</select>\';
-                               var floatSelector=\'<select name="iFloat" id="iFloat"><option value="">' . $LANG->getLL('notSet') . '</option><option value="none">' . $LANG->getLL('nonFloating') . '</option><option value="left">' . $LANG->getLL('left') . '</option><option value="right">' . $LANG->getLL('right') . '</option></select>\';
+                               if (classesImage) var styleSelector=\'<select id="iClass" name="iClass" style="width:140px;">' . $this->classesImageJSOptions  . '</select>\';
+                               var floatSelector=\'<select id="iFloat" name="iFloat"><option value="">' . $LANG->getLL('notSet') . '</option><option value="none">' . $LANG->getLL('nonFloating') . '</option><option value="left">' . $LANG->getLL('left') . '</option><option value="right">' . $LANG->getLL('right') . '</option></select>\';
                                var bgColor=\' class="bgColor4"\';
                                var sz="";
                                sz+=\'<table border=0 cellpadding=1 cellspacing=1><form action="" name="imageData">\';
+                               '.(in_array('class', $this->removedProperties)?'':'
                                if(classesImage) {
-                                       sz+=\'<tr><td\'+bgColor+\'>'.$LANG->getLL('class').': </td><td>\'+styleSelector+\'</td></tr>\';
-                               }
-                               sz+=\'<tr><td\'+bgColor+\'><label for="iWidth">'.$LANG->getLL('width').': </label></td><td><input type="text" name="iWidth" id="iWidth" value=""'.$GLOBALS['TBE_TEMPLATE']->formWidth(4).' /></td></tr>\';
-                               sz+=\'<tr><td\'+bgColor+\'><label for="iHeight">'.$LANG->getLL('height').': </label></td><td><input type="text" name="iHeight" id="iHeight" value=""'.$GLOBALS['TBE_TEMPLATE']->formWidth(4).' /></td></tr>\';
-                               sz+=\'<tr><td\'+bgColor+\'><label for="iBorder">'.$LANG->getLL('border').': </label></td><td><input type="checkbox" name="iBorder" id="iBorder" value="1" /></td></tr>\';
-                               sz+=\'<tr><td\'+bgColor+\'><label for="iFloat">'.$LANG->getLL('float').': </label></td><td>\'+floatSelector+\'</td></tr>\';
-                               sz+=\'<tr><td\'+bgColor+\'><label for="iHspace">'.$LANG->getLL('margin_lr').': </label></td><td><input type="text" name="iHspace" id="iHspace" value=""'.$GLOBALS['TBE_TEMPLATE']->formWidth(4).'></td></tr>\';
-                               sz+=\'<tr><td\'+bgColor+\'><label for="iVspace">'.$LANG->getLL('margin_tb').': </label></td><td><input type="text" name="iVspace" id="iVspace" value=""'.$GLOBALS['TBE_TEMPLATE']->formWidth(4).' /></td></tr>\';
-                               sz+=\'<tr><td\'+bgColor+\'><label for="iTitle">'.$LANG->getLL('title').': </label></td><td><input type="text" name="iTitle" id="iTitle"'.$GLOBALS['TBE_TEMPLATE']->formWidth(20).' /></td></tr>\';
-                               sz+=\'<tr><td\'+bgColor+\'><label for="iAlt">'.$LANG->getLL('alt').': </label></td><td><input type="text" name="iAlt" id="iAlt"'.$GLOBALS['TBE_TEMPLATE']->formWidth(20).' /></td></tr>\';
-                               '.(($TYPO3_CONF_VARS['EXTCONF'][$this->extKey]['enableClickEnlarge'] && !(is_array($this->buttonConfig['clickEnlarge.']) && $this->buttonConfig['clickEnlarge.']['disabled']))?'if (selectedImageRef && selectedImageRef.getAttribute("clickenlargesrc")) sz+=\'<tr><td\'+bgColor+\'><label for="iClickEnlarge">'.$LANG->sL('LLL:EXT:cms/locallang_ttc.php:image_zoom',1).' </label></td><td><input type="checkbox" name="iClickEnlarge" id="iClickEnlarge" value="1" /></td></tr>\';':'').'
+                                       sz+=\'<tr><td\'+bgColor+\'><label for="iClass">'.$LANG->getLL('class').': </label></td><td>\'+styleSelector+\'</td></tr>\';
+                               }')
+                               .(in_array('width', $this->removedProperties)?'':'
+                               if (!(selectedImageRef && selectedImageRef.src.indexOf("RTEmagic") == -1 && '. $this->lockPlainWidth .')) {
+                                       sz+=\'<tr><td\'+bgColor+\'><label for="iWidth">'.$LANG->getLL('width').': </label></td><td><input type="text" id="iWidth" name="iWidth" value=""'.$GLOBALS['TBE_TEMPLATE']->formWidth(4).' /></td></tr>\';
+                               }')
+                               .(in_array('height', $this->removedProperties)?'':'
+                               if (!(selectedImageRef && selectedImageRef.src.indexOf("RTEmagic") == -1 && '. $this->lockPlainHeight .')) {
+                                       sz+=\'<tr><td\'+bgColor+\'><label for="iHeight">'.$LANG->getLL('height').': </label></td><td><input type="text" id="iHeight" name="iHeight" value=""'.$GLOBALS['TBE_TEMPLATE']->formWidth(4).' /></td></tr>\';
+                               }')
+                               .(in_array('border', $this->removedProperties)?'':'
+                               sz+=\'<tr><td\'+bgColor+\'><label for="iBorder">'.$LANG->getLL('border').': </label></td><td><input type="checkbox" id="iBorder" name="iBorder" value="1" /></td></tr>\';')
+                               .(in_array('float', $this->removedProperties)?'':'
+                               sz+=\'<tr><td\'+bgColor+\'><label for="iFloat">'.$LANG->getLL('float').': </label></td><td>\'+floatSelector+\'</td></tr>\';')
+                               .(in_array('paddingTop', $this->removedProperties)?'':'
+                               sz+=\'<tr><td\'+bgColor+\'><label for="iPaddingTop">'.$LANG->getLL('padding_top').': </label></td><td><input type="text" id="iPaddingTop" name="iPaddingTop" value=""'.$GLOBALS['TBE_TEMPLATE']->formWidth(4).'></td></tr>\';')
+                               .(in_array('paddingRight', $this->removedProperties)?'':'
+                               sz+=\'<tr><td\'+bgColor+\'><label for="iPaddingRight">'.$LANG->getLL('padding_right').': </label></td><td><input type="text" id="iPaddingRight" name="iPaddingRight" value=""'.$GLOBALS['TBE_TEMPLATE']->formWidth(4).' /></td></tr>\';')
+                               .(in_array('paddingBottom', $this->removedProperties)?'':'
+                               sz+=\'<tr><td\'+bgColor+\'><label for="iPaddingBottom">'.$LANG->getLL('padding_bottom').': </label></td><td><input type="text" id="iPaddingBottom" name="iPaddingBottom" value=""'.$GLOBALS['TBE_TEMPLATE']->formWidth(4).' /></td></tr>\';')
+                               .(in_array('paddingLeft', $this->removedProperties)?'':'
+                               sz+=\'<tr><td\'+bgColor+\'><label for="iPaddingLeft">'.$LANG->getLL('padding_left').': </label></td><td><input type="text" id="iPaddingLeft" name="iPaddingLeft" value=""'.$GLOBALS['TBE_TEMPLATE']->formWidth(4).' /></td></tr>\';')
+                               .(in_array('title', $this->removedProperties)?'':'
+                               sz+=\'<tr><td\'+bgColor+\'><label for="iTitle">'.$LANG->getLL('title').': </label></td><td><input type="text" id="iTitle" name="iTitle"'.$GLOBALS['TBE_TEMPLATE']->formWidth(20).' /></td></tr>\';')
+                               .(in_array('alt', $this->removedProperties)?'':'
+                               sz+=\'<tr><td\'+bgColor+\'><label for="iAlt">'.$LANG->getLL('alt').': </label></td><td><input type="text" id="iAlt" name="iAlt"'.$GLOBALS['TBE_TEMPLATE']->formWidth(20).' /></td></tr>\';')
+                               .((!$TYPO3_CONF_VARS['EXTCONF'][$this->extKey]['enableClickEnlarge'] || in_array('clickenlarge', $this->removedProperties))?'':'
+                               sz+=\'<tr><td\'+bgColor+\'><label for="iClickEnlarge">'.$LANG->sL('LLL:EXT:cms/locallang_ttc.php:image_zoom',1).' </label></td><td><input type="checkbox" name="iClickEnlarge" id="iClickEnlarge" value="1" /></td></tr>\';').'
                                sz+=\'<tr><td><input type="submit" value="'.$LANG->getLL('update').'" onClick="return setImageProperties();"></td></tr>\';
                                sz+=\'</form></table>\';
                                return sz;
@@ -405,152 +441,206 @@ class tx_rtehtmlarea_dam_browse_media extends tx_dam_browse_media {
                        function setImageProperties() {
                                var classesImage = ' . ($this->thisConfig['classesImage']?'true':'false') . ';
                                if (selectedImageRef)   {
-                                       if(document.imageData.iWidth.value && document.imageData.iWidth.value != "auto") {
-                                               selectedImageRef.style.width = document.imageData.iWidth.value + "px";
-                                       } else {
-                                               selectedImageRef.style.width = "auto";
+                                       if (document.imageData.iWidth) {
+                                               if (document.imageData.iWidth.value && parseInt(document.imageData.iWidth.value)) {
+                                                       selectedImageRef.style.width = "";
+                                                       selectedImageRef.width = parseInt(document.imageData.iWidth.value);
+                                               } else {
+                                                       selectedImageRef.style.width = "auto";
+                                               }
                                        }
-                                       selectedImageRef.removeAttribute("width");
-                                       if(document.imageData.iHeight.value && document.imageData.iHeight.value != "auto") {
-                                               selectedImageRef.style.height=document.imageData.iHeight.value + "px";
-                                       } else {
-                                               selectedImageRef.style.height = "auto";
-                                       }
-                                       selectedImageRef.removeAttribute("height");
-
-                                       selectedImageRef.style.paddingTop = "0px";
-                                       selectedImageRef.style.paddingBottom = "0px";
-                                       selectedImageRef.style.paddingRight = "0px";
-                                       selectedImageRef.style.paddingLeft = "0px";
-                                       selectedImageRef.style.padding = "";  // this statement ignored by Mozilla 1.3.1
-                                       if(document.imageData.iVspace.value != "" && !isNaN(parseInt(document.imageData.iVspace.value))) {
-                                               selectedImageRef.style.paddingTop = parseInt(document.imageData.iVspace.value) + "px";
-                                               selectedImageRef.style.paddingBottom = selectedImageRef.style.paddingTop;
-                                       }
-                                       if(document.imageData.iHspace.value != "" && !isNaN(parseInt(document.imageData.iHspace.value))) {
-                                               selectedImageRef.style.paddingRight = parseInt(document.imageData.iHspace.value) + "px";
-                                               selectedImageRef.style.paddingLeft = selectedImageRef.style.paddingRight;
-                                       }
-                                       selectedImageRef.removeAttribute("vspace");
-                                       selectedImageRef.removeAttribute("hspace");
-
-                                       selectedImageRef.title=document.imageData.iTitle.value;
-                                       selectedImageRef.alt=document.imageData.iAlt.value;
-
-                                       selectedImageRef.style.borderStyle = "none";
-                                       selectedImageRef.style.borderWidth = "0px";
-                                       selectedImageRef.style.border = "";  // this statement ignored by Mozilla 1.3.1
-                                       if(document.imageData.iBorder.checked) {
-                                               selectedImageRef.style.borderStyle = "solid";
-                                               selectedImageRef.style.borderWidth = "thin";
-                                       }
-                                       selectedImageRef.removeAttribute("border");
-
-                                       var iFloat = document.imageData.iFloat.options[document.imageData.iFloat.selectedIndex].value;
-                                       if (iFloat || selectedImageRef.style.cssFloat || selectedImageRef.style.styleFloat)     {
-                                               if(document.all) {
-                                                       selectedImageRef.style.styleFloat = iFloat;
+                                       if (document.imageData.iHeight) {
+                                               if (document.imageData.iHeight.value && parseInt(document.imageData.iHeight.value)) {
+                                                       selectedImageRef.style.height = "";
+                                                       selectedImageRef.height = parseInt(document.imageData.iHeight.value);
+                                               } else {
+                                                       selectedImageRef.style.height = "auto";
+                                               }
+                                       }
+                                       if (document.imageData.iPaddingTop) {
+                                               if (document.imageData.iPaddingTop.value != "" && !isNaN(parseInt(document.imageData.iPaddingTop.value))) {
+                                                       selectedImageRef.style.paddingTop = parseInt(document.imageData.iPaddingTop.value) + "px";
                                                } else {
-                                                       selectedImageRef.style.cssFloat = iFloat;
+                                                       selectedImageRef.style.paddingTop = "";
                                                }
                                        }
+                                       if (document.imageData.iPaddingRight) {
+                                               if (document.imageData.iPaddingRight.value != "" && !isNaN(parseInt(document.imageData.iPaddingRight.value))) {
+                                                       selectedImageRef.style.paddingRight = parseInt(document.imageData.iPaddingRight.value) + "px";
+                                               } else {
+                                                       selectedImageRef.style.paddingRight = "";
+                                               }
+                                       }
+                                       if (document.imageData.iPaddingBottom) {
+                                               if (document.imageData.iPaddingBottom.value != "" && !isNaN(parseInt(document.imageData.iPaddingBottom.value))) {
+                                                       selectedImageRef.style.paddingBottom = parseInt(document.imageData.iPaddingBottom.value) + "px";
+                                               } else {
+                                                       selectedImageRef.style.paddingBottom = "";
+                                               }
+                                       }
+                                       if (document.imageData.iPaddingLeft) {
+                                               if (document.imageData.iPaddingLeft.value != "" && !isNaN(parseInt(document.imageData.iPaddingLeft.value))) {
+                                                       selectedImageRef.style.paddingLeft = parseInt(document.imageData.iPaddingLeft.value) + "px";
+                                               } else {
+                                                       selectedImageRef.style.paddingLeft = "";
+                                               }
+                                       }
+                                       if (document.imageData.iTitle) {
+                                               selectedImageRef.title=document.imageData.iTitle.value;
+                                       }
+                                       if (document.imageData.iAlt) {
+                                               selectedImageRef.alt=document.imageData.iAlt.value;
+                                       }
                                        
-                                       if(classesImage) {
+                                       if (document.imageData.iBorder) {
+                                               selectedImageRef.style.borderStyle = "";
+                                               selectedImageRef.style.borderWidth = "";
+                                               selectedImageRef.style.border = "";  // this statement ignored by Mozilla 1.3.1
+                                               selectedImageRef.style.borderTopStyle = "";
+                                               selectedImageRef.style.borderRightStyle = "";
+                                               selectedImageRef.style.borderBottomStyle = "";
+                                               selectedImageRef.style.borderLeftStyle = "";
+                                               selectedImageRef.style.borderTopWidth = "";
+                                               selectedImageRef.style.borderRightWidth = "";
+                                               selectedImageRef.style.borderBottomWidth = "";
+                                               selectedImageRef.style.borderLeftWidth = "";
+                                               if(document.imageData.iBorder.checked) {
+                                                       selectedImageRef.style.borderStyle = "solid";
+                                                       selectedImageRef.style.borderWidth = "thin";
+                                               }
+                                               selectedImageRef.removeAttribute("border");
+                                       }
+                                       
+                                       if (document.imageData.iFloat) {
+                                               var iFloat = document.imageData.iFloat.options[document.imageData.iFloat.selectedIndex].value;
+                                               if (iFloat || selectedImageRef.style.cssFloat || selectedImageRef.style.styleFloat) {
+                                                       if (document.all) {
+                                                               selectedImageRef.style.styleFloat = (iFloat != "none") ? iFloat : "";
+                                                       } else {
+                                                               selectedImageRef.style.cssFloat = (iFloat != "none") ? iFloat : "";
+                                                       }
+                                               }
+                                       }
+
+                                       if (classesImage && document.imageData.iClass) {
                                                var iClass = document.imageData.iClass.options[document.imageData.iClass.selectedIndex].value;
-                                               if (iClass || (selectedImageRef.attributes["class"] && selectedImageRef.attributes["class"].value))     {
+                                               if (iClass || (selectedImageRef.attributes["class"] && selectedImageRef.attributes["class"].value)) {
                                                        selectedImageRef.className = iClass;
+                                               } else {
+                                                       selectedImageRef.className = "";
                                                }
                                        }
                                        
-                                       '.(($TYPO3_CONF_VARS['EXTCONF'][$this->extKey]['enableClickEnlarge'] && !(is_array($this->buttonConfig['clickEnlarge.']) && $this->buttonConfig['clickEnlarge.']['disabled']))?'
-                                       if (document.imageData.iClickEnlarge && document.imageData.iClickEnlarge.checked) selectedImageRef.setAttribute("clickenlarge","1");
-                                               else selectedImageRef.setAttribute("clickenlarge","0");':'').'
-                                       
-                                       HTMLArea.edHidePopup();
+                                       if (document.imageData.iClickEnlarge) {
+                                               if (document.imageData.iClickEnlarge.checked) {
+                                                       selectedImageRef.setAttribute("clickenlarge","1");
+                                               } else {
+                                                       selectedImageRef.setAttribute("clickenlarge","0");
+                                               }
+                                       }
+                                       dialog.close();
                                }
                                return false;
                        }
                        function insertImagePropertiesInForm()  {
                                var classesImage = ' . ($this->thisConfig['classesImage']?'true':'false') . ';
                                if (selectedImageRef)   {
-                                       var styleWidth, styleHeight, paddingTop, paddingRight;
-                                       styleWidth = selectedImageRef.style.width ? selectedImageRef.style.width : selectedImageRef.width;
-                                       styleWidth = parseInt(styleWidth);
-                                       if (isNaN(styleWidth) || styleWidth == 0) { styleWidth = "auto"; }
-                                       document.imageData.iWidth.value = styleWidth;
-                                       styleHeight = selectedImageRef.style.height ? selectedImageRef.style.height : selectedImageRef.height;
-                                       styleHeight = parseInt(styleHeight);
-                                       if (isNaN(styleHeight) || styleHeight == 0) { styleHeight = "auto"; }
-                                       document.imageData.iHeight.value = styleHeight;
-
-                                       paddingTop = selectedImageRef.style.paddingTop ? selectedImageRef.style.paddingTop : selectedImageRef.vspace;
-                                       paddingTop = parseInt(paddingTop);
-                                       if (isNaN(paddingTop) || paddingTop < 0) { paddingTop = ""; }
-                                       document.imageData.iVspace.value = paddingTop;
-                                       paddingRight = selectedImageRef.style.paddingRight ? selectedImageRef.style.paddingRight : selectedImageRef.hspace;
-                                       paddingRight = parseInt(paddingRight);
-                                       if (isNaN(paddingRight) || paddingRight < 0) { paddingRight = ""; }
-                                       document.imageData.iHspace.value = paddingRight;
-
-                                       document.imageData.iTitle.value = selectedImageRef.title;
-                                       document.imageData.iAlt.value = selectedImageRef.alt;
-
-                                       if((selectedImageRef.style.borderStyle && selectedImageRef.style.borderStyle != "none" && selectedImageRef.style.borderStyle != "none none none none") || selectedImageRef.border) {
-                                               document.imageData.iBorder.checked = 1;
-                                       }
-
-                                       var fObj=document.imageData.iFloat;
-                                       var value = (selectedImageRef.style.cssFloat ? selectedImageRef.style.cssFloat : selectedImageRef.style.styleFloat);
-                                       var l=fObj.length;
-                                       for (a=0;a<l;a++)       {
-                                               if (fObj.options[a].value == value)     {
-                                                       fObj.selectedIndex = a;
+                                       var styleWidth, styleHeight, padding;
+                                       if (document.imageData.iWidth) {
+                                               styleWidth = selectedImageRef.style.width ? selectedImageRef.style.width : selectedImageRef.width;
+                                               styleWidth = parseInt(styleWidth);
+                                               if (isNaN(styleWidth) || styleWidth == 0) { styleWidth = "auto"; }
+                                               document.imageData.iWidth.value = styleWidth;
+                                       }
+                                       if (document.imageData.iHeight) {
+                                               styleHeight = selectedImageRef.style.height ? selectedImageRef.style.height : selectedImageRef.height;
+                                               styleHeight = parseInt(styleHeight);
+                                               if (isNaN(styleHeight) || styleHeight == 0) { styleHeight = "auto"; }
+                                               document.imageData.iHeight.value = styleHeight;
+                                       }
+                                       if (document.imageData.iPaddingTop) {
+                                               var padding = selectedImageRef.style.paddingTop ? selectedImageRef.style.paddingTop : selectedImageRef.vspace;
+                                               var padding = parseInt(padding);
+                                               if (isNaN(padding) || padding <= 0) { padding = ""; }
+                                               document.imageData.iPaddingTop.value = padding;
+                                       }
+                                       if (document.imageData.iPaddingRight) {
+                                               padding = selectedImageRef.style.paddingRight ? selectedImageRef.style.paddingRight : selectedImageRef.hspace;
+                                               var padding = parseInt(padding);
+                                               if (isNaN(padding) || padding <= 0) { padding = ""; }
+                                               document.imageData.iPaddingRight.value = padding;
+                                       }
+                                       if (document.imageData.iPaddingBottom) {
+                                               var padding = selectedImageRef.style.paddingBottom ? selectedImageRef.style.paddingBottom : selectedImageRef.vspace;
+                                               var padding = parseInt(padding);
+                                               if (isNaN(padding) || padding <= 0) { padding = ""; }
+                                               document.imageData.iPaddingBottom.value = padding;
+                                       }
+                                       if (document.imageData.iPaddingLeft) {
+                                               var padding = selectedImageRef.style.paddingLeft ? selectedImageRef.style.paddingLeft : selectedImageRef.hspace;
+                                               var padding = parseInt(padding);
+                                               if (isNaN(padding) || padding <= 0) { padding = ""; }
+                                               document.imageData.iPaddingLeft.value = padding;
+                                       }
+                                       if (document.imageData.iTitle) {
+                                               document.imageData.iTitle.value = selectedImageRef.title;
+                                       }
+                                       if (document.imageData.iAlt) {
+                                               document.imageData.iAlt.value = selectedImageRef.alt;
+                                       }
+                                       if (document.imageData.iBorder) {
+                                               if((selectedImageRef.style.borderStyle && selectedImageRef.style.borderStyle != "none" && selectedImageRef.style.borderStyle != "none none none none") || selectedImageRef.border) {
+                                                       document.imageData.iBorder.checked = 1;
+                                               }
+                                       }
+                                       if (document.imageData.iFloat) {
+                                               var fObj=document.imageData.iFloat;
+                                               var value = (selectedImageRef.style.cssFloat ? selectedImageRef.style.cssFloat : selectedImageRef.style.styleFloat);
+                                               var l=fObj.length;
+                                               for (var a=0;a<l;a++)   {
+                                                       if (fObj.options[a].value == value) {
+                                                               fObj.selectedIndex = a;
+                                                       }
                                                }
                                        }
 
-                                       if(classesImage) {
+                                       if (classesImage && document.imageData.iClass) {
                                                var fObj=document.imageData.iClass;
                                                var value=selectedImageRef.className;
                                                var l=fObj.length;
-                                               for (a=0;a<l;a++)       {
+                                               for (var a=0;a < l; a++)        {
                                                        if (fObj.options[a].value == value)     {
                                                                fObj.selectedIndex = a;
                                                        }
                                                }
                                        }
-                                       
-                                       '.(($TYPO3_CONF_VARS['EXTCONF'][$this->extKey]['enableClickEnlarge'] && !(is_array($this->buttonConfig['clickEnlarge.']) && $this->buttonConfig['clickEnlarge.']['disabled']))?'if (selectedImageRef.getAttribute("clickenlargesrc")) {
-                                               if (selectedImageRef.getAttribute("clickenlarge") == "1") document.imageData.iClickEnlarge.checked = 1;
-                                                       else document.imageData.iClickEnlarge.removeAttribute("checked");
-                                       }':'').'
+                                       if (document.imageData.iClickEnlarge) {
+                                               if (selectedImageRef.getAttribute("clickenlarge") == "1") {
+                                                       document.imageData.iClickEnlarge.checked = 1;
+                                               } else {
+                                                       document.imageData.iClickEnlarge.checked = 0;
+                                               }
+                                       }
+                                       return false;
                                }
-                               return false;
-                       }
-
-                       function openDragDrop() {
-                               var url = "' . $BACK_PATH . 'browse_links.php?mode=filedrag&editorNo='.$this->editorNo.'&bparams=|'.implode(':', array($this->editorNo,$this->sys_language_content)).'||"+escape("gif,jpg,jpeg,png");
-                               window.opener.browserWin = window.open(url,"Typo3WinBrowser","height=350,width=600,status=0,menubar=0,resizable=1,scrollbars=1");
-                               HTMLArea.edHidePopup();
                        }
 
-                       var selectedImageRef = getCurrentImageRef();    // Setting this to a reference to the image object.
-
-                       '.($this->act=='dragdrop'?'openDragDrop();':'');
+                       var selectedImageRef = getCurrentImageRef();';  // Setting this to a reference to the image object.
 
                        // Finally, add the accumulated JavaScript to the template object:
-               $this->doc->JScode = $this->doc->wrapScriptTags($JScode);
+               $this->doc->JScodeArray['rtehtmlarea'] = $JScode;
        }
        
        function reinitParams() {
-// We need to pass along some RTE parameters
                if ($this->editorNo) {
                        $pArr = explode('|', $this->bparams);
                        $pArr[1] = implode(':', array($this->editorNo, $this->sys_language_content));
                        $pArr[2] = $this->RTEtsConfigParams;
+                       if ($this->act == 'dragdrop' || $this->act == 'plain') {
+                               $pArr[3] = 'jpg,jpeg,gif,png';
+                       }
                        $this->bparams = implode('|', $pArr);
-                       
                }
-// We need to pass along some RTE parameters
                parent::reinitParams();
        }
        
@@ -561,9 +651,7 @@ class tx_rtehtmlarea_dam_browse_media extends tx_dam_browse_media {
         */
        function displayThumbs() {
                global $BE_USER;
-// Honor options.noThumbsInRTEimageSelect              
-               return parent::displayThumbs() && !$BE_USER->getTSConfigVal('options.noThumbsInRTEimageSelect');
-// Honor options.noThumbsInRTEimageSelect
+               return parent::displayThumbs() && !$BE_USER->getTSConfigVal('options.noThumbsInRTEimageSelect') && ($this->act != 'dragdrop');
        }
        
        /**
@@ -575,9 +663,7 @@ class tx_rtehtmlarea_dam_browse_media extends tx_dam_browse_media {
                global $BE_USER;
                
                        // Getting flag for showing/not showing thumbnails:
-// Honor options.noThumbsInRTEimageSelect
-               $noThumbs = $BE_USER->getTSConfigVal('options.noThumbsInEB') || ($this->mode == 'rte' && $BE_USER->getTSConfigVal('options.noThumbsInRTEimageSelect'));
-// Honor options.noThumbsInRTEimageSelect
+               $noThumbs = $BE_USER->getTSConfigVal('options.noThumbsInEB') || ($this->mode == 'rte' && $BE_USER->getTSConfigVal('options.noThumbsInRTEimageSelect')) || ($this->act == 'dragdrop');
                if ($noThumbs)  {
                        $thumbNailCheckbox = '';
                } else {
@@ -601,7 +687,7 @@ class tx_rtehtmlarea_dam_browse_media extends tx_dam_browse_media {
         * @return      string          HTML output
         */
        function renderFileList($files, $mode='file') {
-               global $LANG;
+               global $LANG, $BACK_PATH, $BE_USER, $TYPO3_CONF_VARS;
 
                $out = '';
 
@@ -609,6 +695,7 @@ class tx_rtehtmlarea_dam_browse_media extends tx_dam_browse_media {
                if (is_array($files) AND count($files)) {
 
                        $displayThumbs = $this->displayThumbs();
+                       $displayImage = ($this->act === 'dragdrop');
 
                                // Traverse the file list:
                        $lines=array();
@@ -622,7 +709,7 @@ class tx_rtehtmlarea_dam_browse_media extends tx_dam_browse_media {
                                $titleAttrib = tx_dam_guiFunc::icon_getTitleAttribute($fI);
                                $iconFile = tx_dam::icon_getFileType($fI);
                                $iconTag = tx_dam_guiFunc::icon_getFileTypeImgTag($fI);
-                               $iconAndFilename = $iconTag.htmlspecialchars(t3lib_div::fixed_lgd_cs($fI['file_title'], $GLOBALS['BE_USER']->uc['titleLen']));
+                               $iconAndFilename = $iconTag.htmlspecialchars(t3lib_div::fixed_lgd_cs($fI['file_title'], $BE_USER->uc['titleLen']));
 
 
                                        // Create links for adding the file:
@@ -651,9 +738,9 @@ class tx_rtehtmlarea_dam_browse_media extends tx_dam_browse_media {
 
                                        // Create link to showing details about the file in a window:
                                if ($fI['__exists']) {
-                                       $Ahref = $GLOBALS['BACK_PATH'].'show_item.php?table='.rawurlencode($fI['file_name_absolute']).'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'));
+                                       $Ahref = $BACK_PATH.'show_item.php?table='.rawurlencode($fI['file_name_absolute']).'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'));
                                        $ATag_info = '<a href="'.htmlspecialchars($Ahref).'">';
-                                       $info = $ATag_info.'<img'.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/zoom2.gif', 'width="12" height="12"').' title="'.$LANG->getLL('info',1).'" alt="" /> '.$LANG->getLL('info',1).'</a>';
+                                       $info = $ATag_info.'<img'.t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/zoom2.gif', 'width="12" height="12"').' title="'.$LANG->getLL('info',1).'" alt="" /> '.$LANG->getLL('info',1).'</a>';
 
                                } else {
                                        $info = '&nbsp;';
@@ -661,21 +748,41 @@ class tx_rtehtmlarea_dam_browse_media extends tx_dam_browse_media {
 
                                        // Thumbnail/size generation:
                                $clickThumb = '';
-                               if (t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], $fI['file_type']) AND $displayThumbs AND is_file($fI['file_name_absolute'])) {
-// adding $GLOBALS['BACK_PATH']
-                                       $clickThumb = t3lib_BEfunc::getThumbNail($GLOBALS['BACK_PATH'].'thumbs.php', $fI['file_path_absolute'].$fI['file_name'], '');
-// adding $GLOBALS['BACK_PATH']
+                               if (t3lib_div::inList($TYPO3_CONF_VARS['GFX']['imagefile_ext'], $fI['file_type']) AND $displayThumbs AND is_file($fI['file_name_absolute']))    {
+                                       $clickThumb = t3lib_BEfunc::getThumbNail($BACK_PATH.'thumbs.php', $fI['file_path_absolute'].$fI['file_name'], '');
                                        $clickThumb = '<div style="width:56px; overflow:auto; padding: 5px; background-color:#fff; border:solid 1px #ccc;">'.$ATag_insert.$clickThumb.'</a>'.'</div>';
                                } elseif ($displayThumbs) {
                                        $clickThumb = '<div style="width:68px"></div>';
                                }
-
+                               
+                                       // Drag & drop image
+                               if ($displayImage AND t3lib_div::inList($TYPO3_CONF_VARS['GFX']['imagefile_ext'], $fI['file_type']) AND is_file($fI['file_name_absolute']))     {
+                                       if (t3lib_div::_GP('noLimit'))  {
+                                               $maxW=10000;
+                                               $maxH=10000;
+                                       } else {
+                                               $maxW=380;
+                                               $maxH=500;
+                                       }
+                                       $IW = $fI['hpixels'];
+                                       $IH = $fI['vpixels'];
+                                       if ($IW>$maxW)  {
+                                               $IH=ceil($IH/$IW*$maxW);
+                                               $IW=$maxW;
+                                       }
+                                       if ($IH>$maxH)  {
+                                               $IW=ceil($IW/$IH*$maxH);
+                                               $IH=$maxH;
+                                       }
+                                       $clickThumb = '<img src="'.$this->siteUrl.substr($fI['file_name_absolute'],strlen(PATH_site)).'" width="'.$IW.'" height="'.$IH.'"' . ($this->defaultClass?(' class="'.$this->defaultClass.'"'):''). ' alt="'.$fI['alt_text'].'" title="'.$fI[$this->imgTitleDAMColumn].'" />';
+                                       $clickThumb = '<div style="width:380px; overflow:auto; padding: 5px; background-color:#fff; border:solid 1px #ccc;">'.$clickThumb.'</div>';
+                               }
 
                                        // Show element:
                                $lines[] = '
                                        <tr class="bgColor4">
-                                               <td valign="top" nowrap="nowrap" style="min-width:20em">'.$ATag_insert.$iconAndFilename.'</a>'.'&nbsp;</td>
-                                               <td valign="top" width="1%">'.$ATag_add.'<img'.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/plusbullet2.gif', 'width="18" height="16"').' title="'.$LANG->getLL('addToList',1).'" alt="" /></a></td>
+                                               <td valign="top" nowrap="nowrap" style="min-width:20em">'.($displayImage?'':$ATag_insert).$iconAndFilename.'</a>'.'&nbsp;</td>
+                                               <td valign="top" width="1%">'.($displayImage?'':$ATag_add).'<img'.t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/plusbullet2.gif', 'width="18" height="16"').' title="'.$LANG->getLL('addToList',1).'" alt="" /></a></td>
                                                <td valign="top" nowrap="nowrap" width="1%">'.$info.'</td>
                                        </tr>';
 
@@ -689,7 +796,7 @@ class tx_rtehtmlarea_dam_browse_media extends tx_dam_browse_media {
                                }
 
 
-                               if ($displayThumbs AND $infoText) {
+                               if (($displayThumbs || $displayImage) AND $infoText) {
                                        $lines[] = '
                                                <tr class="bgColor">
                                                        <td valign="top" colspan="3">
@@ -742,16 +849,15 @@ class tx_rtehtmlarea_dam_browse_media extends tx_dam_browse_media {
         * @return      array           Array of file elements
         */
        function getFileListArr($allowedFileTypes, $disallowedFileTypes, $mode) {
-               global $TYPO3_CONF_VARS;
+               global $TYPO3_CONF_VARS, $TYPO3_DB;
                
                $filearray = array();
-
                //
                // Use the current selection to create a query and count selected records
                //
 
                $this->damSC->selection->addSelectionToQuery();
-               $this->damSC->selection->qg->query['FROM']['tx_dam'] = tx_dam_db::getMetaInfoFieldList(true, array('hpixels','vpixels','caption'));
+               $this->damSC->selection->qg->query['FROM']['tx_dam'] = tx_dam_db::getMetaInfoFieldList(true, array('hpixels','vpixels',$this->imgTitleDAMColumn,'alt_text'));
                #$this->damSC->selection->qg->addSelectFields(...
                if ($allowedFileTypes) {
                        $extList = '"'.implode ('","', explode(',',$allowedFileTypes)).'"';
@@ -761,12 +867,10 @@ class tx_rtehtmlarea_dam_browse_media extends tx_dam_browse_media {
                        $extList = '"'.implode ('","', explode(',',$disallowedFileTypes)).'"';
                        $this->damSC->selection->qg->addWhere('AND NOT tx_dam.file_type IN ('.$extList.')', 'WHERE', 'NOT tx_dam.file_type');
                }
-// selection with limited dimensions
                if ($this->act == 'plain') {
                        $this->damSC->selection->qg->addWhere('AND tx_dam.hpixels <= '.intval($this->plainMaxWidth), 'WHERE', 'tx_dam.hpixels');
                        $this->damSC->selection->qg->addWhere('AND tx_dam.vpixels <= '.intval($this->plainMaxHeight), 'WHERE', 'tx_dam.vpixels');
                }
-// selection with limited dimensions
                
                $this->damSC->selection->execSelectionQuery(TRUE);
 
@@ -778,7 +882,7 @@ class tx_rtehtmlarea_dam_browse_media extends tx_dam_browse_media {
                        $this->damSC->selection->execSelectionQuery();
 
                        if($this->damSC->selection->res) {
-                               while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($this->damSC->selection->res)) {
+                               while($row = $TYPO3_DB->sql_fetch_assoc($this->damSC->selection->res)) {
 
                                        $row['file_title'] = $row['title'] ? $row['title'] : $row['file_name'];
                                        $row['file_path_absolute'] = tx_dam::path_makeAbsolute($row['file_path']);
@@ -851,7 +955,7 @@ class tx_rtehtmlarea_dam_browse_media extends tx_dam_browse_media {
                        $menuDef['mail']['isActive'] = $this->act=='dragdrop';
                        $menuDef['mail']['label'] = $LANG->getLL('dragDropImage',1);
                        $menuDef['mail']['url'] = '#';
-                       $menuDef['mail']['addParams'] = 'onClick="openDragDrop();return false;"';
+                       $menuDef['mail']['addParams'] = 'onClick="jumpToUrl(\''.htmlspecialchars($this->thisScript.'?act=dragdrop&mode='.$this->mode.'&bparams='.$this->bparams).'\');return false;"';
                }
                if (in_array('upload', $this->allowedItems)) {
                        $menuDef['upload']['isActive'] = ($this->act=='upload');
@@ -861,6 +965,7 @@ class tx_rtehtmlarea_dam_browse_media extends tx_dam_browse_media {
                }
                $this->content .= $this->doc->getTabMenuRaw($menuDef);
                
+               $pArr = explode('|', $this->bparams);
                switch($this->act)      {
                        case 'image':
                                $JScode = '
@@ -877,8 +982,9 @@ class tx_rtehtmlarea_dam_browse_media extends tx_dam_browse_media {
                                        $this->content.= '<br />';
                                }
                                break;
+                       case 'dragdrop':
                        case 'plain':
-                               $this->allowedFileTypes = 'jpg,jpeg,gif,png';
+                               //$this->allowedFileTypes = t3lib_div::trimExplode(',', $pArr[3], true);
                        case 'magic':
                                $this->addDisplayOptions();
                                $this->content.= $this->dam_select($this->allowedFileTypes, $this->disallowedFileTypes);
@@ -895,7 +1001,8 @@ class tx_rtehtmlarea_dam_browse_media extends tx_dam_browse_media {
                                break;
                }
                        // Ending page, returning content:
-               $this->content.= $this->doc->endPage();
+               $this->content .= $this->doc->endPage();
+               $this->getJSCode();
                $this->content = $this->damSC->doc->insertStylesAndJS($this->content);
                return $this->content;
        }
index d197793..6792391 100644 (file)
@@ -3,7 +3,7 @@
 *  Copyright notice
 *
 *  (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com)
-*  (c) 2004-2006 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
+*  (c) 2004-2008 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -135,10 +135,13 @@ class tx_rtehtmlarea_image_folderTree extends t3lib_folderTree {
 class tx_rtehtmlarea_select_image extends browse_links {
        var $extKey = 'rtehtmlarea';
        var $content;
-       var $act;
        var $allowedItems;
+       var $removedProperties = array();
+       var $defaultClass;
        var $plainMaxWidth;
        var $plainMaxHeight;
+       var $lockPlainWidth;
+       var $lockPlainHeight;
        var $magicMaxWidth;
        var $magicMaxHeight;
        var $imgPath;
@@ -184,9 +187,28 @@ class tx_rtehtmlarea_select_image extends browse_links {
                
                if (is_array($this->thisConfig['buttons.']) && is_array($this->thisConfig['buttons.']['image.'])) {
                        $this->buttonConfig = $this->thisConfig['buttons.']['image.'];
+                       if (is_array($this->buttonConfig['properties.'])) {
+                               if ($this->buttonConfig['properties.']['removeItems']) {
+                                       $this->removedProperties = t3lib_div::trimExplode(',',$this->buttonConfig['properties.']['removeItems'],1);
+                               }
+                               if (is_array($this->buttonConfig['properties.']['class.']) && trim($this->buttonConfig['properties.']['class.']['default'])) {
+                                       $this->defaultClass = trim($this->buttonConfig['properties.']['class.']['default']);
+                               }
+                       }
+                       
+               }
+               
+               if (is_array($this->thisConfig['proc.']) && $this->thisConfig['proc.']['plainImageMode']) {
+                       $plainImageMode = $this->thisConfig['proc.']['plainImageMode'];
+                       $this->lockPlainWidth = ($plainImageMode == 'lockDimensions')?'true':'false';
+                       $this->lockPlainHeight = ($this->lockPlainWidth || $plainImageMode == 'lockRatio' || ($plainImageMode == 'lockRatioWhenSmaller'))?'true':'false';
                }
                
-               $this->allowedItems = explode(',','magic,plain,dragdrop,image');
+               $this->allowedItems = explode(',','magic,plain,image');
+               $clientInfo = t3lib_div::clientInfo();
+               if ($clientInfo['BROWSER'] !== 'opera') {
+                       $this->allowedItems[] = 'dragdrop';
+               }
                if (is_array($this->buttonConfig['options.']) && $this->buttonConfig['options.']['removeItems']) {
                        $this->allowedItems = array_diff($this->allowedItems,t3lib_div::trimExplode(',',$this->buttonConfig['options.']['removeItems'],1));
                } else {
@@ -216,11 +238,10 @@ class tx_rtehtmlarea_select_image extends browse_links {
                        if (!$this->magicMaxHeight) $this->magicMaxHeight = 1000;
                }
                
-               if($this->thisConfig['classesImage']) {
+               if ($this->thisConfig['classesImage']) {
                        $classesImageArray = t3lib_div::trimExplode(',',$this->thisConfig['classesImage'],1);
                        $this->classesImageJSOptions = '<option value=""></option>';
-                       reset($classesImageArray);
-                       while(list(,$class)=each($classesImageArray)) {
+                       foreach ($classesImageArray as $class) {
                                $this->classesImageJSOptions .= '<option value="' .$class . '">' . $class . '</option>';
                        }
                }
@@ -298,32 +319,19 @@ class tx_rtehtmlarea_select_image extends browse_links {
 <head>
        <title>Untitled</title>
 </head>
-<script language="javascript" type="text/javascript">
+<script type="text/javascript">
 /*<![CDATA[*/
-       var editor = window.opener.RTEarea[' . $this->editorNo . ']["editor"];
-       var HTMLArea = window.opener.HTMLArea;
-       function insertImage(file,width,height,origFile)        {
-               var styleWidth, styleHeight;
-               styleWidth = parseInt(width);
-               if (isNaN(styleWidth) || styleWidth == 0) {
-                       styleWidth = "auto";
-               } else {
-                       styleWidth += "px";
-               }
-               styleHeight = parseInt(height);
-               if (isNaN(styleHeight) || styleHeight == 0) {
-                       styleHeight = "auto";
-               } else {
-                       styleHeight += "px";
-               }
-               editor.renderPopup_insertImage(\'<img src="\'+file+\'" style="width: \'+styleWidth+\'; height: \'+styleHeight+\';"'.(($TYPO3_CONF_VARS['EXTCONF'][$this->extKey]['enableClickEnlarge'] && !(is_array($this->buttonConfig['clickEnlarge.']) && $this->buttonConfig['clickEnlarge.']['disabled']))?' clickenlargesrc="\'+origFile+\'" clickenlarge="0"':'').' />\');
+       var dialog = window.opener.HTMLArea.Dialog["TYPO3Image"];
+       var plugin = dialog.plugin;
+       function insertImage(file,width,height) {
+               plugin.insertImage(\'<img src="\'+file+\'"' . ($this->defaultClass?(' class="'.$this->defaultClass.'"'):'') . ' width="\'+parseInt(width)+\'" height="\'+parseInt(height)+\'" />\');
        }
 /*]]>*/
 </script>
 <body>
 <script type="text/javascript">
 /*<![CDATA[*/
-       insertImage(\''.$iurl.'\','.$imgI[0].','.$imgI[1].',\''.substr($imgInfo[3],strlen(PATH_site)).'\');
+       insertImage(\''.$iurl.'\','.$imgI[0].','.$imgI[1].');
 /*]]>*/
 </script>
 </body>
@@ -345,9 +353,10 @@ class tx_rtehtmlarea_select_image extends browse_links {
                global $LANG,$BACK_PATH,$TYPO3_CONF_VARS;
 
                $JScode='
-                       var editor = window.opener.RTEarea[' . $this->editorNo . ']["editor"];
+                       var dialog = window.opener.HTMLArea.Dialog["TYPO3Image"];
+                       var plugin = dialog.plugin;
                        var HTMLArea = window.opener.HTMLArea;
-                       function jumpToUrl(URL,anchor)  {       //
+                       function jumpToUrl(URL,anchor)  {
                                var add_act = URL.indexOf("act=")==-1 ? "&act='.$this->act.'" : "";
                                var add_editorNo = URL.indexOf("editorNo=")==-1 ? "&editorNo='.$this->editorNo.'" : "";
                                var RTEtsConfigParams = "&RTEtsConfigParams='.rawurlencode(t3lib_div::_GP('RTEtsConfigParams')).'";
@@ -359,21 +368,8 @@ class tx_rtehtmlarea_select_image extends browse_links {
                                window.location.href = theLocation;
                                return false;
                        }
-                       function insertImage(file,width,height,origFile)        {
-                               var styleWidth, styleHeight;
-                               styleWidth = parseInt(width);
-                               if (isNaN(styleWidth) || styleWidth == 0) {
-                                       styleWidth = "auto";
-                               } else {
-                                       styleWidth += "px";
-                               }
-                               styleHeight = parseInt(height);
-                               if (isNaN(styleHeight) || styleHeight == 0) {
-                                       styleHeight = "auto";
-                               } else {
-                                       styleHeight += "px";
-                               }
-                               editor.renderPopup_insertImage(\'<img src="\'+file+\'" style="width: \'+styleWidth+\'; height: \'+styleHeight+\';"'.(($TYPO3_CONF_VARS['EXTCONF'][$this->extKey]['enableClickEnlarge'] && !(is_array($this->buttonConfig['clickEnlarge.']) && $this->buttonConfig['clickEnlarge.']['disabled']))?' clickenlargesrc="\'+origFile+\'" clickenlarge="0"':'').' />\');
+                       function insertImage(file,width,height) {
+                               plugin.insertImage(\'<img src="\'+file+\'"' . ($this->defaultClass?(' class="'.$this->defaultClass.'"'):'') . ' width="\'+parseInt(width)+\'" height="\'+parseInt(height)+\'" />\');
                        }
                        function launchView(url) {
                                var thePreviewWindow="";
@@ -383,168 +379,241 @@ class tx_rtehtmlarea_select_image extends browse_links {
                                }
                        }
                        function getCurrentImageRef() {
-                               if (editor._selectedImage) {
-                                       return editor._selectedImage;
+                               if (plugin.image) {
+                                       return plugin.image;
                                } else {
                                        return null;
                                }
                        }
                        function printCurrentImageOptions() {
                                var classesImage = ' . ($this->thisConfig['classesImage']?'true':'false') . ';
-                               if(classesImage) var styleSelector=\'<select name="iClass" style="width:140px;">' . $this->classesImageJSOptions  . '</select>\';
-                               var floatSelector=\'<select name="iFloat"><option value="">' . $LANG->getLL('notSet') . '</option><option value="none">' . $LANG->getLL('nonFloating') . '</option><option value="left">' . $LANG->getLL('left') . '</option><option value="right">' . $LANG->getLL('right') . '</option></select>\';
+                               if (classesImage) var styleSelector=\'<select id="iClass" name="iClass" style="width:140px;">' . $this->classesImageJSOptions  . '</select>\';
+                               var floatSelector=\'<select id="iFloat" name="iFloat"><option value="">' . $LANG->getLL('notSet') . '</option><option value="none">' . $LANG->getLL('nonFloating') . '</option><option value="left">' . $LANG->getLL('left') . '</option><option value="right">' . $LANG->getLL('right') . '</option></select>\';
                                var bgColor=\' class="bgColor4"\';
                                var sz="";
                                sz+=\'<table border=0 cellpadding=1 cellspacing=1><form action="" name="imageData">\';
+                               '.(in_array('class', $this->removedProperties)?'':'
                                if(classesImage) {
-                                       sz+=\'<tr><td\'+bgColor+\'>'.$LANG->getLL('class').': </td><td>\'+styleSelector+\'</td></tr>\';
-                               }
-                               sz+=\'<tr><td\'+bgColor+\'>'.$LANG->getLL('width').': </td><td><input type="text" name="iWidth" value=""'.$GLOBALS['TBE_TEMPLATE']->formWidth(4).' /></td></tr>\';
-                               sz+=\'<tr><td\'+bgColor+\'>'.$LANG->getLL('height').': </td><td><input type="text" name="iHeight" value=""'.$GLOBALS['TBE_TEMPLATE']->formWidth(4).' /></td></tr>\';
-                               sz+=\'<tr><td\'+bgColor+\'>'.$LANG->getLL('border').': </td><td><input type="checkbox" name="iBorder" value="1" /></td></tr>\';
-                               sz+=\'<tr><td\'+bgColor+\'>'.$LANG->getLL('float').': </td><td>\'+floatSelector+\'</td></tr>\';
-                               sz+=\'<tr><td\'+bgColor+\'>'.$LANG->getLL('margin_lr').': </td><td><input type="text" name="iHspace" value=""'.$GLOBALS['TBE_TEMPLATE']->formWidth(4).'></td></tr>\';
-                               sz+=\'<tr><td\'+bgColor+\'>'.$LANG->getLL('margin_tb').': </td><td><input type="text" name="iVspace" value=""'.$GLOBALS['TBE_TEMPLATE']->formWidth(4).' /></td></tr>\';
-                               sz+=\'<tr><td\'+bgColor+\'>'.$LANG->getLL('title').': </td><td><input type="text" name="iTitle"'.$GLOBALS['TBE_TEMPLATE']->formWidth(20).' /></td></tr>\';
-                               sz+=\'<tr><td\'+bgColor+\'>'.$LANG->getLL('alt').': </td><td><input type="text" name="iAlt"'.$GLOBALS['TBE_TEMPLATE']->formWidth(20).' /></td></tr>\';
-                               '.(($TYPO3_CONF_VARS['EXTCONF'][$this->extKey]['enableClickEnlarge'] && !(is_array($this->buttonConfig['clickEnlarge.']) && $this->buttonConfig['clickEnlarge.']['disabled']))?'if (selectedImageRef && selectedImageRef.getAttribute("clickenlargesrc")) sz+=\'<tr><td\'+bgColor+\'><label for="iClickEnlarge">'.$LANG->sL('LLL:EXT:cms/locallang_ttc.php:image_zoom',1).' </label></td><td><input type="checkbox" name="iClickEnlarge" id="iClickEnlarge" value="1" /></td></tr>\';':'').'                            sz+=\'<tr><td><input type="submit" value="'.$LANG->getLL('update').'" onClick="return setImageProperties();"></td></tr>\';
+                                       sz+=\'<tr><td\'+bgColor+\'><label for="iClass">'.$LANG->getLL('class').': </label></td><td>\'+styleSelector+\'</td></tr>\';
+                               }')
+                               .(in_array('width', $this->removedProperties)?'':'
+                               if (!(selectedImageRef && selectedImageRef.src.indexOf("RTEmagic") == -1 && '. $this->lockPlainWidth .')) {
+                                       sz+=\'<tr><td\'+bgColor+\'><label for="iWidth">'.$LANG->getLL('width').': </label></td><td><input type="text" id="iWidth" name="iWidth" value=""'.$GLOBALS['TBE_TEMPLATE']->formWidth(4).' /></td></tr>\';
+                               }')
+                               .(in_array('height', $this->removedProperties)?'':'
+                               if (!(selectedImageRef && selectedImageRef.src.indexOf("RTEmagic") == -1 && '. $this->lockPlainHeight .')) {
+                                       sz+=\'<tr><td\'+bgColor+\'><label for="iHeight">'.$LANG->getLL('height').': </label></td><td><input type="text" id="iHeight" name="iHeight" value=""'.$GLOBALS['TBE_TEMPLATE']->formWidth(4).' /></td></tr>\';
+                               }')
+                               .(in_array('border', $this->removedProperties)?'':'
+                               sz+=\'<tr><td\'+bgColor+\'><label for="iBorder">'.$LANG->getLL('border').': </label></td><td><input type="checkbox" id="iBorder" name="iBorder" value="1" /></td></tr>\';')
+                               .(in_array('float', $this->removedProperties)?'':'
+                               sz+=\'<tr><td\'+bgColor+\'><label for="iFloat">'.$LANG->getLL('float').': </label></td><td>\'+floatSelector+\'</td></tr>\';')
+                               .(in_array('paddingTop', $this->removedProperties)?'':'
+                               sz+=\'<tr><td\'+bgColor+\'><label for="iPaddingTop">'.$LANG->getLL('padding_top').': </label></td><td><input type="text" id="iPaddingTop" name="iPaddingTop" value=""'.$GLOBALS['TBE_TEMPLATE']->formWidth(4).'></td></tr>\';')
+                               .(in_array('paddingRight', $this->removedProperties)?'':'
+                               sz+=\'<tr><td\'+bgColor+\'><label for="iPaddingRight">'.$LANG->getLL('padding_right').': </label></td><td><input type="text" id="iPaddingRight" name="iPaddingRight" value=""'.$GLOBALS['TBE_TEMPLATE']->formWidth(4).' /></td></tr>\';')
+                               .(in_array('paddingBottom', $this->removedProperties)?'':'
+                               sz+=\'<tr><td\'+bgColor+\'><label for="iPaddingBottom">'.$LANG->getLL('padding_bottom').': </label></td><td><input type="text" id="iPaddingBottom" name="iPaddingBottom" value=""'.$GLOBALS['TBE_TEMPLATE']->formWidth(4).' /></td></tr>\';')
+                               .(in_array('paddingLeft', $this->removedProperties)?'':'
+                               sz+=\'<tr><td\'+bgColor+\'><label for="iPaddingLeft">'.$LANG->getLL('padding_left').': </label></td><td><input type="text" id="iPaddingLeft" name="iPaddingLeft" value=""'.$GLOBALS['TBE_TEMPLATE']->formWidth(4).' /></td></tr>\';')
+                               .(in_array('title', $this->removedProperties)?'':'
+                               sz+=\'<tr><td\'+bgColor+\'><label for="iTitle">'.$LANG->getLL('title').': </label></td><td><input type="text" id="iTitle" name="iTitle"'.$GLOBALS['TBE_TEMPLATE']->formWidth(20).' /></td></tr>\';')
+                               .(in_array('alt', $this->removedProperties)?'':'
+                               sz+=\'<tr><td\'+bgColor+\'><label for="iAlt">'.$LANG->getLL('alt').': </label></td><td><input type="text" id="iAlt" name="iAlt"'.$GLOBALS['TBE_TEMPLATE']->formWidth(20).' /></td></tr>\';')
+                               .((!$TYPO3_CONF_VARS['EXTCONF'][$this->extKey]['enableClickEnlarge'] || in_array('clickenlarge', $this->removedProperties))?'':'
+                               sz+=\'<tr><td\'+bgColor+\'><label for="iClickEnlarge">'.$LANG->sL('LLL:EXT:cms/locallang_ttc.php:image_zoom',1).' </label></td><td><input type="checkbox" name="iClickEnlarge" id="iClickEnlarge" value="1" /></td></tr>\';').'
+                               sz+=\'<tr><td><input type="submit" value="'.$LANG->getLL('update').'" onClick="return setImageProperties();"></td></tr>\';
                                sz+=\'</form></table>\';
                                return sz;
                        }
                        function setImageProperties() {
                                var classesImage = ' . ($this->thisConfig['classesImage']?'true':'false') . ';
                                if (selectedImageRef)   {
-                                       if(document.imageData.iWidth.value && document.imageData.iWidth.value != "auto") {
-                                               selectedImageRef.style.width = document.imageData.iWidth.value + "px";
-                                       } else {
-                                               selectedImageRef.style.width = "auto";
+                                       if (document.imageData.iWidth) {
+                                               if (document.imageData.iWidth.value && parseInt(document.imageData.iWidth.value)) {
+                                                       selectedImageRef.style.width = "";
+                                                       selectedImageRef.width = parseInt(document.imageData.iWidth.value);
+                                               } else {
+                                                       selectedImageRef.style.width = "auto";
+                                               }
                                        }
-                                       selectedImageRef.removeAttribute("width");
-                                       if(document.imageData.iHeight.value && document.imageData.iHeight.value != "auto") {
-                                               selectedImageRef.style.height=document.imageData.iHeight.value + "px";
-                                       } else {
-                                               selectedImageRef.style.height = "auto";
+                                       if (document.imageData.iHeight) {
+                                               if (document.imageData.iHeight.value && parseInt(document.imageData.iHeight.value)) {
+                                                       selectedImageRef.style.height = "";
+                                                       selectedImageRef.height = parseInt(document.imageData.iHeight.value);
+                                               } else {
+                                                       selectedImageRef.style.height = "auto";
+                                               }
                                        }
-                                       selectedImageRef.removeAttribute("height");
-
-                                       selectedImageRef.style.paddingTop = "0px";
-                                       selectedImageRef.style.paddingBottom = "0px";
-                                       selectedImageRef.style.paddingRight = "0px";
-                                       selectedImageRef.style.paddingLeft = "0px";
-                                       selectedImageRef.style.padding = "";  // this statement ignored by Mozilla 1.3.1
-                                       if(document.imageData.iVspace.value != "" && !isNaN(parseInt(document.imageData.iVspace.value))) {
-                                               selectedImageRef.style.paddingTop = parseInt(document.imageData.iVspace.value) + "px";
-                                               selectedImageRef.style.paddingBottom = selectedImageRef.style.paddingTop;
+                                       if (document.imageData.iPaddingTop) {
+                                               if (document.imageData.iPaddingTop.value != "" && !isNaN(parseInt(document.imageData.iPaddingTop.value))) {
+                                                       selectedImageRef.style.paddingTop = parseInt(document.imageData.iPaddingTop.value) + "px";
+                                               } else {
+                                                       selectedImageRef.style.paddingTop = "";
+                                               }
                                        }
-                                       if(document.imageData.iHspace.value != "" && !isNaN(parseInt(document.imageData.iHspace.value))) {
-                                               selectedImageRef.style.paddingRight = parseInt(document.imageData.iHspace.value) + "px";
-                                               selectedImageRef.style.paddingLeft = selectedImageRef.style.paddingRight;
+                                       if (document.imageData.iPaddingRight) {
+                                               if (document.imageData.iPaddingRight.value != "" && !isNaN(parseInt(document.imageData.iPaddingRight.value))) {
+                                                       selectedImageRef.style.paddingRight = parseInt(document.imageData.iPaddingRight.value) + "px";
+                                               } else {
+                                                       selectedImageRef.style.paddingRight = "";
+                                               }
                                        }
-                                       selectedImageRef.removeAttribute("vspace");
-                                       selectedImageRef.removeAttribute("hspace");
-
-                                       selectedImageRef.title=document.imageData.iTitle.value;
-                                       selectedImageRef.alt=document.imageData.iAlt.value;
-
-                                       selectedImageRef.style.borderStyle = "none";
-                                       selectedImageRef.style.borderWidth = "0px";
-                                       selectedImageRef.style.border = "";  // this statement ignored by Mozilla 1.3.1
-                                       if(document.imageData.iBorder.checked) {
-                                               selectedImageRef.style.borderStyle = "solid";
-                                               selectedImageRef.style.borderWidth = "thin";
+                                       if (document.imageData.iPaddingBottom) {
+                                               if (document.imageData.iPaddingBottom.value != "" && !isNaN(parseInt(document.imageData.iPaddingBottom.value))) {
+                                                       selectedImageRef.style.paddingBottom = parseInt(document.imageData.iPaddingBottom.value) + "px";
+                                               } else {
+                                                       selectedImageRef.style.paddingBottom = "";
+                                               }
                                        }
-                                       selectedImageRef.removeAttribute("border");
-
-                                       var iFloat = document.imageData.iFloat.options[document.imageData.iFloat.selectedIndex].value;
-                                       if (iFloat || selectedImageRef.style.cssFloat || selectedImageRef.style.styleFloat)     {
-                                               if(document.all) {
-                                                       selectedImageRef.style.styleFloat = iFloat;
+                                       if (document.imageData.iPaddingLeft) {
+                                               if (document.imageData.iPaddingLeft.value != "" && !isNaN(parseInt(document.imageData.iPaddingLeft.value))) {
+                                                       selectedImageRef.style.paddingLeft = parseInt(document.imageData.iPaddingLeft.value) + "px";
                                                } else {
-                                                       selectedImageRef.style.cssFloat = iFloat;
+                                                       selectedImageRef.style.paddingLeft = "";
+                                               }
+                                       }
+                                       if (document.imageData.iTitle) {
+                                               selectedImageRef.title=document.imageData.iTitle.value;
+                                       }
+                                       if (document.imageData.iAlt) {
+                                               selectedImageRef.alt=document.imageData.iAlt.value;
+                                       }
+                                       
+                                       if (document.imageData.iBorder) {
+                                               selectedImageRef.style.borderStyle = "";
+                                               selectedImageRef.style.borderWidth = "";
+                                               selectedImageRef.style.border = "";  // this statement ignored by Mozilla 1.3.1
+                                               selectedImageRef.style.borderTopStyle = "";
+                                               selectedImageRef.style.borderRightStyle = "";
+                                               selectedImageRef.style.borderBottomStyle = "";
+                                               selectedImageRef.style.borderLeftStyle = "";
+                                               selectedImageRef.style.borderTopWidth = "";
+                                               selectedImageRef.style.borderRightWidth = "";
+                                               selectedImageRef.style.borderBottomWidth = "";
+                                               selectedImageRef.style.borderLeftWidth = "";
+                                               if(document.imageData.iBorder.checked) {
+                                                       selectedImageRef.style.borderStyle = "solid";
+                                                       selectedImageRef.style.borderWidth = "thin";
+                                               }
+                                               selectedImageRef.removeAttribute("border");
+                                       }
+                                       
+                                       if (document.imageData.iFloat) {
+                                               var iFloat = document.imageData.iFloat.options[document.imageData.iFloat.selectedIndex].value;
+                                               if (iFloat || selectedImageRef.style.cssFloat || selectedImageRef.style.styleFloat) {
+                                                       if (document.all) {
+                                                               selectedImageRef.style.styleFloat = (iFloat != "none") ? iFloat : "";
+                                                       } else {
+                                                               selectedImageRef.style.cssFloat = (iFloat != "none") ? iFloat : "";
+                                                       }
                                                }
                                        }
 
-                                       if(classesImage) {
+                                       if (classesImage && document.imageData.iClass) {
                                                var iClass = document.imageData.iClass.options[document.imageData.iClass.selectedIndex].value;
-                                               if (iClass || (selectedImageRef.attributes["class"] && selectedImageRef.attributes["class"].value))     {
+                                               if (iClass || (selectedImageRef.attributes["class"] && selectedImageRef.attributes["class"].value)) {
                                                        selectedImageRef.className = iClass;
+                                               } else {
+                                                       selectedImageRef.className = "";
                                                }
                                        }
                                        
-                                       '.(($TYPO3_CONF_VARS['EXTCONF'][$this->extKey]['enableClickEnlarge'] && !(is_array($this->buttonConfig['clickEnlarge.']) && $this->buttonConfig['clickEnlarge.']['disabled']))?'
-                                       if (document.imageData.iClickEnlarge && document.imageData.iClickEnlarge.checked) selectedImageRef.setAttribute("clickenlarge","1");
-                                               else selectedImageRef.setAttribute("clickenlarge","0");':'').'
-                                       
-                                       HTMLArea.edHidePopup();
+                                       if (document.imageData.iClickEnlarge) {
+                                               if (document.imageData.iClickEnlarge.checked) {
+                                                       selectedImageRef.setAttribute("clickenlarge","1");
+                                               } else {
+                                                       selectedImageRef.setAttribute("clickenlarge","0");
+                                               }
+                                       }
+                                       dialog.close();
                                }
                                return false;
                        }
                        function insertImagePropertiesInForm()  {
                                var classesImage = ' . ($this->thisConfig['classesImage']?'true':'false') . ';
                                if (selectedImageRef)   {
-                                       var styleWidth, styleHeight, paddingTop, paddingRight;
-                                       styleWidth = selectedImageRef.style.width ? selectedImageRef.style.width : selectedImageRef.width;
-                                       styleWidth = parseInt(styleWidth);
-                                       if (isNaN(styleWidth) || styleWidth == 0) { styleWidth = "auto"; }
-                                       document.imageData.iWidth.value = styleWidth;
-                                       styleHeight = selectedImageRef.style.height ? selectedImageRef.style.height : selectedImageRef.height;
-                                       styleHeight = parseInt(styleHeight);
-                                       if (isNaN(styleHeight) || styleHeight == 0) { styleHeight = "auto"; }
-                                       document.imageData.iHeight.value = styleHeight;
-
-                                       paddingTop = selectedImageRef.style.paddingTop ? selectedImageRef.style.paddingTop : selectedImageRef.vspace;
-                                       paddingTop = parseInt(paddingTop);
-                                       if (isNaN(paddingTop) || paddingTop < 0) { paddingTop = ""; }
-                                       document.imageData.iVspace.value = paddingTop;
-                                       paddingRight = selectedImageRef.style.paddingRight ? selectedImageRef.style.paddingRight : selectedImageRef.hspace;
-                                       paddingRight = parseInt(paddingRight);
-                                       if (isNaN(paddingRight) || paddingRight < 0) { paddingRight = ""; }
-                                       document.imageData.iHspace.value = paddingRight;
-
-                                       document.imageData.iTitle.value = selectedImageRef.title;
-                                       document.imageData.iAlt.value = selectedImageRef.alt;
-
-                                       if((selectedImageRef.style.borderStyle && selectedImageRef.style.borderStyle != "none" && selectedImageRef.style.borderStyle != "none none none none") || selectedImageRef.border) {
-                                               document.imageData.iBorder.checked = 1;
+                                       var styleWidth, styleHeight, padding;
+                                       if (document.imageData.iWidth) {
+                                               styleWidth = selectedImageRef.style.width ? selectedImageRef.style.width : selectedImageRef.width;
+                                               styleWidth = parseInt(styleWidth);
+                                               if (isNaN(styleWidth) || styleWidth == 0) { styleWidth = "auto"; }
+                                               document.imageData.iWidth.value = styleWidth;
                                        }
-
-                                       var fObj=document.imageData.iFloat;
-                                       var value = (selectedImageRef.style.cssFloat ? selectedImageRef.style.cssFloat : selectedImageRef.style.styleFloat);
-                                       var l=fObj.length;
-                                       for (a=0;a<l;a++)       {
-                                               if (fObj.options[a].value == value)     {
-                                                       fObj.selectedIndex = a;
+                                       if (document.imageData.iHeight) {
+                                               styleHeight = selectedImageRef.style.height ? selectedImageRef.style.height : selectedImageRef.height;
+                                               styleHeight = parseInt(styleHeight);
+                                               if (isNaN(styleHeight) || styleHeight == 0) { styleHeight = "auto"; }
+                                               document.imageData.iHeight.value = styleHeight;
+                                       }
+                                       if (document.imageData.iPaddingTop) {
+                                               var padding = selectedImageRef.style.paddingTop ? selectedImageRef.style.paddingTop : selectedImageRef.vspace;
+                                               var padding = parseInt(padding);
+                                               if (isNaN(padding) || padding <= 0) { padding = ""; }
+                                               document.imageData.iPaddingTop.value = padding;
+                                       }
+                                       if (document.imageData.iPaddingRight) {
+                                               padding = selectedImageRef.style.paddingRight ? selectedImageRef.style.paddingRight : selectedImageRef.hspace;
+                                               var padding = parseInt(padding);
+                                               if (isNaN(padding) || padding <= 0) { padding = ""; }
+                                               document.imageData.iPaddingRight.value = padding;
+                                       }
+                                       if (document.imageData.iPaddingBottom) {
+                                               var padding = selectedImageRef.style.paddingBottom ? selectedImageRef.style.paddingBottom : selectedImageRef.vspace;
+                                               var padding = parseInt(padding);
+                                               if (isNaN(padding) || padding <= 0) { padding = ""; }
+                                               document.imageData.iPaddingBottom.value = padding;
+                                       }
+                                       if (document.imageData.iPaddingLeft) {
+                                               var padding = selectedImageRef.style.paddingLeft ? selectedImageRef.style.paddingLeft : selectedImageRef.hspace;
+                                               var padding = parseInt(padding);
+                                               if (isNaN(padding) || padding <= 0) { padding = ""; }
+                                               document.imageData.iPaddingLeft.value = padding;
+                                       }
+                                       if (document.imageData.iTitle) {
+                                               document.imageData.iTitle.value = selectedImageRef.title;
+                                       }
+                                       if (document.imageData.iAlt) {
+                                               document.imageData.iAlt.value = selectedImageRef.alt;
+                                       }
+                                       if (document.imageData.iBorder) {
+                                               if((selectedImageRef.style.borderStyle && selectedImageRef.style.borderStyle != "none" && selectedImageRef.style.borderStyle != "none none none none") || selectedImageRef.border) {
+                                                       document.imageData.iBorder.checked = 1;
+                                               }
+                                       }
+                                       if (document.imageData.iFloat) {
+                                               var fObj=document.imageData.iFloat;
+                                               var value = (selectedImageRef.style.cssFloat ? selectedImageRef.style.cssFloat : selectedImageRef.style.styleFloat);
+                                               var l=fObj.length;
+                                               for (var a=0;a<l;a++)   {
+                                                       if (fObj.options[a].value == value) {
+                                                               fObj.selectedIndex = a;
+                                                       }
                                                }
                                        }
 
-                                       if(classesImage) {
+                                       if (classesImage && document.imageData.iClass) {
                                                var fObj=document.imageData.iClass;
                                                var value=selectedImageRef.className;
                                                var l=fObj.length;
-                                               for (a=0;a<l;a++)       {
+                                               for (var a=0;a < l; a++)        {
                                                        if (fObj.options[a].value == value)     {
                                                                fObj.selectedIndex = a;
                                                        }
                                                }
                                        }
-                                       
-                                       '.(($TYPO3_CONF_VARS['EXTCONF'][$this->extKey]['enableClickEnlarge'] && !(is_array($this->buttonConfig['clickEnlarge.']) && $this->buttonConfig['clickEnlarge.']['disabled']))?'if (selectedImageRef.getAttribute("clickenlargesrc")) {
-                                               if (selectedImageRef.getAttribute("clickenlarge") == "1") document.imageData.iClickEnlarge.checked = 1;
-                                                       else document.imageData.iClickEnlarge.removeAttribute("checked");
-                                       }':'').'
+                                       if (document.imageData.iClickEnlarge) {
+                                               if (selectedImageRef.getAttribute("clickenlarge") == "1") {
+                                                       document.imageData.iClickEnlarge.checked = 1;
+                                               } else {
+                                                       document.imageData.iClickEnlarge.checked = 0;
+                                               }
+                                       }
+                                       return false;
                                }
-                               return false;
                        }
 
-                       function openDragDrop() {
-                               var url = "' . $BACK_PATH . t3lib_extMgm::extRelPath($this->extKey) . 'mod3/browse_links.php?mode=filedrag&editorNo='.$this->editorNo.'&bparams=|||"+escape("gif,jpg,jpeg,png");
-                               window.opener.browserWin = window.open(url,"Typo3WinBrowser","height=350,width=600,status=0,menubar=0,resizable=1,scrollbars=1");
-                               HTMLArea.edHidePopup();
-                       }
-
-                       var selectedImageRef = getCurrentImageRef();    // Setting this to a reference to the image object.
-
-                       '.($this->act=='dragdrop'?'openDragDrop();':'');
+                       var selectedImageRef = getCurrentImageRef();';  // Setting this to a reference to the image object.
 
                        // Finally, add the accumulated JavaScript to the template object:
                $this->doc->JScode = $this->doc->wrapScriptTags($JScode);
@@ -614,7 +683,7 @@ class tx_rtehtmlarea_select_image extends browse_links {
                        $menuDef['mail']['isActive'] = $this->act=='dragdrop';
                        $menuDef['mail']['label'] = $LANG->getLL('dragDropImage',1);
                        $menuDef['mail']['url'] = '#';
-                       $menuDef['mail']['addParams'] = 'onClick="openDragDrop();return false;"';
+                       $menuDef['mail']['addParams'] = 'onClick="jumpToUrl(\'?act=dragdrop&editorNo='.$this->editorNo.'&bparams=|||\'+escape(\'gif,jpg,jpeg,png\'));return false;"';
                }
                $this->content .= $this->doc->getTabMenuRaw($menuDef);
                
@@ -645,7 +714,7 @@ class tx_rtehtmlarea_select_image extends browse_links {
                        }
 
                                // Getting flag for showing/not showing thumbnails:
-                       $noThumbs = $BE_USER->getTSConfigVal('options.noThumbsInRTEimageSelect');
+                       $noThumbs = $BE_USER->getTSConfigVal('options.noThumbsInRTEimageSelect') || ($this->act == 'dragdrop');
 
                        if (!$noThumbs) {
                                        // MENU-ITEMS, fetching the setting for thumbnails from File>List module:
@@ -658,11 +727,23 @@ class tx_rtehtmlarea_select_image extends browse_links {
                                $thumbNailCheck='';
                        }
 
-                               // File-folders:
-                       $foldertree = t3lib_div::makeInstance('tx_rtehtmlarea_image_folderTree');
-                       $tree=$foldertree->getBrowsableTree();
+                               // Create folder tree:
+                       if ($this->act == 'dragdrop') {
+                               $foldertree = t3lib_div::makeInstance('TBE_FolderTree');
+                               $foldertree->thisScript=$this->thisScript;
+                               $foldertree->ext_noTempRecyclerDirs = true;
+                       } else {
+                               $foldertree = t3lib_div::makeInstance('tx_rtehtmlarea_image_folderTree');
+                       }
+                       $tree = $foldertree->getBrowsableTree();
                        list(,,$specUid) = explode('_',t3lib_div::_GP('PM'));
-                       $files = $this->expandFolder($foldertree->specUIDmap[$specUid],$this->act=='plain',$noThumbs?$noThumbs:!$_MOD_SETTINGS['displayThumbs']);
+                       if ($this->act == 'dragdrop') {
+                               $pArr = explode('|',$this->bparams);
+                               $allowedTablesOrFileTypes = $pArr[3];
+                               $files = $this->TBE_dragNDrop($foldertree->specUIDmap[$specUid],$pArr[3]);
+                       } else {
+                               $files = $this->expandFolder($foldertree->specUIDmap[$specUid],$this->act=='plain',$noThumbs?$noThumbs:!$_MOD_SETTINGS['displayThumbs']);
+                       }
                        
                        $this->content.= '<table border=0 cellpadding=0 cellspacing=0>
                        <tr>
@@ -740,7 +821,7 @@ class tx_rtehtmlarea_select_image extends browse_links {
                                        if (!$plainFlag)        {
                                                $ATag = '<a href="#" onclick="return jumpToUrl(\'?editorNo='.$this->editorNo.'&insertMagicImage='.rawurlencode($filepath).'\');">';
                                        } else {
-                                               $ATag = '<a href="#" onclick="return insertImage(\''.$iurl.'\','.$imgInfo[0].','.$imgInfo[1].',\''.$origFile.'\');">';
+                                               $ATag = '<a href="#" onclick="return insertImage(\''.$iurl.'\','.$imgInfo[0].','.$imgInfo[1].');">';
                                        }
                                        $ATag_e='</a>';
                                        if ($plainFlag && (($imgInfo[0] > $this->plainMaxWidth) || ($imgInfo[1] > $this->plainMaxHeight)))      {
@@ -864,7 +945,119 @@ class tx_rtehtmlarea_select_image extends browse_links {
 
                return $code;
        }
+       
+       /**
+        * For RTE: This displays all IMAGES (gif,png,jpg) (from extensionList) from folder. Thumbnails are shown for images.
+        * This listing is of images located in the web-accessible paths ONLY - the listing is for drag-n-drop use in the RTE
+        *
+        * @param       string          The folder path to expand
+        * @param       string          List of fileextensions to show
+        * @return      string          HTML output
+        */
+       function TBE_dragNDrop($expandFolder=0,$extensionList='')       {
+               global $BACK_PATH;
+
+               $expandFolder = $expandFolder ? $expandFolder : $this->expandFolder;
+               $out='';
+               if ($expandFolder && $this->checkFolder($expandFolder)) {
+                       if ($this->isWebFolder($expandFolder))  {
+
+                                       // Read files from directory:
+                               $files = t3lib_div::getFilesInDir($expandFolder,$extensionList,1,1);    // $extensionList="",$prependPath=0,$order='')
+                               if (is_array($files))   {
+                                       $out.=$this->barheader(sprintf($GLOBALS['LANG']->getLL('files').' (%s):',count($files)));
+
+                                       $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
+                                       $picon='<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/i/_icon_webfolders.gif','width="18" height="16"').' alt="" />';
+                                       $picon.=htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($expandFolder),$titleLen));
+                                       $out.=$picon.'<br />';
+
+                                               // Init row-array:
+                                       $lines=array();
+
+                                               // Add "drag-n-drop" message:
+                                       $lines[]='
+                                               <tr>
+                                                       <td colspan="2">'.$this->getMsgBox($GLOBALS['LANG']->getLL('findDragDrop')).'</td>
+                                               </tr>';
+
+                                               // Fraverse files:
+                                       while(list(,$filepath)=each($files))    {
+                                               $fI = pathinfo($filepath);
+
+                                                       // URL of image:
+                                               $iurl = $this->siteURL.t3lib_div::rawurlencodeFP(substr($filepath,strlen(PATH_site)));
+
+                                                       // Show only web-images
+                                               if (t3lib_div::inList('gif,jpeg,jpg,png',strtolower($fI['extension']))) {
+                                                       $imgInfo = @getimagesize($filepath);
+                                                       $pDim = $imgInfo[0].'x'.$imgInfo[1].' pixels';
+
+                                                       $ficon = t3lib_BEfunc::getFileIcon(strtolower($fI['extension']));
+                                                       $size=' ('.t3lib_div::formatSize(filesize($filepath)).'bytes'.($pDim?', '.$pDim:'').')';
+                                                       $icon = '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/fileicons/'.$ficon,'width="18" height="16"').' class="absmiddle" title="'.htmlspecialchars($fI['basename'].$size).'" alt="" />';
+                                                       $filenameAndIcon=$icon.htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($filepath),$titleLen));
+
+                                                       if (t3lib_div::_GP('noLimit'))  {
+                                                               $maxW=10000;
+                                                               $maxH=10000;
+                                                       } else {
+                                                               $maxW=380;
+                                                               $maxH=500;
+                                                       }
+                                                       $IW = $imgInfo[0];
+                                                       $IH = $imgInfo[1];
+                                                       if ($IW>$maxW)  {
+                                                               $IH=ceil($IH/$IW*$maxW);
+                                                               $IW=$maxW;
+                                                       }
+                                                       if ($IH>$maxH)  {
+                                                               $IW=ceil($IW/$IH*$maxH);
+                                                               $IH=$maxH;
+                                                       }
 
+                                                               // Make row:
+                                                       $lines[]='
+                                                               <tr class="bgColor4">
+                                                                       <td nowrap="nowrap">'.$filenameAndIcon.'&nbsp;</td>
+                                                                       <td nowrap="nowrap">'.
+                                                                       ($imgInfo[0]!=$IW ? '<a href="'.htmlspecialchars(t3lib_div::linkThisScript(array('noLimit'=>'1'))).'">'.
+                                                                                                               '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/icon_warning2.gif','width="18" height="16"').' title="'.$GLOBALS['LANG']->getLL('clickToRedrawFullSize',1).'" alt="" />'.
+                                                                                                               '</a>':'').
+                                                                       $pDim.'&nbsp;</td>
+                                                               </tr>';
+                                                               // Remove hardcoded border="1"
+                                                               // Add default class for images
+                                                       $lines[]='
+                                                               <tr>
+                                                                       <td colspan="2"><img src="'.$iurl.'" width="'.$IW.'" height="'.$IH.'" alt=""' . ($this->defaultClass?(' class="'.$this->defaultClass.'"'):''). ' /></td>
+                                                               </tr>';
+                                                       $lines[]='
+                                                               <tr>
+                                                                       <td colspan="2"><img src="clear.gif" width="1" height="3" alt="" /></td>
+                                                               </tr>';
+                                               }
+                                       }
+
+                                               // Finally, wrap all rows in a table tag:
+                                       $out.='
+
+
+                       <!--
+                               File listing / Drag-n-drop
+                       -->
+                                               <table border="0" cellpadding="0" cellspacing="1" id="typo3-dragBox">
+                                                       '.implode('',$lines).'
+                                               </table>';
+                               }
+                       } else {
+                                       // Print this warning if the folder is NOT a web folder:
+                               $out.=$this->barheader($GLOBALS['LANG']->getLL('files'));
+                               $out.=$this->getMsgBox($GLOBALS['LANG']->getLL('noWebFolder'),'icon_warning2');
+                       }
+               }
+               return $out;
+       }
 
 }
 
index 63853a5..21d8bba 100644 (file)
                        <label index="border">Border</label>
                        <label index="margin_tb">Margin top/bottom</label>
                        <label index="margin_lr">Margin left/right</label>
+                       <label index="padding_top">Top padding</label>
+                       <label index="padding_right">Right padding</label>
+                       <label index="padding_bottom">Bottom padding</label>
+                       <label index="padding_left">Left padding</label>
                        <label index="float">Float</label>
                        <label index="notSet">Not set</label>
                        <label index="nonFloating">Non-floating</label>
index eb7cb94..0218454 100644 (file)
@@ -61,10 +61,18 @@ class tx_rtehtmlarea_pi3 extends tslib_pibase {
                global $TYPO3_CONF_VARS;
                
                $clickenlarge = isset($this->cObj->parameters['clickenlarge']) ? $this->cObj->parameters['clickenlarge'] : 0;
-               $file = isset($this->cObj->parameters['clickenlargesrc']) ? $this->cObj->parameters['clickenlargesrc'] : '';
+               $path = $this->cObj->parameters['src'];
+               $pathPre = $TYPO3_CONF_VARS['BE']['RTE_imageStorageDir'].'RTEmagicC_';
+               if (t3lib_div::isFirstPartOfStr($path,$pathPre)) {
+                               // Find original file:
+                       $pI=pathinfo(substr($path,strlen($pathPre)));
+                       $filename = substr($pI['basename'],0,-strlen('.'.$pI['extension']));
+                       $file = $TYPO3_CONF_VARS['BE']['RTE_imageStorageDir'].'RTEmagicP_'.$filename;
+               } else {
+                       $file = $this->cObj->parameters['src'];
+               }
                
                unset($this->cObj->parameters['clickenlarge']);
-               unset($this->cObj->parameters['clickenlargesrc']);
                unset($this->cObj->parameters['allParams']);
                $content = '<img '. t3lib_div::implodeAttributes($this->cObj->parameters, TRUE, TRUE) . ' />';