1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
3 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
4 * Copyright (C) 2003-2008 Frederico Caldeira Knabben
8 * Licensed under the terms of any of the following licenses at your
11 * - GNU General Public License Version 2 or later (the "GPL")
12 * http://www.gnu.org/licenses/gpl.html
14 * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
15 * http://www.gnu.org/licenses/lgpl.html
17 * - Mozilla Public License Version 1.1 or later (the "MPL")
18 * http://www.mozilla.org/MPL/MPL-1.1.html
22 * This page shows the list of folders available in the parent folder
23 * of the current folder.
25 <html xmlns="http://www.w3.org/1999/xhtml">
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">
35 var bIsLoaded = false ;
38 var oListManager = new Object() ;
40 oListManager.Init = function()
42 this.Table = document.getElementById('tableFiles') ;
43 this.UpRow = document.getElementById('trUp') ;
45 this.TableRows = new Object() ;
48 oListManager.Clear = function()
50 // Remove all other rows available.
51 while ( this.Table.rows.length > 1 )
52 this.Table.deleteRow(1) ;
54 // Reset the TableRows collection.
55 this.TableRows = new Object() ;
58 oListManager.AddItem = function( folderName, folderPath )
60 // Create the new row.
61 var oRow = this.Table.insertRow(-1) ;
62 oRow.className = 'FolderListFolder' ;
64 // Build the link to view the folder.
65 var sLink = '<a href="#" onclick="OpenFolder(\'' + folderPath.replace( /'/g, '\\\'') + '\');return false;">' ;
67 // Add the folder icon cell.
68 var oCell = oRow.insertCell(-1) ;
70 oCell.innerHTML = sLink + '<img alt="" src="images/spacer.gif" width="16" height="16" border="0"><\/a>' ;
72 // Add the folder name cell.
73 oCell = oRow.insertCell(-1) ;
75 oCell.innerHTML = ' ' + sLink + folderName + '<\/a>' ;
77 this.TableRows[ folderPath.replace( /'/g, '\\\'') ] = oRow ;
80 oListManager.ShowUpFolder = function( upFolderPath )
82 this.UpRow.style.display = ( upFolderPath != null ? '' : 'none' ) ;
84 if ( upFolderPath != null )
86 document.getElementById('linkUpIcon').onclick = document.getElementById('linkUp').onclick = function()
88 LoadFolders( upFolderPath ) ;
94 function CheckLoaded()
96 if ( window.top.IsLoadedActualFolder
97 && window.top.IsLoadedCreateFolder
98 && window.top.IsLoadedUpload
99 && window.top.IsLoadedResourcesList )
101 window.clearInterval( iIntervalId ) ;
103 OpenFolder( sActiveFolder ) ;
107 function OpenFolder( folderPath )
109 sActiveFolder = folderPath ;
114 iIntervalId = window.setInterval( CheckLoaded, 100 ) ;
118 // Change the style for the select row (to show the opened folder).
119 for ( var sFolderPath in oListManager.TableRows )
121 oListManager.TableRows[ sFolderPath ].className =
122 ( sFolderPath == folderPath.replace( /'/g, '\\\'') ? 'FolderListCurrentFolder' : 'FolderListFolder' ) ;
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 ) ;
130 // Load the resources list for this folder.
131 window.parent.frames['frmResourcesList'].LoadResources( oConnector.ResourceType, folderPath ) ;
134 function LoadFolders( folderPath )
136 // Clear the folders list.
137 oListManager.Clear() ;
139 // Get the parent folder path.
140 var sParentFolderPath ;
141 if ( folderPath != '/' )
142 sParentFolderPath = folderPath.substring( 0, folderPath.lastIndexOf( '/', folderPath.length - 2 ) + 1 ) ;
144 // Show/Hide the Up Folder.
145 oListManager.ShowUpFolder( sParentFolderPath ) ;
147 if ( folderPath != '/' )
149 sActiveFolder = folderPath ;
150 oConnector.CurrentFolder = sParentFolderPath ;
151 oConnector.SendCommand( 'GetFolders', null, GetFoldersCallBack ) ;
157 function GetFoldersCallBack( fckXml )
159 if ( oConnector.CheckError( fckXml ) != 0 )
162 // Get the current folder path.
163 var oNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' ) ;
164 var sCurrentFolderPath = oNode.attributes.getNamedItem('path').value ;
166 var oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' ) ;
168 for ( var i = 0 ; i < oNodes.length ; i++ )
170 var sFolderName = oNodes[i].attributes.getNamedItem('name').value ;
171 oListManager.AddItem( sFolderName, sCurrentFolderPath.replace( /'/g, '\\\'') + sFolderName + '/' ) ;
174 OpenFolder( sActiveFolder ) ;
177 function SetResourceType( type )
179 oConnector.ResourceType = type ;
183 window.onload = function()
185 oListManager.Init() ;
190 <body class="FileArea">
191 <table id="tableFiles" cellSpacing="0" cellPadding="0" width="100%" border="0">
192 <tr id="trUp" style="DISPLAY: none">
193 <td width="16"><a id="linkUpIcon" href="#"><img alt="" src="images/FolderUp.gif" width="16" height="16" border="0"></a></td>
194 <td nowrap width="100%"> <a id="linkUp" href="#">..</a></td>