Exemplo n.º 1
0
        public override void DataBind()
        {
            if (_bound)
            {
                return;
            }
            _bound = true;

            MediaGalleryManager mgMgr = new MediaGalleryManager();


            string title = "";

            if (VideoId != null)
            {
                Video v = mgMgr.GetVideo(VideoId.Value);
                this.DataItem = v;
                title         = v.Title;
            }
            else if (VideoName != "")
            {
                VideosView v = mgMgr.GetVideoDetails(VideoName);
                this.DataItem = v;
                title         = v.Title;
            }



            base.DataBind();

            if (!String.IsNullOrWhiteSpace(title))
            {
                if (MyPage != null)
                {
                    Config cfg = new Config();
                    MyPage.CustomTitle = string.Format("{0} Video - {1}",
                                                       StringUtils.StripOutHtmlTags(title), cfg.GetKey("SiteName"));
                }
            }
        }
Exemplo n.º 2
0
        public override void DataBind()
        {
            bind();
            if (_bound)
            {
                string temp = "";
                switch (VideoImageType)
                {
                case ImageType.Thumb:
                default:
                    temp = MediaGalleryManager.GetThumbImage(videoThumb);
                    if (!StringUtils.IsNullOrWhiteSpace(temp))
                    {
                        this.Src = WebContext.Root + "/" + temp;
                    }
                    if (this.Src != "")
                    {
                        NoResize = true;
                    }
                    break;
                }
                if (String.IsNullOrEmpty(this.Src))
                {
                    if (NoImage == "")
                    {
                        Visible = false;
                        return;
                    }
                    else
                    {
                        this.Src = ResolveUrl(NoImage);
                    }
                }

                this.Attributes["alt"] = alt != null?StringUtils.StripOutHtmlTags(alt.ToString()) : "";

                base.DataBind();
            }
        }
Exemplo n.º 3
0
 public VideosDataSource()
 {
     this.DataLibrary = cte.lib;
     mMgr             = new MediaGalleryManager();
 }
Exemplo n.º 4
0
        public override void DataBind()
        {
            if (this._bound)
            {
                return;
            }
            _bound = true;

            int    _videoId = -1;
            object obj      = DataBinder.Eval(this.NamingContainer, "DataItem.VideoId");

            if (!String.IsNullOrEmpty(obj.ToString()))
            {
                _videoId = (int)obj;
            }
            else
            {
                return;
            }

            MediaGalleryManager mMgr       = new MediaGalleryManager();
            VideosView          _videoView = mMgr.GetVideoView(_videoId);

            string text = _videoView.Title;

            switch (Type)
            {
            case VideoLinkType.ArchiveByType:
                text      = _videoView.VideoCategoryTitle;
                this.HRef = string.Format("{2}/{0}/{1}.aspx",
                                          Path == "" ? "video-categories" : Path,
                                          _videoView.VideoCategoryUniqueName,
                                          WebContext.Root);
                break;

            case VideoLinkType.VideoID:
                if (IncludeVideoCategoryPath)
                {
                    this.HRef = string.Format("{3}/{0}{1}/{2}{4}",
                                              Path == "" ? "" : Path + "/",
                                              _videoView.VideoCategoryUniqueName,
                                              _videoView.VideoId,
                                              WebContext.Root,
                                              Extension
                                              );
                }
                else
                {
                    this.HRef = string.Format("{2}/{0}{1}{3}",
                                              Path == "" ? "" : Path + "/",
                                              _videoView.VideoId,
                                              WebContext.Root,
                                              Extension
                                              );
                }
                break;

            case VideoLinkType.Video:
            default:
                this.HRef = string.Format("{2}/{0}/{1}{3}",
                                          Path == "" ? "videos" : Path,
                                          _videoView.UniqueName,
                                          WebContext.Root,
                                          Extension
                                          );
                if (IncludeVideoCategoryPath)
                {
                    this.HRef = string.Format("{3}/{0}/{1}/{2}{4}",
                                              Path == "" ? "videos" : Path,
                                              _videoView.VideoCategoryUniqueName,
                                              _videoView.UniqueName,
                                              WebContext.Root,
                                              Extension
                                              );
                }
                else
                {
                    this.HRef = string.Format("{2}/{0}/{1}{3}",
                                              Path == "" ? "videos" : Path,
                                              _videoView.UniqueName,
                                              WebContext.Root,
                                              Extension
                                              );
                }
                break;
            }
            if (this.Controls.Count == 0)
            {
                this.InnerHtml = string.Format(Format, text);
            }

            base.DataBind();

            if (MyPage.Editable && ImEditable)
            {
                this.Attributes.Add("data-editable", "true");
                this.Attributes.Add("data-id", _videoId.ToString());
                this.Attributes.Add("data-type", "videos");
            }
        }