commit | author | age
|
723bf7
|
1 |
/* |
U |
2 |
Dateiverwaltung - File management in your browser |
|
3 |
Copyright (C) 2017 Ulrich Hilger, http://uhilger.de |
|
4 |
|
|
5 |
This program is free software: you can redistribute it and/or modify |
|
6 |
it under the terms of the GNU Affero General Public License as |
|
7 |
published by the Free Software Foundation, either version 3 of the |
|
8 |
License, or (at your option) any later version. |
|
9 |
|
|
10 |
This program is distributed in the hope that it will be useful, |
|
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
GNU Affero General Public License for more details. |
|
14 |
|
|
15 |
You should have received a copy of the GNU Affero General Public License |
|
16 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
17 |
*/ |
|
18 |
|
a4d3b5
|
19 |
var cm; |
5dfab6
|
20 |
var pfad = ''; |
10d3d3
|
21 |
var modus = 'kacheln'; |
5ebb8e
|
22 |
var openFileName = ''; |
305573
|
23 |
var ed; |
7d8ef6
|
24 |
var openEditor; |
0c1d5b
|
25 |
var userid; |
U |
26 |
var tmo; |
be9b6d
|
27 |
var tmo2; |
7165a1
|
28 |
var cutCopySrcDir; |
U |
29 |
var cutCopyFiles; |
|
30 |
var cutCopyOperation; |
fa012b
|
31 |
var loc; |
cccd2b
|
32 |
var PERS_DIR = "Persoenlich"; |
U |
33 |
var PUB_DIR = "Oeffentlich"; |
c7c502
|
34 |
|
U |
35 |
function fm_init() { |
305573
|
36 |
$("#mce-editor").hide(); |
a4d3b5
|
37 |
$('.codeeditor-space').hide(); |
U |
38 |
$('.code-editor-container').hide(); |
bef5c6
|
39 |
//$('.ost').attr('flex-basis', 0); |
a4d3b5
|
40 |
$('#newTextFile').on('click', fm_menu_neue_textdatei); |
305573
|
41 |
$('#newDoc').on('click', fm_menu_neues_dokument); |
adf812
|
42 |
$('#newFolder').on('click', fm_get_new_folder); |
fc8db1
|
43 |
$('#viewFile').on('click', fm_view_file); |
7d8ef6
|
44 |
$('#editTextFile').on('click', function() { |
U |
45 |
fm_get_file_content('text'); |
|
46 |
}); |
|
47 |
$('#editDocFile').on('click', function() { |
|
48 |
fm_get_file_content('dok'); |
|
49 |
}); |
e5ff42
|
50 |
$('#saveFile').on('click', fm_menu_datei_speichern); |
5ebb8e
|
51 |
$('#saveFileAs').on('click', fm_menu_datei_speichern_unter); |
a4d3b5
|
52 |
$('#closeFile').on('click', fm_menu_datei_schliessen); |
8446c2
|
53 |
$('#renameFile').on('click', fm_menu_datei_umbenennen); |
fc1897
|
54 |
$('#m-del').on('click', fm_menu_delete); |
7165a1
|
55 |
$('#m-cut').on('click', fm_menu_cut); |
U |
56 |
$('#m-copy').on('click', fm_menu_copy); |
|
57 |
$('#m-paste').on('click', fm_menu_paste); |
438b16
|
58 |
$('#m-shrink').on('click', fm_menu_shrink); |
bef5c6
|
59 |
$('#m-test').on('click', fm_menu_test); |
c509a0
|
60 |
$('#saveModal').on('hidden.bs.modal', function (e) { |
915927
|
61 |
$('#modal_ok').attr('onclick','').unbind('click'); |
b7475d
|
62 |
}); |
U |
63 |
$('#logout').click(fm_logout); |
05cfa7
|
64 |
fm_get_login(); |
7342b1
|
65 |
fm_get_list(''); |
7aa566
|
66 |
fm_init_uploader(); |
fa012b
|
67 |
/* |
U |
68 |
console.log('href: ' + window.location.href); |
|
69 |
console.log('host: ' + window.location.host); |
|
70 |
console.log('hostname: ' + window.location.hostname); |
|
71 |
console.log('port: ' + window.location.port); |
|
72 |
console.log('protocol: ' + window.location.protocol); |
|
73 |
*/ |
|
74 |
loc = window.location.protocol + '//' + window.location.host; |
fc8db1
|
75 |
} |
U |
76 |
|
0c1d5b
|
77 |
function fm_resize_editor() { |
U |
78 |
window.clearTimeout(tmo); |
|
79 |
tmo = window.setTimeout(function () { |
|
80 |
try { |
|
81 |
var myHeight = $('.zentrum').height() - $('.nord').height() - 4; |
|
82 |
ed.theme.resizeTo('100%', myHeight); // sets the dimensions of the editable area |
|
83 |
} catch (err) { |
|
84 |
} |
|
85 |
}, 200); |
fc8db1
|
86 |
} |
U |
87 |
|
0c1d5b
|
88 |
function fm_get_path(uid) { |
U |
89 |
//console.log('pfad: ' + pfad); |
|
90 |
var restdir; |
cccd2b
|
91 |
if(pfad.indexOf(PUB_DIR) > -1) { |
U |
92 |
restdir = pfad.substr(PUB_DIR.length); |
|
93 |
} else if(pfad.indexOf(PERS_DIR) > -1) { |
|
94 |
restdir = pfad.substr(PERS_DIR.length); |
0c1d5b
|
95 |
} |
U |
96 |
if(restdir !== undefined && restdir.startsWith('/')) { |
|
97 |
restdir = restdir.substr(1); |
|
98 |
} |
|
99 |
var pdir = fm_get_base(uid); |
|
100 |
//console.log('path: ' + pdir + "/" + restdir); |
|
101 |
if(restdir.length > 1) { |
|
102 |
return pdir + "/" + restdir; |
|
103 |
} else { |
|
104 |
return pdir; |
|
105 |
} |
|
106 |
} |
|
107 |
|
|
108 |
function fm_get_base(uid) { |
|
109 |
//console.log('pfad: ' + pfad); |
|
110 |
var pdir; |
cccd2b
|
111 |
if(pfad.indexOf(PUB_DIR) > -1) { |
0c1d5b
|
112 |
pdir = '/data/'; |
cccd2b
|
113 |
} else if(pfad.indexOf(PERS_DIR) > -1) { |
0c1d5b
|
114 |
pdir = '/home/'; |
U |
115 |
} |
|
116 |
//console.log('base: ' + pdir + uid); |
|
117 |
return pdir + uid; |
|
118 |
} |
05cfa7
|
119 |
|
0c1d5b
|
120 |
function fm_dok_editor_init(uid) { |
U |
121 |
var base = fm_get_path(uid); |
a75859
|
122 |
edCount = 0; |
0c1d5b
|
123 |
//console.log("calling tinymce.init with base: " + base + "/"); |
fc8db1
|
124 |
|
0c1d5b
|
125 |
/* |
U |
126 |
* vgl. |
|
127 |
* http://stackoverflow.com/questions/4651676/how-do-i-remove-tinymce-and-then-re-add-it |
|
128 |
*/ |
|
129 |
//tinymce.EditorManager.execCommand('mceRemoveControl',true, 'textarea.text-editor'); |
|
130 |
//tinymce.EditorManager.execCommand('mceAddControl',true, editor_id); |
|
131 |
if(ed !== undefined) { |
|
132 |
ed.destroy(); |
|
133 |
} |
|
134 |
tinymce.remove('textarea.text-editor'); |
|
135 |
tinymce.EditorManager.editors = []; |
305573
|
136 |
|
U |
137 |
/* |
|
138 |
* Konfiguration TinyMCE |
|
139 |
*/ |
|
140 |
tinymce.init({ |
547755
|
141 |
content_css : "/file-cms/ui/mce.css", |
7b7627
|
142 |
//content_css: "/jslib/bootstrap/css/bootstrap.min.css", |
7d8ef6
|
143 |
selector: "textarea.text-editor", |
305573
|
144 |
statusbar: false, |
U |
145 |
menubar: false, |
ea1ae0
|
146 |
plugins: 'advlist charmap code image link lists media print preview save table textcolor importcss', |
7d8ef6
|
147 |
toolbar: 'undo redo | styleselect | image | link unlink | bullist numlist | outdent indent | code', |
305573
|
148 |
/* |
U |
149 |
menu: { |
|
150 |
file: {title: 'File', items: 'savevers | exit'}, |
|
151 |
edit: {title: 'Edit', items: 'undo redo | cut copy paste pastetext | selectall'}, |
|
152 |
view: {title: 'View', items: 'visualaid | code | link image media | template hr'}, |
|
153 |
}, |
|
154 |
*/ |
0c1d5b
|
155 |
resize: 'both', |
ea1ae0
|
156 |
importcss_append: true, |
305573
|
157 |
width: "100%", |
U |
158 |
height: '100%', |
0c1d5b
|
159 |
document_base_url : base + "/", |
305573
|
160 |
setup: function (editor) { |
U |
161 |
ed = editor; |
|
162 |
} |
|
163 |
}); |
0c1d5b
|
164 |
|
U |
165 |
$(window).on('resize', fm_resize_editor); |
|
166 |
fm_resize_editor(); |
10d3d3
|
167 |
} |
7aa566
|
168 |
|
U |
169 |
/* ----- Uploader Anfang ----------*/ |
|
170 |
|
|
171 |
var dateien = new Array(); |
|
172 |
|
|
173 |
function fm_init_uploader() { |
|
174 |
var dropzone = document.getElementById("dateien"); |
|
175 |
dropzone.ondragover = dropzone.ondragenter = function(event) { |
|
176 |
event.stopPropagation(); |
|
177 |
event.preventDefault(); |
|
178 |
}; |
|
179 |
|
|
180 |
dropzone.ondrop = function(event) { |
|
181 |
event.stopPropagation(); |
|
182 |
event.preventDefault(); |
7ebde1
|
183 |
var fileList = event.dataTransfer.files; |
U |
184 |
for (var i=0; i<fileList.length; i++) { |
|
185 |
dateien.push(fileList[i]); |
|
186 |
} |
|
187 |
sendFile(dateien.pop()); |
7aa566
|
188 |
}; |
U |
189 |
} |
|
190 |
|
|
191 |
function sendFile(datei) { |
7ebde1
|
192 |
var uri = "../api/upload"; |
7aa566
|
193 |
var xhr = new XMLHttpRequest(); |
U |
194 |
var fd = new FormData(); |
|
195 |
xhr.open("POST", uri, true); |
|
196 |
xhr.onreadystatechange = function() { |
|
197 |
if (xhr.readyState == 4 && xhr.status == 200) { |
|
198 |
fm_get_list(pfad); |
7ebde1
|
199 |
if(dateien.length > 0) { |
U |
200 |
sendFile(dateien.pop()); |
|
201 |
} |
7aa566
|
202 |
} |
U |
203 |
}; |
7ebde1
|
204 |
fd.append('dateiauswahlfeld', datei); |
42fece
|
205 |
fd.append('pfad', pfad); |
7aa566
|
206 |
xhr.send(fd); |
U |
207 |
} |
|
208 |
|
|
209 |
/* ----- Uploader Ende --------------- */ |
10d3d3
|
210 |
|
7165a1
|
211 |
/* ------- Dateifunktionen Start ----------- */ |
U |
212 |
|
|
213 |
function fm_menu_cut() { |
98f088
|
214 |
//alert('fm_menu_cut'); |
U |
215 |
fm_cut_files(); |
7165a1
|
216 |
} |
U |
217 |
function fm_menu_copy() { |
98f088
|
218 |
//alert('fm_menu_copy'); |
U |
219 |
fm_copy_files(); |
7165a1
|
220 |
} |
U |
221 |
function fm_menu_paste() { |
98f088
|
222 |
//alert('fm_menu_paste'); |
U |
223 |
fm_paste_files(); |
7165a1
|
224 |
} |
fc1897
|
225 |
function fm_menu_delete() { |
U |
226 |
$('#confirmOk').click(function() { |
a75859
|
227 |
$('#confirmOk').attr('onclick','').unbind('click'); |
fc1897
|
228 |
fm_del_files(); |
U |
229 |
}); |
a75859
|
230 |
$('#confirmOk').text("Loeschen"); |
U |
231 |
$('#confirmOk').removeClass('btn-primary'); |
|
232 |
$('#confirmOk').addClass('btn-danger'); |
|
233 |
$('#confirmClose').hide(); |
957b51
|
234 |
$('#confirmModalTitle').text("Löschen"); |
U |
235 |
$('#confirmModalBody').text("Wirklich löschen?"); |
fc1897
|
236 |
$('#confirmModal').modal({ |
U |
237 |
keyboard: false, |
|
238 |
show: true |
|
239 |
}); |
|
240 |
} |
7165a1
|
241 |
|
U |
242 |
/* |
|
243 |
* Gewaehlte Dateien feststellen |
|
244 |
* |
|
245 |
* @returns {String} eine per JSON.stringify schon vorbereitete List zum |
|
246 |
* Absenden als Parameter an den Server |
|
247 |
*/ |
|
248 |
function fm_gewaehlte_dateien() { |
|
249 |
var gewaehlte = $('.datei-gewaehlt'); |
|
250 |
//console.log('anzahl: ' + gewaehlte.length); |
|
251 |
var fnames = new Array(); |
|
252 |
var i = 0; |
|
253 |
while(i < gewaehlte.length) { |
|
254 |
var str = { "java.lang.String": $(gewaehlte[i]).text()}; |
|
255 |
fnames.push(str); |
|
256 |
//console.log('loeschen ' + pfad + ' ' + $(gewaehlte[i]).text()); |
|
257 |
//i += 2; |
|
258 |
i++; |
|
259 |
} |
|
260 |
var liste = '{"List":' + JSON.stringify(fnames) + '}'; |
|
261 |
// 'liste' enthaelt: |
|
262 |
// {"List":[{"java.lang.String":"test3.txt"},{"java.lang.String":"Test1.txt"},{"java.lang.String":"Test2.txt"}]} |
|
263 |
// und wird auf dem Server zu einer List[ArrayList<String>] bei der jede ArrayList<String> nur ein Element hat |
|
264 |
return liste; |
|
265 |
} |
|
266 |
/* --------- Dateifunktionen Ende ---------- */ |
fc1897
|
267 |
|
bef5c6
|
268 |
function fm_menu_test() { |
U |
269 |
var w = $('.ost').width(); |
|
270 |
if(w == 0) { |
|
271 |
$('.ost').width('20%'); |
|
272 |
$('.ost').text('Hallo Welt!'); |
|
273 |
} else { |
|
274 |
$('.ost').empty(); |
|
275 |
$('.ost').width(0); |
|
276 |
} |
|
277 |
} |
|
278 |
|
10d3d3
|
279 |
function fm_ansicht_umschalten() { |
U |
280 |
if($('#ansicht').children(0).hasClass('fa-th-list')) { |
|
281 |
$('#ansicht').children(0).addClass('fa-th-large'); |
|
282 |
$('#ansicht').children(0).removeClass('fa-th-list'); |
|
283 |
modus = 'liste'; |
|
284 |
} else { |
|
285 |
$('#ansicht').children(0).addClass('fa-th-list'); |
|
286 |
$('#ansicht').children(0).removeClass('fa-th-large'); |
|
287 |
modus = 'kacheln'; |
|
288 |
} |
|
289 |
fm_get_list(pfad); |
|
290 |
} |
|
291 |
|
|
292 |
function fm_set_modus() { |
|
293 |
if(modus == 'kacheln') { |
|
294 |
$('#ansicht').children(0).addClass('fa-th-list'); |
|
295 |
$('#ansicht').children(0).removeClass('fa-th-large'); |
|
296 |
} else { |
|
297 |
$('#ansicht').children(0).addClass('fa-th-large'); |
|
298 |
$('#ansicht').children(0).removeClass('fa-th-list'); |
|
299 |
} |
a4d3b5
|
300 |
} |
U |
301 |
|
|
302 |
function fm_menu_neue_textdatei() { |
adf812
|
303 |
fm_text_edit('Neue Datei'); |
a4d3b5
|
304 |
} |
U |
305 |
|
305573
|
306 |
function fm_menu_neues_dokument() { |
7d8ef6
|
307 |
fm_dok_edit(''); |
305573
|
308 |
} |
U |
309 |
|
a4d3b5
|
310 |
function fm_menu_datei_schliessen() { |
3003b2
|
311 |
if(openEditor === 'text') { |
U |
312 |
if(!cm.getDoc().isClean()) { |
|
313 |
fm_ask_for_save(); |
|
314 |
} else { |
|
315 |
fm_do_close(); |
|
316 |
} |
|
317 |
} else { |
|
318 |
if(tinymce.activeEditor.undoManager.hasUndo()) { |
|
319 |
fm_ask_for_save(); |
|
320 |
} else { |
|
321 |
fm_do_close(); |
|
322 |
} |
|
323 |
} |
|
324 |
} |
|
325 |
|
|
326 |
function fm_ask_for_save() { |
|
327 |
// hier Abfrage ob gespeichert werden soll |
|
328 |
$('#confirmOk').click(function() { |
|
329 |
$('#confirmOk').attr('onclick','').unbind('click'); |
|
330 |
fm_menu_datei_speichern(function() { |
a75859
|
331 |
fm_do_close(); |
U |
332 |
}); |
3003b2
|
333 |
}); |
U |
334 |
$('#confirmCancel').click(function() { |
|
335 |
$('#confirmCancel').attr('onclick','').unbind('click'); |
|
336 |
}); |
|
337 |
$('#confirmClose').show(); |
|
338 |
$('#confirmClose').click(function() { |
|
339 |
$('#confirmClose').attr('onclick','').unbind('click'); |
a75859
|
340 |
fm_do_close(); |
3003b2
|
341 |
}); |
U |
342 |
$('#confirmOk').text("Speichern"); |
|
343 |
$('#confirmOk').addClass('btn-primary'); |
|
344 |
$('#confirmOk').removeClass('btn-danger'); |
|
345 |
$('#confirmModalTitle').text("Schliessen"); |
|
346 |
$('#confirmModalBody').text("Speichern vor dem Schliessen?"); |
|
347 |
$('#confirmModal').modal({ |
|
348 |
keyboard: false, |
|
349 |
show: true |
|
350 |
}); |
a75859
|
351 |
} |
U |
352 |
|
|
353 |
function fm_do_close() { |
a4d3b5
|
354 |
$('.codeeditor-space').hide(); |
U |
355 |
$('.code-editor-container').hide(); |
305573
|
356 |
$("#mce-editor").hide(); |
U |
357 |
if(cm !== undefined) { |
|
358 |
cm.toTextArea(); |
|
359 |
} |
5ebb8e
|
360 |
openFileName = ''; |
7d8ef6
|
361 |
openEditor = ''; |
adf812
|
362 |
fm_get_list(pfad); |
305573
|
363 |
fm_filectls_show(); |
e5ff42
|
364 |
} |
U |
365 |
|
17919c
|
366 |
function fm_dateiwahl(ev) { |
5dfab6
|
367 |
var elem = this; |
17919c
|
368 |
//console.log('dateiwahl nach click, event shift: ' + ev.shiftKey + ", event ctrl: " + ev.ctrlKey); |
10d3d3
|
369 |
if(modus == 'kacheln') { |
957b51
|
370 |
// Kacheln |
10d3d3
|
371 |
if($(elem).children(0).hasClass('fa-folder')) { |
957b51
|
372 |
if(/*ev.shiftKey || */ ev.ctrlKey) { |
U |
373 |
$(elem).find('.dateiname').addClass('datei-gewaehlt'); |
10d3d3
|
374 |
} else { |
957b51
|
375 |
var ordner = $(elem).text().trim(); |
U |
376 |
if(pfad.length > 0) { |
|
377 |
pfad = pfad + '/' + ordner; |
|
378 |
} else { |
|
379 |
pfad = ordner; |
|
380 |
} |
|
381 |
fm_get_list(pfad); |
10d3d3
|
382 |
} |
7f2a41
|
383 |
} else if($(elem).children(0).hasClass('datei')) { |
17919c
|
384 |
if(/*ev.shiftKey || */ ev.ctrlKey) { |
U |
385 |
// mehrere Dateien sollen gewaehlt werden |
|
386 |
} else { |
|
387 |
$('.datei-gewaehlt').removeClass('datei-gewaehlt'); |
|
388 |
} |
957b51
|
389 |
$(elem).find('.dateiname').addClass('datei-gewaehlt'); |
5dfab6
|
390 |
} else { |
10d3d3
|
391 |
//console.log('kein folder oder file...'); |
5dfab6
|
392 |
} |
U |
393 |
} else { |
957b51
|
394 |
// Liste |
10d3d3
|
395 |
if($(elem).find('.datei-elem').children(0).hasClass('fa-file-o')) { |
957b51
|
396 |
// Datei |
17919c
|
397 |
if(/*ev.shiftKey || */ ev.ctrlKey) { |
U |
398 |
// mehrere Dateien sollen gewaehlt werden |
|
399 |
} else { |
|
400 |
$('.table-info').removeClass('table-info'); |
957b51
|
401 |
$('.datei-gewaehlt').removeClass('datei-gewaehlt'); |
17919c
|
402 |
} |
10d3d3
|
403 |
$(elem).addClass('table-info'); |
U |
404 |
$(elem).find('.dateiname').addClass('datei-gewaehlt'); |
|
405 |
} else { |
957b51
|
406 |
// Ordner |
U |
407 |
if(/*ev.shiftKey || */ ev.ctrlKey) { |
|
408 |
$(elem).children(0).addClass('datei-gewaehlt'); |
10d3d3
|
409 |
} else { |
957b51
|
410 |
var ordner = $(elem).find('.dateiname').text(); |
U |
411 |
if(pfad.length > 0) { |
|
412 |
pfad = pfad + '/' + ordner; |
|
413 |
} else { |
|
414 |
pfad = ordner; |
|
415 |
} |
|
416 |
fm_get_list(pfad); |
10d3d3
|
417 |
} |
U |
418 |
} |
5dfab6
|
419 |
} |
c509a0
|
420 |
} |
U |
421 |
|
a94216
|
422 |
function fm_bc_click() { |
U |
423 |
var elem = this; |
|
424 |
var bcPfad = $(elem).attr('rpath'); |
|
425 |
if(bcPfad !== undefined) { |
c509a0
|
426 |
pfad = bcPfad; |
a94216
|
427 |
fm_get_list(bcPfad); |
U |
428 |
} else { |
|
429 |
pfad = ''; |
|
430 |
fm_get_list(''); |
|
431 |
} |
|
432 |
} |
|
433 |
|
42fece
|
434 |
function fm_text_edit(content, mode) { |
305573
|
435 |
fm_filectls_hide(); |
3ad4db
|
436 |
$('.codeeditor-space').show(); |
U |
437 |
$('.code-editor-container').show(); |
42fece
|
438 |
fm_code_edit(content, mode); |
7d8ef6
|
439 |
openEditor = 'text'; |
U |
440 |
} |
|
441 |
|
|
442 |
function fm_dok_edit(content) { |
|
443 |
fm_filectls_hide(); |
0c1d5b
|
444 |
fm_dok_editor_init(userid); |
7d8ef6
|
445 |
$("#mce-editor").show(); |
be9b6d
|
446 |
|
U |
447 |
window.clearTimeout(tmo2); |
|
448 |
tmo2 = window.setTimeout(function () { |
|
449 |
try { |
|
450 |
ed.setContent(content); |
|
451 |
openEditor = 'dok'; |
|
452 |
} catch (err) { |
|
453 |
} |
|
454 |
}, 200); |
3ad4db
|
455 |
} |
U |
456 |
|
305573
|
457 |
function fm_filectls_hide() { |
U |
458 |
$('#zentrum_bc').hide(); |
|
459 |
$('#dateien').hide(); |
547755
|
460 |
$('#editMenu').addClass('disabled'); |
305573
|
461 |
} |
U |
462 |
|
|
463 |
function fm_filectls_show() { |
|
464 |
$('#zentrum_bc').show(); |
|
465 |
$('#dateien').show(); |
547755
|
466 |
$('#editMenu').removeClass('disabled'); |
305573
|
467 |
} |
b7475d
|
468 |
/* ----- API Calls ------------- */ |
U |
469 |
|
0c1d5b
|
470 |
function fm_get_login() { |
3ad4db
|
471 |
var m = '?c=de.uhilger.filecms.pub.SessionManager&m=getSessionUser'; |
U |
472 |
var u = '../pub' + m; |
|
473 |
fm_get(u, "text", function(resp) { |
0c1d5b
|
474 |
userid = resp; |
3ad4db
|
475 |
$('#userMenu').text(resp); |
7342b1
|
476 |
}); |
c509a0
|
477 |
} |
U |
478 |
|
|
479 |
function fm_get_new_folder() { |
|
480 |
$('#modal_ok').click(function() { |
|
481 |
// hier speichern |
|
482 |
var m = '?c=de.uhilger.filecms.api.FileMgr&m=newFolder&p=' + pfad + '&p=' + $('#dateiname').val(); |
|
483 |
var u = '../svc' + m; |
|
484 |
fm_get(u, "json", function(resp) { |
adf812
|
485 |
fm_get_list(pfad); |
c509a0
|
486 |
}); |
U |
487 |
}); |
957b51
|
488 |
$('#saveModalTitle').text('Neuer Ordner'); |
c509a0
|
489 |
$('#dialogfrage').text("Name?"); |
U |
490 |
$('#dateiname').val(''); |
|
491 |
$('#dateiname').attr('placeholder', 'Ordnername'); |
|
492 |
$('#saveModal').modal({ |
|
493 |
keyboard: false, |
|
494 |
show: true |
|
495 |
}); |
7342b1
|
496 |
} |
U |
497 |
|
7d8ef6
|
498 |
function fm_get_file_content(typ) { |
fc1897
|
499 |
var gewaehlte = $('.datei-gewaehlt'); |
957b51
|
500 |
//var fname = $(gewaehlte).find('.dateiname').text(); |
U |
501 |
|
|
502 |
var fname = $(gewaehlte[0]).text(); |
5ebb8e
|
503 |
openFileName = fname; |
3ad4db
|
504 |
var m = '?c=de.uhilger.filecms.api.FileMgr&m=getCode&p=' + pfad + '&p=' + fname; |
2121cc
|
505 |
var u = '../svc' + m; |
3ad4db
|
506 |
fm_get(u, "text", function(resp) { |
7d8ef6
|
507 |
if(typ == 'text') { |
42fece
|
508 |
var mode = "text/x-java"; |
U |
509 |
if(fname.endsWith('js')) { |
|
510 |
mode = 'javascript'; |
|
511 |
} else if(fname.endsWith('xml')) { |
|
512 |
mode = 'xml'; |
|
513 |
} else if(fname.endsWith('properties')) { |
|
514 |
mode = 'xml'; |
|
515 |
} |
|
516 |
fm_text_edit(resp, mode); |
7d8ef6
|
517 |
} else { |
U |
518 |
fm_dok_edit(resp); |
|
519 |
} |
2121cc
|
520 |
}); |
3ad4db
|
521 |
|
2121cc
|
522 |
} |
U |
523 |
|
fc8db1
|
524 |
function fm_view_file() { |
U |
525 |
// http://localhost:8080/file-cms/ui/# |
|
526 |
// http://localhost:8080/file-cms/data/admin/usw. |
|
527 |
|
|
528 |
var userid = $('#userMenu').text(); |
|
529 |
var gewaehlte = $('.datei-gewaehlt'); |
|
530 |
var fname = $(gewaehlte[0]).text(); |
0c1d5b
|
531 |
|
U |
532 |
var path = fm_get_path(userid); |
|
533 |
|
|
534 |
window.open(path + '/' + fname, '_blank'); |
fc8db1
|
535 |
} |
U |
536 |
|
8446c2
|
537 |
function fm_menu_datei_umbenennen() { |
U |
538 |
var gewaehlte = $('.datei-gewaehlt'); |
|
539 |
var fname = $(gewaehlte[0]).text(); |
663ee9
|
540 |
|
U |
541 |
$('#modal_ok').click(function() { |
|
542 |
// hier umbenennen |
|
543 |
fm_rename_file(fname, pfad, $('#dateiname').val()) |
|
544 |
}); |
|
545 |
$('#saveModalTitle').text('Datei umbenennen'); |
|
546 |
$('#dialogfrage').text("Neuer Dateiname?"); |
|
547 |
|
|
548 |
if(fname !== undefined) { |
|
549 |
$('#dateiname').val(fname); |
|
550 |
$('#dateiname').attr('placeholder', 'Dateiname'); |
|
551 |
$('#saveModal').modal({ |
|
552 |
keyboard: false, |
|
553 |
show: true |
|
554 |
}); |
|
555 |
} |
|
556 |
} |
|
557 |
|
|
558 |
function fm_rename_file(fn, p, neuerName) { |
|
559 |
var m = '?c=de.uhilger.filecms.api.FileMgr&m=renameFile'; |
|
560 |
m = m + '&p=' + p; |
|
561 |
m = m + '&p=' + fn; |
|
562 |
m = m + '&p=' + neuerName; |
|
563 |
var u = '../svc' + m; |
|
564 |
fm_get(u, "text", function(resp) { |
|
565 |
fm_get_list(pfad); |
|
566 |
}); |
8446c2
|
567 |
} |
U |
568 |
|
438b16
|
569 |
function fm_menu_shrink() { |
U |
570 |
var gewaehlte = $('.datei-gewaehlt'); |
|
571 |
var fname = $(gewaehlte[0]).text(); |
|
572 |
var m = '?c=de.uhilger.filecms.api.FileMgr&m=bildVerkleinern'; |
|
573 |
m = m + '&p=' + pfad; |
|
574 |
m = m + '&p=' + fname; |
|
575 |
var u = '../svc' + m; |
|
576 |
fm_get(u, "text", function(resp) { |
|
577 |
fm_get_list(pfad); |
|
578 |
}); |
|
579 |
} |
|
580 |
|
7165a1
|
581 |
/* |
U |
582 |
* Hier merkt sich die Dateiverwalting die markierten Dateien fuer |
|
583 |
* eine Dateioperation. Bei cut wird in der 'paste' Operation auf dem Server |
|
584 |
* fuer die 'gemerkten' Dateien ein Move gemacht. Die Dateien werden |
|
585 |
* vom gewaehlten Ort zum Zielort verschoben. |
|
586 |
* |
|
587 |
* @returns {undefined} |
|
588 |
*/ |
|
589 |
function fm_cut_files() { |
|
590 |
cutCopySrcDir = pfad; |
|
591 |
cutCopyFiles = fm_gewaehlte_dateien(); |
|
592 |
cutCopyOperation = 'cut'; |
|
593 |
} |
|
594 |
|
|
595 |
/* |
|
596 |
* Hier merkt sich die Dateiverwalting die markierten Dateien fuer |
|
597 |
* eine Dateioperation. Bei copy wird in der 'paste' Operation auf dem Server |
|
598 |
* fuer die 'gemerkten' Dateien eine Kopie gemacht. Die Dateien werden |
|
599 |
* am gewaehlten Ort behalten und am Zielort wird eine Kopier der |
|
600 |
* gewaehlten DAteien erstellt |
|
601 |
* |
|
602 |
* @returns {undefined} |
|
603 |
*/ |
|
604 |
function fm_copy_files() { |
|
605 |
cutCopySrcDir = pfad; |
|
606 |
cutCopyFiles = fm_gewaehlte_dateien(); |
9e2964
|
607 |
cutCopyOperation = 'copy'; |
7165a1
|
608 |
} |
U |
609 |
|
|
610 |
/* |
|
611 |
* Hier wird fuer eine zuvor markierte Liste von Dateien, fuer die |
|
612 |
* Cut oder Copy gewaehlt wurde, die Operations ausgefuehrt (move oder copy) |
|
613 |
* @returns {undefined} |
|
614 |
*/ |
|
615 |
function fm_paste_files() { |
|
616 |
var m; |
9e2964
|
617 |
if(cutCopyOperation === 'cut') { |
U |
618 |
//m = '?c=de.uhilger.filecms.api.FileMgr&m=moveFiles'; //&p=' + cutCopySrcDir + '&p=' + pfad + '&p=' + encodeURIComponent(liste); |
|
619 |
m = '?c=de.uhilger.filecms.api.FileMgr&m=moveFiles&p=' + cutCopySrcDir + '&p=' + pfad + '&p=' + encodeURIComponent(cutCopyFiles); |
7165a1
|
620 |
} else { |
9e2964
|
621 |
//m = '?c=de.uhilger.filecms.api.FileMgr&m=copyFiles'; //&p=' + cutCopySrcDir + '&p=' + pfad + '&p=' + encodeURIComponent(liste); |
U |
622 |
m = '?c=de.uhilger.filecms.api.FileMgr&m=copyFiles&p=' + cutCopySrcDir + '&p=' + pfad + '&p=' + encodeURIComponent(cutCopyFiles); |
fc1897
|
623 |
} |
7165a1
|
624 |
var u = '../svc' + m; |
9e2964
|
625 |
fm_get(u, "text", function(resp) { |
U |
626 |
// console.log('deleteFiles gab folgendes zurueck: ' + resp); |
|
627 |
fm_get_list(pfad); |
|
628 |
}); |
|
629 |
/* |
|
630 |
fm_post(u, {p1: encodeURIComponent(cutCopySrcDir), p2: encodeURIComponent(pfad), p3: encodeURIComponent(cutCopyFiles)},'text', function(resp) { |
7165a1
|
631 |
// resp evtl. zeigen.. |
U |
632 |
fm_get_list(pfad); |
|
633 |
}); |
9e2964
|
634 |
*/ |
7165a1
|
635 |
} |
U |
636 |
|
|
637 |
function fm_del_files() { |
|
638 |
var liste = fm_gewaehlte_dateien(); |
fc1897
|
639 |
var m = '?c=de.uhilger.filecms.api.FileMgr&m=deleteFiles&p=' + pfad + '&p=' + encodeURIComponent(liste); |
U |
640 |
var u = '../svc' + m; |
|
641 |
fm_get(u, "text", function(resp) { |
|
642 |
// console.log('deleteFiles gab folgendes zurueck: ' + resp); |
|
643 |
fm_get_list(pfad); |
|
644 |
}); |
|
645 |
} |
|
646 |
|
10d3d3
|
647 |
function fm_render_list(fl) { |
U |
648 |
if(modus == 'kacheln') { |
|
649 |
// Kachelansicht |
7d8ef6
|
650 |
var template = $('#tpl-kacheln').html(); |
U |
651 |
Mustache.parse(template); // optional, speeds up future uses |
|
652 |
$('.datei-zeile').attr('onclick','').unbind('click'); |
|
653 |
$('#dateien').empty(); |
|
654 |
$('#dateien').html(Mustache.render(template, fl)); |
|
655 |
$('.figure').click(fm_dateiwahl); |
|
656 |
} else { |
|
657 |
// Listenansicht |
|
658 |
var template = $('#tpl-liste').html(); |
|
659 |
Mustache.parse(template); // optional, speeds up future uses |
|
660 |
$('.figure').attr('onclick','').unbind('click'); |
|
661 |
$('#dateien').empty(); |
|
662 |
$('#dateien').html(Mustache.render(template, fl)); |
|
663 |
$('.datei-zeile').click(fm_dateiwahl); |
|
664 |
} |
|
665 |
/* |
|
666 |
if(modus == 'kacheln') { |
|
667 |
// Kachelansicht |
a3d410
|
668 |
$.get('tpl-kacheln.txt', function(template) { |
U |
669 |
$('#dateien').empty(); |
|
670 |
$('#dateien').html(Mustache.render(template, fl)); |
|
671 |
$('.figure').click(fm_dateiwahl); |
|
672 |
}); |
10d3d3
|
673 |
$('.datei-zeile').attr('onclick','').unbind('click'); |
U |
674 |
} else { |
|
675 |
// Listenansicht |
a3d410
|
676 |
$.get('tpl-liste.txt', function(template) { |
U |
677 |
$('#dateien').empty(); |
|
678 |
$('#dateien').html(Mustache.render(template, fl)); |
|
679 |
$('.datei-zeile').click(fm_dateiwahl); |
|
680 |
}); |
10d3d3
|
681 |
$('.figure').attr('onclick','').unbind('click'); |
U |
682 |
} |
7d8ef6
|
683 |
*/ |
10d3d3
|
684 |
} |
U |
685 |
|
7342b1
|
686 |
// http://localhost:8079/file-cms/svc?c=de.uhilger.filecms.api.FileMgr&f=JSONNICE&m=list&p= |
a94216
|
687 |
function fm_get_list(relPfad) { |
10d3d3
|
688 |
$('#ansicht').attr('onclick','').unbind('click'); |
a94216
|
689 |
var m = '?c=de.uhilger.filecms.api.FileMgr&m=list&p=' + relPfad; |
7342b1
|
690 |
var u = '../svc' + m; |
U |
691 |
fm_get(u, "json", function(resp) { |
10d3d3
|
692 |
|
2121cc
|
693 |
if(resp.List[0].FileRef !== undefined) { |
U |
694 |
var files = new Array(); |
c509a0
|
695 |
if(resp.List[0].FileRef instanceof Array) { |
U |
696 |
for(var i = 0; i < resp.List[0].FileRef.length; i++) { |
|
697 |
files.push(new FileRef(resp.List[0].FileRef[i])); |
|
698 |
} |
|
699 |
} else { |
|
700 |
files.push(new FileRef(resp.List[0].FileRef)); |
2121cc
|
701 |
} |
U |
702 |
var fl = new FileList(files); |
10d3d3
|
703 |
fm_render_list(fl); |
2121cc
|
704 |
} else { |
U |
705 |
$('#dateien').empty(); |
7342b1
|
706 |
} |
5dfab6
|
707 |
|
10d3d3
|
708 |
// Breadcrumb-Ansicht |
7d8ef6
|
709 |
var template; |
a94216
|
710 |
$('.breadcrumb-item').attr('onclick','').unbind('click'); |
2315a0
|
711 |
$('#bcnav').empty(); |
5dfab6
|
712 |
var dirList = new Array(); |
U |
713 |
var rp = ''; |
a94216
|
714 |
//console.log("'" + relPfad + "'"); |
U |
715 |
var dirs = relPfad.split('/'); |
|
716 |
//console.log(dirs.length); |
2121cc
|
717 |
dirList.push(new BcrFile(rp, 'Home')); |
a94216
|
718 |
if(relPfad.length > 0) { |
2315a0
|
719 |
for(var i = 0; i < dirs.length - 1; i++) { |
5dfab6
|
720 |
if(rp.length > 0 ) { |
U |
721 |
dirList.push(new BcrFile(rp + '/' + dirs[i], dirs[i])); |
2315a0
|
722 |
rp = rp + '/' + dirs[i]; |
5dfab6
|
723 |
} else { |
U |
724 |
dirList.push(new BcrFile(dirs[i], dirs[i])); |
2315a0
|
725 |
rp = dirs[i]; |
5dfab6
|
726 |
} |
U |
727 |
} |
|
728 |
var bl = new BcrFiles(dirList); |
7d8ef6
|
729 |
|
U |
730 |
if(dirList.length > 0) { |
|
731 |
template = $('#tpl-bcr').html(); |
|
732 |
Mustache.parse(template); // optional, speeds up future uses |
|
733 |
$('#bcnav').html(Mustache.render(template, bl)); |
2315a0
|
734 |
} |
7d8ef6
|
735 |
|
U |
736 |
if(dirs.length > 0) { |
|
737 |
dirList.push(new BcrFile(rp + '/' + dirs[dirs.length-1], dirs[dirs.length-1])); |
|
738 |
template = $('#tpl-bcr2').html(); |
|
739 |
Mustache.parse(template); // optional, speeds up future uses |
|
740 |
$('#bcnav').append(Mustache.render(template, dirList[dirList.length-1])); |
|
741 |
} else { |
|
742 |
template = $('#tpl-bcr2').html(); |
|
743 |
Mustache.parse(template); // optional, speeds up future uses |
|
744 |
$('#bcnav').append(Mustache.render(template, dirList[0])); |
|
745 |
} |
|
746 |
|
|
747 |
$('#bcnav').append($('#tpl-bcr3').html()); |
2315a0
|
748 |
} else { |
a94216
|
749 |
pfad = ''; |
7d8ef6
|
750 |
template = $('#tpl-bcr2').html(); |
U |
751 |
Mustache.parse(template); // optional, speeds up future uses |
|
752 |
$('#bcnav').append(Mustache.render(template, dirList[0])); |
|
753 |
$('#bcnav').append($('#tpl-bcr3').html()); |
5dfab6
|
754 |
} |
7d8ef6
|
755 |
$('.breadcrumb-item').click(fm_bc_click); |
U |
756 |
$('#ansicht').click(fm_ansicht_umschalten); |
|
757 |
fm_set_modus(); |
|
758 |
}); |
e5ff42
|
759 |
} |
U |
760 |
|
a75859
|
761 |
function fm_menu_datei_speichern(callback) { |
5ebb8e
|
762 |
//var fname = $('.datei-gewaehlt').text(); |
U |
763 |
var fname = openFileName; |
|
764 |
if(fname !== undefined && fname !== '') { |
a75859
|
765 |
fm_save_file(fname, 'saveTextFile', callback); |
5ebb8e
|
766 |
} else { |
a75859
|
767 |
fm_menu_datei_speichern_unter(callback); |
5ebb8e
|
768 |
} |
U |
769 |
} |
|
770 |
|
a75859
|
771 |
function fm_save_file(saveFileName, method, callback) { |
7d8ef6
|
772 |
var content; |
U |
773 |
if(openEditor === 'text') { |
|
774 |
content = cm.getValue(); |
3003b2
|
775 |
cm.getDoc().markClean(); |
7d8ef6
|
776 |
} else { |
U |
777 |
content = ed.getContent(); |
3003b2
|
778 |
tinymce.activeEditor.undoManager.clear(); |
7d8ef6
|
779 |
} |
47e9d4
|
780 |
var m = '?c=de.uhilger.filecms.api.FileMgr&m=' + method; |
5ebb8e
|
781 |
var u = '../svc' + m; |
7d8ef6
|
782 |
fm_post(u, {p1: pfad, p2: saveFileName, p3: content}, function(resp) { |
a75859
|
783 |
// hier scheint nichts zurueckzukommen.. |
5ebb8e
|
784 |
}); |
a75859
|
785 |
openFileName = saveFileName; |
3003b2
|
786 |
if(typeof (callback) !== 'function') { |
U |
787 |
|
|
788 |
} else { |
a75859
|
789 |
callback(); |
U |
790 |
} |
5ebb8e
|
791 |
} |
U |
792 |
|
a75859
|
793 |
function fm_menu_datei_speichern_unter(callback) { |
915927
|
794 |
$('#modal_ok').click(function() { |
a75859
|
795 |
$('#modal_ok').attr('onclick','').unbind('click'); |
915927
|
796 |
// hier speichern |
a75859
|
797 |
fm_save_file($('#dateiname').val(), 'saveTextFileAs', callback); |
915927
|
798 |
}); |
957b51
|
799 |
$('#saveModalTitle').text('Datei speichern'); |
c509a0
|
800 |
$('#dialogfrage').text("Dateiname?"); |
3ad4db
|
801 |
|
U |
802 |
var fname = $('.datei-gewaehlt').text(); |
|
803 |
if(fname !== undefined) { |
|
804 |
$('#dateiname').val(fname); |
|
805 |
} else { |
|
806 |
$('#dateiname').val(''); |
|
807 |
} |
c509a0
|
808 |
$('#dateiname').attr('placeholder', 'Dateiname'); |
915927
|
809 |
$('#saveModal').modal({ |
U |
810 |
keyboard: false, |
|
811 |
show: true |
|
812 |
}); |
a4d3b5
|
813 |
} |
U |
814 |
|
b7475d
|
815 |
function fm_logout() { |
U |
816 |
var m = '?c=de.uhilger.filecms.pub.SessionManager&m=expireSession'; |
|
817 |
var u = '../pub' + m; |
|
818 |
|
|
819 |
fm_get(u, "text", function(resp) { |
|
820 |
$('#userMenu').text('nicht angemeldet'); |
|
821 |
window.location.href = '../logout.html'; |
|
822 |
}); |
|
823 |
} |
|
824 |
|
|
825 |
|
a4d3b5
|
826 |
/* ---- codemirror editor handling -------- */ |
U |
827 |
|
942d63
|
828 |
function htmlDecode(value){ |
U |
829 |
return $('<div/>').html(value).text(); |
|
830 |
} |
|
831 |
|
42fece
|
832 |
function fm_code_edit(content, m) { |
a4d3b5
|
833 |
cm = CodeMirror.fromTextArea(document.getElementById("editspace"), { |
U |
834 |
lineNumbers: true, |
42fece
|
835 |
mode: m, |
a4d3b5
|
836 |
viewportMargin : Infinity, |
U |
837 |
extraKeys: { |
915927
|
838 |
"F9": function(cm) { |
U |
839 |
cm.setOption("fullScreen", !cm.getOption("fullScreen")); |
|
840 |
}, |
|
841 |
"Esc": function(cm) { |
|
842 |
if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false); |
|
843 |
} |
a4d3b5
|
844 |
} |
U |
845 |
}); |
fab80c
|
846 |
//cm.setValue(htmlDecode(content)); |
U |
847 |
//cm.setValue(content); |
|
848 |
cm.setValue(unescapeHtml(content)); |
3003b2
|
849 |
cm.getDoc().markClean(); |
915927
|
850 |
} |
a4d3b5
|
851 |
|
U |
852 |
|
|
853 |
|
|
854 |
/* -------- helper functions ----------- */ |
|
855 |
|
b7475d
|
856 |
function fm_get(u, dtype, scallback) { |
a4d3b5
|
857 |
$.ajax({ |
U |
858 |
url: u, |
|
859 |
type: "GET", |
b7475d
|
860 |
dataType: dtype, |
a4d3b5
|
861 |
success: scallback, |
U |
862 |
error: function (xhr, status, errorThrown) { |
|
863 |
alert("Error: " + errorThrown + " Status: " + status + " URL: " + u); |
|
864 |
}, |
|
865 |
complete: function (xhr, status) { |
|
866 |
//console.log( "The request is complete!" ); |
|
867 |
} |
|
868 |
|
|
869 |
}); |
915927
|
870 |
} |
a4d3b5
|
871 |
|
9e2964
|
872 |
function fm_post(u, d, dtype, scallback) { |
a4d3b5
|
873 |
$.ajax({ |
U |
874 |
url: u, |
|
875 |
data: d, |
|
876 |
type: "POST", |
9e2964
|
877 |
dataType: dtype, |
a4d3b5
|
878 |
success: scallback, |
U |
879 |
error: function (xhr, status, errorThrown) { |
|
880 |
$('#fehler').html("Error: " + errorThrown + " Status: " + status); |
|
881 |
}, |
|
882 |
complete: function (xhr, status) { |
|
883 |
//alert( "The request is complete!" ); |
|
884 |
} |
|
885 |
}); |
915927
|
886 |
} |
a4d3b5
|
887 |
|
e5ff42
|
888 |
function fm_serialise(obj) { |
U |
889 |
return '{"' + obj.constructor.name + '":' + JSON.stringify(obj) + '}'; |
915927
|
890 |
} |
e5ff42
|
891 |
|
fab80c
|
892 |
function escapeHtml(text) { |
U |
893 |
text = text.replace(/\u228/g,'ä'); |
|
894 |
text = text.replace(/\u246/g,'ö'); |
|
895 |
text = text.replace(/\u252/g,'ü'); |
|
896 |
text = text.replace(/\u196/g,'Ä'); |
|
897 |
text = text.replace(/\u214/g,'Ö'); |
|
898 |
text = text.replace(/\u220/g,'Ü'); |
|
899 |
text = text.replace(/\u223/g,'ß'); |
|
900 |
text = text.replace(/\u26/g,'&'); |
|
901 |
return text; |
|
902 |
} |
|
903 |
|
|
904 |
function unescapeHtml(text) { |
|
905 |
text = text.replace(/ä/g, String.fromCharCode(228)); |
|
906 |
text = text.replace(/ö/g, String.fromCharCode(246)); |
|
907 |
text = text.replace(/ü/g, String.fromCharCode(252)); |
|
908 |
text = text.replace(/Ä/g, String.fromCharCode(196)); |
|
909 |
text = text.replace(/Ö/g, String.fromCharCode(214)); |
|
910 |
text = text.replace(/Ü/g, String.fromCharCode(220)); |
|
911 |
text = text.replace(/ß/g, String.fromCharCode(223)); |
|
912 |
text = text.replace(/&/g, String.fromCharCode(26)); |
|
913 |
return text; |
|
914 |
} |
|
915 |
|
|
916 |
|
7342b1
|
917 |
/* ----- Objekte ----- */ |
U |
918 |
|
|
919 |
function FileList(fl) { |
|
920 |
this.files = fl; |
|
921 |
} |
|
922 |
|
|
923 |
function FileRef(obj) { |
|
924 |
var self = this; |
|
925 |
this.fr = obj; |
7f2a41
|
926 |
this.fnx; |
7342b1
|
927 |
|
U |
928 |
this.typeClass = function() { |
10d3d3
|
929 |
if(modus == 'kacheln') { |
U |
930 |
if(self.fr.isDirectory) { |
a3d410
|
931 |
return 'fa-folder ordner'; |
10d3d3
|
932 |
} else { |
a3d410
|
933 |
return 'fa-file datei'; |
10d3d3
|
934 |
} |
7342b1
|
935 |
} else { |
10d3d3
|
936 |
if(self.fr.isDirectory) { |
a3d410
|
937 |
return 'fa-folder ordner'; |
10d3d3
|
938 |
} else { |
a3d410
|
939 |
return 'fa-file-o datei'; |
10d3d3
|
940 |
} |
7342b1
|
941 |
} |
2121cc
|
942 |
}; |
U |
943 |
|
7f2a41
|
944 |
this.mini = function() { |
U |
945 |
var miniatur = false; |
|
946 |
var namen = self.fr.absolutePath.split('/'); |
|
947 |
if(namen.length > 0) { |
|
948 |
self.fnx = decodeURIComponent(namen[namen.length - 1]); |
|
949 |
} else { |
|
950 |
self.fnx = decodeURIComponent(self.fr.absolutePath); |
|
951 |
} |
|
952 |
if(self.fnx.indexOf('.jpg') > -1 || self.fnx.indexOf('.png') > -1 || self.fnx.indexOf('.gif') > -1 || self.fnx.indexOf('.jpeg') > -1) { |
|
953 |
miniatur = true; |
|
954 |
} |
|
955 |
return miniatur; |
|
956 |
}; |
|
957 |
|
|
958 |
this.miniurl = function() { |
|
959 |
var userid = $('#userMenu').text(); |
|
960 |
var ext = ''; |
|
961 |
var dotpos = self.fnx.indexOf('.'); |
|
962 |
if(dotpos > -1) { |
|
963 |
var fny = self.fnx; |
|
964 |
self.fnx = self.fnx.substring(0, dotpos); |
|
965 |
ext = fny.substr(dotpos); |
|
966 |
} |
|
967 |
var path = fm_get_path(userid); |
fa012b
|
968 |
var imgurl = loc + path + '/' + self.fnx + '_tn' + ext; |
7f2a41
|
969 |
return imgurl; |
U |
970 |
|
|
971 |
}; |
|
972 |
|
2121cc
|
973 |
this.fileName = function() { |
7f2a41
|
974 |
|
2121cc
|
975 |
var namen = self.fr.absolutePath.split('/'); |
U |
976 |
if(namen.length > 0) { |
f7d8bf
|
977 |
return decodeURIComponent(namen[namen.length - 1]); |
2121cc
|
978 |
} else { |
f7d8bf
|
979 |
return decodeURIComponent(self.fr.absolutePath); |
2121cc
|
980 |
} |
7f2a41
|
981 |
|
2121cc
|
982 |
}; |
7342b1
|
983 |
} |
5dfab6
|
984 |
|
U |
985 |
function BcrFiles(fl) { |
|
986 |
this.files = fl; |
|
987 |
} |
|
988 |
|
|
989 |
function BcrFile(rp, n) { |
|
990 |
this.relPath = rp; |
|
991 |
this.fName = n; |
7aa566
|
992 |
} |
U |
993 |
|