|
@@ -545,16 +545,16 @@ class GetRealImage < Riddl::Implementation
|
|
|
|
|
|
if false #Currently replacements are done on the client side
|
|
|
if(@p[0].nil?)
|
|
|
- puts "Undefined p"
|
|
|
+ #puts "Undefined p"
|
|
|
else
|
|
|
if(@p[0].name == "video" && @p[0].value)
|
|
|
|
|
|
xml = Nokogiri.parse img
|
|
|
- puts "Width " + xml.xpath("string(//xmlns:image/@width)")
|
|
|
- puts "Height " + xml.xpath("string(//xmlns:image/@height)")
|
|
|
+ #puts "Width " + xml.xpath("string(//xmlns:image/@width)")
|
|
|
+ #puts "Height " + xml.xpath("string(//xmlns:image/@height)")
|
|
|
#puts "Posi " + xml.xpath("string(//xmlns:clipPath/path/@height)")
|
|
|
- puts "Posi " + xml.xpath("string(//xmlns:image/following-sibling::clipPath/@id)")
|
|
|
- puts xml.xpath("string(//xmlns:text[starts-with(text(), 'url')])").sub("url=", "")
|
|
|
+ #puts "Posi " + xml.xpath("string(//xmlns:image/following-sibling::clipPath/@id)")
|
|
|
+ #puts xml.xpath("string(//xmlns:text[starts-with(text(), 'url')])").sub("url=", "")
|
|
|
|
|
|
# text
|
|
|
img = img.sub! "</svg>", '
|
|
@@ -639,7 +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
|
|
|
+ #puts searchstring
|
|
|
|
|
|
#Search for images with one or multiple found patternIDs
|
|
|
ret = []
|
|
@@ -902,7 +902,6 @@ end
|
|
|
|
|
|
class ListAssignmentSearch < Riddl::Implementation
|
|
|
|
|
|
-
|
|
|
def self::prepare(appconf, pat, pat_station, pat_value)
|
|
|
#https://centurio.work/customers/evva/was/ui/TransformProductCode.php?ProductCode=E.A.PZ.DZ-S.31.31.MP.SEP
|
|
|
pattern = JSON.parse(Net::HTTP.get URI(appconf + "ui/TransformProductCode.php?ProductCode=" + pat))
|
|
@@ -941,6 +940,8 @@ class ListAssignmentSearch < Riddl::Implementation
|
|
|
|
|
|
|
|
|
searchstring = searchstring + " , patternassignments STATION , patternassignments ValText"
|
|
|
+
|
|
|
+
|
|
|
searchstring = searchstring + " WHERE " + pattern.map{ |key, val| pattern.keys[0] + ".AssID == " + key + ".AssID"}.join(' AND ');
|
|
|
searchstring = searchstring + " AND " + pattern.map{ |key, val| pattern.keys[0] + ".ID == " + key + ".ID"}.join(' AND ')
|
|
|
|
|
@@ -949,10 +950,10 @@ class ListAssignmentSearch < Riddl::Implementation
|
|
|
searchstring = searchstring + " AND " + emptypatternparts.map{ |key| pattern.keys[0] + ".ID == " + key + ".ID"}.join(' AND ')
|
|
|
searchstring = searchstring + " AND " + emptypatternparts.map{ |key| key + ".type == '" + key + "' AND " + key + ".value == ''" }.join(' AND ')
|
|
|
|
|
|
- searchstring = searchstring + " AND " + pattern.keys[0] + ".AssID == STATION.AssID"
|
|
|
- searchstring = searchstring + " AND " + pattern.keys[0] + ".AssID == ValText.AssID"
|
|
|
- searchstring = searchstring + " AND " + pattern.keys[0] + ".ID == STATION.ID"
|
|
|
- searchstring = searchstring + " AND " + pattern.keys[0] + ".ID == ValText.ID"
|
|
|
+ searchstring = searchstring + " AND " + pattern.keys[0] + ".AssID == STATION.AssID"
|
|
|
+ searchstring = searchstring + " AND " + pattern.keys[0] + ".AssID == ValText.AssID"
|
|
|
+ searchstring = searchstring + " AND " + pattern.keys[0] + ".ID == STATION.ID"
|
|
|
+ searchstring = searchstring + " AND " + pattern.keys[0] + ".ID == ValText.ID"
|
|
|
|
|
|
|
|
|
searchstring = searchstring + " AND STATION.type == 'STATION'" + " AND STATION.value == '" + pat_station + "'"
|
|
@@ -979,10 +980,13 @@ class ListAssignmentSearch < Riddl::Implementation
|
|
|
searchstring = searchstring + " ORDER BY ID ASC"
|
|
|
end
|
|
|
|
|
|
-
|
|
|
+ #pp searchstring
|
|
|
|
|
|
result = $db.execute searchstring;
|
|
|
|
|
|
+ #count entries
|
|
|
+ #result2 = $db.execute "SELECT COUNT(*) FROM patternassignments";
|
|
|
+ #pp result2;
|
|
|
|
|
|
#Search for images with one or multiple found patternIDs
|
|
|
ret = []
|
|
@@ -1005,6 +1009,28 @@ class ListAssignmentSearch < Riddl::Implementation
|
|
|
end
|
|
|
|
|
|
|
|
|
+class ListAssignmentSearchMultiple < Riddl::Implementation
|
|
|
+ def response
|
|
|
+ #pattern station text
|
|
|
+
|
|
|
+ pattern = JSON.parse(@p[0].value)
|
|
|
+ station = JSON.parse(@p[1].value)
|
|
|
+ text = JSON.parse(@p[2].value)
|
|
|
+
|
|
|
+ ret = []
|
|
|
+ pattern.each_with_index {|val, index|
|
|
|
+ #puts "#{val} => #{index} : #{station[index]} : #{text[index]}"
|
|
|
+ ret = ret.push(ListAssignmentSearch::prepare(@a[0][:appconf]["wasurl"], val, station[index], text[index]))
|
|
|
+ }
|
|
|
+
|
|
|
+ #ret = ListAssignmentSearch::prepare(@a[0][:appconf]["wasurl"], @p[0].value, @p[1].value, @p[2].value)
|
|
|
+ Riddl::Parameter::Complex.new('list','application/json',JSON::pretty_generate(ret))
|
|
|
+ end
|
|
|
+end
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
def createDB(opts)
|
|
|
$db.execute("PRAGMA foreign_keys=ON");
|
|
@@ -1118,6 +1144,9 @@ server = Riddl::Server.new(File.join(__dir__,'/was.xml'), :host => 'localhost')
|
|
|
on resource 'search' do
|
|
|
run ListAssignmentSearch, opts if get
|
|
|
end
|
|
|
+ on resource 'searchMultiple' do
|
|
|
+ run ListAssignmentSearchMultiple, opts if post
|
|
|
+ end
|
|
|
on resource '\d+' do
|
|
|
run GetAssignment if get
|
|
|
run RenameAssignmentImagePath if put 'list'
|