Esempio n. 1
0
            public CBoxText(GDMIndividualRecord ir)
            {
                FirstName = "";
                Surname   = "";
                Concealed = (!GMHelper.GetVisibility(ir));
                if (Concealed && !CConfig.Instance.UseWithheldNames)
                {
                    FirstName = "";
                    Surname   = Name = CConfig.Instance.ConcealedName;
                }
                else
                {
                    var irName = ir.GetPrimaryFullName();
                    if (irName != "")
                    {
                        Name = GMHelper.CapitaliseName(irName, ref FirstName, ref Surname);
                    }
                    else
                    {
                        FirstName = "";
                        Surname   = Name = CConfig.Instance.UnknownName;
                    }
                }

                Date = Concealed ? string.Empty : GMHelper.GetLifeDatesStr(ir);
            }
Esempio n. 2
0
        // 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 (!GMHelper.GetVisibility(ir))
            {
                // 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);
        }
Esempio n. 3
0
        // For sorting the list
        public int CompareTo(LVItem other)
        {
            if (fRecord == null && other.fRecord == null)
            {
                return(0);
            }
            if (fRecord == null)
            {
                return(1);
            }
            if (other.fRecord == null)
            {
                return(-1);
            }
            bool tr = GMHelper.GetVisibility(fRecord);
            bool or = GMHelper.GetVisibility(other.fRecord);

            return((tr == or) ? 0 : (tr) ? 1 : -1);
        }
Esempio n. 4
0
        // 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 (!GMHelper.GetVisibility(ir) && !CConfig.Instance.UseWithheldNames)
            {
                name = CConfig.Instance.ConcealedName;
            }
            else
            {
                name = GMHelper.CapitaliseName(name, ref dummy, ref dummy);
            }
            return(MakeLink(ir, name));
        }
Esempio n. 5
0
        // Adds the given multimedia links to the given multimedia list.
        protected void AddMultimedia(GDMList <GDMMultimediaLink> multimediaLinks, string mmPrefix,
                                     string mmLargePrefix, int maxWidth, int maxHeight, Stats stats)
        {
            // TODO: ml.GetFileReferences();
            var fileRefs = new List <GDMFileReference>();

            foreach (var mmLink in multimediaLinks)
            {
                if (mmLink.IsPointer)
                {
                    var mmRec = fTree.GetPtrValue(mmLink);
                    if (!GMHelper.GetVisibility(mmRec))
                    {
                        // user chose not to show this picture
                        continue;
                    }

                    foreach (var fileRef in mmRec.FileReferences)
                    {
                        fileRefs.Add(fileRef);
                    }
                }
                else
                {
                    foreach (var fileRef in mmLink.FileReferences)
                    {
                        fileRefs.Add(fileRef);
                    }
                }
            }

            if (multimediaLinks != null)
            {
                // Add extra pics added by the user on indi exclude screen.
                AddMultimediaFileReferences(fileRefs, mmPrefix, mmLargePrefix, maxWidth, maxHeight, stats);
            }
        }
Esempio n. 6
0
 // Returns true if the supplied record is valid for inclusion in the tree
 private static bool Exists(GDMIndividualRecord ir)
 {
     return(ir != null && GMHelper.GetVisibility(ir));
 }
Esempio n. 7
0
        // 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 (var userRef in fSourceRecord.UserReferences)
                    {
                        if (userRef.StringValue != "")
                        {
                            sourName     += userRef.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 (var sourCit in fSourceRecord.RepositoryCitations)
                {
                    GDMRepositoryRecord repoRec = fTree.GetPtrValue <GDMRepositoryRecord>(sourCit);
                    if (repoRec != null)
                    {
                        if (!string.IsNullOrEmpty(repoRec.RepositoryName))
                        {
                            f.WriteLine("<h2>{0}</h2>", EscapeHTML(repoRec.RepositoryName, false));
                        }

                        foreach (GDMNotes ns in repoRec.Notes)
                        {
                            WriteNotes(f, ns);
                        }
                    }

                    foreach (GDMNotes ns in sourCit.Notes)
                    {
                        WriteNotes(f, ns);
                    }
                }

                // 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)
                {
                    f.WriteLine("        <div id=\"citations\">");
                    f.WriteLine("          <h1>Citations</h1>");
                    f.WriteLine("          <ul>");

                    var htBackrefs = GMHelper.MakeBackReferences(fSourceRecord);
                    IDictionaryEnumerator enumerator = htBackrefs.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        GDMIndividualRecord ir = (GDMIndividualRecord)(enumerator.Value);
                        if (ir != null && GMHelper.GetVisibility(ir))
                        {
                            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);
        }