3
0
Fork 0

initial commit

This commit is contained in:
Willem Cazander 2022-11-13 14:46:54 +01:00
parent 5aeabf52d6
commit 5a6bd1d07b
148 changed files with 7509 additions and 0 deletions

View file

@ -0,0 +1,3 @@
Manifest-Version: 1.0
Class-Path:

View file

@ -0,0 +1,74 @@
<?xml version="1.0"?>
<Context path="/"
docBase="${catalina.home}/webapps/ROOT"
debug="5"
reloadable="true"
crossContext="true"
>
<Resource name="mail/Session"
auth="Container"
type="javax.mail.Session"
/>
<ResourceParams name="mail/Session">
<parameter>
<name>mail.smtp.host</name>
<value>localhost</value>
</parameter>
</ResourceParams>
<!--
<Resource name="jdbc/fsim_dba"
description="DB Connection for fsim"
scope="Shareable"
auth="Container"
type="com.mchange.v2.c3p0.ComboPooledDataSource"
maxPoolSize="4"
minPoolSize="2"
acquireIncrement="1"
driverClass="org.postgresql.Driver"
user="fsim"
password="fsim"
factory="org.apache.naming.factory.BeanFactory"
jdbcUrl="jdbc:postgresql://localhost/fsim"
/>
-->
<Resource name="jdbc/fsim_dba"
scope="Shareable"
type="javax.sql.DataSource"
auth="Container"
factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
accessToUnderlyingConnectionAllowed="false"
defaultAutoCommit="false"
defaultReadOnly="false"
defaultTransactionIsolation="READ_COMMITTED"
validationQuery="select 1"
testOnBorrow="true"
testOnReturn="false"
testWhileIdle="false"
initialSize="5"
minIdle="2"
maxIdle="10"
maxActive="20"
maxWait="6000"
removeAbandoned="true"
removeAbandonedTimeout="5"
logAbandoned="true"
timeBetweenEvictionRunsMillis="2000"
minEvictableIdleTimeMillis="20000"
numTestsPerEvictionRun="5"
driverClassName="org.postgresql.Driver"
username="fsim" password="fsim"
url="jdbc:postgresql://localhost/fsim"
/>
</Context>

View file

@ -0,0 +1,36 @@
fsim.title = FSIM: File Search Index Machine
fsim.logo.alt = fsim-logo
fsim.logo.title = FSIM Searcher
fsim.header.title = File Search
fsim.topbar.results = Results:
fsim.topbar.resultsin = found in:
fsim.topbar.inms = ms.
fsim.search.button = Search
fsim.bottombar.rendered = Rendered in:
fsim.bottombar.inms = ms.
fsim.copyright = <br/>Fsim is a product of idca.nl<br/>(c)2005 idca
fsim.tech.vcss.alt = Valid CSS
fsim.tech.vcss.title = This page has an valid css file.
fsim.tech.xhtml11.alt = Valid XHML 1.1
fsim.tech.xhtml11.title = This page is build with XHTML technolocy.
fsim.tech.debian.alt = debian-logo
fsim.tech.debian.title = This service runs on Debian.
fsim.tech.java.alt = java-logo
fsim.tech.java.title = This service is written in java.
fsim.tech.postgres.alt = postgresql-logo
fsim.tech.postgres.title= This service uses an PostgreSQL DB.
fsim.tech.linux.alt = linux-logo
fsim.tech.linux.title = The OS runs Linux.
fsim.tech.tomcat.alt = tomcat-logo
fsim.tech.tomcat.title = Tomcat 5 J2EE WebServer.
fsim.text = foo {0} bar

View file

@ -0,0 +1,9 @@
fsim.test = Mmmm dit is een test
fsim.copyright = Fsim is a product of idca.nl<br/>(c)2005 idca

View file

@ -0,0 +1 @@
logging-development.properties

View file

@ -0,0 +1,26 @@
#
# COPY THIS FILE TO: logging-development.properties
# and set the properties correctly
#
# Specify the handlers to create in the root logger
# (all loggers are children of the root logger)
# The following creates two handlers
handlers = java.util.logging.ConsoleHandler
# Set the default logging level for new ConsoleHandler instances
java.util.logging.ConsoleHandler.level = ALL
# Set the default formatter for new ConsoleHandler instances ( was java.util.logging.SimpleFormatter)
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
# Set the default logging level for the root logger
.level = INFO
#org.apache.tomcat.level = ALL
#org.apache.catalina.level = ALL
#org.apache.jasper.level = ALL
#org.apache.commons.level = ALL
#org.apache.myfaces.level = ALL
#org.hibernate.level = ALL
#com.opensymphony.oscache.level = ALL

View file

@ -0,0 +1,29 @@
#
# THIS ARE THE LIVE logging properties
# when the context parameter "DEVELOPMENT" on true is set
# then we will try to read logging-development.properties.
# this parameter should be set in web-override.xml
#
#
# Specify the handlers to create in the root logger
# (all loggers are children of the root logger)
# The following creates two handlers
handlers = java.util.logging.ConsoleHandler
# Set the default logging level for new ConsoleHandler instances
java.util.logging.ConsoleHandler.level = INFO
# Set the default formatter for new ConsoleHandler instances ( was java.util.logging.SimpleFormatter)
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
# Set the default logging level for the root logger
.level = INFO
#org.apache.tomcat.level = ALL
#org.apache.catalina.level = ALL
#org.apache.jasper.level = ALL
#org.apache.commons.level = ALL
#org.apache.myfaces.level = ALL
#org.hibernate.level = ALL
#com.opensymphony.oscache.level = ALL

92
WebRoot/WEB-INF/fsim.xml Normal file
View file

