home *** CD-ROM | disk | FTP | other *** search
Wrap
{ HTML report script v1.0 for NetView by KillerR Saves current hostlist state to an HTML file Saving occurs after every list recheck By the way you can use this script with NetView's HTTP server listener script in pair User defined constants: HTMLFILENAME - report file path and name. If you want to use this script with HTTP script you should set this const like '\Scripts\HTTP\index.html' or any other filename and set reference to it in index.html } const HTMLFILENAME='\Scripts\HTTP\index.html'; var e,i1,i2:integer; tabs:TStringList; procedure goreport; var fn,ts,lst,ctime:string; hst:tnvhost; i,f,flg:integer; dtm:TDateTime; begin hst:=tnvhost.create; fn:=nv_directory+HTMLFILENAME; f:=openfile(fn,11); dtm:=Now; tabs.clear; writefile(f,'<html><title>NetView hostlist</title><body>'); writefile(f,'<p align=center>Accessible resources list generated by NetView on '+FormatDateTime(' YYYY-MM-DD HH:MM.SS',dtm)+'</p>'); writefile(f,'<TABLE x:str align=center border=1 cellpadding=0 cellspacing=0 style=''border-collapse: collapse;table-layout:fixed''>'); writefile(f,'<TR bgcolor="#C0C0C0">'); writefile(f,'<td width=150><b>Hostname</b></td>'); writefile(f,'<td width=150><b>IP address</b></td>'); writefile(f,'<td width=150><b>Connection</b></td>'); writefile(f,'<td width=150><b>Workgroup</b></td>'); writefile(f,'</TR>'); hst.nextid:=0; repeat hst.gethost(hst.nextid,0); if(hst.id<>0)then begin flg:=strtoint(hst.getmetavar('flags')); lst:=hst.getmetavar('wgrp'); ctime:=hst.getmetavar('ctime'); if(flg and $200)=0 then begin if(hst.getmetavar('ison')='on')then ts:='<TR bgcolor="#E8F0F5">' else ts:='<TR>'; ts:=ts+'<td width=150><a href="file://'+hst.hname+'/" target="_blank">\\'+hst.hname+'</a></td>'; ts:=ts+'<td width=150><a href="file://'+hst.hip+'/" target="_blank">\\'+hst.hip+'</a></td>'; ts:=ts+'<td width=150>'+ctime+'</td>'; ts:=ts+'<td width=150>'+lst+'</td>'; ts:=ts+'</TR>'; tabs.add(lst+hst.hname+chr(13)+ts); end; if((flg and $400)<>0) or ((flg and $1000)<>0) then begin if(hst.getmetavar('ison')='on')then ts:='<TR bgcolor="#E8F0F5">' else ts:='<TR>'; ts:=ts+'<td width=150><a href="ftp://'+hst.hname+'" target="_blank">ftp://'+hst.hname+'</a></td>'; ts:=ts+'<td width=150><a href="ftp://'+hst.hip+'" target="_blank">ftp://'+hst.hip+'</a></td>'; ts:=ts+'<td width=150>'+ctime+'</td>'; ts:=ts+'<td width=150>'+lst+'</td>'; ts:=ts+'</TR>'; tabs.add(lst+hst.hname+chr(13)+ts); end; end; until hst.nextid=0; tabs.Sort; for i:=0 to tabs.count-1 do begin ts:=tabs.strings[i]; delete(ts,1,pos(chr(13),ts)); writefile(f,ts); end; writefile(f,'</TABLE>'); writefile(f,'<p align=center><a href=avilist.html> List of .avi files of all network</a></p>'); writefile(f,'<p align="center">Powered by NetView<br><img border="0" src="nvico.gif" width="64" height="64"><br><a href="http://www.killprog.com">http://www.killprog.com</a></p>'); writefile(f,'</body> </html>'); closefile(f); hst.free; end; begin tabs:=TStringList.Create; goreport; repeat e:=waitevent(i1,i2); if(e=NMNP_ACTION)then begin if((i1 and NVACTION_LIST)<>0) and (((i1 and NVACTION_RECHECK)<>0)or((i1 and NVACTION_GETFROMFILE)<>0)or((i1 and NVACTION_GETFROMNET)<>0)) then goreport; end; until e=0; tabs.Free; end.