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
 * Page used to upload new files in the current folder.
23
-->
24
<html>
25
	<head>
26
		<title>File Upload</title>
27
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
28
		<link href="browser.css" type="text/css" rel="stylesheet" >
29
		<script type="text/javascript" src="js/common.js"></script>
30
		<script type="text/javascript">
31
 
32
function SetCurrentFolder( resourceType, folderPath )
33
{
34
	var sUrl = oConnector.ConnectorUrl + 'Command=FileUpload' ;
35
	sUrl += '&Type=' + resourceType ;
36
	sUrl += '&CurrentFolder=' + encodeURIComponent( folderPath ) ;
37
 
38
	document.getElementById('frmUpload').action = sUrl ;
39
}
40
 
41
function OnSubmit()
42
{
43
	if ( document.getElementById('NewFile').value.length == 0 )
44
	{
45
		alert( 'Please select a file from your computer' ) ;
46
		return false ;
47
	}
48
 
49
	// Set the interface elements.
50
	document.getElementById('eUploadMessage').innerHTML = 'Upload a new file in this folder (Upload in progress, please wait...)' ;
51
	document.getElementById('btnUpload').disabled = true ;
52
 
53
	return true ;
54
}
55
 
56
function OnUploadCompleted( errorNumber, data )
57
{
58
	// Reset the Upload Worker Frame.
59
	window.parent.frames['frmUploadWorker'].location = 'javascript:void(0)' ;
60
 
61
	// Reset the upload form (On IE we must do a little trick to avoid problems).
62
	if ( document.all )
63
		document.getElementById('NewFile').outerHTML = '<input id="NewFile" name="NewFile" style="WIDTH: 100%" type="file">' ;
64
	else
65
		document.getElementById('frmUpload').reset() ;
66
 
67
	// Reset the interface elements.
68
	document.getElementById('eUploadMessage').innerHTML = 'Upload a new file in this folder' ;
69
	document.getElementById('btnUpload').disabled = false ;
70
 
71
	switch ( errorNumber )
72
	{
73
		case 0 :
74
			window.parent.frames['frmResourcesList'].Refresh() ;
75
			break ;
76
		case 1 :	// Custom error.
77
			alert( data ) ;
78
			break ;
79
		case 201 :
80
			window.parent.frames['frmResourcesList'].Refresh() ;
81
			alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + data + '"' ) ;
82
			break ;
83
		case 202 :
84
			alert( 'Invalid file' ) ;
85
			break ;
86
		default :
87
			alert( 'Error on file upload. Error number: ' + errorNumber ) ;
88
			break ;
89
	}
90
}
91
 
92
window.onload = function()
93
{
94
	window.top.IsLoadedUpload = true ;
95
}
96
		</script>
97
	</head>
98
	<body>
99
		<form id="frmUpload" action="" target="frmUploadWorker" method="post" enctype="multipart/form-data" onsubmit="return OnSubmit();">
100
			<table class="fullHeight" cellspacing="0" cellpadding="0" width="100%" border="0">
101
				<tr>
102
					<td nowrap="nowrap">
103
						<span id="eUploadMessage">Upload a new file in this folder</span><br>
104
						<table cellspacing="0" cellpadding="0" width="100%" border="0">
105
							<tr>
106
								<td width="100%"><input id="NewFile" name="NewFile" style="WIDTH: 100%" type="file"></td>
107
								<td nowrap="nowrap">&nbsp;<input id="btnUpload" type="submit" value="Upload"></td>
108
							</tr>
109
						</table>
110
					</td>
111
				</tr>
112
			</table>
113
		</form>
114
	</body>
115
</html>