second try of rev 4100 :). Tested in Iceweasel/Firefox 2.0.6, Konqueror 3.5.7, Opera 9.23 (all linux) and IE6-SP1 (wine)

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4102 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
fuchsi 2007-09-17 19:39:15 +00:00
parent 6b8faaadb6
commit 9524b9c16a
4 changed files with 64 additions and 33 deletions

28
htroot/env/base.css vendored
View File

@ -241,9 +241,37 @@ div.ProgressBar {
}
div.ProgressBarFill {
margin:0px;
padding:0px;
height:100%; /*not valid value for Netscape 8*/
}
#resCounter {
/* left part of the progress bar */
position: absolute;
left: 1em;
}
#resProgBar {
height: 1.5em;
margin: 1em auto;
position: relative; /* for "relative" absolute pos of children */
text-align: left;
width: 100%;
float: none;
}
#resNav {
/* right part of the progress bar */
position: absolute;
right: 1em;
}
#resProgFill {
position: absolute;
left: 0px;
top: 0px;
}
div.bookmarkList, div.Tags {
margin-top:1em;
}

View File

@ -1,7 +1,4 @@
function Progressbar(length, parent) {
// the description (displayed above the progressbar while loading the results), should be translated
var DESCRIPTION_STRING = "Loading results...";
// the number of steps of the bar
this.length = length;
// the current position, expressed in steps (so 100% = length)
@ -12,41 +9,46 @@ function Progressbar(length, parent) {
// use this function to display the progress, because it updates everything
this.step = function(count) {
if (this.position < this.length)
this.position += count;
// update the bar
this.percentage = this.position*(100/this.length);
this.fill.style.width = this.percentage + "%";
// if the end is reached, the bar is hidden/removed
if(this.position==this.length)
removeAllChildren(this.element);
if(this.position >= this.length) {
this.fill.style.visibility = "hidden";
}
}
// the actual progressbar
var bar = document.createElement("div");
bar.className = "ProgressBar";
bar.style.width = "100%";
bar.style.height = "20px";
bar.style.margin = "10px auto";
bar.style.textAlign = "left";
bar.id = "resProgBar";
bar.className ="ProgressBar";
// the actual bar
this.fill = document.createElement("div");
this.fill.id = "resProgFill";
this.fill.className = "ProgressBarFill";
this.fill.style.width = "0%"
bar.appendChild(this.fill);
// a description for the bar
var description = document.createTextNode(DESCRIPTION_STRING);
var textcontainer = document.createElement("strong");
textcontainer.appendChild(description);
// the container for the elements used by the Progressbar
this.element = document.createElement("div");
this.element.style.textAlign = "center";
// get hasLayout in IE, needed because of the percentage as width of the bar
this.element.className = "gainlayout";
this.element.appendChild(textcontainer);
// results counter inside progress bar
var resCounter = document.getElementById("resCounter");
resCounter.style.display = "inline";
bar.appendChild(resCounter);
// the result sites navigation
var resNav = document.getElementById("resNav");
resNav.style.display = "inline";
bar.appendChild(resNav);
this.element.appendChild(bar);
parent.appendChild(this.element);
}

View File

@ -99,8 +99,9 @@ document.getElementById("Enter").value = "search again - catch up more links";
::
<p>No Results. (length of search words must be at least 3 characters)</p>
::
<p><strong id="resultsOffset">#[offset]#</strong>-<strong id="itemscount">#[linkcount]#</strong> results from a total number of <strong id="totalcount">#[totalcount]#</strong> known#(globalresults)#.::, <strong id="globalcount">#[globalcount]#</strong> links from other YaCy peers.#(/globalresults)#<div id="results"></div></p>
<p>Search Result Pages: <span id="pagenav">#[pagenav]#</span></p>
<div id="results"></div>
<span id="resCounter" style="display: inline;"><strong id="resultsOffset">#[offset]#</strong>-<strong id="itemscount">#[linkcount]#</strong> results from a total number of <strong id="totalcount">#[totalcount]#</strong> known#(globalresults)#.::, <strong id="globalcount">#[globalcount]#</strong> links from other YaCy peers.#(/globalresults)#</span>
<span id="resNav" style="display: inline;">#[resnav]#</span>
::
<p>Searching the web with this peer is disabled for unauthorized users. Please <a href="Status.html?login=">log in</a> as administrator to use the search function</p>
#(/num-results)#

View File

@ -323,29 +323,29 @@ public class yacysearch {
prop.put("num-results_linkcount", 0);
// compose page navigation
StringBuffer pagenav = new StringBuffer();
StringBuffer resnav = new StringBuffer();
int thispage = offset / theQuery.displayResults();
if (thispage == 0) pagenav.append("&lt;&nbsp;"); else {
pagenav.append(navurla(thispage - 1, display, theQuery));
pagenav.append("<strong>&lt;</strong></a>&nbsp;");
if (thispage == 0) resnav.append("&lt;&nbsp;"); else {
resnav.append(navurla(thispage - 1, display, theQuery));
resnav.append("<strong>&lt;</strong></a>&nbsp;");
}
int numberofpages = Math.min(10, Math.min(thispage + 2, (theSearch.getGlobalCount() + theSearch.getLocalCount()) / theQuery.displayResults()));
for (int i = 0; i < numberofpages; i++) {
if (i == thispage) {
pagenav.append("<strong>");
pagenav.append(i + 1);
pagenav.append("</strong>&nbsp;");
resnav.append("<strong>");
resnav.append(i + 1);
resnav.append("</strong>&nbsp;");
} else {
pagenav.append(navurla(i, display, theQuery));
pagenav.append(i + 1);
pagenav.append("</a>&nbsp;");
resnav.append(navurla(i, display, theQuery));
resnav.append(i + 1);
resnav.append("</a>&nbsp;");
}
}
if (thispage >= numberofpages) pagenav.append("&gt;"); else {
pagenav.append(navurla(thispage + 1, display, theQuery));
pagenav.append("<strong>&gt;</strong></a>");
if (thispage >= numberofpages) resnav.append("&gt;"); else {
resnav.append(navurla(thispage + 1, display, theQuery));
resnav.append("<strong>&gt;</strong></a>");
}
prop.putASIS("num-results_pagenav", pagenav.toString());
prop.putASIS("num-results_resnav", resnav.toString());
// generate the search result lines; they will be produced by another servlet
for (int i = 0; i < theQuery.displayResults(); i++) {