Exemple #1
0
 protected void PostCommentCtrl_CommentPosted(object sender, ArticleEventArgs e)
 {
     if (e.IsNew)
     {
         using (MainDataSetTableAdapters.AlternateIdTableAdapter taAlternateId = new MainDataSetTableAdapters.AlternateIdTableAdapter())
         {
             taAlternateId.InsertAlt(this.Master.InstanceGuid, e.ArticleGuid, this.AlternateId);
         }
         PanelArticle.Visible = false;
         PanelSuccess.Visible = true;
         //LabelCommentPosted.Text = string.Format(LabelCommentPosted.Text, PostCommentCtrl.ReceiverName);
         //Response.Redirect(string.Format("~/?i={0}&t={1}#comments", this.Master.InstanceGuid.ToString("N"), e.ArticleGuid.ToString("N")), false);
     }
     else
     {
         CommentsListCtrl.DataBind();
         CommentsListCtrl.RegisterGoAnchor();
     }
 }
Exemple #2
0
        private void DoArticleView(MainDataSet.ArticleRow articleRow)
        {
            PanelArticle.Visible = true;
            if (articleRow != null)
            {
                if (!IsPopup)
                {
                    UserContext.Breadcrumbs.AddRange(Utils.GenerateBreadCrumbs(articleRow.ArticleGuid, this.Master.InstanceGuid, false));
                }
                //Master.CustomName = articleRow.Subject;
                Master.Title    = articleRow.Subject;
                litSubject.Text = articleRow.Subject;
                HtmlMeta metaKeywords = new HtmlMeta();
                metaKeywords.Name    = "keywords";
                metaKeywords.Content = Master.Title;
                Page.Header.Controls.Add(metaKeywords);
                HtmlMeta metaDescription = new HtmlMeta();
                metaDescription.Name    = "Description";
                metaDescription.Content = articleRow.SearchDesc;
                Page.Header.Controls.Add(metaDescription);

                if (articleRow.Type == ArticleType.Request.ToString())
                {
                    divBody.InnerHtml = (string)this.GetLocalResourceObject("ArticleDoesNotExist");
                }
                else
                {
                    this.ArticleTableAdapter.IncReview(articleRow.ArticleGuid);
                    string body = this.ArticleTableAdapter.GetBody(articleRow.ArticleGuid);
                    if (!string.IsNullOrEmpty(body))
                    {
                        divBody.InnerHtml = body;
                    }
                }
                //divType.InnerText = articleRow.Type;
                Guid userId = Guid.Empty;
                if (!articleRow.IsCreatedByNull())
                {
                    userId = articleRow.CreatedBy;
                }
                if (!articleRow.IsUpdatedByNull())
                {
                    userId = articleRow.UpdatedBy;
                }
                //if (userId == Guid.Empty)
                //    PostCommentCtrl.ReceiverName = Utils.GetInstanceUserName(this.Master.InstanceGuid);
                //else
                //{
                //    using (MainDataSetTableAdapters.Mc_UserTableAdapter userAdapter = new MainDataSetTableAdapters.Mc_UserTableAdapter())
                //    {
                //        MainDataSet.Mc_UserDataTable dtUser = userAdapter.GetDataByUserId(userId);
                //        if (dtUser != null && dtUser.Count > 0)
                //            PostCommentCtrl.ReceiverName = dtUser[0].FirstName + " " + dtUser[0].LastName;
                //    }
                //}
                ArticlesListCtrl.ArticleGuid = articleRow.ArticleGuid;
                PostCommentCtrl.InstanceGuid = this.Master.InstanceGuid;
                PostCommentCtrl.ArticleGuid  = articleRow.ArticleGuid;
                CommentsListCtrl.ArticleGuid = articleRow.ArticleGuid;
                CommentsListCtrl.DataBind();
            }
        }
 protected void PostCommentCtrl_CommentPosted(object sender, ArticleEventArgs e)
 {
     CommentsListCtrl.DataBind();
     CommentsListCtrl.RegisterGoAnchor();
 }
        private void DoAricleView(MainDataSet.ArticleRow articleRow)
        {
            if (articleRow != null)
            {
                this.ArticleTableAdapter.IncReview(articleRow.ArticleGuid);
                ImageListCtrl.ArticleGuid = articleRow.ArticleGuid;
                FileListCtrl.ArticleGuid  = articleRow.ArticleGuid;
                ShowArticleView();

                HyperLinkPreview.Attributes["onclick"] = string.Format(CultureInfo.InvariantCulture, "javascript:window.open('default.aspx?i={0}&t={1}&popup=true', '_blank', 'location=0,menubar=0,resizable=1,scrollbars=1,status=0,titlebar=0,toolbar=0,top=' + Mp_GetPopupPositionY(event) + ',left=' + Mp_GetPopupPositionX({2})  + ',width={2},height={3}');",
                                                                       UserContext.Current.SelectedInstance.InstanceId.ToString("N"),
                                                                       articleRow.ArticleGuid.ToString("N"),
                                                                       Micajah.Common.Configuration.FrameworkConfiguration.Current.WebApplication.MasterPage.HelpLink.WindowWidth,
                                                                       Micajah.Common.Configuration.FrameworkConfiguration.Current.WebApplication.MasterPage.HelpLink.WindowHeight);
                if (articleRow.Deleted)
                {
                    ButtonInactive.Text          = (string)this.GetLocalResourceObject("ActivateArticle");
                    ButtonInactive.OnClientClick = (string)this.GetLocalResourceObject("ConfirmActivate");
                }
                else
                {
                    ButtonInactive.Text          = (string)this.GetLocalResourceObject("InactivateArticle");
                    ButtonInactive.OnClientClick = string.Empty;
                }
                Master.CustomName = articleRow.Subject;
                //Master.Title = string.Format("{0} {1} KB - {2}", this.ArticleTableAdapter.GetOrganizationName(this.Master.InstanceGuid), this.ArticleTableAdapter.GetInstanceName(this.Master.InstanceGuid), articleRow.Subject);
                Master.Title = articleRow.Subject;

                //Master.VisiblePageTitle = false;
                litSubject.Text = articleRow.Subject;
                string body = this.ArticleTableAdapter.GetBody(articleRow.ArticleGuid);
                if (!string.IsNullOrEmpty(body))
                {
                    body = body.Replace("<h2>", "<h2><span>");
                    body = body.Replace("<H2>", "<H2><span>");
                    body = body.Replace("</h2>", "</span></h2>");
                    body = body.Replace("</H2>", "</span></H2>");
                    divBody.InnerHtml = body;//HttpUtility.HtmlDecode(body);
                }
                HtmlMeta metaDescription = new HtmlMeta();
                metaDescription.Name    = "Description";
                metaDescription.Content = articleRow.SearchDesc;
                Page.Header.Controls.Add(metaDescription);
                Guid userId = Guid.Empty;
                if (!articleRow.IsCreatedByNull())
                {
                    userId = articleRow.CreatedBy;
                }
                if (!articleRow.IsUpdatedByNull())
                {
                    userId = articleRow.UpdatedBy;
                }
                //if (userId == Guid.Empty)
                //    PostCommentCtrl.ReceiverName = Utils.GetInstanceUserName(UserContext.Current.SelectedInstance.InstanceId);
                //else
                //{
                //    Micajah.Common.Dal.OrganizationDataSet.UserRow userRow = Micajah.Common.Bll.Providers.UserProvider.GetUserRow(userId);
                //    if (userRow != null)
                //        PostCommentCtrl.ReceiverName = userRow.FirstName + " " + userRow.LastName;
                //}
                PostCommentCtrl.InstanceGuid = UserContext.Current.SelectedInstance.InstanceId;
                PostCommentCtrl.ArticleGuid  = articleRow.ArticleGuid;
                CommentsListCtrl.ArticleGuid = articleRow.ArticleGuid;
                CommentsListCtrl.DataBind();
            }
        }