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=' + encodeURIComponent(document.getElementById('txtFolder').value) ; 36 37 return sUrl ; 38} 39 40function SetFrameUrl( url ) 41{ 42 document.getElementById('eRunningFrame').src = url ; 43 44 document.getElementById('eUrl').innerHTML = url ; 45} 46 47function GetFolders() 48{ 49 SetFrameUrl( BuildBaseUrl( 'GetFolders' ) ) ; 50 return false ; 51} 52 53function GetFoldersAndFiles() 54{ 55 SetFrameUrl( BuildBaseUrl( 'GetFoldersAndFiles' ) ) ; 56 return false ; 57} 58 59function CreateFolder() 60{ 61 var sFolder = prompt( 'Type the folder name:', 'Test Folder' ) ; 62 63 if ( ! sFolder ) 64 return false ; 65 66 var sUrl = BuildBaseUrl( 'CreateFolder' ) ; 67 sUrl += '&NewFolderName=' + encodeURIComponent( sFolder ) ; 68 69 SetFrameUrl( sUrl ) ; 70 return false ; 71} 72 73function OnUploadCompleted( errorNumber, fileName ) 74{ 75 switch ( errorNumber ) 76 { 77 case 0 : 78 alert( 'File uploaded with no errors' ) ; 79 break ; 80 case 201 : 81 GetFoldersAndFiles() ; 82 alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + fileName + '"' ) ; 83 break ; 84 case 202 : 85 alert( 'Invalid file' ) ; 86 break ; 87 default : 88 alert( 'Error on file upload. Error number: ' + errorNumber ) ; 89 break ; 90 } 91} 92 93this.frames.frmUpload = this ; 94 95function SetAction() 96{ 97 var sUrl = BuildBaseUrl( 'FileUpload' ) ; 98 document.getElementById('eUrl').innerHTML = sUrl ; 99 document.getElementById('frmUpload').action = sUrl ; 100} 101 102 </script> 103</head> 104<body> 105 <table height="100%" cellspacing="0" cellpadding="0" width="100%" border="0"> 106 <tr> 107 <td> 108 <table cellspacing="0" cellpadding="0" border="0"> 109 <tr> 110 <td> 111 Connector:<br /> 112 <select id="cmbConnector" name="cmbConnector"> 113 <option value="asp/connector.asp" selected="selected">ASP</option> 114 <option value="aspx/connector.aspx">ASP.Net</option> 115 <option value="cfm/connector.cfm">ColdFusion</option> 116 <option value="lasso/connector.lasso">Lasso</option> 117 <option value="perl/connector.cgi">Perl</option> 118 <option value="php/connector.php">PHP</option> 119 <option value="py/connector.py">Python</option> 120 </select> 121 </td> 122 <td> 123 </td> 124 <td> 125 Current Folder<br /> 126 <input id="txtFolder" type="text" value="/" name="txtFolder" /></td> 127 <td> 128 </td> 129 <td> 130 Resource Type<br /> 131 <select id="cmbType" name="cmbType"> 132 <option value="File" selected="selected">File</option> 133 <option value="Image">Image</option> 134 <option value="Flash">Flash</option> 135 <option value="Media">Media</option> 136 <option value="Invalid">Invalid Type (for testing)</option> 137 </select> 138 </td> 139 </tr> 140 </table> 141 <br /> 142 <table cellspacing="0" cellpadding="0" border="0"> 143 <tr> 144 <td valign="top"> 145 <a href="#" onclick="GetFolders();">Get Folders</a></td> 146 <td> 147 </td> 148 <td valign="top"> 149 <a href="#" onclick="GetFoldersAndFiles();">Get Folders and Files</a></td> 150 <td> 151 </td> 152 <td valign="top"> 153 <a href="#" onclick="CreateFolder();">Create Folder</a></td> 154 <td> 155 </td> 156 <td valign="top"> 157 <form id="frmUpload" action="" target="eRunningFrame" method="post" enctype="multipart/form-data"> 158 File Upload<br /> 159 <input id="txtFileUpload" type="file" name="NewFile" /> 160 <input type="submit" value="Upload" onclick="SetAction();" /> 161 </form> 162 </td> 163 </tr> 164 </table> 165 <br /> 166 URL: <span id="eUrl"></span> 167 </td> 168 </tr> 169 <tr> 170 <td height="100%" valign="top"> 171 <iframe id="eRunningFrame" src="javascript:void(0)" name="eRunningFrame" width="100%" 172 height="100%"></iframe> 173 </td> 174 </tr> 175 </table> 176</body> 177</html> 178