protected void btnSave_Click(object sender, EventArgs e)
        {
            GalleryHelper gh = new GalleryHelper(SiteID);

            Dictionary<int, string> lstImages = ParseGalleryImages();
            int iPos = 0;

            foreach (var img in lstImages) {
                if (!String.IsNullOrEmpty(img.Value)) {
                    var theImg = gh.GalleryImageEntryGetByFilename(gTheID, img.Value);

                    if (theImg == null) {
                        theImg = new GalleryImageEntry();
                        theImg.GalleryImage = img.Value;
                        theImg.GalleryImageID = Guid.NewGuid();
                        theImg.GalleryID = gTheID;
                    }

                    theImg.ImageOrder = iPos;

                    theImg.Save();
                }

                iPos++;

                List<string> lst = (from l in lstImages
                                    select l.Value.ToLower()).ToList();

                gh.GalleryImageCleanup(gTheID, lst);
            }

            var stringFile = CreateLink(ModuleName, string.Format("id={0}", gTheID));

            Response.Redirect(stringFile);
        }
Exemple #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            GetPublicParmValues();

            if (this.PublicParmValues.Any())
            {
                this.GalleryIDs = new List <Guid>();

                this.ThumbSize = 150;

                try {
                    List <string> lstGallery = GetParmValueList("GalleryIDs");

                    foreach (string sGallery in lstGallery)
                    {
                        if (!String.IsNullOrEmpty(sGallery))
                        {
                            this.GalleryIDs.Add(new Guid(sGallery));
                        }
                    }
                } catch (Exception ex) { }

                try {
                    string sFoundVal = GetParmValue("ThumbSize", "150");

                    if (!String.IsNullOrEmpty(sFoundVal))
                    {
                        this.ThumbSize = Convert.ToInt32(sFoundVal);
                    }
                } catch (Exception ex) { }
            }

            if (this.GalleryIDs == null)
            {
                this.GalleryIDs = new List <Guid>();
            }

            GalleryHelper gh      = new GalleryHelper(SiteID);
            var           lstCont = gh.GalleryGroupListGetBySiteID();

            var gal = (from g in GalleryIDs
                       join gg in lstCont on g equals gg.GalleryID
                       orderby gg.GalleryTitle
                       select gg).ToList();

            if (gal != null)
            {
                rpGalleries.DataSource = gal;
                rpGalleries.DataBind();
            }

            if (rpGalleries.Items.Count > 0)
            {
                pnlGallery.Visible = true;
            }
            else
            {
                pnlGallery.Visible = false;
            }
        }
		protected void Page_Load(object sender, EventArgs e) {
			GetPublicParmValues();

			GalleryHelper gh = new GalleryHelper(SiteID);

			var gal = gh.GalleryGroupGetByID(GalleryID);

			if (gal != null) {
				litGalleryName.Text = gal.GalleryTitle;
				pnlGalleryHead.Visible = ShowHeading;

				rpGallery.DataSource = (from g in gal.GalleryImages
										where g.GalleryID == GalleryID
										orderby g.ImageOrder ascending
										select g).ToList();

				rpGallery.DataBind();
			}

			if (rpGallery.Items.Count > 0) {
				pnlGallery.Visible = true;
			} else {
				pnlGallery.Visible = false;
			}

			if (!this.IsBeingEdited) {
				pnlScript.Visible = true;
			} else {
				pnlScript.Visible = false;
			}
		}
        //========================
        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));
        }
