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