Ejemplo n.º 1
0
        public string GetWindowsMediaMarkUp(MediaInfo Media, ModuleInfo ModuleConfig)
        {
            string strWMediaId    = string.Concat(WINDOWS_MEDIA_ID_PREFIX, Media.ModuleID.ToString());
            string strDivId       = string.Concat(DIV_ID_PREFIX, strWMediaId);
            string strDivCssClass = string.Concat(DIV_CLASS, GetMediaAlignment(Media.MediaAlignment, ModuleConfig), " dnnmedia_wmp");

            //
            // BUILD:
            // <div id="" class="">
            // <embed src="" width="" height="" autostart="" loop="" pluginspage="http://download.microsoft.com/download/winmediaplayer/nsplugin/6.4/WIN98/EN-US/wmpplugin.exe" type="application/x-mplayer2"></embed>
            // </div>
            //

            StringBuilder sb = new StringBuilder(10);

            // build open div
            sb.AppendFormat(OPEN_TAG_FORMAT, DIV_TAG);
            sb.AppendFormat(ID_ATTRIBUTE, strDivId);
            sb.AppendFormat(CLASS_ATTRIBUTE.Trim(), strDivCssClass);
            sb.Append(CLOSE_BRACKET);
            //

            // build windows media object
            sb.AppendFormat(OPEN_TAG_FORMAT, OBJECT_TAG);
            sb.AppendFormat(ID_ATTRIBUTE, strWMediaId);

            if (Media.Width > Null.NullInteger)
            {
                sb.AppendFormat(WIDTH_ATTRIBUTE, Media.Width);
            }

            if (Media.Height > Null.NullInteger)
            {
                sb.AppendFormat(HEIGHT_ATTRIBUTE, Media.Height);
            }

            sb.Append("classid=\"clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6\"");
            sb.Append(CLOSE_BRACKET);
            sb.AppendFormat(PARAM_TAG_FORMAT, "url", Media.WebFriendlyUrl);
            sb.AppendFormat(PARAM_TAG_FORMAT, "src", Media.WebFriendlyUrl);
            sb.AppendFormat(PARAM_TAG_FORMAT, "showcontrols", "true");
            sb.AppendFormat(PARAM_TAG_FORMAT, AUTOSTART, Media.AutoStart.ToString().ToLower());
            sb.AppendFormat(PARAM_TAG_FORMAT, MEDIA_LOOP, Media.MediaLoop.ToString().ToLower());
            sb.Append("<!--[if !IE]> <-->");
            sb.AppendFormat(OPEN_TAG_FORMAT, OBJECT_TAG);
            sb.AppendFormat(DATA_ATTRIBUTE, Media.WebFriendlyUrl);

            if (Media.Width > Null.NullInteger)
            {
                sb.AppendFormat(WIDTH_ATTRIBUTE, Media.Width);
            }

            if (Media.Height > Null.NullInteger)
            {
                sb.AppendFormat(HEIGHT_ATTRIBUTE, Media.Height);
            }

            sb.Append("type=\"video/x-ms-wmv\"");
            sb.Append(CLOSE_BRACKET);
            sb.AppendFormat(PARAM_TAG_FORMAT, "src", Media.WebFriendlyUrl);
            sb.AppendFormat(PARAM_TAG_FORMAT, "controller", "true");
            sb.AppendFormat(PARAM_TAG_FORMAT, AUTOSTART, Media.AutoStart.ToString().ToLower());
            sb.AppendFormat(PARAM_TAG_FORMAT, MEDIA_LOOP, Media.MediaLoop.ToString().ToLower());
            sb.AppendFormat(CLOSE_TAG_FORMAT, OBJECT_TAG);
            sb.Append("<!--> <![endif]-->");
            sb.AppendFormat(CLOSE_TAG_FORMAT, OBJECT_TAG);
            //

            // build close div
            sb.AppendFormat(CLOSE_TAG_FORMAT, DIV_TAG);
            //

            return(sb.ToString());
        }
Ejemplo n.º 2
0
        public string GetRealPlayerMarkUp(MediaInfo Media, ModuleInfo ModuleConfig)
        {
            string strRMediaId    = string.Concat(REAL_PLAYER_ID_PREFIX, Media.ModuleID.ToString());
            string strDivId       = string.Concat(DIV_ID_PREFIX, strRMediaId);
            string strDivCssClass = string.Concat(DIV_CLASS, GetMediaAlignment(Media.MediaAlignment, ModuleConfig), " dnnmedia_wmp");

            //
            // BUILD:
            // <div id="" class="">
            // <object classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="" height="">
            // <param name="src" value="" />
            // <param name="controls" value="ImageWindow" />
            // <param name="console" value="one" />
            // <param name="autostart" value="true" />
            // <param name="wmode" value="transparent" />
            // <embed src="" width="" height="" nojava="true" controls="ImageWindow" console="one" autostart="" wmode="transparent"></embed>
            // </object>
            // </div>
            //

            StringBuilder sb = new StringBuilder(10);

            // build open div
            sb.AppendFormat(OPEN_TAG_FORMAT, DIV_TAG);
            sb.AppendFormat(ID_ATTRIBUTE, strDivId);
            sb.AppendFormat(CLASS_ATTRIBUTE.Trim(), strDivCssClass);
            sb.Append(CLOSE_BRACKET);
            //

            // build real media player object
            sb.AppendFormat(OPEN_TAG_FORMAT, OBJECT_TAG);
            sb.AppendFormat(ID_ATTRIBUTE, strRMediaId);

            if (Media.Width > Null.NullInteger)
            {
                sb.AppendFormat(WIDTH_ATTRIBUTE, Media.Width);
            }

            if (Media.Height > Null.NullInteger)
            {
                sb.AppendFormat(HEIGHT_ATTRIBUTE, Media.Height);
            }

            sb.Append("classid=\"clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA\"");
            sb.Append(CLOSE_BRACKET);
            sb.AppendFormat(PARAM_TAG_FORMAT, SRC, Media.WebFriendlyUrl);
            sb.AppendFormat(PARAM_TAG_FORMAT, MEDIA_LOOP, Media.MediaLoop);
            sb.AppendFormat(PARAM_TAG_FORMAT, "controls", "ImageWindow");
            sb.AppendFormat(PARAM_TAG_FORMAT, "maintainaspect", "true");
            //sb.AppendFormat(PARAM_TAG_FORMAT, "console", "_unique")
            sb.AppendFormat(PARAM_TAG_FORMAT, AUTOSTART, Media.AutoStart.ToString().ToLower());
            sb.Append("<!--[if !IE]> <-->");
            sb.AppendFormat(OPEN_TAG_FORMAT, OBJECT_TAG);
            sb.AppendFormat(DATA_ATTRIBUTE, Media.WebFriendlyUrl);

            if (Media.Width > Null.NullInteger)
            {
                sb.AppendFormat(WIDTH_ATTRIBUTE, Media.Width);
            }

            if (Media.Height > Null.NullInteger)
            {
                sb.AppendFormat(HEIGHT_ATTRIBUTE, Media.Height);
            }

            sb.Append("type=\"audio/x-pn-realaudio-plugin\"");
            sb.Append(CLOSE_BRACKET);
            sb.AppendFormat(PARAM_TAG_FORMAT, SRC, Media.WebFriendlyUrl);
            sb.AppendFormat(PARAM_TAG_FORMAT, MEDIA_LOOP, Media.MediaLoop);
            sb.AppendFormat(PARAM_TAG_FORMAT, AUTOSTART, Media.AutoStart.ToString().ToLower());
            sb.AppendFormat(PARAM_TAG_FORMAT, "nojava", "true");
            sb.AppendFormat(PARAM_TAG_FORMAT, "controls", "ImageWindow");
            sb.AppendFormat(PARAM_TAG_FORMAT, "maintainaspect", "true");
            //sb.AppendFormat(PARAM_TAG_FORMAT, "console", "_unique")
            sb.AppendFormat(CLOSE_TAG_FORMAT, OBJECT_TAG);
            sb.Append("<!--> <![endif]-->");
            sb.AppendFormat(CLOSE_TAG_FORMAT, OBJECT_TAG);
            //

            // build close div
            sb.AppendFormat(CLOSE_TAG_FORMAT, DIV_TAG);
            //

            return(sb.ToString());
        }