Exemple #5
0
        private void LoadData()
        {
            GalleryHelper gh = new GalleryHelper(SiteID);

            var lstCont = gh.GalleryGroupListGetBySiteID();

            gvPages.DataSource = lstCont;
            gvPages.DataBind();
        }
		private void LoadForm() {
			GalleryHelper gh = new GalleryHelper(SiteID);
			var meta = gh.GalleryMetaDataGetByFilename(sImageFile);

			if (meta != null) {
				txtMetaInfo.Text = meta.ImageMetaData;
				txtTitle.Text = meta.ImageTitle;
			}
		}
		private void LoadData() {

			GalleryHelper gh = new GalleryHelper(SiteID);

			var lstCont = gh.GalleryGroupListGetBySiteID();

			gvPages.DataSource = lstCont;
			gvPages.DataBind();

		}
        private void LoadForm()
        {
            GalleryHelper gh   = new GalleryHelper(SiteID);
            var           meta = gh.GalleryMetaDataGetByFilename(sImageFile);

            if (meta != null)
            {
                txtMetaInfo.Text = meta.ImageMetaData;
                txtTitle.Text    = meta.ImageTitle;
            }
        }
		internal GalleryGroup(tblGallery gal) {
			if (gal != null) {
				this.GalleryID = gal.GalleryID;
				this.SiteID = gal.SiteID.Value;

				this.GalleryTitle = gal.GalleryTitle;

				GalleryHelper gh = new GalleryHelper(SiteID);

				this.GalleryImages = gh.GalleryImageEntryListGetByGalleryID(this.GalleryID);

			}
		}
		protected void Page_Load(object sender, EventArgs e) {
			GetPublicParmValues();

			if (this.PublicParmValues.Any()) {
				this.GalleryIDs = new List<Guid>();

				this.ThumbSize = 150;

				try {
					List<string> lstGallery = GetParmValueList("GalleryIDs");

					foreach (string sGallery in lstGallery) {
						if (!String.IsNullOrEmpty(sGallery)) {
							this.GalleryIDs.Add(new Guid(sGallery));
						}
					}
				} catch (Exception ex) { }

				try {
					string sFoundVal = GetParmValue("ThumbSize", "150");

					if (!String.IsNullOrEmpty(sFoundVal)) {
						this.ThumbSize = Convert.ToInt32(sFoundVal);
					}
				} catch (Exception ex) { }
			}

			if (this.GalleryIDs == null) {
				this.GalleryIDs = new List<Guid>();
			}

			GalleryHelper gh = new GalleryHelper(SiteID);
			var lstCont = gh.GalleryGroupListGetBySiteID();

			var gal = (from g in GalleryIDs
					   join gg in lstCont on g equals gg.GalleryID
					   orderby gg.GalleryTitle
					   select gg).ToList();

			if (gal != null) {
				rpGalleries.DataSource = gal;
				rpGalleries.DataBind();
			}

			if (rpGalleries.Items.Count > 0) {
				pnlGallery.Visible = true;
			} else {
				pnlGallery.Visible = false;
			}
		}
        internal GalleryGroup(tblGallery gal)
        {
            if (gal != null)
            {
                this.GalleryID = gal.GalleryID;
                this.SiteID    = gal.SiteID.Value;

                this.GalleryTitle = gal.GalleryTitle;

                GalleryHelper gh = new GalleryHelper(SiteID);

                this.GalleryImages = gh.GalleryImageEntryListGetByGalleryID(this.GalleryID);
            }
        }
		protected void Page_Load(object sender, EventArgs e) {
			this.ScaleImage = true;
			this.ShowHeading = false;
			this.ThumbSize = 100;
			this.PrettyPhotoSkin = "light_rounded";

			GetPublicParmValues();

			if (this.PublicParmValues.Any()) {
				try {
					string sFoundVal = GetParmValue("PrettyPhotoSkin", "light_rounded");

					if (!String.IsNullOrEmpty(sFoundVal)) {
						this.PrettyPhotoSkin = sFoundVal;
					}
				} catch (Exception ex) { }
			}

			if (String.IsNullOrEmpty(PrettyPhotoSkin)) {
				PrettyPhotoSkin = "light_rounded";
			}

			GalleryHelper gh = new GalleryHelper(SiteID);

			var gal = gh.GalleryGroupGetByID(GalleryID);

			if (gal != null) {
				litGalleryName.Text = gal.GalleryTitle;
				pnlGalleryHead.Visible = ShowHeading;

				rpGallery.DataSource = (from g in gal.GalleryImages
										where g.GalleryID == GalleryID
										orderby g.ImageOrder ascending
										select g).ToList();

				rpGallery.DataBind();
			}

			if (rpGallery.Items.Count > 0) {
				pnlGallery.Visible = true;
			} else {
				pnlGallery.Visible = false;
			}

			if (!this.IsBeingEdited) {
				pnlScript.Visible = true;
			} else {
				pnlScript.Visible = false;
			}
		}
		protected void Page_Load(object sender, EventArgs e) {
			gTheID = ParmParser.GetGuidIDFromQuery();

			if (!IsPostBack) {
				GalleryHelper gh = new GalleryHelper(SiteID);

				var gal = gh.GalleryGroupGetByID(gTheID);

				if (gal != null) {
					txtGallery.Text = gal.GalleryTitle;
				}

			}
		}
        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();
                    }
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            gTheID = ParmParser.GetGuidIDFromQuery();

            if (!IsPostBack)
            {
                GalleryHelper gh = new GalleryHelper(SiteID);

                var gal = gh.GalleryGroupGetByID(gTheID);

                if (gal != null)
                {
                    txtGallery.Text = gal.GalleryTitle;
                }
            }
        }
		protected void LoadLists() {
			GalleryHelper gh = new GalleryHelper(SiteID);

			var gal = gh.GalleryGroupGetByID(gTheID);

			if (gal != null) {
				litGalleryName.Text = gal.GalleryTitle;

				rpGallery.DataSource = (from g in gal.GalleryImages
										orderby g.ImageOrder ascending
										select fileHelper.GetFileInfo(g.GalleryImage, g.GalleryImage)).ToList();

				rpGallery.DataBind();
			}

			SetSourceFiles(null, "/");
		}
		protected void btnSave_Click(object sender, EventArgs e) {

			GalleryHelper gh = new GalleryHelper(SiteID);
			var meta = gh.GalleryMetaDataGetByFilename(sImageFile);

			if (meta == null) {
				meta = new GalleryMetaData();
				meta.GalleryImageMetaID = Guid.Empty;
				meta.SiteID = SiteID;
				meta.GalleryImage = sImageFile.ToLower();
			}

			meta.ImageMetaData = txtMetaInfo.Text;
			meta.ImageTitle = txtTitle.Text;

			meta.Save();

			Response.Redirect(SiteData.CurrentScriptName + "?" + Request.QueryString.ToString());
		}
