-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathelfinder.mustache
164 lines (146 loc) · 6.55 KB
/
elfinder.mustache
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
{{# prepareElfinderConnectorUrl }}{{!-- NOOP --}}{{/ prepareElfinderConnectorUrl }}
<!DOCTYPE html>
<html class="has-no-js{{# devMode }} s-admin-debug{{/ devMode }}" lang="{{ lang }}">
<head>
<meta charset="utf-8">
<title>{{# _t }}elFinder.manager.title{{/ _t }}</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2"/>
<script data-main="{{ elfinderAssetsUrl }}main.js" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js"></script>
<style type="text/css">
html,
body/*,
#elfinder */{
height: 100%;
margin: 0;
}
.elfinder {
border: none;
box-shadow: none;
}
</style>
<script>
// config of RequireJS (REQUIRED)
/*
require.config({
baseUrl: '{{ elfinderAssetsUrl }}js'
});
*/
/**
* elFinder options for Charcoal
*
* {@link https://github.com/Studio-42/elFinder/wiki/Client-configuration-options Documentation for client options:}
*
* @param {jQuery} $ - jQuery API
* @return {object} - elFinder client settings.
*/
define('elFinderConfig', [ 'jquery' ], function ($) {
var $window = $(window),
$html = $(document.documentElement),
customOpts = {},
defaultOpts = {},
immutableOpts = {};
$html.removeClass('has-no-js').addClass('has-js');
if (!$.fn.smartresize) {
// debouncing function from John Hann
// http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/
var debounce = function (func, threshold, execAsap) {
var timeout;
return function debounced() {
var obj = this,
args = arguments;
function delayed() {
if (!execAsap) {
func.apply(obj, args);
}
timeout = null;
};
if (timeout) {
clearTimeout(timeout);
} else if (execAsap) {
func.apply(obj, args);
}
timeout = setTimeout(delayed, threshold || 100);
};
};
$.fn.smartresize = function (fn) {
return fn ? this.bind('resize', debounce(fn)) : this.trigger('smartresize');
};
}
defaultOpts = {
url: '{{& elfinderConnectorUrl }}',
resizable: false,
height: $window.height(),
commandsOptions: {
quicklook: {
// to enable preview with Google Docs Viewer
googleDocsMimes: [
'application/pdf',
'image/tiff',
'application/vnd.ms-office',
'application/msword',
'application/vnd.ms-word',
'application/vnd.ms-excel',
'application/vnd.ms-powerpoint',
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'application/vnd.openxmlformats-officedocument.presentationml.presentation'
]
}
},
bootCallback: function (fm /* , extraObj */) {
// Set document.title dynamically.
var title = document.title;
fm.bind('open', function() {
var path = '',
cwd = fm.cwd();
if (cwd) {
path = fm.path(cwd.hash) || null;
}
document.title = path ? path + ':' + title : title;
}).bind('destroy', function() {
document.title = title;
});
$window.smartresize(function () {
var height = $window.height();
console.log('SmartResize', fm.options.height, height);
if (fm.options.height != height) {
fm.resize('auto', height);
}
});
},
getFileCallback: function (file, fm) {
if (fm.option('separator') === '\\') {
var separator = /\\/g;
if ($.isArray(file)) {
file = $.map(file, function (f) {
return f.path.replace(separator, '/');
});
} else {
file.path = file.path.replace(separator, '/');
}
}
if (typeof(parent.elFinderCallback['{{ elfinderCallback }}']) === 'function') {
parent.elFinderCallback['{{ elfinderCallback }}'](file, fm);
}
}
};
customOpts = {{& elfinderClientConfigAsJson }};
return {
defaultOpts: $.extend({}, defaultOpts, customOpts),
managers: {
'elfinder': {},
}
};
});
/**
* elFinder localizations for Charcoal
*
* @return {object} - Localized messages.
*/
define('elFinderL10n', {{& elfinderLocalizationsAsJson }});
</script>
</head>
<body>
<div id="elfinder"></div>
</body>
</html>