예제 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        btnDelete.OnClientClick = "return confirm('" + Language.Admin["CategoryDeleteConfirm"] + "');";
        HideAll();

        int iFileID = 0;

        int.TryParse(Request["FileID"], out iFileID);

        if (!string.IsNullOrEmpty(Request["p"]) && Request["p"].Equals("new"))
        {
            divAddMedia.Visible = true;
        }
        else if (iFileID != 0)
        {
            divEditMedia.Visible     = true;
            divEditMediaSide.Visible = true;

            divEditMedia.Visible     = true;
            divEditMediaSide.Visible = true;
            if (!IsPostBack)
            {
                BSPost bsPost = BSPost.GetPost(iFileID);
                if (bsPost != null)
                {
                    tmceContent.Content   = bsPost.Content;
                    txtTitle.Text         = bsPost.Title;
                    cblAddComment.Checked = bsPost.AddComment;
                    ddState.SelectedValue = bsPost.State.ToString();
                    Categories1.TermType  = TermTypes.Category;
                    Categories1.LoadData(bsPost.PostID);
                    Tags1.LoadTags(bsPost.PostID);
                    ddState.Items[0].Text = Language.Admin["HiddenFile"];
                    ddState.Items[1].Text = Language.Admin["PublicFile"];
                    cblAddComment.Text    = Language.Admin["CommentAdd"];

                    string strFolder = bsPost.Show == PostVisibleTypes.Hidden ? "Files/" : bsPost.Show == PostVisibleTypes.Public ? "Images/" : "Files/";

                    ltOpenAddress.Text    = "Upload/" + strFolder + bsPost.Title;
                    ltShowAddress.Text    = "?FileID=" + bsPost.PostID;
                    ltDownloadAdress.Text = "FileHandler.ashx?FileID=" + bsPost.PostID;
                }
                else
                {
                    Response.Redirect("Library.aspx");
                }
            }
        }
        else
        {
            if (!IsPostBack)
            {
                gvPosts.DataBind();
            }
            divLibrary.Visible = true;
        }
    }
    /// <summary>
    /// Page Load
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Page_Load(object sender, EventArgs e)
    {
        gvhDefault.SearchButton.Click += new EventHandler(lbSearch_Click);

        GenerateHeaderButtons();

        if (!Page.IsPostBack)
        {
            HideAll();
            string PostID  = Request.QueryString["PostID"];
            int    iPostID = 0;

            int.TryParse(PostID, out iPostID);

            if (iPostID > 0)
            {
                BSPost bsPost = BSPost.GetPost(iPostID);

                divAddPost.Visible     = true;
                divAddPostSide.Visible = true;
                if (bsPost != null)
                {
                    tmceContent.Content   = bsPost.Content;
                    txtTitle.Text         = bsPost.Title;
                    cblAddComment.Checked = bsPost.AddComment;
                    ddState.SelectedValue = bsPost.State.ToString();
                    Categories1.TermType  = TermTypes.Category;
                    Categories1.LoadData(bsPost.PostID);
                    Tags1.LoadTags(bsPost.PostID);
                    rblDate.Items[0].Text = Language.Admin["NowPublish"];
                    rblDate.Items[1].Text = Language.Admin["ChangeDateTime"];

                    dtsDateTime.SelectedDateTime = bsPost.Date;
                }
                else
                {
                    Response.Redirect("Posts.aspx");
                }
            }
            else
            {
                divPosts.Visible = true;
                gvPosts.DataBind();
            }
        }
    }