Ejemplo n.º 1
0
        /// <summary>
        /// Create new post
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btn_Update_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                if (!DataEval.IsEmptyQuery(_ownership_userid))
                {
                    if (Security.Users.UserStatus.Validate_Ownership(this.Page, _ownership_userid) ||
                        Security.Users.UserStatus.Validate_PageAuth_Modify(this.Page))
                    {
                        // Check Blog UserID before post
                        if (_ownership_userid == "ALL")
                        {
                            btn_Update.Text    = "Blog UserID is not valid";
                            btn_Update.Enabled = false;
                            return;
                        }

                        Lib.BlogMgr myBlogMgr = new Lib.BlogMgr();

                        string Post_Date;
                        try
                        {
                            Post_Date = RadDateTimePicker_PostDate.SelectedDate.ToString();
                        }
                        catch
                        {
                            Post_Date = DateTime.Now.ToString();
                        }

                        e2Data[] UpdateData =
                        {
                            new e2Data("Ownership_UserID", _ownership_userid),
                            new e2Data("UserID",           Security.Users.UserStatus.Current_UserID(this.Page)),
                            new e2Data("UserName",         Security.Users.UserStatus.Current_UserName(this.Page)),
                            new e2Data("Post_Date",        Post_Date),
                            new e2Data("Post_ModifyDate",  Post_Date),
                            new e2Data("Post_Title",       tbx_Title.Text),
                            new e2Data("Post_Content",     RadEditor_BlogContent.Content),
                            new e2Data("Post_Status",      droplist_PostStatus.SelectedValue),
                            new e2Data("Post_Password",    tbx_Password.Text)
                        };

                        myBlogMgr.Add_Blog_Post(UpdateData);

                        _view_stage            = "view_posts";
                        ViewState["ViewStage"] = _view_stage;

                        Control_Init();
                    }
                    else
                    {
                        btn_Update.Text    = "User does not have permission";
                        btn_Update.Enabled = false;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        protected void btn_PostComment_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                if (!DataEval.IsEmptyQuery(Request["NexusBlogPostID"]))
                {
                    string _current_userid = Security.Users.UserStatus.Current_UserID(this.Page);

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


                    Lib.BlogMgr myBlogMgr = new Lib.BlogMgr();

                    e2Data[] UpdateData =
                    {
                        new e2Data("Parent_CommentID", "-1"),
                        new e2Data("PostID",           Request["NexusBlogPostID"]),
                        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")
                    };

                    myBlogMgr.Add_Blog_Comment(UpdateData);

                    // Add Comment Count
                    Lib.Blog_Post myBlog_Post = myBlogMgr.Get_Blog_Post(Request["NexusBlogPostID"]);

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

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

                    myBlogMgr.Edit_Blog_Post(UpdateData_Post);

                    Control_Init();
                }
            }
        }
Ejemplo n.º 3
0
        protected void lbtn_Edit_Post_Click(object sender, EventArgs e)
        {
            _view_stage            = "view_edit";
            ViewState["ViewStage"] = _view_stage;

            MultiView_PostView.SetActiveView(View_Edit);

            if (!DataEval.IsEmptyQuery(Request["NexusBlogPostID"]))
            {
                Lib.BlogMgr myBlogMgr = new Lib.BlogMgr();

                Lib.Blog_Post myBlog_Post = myBlogMgr.Get_Blog_Post(Request["NexusBlogPostID"]);

                // Initiate Post form default setting
                RadEditor_BlogContent.ToolsFile = "~/App_Data/Editor/BasicTools.xml";

                #region Bind Data to droplist
                // Enable user edit mode

                //Gets your enum names and adds it to a string array
                Array enumNames = Enum.GetValues(typeof(Lib.Post_Status));

                //Creates an ArrayList
                ArrayList myPost_Statuses = new ArrayList();

                //Loop through your string array and poppulates the ArrayList
                foreach (Lib.Post_Status myPost_Status in enumNames)
                {
                    myPost_Statuses.Add(new { Value = StringEnum.GetStringValue(myPost_Status), Name = myPost_Status.ToString() });
                }


                //Bind the ArrayList to your DropDownList
                droplist_PostStatus.DataSource     = myPost_Statuses;
                droplist_PostStatus.DataTextField  = "Name";
                droplist_PostStatus.DataValueField = "Value";
                droplist_PostStatus.DataBind();
                #endregion

                // Init Form data
                tbx_Title.Text = myBlog_Post.Post_Title;
                RadEditor_BlogContent.Content     = myBlog_Post.Post_Content;
                droplist_PostStatus.SelectedValue = myBlog_Post.Post_Status.ToString();
                tbx_Password.Text = myBlog_Post.Post_Password;
                RadDateTimePicker_PostDate.SelectedDate = Convert.ToDateTime(myBlog_Post.Post_Date);
            }
            else
            {
                Control_Init();
            }
        }
