void WeblogCalendar_Load(object sender, EventArgs e) { SharedBasePage requestPage = this.Page as SharedBasePage; if (requestPage.SiteConfig.AdjustDisplayTimeZone) { daysWithEntries = requestPage.DataService.GetDaysWithEntries(requestPage.SiteConfig.GetConfiguredTimeZone()); newtelligence.DasBlog.Util.WindowsTimeZone tz = requestPage.SiteConfig.GetConfiguredTimeZone(); this.TodaysDate = tz.ToLocalTime(DateTime.Now.ToUniversalTime()); } else { daysWithEntries = requestPage.DataService.GetDaysWithEntries(new newtelligence.DasBlog.Util.UTCTimeZone()); } // TSC: we have collected a date from the __EVENTARGUMENT if the __EVENTTARGET // was holding the name from our weblogCalender in the SharedBasePage, // so we supress the overwriting here if ( (Parent.Page.Request.QueryString["date"] != null && Parent.Page.Request.Params["__EVENTARGUMENT"] == null ) || (Parent.Page.Request.QueryString["date"] != null && Parent.Page.Request.Params["__EVENTTARGET"] != null && Parent.Page.Request.Params["__EVENTTARGET"].IndexOf(this.ID) == -1 ) ) { try { string _mDate = Parent.Page.Request.QueryString["date"]; this.VisibleDate = new System.DateTime(Convert.ToInt16(_mDate.Substring(0, 4)), Convert.ToInt16(_mDate.Substring(5, 2)), 1); } catch { // supress } } }
protected void CommentView_PreRender(object sender, System.EventArgs e) { SharedBasePage requestPage = Page as SharedBasePage; string entryId = (string)ViewState["entryId"]; bool obfuscateEmail = requestPage.SiteConfig.ObfuscateEmail; Entry entry = requestPage.DataService.GetEntry(entryId); if (entry != null) { //Modified 10-3-03 HPierson //Render the day template with just the single entry, rather than the item template //Modified 12-8-03 HPierson //Using entry.CreatedLocalTime causes a bug when dasBlog is not configured to be in //the same time zone as the server. Instead, we use the configured WindowsTimeZone //to calculate the dasBlog configured local time for the entry requestPage.WeblogEntries.Add(entry); if (requestPage.SiteConfig.AdjustDisplayTimeZone) { newtelligence.DasBlog.Util.WindowsTimeZone wtz = requestPage.SiteConfig.GetConfiguredTimeZone(); requestPage.ProcessDayTemplate(wtz.ToLocalTime(entry.CreatedUtc), commentViewContent); } else { requestPage.ProcessDayTemplate(entry.CreatedUtc, commentViewContent); } HtmlAnchor commentStart = new HtmlAnchor(); commentStart.Name = "commentstart"; commentViewContent.Controls.Add(commentStart); // Show all public comments, or all contents if you can approve them // This way all non-public comments remain hidden, when you no longer require approval. bool allComments = SiteSecurity.IsValidContributor(); foreach (Comment c in requestPage.DataService.GetCommentsFor(entryId, allComments)) { SingleCommentView view = (SingleCommentView)LoadControl("SingleCommentView.ascx"); view.Comment = c; view.ObfuscateEmail = obfuscateEmail; commentViewContent.Controls.Add(view); } commentsClosed.Visible = false; commentViewTable.Visible = true; // only show the openid option when allowed in the config openIdTable.Visible = requestPage.SiteConfig.AllowOpenIdComments; commentsGravatarEnabled.Visible = requestPage.SiteConfig.CommentsAllowGravatar; // show the comments require approval warning when moderating, or suspected spam, // maybe users won't post multiple comments when their comment won't show immediately commentsModerated.Visible = (requestPage.SiteConfig.CommentsRequireApproval || potentialSpamSubmitted); if (potentialSpamSubmitted) { labelCommentsModerated.Text = resmgr.GetString("text_comment_potential_spam"); } // display no/some html labelCommentHtml.Visible = requestPage.SiteConfig.CommentsAllowHtml && (requestPage.SiteConfig.AllowedTags.AllowedTagsCount > 0); labelComment.Visible = !labelCommentHtml.Visible; labelCommentHtml.Text = String.Format(resmgr.GetString("text_comment_content_html"), requestPage.SiteConfig.AllowedTags.ToString()); if (SiteUtilities.AreCommentsAllowed(entry, requestPage.SiteConfig) == false) { commentsClosed.Visible = true; commentViewTable.Visible = false; openIdTable.Visible = false; // if comments are not allow, there is no need to show the approval warning commentsModerated.Visible = false; } if (Page.ClientScript.IsClientScriptBlockRegistered(this.GetType(), "coCommentScript") == false && requestPage.SiteConfig.EnableCoComment == true) { string coCommentScript = String.Format(@" <script type=""text/javascript""> // this ensures coComment gets the correct values coco = {{ tool : ""dasBlog"", siteurl : ""{0}"", sitetitle : ""{1}"", pageurl : ""{2}"", pagetitle : ""{3}"", author : ""{4}"", formID : ""{5}"", textareaID : ""{6}"", buttonID : ""{7}"" }} </script> <script id=""cocomment-fetchlet"" src=""http://www.cocomment.com/js/enabler.js"" type=""text/javascript""> // this activates coComment </script> ", requestPage.SiteConfig.Root, Server.HtmlEncode(requestPage.SiteConfig.Title), Request.Url.ToString(), Server.HtmlEncode(entry.Title), Server.HtmlEncode(entry.Author), this.Page.Form.ClientID, this.comment.ClientID, this.add.ClientID ); Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "coComment", coCommentScript); } } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); resmgr = ApplicationResourceTable.Get(); if (!Page.IsPostBack) { DateTime dt = new DateTime(DateTime.Now.Year, 1, 1); DateTime filteredDate = DateTime.UtcNow; string date = null; if (this.Request.QueryString["date"] != null) { date = this.Request.QueryString["date"]; try { filteredDate = DateTime.ParseExact(date, "yyyy-MM-dd", CultureInfo.InvariantCulture); } catch (FormatException ex) { ErrorTrace.Trace(TraceLevel.Error, ex); } } // move the local/non-local date logic to one place if (((SharedBasePage)Page).SiteConfig.AdjustDisplayTimeZone && date == null) { newtelligence.DasBlog.Util.WindowsTimeZone tz = ((SharedBasePage)Page).SiteConfig.GetConfiguredTimeZone(); filteredDate = tz.ToLocalTime(filteredDate); } // someone is trying to mess with us, let's play along if (filteredDate.Year > dt.Year || filteredDate.Year < dt.Year - 11) { dt = new DateTime(filteredDate.Year, 1, 1); } for (int i = 0; i > -12; i--) { this.DropDownListYear.Items.Add(dt.AddYears(i).ToString("yyyy")); } try{ this.DropDownListYear.SelectedValue = filteredDate.Year.ToString(); }catch (ArgumentOutOfRangeException) { //.. tried to set a year in the future, that's not in the list. } for (int i = 0; i < 12; i++) { this.DropDownListMonth.Items.Add(dt.AddMonths(i).ToString("MMMM")); } this.DropDownListMonth.SelectedIndex = filteredDate.Month - 1; int numDays = DateTime.DaysInMonth(Convert.ToInt32(this.DropDownListYear.SelectedItem.Text), this.DropDownListMonth.SelectedIndex + 1); for (int i = 1; i <= numDays; i++) { this.DropDownListDay.Items.Add(i.ToString()); } this.DropDownListDay.SelectedIndex = filteredDate.Day - 1; // set the href for for the links DateTime nextDate = filteredDate.AddDays(1); DateTime previousDate = filteredDate.AddDays(-1); DateTime today = DateTime.Now; string requestUrl = this.Context.Request.Path; string dateFormat = "{0}?date={1:yyyy-MM-dd}"; this.linkNext.HRef = String.Format(System.Globalization.CultureInfo.InvariantCulture, dateFormat, requestUrl, nextDate); this.linkPrevious.HRef = String.Format(System.Globalization.CultureInfo.InvariantCulture, dateFormat, requestUrl, previousDate); this.linkToday.HRef = String.Format(System.Globalization.CultureInfo.InvariantCulture, dateFormat, requestUrl, today); } DataBind(); }