Ejemplo n.º 3
0
        public string GetImageMarkUp(MediaInfo Media, ModuleInfo ModuleConfig)
        {
            string strTagId       = string.Concat(IMAGE_ID_PREFIX, Media.ModuleID.ToString());
            string strAnchorId    = string.Concat(ANCHOR_ID_PREFIX, strTagId);
            string strDivId       = string.Concat(DIV_ID_PREFIX, strTagId);
            string strDivCssClass = string.Concat(DIV_CLASS, GetMediaAlignment(Media.MediaAlignment, ModuleConfig));

            //
            // BUILD:
            // <div id="" class="">
            // <img id="" class="" src="" alt="" title="" />
            // </div>
            // <div id="" class="">
            // </div>
            //

            StringBuilder sb = new StringBuilder(10);

            // build open div
            sb.AppendFormat(OPEN_TAG_FORMAT, DIV_TAG);
            sb.AppendFormat(ID_ATTRIBUTE, strDivId);
            sb.AppendFormat(CLASS_ATTRIBUTE.Trim(), strDivCssClass);
            sb.Append(CLOSE_BRACKET);
            //

            // build open anchor tag
            if (!(string.IsNullOrEmpty(Media.NavigateUrl)))
            {
                sb.AppendFormat(OPEN_TAG_FORMAT, ANCHOR_TAG);
                sb.AppendFormat(ID_ATTRIBUTE, strAnchorId);

                if (Regex.IsMatch(Media.NavigateUrl, NUMERIC_MATCH_PATTERN))
                {
                    Media.NavigateUrl = Globals.NavigateURL(int.Parse(Media.NavigateUrl, NumberStyles.Integer));
                }

                if (Media.TrackClicks)
                {
                    // need to parse the local URL to get the human-friendly one
                    sb.AppendFormat(HREF_ATTRIBUTE, FormatURL(Media.NavigateUrl, Media.TrackClicks, ModuleConfig.TabID, ModuleConfig.ModuleID));
                }
                else
                {
                    // this must be a URL already
                    sb.AppendFormat(HREF_ATTRIBUTE, FormatURL(Media.NavigateUrl));
                }

                if (Media.NewWindow)
                {
                    sb.AppendFormat(TARGET_ATTRIBUTE, BLANK_ATTRIBUTE);
                }

                sb.Append(CLOSE_BRACKET);
            }
            //

            // begin building the image tag
            sb.AppendFormat(OPEN_TAG_FORMAT, IMAGE_TAG);
            sb.AppendFormat(ID_ATTRIBUTE, strTagId);
            sb.AppendFormat(CLASS_ATTRIBUTE, MEDIA_IMAGE_CLASS);
            sb.AppendFormat(SRC_ATTRIBUTE, Media.WebFriendlyUrl);

            if (!(string.IsNullOrEmpty(Media.Alt)))
            {
                sb.AppendFormat(ALT_ATTRIBUTE, Media.Alt);
                sb.AppendFormat(TITLE_ATTRIBUTE, Media.Alt);
            }
            else
            {
                // for XHTML compliance
                sb.AppendFormat(ALT_ATTRIBUTE, string.Empty);
            }

            if (Media.Width > Null.NullInteger & Media.Height > Null.NullInteger)
            {
                sb.AppendFormat(STYLE_ATTRIBUTE, Media.Width.ToString(), Media.Height.ToString());
            }

            sb.Append(SELF_CLOSE_BRACKET);
            //

            // build close anchor
            if (!(string.IsNullOrEmpty(Media.NavigateUrl)))
            {
                sb.AppendFormat(CLOSE_TAG_FORMAT, ANCHOR_TAG);
            }
            //

            // build close div
            sb.AppendFormat(CLOSE_TAG_FORMAT, DIV_TAG);
            //

            // add the description, if necessary
            if (!string.IsNullOrEmpty(Media.MediaMessage))
            {
                var strDescriptionId = string.Concat(strDivId, DESCRIPTION);

                // build open div for description
                sb.AppendFormat(OPEN_TAG_FORMAT, DIV_TAG);
                sb.AppendFormat(ID_ATTRIBUTE, strDescriptionId);
                sb.AppendFormat(CLASS_ATTRIBUTE.Trim(), DNNCLEAR);
                sb.Append(CLOSE_BRACKET);
                //

                // add the desciption
                sb.Append(HttpUtility.HtmlDecode(Media.MediaMessage));
                //

                // build the close div
                sb.AppendFormat(CLOSE_TAG_FORMAT, DIV_TAG);
                //
            }

            return(sb.ToString());
        }
