Project

General

Profile

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 all resources available in a folder in the File Browser.
23
-->
24
<html>
25
<head>
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">
31

    
32

    
33

    
34

    
35
var oListManager = new Object() ;
36

    
37
oListManager.Clear = function()
38
{
39
	document.body.innerHTML = '' ;
40
}
41

    
42
function ProtectPath(path)
43
{
44
	path = path.replace( /\\/g, '\\\\') ;
45
	path = path.replace( /'/g, '\\\'') ;
46
	return path ;
47
}
48

    
49
oListManager.GetFolderRowHtml = function( folderName, folderPath )
50
{
51
	// Build the link to view the folder.
52
	var sLink = '<a href="#" onclick="OpenFolder(\'' + ProtectPath( folderPath ) + '\');return false;">' ;
53

    
54
	return '<tr>' +
55
			'<td width="16">' +
56
				sLink +
57
				'<img alt="" src="images/Folder.gif" width="16" height="16" border="0"><\/a>' +
58
			'<\/td><td nowrap colspan="2">&nbsp;' +
59
				sLink +
60
				folderName +
61
				'<\/a>' +
62
		'<\/td><\/tr>' ;
63
}
64

    
65
oListManager.GetFileRowHtml = function( fileName, fileUrl, fileSize )
66
{
67
	// Build the link to view the folder.
68
	var sLink = '<a href="#" onclick="OpenFile(\'' + ProtectPath( fileUrl ) + '\');return false;">' ;
69
	var relLink = '<a href="'+fileUrl+'" rel="lightbox">' ;
70

    
71
	// Get the file icon.
72
	var sIcon = oIcons.GetIcon( fileName ) ;
73

    
74
	return '<tr>' +
75
			'<td class="icon">' +
76
				sLink +
77
				'<img alt="" src="images/icons/' + sIcon + '.gif" width="16" height="16" border="0"><\/a>' +
78
			'<\/td>'+
79
			'<td class="thumbnail">' +
80
				sLink +
81
				'<img alt="" src="' + fileUrl + '" width="100"><\/a>' +
82
			'<\/td>' +
83
            '<td class="filename">' +
84
				sLink +
85
				fileName +
86
				'<\/a>' +
87
			'<\/td>'+
88
            '<td align="right" nowrap>&nbsp;' +
89
				fileSize +
90
				' KB' +
91
		'<\/td><\/tr>' ;
92
}
93

    
94
function OpenFolder( folderPath )
95
{
96
	// Load the resources list for this folder.
97
	window.parent.frames['frmFolders'].LoadFolders( folderPath ) ;
98
}
99

    
100
function OpenFile( fileUrl )
101
{
102
	window.top.opener.SetUrl( fileUrl ) ;
103
	window.top.close() ;
104
	window.top.opener.focus() ;
105
}
106

    
107
function LoadResources( resourceType, folderPath )
108
{
109
	oListManager.Clear() ;
110
	oConnector.ResourceType = resourceType ;
111
	oConnector.CurrentFolder = folderPath ;
112
	oConnector.SendCommand( 'GetFoldersAndFiles', null, GetFoldersAndFilesCallBack ) ;
113
}
114

    
115
function Refresh()
116
{
117
	LoadResources( oConnector.ResourceType, oConnector.CurrentFolder ) ;
118
}
119

    
120
function GetFoldersAndFilesCallBack( fckXml )
121
{
122
	if ( oConnector.CheckError( fckXml ) != 0 )
123
		return ;
124

    
125
	// Get the current folder path.
126
	var oFolderNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' ) ;
127
	if ( oFolderNode == null )
128
	{
129
		alert( 'The server didn\'t reply with a proper XML data. Please check your configuration.' ) ;
130
		return ;
131
	}
132
	var sCurrentFolderPath	= oFolderNode.attributes.getNamedItem('path').value ;
133
	var sCurrentFolderUrl	= oFolderNode.attributes.getNamedItem('url').value ;
134

    
135
//	var dTimer = new Date() ;
136

    
137
	var oHtml = new StringBuilder( '<table id="tableFiles" cellspacing="1" cellpadding="0" width="100%" border="0">' ) ;
138

    
139
	// Add the Folders.
140
	var oNodes ;
141
	oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' ) ;
142
	for ( var i = 0 ; i < oNodes.length ; i++ )
143
	{
144
		var sFolderName = oNodes[i].attributes.getNamedItem('name').value ;
145
		oHtml.Append( oListManager.GetFolderRowHtml( sFolderName, sCurrentFolderPath + sFolderName + "/" ) ) ;
146
	}
147

    
148
	// Add the Files.
149
	oNodes = fckXml.SelectNodes( 'Connector/Files/File' ) ;
150
	for ( var j = 0 ; j < oNodes.length ; j++ )
151
	{
152
		var oNode = oNodes[j] ;
153
		var sFileName = oNode.attributes.getNamedItem('name').value ;
154
		var sFileSize = oNode.attributes.getNamedItem('size').value ;
155

    
156
		// Get the optional "url" attribute. If not available, build the url.
157
		var oFileUrlAtt = oNodes[j].attributes.getNamedItem('url') ;
158
		var sFileUrl = oFileUrlAtt != null ? oFileUrlAtt.value : encodeURI( sCurrentFolderUrl + sFileName ).replace( /#/g, '%23' ) ;
159

    
160
		oHtml.Append( oListManager.GetFileRowHtml( sFileName, sFileUrl, sFileSize ) ) ;
161
	}
162

    
163
	oHtml.Append( '<\/table>' ) ;
164

    
165
	document.body.innerHTML = oHtml.ToString() ;
166

    
167
//	window.top.document.title = 'Finished processing in ' + ( ( ( new Date() ) - dTimer ) / 1000 ) + ' seconds' ;
168

    
169
}
170

    
171
window.onload = function()
172
{
173
	window.top.IsLoadedResourcesList = true ;
174
}
175

    
176
	</script>
177
</head>
178
<body class="FileArea">
179
</body>
180
</html>
(7-7/12)