Ejemplo n.º 4
0
        protected void btn_Update_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                if (!DataEval.IsEmptyQuery(Request["NexusBlogPostID"]))
                {
                    Lib.BlogMgr   myBlogMgr   = new Lib.BlogMgr();
                    Lib.Blog_Post myBlog_Post = myBlogMgr.Get_Blog_Post(Request["NexusBlogPostID"]);

                    if (Security.Users.UserStatus.Validate_Ownership(this.Page, myBlog_Post.Ownership_UserID) ||
                        Security.Users.UserStatus.Validate_PageAuth_Modify(this.Page))
                    {
                        string Post_Date;
                        try
                        {
                            Post_Date = RadDateTimePicker_PostDate.SelectedDate.ToString();
                        }
                        catch
                        {
                            Post_Date = DateTime.Now.ToString();
                        }

                        e2Data[] UpdateData =
                        {
                            new e2Data("PostID",          myBlog_Post.PostID),
                            new e2Data("UserID",          Security.Users.UserStatus.Current_UserID(this.Page)),
                            new e2Data("UserName",        Security.Users.UserStatus.Current_UserName(this.Page)),
                            new e2Data("Post_Date",       Post_Date),
                            new e2Data("Post_ModifyDate", DateTime.Now.ToString()),
                            new e2Data("Post_Title",      tbx_Title.Text),
                            new e2Data("Post_Content",    RadEditor_BlogContent.Content),
                            new e2Data("Post_Status",     droplist_PostStatus.SelectedValue),
                            new e2Data("Post_Password",   tbx_Password.Text)
                        };

                        myBlogMgr.Edit_Blog_Post(UpdateData);

                        _view_stage            = "view_post";
                        ViewState["ViewStage"] = _view_stage;

                        Control_Init();
                    }
                    else
                    {
                        btn_Update.Text    = "User does not have permission";
                        btn_Update.Enabled = false;
                    }
                }
            }
        }
Ejemplo n.º 5
0
        protected void lbtn_BlogPostsURL_Click(object sender, EventArgs e)
        {
            if (!DataEval.IsEmptyQuery(Request["NexusBlogPostID"]))
            {
                Lib.BlogMgr   myBlogMgr   = new Lib.BlogMgr();
                Lib.Blog_Post myBlog_Post = myBlogMgr.Get_Blog_Post(Request["NexusBlogPostID"]);

                Response.Redirect(Core.Tools.URLParse.Update_Arg(_blogpostsurl, "NexusBlogUserID", myBlog_Post.Ownership_UserID));
            }
            else
            {
                Response.Redirect(_blogpostsurl);
            }
        }
Ejemplo n.º 6
0
        private void Control_PreInit()
        {
            if (!DataEval.IsEmptyQuery(Request["NexusBlogPostID"]))
            {
                // Add View Count
                Lib.BlogMgr myBlogMgr = new Lib.BlogMgr();

                Lib.Blog_Post myBlog_Post = myBlogMgr.Get_Blog_Post(Request["NexusBlogPostID"]);

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

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

                myBlogMgr.Edit_Blog_Post(UpdateData_Post);
            }
        }
