From 8c352d59e8d9de9c53d70c2327330022a1d658b7 Mon Sep 17 00:00:00 2001
From: ulrich <undisclosed>
Date: Sun, 25 Feb 2018 18:12:03 +0000
Subject: [PATCH] SenderApi aufgeraeumt

---
 web/app.js |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/web/app.js b/web/app.js
index 7647533..d3613cf 100644
--- a/web/app.js
+++ b/web/app.js
@@ -248,7 +248,9 @@
   app_dialog_laden_und_zeigen(templateCache[TPL_DLG_SENDER_NEU], '');
   $('#sender-speichern').on('click', function() {
     $('#sender-speichern').off('click');
-    app_kachel_neu(app_sender_dialog_lesen(--ID_UNDEFINED));
+    var sender = app_sender_dialog_lesen(--ID_UNDEFINED);
+    app_neuen_sender_speichern(sender);
+    app_kachel_neu(sender);
     app_dialog_schliessen();
     app_meldung_mit_timeout('Speichern gewaehlt', 1500);
   });
@@ -456,6 +458,20 @@
   });
 }
 
+function app_neuen_sender_speichern(sender) {
+  var obj = serialisieren(sender);
+  var url = 'api?c=de.uhilger.radiozentrale.api.SenderApi&m=neuerSender';
+  $.post( url, 'p=' + obj, function( result ) {
+    console.log( result );
+  }, "json");
+}
+
+/* Hilfsfunktionen */
+
+function serialisieren(obj) {
+  return '{"' + obj.constructor.name + '":' + JSON.stringify(obj) + '}';
+}
+
 /* Objekte */
 
 function Sender(i, n, u, l) {

--
Gitblit v1.9.3