Ejemplo n.º 4
0
        public string GetFlashMarkUp(MediaInfo Media, ModuleInfo ModuleConfig)
        {
            string strFlashId     = string.Concat(FLASH_ID_PREFIX, Media.ModuleID.ToString());
            string strDivId       = string.Concat(DIV_ID_PREFIX, strFlashId);
            string strDivCssClass = string.Concat(DIV_CLASS, GetMediaAlignment(Media.MediaAlignment, ModuleConfig));

            //Media.Src = String.Concat(CurrentDomain, Media.Src)

            //
            // BUILD:
            // <div id="" class="">
            // <embed pluginspage="http://www.macromedia.com/go/getflashplayer" src="" width="" height="" type="application/x-shockwave-flash" bgcolor="" salign="LT" quality="high" menu="false" loop=""></embed>
            // </div>
            //

            StringBuilder sb = new StringBuilder(10);

            // build open div
            sb.AppendFormat(OPEN_TAG_FORMAT, DIV_TAG);
            sb.AppendFormat(ID_ATTRIBUTE, strDivId);
            sb.AppendFormat(CLASS_ATTRIBUTE.Trim(), strDivCssClass);
            sb.Append(CLOSE_BRACKET);
            //

            // build flash object
            sb.AppendFormat(OPEN_TAG_FORMAT, OBJECT_TAG);
            sb.AppendFormat(ID_ATTRIBUTE, strFlashId);
            if (Media.Width > Null.NullInteger)
            {
                sb.AppendFormat(WIDTH_ATTRIBUTE, Media.Width);
            }
            if (Media.Height > Null.NullInteger)
            {
                sb.AppendFormat(HEIGHT_ATTRIBUTE, Media.Height);
            }
            sb.Append("classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" ");
            sb.AppendFormat("codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0\"");
            sb.Append(CLOSE_BRACKET);
            sb.AppendFormat(PARAM_TAG_FORMAT, "movie", Media.WebFriendlyUrl);
            sb.AppendFormat(PARAM_TAG_FORMAT, "quality", "high");
            sb.AppendFormat(PARAM_TAG_FORMAT, "bgcolor", "#ffffff");
            sb.AppendFormat(PARAM_TAG_FORMAT, "wmode", "transparent");
            sb.Append("<!--[if !IE]> <-->");
            sb.AppendFormat(OPEN_TAG_FORMAT, OBJECT_TAG);
            sb.AppendFormat(DATA_ATTRIBUTE, Media.WebFriendlyUrl);
            if (Media.Width > Null.NullInteger)
            {
                sb.AppendFormat(WIDTH_ATTRIBUTE, Media.Width);
            }
            if (Media.Height > Null.NullInteger)
            {
                sb.AppendFormat(HEIGHT_ATTRIBUTE, Media.Height);
            }
            sb.Append("type=\"application/x-shockwave-flash\"");
            sb.Append(CLOSE_BRACKET);
            sb.AppendFormat(PARAM_TAG_FORMAT, "quality", "high");
            sb.AppendFormat(PARAM_TAG_FORMAT, "bgcolor", "#ffffff");
            sb.AppendFormat(PARAM_TAG_FORMAT, "wmode", "transparent");
            sb.AppendFormat(PARAM_TAG_FORMAT, "pluginurl", "http://www.macromedia.com/go/getflashplayer");
            sb.AppendFormat(PARAM_TAG_FORMAT, "wmode", "transparent");
            sb.AppendFormat(CLOSE_TAG_FORMAT, OBJECT_TAG);
            sb.Append("<!--> <![endif]-->");
            sb.AppendFormat(CLOSE_TAG_FORMAT, OBJECT_TAG);
            //

            // build close div
            sb.AppendFormat(CLOSE_TAG_FORMAT, DIV_TAG);
            //

            return(sb.ToString());
        }
Ejemplo n.º 5
0
        private void SaveMedia()
        {
            var objMediaController = new MediaController();
            var objMedia           = new MediaInfo();

            try
            {
                // Update settings in the database
                if (radMediaType.SelectedIndex == 0) // standard file system
                {
                    if (string.Equals(ctlURL.UrlType, "F"))
                    {
                        IFileInfo objFile = FileManager.Instance.GetFile(int.Parse(Regex.Match(ctlURL.Url, "\\d+").Value, NumberStyles.Integer));
                        if (objFile != null)
                        {
                            if (string.IsNullOrEmpty(txtWidth.Text))
                            {
                                txtWidth.Text = objFile.Width.ToString();
                            }
                            if (string.IsNullOrEmpty(txtHeight.Text))
                            {
                                txtHeight.Text = objFile.Height.ToString();
                            }
                        }
                    }
                }

                var sec = new PortalSecurity();

                objMedia.ModuleID  = ModuleId;
                objMedia.MediaType = radMediaType.SelectedIndex;
                switch (radMediaType.SelectedIndex)
                {
                case 0:     // standard file system
                    objMedia.Src = ctlURL.Url;
                    break;

                case 1:     // embed code
                    objMedia.Src = txtEmbed.Text;
                    break;

                case 2:     // oembed url
                    objMedia.Src = txtOEmbed.Text;
                    break;
                }

                // ensure that youtube gets formatted correctly
                objMedia.Src = ReformatForYouTube(objMedia.Src);

                objMedia.Alt = sec.InputFilter(txtAlt.Text, PortalSecurity.FilterFlag.NoMarkup);

                if (!string.IsNullOrEmpty(txtWidth.Text))
                {
                    objMedia.Width = int.Parse(sec.InputFilter(txtWidth.Text, PortalSecurity.FilterFlag.NoMarkup), NumberStyles.Integer);
                }

                if (!string.IsNullOrEmpty(txtHeight.Text))
                {
                    objMedia.Height = int.Parse(sec.InputFilter(txtHeight.Text, PortalSecurity.FilterFlag.NoMarkup), NumberStyles.Integer);
                }

                objMedia.NavigateUrl    = sec.InputFilter(ctlNavigateUrl.Url, PortalSecurity.FilterFlag.NoMarkup);
                objMedia.MediaAlignment = int.Parse(sec.InputFilter(ddlImageAlignment.SelectedValue, PortalSecurity.FilterFlag.NoMarkup), NumberStyles.Integer);
                objMedia.AutoStart      = chkAutoStart.Checked;
                objMedia.MediaLoop      = chkLoop.Checked;
                objMedia.LastUpdatedBy  = UserId;
                objMedia.MediaMessage   = sec.InputFilter(txtMessage.Text, PortalSecurity.FilterFlag.NoScripting);

                // url tracking
                var objUrls = new UrlController();
                objUrls.UpdateUrl(PortalId, ctlNavigateUrl.Url, ctlNavigateUrl.UrlType, ctlNavigateUrl.Log, ctlNavigateUrl.Track, ModuleId, ctlNavigateUrl.NewWindow);

                // update settings/preferences
                SaveMediaSettings();

                // add/update
                if (p_isNew)
                {
                    // add new media
                    objMediaController.AddMedia(objMedia);
                }
                else
                {
                    // update existing media
                    objMediaController.UpdateMedia(objMedia);
                }

                // save the update into the journal
                if (PostToJournal)
                {
                    AddMediaUpdateToJournal(objMedia);
                }

                // notify the site administrators
                if (NotifyOnUpdate)
                {
                    SendNotificationToMessageCenter(objMedia);
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.LogException(exc);
            }
        }
Ejemplo n.º 6
0
 public MediaType GetMediaType(MediaInfo Media)
 {
     return(GetMediaType(Media.Src));
 }
Ejemplo n.º 7
0
        public string GetRealPlayerMarkUp(MediaInfo Media, DotNetNuke.Entities.Modules.ModuleInfo ModuleConfig)
        {
            string strRMediaId = string.Concat(REAL_PLAYER_ID_PREFIX, Media.ModuleID.ToString());
            string strDivId = string.Concat(DIV_ID_PREFIX, strRMediaId);
            string strDivCssClass = string.Concat(DIV_CLASS, GetMediaAlignment(Media.MediaAlignment, ModuleConfig), " dnnmedia_wmp");

            //
            // BUILD:
            // <div id="" class="">
            // <object classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="" height="">
            // <param name="src" value="" />
            // <param name="controls" value="ImageWindow" />
            // <param name="console" value="one" />
            // <param name="autostart" value="true" />
            // <param name="wmode" value="transparent" />
            // <embed src="" width="" height="" nojava="true" controls="ImageWindow" console="one" autostart="" wmode="transparent"></embed>
            // </object>
            // </div>
            //

            StringBuilder sb = new StringBuilder(10);

            // build open div
            sb.AppendFormat(OPEN_TAG_FORMAT, DIV_TAG);
            sb.AppendFormat(ID_ATTRIBUTE, strDivId);
            sb.AppendFormat(CLASS_ATTRIBUTE.Trim(), strDivCssClass);
            sb.Append(CLOSE_BRACKET);
            //

            // build real media player object
            sb.AppendFormat(OPEN_TAG_FORMAT, OBJECT_TAG);
            sb.AppendFormat(ID_ATTRIBUTE, strRMediaId);
            if (Media.Width > Null.NullInteger)
            {
                sb.AppendFormat(WIDTH_ATTRIBUTE, Media.Width);
            }
            if (Media.Height > Null.NullInteger)
            {
                sb.AppendFormat(HEIGHT_ATTRIBUTE, Media.Height);
            }
            sb.Append("classid=\"clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA\"");
            sb.Append(CLOSE_BRACKET);
            sb.AppendFormat(PARAM_TAG_FORMAT, SRC, Media.WebFriendlyUrl);
            sb.AppendFormat(PARAM_TAG_FORMAT, MEDIA_LOOP, Media.MediaLoop);
            sb.AppendFormat(PARAM_TAG_FORMAT, "controls", "ImageWindow");
            sb.AppendFormat(PARAM_TAG_FORMAT, "maintainaspect", "true");
            //sb.AppendFormat(PARAM_TAG_FORMAT, "console", "_unique")
            sb.AppendFormat(PARAM_TAG_FORMAT, AUTOSTART, Media.AutoStart.ToString().ToLower());
            sb.Append("<!--[if !IE]> <-->");
            sb.AppendFormat(OPEN_TAG_FORMAT, OBJECT_TAG);
            sb.AppendFormat(DATA_ATTRIBUTE, Media.WebFriendlyUrl);
            if (Media.Width > Null.NullInteger)
            {
                sb.AppendFormat(WIDTH_ATTRIBUTE, Media.Width);
            }
            if (Media.Height > Null.NullInteger)
            {
                sb.AppendFormat(HEIGHT_ATTRIBUTE, Media.Height);
            }
            sb.Append("type=\"audio/x-pn-realaudio-plugin\"");
            sb.Append(CLOSE_BRACKET);
            sb.AppendFormat(PARAM_TAG_FORMAT, SRC, Media.WebFriendlyUrl);
            sb.AppendFormat(PARAM_TAG_FORMAT, MEDIA_LOOP, Media.MediaLoop);
            sb.AppendFormat(PARAM_TAG_FORMAT, AUTOSTART, Media.AutoStart.ToString().ToLower());
            sb.AppendFormat(PARAM_TAG_FORMAT, "nojava", "true");
            sb.AppendFormat(PARAM_TAG_FORMAT, "controls", "ImageWindow");
            sb.AppendFormat(PARAM_TAG_FORMAT, "maintainaspect", "true");
            //sb.AppendFormat(PARAM_TAG_FORMAT, "console", "_unique")
            sb.AppendFormat(CLOSE_TAG_FORMAT, OBJECT_TAG);
            sb.Append("<!--> <![endif]-->");
            sb.AppendFormat(CLOSE_TAG_FORMAT, OBJECT_TAG);
            //

            // build close div
            sb.AppendFormat(CLOSE_TAG_FORMAT, DIV_TAG);
            //

            return sb.ToString();
        }
Ejemplo n.º 8
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);
        }
