From d0dd8b14d2b0405055dafaa2703e2d325aabeeb1 Mon Sep 17 00:00:00 2001
From: orbiter
Date: Fri, 7 Apr 2006 22:09:59 +0000
Subject: [PATCH] fixed picture tag and presentation
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2014 6c8d7289-2bf4-0310-a012-ef5d649a1542
---
htroot/yacysearch.html | 14 ++++++++---
htroot/yacysearch.java | 25 +++++++++++++------
.../de/anomic/plasma/plasmaSearchImages.java | 2 +-
3 files changed, 29 insertions(+), 12 deletions(-)
diff --git a/htroot/yacysearch.html b/htroot/yacysearch.html
index 3fdc2196c..a867f7a78 100644
--- a/htroot/yacysearch.html
+++ b/htroot/yacysearch.html
@@ -119,7 +119,7 @@ available for everyone. Then stay online to support crawls from other peers. Tha
#(snippet)#loading snippet ...::#[text]##(/snippet)#
#[urlname]#
#[date]# |
-YBR-#[ybr]# | Info | Pictures
+YBR-#[ybr]# | Info | Pictures
@@ -147,11 +147,17 @@ You can enrich the search results by using the 'global' option; you must also sw
#(/resultbottomline)#
::
+
#{results}#
-
-
-
+
+#{line}#
+
+ #[name]#
+ |
+#{/line}#
+
#{/results}#
+
#(/type)#
diff --git a/htroot/yacysearch.java b/htroot/yacysearch.java
index 211a7104f..58bac30fa 100644
--- a/htroot/yacysearch.java
+++ b/htroot/yacysearch.java
@@ -314,21 +314,32 @@ public class yacysearch {
}
- if ((post.get("cat", "href").equals("image")) && (querystring.startsWith("http://"))) {
+ if (post.get("cat", "href").equals("image")) {
int depth = post.getInt("depth", 0);
+ int columns = post.getInt("columns", 6);
URL url = null;
- try {url = new URL(querystring);} catch (MalformedURLException e) {}
+ try {url = new URL(post.get("url", ""));} catch (MalformedURLException e) {}
plasmaSearchImages si = new plasmaSearchImages(sb.snippetCache, 6000, url, depth);
Iterator i = si.entries();
htmlFilterImageEntry ie;
- int c = 0;
+ int line = 0;
while (i.hasNext()) {
- ie = (htmlFilterImageEntry) i.next();
- prop.put("type_results_" + c + "_url", ie.url().toString());
- c++;
+ int col = 0;
+ for (col = 0; col < columns; col++) {
+ if (!i.hasNext()) break;
+ ie = (htmlFilterImageEntry) i.next();
+ String urls = ie.url().toString();
+ String name = "";
+ int p = urls.lastIndexOf('/');
+ if (p > 0) name = urls.substring(p + 1);
+ prop.put("type_results_" + line + "_line_" + col + "_url", urls);
+ prop.put("type_results_" + line + "_line_" + col + "_name", name);
+ }
+ prop.put("type_results_" + line + "_line", col);
+ line++;
}
- prop.put("type_results", c);
+ prop.put("type_results", line);
prop.put("cat", "image");
prop.put("type", 1); // set type of result: image list
diff --git a/source/de/anomic/plasma/plasmaSearchImages.java b/source/de/anomic/plasma/plasmaSearchImages.java
index a5023f5fa..539c720bb 100644
--- a/source/de/anomic/plasma/plasmaSearchImages.java
+++ b/source/de/anomic/plasma/plasmaSearchImages.java
@@ -64,7 +64,7 @@ public final class plasmaSearchImages {
plasmaParserDocument document = sc.parseDocument(url, res);
// add the image links
- this.addAll(document.getImages());
+ if (document != null) this.addAll(document.getImages());
// add also links from pages one step deeper, if depth > 0
if (depth > 0) {