2
* FCKeditor - The text editor for internet
3
* Copyright (C) 2003-2005 Frederico Caldeira Knabben
5
* Licensed under the terms of the GNU Lesser General Public License:
6
* http://www.opensource.org/licenses/lgpl-license.php
8
* For further information visit:
9
* http://www.fckeditor.net/
11
* "Support Open Source software. What about a donation today?"
13
* File Name: frmfolders.html
14
* This page shows the list of folders available in the parent folder
15
* of the current folder.
18
* Frederico Caldeira Knabben (fredck@fckeditor.net)
20
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
23
<link href="browser.css" type="text/css" rel="stylesheet">
24
<script type="text/javascript" src="js/common.js"></script>
25
<script language="javascript">
29
var bIsLoaded = false ;
32
var oListManager = new Object() ;
34
oListManager.Init = function()
36
this.Table = document.getElementById('tableFiles') ;
37
this.UpRow = document.getElementById('trUp') ;
39
this.TableRows = new Object() ;
42
oListManager.Clear = function()
44
// Remove all other rows available.
45
while ( this.Table.rows.length > 1 )
46
this.Table.deleteRow(1) ;
48
// Reset the TableRows collection.
49
this.TableRows = new Object() ;
52
oListManager.AddItem = function( folderName, folderPath )
54
// Create the new row.
55
var oRow = this.Table.insertRow(-1) ;
56
oRow.className = 'FolderListFolder' ;
58
// Build the link to view the folder.
59
var sLink = '<a href="#" onclick="OpenFolder(\'' + folderPath + '\');return false;">' ;
61
// Add the folder icon cell.
62
var oCell = oRow.insertCell(-1) ;
64
oCell.innerHTML = sLink + '<img alt="" src="images/spacer.gif" width="16" height="16" border="0"></a>' ;
66
// Add the folder name cell.
67
oCell = oRow.insertCell(-1) ;
69
oCell.innerHTML = ' ' + sLink + folderName + '</a>' ;
71
this.TableRows[ folderPath ] = oRow ;
74
oListManager.ShowUpFolder = function( upFolderPath )
76
this.UpRow.style.display = ( upFolderPath != null ? '' : 'none' ) ;
78
if ( upFolderPath != null )
80
document.getElementById('linkUpIcon').onclick = document.getElementById('linkUp').onclick = function()
82
LoadFolders( upFolderPath ) ;
88
function CheckLoaded()
90
if ( window.top.IsLoadedActualFolder
91
&& window.top.IsLoadedCreateFolder
92
&& window.top.IsLoadedUpload
93
&& window.top.IsLoadedResourcesList )
95
window.clearInterval( iIntervalId ) ;
97
OpenFolder( sActiveFolder ) ;
101
function OpenFolder( folderPath )
103
sActiveFolder = folderPath ;
108
iIntervalId = window.setInterval( CheckLoaded, 100 ) ;
112
// Change the style for the select row (to show the opened folder).
113
for ( var sFolderPath in oListManager.TableRows )
115
oListManager.TableRows[ sFolderPath ].className =
116
( sFolderPath == folderPath ? 'FolderListCurrentFolder' : 'FolderListFolder' ) ;
119
// Set the current folder in all frames.
120
window.parent.frames['frmActualFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ;
121
window.parent.frames['frmCreateFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ;
122
window.parent.frames['frmUpload'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ;
124
// Load the resources list for this folder.
125
window.parent.frames['frmResourcesList'].LoadResources( oConnector.ResourceType, folderPath ) ;
128
function LoadFolders( folderPath )
130
// Clear the folders list.
131
oListManager.Clear() ;
133
// Get the parent folder path.
134
var sParentFolderPath ;
135
if ( folderPath != '/' )
136
sParentFolderPath = folderPath.substring( 0, folderPath.lastIndexOf( '/', folderPath.length - 2 ) + 1 ) ;
138
// Show/Hide the Up Folder.
139
oListManager.ShowUpFolder( sParentFolderPath ) ;
141
if ( folderPath != '/' )
143
sActiveFolder = folderPath ;
144
oConnector.CurrentFolder = sParentFolderPath
145
oConnector.SendCommand( 'GetFolders', null, GetFoldersCallBack ) ;
151
function GetFoldersCallBack( fckXml )
153
if ( oConnector.CheckError( fckXml ) != 0 )
156
// Get the current folder path.
157
var oNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' ) ;
158
var sCurrentFolderPath = oNode.attributes.getNamedItem('path').value ;
160
var oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' ) ;
162
for ( var i = 0 ; i < oNodes.length ; i++ )
164
var sFolderName = oNodes[i].attributes.getNamedItem('name').value ;
165
oListManager.AddItem( sFolderName, sCurrentFolderPath + sFolderName + "/" ) ;
168
OpenFolder( sActiveFolder ) ;
171
function SetResourceType( type )
173
oConnector.ResourceType = type ;
177
window.onload = function()
179
oListManager.Init() ;
184
<body class="FileArea" bottomMargin="10" leftMargin="10" topMargin="10" rightMargin="10">
185
<table id="tableFiles" cellSpacing="0" cellPadding="0" width="100%" border="0">
186
<tr id="trUp" style="DISPLAY: none">
187
<td width="16"><a id="linkUpIcon" href="#"><img alt="" src="images/FolderUp.gif" width="16" height="16" border="0"></a></td>
188
<td nowrap width="100%"> <a id="linkUp" href="#">..</a></td>