protected void Page_Load(object sender, EventArgs e) { // Add CSS files Master.AddCss("style.css"); Master.AddCss("history.css"); Master.AddCss("entry.css"); // Identify our position; load data loadData(); // Navigation buildPageLinks(); // Add changes for (int i = 0; i != changes.Count; ++i) { SqlDict.ChangeItem ci = changes[i]; changeList.Controls.Add(new HistoryItem(ci)); } //// Render static content //string path = HttpRuntime.AppDomainAppPath; //path = Path.Combine(path, "Content"); //path = Path.Combine(path, "HistoryDoodle.html"); //using (StreamReader sr = new StreamReader(path)) //{ // lit.Text = sr.ReadToEnd(); //} }
private void doHistory(string lang, string rel) { // Diagnostics/doodling if (rel == "edit/history/x") { Res = makeResult(getFileName("en", "_historydoodle")); return; } // Load history to show on this page loadHistory(rel); // Navigation string histLinks = buildHistoryLinks(lang); // Add changes StringBuilder sbChanges = new StringBuilder(); using (HtmlTextWriter wrChanges = new HtmlTextWriter(new StringWriter(sbChanges))) { for (int i = 0; i != histChanges.Count; ++i) { SqlDict.ChangeItem ci = histChanges[i]; histRenderChange(wrChanges, ci, i != histChanges.Count - 1); } } // Render full page StringBuilder sbHtml; string title, keywords, description; readFile(getFileName(lang, "edit.history"), out sbHtml, out title, out keywords, out description); sbHtml.Replace("<!-- PAGELINKS -->", histLinks); sbHtml.Replace("<!-- CHANGELIST -->", sbChanges.ToString()); Result res = new Result(); res.Html = sbHtml.ToString(); res.Title = title; res.Keywords = keywords; res.Description = description; Res = res; }
private void histRenderChange(HtmlTextWriter writer, SqlDict.ChangeItem ci, bool trailingSeparator) { writer.WriteLine(); writer.AddAttribute("class", "historyItem"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.AddAttribute("class", "changeHead"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.AddAttribute("class", "fa fa-lightbulb-o ctNew"); writer.RenderBeginTag(HtmlTextWriterTag.I); writer.RenderEndTag(); writer.AddAttribute("class", "changeSummary"); writer.RenderBeginTag(HtmlTextWriterTag.Div); string changeMsg; string changeCls = "changeType"; if (ci.ChangeType == SqlDict.ChangeType.New) { changeMsg = "Új szócikk"; } else if (ci.ChangeType == SqlDict.ChangeType.Edit) { changeMsg = "Szerkesztve"; } else if (ci.ChangeType == SqlDict.ChangeType.Note) { changeMsg = "Megjegyzés"; } else { changeMsg = ci.ChangeType.ToString(); } changeMsg += ": "; writer.AddAttribute("class", changeCls); writer.RenderBeginTag(HtmlTextWriterTag.Span); writer.WriteEncodedText(changeMsg); writer.RenderEndTag(); writer.AddAttribute("class", "changeUser"); writer.RenderBeginTag(HtmlTextWriterTag.Span); writer.WriteEncodedText(ci.User); writer.RenderEndTag(); writer.Write(" • "); writer.AddAttribute("class", "changeTime"); writer.RenderBeginTag(HtmlTextWriterTag.Span); DateTime dt = TimeZoneInfo.ConvertTimeFromUtc(ci.When, Global.TimeZoneInfo); string dtFmt = "{0}-{1:00}-{2:00} {3:00}:{4:00}"; dtFmt = string.Format(dtFmt, dt.Year, dt.Month, dt.Day, dt.Hour, dt.Minute); writer.WriteEncodedText(dtFmt); writer.RenderEndTag(); writer.RenderEndTag(); writer.AddAttribute("class", "changeNote"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.WriteEncodedText(ci.Note); writer.RenderEndTag(); writer.RenderEndTag(); writer.AddAttribute("class", "changeEntry"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.AddAttribute("class", "histEntryOps"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.AddAttribute("class", "opHistEdit fa fa-pencil-square-o"); writer.RenderBeginTag(HtmlTextWriterTag.I); writer.RenderEndTag(); writer.AddAttribute("class", "opHistComment fa fa-commenting-o"); writer.RenderBeginTag(HtmlTextWriterTag.I); writer.RenderEndTag(); writer.AddAttribute("class", "opHistFlag fa fa-flag-o"); writer.RenderBeginTag(HtmlTextWriterTag.I); writer.RenderEndTag(); writer.RenderEndTag(); CedictEntry entry = SqlDict.BuildEntry(ci.EntryHead, ci.EntryBody); EntryRenderer er = new EntryRenderer(entry); er.OneLineHanziLimit = 12; er.Render(writer); writer.RenderEndTag(); writer.RenderEndTag(); if (trailingSeparator) { writer.AddAttribute("class", "historySep"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.RenderEndTag(); } }
public HistoryItem(SqlDict.ChangeItem ci) { this.ci = ci; }