Dateiverwaltung für die WebBox
ulrich
2017-03-20 a450f233393a9e3297fea633373635d060a3c709
web/ui/ui.js
@@ -40,6 +40,7 @@
  $("#mce-editor").hide();
  $('.codeeditor-space').hide();
  $('.code-editor-container').hide();
  $('.sued').hide();
  //$('.ost').attr('flex-basis', 0);
  $('#newTextFile').on('click', fm_menu_neue_textdatei);
  $('#newDoc').on('click', fm_menu_neues_dokument);
@@ -63,10 +64,12 @@
  $('#m-test').on('click', fm_menu_test);
  $('#m-test-2').on('click', fm_menu_compile);
  $('#m-test-3').on('click', fm_menu_compile_all);
  $('#m-compile-results').on('click', fm_fusszeile_zeigen);
  $('#saveModal').on('hidden.bs.modal', function (e) {
    $('#modal_ok').attr('onclick','').unbind('click');
  });
  $('#logout').click(fm_logout);  
  $('#fusszeile-schliessen').on('click', fm_fusszeile_schliessen);
  fm_get_login();
  fm_get_list('');
  fm_init_uploader();
@@ -89,6 +92,14 @@
    } catch (err) {
    }
  }, 200);
}
function fm_fusszeile_schliessen() {
  $('.sued').hide();
}
function fm_fusszeile_zeigen() {
  $('.sued').show();
}
function fm_get_path(uid) {
@@ -266,6 +277,7 @@
 */
function fm_gewaehlte_dateien() {
  var gewaehlte = $('.datei-gewaehlt');
  /*
  //console.log('anzahl: ' + gewaehlte.length);
  var fnames = new Array();
  var i = 0;
@@ -281,7 +293,27 @@
  // {"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 fm_dateiliste_bilden(gewaehlte);
}
function fm_dateiliste_bilden(gewaehlte) {
  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;
}
/* --------- Dateifunktionen Ende ---------- */
function fm_menu_test() {
@@ -335,21 +367,53 @@
    if(resp.List[0].CompilerIssue !== undefined) {
      var lno;
      var eMsg;
      var issueList = new Array();
      if(resp.List[0].CompilerIssue instanceof Array) {
        var issueNo = 0;
        while(issueNo < resp.List[0].CompilerIssue.length) {
          /*
          $('.system-out').append('   +++ ---- +++   ');
          $('.system-out').append(resp.List[0].CompilerIssue[issueNo].kind);
          $('.system-out').append(resp.List[0].CompilerIssue[issueNo].lineNumber);
          $('.system-out').append(resp.List[0].CompilerIssue[issueNo].sourceName);
          $('.system-out').append(resp.List[0].CompilerIssue[issueNo].message);
          */
          var issue = new CompilerIssue(
            resp.List[0].CompilerIssue[issueNo].sourceName,
            resp.List[0].CompilerIssue[issueNo].message,
            resp.List[0].CompilerIssue[issueNo].kind,
            resp.List[0].CompilerIssue[issueNo].lineNumber
          );
          issueList.push(issue);
          /*
          console.log('   +++ ---- +++   ');
          console.log(resp.List[0].CompilerIssue[issueNo].kind);
          console.log(resp.List[0].CompilerIssue[issueNo].lineNumber);
          console.log(resp.List[0].CompilerIssue[issueNo].sourceName);
          console.log(resp.List[0].CompilerIssue[issueNo].message);
          */
          issueNo++;
        }
      } else {
        lno = resp.List[0].CompilerIssue.lineNumber;
        eMsg = resp.List[0].CompilerIssue.kind + ' ' + resp.List[0].CompilerIssue.message;
        console.log(lno + ' ' + eMsg);
        //lno = resp.List[0].CompilerIssue.lineNumber;
        //eMsg = resp.List[0].CompilerIssue.kind + ' ' + resp.List[0].CompilerIssue.message;
        //$('.system-out').append(lno + ' ' + eMsg);
        //console.log(lno + ' ' + eMsg);
        var issue = new CompilerIssue(
          resp.List[0].CompilerIssue.sourceName,
          resp.List[0].CompilerIssue.message,
          resp.List[0].CompilerIssue.kind,
          resp.List[0].CompilerIssue.lineNumber
        );
        issueList.push(issue);
      }
      var theList = new IssueList(issueList);
      var template = $('#tpl-ci').html();
      Mustache.parse(template);   // optional, speeds up future uses
      $('.system-out').empty();
      $('.system-out').html(Mustache.render(template, theList));
      $('.sued').show();
    }
  });
}
@@ -1045,6 +1109,18 @@
/* ----- Objekte ----- */
function IssueList(il) {
  this.issues = il;
}
function CompilerIssue(sn, ms, ki, ln) {
  var self = this;
  this.sourceName = sn;
  this.message = ms;
  this.kind = ki;
  this.lineNumber = ln;
}
function FileList(fl) {
  this.files = fl;
}