@ -0,0 +1,92 @@
<?xml version="1.0"?>
<fsimConfig name="WTH-SEARCH">
<pluginPage name="file_mirrors"
file="/fragments/searchers/files/file_mirrors.jsp"
/>
<pluginPage name="file_redirect"
file="/fragments/searchers/files/file_redirect.jsp"
/>
<pluginPage name="host_browse"
file="/fragments/searchers/files/host_browse.jsp"
/>
<pluginPage name="host_redirect"
file="/fragments/searchers/files/host_redirect.jsp"
/>
<pluginPage name="path_browse"
file="/fragments/searchers/files/path_browse.jsp"
/>
<pluginPage name="path_redirect"
file="/fragments/searchers/files/path_redirect.jsp"
/>
<!--
<database name="fsim_db"
driver="org.postgresql.Driver"
url="jdbc:postgresql://dbhost/fsim"
username="fsimdb"
password="bdmisf"
/>
-->
<listener class="com.idca.fsim.searchers.files.FilesListener"/>
<optionRenderer dataModel="com.idca.fsim.searchers.files.models.File"
optionRenderer="com.idca.fsim.searchers.files.renderers.options.FileDownloadOptionRenderer"
/>
<optionRenderer dataModel="com.idca.fsim.searchers.files.models.File"
optionRenderer="com.idca.fsim.searchers.files.renderers.options.FileDownloadOptionRenderer"
/>
<optionRenderer dataModel="com.idca.fsim.searchers.files.models.File"
optionRenderer="com.idca.fsim.searchers.files.renderers.options.FileDownloadOptionRenderer"
/>
<!-- this is really an DB saerchSource...maybe include others.(v2) -->
<searchSource name="fsim-files"
searchSource="com.idca.fsim.core.plugins.DBSearchSource"
dataModel="com.idca.fsim.searchers.generic.models.File"
indexer="com.idca.fsim.core.plugins.DBIndexer"
resultCollector="com.idca.fsim.searchers.files.collectors.FileResultCollector"
resultRenderer="com.idca.fsim.searchers.files.renderers.FileResultRenderer"
resultCacheResolver=""
dbName="fsim_dba"
tableName="file"
idColumnName="id"
searchColumnName="name"
>
<!--
<initParam name="DB_NAME" value="fsim_dba"/>
<initParam name="TABLE_NAME" value="fsim_file"/>
<initParam name="ID_COLUMN_NAME" value="file"/>
<initParam name="SEARCH_COLUMN_NAME" value="name"/>
<hitParamLong1 name="size"/>
<hitParamLong2 name="date"/>
-->
</searchSource>
<searchSource name="fsim-paths"
searchSource="com.idca.fsim.core.plugins.DBSearchSource"
dataModel="com.idca.fsim.searchers.generic.models.Path"
indexer="com.idca.fsim.core.plugins.DBIndexer"
dbName="fsim_dba"
tableName="path"
idColumnName="id"
searchColumnName="directory"
resultCollector="com.idca.fsim.searchers.files.collectors.PathResultCollector"
resultRenderer="com.idca.fsim.searchers.files.renderers.PathResultRenderer"
/>
<searchSource name="fsim-hosts"
searchSource="com.idca.fsim.core.plugins.DBSearchSource"
dataModel="com.idca.fsim.searchers.generic.models.Host"
indexer="com.idca.fsim.core.plugins.DBIndexer"
dbName="fsim_dba"
tableName="host"
idColumnName="id"
searchColumnName="hostname"
resultCollector="com.idca.fsim.searchers.files.collectors.HostResultCollector"
resultRenderer="com.idca.fsim.searchers.files.renderers.HostResultRenderer"
/>
</fsimConfig>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
WebRoot/WEB-INF/lib/dom.jar Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
WebRoot/WEB-INF/lib/sax.jar Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

175
WebRoot/WEB-INF/web.xml Normal file
View file

@ -0,0 +1,175 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<!--
Copyright 2004-2006 IDCA. All rights reserved.
IDCA PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
-->
<!--
=========== GENERAL CONFIG
-->
<display-name>FSIM</display-name>
<description>FSIM: File Search Index Machine</description>
<session-config>
<session-timeout>1</session-timeout>
<!-- An 1min session. -->
</session-config>
<welcome-file-list>
<!-- this file redirects to /search -->
<welcome-file>/index.jsp</welcome-file>
</welcome-file-list>
<context-param>
<description>The fsimcontext xml file</description>
<param-name>FSIM_CONFIG_FILE</param-name>
<param-value>/WEB-INF/fsim.xml</param-value>
</context-param>
<context-param>
<description>
All servlets / listeners and filters use
this context.
</description>
<param-name>FsimContextName</param-name>
<param-value>WTH-SEARCH</param-value>
</context-param>
<context-param>
<description>
The page when a host is blocked.
note: should be on other server ivm DDOS
</description>
<param-name>hostBlockedRedirectURL</param-name>
<param-value>/denied/host_blocked.jsp</param-value>
</context-param>
<!--
================== LISTENERS ========================
-->
<listener>
<listener-class>com.idca.fsim.core.FsimListener</listener-class>
<!-- Start fsim and loads config. -->
</listener>
<listener>
<listener-class>com.idca.fsim.core.indexer.IndexerManagerListener</listener-class>
<!-- Start fsim and loads config. -->
</listener>
<!--
======================== SERVLETS ======================
-->
<servlet>
<description>Fsim Search Servlet</description>
<display-name>Fsim Search Servlet</display-name>
<servlet-name>searchServlet</servlet-name>
<servlet-class>com.idca.fsim.web.SearchServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>searchServlet</servlet-name>
<url-pattern>/search</url-pattern>
</servlet-mapping>
<servlet>
<description>Fsim Admin Servlet</description>
<display-name>Fsim Admin Servlet</display-name>
<servlet-name>adminServlet</servlet-name>
<servlet-class>com.idca.fsim.web.AdminServlet</servlet-class>
<init-param>
<description>
When an hosts session is not an admin session then
hosty is blocked, time is increased with this value in minutes.
</description>
<param-name>hostBlockedNoAdminPeneltyTime</param-name>
<param-value>1</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>adminServlet</servlet-name>
<url-pattern>/admin</url-pattern>
</servlet-mapping>
<servlet>
<description>Fsim Redirect Servlet</description>
<display-name>Fsim Redirect Servlet</display-name>
<servlet-name>redirectServlet</servlet-name>
<servlet-class>com.idca.fsim.web.RedirectServlet</servlet-class>
<init-param>
<description>when click is done send to this url.</description>
<param-name>pluginPageRedirectURL</param-name>
<param-value>/ppage</param-value>
</init-param>
<init-param>
<description>blocked time im mins when parameter(s) is wrong</description>
<param-name>hostBlockedParameterPeneltyTime</param-name>
<param-value>0</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>redirectServlet</servlet-name>
<url-pattern>/redirect</url-pattern>
</servlet-mapping>
<servlet>
<description>Fsim Plugin Page Servlet</description>
<display-name>Fsim Plugin Page Servlet</display-name>
<servlet-name>pluginPageServlet</servlet-name>
<servlet-class>com.idca.fsim.web.PluginPageServlet</servlet-class>
<init-param>
<description>blocked time im mins when parameter(s) is wrong</description>
<param-name>hostBlockedParameterPeneltyTime</param-name>
<param-value>0</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>pluginPageServlet</servlet-name>
<url-pattern>/ppage</url-pattern>
</servlet-mapping>
<!--
===================== FILTERS =================================
-->
<!--
note: volgorde belangrijk !!
aangezien servlet andere resources include bv !!
en session of de aanwezig is !!
Na de SessionFilter is er altijd een session beschikbaar.
NU: request -> RequestLoggerFilter -> HostMonitoringFilter -> PagePathFilter -> SessionFilter -> AutenticationFilter -> RequestPerTimeFilter -> page(s)
-->
<filter>
<description>Manages user inlog/output</description>
<filter-name>authenticationFilter</filter-name>
<filter-class>com.idca.fsim.web.filters.AuthenticationFilter</filter-class>
<init-param>
<description>The page where a user comes when he logs out.</description>
<param-name>logoutRedirectURL</param-name>
<param-value>/search</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>authenticationFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>

