1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
2   "http://www.w3.org/TR/html4/frameset.dtd">
3<!--
4 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
5 * Copyright (C) 2003-2009 Frederico Caldeira Knabben
6 *
7 * == BEGIN LICENSE ==
8 *
9 * Licensed under the terms of any of the following licenses at your
10 * choice:
11 *
12 *  - GNU General Public License Version 2 or later (the "GPL")
13 *    http://www.gnu.org/licenses/gpl.html
14 *
15 *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
16 *    http://www.gnu.org/licenses/lgpl.html
17 *
18 *  - Mozilla Public License Version 1.1 or later (the "MPL")
19 *    http://www.mozilla.org/MPL/MPL-1.1.html
20 *
21 * == END LICENSE ==
22 *
23 * This page compose the File Browser dialog frameset.
24-->
25<html>
26	<head>
27		<title>FCKeditor - Resources Browser</title>
28		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
29		<link href="browser.css" type="text/css" rel="stylesheet">
30		<script type="text/javascript" src="js/fckxml.js"></script>
31		<script type="text/javascript" src="js/language.js"></script>
32		<script type="text/javascript" src="js/safeFN_class.js"></script>
33		<script type="text/javascript">
34
35var CurrentDWikiUser = opener.FCK.dwiki_user; // use this variable to pass into frame (frmupload.html)
36var CurrentDWikiClient = opener.FCK.dwiki_client; // use this variable to pass into frame (frmupload.html)
37var isLocalDwikiBrowser = opener.FCK.islocal_dwikibrowser ? true : false;
38var CreateDwikiFolder = opener.FCK.dwiki_create_folder; // use this variable to pass into frame (frmupload.html)
39var DwikiFNencode = opener.FCK.dwiki_fnencode;
40var FCKConfig = opener.FCKConfig;
41
42// Automatically detect the correct document.domain (#1919).
43(function()
44{
45	var d = document.domain ;
46
47	while ( true )
48	{
49		// Test if we can access a parent property.
50		try
51		{
52			var test = window.opener.document.domain ;
53			break ;
54		}
55		catch( e )
56		{}
57
58		// Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ...
59		d = d.replace( /.*?(?:\.|$)/, '' ) ;
60
61		if ( d.length == 0 )
62			break ;		// It was not able to detect the domain.
63
64		try
65		{
66			document.domain = d ;
67		}
68		catch (e)
69		{
70			break ;
71		}
72	}
73})() ;
74
75window.onload = function() {
76  setupLanguage();
77}
78
79function GetUrlParam( paramName )
80{
81	var oRegex = new RegExp( '[\?&]' + paramName + '=([^&]+)', 'i' ) ;
82	var oMatch = oRegex.exec( window.top.location.search ) ;
83
84	if ( oMatch && oMatch.length > 1 ) {
85       // alert(paramName + ' ' + decodeURIComponent( oMatch[1] ) );
86		return decodeURIComponent( oMatch[1] ) ;
87      // return dwikiUTF8_decodeFN( oMatch[1],DwikiFNencode);
88	}
89	else
90		return '' ;
91}
92
93var oConnector = new Object() ;
94oConnector.CurrentFolder	= '/' ;
95
96var sConnUrl = GetUrlParam( 'Connector' ) ;
97
98// Gecko has some problems when using relative URLs (not starting with slash).
99if ( sConnUrl.substr(0,1) != '/' && sConnUrl.indexOf( '://' ) < 0 )
100	sConnUrl = window.location.href.replace( /browser.html.*$/, '' ) + sConnUrl ;
101
102oConnector.ConnectorUrl = sConnUrl + ( sConnUrl.indexOf('?') != -1 ? '&' : '?' ) ;
103
104var sServerPath = GetUrlParam( 'ServerPath' ) ;
105
106if ( sServerPath.length > 0 )
107	oConnector.ConnectorUrl += 'ServerPath=' + dwikiUTF8_encodeFN(sServerPath, 'url') + '&' ;
108
109oConnector.ResourceType		= GetUrlParam( 'Type' ) ;
110oConnector.ShowAllTypes		= ( oConnector.ResourceType.length == 0 ) ;
111
112if ( oConnector.ShowAllTypes )
113	oConnector.ResourceType = 'File' ;
114
115oConnector.SendCommand = function( command, params, callBackFunction )
116{
117   /* requires safe_ascii */
118
119	var sUrl = this.ConnectorUrl + 'Command=' + command ;
120	sUrl += '&Type=' + this.ResourceType ;
121	sUrl += '&CurrentFolder=' + dwikiUTF8_encodeFN(this.CurrentFolder, DwikiFNencode);
122
123//	sUrl += '&CurrentFolder=' + encodeURIComponent( this.CurrentFolder ) ;
124
125	if ( params ) sUrl += '&' + params ;
126
127    if(opener.FCK.dwiki_browser) {
128        sUrl += '&DWFCK_Browser=' + opener.FCK.dwiki_browser;
129   }
130    if(opener.FCK.dwiki_client) {
131        sUrl += '&DWFCK_Client=' + opener.FCK.dwiki_client;
132   }
133    if(opener.FCK.dwiki_client) {
134        sUrl += '&DWFCK_usergrps=' + opener.FCK.dwiki_usergroups;
135   }
136
137	// Add a random salt to avoid getting a cached version of the command execution
138	sUrl += '&uuid=' + new Date().getTime() ;
139
140	var oXML = new FCKXml() ;
141
142	if ( callBackFunction )
143		oXML.LoadUrl( sUrl, callBackFunction ) ;	// Asynchronous load.
144	else
145		return oXML.LoadUrl( sUrl ) ;
146
147	return null ;
148}
149oConnector.CheckError = function( responseXml )
150{
151	var iErrorNumber = 0 ;
152	var oErrorNode = responseXml.SelectSingleNode( 'Connector/Error' ) ;
153
154	if ( oErrorNode )
155	{
156		iErrorNumber = parseInt( oErrorNode.attributes.getNamedItem('number').value, 10 ) ;
157
158		switch ( iErrorNumber )
159		{
160			case 0 :
161				break ;
162			case 1 :	// Custom error. Message placed in the "text" attribute.
163				//alert( oErrorNode.attributes.getNamedItem('text').value ) ;
164                alert(translateErrorAny(oErrorNode.attributes.getNamedItem('text').value )) ;
165				break ;
166			case 101 :
167                                alert(translateItem('FileBrowserError_101', 'Folder already exists' ));
168				break ;
169			case 102 :
170                                alert(translateItem('FileBrowserError_102', 'Invalid folder name' ));
171				break ;
172			case 103 :
173                                alert(translateItem('FileBrowserError_103', 'You have no permissions to create the folder' ));
174				break ;
175			case 110 :
176                                alert(translateItem('FileBrowserError_110', 'Unknown error creating folder' ));
177				break ;
178			case 204 :
179                                alert(translateItem('FileBrowserError_204', 'Unable to delete the selected file' ));
180				break ;
181			case 205 :
182                                alert(translateItem('FileBrowserError_205',
183                                 'Unable to rename the selected file; check your directory/write permisssions' ));
184				break ;
185			default :
186                                var err_default =  translateItem('FileBrowserError_default', 'Error on your request. Error number: ' );
187				alert(err_default + iErrorNumber ) ;
188				break ;
189		}
190	}
191	return iErrorNumber ;
192}
193
194var oIcons = new Object() ;
195
196oIcons.AvailableIconsArray = [
197	'ai','avi','bmp','cs','dll','doc','exe','fla','gif','htm','html','jpg','js',
198	'mdb','mp3','pdf','png','ppt','rdp','swf','swt','txt','vsd','xls','xml','zip' ] ;
199
200oIcons.AvailableIcons = new Object() ;
201
202for ( var i = 0 ; i < oIcons.AvailableIconsArray.length ; i++ )
203	oIcons.AvailableIcons[ oIcons.AvailableIconsArray[i] ] = true ;
204
205oIcons.GetIcon = function( fileName )
206{
207	var sExtension = fileName.substr( fileName.lastIndexOf('.') + 1 ).toLowerCase() ;
208
209	if ( this.AvailableIcons[ sExtension ] == true )
210		return sExtension ;
211	else
212		return 'default.icon' ;
213}
214
215function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg )
216{
217   // alert( errorNumber +"\nurl="+ fileUrl+"\nfname="+ fileName+"\nmsg="+ customMsg );
218
219	if (errorNumber == "1" || parseInt(errorNumber) > 300)
220		window.frames['frmUpload'].OnUploadCompleted( errorNumber, customMsg ) ;
221	else
222		window.frames['frmUpload'].OnUploadCompleted( errorNumber, fileName ) ;
223}
224
225		</script>
226	</head>
227	<frameset cols="150,*" class="Frame" framespacing="3" bordercolor="#f1f1e3" frameborder="1">
228		<frameset rows="50,*" framespacing="0">
229			<frame src="frmresourcetype.html" scrolling="no" frameborder="0">
230			<frame name="frmFolders" src="frmfolders.html" scrolling="auto" frameborder="1">
231		</frameset>
232		<frameset rows="50,*,70" framespacing="0">
233			<frame name="frmActualFolder" src="frmactualfolder.html" scrolling="no" frameborder="0">
234			<frame name="frmResourcesList" src="frmresourceslist.html" scrolling="auto" frameborder="1">
235			<frameset cols="150,*,0" framespacing="0" frameborder="0">
236				<frame name="frmCreateFolder" src="frmcreatefolder.html" scrolling="no" frameborder="0">
237				<frame name="frmUpload" src="frmupload.html" scrolling="no" frameborder="0">
238				<frame name="frmUploadWorker" src="javascript:void(0)" scrolling="no" frameborder="0">
239			</frameset>
240		</frameset>
241	</frameset>
242</html>
243