private void BindDataGrid() { ContentSnippet current = ContentSnippet.Get(guidSnippetID); litSlug.Text = current.ContentSnippetSlug; litSnippetName.Text = current.ContentSnippetName; if (current.ContentSnippetActive != true) { imgStatus.ImageUrl = hdnInactive.Value; imgStatus.AlternateText = "Inactive"; } imgStatus.ToolTip = imgStatus.AlternateText; var lstS = current.GetHistory(); GeneralUtilities.BindDataBoundControl(gvPages, lstS); foreach (GridViewRow dgItem in gvPages.Rows) { CheckBox chkContent = (CheckBox)dgItem.FindControl("chkContent"); if (chkContent.Attributes["value"].ToString() == current.ContentSnippetID.ToString()) { chkContent.Visible = false; } } if (lstS.Count < 1) { btnRemove.Visible = false; } }
protected void Page_Load(object sender, EventArgs e) { Master.ActivateTab(AdminBaseMasterPage.SectionID.ContentSnippet); guidRootItemID = GetGuidIDFromQuery(); guidVersionItemID = GetGuidParameterFromQuery("versionid"); guidItemID = guidRootItemID; if (guidItemID == Guid.Empty) { guidItemID = guidVersionItemID; } if (!IsPostBack) { DateTime dtSite = CMSConfigHelper.CalcNearestFiveMinTime(SiteData.CurrentSite.Now); ucReleaseDate.SetDate(dtSite); ucRetireDate.SetDate(dtSite.AddYears(200)); ContentSnippet item = null; if (guidRootItemID != Guid.Empty) { item = ContentSnippet.Get(guidRootItemID); } else { item = ContentSnippet.GetVersion(guidVersionItemID); } if (item != null) { bool bRet = item.RecordSnippetLock(SecurityData.CurrentUserGuid); bLocked = item.IsSnippetLocked(); if (bLocked && item.Heartbeat_UserId != null) { MembershipUser usr = SecurityData.GetUserByGuid(item.Heartbeat_UserId.Value); litUser.Text = "Read only mode. User '" + usr.UserName + "' is currently editing the snippet."; } txtSlug.Text = item.ContentSnippetSlug; txtLabel.Text = item.ContentSnippetName; reBody.Text = item.ContentBody; guidRootItemID = item.Root_ContentSnippetID; ucReleaseDate.SetDate(item.GoLiveDate); ucRetireDate.SetDate(item.RetireDate); chkPublic.Checked = item.ContentSnippetActive; btnDeleteButton.Visible = true; pnlReview.Visible = true; Dictionary <string, string> dataVersions = (from v in ContentSnippet.GetHistory(guidRootItemID) join u in ExtendedUserData.GetUserList() on v.EditUserId equals u.UserId orderby v.EditDate descending select new KeyValuePair <string, string>(v.ContentSnippetID.ToString(), string.Format("{0} ({1}) {2}", v.EditDate, u.UserName, (v.IsLatestVersion ? " [**] " : " "))) ).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); GeneralUtilities.BindListDefaultText(ddlVersions, dataVersions, null, "Versions", "00000"); } else { btnDeleteButton.Visible = false; pnlReview.Visible = false; } } sPageMode = GetStringParameterFromQuery("mode"); if (sPageMode.ToLowerInvariant() == "raw") { reBody.CssClass = "rawEditor"; divCenter.Visible = false; } pnlHB.Visible = !bLocked; pnlHBEmpty.Visible = bLocked; pnlButtons.Visible = !bLocked; divEditing.Visible = bLocked; }