Ejemplo n.º 7
0
        private void Control_Init()
        {
            if (DataEval.IsEmptyQuery(_postviewid))
            {
                MultiView_PostView.SetActiveView(View_New);
            }
            else
            {
                if (Request.QueryString["PageLink"] == "Disable")
                {
                    lbtn_Edit_Post.Enabled    = false;
                    lbtn_BlogPostsURL.Enabled = false;
                    btn_PostComment.Enabled   = false;
                }

                if (_view_stage == "view_edit")
                {
                    MultiView_PostView.SetActiveView(View_Edit);
                }
                else
                {
                    MultiView_PostView.SetActiveView(View_Post);

                    _view_stage            = "view_post";
                    ViewState["ViewStage"] = _view_stage;

                    // 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["NexusBlogPostID"]))
                    {
                        Lib.BlogMgr myBlogMgr = new Lib.BlogMgr();

                        Lib.Blog_Post myBlog_Post = myBlogMgr.Get_Blog_Post(Request["NexusBlogPostID"]);

                        if (Security.Users.UserStatus.Validate_Ownership(this.Page, myBlog_Post.Ownership_UserID) ||
                            Security.Users.UserStatus.Validate_PageAuth_Modify(this.Page))
                        {
                            lbtn_Edit_Post.Visible = true;
                        }
                        else
                        {
                            lbtn_Edit_Post.Visible = false;
                        }

                        // Page Title
                        if (_ispagetitle)
                        {
                            Page.Title = myBlog_Post.Post_Title;
                        }

                        // Fillup Post Content
                        lbl_Title.Text           = myBlog_Post.Post_Title;
                        lbl_Post_Date.Text       = myBlog_Post.Post_Date_Short;
                        lbl_UserName.Text        = myBlog_Post.UserName;
                        Literal_Content.Text     = myBlog_Post.Post_Content;
                        lbl_Post_ModifyDate.Text = myBlog_Post.Post_ModifyDate;
                        lbl_Comment_Count.Text   = myBlog_Post.Comment_Count;

                        // Add Social button
                        PlaceHolder_SocialNetwork.Controls.Clear();

                        string    _facebook   = string.Format("http://www.facebook.com/sharer.php?u={0}&t={1}", Server.UrlEncode(Request.Url.ToString()), Server.UrlEncode(myBlog_Post.Post_Title));
                        HyperLink myHyperLink = new HyperLink();
                        myHyperLink.NavigateUrl = _facebook;
                        myHyperLink.Target      = "_blank";
                        myHyperLink.ImageUrl    = "~/App_Control_Style/Nexus_mBlog/SocialBookmark/Facebook_24.png";

                        PlaceHolder_SocialNetwork.Controls.Add(myHyperLink);

                        //  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;
                        }
                        else
                        {
                            tbx_Comment_UserName.Text    = _current_username;
                            tbx_Comment_UserName.Enabled = false;
                        }

                        // Bind Post Comment
                        ListView_Comment.DataSource   = myBlogMgr.Get_Blog_Comments(Request["NexusBlogPostID"], "1");
                        ListView_Comment.DataKeyNames = new string[] { "CommentID" };
                        ListView_Comment.DataBind();

                        DataPager_PostView.PageSize = _numberperpage;
                    }
                    else
                    {
                        // No Post ID
                        lbtn_Edit_Post.Visible  = false;
                        btn_PostComment.Visible = false;
                    }
                }
            }
        }
