1<!-- 2 * FCKeditor - The text editor for Internet - http://www.fckeditor.net 3 * Copyright (C) 2003-2009 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 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 28 <script type="text/javascript"> 29 30// Automatically detect the correct document.domain (#1919). 31(function() 32{ 33 var d = document.domain ; 34 35 while ( true ) 36 { 37 // Test if we can access a parent property. 38 try 39 { 40 var test = window.opener.document.domain ; 41 break ; 42 } 43 catch( e ) {} 44 45 // Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ... 46 d = d.replace( /.*?(?:\.|$)/, '' ) ; 47 48 if ( d.length == 0 ) 49 break ; // It was not able to detect the domain. 50 51 try 52 { 53 document.domain = d ; 54 } 55 catch (e) 56 { 57 break ; 58 } 59 } 60})() ; 61 62function BuildBaseUrl( command ) 63{ 64 var sUrl = 65 document.getElementById('cmbConnector').value + 66 '?Command=' + command + 67 '&Type=' + document.getElementById('cmbType').value + 68 '&CurrentFolder=' + encodeURIComponent(document.getElementById('txtFolder').value) ; 69 70 return sUrl ; 71} 72 73function SetFrameUrl( url ) 74{ 75 document.getElementById('eRunningFrame').src = url ; 76 77 document.getElementById('eUrl').innerHTML = url ; 78} 79 80function GetFolders() 81{ 82 SetFrameUrl( BuildBaseUrl( 'GetFolders' ) ) ; 83 return false ; 84} 85 86function GetFoldersAndFiles() 87{ 88 SetFrameUrl( BuildBaseUrl( 'GetFoldersAndFiles' ) ) ; 89 return false ; 90} 91 92function CreateFolder() 93{ 94 var sFolder = prompt( 'Type the folder name:', 'Test Folder' ) ; 95 96 if ( ! sFolder ) 97 return false ; 98 99 var sUrl = BuildBaseUrl( 'CreateFolder' ) ; 100 sUrl += '&NewFolderName=' + encodeURIComponent( sFolder ) ; 101 102 SetFrameUrl( sUrl ) ; 103 return false ; 104} 105 106function OnUploadCompleted( errorNumber, fileName ) 107{ 108 switch ( errorNumber ) 109 { 110 case 0 : 111 alert( 'File uploaded with no errors' ) ; 112 break ; 113 case 201 : 114 GetFoldersAndFiles() ; 115 alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + fileName + '"' ) ; 116 break ; 117 case 202 : 118 alert( 'Invalid file' ) ; 119 break ; 120 default : 121 alert( 'Error on file upload. Error number: ' + errorNumber ) ; 122 break ; 123 } 124} 125 126this.frames.frmUpload = this ; 127 128function SetAction() 129{ 130 var sUrl = BuildBaseUrl( 'FileUpload' ) ; 131 document.getElementById('eUrl').innerHTML = sUrl ; 132 document.getElementById('frmUpload').action = sUrl ; 133} 134 135 </script> 136</head> 137<body> 138 <table height="100%" cellspacing="0" cellpadding="0" width="100%" border="0"> 139 <tr> 140 <td> 141 <table cellspacing="0" cellpadding="0" border="0"> 142 <tr> 143 <td> 144 Connector:<br /> 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> 153 </select> 154 </td> 155 <td> 156 </td> 157 <td> 158 Current Folder<br /> 159 <input id="txtFolder" type="text" value="/" name="txtFolder" /></td> 160 <td> 161 </td> 162 <td> 163 Resource Type<br /> 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> 170 </select> 171 </td> 172 </tr> 173 </table> 174 <br /> 175 <table cellspacing="0" cellpadding="0" border="0"> 176 <tr> 177 <td valign="top"> 178 <a href="#" onclick="GetFolders();">Get Folders</a></td> 179 <td> 180 </td> 181 <td valign="top"> 182 <a href="#" onclick="GetFoldersAndFiles();">Get Folders and Files</a></td> 183 <td> 184 </td> 185 <td valign="top"> 186 <a href="#" onclick="CreateFolder();">Create Folder</a></td> 187 <td> 188 </td> 189 <td valign="top"> 190 <form id="frmUpload" action="" target="eRunningFrame" method="post" enctype="multipart/form-data"> 191 File Upload<br /> 192 <input id="txtFileUpload" type="file" name="NewFile" /> 193 <input type="submit" value="Upload" onclick="SetAction();" /> 194 </form> 195 </td> 196 </tr> 197 </table> 198 <br /> 199 URL: <span id="eUrl"></span> 200 </td> 201 </tr> 202 <tr> 203 <td height="100%" valign="top"> 204 <iframe id="eRunningFrame" src="javascript:void(0)" name="eRunningFrame" width="100%" 205 height="100%"></iframe> 206 </td> 207 </tr> 208 </table> 209</body> 210</html> 211