1 | <!-- |
---|
2 | * FCKeditor - The text editor for internet |
---|
3 | * Copyright (C) 2003-2006 Frederico Caldeira Knabben |
---|
4 | * |
---|
5 | * Licensed under the terms of the GNU Lesser General Public License: |
---|
6 | * http://www.opensource.org/licenses/lgpl-license.php |
---|
7 | * |
---|
8 | * For further information visit: |
---|
9 | * http://www.fckeditor.net/ |
---|
10 | * |
---|
11 | * "Support Open Source software. What about a donation today?" |
---|
12 | * |
---|
13 | * File Name: test.html |
---|
14 | * Test page for the File Browser connectors. |
---|
15 | * |
---|
16 | * File Authors: |
---|
17 | * Frederico Caldeira Knabben (fredck@fckeditor.net) |
---|
18 | --> |
---|
19 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
---|
20 | <html xmlns="http://www.w3.org/1999/xhtml"> |
---|
21 | <head> |
---|
22 | <title>FCKeditor - Connectors Tests</title> |
---|
23 | <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5" /> |
---|
24 | <script type="text/javascript"> |
---|
25 | |
---|
26 | function BuildBaseUrl( command ) |
---|
27 | { |
---|
28 | var sUrl = |
---|
29 | document.getElementById('cmbConnector').value + |
---|
30 | '?Command=' + command + |
---|
31 | '&Type=' + document.getElementById('cmbType').value + |
---|
32 | '&CurrentFolder=' + document.getElementById('txtFolder').value ; |
---|
33 | |
---|
34 | return sUrl ; |
---|
35 | } |
---|
36 | |
---|
37 | function SetFrameUrl( url ) |
---|
38 | { |
---|
39 | if ( document.all ) |
---|
40 | eRunningFrame.document.location = url ; |
---|
41 | else |
---|
42 | document.getElementById('eRunningFrame').src = url ; |
---|
43 | |
---|
44 | document.getElementById('eUrl').innerHTML = url ; |
---|
45 | } |
---|
46 | |
---|
47 | function GetFolders() |
---|
48 | { |
---|
49 | SetFrameUrl( BuildBaseUrl( 'GetFolders' ) ) ; |
---|
50 | return false ; |
---|
51 | } |
---|
52 | |
---|
53 | function GetFoldersAndFiles() |
---|
54 | { |
---|
55 | SetFrameUrl( BuildBaseUrl( 'GetFoldersAndFiles' ) ) ; |
---|
56 | return false ; |
---|
57 | } |
---|
58 | |
---|
59 | function CreateFolder() |
---|
60 | { |
---|
61 | var sFolder = prompt( 'Type the folder name:', 'Test Folder' ) ; |
---|
62 | |
---|
63 | if ( ! sFolder ) |
---|
64 | return ; |
---|
65 | |
---|
66 | var sUrl = BuildBaseUrl( 'CreateFolder' ) ; |
---|
67 | sUrl += '&NewFolderName=' + escape( sFolder ) ; |
---|
68 | |
---|
69 | SetFrameUrl( sUrl ) ; |
---|
70 | return false ; |
---|
71 | } |
---|
72 | |
---|
73 | function 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 | |
---|
93 | this.frames.frmUpload = this ; |
---|
94 | |
---|
95 | function 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="../../../../fckblank.html" name="eRunningFrame" width="100%" |
---|
172 | height="100%"></iframe> |
---|
173 | </td> |
---|
174 | </tr> |
---|
175 | </table> |
---|
176 | </body> |
---|
177 | </html> |
---|