Can the CKFinder finder.SelectFunction function only be in the window scope?
I try to have an object's method called as the SelectFunction, but line 122 in ckfinder.js (functionName.toString().match( /function ([^(]+)/ )[1]
fails on that. An anonymous function is also not working and it also fails when I overwrite or set the function in the window scope like window.mySelectFunction = function(){alert('test');}
Is there a way?
Wed, 08/06/2008 - 11:17
#1

Re: CKFinder.SelectFunction can only be in the window scope?
Wiktor Walc
CTO, CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+
Re: CKFinder.SelectFunction can only be in the window scope?
Thanks Wiktor,

Can't it be built so that a function be passed by reference? It should be possible to trigger it by something like parent.opener from the CKFinder like the default filebrowser of the FCKeditor does, wouldn't it?
I really miss this possibility
Taking this one step further, perhaps an event system for the CKfinder is a neat idea: having the possibility to add functions for events like thumClick, thumbSelect, ckfinderClose ...
Is there the possibility to add feature request tickets?
Re: CKFinder.SelectFunction can only be in the window scope?
Re: CKFinder.SelectFunction can only be in the window scope?
window.testFunction = function(url) { alert('you clicked ' + url) } ;you can wrap whatever object, scope or anything else that you want there.
Re: CKFinder.SelectFunction can only be in the window scope?
I tried this earlier and line 122 in ckfinder.js thrown an error on that too.
Re: CKFinder.SelectFunction can only be in the window scope?
yes, I tested it.:
<%@ codepage="65001" language="VBScript" %> <% Option Explicit %> <% ' CKFinder ' ======== ' http://www.ckfinder.com ' Copyright (C) 2007-2008 Frederico Caldeira Knabben (FredCK.com) ' ' The software, this file and its contents are subject to the CKFinder ' License. Please read the license.txt file before using, installing, copying, ' modifying or distribute this file or part of its contents. The contents of ' this file is part of the Source Code of CKFinder. %> <% ' You must set "Enable Parent Paths" on your web site in order this relative include to work. %> <! -- # INCLUDE file="../../ckfinder.asp" -- > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>CKFinder - Sample - Standalone</title> <style type="text/css"> /* By defining CKFinderFrame, you are able to customize the CKFinder frame style */ .CKFinderFrame { border: solid 2px #e3e3c7; background-color: #f1f1e3; } </style> <script type="text/javascript"> // This is a sample function which is called when a file is selected in CKFinder. function ShowFileInfo( fileUrl ) { alert( 'The selected file URL is "' + fileUrl + '"' ) ; } window.testFunction = function(url) { alert('you clicked ' + url) } ; </script> </head> <body> <h1> CKFinder - Sample - Standalone </h1> <hr /> <p> CKFinder may be used in standalone mode inside any page, to create a repository manager with easy. You may define a custom JavaScript function to be called when an image is selected (double-clicked).</p> <p style="padding-left: 30px; padding-right: 30px;"> <% ' You can use the "CKFinder" class to render CKFinder in a page: Dim oFinder Set oFinder = New CKFinder oFinder.BasePath = "../../" ' The path for the installation of CKFinder (default = "/ckfinder/"). oFinder.SelectFunction = "testFunction" oFinder.Create ' It can also be done in a single line, calling the "static" ' CKFinder_CreateStatic( basePath, width, height, selectFunction ) function: ' CKFinder_CreateStatic "../../", empty, empty, "ShowFileInfo" %> </p> </body> </html>Re: CKFinder.SelectFunction can only be in the window scope?
Nevertheless I really would prefer to pass a function by reference that gets called like e.g. parent.opener.SelectFunction from the CKFinder.