| | |
| | | if(dateiname.endsWith('htmi')) { |
| | | self.fm_get_file_content('doc', dateiname); |
| | | } else if(dateiname.endsWith('jpg') || dateiname.endsWith('png') || |
| | | dateiname.endsWith('gif') || dateiname.endsWith('pdf')) { |
| | | |
| | | dateiname.endsWith('gif') || dateiname.endsWith('pdf') ) { |
| | | self.fm_view_file(); |
| | | } else { |
| | | self.fm_get_file_content('text', dateiname); |
| | | } |
| | |
| | | //}); |
| | | }); |
| | | }); |
| | | /* |
| | | $('#confirmOk').click(function() { |
| | | $('#confirmOk').attr('onclick','').unbind('click'); |
| | | fm_del_files(); |
| | | }); |
| | | $('#confirmOk').text("Loeschen"); |
| | | $('#confirmOk').removeClass('btn-primary'); |
| | | $('#confirmOk').addClass('btn-danger'); |
| | | $('#confirmClose').hide(); |
| | | $('#confirmModalTitle').text("Löschen"); |
| | | $('#confirmModalBody').text("Wirklich löschen?"); |
| | | $('#confirmModal').modal({ |
| | | keyboard: false, |
| | | show: true |
| | | }); |
| | | */ |
| | | }; |
| | | |
| | | /* |
| | |
| | | * Absenden als Parameter an den Server |
| | | */ |
| | | this.fm_gewaehlte_dateien = function() { |
| | | //var gewaehlte = $('.datei-gewaehlt'); |
| | | var gewaehlte = document.querySelectorAll('.datei-gewaehlt'); |
| | | /* |
| | | //console.log('anzahl: ' + gewaehlte.length); |
| | | var fnames = new Array(); |
| | | var i = 0; |
| | | while(i < gewaehlte.length) { |
| | | var str = { "java.lang.String": $(gewaehlte[i]).text()}; |
| | | fnames.push(str); |
| | | //console.log('loeschen ' + pfad + ' ' + $(gewaehlte[i]).text()); |
| | | //i += 2; |
| | | i++; |
| | | } |
| | | var liste = '{"List":' + JSON.stringify(fnames) + '}'; |
| | | // 'liste' enthaelt: |
| | | // {"List":[{"java.lang.String":"test3.txt"},{"java.lang.String":"Test1.txt"},{"java.lang.String":"Test2.txt"}]} |
| | | // und wird auf dem Server zu einer List[ArrayList<String>] bei der jede ArrayList<String> nur ein Element hat |
| | | return liste; |
| | | */ |
| | | return self.fm_dateiliste_bilden(gewaehlte); |
| | | }; |
| | | |
| | |
| | | return liste; |
| | | }; |
| | | |
| | | this.fm_menu_datei_umbenennen = function() { |
| | | //var gewaehlte = $('.datei-gewaehlt'); |
| | | var gewaehlte = document.querySelector('.datei-gewaehlt'); |
| | | var fname = gewaehlte.textContent; |
| | | |
| | | self.dialog_laden_und_zeigen('data/tpl/dlg-rename.tpl', '', function() { |
| | | document.querySelector('#cancel-btn').addEventListener('click', function() { |
| | | self.dialog_schliessen(); |
| | | }); |
| | | document.querySelector('#speichern-btn').addEventListener('click', function() { |
| | | self.fm_rename_file(fname, self.pfad, document.querySelector('#datei-name-in').value); |
| | | self.dialog_schliessen(); |
| | | }); |
| | | }); |
| | | |
| | | /* |
| | | $('#modal_ok').click(function() { |
| | | // hier umbenennen |
| | | fm_rename_file(fname, pfad, $('#dateiname').val()); |
| | | }); |
| | | $('#saveModalTitle').text('Datei umbenennen'); |
| | | $('#dialogfrage').text("Neuer Dateiname?"); |
| | | |
| | | if(fname !== undefined) { |
| | | $('#dateiname').val(fname); |
| | | $('#dateiname').attr('placeholder', 'Dateiname'); |
| | | $('#saveModal').modal({ |
| | | keyboard: false, |
| | | show: true |
| | | }); |
| | | } |
| | | */ |
| | | }; |
| | | |
| | | this.fm_menu_html_export = function() { |
| | | self.fm_export_html(); |
| | | }; |
| | |
| | | self.fm_get_sel_for_file_content('doc'); |
| | | }; |
| | | |
| | | this.get_sel_for_file_content = function(typ) { |
| | | this.fm_get_sel_for_file_content = function(typ) { |
| | | var gewaehlte = document.querySelector('.datei-gewaehlt'); |
| | | //var fname = $(gewaehlte).find('.dateiname').text(); |
| | | |
| | |
| | | }); |
| | | }; |
| | | |
| | | this.fm_rename_file = function(fn, p, neuerName) { |
| | | var m = '?c=de.uhilger.filecms.api.FileMgr&m=renameFile'; |
| | | m = m + '&p=' + p; |
| | | m = m + '&p=' + fn; |
| | | m = m + '&p=' + neuerName; |
| | | var u = '../svc' + m; |
| | | self.fm_get(u, "text", function(resp) { |
| | | self.fm_get_list(self.pfad); |
| | | }); |
| | | }; |
| | | |
| | | /* ---- codemirror editor handling -------- */ |
| | | |
| | | /* |