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