Your assumptions are correct, because function name is later passed via url, you may assign only a function name to a finder.SelectFunction. Calling a method or assigning an anonymous function will not work.
<%@ 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?
Wiktor Walc
CTO, CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+
Re: CKFinder.SelectFunction can only be in the window scope?
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?
<%@ 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.