Ejemplo n.º 9
0
 public MediaType GetMediaType(MediaInfo Media)
 {
     return GetMediaType(Media.Src);
 }
Ejemplo n.º 10
0
        public string GetQuicktimeMarkUp(MediaInfo Media, DotNetNuke.Entities.Modules.ModuleInfo ModuleConfig)
        {
            string strQMediaId = string.Concat(QUICKTIME_ID_PREFIX, Media.ModuleID.ToString());
            string strDivId = string.Concat(DIV_ID_PREFIX, strQMediaId);
            string strDivCssClass = string.Concat(DIV_CLASS, GetMediaAlignment(Media.MediaAlignment, ModuleConfig), " dnnmedia_wmp");

            //
            // BUILD:
            // <div id="" class="">
            // <object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" width="" height="">
            // <param name="src" value="" />
            // <param name="autoplay" value="true" />
            // <param name="controller" value="true" />
            // <param name="loop" value="false" />
            // <param name="type" value="video/quicktime" />
            // <param name="target" value="myself" />
            // <embed width="" height="" pluginspage="http://www.apple.com/quicktime/download/" src="" type="video/quicktime" autoplay="true" controller="true" loop="false" target="myself"></embed>
            // </object>
            // </div>
            //

            StringBuilder sb = new StringBuilder(10);

            // build open div
            sb.AppendFormat(OPEN_TAG_FORMAT, DIV_TAG);
            sb.AppendFormat(ID_ATTRIBUTE, strDivId);
            sb.AppendFormat(CLASS_ATTRIBUTE.Trim(), strDivCssClass);
            sb.Append(CLOSE_BRACKET);
            //

            // build quicktime object
            sb.AppendFormat(OPEN_TAG_FORMAT, OBJECT_TAG);
            sb.AppendFormat(ID_ATTRIBUTE, strQMediaId);
            if (Media.Width > Null.NullInteger)
            {
                sb.AppendFormat(WIDTH_ATTRIBUTE, Media.Width);
            }
            if (Media.Height > Null.NullInteger)
            {
                sb.AppendFormat(HEIGHT_ATTRIBUTE, Media.Height);
            }
            // ISSUE 18955 - http://dnnmedia.codeplex.com/workitem/18955
            // Changed the clsid to be the correct one
            sb.Append("classid=\"clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B\" ");
            sb.Append("codebase=\"http://www.apple.com/qtactivex/qtplugin.cab\"");
            sb.Append(CLOSE_BRACKET);
            sb.AppendFormat(PARAM_TAG_FORMAT, "src", Media.WebFriendlyUrl);
            sb.AppendFormat(PARAM_TAG_FORMAT, "controller", "true");
            sb.AppendFormat(PARAM_TAG_FORMAT, AUTOPLAY, Media.AutoStart);
            sb.AppendFormat(PARAM_TAG_FORMAT, MEDIA_LOOP, Media.MediaLoop);
            sb.Append("<!--[if !IE]> <-->");
            sb.AppendFormat(OPEN_TAG_FORMAT, OBJECT_TAG);
            sb.AppendFormat(DATA_ATTRIBUTE, Media.WebFriendlyUrl);
            if (Media.Width > Null.NullInteger)
            {
                sb.AppendFormat(WIDTH_ATTRIBUTE, Media.Width);
            }
            if (Media.Height > Null.NullInteger)
            {
                sb.AppendFormat(HEIGHT_ATTRIBUTE, Media.Height);
            }
            sb.Append("type=\"video/quicktime\"");
            sb.Append(CLOSE_BRACKET);
            sb.AppendFormat(PARAM_TAG_FORMAT, "controller", "true");
            sb.AppendFormat(PARAM_TAG_FORMAT, AUTOPLAY, Media.AutoStart);
            sb.AppendFormat(PARAM_TAG_FORMAT, MEDIA_LOOP, Media.MediaLoop);
            sb.AppendFormat(CLOSE_TAG_FORMAT, OBJECT_TAG);
            sb.Append("<!--> <![endif]-->");
            sb.AppendFormat(CLOSE_TAG_FORMAT, OBJECT_TAG);
            //

            // build close div
            sb.AppendFormat(CLOSE_TAG_FORMAT, DIV_TAG);
            //

            return sb.ToString();
        }
