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 all resources available in a folder in the File Browser.
24 <html xmlns="http://www.w3.org/1999/xhtml">
26 <title>Resources</title>
27 <link href="browser.css" type="text/css" rel="stylesheet">
28 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
29 <script type="text/javascript" src="js/common.js"></script>
30 <script type="text/javascript">
32 var oListManager = new Object() ;
34 oListManager.Clear = function()
36 document.body.innerHTML = '' ;
39 function ProtectPath(path)
41 path = path.replace( /\\/g, '\\\\') ;
44 path = path.replace( /'/g, '\\\'') ;
45 path = path.replace( /'/g, '\\\'') ;
51 oListManager.GetFolderRowHtml = function( folderName, folderPath )
53 // Build the link to view the folder.
54 var sLink = '<a href="#" onclick="OpenFolder(\'' + ProtectPath( folderPath ) + '\');return false;">' ;
59 '<img alt="" src="images/Folder.gif" width="16" height="16" border="0"><\/a>' +
60 '<\/td><td nowrap colspan="2"> ' +
67 oListManager.GetFileRowHtml = function( fileName, fileUrl, fileSize )
69 // Build the link to view the folder.
70 var sLink = '<a href="#" onclick="OpenFile(\'' + ProtectPath( fileUrl ) + '\');return false;">' ;
73 var sIcon = oIcons.GetIcon( fileName ) ;
78 '<img alt="" src="images/icons/' + sIcon + '.gif" width="16" height="16" border="0"><\/a>' +
83 '<\/td><td align="right" nowrap> ' +
89 function OpenFolder( folderPath )
91 // Load the resources list for this folder.
92 window.parent.frames['frmFolders'].LoadFolders( folderPath ) ;
95 function OpenFile( fileUrl )
99 var match = window.top.location.search.match(/(?:[\?&]|&)CKEditorFuncNum=([^&]+)/i);
\r
101 var funcNum = (match && match.length) ? match[1] : '';
\r
103 window.top.opener.CKEDITOR.tools.callFunction(funcNum, fileUrl);
\r
107 window.top.opener.focus() ;
110 function LoadResources( resourceType, folderPath )
112 oListManager.Clear() ;
113 oConnector.ResourceType = resourceType ;
114 oConnector.CurrentFolder = folderPath ;
115 oConnector.SendCommand( 'GetFoldersAndFiles', null, GetFoldersAndFilesCallBack ) ;
120 LoadResources( oConnector.ResourceType, oConnector.CurrentFolder ) ;
123 function GetFoldersAndFilesCallBack( fckXml )
125 if ( oConnector.CheckError( fckXml ) != 0 )
128 // Get the current folder path.
129 var oFolderNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' ) ;
130 if ( oFolderNode == null )
132 alert( 'The server didn\'t reply with a proper XML data. Please check your configuration.' ) ;
135 var sCurrentFolderPath = oFolderNode.attributes.getNamedItem('path').value.replace( /"/g, '') ;
136 var sCurrentFolderUrl = oFolderNode.attributes.getNamedItem('url').value ;
138 // var dTimer = new Date() ;
140 var oHtml = new StringBuilder( '<table id="tableFiles" cellspacing="1" cellpadding="0" width="100%" border="0">' ) ;
144 oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' ) ;
145 for ( var i = 0 ; i < oNodes.length ; i++ )
147 var sFolderName = oNodes[i].attributes.getNamedItem('name').value ;
148 oHtml.Append( oListManager.GetFolderRowHtml( sFolderName, sCurrentFolderPath + sFolderName + "/" ) ) ;
152 oNodes = fckXml.SelectNodes( 'Connector/Files/File' ) ;
153 for ( var j = 0 ; j < oNodes.length ; j++ )
155 var oNode = oNodes[j] ;
156 var sFileName = oNode.attributes.getNamedItem('name').value ;
157 var sFileSize = oNode.attributes.getNamedItem('size').value ;
159 var sFileDesc = oNode.attributes.getNamedItem('desc').value ;
160 var sFileUrl = oNode.attributes.getNamedItem('url').value ;
162 oHtml.Append( oListManager.GetFileRowHtml( sFileDesc, sFileUrl, sFileSize ) ) ;
165 oHtml.Append( '<\/table>' ) ;
167 document.body.innerHTML = oHtml.ToString() ;
169 // window.top.document.title = 'Finished processing in ' + ( ( ( new Date() ) - dTimer ) / 1000 ) + ' seconds' ;
173 window.onload = function()
175 window.top.IsLoadedResourcesList = true ;
179 <body class="FileArea">