1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
\r
3 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
\r
4 * Copyright (C) 2003-2007 Frederico Caldeira Knabben
\r
6 * == BEGIN LICENSE ==
\r
8 * Licensed under the terms of any of the following licenses at your
\r
11 * - GNU General Public License Version 2 or later (the "GPL")
\r
12 * http://www.gnu.org/licenses/gpl.html
\r
14 * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
\r
15 * http://www.gnu.org/licenses/lgpl.html
\r
17 * - Mozilla Public License Version 1.1 or later (the "MPL")
\r
18 * http://www.mozilla.org/MPL/MPL-1.1.html
\r
22 * This page shows the list of folders available in the parent folder
\r
23 * of the current folder.
\r
27 <link href="browser.css" type="text/css" rel="stylesheet">
\r
28 <script type="text/javascript" src="js/common.js"></script>
\r
29 <script language="javascript">
\r
33 var bIsLoaded = false ;
\r
36 var oListManager = new Object() ;
\r
38 oListManager.Init = function()
\r
40 this.Table = document.getElementById('tableFiles') ;
\r
41 this.UpRow = document.getElementById('trUp') ;
\r
43 this.TableRows = new Object() ;
\r
46 oListManager.Clear = function()
\r
48 // Remove all other rows available.
\r
49 while ( this.Table.rows.length > 1 )
\r
50 this.Table.deleteRow(1) ;
\r
52 // Reset the TableRows collection.
\r
53 this.TableRows = new Object() ;
\r
56 oListManager.AddItem = function( folderName, folderPath )
\r
58 // Create the new row.
\r
59 var oRow = this.Table.insertRow(-1) ;
\r
60 oRow.className = 'FolderListFolder' ;
\r
62 // Build the link to view the folder.
\r
63 var sLink = '<a href="#" onclick="OpenFolder(\'' + folderPath + '\');return false;">' ;
\r
65 // Add the folder icon cell.
\r
66 var oCell = oRow.insertCell(-1) ;
\r
68 oCell.innerHTML = sLink + '<img alt="" src="images/spacer.gif" width="16" height="16" border="0"></a>' ;
\r
70 // Add the folder name cell.
\r
71 oCell = oRow.insertCell(-1) ;
\r
72 oCell.noWrap = true ;
\r
73 oCell.innerHTML = ' ' + sLink + folderName + '</a>' ;
\r
75 this.TableRows[ folderPath ] = oRow ;
\r
78 oListManager.ShowUpFolder = function( upFolderPath )
\r
80 this.UpRow.style.display = ( upFolderPath != null ? '' : 'none' ) ;
\r
82 if ( upFolderPath != null )
\r
84 document.getElementById('linkUpIcon').onclick = document.getElementById('linkUp').onclick = function()
\r
86 LoadFolders( upFolderPath ) ;
\r
92 function CheckLoaded()
\r
94 if ( window.top.IsLoadedActualFolder
\r
95 && window.top.IsLoadedCreateFolder
\r
96 && window.top.IsLoadedUpload
\r
97 && window.top.IsLoadedResourcesList )
\r
99 window.clearInterval( iIntervalId ) ;
\r
101 OpenFolder( sActiveFolder ) ;
\r
105 function OpenFolder( folderPath )
\r
107 sActiveFolder = folderPath ;
\r
111 if ( ! iIntervalId )
\r
112 iIntervalId = window.setInterval( CheckLoaded, 100 ) ;
\r
116 // Change the style for the select row (to show the opened folder).
\r
117 for ( var sFolderPath in oListManager.TableRows )
\r
119 oListManager.TableRows[ sFolderPath ].className =
\r
120 ( sFolderPath == folderPath ? 'FolderListCurrentFolder' : 'FolderListFolder' ) ;
\r
123 // Set the current folder in all frames.
\r
124 window.parent.frames['frmActualFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ;
\r
125 window.parent.frames['frmCreateFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ;
\r
126 window.parent.frames['frmUpload'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ;
\r
128 // Load the resources list for this folder.
\r
129 window.parent.frames['frmResourcesList'].LoadResources( oConnector.ResourceType, folderPath ) ;
\r
132 function LoadFolders( folderPath )
\r
134 // Clear the folders list.
\r
135 oListManager.Clear() ;
\r
137 // Get the parent folder path.
\r
138 var sParentFolderPath ;
\r
139 if ( folderPath != '/' )
\r
140 sParentFolderPath = folderPath.substring( 0, folderPath.lastIndexOf( '/', folderPath.length - 2 ) + 1 ) ;
\r
142 // Show/Hide the Up Folder.
\r
143 oListManager.ShowUpFolder( sParentFolderPath ) ;
\r
145 if ( folderPath != '/' )
\r
147 sActiveFolder = folderPath ;
\r
148 oConnector.CurrentFolder = sParentFolderPath ;
\r
149 oConnector.SendCommand( 'GetFolders', null, GetFoldersCallBack ) ;
\r
152 OpenFolder( '/' ) ;
\r
155 function GetFoldersCallBack( fckXml )
\r
157 if ( oConnector.CheckError( fckXml ) != 0 )
\r
160 // Get the current folder path.
\r
161 var oNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' ) ;
\r
162 var sCurrentFolderPath = oNode.attributes.getNamedItem('path').value ;
\r
164 var oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' ) ;
\r
166 for ( var i = 0 ; i < oNodes.length ; i++ )
\r
168 var sFolderName = oNodes[i].attributes.getNamedItem('name').value ;
\r
169 oListManager.AddItem( sFolderName, sCurrentFolderPath + sFolderName + "/" ) ;
\r
172 OpenFolder( sActiveFolder ) ;
\r
175 function SetResourceType( type )
\r
177 oConnector.ResourceType = type ;
\r
178 LoadFolders( '/' ) ;
\r
181 window.onload = function()
\r
183 oListManager.Init() ;
\r
184 LoadFolders( '/' ) ;
\r
188 <body class="FileArea" bottomMargin="10" leftMargin="10" topMargin="10" rightMargin="10">
\r
189 <table id="tableFiles" cellSpacing="0" cellPadding="0" width="100%" border="0">
\r
190 <tr id="trUp" style="DISPLAY: none">
\r
191 <td width="16"><a id="linkUpIcon" href="#"><img alt="" src="images/FolderUp.gif" width="16" height="16" border="0"></a></td>
\r
192 <td nowrap width="100%"> <a id="linkUp" href="#">..</a></td>
\r