1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
3
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
4
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
8
* Licensed under the terms of any of the following licenses at your
11
* - GNU General Public License Version 2 or later (the "GPL")
12
* http://www.gnu.org/licenses/gpl.html
14
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
15
* http://www.gnu.org/licenses/lgpl.html
17
* - Mozilla Public License Version 1.1 or later (the "MPL")
18
* http://www.mozilla.org/MPL/MPL-1.1.html
22
* This page shows all resources available in a folder in the File Browser.
24
<html xmlns="http://www.w3.org/1999/xhtml">
26
<link href="browser.css" type="text/css" rel="stylesheet" />
27
<script type="text/javascript" src="js/common.js"></script>
28
<script type="text/javascript">
30
var oListManager = new Object() ;
32
oListManager.Clear = function()
34
document.body.innerHTML = '' ;
37
oListManager.GetFolderRowHtml = function( folderName, folderPath )
39
// Build the link to view the folder.
40
var sLink = '<a href="#" onclick="OpenFolder(\'' + folderPath.replace( /'/g, '\\\'') + '\');return false;">' ;
45
'<img alt="" src="images/Folder.gif" width="16" height="16" border="0"></a>' +
46
'</td><td nowrap colspan="2"> ' +
53
oListManager.GetFileRowHtml = function( fileName, fileUrl, fileSize )
55
// Build the link to view the folder.
56
var sLink = '<a href="#" onclick="OpenFile(\'' + fileUrl.replace( /'/g, '\\\'') + '\');return false;">' ;
59
var sIcon = oIcons.GetIcon( fileName ) ;
64
'<img alt="" src="images/icons/' + sIcon + '.gif" width="16" height="16" border="0"></a>' +
69
'</td><td align="right" nowrap> ' +
75
function OpenFolder( folderPath )
77
// Load the resources list for this folder.
78
window.parent.frames['frmFolders'].LoadFolders( folderPath ) ;
81
function OpenFile( fileUrl )
83
window.top.opener.SetUrl( encodeURI( fileUrl ) ) ;
85
window.top.opener.focus() ;
88
function LoadResources( resourceType, folderPath )
90
oListManager.Clear() ;
91
oConnector.ResourceType = resourceType ;
92
oConnector.CurrentFolder = folderPath ;
93
oConnector.SendCommand( 'GetFoldersAndFiles', null, GetFoldersAndFilesCallBack ) ;
98
LoadResources( oConnector.ResourceType, oConnector.CurrentFolder ) ;
101
function GetFoldersAndFilesCallBack( fckXml )
103
if ( oConnector.CheckError( fckXml ) != 0 )
106
// Get the current folder path.
107
var oFolderNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' ) ;
108
if ( oFolderNode == null )
110
alert( 'The server didn\'t reply with a proper XML data. Please check your configuration.' ) ;
113
var sCurrentFolderPath = oFolderNode.attributes.getNamedItem('path').value ;
114
var sCurrentFolderUrl = oFolderNode.attributes.getNamedItem('url').value ;
116
// var dTimer = new Date() ;
118
var oHtml = new StringBuilder( '<table id="tableFiles" cellspacing="1" cellpadding="0" width="100%" border="0">' ) ;
122
oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' ) ;
123
for ( var i = 0 ; i < oNodes.length ; i++ )
125
var sFolderName = oNodes[i].attributes.getNamedItem('name').value ;
126
oHtml.Append( oListManager.GetFolderRowHtml( sFolderName, sCurrentFolderPath + sFolderName + "/" ) ) ;
130
oNodes = fckXml.SelectNodes( 'Connector/Files/File' ) ;
131
for ( var j = 0 ; j < oNodes.length ; j++ )
133
var oNode = oNodes[j] ;
134
var sFileName = oNode.attributes.getNamedItem('name').value ;
135
var sFileSize = oNode.attributes.getNamedItem('size').value ;
137
// Get the optional "url" attribute. If not available, build the url.
138
var oFileUrlAtt = oNodes[j].attributes.getNamedItem('url') ;
139
var sFileUrl = oFileUrlAtt != null ? oFileUrlAtt.value : sCurrentFolderUrl + sFileName ;
141
oHtml.Append( oListManager.GetFileRowHtml( sFileName, sFileUrl, sFileSize ) ) ;
144
oHtml.Append( '<\/table>' ) ;
146
document.body.innerHTML = oHtml.ToString() ;
148
// window.top.document.title = 'Finished processing in ' + ( ( ( new Date() ) - dTimer ) / 1000 ) + ' seconds' ;
152
window.onload = function()
154
window.top.IsLoadedResourcesList = true ;
158
<body class="FileArea" bottommargin="10" leftmargin="10" topmargin="10" rightmargin="10">