home *** CD-ROM | disk | FTP | other *** search
-
- {
- WebCenter HtmlResources helper script
- }
-
- const HTML_FILE='';//Path and name of result report file.
- //If empty defaults to nv_directory+'\Scripts\HTTP\DefaultHost\HtmlReport\index.html';
-
- const HtmlHead='<head>'#13#10
- '<title>NetView HtmlResources</title>'#13#10
- '<SCRIPT LANGUAGE="JavaScript">'#13#10
- 'function Toggle(node)'#13#10
- '{'#13#10
- 'var m_ToggleStyle = node.nextSibling.style.display;'#13#10
- 'm_ToggleStyle=(m_ToggleStyle==''none'')?''block'':''none'';'#13#10
- 'node.nextSibling.style.display = m_ToggleStyle;'#13#10
- '}'#13#10
- 'var ToggleStyle = ''block'';'#13#10
- 'function ToggleAll(node)'#13#10
- '{'#13#10
- 'ToggleStyle=(ToggleStyle==''none'')?''block'':''none'';'#13#10
- 'node=node.nextSibling.firstChild;'#13#10
- 'while(node)'#13#10
- ' {'#13#10
- ' node.firstChild.firstChild.firstChild.firstChild.nextSibling.nextSibling.nextSibling.style.display = ToggleStyle;'#13#10
- ' node=node.nextSibling;'#13#10
- ' }'#13#10
- '}'#13#10
- '</SCRIPT>'#13#10
- '</head>'#13#10;
-
-
- procedure WriteResourceList(f:integer;proto,img:string;var lst:TStringList);
- var i:integer;
- begin
- if lst.Count>0 then
- for i:=0 to lst.Count-1 do
- begin
- writefile(f,'<li> <a target="_blank" href="'+proto+lst.Strings[i]+'"> <IMG src="'+
- img+'">'+lst.Strings[i]+'</a><br>'#13#10);
- end;
- end;
-
- procedure GoReport;
- var hst:TNVHost;
- l_nb,l_ftp,l_hosts:TStringList;
- s_http,ts,fn,sdesc:string;
- n,i,f,nextid:integer;
- condel:boolean;
- begin
- if length(HTML_FILE)=0 then fn:=nv_directory+'\Scripts\HTTP\DefaultHost\HtmlResources\index.html'
- else fn:=HTML_FILE;
- CreateDirectory(ExtractFilePath(fn));
- f:=openfile(fn,11);
-
- writefile(f,'<html>'#13#10);
- writefile(f,HtmlHead);
- writefile(f,'<body text="#FFFFFF" bgcolor="#000000" link="#00FFFF" vlink="#00FFAA" alink="#00FFFF">'#13#10);
- writefile(f,'<p align=center><a href=/>Go to main page</a></p>'#13#10);
- writefile(f,'<H3><p align=center>Accessible resources tree generated by NetView on '+FormatDateTime(' YYYY-MM-DD HH:MM.SS',Now)+'</p></H3>'#13#10);
- writefile(f,'<table cellpadding=4 cellspacing=2>'#13#10'<tr><td>'#13#10
- '<a onclick="ToggleAll(this)" style=''cursor: hand; color:#CC0000; '+
- 'font-weight: bold''>Expand/collapse all</a><div style=''display:block''>');
-
- l_nb:=TStringList.Create;l_nb.CaseSensitive:=false;l_nb.Sorted:=true;
- l_ftp:=TStringList.Create;l_ftp.CaseSensitive:=false;l_ftp.Sorted:=true;
- l_hosts:=TStringList.Create;l_hosts.CaseSensitive:=false;l_hosts.Sorted:=true;
-
- nextid:=0;
- repeat
- condel:=true;
- hst:=TNVHost.create;
- hst.GetHost(nextid,0);
- if hst.id<>0 then
- begin
- nextid:=hst.nextid;
- if hst.GetMetaVar('ison')<>'off' then
- begin
- l_hosts.AddObject(hst.hname,hst);
- condel:=false;
- end;
- end else nextid:=0;
- if condel then hst.Free;
- until nextid=0;
-
-
- if l_hosts.Count<>0 then
- for n:=0 to l_hosts.Count-1 do
- begin
- hst:=TNVHost(l_hosts.Objects[n]);
- ts:=hst.GetMetaVar('!nbcache');
- if ts<>chr(1) then l_nb.Text:=ts else l_nb.Clear;
- ts:=hst.GetMetaVar('!ftpcache');
- if ts<>chr(1) then l_ftp.Text:=ts else l_ftp.Clear;
- ts:=hst.GetMetaVar('!httitle');
- if length(ts)>0 then
- begin
- if length(ts)>1 then delete(ts,1,1)
- else ts:='Possible HTTP server';
- end;
- s_http:=ts;
- if l_nb.Count<>0 then
- for i:=l_nb.Count-1 downto 0 do
- begin
- ts:=l_nb.Strings[i];
- if length(ts)=0 then l_nb.Delete(i) else
- if ts[length(ts)]='$' then l_nb.Delete(i);
- end;
-
- if (l_nb.Count<>0) or (l_ftp.Count<>0) or (length(s_http)<>0) then
- begin
- sdesc:=hst.GetMetaVar('sdesc');
- writefile(f,'<table cellpadding=4 cellspacing=2>'#13#10'<tr><td>'#13#10);
- writefile(f,'<IMG src="comp.gif"> <a onclick="Toggle(this)" style=''cursor: hand; color:#CC0000; font-weight: bold''>'
- +hst.hname+' - '+hst.hip);
- if length(sdesc)<>0 then writefile(f,' ('+sdesc+')');
- writefile(f,'</a><div style=''display:block''>'#13#10);
- writefile(f,'<table border=0>'#13#10'<tr><td>'#13#10'<ul class="li_main">'#13#10);
- if l_nb.Count<>0 then WriteResourceList(f,'file://'+hst.hip+'/','netbios.gif',l_nb);
- if l_ftp.Count<>0 then WriteResourceList(f,'ftp://'+hst.hip+'/','ftp.gif',l_ftp);
- if length(s_http)<>0 then
- begin
- writefile(f,'<li> <a target="_blank" href="http://'+hst.hip+'/"> <IMG src="'+
- 'http.gif">'+s_http+'</a><br>'#13#10);
- end;
-
- writefile(f,'</ul>'#13#10'</td></tr>'#13#10'</table>'#13#10'</div>'#13#10
- '</td></tr>'#13#10'</table>'#13#10);
- end;
- hst.Free;
- end;
-
- l_nb.Free;
- l_ftp.Free;
- l_hosts.Free;
- writefile(f,'</tr></td></table>'#13#10);
- 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><script language="JavaScript" src="/fade.js"></script></html>');
- CloseFile(f);
- end;
-
- var e,i1,i2:integer;
- begin
- GoReport;
- repeat
- e:=waitevent(i1,i2);
- if ( (e=NMNP_ACTION) and ((i1 and NVACTION_LIST)<>0) and
- ( ((i1 and NVACTION_RECHECK)<>0) or ((i1 and NVACTION_GETFROMFILE)<>0) or ((i1 and NVACTION_GETFROMNET)<>0) ) )
- or ( (e=NMNP_ALERT) and ((i1 and NVALERT_RESSCANER)<>0) ) then GoReport;
- until e=0;
- end.
-
-