Viewing contents of file '../idllib/deutsch/local/mk_local_help.pro'
pro mk_local_help,whichlib,list=list,no_mk_html_help=no_mk_html_help
;+
; NAME:
;   MK_LOCAL_HELP
; PURPOSE:
;   This program generates the large local help files (using RSI's
;   mk_html_help) for all installed software and also generates the master
;   index.html for the IDL page.
; CALLING SEQEUNCE:
;   mk_local_help 
; NOTES:
;   This program should be run on bluemoon (where all the IDL libraries
;   reside). 
;-


  IDL_MAIN='/host/bluemoon/usr2/idllib/'
  IDL_HTML_DIR='/scr/tmp/deutsch/'
  HEADER_FILE=IDL_MAIN+'deutsch/local/mk_local_help.header'
  FOOTER_FILE=IDL_MAIN+'deutsch/local/mk_local_help.footer'
  TITLE='UW Astronomy Top IDL Help Page'

  libdirs=[ $
           'astron/pro',"Astronomy User's Library", $
           'deutsch/misc','Deutsch Misc Library', $
           'deutsch/img','Deutsch IMG Library', $
           'deutsch/imgroam','Deutsch IMGroam Library', $
           'deutsch/apo','Deutsch APO Library',$
           'deutsch/local','Deutsch Local Library', $
           'idl_5.2/lib','RSI IDL 5.2 Procedures Library', $
           'contrib/windt','Windt Library', $
           'jhuapls1r/usr','JHU/APL/S1R usr Library', $
           'jhuapls1r/usr2','JHU/APL/S1R usr2 Library', $
           'jhuapls1r/doc','JHU/APL/S1R doc Library', $
           'astron/contrib/beck','Beck AstroContrib Library', $
           'astron/contrib/bhill','BHill AstroContrib Library', $
           'astron/contrib/freudenreich','Freudenreich AstroContrib Library', $
           'astron/contrib/knight','Knight AstroContrib Library', $
           'astron/contrib/landsman/allpro','Landsman AstroContrib Library', $
           'astron/contrib/malumuth','Malumuth AstroContrib Library', $
           'astron/contrib/markwardt','Markwardt AstroContrib Library', $
           'astron/contrib/offenberg','Offenberg AstroContrib Library', $
           'astron/contrib/varosi/code/allpro','Varosi code AstroContrib Library', $
           'astron/contrib/varosi/vlib/allpro','Varosi vlib AstroContrib Library', $
           'astron/contrib/varosi/vlibm/allpro','Varosi vlibm AstroContrib Library', $
           'contrib/meron','Meron Library', $
           'contrib/fanning','Fanning Example Programs', $
           'contrib/mallozzi','Mallozzi Library', $
           'contrib/markwardt','Markwardt Library', $
           'contrib/groupk','Group K Library', $
           'contrib/esrg_ucsb','ESRG UCSB Library', $
           'contrib/harris','Harris Library', $
           'contrib/buie','Lowell Buie Library', $
           'contrib/icur','ICUR Library', $
           'ssw/allpro','SolarSoft Library', $
           'contrib/atv','Aaron Barth''s ATV', $
           'contrib/tappin/graffer','Tappin''s Graffer', $
           'contrib/lamp','LAMP Library', $
           'sdss/allpro','SDSS Library', $
           'uit/pro','UIT Library', $
           'iuedac/iuelib/pro','IUE RDAF Library', $
           'user_contrib/creaso','Creaso Contrib Library', $
           'user_contrib/habbersett','Habbersett Contrib Library', $
           'user_contrib/hamill','Hamill Contrib Library', $
           'user_contrib/knight','Knight Contrib Library', $
           'ghrs/pro','GHRS Library', $
           '../rsi/idl_4/lib','IDL 4.0.1 Procedures Library', $
           '../rsi/idl_3.6/lib/ALL','IDL 3.6.1 Procedures Library' $
           ]

  if (n_elements(no_mk_html_help) eq 0) then no_mk_html_help=0

  if (n_elements(list) ne 0) then begin
    for i=0,n_elements(libdirs)-2,2 do begin
      print,i,'  ',libdirs(i),' ## ',libdirs(i+1)
      endfor
    return
    endif

  stlib=0 & enlib=n_elements(libdirs)-2
  if (n_elements(whichlib) ne 0) then begin
    stlib=whichlib & enlib=whichlib
    endif


  openw,outfil,IDL_HTML_DIR+'index.html',/get_lun
  openw,outidx,'dirindex.dat',/get_lun
  printf,outfil,'<!-- This file was generated by mk_local_help.pro -->'

  openr,hdrfil,HEADER_FILE,/get_lun
  lin=''
  while not EOF(hdrfil) do begin
    readf,hdrfil,lin
    printf,outfil,lin
    endwhile
  free_lun,hdrfil

  printf,outfil,'<H2>Locally-installed Libraries</H2>'
  printf,outfil,'This is the list of libraries which are installed locally.'
  printf,outfil,'Search through them with the form above, or browse through the'
  printf,outfil,'list below. <I>Please Note: </I> Most of these libraries are'
  printf,outfil,'written, maintained, and modified by other people in the'
  printf,outfil,'community.  This facility can only browse/search what I''ve installed'
  printf,outfil,'locally; in many cases, these libraries are <B>not the latest versions</B>'
  printf,outfil,'because I only update them when I can spare time.  If you see a library that is vastly'
  printf,outfil,'outdated, let me know and I''ll try to update it.<P>'
  dt=strmid(!stime,0,11)
  printf,outfil,'<I>This page last updated on '+dt+'</I><P>'
