Dateiverwaltung für die WebBox
ulrich
2017-02-21 f5505fb5459ba11befd28ddd3aa89595c9f9ffc0
web/ui/ui.js
@@ -19,8 +19,6 @@
}
function fm_ansicht_umschalten() {
  //console.log('hat th-list: ' + $('#ansicht').children(0).hasClass('fa-th-list'));
  //console.log('hat th-large: ' + $('#ansicht').children(0).hasClass('fa-th-large'));
  if($('#ansicht').children(0).hasClass('fa-th-list')) {
    $('#ansicht').children(0).addClass('fa-th-large');
    $('#ansicht').children(0).removeClass('fa-th-list');
@@ -44,12 +42,6 @@
}
function fm_menu_neue_textdatei() {
  /*
  $('#dateiansicht').hide();
  $('.codeeditor-space').show();
  $('.code-editor-container').show();
  fm_code_edit('Test');
  */
  fm_text_edit('Test');
}
@@ -57,14 +49,12 @@
  $('.codeeditor-space').hide();
  $('.code-editor-container').hide();
  cm.toTextArea();
  $('#dateiansicht').show();
  $('#bcnav').show();
  $('#dateien').show();
}
function fm_dateiwahl() {
  var elem = this;
  //console.log('kachel datei gewaehlt ' + $(elem).text().trim());
  //console.log('liste datei gewaehlt ' + $(elem).children(1).text());
  //console.log('dateiname: ' + $(elem).find('.dateiname').text());
  if(modus == 'kacheln') {
    if($(elem).children(0).hasClass('fa-folder')) {
      var ordner = $(elem).text().trim();
@@ -105,7 +95,6 @@
function fm_bc_click() {
  var elem = this;
  var bcPfad = $(elem).attr('rpath');
  //console.log(relPath);
  if(bcPfad !== undefined) {
    pfad = bcPfad;
    fm_get_list(bcPfad);
@@ -113,13 +102,11 @@
    pfad = '';
    fm_get_list('');
  }
  //console.log($(elem).text() + ' ' + $(elem).attr('rpath') + ' ' + $(elem).hasClass('active'));
}
function fm_text_edit(content) {
  $('#dateiansicht').hide();
  $('#bcnav').hide();
  $('#dateien').hide();
  $('.codeeditor-space').show();
  $('.code-editor-container').show();
  fm_code_edit(content);  
@@ -143,14 +130,6 @@
    fm_get(u, "json", function(resp) {
      
    });
    /*
    var m = '?c=de.uhilger.filecms.api.FileMgr&m=saveTextFile';
    var u = '../svc' + m;
    fm_post(u, {p1: pfad, p2: $('#dateiname').val(), p3: cm.getValue()}, function(resp) {
    });
    */
  });
  $('.modal-title').text('Neuer Ordner');
  $('#dialogfrage').text("Name?");
@@ -163,27 +142,16 @@
}
function fm_get_file_content() {
  var fname = $('.datei-gewaehlt').text();
  //console.log(pfad + '/' + fname);
  var m = '?c=de.uhilger.filecms.api.FileMgr&m=getCode&p=' + pfad + '&p=' + fname;
  var u = '../svc' + m;
  fm_get(u, "text", function(resp) {
    /*
    $('#dateiansicht').hide();
    $('.codeeditor-space').show();
    $('.code-editor-container').show();
    fm_code_edit(resp);
    */
    fm_text_edit(resp);
  });
  
}
function fm_render_list(fl) {
  //if($('#ansicht').children(0).hasClass('fa-th-list')) {
  if(modus == 'kacheln') {
    // Kachelansicht
    var template = $('#tpl-kacheln').html();
@@ -302,21 +270,6 @@
    keyboard: false,
    show: true
  });
  // FileRef saveTextFile(String relPath, String fileName, String contents)
  /*
  var t = new Template(-2, $('#filename').val(), self.cm.getValue(), 3);
  var u = '../api/tr/?c=de.uhilger.webbox.api.ContentApi&m=newTemplate';
  self.post(u, {p: self.serialise(t)}, function (resp) {
    self.isnew = false;
    self.editid = resp.Template.id;
    $('#contlist').append(self.buildContListItem(3, resp.Template.name, resp.Template.id));
    $('#templateeditor').addClass('hidden');
  });
  */
}
function fm_logout() {
@@ -333,10 +286,6 @@
/* ---- codemirror editor handling -------- */
function fm_code_edit(content) {
  //var windowHeight = $(window).height();
  //$("editspace").empty();
  //self.cm.toTextArea();
  cm = CodeMirror.fromTextArea(document.getElementById("editspace"), {
    lineNumbers: true,
    mode: "xml",
@@ -436,4 +385,4 @@
function BcrFile(rp, n) {
  this.relPath = rp;
  this.fName = n;
}
}