GetSimple Support Forum

Full Version: Unflexible filebrowser.php in GS 3.1
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
@GS Developers:
In the GS 3.1 filebrowser.php there is the following code:
Code:
<script type='text/javascript'>
    function submitLink($funcNum, $url) {
        if ($funcNum=="2"){
            if(window.opener){
                window.opener.CKEDITOR.tools.callFunction($funcNum, $url);
            }
        }
        <?php if (isset($_GET['returnid'])){ ?>
            if(window.opener){
                window.opener.document.getElementById('<?php echo $returnid; ?>').value=$url;
            }
        <?php } ?>    
        window.close();
    }
    </script>
The check for "2" (as opposed to GS 3.0) prevents other instances of CKEditor (e.g. for I18N Custom Fields) from selecting an image, as they will be called with another function number.
I'm not sure what should be achieved with this weird code, but either remove the =="2" or use a code like this:
Code:
<script type='text/javascript'>
    function submitLink($funcNum, $url) {
        <?php if (isset($_GET['returnid'])){ ?>
            if(window.opener){
                window.opener.document.getElementById('<?php echo $returnid; ?>').value=$url;
            }
        <?php } else { ?>
            if(window.opener){
                window.opener.CKEDITOR.tools.callFunction($funcNum, $url);
            }
        <?php } ?>
        window.close();
    }
    </script>
(Not sure if this is what was intended)
This has already been dealt with in GS3.1.1.

Also added a new option 'func' for a callback function on the opening window.
@mvlcek, Thanks, I've ammended your script and added it to the SVN for 3.1.2