Ejemplo n.º 8
0
        private void Control_Init()
        {
            if (DataEval.IsEmptyQuery(_blogpostsid))
            {
                MultiView_BlogPosts.SetActiveView(View_New);
            }
            else
            {
                if (Request.QueryString["PageLink"] == "Disable")
                {
                    ListView_BlogPosts.Enabled      = false;
                    ListView_BlogPosts_List.Enabled = false;
                    btn_PostStatus_Show.Enabled     = false;

                    _ownership_userid             = "ALL";
                    ViewState["Ownership_UserID"] = _ownership_userid;
                }
                else
                {
                    if (DataEval.IsEmptyQuery(Request["NexusBlogUserID"]))
                    {
                        // Not valid Blog UserID
                        Invalid_BlogUserID();
                    }
                    else
                    {
                        // Check Blog UserID is valid
                        Security.Users.UserMgr myUserMgr = new Security.Users.UserMgr();

                        if (myUserMgr.Chk_UserID_Exist(Request["NexusBlogUserID"]))
                        {
                            _ownership_userid             = Request["NexusBlogUserID"];
                            ViewState["Ownership_UserID"] = _ownership_userid;

                            _maxnumberposts = -1;
                        }
                        else
                        {
                            // Not valid Blog UserID
                            Invalid_BlogUserID();
                        }
                    }
                }

                if (_view_stage == "view_add_post")
                {
                    MultiView_BlogPosts.SetActiveView(View_Add_Post);
                }
                else
                {
                    MultiView_BlogPosts.SetActiveView(View_Posts);

                    #region Bind Data to droplist
                    // Enable user edit mode

                    //Gets your enum names and adds it to a string array
                    Array enumNames = Enum.GetValues(typeof(Lib.Post_Status));

                    //Creates an ArrayList
                    ArrayList myPost_Statuses = new ArrayList();

                    //Loop through your string array and poppulates the ArrayList
                    foreach (Lib.Post_Status myPost_Status in enumNames)
                    {
                        myPost_Statuses.Add(new { Value = StringEnum.GetStringValue(myPost_Status), Name = myPost_Status.ToString() });
                    }


                    //Bind the ArrayList to your DropDownList
                    droplist_PostStatus_Show.DataSource     = myPost_Statuses;
                    droplist_PostStatus_Show.DataTextField  = "Name";
                    droplist_PostStatus_Show.DataValueField = "Value";
                    droplist_PostStatus_Show.DataBind();
                    #endregion

                    _view_stage            = "view_posts";
                    ViewState["ViewStage"] = _view_stage;

                    if (DataEval.IsEmptyQuery(_post_status_show))
                    {
                        _post_status_show = droplist_PostStatus_Show.SelectedValue;
                        //ViewState["PostStatus_Show"] = _post_status_show;
                    }
                    else
                    {
                        droplist_PostStatus_Show.SelectedValue = _post_status_show;
                    }

                    #region Check who can change the post

                    if (Security.Users.UserStatus.Validate_Ownership(this.Page, _ownership_userid) ||
                        Security.Users.UserStatus.Validate_PageAuth_Modify(this.Page))
                    {
                        if (_ownership_userid == "ALL")
                        {
                            lbtn_Add_Post.Visible            = false;
                            droplist_PostStatus_Show.Visible = false;
                            btn_PostStatus_Show.Visible      = false;
                        }
                        else
                        {
                            lbtn_Add_Post.Visible            = true;
                            droplist_PostStatus_Show.Visible = true;
                            btn_PostStatus_Show.Visible      = true;
                        }
                    }
                    else
                    {
                        lbtn_Add_Post.Visible            = false;
                        droplist_PostStatus_Show.Visible = false;
                        btn_PostStatus_Show.Visible      = false;
                    }

                    #endregion

                    Lib.BlogMgr myBlogMgr = new Lib.BlogMgr();

                    if (_showcontent)
                    {
                        ListView_BlogPosts.DataSource   = myBlogMgr.Get_mBlog_Posts(_ownership_userid, _post_status_show, _maxnumberposts);
                        ListView_BlogPosts.DataKeyNames = new string[] { "PostID" };
                        ListView_BlogPosts.DataBind();

                        DataPager_BlogPosts.PageSize = _numberperpage;

                        ListView_BlogPosts.Visible       = true;
                        DataPager_BlogPosts.Visible      = true;
                        ListView_BlogPosts_List.Visible  = false;
                        DataPager_BlogPosts_List.Visible = false;
                    }
                    else
                    {
                        ListView_BlogPosts_List.DataSource   = myBlogMgr.Get_mBlog_Posts(_ownership_userid, _post_status_show, _maxnumberposts);
                        ListView_BlogPosts_List.DataKeyNames = new string[] { "PostID" };
                        ListView_BlogPosts_List.DataBind();

                        DataPager_BlogPosts_List.PageSize = _numberperpage;

                        ListView_BlogPosts.Visible       = false;
                        DataPager_BlogPosts.Visible      = false;
                        ListView_BlogPosts_List.Visible  = true;
                        DataPager_BlogPosts_List.Visible = true;
                    }
                }
            }
        }
