2
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
3
* Copyright (C) 2003-2010 Frederico Caldeira Knabben
7
* Licensed under the terms of any of the following licenses at your
10
* - GNU General Public License Version 2 or later (the "GPL")
11
* http://www.gnu.org/licenses/gpl.html
13
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
14
* http://www.gnu.org/licenses/lgpl.html
16
* - Mozilla Public License Version 1.1 or later (the "MPL")
17
* http://www.mozilla.org/MPL/MPL-1.1.html
21
* Test page for the File Browser connectors.
23
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
24
<html xmlns="http://www.w3.org/1999/xhtml">
26
<title>FCKeditor - Connectors Tests</title>
27
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
28
<script type="text/javascript">
30
// Automatically detect the correct document.domain (#1919).
33
var d = document.domain ;
37
// Test if we can access a parent property.
40
var test = window.opener.document.domain ;
45
// Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ...
46
d = d.replace( /.*?(?:\.|$)/, '' ) ;
49
break ; // It was not able to detect the domain.
62
function BuildBaseUrl( command )
65
document.getElementById('cmbConnector').value +
66
'?Command=' + command +
67
'&Type=' + document.getElementById('cmbType').value +
68
'&CurrentFolder=' + encodeURIComponent(document.getElementById('txtFolder').value) ;
73
function SetFrameUrl( url )
75
document.getElementById('eRunningFrame').src = url ;
77
document.getElementById('eUrl').innerHTML = url ;
82
SetFrameUrl( BuildBaseUrl( 'GetFolders' ) ) ;
86
function GetFoldersAndFiles()
88
SetFrameUrl( BuildBaseUrl( 'GetFoldersAndFiles' ) ) ;
92
function CreateFolder()
94
var sFolder = prompt( 'Type the folder name:', 'Test Folder' ) ;
99
var sUrl = BuildBaseUrl( 'CreateFolder' ) ;
100
sUrl += '&NewFolderName=' + encodeURIComponent( sFolder ) ;
102
SetFrameUrl( sUrl ) ;
106
function OnUploadCompleted( errorNumber, fileName )
108
switch ( errorNumber )
111
alert( 'File uploaded with no errors' ) ;
114
GetFoldersAndFiles() ;
115
alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + fileName + '"' ) ;
118
alert( 'Invalid file' ) ;
121
alert( 'Error on file upload. Error number: ' + errorNumber ) ;
126
this.frames.frmUpload = this ;
130
var sUrl = BuildBaseUrl( 'FileUpload' ) ;
131
document.getElementById('eUrl').innerHTML = sUrl ;
132
document.getElementById('frmUpload').action = sUrl ;
138
<table height="100%" cellspacing="0" cellpadding="0" width="100%" border="0">
141
<table cellspacing="0" cellpadding="0" border="0">
145
<select id="cmbConnector" name="cmbConnector">
146
<option value="asp/connector.asp" selected="selected">ASP</option>
147
<option value="aspx/connector.aspx">ASP.Net</option>
148
<option value="cfm/connector.cfm">ColdFusion</option>
149
<option value="lasso/connector.lasso">Lasso</option>
150
<option value="perl/connector.cgi">Perl</option>
151
<option value="php/connector.php">PHP</option>
152
<option value="py/connector.py">Python</option>
156
</td>
159
<input id="txtFolder" type="text" value="/" name="txtFolder" /></td>
161
</td>
164
<select id="cmbType" name="cmbType">
165
<option value="File" selected="selected">File</option>
166
<option value="Image">Image</option>
167
<option value="Flash">Flash</option>
168
<option value="Media">Media</option>
169
<option value="Invalid">Invalid Type (for testing)</option>
175
<table cellspacing="0" cellpadding="0" border="0">
178
<a href="#" onclick="GetFolders();">Get Folders</a></td>
180
</td>
182
<a href="#" onclick="GetFoldersAndFiles();">Get Folders and Files</a></td>
184
</td>
186
<a href="#" onclick="CreateFolder();">Create Folder</a></td>
188
</td>
190
<form id="frmUpload" action="" target="eRunningFrame" method="post" enctype="multipart/form-data">
192
<input id="txtFileUpload" type="file" name="NewFile" />
193
<input type="submit" value="Upload" onclick="SetAction();" />
199
URL: <span id="eUrl"></span>
203
<td height="100%" valign="top">
204
<iframe id="eRunningFrame" src="javascript:void(0)" name="eRunningFrame" width="100%"
205
height="100%"></iframe>