;-
if not data_chk(htmlfiles,/string,/vector) then begin
message,/info,"IDL> html_linklist, htmlfiles [,giffiles, ...]"
return
endif
; ------- Verify that all files exist ----------
ifiles=htmlfiles
nfiles=n_elements(ifiles)
exist=where(file_exist(ifiles),ecnt)
if ecnt ne nfiles then begin
ifiles=http_names(ifiles) ; user entered URLS, not pathnames?
exist=where(file_exist(ifiles),ecnt)
if ecnt ne nfiles then begin
prstr,["Only found " + strtrim(ecnt,2) + " of " + strtrim(nfiles,2) + "files", $
"Returning with no action..."]
return
endif
endif
; -----------------------------------------------------
;
absnames=http_names(ifiles) ; full URLS
break_file,ifiles,ll,pp,ff,ee,vv
case 1 of
keyword_set(absolute):urls=absnames ; use absolute URLs
else: urls=ff+ee ; otherwise, relative
endcase
urls=str2html(urls,link=ff,/nopar) ; CURRENT->HTML
nexturl=shift(urls,-1) ; NEXT
lasturl=shift(urls,1) ; PREVIOUS
header=['Previous','Current','Next'] ; menu header
header=''+header+''
first=keyword_set(insert) ; user supplied insertion tag
d1='' ; default d1
d2='' ; default d2
prefix=data_chk(prehtml,/string)
for i=0,nfiles-1 do begin
urltable=[[header],[lasturl(i),urls(i),nexturl(i)]] ; Make the HTML table
html=strtab2html(urltable) ; (linked list)
html=['',html,''] ; center table
if prefix then html=[prefix,html] ; user xtra html
oldhtml=rd_tfile(ifiles(i)) ; existing html->
if first then $
newhtml=strarrinsert(oldhtml,[d1,html,d2],$ ; initial links
insert,/first,status=status) else $
newhtml=strarrinsert(oldhtml, html, $ ; subsquent links
d1,d2,status=status)
if status then file_append,ifiles(i),newhtml,/new ; html change?-> update
endfor
return
end