;+
;NAME:
;	go_mk_sum_head
;PURPOSE:
;	To make summary listings of images received
;HISTORY:
;	Written 1997 by M.Morrison
;	14-Apr-98 (MDM) - Gutted and replaced calls to GO_SUMMARY_HEAD with
;			  calls to TR_TAB_HEAD to work with post-launch files
;	07-Mar-06 (ZAF) - reworked perl command for index for Mac version
;-
;
if (n_elements(sttim) eq 0) then sttim = anytim2ints(ut_time(), off=-3*24*60.*60)
if (n_elements(entim) eq 0) then entim = ut_time()
if (n_elements(outdir) eq 0) then outdir = '/www/htdocs/TRACE/Operations/DataSum/head_sum'
;
pre = 'GO_MK_SUM_HEAD  Program Run ' + !stime
for iday=gt_day(sttim),gt_day(entim) do begin
    tr_rd_index, fmt_tim(iday), fmt_tim(iday+1), index, /struct
    if (data_type(index) eq 8) then begin
	tabfil = 'thead_tab_jake2.lst'
	page1head = 'thead_top_jake2.lst'
        tr_tab_head, index, out, tabfil, page1head=page1head, /quiet, pre=pre
    end else begin
	out = [pre, $
                        'No image data found from ' + fmt_tim(iday) + ' to ' + fmt_tim(iday+1)]
    end
    ;
    filnam = strmid(time2file( fmt_tim(iday) ), 0, 8) + '.head_sum'
    outfil = concat_dir(outdir, filnam)
    prstr, out, file=outfil
end
;
tit = '"TRACE Per Image Daily Tabular Listings"'
cmd = ['perl /tsw/bin/make_day_html.pl'+ ' -t '+ tit+' '+ outdir]
;spawn, cmd, result, /noshell
spawn, cmd, result
prstr, result, file=concat_dir(outdir, 'index.html')
;
;if (n_elements(date) eq 0) then date = anytim2ints(ut_time(), off=-2*24*60.*60)
;tim = anytim2ex(date)
;since = strmid( ex2fid(tim), 0, 6)
;go_summary_head, /all, since=since
;go_summary_head, /all, since=since, /seq
;
;setenv,'GSE_DATA_DIR3=/td22'
;go_summary_head, /all, since=since,        obasedir='/td10/summary_shawnee/'
;go_summary_head, /all, since=since, /seq,  obasedir='/td10/summary_shawnee/'
;
end