View file

@ -0,0 +1,54 @@
/* ---- THIS STYLE SHEETS ONLY HANDLES STYLE CLASSES --- */
#top {
height: 100px;
}
#topLogo {
float: left;
width: 150px;
height: 95%;
}
#topSearchBox {
float: left;
width: 450px;
/*height: 95%;*/
}
#topFsimLinks {
float: right;
width: 15%;
height: 95%;
}
#topBar {
}
#results {
min-height: 100px;
}
#bottomBar {
}
#bottom {
}
#fsimKeywordsPopup {
position: absolute;
width: 365px;
left: 160px;
top: 68px;
visibility: hidden;
z-index: 1;
/* strange it wont do the class ??? */
font-size: 60%;
border-style: solid;
border-color: green;
border-width: 2px;
background-color:#C4D8FD;
}

View file

@ -0,0 +1,140 @@
/* ---- THIS STYLE SHEETS ONLY HANDLES STYLE CLASSES --- */
* {
margin: 0;
padding: 0;
font-family: arial,sans-serif;
}
body {
/* nice border around site */
margin: 5px;
}
img {
border: 0px;
}
/* makes div visable for devv */
/*
div,span {
border: 1px solid #f00;
margin: 1px;
}
*/
.top {
}
.topSearchBox {
padding-left: 5px;
padding-right: 5px;
}
.topOptions {
font-size: 12pt;
color: #aa6ea6;
}
.topBar {
background-color: #C4D8FD;
border-top-style: solid;
border-top-width: 1px;
border-top-color: #FE3061;
border-bottom-style:solid;
border-bottom-width:1px;
border-bottom-color:#B4C8DD;
}
.topBarSearchStats {
font-size: 90%;
text-align: right;
}
.topSearchBoxTitle {
text-align: center;
font-weight: bold;
}
.results {
width: 100%;
max-width: 100%;
}
.resultsURL {
font-size: 80%;
}
.resultsKeywordHighLight {
font-size: 120%;
color: #FE3061;
font-weight: bold;
}
.resultDetails {
font-size: 70%;
color: #018001;
}
.bottomBar {
background-color: #C4D8FD;
border-top-style: solid;
border-top-width: 1px;
border-top-color: #FE3061;
border-bottom-style:solid;
border-bottom-width:1px;
border-bottom-color:#FE3061;
padding: 2px;
}
.bottomBarPages {
text-align: center;
font-weight: bold;
}
.bottomBarRender {
font-size: 90%;
text-align: right;
}
.bottom {
}
.bottomCopy {
font-size: 66%;
text-align: center;
}
/* see the ID in layout this didn't work :? */
.fsimKeywordsPopup {
}
.fsimCompleteBinderNormal {
/* height: 14px; */
background-color: #C4D8FD;
}
.fsimCompleteBinderHighlight {
/* height: 14px; */
background-color: #FE3061;
}
.fsimCompleteWords {
width: 80%;
font-size: 90%;
/* float: left; */
}
.fsimCompleteHits {
/* float: right; */
width: 15%;
font-size: 10px;
color: #018001;
}

View file

@ -0,0 +1,54 @@
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>HOST BLOCKED</title>
</head>
<body>
<h1>HOST BLOCKED</h1>
<hr/>
<hr/>
<br/>
You IP: <c:out value="${param['ip']}"/> has been
<c:if test="${param['perm'] == null}">
<form>
<span style="color:red">temperaly blocked.</span><br/>
Time to unblock:&nbsp;&nbsp;<input type="textfield" name="time" disabled/>&nbsp;&nbsp;in ms.<br/>
<br/>
<br/>
</form>
</c:if>
<c:if test="${param['perm'] != null}">
You are <span style="color:red">permenent blocked.</span><br/>
<br/>
</c:if>
Please consult the IDCA crew howto unblock if u think its not your fault.<br/>
(Bring some cold drinks. ;-)<br/>
<br/>
<hr/>
<hr/>
<br/>
Last reason: <c:out value="${param['reason']}"/>
<br/>
<script type="text/javascript">
var time = <c:out value="${param['time']}"/>+30000;
var obj = document.forms[0].elements[0];
var timeInterval = 1795;
doTime();
function doTime()
{
time = time - timeInterval;
if(time>0)
{
obj.value = time;
setTimeout("doTime()",timeInterval);
return;
}
window.location='/search';
}
</script>
</body>
</html>

View file