Ejemplo n.º 11
0
        public string GetImageMarkUp(MediaInfo Media, Entities.Modules.ModuleInfo ModuleConfig)
        {
            string strTagId = string.Concat(IMAGE_ID_PREFIX, Media.ModuleID.ToString());
            string strAnchorId = string.Concat(ANCHOR_ID_PREFIX, strTagId);
            string strDivId = string.Concat(DIV_ID_PREFIX, strTagId);
            string strDivCssClass = string.Concat(DIV_CLASS, GetMediaAlignment(Media.MediaAlignment, ModuleConfig));

            //
            // BUILD:
            // <div id="" class="">
            // <img id="" class="" src="" alt="" title="" />
            // </div>
            // <div id="" class="">
            // </div>
            //

            StringBuilder sb = new StringBuilder(10);

            // build open div
            sb.AppendFormat(OPEN_TAG_FORMAT, DIV_TAG);
            sb.AppendFormat(ID_ATTRIBUTE, strDivId);
            sb.AppendFormat(CLASS_ATTRIBUTE.Trim(), strDivCssClass);
            sb.Append(CLOSE_BRACKET);
            //

            // build open anchor tag
            if (! (string.IsNullOrEmpty(Media.NavigateUrl)))
            {
                sb.AppendFormat(OPEN_TAG_FORMAT, ANCHOR_TAG);
                sb.AppendFormat(ID_ATTRIBUTE, strAnchorId);

                if (Regex.IsMatch(Media.NavigateUrl, NUMERIC_MATCH_PATTERN))
                {
                    Media.NavigateUrl = Globals.NavigateURL(int.Parse(Media.NavigateUrl, NumberStyles.Integer));
                }

                if (Media.TrackClicks)
                {
                    // need to parse the local URL to get the human-friendly one
                    sb.AppendFormat(HREF_ATTRIBUTE, FormatURL(Media.NavigateUrl, Media.TrackClicks, ModuleConfig.TabID, ModuleConfig.ModuleID));
                }
                else
                {
                    // this must be a URL already
                    sb.AppendFormat(HREF_ATTRIBUTE, FormatURL(Media.NavigateUrl));
                }

                if (Media.NewWindow)
                {
                    sb.AppendFormat(TARGET_ATTRIBUTE, BLANK_ATTRIBUTE);
                }

                sb.Append(CLOSE_BRACKET);
            }
            //

            // begin building the image tag
            sb.AppendFormat(OPEN_TAG_FORMAT, IMAGE_TAG);
            sb.AppendFormat(ID_ATTRIBUTE, strTagId);
            sb.AppendFormat(CLASS_ATTRIBUTE, MEDIA_IMAGE_CLASS);
            sb.AppendFormat(SRC_ATTRIBUTE, Media.WebFriendlyUrl);

            if (! (string.IsNullOrEmpty(Media.Alt)))
            {
                sb.AppendFormat(ALT_ATTRIBUTE, Media.Alt);
                sb.AppendFormat(TITLE_ATTRIBUTE, Media.Alt);
            }
            else
            {
                // for XHTML compliance
                sb.AppendFormat(ALT_ATTRIBUTE, string.Empty);
            }

            if (Media.Width > Null.NullInteger & Media.Height > Null.NullInteger)
            {
                sb.AppendFormat(STYLE_ATTRIBUTE, Media.Width.ToString(), Media.Height.ToString());
            }

            sb.Append(SELF_CLOSE_BRACKET);
            //

            // build close anchor
            if (! (string.IsNullOrEmpty(Media.NavigateUrl)))
            {
                sb.AppendFormat(CLOSE_TAG_FORMAT, ANCHOR_TAG);
            }
            //

            // build close div
            sb.AppendFormat(CLOSE_TAG_FORMAT, DIV_TAG);
            //

            // add the description, if necessary
            if (!string.IsNullOrEmpty(Media.MediaMessage))
            {

                var strDescriptionId = string.Concat(strDivId, DESCRIPTION);

                // build open div for description
                sb.AppendFormat(OPEN_TAG_FORMAT, DIV_TAG);
                sb.AppendFormat(ID_ATTRIBUTE, strDescriptionId);
                sb.AppendFormat(CLASS_ATTRIBUTE.Trim(), DNNCLEAR);
                sb.Append(CLOSE_BRACKET);
                //

                // add the desciption
                sb.Append(HttpUtility.HtmlDecode(Media.MediaMessage));
                //

                // build the close div
                sb.AppendFormat(CLOSE_TAG_FORMAT, DIV_TAG);
                //

            }

            return sb.ToString();
        }
