Пример #1
0
        /*protected override void OnPreRender(EventArgs e)
         * {
         *  base.OnPreRender(e);
         *
         *  if (!IsPostBack)
         *      UpdateFieldsFromObject();
         * }*/

        private void UpdateSectionTitles()
        {
            string title        = "";
            string sectionTitle = "";

            if (selectedItem.ID == 0)
            {
                string       under      = "Root";
                IMediaDetail atleastOne = null;

                if (parentMediaItem != null)
                {
                    atleastOne = MediaDetailsMapper.GetAtleastOneByMedia(parentMediaItem, CurrentLanguage);
                }

                if ((parentMediaItem != null) && (atleastOne != null))
                {
                    under = atleastOne.LinkTitle;
                }

                sectionTitle = "Creating: <span>New Media of Type '" + MediaTypesMapper.GetByID(mediaTypeId).Name + "' Under '" + under + "' with Language '" + CurrentLanguage.Name + "'</span>";
                title        = StringHelper.StripHtmlTags(sectionTitle);
            }
            else
            {
                title        = "Editing: " + selectedItem.LinkTitle;
                sectionTitle = "Editing: <span>" + selectedItem.LinkTitle + "</span>";
            }

            this.Page.Title        = title;
            this.SectionTitle.Text = sectionTitle;
        }
Пример #2
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            if (!BaseMapper.GetDataModel().MediaDetails.Any())
            {
                var rootMediaType = MediaTypesMapper.GetByEnum(MediaTypeEnum.RootPage);

                if (rootMediaType != null)
                {
                    MediaTypeSelector.SetMediaTypes(new List <MediaType>()
                    {
                        rootMediaType
                    });
                }
            }
            else
            {
                if (SelectedMedia != null)
                {
                    MediaType mediaType = MediaTypesMapper.GetByID(MediaDetailsMapper.GetAtleastOneByMedia(SelectedMedia, CurrentLanguage).MediaTypeID);
                    MediaTypeSelector.SetMediaTypes(mediaType.MediaTypes);
                }
            }
        }
Пример #3
0
        protected void ListView_ItemDataBound(object sender, ListViewItemEventArgs e)
        {
            if (e.Item.DataItem == null)
            {
                return;
            }

            var media         = (Media)e.Item.DataItem;
            var link          = (HyperLink)e.Item.FindControl("Link");
            var childListView = (ListView)e.Item.FindControl("ChildListView");

            var mediaDetail = MediaDetailsMapper.GetAtleastOneByMedia(media, AdminBasePage.CurrentLanguage);

            if (mediaDetail != null)
            {
                link.Attributes.Add("data-mediaDetailId", mediaDetail.ID.ToString());
                link.Text        = mediaDetail.SectionTitle;
                link.NavigateUrl = AdminBasePage.GetRedirectToMediaDetailUrl(mediaDetail.MediaTypeID, mediaDetail.MediaID);

                if (!mediaDetail.ShowInMenu)
                {
                    link.CssClass += " isHidden";
                }

                if (mediaDetail.IsDeleted)
                {
                    link.CssClass += " isDeleted";
                }

                if (!mediaDetail.IsPublished)
                {
                    link.CssClass += " unPublished";
                }

                if (mediaDetail.ID == AdminBasePage.SelectedMediaDetail.ID)
                {
                    link.CssClass += " selected";
                    link.Attributes.Add("data-jstree", "{\"opened\":true,\"selected\":true}");
                }
            }
            else
            {
                link.Text = "MediaID:" + media.ID + " Does not have a media detail";
            }

            if (childListView != null)
            {
                childListView.DataSource     = media.ChildMedias.OrderBy(i => i.OrderIndex);
                childListView.LayoutTemplate = ListView.LayoutTemplate;
                childListView.ItemTemplate   = ListView.ItemTemplate;
                childListView.DataBind();
            }
        }
 private IMediaDetail GetAtleastOneByMedia(Media item)
 {
     return(MediaDetailsMapper.GetAtleastOneByMedia(item, AdminBasePage.CurrentLanguage));
 }