Dateiverwaltung für die WebBox
ulrich
2017-02-19 b7475d69c0d52f1639a13fae0afc617767852173
web/ui/ui.js
@@ -8,7 +8,8 @@
  $('#closeFile').on('click', fm_menu_datei_schliessen);
  $('#myModal').on('hidden.bs.modal', function (e) {
    $('#modal_ok').attr('onclick','').unbind('click');
  })
  });
  $('#logout').click(fm_logout);
  fm_get_login();
}
@@ -26,10 +27,12 @@
  $('#dateiansicht').show();  
}
/* ----- API Calls ------------- */
function fm_get_login() {
  var m = '?c=de.uhilger.um.pub.SessionManager&m=getSessionUser';
  var u = '../../um/pub' + m;
  fm_get(u, function(resp) {
  fm_get(u, "json", function(resp) {
    $('#userMenu').text(resp.UserData.firstName);
  });  
}
@@ -38,7 +41,6 @@
  
  $('#modal_ok').click(function() {
    // hier speichern
    alert("Speichern");
    var m = '?c=de.uhilger.filecms.api.FileMgr&m=saveTextFile';
    var u = '../svc' + m;
    fm_post(u, {p1: '', p2: $('#dateiname').val(), p3: cm.getValue()}, function(resp) {
@@ -65,6 +67,17 @@
  });
  */
}
function fm_logout() {
  var m = '?c=de.uhilger.filecms.pub.SessionManager&m=expireSession';
  var u = '../pub' + m;
  fm_get(u, "text", function(resp) {
    $('#userMenu').text('nicht angemeldet');
    window.location.href = '../logout.html';
  });
}
/* ---- codemirror editor handling -------- */
@@ -93,11 +106,11 @@
/* -------- helper functions ----------- */
function fm_get(u, scallback) {
function fm_get(u, dtype, scallback) {
  $.ajax({
    url: u,
    type: "GET",
    dataType: "json",
    dataType: dtype,
    success: scallback,
    error: function (xhr, status, errorThrown) {
      alert("Error: " + errorThrown + " Status: " + status + " URL: " + u);