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 all resources available in a folder in the File Browser.
\r
26 <title>Resources</title>
\r
27 <link href="browser.css" type="text/css" rel="stylesheet">
\r
28 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
\r
29 <script type="text/javascript" src="js/common.js"></script>
\r
30 <script type="text/javascript">
\r
32 var oListManager = new Object() ;
\r
34 oListManager.Clear = function()
\r
36 document.body.innerHTML = '' ;
\r
39 function ProtectPath(path)
\r
41 path = path.replace( /\\/g, '\\\\') ;
\r
42 path = path.replace( /'/g, '\\\'') ;
\r
46 oListManager.GetFolderRowHtml = function( folderName, folderPath )
\r
48 // Build the link to view the folder.
\r
49 var sLink = '<a href="#" onclick="OpenFolder(\'' + ProtectPath( folderPath ) + '\');return false;">' ;
\r
54 '<img alt="" src="images/Folder.gif" width="16" height="16" border="0"><\/a>' +
\r
55 '<\/td><td nowrap colspan="2"> ' +
\r
62 oListManager.GetFileRowHtml = function( fileName, fileUrl, fileSize )
\r
64 // Build the link to view the folder.
\r
65 var sLink = '<a href="#" onclick="OpenFile(\'' + ProtectPath( fileUrl ) + '\');return false;">' ;
\r
67 // Get the file icon.
\r
68 var sIcon = oIcons.GetIcon( fileName ) ;
\r
73 '<img alt="" src="images/icons/' + sIcon + '.gif" width="16" height="16" border="0"><\/a>' +
\r
74 '<\/td><td> ' +
\r
78 '<\/td><td align="right" nowrap> ' +
\r
84 function OpenFolder( folderPath )
\r
86 // Load the resources list for this folder.
\r
87 window.parent.frames['frmFolders'].LoadFolders( folderPath ) ;
\r
90 function OpenFile( fileUrl )
\r
92 window.top.opener.SetUrl( fileUrl ) ;
\r
93 window.top.close() ;
\r
94 window.top.opener.focus() ;
\r
97 function LoadResources( resourceType, folderPath )
\r
99 oListManager.Clear() ;
\r
100 oConnector.ResourceType = resourceType ;
\r
101 oConnector.CurrentFolder = folderPath ;
\r
102 oConnector.SendCommand( 'GetFoldersAndFiles', null, GetFoldersAndFilesCallBack ) ;
\r
107 LoadResources( oConnector.ResourceType, oConnector.CurrentFolder ) ;
\r
110 function GetFoldersAndFilesCallBack( fckXml )
\r
112 if ( oConnector.CheckError( fckXml ) != 0 )
\r
115 // Get the current folder path.
\r
116 var oFolderNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' ) ;
\r
117 if ( oFolderNode == null )
\r
119 alert( 'The server didn\'t reply with a proper XML data. Please check your configuration.' ) ;
\r
122 var sCurrentFolderPath = oFolderNode.attributes.getNamedItem('path').value ;
\r
123 var sCurrentFolderUrl = oFolderNode.attributes.getNamedItem('url').value ;
\r
125 // var dTimer = new Date() ;
\r
127 var oHtml = new StringBuilder( '<table id="tableFiles" cellspacing="1" cellpadding="0" width="100%" border="0">' ) ;
\r
129 // Add the Folders.
\r
131 oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' ) ;
\r
132 for ( var i = 0 ; i < oNodes.length ; i++ )
\r
134 var sFolderName = oNodes[i].attributes.getNamedItem('name').value ;
\r
135 oHtml.Append( oListManager.GetFolderRowHtml( sFolderName, sCurrentFolderPath + sFolderName + "/" ) ) ;
\r
139 oNodes = fckXml.SelectNodes( 'Connector/Files/File' ) ;
\r
140 for ( var j = 0 ; j < oNodes.length ; j++ )
\r
142 var oNode = oNodes[j] ;
\r
143 var sFileName = oNode.attributes.getNamedItem('name').value ;
\r
144 var sFileSize = oNode.attributes.getNamedItem('size').value ;
\r
146 // Get the optional "url" attribute. If not available, build the url.
\r
147 var oFileUrlAtt = oNodes[j].attributes.getNamedItem('url') ;
\r
148 var sFileUrl = oFileUrlAtt != null ? oFileUrlAtt.value : encodeURI( sCurrentFolderUrl + sFileName ).replace( /#/g, '%23' ) ;
\r
150 oHtml.Append( oListManager.GetFileRowHtml( sFileName, sFileUrl, sFileSize ) ) ;
\r
153 oHtml.Append( '<\/table>' ) ;
\r
155 document.body.innerHTML = oHtml.ToString() ;
\r
157 // window.top.document.title = 'Finished processing in ' + ( ( ( new Date() ) - dTimer ) / 1000 ) + ' seconds' ;
\r
161 window.onload = function()
\r
163 window.top.IsLoadedResourcesList = true ;
\r
167 <body class="FileArea">
\r