protected void btnSave_Click(object sender, System.EventArgs e) { if (this.IsValid) { if (this._article == null) { this._article = new Article(); this._article.Section = this._articleModule.Section; this._article.CreatedBy = (Cuyahoga.Core.Domain.User)this.User.Identity; } SaveArticle(); } }
protected void Page_Load(object sender, System.EventArgs e) { this._articleModule = base.Module as ArticleModule; if (Request.QueryString["ArticleId"] != null) { int articleId = Int32.Parse(Request.QueryString["ArticleId"]); if (articleId > 0) { this._article = this._articleModule.GetArticleById(articleId); BindComments(); } } }
protected void Page_Load(object sender, System.EventArgs e) { this.fckContent.BasePath = this.Page.ResolveUrl("~/Support/FCKeditor/"); //Add FCK Specific CSS and template references to the editor //RegisterStylesheet("CatModCSS", UrlHelper.GetApplicationPath() + "Modules/Articles/EditorCSS/style.css"); //To DISPLAY template styles in editor fckContent.EditorAreaCSS = UrlHelper.GetApplicationPath() + this.Node.Template.BasePath + "/css/editor_" + this.Node.Template.Css; //To ADD template styles in editor DropDown List fckContent.StylesXmlPath = UrlHelper.GetApplicationPath() + this.Node.Template.BasePath + "/css/fckstyles.xml"; this._articleModule = base.Module as ArticleModule; this.btnCancel.Attributes.Add("onclick", String.Format("document.location.href='AdminArticles.aspx{0}'", base.GetBaseQueryString())); if (! this.IsPostBack) { BindCategories(); } if (Request.QueryString["ArticleId"] != null) { int articleId = Int32.Parse(Request.QueryString["ArticleId"]); if (articleId > 0) { this._article = this._articleModule.GetArticleById(articleId); if (! this.IsPostBack) { BindArticle(); } this.btnDelete.Visible = true; this.btnDelete.Attributes.Add("onclick", "return confirm('Are you sure?');"); } } }
protected void Page_Load(object sender, System.EventArgs e) { this._articleModule = base.Module as ArticleModule; this.RegisterAdminJavascript("ckeditor","/Support/ckeditor/ckeditor.js"); this.btnCancel.Attributes.Add("onclick", String.Format("document.location.href='AdminArticles.aspx{0}'", base.GetBaseQueryString())); if (! this.IsPostBack) { BindCategories(); } if (Request.QueryString["ArticleId"] != null) { int articleId = Int32.Parse(Request.QueryString["ArticleId"]); if (articleId > 0) { this._article = this._articleModule.GetArticleById(articleId); if (! this.IsPostBack) { BindArticle(); } this.btnDelete.Visible = true; this.btnDelete.Attributes.Add("onclick", "return confirm('Are you sure?');"); } } }
protected void Page_Load(object sender, System.EventArgs e) { this._module = this.Module as ArticleModule; if (this._module.CurrentArticleId > 0 && (!base.HasCachedOutput || this.Page.IsPostBack) || this.Page.User.Identity.IsAuthenticated) { // Article view this._activeArticle = this._module.GetArticleById(this._module.CurrentArticleId); this.litTitle.Text = this._activeArticle.Title; this.litContent.Text = this._activeArticle.Content; if (this._module.AllowComments || this._module.ShowAuthor || this._module.ShowCategory || this._module.ShowDateTime) { this.pnlArticleInfo.Visible = true; this.lblDateOnline.Text = TimeZoneUtil.AdjustDateToUserTimeZone(this._activeArticle.DateOnline, this.Page.User.Identity).ToString(); this.lblDateOnline.Visible = this._module.ShowDateTime; this.litAuthor.Text = base.GetText("PUBLISHED") + " " + base.GetText("BY"); this.litAuthor.Visible = this._module.ShowAuthor; this.hplAuthor.NavigateUrl = this._module.GetProfileUrl(this._activeArticle.CreatedBy.Id); this.hplAuthor.Text = this._activeArticle.CreatedBy.FullName; this.hplAuthor.Visible = this._module.ShowAuthor; this.litCategory.Text = base.GetText("CATEGORY"); this.litCategory.Visible = this._module.ShowCategory; if (this._activeArticle.Category != null) { this.hplCategory.NavigateUrl = UrlHelper.GetUrlFromSection(this.Module.Section) + String.Format("/category/{0}", this._activeArticle.Category.Id); this.hplCategory.Text = this._activeArticle.Category.Title; } else { this.hplCategory.Text = String.Empty; } this.hplCategory.Visible = this._module.ShowCategory; if (this._module.AllowComments) { this.hplComments.NavigateUrl = UrlHelper.GetUrlFromSection(this._module.Section) + String.Format("/{0}#comments", this._activeArticle.Id); this.hplComments.Text = base.GetText("COMMENTS") + " " + this._activeArticle.Comments.Count.ToString(); } else { this.hplComments.Visible = false; } } else { this.pnlArticleInfo.Visible = false; } this.hplBack.NavigateUrl = UrlHelper.GetUrlFromSection(this._module.Section); this.hplBack.Text = base.GetText("BACK"); this.btnSaveComment.Text = base.GetText("BTNSAVECOMMENT"); this.rfvName.ErrorMessage = base.GetText("NAMEREQUIRED"); this.rfvComment.ErrorMessage = base.GetText("COMMENTREQUIRED"); this.pnlArticleDetails.Visible = true; this.pnlComments.Visible = this._module.AllowComments && this._activeArticle.Comments.Count > 0; if (this._module.AllowAnonymousComments || (this.Page.User.Identity.IsAuthenticated && this._module.AllowComments)) { this.pnlComment.Visible = true; this.pnlAnonymous.Visible = (!this.Page.User.Identity.IsAuthenticated); } else { this.pnlComment.Visible = false; } // Comments this.rptComments.DataSource = this._activeArticle.Comments; this.rptComments.ItemDataBound += new RepeaterItemEventHandler(rptComments_ItemDataBound); this.rptComments.DataBind(); } }
private SearchContent ArticleToSearchContent(Article article) { SearchContent sc = new SearchContent(); sc.Title = article.Title; if (article.Summary == null || article.Summary == String.Empty) { sc.Summary = Text.TruncateText(article.Content, 200); // truncate summary to 200 chars } else { sc.Summary = article.Summary; } sc.Contents = article.Content; sc.Author = article.ModifiedBy.FullName; sc.ModuleType = this.Section.ModuleType.Name; sc.Path = this.SectionUrl + "/" + article.Id; // article ID has to be added as pathinfo parameter. sc.Category = (article.Category != null ? article.Category.Title : sc.Category = String.Empty); sc.Site = (this.Section.Node != null ? this.Section.Node.Site.Name : String.Empty); sc.DateCreated = article.DateCreated; sc.DateModified = article.DateModified; sc.SectionId = this.Section.Id; return sc; }
public virtual void SaveArticle(Article article) { article.Category = HandleCategory(article.Category); if (article.Id == -1) { this._commonDao.SaveOrUpdateObject(article); OnContentCreated(new IndexEventArgs(ArticleToSearchContent(article))); } else { this._commonDao.SaveOrUpdateObject(article); OnContentUpdated(new IndexEventArgs(ArticleToSearchContent(article))); } }
public virtual void DeleteArticle(Article article) { this._commonDao.DeleteObject(article); OnContentDeleted(new IndexEventArgs(ArticleToSearchContent(article))); }