Subversion Repositories Applications.papyrus

Rev

Rev 1075 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1075 ddelon 1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2
<!--
3
 * FCKeditor - The text editor for internet
4
 * Copyright (C) 2003-2006 Frederico Caldeira Knabben
5
 *
6
 * Licensed under the terms of the GNU Lesser General Public License:
7
 * 		http://www.opensource.org/licenses/lgpl-license.php
8
 *
9
 * For further information visit:
10
 * 		http://www.fckeditor.net/
11
 *
12
 * "Support Open Source software. What about a donation today?"
13
 *
14
 * File Name: frmresourceslist.html
15
 * 	This page shows all resources available in a folder in the File Browser.
16
 *
17
 * File Authors:
18
 * 		Frederico Caldeira Knabben (fredck@fckeditor.net)
19
-->
20
<html xmlns="http://www.w3.org/1999/xhtml">
21
<head>
22
	<link href="browser.css" type="text/css" rel="stylesheet" />
23
	<script type="text/javascript" src="js/common.js"></script>
24
	<script type="text/javascript">
25
 
26
var oListManager = new Object() ;
27
 
28
oListManager.Clear = function()
29
{
30
	document.body.innerHTML = '' ;
31
}
32
 
33
oListManager.GetFolderRowHtml = function( folderName, folderPath )
34
{
35
	// Build the link to view the folder.
36
	var sLink = '<a href="#" onclick="OpenFolder(\'' + folderPath.replace( /'/g, '\\\'') + '\');return false;">' ;
37
 
38
	return '<tr>' +
39
			'<td width="16">' +
40
				sLink +
41
				'<img alt="" src="images/Folder.gif" width="16" height="16" border="0"></a>' +
42
			'</td><td nowrap colspan="2">&nbsp;' +
43
				sLink +
44
				folderName +
45
				'</a>' +
46
		'</td></tr>' ;
47
}
48
 
49
oListManager.GetFileRowHtml = function( fileName, fileUrl, fileSize )
50
{
51
	// Build the link to view the folder.
52
	var sLink = '<a href="#" onclick="OpenFile(\'' + fileUrl.replace( /'/g, '\\\'') + '\');return false;">' ;
53
 
54
	// Get the file icon.
55
	var sIcon = oIcons.GetIcon( fileName ) ;
56
 
57
	return '<tr>' +
58
			'<td width="16">' +
59
				sLink +
60
				'<img alt="" src="images/icons/' + sIcon + '.gif" width="16" height="16" border="0"></a>' +
61
			'</td><td>&nbsp;' +
62
				sLink +
63
				fileName +
64
				'</a>' +
65
			'</td><td align="right" nowrap>&nbsp;' +
66
				fileSize +
67
				' KB' +
68
		'</td></tr>' ;
69
}
70
 
71
function OpenFolder( folderPath )
72
{
73
	// Load the resources list for this folder.
74
	window.parent.frames['frmFolders'].LoadFolders( folderPath ) ;
75
}
76
 
77
function OpenFile( fileUrl )
78
{
79
	window.top.opener.SetUrl( fileUrl ) ;
80
	window.top.close() ;
81
	window.top.opener.focus() ;
82
}
83
 
84
function LoadResources( resourceType, folderPath )
85
{
86
	oListManager.Clear() ;
87
	oConnector.ResourceType = resourceType ;
88
	oConnector.CurrentFolder = folderPath ;
89
	oConnector.SendCommand( 'GetFoldersAndFiles', null, GetFoldersAndFilesCallBack ) ;
90
}
91
 
92
function Refresh()
93
{
94
	LoadResources( oConnector.ResourceType, oConnector.CurrentFolder ) ;
95
}
96
 
97
function GetFoldersAndFilesCallBack( fckXml )
98
{
99
	if ( oConnector.CheckError( fckXml ) != 0 )
100
		return ;
101
 
102
	// Get the current folder path.
103
	var oNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' ) ;
104
	var sCurrentFolderPath	= oNode.attributes.getNamedItem('path').value ;
105
	var sCurrentFolderUrl	= oNode.attributes.getNamedItem('url').value ;
106
 
107
//	var dTimer = new Date() ;
108
 
109
	var oHtml = new StringBuilder( '<table id="tableFiles" cellspacing="1" cellpadding="0" width="100%" border="0">' ) ;
110
 
111
	// Add the Folders.
112
	var oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' ) ;
113
	for ( var i = 0 ; i < oNodes.length ; i++ )
114
	{
115
		var sFolderName = oNodes[i].attributes.getNamedItem('name').value ;
116
		oHtml.Append( oListManager.GetFolderRowHtml( sFolderName, sCurrentFolderPath + sFolderName + "/" ) ) ;
117
	}
118
 
119
	// Add the Files.
120
	var oNodes = fckXml.SelectNodes( 'Connector/Files/File' ) ;
121
	for ( var i = 0 ; i < oNodes.length ; i++ )
122
	{
123
		var oNode = oNodes[i] ;
124
		var sFileName = oNode.attributes.getNamedItem('name').value ;
125
		var sFileSize = oNode.attributes.getNamedItem('size').value ;
126
 
127
		// Get the optional "url" attribute. If not available, build the url.
128
		var oFileUrlAtt = oNodes[i].attributes.getNamedItem('url') ;
129
		var sFileUrl = oFileUrlAtt != null ? oFileUrlAtt.value : sCurrentFolderUrl + sFileName ;
130
 
131
		oHtml.Append( oListManager.GetFileRowHtml( sFileName, sFileUrl, sFileSize ) ) ;
132
	}
133
 
134
	oHtml.Append( '</table>' ) ;
135
 
136
	document.body.innerHTML = oHtml.ToString() ;
137
 
138
//	window.top.document.title = 'Finished processing in ' + ( ( ( new Date() ) - dTimer ) / 1000 ) + ' seconds' ;
139
 
140
}
141
 
142
window.onload = function()
143
{
144
	window.top.IsLoadedResourcesList = true ;
145
}
146
	</script>
147
</head>
148
<body class="FileArea" bottommargin="10" leftmargin="10" topmargin="10" rightmargin="10">
149
</body>
150
</html>