(* Main index file *) maintainIndex := ( {wthmaxm, hthmaxm} = {400, 300}; Print["Creating main index file ..."]; xsizem1 = 400; (* Max width of pop-up thumbnail *) ysizem1 = 300; (* Max height of pop-up thumbnail *) height = 270; filesample = ToFileName[{dirwork, "templates"}, "index.htm"]; checkfile[filesample]; text = Import[filesample, "Text"]; spanRead[text]; spanNew["topline"] = toplinefix[spanOld["topline"]]; mushyears = Union[ryears]; (* Paginating to several year sets *) (*ryearsets = Prepend[Table[{y, y}, {y, 2016, ryearmax}], {2003, 2015}];*) ryearsets = Join[{{2003, 2015}, {2016, 2016}, {2017, 2017}, {2018, 2018}, {2019, 2021}}, Table[{y, y}, {y, 2022, ryearmax}] ]; Print["Year sets for thumbnails: ", ryearsets // TableForm]; (* Main body - giant photomontage - for each year set *) body = Table[ {ymin, ymax} = ryearset; title = label = ToString[ymin]; If[ymax != ymin, title = title <> " - " <> ToString[ymax]; title1 = "Years " <> title, title1 = "Year " <> title]; rmushpics = Select[rmushpictures, (ymin <= ToExpression[#[[1]]] <= ymax) &]; Print[" --- ", title1, ": Total of ", Length[rmushpics], " pictures of Russian mushrooms."]; set = rmushpics; mset = Length[set]; thsize = 50; columns = 20; columns = Min[columns, mset]; rows = Ceiling[Length[set]/columns]; dirmont = ToFileName[{dir0, "chron"}]; checkdir1[dirmont]; filemont = ToFileName[{dirmont}, "montage" <> label <> ".jpg"]; If[FileType[filemont] =!= File || ifRefreshMont === True, maintainMontage]; nborder = 1; montagewidth = columns (thsize + 2 nborder); montageheight = rows (thsize + 2 nborder); imgmap[ryearset] = { " label <> "\">", nf = 1; nrow = ncol = 1; Table[ xbr = (thsize + 2 nborder) ncol; ybr = (thsize + 2 nborder) nrow; x1 = ToString[xbr - thsize - nborder]; y1 = ToString[ybr - thsize - nborder]; x2 = ToString[xbr - nborder]; y2 = ToString[ybr - nborder]; nf++; ncol++; If[ncol > columns, ncol = ncol - columns; nrow++]; {y, roll, pic} = picture; mushroom = mushroomsonpicture[picture][[1]]; mushrooma = ToLowerCase[StringReplace[mushroom, " " -> "_"]]; href = "en/" <> mushrooma <> ".htm#r" <> roll <> "p" <> pic; psize = picsize[roll, pic]; {pw, ph} = psize; {sc1, sc2} = {wthmaxm, hthmaxm}/{pw, ph}; sc = Min[sc1, sc2]; {pw2, ph2} = Round[sc {pw, ph}]; {xm, ym} = ToString /@ {pw2, ph2}; imgtrail = "ONMOUSEOVER=\"showtrail('asergeev/pictures/archives/compress/" <> y <> "/" <> roll <> "/jpeg/" <> pic <> "m.jpg'," <> xm <> "," <> ym <> ");\" " <> "ONMOUSEOUT=\"hidetrail();\""; " x1 <> "," <> y1 <> "," <> x2 <> "," <> y2 <> "\" href=\"" <> href <> "\" " <> imgtrail <> ">", {picture, rmushpics}], "" } // StringJoin; "

" <> title1 <> "

label <> ".jpg\" ALT=\"Photomontage of pictures of mushrooms in Russia. " <> title1 <> "\" BORDER=\"0\" WIDTH=\"" <> ToString[montagewidth] <> "\" HEIGHT=\"" <> ToString[montageheight] <> "\" USEMAP=\"#montage" <> label <> "\">
", {ryearset, ryearsets}] // StringJoin; spanNew["yearpics"] = body; imagemap = Table[imgmap[ryearset], {ryearset, ryearsets}] // StringJoin; spanNew["imagemap"] = imagemap; epilog = StringReplace[epilog0, {"SCRIPTNAME" -> "index", "href=\"index.htm\"" -> "href=\"#\""}]; spanNew["epilog"] = epilog; text = spanReplace[text]; file = ToFileName[dir0, "index.htm"]; Export[file, text, "Text"]; (* ----------- The same for Russian language *) filesample = ToFileName[{dirwork, "templates"}, "index-ru.htm"]; checkfile[filesample]; text = Import[filesample, "Text"]; spanRead[text]; spanNew["topline"] = toplinefix[spanOld["topline"]]; (* Main body - giant photomontage - for each year set *) body = Table[ {ymin, ymax} = ryearset; title = label = ToString[ymin]; If[ymax != ymin, title = title <> " - " <> ToString[ymax]; title1 = "Годы " <> title, title1 = "Год " <> title]; rmushpics = Select[rmushpictures, (ymin <= ToExpression[#[[1]]] <= ymax) &]; Print[" --- ", title1, ": Total of ", Length[rmushpics], " pictures of Russian mushrooms."]; set = rmushpics; mset = Length[set]; thsize = 50; columns = 20; columns = Min[columns, mset]; rows = Ceiling[Length[set]/columns]; dirmont = ToFileName[{dir0, "chron"}]; checkdir1[dirmont]; filemont = ToFileName[{dirmont}, "montage" <> label <> ".jpg"]; (* Already done for English version! If[FileType[filemont] =!= File || ifRefreshMont === True, maintainMontage];*) nborder = 1; montagewidth = columns (thsize + 2 nborder); montageheight = rows (thsize + 2 nborder); imgmap[ryearset] = { " label <> "\">", nf = 1; nrow = ncol = 1; Table[ xbr = (thsize + 2 nborder) ncol; ybr = (thsize + 2 nborder) nrow; x1 = ToString[xbr - thsize - nborder]; y1 = ToString[ybr - thsize - nborder]; x2 = ToString[xbr - nborder]; y2 = ToString[ybr - nborder]; nf++; ncol++; If[ncol > columns, ncol = ncol - columns; nrow++]; {y, roll, pic} = picture; mushroom = mushroomsonpicture[picture][[1]]; mushrooma = ToLowerCase[StringReplace[mushroom, " " -> "_"]]; href = "ru/" <> mushrooma <> ".htm#r" <> roll <> "p" <> pic; psize = picsize[roll, pic]; {pw, ph} = psize; {sc1, sc2} = {wthmaxm, hthmaxm}/{pw, ph}; sc = Min[sc1, sc2]; {pw2, ph2} = Round[sc {pw, ph}]; {xm, ym} = ToString /@ {pw2, ph2}; imgtrail = "ONMOUSEOVER=\"showtrail('asergeev/pictures/archives/compress/" <> y <> "/" <> roll <> "/jpeg/" <> pic <> "m.jpg'," <> xm <> "," <> ym <> ");\" " <> "ONMOUSEOUT=\"hidetrail();\""; " x1 <> "," <> y1 <> "," <> x2 <> "," <> y2 <> "\" href=\"" <> href <> "\" " <> imgtrail <> ">", {picture, rmushpics}], "" } // StringJoin; "

" <> title1 <> "

label <> ".jpg\" ALT=\"Photomontage of pictures of mushrooms in Russia. " <> title1 <> "\" BORDER=\"0\" WIDTH=\"" <> ToString[montagewidth] <> "\" HEIGHT=\"" <> ToString[montageheight] <> "\" USEMAP=\"#montage" <> label <> "\">
", {ryearset, ryearsets}] // StringJoin; spanNew["yearpics"] = body; imagemap = Table[imgmap[ryearset], {ryearset, ryearsets}] // StringJoin; spanNew["imagemap"] = imagemap; epilog = StringReplace[epilogru0, {"SCRIPTNAME" -> "index-ru", "href=\"index-ru.htm\"" -> "href=\"#\""}]; spanNew["epilog"] = epilog; text = spanReplace[text]; file = ToFileName[dir0, "index-ru.htm"]; Export[file, text, "Text"]; );