private void Page_Load(object sender, EventArgs e)
{
try
{
this.LocalizeCollapsePanels();
// check VI for null then set information
if (!this.Page.IsPostBack)
{
this.LoadAuthorsList();
// set author
this.ddlAuthor.SelectedValue = this.VersionInfoObject.AuthorUserId > 0
? this.VersionInfoObject.AuthorUserId.ToString()
: this.UserId.ToString();
// configure the author name (Text) if defined
// chkShowAuthor
ItemVersionSetting auNameSetting = ItemVersionSetting.GetItemVersionSetting(
this.VersionInfoObject.ItemVersionId, "lblAuthorName", "Text", this.PortalId);
this.txtAuthorName.Text = auNameSetting != null ? auNameSetting.PropertyValue : this.ddlAuthor.SelectedItem.Text.Trim();
if (this.AllowRichTextDescriptions)
{
if (this.DefaultRichTextDescriptions)
{
this.teDescription.ChooseMode = true;
this.btnChangeDescriptionEditorMode.Visible = false;
this.teDescription.Visible = true;
this.txtDescription.Visible = false;
}
else
{
// if their profile is set to basic text mode, we need to show the radio buttons so they can get to rich text mode.
this.teDescription.ChooseMode = (string)Personalization.GetProfile("DotNetNuke.TextEditor", "PreferredTextEditor") ==
"BASIC";
this.btnChangeDescriptionEditorMode.Text =
Localization.GetString("btnChangeDescriptionEditorMode_" + this.txtDescription.Visible, this.LocalResourceFile);
}
}
else
{
this.btnChangeDescriptionEditorMode.Visible = false;
}
if (Engage.Utility.HasValue(this.VersionInfoObject.MetaTitle) || Engage.Utility.HasValue(this.VersionInfoObject.MetaDescription) ||
Engage.Utility.HasValue(this.VersionInfoObject.MetaKeywords))
{
this.chkSearchEngine.Checked = true;
this.pnlSearchEngine.Visible = true;
}
this.txtDescription.Text = this.VersionInfoObject.Description;
this.teDescription.Text = this.VersionInfoObject.Description;
this.txtMetaKeywords.Text = this.VersionInfoObject.MetaKeywords;
this.txtMetaDescription.Text = this.VersionInfoObject.MetaDescription;
this.txtMetaTitle.Text = this.VersionInfoObject.MetaTitle;
if (this.EnableDisplayNameAsHyperlink)
{
this.chkDisplayAsHyperlink.Checked = !this.VersionInfoObject.Disabled;
}
else
{
this.lblDisplayAsHyperlink.Visible = false;
this.chkDisplayAsHyperlink.Visible = false;
this.chkDisplayAsHyperlink.Checked = true;
}
if (Engage.Utility.HasValue(this.VersionInfoObject.StartDate))
{
this.txtStartDate.Text = Utility.GetCurrentCultureDateTime(this.VersionInfoObject.StartDate);
}
if (Engage.Utility.HasValue(this.VersionInfoObject.EndDate))
{
this.txtEndDate.Text = Utility.GetCurrentCultureDateTime(this.VersionInfoObject.EndDate);
}
this.txtName.Text = this.VersionInfoObject.Name;
this.thumbnailSelector.ThumbnailUrl = this.VersionInfoObject.Thumbnail;
}
else
{
this.VersionInfoObject.Name = this.txtName.Text;
this.VersionInfoObject.Description = this.DescriptionText;
this.VersionInfoObject.Thumbnail = this.thumbnailSelector.ThumbnailUrl; // ctlMediaFile.Url;
// define author's name to display
this._authorName = this.txtAuthorName.Text.Trim();
this.VersionInfoObject.MetaKeywords = this.txtMetaKeywords.Text;
this.VersionInfoObject.MetaDescription = this.txtMetaDescription.Text;
this.VersionInfoObject.MetaTitle = this.txtMetaTitle.Text;
this.VersionInfoObject.Disabled = !this.chkDisplayAsHyperlink.Checked;
this.VersionInfoObject.Url = this.ctlUrlSelection.Url;
this.VersionInfoObject.NewWindow = this.chkNewWindow.Checked;
DateTime dt;
if (Engage.Utility.HasValue(this.txtStartDate.Text) && DateTime.TryParse(this.txtStartDate.Text, out dt))
{
if (!dt.Equals(DateTime.MinValue))
{
this.VersionInfoObject.StartDate = dt.ToString(CultureInfo.InvariantCulture);
}
}
if (Engage.Utility.HasValue(this.txtEndDate.Text) && DateTime.TryParse(this.txtEndDate.Text, out dt))
{
if (!dt.Equals(DateTime.MinValue))
{
this.VersionInfoObject.EndDate = dt.ToString(CultureInfo.InvariantCulture);
}
}
else
{
this.VersionInfoObject.EndDate = string.Empty;
}
this.VersionInfoObject.AuthorUserId = Convert.ToInt32(this.ddlAuthor.SelectedValue);
this.VersionInfoObject.RevisingUserId = this.UserId;
}
}
catch (Exception exc)
{
Exceptions.ProcessModuleLoadException(this, exc);
}
}