From 590b029719086399f57e17c8a9b11f64addedc87 Mon Sep 17 00:00:00 2001 From: ulrich@undisclosed Date: Mon, 11 May 2020 06:29:45 +0000 Subject: [PATCH] Stile fuer Dialog Neuer Nutzer --- web/ui2/js/app.js | 69 +++++++++++++++++++++++----------- 1 files changed, 46 insertions(+), 23 deletions(-) diff --git a/web/ui2/js/app.js b/web/ui2/js/app.js index ad224ea..07fb0dd 100644 --- a/web/ui2/js/app.js +++ b/web/ui2/js/app.js @@ -1,4 +1,4 @@ -function AppVorlage() { +function NutzerApp() { var self = this; var appMenu; var vorlagen; @@ -7,12 +7,6 @@ var pfad = ''; var loc; var modus = 'kacheln'; - var PERS_DIR = "Persoenlich"; - var PUB_DIR = "Oeffentlich"; - var DAV_DIR = "Austausch"; - var BASE_DIR = "$basis"; - var DATA_DIR = "$daten"; - var WWW_DIR = "www"; this.datei_neuer_text = function () { self.meldung_mit_timeout("Neuer Text", 1500); @@ -32,6 +26,9 @@ document.querySelector('.hamburger').addEventListener('click', function (e) { self.menue_umschalten(); }); + var dlg = document.querySelector(".dialog"); + dlg.style.flexBasis = '0em'; + self.seitenleiste_umschalten(); self.um_get_login(); self.um_get_user_list(); self.loc = window.location.protocol + '//' + window.location.host; @@ -49,6 +46,11 @@ this.info_dialog_zeigen = function () { self.dialog_laden_und_zeigen('data/tpl/dlg-info.tpl', ''); + self.menue_umschalten(); + }; + + this.nutzer_neu_dialog_zeigen = function () { + self.dialog_laden_und_zeigen('data/tpl/dlg-nutzer-neu.tpl', ''); self.menue_umschalten(); }; @@ -119,41 +121,44 @@ vurl, inhalt, function (html) { - //dlg.html(html); - dlg.style.height = '5em'; - dlg.innerHTML = html; - document.querySelector('.close-btn').addEventListener('click', self.dialog_schliessen); - //dlg.slideDown(300); + dlg.style.flexBasis = '14em'; + setTimeout(function () { + dlg.innerHTML = html; + document.querySelector('.close-btn').addEventListener('click', self.dialog_schliessen); + }, 300); }); }; this.dialog_schliessen = function () { document.querySelector('.close-btn').removeEventListener('click', self.dialog_schliessen); - //$('.dialog').slideUp(300); var dlg = document.querySelector('.dialog'); - //dlg.style.display = "none"; - dlg.style.height = '0'; dlg.innerHTML = ''; + dlg.style.flexBasis = '0em'; }; /* API functions */ this.um_get_user_list = function() { + //var m = 'getUserNameList'; var m = 'getUserNameList'; var u = '../svc/' + m; - self.fm_get(u, "json", function (antwort) { - var elem = document.getElementById('nutzer'); - elem.textContent = antwort; + self.um_get(u, "json", function (antwort) { + self.vorlagen.html_erzeugen( + 'data/tpl/inhalt.tpl', + JSON.parse(antwort), + function (h) { + var elem = document.getElementById('nutzer'); + elem.innerHTML = h; + }); }); - } - + }; /* -------- An- und Abmelden ------------- */ this.um_get_login = function() { var m = '?c=de.uhilger.um.pub.SessionManager&m=getSessionUser'; var u = '../pub' + m; - self.fm_get(u, "text", function (resp) { + self.um_get(u, "text", function (resp) { self.userid = resp; self.login_zeigen(); //document.querySelector("#userMenu").textContent = resp; @@ -163,7 +168,7 @@ this.um_logout = function() { var m = '?c=de.uhilger.um.pub.SessionManager&m=expireSession'; var u = '../pub' + m; - self.fm_get(u, "text", function (resp) { + self.um_get(u, "text", function (resp) { //$('#userMenu').text('nicht angemeldet'); window.location.href = '../logout.html'; }); @@ -171,7 +176,7 @@ /* -------- ajax helper functions ----------- */ - this.fm_get = function (u, dtype, scallback) { + this.um_get = function (u, dtype, scallback) { var xmlhttp = new XMLHttpRequest(); var url = u; xmlhttp.onreadystatechange = function() { @@ -182,5 +187,23 @@ xmlhttp.open("GET", url, true); xmlhttp.send(); }; + +/* ----- Hilfsfunktionen ----- */ + + this.serialisieren = function(obj) { + return '{"' + obj.constructor.name + '":' + JSON.stringify(obj) + '}'; + }; } + + +/* ----- Objekte ----- */ + +function User(i, p, fn, ln, em) { + this.id = i; + this.pw = p; + this.firstName = fn; + this.lastName = ln; + this.email = em; +} + -- Gitblit v1.9.3