/// <summary> /// Default Constructor /// </summary> public Doc() { Title = new List<Title>(); DocumentText = new BodyContent(); CreditText = new CreditContent(); ImageOnlySet = new ImageOnly(); Bullet = new List<Bullet>(); PhotoRelated = new List<PhotoRelated>(); ReaderHelp = new List<ReaderHelp>(); NewsGrouper = new List<NewsGrouper>(); CartoonGrouper = new List<CartoonGrouper>(); PhotoGallery = new List<PhotoGallery>(); PhotoFooterGallery = new PhotoOnlyGallery(); Reset(); }
/// <summary> /// Before attempting to generate the document to XML it is checked if image gallery is actually set. /// </summary> /// <param name="doc">Properties to doc to check</param> /// <param name="documentPath">ZIP path</param> /// <returns>True if valid.</returns> private bool IsValidImageGallery(IterwebMapInfo doc, string documentPath) { bool rslt = true; if (log.IsDebugEnabled) log.Debug("IsValidImageGallery Start"); // Retrieve Document Attributes and filter to use those enabled to do so. List<SE4Attribute> docSE4AttrList = LoadSE4DocItems(doc.IdObjetoSE, doc.Layout); var node = (from a in docSE4AttrList where a.ElementName == "nombreGaleria" select a ).FirstOrDefault<SE4Attribute>(); if (node != null) { string contextText = (node.HugeContentCode != -1 ? node.HugeText : node.Text); if (contextText == "") { string msg = "Doc idSitemap=[" + doc.IdSitemap + "] has not a gallery directory set appropriately, document not exported"; if (log.IsFatalEnabled) { log.Fatal(msg); } Console.WriteLine(msg); doc.Processed = 12; rslt = false; } else { string imageGalleryFolder = _se4MediaImageGallerySourceFolder; imageGalleryFolder += @"\" + contextText; if (Directory.Exists(imageGalleryFolder)) { string pubInfoFileName = imageGalleryFolder + @"\Pubinfo.txt"; if (File.Exists(pubInfoFileName)) { // First store in list all found images imageGalleryTitle = ""; galleryImgList = new List<ImageOnly>(); string[] lines = File.ReadAllLines(pubInfoFileName); // Grab Title var imageGalleryHeadLine = lines[0].Split('|'); if (imageGalleryHeadLine.Length > 0) { imageGalleryTitle = imageGalleryHeadLine[1]; } for (int i = 1; i < lines.Length; i++) { var elements = lines[i].Split('|'); string fileName = elements[0]; fileName = HttpUtility.HtmlDecode(fileName) + ".jpg"; fileName = CopyImageToZip(imageGalleryFolder, documentPath, fileName, doc, false); if (fileName != "") { ImageOnly imgInfo = new ImageOnly(); imgInfo.Name = fileName; imgInfo.Content = elements[1] + " - " + elements[2]; galleryImgList.Add(imgInfo); } } if (galleryImgList.Count == 0) { doc.Processed = 11; rslt = false; if (log.IsErrorEnabled) { log.Error("Doc idSitemap=[" + doc.IdSitemap + "] does not contain any images SET to processed = 11"); } } } else { if (log.IsErrorEnabled) { log.Error("Doc idSitemap=[" + doc.IdSitemap + "] does not contain 'PubInfo.txt' file SET to processed = 10"); } doc.Processed = 10; rslt = false; } } else { if (log.IsErrorEnabled) { log.Error("Doc idSitemap=[" + doc.IdSitemap + "] does not contain 'PubInfo.txt' file SET to processed = 10"); } doc.Processed = 10; rslt = false; } } } else { // Document was not actually found in DB. rslt = false; } if (log.IsDebugEnabled) log.Debug("IsValidImageGallery End"); return rslt; }