private string GetContent(M_Collection collectionM, string contentStr) { this.ColumnM = this.ColumnBll.GetColumn(collectionM.ColId); this.ChannelM = this.ChannelBll.GetChannel(this.ColumnM.ChId); this.ModelM = this.InfoModelBll.GetModel(this.ChannelM.ModelType); this.SiteModel = this.SiteBll.GetSiteModel(); B_ConvertImage image = new B_ConvertImage(this.SiteModel.Domain, this.ModelM.UploadPath); string simpleFilterRule = collectionM.SimpleFilterRule; string pattern = string.Empty; string complexityFilterRule = collectionM.ComplexityFilterRule; if (complexityFilterRule != "") { string[] strArray = complexityFilterRule.Split(new char[] { ',' }); for (int i = 0; i < strArray.Length; i++) { this.SuperiorM = this.SuperiorBll.GetIdBySuperior(int.Parse(strArray[i].ToString())); pattern = this.TransferStr(this.SuperiorM.StartCode) + "((?:.|\n)*?)" + this.TransferStr(this.SuperiorM.EndCode); contentStr = this.SuperiorHtml(contentStr, pattern); } } if (simpleFilterRule != "") { string[] strArray2 = simpleFilterRule.Split(new char[] { ',' }); for (int j = 0; j < (strArray2.Length - 1); j++) { switch (int.Parse(strArray2[j].ToString())) { case 0: contentStr = this.FilterObject(contentStr); break; case 1: contentStr = this.FilterScript(contentStr); break; case 2: contentStr = this.FilterStyle(contentStr); break; case 3: contentStr = this.FilterDiv(contentStr); break; case 4: contentStr = this.FilterSpan(contentStr); break; case 5: contentStr = this.FilterTableProtery(contentStr); break; case 6: contentStr = this.FilterImg(contentStr); break; case 7: contentStr = this.FilterFont(contentStr); break; case 8: contentStr = this.FilterA(contentStr); break; case 9: contentStr = this.RemoveHtml(contentStr); break; } } } contentStr = image.ConvertLocalImagePath(contentStr); contentStr = image.ConvertContent(contentStr); return contentStr; }
private void ShowInfo(int ArticleId) { #region 文章基本信息修改 B_Article ArticleBll = new B_Article(); M_Article Articlemodel = ArticleBll.GetArticle(ArticleId); if (Articlemodel == null || Articlemodel.Status == -1) { Function.ShowSysMsg(0, "<li>所选文章不存在或已经被删除</li>"); } txtAuthor.Text = Articlemodel.Author; //重复收费方式 switch (Articlemodel.ChargeType) { case 1: rdBtnChargeType1.Checked = true; break; case 2: txtChargeHourCount.Text = Articlemodel.ChargeHourCount.ToString(); rdBtnChargeType2.Checked = true; break; case 3: rdBtnChargeType3.Checked = true; txtChargeViewCount.Text = Articlemodel.ChargeViewCount.ToString(); break; case 4: txtChargeHourCount.Text = Articlemodel.ChargeHourCount.ToString(); txtChargeViewCount.Text = Articlemodel.ChargeViewCount.ToString(); rdBtnChargeType4.Checked = true; break; case 5: txtChargeHourCount.Text = Articlemodel.ChargeHourCount.ToString(); txtChargeViewCount.Text = Articlemodel.ChargeViewCount.ToString(); rdBtnChargeType5.Checked = true; break; case 6: rdBtnChargeType6.Checked = true; break; } B_ConvertImage convertBll = new B_ConvertImage(SiteModel.Domain, InfoModel.UploadPath); txtContent.Value = convertBll.ConvertContent(Articlemodel.Content); txtContent.Value = txtContent.Value.Replace("{Ky:PAGE}", @"<div style=""page-break-after: always""><span style=""display: none""> </span></div>"); rdBtnPageType.SelectedValue = Articlemodel.PageType.ToString(); txtUpdateDateTime.Text = DateTime.Now.ToString(); //添加时间 txtAddTime.Text = Articlemodel.AddTime.ToString(); txtExpireTime.Text = Articlemodel.ExpireTime.ToString("yyyy-MM-dd"); if (Articlemodel.ViewEndTime != "") txtViewEndTime.Text = Convert.ToDateTime(Articlemodel.ViewEndTime).ToString("yyyy-MM-dd"); rdBtnIsOpened.SelectedValue = Articlemodel.IsOpened.ToString(); foreach (ListItem li in chkBoxGroupIdStr.Items) { if (Articlemodel.GroupIdStr.IndexOf("|" + li.Value + "|") != -1) li.Selected = true; } txtHitCount.Text = Articlemodel.HitCount.ToString(); txtOuterUrl.Text = Articlemodel.OuterUrl; if (txtOuterUrl.Text.Trim() != string.Empty) { rbOuter.Checked = true; } chkBoxIsAllowComment.Checked = Articlemodel.IsAllowComment; chkBoxIsFocus.Checked = Articlemodel.IsFocus; chkBoxIsHeader.Checked = Articlemodel.IsHeader; chkBoxIsIrregular.Checked = Articlemodel.IsIrregular; chkBoxIsRecommend.Checked = Articlemodel.IsRecommend; IsShowCommentLink.Checked = Articlemodel.IsShowCommentLink; chkBoxIsSideShow.Checked = Articlemodel.IsSideShow; chkBoxIsTop.Checked = Articlemodel.IsTop; txtPointCount.Text = Articlemodel.PointCount.ToString(); txtShortContent.Text = Articlemodel.ShortContent; txtSource.Text = Articlemodel.Source; try { ddlStarLevel.SelectedValue = Articlemodel.StarLevel.ToString(); } catch { } //关键字 string tagNameStr = string.Empty; tagNameStr = Articlemodel.TagNameStr; //Response.End(); if (!string.IsNullOrEmpty(tagNameStr)) { if (tagNameStr.StartsWith("|") && tagNameStr.EndsWith("|")) { tagNameStr = tagNameStr.Substring(0, tagNameStr.Length - 1); tagNameStr = tagNameStr.Substring(1, tagNameStr.Length - 1); } } tagNameStr = tagNameStr.Replace("|", " "); txtTagNameStr.Text = tagNameStr; txtTemplatePath.Text = Articlemodel.TemplatePath; txtTitle.Text = Articlemodel.Title; txtLongTitle.Text = Articlemodel.LongTitle; txtTitleColor.Text = Articlemodel.TitleColor.ToString(); ddlTitleFontType.SelectedValue = Articlemodel.TitleFontType.ToString(); switch (int.Parse(Articlemodel.TitleType.ToString())) { case 1: rbComm.Checked = true; break; case 2: rbImg.Checked = true; txtTitleImgPath.Text = Articlemodel.TitleImgPath; break; } //文章所属专题 string[] arraySpecialIdStr = Articlemodel.SpecialIdStr.Split('|'); for (int i = 0; i < arraySpecialIdStr.Length; i++) { for (int j = 0; j < lBoxTopicIdStr.Items.Count; j++) { if (lBoxTopicIdStr.Items[j].Value == arraySpecialIdStr[i]) { lBoxTopicIdStr.Items[j].Selected = true; } } } //签收用户 string viewUName = Articlemodel.ViewUName; if (viewUName != string.Empty && viewUName.StartsWith("|") && viewUName.EndsWith("|")) { viewUName = viewUName.Substring(0, viewUName.Length - 1); viewUName = viewUName.Substring(1, viewUName.Length - 1); txtViewer.Text = viewUName; } txtViewer.Text = viewUName; //头条文章属性设置 if (Articlemodel.HeaderFont.Length != 0) { string[] headerArray = Articlemodel.HeaderFont.Split('|'); txtHeaderFont.Text = headerArray[0]; ddlHeaderProPerty.SelectedValue = headerArray[1]; ddlHeaderSize.SelectedValue = headerArray[2]; txtHeaderColor.Text = headerArray[3]; } txtHeaderImgPath.Value = Articlemodel.HeaderImgPath; #endregion btnAddNewsSave.Text = "确定修改"; }
private void ShowInfo(int articleId) { ArticleModel = ArticleBll.GetArticle(articleId); hfIsOpened.Value = ArticleModel.IsOpened.ToString(); if (ArticleModel == null) Function.ShowMsg(0, "<li>所选" + ChannelModel.TypeName + "不存在或已经被删除</li><li><a href='javascript:history.back()'>返回上一级</a></li>"); if (ArticleModel.Status == 1 || ArticleModel.Status == 2 || ArticleModel.Status == 3) Function.ShowMsg(0, "<li>你没有修改此稿件的权限</li><li><a href='javascript:history.back()'>返回上一级</a></li>"); txtTitle.Text = ArticleModel.Title.Trim(); txtAuthor.Text = ArticleModel.Author.Trim(); txtSource.Text = ArticleModel.Source.Trim(); string tagNameStr = ArticleModel.TagNameStr; if (tagNameStr != string.Empty && tagNameStr.StartsWith("|") && tagNameStr.EndsWith("|")) { tagNameStr = tagNameStr.Substring(0, tagNameStr.Length - 1); tagNameStr = tagNameStr.Substring(1, tagNameStr.Length - 1); } txtTagNameStr.Text = tagNameStr; ddlUserCate.SelectedValue = ArticleModel.UserCateId.ToString(); txtShortContent.Text = ArticleModel.ShortContent.Trim(); B_ConvertImage convertBll = new B_ConvertImage(SiteModel.Domain, InfoModel.UploadPath); txtContent.Value = convertBll.ConvertContent(ArticleModel.Content); txtContent.Value = txtContent.Value.Replace("{Ky:PAGE}", @"<div style=""page-break-after: always""><span style=""display: none""> </span></div>"); txtPoint.Text = ArticleModel.PointCount.ToString().Trim(); btnAddCateSave.Visible = false; btnSaveCaoGao.Visible = false; btnUpdate.Visible = true; }