protected override void OnInit(EventArgs e)
{
WebUtils.CheckRightsForAdminPostPages(false);
MaintainScrollPositionOnPostBack = true;
BindTags();
BindUsers();
Page.Title = labels.add_Entry;
Page.ClientScript.GetCallbackEventReference(this, "title", "ApplyCallback", "slug");
if (!String.IsNullOrEmpty(Request.QueryString["id"]) && Request.QueryString["id"].Length == 36)
{
var id = new Guid(Request.QueryString["id"]);
Page.Title = string.Format("{0} {1}", labels.edit, labels.post);
BindPost(id);
BindCategories(id);
}
else
{
BindCategories(Guid.Empty);
PreSelectAuthor(Page.User.Identity.Name);
txtDate.Text = DateTime.Now.AddHours(BlogSettings.Instance.Timezone).ToString("yyyy-MM-dd");
txtTime.Text = DateTime.Now.AddHours(BlogSettings.Instance.Timezone).ToString("HH\\:mm");
cbEnableComments.Checked = BlogSettings.Instance.IsCommentsEnabled;
cbPublish.Checked = Security.IsAuthorizedTo(Rights.PublishOwnPosts);
if (Session["content"] != null)
{
txtContent.Text = Session["content"].ToString();
txtRawContent.Text = txtContent.Text;
txtTitle.Text = Session["title"].ToString();
txtDescription.Text = Session["description"].ToString();
txtSlug.Text = Session["slug"].ToString();
txtTags.Text = Session["tags"].ToString();
}
BindBookmarklet();
}
if (!Security.IsAuthorizedTo(Rights.EditOtherUsersPosts))
{
ddlAuthor.Enabled = false;
}
cbEnableComments.Enabled = BlogSettings.Instance.IsCommentsEnabled;
if (Request.Cookies[RawEditorCookie] != null)
{
txtRawContent.Visible = true;
txtContent.Visible = false;
cbUseRaw.Checked = true;
}
btnCategory.Click += BtnCategoryClick;
btnUploadFile.Click += BtnUploadFileClick;
btnUploadImage.Click += BtnUploadImageClick;
btnUploadVideo.Click += BtnUploadVideoClick;
valExist.ServerValidate += ValExistServerValidate;
cbUseRaw.CheckedChanged += CbUseRawCheckedChanged;
base.OnInit(e);
}