From fcc734a744409e307d334a1f8f4bfcfc0a319cb1 Mon Sep 17 00:00:00 2001
From: ulrich
Date: Thu, 08 Apr 2021 19:41:43 +0000
Subject: [PATCH] Titel auf Abspielliste, Abspielliste anzeigen, Eintrag auswaehlen

---
 www/ui/js/app.js |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/www/ui/js/app.js b/www/ui/js/app.js
index 3f8f2b6..a28d20b 100644
--- a/www/ui/js/app.js
+++ b/www/ui/js/app.js
@@ -74,19 +74,28 @@
   /* ---------------- Titel einer Abspielliste ----------------- */
   
   this.titel_liste = function() {
-    self.http_get('../api/store/Ablageort/liste/', function (responseText) {
-      self.vorlage_laden_und_fuellen("data/tpl/ablageort_liste.tpl", JSON.parse(responseText), function (html) {
+    self.reset_top_buttons();
+    var plname = document.querySelector('#playlist').value;
+    self.http_get('../api/alist/' + plname, function (responseText) {
+      self.vorlage_laden_und_fuellen("data/tpl/titel_liste.tpl", JSON.parse(responseText), function (html) {
         document.querySelector(".zentraler-inhalt").innerHTML = html;
         self.addEvtListener('.entity-eintrag', 'click', function (event) {
           var t = event.target;
+          self.removeClassMulti('selected');
+          t.classList.add('selected');
+
+          /*
           self.http_get('../api/store/Ablageort/' + t.textContent, function(responseText){
             var ablageort = JSON.parse(responseText);
             self.ablageort_form(ablageort);
           });
+          */
         });
+        /*
         self.addEvtListener('#neu-btn', 'click', function (event) {
           eval("self.ablageort_form" + "(this)");
-        });        
+        });
+        */
       });
     });
   };
@@ -165,7 +174,12 @@
   
   this.addSelectedTitel = function() {
     var titelName = document.querySelector(".selected").textContent;
-    var titel = new Titel(self.mediaPfad + titelName, self.ortPfad);
+    var titel;
+    if(self.mediaPfad.endsWith('/')) {
+      titel = new Titel(self.mediaPfad + titelName, self.ortPfad);
+    } else {
+      titel = new Titel(self.mediaPfad + '/' + titelName, self.ortPfad);
+    }
     var plname = document.querySelector('#playlist').value;
     self.http_put('../api/alist/' + plname, JSON.stringify(titel), function(responseText) {
       self.meldung_mit_timeout(responseText, 1500);

--
Gitblit v1.9.3