| | |
| | | // 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); |
| | |
| | | } |
| | | |
| | | function app_abspieler_neu(abspieler) { |
| | | app_neuen_abspieler_speichern(abspieler); |
| | | var html = Mustache.render(templateCache[TPL_ABSPIELER_EINTRAG], abspieler); |
| | | if(abspieler.zustand === 'selected') { |
| | | $.each($(".abspieler-auswahl option:selected"), function() { |
| | |
| | | ); |
| | | $('#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); |
| | | }); |
| | |
| | | */ |
| | | $('#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); |
| | |
| | | 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); |
| | | }); |
| | |
| | | |
| | | 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 ) { |
| | |
| | | }); |
| | | } |
| | | |
| | | function app_crud_api(api, methode, o) { |
| | | var obj = serialisieren(o); |
| | | var url = api + methode; |
| | | $.post( url, 'p=' + obj, function( result ) { |
| | | console.log( result ); |
| | | }, "json"); |
| | | } |
| | | |
| | | /* SenderApi */ |
| | | |
| | | var URL_SENDER_API = "api?c=de.uhilger.radiozentrale.api.SenderApi&m="; |
| | | |
| | | function app_neuen_sender_speichern(sender) { |
| | | app_crud_api(URL_SENDER_API, 'neuerSender', sender); |
| | | } |
| | | |
| | | function app_sender_aendern(sender) { |
| | | app_crud_api(URL_SENDER_API, 'senderAendern', sender); |
| | | } |
| | | |
| | | function app_sender_entfernen(sender) { |
| | | app_crud_api(URL_SENDER_API, 'senderLoeschen', sender); |
| | | } |
| | | |
| | | /* AbspielerApi */ |
| | | |
| | | var URL_ABSPIELER_API = "api?c=de.uhilger.radiozentrale.api.AbspielerApi&m="; |
| | | |
| | | function app_neuen_abspieler_speichern(abspieler) { |
| | | app_crud_api(URL_ABSPIELER_API, 'neuerAbspieler', abspieler); |
| | | } |
| | | |
| | | /* Hilfsfunktionen */ |
| | | |
| | | function serialisieren(obj) { |
| | | return '{"' + obj.constructor.name + '":' + JSON.stringify(obj) + '}'; |
| | | } |
| | | |
| | | /* Objekte */ |
| | | |
| | | function Sender(i, n, u, l) { |