Subversion Repositories Applications.papyrus

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1925 jp_milcent 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-2008 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
var oListManager = new Object() ;
33
 
34
oListManager.Clear = function()
35
{
36
	document.body.innerHTML = '' ;
37
}
38
 
39
function ProtectPath(path)
40
{
41
	path = path.replace( /\\/g, '\\\\') ;
42
	path = path.replace( /'/g, '\\\'') ;
43
	return path ;
44
}
45
 
46
oListManager.GetFolderRowHtml = function( folderName, folderPath )
47
{
48
	// Build the link to view the folder.
49
	var sLink = '<a href="#" onclick="OpenFolder(\'' + ProtectPath( folderPath ) + '\');return false;">' ;
50
 
51
	return '<tr>' +
52
			'<td width="16">' +
53
				sLink +
54
				'<img alt="" src="images/Folder.gif" width="16" height="16" border="0"><\/a>' +
55
			'<\/td><td nowrap colspan="2">&nbsp;' +
56
				sLink +
57
				folderName +
58
				'<\/a>' +
59
		'<\/td><\/tr>' ;
60
}
61
 
62
oListManager.GetFileRowHtml = function( fileName, fileUrl, fileSize )
63
{
64
	// Build the link to view the folder.
65
	var sLink = '<a href="#" onclick="OpenFile(\'' + ProtectPath( fileUrl ) + '\');return false;">' ;
66
 
67
	// Get the file icon.
68
	var sIcon = oIcons.GetIcon( fileName ) ;
69
 
70
	return '<tr>' +
71
			'<td width="16">' +
72
				sLink +
73
				'<img alt="" src="images/icons/' + sIcon + '.gif" width="16" height="16" border="0"><\/a>' +
74
			'<\/td><td>&nbsp;' +
75
				sLink +
76
				fileName +
77
				'<\/a>' +
78
			'<\/td><td align="right" nowrap>&nbsp;' +
79
				fileSize +
80
				' KB' +
81
		'<\/td><\/tr>' ;
82
}
83
 
84
function OpenFolder( folderPath )
85
{
86
	// Load the resources list for this folder.
87
	window.parent.frames['frmFolders'].LoadFolders( folderPath ) ;
88
}
89
 
90
function OpenFile( fileUrl )
91
{
92
	window.top.opener.SetUrl( encodeURI( fileUrl ).replace( '#', '%23' ) ) ;
93
	window.top.close() ;
94
	window.top.opener.focus() ;
95
}
96
 
97
function LoadResources( resourceType, folderPath )
98
{
99
	oListManager.Clear() ;
100
	oConnector.ResourceType = resourceType ;
101
	oConnector.CurrentFolder = folderPath ;
102
	oConnector.SendCommand( 'GetFoldersAndFiles', null, GetFoldersAndFilesCallBack ) ;
103
}
104
 
105
function Refresh()
106
{
107
	LoadResources( oConnector.ResourceType, oConnector.CurrentFolder ) ;
108
}
109
 
110
function GetFoldersAndFilesCallBack( fckXml )
111
{
112
	if ( oConnector.CheckError( fckXml ) != 0 )
113
		return ;
114
 
115
	// Get the current folder path.
116
	var oFolderNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' ) ;
117
	if ( oFolderNode == null )
118
	{
119
		alert( 'The server didn\'t reply with a proper XML data. Please check your configuration.' ) ;
120
		return ;
121
	}
122
	var sCurrentFolderPath	= oFolderNode.attributes.getNamedItem('path').value ;
123
	var sCurrentFolderUrl	= oFolderNode.attributes.getNamedItem('url').value ;
124
 
125
//	var dTimer = new Date() ;
126
 
127
	var oHtml = new StringBuilder( '<table id="tableFiles" cellspacing="1" cellpadding="0" width="100%" border="0">' ) ;
128
 
129
	// Add the Folders.
130
	var oNodes ;
131
	oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' ) ;
132
	for ( var i = 0 ; i < oNodes.length ; i++ )
133
	{
134
		var sFolderName = oNodes[i].attributes.getNamedItem('name').value ;
135
		oHtml.Append( oListManager.GetFolderRowHtml( sFolderName, sCurrentFolderPath + sFolderName + "/" ) ) ;
136
	}
137
 
138
	// Add the Files.
139
	oNodes = fckXml.SelectNodes( 'Connector/Files/File' ) ;
140
	for ( var j = 0 ; j < oNodes.length ; j++ )
141
	{
142
		var oNode = oNodes[j] ;
143
		var sFileName = oNode.attributes.getNamedItem('name').value ;
144
		var sFileSize = oNode.attributes.getNamedItem('size').value ;
145
 
146
		// Get the optional "url" attribute. If not available, build the url.
147
		var oFileUrlAtt = oNodes[j].attributes.getNamedItem('url') ;
148
		var sFileUrl = oFileUrlAtt != null ? oFileUrlAtt.value : sCurrentFolderUrl + sFileName ;
149
 
150
		oHtml.Append( oListManager.GetFileRowHtml( sFileName, sFileUrl, sFileSize ) ) ;
151
	}
152
 
153
	oHtml.Append( '<\/table>' ) ;
154
 
155
	document.body.innerHTML = oHtml.ToString() ;
156
 
157
//	window.top.document.title = 'Finished processing in ' + ( ( ( new Date() ) - dTimer ) / 1000 ) + ' seconds' ;
158
 
159
}
160
 
161
window.onload = function()
162
{
163
	window.top.IsLoadedResourcesList = true ;
164
}
165
	</script>
166
</head>
167
<body class="FileArea">
168
</body>
169
</html>