;  printf,outfil,'<B>This database is currently being updated and improved.  Please be patient during episodes of unavailability.</B><P>'
  printf,outfil,''
  printf,outfil,'<TABLE border cellpadding=6>'
  printf,outfil,'<TR> <TH> Library Name <TH> Updated here on <TH> Original Source of Library </TR>'

  for i=stlib,enlib,2 do begin
    ctr=i/2+1
    libname='library'+strn(ctr,len=2,padchar='0')+'.html'
    printf,outidx,strn(ctr,len=2,padchar='0')+' '+IDL_MAIN+libdirs(i)
    print,'Building html file for library in ',+libdirs(i)
    if (no_mk_html_help eq 0) then mk_html_help,IDL_MAIN+libdirs(i),IDL_HTML_DIR+libname,title=libdirs(i+1)
    lastmod='-'
    if (exist(IDL_MAIN+libdirs(i)+'/LAST_UPDATE')) then begin
      openr,5,IDL_MAIN+libdirs(i)+'/LAST_UPDATE'
      readf,5,lastmod
      close,5
      endif
    libsource='-'
    if (exist(IDL_MAIN+libdirs(i)+'/SOURCE_PAGE')) then begin
      openr,5,IDL_MAIN+libdirs(i)+'/SOURCE_PAGE'
      readf,5,libsource
      close,5
      endif
    if (strpos(libdirs(i),'deutsch') ne -1) then begin
      lastmod=strmid(dt,strpos(dt,'-')+1,3)+' '+strmid(dt,0,strpos(dt,'-'))+', '+ $
        strmid(dt,strpos(strmid(dt,3,99),'-')+3+1,4)
      endif
    tmpstr='<TR> <TD nowrap> <A HREF="s'+libname+'">'+libdirs(i+1)+'</A> <TD nowrap> '+strn(lastmod)
    if (strmid(libsource,0,4) eq 'http') then $
      tmpstr=tmpstr+' <TD> <A HREF="'+libsource+'">'+libsource+'</A> </TR>' $
    else if (strmid(libsource,0,3) eq 'ftp') then $
      tmpstr=tmpstr+' <TD> <A HREF="'+libsource+'">'+libsource+'</A> </TR>' $
    else tmpstr=tmpstr+' <TD> '+libsource+' </TR>'
    printf,outfil,tmpstr
    endfor

  printf,outfil,'</TABLE>'

  openr,hdrfil,FOOTER_FILE,/get_lun
  lin=''
  while not EOF(hdrfil) do begin
    readf,hdrfil,lin
    printf,outfil,lin
    endwhile
  free_lun,hdrfil

  free_lun,outfil
  free_lun,outidx
end