From 6043314d5e9787504321829bb8138d55a74ce07c Mon Sep 17 00:00:00 2001
From: hilgeru <hilgeru@msgn07482.int.root.msg.ag>
Date: Tue, 27 Feb 2018 15:28:09 +0000
Subject: [PATCH] Doku ergaenzt

---
 web/app.js |   32 ++++++++++++++++++++++++++++----
 1 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/web/app.js b/web/app.js
index d3613cf..b474eb6 100644
--- a/web/app.js
+++ b/web/app.js
@@ -36,7 +36,8 @@
   // Templates laden
   app_get_template('data/tpl/dlg-msg.tpl', TPL_DLG_MSG);
   app_get_template('data/tpl/dlg-info.tpl', TPL_DLG_INFO);
-  app_get_template('data/tpl/sender.tpl', TPL_SENDER);
+  //app_get_template('data/tpl/sender.tpl', TPL_SENDER);
+  app_get_template('data/tpl/sender-transit.tpl', TPL_SENDER);
   app_get_template('data/tpl/dlg-sender-neu.tpl', TPL_DLG_SENDER_NEU);
   app_get_template('data/tpl/dlg-sender-edit.tpl', TPL_DLG_SENDER_EDIT);
   app_get_template('data/tpl/dlg-sender-loeschen.tpl', TPL_DLG_SENDER_DEL);
@@ -202,7 +203,11 @@
         );
         $('#sender-speichern').on('click', function() {
           $('#sender-speichern').off('click');
-          app_kachel_anpassen(app_sender_dialog_lesen(senderId));
+          var sender = app_sender_dialog_lesen(senderId);
+          
+          app_sender_aendern(sender);
+          
+          app_kachel_anpassen(sender);
           app_dialog_schliessen();
           app_meldung_mit_timeout('Speichern gewaehlt', 1500);
         });
@@ -216,6 +221,9 @@
         */
         $('#sender-loeschen').on('click', function() {
           $('#sender-loeschen').off('click');
+          
+          app_sender_entfernen(s);
+          
           app_kachel_entfernen(s);
           app_dialog_schliessen();
           app_meldung_mit_timeout('Loeschen gewaehlt ' + s.name, 1500);
@@ -373,7 +381,7 @@
 
 function app_get_sender() {
   $.ajax({
-    url: "data/sender.json",
+    url: "api?c=de.uhilger.radiozentrale.api.SenderApi&m=senderliste&f=JSONNICE",
     type: "GET",
     dataType : "json"
   }).done(function( senderliste ) {
@@ -458,9 +466,25 @@
   });
 }
 
+/* SenderApi */
+
+var URL_SENDER_API = "api?c=de.uhilger.radiozentrale.api.SenderApi&m=";
+
 function app_neuen_sender_speichern(sender) {
+  app_sender_api('neuerSender', sender);
+}
+
+function app_sender_aendern(sender) {
+  app_sender_api('senderAendern', sender);
+}
+
+function app_sender_entfernen(sender) {
+  app_sender_api('senderLoeschen', sender);
+}
+
+function app_sender_api(methode, sender) {
   var obj = serialisieren(sender);
-  var url = 'api?c=de.uhilger.radiozentrale.api.SenderApi&m=neuerSender';
+  var url = URL_SENDER_API + methode;
   $.post( url, 'p=' + obj, function( result ) {
     console.log( result );
   }, "json");

--
Gitblit v1.9.3