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