Ejemplo n.º 9
0
        private void Control_Init()
        {
            if (DataEval.IsEmptyQuery(_blogpostsid))
            {
                MultiView_BlogPosts.SetActiveView(View_New);
            }
            else
            {
                if (Request.QueryString["PageLink"] == "Disable")
                {
                    ListView_BlogPosts.Enabled  = false;
                    btn_PostStatus_Show.Enabled = false;
                }

                MultiView_BlogPosts.SetActiveView(View_Posts);

                #region Bind Data to droplist
                // Enable user edit mode

                //Gets your enum names and adds it to a string array
                Array enumNames = Enum.GetValues(typeof(Lib.Post_Status));

                //Creates an ArrayList
                ArrayList myPost_Statuses = new ArrayList();

                //Loop through your string array and poppulates the ArrayList
                foreach (Lib.Post_Status myPost_Status in enumNames)
                {
                    myPost_Statuses.Add(new { Value = StringEnum.GetStringValue(myPost_Status), Name = myPost_Status.ToString() });
                }


                //Bind the ArrayList to your DropDownList
                droplist_PostStatus_Show.DataSource     = myPost_Statuses;
                droplist_PostStatus_Show.DataTextField  = "Name";
                droplist_PostStatus_Show.DataValueField = "Value";
                droplist_PostStatus_Show.DataBind();
                #endregion


                if (Security.Users.UserStatus.Validate_Ownership(this.Page, _ownership_userid) ||
                    Security.Users.UserStatus.Validate_PageAuth_Modify(this.Page))
                {
                    lbtn_Add_Post.Visible            = true;
                    droplist_PostStatus_Show.Visible = true;
                    btn_PostStatus_Show.Visible      = true;
                }
                else
                {
                    lbtn_Add_Post.Visible            = false;
                    droplist_PostStatus_Show.Visible = false;
                    btn_PostStatus_Show.Visible      = false;
                }

                Lib.BlogMgr myBlogMgr = new Lib.BlogMgr();

                ListView_BlogPosts.DataSource   = myBlogMgr.Get_Blog_Posts(_ownership_userid, "Publish", _postviewurl);
                ListView_BlogPosts.DataKeyNames = new string[] { "PostID" };

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

                switch (_itemtemplate)
                {
                case "Default":
                    myItemTemplate.ItemTemplatePath = "~/App_Control_Style/Nexus_Blog/Templates/BlogPosts_Default.ascx";
                    break;

                case "TitleOnly":
                    myItemTemplate.ItemTemplatePath = "~/App_Control_Style/Nexus_Blog/Templates/BlogPosts_TitleOnly.ascx";
                    break;

                case "Custom":
                    myItemTemplate.ItemTemplatePath = _itemtemplateurl;
                    break;

                default:
                    myItemTemplate.ItemTemplatePath = "~/App_Control_Style/Nexus_Blog/Templates/BlogPosts_Default.ascx";
                    break;
                }

                myItemTemplate.Set_Separator("");
                myItemTemplate.Set_DataEmpty("");

                ListView_BlogPosts.ItemTemplate            = Page.LoadTemplate(myItemTemplate.ItemTemplatePath);
                ListView_BlogPosts.AlternatingItemTemplate = Page.LoadTemplate(myItemTemplate.AltPath);

                if (!DataEval.IsEmptyQuery(myItemTemplate.Separator))
                {
                    ListView_BlogPosts.ItemSeparatorTemplate = Page.LoadTemplate(myItemTemplate.Separator);
                }

                if (!DataEval.IsEmptyQuery(myItemTemplate.DataEmpty))
                {
                    ListView_BlogPosts.EmptyDataTemplate = Page.LoadTemplate(myItemTemplate.DataEmpty);
                }

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


                DataPager_BlogPosts.PageSize = _numberperpage;
                DataPager_BlogPosts.Visible  = _enable_pager;
            }
        }