Ejemplo n.º 12
0
        public string GetFlashMarkUp(MediaInfo Media, DotNetNuke.Entities.Modules.ModuleInfo ModuleConfig)
        {
            string strFlashId = string.Concat(FLASH_ID_PREFIX, Media.ModuleID.ToString());
            string strDivId = string.Concat(DIV_ID_PREFIX, strFlashId);
            string strDivCssClass = string.Concat(DIV_CLASS, GetMediaAlignment(Media.MediaAlignment, ModuleConfig));

            //Media.Src = String.Concat(CurrentDomain, Media.Src)

            //
            // BUILD:
            // <div id="" class="">
            // <embed pluginspage="http://www.macromedia.com/go/getflashplayer" src="" width="" height="" type="application/x-shockwave-flash" bgcolor="" salign="LT" quality="high" menu="false" loop=""></embed>
            // </div>
            //

            StringBuilder sb = new StringBuilder(10);

            // build open div
            sb.AppendFormat(OPEN_TAG_FORMAT, DIV_TAG);
            sb.AppendFormat(ID_ATTRIBUTE, strDivId);
            sb.AppendFormat(CLASS_ATTRIBUTE.Trim(), strDivCssClass);
            sb.Append(CLOSE_BRACKET);
            //

            // build flash object
            sb.AppendFormat(OPEN_TAG_FORMAT, OBJECT_TAG);
            sb.AppendFormat(ID_ATTRIBUTE, strFlashId);
            if (Media.Width > Null.NullInteger)
            {
                sb.AppendFormat(WIDTH_ATTRIBUTE, Media.Width);
            }
            if (Media.Height > Null.NullInteger)
            {
                sb.AppendFormat(HEIGHT_ATTRIBUTE, Media.Height);
            }
            sb.Append("classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" ");
            sb.AppendFormat("codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0\"");
            sb.Append(CLOSE_BRACKET);
            sb.AppendFormat(PARAM_TAG_FORMAT, "movie", Media.WebFriendlyUrl);
            sb.AppendFormat(PARAM_TAG_FORMAT, "quality", "high");
            sb.AppendFormat(PARAM_TAG_FORMAT, "bgcolor", "#ffffff");
            sb.AppendFormat(PARAM_TAG_FORMAT, "wmode", "transparent");
            sb.Append("<!--[if !IE]> <-->");
            sb.AppendFormat(OPEN_TAG_FORMAT, OBJECT_TAG);
            sb.AppendFormat(DATA_ATTRIBUTE, Media.WebFriendlyUrl);
            if (Media.Width > Null.NullInteger)
            {
                sb.AppendFormat(WIDTH_ATTRIBUTE, Media.Width);
            }
            if (Media.Height > Null.NullInteger)
            {
                sb.AppendFormat(HEIGHT_ATTRIBUTE, Media.Height);
            }
            sb.Append("type=\"application/x-shockwave-flash\"");
            sb.Append(CLOSE_BRACKET);
            sb.AppendFormat(PARAM_TAG_FORMAT, "quality", "high");
            sb.AppendFormat(PARAM_TAG_FORMAT, "bgcolor", "#ffffff");
            sb.AppendFormat(PARAM_TAG_FORMAT, "wmode", "transparent");
            sb.AppendFormat(PARAM_TAG_FORMAT, "pluginurl", "http://www.macromedia.com/go/getflashplayer");
            sb.AppendFormat(PARAM_TAG_FORMAT, "wmode", "transparent");
            sb.AppendFormat(CLOSE_TAG_FORMAT, OBJECT_TAG);
            sb.Append("<!--> <![endif]-->");
            sb.AppendFormat(CLOSE_TAG_FORMAT, OBJECT_TAG);
            //

            // build close div
            sb.AppendFormat(CLOSE_TAG_FORMAT, DIV_TAG);
            //

            return sb.ToString();
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Adds the media update to the journal
        /// </summary>
        /// <param name="oMedia"></param>
        private void AddMediaUpdateToJournal(MediaInfo oMedia)
        {
            MediaController ctlMedia = new MediaController();

            //
            // Object Keys - great to GET data out of the journal
            // Create an oject key scheme unique to your data that will likely never change
            //
            var objectKey = MediaController.GetObjectKeyForJournal(ModuleId, UserId);

            //
            // Defensive coding to prevent duplicate journal entries
            //

            // attempt to get a reference to a journal item
            var ji = JournalController.Instance.GetJournalItemByKey(PortalId, objectKey);

            // delete the journal item if it already exists
            if (ji != null)
            {
                JournalController.Instance.DeleteJournalItemByKey(PortalId, objectKey);
            }

            // ensure we have a valid title for the journal status
            string tabTitle = PortalSettings.ActiveTab.Title;

            // if there isn't a Page Title in the Page Settings, use the Page Name
            if (string.IsNullOrEmpty(tabTitle))
            {
                tabTitle = PortalSettings.ActiveTab.TabName;
            }

            // Method unique to the Media Module to generate Media markup for images, videos, music, etc.
            List <string> lstMedia = ctlMedia.DisplayMedia(ModuleId, TabId, IsEditable, ModuleConfiguration, PortalSettings);

            //
            // Create a journal item object
            //

            // If valid media was returned, create a new journal item object
            if (!string.IsNullOrEmpty(lstMedia[0]))
            {
                // ensure that an acceptable description is generated for the journal
                string desc = string.Empty;
                if (!Regex.IsMatch(oMedia.ContentType, @"^image/", RegexOptions.IgnoreCase))
                {
                    // use a generic placeholder for non-image media as a click-through
                    desc = string.Format("<a href=\"{0}\"><img src=\"/DesktopModules/Media/Images/play-button.png\" alt=\"{1}\" /></a>",
                                         Common.Globals.NavigateURL(TabId),
                                         oMedia.Alt);
                }
                else
                {
                    // use the saved media
                    desc = lstMedia[0];
                }

                // create a new journal item object
                ji = new JournalItem
                {
                    PortalId      = PortalId,   // site id number
                    ProfileId     = UserId,     // profile id that this should be posted under
                    UserId        = UserId,     // id of the user account that generated the journal item
                    ContentItemId = ModuleId,   // ordinarily, this will be a contentID
                    Title         = oMedia.Alt, // title of the journal item in the meta data
                    ItemData      = new ItemData {
                        ImageUrl    = "\"/DesktopModules/Media/Images/play-button.png\"",
                        Description = desc,
                        Title       = oMedia.Alt,
                        Url         = Globals.NavigateURL(TabId)
                    },                                       // used to populate the journal item template, depending on the journal type
                    Summary = string.Format(GetLocalizedString("Journal.Status.Media.Updated"),
                                            oMedia.Alt,
                                            Globals.NavigateURL(TabId),
                                            tabTitle),                               // the text shown in the journal status
                    Body          = null,                                            // not really used in the default templates, but could be in your own
                    JournalTypeId = MediaController.GetMediaJournalTypeID(PortalId), // local method to choose the journal type globally
                    ObjectKey     = objectKey,                                       // your object key from above
                    SecuritySet   = "E,"                                             // valid values include:  E = Everyone, F = Friends Only, U = Private, P = Profile Only, R[n] = Role Id
                };
            }
            else
            {
                // create a generic journal item object for the media
                ji = new JournalItem
                {
                    PortalId      = PortalId,
                    ProfileId     = UserId,
                    UserId        = UserId,
                    ContentItemId = ModuleId,  // ordinarily, this will be a contentID
                    Title         = oMedia.Alt,
                    Summary       = string.Format(GetLocalizedString("Journal.Status.Media.Updated"),
                                                  oMedia.Alt,
                                                  Common.Globals.NavigateURL(TabId),
                                                  tabTitle),
                    Body          = null,
                    JournalTypeId = MediaController.GetMediaJournalTypeID(PortalId),
                    ObjectKey     = objectKey,
                    SecuritySet   = "E,"
                };
            }

            // send your new journal item to the feed
            JournalController.Instance.SaveJournalItem(ji, TabId);
        }
Ejemplo n.º 14
0
        public string GetQuicktimeMarkUp(MediaInfo Media, ModuleInfo ModuleConfig)
        {
            string strQMediaId    = string.Concat(QUICKTIME_ID_PREFIX, Media.ModuleID.ToString());
            string strDivId       = string.Concat(DIV_ID_PREFIX, strQMediaId);
            string strDivCssClass = string.Concat(DIV_CLASS, GetMediaAlignment(Media.MediaAlignment, ModuleConfig), " dnnmedia_wmp");

            //
            // BUILD:
            // <div id="" class="">
            // <object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" width="" height="">
            // <param name="src" value="" />
            // <param name="autoplay" value="true" />
            // <param name="controller" value="true" />
            // <param name="loop" value="false" />
            // <param name="type" value="video/quicktime" />
            // <param name="target" value="myself" />
            // <embed width="" height="" pluginspage="http://www.apple.com/quicktime/download/" src="" type="video/quicktime" autoplay="true" controller="true" loop="false" target="myself"></embed>
            // </object>
            // </div>
            //

            StringBuilder sb = new StringBuilder(10);

            // build open div
            sb.AppendFormat(OPEN_TAG_FORMAT, DIV_TAG);
            sb.AppendFormat(ID_ATTRIBUTE, strDivId);
            sb.AppendFormat(CLASS_ATTRIBUTE.Trim(), strDivCssClass);
            sb.Append(CLOSE_BRACKET);
            //

            // build quicktime object
            sb.AppendFormat(OPEN_TAG_FORMAT, OBJECT_TAG);
            sb.AppendFormat(ID_ATTRIBUTE, strQMediaId);

            if (Media.Width > Null.NullInteger)
            {
                sb.AppendFormat(WIDTH_ATTRIBUTE, Media.Width);
            }

            if (Media.Height > Null.NullInteger)
            {
                sb.AppendFormat(HEIGHT_ATTRIBUTE, Media.Height);
            }

            // ISSUE 18955 - http://dnnmedia.codeplex.com/workitem/18955
            // Changed the clsid to be the correct one
            sb.Append("classid=\"clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B\" ");
            sb.Append("codebase=\"http://www.apple.com/qtactivex/qtplugin.cab\"");
            sb.Append(CLOSE_BRACKET);
            sb.AppendFormat(PARAM_TAG_FORMAT, "src", Media.WebFriendlyUrl);
            sb.AppendFormat(PARAM_TAG_FORMAT, "controller", "true");
            sb.AppendFormat(PARAM_TAG_FORMAT, AUTOPLAY, Media.AutoStart);
            sb.AppendFormat(PARAM_TAG_FORMAT, MEDIA_LOOP, Media.MediaLoop);
            sb.Append("<!--[if !IE]> <-->");
            sb.AppendFormat(OPEN_TAG_FORMAT, OBJECT_TAG);
            sb.AppendFormat(DATA_ATTRIBUTE, Media.WebFriendlyUrl);

            if (Media.Width > Null.NullInteger)
            {
                sb.AppendFormat(WIDTH_ATTRIBUTE, Media.Width);
            }

            if (Media.Height > Null.NullInteger)
            {
                sb.AppendFormat(HEIGHT_ATTRIBUTE, Media.Height);
            }

            sb.Append("type=\"video/quicktime\"");
            sb.Append(CLOSE_BRACKET);
            sb.AppendFormat(PARAM_TAG_FORMAT, "controller", "true");
            sb.AppendFormat(PARAM_TAG_FORMAT, AUTOPLAY, Media.AutoStart);
            sb.AppendFormat(PARAM_TAG_FORMAT, MEDIA_LOOP, Media.MediaLoop);
            sb.AppendFormat(CLOSE_TAG_FORMAT, OBJECT_TAG);
            sb.Append("<!--> <![endif]-->");
            sb.AppendFormat(CLOSE_TAG_FORMAT, OBJECT_TAG);
            //

            // build close div
            sb.AppendFormat(CLOSE_TAG_FORMAT, DIV_TAG);
            //

            return(sb.ToString());
        }
Ejemplo n.º 15
0
        public string GetWindowsMediaMarkUp(MediaInfo Media, DotNetNuke.Entities.Modules.ModuleInfo ModuleConfig)
        {
            string strWMediaId = string.Concat(WINDOWS_MEDIA_ID_PREFIX, Media.ModuleID.ToString());
            string strDivId = string.Concat(DIV_ID_PREFIX, strWMediaId);
            string strDivCssClass = string.Concat(DIV_CLASS, GetMediaAlignment(Media.MediaAlignment, ModuleConfig), " dnnmedia_wmp");

            //
            // BUILD:
            // <div id="" class="">
            // <embed src="" width="" height="" autostart="" loop="" pluginspage="http://download.microsoft.com/download/winmediaplayer/nsplugin/6.4/WIN98/EN-US/wmpplugin.exe" type="application/x-mplayer2"></embed>
            // </div>
            //

            StringBuilder sb = new StringBuilder(10);

            // build open div
            sb.AppendFormat(OPEN_TAG_FORMAT, DIV_TAG);
            sb.AppendFormat(ID_ATTRIBUTE, strDivId);
            sb.AppendFormat(CLASS_ATTRIBUTE.Trim(), strDivCssClass);
            sb.Append(CLOSE_BRACKET);
            //

            // build windows media object
            sb.AppendFormat(OPEN_TAG_FORMAT, OBJECT_TAG);
            sb.AppendFormat(ID_ATTRIBUTE, strWMediaId);
            if (Media.Width > Null.NullInteger)
            {
                sb.AppendFormat(WIDTH_ATTRIBUTE, Media.Width);
            }
            if (Media.Height > Null.NullInteger)
            {
                sb.AppendFormat(HEIGHT_ATTRIBUTE, Media.Height);
            }
            sb.Append("classid=\"clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6\"");
            sb.Append(CLOSE_BRACKET);
            sb.AppendFormat(PARAM_TAG_FORMAT, "url", Media.WebFriendlyUrl);
            sb.AppendFormat(PARAM_TAG_FORMAT, "src", Media.WebFriendlyUrl);
            sb.AppendFormat(PARAM_TAG_FORMAT, "showcontrols", "true");
            sb.AppendFormat(PARAM_TAG_FORMAT, AUTOSTART, Media.AutoStart.ToString().ToLower());
            sb.AppendFormat(PARAM_TAG_FORMAT, MEDIA_LOOP, Media.MediaLoop.ToString().ToLower());
            sb.Append("<!--[if !IE]> <-->");
            sb.AppendFormat(OPEN_TAG_FORMAT, OBJECT_TAG);
            sb.AppendFormat(DATA_ATTRIBUTE, Media.WebFriendlyUrl);
            if (Media.Width > Null.NullInteger)
            {
                sb.AppendFormat(WIDTH_ATTRIBUTE, Media.Width);
            }
            if (Media.Height > Null.NullInteger)
            {
                sb.AppendFormat(HEIGHT_ATTRIBUTE, Media.Height);
            }
            sb.Append("type=\"video/x-ms-wmv\"");
            sb.Append(CLOSE_BRACKET);
            sb.AppendFormat(PARAM_TAG_FORMAT, "src", Media.WebFriendlyUrl);
            sb.AppendFormat(PARAM_TAG_FORMAT, "controller", "true");
            sb.AppendFormat(PARAM_TAG_FORMAT, AUTOSTART, Media.AutoStart.ToString().ToLower());
            sb.AppendFormat(PARAM_TAG_FORMAT, MEDIA_LOOP, Media.MediaLoop.ToString().ToLower());
            sb.AppendFormat(CLOSE_TAG_FORMAT, OBJECT_TAG);
            sb.Append("<!--> <![endif]-->");
            sb.AppendFormat(CLOSE_TAG_FORMAT, OBJECT_TAG);
            //

            // build close div
            sb.AppendFormat(CLOSE_TAG_FORMAT, DIV_TAG);
            //

            return sb.ToString();
        }
Ejemplo n.º 16
0
 /// <summary>
 /// UpdateMedia saves the MediaInfo object to the Database
 /// </summary>
 /// <remarks>
 /// </remarks>
 /// <param name="objMedia">The MediaInfo object</param>
 /// <history>
 ///		[lpointer]	31.10.2005	documented
 /// </history>
 public void UpdateMedia(MediaInfo objMedia)
 {
     DataProvider.Instance().UpdateMedia(objMedia.ModuleID, objMedia.Src, objMedia.Alt, objMedia.Width, objMedia.Height, objMedia.NavigateUrl, objMedia.MediaAlignment, objMedia.AutoStart, objMedia.MediaLoop, objMedia.NewWindow, objMedia.TrackClicks, objMedia.MediaType, objMedia.MediaMessage, objMedia.LastUpdatedBy);
 }
Ejemplo n.º 17
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);
        }
