From 6b63ff8c8429e328aa3ad90868e69ba28b28ef63 Mon Sep 17 00:00:00 2001 From: ulrich <undisclosed> Date: Sun, 25 Feb 2018 18:30:07 +0000 Subject: [PATCH] Senderkacheln auf Transit-Antwort umgestellt --- web/app.js | 23 ++++++++++++++++++++--- 1 files changed, 20 insertions(+), 3 deletions(-) diff --git a/web/app.js b/web/app.js index 7647533..4670e93 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); @@ -248,7 +249,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); }); @@ -371,7 +374,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 ) { @@ -456,6 +459,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