@ -0,0 +1,19 @@
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Max users reached.</title>
</head>
<body>
<br/>
<hr/>
<br/>
Sorry, but our max concurrent users limit is rearched.<br/>
<br/>
Please try again in a 5 minutes.<br/>
<br/>
<hr/>
<br/>
</body>
</html>

View file

@ -0,0 +1,20 @@
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Real error encountered.</title>
</head>
<body>
<br/>
<hr/>
<br/>
Sorry, but there was een error.<br/>
<br/>
Please try again.<br/>
<a href="/search">FSIM</a>
<br/>
<hr/>
<br/>
</body>
</html>

View file

@ -0,0 +1,107 @@
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!-- START BOTTOM -->
</div>
<div id="bottomBar" class="bottomBar">&nbsp;
<c:if test="${drawPageResults == true}">
<div class="bottomBarPages">
<c:forEach var="page" items="${searchBean.pages}">
<a href="<c:url value="/search">
<c:param name="m" value="0"/>
<c:param name="p" value="${page}"/>
<c:param name="q" value="${searchBean.searchQuery}"/>
</c:url>"><c:out value="${page}"/></a>
&nbsp;
</c:forEach>
</div>
<div class="bottomBarRender">
<fmt:message key="fsim.bottombar.rendered" bundle="${fsim}"/>
<c:out value="${renderTime}"/>
<fmt:message key="fsim.bottombar.inms" bundle="${fsim}"/>
</div>
</c:if>
</div>
<div id="bottom" class="bottom">
<div class="bottomCopy">
<br/>
FSIM: Is a pluggable DataBae search engine.<br/>
Very customizable. To fit all needs.<br/>
<br/>
<fmt:message key="fsim.copyright" bundle="${fsim}"/>
</div>
</div>
<div id="debug">
</div>
<div id="tech" class="tech">
<a href="http://jigsaw.w3.org/css-validator/"
title="<fmt:message key="fsim.tech.vcss.title" bundle="${fsim}"/>"
>
<img src="http://jigsaw.w3.org/css-validator/images/vcss"
height="31"
width="88"
alt="<fmt:message key="fsim.tech.vcss.alt" bundle="${fsim}"/>"
/>
</a>
<a href="http://validator.w3.org/check?uri=referer"
title="<fmt:message key="fsim.tech.xhtml11.title" bundle="${fsim}"/>"
>
<img src="/images/tech/valid-xhtml11.png"
height="31"
width="88"
alt="<fmt:message key="fsim.tech.xhtml11.alt" bundle="${fsim}"/>"
/>
</a>
<a href="http://www.debian.org"
title="<fmt:message key="fsim.tech.debian.title" bundle="${fsim}"/>"
>
<img src="/images/tech/debian.gif"
alt="<fmt:message key="fsim.tech.debian.alt" bundle="${fsim}"/>"
/>
</a>
<a href="http://sun.java.com"
title="<fmt:message key="fsim.tech.java.title" bundle="${fsim}"/>"
>
<img src="/images/tech/duke.gif"
height="60"
width="60"
alt="<fmt:message key="fsim.tech.java.alt" bundle="${fsim}"/>"
/>
</a>
<a href="http://www.postgres.org"
title="<fmt:message key="fsim.tech.postgres.title" bundle="${fsim}"/>"
>
<img src="/images/tech/postgres.gif"
height="50"
width="50"
alt="<fmt:message key="fsim.tech.postgres.alt" bundle="${fsim}"/>"
/>
</a>
<a href="http://www.kernel.org"
title="<fmt:message key="fsim.tech.linux.title" bundle="${fsim}"/>"
>
<img src="/images/tech/tux.gif"
height="60"
width="60"
alt="<fmt:message key="fsim.tech.linux.alt" bundle="${fsim}"/>"
/>
</a>
<a href="http://jakarta.apache.org/tomcat/"
title="<fmt:message key="fsim.tech.tomcat.title" bundle="${fsim}"/>"
>
<img src="/images/tech/tomcat.gif"
height="50"
width="60"
alt="<fmt:message key="fsim.tech.tomcat.alt" bundle="${fsim}"/>"
/>
</a>
</div>
</body>
</html>

View file

@ -0,0 +1,51 @@
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<div class="fsimHttpHosts">
<br/>
<form action="/admin" method="POST">
IP: <input type="textfield" name="host_address"/>
Reason: <input type="textfield" name="host_reason"/>
<input type="submit" name="host_add" value="add"/>
<input type="hidden" name="m" value="1"/>
</form>
<br/>
<table border="1">
<thead>
<tr>
<td>IP</td>
<td>startDate</td>
<td>lastMessage</td>
<td>blocked</td>
<td>blockedTime</td>
<td>lastRequest</td>
<td>permenent</td>
</tr>
</thead>
<tbody>
<c:forEach var="host" items="${httpHosts}">
<tr>
<td><c:out value="${host.hostAddress}"/>
<form action="/admin" method="POST">
<input type="submit" name="host_monitoring_remove" value="remove"/>
<input type="hidden" name="m" value="1"/>
<input type="hidden" name="host_address" value="<c:out value="${host.hostAddress}"/>"/>
</form>
</td>
<td><c:out value="${host.monitoredStartDate}"/></td>
<td><c:out value="${host.lastMessage}"/></td>
<td><c:out value="${host.blocked}"/></td>
<td><c:out value="${host.blockedTime}"/></td>
<td><c:out value="${host.lastRequest}"/></td>
<td><c:out value="${host.permenent}"/>
<form action="/admin" method="POST">
<input type="submit" name="host_permanent_add" value="set permanent"/>
<input type="submit" name="host_permanent_remove" value="remove permanent"/>
<input type="hidden" name="m" value="1"/>
<input type="hidden" name="host_address" value="<c:out value="${host.hostAddress}"/>"/>
</form>
</td>
</tr>
</c:forEach>
</tbody>
</table>
</div>

View file

