1<!--
2 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
3 * Copyright (C) 2003-2007 Frederico Caldeira Knabben
4 *
5 * == BEGIN LICENSE ==
6 *
7 * Licensed under the terms of any of the following licenses at your
8 * choice:
9 *
10 *  - GNU General Public License Version 2 or later (the "GPL")
11 *    http://www.gnu.org/licenses/gpl.html
12 *
13 *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
14 *    http://www.gnu.org/licenses/lgpl.html
15 *
16 *  - Mozilla Public License Version 1.1 or later (the "MPL")
17 *    http://www.mozilla.org/MPL/MPL-1.1.html
18 *
19 * == END LICENSE ==
20 *
21 * Test page for the File Browser connectors.
22-->
23<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
24<html xmlns="http://www.w3.org/1999/xhtml">
25<head>
26	<title>FCKeditor - Connectors Tests</title>
27	<script type="text/javascript">
28
29function BuildBaseUrl( command )
30{
31	var sUrl =
32		document.getElementById('cmbConnector').value +
33		'?Command=' + command +
34		'&Type=' + document.getElementById('cmbType').value +
35		'&CurrentFolder=' + document.getElementById('txtFolder').value ;
36
37	return sUrl ;
38}
39
40function SetFrameUrl( url )
41{
42	if ( document.all )
43		eRunningFrame.document.location = url ;
44	else
45		document.getElementById('eRunningFrame').src = url ;
46
47	document.getElementById('eUrl').innerHTML = url ;
48}
49
50function GetFolders()
51{
52	SetFrameUrl( BuildBaseUrl( 'GetFolders' ) ) ;
53	return false ;
54}
55
56function GetFoldersAndFiles()
57{
58	SetFrameUrl( BuildBaseUrl( 'GetFoldersAndFiles' ) ) ;
59	return false ;
60}
61
62function CreateFolder()
63{
64	var sFolder = prompt( 'Type the folder name:', 'Test Folder' ) ;
65
66	if ( ! sFolder )
67		return false ;
68
69	var sUrl = BuildBaseUrl( 'CreateFolder' ) ;
70	sUrl += '&NewFolderName=' + encodeURIComponent( sFolder ) ;
71
72	SetFrameUrl( sUrl ) ;
73	return false ;
74}
75
76function OnUploadCompleted( errorNumber, fileName )
77{
78	switch ( errorNumber )
79	{
80		case 0 :
81			alert( 'File uploaded with no errors' ) ;
82			break ;
83		case 201 :
84			GetFoldersAndFiles() ;
85			alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + fileName + '"' ) ;
86			break ;
87		case 202 :
88			alert( 'Invalid file' ) ;
89			break ;
90		default :
91			alert( 'Error on file upload. Error number: ' + errorNumber ) ;
92			break ;
93	}
94}
95
96this.frames.frmUpload = this ;
97
98function SetAction()
99{
100	var sUrl = BuildBaseUrl( 'FileUpload' ) ;
101	document.getElementById('eUrl').innerHTML = sUrl ;
102	document.getElementById('frmUpload').action = sUrl ;
103}
104
105	</script>
106</head>
107<body>
108	<table height="100%" cellspacing="0" cellpadding="0" width="100%" border="0">
109		<tr>
110			<td>
111				<table cellspacing="0" cellpadding="0" border="0">
112					<tr>
113						<td>
114							Connector:<br />
115							<select id="cmbConnector" name="cmbConnector">
116								<option value="asp/connector.asp" selected="selected">ASP</option>
117								<option value="aspx/connector.aspx">ASP.Net</option>
118								<option value="cfm/connector.cfm">ColdFusion</option>
119								<option value="lasso/connector.lasso">Lasso</option>
120								<option value="perl/connector.cgi">Perl</option>
121								<option value="php/connector.php">PHP</option>
122								<option value="py/connector.py">Python</option>
123							</select>
124						</td>
125						<td>
126							&nbsp;&nbsp;&nbsp;</td>
127						<td>
128							Current Folder<br />
129							<input id="txtFolder" type="text" value="/" name="txtFolder" /></td>
130						<td>
131							&nbsp;&nbsp;&nbsp;</td>
132						<td>
133							Resource Type<br />
134							<select id="cmbType" name="cmbType">
135								<option value="File" selected="selected">File</option>
136								<option value="Image">Image</option>
137								<option value="Flash">Flash</option>
138								<option value="Media">Media</option>
139								<option value="Invalid">Invalid Type (for testing)</option>
140							</select>
141						</td>
142					</tr>
143				</table>
144				<br />
145				<table cellspacing="0" cellpadding="0" border="0">
146					<tr>
147						<td valign="top">
148							<a href="#" onclick="GetFolders();">Get Folders</a></td>
149						<td>
150							&nbsp;&nbsp;&nbsp;</td>
151						<td valign="top">
152							<a href="#" onclick="GetFoldersAndFiles();">Get Folders and Files</a></td>
153						<td>
154							&nbsp;&nbsp;&nbsp;</td>
155						<td valign="top">
156							<a href="#" onclick="CreateFolder();">Create Folder</a></td>
157						<td>
158							&nbsp;&nbsp;&nbsp;</td>
159						<td valign="top">
160							<form id="frmUpload" action="" target="eRunningFrame" method="post" enctype="multipart/form-data">
161								File Upload<br />
162								<input id="txtFileUpload" type="file" name="NewFile" />
163								<input type="submit" value="Upload" onclick="SetAction();" />
164							</form>
165						</td>
166					</tr>
167				</table>
168				<br />
169				URL: <span id="eUrl"></span>
170			</td>
171		</tr>
172		<tr>
173			<td height="100%" valign="top">
174				<iframe id="eRunningFrame" src="javascript:void(0)" name="eRunningFrame" width="100%"
175					height="100%"></iframe>
176			</td>
177		</tr>
178	</table>
179</body>
180</html>
181