protected void Page_Load(object sender, EventArgs e)
        {
            pnlReview.Visible = false;
            pnlUpload.Visible = false;

            if (!string.IsNullOrEmpty(Request.QueryString["id"]))
            {
                gTheID = new Guid(Request.QueryString["id"].ToString());
            }
            else
            {
                pnlUpload.Visible = true;
            }

            lblWarning.Text = String.Empty;
            lblWarning.Attributes["style"] = "color: #000000;";

            if (gTheID != Guid.Empty)
            {
                lstGalleries = GalleryExportList.GetGalleryExport(gTheID);
            }

            if (!IsPostBack && gTheID != Guid.Empty)
            {
                pnlReview.Visible = true;
                LoadLists();
            }
        }
Ejemplo n.º 2
0
        //========================
        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));
        }
Ejemplo n.º 3
0
        protected void btnExport_Click(object sender, EventArgs e)
        {
            List <Guid> lstSel = new List <Guid>();

            foreach (GridViewRow row in gvPages.Rows)
            {
                var chkReMap = (CheckBox)row.FindControl("chkSelect");

                if (chkReMap.Checked)
                {
                    var  hdnGalleryID = (HiddenField)row.FindControl("hdnGalleryID");
                    Guid gGallery     = new Guid(hdnGalleryID.Value);

                    lstSel.Add(gGallery);
                }
            }

            string theXML   = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n";
            string fileName = "galleryexport-" + SiteID.ToString() + ".xml";

            theXML = GalleryExportList.GetGalleryExportXML(SiteID, lstSel);

            fileName = fileName.Replace(" ", "_");

            Response.Expires     = 5;
            Response.ContentType = "application/octet-stream";
            Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName));

            Response.Write(theXML);

            Response.StatusCode        = 200;
            Response.StatusDescription = "OK";
            Response.End();
        }
Ejemplo n.º 4
0
        public static GalleryExportList GetGalleryExport(Guid galleryID)
        {
            GalleryExportList lstG = null;

            try {
                string sXML = ContentImportExportUtils.GetSerialized(galleryID);
                lstG = ContentImportExportUtils.GetSerialData <GalleryExportList>(sXML) as GalleryExportList;
            } catch (Exception ex) { }
            return(lstG);
        }
		public static Guid SaveSerializedDataExport(GalleryExportList lstGalleries) {
			Guid gKey = Guid.NewGuid();

			foreach (GalleryExport g in lstGalleries.TheGalleries) {
				g.TheGallery.GalleryID = Guid.NewGuid();
				g.TheGallery.GalleryImages.ForEach(q => q.GalleryID = g.TheGallery.GalleryID);
				g.TheGallery.GalleryImages.ForEach(q => q.GalleryImageID = Guid.NewGuid());
			}

			ContentImportExportUtils.SaveSerializedDataExport<GalleryExportList>(gKey, lstGalleries);
			return gKey;
		}
Ejemplo n.º 6
0
        public static Guid SaveSerializedDataExport(GalleryExportList lstGalleries)
        {
            Guid gKey = Guid.NewGuid();

            foreach (GalleryExport g in lstGalleries.TheGalleries)
            {
                g.TheGallery.GalleryID = Guid.NewGuid();
                g.TheGallery.GalleryImages.ForEach(q => q.GalleryID      = g.TheGallery.GalleryID);
                g.TheGallery.GalleryImages.ForEach(q => q.GalleryImageID = Guid.NewGuid());
            }

            ContentImportExportUtils.SaveSerializedDataExport <GalleryExportList>(gKey, lstGalleries);
            return(gKey);
        }
		protected void Page_Load(object sender, EventArgs e) {
			pnlReview.Visible = false;
			pnlUpload.Visible = false;

			if (!string.IsNullOrEmpty(Request.QueryString["id"])) {
				gTheID = new Guid(Request.QueryString["id"].ToString());
			} else {
				pnlUpload.Visible = true;
			}

			lblWarning.Text = "";
			lblWarning.Attributes["style"] = "color: #000000;";

			if (gTheID != Guid.Empty) {
				lstGalleries = GalleryExportList.GetGalleryExport(gTheID);
			}

			if (!IsPostBack && gTheID != Guid.Empty) {
				pnlReview.Visible = true;
				LoadLists();
			}
		}
        protected void btnUpload_Click(object sender, EventArgs e)
        {
            string sXML = String.Empty;

            if (upFile.HasFile)
            {
                using (StreamReader sr = new StreamReader(upFile.FileContent)) {
                    sXML = sr.ReadToEnd();
                }
            }
            string sTest = String.Empty;

            if (!string.IsNullOrEmpty(sXML) && sXML.Length > 500)
            {
                sTest = sXML.Substring(0, 250).ToLower();

                try {
                    if (sTest.Contains("<galleryexportlist xmlns:xsi=\"http://www.w3.org/2001/xmlschema-instance\" xmlns:xsd=\"http://www.w3.org/2001/xmlschema\">"))
                    {
                        GalleryExportList galExp = GalleryExportList.DeserializeGalleryExport(sXML);
                        Guid gKey = GalleryExportList.SaveSerializedDataExport(galExp);

                        Response.Redirect(CreateLink("GalleryImport", String.Format("id={0}", gKey)));
                    }

                    lblWarning.Text = "File did not appear to match an expected format.";
                    lblWarning.Attributes["style"] = "color: #990000;";
                } catch (Exception ex) {
                    lblWarning.Text = ex.ToString();
                    lblWarning.Attributes["style"] = "color: #990000;";
                }
            }
            else
            {
                lblWarning.Text = "No file appeared in the upload queue.";
                lblWarning.Attributes["style"] = "color: #990000;";
            }
        }
		//========================
		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);
		}
Ejemplo n.º 10
0
        public static GalleryExportList DeserializeGalleryExport(string sXML)
        {
            GalleryExportList lstG = ContentImportExportUtils.GetSerialData <GalleryExportList>(sXML) as GalleryExportList;

            return(lstG);
        }