@ -0,0 +1,43 @@
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ page import="com.idca.fsim.web.session.SearchBean" %>
<%@ page import="java.util.Enumeration" %>
<div class="fsimSessions">
<table border="1">
<thead>
<tr>
<td width="15%">SESSIONID</td>
<td width="10%">created</td>
<td width="10%">last access</td>
<td>objects</td>
</tr>
</thead>
<tbody>
<c:forEach var="session2" items="${sessions}">
<tr>
<td><c:out value="${session2.id}"/></td>
<td><c:out value="${session2.creationTime}"/></td>
<td><c:out value="${session2.lastAccessedTime}"/></td>
<td>
<%
Enumeration sessionNames = session.getAttributeNames();
while (sessionNames.hasMoreElements()) {
String sessionName = (String)sessionNames.nextElement();
String className = session.getAttribute( sessionName ).getClass().getName();
out.println(sessionName+"("+className+")<br/>");
Object object = session.getAttribute(sessionName);
if(object instanceof SearchBean)
{
SearchBean sb = (SearchBean)object;
out.println("searched: "+sb.getSearchQuery()+"<br/>");
}
}
%>
</td>
</tr>
</c:forEach>
</tbody>
</table>
</div>

View file

@ -0,0 +1,48 @@
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<div class="fsimSessions">
<table border="1">
<thead>
<tr>
<td>name</td>
<td>table</td>
<td>search column</td>
<td>last index</td>
<td>hits</td>
<td>last id</id>
</tr>
</thead>
<tbody>
<c:forEach var="source" items="${sources}">
<tr>
<td>
<c:out value="${source.name}"/>
<form action="/admin" method="POST">
<input type="submit" name="source_index" value="index"/>
<input type="hidden" name="m" value="2"/>
<input type="hidden" name="source_name" value="<c:out value="${source.name}"/>"/>
</form>
</td>
<td><c:out value="${source.tableName}"/></td>
<td><c:out value="${source.searchColumnName}"/></td>
<td><c:out value="${source.lastIndexed}"/></td>
<td><c:out value="${source.hitsSize}"/></td>
<td><c:out value="${source.lastIndexedHitID}"/></td>
</tr>
</c:forEach>
</tbody>
</table>
<br/>
<br/>
Update path cache:
<form action="/admin" method="POST">
<input type="submit" name="path_update" value="path_update"/>
<input type="hidden" name="m" value="2"/>
</form>
<br/>
Dump wordLists info in log.
<form action="/admin" method="POST">
<input type="submit" name="wordlists_info" value="wordlists info"/>
<input type="hidden" name="m" value="2"/>
</form>
</div>

View file

@ -0,0 +1,137 @@
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Collection" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="java.net.URLEncoder" %>
<%@ page import="com.idca.fsim.core.plugins.SearchSource" %>
<fmt:setBundle basename="com.idca.fsim.resources.i18n.fsim" var="fsim" scope="request"/>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><fmt:message key="fsim.title" bundle="${fsim}"/></title>
<script type="text/javascript"
src="/js/fsim.js">
</script>
<link rel="stylesheet"
type="text/css"
href="/css/fsim-layout-default.css"
media="all"
/>
<link rel="stylesheet"
type="text/css"
href="/css/fsim-style-default.css"
media="screen"
/>
<meta http-equiv="Content-Type"
content="text/html; charset=UTF-8"
/>
<meta name="pagename"
content="FSIM: File Search Index Machine"
/>
<meta name="description"
content="File Search Indexing Machine"
/>
<meta name="keywords"
content="fsim,idca,search,searching,file,files,directory,path,browse,ftp"
/>
<meta name="robots"
content="all"
/>
<meta name="author"
content="http://www.idca.nl"
/>
</head>
<body onload="javascript:createAutoComplete();">
<div id="top">
<form action="/search" method="POST">
<div id="topLogo" class="toplogo">
<a href="/search"
title="<fmt:message key="fsim.logo.title" bundle="${fsim}"/>"
>
<img src="images/fsim.png"
alt="<fmt:message key="fsim.logo.alt" bundle="${fsim}"/>"
/>
</a>
</div>
<c:if test="${drawSearch == true}">
<div id="topSearchBox" class="topSearchBox">
<div class="topSearchBoxTitle"><br/><fmt:message key="fsim.header.title" bundle="${fsim}"/></div>
<div>
<input name="q"
id="q"
size="35"
autocomplete="off"
type="text"
value="<c:out value="${searchBean.searchQuery}"/>"/>
&nbsp;
<input type="submit"
value="<fmt:message key="fsim.search.button" bundle="${fsim}"/>"/>
<div id="fsimKeywordsPopup"></div>
</div>
</div>
<div id="topFsimLinks" class="topFsimLinks">
<br/>
Beta version.<br/>
<%
//<c:forEach var="source" items="${searchSources}">
Collection ss = (Collection)request.getAttribute("searchSources2");
Iterator i = ss.iterator();
while(i.hasNext())
{
request.setAttribute("source",i.next());
%>
<input type="checkbox"
name="<c:out value="${source.name}"/>"
onchange="this.form.submit();"
<%
String sss = (String)session.getAttribute("searchSources");
SearchSource ss1 = (SearchSource)request.getAttribute("source");
System.out.println("ssss: "+sss+" sdfsdf: " + ss1.getName());
if(sss.contains(ss1.getName())) {
out.print(" checked=\"true\" ");
}
%>
/>
<c:out value="${source.name}"/>
<br/>
<%
}
//</c:forEach>
%>
</div>
</c:if>
</div>
<c:if test="${admin == true}">
Welcome admin user&nbsp;
<a href="/admin?m=0">sessions</a>&nbsp;<a href="/admin?m=1">host monitoring</a>&nbsp;<a href="/admin?m=2">sources</a>
<br/>
</c:if>
<div id="topBar" class="topBar">&nbsp;
<c:if test="${drawPageResults == true}">
<div class="bottomBarPages">
<c:forEach var="page" items="${searchBean.pages}">
<a href="<c:url value="/search">
<c:param name="m" value="0"/>
<c:param name="p" value="${page}"/>
<c:param name="q" value="${searchBean.searchQuery}"/>
</c:url>"><c:out value="${page}"/></a>
&nbsp;
</c:forEach>
</div>
<div class="topBarSearchStats"><fmt:message key="fsim.topbar.results" bundle="${fsim}"/>
<c:out value='${resultSize}'/> <fmt:message key="fsim.topbar.resultsin" bundle="${fsim}"/>
<c:out value='${searchTime}'/> <fmt:message key="fsim.topbar.inms" bundle="${fsim}"/>
</div>
</c:if>
</div>
</form>
</div>
<div id="results">
<br/>
<!-- END TOP -->