Ejemplo n.º 18
0
        /// <summary>
        /// ImportModule implements the IPortable ImportModule Interface
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <param name="ModuleID">The Id of the module to be imported</param>
        /// <history>
        ///		[lpointer]	31.10.2005	documented
        /// </history>
        public void ImportModule(int ModuleID, string Content, string Version, int UserId)
        {
            try
            {
                // Check to see if the module already has media. If it does, get rid of it.
                MediaInfo oMedia = new MediaInfo();
                oMedia = GetMedia(ModuleID);

                if (oMedia != null)
                {
                    DeleteMedia(ModuleID);
                }

                XmlNode   xmlImage = Globals.GetContent(Content, "image");
                MediaInfo objImage = new MediaInfo
                {
                    ModuleID    = ModuleID,
                    Src         = xmlImage.SelectSingleNode("src").InnerText, //ImportUrl(ModuleID, xmlImage.SelectSingleNode("src").InnerText)
                    Alt         = xmlImage.SelectSingleNode("alt").InnerText,
                    Width       = int.Parse(xmlImage.SelectSingleNode("width").InnerText),
                    Height      = int.Parse(xmlImage.SelectSingleNode("height").InnerText),
                    NavigateUrl = xmlImage.SelectSingleNode("navigateUrl").InnerText
                };

                // new/missing properties to assign in v03.03.00

                if (xmlImage.SelectSingleNode("AutoStart") != null)
                {
                    System.Boolean tempVar = false;
                    bool.TryParse(xmlImage.SelectSingleNode("AutoStart").InnerText, out tempVar);
                    objImage.AutoStart = tempVar;
                }
                if (xmlImage.SelectSingleNode("MediaAlignment") != null)
                {
                    System.Int32 tempVar2 = 0;
                    int.TryParse(xmlImage.SelectSingleNode("MediaAlignment").InnerText, out tempVar2);
                    objImage.MediaAlignment = tempVar2;
                }
                if (xmlImage.SelectSingleNode("MediaLoop") != null)
                {
                    System.Boolean tempVar3 = false;
                    bool.TryParse(xmlImage.SelectSingleNode("MediaLoop").InnerText, out tempVar3);
                    objImage.MediaLoop = tempVar3;
                }

                // new/missing properties to assign in v04.00.00

                if (xmlImage.SelectSingleNode("NewWindow") != null)
                {
                    System.Boolean tempVar4 = false;
                    bool.TryParse(xmlImage.SelectSingleNode("NewWindow").InnerText, out tempVar4);
                    objImage.NewWindow = tempVar4;
                }
                if (xmlImage.SelectSingleNode("TrackClicks") != null)
                {
                    System.Boolean tempVar5 = false;
                    bool.TryParse(xmlImage.SelectSingleNode("TrackClicks").InnerText, out tempVar5);
                    objImage.TrackClicks = tempVar5;
                }
                if (xmlImage.SelectSingleNode("MediaType") != null)
                {
                    System.Int32 tempVar6 = 0;
                    int.TryParse(xmlImage.SelectSingleNode("MediaType").InnerText, out tempVar6);
                    objImage.MediaType = tempVar6;
                }

                // new/missing properties to assign in v04.01.00

                if (xmlImage.SelectSingleNode("MediaMessage") != null)
                {
                    objImage.MediaMessage = xmlImage.SelectSingleNode("MediaMessage").InnerText;
                }

                var currentUser = UserController.GetCurrentUserInfo();

                if (currentUser != null && currentUser.UserID > 0)
                {
                    objImage.LastUpdatedBy = currentUser.UserID;
                }
                else
                {
                    var portalSettings = PortalController.GetCurrentPortalSettings();

                    if (portalSettings != null)
                    {
                        objImage.LastUpdatedBy = portalSettings.AdministratorId;
                    }
                }

                objImage.LastUpdatedDate = DateTime.Now;

                AddMedia(objImage);

                // calling this method to clear the module cache, and ensure all is wired up from the DAL for the next page load
                ModuleController.SynchronizeModule(ModuleID);
            }
            catch (Exception ex)
            {
                Exceptions.LogException(ex);
                throw ex;
            }
        }
