Пример #1
0
        /// <summary>
        /// Retrieves the markup to display to the end-user
        /// </summary>
        /// <param name="moduleId"></param>
        /// <param name="tabId"></param>
        /// <param name="isEditable"></param>
        /// <param name="config"></param>
        /// <param name="settings"></param>
        /// <returns></returns>
        public List <string> DisplayMedia(int moduleId, int tabId, bool isEditable, ModuleInfo config, PortalSettings settings)
        {
            MediaInfo     objMedia = GetMedia(moduleId);
            List <string> lstMedia = new List <string> {
                string.Empty, string.Empty, string.Empty
            };
            string HTMLTag = string.Empty;

            if (objMedia != null && objMedia.ModuleID > Null.NullInteger)
            {
                if (objMedia.MediaType == 0) // standard file system
                {
                    MediaMarkUpUtility utilMedia = new MediaMarkUpUtility();

                    // Check extension
                    switch (utilMedia.GetMediaType(objMedia))
                    {
                    case MediaType.Flash:
                        HTMLTag = utilMedia.GetFlashMarkUp(objMedia, config);
                        break;

                    case MediaType.WindowsMedia:
                        HTMLTag = utilMedia.GetWindowsMediaMarkUp(objMedia, config);
                        break;

                    case MediaType.RealPlayer:
                        HTMLTag = utilMedia.GetRealPlayerMarkUp(objMedia, config);
                        break;

                    case MediaType.Quicktime:
                        HTMLTag = utilMedia.GetQuicktimeMarkUp(objMedia, config);
                        break;

                    default:
                        HTMLTag = utilMedia.GetImageMarkUp(objMedia, config);
                        break;
                    }

                    lstMedia[0] = HTMLTag;
                }
                else if (objMedia.MediaType == 1) // embed code
                {
                    lstMedia[0] = System.Web.HttpUtility.HtmlDecode(objMedia.Src);
                }
                else if (objMedia.MediaType == 2) // oembed
                {
                    try
                    {
                        Wrapper ctlOEmbed = new Wrapper();
                        //if (objMedia.Width > 0 & objMedia.Height > 0)
                        //{
                        //    lstMedia[0] = ctlOEmbed.GetContent(new RequestInfo(objMedia.Src));
                        //}
                        //else
                        //{
                        lstMedia[0] = ctlOEmbed.GetContent(new RequestInfo(objMedia.Src, objMedia.Width, objMedia.Height));
                        //}
                    }
                    catch (Exception ex)
                    {
                        Exceptions.LogException(ex);
                        lstMedia[2] = "oEmbed.ErrorMessage";
                    }
                }

                // load the saved message from options
                lstMedia[1] = objMedia.MediaMessage;
            }

            return(lstMedia);
        }
Пример #2
0
        /// <summary>
        /// Retrieves the markup to display to the end-user
        /// </summary>
        /// <param name="moduleId"></param>
        /// <param name="tabId"></param>
        /// <param name="isEditable"></param>
        /// <param name="config"></param>
        /// <param name="settings"></param>
        /// <returns></returns>
        public List <string> DisplayMedia(int moduleId, int tabId, bool isEditable, ModuleInfo config, PortalSettings settings)
        {
            MediaInfo     objMedia = GetMedia(moduleId);
            List <string> lstMedia = new List <string> {
                string.Empty, string.Empty, string.Empty
            };
            string HTMLTag = string.Empty;

            if (objMedia != null && objMedia.ModuleID > Null.NullInteger)
            {
                if (objMedia.MediaType == 0) // standard file system
                {
                    // 20120822 - WStrohl
                    // old way of retrieving files from the file system
                    // no longer needed with folder providers
                    //objMedia.Src = Globals.LinkClick(objMedia.Src.ToLower(), tabId, moduleId, false);

                    //if (objMedia.Src.IndexOf("://") == 0)
                    //{
                    //    objMedia.Src = string.Concat(settings.HomeDirectory, objMedia.Src);
                    //}

                    MediaMarkUpUtility utilMedia = new MediaMarkUpUtility();

                    // Check extension
                    switch (utilMedia.GetMediaType(objMedia))
                    {
                    case MediaType.Flash:
                        HTMLTag = utilMedia.GetFlashMarkUp(objMedia, config);
                        break;

                    case MediaType.WindowsMedia:
                        HTMLTag = utilMedia.GetWindowsMediaMarkUp(objMedia, config);
                        break;

                    case MediaType.RealPlayer:
                        HTMLTag = utilMedia.GetRealPlayerMarkUp(objMedia, config);
                        break;

                    case MediaType.Quicktime:
                        HTMLTag = utilMedia.GetQuicktimeMarkUp(objMedia, config);
                        break;

                    default:
                        HTMLTag = utilMedia.GetImageMarkUp(objMedia, config);
                        break;
                    }

                    lstMedia[0] = HTMLTag;
                }
                else if (objMedia.MediaType == 1) // embed code
                {
                    lstMedia[0] = System.Web.HttpUtility.HtmlDecode(objMedia.Src);
                }
                else if (objMedia.MediaType == 2) // oembed
                {
                    try
                    {
                        Wrapper ctlOEmbed = new Wrapper();
                        if (objMedia.Width > 0 & objMedia.Height > 0)
                        {
                            lstMedia[0] = ctlOEmbed.GetContent(new RequestInfo(objMedia.Src));
                        }
                        else
                        {
                            lstMedia[0] = ctlOEmbed.GetContent(new RequestInfo(objMedia.Src, objMedia.Width, objMedia.Height));
                        }
                    }
                    catch (Exception ex)
                    {
                        Exceptions.LogException(ex);
                        lstMedia[2] = "oEmbed.ErrorMessage";
                    }
                }
            }

            return(lstMedia);
        }