Ejemplo n.º 10
0
        private void Control_Init()
        {
            if (DataEval.IsEmptyQuery(_postviewid))
            {
                MultiView_PostView.SetActiveView(View_New);
            }
            else
            {
                if (Request.QueryString["PageLink"] == "Disable")
                {
                    lbtn_Edit_Post.Enabled  = false;
                    btn_PostComment.Enabled = false;
                }


                MultiView_PostView.SetActiveView(View_Post);

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


                // Fillup Post Content
                if (!DataEval.IsEmptyQuery(Request["NexusBlogPostID"]))
                {
                    Lib.BlogMgr myBlogMgr = new Lib.BlogMgr();

                    Lib.Blog_Post myBlog_Post = myBlogMgr.Get_Blog_Post(Request["NexusBlogPostID"]);

                    List <Blog_Post> myPostViews = new List <Blog_Post>();
                    myPostViews.Add(myBlog_Post);

                    FormView_PostView.DataSource   = myPostViews;
                    FormView_PostView.DataKeyNames = new string[] { "PostID" };

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

                    switch (_postview_itemtemplate)
                    {
                    case "Default":
                        myPostView_ItemTemplate.ItemTemplatePath = "~/App_Control_Style/Nexus_Blog/Templates/PostView_Default.ascx";
                        break;

                    case "Custom":
                        myPostView_ItemTemplate.ItemTemplatePath = _postview_itemtemplateurl;
                        break;

                    default:
                        myPostView_ItemTemplate.ItemTemplatePath = "~/App_Control_Style/Nexus_Blog/Templates/PostView_Default.ascx";
                        break;
                    }

                    FormView_PostView.ItemTemplate = Page.LoadTemplate(myPostView_ItemTemplate.ItemTemplatePath);

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

                    //lbl_Title.Text = "Demo Title...";
                    //lbl_Post_Date.Text = DateTime.Now.ToShortDateString();
                    //lbl_UserName.Text = "Demo User Name";
                    //Literal_Content.Text = "<p>Demo Content...</p>";
                    //lbl_Post_ModifyDate.Text = DateTime.Now.ToString();
                    //lbl_Comment_Count.Text = "0";

                    //// Add Social button
                    //PlaceHolder_SocialNetwork.Controls.Clear();

                    //HyperLink myHyperLink = new HyperLink();
                    //myHyperLink.ImageUrl = "~/App_Control_Style/Nexus_Blog/SocialBookmark/Facebook_24.png";

                    //PlaceHolder_SocialNetwork.Controls.Add(myHyperLink);
                }
                else
                {
                    // No Post ID
                    lbtn_Edit_Post.Visible  = false;
                    btn_PostComment.Visible = false;
                }
            }
        }
