Anfrage direkt an:
0175/9167312
email@henryschorradt.de

EDV & IT Service – Dienstleistungen – einfach-machen.de

EDV – Computerhilfe – Joomla – Wordpress – Magento – Administration – Internet – Telefonie – Programmierung – Satz & Layout

Lanot File Manager – Uploader – Magento 1.9.3 – Bugfix

Hier ist ein Patch für Lanot File Manager v. 1.1.0 für Magento 1.9.3

Der Uploader wurde im Patch zu Magento 1.9.3 etwas überarbeitet sodass aufbauende Module eventl. nicht mehr funktionieren. So ist auch der Lanot File Manager betroffen. Da ich den Eindruck habe, dass dieses Module nicht mehr weiterentwickelt wird, habe ich mir erlaubt selbst ein Patch/Bugfix zu erstellen.

---
 .../Block/Adminhtml/Content/Uploader.php           | 31 +++++++++++++++++-----
 .../community/Lanot/FileManager/etc/config.xml     |  2 +-
 .../default/default/layout/lanot_filemanager.xml   |  7 +++--
 3 files changed, 31 insertions(+), 9 deletions(-)

diff --git a/app/code/community/Lanot/FileManager/Block/Adminhtml/Content/Uploader.php b/app/code/community/Lanot/FileManager/Block/Adminhtml/Content/Uploader.php
index 801ba45..5557fff 100644
--- a/app/code/community/Lanot/FileManager/Block/Adminhtml/Content/Uploader.php
+++ b/app/code/community/Lanot/FileManager/Block/Adminhtml/Content/Uploader.php
@@ -18,15 +18,16 @@
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 class Lanot_FileManager_Block_Adminhtml_Content_Uploader
-    extends Mage_Adminhtml_Block_Cms_Wysiwyg_Images_Content_Uploader
+    extends Mage_Uploader_Block_Multiple
+    //extends Mage_Adminhtml_Block_Cms_Wysiwyg_Images_Content_Uploader
 {
     public function __construct()
     {
         parent::__construct();
-        $params = $this->getConfig()->getParams();
+        $params = $this->getUploaderConfig()->getParams();
         $type = $this->_getMediaType();
-
         $allowed = Mage::getSingleton('lanot_filemanager/storage')->getAllowedExtensions($type);
+
         $labels = array();
         $files = array();
 
@@ -40,15 +41,33 @@ class Lanot_FileManager_Block_Adminhtml_Content_Uploader
             }
         }
 
-        $this->getConfig()
-            ->setUrl(Mage::getModel('adminhtml/url')->addSessionParam()->getUrl('*/*/upload', array('type' => $type)))
+        $this->getUploaderConfig()
+            ->setTarget(
+                Mage::getModel('adminhtml/url')->addSessionParam()->getUrl('*/*/upload', array('type' => $type))
+            )
             ->setParams($params)
-            ->setFileField('image')//@todo: post key
+            ->setFileParameterName('image')
             ->setFilters(array(
                 'files' => array(
                     'label' => $this->helper('cms')->__('Files (%s)', implode(', ', $labels)),
                     'files' => $files
                 )
             ));
+
+    }
+
+
+    /**
+     * Return current media type based on request or data
+     * @return string
+     */
+    protected function _getMediaType()
+    {
+        if ($this->hasData('media_type')) {
+            return $this->_getData('media_type');
+        }
+        return $this->getRequest()->getParam('type');
     }
+
+
 }
diff --git a/app/code/community/Lanot/FileManager/etc/config.xml b/app/code/community/Lanot/FileManager/etc/config.xml
index 3952316..e27a733 100644
--- a/app/code/community/Lanot/FileManager/etc/config.xml
+++ b/app/code/community/Lanot/FileManager/etc/config.xml
@@ -3,7 +3,7 @@
 
     <modules>
         <Lanot_FileManager>
-            <version>1.1.0</version>
+            <version>1.1.1</version>
         </Lanot_FileManager>
     </modules>
 
diff --git a/app/design/adminhtml/default/default/layout/lanot_filemanager.xml b/app/design/adminhtml/default/default/layout/lanot_filemanager.xml
index adbc2f3..ea23695 100644
--- a/app/design/adminhtml/default/default/layout/lanot_filemanager.xml
+++ b/app/design/adminhtml/default/default/layout/lanot_filemanager.xml
@@ -10,8 +10,8 @@
     <lanot_filemanager_adminhtml_media_index>
         <update handle="editor" />
         <reference name="head">
-            <action method="addCss"><name>lanot_filemanager.css</name></action>
             <action method="addJs"><script>lanot/filemanager/browser.js</script></action>
+            <action method="addCss"><name>lanot_filemanager.css</name></action>
         </reference>
         <reference name="left">
             <block name="wysiwyg_images.js" type="lanot_filemanager/adminhtml_content" template="lanot/filemanager/browser/js.phtml" />
@@ -19,7 +19,10 @@
         </reference>
         <reference name="content">
             <block name="wysiwyg_images.content"  type="lanot_filemanager/adminhtml_content" template="cms/browser/content.phtml">
-                <block name="wysiwyg_images.uploader" type="lanot_filemanager/adminhtml_content_uploader" template="cms/browser/content/uploader.phtml" />
+                <block name="wysiwyg_images.uploader" type="lanot_filemanager/adminhtml_content_uploader" template="media/uploader.phtml" >
+                    <!-- template="cms/browser/content/uploader.phtml"  -->
+                    <block name="additional_scripts" type="core/template" template="cms/browser/content/uploader.phtml"/>
+                </block>
                 <block name="wysiwyg_images.newfolder" type="adminhtml/cms_wysiwyg_images_content_newfolder" template="cms/browser/content/newfolder.phtml" />
             </block>
         </reference>
-- 
1.9.5.msysgit.0