protected void btn_Delete_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                for (int i = 0; i < ListView_NewsList.Items.Count; i++)
                {
                    CheckBox chk_Selected = (CheckBox)ListView_NewsList.Items[i].FindControl("chk_Selected");
                    if (chk_Selected.Checked)
                    {
                        HiddenField hidden_NewsID = (HiddenField)ListView_NewsList.Items[i].FindControl("Hidden_NewsID");

                        Lib.NewsMgr   myNewsMgr   = new Lib.NewsMgr();
                        Lib.News_Post myNews_Post = myNewsMgr.Get_News_Post(hidden_NewsID.Value);

                        // Remove from Database
                        myNewsMgr.Remove_News_Comments(hidden_NewsID.Value);
                        myNewsMgr.Remove_News_Post(hidden_NewsID.Value);

                        // Remove Item from Category
                        CategoryMgr myCategoryMgr = new CategoryMgr();
                        myCategoryMgr.Delete_ComponentInCategory_Item(myNews_Post.CategoryID, "3A79BF21-D0DF-4825-BFB2-7F6738C12BA7");
                    }
                }

                Control_Init();
            }
        }
        protected void btn_Move_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                for (int i = 0; i < ListView_NewsList.Items.Count; i++)
                {
                    CheckBox chk_Selected = (CheckBox)ListView_NewsList.Items[i].FindControl("chk_Selected");
                    if (chk_Selected.Checked)
                    {
                        HiddenField hidden_NewsID = (HiddenField)ListView_NewsList.Items[i].FindControl("Hidden_NewsID");

                        Lib.NewsMgr   myNewsMgr   = new Lib.NewsMgr();
                        Lib.News_Post myNews_Post = myNewsMgr.Get_News_Post(hidden_NewsID.Value);

                        if (myNews_Post.CategoryID != CategoryTree_MoveTo.Selected_CategoryID)
                        {
                            e2Data[] UpdateData =
                            {
                                new e2Data("NewsID",     myNews_Post.NewsID),
                                new e2Data("CategoryID", CategoryTree_MoveTo.Selected_CategoryID)
                            };

                            myNewsMgr.Edit_News_Post(UpdateData);

                            // Switch Category
                            CategoryMgr myCategoryMgr = new CategoryMgr();
                            myCategoryMgr.Move_ComponentInCategory_Item(myNews_Post.CategoryID, CategoryTree_MoveTo.Selected_CategoryID, "3A79BF21-D0DF-4825-BFB2-7F6738C12BA7");
                        }
                    }
                }

                Control_Init();
            }
        }
        private void Control_Init()
        {
            if (!DataEval.IsEmptyQuery(Request["NexusNewsPostID"]))
            {
                Lib.NewsMgr   myNewsMgr   = new Lib.NewsMgr();
                Lib.News_Post myNews_Post = myNewsMgr.Get_News_Post(Request["NexusNewsPostID"]);

                tbx_Title.Text = myNews_Post.News_Title;
                TextEditor_NewsContent.Content        = myNews_Post.News_Content;
                CategoryTree_Menu.Selected_CategoryID = myNews_Post.CategoryID;
                droplist_NewsStatus.SelectedValue     = myNews_Post.News_Status.ToString();
                tbx_Password.Text = myNews_Post.News_Password;
                RadDateTimePicker_NewsDate.SelectedDate = Convert.ToDateTime(myNews_Post.News_Date);
                TextEditor_ContentBrief.Content         = myNews_Post.News_Brief;
                tbx_Author.Text     = myNews_Post.Author;
                tbx_SourceName.Text = myNews_Post.Source_Name;
                tbx_SourceURL.Text  = myNews_Post.Source_URL;

                _newsid                        = myNews_Post.NewsID;
                ViewState["NewsID"]            = _newsid;
                _source_categoryid             = myNews_Post.CategoryID;
                ViewState["Source_CategoryID"] = _source_categoryid;
            }
            else
            {
                btn_Update.Enabled = false;
            }
        }
示例#4
0
        protected void btn_PostComment_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                if (!DataEval.IsEmptyQuery(Request["NexusNewsPostID"]))
                {
                    string _current_userid = Security.Users.UserStatus.Current_UserID(this.Page);

                    if (!_isguestcomment)
                    {
                        if (_current_userid == "0")
                        {
                            Control_Init();
                            return;
                        }
                    }


                    Lib.NewsMgr myNewsMgr = new Lib.NewsMgr();

                    e2Data[] UpdateData =
                    {
                        new e2Data("Parent_CommentID", "-1"),
                        new e2Data("NewsID",           Request["NexusNewsPostID"]),
                        new e2Data("UserID",           _current_userid),
                        new e2Data("UserName",         tbx_Comment_UserName.Text),
                        new e2Data("UserEmail",        tbx_Comment_UserEmail.Text),
                        new e2Data("UserURL",          tbx_Comment_UserURL.Text),
                        new e2Data("UserIPaddress",    Request.ServerVariables["REMOTE_ADDR"]),
                        new e2Data("Post_Date",        DateTime.Now.ToString()),
                        new e2Data("Post_Content",     RadEditor_Comment.Content),
                        new e2Data("Comment_Approved", "1")
                    };

                    myNewsMgr.Add_News_Comment(UpdateData);

                    // Add Comment Count
                    Lib.News_Post myNews_Post = myNewsMgr.Get_News_Post(Request["NexusNewsPostID"]);

                    int _comment_count = Convert.ToInt32(myNews_Post.Comment_Count) + 1;

                    e2Data[] UpdateData_Post =
                    {
                        new e2Data("NewsID",        myNews_Post.NewsID),
                        new e2Data("Comment_Count", _comment_count.ToString())
                    };

                    myNewsMgr.Edit_News_Post(UpdateData_Post);

                    Control_Init();
                }
            }
        }
