//======================== public static string GetGalleryExportXML(Guid siteID, List <Guid> GalleryIDs) { GalleryExportList lstGE = new GalleryExportList(); lstGE.ExportDate = SiteData.CurrentSite.Now; lstGE.CarrotCakeVersion = SiteData.CarrotCakeCMSVersion; lstGE.OriginalSite = SiteData.GetSiteFromCache(siteID); GalleryHelper gh = new GalleryHelper(siteID); foreach (Guid galleryID in GalleryIDs) { GalleryExport ge = new GalleryExport(); GalleryGroup gal = gh.GalleryGroupGetByID(galleryID); ge.TheGallery = gal; ge.OriginalGalleryID = gal.GalleryID; ge.ExportDate = SiteData.CurrentSite.Now; ge.CarrotCakeVersion = SiteData.CarrotCakeCMSVersion; lstGE.TheGalleries.Add(ge); } return(ContentImportExportUtils.GetExportXML <GalleryExportList>(lstGE)); }
public GalleryGroup GalleryGroupGetByID(Guid galleryID) { using (PhotoGalleryDataContext db = PhotoGalleryDataContext.GetDataContext()) { GalleryGroup ge = (from c in db.tblGalleries where c.SiteID == this.ThisSite.SiteID && c.GalleryID == galleryID select new GalleryGroup(c)).FirstOrDefault(); return(ge); } }
protected void BuildInstallList() { pnlReview.Visible = true; SiteData site = SiteData.CurrentSite; GalleryHelper gh = new GalleryHelper(SiteID); foreach (GridViewRow row in gvPages.Rows) { Guid gGallery = Guid.Empty; CheckBox chkSelect = (CheckBox)row.FindControl("chkSelect"); if (chkSelect.Checked) { HiddenField hdnGalleryID = (HiddenField)row.FindControl("hdnGalleryID"); gGallery = new Guid(hdnGalleryID.Value); GalleryGroup grpImp = (from g in lstGalleries.TheGalleries where g.TheGallery.GalleryID == gGallery select g.TheGallery).FirstOrDefault(); GalleryGroup grpSite = gh.GalleryGroupGetByName(grpImp.GalleryTitle); if (grpSite == null) { grpSite = grpImp; grpSite.SiteID = site.SiteID; } grpSite.Save(); grpImp.GalleryImages.ForEach(q => q.GalleryImageID = Guid.NewGuid()); grpImp.GalleryImages.ForEach(q => q.GalleryID = grpSite.GalleryID); foreach (GalleryImageEntry imgImp in grpImp.GalleryImages) { GalleryImageEntry imgSite = gh.GalleryImageEntryGetByFilename(grpSite.GalleryID, imgImp.GalleryImage); if (imgSite == null) { imgSite = imgImp; imgSite.GalleryID = grpSite.GalleryID; } imgSite.Save(); } } } }
public GalleryGroup GalleryGroupGetByName(string galleryTitle) { GalleryGroup ge = null; using (PhotoGalleryDataContext db = PhotoGalleryDataContext.GetDataContext()) { if (!string.IsNullOrEmpty(galleryTitle)) { ge = (from c in db.tblGalleries where c.SiteID == this.ThisSite.SiteID && c.GalleryTitle.ToLower() == galleryTitle.ToLower() select new GalleryGroup(c)).FirstOrDefault(); } } return(ge); }
public override bool Equals(Object obj) { //Check for null and compare run-time types. if (obj == null || GetType() != obj.GetType()) { return(false); } if (obj is GalleryGroup) { GalleryGroup p = (GalleryGroup)obj; return((this.GalleryID == p.GalleryID) && (this.SiteID == p.SiteID) && (this.GalleryTitle == p.GalleryTitle)); } else { return(false); } }
protected void btnSave_Click(object sender, EventArgs e) { GalleryHelper gh = new GalleryHelper(SiteID); var gal = gh.GalleryGroupGetByID(gTheID); if (gal == null || gTheID == Guid.Empty) { gTheID = Guid.NewGuid(); gal = new GalleryGroup(); gal.SiteID = SiteID; gal.GalleryID = gTheID; } gal.GalleryTitle = txtGallery.Text; gal.Save(); string stringFile = CreateLink("GalleryList"); Response.Redirect(stringFile); }
protected void BuildWidgetInstall() { pnlReview.Visible = true; SiteData site = SiteData.CurrentSite; CMSAdminModuleMenu thisModule = cmsHelper.GetCurrentAdminModuleControl(); string sDir = thisModule.ControlFile.Substring(0, thisModule.ControlFile.LastIndexOf("/")); List<CMSPlugin> lstPlug = cmsHelper.GetPluginsInFolder(sDir); CMSPlugin plug = lstPlug.Where(x => x.FilePath.EndsWith("PhotoGalleryPrettyPhoto.ascx")).FirstOrDefault(); GalleryHelper gh = new GalleryHelper(site.SiteID); foreach (GridViewRow row in gvPages.Rows) { Guid gRootPage = Guid.Empty; Guid gGallery = Guid.Empty; int iPost = 0; CheckBox chkSelect = (CheckBox)row.FindControl("chkSelect"); if (chkSelect.Checked) { HiddenField hdnPostID = (HiddenField)row.FindControl("hdnPostID"); iPost = int.Parse(hdnPostID.Value); List<WordPressPost> lstA = (from a in wpSite.Content where a.PostType == WordPressPost.WPPostType.Attachment && a.ParentPostID == iPost orderby a.PostDateUTC select a).Distinct().ToList(); lstA.ToList().ForEach(q => q.ImportFileSlug = ddlFolders.SelectedValue + "/" + q.ImportFileSlug); lstA.ToList().ForEach(q => q.ImportFileSlug = q.ImportFileSlug.Replace("//", "/").Replace("//", "/")); WordPressPost post = (from p in wpSite.Content where p.PostID == iPost select p).FirstOrDefault(); ContentPage cp = null; List<ContentPage> lstCP = pageHelper.FindPageByTitleAndDate(site.SiteID, post.PostTitle, post.PostName, post.PostDateUTC); if (lstCP != null && lstCP.Any()) { cp = lstCP.FirstOrDefault(); } if (cp != null) { gRootPage = cp.Root_ContentID; if (cp.PageText.Contains("[gallery]")) { cp.PageText = cp.PageText.Replace("[gallery]", ""); cp.SavePageEdit(); } } GalleryGroup gal = gh.GalleryGroupGetByName(post.PostTitle); if (gal == null) { gal = new GalleryGroup(); gal.SiteID = site.SiteID; gal.GalleryID = Guid.Empty; gal.GalleryTitle = post.PostTitle; gal.Save(); } gGallery = gal.GalleryID; int iPos = 0; foreach (var img in lstA) { img.ImportFileSlug = img.ImportFileSlug.Replace("//", "/").Replace("//", "/"); if (!chkFileGrab.Checked) { cmsHelper.GetFile(img.AttachmentURL, img.ImportFileSlug); } if (!string.IsNullOrEmpty(img.ImportFileSlug)) { GalleryImageEntry theImg = gh.GalleryImageEntryGetByFilename(gGallery, img.ImportFileSlug); if (theImg == null) { theImg = new GalleryImageEntry(); theImg.GalleryImage = img.ImportFileSlug; theImg.GalleryImageID = Guid.Empty; theImg.GalleryID = gGallery; } theImg.ImageOrder = iPos; theImg.Save(); GalleryMetaData theMeta = gh.GalleryMetaDataGetByFilename(img.ImportFileSlug); if (theMeta == null) { theMeta = new GalleryMetaData(); theMeta.GalleryImageMetaID = Guid.Empty; theMeta.SiteID = site.SiteID; } if (!string.IsNullOrEmpty(img.PostTitle) || !string.IsNullOrEmpty(img.PostContent)) { theMeta.ImageTitle = img.PostTitle; theMeta.ImageMetaData = img.PostContent; theMeta.Save(); } } iPos++; } if (gRootPage != Guid.Empty) { List<Widget> lstW = (from w in cp.GetWidgetList() where w.ControlPath.ToLower() == plug.FilePath.ToLower() && w.ControlProperties.ToLower().Contains(gGallery.ToString().ToLower()) select w).ToList(); if (lstW.Count < 1) { Widget newWidget = new Widget(); newWidget.ControlProperties = null; newWidget.Root_ContentID = gRootPage; newWidget.Root_WidgetID = Guid.NewGuid(); newWidget.WidgetDataID = newWidget.Root_WidgetID; newWidget.ControlPath = plug.FilePath; newWidget.EditDate = SiteData.CurrentSite.Now; newWidget.IsLatestVersion = true; newWidget.IsWidgetActive = true; newWidget.IsWidgetPendingDelete = false; newWidget.WidgetOrder = -1; newWidget.PlaceholderName = txtPlaceholderName.Text; List<WidgetProps> lstProps = new List<WidgetProps>(); lstProps.Add(new WidgetProps { KeyName = "ShowHeading", KeyValue = chkShowHeading.Checked.ToString() }); lstProps.Add(new WidgetProps { KeyName = "ScaleImage", KeyValue = chkScaleImage.Checked.ToString() }); lstProps.Add(new WidgetProps { KeyName = "ThumbSize", KeyValue = ddlSize.SelectedValue }); lstProps.Add(new WidgetProps { KeyName = "PrettyPhotoSkin", KeyValue = ddlSkin.SelectedValue }); lstProps.Add(new WidgetProps { KeyName = "GalleryID", KeyValue = gGallery.ToString() }); newWidget.SaveDefaultControlProperties(lstProps); newWidget.Save(); } } } } }
protected void BuildWidgetInstall() { pnlReview.Visible = true; SiteData site = SiteData.CurrentSite; CMSAdminModuleMenu thisModule = cmsHelper.GetCurrentAdminModuleControl(); string sDir = thisModule.ControlFile.Substring(0, thisModule.ControlFile.LastIndexOf("/")); List <CMSPlugin> lstPlug = cmsHelper.GetPluginsInFolder(sDir); CMSPlugin plug = lstPlug.Where(x => x.FilePath.EndsWith("PhotoGalleryPrettyPhoto.ascx")).FirstOrDefault(); GalleryHelper gh = new GalleryHelper(site.SiteID); foreach (GridViewRow row in gvPages.Rows) { Guid gRootPage = Guid.Empty; Guid gGallery = Guid.Empty; int iPost = 0; CheckBox chkSelect = (CheckBox)row.FindControl("chkSelect"); if (chkSelect.Checked) { HiddenField hdnPostID = (HiddenField)row.FindControl("hdnPostID"); iPost = int.Parse(hdnPostID.Value); List <WordPressPost> lstA = (from a in wpSite.Content where a.PostType == WordPressPost.WPPostType.Attachment && a.ParentPostID == iPost orderby a.PostDateUTC select a).Distinct().ToList(); lstA.ToList().ForEach(q => q.ImportFileSlug = ddlFolders.SelectedValue + "/" + q.ImportFileSlug); lstA.ToList().ForEach(q => q.ImportFileSlug = q.ImportFileSlug.Replace("//", "/").Replace("//", "/")); WordPressPost post = (from p in wpSite.Content where p.PostID == iPost select p).FirstOrDefault(); ContentPage cp = null; List <ContentPage> lstCP = pageHelper.FindPageByTitleAndDate(site.SiteID, post.PostTitle, post.PostName, post.PostDateUTC); if (lstCP != null && lstCP.Any()) { cp = lstCP.FirstOrDefault(); } if (cp != null) { gRootPage = cp.Root_ContentID; if (cp.PageText.Contains("[gallery]")) { cp.PageText = cp.PageText.Replace("[gallery]", ""); cp.SavePageEdit(); } } GalleryGroup gal = gh.GalleryGroupGetByName(post.PostTitle); if (gal == null) { gal = new GalleryGroup(); gal.SiteID = site.SiteID; gal.GalleryID = Guid.Empty; gal.GalleryTitle = post.PostTitle; gal.Save(); } gGallery = gal.GalleryID; int iPos = 0; foreach (var img in lstA) { img.ImportFileSlug = img.ImportFileSlug.Replace("//", "/").Replace("//", "/"); if (!chkFileGrab.Checked) { cmsHelper.GetFile(img.AttachmentURL, img.ImportFileSlug); } if (!string.IsNullOrEmpty(img.ImportFileSlug)) { GalleryImageEntry theImg = gh.GalleryImageEntryGetByFilename(gGallery, img.ImportFileSlug); if (theImg == null) { theImg = new GalleryImageEntry(); theImg.GalleryImage = img.ImportFileSlug; theImg.GalleryImageID = Guid.Empty; theImg.GalleryID = gGallery; } theImg.ImageOrder = iPos; theImg.Save(); GalleryMetaData theMeta = gh.GalleryMetaDataGetByFilename(img.ImportFileSlug); if (theMeta == null) { theMeta = new GalleryMetaData(); theMeta.GalleryImageMetaID = Guid.Empty; theMeta.SiteID = site.SiteID; } if (!string.IsNullOrEmpty(img.PostTitle) || !string.IsNullOrEmpty(img.PostContent)) { theMeta.ImageTitle = img.PostTitle; theMeta.ImageMetaData = img.PostContent; theMeta.Save(); } } iPos++; } if (gRootPage != Guid.Empty) { List <Widget> lstW = (from w in cp.GetWidgetList() where w.ControlPath.ToLower() == plug.FilePath.ToLower() && w.ControlProperties.ToLower().Contains(gGallery.ToString().ToLower()) select w).ToList(); if (lstW.Count < 1) { Widget newWidget = new Widget(); newWidget.ControlProperties = null; newWidget.Root_ContentID = gRootPage; newWidget.Root_WidgetID = Guid.NewGuid(); newWidget.WidgetDataID = newWidget.Root_WidgetID; newWidget.ControlPath = plug.FilePath; newWidget.EditDate = SiteData.CurrentSite.Now; newWidget.IsLatestVersion = true; newWidget.IsWidgetActive = true; newWidget.IsWidgetPendingDelete = false; newWidget.WidgetOrder = -1; newWidget.PlaceholderName = txtPlaceholderName.Text; List <WidgetProps> lstProps = new List <WidgetProps>(); lstProps.Add(new WidgetProps { KeyName = "ShowHeading", KeyValue = chkShowHeading.Checked.ToString() }); lstProps.Add(new WidgetProps { KeyName = "ScaleImage", KeyValue = chkScaleImage.Checked.ToString() }); lstProps.Add(new WidgetProps { KeyName = "ThumbSize", KeyValue = ddlSize.SelectedValue }); lstProps.Add(new WidgetProps { KeyName = "PrettyPhotoSkin", KeyValue = ddlSkin.SelectedValue }); lstProps.Add(new WidgetProps { KeyName = "GalleryID", KeyValue = gGallery.ToString() }); newWidget.SaveDefaultControlProperties(lstProps); newWidget.Save(); } } } } }