Ejemplo n.º 11
0
        private void Control_Init()
        {
            if (DataEval.IsEmptyQuery(_postviewid))
            {
                MultiView_PostView.SetActiveView(View_New);
            }
            else
            {
                if (Request.QueryString["PageLink"] == "Disable")
                {
                    lbtn_Edit_Post.Enabled  = false;
                    btn_PostComment.Enabled = false;
                }

                if (_view_stage == "view_edit")
                {
                    MultiView_PostView.SetActiveView(View_Edit);
                }
                else
                {
                    MultiView_PostView.SetActiveView(View_Post);

                    _view_stage            = "view_post";
                    ViewState["ViewStage"] = _view_stage;

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

                    if (!DataEval.IsEmptyQuery(Request["NexusBlogPostID"]))
                    {
                        Lib.BlogMgr myBlogMgr = new Lib.BlogMgr();

                        Lib.Blog_Post myBlog_Post = myBlogMgr.Get_Blog_Post(Request["NexusBlogPostID"]);

                        if (Security.Users.UserStatus.Validate_Ownership(this.Page, myBlog_Post.Ownership_UserID) ||
                            Security.Users.UserStatus.Validate_PageAuth_Modify(this.Page))
                        {
                            lbtn_Edit_Post.Visible = true;
                        }
                        else
                        {
                            lbtn_Edit_Post.Visible = false;
                        }

                        // Page Title
                        if (_ispagetitle)
                        {
                            Page.Title = myBlog_Post.Post_Title;
                        }

                        // Fillup Post Content
                        List <Blog_Post> myPostViews = new List <Blog_Post>();
                        myPostViews.Add(myBlog_Post);

                        FormView_PostView.DataSource   = myPostViews;
                        FormView_PostView.DataKeyNames = new string[] { "PostID" };

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

                        switch (_postview_itemtemplate)
                        {
                        case "Default":
                            myPostView_ItemTemplate.ItemTemplatePath = "~/App_Control_Style/Nexus_Blog/Templates/PostView_Default.ascx";
                            break;

                        case "Custom":
                            myPostView_ItemTemplate.ItemTemplatePath = _postview_itemtemplateurl;
                            break;

                        default:
                            myPostView_ItemTemplate.ItemTemplatePath = "~/App_Control_Style/Nexus_Blog/Templates/PostView_Default.ascx";
                            break;
                        }

                        FormView_PostView.ItemTemplate = Page.LoadTemplate(myPostView_ItemTemplate.ItemTemplatePath);

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

                        //lbl_Title.Text = myBlog_Post.Post_Title;
                        //lbl_Post_Date.Text = myBlog_Post.Post_Date_Short;
                        //lbl_UserName.Text = myBlog_Post.UserName;
                        //Literal_Content.Text = myBlog_Post.Post_Content;
                        //lbl_Post_ModifyDate.Text = myBlog_Post.Post_ModifyDate;
                        //lbl_Comment_Count.Text = myBlog_Post.Comment_Count;

                        //// Add Social button
                        //PlaceHolder_SocialNetwork.Controls.Clear();

                        //string _facebook = string.Format("http://www.facebook.com/sharer.php?u={0}&t={1}", Server.UrlEncode(Request.Url.ToString()), Server.UrlEncode(myBlog_Post.Post_Title));
                        //HyperLink myHyperLink = new HyperLink();
                        //myHyperLink.NavigateUrl = _facebook;
                        //myHyperLink.Target = "_blank";
                        //myHyperLink.ImageUrl = "~/App_Control_Style/Nexus_Blog/SocialBookmark/Facebook_24.png";

                        //PlaceHolder_SocialNetwork.Controls.Add(myHyperLink);

                        //  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   = myBlogMgr.Get_Blog_Comments(Request["NexusBlogPostID"], "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_Blog/Templates/PostComment_Default.ascx";
                            break;

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

                        default:
                            myComment_ItemTemplate.ItemTemplatePath = "~/App_Control_Style/Nexus_Blog/Templates/PostComment_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;
                        DataPager_PostView.Visible  = _enable_pager;
                    }
                    else
                    {
                        // No Post ID
                        lbtn_Edit_Post.Visible  = false;
                        btn_PostComment.Visible = false;
                    }
                }
            }
        }