protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.UrlReferrer != null) { ViewState["RefUrl"] = Request.UrlReferrer.ToString(); } BusiBlocks.DocoBlock.Article latestArticle = BusiBlocks.DocoBlock.DocoManager.GetArticleByName(ArticleName, false); LoadChapter(true); tempChapterId = ChapterId; CreateCustomToolBarBtns(); AddParaHeadingStyles(); BindTrafficLight(); } else { LoadViewState(); } BindArticles(); BindSequence(); }
protected void btnAcknowledge_Click(object sender, EventArgs e) { BusiBlocks.DocoBlock.Article latestArticle = BusiBlocks.DocoBlock.DocoManager.GetArticleByName(ArticleName, false); AuditManager.Audit(Page.User.Identity.Name, latestArticle.Id + latestArticle.Version.ToString(), AuditRecord.AuditAction.Acknowledged); Response.Redirect(hidReferrer.Value); }
private void LoadList() { BusiBlocks.DocoBlock.Article article = BusiBlocks.DocoBlock.DocoManager.GetArticleByName(ArticleName, true); lblTitle.InnerText = article.Title; //if (BusiBlocks.SecurityHelper.CanRead(Page.User, article.Category, article) == false) // throw new BusiBlocks.InvalidPermissionException("read article"); IList <BusiBlocks.DocoBlock.ArticleBase> versions = BusiBlocks.DocoBlock.DocoManager.GetArticleVersions(article); listRepeater.DataSource = versions; listRepeater.DataBind(); }
private SyndicationLibrary.RSS.RssItem CreateRssItem(BusiBlocks.DocoBlock.Article article) { //Calculate the link of the article //The link is encoded automatically by the Rss library string link = Navigation.Doco_ViewArticle(article.Name, article.Version).GetAbsoluteClientUrl(false); string rssTitle = string.Format("[{0}] {1}", article.Category.DisplayName, article.Title); SyndicationLibrary.RSS.RssItem item = new SyndicationLibrary.RSS.RssItem(rssTitle, article.Description, link); item.PublicationDate = article.UpdateDate; item.Guid = new SyndicationLibrary.RSS.RssGuid(link, true); return(item); }
private string ElaborateXHTML(BusiBlocks.DocoBlock.Article latestArticle, BusiBlocks.DocoBlock.ArticleBase article) { var xhtml = new BusiBlocks.XHTMLText(); xhtml.Load(article.Body); string[] attachments = BusiBlocks.DocoBlock.DocoManager.GetFileAttachments(latestArticle, BusiBlocks.DocoBlock.EnabledStatus.Enabled); Array.Sort <string>(attachments); xhtml.ReplaceLinks(delegate(string oldUrl, out string newUrl) { ReplaceLink(latestArticle.Name, attachments, oldUrl, out newUrl); } ); return(xhtml.Xhtml); }
protected void lnkSection_Click(object sender, EventArgs e) { string ArticleNameId = Request["__EVENTARGUMENT"]; BusiBlocks.DocoBlock.Article latestArticle = BusiBlocks.DocoBlock.DocoManager.GetArticleByName(ArticleName, false); BusiBlocks.DocoBlock.ArticleBase article; if (ArticleVersion == 0) { article = latestArticle; } else { article = BusiBlocks.DocoBlock.DocoManager.GetArticleByVersion(latestArticle, ArticleVersion); } var xmlDoc = new XmlDocument(); xmlDoc.LoadXml("<root>" + article.Body + "</root>"); XmlNode hTag = xmlDoc.DocumentElement.SelectSingleNode("//*[@id='" + Request["__EVENTARGUMENT"] + "']"); string firstTag = hTag.OuterXml; int firstIndex = xmlDoc.DocumentElement.InnerXml.IndexOf(firstTag); int lastIndex = GetEndPosition(firstIndex, xmlDoc.DocumentElement.InnerXml, firstTag); if (lastIndex == -1) { lastIndex = xmlDoc.DocumentElement.InnerXml.Length; } int length = lastIndex - firstIndex; string section = xmlDoc.DocumentElement.InnerXml.Substring(firstIndex, length); sectionBody.InnerHtml = section; Control TOC = ParseControl(article.TOC); SetControlVisibility(TOC, ArticleNameId); sectionTOC.Controls.Add(TOC); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BusiBlocks.DocoBlock.Article latestArticle = BusiBlocks.DocoBlock.DocoManager.GetArticleByName(ArticleName, false); hidReferrer.Value = Request.UrlReferrer.OriginalString; if (latestArticle == null) { controlDiv.Visible = false; sectionError.Visible = true; } else { controlDiv.Visible = true; sectionError.Visible = false; LoadArticle(latestArticle); } } }
/// <summary> /// Loads the meta information for the selected document. Called once on PageInit. /// </summary> protected void LoadArticle() { BusiBlocks.DocoBlock.ArticleBase article; BusiBlocks.DocoBlock.Article latestArticle = BusiBlocks.DocoBlock.DocoManager.GetArticleByName(ArticleName, false); //if (BusiBlocks.SecurityHelper.CanRead(Page.User, latestArticle.Category, latestArticle) == false) // throw new BusiBlocks.InvalidPermissionException("read article"); if (!BusiBlocks.SecurityHelper.CanUserView(Page.User.Identity.Name, latestArticle.Category.Id) && !BusiBlocks.SecurityHelper.CheckWriteAccess(Page.User.Identity.Name, latestArticle.Category.Id)) { throw new BusiBlocks.InvalidGroupMembershipException(); } EditMode(latestArticle.Category.Id); if (ArticleVersion == 0) { article = latestArticle; } else { article = BusiBlocks.DocoBlock.DocoManager.GetArticleByVersion(latestArticle, ArticleVersion); } LoadArticleMeta(article); IsNumbChaps = latestArticle.NumberedChaps; //if admin is adding or editing the document then don't audit it. if (Request.UrlReferrer != null) { if (Request.UrlReferrer.AbsoluteUri.Contains("NewArticle.aspx") == false && Request.UrlReferrer.AbsoluteUri.Contains("EditArticle.aspx") == false) { AuditManager.Audit(Page.User.Identity.Name, article.Id + article.Version.ToString(), AuditRecord.AuditAction.Viewed); } } }
private void LoadArticle(BusiBlocks.DocoBlock.Article latestArticle) { try { BusiBlocks.DocoBlock.ArticleBase article; if (!BusiBlocks.SecurityHelper.CanUserView(Page.User.Identity.Name, latestArticle.Category.Id)) { throw new BusiBlocks.InvalidGroupMembershipException(); } if (ArticleVersion == 0) { article = latestArticle; } else { article = BusiBlocks.DocoBlock.DocoManager.GetArticleByVersion(latestArticle, ArticleVersion); } lblArticleTitle.InnerText = article.Title; lblAuthor.InnerText = Utilities.GetDisplayUser(article.Author); lblDate.InnerText = Utilities.GetDateTimeForDisplay(article.UpdateDate); lblVersion.InnerText = article.Version.ToString(); lblArticleDescription.InnerText = article.Description; string body = article.Body; if (ElaborateOutput) { body = ElaborateXHTML(latestArticle, article); } if (Printing) { sectionTOC.Visible = false; sectionBody.InnerHtml = body; } else { if (article.TOC == null) { sectionTOC.Visible = false; sectionBody.Attributes["class"] = "sectionNoTOC"; } else if (article.TOC.Length > 0) { Control TOC = ParseControl(article.TOC); SetControlVisibility(TOC); sectionTOC.Controls.Add(TOC); } else { sectionBody.Attributes["class"] = "sectionNoTOC"; sectionTOC.Visible = false; } AuditManager.Audit(Page.User.Identity.Name, article.Id + article.Version.ToString(), AuditRecord.AuditAction.Viewed); } sectionBody.InnerHtml = body; linkLatestVersion.HRef = Navigation.Doco_ViewArticle(latestArticle.Name, 0).GetServerUrl(true); linkBrowseVersions.HRef = Navigation.Doco_ViewArticleVersions(latestArticle.Name).GetServerUrl(true); //Show the edit only if EditLinkVisible and this is the latest article version bool enabledEdit = BusiBlocks.SecurityHelper.CanUserEdit(Page.User.Identity.Name, latestArticle.Category.Id); linkEdit.Visible = enabledEdit && latestArticle == article; linkEdit.HRef = Navigation.Doco_EditArticle(ArticleName).GetServerUrl(true); linkPrint.HRef = Navigation.Doco_PrintArticle(ArticleName, ArticleVersion).GetServerUrl(true); sectionActions.Visible = SectionActionsVisible; sectionProperties.Visible = SectionPropertiesVisible; btnAcknowledge.Visible = article.RequiresAck && !article.Acknowledged; } catch (Exception ex) { throw ex; ((IFeedback)Page.Master).SetException(GetType(), ex); } }
Navigation.NavigationPage searchResult_SearchEntityUrlCallback(BusiBlocks.ISearchResult entity) { BusiBlocks.DocoBlock.Article article = (BusiBlocks.DocoBlock.Article)entity; return(Navigation.Doco_ViewArticle(article.Name, 0)); }