event refactor, landing on HEAD!
[freeside.git] / httemplate / elements / fckeditor / editor / filemanager / browser / default / browser.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">\r
2 <!--\r
3  * FCKeditor - The text editor for Internet - http://www.fckeditor.net\r
4  * Copyright (C) 2003-2007 Frederico Caldeira Knabben\r
5  *\r
6  * == BEGIN LICENSE ==\r
7  *\r
8  * Licensed under the terms of any of the following licenses at your\r
9  * choice:\r
10  *\r
11  *  - GNU General Public License Version 2 or later (the "GPL")\r
12  *    http://www.gnu.org/licenses/gpl.html\r
13  *\r
14  *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")\r
15  *    http://www.gnu.org/licenses/lgpl.html\r
16  *\r
17  *  - Mozilla Public License Version 1.1 or later (the "MPL")\r
18  *    http://www.mozilla.org/MPL/MPL-1.1.html\r
19  *\r
20  * == END LICENSE ==\r
21  *\r
22  * This page compose the File Browser dialog frameset.\r
23 -->\r
24 <html>\r
25         <head>\r
26                 <title>FCKeditor - Resources Browser</title>\r
27                 <link href="browser.css" type="text/css" rel="stylesheet">\r
28                 <script type="text/javascript" src="js/fckxml.js"></script>\r
29                 <script language="javascript">\r
30 \r
31 function GetUrlParam( paramName )\r
32 {\r
33         var oRegex = new RegExp( '[\?&]' + paramName + '=([^&]+)', 'i' ) ;\r
34         var oMatch = oRegex.exec( window.top.location.search ) ;\r
35 \r
36         if ( oMatch && oMatch.length > 1 )\r
37                 return decodeURIComponent( oMatch[1] ) ;\r
38         else\r
39                 return '' ;\r
40 }\r
41 \r
42 var oConnector = new Object() ;\r
43 oConnector.CurrentFolder        = '/' ;\r
44 \r
45 var sConnUrl = GetUrlParam( 'Connector' ) ;\r
46 \r
47 // Gecko has some problems when using relative URLs (not starting with slash).\r
48 if ( sConnUrl.substr(0,1) != '/' && sConnUrl.indexOf( '://' ) < 0 )\r
49         sConnUrl = window.location.href.replace( /browser.html.*$/, '' ) + sConnUrl ;\r
50 \r
51 oConnector.ConnectorUrl = sConnUrl + ( sConnUrl.indexOf('?') != -1 ? '&' : '?' ) ;\r
52 \r
53 var sServerPath = GetUrlParam( 'ServerPath' ) ;\r
54 if ( sServerPath.length > 0 )\r
55         oConnector.ConnectorUrl += 'ServerPath=' + encodeURIComponent( sServerPath ) + '&' ;\r
56 \r
57 oConnector.ResourceType         = GetUrlParam( 'Type' ) ;\r
58 oConnector.ShowAllTypes         = ( oConnector.ResourceType.length == 0 ) ;\r
59 \r
60 if ( oConnector.ShowAllTypes )\r
61         oConnector.ResourceType = 'File' ;\r
62 \r
63 oConnector.SendCommand = function( command, params, callBackFunction )\r
64 {\r
65         var sUrl = this.ConnectorUrl + 'Command=' + command ;\r
66         sUrl += '&Type=' + this.ResourceType ;\r
67         sUrl += '&CurrentFolder=' + encodeURIComponent( this.CurrentFolder ) ;\r
68 \r
69         if ( params ) sUrl += '&' + params ;\r
70 \r
71         var oXML = new FCKXml() ;\r
72 \r
73         if ( callBackFunction )\r
74                 oXML.LoadUrl( sUrl, callBackFunction ) ;        // Asynchronous load.\r
75         else\r
76                 return oXML.LoadUrl( sUrl ) ;\r
77 \r
78         return null ;\r
79 }\r
80 \r
81 oConnector.CheckError = function( responseXml )\r
82 {\r
83         var iErrorNumber = 0 ;\r
84         var oErrorNode = responseXml.SelectSingleNode( 'Connector/Error' ) ;\r
85 \r
86         if ( oErrorNode )\r
87         {\r
88                 iErrorNumber = parseInt( oErrorNode.attributes.getNamedItem('number').value, 10 ) ;\r
89 \r
90                 switch ( iErrorNumber )\r
91                 {\r
92                         case 0 :\r
93                                 break ;\r
94                         case 1 :        // Custom error. Message placed in the "text" attribute.\r
95                                 alert( oErrorNode.attributes.getNamedItem('text').value ) ;\r
96                                 break ;\r
97                         case 101 :\r
98                                 alert( 'Folder already exists' ) ;\r
99                                 break ;\r
100                         case 102 :\r
101                                 alert( 'Invalid folder name' ) ;\r
102                                 break ;\r
103                         case 103 :\r
104                                 alert( 'You have no permissions to create the folder' ) ;\r
105                                 break ;\r
106                         case 110 :\r
107                                 alert( 'Unknown error creating folder' ) ;\r
108                                 break ;\r
109                         default :\r
110                                 alert( 'Error on your request. Error number: ' + iErrorNumber ) ;\r
111                                 break ;\r
112                 }\r
113         }\r
114         return iErrorNumber ;\r
115 }\r
116 \r
117 var oIcons = new Object() ;\r
118 \r
119 oIcons.AvailableIconsArray = [\r
120         'ai','avi','bmp','cs','dll','doc','exe','fla','gif','htm','html','jpg','js',\r
121         'mdb','mp3','pdf','png','ppt','rdp','swf','swt','txt','vsd','xls','xml','zip' ] ;\r
122 \r
123 oIcons.AvailableIcons = new Object() ;\r
124 \r
125 for ( var i = 0 ; i < oIcons.AvailableIconsArray.length ; i++ )\r
126         oIcons.AvailableIcons[ oIcons.AvailableIconsArray[i] ] = true ;\r
127 \r
128 oIcons.GetIcon = function( fileName )\r
129 {\r
130         var sExtension = fileName.substr( fileName.lastIndexOf('.') + 1 ).toLowerCase() ;\r
131 \r
132         if ( this.AvailableIcons[ sExtension ] == true )\r
133                 return sExtension ;\r
134         else\r
135                 return 'default.icon' ;\r
136 }\r
137                 </script>\r
138         </head>\r
139         <frameset cols="150,*" class="Frame" framespacing="3" bordercolor="#f1f1e3" frameborder="1">\r
140                 <frameset rows="50,*" framespacing="0">\r
141                         <frame src="frmresourcetype.html" scrolling="no" frameborder="0">\r
142                         <frame name="frmFolders" src="frmfolders.html" scrolling="auto" frameborder="1">\r
143                 </frameset>\r
144                 <frameset rows="50,*,50" framespacing="0">\r
145                         <frame name="frmActualFolder" src="frmactualfolder.html" scrolling="no" frameborder="0">\r
146                         <frame name="frmResourcesList" src="frmresourceslist.html" scrolling="auto" frameborder="1">\r
147                         <frameset cols="150,*,0" framespacing="0" frameborder="0">\r
148                                 <frame name="frmCreateFolder" src="frmcreatefolder.html" scrolling="no" frameborder="0">\r
149                                 <frame name="frmUpload" src="frmupload.html" scrolling="no" frameborder="0">\r
150                                 <frame name="frmUploadWorker" src="javascript:void(0)" scrolling="no" frameborder="0">\r
151                         </frameset>\r
152                 </frameset>\r
153         </frameset>\r
154 </html>\r