Bläddra i källkod

updated image replacement

Manuel Gall 3 år sedan
förälder
incheckning
cb2e49f1b2
2 ändrade filer med 13 tillägg och 15 borttagningar
  1. 5 10
      server/was.rb
  2. 8 5
      ui/imageReplacement.php

+ 5 - 10
server/was.rb

@@ -149,9 +149,9 @@ class CreatePattern < Riddl::Implementation
     $db.execute("INSERT INTO stationpattern (station, internalID, description, date) VALUES (?,?,?,?)", [@r.last, id, doc.xpath("/*/@description")[0].value, doc.xpath("/*/@changed")[0].value])
     
     doc.xpath(".//parts/*").each do |node|
-      if(node.text != "")
+      #if(node.text != "")
         $db.execute("INSERT INTO pattern (internalID, type, value) VALUES (?,?,?)", [id, node.name, node.text])
-      end
+      #end
     end
     
     ret = {:id => id}
@@ -188,9 +188,9 @@ class UpdatePattern < Riddl::Implementation
     $db.execute("DELETE FROM pattern WHERE  internalID = ?", [@r[1]])
 
     doc.xpath(".//parts/*").each do |node|
-      if(node.text != "")
+      #if(node.text != "")
         $db.execute("INSERT INTO pattern (internalID, type, value) VALUES (?,?,?)", [@r[1], node.name, node.text])
-      end
+      #end
     end
   end
 end
@@ -225,12 +225,6 @@ class DuplicatePattern < Riddl::Implementation
       $db.execute( "INSERT INTO pattern values (?,?,?)", row)
     end
     
-
-
-
-    
-
-    
     
     #duplicate error
     
@@ -645,6 +639,7 @@ class SearchImages < Riddl::Implementation
     searchstring = searchstring + " AND " + pattern.map{ |key, val| key + ".type == '" + key + "' AND (" + key + ".value == '"+ val +"' or " + key + ".value == '*')"}.join(' AND ') + " ORDER BY ID ASC" 
     result = $db.execute searchstring;
     
+    puts searchstring
     
     #Search for images with one or multiple found patternIDs
     ret = []

+ 8 - 5
ui/imageReplacement.php

@@ -118,12 +118,12 @@
     $fullfilename = substr($fullfilename, 1); 
     $fullfilename = $universalStorageEinzelbilder . "Station" . $curstation . "/Station". $curstation.     "_" . $fullfilename . ".jpg";
     
-    
     //if Real image was not found
     $file_headers = @get_headers($fullfilename);
     if(!$file_headers || $file_headers[0] == 'HTTP/1.1 404 Not Found') {
-      echo $key . " ";
-      echo json_encode($asocarray);
+      //echo $fullfilename;
+      //echo $key . " ";
+      //echo json_encode($asocarray);
       
       $onlyUsedParts=array();
       foreach($asocarray as $keypart => $keyval){
@@ -135,8 +135,8 @@
           array_push($onlyUsedParts, "");
         }
       }
-      echo implode (".", $onlyUsedParts);
-      echo "<br>";
+      //echo implode (".", $onlyUsedParts);
+      //echo "<br>";
       
       
         
@@ -153,6 +153,9 @@
 
       
       
+    }
+    else{
+      //echo $fullfilename;
     }