protected void LanguageSelect_SelectedIndexChanged(object sender, EventArgs e) { if (string.IsNullOrEmpty(LanguageSelect.SelectedValue)) { return; } AdminBasePage.CurrentLanguage = LanguagesMapper.GetByID(long.Parse(LanguageSelect.SelectedValue)); Response.Redirect(Request.Url.PathAndQuery); }
protected void Page_Load(object sender, EventArgs e) { long id; if (long.TryParse(Request["id"], out id)) { selectedItem = LanguagesMapper.GetByID(id); if (!IsPostBack) { UpdateFieldsFromObject(); } } this.Page.Title = this.SectionTitle.Text = GetSectionTitle(); }
public string DeleteItemPermanently(long id) { Language item = BaseMapper.GetObjectFromContext(LanguagesMapper.GetByID(id)); if (item != null) { Return returnObj = LanguagesMapper.DeletePermanently(item); if (returnObj.IsError) { return(jGrowlHelper.GenerateCode(new jGrowlMessage("Error", "Error deleting item permanently", jGrowlMessage.jGrowlMessageType.Error, returnObj.Error), true)); } else { return(jGrowlHelper.GenerateCode(new jGrowlMessage("Success", "Item was successfully deleted permanently", jGrowlMessage.jGrowlMessageType.Success), false)); } } return(""); }
private void UpdateTreeNode(JsTreeNode node, IMediaDetail detail) { if (detail == null) { return; } node.id = detail.MediaID.ToString(); node.parent = (detail.Media.ParentMediaID == null) ? "#" : detail.Media.ParentMediaID.ToString(); node.text = detail.SectionTitle; //node.children =( MediaDetailsMapper.GetAtleastOneChildByMedia(detail.Media, AdminBasePage.CurrentLanguage).Where(i => i.MediaType.ShowInSiteTree).Count() > 0); node.children = (BaseMapper.GetDataModel().MediaDetails.Count(i => i.MediaType.ShowInSiteTree && i.HistoryVersionNumber == 0 && i.Media.ParentMediaID == detail.MediaID) > 0); node.text = detail.SectionTitle.ToString(); //node.Attributes.Add("FrontEndUrl", detail.AbsoluteUrl); var nodeText = ""; if (detail.LanguageID != AdminBasePage.CurrentLanguage.ID) { nodeText = $"{detail.LinkTitle} - {LanguagesMapper.GetByID(detail.Language.ID).Name} ({node.id})"; node.li_attr._class = "doesNotExistInLanguage"; } else { nodeText = $"{detail.LinkTitle} <small>({detail.MediaID})</small>"; } if (detail.IsDeleted) { node.li_attr._class += " isDeleted"; } if (detail.WillPublish) { node.li_attr._class += " willPublish"; var autoPublishCode = $"<i class='fa fa-clock-o' aria-hidden='true' title='This page is set to auto-publish at: {detail.PublishDate}'></i> "; nodeText += $"<small class='willPublishWrapper'>{autoPublishCode}Will Publish</small>"; } if (detail.IsPublished && detail.WillExpire) { node.li_attr._class += " willExpire"; var autoPublishCode = $"<i class='fa fa-clock-o' aria-hidden='true' title='This page is set to auto-expire at: {detail.ExpiryDate}'></i> "; nodeText += $"<small class='willExpireWrapper'>{autoPublishCode}Will Expire</small>"; } if ((!detail.ShowInMenu) && (!detail.RenderInFooter)) { node.li_attr._class += " isHidden"; } if (detail.HasExpired) { node.li_attr._class += " hasExpired"; nodeText += $"<small class='hasExpiredWrapper'>Has Expired</small>"; } else { if (!detail.IsPublished && !detail.WillPublish) { node.li_attr._class += " unPublished"; nodeText += $"<small class='unPublishedWrapper'>UnPublished</small>"; } } if (AdminBasePage.SelectedMediaDetail != null && AdminBasePage.SelectedMediaDetail.ID == detail.ID) { node.li_attr._class += " selected"; } var draft = detail.GetLatestDraft(); if (detail.HasDraft && draft != null) { node.li_attr._class += " hasDraft"; var autoPublishCode = ""; if (draft.DateLastModified > detail.DateLastModified) { node.li_attr._class += " draftIsNewer"; } if ((draft.PublishDate - detail.PublishDate) > TimeSpan.FromSeconds(10)) { autoPublishCode = $"<i class='fa fa-clock-o' aria-hidden='true' title='This draft is set to auto-publish at: {draft.PublishDate}'></i> "; } nodeText += $"<small class='hasDraftWrapper'>{autoPublishCode}Has Draft</small>"; } var pendingComments = detail.Media.Comments.Count(i => i.Status == StatusEnum.Pending.ToString() && i.LanguageID == detail.LanguageID); if (pendingComments > 0) { node.li_attr._class += " hasPendingComments"; nodeText += $"<small class='hasPendingCommentsWrapper'>Pending Comments</small>"; } if (detail.MediaType.GetRoles().Count > 0 || detail.Media.RolesMedias.Count > 0) { var fontAwsomeClasses = "fa"; node.li_attr._class += " restricted"; if (MediaDetailsMapper.CanAccessMediaDetail(detail, FrameworkSettings.CurrentUser).IsError) { fontAwsomeClasses += " fa-lock"; } else { fontAwsomeClasses += " fa-unlock"; } nodeText += $"<small class='restrictedWrapper'><i class='fa {fontAwsomeClasses}' aria-hidden='true'></i></small>"; } node.text = nodeText; //node.LinkAttributes.Add("data-frontendurl", detail.Media.PermaLink); node.a_attr.frontendurl = detail.AbsoluteUrl; node.li_attr.mediaDetailId = detail.ID.ToString(); node.a_attr.href = URIHelper.ConvertToAbsUrl(WebApplication.BasePage.GetAdminUrl(detail.MediaTypeID, detail.MediaID)); if (detail?.MediaType?.Name == "Website" || detail?.MediaType?.Name == "RootPage") { node.state.opened = true; } IEnumerable <Media> parentItems = new List <Media>(); if (AdminBasePage.SelectedMedia != null) { parentItems = MediaDetailsMapper.GetAllParentMedias(AdminBasePage.SelectedMedia); if (parentItems.Any(i => i.ID == detail.MediaID)) { node.state.opened = true; } } if (detail.MediaID == AdminBasePage.SelectedMedia?.ID) { node.state.opened = true; node.state.selected = true; } }