We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4018
    • 1,131 Posts
    I’ve always noticed some odd behavior in the MCPUK Resource Browser when it comes to uploading images. First, the window used to have problems refreshing and wouldn’t show any files. This one’s easy to fix. However, after fixing the refresh problem, I noticed that after uploading an image, the darn Edit button wouldn’t work right...kept telling me it couldn’t find the ImageEditor/editor.php file. If I forced a refresh, then it could find the file. So...what do ya do? Couple of simple fixes.

    First, the refresh problem. It’s been documented that the MCPUK File Manager can have problems if you use a relative path for the Connector variable. So...all you do is make sure and use a full path instead. All calls to the Resource Browser from any WYSIWYG plugin should be like so:

    {$base_url}manager/media/browser/mcpuk/browser.html?Type=images&Connector={$base_url}manager/media/browser/mcpuk/connectors/php/connector.php&ServerPath={$base_url}


    Notice the Connector variable uses the {$base_url} parameter and path to the connector file. This will ensure that the connector will refresh properly, especially in Firefox.

    You’ll also notice that I added the {$base_url} parameter to the ServerPath variable. I noticed this variable in the main fckconfig.js file and wondered what it was for. What’s odd is that the variable appears nowhere in the code for the Resource Manager. So...I added it in! wink

    Open /manager/media/browser/mcpuk/js/common.js
    Around line 57, insert the following line:

    oConnector.ServerPath		= GetUrlParam( 'ServerPath' ) ;


    Changing this alone doesn’t solve the Edit button problem so...now we need to utilize the ServerPath variable in the call to the ImageEditor:

    Open /manager/media/browser/mcpuk/frmresourceslist.html
    Around line 134, replace:

    	if(imageEditable==1 && oConnector.ResourceType.toLowerCase()=="images") {
    		oCell.innerHTML = oCell.innerHTML + '<a href="#" onclick="javascript:window.open(\'../../ImageEditor/editor.php?img=/images' + oConnector.CurrentFolder + fileName + '\',\'win\',\'status=0,toolbar=0\');"><img alt="Edit image" border="0" src="images/editImage.gif" /></a>' ;
    	}
    


    with:

    	if(imageEditable==1 && oConnector.ResourceType.toLowerCase()=="images") {
    		oCell.innerHTML = oCell.innerHTML + '<a href="#" onclick="javascript:window.open(\'' + oConnector.ServerPath + 'manager/media/ImageEditor/editor.php?img=/images' + oConnector.CurrentFolder + fileName + '\',\'win\',\'status=0,toolbar=0\');"><img alt="Edit image" border="0" src="images/editImage.gif" /></a>' ;
    	}
    


    This should solve the editor button and refresh problems. Ryan, if at all possible, see if you can get these fixes into the new code. laugh

    L8R!
      Jeff Whitfield

      "I like my coffee hot and strong, like I like my women, hot and strong... with a spoon in them."
      • 32963
      • 1,732 Posts
      Many thanks Jeff. We will see what we can do to get these changes inisde the core.
        xWisdom
        www.xwisdomhtml.com
        The fear of the Lord is the beginning of wisdom:
        MODx Co-Founder - Create and do more with less.
      • Translation from laid back island language: it’ll be there. wink
          Ryan Thrash, MODX Co-Founder
          Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
          • 8634
          • 56 Posts
          Maybe an extraordinarily stupid question, but in which file should I edit

          "{$base_url}manager/media/browser/mcpuk/browser.html?Type=images&Connector={$base_url}manager/media/browser/mcpuk/connectors/php/connector.php&ServerPath={$base_url}"

          Thanks!
            • 4018
            • 1,131 Posts
            Quote from: eko40 at Aug 04, 2005, 07:37 PM

            Maybe an extraordinarily stupid question, but in which file should I edit

            "{$base_url}manager/media/browser/mcpuk/browser.html?Type=images&Connector={$base_url}manager/media/browser/mcpuk/connectors/php/connector.php&ServerPath={$base_url}"

            Thanks!

            It’s not in a file but rather in the plugin code itself. So in the case of the FCKeditor plugin, you would go to Manage Resources, click on the Plugins tab and edit the code for the plugin itself. Shoud be fairly easy to find the lines that have this code. smiley
              Jeff Whitfield

              "I like my coffee hot and strong, like I like my women, hot and strong... with a spoon in them."
              • 4095
              • 372 Posts
              Let me know how you go Eko, I tried it and lost the toolbar, but maybe I did something slightly wrong and like and idiot, didn’t take a copy of the code 1st smiley

              If it works for you I’ll go back and try sort mine out lol

              Briggsy
                [img]http://www.emanz.ac.nz/assets/images/logo/emanz-icon_16x16.gif[/img] Emergency Management Academy of New Zealand [br] http://www.emanz.ac.nz[br][br]MODx Sandbox Login: sandbox Password: castle [br]
                Admin Sandbox Login: sandbox Password: castle
                • 4095
                • 372 Posts
                I have replaced my toolbar, replaced all the files with original, including the plugin code.

                I re-tried the above fix but it made things worse. Firstly you need to add the $base_url string in 6 places, twice on each line (the 1st ones already there). If you don’t you won’t even get the toolbar appearing.

                <script language="javascript" type="text/javascript">
                			var FCKImageBrowserURL = '{$base_url}manager/media/browser/mcpuk/browser.html?Type=images&Connector={$base_url}connectors/php/connector.php&ServerPath={$base_url}';
                			var FCKLinkBrowserURL = '{$base_url}manager/media/browser/mcpuk/browser.html?Connector={$base_url}connectors/php/connector.php&ServerPath={$base_url}';
                			var FCKFlashBrowserURL = '{$base_url}manager/media/browser/mcpuk/browser.html?Type=flash&Connector={$base_url}connectors/php/connector.php&ServerPath={$base_url}';


                Once you do that you get the tool bar but the resource manager is empty, my images don’t show up. tried to upload an image and it just said 0% and never moved (its a local network). I tried to create folders and they never showed up, and a Windows search of the drive showed nothing

                If I replace the plugin code with the orginal it goes back to its original problem of not refreshing.
                  [img]http://www.emanz.ac.nz/assets/images/logo/emanz-icon_16x16.gif[/img] Emergency Management Academy of New Zealand [br] http://www.emanz.ac.nz[br][br]MODx Sandbox Login: sandbox Password: castle [br]
                  Admin Sandbox Login: sandbox Password: castle
                  • 4018
                  • 1,131 Posts
                  Quote from: briggsys at Aug 05, 2005, 01:42 AM

                  I have replaced my toolbar, replaced all the files with original, including the plugin code.

                  I re-tried the above fix but it made things worse. Firstly you need to add the $base_url string in 6 places, twice on each line (the 1st ones already there). If you don’t you won’t even get the toolbar appearing.

                  <script language="javascript" type="text/javascript">
                  			var FCKImageBrowserURL = '{$base_url}manager/media/browser/mcpuk/browser.html?Type=images&Connector={$base_url}connectors/php/connector.php&ServerPath={$base_url}';
                  			var FCKLinkBrowserURL = '{$base_url}manager/media/browser/mcpuk/browser.html?Connector={$base_url}connectors/php/connector.php&ServerPath={$base_url}';
                  			var FCKFlashBrowserURL = '{$base_url}manager/media/browser/mcpuk/browser.html?Type=flash&Connector={$base_url}connectors/php/connector.php&ServerPath={$base_url}';


                  Once you do that you get the tool bar but the resource manager is empty, my images don’t show up. tried to upload an image and it just said 0% and never moved (its a local network). I tried to create folders and they never showed up, and a Windows search of the drive showed nothing

                  If I replace the plugin code with the orginal it goes back to its original problem of not refreshing.

                  That’s because your connector path is wrong. The thing with the connector is that it needs to be a full path and not a relative one, thus the reason for using the base url along with the path. Try this:

                  <script language="javascript" type="text/javascript">
                  			var FCKImageBrowserURL = '{$base_url}manager/media/browser/mcpuk/browser.html?Type=images&Connector={$base_url}manager/media/browser/mcpuk/connectors/php/connector.php&ServerPath={$base_url}';
                  			var FCKLinkBrowserURL = '{$base_url}manager/media/browser/mcpuk/browser.html?Connector={$base_url}manager/media/browser/mcpuk/connectors/php/connector.php&ServerPath={$base_url}';
                  			var FCKFlashBrowserURL = '{$base_url}manager/media/browser/mcpuk/browser.html?Type=flash&Connector={$base_url}manager/media/browser/mcpuk/connectors/php/connector.php&ServerPath={$base_url}';
                    Jeff Whitfield

                    "I like my coffee hot and strong, like I like my women, hot and strong... with a spoon in them."
                    • 4095
                    • 372 Posts
                    Ah.... Thanks for clearing that up, works now smiley
                      [img]http://www.emanz.ac.nz/assets/images/logo/emanz-icon_16x16.gif[/img] Emergency Management Academy of New Zealand [br] http://www.emanz.ac.nz[br][br]MODx Sandbox Login: sandbox Password: castle [br]
                      Admin Sandbox Login: sandbox Password: castle
                      • 8634
                      • 56 Posts
                      yep seems to work although I also have manager menuing problems where I need to refresh the manager several times for either the folder list or the top menu to appear again, very frustrating, but guess nothing to do with this.