small bugfixes for search result display and cache display

This commit is contained in:
Michael Christen 2011-12-10 01:35:38 +01:00
parent 2c1c0dfec2
commit 204c29f010
8 changed files with 26 additions and 25 deletions

View File

@ -14,15 +14,12 @@
</a>
<span>See the page info about the url.</span>
</div>
#(display)#
#%env/templates/simpleheader.template%#
::
#%env/templates/header.template%#
#%env/templates/submenuIndexControl.template%#
::
#(topmenu)#
#%env/templates/embeddedheader.template%#
#(/display)#
::
#%env/templates/simpleheader.template%#
#(/topmenu)#
<h2>View URL Content</h2>
<form method="get" action="ViewFile.html" accept-charset="ascii">

View File

@ -76,10 +76,9 @@ public class ViewFile {
final serverObjects prop = new serverObjects();
final Switchboard sb = (Switchboard)env;
prop.put("topmenu", sb.getConfigBool("publicTopmenu", true) ? 1 : 0);
if (post == null) {
prop.put("display", 1);
prop.put("error_display", 0);
prop.putHTML("error_words", "");
prop.put("error_vMode-sentences", "1");
prop.put("error", "1");
@ -88,8 +87,6 @@ public class ViewFile {
return prop;
}
final int display = post.getInt("display", 1);
// get segment
Segment indexSegment = null;
final boolean authorized = sb.verifyAuthentication(header);
@ -99,9 +96,6 @@ public class ViewFile {
indexSegment = sb.indexSegments.segment(Segments.Process.PUBLIC);
}
prop.put("display", display);
prop.put("error_display", display);
if (post.containsKey("words"))
prop.putHTML("error_words", post.get("words"));
else {
@ -212,7 +206,9 @@ public class ViewFile {
} else if (viewMode.equals("iframeCache")) {
prop.put("viewMode", VIEW_MODE_AS_IFRAME_FROM_CACHE);
final String ext = url.getFileExtension();
if ("jpg.jpeg.png.gif".indexOf(ext) >= 0) {
prop.put("viewMode_png", 0);
prop.put("viewMode_html", 0);
if (ext.length() > 0 && "jpg.jpeg.png.gif".indexOf(ext) >= 0) {
prop.put("viewMode_png", 1);
prop.put("viewMode_png_url", url.toNormalform(false, true));
} else {

View File

@ -31,7 +31,7 @@ you can validate it with http://validator.w3.org/
<dt>Date</dt><dd property="dc:date">#[dc_date]#</dd>
<dt>Type</dt><dd property="dc:type">yacy:doctype:#[dc_type]#</dd>
<dt>YaCy Identifier</dt><dd property="dc:identifier">yacy:urlhash:#[yacy_urlhash]#</dd>
<dt>Identifier</dt><dd><a href="#[dc_identifier]# property="dc:identifier">#[dc_identifier]#</a></dd>
<dt>Identifier</dt><dd><a href="#[dc_identifier]#" property="dc:identifier">#[dc_identifier]#</a></dd>
<dt>Language</dt><dd property="dc:language">#[dc_language]#</dd>
<dt>Load Date</dt><dd property="yacy:loaddate">#[yacy_loaddate]#</dd>

View File

@ -29,7 +29,6 @@ import java.net.MalformedURLException;
import net.yacy.cora.date.ISO8601Formatter;
import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.UTF8;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.kelondro.data.meta.DigestURI;
import net.yacy.kelondro.data.meta.URIMetadataRow;
@ -103,7 +102,7 @@ public class yacydoc {
prop.putXML("dc_date", ISO8601Formatter.FORMATTER.format(entry.moddate()));
prop.putXML("dc_type", String.valueOf(entry.doctype()));
prop.putXML("dc_identifier", metadata.url().toNormalform(false, true));
prop.putXML("dc_language", UTF8.String(entry.language()));
prop.putXML("dc_language", ASCII.String(entry.language()));
prop.put("geo_lat", metadata.lat());
prop.put("geo_long", metadata.lon());

View File

@ -41,7 +41,6 @@
</script>
</head>
<body id="yacysearch">
<script type="text/javascript" src="/yacy/ui/js/jquery.autocomplete.yacy.js"></script>
<script type="text/javascript">
$(document).ready(function() {
@ -63,7 +62,6 @@
};
});
</script>
#(topmenu)#
#%env/templates/embeddedheader.template%#
::
@ -81,7 +79,6 @@ To see a list of all APIs, please visit the <a href="http://www.yacy-websuche.de
</div>
#%env/templates/simpleheader.template%#
#(/topmenu)#
<script type="text/javascript">
//<![CDATA[
$(function() {

View File

@ -26,8 +26,8 @@
<p class="urlinfo">
#(showDate)#::#[date]##(/showDate)#
#(showSize)#::&nbsp;|&nbsp;#[sizename]##(/showSize)#
#(showMetadata)#::&nbsp;|&nbsp;<a href="api/yacydoc.html?urlhash=#[urlhash]#" onclick="return hs.htmlExpand(this, { objectType: 'ajax'} )">Metadata</a>#(/showMetadata)#
#(showParser)#::&nbsp;|&nbsp;<a href="ViewFile.html?urlHash=#[urlhash]#&amp;words=#[words]#&amp">Parser</a>#(/showParser)#
#(showMetadata)#::&nbsp;|&nbsp;<a href="api/yacydoc.html?urlhash=#[urlhash]#" target="_blank" onclick="return hs.htmlExpand(this, { objectType: 'ajax'} )">Metadata</a>#(/showMetadata)#
#(showParser)#::&nbsp;|&nbsp;<a href="ViewFile.html?urlHash=#[urlhash]#&amp;words=#[words]#&amp" target="_blank">Parser</a>#(/showParser)#
#(showPictures)#::&nbsp;|&nbsp;<a href="yacysearch.html?cat=image&amp;url=#[link]#&amp;query=#[former]#">Pictures</a></p>#(/showPictures)#
</div>
::

View File

@ -694,6 +694,12 @@ public class MultiProtocolURI implements Serializable, Comparable<MultiProtocolU
return this.host;
}
public String getTLD() {
int p = this.host.lastIndexOf('.');
if (p < 0) return "";
return this.host.substring(p + 1);
}
public InetAddress getInetAddress() {
if (this.hostAddress != null) return this.hostAddress;
this.hostAddress = Domains.dnsResolve(this.host.toLowerCase());

View File

@ -427,7 +427,13 @@ public class URIMetadataRow implements URIMetadata {
}
public byte[] language() {
return this.entry.getColBytes(col_lang, true);
byte[] b = this.entry.getColBytes(col_lang, true);
if (b[0] == (byte)'[') {
String tld = this.metadata().url.getTLD();
if (tld.length() < 2 || tld.length() > 2) return ASCII.getBytes("en");
return ASCII.getBytes(tld);
}
return b;
}
public int size() {