fixing html whitelist bug
[mir.git] / source / mircoders / producer / PDFPreFormattingProducerNode.java
index 4b7e9eb..597872e 100755 (executable)
@@ -34,6 +34,7 @@ import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 
 import mir.entity.Entity;
@@ -103,12 +104,15 @@ public class PDFPreFormattingProducerNode implements ProducerNode {
 
       ArrayList brokenUpContent = new ArrayList();
 
+
+      List extraTables = new ArrayList();
+      extraTables.add("content_x_media cxm");
       Iterator images = new EntityBrowser(
-         DatabaseImages.getInstance(),
-          "exists (select * from content_x_media where content_id=" + entity.getId() + " and media_id=id)",
-          "id desc", 30, -1, 0);
+        DatabaseImages.getInstance(), "i", extraTables,
+          "cxm.content_id="+entity.getId()+"and cxm.media_id=i.id",
+          "i.id desc", 30, -1, 0);
 
-      String theContent = ((EntityContent) entity).getValue("content_data");
+      String theContent = ((EntityContent) entity).getFieldValue("content_data");
       //remove pesky characters
       theContent = HTMLRoutines.encodeXML(theContent);
       //put in the <BR> tags so we can turn them to empty blocks
@@ -140,8 +144,8 @@ public class PDFPreFormattingProducerNode implements ProducerNode {
               Map row1 = new HashMap();
               Map row2 = new HashMap();
               EntityImages currentImage=(EntityImages) images.next();
-              float img_width=(new Float(currentImage.getValue("img_width"))).floatValue();
-              float img_height=(new Float(currentImage.getValue("img_height"))).floatValue();
+              float img_width=(new Float(currentImage.getFieldValue("img_width"))).floatValue();
+              float img_height=(new Float(currentImage.getFieldValue("img_height"))).floatValue();
 
               //oversize images must be shrunk
               if (img_width>250){
@@ -158,7 +162,7 @@ public class PDFPreFormattingProducerNode implements ProducerNode {
 
               row1.put("text_widthCM",Float.toString(text_widthCM));
 
-              row1.put("img_title",currentImage.getValue("title"));
+              row1.put("img_title",currentImage.getFieldValue("title"));
 
               row1.put("img_width",Float.toString(img_width));
               row1.put("img_height",Float.toString(img_height));
@@ -166,7 +170,7 @@ public class PDFPreFormattingProducerNode implements ProducerNode {
               aLogger.debug("img_width " +Float.toString(img_width));
               aLogger.debug("img_height "+Float.toString(img_height));
 
-              row1.put("img_src",currentImage.getValue("publish_path"));
+              row1.put("img_src",currentImage.getFieldValue("publish_path"));
               row1.put("hasImage","1");
               if (! outOfText){
                   try {