| | |
| | | var loc; |
| | | var pfad = PUB_DIR; |
| | | var ordner; |
| | | var userid; |
| | | |
| | | |
| | | function fo_init() { |
| | | $('.sued').hide(); |
| | | //$('.sued').hide(); |
| | | document.querySelector('.sued').style.display = 'none'; |
| | | loc = window.location.protocol + '//' + window.location.host; |
| | | ordner = getURLParameter('o'); |
| | | fo_get_list(ordner); |
| | | fo_get_login(); |
| | | } |
| | | |
| | | function getURLParameter(name) { |
| | |
| | | // http://localhost:8079/file-cms/svc?c=de.uhilger.filecms.api.FileMgr&f=JSONNICE&m=list&p= |
| | | // https://uhilger.de/file-cms/pub?c=de.uhilger.filecms.pub.Catalog&m=listOrdered&p=ulrich/bilder/alben/farbe&p=date&p=asc |
| | | function fo_get_list(relPfad) { |
| | | $('#ansicht').attr('onclick','').unbind('click'); |
| | | //$('#ansicht').attr('onclick','').unbind('click'); |
| | | var m = '?c=de.uhilger.filecms.pub.Catalog&m=listOrdered&p=' + relPfad + '&p=date&p=asc'; |
| | | var u = '../pub' + m; |
| | | fo_get(u, "json", function(resp) { |
| | | |
| | | fo_get(u, "json", function(respText) { |
| | | var resp = JSON.parse(respText); |
| | | if(resp.List[0].FileRef !== undefined) { |
| | | var files = new Array(); |
| | | if(resp.List[0].FileRef instanceof Array) { |
| | |
| | | var fl = new FileList(files); |
| | | fo_render_list(fl); |
| | | } else { |
| | | $('#dateien').empty(); |
| | | //$('#dateien').empty(); |
| | | document.querySelector('#dateien').innerHTML = ''; |
| | | } |
| | | }); |
| | | } |
| | | |
| | | function fo_render_list(fl) { |
| | | if(modus == 'kacheln') { |
| | | if(modus === 'kacheln') { |
| | | // Kachelansicht |
| | | var template = $('#tpl-kacheln').html(); |
| | | var template = document.querySelector('#tpl-kacheln').innerHTML; //$('#tpl-kacheln').html(); |
| | | console.log(template); |
| | | Mustache.parse(template); // optional, speeds up future uses |
| | | $('.datei-zeile').attr('onclick','').unbind('click'); |
| | | $('#dateien').empty(); |
| | | $('#dateien').html(Mustache.render(template, fl)); |
| | | //$('.datei-zeile').attr('onclick','').unbind('click'); |
| | | //$('#dateien').empty(); |
| | | var elem = document.querySelector('#dateien'); |
| | | elem.innerHTML = Mustache.render(template, fl); |
| | | //$('#dateien').html(Mustache.render(template, fl)); |
| | | //$('.figure').click(fm_dateiwahl); |
| | | } else { |
| | | // Listenansicht |
| | | var template = $('#tpl-liste').html(); |
| | | var template = document.querySelector('#tpl-liste').innerHTML; //var template = $('#tpl-liste').html(); |
| | | Mustache.parse(template); // optional, speeds up future uses |
| | | $('.figure').attr('onclick','').unbind('click'); |
| | | $('#dateien').empty(); |
| | | $('#dateien').html(Mustache.render(template, fl)); |
| | | //$('.figure').attr('onclick','').unbind('click'); |
| | | var elem = document.querySelector('#dateien'); |
| | | elem.innerHTML = Mustache.render(template, fl); |
| | | //$('#dateien').empty(); |
| | | //$('#dateien').html(Mustache.render(template, fl)); |
| | | //$('.datei-zeile').click(fm_dateiwahl); |
| | | } |
| | | } |
| | | |
| | | |
| | | function fo_get(u, dtype, scallback) { |
| | | var xmlhttp = new XMLHttpRequest(); |
| | | var url = u; |
| | | xmlhttp.onreadystatechange = function() { |
| | | if (this.readyState === 4 && this.status === 200) { |
| | | scallback(this.responseText); |
| | | } |
| | | }; |
| | | xmlhttp.open("GET", url, true); |
| | | xmlhttp.send(); |
| | | |
| | | |
| | | |
| | | /* |
| | | $.ajax({ |
| | | url: u, |
| | | type: "GET", |
| | |
| | | } |
| | | |
| | | }); |
| | | */ |
| | | } |
| | | function fo_get_login() { |
| | | var m = '?c=de.uhilger.filecms.pub.SessionManager&m=getSessionUser'; |
| | | var u = '../pub' + m; |
| | | fo_get(u, "text", function (resp) { |
| | | userid = resp; |
| | | //self.login_zeigen(); |
| | | //document.querySelector("#userMenu").textContent = resp; |
| | | }); |
| | | } |
| | | |
| | | |
| | | function fm_get_path(uid) { |
| | | //console.log('pfad: ' + pfad); |
| | |
| | | restdir = restdir.replace(WWW_DIR, 'data'); |
| | | } |
| | | } |
| | | console.log('restdir ' + restdir); |
| | | var pdir = fm_get_base(uid); |
| | | console.log('pdir ' + pdir); |
| | | console.log('ordner ' + ordner); |
| | | // console.log('fm_get_path path: ' + pdir + "/" + restdir); |
| | | if(restdir.length > 1) { |
| | | if(restdir !== undefined && restdir.length > 1) { |
| | | console.log('fm_get_path ' + pdir + "/" + restdir + "/" + ordner); |
| | | return pdir + "/" + restdir + "/" + ordner; |
| | | } else { |
| | | console.log('fm_get_path ' + pdir + "/" + ordner); |
| | | return pdir + "/" + ordner; |
| | | } |
| | | } |
| | |
| | | //console.log('pfad: ' + pfad); |
| | | var pdir; |
| | | if(pfad.indexOf(PUB_DIR) > -1) { |
| | | pdir = '/data/' + uid; |
| | | pdir = '/data/'; //+ uid; |
| | | } else if(pfad.indexOf(PERS_DIR) > -1) { |
| | | pdir = '/home/' + uid; |
| | | pdir = '/home/'; // + uid; |
| | | } else if(pfad.indexOf(BASE_DIR) > -1) { |
| | | pdir = ''; |
| | | } else if(pfad.indexOf(DATA_DIR) > -1) { |