GetSimple Support Forum
Unflexible filebrowser.php in GS 3.1 - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: Developer Discussions (http://get-simple.info/forums/forumdisplay.php?fid=8)
+--- Thread: Unflexible filebrowser.php in GS 3.1 (/showthread.php?tid=3274)



Unflexible filebrowser.php in GS 3.1 - mvlcek - 2012-06-16

@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)


Unflexible filebrowser.php in GS 3.1 - n00dles101 - 2012-06-16

This has already been dealt with in GS3.1.1.

Also added a new option 'func' for a callback function on the opening window.


Unflexible filebrowser.php in GS 3.1 - n00dles101 - 2012-06-17

@mvlcek, Thanks, I've ammended your script and added it to the SVN for 3.1.2