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-2009 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" src="js/language.js"></script> 32 <script type="text/javascript" src="js/safeFN_class.js"></script> 33 <script type="text/javascript"> 34 35/* requires safe_ascii */ 36 37var sActiveFolder ; 38 39var bIsLoaded = false ; 40var iIntervalId ; 41var DwikiFNencode = parent.DwikiFNencode;; 42var oListManager = new Object() ; 43 44function getHTTPObject() 45{ 46 if (window.XMLHttpRequest) 47 { 48 return new XMLHttpRequest(); 49 } 50 else 51 { 52 if (window.ActiveXObject) 53 { 54 return new ActiveXObject("Microsoft.XMLHTTP"); 55 } 56 else 57 { 58 alert(translateItem('FileBrowserError_Ajax', 'Your browser does not support AJAX.')); 59 return null; 60 } 61 } 62} 63 64function GetCurentFolder() 65{ 66 httpObject = getHTTPObject(); 67 if (httpObject != null) 68 { 69 httpObject.onreadystatechange = GetCurentFolder_from_Request; 70 httpObject.open("GET", '../../connectors/php/connector.php?Command=GetDwfckNs&Type=File&CurrentFolder=nothing', true); 71 httpObject.send(null); 72 73 } 74} 75 76function GetCurentFolder_from_Request() 77{ 78 if (httpObject.readyState == 4) 79 { 80 if (httpObject.status == 200) 81 { 82 response = (httpObject.responseText); 83 res = response.replace(/:/g,"/"); 84 if(res.match(/lib\/plugins\/ckgedit\/fckeditor\/userfiles\/image/)) { 85 res = ''; // temp fix for puzzling encoding=url bug in frmresourceslist.html, 86 // where image loading is processed in GetFileRowHtml() 87 } 88 if(res!='') 89 { 90 res = "/" + res + "/"; 91 } 92 else 93 { 94 res = "/"; 95 } 96 LoadFolders(res); 97 } 98 } 99} 100oListManager.Init = function() 101{ 102 this.Table = document.getElementById('tableFiles') ; 103 this.UpRow = document.getElementById('trUp') ; 104 105 this.TableRows = new Object() ; 106} 107 108oListManager.Clear = function() 109{ 110 // Remove all other rows available. 111 while ( this.Table.rows.length > 1 ) 112 this.Table.deleteRow(1) ; 113 114 // Reset the TableRows collection. 115 this.TableRows = new Object() ; 116} 117 118oListManager.AddItem = function( folderName, folderPath, folder_class ) 119{ 120 // Create the new row. 121 var oRow = this.Table.insertRow(-1) ; 122 if(folder_class == 'r') { 123 oRow.className = 'FolderListFolderRO' 124 } 125 else { 126 oRow.className = 'FolderListFolder' ; 127 } 128 129 folderName = dwikiUTF8_decodeFN(folderName,DwikiFNencode); 130 folderPath = dwikiUTF8_decodeFN(folderPath,DwikiFNencode); 131// folderPath = decodeURI(folderPath); 132 133 // Build the link to view the folder. 134 var sLink = '<a href="#" onclick="OpenFolder(\'' + dwikiUTF8_encodeFN(folderPath,DwikiFNencode) + '\');return false;">' ; 135 136 // Add the folder icon cell. 137 var oCell = oRow.insertCell(-1) ; 138 oCell.width = 16 ; 139 oCell.innerHTML = sLink + '<img alt="" src="images/spacer.gif" width="16" height="16" border="0"><\/a>' ; 140 141 // Add the folder name cell. 142 oCell = oRow.insertCell(-1) ; 143 oCell.noWrap = true ; 144 oCell.innerHTML = ' ' + sLink + folderName + '<\/a>' ; 145 146 this.TableRows[ folderPath ] = oRow ; 147} 148 149oListManager.ShowUpFolder = function( upFolderPath ) 150{ 151 this.UpRow.style.display = ( upFolderPath != null ? '' : 'none' ) ; 152 153 if ( upFolderPath != null ) 154 { 155 document.getElementById('linkUpIcon').onclick = document.getElementById('linkUp').onclick = function() 156 { 157 LoadFolders( upFolderPath ) ; 158 return false ; 159 } 160 } 161} 162 163function CheckLoaded() 164{ 165 if ( window.top.IsLoadedActualFolder 166 && window.top.IsLoadedCreateFolder 167 && window.top.IsLoadedUpload 168 && window.top.IsLoadedResourcesList ) 169 { 170 window.clearInterval( iIntervalId ) ; 171 bIsLoaded = true ; 172 GetCurentFolder(); 173 //OpenFolder( sActiveFolder ) ; 174 } 175} 176 177function OpenFolder( folderPath ) 178{ 179 sActiveFolder = folderPath ; 180 181 if ( ! bIsLoaded ) 182 { 183 if ( ! iIntervalId ) 184 iIntervalId = window.setInterval( CheckLoaded, 100 ) ; 185 return ; 186 } 187 188 // Change the style for the select row (to show the opened folder). 189 for ( var sFolderPath in oListManager.TableRows ) 190 { 191 $ronly = ""; 192 if(oListManager.TableRows[ sFolderPath ].className.match(/RO/)) { 193 $ronly='RO'; 194 195 } 196 oListManager.TableRows[ sFolderPath ].className = 197 ( sFolderPath == folderPath ? 'FolderListCurrentFolder' + $ronly : 'FolderListFolder' + $ronly ) ; 198 } 199 200 // Set the current folder in all frames. 201 window.parent.frames['frmActualFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ; 202 window.parent.frames['frmCreateFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ; 203 window.parent.frames['frmUpload'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ; 204 205 // Load the resources list for this folder. 206 window.parent.frames['frmResourcesList'].LoadResources( oConnector.ResourceType, folderPath ) ; 207} 208 209function LoadFolders( folderPath ) 210{ 211 // Clear the folders list. 212 oListManager.Clear() ; 213 214 // Get the parent folder path. 215 var sParentFolderPath ; 216 if ( folderPath != '/' ) 217 sParentFolderPath = folderPath.substring( 0, folderPath.lastIndexOf( '/', folderPath.length - 2 ) + 1 ) ; 218 219 // Show/Hide the Up Folder. 220 oListManager.ShowUpFolder( sParentFolderPath ) ; 221 222 if ( folderPath != '/' ) 223 { 224 sActiveFolder = folderPath ; 225 oConnector.CurrentFolder = sParentFolderPath ; 226 oConnector.SendCommand( 'GetFolders', null, GetFoldersCallBack ) ; 227 } 228 else 229 OpenFolder( '/' ) ; 230 231 232} 233 234function GetFoldersCallBack( fckXml ) 235{ 236 if ( oConnector.CheckError( fckXml ) != 0 ) 237 return ; 238 239 // Get the current folder path. 240 var oNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' ) ; 241 var sCurrentFolderPath = oNode.attributes.getNamedItem('path').value ; 242 243 var oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' ) ; 244 245 for ( var i = 0 ; i < oNodes.length ; i++ ) 246 { 247 // var sFolderName = decodeURI(oNodes[i].attributes.getNamedItem('name').value) ; 248 var sFolderName = dwikiUTF8_decodeFN(oNodes[i].attributes.getNamedItem('name').value,DwikiFNencode); 249 var folder_class = oNodes[i].attributes.getNamedItem('class').value ; 250 oListManager.AddItem( sFolderName, sCurrentFolderPath + sFolderName + '/', folder_class ) ; 251 } 252 253 OpenFolder( sActiveFolder ) ; 254} 255 256function SetResourceType( type ) 257{ 258 oConnector.ResourceType = type ; 259 LoadFolders( '/' ) ; 260} 261 262window.onload = function() 263{ 264 setupLanguage(); 265 oListManager.Init() ; 266 LoadFolders( '/' ) ; 267} 268 </script> 269 </head> 270 <body class="FileArea"> 271 <table id="tableFiles" cellSpacing="0" cellPadding="0" width="100%" border="0"> 272 <tr id="trUp" style="DISPLAY: none"> 273 <td width="16"><a id="linkUpIcon" href="#"><img alt="" src="images/FolderUp.gif" width="16" height="16" border="0"></a></td> 274 <td nowrap width="100%"> <a id="linkUp" href="#">..</a></td> 275 </tr> 276 </table> 277 </body> 278</html> 279