Ejemplo n.º 19
0
        private void BindData()
        {
            LocalizeModule();

            // Obtain a single row of text information
            MediaController objMediaController = new MediaController();
            MediaInfo       objMedia           = objMediaController.GetMedia(ModuleId);

            BindControls();

            if (objMedia != null && objMedia.ModuleID > Null.NullInteger)
            {
                p_isNew = false;
                ddlImageAlignment.SelectedValue = objMedia.MediaAlignment.ToString();
                ToggleFileTypeView(objMedia.MediaType);
                switch (objMedia.MediaType)
                {
                case 0:     // local file system
                    ctlURL.Url = objMedia.Src;
                    break;

                case 1:     // embed code
                    txtEmbed.Text = HttpUtility.HtmlDecode(objMedia.Src);
                    break;

                case 2:     // embedable url
                    txtOEmbed.Text = objMedia.Src;
                    break;
                }
                txtAlt.Text = objMedia.Alt;
                if (objMedia.Width != Null.NullInteger)
                {
                    txtWidth.Text = objMedia.Width.ToString();
                }
                if (objMedia.Height != Null.NullInteger)
                {
                    txtHeight.Text = objMedia.Height.ToString();
                }
                ctlNavigateUrl.Url   = objMedia.NavigateUrl;
                ctlTracking.URL      = objMedia.NavigateUrl;
                ctlTracking.ModuleID = ModuleId;
                chkAutoStart.Checked = objMedia.AutoStart;
                chkLoop.Checked      = objMedia.MediaLoop;

                txtMessage.Text = objMedia.MediaMessage;
            }
            else
            {
                p_isNew = true;
            }

            // populate the setting controls
            BindSettings();

            // populate the support file types in the UI
            BindSupportedFileTypes();

            ToggleSettingViews();

            // only show the side-wide settings when Admnistrators are logged in
            liSideWideJournalSetting.Visible = UserInfo.IsInRole(PortalSettings.AdministratorRoleName);
            liNotifyOnUpdate.Visible         = liSideWideJournalSetting.Visible;
        }