This repository has been archived by the owner on Nov 25, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 293
/
pluploader_tpl.html
112 lines (95 loc) · 4.78 KB
/
pluploader_tpl.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php
$UploadMaxSize = AJXP_Utils::convertBytes(ini_get('upload_max_filesize'));
$UploadMaxPostSize = AJXP_Utils::convertBytes(ini_get('post_max_size'));
if($UploadMaxPostSize > 0 && $UploadMaxPostSize < $UploadMaxSize) $UploadMaxSize = $UploadMaxPostSize;
$confMaxSize = ConfService::getConf("UPLOAD_MAX_FILE");
if($confMaxSize != 0 && $confMaxSize < $UploadMaxSize) $UploadMaxSize = $confMaxSize;
$confTotalSize = ConfService::getConf("UPLOAD_MAX_TOTAL");
$confTotalNumber = ConfService::getConf("UPLOAD_MAX_NUMBER");
$repository = ConfService::getRepository();
$accessType = $repository->getAccessType();
if($accessType == "fs"){
$partitionLength = $UploadMaxSize - 1000;
}else if($accessType == "remotefs"){
$maxFileLength = $UploadMaxSize;
}else if($accessType == "ftp"){
$maxFileLength = $UploadMaxSize;
/*
// Here we could switch to FTP, but that would mean, by a way or another,
// to display in clear the ftp credentials...
// Also, beware the ftp_z.jar is needed for this to work.
$ftpWrapper = new ftpAccessWrapper();
$plugin = AJXP_PluginsService::findPlugin("access", $repository->getAccessType());
$streamData = $plugin->detectStreamWrapper(true);
$destStreamURL = $streamData["protocol"]."://".$repository->getId()."/";
// Not working now, as ftpAccessWrapper::buildRealUrl is in fact protected
$ftpURL = $ftpWrapper->buildRealUrl($destStreamURL);
// Then pass this URL to the javascript uploadUrl => to the applet.
*/
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="ffffff" style="overflow:hidden; padding: 0px; padding-left: 0px; margin: 0px;">
<link rel="stylesheet" href="plugins/uploader.plupload/plupload/jquery.plupload.queue/css/jquery.plupload.queue.css?v=2" type="text/css" media="screen" />
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript"> google.load("jquery", "1.6.4"); </script>
<script type="text/javascript" src="plugins/uploader.plupload/plupload/plupload.full.min.js"></script>
<script type="text/javascript" src="plugins/uploader.plupload/plupload/jquery.plupload.queue/jquery.plupload.queue.min.js"></script>
<script type="text/javascript" src="plugins/uploader.plupload/plupload/moxie.min.js"></script>
<script language="javascript" type="text/javascript">
// Fix height of modal box
//$(window.parent.document).find("#generic_dialog_box").height(355);
var clientId = '<?php echo session_id(); ?>';
var partitionLength = <?php echo ($partitionLength?$partitionLength:-1); ?>;
var maxFileLength = <?php echo ($maxFileLength?$maxFileLength:-1); ?>;
var ftpUrl = '<?php echo ($ftpURL?$ftpURL:""); ?>';
var uploadUrl = '<?php print($_SERVER["SCRIPT_NAME"]); ?>?get_action=upload_chunks_unify&secure_token=<?php echo AuthService::getSecureToken();?>&ajxp_sessid=<?php echo session_id(); ?>';
var upurl = '<?php print($_SERVER["SCRIPT_NAME"]); ?>?get_action=upload&secure_token=<?php echo AuthService::getSecureToken();?>&ajxp_sessid=<?php echo session_id(); ?>';
var maxFileSize = '<?PHP echo ($UploadMaxSize/1048576) . "mb"; ?>';
var maxHTML4 = '<?PHP echo $UploadMaxSize; ?>';
var chunkSize = '<?PHP echo (($UploadMaxSize/1048576) - 1) . "mb"; ?>';
var currentDir = parent.ajaxplorer.getContextNode().getPath();
$(function() {
$("#plupload_uploader").pluploadQueue({
// General settings
runtimes : 'silverlight,flash,html5,html4',
url : uploadUrl,
//max_file_size : maxFileSize, //Uncomment this line and comment the following to use php.ini max file size for maximum filesize
max_file_size : '4096mb',
chunk_size : chunkSize, //Uncomment this line to use php.ini maxsize-1 for chunk size
//chunk_size : '2mb',
unique_names : false,
multiple_queues : true,
multipart : true,
multipart_params : { dir: currentDir },
// Specify what files to browse for
filters : [],
// Flash settings
flash_swf_url : 'plugins/uploader.plupload/plupload/Moxie.swf',
silverlight_xap_url : 'plugins/uploader.plupload/plupload/Moxie.xap',
// attach callbacks before queue
preinit: attachCallbacks
});
// attach callbacks for FileUploaded
function attachCallbacks(Uploader) {
Uploader.bind('UploadFile', function(up, file, res) {
parent.document.fire("ajaxplorer:longtask_starting");
});
Uploader.bind('FileUploaded', function(up, file, res) {
if(this.total.queued <= 1) {
//parent.ajaxplorer.fireContextRefresh();
parent.document.fire("ajaxplorer:longtask_finished");
}
$.get(upurl);
});
}
});
</script>
<div id="plupload_uploader">Your browser does not support uploads, please install Flash Player or Microsoft Silverlight.</div>
</body>
</html>