Project

General

Profile

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-2008 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 shows the list of folders available in the parent folder
23
 * of the current folder.
24
-->
25
<html>
26
	<head>
27
		<link href="browser.css" type="text/css" rel="stylesheet">
28
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
29
		<script type="text/javascript" src="js/common.js"></script>
30
		<script language="javascript">
31

    
32
var sActiveFolder ;
33

    
34
var bIsLoaded = false ;
35
var iIntervalId ;
36

    
37
var oListManager = new Object() ;
38

    
39
oListManager.Init = function()
40
{
41
	this.Table = document.getElementById('tableFiles') ;
42
	this.UpRow = document.getElementById('trUp') ;
43

    
44
	this.TableRows = new Object() ;
45
}
46

    
47
oListManager.Clear = function()
48
{
49
	// Remove all other rows available.
50
	while ( this.Table.rows.length > 1 )
51
		this.Table.deleteRow(1) ;
52

    
53
	// Reset the TableRows collection.
54
	this.TableRows = new Object() ;
55
}
56

    
57
oListManager.AddItem = function( folderName, folderPath )
58
{
59
	// Create the new row.
60
	var oRow = this.Table.insertRow(-1) ;
61
	oRow.className = 'FolderListFolder' ;
62

    
63
	// Build the link to view the folder.
64
	var sLink = '<a href="#" onclick="OpenFolder(\'' + folderPath + '\');return false;">' ;
65

    
66
	// Add the folder icon cell.
67
	var oCell = oRow.insertCell(-1) ;
68
	oCell.width = 16 ;
69
	oCell.innerHTML = sLink + '<img alt="" src="images/spacer.gif" width="16" height="16" border="0"></a>' ;
70

    
71
	// Add the folder name cell.
72
	oCell = oRow.insertCell(-1) ;
73
	oCell.noWrap = true ;
74
	oCell.innerHTML = '&nbsp;' + sLink + folderName + '</a>' ;
75

    
76
	this.TableRows[ folderPath ] = oRow ;
77
}
78

    
79
oListManager.ShowUpFolder = function( upFolderPath )
80
{
81
	this.UpRow.style.display = ( upFolderPath != null ? '' : 'none' ) ;
82

    
83
	if ( upFolderPath != null )
84
	{
85
		document.getElementById('linkUpIcon').onclick = document.getElementById('linkUp').onclick = function()
86
		{
87
			LoadFolders( upFolderPath ) ;
88
			return false ;
89
		}
90
	}
91
}
92

    
93
function CheckLoaded()
94
{
95
	if ( window.top.IsLoadedActualFolder
96
		&& window.top.IsLoadedCreateFolder
97
		&& window.top.IsLoadedUpload
98
		&& window.top.IsLoadedResourcesList )
99
	{
100
		window.clearInterval( iIntervalId ) ;
101
		bIsLoaded = true ;
102
		OpenFolder( sActiveFolder ) ;
103
	}
104
}
105

    
106
function OpenFolder( folderPath )
107
{
108
	sActiveFolder = folderPath ;
109

    
110
	if ( ! bIsLoaded )
111
	{
112
		if ( ! iIntervalId )
113
			iIntervalId = window.setInterval( CheckLoaded, 100 ) ;
114
		return ;
115
	}
116

    
117
	// Change the style for the select row (to show the opened folder).
118
	for ( var sFolderPath in oListManager.TableRows )
119
	{
120
		oListManager.TableRows[ sFolderPath ].className =
121
			( sFolderPath == folderPath ? 'FolderListCurrentFolder' : 'FolderListFolder' ) ;
122
	}
123

    
124
	// Set the current folder in all frames.
125
	window.parent.frames['frmActualFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ;
126
	window.parent.frames['frmCreateFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ;
127
	window.parent.frames['frmUpload'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ;
128

    
129
	// Load the resources list for this folder.
130
	window.parent.frames['frmResourcesList'].LoadResources( oConnector.ResourceType, folderPath ) ;
131
}
132

    
133
function LoadFolders( folderPath )
134
{
135
	// Clear the folders list.
136
	oListManager.Clear() ;
137

    
138
	// Get the parent folder path.
139
	var sParentFolderPath ;
140
	if ( folderPath != '/' )
141
		sParentFolderPath = folderPath.substring( 0, folderPath.lastIndexOf( '/', folderPath.length - 2 ) + 1 ) ;
142

    
143
	// Show/Hide the Up Folder.
144
	oListManager.ShowUpFolder( sParentFolderPath ) ;
145

    
146
	if ( folderPath != '/' )
147
	{
148
		sActiveFolder = folderPath ;
149
		oConnector.CurrentFolder = sParentFolderPath ;
150
		oConnector.SendCommand( 'GetFolders', null, GetFoldersCallBack ) ;
151
	}
152
	else
153
		OpenFolder( '/' ) ;
154
}
155

    
156
function GetFoldersCallBack( fckXml )
157
{
158
	if ( oConnector.CheckError( fckXml ) != 0 )
159
		return ;
160

    
161
	// Get the current folder path.
162
	var oNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' ) ;
163
	var sCurrentFolderPath = oNode.attributes.getNamedItem('path').value ;
164

    
165
	var oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' ) ;
166

    
167
	for ( var i = 0 ; i < oNodes.length ; i++ )
168
	{
169
		var sFolderName = oNodes[i].attributes.getNamedItem('name').value ;
170
		oListManager.AddItem( sFolderName, sCurrentFolderPath + sFolderName + '/' ) ;
171
	}
172

    
173
	OpenFolder( sActiveFolder ) ;
174
}
175

    
176
function SetResourceType( type )
177
{
178
	oConnector.ResourceType = type ;
179
	LoadFolders( '/' ) ;
180
}
181

    
182
window.onload = function()
183
{
184
	oListManager.Init() ;
185
	LoadFolders( '/' ) ;
186
}
187
		</script>
188
	</head>
189
	<body class="FileArea" bottomMargin="10" leftMargin="10" topMargin="10" rightMargin="10">
190
		<table id="tableFiles" cellSpacing="0" cellPadding="0" width="100%" border="0">
191
			<tr id="trUp" style="DISPLAY: none">
192
				<td width="16"><a id="linkUpIcon" href="#"><img alt="" src="images/FolderUp.gif" width="16" height="16" border="0"></a></td>
193
				<td nowrap width="100%">&nbsp;<a id="linkUp" href="#">..</a></td>
194
			</tr>
195
		</table>
196
	</body>
197
</html>
(5-5/10)