Subversion Repositories Applications.papyrus

Rev

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

Rev Author Line No. Line
1921 jp_milcent 1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
1075 ddelon 2
<!--
1921 jp_milcent 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 the list of folders available in the parent folder
23
 * of the current folder.
1075 ddelon 24
-->
25
<html>
26
	<head>
1921 jp_milcent 27
		<title>Folders</title>
1075 ddelon 28
		<link href="browser.css" type="text/css" rel="stylesheet">
1921 jp_milcent 29
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
1075 ddelon 30
		<script type="text/javascript" src="js/common.js"></script>
1921 jp_milcent 31
		<script type="text/javascript">
1075 ddelon 32
 
33
var sActiveFolder ;
34
 
35
var bIsLoaded = false ;
36
var iIntervalId ;
37
 
38
var oListManager = new Object() ;
39
 
40
oListManager.Init = function()
41
{
42
	this.Table = document.getElementById('tableFiles') ;
43
	this.UpRow = document.getElementById('trUp') ;
44
 
1921 jp_milcent 45
	this.TableRows = new Object() ;
1075 ddelon 46
}
47
 
48
oListManager.Clear = function()
49
{
50
	// Remove all other rows available.
51
	while ( this.Table.rows.length > 1 )
52
		this.Table.deleteRow(1) ;
53
 
54
	// Reset the TableRows collection.
55
	this.TableRows = new Object() ;
56
}
57
 
58
oListManager.AddItem = function( folderName, folderPath )
59
{
60
	// Create the new row.
61
	var oRow = this.Table.insertRow(-1) ;
62
	oRow.className = 'FolderListFolder' ;
63
 
64
	// Build the link to view the folder.
65
	var sLink = '<a href="#" onclick="OpenFolder(\'' + folderPath + '\');return false;">' ;
66
 
67
	// Add the folder icon cell.
68
	var oCell = oRow.insertCell(-1) ;
69
	oCell.width = 16 ;
1921 jp_milcent 70
	oCell.innerHTML = sLink + '<img alt="" src="images/spacer.gif" width="16" height="16" border="0"><\/a>' ;
1075 ddelon 71
 
72
	// Add the folder name cell.
73
	oCell = oRow.insertCell(-1) ;
74
	oCell.noWrap = true ;
1921 jp_milcent 75
	oCell.innerHTML = '&nbsp;' + sLink + folderName + '<\/a>' ;
76
 
1075 ddelon 77
	this.TableRows[ folderPath ] = oRow ;
78
}
79
 
80
oListManager.ShowUpFolder = function( upFolderPath )
81
{
82
	this.UpRow.style.display = ( upFolderPath != null ? '' : 'none' ) ;
1921 jp_milcent 83
 
1075 ddelon 84
	if ( upFolderPath != null )
85
	{
86
		document.getElementById('linkUpIcon').onclick = document.getElementById('linkUp').onclick = function()
87
		{
88
			LoadFolders( upFolderPath ) ;
89
			return false ;
90
		}
91
	}
92
}
93
 
94
function CheckLoaded()
95
{
1921 jp_milcent 96
	if ( window.top.IsLoadedActualFolder
97
		&& window.top.IsLoadedCreateFolder
1075 ddelon 98
		&& window.top.IsLoadedUpload
99
		&& window.top.IsLoadedResourcesList )
100
	{
101
		window.clearInterval( iIntervalId ) ;
102
		bIsLoaded = true ;
103
		OpenFolder( sActiveFolder ) ;
104
	}
105
}
106
 
107
function OpenFolder( folderPath )
108
{
109
	sActiveFolder = folderPath ;
110
 
111
	if ( ! bIsLoaded )
112
	{
113
		if ( ! iIntervalId )
114
			iIntervalId = window.setInterval( CheckLoaded, 100 ) ;
115
		return ;
116
	}
117
 
118
	// Change the style for the select row (to show the opened folder).
119
	for ( var sFolderPath in oListManager.TableRows )
120
	{
1921 jp_milcent 121
		oListManager.TableRows[ sFolderPath ].className =
1075 ddelon 122
			( sFolderPath == folderPath ? 'FolderListCurrentFolder' : 'FolderListFolder' ) ;
123
	}
124
 
125
	// Set the current folder in all frames.
126
	window.parent.frames['frmActualFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ;
127
	window.parent.frames['frmCreateFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ;
128
	window.parent.frames['frmUpload'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ;
1921 jp_milcent 129
 
1075 ddelon 130
	// Load the resources list for this folder.
131
	window.parent.frames['frmResourcesList'].LoadResources( oConnector.ResourceType, folderPath ) ;
132
}
133
 
134
function LoadFolders( folderPath )
135
{
136
	// Clear the folders list.
137
	oListManager.Clear() ;
138
 
139
	// Get the parent folder path.
140
	var sParentFolderPath ;
141
	if ( folderPath != '/' )
142
		sParentFolderPath = folderPath.substring( 0, folderPath.lastIndexOf( '/', folderPath.length - 2 ) + 1 ) ;
143
 
144
	// Show/Hide the Up Folder.
145
	oListManager.ShowUpFolder( sParentFolderPath ) ;
1921 jp_milcent 146
 
1075 ddelon 147
	if ( folderPath != '/' )
148
	{
149
		sActiveFolder = folderPath ;
1921 jp_milcent 150
		oConnector.CurrentFolder = sParentFolderPath ;
1075 ddelon 151
		oConnector.SendCommand( 'GetFolders', null, GetFoldersCallBack ) ;
152
	}
153
	else
154
		OpenFolder( '/' ) ;
155
}
156
 
157
function GetFoldersCallBack( fckXml )
158
{
159
	if ( oConnector.CheckError( fckXml ) != 0 )
160
		return ;
1921 jp_milcent 161
 
1075 ddelon 162
	// Get the current folder path.
163
	var oNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' ) ;
164
	var sCurrentFolderPath = oNode.attributes.getNamedItem('path').value ;
1921 jp_milcent 165
 
1075 ddelon 166
	var oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' ) ;
1921 jp_milcent 167
 
1075 ddelon 168
	for ( var i = 0 ; i < oNodes.length ; i++ )
169
	{
170
		var sFolderName = oNodes[i].attributes.getNamedItem('name').value ;
1921 jp_milcent 171
		oListManager.AddItem( sFolderName, sCurrentFolderPath + sFolderName + '/' ) ;
1075 ddelon 172
	}
1921 jp_milcent 173
 
1075 ddelon 174
	OpenFolder( sActiveFolder ) ;
175
}
176
 
177
function SetResourceType( type )
178
{
179
	oConnector.ResourceType = type ;
180
	LoadFolders( '/' ) ;
181
}
182
 
183
window.onload = function()
184
{
185
	oListManager.Init() ;
186
	LoadFolders( '/' ) ;
187
}
188
		</script>
189
	</head>
1921 jp_milcent 190
	<body class="FileArea">
1075 ddelon 191
		<table id="tableFiles" cellSpacing="0" cellPadding="0" width="100%" border="0">
192
			<tr id="trUp" style="DISPLAY: none">
193
				<td width="16"><a id="linkUpIcon" href="#"><img alt="" src="images/FolderUp.gif" width="16" height="16" border="0"></a></td>
194
				<td nowrap width="100%">&nbsp;<a id="linkUp" href="#">..</a></td>
195
			</tr>
196
		</table>
197
	</body>
198
</html>