I'll share my search script, but everyone is on their own! I'm using
javascript. This way you can search using only partial names and IP
addresses, and they are NOT case sensitive. The script supports 3 search
fields (NAME, IP ADDRESS, or LOCATION).
NOTE: I use WUG's "INFO2" field to represent device location. You can
change the LOCATION label used in the script to whatever you use "INFO2"
for. You can use multiple words or strings when searching by LOCATION.
When you get search results, you can either click on a device or you can
Right-Click on a device name. The will open a pop-up menu that lets you
TELNET, PING, TRACEROUTE, or DNS LOOKUP. These functions are contained in
the NetTools.asp file.
I have only tested the SearchForm.asp script with IE 5.5 and 6. Hope this
helps.
Scott Taylor
Westat, Inc.
-----Original Message-----
From: Anthony Franklin [mailto:[EMAIL PROTECTED]
Sent: Friday, May 28, 2004 11:01 AM
To: [EMAIL PROTECTED]
Subject: RE: [WhatsUp Forum] Search Script for asp pages
Answer: Ctrl+ f until you get a script written.
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Gamboa, Jose
Alfredo
Sent: Wednesday, May 19, 2004 7:55 AM
To: WhatsUp_Forum (E-mail)
Subject: [WhatsUp Forum] Search Script for asp pages
I have 160 maps being monitored on my whatsup server. We are trying to
incorporate some kind of a search function within the "TOPVIEW.asp"
page.
We have shied away from the standard web template that was provided by
Ipswich so that we can customize our own pages. Does anyone out there
have
some kind of search script written?
Thanks in advance,
Alfredo
J. Alfredo Gamboa
ICT - Network Infrastructure
Dufferin-Peel Catholic District School Board
Voice: (905)-890-0708 ext:4177
Mobile: (905)-601-2955
Fax: (905)-890-3979
Toll Free: 1-800-387-9501
E-Mail: [EMAIL PROTECTED]
"Ordinary people believe only in the possible. Extraordinary
people visualize not what is possible or probable, but rather what is
impossible. And by visualizing the impossible, they begin to see it as
possible."
-Cherie Carter-Scott (American Author, Speaker,)
Please visit http://www.ipswitch.com/support/mailing-lists.html
to be removed from this list.
An Archive of this list is available at:
http://www.mail-archive.com/whatsup_forum%40list.ipswitch.com/
Please visit http://www.ipswitch.com/support/mailing-lists.html
to be removed from this list.
An Archive of this list is available at:
http://www.mail-archive.com/whatsup_forum%40list.ipswitch.com/
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- SearchForm.asp 02-04-2004 by Scott Taylor
-------------------------------------------
some javascript is from DHTMLCentral.com
This script is used for searching WhatsUp.
Fields are not case sensitive. Partial
strings and IP addresses may be used.
The "Location Information" search field
is just a reference to "Info2" in WhatsUp.
Multiple words can be used in this field.
-->
<HTML>
<HEAD>
<META http-equiv="pragma" content="no-cache">
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<TITLE>Search For Devices In WhatsUp</TITLE>
<STYLE>
.borderimage{border:1px solid white; }
.initial2{font-weight:bold;background-color:lime; }
</STYLE>
<SCRIPT language="JavaScript1.2">
var highlightcolor="lightyellow"
var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1
var ns6=document.getElementById&&!document.all
var previous=''
var eventobj
var intended=/INPUT|TEXTAREA/
//Function to check whether element clicked is a form element
function checkel(which) {
if (which.style&&intended.test(which.tagName)){
if (ns6&&eventobj.nodeType==3)
eventobj=eventobj.parentNode.parentNode
return true
}
else
return false
}
//Function to highlight form element
function highlight(e) {
eventobj=ns6? e.target : event.srcElement
if (previous!=''){
if (checkel(previous))
previous.style.backgroundColor=''
previous=eventobj
if (checkel(eventobj))
eventobj.style.backgroundColor=highlightcolor
}
else{
if (checkel(eventobj))
eventobj.style.backgroundColor=highlightcolor
previous=eventobj
}
}
</SCRIPT>
</HEAD>
<BODY>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function searchByName(str1,str2,str3) {
var x=0;
if (str1 != "") {
upN1=str1.toUpperCase();
s=1;
}
else if (str2 != "") {
upN1=str2;
s=2;
}
else if (str3 != "") {
upN1=str3.toUpperCase();
loc=upN1.split(" ");
s=3;
}
else {
return false;
}
document.writeln("<STYLE>");
document.writeln("BODY { text-decoration:none; }");
document.writeln("A:link {text-decoration:none;color:blue;}");
document.writeln("A:visited {text-decoration:none;color:blue;}");
document.writeln("A:hover {color:red;border-style:none; }");
document.writeln(".TBL { width:100%;border;border-width:3px;border-style:solid
groove groove solid;border-color:f4fafc;background-color:f4fafc; }");
document.writeln(".DAT1 { width:28%;text-indent:21px; }");
document.writeln(".DAT2 { width:19%;text-indent:25px; }");
document.writeln(".DAT3 { width:25%;text-indent:23px; }");
document.writeln(".test{position:relative;width:75px;text-align:center;font:normal 9px
Arial;color:920000;top:-30px;left:87%;z-index:100;}");
document.writeln(".menuskin{position:absolute;width:135px;background-color:d4b68e;border:2px
outset a9acaf;font:normal 11px
Verdana;line-height:18px;z-index:100;visibility:hidden;}");
document.writeln(".menuskin
a{text-decoration:none;color:black;padding-left:10px;padding-right:4px;}");
document.writeln(".menuskin A:visited {color:black;}");
document.writeln("#mouseoverstyle{background-color:navy;border:1px inset
c8c8c8}");
document.writeln("#mouseoverstyle a{color:white;font:bold;}");
document.writeln("</STYLE>");
document.writeln("<SCRIPT LANGUAGE=\"JavaScript\">");
document.writeln("function n_over(cell)
{bdr=cell.style.borderColor;cell.style.borderColor='a03030';} function n_out(cell)
{cell.style.borderColor=bdr;}");
document.writeln("var
ie4=document.all&&navigator.userAgent.indexOf(\"Opera\")==-1;var
ns6=document.getElementById&&!document.all;var ctm=document.oncontextmenu;");
document.writeln("function showmenu(e,device,addr) {var evt = (e) ? e :
((window.event) ? event : null);");
document.writeln("if (evt.button==2||evt.button==3) {document.oncontextmenu =
function() { return false; }}");
document.writeln("else {document.oncontextmenu = ctm;return;}");
document.writeln("pmenu='<div class=\"menuitems\"><a
href=\"telnet://'+addr+'\">Telnet To Device</a></div><hr>';");
document.writeln("pmenu+='<div class=\"menuitems\"><a
href=\"nettools.asp?Action=Ping&Device='+device+'&Address='+addr+'\"
target=\"_blank\">Ping Device</a></div>';");
document.writeln("pmenu+='<div class=\"menuitems\"><a
href=\"nettools.asp?Action=Trace&Device='+device+'&Address='+addr+'\"
target=\"_blank\">Trace Route</a></div>';");
document.writeln("pmenu+='<div class=\"menuitems\"><a
href=\"nettools.asp?Action=Lookup&Device='+device+'&Address='+addr+'\"
target=\"_blank\">DNS Lookup</a></div>';");
document.writeln("clearhidemenu();menuobj=ie4? document.all.popmenu : ns6?
document.getElementById(\"popmenu\") : \"\"");
document.writeln("menuobj.thestyle=menuobj.style;menuobj.innerHTML=pmenu;menuobj.contentwidth=menuobj.offsetWidth;menuobj.contentheight=menuobj.offsetHeight;eventX=evt.clientX;eventY=evt.clientY;");
document.writeln("rightedge=ie4? document.body.clientWidth-eventX :
window.innerWidth-eventX");
document.writeln("bottomedge=ie4? document.body.clientHeight-eventY :
window.innerHeight-eventY");
document.writeln("if (rightedge<menuobj.contentwidth)
{menuobj.thestyle.left=ie4? document.body.scrollLeft+eventX-menuobj.contentwidth :
ns6? window.pageXOffset+eventX-menuobj.contentwidth : eventX-menuobj.contentwidth}");
document.writeln("else {menuobj.thestyle.left=ie4?
document.body.scrollLeft+eventX : ns6? window.pageXOffset+eventX : eventX}");
document.writeln("if (bottomedge<menuobj.contentheight)
{menuobj.thestyle.top=ie4? document.body.scrollTop+eventY-menuobj.contentheight : ns6?
window.pageYOffset+eventY-menuobj.contentheight : eventY-menuobj.contentheight}");
document.writeln("else {menuobj.thestyle.top=ie4?
document.body.scrollTop+event.clientY+2 : ns6? window.pageYOffset+eventY+2 :
eventY+2}");
document.writeln("menuobj.thestyle.visibility=\"visible\";return false;}");
document.writeln("function contains_ns6(a, b) {while (b.parentNode) {if ((b =
b.parentNode) == a) {return true;}} return false;}");
document.writeln("function hidemenu() {if (window.menuobj)
{menuobj.thestyle.visibility=\"hidden\";document.oncontextmenu = ctm;}}");
document.writeln("function dynamichide(e) {if
(ie4&&!menuobj.contains(e.toElement)) {hidemenu();}");
document.writeln("else if (ns6&&e.currentTarget!= e.relatedTarget&&
!contains_ns6(e.currentTarget, e.relatedTarget)) {hidemenu();}}");
document.writeln("function delayhidemenu()
{delayhide=setTimeout(\"hidemenu()\",350);}");
document.writeln("function clearhidemenu() {if (window.delayhide)
{clearTimeout(delayhide);}}");
document.writeln("function highlightmenu(e,state) {if (document.all)
{source_el=event.srcElement;} else if (document.getElementById)
{source_el=e.target;}");
document.writeln("if (source_el.className==\"menuitems\")
{source_el.id=(state==\"on\")? \"mouseoverstyle\" : \"\"}");
document.writeln("else {while(source_el.id!=\"popmenu\")
{source_el=document.getElementById? source_el.parentNode : source_el.parentElement");
document.writeln("if (source_el.className==\"menuitems\")
{source_el.id=(state==\"on\")? \"mouseoverstyle\" : \"\"}}}}
document.onclick=hidemenu;");
document.writeln("</SCRIPT>");
document.writeln("<table border=1 width=96% cellspacing=0 cellpadding=2
bgcolor=c0c0c0><tr><td>");
document.writeln("<table border=1 width=100% cellspacing=0 cellpadding=1
bgcolor=c0c0c0><tr>");
document.writeln("<th align=center bgcolor=0099ff colspan=4><table border=0
padding=3 width=100%><tr>");
document.writeln("<td align=center><font size=5><b>WhatsUp Device Search
Results</b></font></td></tr></table></th></tr></table><SPAN class='test'>Rt click a
device name for menu</SPAN><br>");
document.writeln("<table border=1 width=100% cellpadding=1
bgcolor=ffffff><tr>");
document.writeln("<td width=28% valign=top align=center><B>Device Name
</B>");
document.writeln("<td width=28% valign=top align=center><B>Location /
Cabinet </B>");
document.writeln("<td width=19% valign=top align=center><B>IP Address
</B>");
document.writeln("<td width=25% valign=top align=center><B>Device Type
</B></table><tr><td>");
<%START_LOADED_MAP_LIST%>
<%START_DEVICE_LIST%>
<%IFNOT% (%MATCH% (%DEVICE% HOST_TYPE,"Subnet"))>
<%IFNOT% (%MATCH% (%DEVICE% HOST_TYPE,"Container"))>
map="<%URL_ENCODE% (%MAP% FILENAME)>";
uid="<%DEVICE% UNIQUE_ID>";
dev="<%DEVICE% DISPLAY_NAME>";
dev=dev.toUpperCase();
adr="<%DEVICE% IP_ADDRESS>";
nf2="<%DEVICE% INFO_LINE_2>";
if (s == 1) {
chk=dev.indexOf(upN1);
}
else if (s == 2) {
chk=adr.indexOf(upN1);
}
else if (s == 3) {
upN2=nf2.toUpperCase();
for (l=0;l<loc.length;l++) {
chk=upN2.indexOf(loc[l]);
if (chk == -1) {l=9;}
}
}
if (chk != -1) {
x++;
document.writeln("<table class=TBL
onMouseOver=\"n_over(this);\" onMouseOut=\"n_out(this);\"><tr>");
document.writeln("<td class=DAT1><a
href=\"device.asp?map="+map+"&device="+uid+"\"
onMousedown=\"showmenu(event,'"+dev+"','"+adr+"')\"
onMouseout=\"delayhidemenu()\"><b>"+dev+"</b></a>");
document.writeln("<td class=DAT1><a
href=\"device.asp?map="+map+"&device="+uid+"\">"+nf2);
document.writeln("<td class=DAT2><a
href=\"device.asp?map="+map+"&device="+uid+"\">"+adr);
document.writeln("<td class=DAT3><a
href=\"device.asp?map="+map+"&device="+uid+"\"><%DEVICE% HOST_TYPE></table>");
}
<%ENDIF%>
<%ENDIF%>
<%END_DEVICE_LIST%>
<%END_LOADED_MAP_LIST%>
document.writeln("</table><div id=\"popmenu\" class=\"menuskin\"
onMouseover=\"clearhidemenu();highlightmenu(event,'on')\"
onMouseout=\"highlightmenu(event,'off');dynamichide(event)\"></div>");
if (x == 0) {
document.writeln("<P>A Match Could Not Be Found For " + upN1 +
"<P><P>");
return false;
}
return true;
}
// End -->
</SCRIPT>
<P>
<TABLE cellSpacing=0 cellPadding=3 bgColor=c0c0c0 border=2 align=center>
<TR>
<TH align=left bgColor=0080c0 colSpan=2>
<TABLE width="100%" cellSpacing=2 cellPadding=2 border=0>
<TR><TD align=center colSpan=2><FONT size=4><B>Search
For Devices In WhatsUp</B></FONT></TD></TR></TABLE></TH></TR>
<TR>
<TD vAlign=top width="98%">
<TABLE cellSpacing=1 cellPadding=4 width="100%" bgColor=c0c0c0
border=0>
<form name=search onSubmit="return
searchByName(this.DeviceName.value,this.IPAddress.value,this.Location.value);"
onKeyUp="highlight(event)" onClick="highlight(event)" onMouseOver="highlight(event)">
<TR>
<TD> </TD></TR>
<TR>
<TD> </TD><TD align=center vAlign=top><FONT size=2
color="midnightblue"><EM>Fill In Desired Query Field </EM></FONT></TD></TR>
<TR>
<TD>Device Name Search </TD>
<TD><INPUT maxLength=64 size=30 name=DeviceName value=""
onChange='document.search.IPAddress.value="";document.search.Location.value="";'"></TD></TR>
<TR>
<TD>IP Address Search </TD>
<TD><INPUT maxLength=64 size=30 name=IPAddress value=""
onChange='document.search.DeviceName.value="";document.search.Location.value="";'"></TD></TR>
<TR>
<TD>Location Information Search </TD>
<TD><INPUT maxLength=64 size=30 name=Location value=""
onChange='document.search.DeviceName.value="";document.search.IPAddress.value="";'></TD></TR>
<TR>
<TD> </TD>
<TD align=center><INPUT type=hidden value=end name=end>
<INPUT type=submit value=Submit></TD></TR></FORM>
</TABLE>
</BODY>
</HTML>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- NetTools.asp 02-07-2004 by Scott Taylor
----------------------------------------------
WhatsUp network tools containing preset values.
Used by the pop-up menu in SearchForm.asp
-->
<HTML>
<HEAD></HEAD>
<BODY>
<%IF% (%MATCH% ("Ping",%URL_VALUE% "Action"))>
<h2><FONT COLOR="midnightblue">Pinging Device <%URL_VALUE% Device>
(<%URL_VALUE% Address>) </FONT></h2>
<BR><P><pre>
<%NET_TOOLS% (PING,%URL_VALUE% Address,10)>
</pre></P>
<%ELSEIF% (%MATCH% ("Trace",%URL_VALUE% "Action"))>
<h2><FONT COLOR="midnightblue">Tracing Route To <%URL_VALUE% Device>
(<%URL_VALUE% Address>) </FONT></h2>
<BR><P><pre>
<%NET_TOOLS% (TRACE,%URL_VALUE% Address,32)>
</pre></P>
<%ELSEIF% (%MATCH% ("Lookup",%URL_VALUE% "Action"))>
<h2><FONT COLOR="midnightblue">Lookup Records For <%URL_VALUE% Device>
(<%URL_VALUE% Address>) </FONT></h2>
<BR><P><pre>
<%NET_TOOLS% (LOOKUP,%URL_VALUE% Address,ALL,(stack))>
</pre></P>
<%ENDIF%>
<BR><P><h3> <FONT
COLOR="midnightblue">* Task Completed *</FONT></h3></P>
</BODY></HTML>