示例#1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        this.txtTitle.InnerHtml = this.Title;
        this.txtDescription.InnerHtml = this.Description;

        if (this.Description == null) this.txtDescription.Visible = false;

        if (this.MetaData == null) return;
        MetaDataCollection metadata = this.MetaData;

        string featuredImage = metadata.GetFirstStringValue("FeaturedIcon");
        if (featuredImage != null)
        {
            this.imgFeaturedIcon.FileName = featuredImage;
        }

        if (!Page.IsPostBack)
        {
            if (metadata.GetFirstStringValue("IsFeatured") != null)
            {
                this.chckFeatured.Checked = true;
            }
        }
        else if (Page.IsPostBack)
        {
            metadata.Clear("IsFeatured");

            if (this.chckFeatured.Checked) metadata.Set("IsFeatured", "true");

            if (this.FeaturedIconUploader.HasFile)
            {
                Mubble.Models.File file = new Mubble.Models.File();
                file.ControllerID = this.Content.ID;
                file.FileName = this.FeaturedIconUploader.FileName;
                file.Name = this.FeaturedIconUploader.FileName;
                file.Save(this.FeaturedIconUploader.FileContent);

                metadata.Clear("FeaturedIcon");
                metadata.Set("FeaturedIcon", file.FileName, false);
                this.imgFeaturedIcon.FileName = file.FileName;
            }
        }

        if (this.imgFeaturedIcon.FileName != null) this.imgFeaturedIcon.Visible = true;
    }
示例#2
0
        protected void UploadButton_click(object sender, System.EventArgs e)
        {
            if (fileUpload.HasFile)
            {
                Mubble.Models.File m = new Mubble.Models.File();
                m.ControllerID = this.Controller.ID;
                m.FileName = fileUpload.FileName;
                m.Name = fileUpload.FileName;

                m.Save(fileUpload.FileContent);

                string imageLoc = Url.ToString("MediaHandler", "/" + m.FileName);
                string newLoc = Url.ToString("AdminHandler", Url.PathExtra + "?template=popup&src=" + imageLoc);
                Response.Redirect(newLoc);
            }
        }