Exemple #18
0
        protected void LoadLists()
        {
            GalleryHelper gh = new GalleryHelper(SiteID);

            var gal = gh.GalleryGroupGetByID(gTheID);

            if (gal != null)
            {
                litGalleryName.Text = gal.GalleryTitle;

                rpGallery.DataSource = (from g in gal.GalleryImages
                                        orderby g.ImageOrder ascending
                                        select fileHelper.GetFileInfo(g.GalleryImage, g.GalleryImage)).ToList();

                rpGallery.DataBind();
            }

            SetSourceFiles(null, "/");
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            GalleryHelper gh   = new GalleryHelper(SiteID);
            var           meta = gh.GalleryMetaDataGetByFilename(sImageFile);

            if (meta == null)
            {
                meta = new GalleryMetaData();
                meta.GalleryImageMetaID = Guid.Empty;
                meta.SiteID             = SiteID;
                meta.GalleryImage       = sImageFile.ToLower();
            }

            meta.ImageMetaData = txtMetaInfo.Text;
            meta.ImageTitle    = txtTitle.Text;

            meta.Save();

            Response.Redirect(SiteData.CurrentScriptName + "?" + Request.QueryString.ToString());
        }
		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 Page_Load(object sender, EventArgs e)
        {
            GetPublicParmValues();

            GalleryHelper gh = new GalleryHelper(SiteID);

            var gal = gh.GalleryGroupGetByID(GalleryID);

            if (gal != null)
            {
                litGalleryName.Text    = gal.GalleryTitle;
                pnlGalleryHead.Visible = ShowHeading;

                rpGallery.DataSource = (from g in gal.GalleryImages
                                        where g.GalleryID == GalleryID
                                        orderby g.ImageOrder ascending
                                        select g).ToList();

                rpGallery.DataBind();
            }

            if (rpGallery.Items.Count > 0)
            {
                pnlGallery.Visible = true;
            }
            else
            {
                pnlGallery.Visible = false;
            }

            if (!this.IsBeingEdited)
            {
                pnlScript.Visible = true;
            }
            else
            {
                pnlScript.Visible = false;
            }
        }
Exemple #22
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            GalleryHelper gh = new GalleryHelper(SiteID);

            Dictionary <int, string> lstImages = ParseGalleryImages();
            int iPos = 0;

            foreach (var img in lstImages)
            {
                if (!String.IsNullOrEmpty(img.Value))
                {
                    var theImg = gh.GalleryImageEntryGetByFilename(gTheID, img.Value);

                    if (theImg == null)
                    {
                        theImg = new GalleryImageEntry();
                        theImg.GalleryImage   = img.Value;
                        theImg.GalleryImageID = Guid.NewGuid();
                        theImg.GalleryID      = gTheID;
                    }

                    theImg.ImageOrder = iPos;

                    theImg.Save();
                }

                iPos++;

                List <string> lst = (from l in lstImages
                                     select l.Value.ToLower()).ToList();

                gh.GalleryImageCleanup(gTheID, lst);
            }

            var stringFile = CreateLink(ModuleName, string.Format("id={0}", gTheID));

            Response.Redirect(stringFile);
        }
        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);
        }
		//========================
		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);
		}
