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-2010 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 <title>Folders</title>
\r
28 <link href="browser.css" type="text/css" rel="stylesheet">
\r
29 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
\r
30 <script type="text/javascript" src="js/common.js"></script>
\r
31 <script type="text/javascript">
\r
35 var bIsLoaded = false ;
\r
38 var oListManager = new Object() ;
\r
40 oListManager.Init = function()
\r
42 this.Table = document.getElementById('tableFiles') ;
\r
43 this.UpRow = document.getElementById('trUp') ;
\r
45 this.TableRows = new Object() ;
\r
48 oListManager.Clear = function()
\r
50 // Remove all other rows available.
\r
51 while ( this.Table.rows.length > 1 )
\r
52 this.Table.deleteRow(1) ;
\r
54 // Reset the TableRows collection.
\r
55 this.TableRows = new Object() ;
\r
58 oListManager.AddItem = function( folderName, folderPath )
\r
60 // Create the new row.
\r
61 var oRow = this.Table.insertRow(-1) ;
\r
62 oRow.className = 'FolderListFolder' ;
\r
64 // Build the link to view the folder.
\r
65 var sLink = '<a href="#" onclick="OpenFolder(\'' + folderPath + '\');return false;">' ;
\r
67 // Add the folder icon cell.
\r
68 var oCell = oRow.insertCell(-1) ;
\r
70 oCell.innerHTML = sLink + '<img alt="" src="images/spacer.gif" width="16" height="16" border="0"><\/a>' ;
\r
72 // Add the folder name cell.
\r
73 oCell = oRow.insertCell(-1) ;
\r
74 oCell.noWrap = true ;
\r
75 oCell.innerHTML = ' ' + sLink + folderName + '<\/a>' ;
\r
77 this.TableRows[ folderPath ] = oRow ;
\r
80 oListManager.ShowUpFolder = function( upFolderPath )
\r
82 this.UpRow.style.display = ( upFolderPath != null ? '' : 'none' ) ;
\r
84 if ( upFolderPath != null )
\r
86 document.getElementById('linkUpIcon').onclick = document.getElementById('linkUp').onclick = function()
\r
88 LoadFolders( upFolderPath ) ;
\r
94 function CheckLoaded()
\r
96 if ( window.top.IsLoadedActualFolder
\r
97 && window.top.IsLoadedCreateFolder
\r
98 && window.top.IsLoadedUpload
\r
99 && window.top.IsLoadedResourcesList )
\r
101 window.clearInterval( iIntervalId ) ;
\r
103 OpenFolder( sActiveFolder ) ;
\r
107 function OpenFolder( folderPath )
\r
109 sActiveFolder = folderPath ;
\r
113 if ( ! iIntervalId )
\r
114 iIntervalId = window.setInterval( CheckLoaded, 100 ) ;
\r
118 // Change the style for the select row (to show the opened folder).
\r
119 for ( var sFolderPath in oListManager.TableRows )
\r
121 oListManager.TableRows[ sFolderPath ].className =
\r
122 ( sFolderPath == folderPath ? 'FolderListCurrentFolder' : 'FolderListFolder' ) ;
\r
125 // Set the current folder in all frames.
\r
126 window.parent.frames['frmActualFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ;
\r
127 window.parent.frames['frmCreateFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ;
\r
128 window.parent.frames['frmUpload'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ;
\r
130 // Load the resources list for this folder.
\r
131 window.parent.frames['frmResourcesList'].LoadResources( oConnector.ResourceType, folderPath ) ;
\r
134 function LoadFolders( folderPath )
\r
136 // Clear the folders list.
\r
137 oListManager.Clear() ;
\r
139 // Get the parent folder path.
\r
140 var sParentFolderPath ;
\r
141 if ( folderPath != '/' )
\r
142 sParentFolderPath = folderPath.substring( 0, folderPath.lastIndexOf( '/', folderPath.length - 2 ) + 1 ) ;
\r
144 // Show/Hide the Up Folder.
\r
145 oListManager.ShowUpFolder( sParentFolderPath ) ;
\r
147 if ( folderPath != '/' )
\r
149 sActiveFolder = folderPath ;
\r
150 oConnector.CurrentFolder = sParentFolderPath ;
\r
151 oConnector.SendCommand( 'GetFolders', null, GetFoldersCallBack ) ;
\r
154 OpenFolder( '/' ) ;
\r
157 function GetFoldersCallBack( fckXml )
\r
159 if ( oConnector.CheckError( fckXml ) != 0 )
\r
162 // Get the current folder path.
\r
163 var oNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' ) ;
\r
164 var sCurrentFolderPath = oNode.attributes.getNamedItem('path').value ;
\r
166 var oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' ) ;
\r
168 for ( var i = 0 ; i < oNodes.length ; i++ )
\r
170 var sFolderName = oNodes[i].attributes.getNamedItem('name').value ;
\r
171 oListManager.AddItem( sFolderName, sCurrentFolderPath + sFolderName + '/' ) ;
\r
174 OpenFolder( sActiveFolder ) ;
\r
177 function SetResourceType( type )
\r
179 oConnector.ResourceType = type ;
\r
180 LoadFolders( '/' ) ;
\r
183 window.onload = function()
\r
185 oListManager.Init() ;
\r
186 LoadFolders( '/' ) ;
\r
190 <body class="FileArea">
\r
191 <table id="tableFiles" cellSpacing="0" cellPadding="0" width="100%" border="0">
\r
192 <tr id="trUp" style="DISPLAY: none">
\r
193 <td width="16"><a id="linkUpIcon" href="#"><img alt="" src="images/FolderUp.gif" width="16" height="16" border="0"></a></td>
\r
194 <td nowrap width="100%"> <a id="linkUp" href="#">..</a></td>
\r