public CBoxText(GDMIndividualRecord ir) { FirstName = ""; Surname = ""; Concealed = (!ir.GetVisibility()); if (Concealed && !CConfig.Instance.UseWithheldNames) { FirstName = ""; Surname = Name = CConfig.Instance.ConcealedName; } else { var irName = ir.GetPrimaryFullName(); if (irName != "") { Name = CConfig.Instance.CapitaliseName(irName, ref FirstName, ref Surname); } else { FirstName = ""; Surname = Name = CConfig.Instance.UnknownName; } } if (Concealed) { Date = ""; } else { Date = ir.GetLifeDatesStr(); } }
// Creates link HTML for the individual e.g. <a href="indiI1.html">Next Child</a>. Uses name provided by caller. protected static string MakeLink(GDMIndividualRecord ir, string name) { string link; if (!ir.GetVisibility()) { // TODO: Why are we linking to invisible people? link = EscapeHTML(name, true); } else { link = string.Concat("<a href=\"", GetIndividualHTMLFilename(ir), "\">", EscapeHTML(name, false), "</a>"); } return(link); }
// Creates link HTML for the individual e.g. <a href="indiI1.html">Fred Bloggs</a> protected static string MakeLink(GDMIndividualRecord ir) { string name = ir.GetPrimaryFullName(); string dummy = ""; if (name == "") { name = CConfig.Instance.UnknownName; } else if (!ir.GetVisibility() && !CConfig.Instance.UseWithheldNames) { name = CConfig.Instance.ConcealedName; } else { name = CConfig.Instance.CapitaliseName(name, ref dummy, ref dummy); } return(MakeLink(ir, name)); }
// Returns true if the supplied record is valid for inclusion in the tree private static bool Exists(GDMIndividualRecord ir) { return(ir != null && ir.GetVisibility()); }
// The main method that causes the page to be created. public bool Create(Stats stats) { // Sanity check if (fSourceRecord == null) { return(false); } // Create the strings to use for the HTML file. string pageDescription = "GEDmill GEDCOM to HTML page for " + fSourceRecord.ShortTitle; string keywords = "family tree history " + fSourceRecord.ShortTitle; string filename = string.Concat(CConfig.Instance.OutputFolder, "\\sour", fSourceRecord.XRef); string fullFilename = string.Concat(filename, ".", CConfig.Instance.HtmlExtension); HTMLFile f = null; try { // Create a new file with an HTML header. f = new HTMLFile(fullFilename, fSourceRecord.ShortTitle, pageDescription, keywords); // Create a navbar to main site, front page etc. OutputPageHeader(f, "", "", true, true); f.WriteLine(" <div class=\"hr\" />"); f.WriteLine(""); f.WriteLine(" <div id=\"page\"> <!-- page -->"); // Write the page's title text. f.WriteLine(" <div id=\"main\">"); f.WriteLine(" <div id=\"summary\">"); f.WriteLine(" <div id=\"names\">"); string sourName = fSourceRecord.ShortTitle; if (sourName == "") { sourName = "Source "; bool gotSourceName = false; // Try user reference number foreach (GDMUserReference urn in fSourceRecord.UserReferences) { if (urn.StringValue != "") { sourName += urn.StringValue; gotSourceName = true; break; } } if (!gotSourceName && fSourceRecord.AutomatedRecordID != null && fSourceRecord.AutomatedRecordID != "") { sourName += fSourceRecord.AutomatedRecordID; } else if (!gotSourceName) { sourName += fSourceRecord.XRef; } } f.WriteLine("<h1>{0}</h1>", EscapeHTML(sourName, false)); // Add repository information foreach (GDMRepositoryCitation src in fSourceRecord.RepositoryCitations) { GDMRepositoryRecord rr = src.Value as GDMRepositoryRecord; if (rr != null) { if (!string.IsNullOrEmpty(rr.RepositoryName)) { f.WriteLine("<h2>{0}</h2>", EscapeHTML(rr.RepositoryName, false)); } foreach (GDMNotes ns in rr.Notes) { string noteText; if (CConfig.Instance.ObfuscateEmails) { noteText = ObfuscateEmail(ns.Lines.Text); } else { noteText = ns.Lines.Text; } f.WriteLine("<p>{0}</p>", EscapeHTML(noteText, false)); } } if (src.Notes != null && src.Notes.Count > 0) { foreach (GDMNotes ns in src.Notes) { string noteText; if (CConfig.Instance.ObfuscateEmails) { noteText = ObfuscateEmail(ns.Lines.Text); } else { noteText = ns.Lines.Text; } f.WriteLine("<p>{0}</p>", EscapeHTML(noteText, false)); } } } // Add Publication Information string pubFacts; if (CConfig.Instance.ObfuscateEmails) { pubFacts = ObfuscateEmail(fSourceRecord.Publication.Lines.Text); } else { pubFacts = fSourceRecord.Publication.Lines.Text; } if (!string.IsNullOrEmpty(pubFacts)) { if (pubFacts.Length > 7 && pubFacts.ToUpper().Substring(0, 7) == "HTTP://") { f.WriteLine("<h2><a href=\"{0}\">{1}</a></h2>", pubFacts, EscapeHTML(pubFacts, false)); } else { f.WriteLine("<h2>{0}</h2>", EscapeHTML(pubFacts, false)); } } f.WriteLine(" </div> <!-- names -->"); f.WriteLine(" </div> <!-- summary -->"); // Collect together multimedia links. if (CConfig.Instance.AllowMultimedia) { // Fill m_alMultimediaList: AddMultimedia(fSourceRecord.MultimediaLinks, string.Concat(fSourceRecord.XRef, "mms"), string.Concat(fSourceRecord.XRef, "mos"), CConfig.Instance.MaxSourceImageWidth, CConfig.Instance.MaxSourceImageHeight, stats); } // Add pics OutputMultimedia(f); // Add textFromSource string cleanText = fSourceRecord.Text.Lines.Text; if (CConfig.Instance.ObfuscateEmails) { cleanText = ObfuscateEmail(cleanText); } if (!string.IsNullOrEmpty(cleanText)) { f.WriteLine(" <div id=\"text\">"); f.WriteLine(" <h1>Text</h1>"); f.WriteLine(" <p class=\"pretext\">"); f.WriteLine(EscapeHTML(cleanText, false)); f.WriteLine(" </p>"); f.WriteLine(" </div> <!-- text -->"); } // Add notes OutputNotes(f, fSourceRecord.Notes); if (CConfig.Instance.SupressBackreferences == false) { f.WriteLine(" <div id=\"citations\">"); f.WriteLine(" <h1>Citations</h1>"); f.WriteLine(" <ul>"); var htBackrefs = fSourceRecord.MakeBackReferences(); IDictionaryEnumerator enumerator = htBackrefs.GetEnumerator(); while (enumerator.MoveNext()) { GDMIndividualRecord ir = (GDMIndividualRecord)(enumerator.Value); if (ir != null && ir.GetVisibility()) { string link = MakeLink(ir); if (link != "") { f.WriteLine("<li>{0}</li>", link); } } } f.WriteLine(" </ul>"); f.WriteLine(" </div> <!-- citations -->"); } f.WriteLine(" </div> <!-- main -->"); // Add footer (Record date, W3C sticker, GEDmill credit etc.) OutputFooter(f, fSourceRecord); f.WriteLine(" </div> <!-- page -->"); } catch (IOException e) { fLogger.WriteError("Caught IO Exception(6) : ", e); } catch (ArgumentException e) { fLogger.WriteError("Caught Argument Exception(6) : ", e); } finally { if (f != null) { f.Close(); // Adds standard footer to the file } } return(true); }