View file

@ -0,0 +1,4 @@
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
SEE MIRROR LIST

View file

@ -0,0 +1,24 @@
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ page import="com.idca.fsim.searchers.files.models.File" %>
<%@ page import="com.idca.fsim.searchers.files.models.Path" %>
<%@ page import="java.net.URLEncoder" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%
File file = (File)session.getAttribute("model");
String url = file.getPath().getPath()+"/"+file.getName();
url = file.getPath().getHost().getProtocol()+file.getPath().getHost().getHostName()+url;//URLEncoder.encode(url, "UTF-8");
request.setAttribute("url",url);
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<META http-equiv=Refresh Content="0;URL=<c:out value="${url}"/>"/>
</head>
<body>
Going to path now.
</body>
</html>

View file

@ -0,0 +1,39 @@
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ page import="java.util.Collection" %>
<%@ page import="com.idca.fsim.searchers.files.models.Host" %>
<%@ page import="com.idca.fsim.searchers.files.FilesListener" %>
<%@ page import="com.idca.fsim.searchers.files.PathManager" %>
<%
Collection hosts = FilesListener.getPathManager().getHosts();
request.setAttribute("hosts",hosts);
%>
<table>
<thead>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
</thead>
<tbody>
<c:forEach var="host" items="${hosts}">
<tr>
<td>&gt; <c:out value="${host.hostname}"/></td>
<td>
<span class="resultDetails">
<%
Host host = (Host)request.getAttribute("host");
out.println(host.getRootPaths().size());
%>
</span>
</td>
<td>
<span class="resultDetails">
<c:out value="${host.lastScanned}"/>
</span>
</td>
</tr>
</c:forEach>
</tbody>
</table>

View file

@ -0,0 +1,19 @@
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ page import="com.idca.fsim.searchers.files.models.Host" %>
<%@ page import="java.net.URLEncoder" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%
Host host = (Host)session.getAttribute("model");
String url = host.getProtocol()+host.getHostName();
//url = URLEncoder.encode(url, "UTF-8");
request.setAttribute("url",url);
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<META http-equiv=Refresh Content="0;URL=<c:out value="${url}"/>"/>
</head>
<body>
Going to host now.
</body>
</html>

View file

@ -0,0 +1,150 @@
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Collection" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.net.URLEncoder" %>
<%@ page import="com.idca.fsim.searchers.files.models.Host" %>
<%@ page import="com.idca.fsim.searchers.files.models.File" %>
<%@ page import="com.idca.fsim.searchers.files.models.Path" %>
<%@ page import="com.idca.fsim.searchers.files.FilesListener" %>
<%
Object model = session.getAttribute("model");
Path path = null;
Host host = null;
Collection paths = null;
List files = null;
if(model instanceof File)
{
File file = (File)model;
path = file.getPath();
paths = path.getChilderen();
files = FilesListener.getPathManager().getFiles(path);
}
if(model instanceof Path)
{
path = (Path)model;
paths = path.getChilderen();
files = FilesListener.getPathManager().getFiles(path);
}
if(model instanceof Host)
{
host = (Host)model;
if (host.getRootPaths().iterator().hasNext()) {
paths = ((Path)(host.getRootPaths().iterator().next())).getChilderen();
files = FilesListener.getPathManager().getFiles(((Path)(host.getRootPaths().iterator().next())));
} else {
paths = new ArrayList();
files = new ArrayList();
}
}
request.setAttribute("paths",paths);
request.setAttribute("files",files);
%>
<table width="100%">
<thead>
<tr>
<td width="45%"></td>
<td width="25%"></td>
<td width="25%"></td>
</tr>
</thead>
<tbody>
<% if (path!=null && path.getParent()!=null) { %>
<tr>
<td><span class="resultDetails"><a href="<%
out.write("ppage?ss="+request.getParameter("ss")+"&rid="+path.getParent().getID()+"&up=path_browse");
%>">..</a></span></td>
<td><span class="resultDetails"></span></td>
<td><span class="resultDetails"></span></td>
</tr>
<% } %>
<% if (host!=null) {
%>
<tr>
<td><span class="resultDetails">/</span></td>
<td><span class="resultDetails">(root)</span></td>
<td><span class="resultDetails"></span></td>
</tr>
<% }
//<c:forEach var="path" items="${paths}">
Iterator p = paths.iterator();
while(p.hasNext())
{
Path pp = (Path)p.next();
request.setAttribute("path",pp);
%>
<tr>
<td>&gt; <a href="<c:out value="${path.path}"/>"><c:out value="${path.path}"/></a></td>
<td>
<span class="resultDetails">
<%
Path path2 = (Path)request.getAttribute("path");
//if(path2!=null) {
out.println(path2.getChilderen().size());
//} else {
// out.println("path2 null");
//}
%>
</span>
</td>
<td>
<span class="resultDetails">
<c:out value="${path.host.lastScanned}"/>
</span>
</td>
</tr>
<% }
//</c:forEach
//<c:forEach var="file" items="${files}">
Iterator f = files.iterator();
while(f.hasNext())
{
request.setAttribute("file",f.next());
File file = (File)request.getAttribute("file");
//redirect?ss="+hit.source.getName()+"&rid="+hit.id+"&up=path_browse"+"\">browse");
String url = "redirect/"+file.getPath()+file.getName();
url = file.getPath().getHost().getProtocol()+file.getPath().getHost().getHostName()+URLEncoder.encode(url, "UTF-8");
%>
<tr>
<td><span class="resultDetails"><a href="<%=url%>"><c:out value="${file.name}"/></a></span></td>
<td><span class="resultDetails">
<%
//File file = (File)request.getAttribute("file");
//if(file!=null) {
out.println(File.printSize(file));
//} else {
// out.println("file is null");
//}
%>
</span>
</td>
<td>
<span class="resultDetails">
</span>
</td>
</tr>
<%
}
//</c:forEach>
%>
</tbody>
</table>

