public async Task <string> RenderViewAsync(BlogModule module, BlogModuleController.DisplayModel model) { HtmlBuilder hb = new HtmlBuilder(); int count = 0; if (model.StartDate != null) { hb.Append($@" <div class='t_startdate'> {this.__ResStr("startDate", "Showing blog entries published on or before {0}.", Formatting.FormatDate(model.StartDate))} </div>"); } foreach (BlogModuleController.Entry blogEntry in model.BlogEntries) { ++count; hb.Append($@" <h2> <a href='{Utility.HtmlAttributeEncode(await BlogConfigData.GetEntryCanonicalNameAsync(blogEntry.Identity))}' class='yaction-link'> {Utility.HtmlEncode(blogEntry.Title.ToString())} </a> </h2> <div class='t_entry t_entry{count}'> {await HtmlHelper.ForDisplayContainerAsync(blogEntry, "PropertyList")} </div>"); } return(hb.ToString()); }
public Entry(BlogEntry data, EntryDisplayModule dispMod, ModuleAction viewAction) { ObjectSupport.CopyData(data, this); ViewAction = viewAction; ViewAction.LinkText = Title; ViewAction.Tooltip = this.__ResStr("viewTT", "Published {0} - {1}", Formatting.FormatDate(data.DatePublished), data.DisplayableSummaryText); }
public static MvcHtmlString PSDatePicker(this HtmlHelper htmlHelper, string name, DateTime?value, object htmlAttributes) { var newAttributes = ControlHelper.GetHtmlAttributes(htmlAttributes); newAttributes = newAttributes .AddClass("class", "ps-date-picker form-control text-right") .AddClass("maxlength", "11"); // Build Model var model = new DatePickerModel { ID = name, Value = value, DisplayValue = Formatting.FormatDate(value), HtmlAttributes = newAttributes }; return(htmlHelper.Partial("~/Controls/DatePicker/Views/DatePicker.cshtml", model)); }
public async Task <string> RenderViewAsync(CommentsDisplayModule module, CommentsDisplayModuleController.DisplayModel model) { HtmlBuilder hb = new HtmlBuilder(); hb.Append($@" {await RenderBeginFormAsync()}"); if (model.Comments.Count == 0) { hb.Append($@" <div class='t_nocomments'> {Utility.HtmlEncode(this.__ResStr("nocommentsAdd", "Be the first to add a comment!"))} </div>"); } hb.Append($@" <div class='t_comments'>"); int count = 0; foreach (YetaWF.Modules.Blog.Controllers.CommentsDisplayModuleController.CommentData comment in model.Comments) { string commentClass = "t_comment" + count.ToString(); if (model.CanApprove || model.CanRemove) { if (comment.Deleted) { commentClass += " t_deleted"; } else { commentClass += " t_notdeleted"; if (comment.Approved) { commentClass += " t_approved"; } else { commentClass += " t_notapproved"; } } } hb.Append($@" <div class='{commentClass}'>"); if (model.CanApprove || model.CanRemove) { if (comment.Deleted) { hb.Append($@" <div class='t_boxdeleted'> {Utility.HtmlEncode(this.__ResStr("deleted", "This comment has been deleted"))} </div>"); } else if (!comment.Approved) { hb.Append($@" <div class='t_boxnotapproved'> {Utility.HtmlEncode(this.__ResStr("notApproved", "This comment has not yet been approved"))} </div>"); } } if (model.ShowGravatars && comment.ShowGravatar) { hb.Append($@" <div class='t_gravatar'> {await HtmlHelper.ForDisplayAsync(comment, nameof(comment.Email))} </div>"); } hb.Append($@" <div class='t_title'>{Utility.HtmlEncode(comment.Title)}</div> <div class='t_comment'>{comment.Comment}</div> <div class='t_boxinfo'> <div class='t_cmtby'>{Utility.HtmlEncode(this.__ResStr("by", "By:"))}</div> <div class='t_cmtauthor'>"); if (string.IsNullOrEmpty(comment.Website)) { hb.Append(Utility.HtmlEncode(comment.Name)); } else { hb.Append($"<a href='{Utility.HtmlAttributeEncode(comment.Website)}' class='linkpreview-show' target='_blank' rel='nofollow noopener noreferrer'>{Utility.HtmlEncode(comment.Name)}</a>"); } hb.Append($@" </div> <div class='t_cmton'>{Utility.HtmlEncode(this.__ResStr("on", "On:"))}</div> <div class='t_cmtdate'>{Utility.HtmlEncode(Formatting.FormatDate(comment.DateCreated))}</div> </div> <div class='t_boxactions'> {await HtmlHelper.ForDisplayAsync(comment, nameof(comment.Actions))} </div > <div class='t_cmtend'></div> </div>"); } hb.Append($@" </div> {await FormButtonsAsync(new FormButton[] { new FormButton() { ButtonType= ButtonTypeEnum.Cancel, Text=this.__ResStr("btnCancel", "Return") }, })} {await RenderEndFormAsync()}"); return(hb.ToString()); }
public Task <string> RenderViewAsync(FeedModule module, FeedModuleController.DisplayModel model) { HtmlBuilder hb = new HtmlBuilder(); hb.Append($@" <div id='{DivId}' class='t_news'> <div class='t_header'>"); if (model.Url != null) { hb.Append($@" <a class='t_title' href='{HAE(model.Url)}' data-tooltip='{HAE(model.Description)}' target='_blank' rel='noopener noreferrer'> {HE(model.Title)} </a>"); } else { hb.Append($@" <span class='t_title' title='{HAE(model.Description)}>{HE(model.Title)}</span>"); } hb.Append($@" </div> <div class='t_headerentry'></div>"); foreach (FeedModuleController.Entry entry in model.Entries) { string author = null; foreach (FeedModuleController.Author a in entry.Authors) { if (!string.IsNullOrWhiteSpace(a.Email)) { if (string.IsNullOrWhiteSpace(author)) { author += this.__ResStr("sep", " | "); } author += string.Format("<a href='mailto:{0}'>{1}</a>", a.Email, string.IsNullOrWhiteSpace(a.Name) ? a.Email : a.Name); } else if (string.IsNullOrWhiteSpace(a.Url)) { if (string.IsNullOrWhiteSpace(author)) { author += this.__ResStr("sep", " | "); } author += string.Format("<a href='{0}'>{1}</a>", a.Url, string.IsNullOrWhiteSpace(a.Name) ? a.Email : a.Url); } else if (string.IsNullOrWhiteSpace(a.Name)) { author += a.Name; } } hb.Append($@" <div class='t_entry'> <a class='t_title' href='{HAE(entry.Links.First())}' target='_blank' rel='noopener noreferrer' data-text='{HAE(entry.Description)}' data-publishedDate='{HAE(Formatting.FormatDate(entry.PublishDate))}' data-author='{HAE(author)}'> {HE(entry.Title)} </a> </div>"); } Setup setup = new Setup { Interval = module.Interval * 1000, }; hb.Append($@" </div>"); Manager.ScriptManager.AddLast($@"new YetaWF_Feed.Feed('{DivId}', {Utility.JsonSerialize(setup)});"); return(Task.FromResult(hb.ToString())); }
public async Task <ActionResult> AddHoliday_Partial(AddModel model) { if (!ModelState.IsValid) { return(PartialView(model)); } using (HolidayEntryDataProvider dataProvider = new HolidayEntryDataProvider()) { if (!await dataProvider.AddItemAsync(model.GetData())) { ModelState.AddModelError(nameof(AddModel.HolidayDate), this.__ResStr("dup", "An entry for {0} already exists", Formatting.FormatDate(model.HolidayDate))); return(PartialView(model)); } return(FormProcessed(model, this.__ResStr("okSaved", "New holiday saved"), OnPopupClose: OnPopupCloseEnum.ReloadModule)); } }