Exemple #25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.ScaleImage      = true;
            this.ShowHeading     = false;
            this.ThumbSize       = 100;
            this.PrettyPhotoSkin = "light_rounded";

            GetPublicParmValues();

            if (this.PublicParmValues.Any())
            {
                try {
                    string sFoundVal = GetParmValue("PrettyPhotoSkin", "light_rounded");

                    if (!String.IsNullOrEmpty(sFoundVal))
                    {
                        this.PrettyPhotoSkin = sFoundVal;
                    }
                } catch (Exception ex) { }
            }

            if (String.IsNullOrEmpty(PrettyPhotoSkin))
            {
                PrettyPhotoSkin = "light_rounded";
            }

            GalleryHelper gh = new GalleryHelper(SiteID);

            var gal = gh.GalleryGroupGetByID(GalleryID);

            if (gal != null)
            {
                litGalleryName.Text    = gal.GalleryTitle;
                pnlGalleryHead.Visible = ShowHeading;

                rpGallery.DataSource = (from g in gal.GalleryImages
                                        where g.GalleryID == GalleryID
                                        orderby g.ImageOrder ascending
                                        select g).ToList();

                rpGallery.DataBind();
            }

            if (rpGallery.Items.Count > 0)
            {
                pnlGallery.Visible = true;
            }
            else
            {
                pnlGallery.Visible = false;
            }

            if (!this.IsBeingEdited)
            {
                pnlScript.Visible = true;
            }
            else
            {
                pnlScript.Visible = false;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (PublicParmValues.Count > 0) {

                try {
                    string sFoundVal = GetParmValue("GalleryID", Guid.Empty.ToString());

                    if (!string.IsNullOrEmpty(sFoundVal)) {
                        GalleryID = new Guid(sFoundVal);
                    }
                } catch (Exception ex) { }

                try {
                    string sFoundVal = GetParmValue("ShowHeading", "false");

                    if (!string.IsNullOrEmpty(sFoundVal)) {
                        ShowHeading = Convert.ToBoolean(sFoundVal);
                    }
                } catch (Exception ex) { }

                try {
                    string sFoundVal = GetParmValue("ScaleImage", "false");

                    if (!string.IsNullOrEmpty(sFoundVal)) {
                        ScaleImage = Convert.ToBoolean(sFoundVal);
                    }
                } catch (Exception ex) { }

                try {
                    string sFoundVal = GetParmValueDefaultEmpty("WindowWidth", "500");

                    if (!string.IsNullOrEmpty(sFoundVal)) {
                        WindowWidth = Convert.ToInt32(sFoundVal);
                    }
                } catch (Exception ex) { }

                try {
                    string sFoundVal = GetParmValueDefaultEmpty("ThumbSize1", "150");

                    if (!string.IsNullOrEmpty(sFoundVal)) {
                        ThumbSize1 = Convert.ToInt32(sFoundVal);
                    }
                } catch (Exception ex) { }

                try {
                    string sFoundVal = GetParmValueDefaultEmpty("ThumbSize2", "200");

                    if (!string.IsNullOrEmpty(sFoundVal)) {
                        ThumbSize2 = Convert.ToInt32(sFoundVal);
                    }
                } catch (Exception ex) { }

                try {
                    string sFoundVal = GetParmValue("PrettyPhotoSkin", "light_rounded");

                    if (!string.IsNullOrEmpty(sFoundVal)) {
                        PrettyPhotoSkin = sFoundVal;
                    }
                } catch (Exception ex) { }

            }

            if (string.IsNullOrEmpty(PrettyPhotoSkin)) {
                PrettyPhotoSkin = "light_rounded";
            }

            imageData = new List<GalleryMetaData>();

            List<GalleryImageEntry> gallery = null;

            GalleryHelper gh = new GalleryHelper(SiteID);

            var gal = gh.GalleryGroupGetByID(GalleryID);

            if (gal != null) {

                litGalleryName.Text = gal.GalleryTitle;
                pnlGalleryHead.Visible = ShowHeading;

                gallery = (from g in gal.GalleryImages
                           orderby g.ImageOrder ascending
                           select g).ToList();

                imageData = gh.GetGalleryMetaDataListByGalleryID(GalleryID);

                rpGallery.DataSource = gallery;
                rpGallery.DataBind();

                rpGalleryDetail.DataSource = gallery;
                rpGalleryDetail.DataBind();
            }

            if (rpGallery.Items.Count > 0) {
                pnlGallery.Visible = true;
            } else {
                pnlGallery.Visible = false;
            }

            if (!IsBeingEdited) {
                pnlScript.Visible = true;
            } else {
                pnlScript.Visible = false;
            }
        }
		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();
					}
				}
			}
		}