View file

@ -0,0 +1,22 @@
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ page import="com.idca.fsim.searchers.files.models.File" %>
<%@ page import="com.idca.fsim.searchers.files.models.Path" %>
<%@ page import="java.net.URLEncoder" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%
Path path = (Path)session.getAttribute("model");
String url = path.getPath();
//url = URLEncoder.encode(url, "UTF-8");
request.setAttribute("url",path.getHost().getProtocol()+path.getHost().getHostName()+url);
//<jsp:useBean id="hit" class="com.idca.fsim.models.Hit" scope="session"/>
//<jsp:useBean id="model" class="com.idca.fsim.searchers.files.models.Path" scope="session"/>
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<META http-equiv=Refresh Content="0;URL=<c:out value="${url}"/>"/>
</head>
<body>
Downloading file now.
</body>
</html>

BIN
WebRoot/images/fsim.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

View file

@ -0,0 +1,47 @@
K 25
svn:wc:ra_dav:version-url
V 56
/svn/idca/!svn/ver/3/fsim/trunk/fsim/WebRoot/images/tech
END
duke.gif
K 25
svn:wc:ra_dav:version-url
V 65
/svn/idca/!svn/ver/3/fsim/trunk/fsim/WebRoot/images/tech/duke.gif
END
vcss.png
K 25
svn:wc:ra_dav:version-url
V 65
/svn/idca/!svn/ver/3/fsim/trunk/fsim/WebRoot/images/tech/vcss.png
END
tomcat.gif
K 25
svn:wc:ra_dav:version-url
V 67
/svn/idca/!svn/ver/3/fsim/trunk/fsim/WebRoot/images/tech/tomcat.gif
END
debian.gif
K 25
svn:wc:ra_dav:version-url
V 67
/svn/idca/!svn/ver/3/fsim/trunk/fsim/WebRoot/images/tech/debian.gif
END
tux.gif
K 25
svn:wc:ra_dav:version-url
V 64
/svn/idca/!svn/ver/3/fsim/trunk/fsim/WebRoot/images/tech/tux.gif
END
valid-xhtml11.png
K 25
svn:wc:ra_dav:version-url
V 74
/svn/idca/!svn/ver/3/fsim/trunk/fsim/WebRoot/images/tech/valid-xhtml11.png
END
postgres.gif
K 25
svn:wc:ra_dav:version-url
V 69
/svn/idca/!svn/ver/3/fsim/trunk/fsim/WebRoot/images/tech/postgres.gif
END

View file

@ -0,0 +1,266 @@
9
dir
115
https://decaid.idca.nl/svn/idca/fsim/trunk/fsim/WebRoot/images/tech
https://decaid.idca.nl/svn/idca
2005-08-08T22:22:39.000000Z
3
willemc
svn:special svn:externals svn:needs-lock
623d4b01-600f-0410-8ed7-89934cd2f745
debian.gif
file
2009-08-11T18:38:40.000000Z
8ff7f09386f6937371ff2e31e3bf5a7e
2005-08-08T22:22:39.000000Z
3
willemc
has-props
2596
duke.gif
file
2009-08-11T18:38:40.000000Z
70263cae8e43a375c7f260b6d731b7ce
2005-08-08T22:22:39.000000Z
3
willemc
has-props
6310
postgres.gif
file
2009-08-11T18:38:40.000000Z
3bdb0172fbc3e28067700488f4a8a1a0
2005-08-08T22:22:39.000000Z
3
willemc
has-props
9296
tomcat.gif
file
2009-08-11T18:38:40.000000Z
b8ebd781db53b856efa8e873fa4d2f6e
2005-08-08T22:22:39.000000Z
3
willemc
has-props
1934
tux.gif
file
2009-08-11T18:38:39.000000Z
e5b3348e57a2212dfac480d21074fa4c
2005-08-08T22:22:39.000000Z
3
willemc
has-props
4972
valid-xhtml11.png
file
2009-08-11T18:38:40.000000Z
6b1146d15bc3a499567953020fd14204
2005-08-08T22:22:39.000000Z
3
willemc
has-props
1917
vcss.png
file
2009-08-11T18:38:39.000000Z
35986567c8c46ef7fe2fd6f769f8eab3
2005-08-08T22:22:39.000000Z
3
willemc
has-props
1134

View file

@ -0,0 +1 @@
9

View file

@ -0,0 +1,5 @@
K 13
svn:mime-type
V 24
application/octet-stream
END

View file

@ -0,0 +1,5 @@
K 13
svn:mime-type
V 24
application/octet-stream
END

View file

@ -0,0 +1,5 @@
K 13
svn:mime-type
V 24
application/octet-stream
END

View file

@ -0,0 +1,5 @@
K 13
svn:mime-type
V 24
application/octet-stream
END

View file

@ -0,0 +1,5 @@
K 13
svn:mime-type
V 24
application/octet-stream
END

View file

@ -0,0 +1,5 @@
K 13
svn:mime-type
V 24
application/octet-stream
END

View file

@ -0,0 +1,5 @@
K 13
svn:mime-type
V 24
application/octet-stream
END

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
WebRoot/images/tech/tux.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

2
WebRoot/index.jsp Normal file
View file

@ -0,0 +1,2 @@
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:redirect url="/search"/>

253
WebRoot/js/fsim.js Normal file
View file