示例#5
0
        private void Control_PreInit()
        {
            if (!DataEval.IsEmptyQuery(Request["NexusNewsPostID"]))
            {
                // Add View Count
                Lib.NewsMgr myNewsMgr = new Lib.NewsMgr();

                Lib.News_Post myNews_Post = myNewsMgr.Get_News_Post(Request["NexusNewsPostID"]);

                int _view_count = Convert.ToInt32(myNews_Post.View_Count) + 1;

                e2Data[] UpdateData_Post =
                {
                    new e2Data("NewsID",     myNews_Post.NewsID),
                    new e2Data("View_Count", _view_count.ToString())
                };

                myNewsMgr.Edit_News_Post(UpdateData_Post);
            }
        }
示例#6
0
        private void Control_Init()
        {
            if (DataEval.IsEmptyQuery(_newsdetailid))
            {
                MultiView_NewsDetail.SetActiveView(View_New);
            }
            else
            {
                MultiView_NewsDetail.SetActiveView(View_Detail);

                if (Request.QueryString["PageLink"] == "Disable")
                {
                    hlink_Edit_News.Enabled = false;
                    btn_PostComment.Enabled = false;
                }

                // Init Comment Form
                RadEditor_Comment.ToolsFile = "~/App_Data/Editor/BasicTools.xml";
                RadEditor_Comment.EditModes = Telerik.Web.UI.EditModes.Design | Telerik.Web.UI.EditModes.Preview;
                RadEditor_Comment.Content   = "";

                if (!DataEval.IsEmptyQuery(Request["NexusNewsPostID"]))
                {
                    Lib.NewsMgr myNewsMgr = new Lib.NewsMgr();

                    Lib.News_Post myNews_Post = myNewsMgr.Get_News_Post(Request["NexusNewsPostID"]);

                    if (Security.Users.UserStatus.Validate_PageAuth_Modify(this.Page))
                    {
                        hlink_Edit_News.Visible = true;

                        hlink_Edit_News.Attributes["href"]    = "#";
                        hlink_Edit_News.Attributes["onclick"] = string.Format("return Show_ControlManager('/App_AdminCP/SiteAdmin/PoP_ControlPanel.aspx?ControlID={0}&NexusNewsPostID={1}');", "60B08E61-40DA-4989-B401-81B75A619F85", myNews_Post.NewsID);
                    }
                    else
                    {
                        hlink_Edit_News.Visible = false;
                    }

                    // Page Title
                    if (_ispagetitle)
                    {
                        Page.Title = myNews_Post.News_Title;
                    }

                    // Fillup Post Content
                    List <News_Post> myNews_Posts = new List <News_Post>();
                    myNews_Posts.Add(myNews_Post);

                    FormView_NewsDetail.DataSource   = myNews_Posts;
                    FormView_NewsDetail.DataKeyNames = new string[] { "NewsID" };

                    Core.Tools.AppItemTemplates myNewsDetail_ItemTemplate = new Core.Tools.AppItemTemplates();

                    switch (_newsdetail_itemtemplate)
                    {
                    case "Default":
                        myNewsDetail_ItemTemplate.ItemTemplatePath = "~/App_Control_Style/Nexus_News/Templates/NewsDetail_Default.ascx";
                        break;

                    case "Custom":
                        myNewsDetail_ItemTemplate.ItemTemplatePath = _newsdetail_itemtemplateurl;
                        break;

                    default:
                        myNewsDetail_ItemTemplate.ItemTemplatePath = "~/App_Control_Style/Nexus_News/Templates/NewsDetail_Default.ascx";
                        break;
                    }

                    FormView_NewsDetail.ItemTemplate = Page.LoadTemplate(myNewsDetail_ItemTemplate.ItemTemplatePath);

                    try
                    {
                        FormView_NewsDetail.DataBind();
                    }
                    catch
                    {
                        // Load Template Failed
                    }


                    //lbl_Title.Text = myNews_Post.News_Title;
                    //lbl_News_Date.Text = myNews_Post.News_Date_Short;
                    //lbl_UserName.Text = myNews_Post.UserName;
                    //Literal_Content.Text = myNews_Post.News_Content;
                    //lbl_Post_ModifyDate.Text = myNews_Post.News_ModifyDate;
                    //lbl_Comment_Count.Text = myNews_Post.Comment_Count;

                    //// Fillup Author
                    //if (DataEval.IsEmptyQuery(myNews_Post.Author) && DataEval.IsEmptyQuery(myNews_Post.Source_Name))
                    //{
                    //    Panel_Original_Source.Visible = false;
                    //}
                    //else
                    //{
                    //    Panel_Original_Source.Visible = true;

                    //    if (!DataEval.IsEmptyQuery(myNews_Post.Author))
                    //        lbl_Author.Text = "Author : " + myNews_Post.Author;

                    //    if (!DataEval.IsEmptyQuery(myNews_Post.Source_Name_URL))
                    //        lbl_Source_Name.Text = "Source : " + myNews_Post.Source_Name_URL;

                    //}

                    // Enable Comment
                    if (_iscomment)
                    {
                        // Show Comment Title
                        #region Show Comment Title
                        FormView_Comment.DataSource   = myNews_Posts;
                        FormView_Comment.DataKeyNames = new string[] { "NewsID" };

                        Core.Tools.AppItemTemplates myCommentTitle_ItemTemplate = new Core.Tools.AppItemTemplates();

                        switch (_commenttitle_itemtemplate)
                        {
                        case "Default":
                            myCommentTitle_ItemTemplate.ItemTemplatePath = "~/App_Control_Style/Nexus_News/Templates/NewsCommentTitle_Default.ascx";
                            break;

                        case "Custom":
                            myCommentTitle_ItemTemplate.ItemTemplatePath = _commenttitle_itemtemplateurl;
                            break;

                        default:
                            myCommentTitle_ItemTemplate.ItemTemplatePath = "~/App_Control_Style/Nexus_News/Templates/NewsCommentTitle_Default.ascx";
                            break;
                        }

                        FormView_Comment.ItemTemplate = Page.LoadTemplate(myCommentTitle_ItemTemplate.ItemTemplatePath);

                        try
                        {
                            FormView_Comment.DataBind();
                        }
                        catch
                        {
                            // Load Template Failed
                        }

                        #endregion

                        //  Load User Name and Disable Guest Comment
                        string _current_username = Security.Users.UserStatus.Current_UserName(this.Page);
                        if (_current_username == "Guest")
                        {
                            if (_isguestcomment)
                            {
                                btn_PostComment.Enabled = true;
                            }
                            else
                            {
                                btn_PostComment.Enabled = false;
                            }

                            tbx_Comment_UserName.Enabled  = true;
                            Panel_Comment_Contact.Visible = false;
                        }
                        else
                        {
                            tbx_Comment_UserName.Text     = _current_username;
                            tbx_Comment_UserName.Enabled  = false;
                            Panel_Comment_Contact.Visible = true;
                        }

                        // Bind Post Comment
                        ListView_Comment.DataSource   = myNewsMgr.Get_News_Comments(Request["NexusNewsPostID"], "1");
                        ListView_Comment.DataKeyNames = new string[] { "CommentID" };

                        Core.Tools.AppItemTemplates myComment_ItemTemplate = new Core.Tools.AppItemTemplates();

                        switch (_comment_itemtemplate)
                        {
                        case "Default":
                            myComment_ItemTemplate.ItemTemplatePath = "~/App_Control_Style/Nexus_News/Templates/NewsComment_Default.ascx";
                            break;

                        case "Custom":
                            myComment_ItemTemplate.ItemTemplatePath = _comment_itemtemplateurl;
                            break;

                        default:
                            myComment_ItemTemplate.ItemTemplatePath = "~/App_Control_Style/Nexus_News/Templates/NewsComment_Default.ascx";
                            break;
                        }

                        myComment_ItemTemplate.Set_Separator("");
                        myComment_ItemTemplate.Set_DataEmpty("");

                        ListView_Comment.ItemTemplate            = Page.LoadTemplate(myComment_ItemTemplate.ItemTemplatePath);
                        ListView_Comment.AlternatingItemTemplate = Page.LoadTemplate(myComment_ItemTemplate.AltPath);

                        if (!DataEval.IsEmptyQuery(myComment_ItemTemplate.Separator))
                        {
                            ListView_Comment.ItemSeparatorTemplate = Page.LoadTemplate(myComment_ItemTemplate.Separator);
                        }

                        if (!DataEval.IsEmptyQuery(myComment_ItemTemplate.DataEmpty))
                        {
                            ListView_Comment.EmptyDataTemplate = Page.LoadTemplate(myComment_ItemTemplate.DataEmpty);
                        }

                        try
                        {
                            ListView_Comment.DataBind();
                        }
                        catch
                        {
                            // Load Template Failed
                        }

                        DataPager_PostView.PageSize = _numberperpage;

                        Panel_Comment.Visible = true;
                    }
                    else
                    {
                        Panel_Comment.Visible = false;
                    }
                }
                else
                {
                    // No Post ID
                    hlink_Edit_News.Visible = false;
                    Panel_Comment.Visible   = false;
                }
            }
        }