1 |
2
|
Manuela
|
<!DOCTYPE HTML>
|
2 |
|
|
<!--
|
3 |
|
|
* CKeditor - The text editor for Internet - http://www.ckeditor.net
|
4 |
|
|
* Copyright (C) 2003-2010 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 |
|
|
<title>Folders</title>
|
28 |
|
|
<link href="browser.css" type="text/css" rel="stylesheet">
|
29 |
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
30 |
|
|
<script type="text/javascript" src="js/common.js"></script>
|
31 |
|
|
<script type="text/javascript">
|
32 |
|
|
|
33 |
|
|
var sActiveFolder ;
|
34 |
|
|
|
35 |
|
|
var bIsLoaded = false ;
|
36 |
|
|
var iIntervalId ;
|
37 |
|
|
|
38 |
|
|
var oListManager = new Object() ;
|
39 |
|
|
|
40 |
|
|
oListManager.Init = function()
|
41 |
|
|
{
|
42 |
|
|
this.Table = document.getElementById('tableFiles') ;
|
43 |
|
|
this.UpRow = document.getElementById('trUp') ;
|
44 |
|
|
|
45 |
|
|
this.TableRows = new Object() ;
|
46 |
|
|
}
|
47 |
|
|
|
48 |
|
|
oListManager.Clear = function()
|
49 |
|
|
{
|
50 |
|
|
// Remove all other rows available.
|
51 |
|
|
while ( this.Table.rows.length > 1 )
|
52 |
|
|
this.Table.deleteRow(1) ;
|
53 |
|
|
|
54 |
|
|
// Reset the TableRows collection.
|
55 |
|
|
this.TableRows = new Object() ;
|
56 |
|
|
}
|
57 |
|
|
|
58 |
|
|
oListManager.AddItem = function( folderName, folderPath )
|
59 |
|
|
{
|
60 |
|
|
// Create the new row.
|
61 |
|
|
var oRow = this.Table.insertRow(-1) ;
|
62 |
|
|
oRow.className = 'FolderListFolder' ;
|
63 |
|
|
|
64 |
|
|
// Build the link to view the folder.
|
65 |
|
|
var sLink = '<a href="#" onclick="OpenFolder(\'' + folderPath + '\');return false;">' ;
|
66 |
|
|
|
67 |
|
|
// Add the folder icon cell.
|
68 |
|
|
var oCell = oRow.insertCell(-1) ;
|
69 |
|
|
oCell.width = 20 ;
|
70 |
|
|
oCell.innerHTML = sLink + '<img alt="" src="images/spacer.gif" width="20" height="20" border="0"><\/a>' ;
|
71 |
|
|
|
72 |
|
|
// Add the folder name cell.
|
73 |
|
|
oCell = oRow.insertCell(-1) ;
|
74 |
|
|
oCell.noWrap = true ;
|
75 |
|
|
oCell.innerHTML = ' ' + sLink + folderName + '<\/a>' ;
|
76 |
|
|
|
77 |
|
|
this.TableRows[ folderPath ] = oRow ;
|
78 |
|
|
}
|
79 |
|
|
|
80 |
|
|
oListManager.ShowUpFolder = function( upFolderPath )
|
81 |
|
|
{
|
82 |
|
|
this.UpRow.style.display = ( upFolderPath != null ? '' : 'none' ) ;
|
83 |
|
|
|
84 |
|
|
if ( upFolderPath != null )
|
85 |
|
|
{
|
86 |
|
|
document.getElementById('linkUpIcon').onclick = document.getElementById('linkUp').onclick = function()
|
87 |
|
|
{
|
88 |
|
|
LoadFolders( upFolderPath ) ;
|
89 |
|
|
return false ;
|
90 |
|
|
}
|
91 |
|
|
}
|
92 |
|
|
}
|
93 |
|
|
|
94 |
|
|
function CheckLoaded()
|
95 |
|
|
{
|
96 |
|
|
if ( window.top.IsLoadedActualFolder
|
97 |
|
|
&& window.top.IsLoadedCreateFolder
|
98 |
|
|
&& window.top.IsLoadedUpload
|
99 |
|
|
&& window.top.IsLoadedResourcesList )
|
100 |
|
|
{
|
101 |
|
|
window.clearInterval( iIntervalId ) ;
|
102 |
|
|
bIsLoaded = true ;
|
103 |
|
|
OpenFolder( sActiveFolder ) ;
|
104 |
|
|
}
|
105 |
|
|
}
|
106 |
|
|
|
107 |
|
|
function OpenFolder( folderPath )
|
108 |
|
|
{
|
109 |
|
|
sActiveFolder = folderPath ;
|
110 |
|
|
|
111 |
|
|
if ( ! bIsLoaded )
|
112 |
|
|
{
|
113 |
|
|
if ( ! iIntervalId )
|
114 |
|
|
iIntervalId = window.setInterval( CheckLoaded, 100 ) ;
|
115 |
|
|
return ;
|
116 |
|
|
}
|
117 |
|
|
|
118 |
|
|
// Change the style for the select row (to show the opened folder).
|
119 |
|
|
for ( var sFolderPath in oListManager.TableRows )
|
120 |
|
|
{
|
121 |
|
|
oListManager.TableRows[ sFolderPath ].className =
|
122 |
|
|
( sFolderPath == folderPath ? 'FolderListCurrentFolder' : 'FolderListFolder' ) ;
|
123 |
|
|
}
|
124 |
|
|
|
125 |
|
|
// Set the current folder in all frames.
|
126 |
|
|
window.parent.frames['frmActualFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ;
|
127 |
|
|
window.parent.frames['frmCreateFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ;
|
128 |
|
|
window.parent.frames['frmUpload'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ;
|
129 |
|
|
|
130 |
|
|
// Load the resources list for this folder.
|
131 |
|
|
window.parent.frames['frmResourcesList'].LoadResources( oConnector.ResourceType, folderPath ) ;
|
132 |
|
|
}
|
133 |
|
|
|
134 |
|
|
function LoadFolders( folderPath )
|
135 |
|
|
{
|
136 |
|
|
// Clear the folders list.
|
137 |
|
|
oListManager.Clear() ;
|
138 |
|
|
|
139 |
|
|
// Get the parent folder path.
|
140 |
|
|
var sParentFolderPath ;
|
141 |
|
|
if ( folderPath != '/' )
|
142 |
|
|
sParentFolderPath = folderPath.substring( 0, folderPath.lastIndexOf( '/', folderPath.length - 2 ) + 1 ) ;
|
143 |
|
|
|
144 |
|
|
// Show/Hide the Up Folder.
|
145 |
|
|
oListManager.ShowUpFolder( sParentFolderPath ) ;
|
146 |
|
|
|
147 |
|
|
if ( folderPath != '/' )
|
148 |
|
|
{
|
149 |
|
|
sActiveFolder = folderPath ;
|
150 |
|
|
oConnector.CurrentFolder = sParentFolderPath ;
|
151 |
|
|
oConnector.SendCommand( 'GetFolders', null, GetFoldersCallBack ) ;
|
152 |
|
|
}
|
153 |
|
|
else
|
154 |
|
|
OpenFolder( '/' ) ;
|
155 |
|
|
}
|
156 |
|
|
|
157 |
|
|
function GetFoldersCallBack( fckXml )
|
158 |
|
|
{
|
159 |
|
|
if ( oConnector.CheckError( fckXml ) != 0 )
|
160 |
|
|
return ;
|
161 |
|
|
|
162 |
|
|
// Get the current folder path.
|
163 |
|
|
var oNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' ) ;
|
164 |
|
|
var sCurrentFolderPath = oNode.attributes.getNamedItem('path').value ;
|
165 |
|
|
|
166 |
|
|
var oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' ) ;
|
167 |
|
|
|
168 |
|
|
for ( var i = 0 ; i < oNodes.length ; i++ )
|
169 |
|
|
{
|
170 |
|
|
var sFolderName = oNodes[i].attributes.getNamedItem('name').value ;
|
171 |
|
|
oListManager.AddItem( sFolderName, sCurrentFolderPath + sFolderName + '/' ) ;
|
172 |
|
|
}
|
173 |
|
|
|
174 |
|
|
OpenFolder( sActiveFolder ) ;
|
175 |
|
|
}
|
176 |
|
|
|
177 |
|
|
function SetResourceType( type )
|
178 |
|
|
{
|
179 |
|
|
oConnector.ResourceType = type ;
|
180 |
|
|
LoadFolders( '/' ) ;
|
181 |
|
|
}
|
182 |
|
|
|
183 |
|
|
window.onload = function()
|
184 |
|
|
{
|
185 |
|
|
oListManager.Init() ;
|
186 |
|
|
LoadFolders( '/' ) ;
|
187 |
|
|
}
|
188 |
|
|
</script>
|
189 |
|
|
</head>
|
190 |
|
|
<body class="FileArea">
|
191 |
|
|
<table id="tableFiles" >
|
192 |
|
|
<tr id="trUp" style="DISPLAY: none">
|
193 |
|
|
<td><a id="linkUpIcon" href="#">
|
194 |
|
|
<img alt="" src="images/FolderUp.gif" width="20" height="20"></a>
|
195 |
|
|
</td>
|
196 |
|
|
<td style="width: 100%;">
|
197 |
|
|
<a id="linkUp" href="#">..</a></td>
|
198 |
|
|
</tr>
|
199 |
|
|
</table>
|
200 |
|
|
</body>
|
201 |
|
|
</html>
|