@ -0,0 +1,253 @@
//if(window.url.indexOf("divv")!=-1) {
// alert("turning on divv devv mode");
//div,span {
//border: 1px solid #f00;
//margin: 1px;
//}
//}
var IE = document.all?true:false;
var req = null;
if (!IE) {
document.captureEvents(Event.KEYBOARD);
}
// full autocomplete off AND XHTML compatible
for(i=0;i<document.forms.length;i++)void(document.forms[i].setAttribute('autocomplete', 'off'));
function debug(text) {
var divObject = document.getElementById('debug');
divObject.innerHTML = divObject.innerHTML+text+'<br/>';
}
function initRequest() {
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
} else if (window.ActiveXObject) {
IE = true;
req = new ActiveXObject("Microsoft.XMLHTTP");
}
}
function sendRequest(url,oDiv) {
if(req.readyState==1) {
// not while loading.
return;
}
req.table = oDiv;
req.onreadystatechange=callBack;
req.open("GET",url,true);
req.send(null);
}
function callBack()
{
// if xmlhttp shows "loaded"
if(req && req.readyState==4)
{
// if "OK"
if (req.status==200)
{
//alert("just got: "+xmlhttp.responseText);
//document.write(xmlhttp.responseText);
ac = req.table;
oDiv = ac.oDiv;
// clear the popup div.
while ( oDiv.hasChildNodes() )
{
oDiv.removeChild(oDiv.firstChild);
}
var items = req.responseXML.getElementsByTagName("item");
//alert("just got items:"+items);
var to = "";
for (loop = 0; loop < items.length; loop++)
{
var item = items.item(loop).firstChild.nodeValue;
var hits = items.item(loop).getAttribute('hits');
var oDivBinder = document.createElement('div');
oDivBinder.id = loop;
oDivBinder.className = 'fsimCompleteBinderNormal';
var oDivItem = document.createElement('div');
oDivItem.innerHTML = item;
oDivItem.className = 'fsimCompleteWords';
oDivBinder.onmousedown = AutoComplete.prototype.onDivMouseDown;
oDivBinder.onmouseover = AutoComplete.prototype.onDivMouseOver;
oDivBinder.onmouseout = AutoComplete.prototype.onDivMouseOut;
//var oSpanHits = document.createElement('div');
//oSpanHits.className = 'fsimCompleteHits';
//oSpanHits.innerHTML = 'hits: '+hits;
oDivBinder.appendChild(oDivItem);
//oDivBinder.appendChild(oSpanHits);
oDiv.AutoComplete = ac;
oDiv.appendChild(oDivBinder);
}
//alert("got: "+to);
oDiv.style.visibility = "visible";
//oDiv.stlyeClass = "pop";
oDiv.className = "pop";
}
else
{
alert("Problem retrieving XML data status:"+req.statusText);
}
}
}
function AutoComplete(url, oText, oDiv)
{
// initialize member variables
this.oText = oText; // the text box
this.oDiv = oDiv; // a hidden <div> for the popup auto-complete
this.url=url;
this.selectedItem = null;
this.preKeyword = "";
initRequest();
//if(IE) {
// turn of autocompletion in IE for this field !
oText.autocomplete = 'off';
//}
// attach handlers to the text-box
oText.AutoComplete = this;
oText.onkeyup = AutoComplete.prototype.onTextChange;
oText.onblur = AutoComplete.prototype.onTextBlur;
}
AutoComplete.prototype.onTextBlur = function()
{
this.AutoComplete.onblur();
}
AutoComplete.prototype.onblur = function()
{
this.oDiv.style.visibility = "hidden";
}
AutoComplete.prototype.onTextChange = function(e)
{
if(IE) {
var e = window.event;
}
//debug('keycode='+e.keyCode);
var keyCode = e.keyCode;
if(32 === keyCode) {
this.AutoComplete.preKeyword = this.AutoComplete.oText.value;
return;
}
if(40 === keyCode || 38 === keyCode) {
if(this.AutoComplete.selectedItem !== null) {
this.AutoComplete.selectedItem.className = "fsimCompleteBinderNormal";
var currentID = this.AutoComplete.selectedItem.id;
//debug("curID="+currentID);
}
var nextItem = null;
if(40 === keyCode) {
if(!currentID) {
var currentID = -1;
}
currentID++;
nextItem = this.AutoComplete.oDiv.childNodes.item(currentID);
nextItem.className = "fsimCompleteBinderHighlight";
this.AutoComplete.selectedItem = nextItem;
this.AutoComplete.oText.value = this.AutoComplete.preKeyword+nextItem.firstChild.innerHTML;
}
if(38 === keyCode) {
if(!currentID) {
var currentID = this.AutoComplete.oDiv.childNodes.lenght+1;
}
currentID--;
nextItem = this.AutoComplete.oDiv.childNodes.item(currentID);
nextItem.className = "fsimCompleteBinderHighlight";
this.AutoComplete.selectedItem = nextItem;
this.AutoComplete.oText.value = this.parentNode.AutoComplete.preKeyword+nextItem.firstChild.innerHTML;
}
} else {
this.AutoComplete.onchange();
}
}
AutoComplete.prototype.selectRange = function (iStart, iLength)
{
if (this.oText.createTextRange) {
var oRange = this.oText.createTextRange();
oRange.moveStart("character", iStart);
oRange.moveEnd("character", iLength - this.textbox.value.length);
oRange.select();
} else if (this.oText.setSelectionRange) {
this.oText.setSelectionRange(iStart, iLength);
}
this.oText.focus();
}
AutoComplete.prototype.onchange = function()
{
var txt = this.oText.value;
if(""!=txt) {
this.selectedItem = null;
sendRequest(this.url+txt,this);
} else {
// hide !
this.oDiv.style.visibility = "hidden";
this.oText.focus();
}
}
AutoComplete.prototype.onDivMouseDown = function()
{
this.parentNode.AutoComplete.oText.value = this.parentNode.AutoComplete.preKeyword+this.firstChild.innerHTML;
this.parentNode.AutoComplete.selectedItem = null;
}
AutoComplete.prototype.onDivMouseOver = function()
{
if(this.parentNode.AutoComplete.selectedItem !== null) {
this.parentNode.AutoComplete.selectedItem.className = "fsimCompleteBinderNormal";
}
this.className = 'fsimCompleteBinderHighlight';
this.parentNode.AutoComplete.selectedItem = this;
this.parentNode.AutoComplete.oText.value = this.parentNode.AutoComplete.preKeyword+this.firstChild.innerHTML;
}
AutoComplete.prototype.onDivMouseOut = function()
{
this.className = 'fsimCompleteBinderNormal';
}
function createAutoComplete()
{
new AutoComplete('/search?m=1&l=',
document.getElementById('q'),
document.getElementById('fsimKeywordsPopup'));
}