1075 |
ddelon |
1 |
<!--
|
|
|
2 |
* FCKeditor - The text editor for internet
|
|
|
3 |
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
|
|
4 |
*
|
|
|
5 |
* Licensed under the terms of the GNU Lesser General Public License:
|
|
|
6 |
* http://www.opensource.org/licenses/lgpl-license.php
|
|
|
7 |
*
|
|
|
8 |
* For further information visit:
|
|
|
9 |
* http://www.fckeditor.net/
|
|
|
10 |
*
|
|
|
11 |
* "Support Open Source software. What about a donation today?"
|
|
|
12 |
*
|
|
|
13 |
* File Name: frmfolders.html
|
|
|
14 |
* This page shows the list of folders available in the parent folder
|
|
|
15 |
* of the current folder.
|
|
|
16 |
*
|
|
|
17 |
* File Authors:
|
|
|
18 |
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
|
|
19 |
-->
|
|
|
20 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
|
21 |
<html>
|
|
|
22 |
<head>
|
|
|
23 |
<link href="browser.css" type="text/css" rel="stylesheet">
|
|
|
24 |
<script type="text/javascript" src="js/common.js"></script>
|
|
|
25 |
<script language="javascript">
|
|
|
26 |
|
|
|
27 |
var sActiveFolder ;
|
|
|
28 |
|
|
|
29 |
var bIsLoaded = false ;
|
|
|
30 |
var iIntervalId ;
|
|
|
31 |
|
|
|
32 |
var oListManager = new Object() ;
|
|
|
33 |
|
|
|
34 |
oListManager.Init = function()
|
|
|
35 |
{
|
|
|
36 |
this.Table = document.getElementById('tableFiles') ;
|
|
|
37 |
this.UpRow = document.getElementById('trUp') ;
|
|
|
38 |
|
|
|
39 |
this.TableRows = new Object() ;
|
|
|
40 |
}
|
|
|
41 |
|
|
|
42 |
oListManager.Clear = function()
|
|
|
43 |
{
|
|
|
44 |
// Remove all other rows available.
|
|
|
45 |
while ( this.Table.rows.length > 1 )
|
|
|
46 |
this.Table.deleteRow(1) ;
|
|
|
47 |
|
|
|
48 |
// Reset the TableRows collection.
|
|
|
49 |
this.TableRows = new Object() ;
|
|
|
50 |
}
|
|
|
51 |
|
|
|
52 |
oListManager.AddItem = function( folderName, folderPath )
|
|
|
53 |
{
|
|
|
54 |
// Create the new row.
|
|
|
55 |
var oRow = this.Table.insertRow(-1) ;
|
|
|
56 |
oRow.className = 'FolderListFolder' ;
|
|
|
57 |
|
|
|
58 |
// Build the link to view the folder.
|
|
|
59 |
var sLink = '<a href="#" onclick="OpenFolder(\'' + folderPath + '\');return false;">' ;
|
|
|
60 |
|
|
|
61 |
// Add the folder icon cell.
|
|
|
62 |
var oCell = oRow.insertCell(-1) ;
|
|
|
63 |
oCell.width = 16 ;
|
|
|
64 |
oCell.innerHTML = sLink + '<img alt="" src="images/spacer.gif" width="16" height="16" border="0"></a>' ;
|
|
|
65 |
|
|
|
66 |
// Add the folder name cell.
|
|
|
67 |
oCell = oRow.insertCell(-1) ;
|
|
|
68 |
oCell.noWrap = true ;
|
|
|
69 |
oCell.innerHTML = ' ' + sLink + folderName + '</a>' ;
|
|
|
70 |
|
|
|
71 |
this.TableRows[ folderPath ] = oRow ;
|
|
|
72 |
}
|
|
|
73 |
|
|
|
74 |
oListManager.ShowUpFolder = function( upFolderPath )
|
|
|
75 |
{
|
|
|
76 |
this.UpRow.style.display = ( upFolderPath != null ? '' : 'none' ) ;
|
|
|
77 |
|
|
|
78 |
if ( upFolderPath != null )
|
|
|
79 |
{
|
|
|
80 |
document.getElementById('linkUpIcon').onclick = document.getElementById('linkUp').onclick = function()
|
|
|
81 |
{
|
|
|
82 |
LoadFolders( upFolderPath ) ;
|
|
|
83 |
return false ;
|
|
|
84 |
}
|
|
|
85 |
}
|
|
|
86 |
}
|
|
|
87 |
|
|
|
88 |
function CheckLoaded()
|
|
|
89 |
{
|
|
|
90 |
if ( window.top.IsLoadedActualFolder
|
|
|
91 |
&& window.top.IsLoadedCreateFolder
|
|
|
92 |
&& window.top.IsLoadedUpload
|
|
|
93 |
&& window.top.IsLoadedResourcesList )
|
|
|
94 |
{
|
|
|
95 |
window.clearInterval( iIntervalId ) ;
|
|
|
96 |
bIsLoaded = true ;
|
|
|
97 |
OpenFolder( sActiveFolder ) ;
|
|
|
98 |
}
|
|
|
99 |
}
|
|
|
100 |
|
|
|
101 |
function OpenFolder( folderPath )
|
|
|
102 |
{
|
|
|
103 |
sActiveFolder = folderPath ;
|
|
|
104 |
|
|
|
105 |
if ( ! bIsLoaded )
|
|
|
106 |
{
|
|
|
107 |
if ( ! iIntervalId )
|
|
|
108 |
iIntervalId = window.setInterval( CheckLoaded, 100 ) ;
|
|
|
109 |
return ;
|
|
|
110 |
}
|
|
|
111 |
|
|
|
112 |
// Change the style for the select row (to show the opened folder).
|
|
|
113 |
for ( var sFolderPath in oListManager.TableRows )
|
|
|
114 |
{
|
|
|
115 |
oListManager.TableRows[ sFolderPath ].className =
|
|
|
116 |
( sFolderPath == folderPath ? 'FolderListCurrentFolder' : 'FolderListFolder' ) ;
|
|
|
117 |
}
|
|
|
118 |
|
|
|
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 ) ;
|
|
|
123 |
|
|
|
124 |
// Load the resources list for this folder.
|
|
|
125 |
window.parent.frames['frmResourcesList'].LoadResources( oConnector.ResourceType, folderPath ) ;
|
|
|
126 |
}
|
|
|
127 |
|
|
|
128 |
function LoadFolders( folderPath )
|
|
|
129 |
{
|
|
|
130 |
// Clear the folders list.
|
|
|
131 |
oListManager.Clear() ;
|
|
|
132 |
|
|
|
133 |
// Get the parent folder path.
|
|
|
134 |
var sParentFolderPath ;
|
|
|
135 |
if ( folderPath != '/' )
|
|
|
136 |
sParentFolderPath = folderPath.substring( 0, folderPath.lastIndexOf( '/', folderPath.length - 2 ) + 1 ) ;
|
|
|
137 |
|
|
|
138 |
// Show/Hide the Up Folder.
|
|
|
139 |
oListManager.ShowUpFolder( sParentFolderPath ) ;
|
|
|
140 |
|
|
|
141 |
if ( folderPath != '/' )
|
|
|
142 |
{
|
|
|
143 |
sActiveFolder = folderPath ;
|
|
|
144 |
oConnector.CurrentFolder = sParentFolderPath
|
|
|
145 |
oConnector.SendCommand( 'GetFolders', null, GetFoldersCallBack ) ;
|
|
|
146 |
}
|
|
|
147 |
else
|
|
|
148 |
OpenFolder( '/' ) ;
|
|
|
149 |
}
|
|
|
150 |
|
|
|
151 |
function GetFoldersCallBack( fckXml )
|
|
|
152 |
{
|
|
|
153 |
if ( oConnector.CheckError( fckXml ) != 0 )
|
|
|
154 |
return ;
|
|
|
155 |
|
|
|
156 |
// Get the current folder path.
|
|
|
157 |
var oNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' ) ;
|
|
|
158 |
var sCurrentFolderPath = oNode.attributes.getNamedItem('path').value ;
|
|
|
159 |
|
|
|
160 |
var oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' ) ;
|
|
|
161 |
|
|
|
162 |
for ( var i = 0 ; i < oNodes.length ; i++ )
|
|
|
163 |
{
|
|
|
164 |
var sFolderName = oNodes[i].attributes.getNamedItem('name').value ;
|
|
|
165 |
oListManager.AddItem( sFolderName, sCurrentFolderPath + sFolderName + "/" ) ;
|
|
|
166 |
}
|
|
|
167 |
|
|
|
168 |
OpenFolder( sActiveFolder ) ;
|
|
|
169 |
}
|
|
|
170 |
|
|
|
171 |
function SetResourceType( type )
|
|
|
172 |
{
|
|
|
173 |
oConnector.ResourceType = type ;
|
|
|
174 |
LoadFolders( '/' ) ;
|
|
|
175 |
}
|
|
|
176 |
|
|
|
177 |
window.onload = function()
|
|
|
178 |
{
|
|
|
179 |
oListManager.Init() ;
|
|
|
180 |
LoadFolders( '/' ) ;
|
|
|
181 |
}
|
|
|
182 |
</script>
|
|
|
183 |
</head>
|
|
|
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>
|
|
|
189 |
</tr>
|
|
|
190 |
</table>
|
|
|
191 |
</body>
|
|
|
192 |
</html>
|