Exemple #28
0
        protected void Page_Load(object sender, EventArgs e)
        {
            GetPublicParmValues();

            if (this.PublicParmValues.Any())
            {
                try {
                    string sFoundVal = GetParmValue("GalleryID", Guid.Empty.ToString());

                    if (!String.IsNullOrEmpty(sFoundVal))
                    {
                        this.GalleryID = new Guid(sFoundVal);
                    }
                } catch (Exception ex) { }

                try {
                    string sFoundVal = GetParmValueDefaultEmpty("WindowWidth", "500");

                    if (!String.IsNullOrEmpty(sFoundVal))
                    {
                        this.WindowWidth = Convert.ToInt32(sFoundVal);
                    }
                } catch (Exception ex) { }

                try {
                    string sFoundVal = GetParmValueDefaultEmpty("ThumbSize1", "150");

                    if (!String.IsNullOrEmpty(sFoundVal))
                    {
                        this.ThumbSize1 = Convert.ToInt32(sFoundVal);
                    }
                } catch (Exception ex) { }

                try {
                    string sFoundVal = GetParmValueDefaultEmpty("ThumbSize2", "200");

                    if (!String.IsNullOrEmpty(sFoundVal))
                    {
                        this.ThumbSize2 = Convert.ToInt32(sFoundVal);
                    }
                } catch (Exception ex) { }

                try {
                    string sFoundVal = GetParmValue("PrettyPhotoSkin", "light_rounded");

                    if (!String.IsNullOrEmpty(sFoundVal))
                    {
                        this.PrettyPhotoSkin = sFoundVal;
                    }
                } catch (Exception ex) { }
            }

            if (String.IsNullOrEmpty(PrettyPhotoSkin))
            {
                this.PrettyPhotoSkin = "light_rounded";
            }

            imageData = new List <GalleryMetaData>();

            List <GalleryImageEntry> gallery = null;

            GalleryHelper gh = new GalleryHelper(this.SiteID);

            var gal = gh.GalleryGroupGetByID(this.GalleryID);

            if (gal != null)
            {
                litGalleryName.Text    = gal.GalleryTitle;
                pnlGalleryHead.Visible = ShowHeading;

                gallery = (from g in gal.GalleryImages
                           orderby g.ImageOrder ascending
                           select g).ToList();

                imageData = gh.GetGalleryMetaDataListByGalleryID(GalleryID);

                rpGallery.DataSource = gallery;
                rpGallery.DataBind();

                rpGalleryDetail.DataSource = gallery;
                rpGalleryDetail.DataBind();
            }

            if (rpGallery.Items.Count > 0)
            {
                pnlGallery.Visible = true;
            }
            else
            {
                pnlGallery.Visible = false;
            }

            if (!this.IsBeingEdited)
            {
                pnlScript.Visible = true;
            }
            else
            {
                pnlScript.Visible = false;
            }
        }
        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 Page_Load(object sender, EventArgs e)
        {
            if (PublicParmValues.Any()) {
                try {
                    string sFoundVal = GetParmValue("GalleryID", Guid.Empty.ToString());

                    if (!string.IsNullOrEmpty(sFoundVal)) {
                        GalleryID = new Guid(sFoundVal);
                    }
                } catch (Exception ex) { }

                try {
                    string sFoundVal = GetParmValue("ShowHeading", "false");

                    if (!string.IsNullOrEmpty(sFoundVal)) {
                        ShowHeading = Convert.ToBoolean(sFoundVal);
                    }
                } catch (Exception ex) { }

                try {
                    string sFoundVal = GetParmValue("ScaleImage", "false");

                    if (!string.IsNullOrEmpty(sFoundVal)) {
                        ScaleImage = Convert.ToBoolean(sFoundVal);
                    }
                } catch (Exception ex) { }

                try {
                    string sFoundVal = GetParmValue("ThumbSize", "150");

                    if (!string.IsNullOrEmpty(sFoundVal)) {
                        ThumbSize = Convert.ToInt32(sFoundVal);
                    }
                } catch (Exception ex) { }
            }

            GalleryHelper gh = new GalleryHelper(SiteID);

            var gal = gh.GalleryGroupGetByID(GalleryID);

            if (gal != null) {
                litGalleryName.Text = gal.GalleryTitle;
                pnlGalleryHead.Visible = ShowHeading;

                rpGallery.DataSource = (from g in gal.GalleryImages
                                        where g.GalleryID == GalleryID
                                        orderby g.ImageOrder ascending
                                        select g).ToList();

                rpGallery.DataBind();
            }

            if (rpGallery.Items.Count > 0) {
                pnlGallery.Visible = true;
            } else {
                pnlGallery.Visible = false;
            }

            if (!IsBeingEdited) {
                pnlScript.Visible = true;
            } else {
                pnlScript.Visible = false;
            }
        }
Exemple #31
0
        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();
                        }
                    }
                }
            }
        }