Explorar o código

iso changing is working

bscheibel %!s(int64=4) %!d(string=hai) anos
pai
achega
7f8ed28090
Modificáronse 2 ficheiros con 18 adicións e 3 borrados
  1. 17 2
      app/static/js/js_libs/ui.js
  2. 1 1
      app/views.py

+ 17 - 2
app/static/js/js_libs/ui.js

@@ -53,6 +53,7 @@ function ui_add_tab(tabbed,title,id,closeable,additionalclasses) {
 
 function create_new_tab(title, id,terms) {
     //console.log(title,id);
+    if (terms != "empty"){
     var terms = atob(terms);
     var theDiv = document.getElementById(id);
     //var content = document.createTextNode("Test");
@@ -69,19 +70,33 @@ function create_new_tab(title, id,terms) {
         textElement.innerHTML += "<a onclick=change_isos_tab('"+id+"','"+array_terms[key]+"')>"+key+" </a><br>";
     }
     newElement.setAttribute('id', "iso_"+id);
-    //console.log(terms);
+    console.log(terms);
+    console.log(textElement)
     newElement.innerHTML = "<iframe width=100% height=1000px src= '/static/isos/" + id  + ".PDF')'> </iframe>";
     theDiv.appendChild(textElement);
     theDiv.appendChild(newElement);
+    }
+    else{
+        var theDiv = document.getElementById(id);
+        var newElement = document.createElement('div');
+        var textElement = document.createElement('div');
+        textElement.innerHTML += "<a onclick=change_isos_tab('"+id+"','start')> Start of ISO File. </a><br>";
+        newElement.setAttribute('id', "iso_"+id);
+        //console.log(terms);
+        newElement.innerHTML = "<iframe width=100% height=1000px src= '/static/isos/" + id  + ".PDF')'> </iframe>";
+        theDiv.appendChild(textElement);
+        theDiv.appendChild(newElement);
+    }
     return true;
 }
 
 function change_isos_tab(id, term){
     var theDiv = document.getElementById("iso_"+id);
-    if (term = "start"){
+    if (term == "start"){
         term = 1;
     }
     theDiv.innerHTML = "<iframe width=100% height=1000px src= '/static/isos/" + id  + ".PDF#page="+ term+"')'> </iframe>";
+    console.log(id,term);
     return true;
 }
 

+ 1 - 1
app/views.py

@@ -212,7 +212,7 @@ def uploaded_file(filename, uuid):
                 html_code += "</tr>"
                 html_links = ""
                 for link in links:
-                    html_links += "<a onclick =ui_add_tab_active('#main','" + link + "','" + link +"',true,'isotab','"+terms+"')> Open " + link + "</a> <br>"
+                    html_links += "<a onclick =ui_add_tab_active('#main','" + link + "','" + link +"',true,'isotab','empty')> Open " + link + "</a> <br>"
                     #html_links += "<tr> <td> <a onclick =ui_add_tab_active('#main','iso1','iso1',true,'isotab')> Open " + link + " in Tab </a> </td> </tr>"""
         #print("teeest")
         return render_template('index.html', filename=file_out, isos=isos, dims=dims, text=html_code,html_general=html_general, number=number_blocks, og_filename=filename, w=w, h=h, html_links=html_links, isos_names=isos_names)