public string GetPreviewImageSrc(string adType) { var type = EAdvertisementTypeUtils.GetEnumType(adType); var imageUrl = ImageUrl.Text; if (type == EAdvertisementType.ScreenDown) { imageUrl = ScreenDownImageUrl.Text; } if (!string.IsNullOrEmpty(imageUrl)) { var extension = PathUtils.GetExtension(imageUrl); if (EFileSystemTypeUtils.IsImage(extension)) { return(PageUtility.ParseNavigationUrl(PublishmentSystemInfo, imageUrl)); } else if (EFileSystemTypeUtils.IsFlash(extension)) { return(SiteServerAssets.GetIconUrl("flash.jpg")); } else if (EFileSystemTypeUtils.IsPlayer(extension)) { return(SiteServerAssets.GetIconUrl("player.gif")); } } return(SiteServerAssets.GetIconUrl("empty.gif")); }
public string GetPreviewImageSrc(string adType) { var imageUrl = ChildMenuIcon.Text; if (!string.IsNullOrEmpty(imageUrl)) { var extension = PathUtils.GetExtension(imageUrl); if (EFileSystemTypeUtils.IsImage(extension)) { return(PageUtility.ParseNavigationUrl(PublishmentSystemInfo, imageUrl)); } else if (EFileSystemTypeUtils.IsFlash(extension)) { return(SiteServerAssets.GetIconUrl("flash.jpg")); } else if (EFileSystemTypeUtils.IsPlayer(extension)) { return(SiteServerAssets.GetIconUrl("player.gif")); } } return(SiteServerAssets.GetIconUrl("empty.gif")); }
private static string ParseImpl(string stlElement, XmlNode node, PageInfo pageInfo, ContextInfo contextInfo, HtmlImage stlImage, bool isGetPicUrlFromAttribute, string channelIndex, string channelName, int no, int upLevel, int topLevel, string type, bool isOriginal, string src, string altSrc) { var parsedContent = string.Empty; var contentID = 0; //判断是否图片地址由标签属性获得 if (!isGetPicUrlFromAttribute) { contentID = contextInfo.ContentID; } var contextType = contextInfo.ContextType; var picUrl = string.Empty; if (!string.IsNullOrEmpty(src)) { picUrl = src; } else { if (contextType == EContextType.Undefined) { if (contentID != 0) { contextType = EContextType.Content; } else { contextType = EContextType.Channel; } } if (contextType == EContextType.Content)//获取内容图片 { var contentInfo = contextInfo.ContentInfo; if (isOriginal) { if (contentInfo != null && contentInfo.ReferenceId > 0 && contentInfo.SourceId > 0) { var targetNodeID = contentInfo.SourceId; var targetPublishmentSystemID = DataProvider.NodeDao.GetPublishmentSystemId(targetNodeID); var targetPublishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(targetPublishmentSystemID); var targetNodeInfo = NodeManager.GetNodeInfo(targetPublishmentSystemID, targetNodeID); var tableStyle = NodeManager.GetTableStyle(targetPublishmentSystemInfo, targetNodeInfo); var tableName = NodeManager.GetTableName(targetPublishmentSystemInfo, targetNodeInfo); var targetContentInfo = DataProvider.ContentDao.GetContentInfo(tableStyle, tableName, contentInfo.ReferenceId); if (targetContentInfo != null || targetContentInfo.NodeId > 0) { contentInfo = targetContentInfo; } } } if (contentInfo == null) { contentInfo = DataProvider.ContentDao.GetContentInfo(ETableStyle.BackgroundContent, pageInfo.PublishmentSystemInfo.AuxiliaryTableForContent, contentID); } if (contentInfo != null) { if (no <= 1) { picUrl = contentInfo.GetExtendedAttribute(type); } else { var extendAttributeName = ContentAttribute.GetExtendAttributeName(type); var extendValues = contentInfo.GetExtendedAttribute(extendAttributeName); if (!string.IsNullOrEmpty(extendValues)) { var index = 2; foreach (string extendValue in TranslateUtils.StringCollectionToStringList(extendValues)) { if (index == no) { picUrl = extendValue; break; } index++; } } } } } else if (contextType == EContextType.Channel)//获取栏目图片 { var channelID = StlDataUtility.GetNodeIdByLevel(pageInfo.PublishmentSystemId, contextInfo.ChannelID, upLevel, topLevel); channelID = StlCacheManager.NodeId.GetNodeIdByChannelIdOrChannelIndexOrChannelName(pageInfo.PublishmentSystemId, channelID, channelIndex, channelName); var channel = NodeManager.GetNodeInfo(pageInfo.PublishmentSystemId, channelID); picUrl = channel.ImageUrl; } else if (contextType == EContextType.Each) { picUrl = contextInfo.ItemContainer.EachItem.DataItem as string; } } if (string.IsNullOrEmpty(picUrl)) { picUrl = altSrc; } if (!string.IsNullOrEmpty(picUrl)) { var extension = PathUtils.GetExtension(picUrl); if (EFileSystemTypeUtils.IsFlash(extension)) { parsedContent = StlFlash.Parse(stlElement, node, pageInfo, contextInfo); } else if (EFileSystemTypeUtils.IsPlayer(extension)) { parsedContent = StlPlayer.Parse(stlElement, node, pageInfo, contextInfo); } else { stlImage.Src = PageUtility.ParseNavigationUrl(pageInfo.PublishmentSystemInfo, picUrl); parsedContent = ControlUtils.GetControlRenderHtml(stlImage); } } return(parsedContent); }
private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, bool isGetPicUrlFromAttribute, string channelIndex, string channelName, int upLevel, int topLevel, string playUrl, string imageUrl, string playBy, int width, int height, string type, bool isAutoPlay) { var parsedContent = string.Empty; var contentId = 0; //判断是否图片地址由标签属性获得 if (!isGetPicUrlFromAttribute) { contentId = contextInfo.ContentId; } if (string.IsNullOrEmpty(playUrl)) { if (contentId != 0)//获取内容视频 { if (contextInfo.ContentInfo == null) { //playUrl = DataProvider.ContentDao.GetValue(pageInfo.SiteInfo.AuxiliaryTableForContent, contentId, type); playUrl = Content.GetValue(pageInfo.SiteInfo.TableName, contentId, type); if (string.IsNullOrEmpty(playUrl)) { if (!StringUtils.EqualsIgnoreCase(type, BackgroundContentAttribute.VideoUrl)) { //playUrl = DataProvider.ContentDao.GetValue(pageInfo.SiteInfo.AuxiliaryTableForContent, contentId, BackgroundContentAttribute.VideoUrl); playUrl = Content.GetValue(pageInfo.SiteInfo.TableName, contentId, BackgroundContentAttribute.VideoUrl); } } if (string.IsNullOrEmpty(playUrl)) { if (!StringUtils.EqualsIgnoreCase(type, BackgroundContentAttribute.FileUrl)) { //playUrl = DataProvider.ContentDao.GetValue(pageInfo.SiteInfo.AuxiliaryTableForContent, contentId, BackgroundContentAttribute.FileUrl); playUrl = Content.GetValue(pageInfo.SiteInfo.TableName, contentId, BackgroundContentAttribute.FileUrl); } } } else { playUrl = contextInfo.ContentInfo.GetString(type); if (string.IsNullOrEmpty(playUrl)) { playUrl = contextInfo.ContentInfo.GetString(BackgroundContentAttribute.VideoUrl); } if (string.IsNullOrEmpty(playUrl)) { playUrl = contextInfo.ContentInfo.GetString(BackgroundContentAttribute.FileUrl); } } } } if (string.IsNullOrEmpty(imageUrl)) { if (contentId != 0) { //imageUrl = contextInfo.ContentInfo == null ? DataProvider.ContentDao.GetValue(pageInfo.SiteInfo.AuxiliaryTableForContent, contentId, BackgroundContentAttribute.ImageUrl) : contextInfo.ContentInfo.GetString(BackgroundContentAttribute.ImageUrl); imageUrl = contextInfo.ContentInfo == null?Content.GetValue(pageInfo.SiteInfo.TableName, contentId, BackgroundContentAttribute.ImageUrl) : contextInfo.ContentInfo.GetString(BackgroundContentAttribute.ImageUrl); } } if (string.IsNullOrEmpty(imageUrl)) { var channelId = StlDataUtility.GetChannelIdByLevel(pageInfo.SiteId, contextInfo.ChannelId, upLevel, topLevel); channelId = StlDataUtility.GetChannelIdByChannelIdOrChannelIndexOrChannelName(pageInfo.SiteId, channelId, channelIndex, channelName); var channel = ChannelManager.GetChannelInfo(pageInfo.SiteId, channelId); imageUrl = channel.ImageUrl; } if (!string.IsNullOrEmpty(playUrl)) { var extension = PathUtils.GetExtension(playUrl); if (EFileSystemTypeUtils.IsFlash(extension)) { parsedContent = StlFlash.Parse(pageInfo, contextInfo); } else if (EFileSystemTypeUtils.IsImage(extension)) { parsedContent = StlImage.Parse(pageInfo, contextInfo); } else { var uniqueId = pageInfo.UniqueId; playUrl = PageUtility.ParseNavigationUrl(pageInfo.SiteInfo, playUrl, pageInfo.IsLocal); imageUrl = PageUtility.ParseNavigationUrl(pageInfo.SiteInfo, imageUrl, pageInfo.IsLocal); var fileType = EFileSystemTypeUtils.GetEnumType(extension); if (fileType == EFileSystemType.Avi) { parsedContent = $@" <object id=""palyer_{uniqueId}"" width=""{width}"" height=""{height}"" border=""0"" classid=""clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA""> <param name=""ShowDisplay"" value=""0""> <param name=""ShowControls"" value=""1""> <param name=""AutoStart"" value=""{(isAutoPlay ? "1" : "0")}""> <param name=""AutoRewind"" value=""0""> <param name=""PlayCount"" value=""0""> <param name=""Appearance"" value=""0""> <param name=""BorderStyle"" value=""0""> <param name=""MovieWindowHeight"" value=""240""> <param name=""MovieWindowWidth"" value=""320""> <param name=""FileName"" value=""{playUrl}""> <embed width=""{width}"" height=""{height}"" border=""0"" showdisplay=""0"" showcontrols=""1"" autostart=""{(isAutoPlay ? "1" : "0")}"" autorewind=""0"" playcount=""0"" moviewindowheight=""240"" moviewindowwidth=""320"" filename=""{playUrl}"" src=""{playUrl}""> </embed> </object> "; } else if (fileType == EFileSystemType.Mpg) { parsedContent = $@" <object classid=""clsid:05589FA1-C356-11CE-BF01-00AA0055595A"" id=""palyer_{uniqueId}"" width=""{width}"" height=""{height}""> <param name=""Appearance"" value=""0""> <param name=""AutoStart"" value=""{(isAutoPlay ? "true" : "false")}""> <param name=""AllowChangeDisplayMode"" value=""-1""> <param name=""AllowHideDisplay"" value=""0""> <param name=""AllowHideControls"" value=""-1""> <param name=""AutoRewind"" value=""-1""> <param name=""Balance"" value=""0""> <param name=""CurrentPosition"" value=""0""> <param name=""DisplayBackColor"" value=""0""> <param name=""DisplayForeColor"" value=""16777215""> <param name=""DisplayMode"" value=""0""> <param name=""Enabled"" value=""-1""> <param name=""EnableContextMenu"" value=""-1""> <param name=""EnablePositionControls"" value=""-1""> <param name=""EnableSelectionControls"" value=""0""> <param name=""EnableTracker"" value=""-1""> <param name=""Filename"" value=""{playUrl}"" valuetype=""ref""> <param name=""FullScreenMode"" value=""0""> <param name=""MovieWindowSize"" value=""0""> <param name=""PlayCount"" value=""1""> <param name=""Rate"" value=""1""> <param name=""SelectionStart"" value=""-1""> <param name=""SelectionEnd"" value=""-1""> <param name=""ShowControls"" value=""-1""> <param name=""ShowDisplay"" value=""-1""> <param name=""ShowPositionControls"" value=""0""> <param name=""ShowTracker"" value=""-1""> <param name=""Volume"" value=""-480""> </object> "; } else if (fileType == EFileSystemType.Mpg) { parsedContent = $@" <OBJECT id=""palyer_{uniqueId}"" classid=""clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA"" width=""{width}"" height=""{height}""> <param name=""_ExtentX"" value=""6350""> <param name=""_ExtentY"" value=""4763""> <param name=""AUTOSTART"" value=""{(isAutoPlay ? "true" : "false")}""> <param name=""SHUFFLE"" value=""0""> <param name=""PREFETCH"" value=""0""> <param name=""NOLABELS"" value=""-1""> <param name=""SRC"" value=""{playUrl}""> <param name=""CONTROLS"" value=""ImageWindow""> <param name=""CONSOLE"" value=""console1""> <param name=""LOOP"" value=""0""> <param name=""NUMLOOP"" value=""0""> <param name=""CENTER"" value=""0""> <param name=""MAINTAINASPECT"" value=""0""> <param name=""BACKGROUNDCOLOR"" value=""#000000""> <embed src=""{playUrl}"" type=""audio/x-pn-realaudio-plugin"" console=""Console1"" controls=""ImageWindow"" width=""{width}"" height=""{height}"" autostart=""{(isAutoPlay ? "true" : "false")}""></OBJECT> "; } else if (fileType == EFileSystemType.Rm) { parsedContent = $@" <OBJECT id=""palyer_{uniqueId}"" CLASSID=""clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA"" WIDTH=""{width}"" HEIGHT=""{height}""> <param name=""_ExtentX"" value=""9313""> <param name=""_ExtentY"" value=""7620""> <param name=""AUTOSTART"" value=""{(isAutoPlay ? "true" : "false")}""> <param name=""SHUFFLE"" value=""0""> <param name=""PREFETCH"" value=""0""> <param name=""NOLABELS"" value=""0""> <param name=""SRC"" value=""{playUrl}""> <param name=""CONTROLS"" value=""ImageWindow""> <param name=""CONSOLE"" value=""Clip1""> <param name=""LOOP"" value=""0""> <param name=""NUMLOOP"" value=""0""> <param name=""CENTER"" value=""0""> <param name=""MAINTAINASPECT"" value=""0""> <param name=""BACKGROUNDCOLOR"" value=""#000000""> <embed SRC type=""audio/x-pn-realaudio-plugin"" CONSOLE=""Clip1"" CONTROLS=""ImageWindow"" WIDTH=""{width}"" HEIGHT=""{height}"" AUTOSTART=""{(isAutoPlay ? "true" : "false")}""> </OBJECT> "; } else if (fileType == EFileSystemType.Wmv) { parsedContent = $@" <object id=""palyer_{uniqueId}"" WIDTH=""{width}"" HEIGHT=""{height}"" classid=""CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"" codebase=""http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715"" standby=""Loading Microsoft Windows Media Player components..."" type=""application/x-oleobject"" align=""right"" hspace=""5""> <param name=""AutoRewind"" value=""1""> <param name=""ShowControls"" value=""1""> <param name=""ShowPositionControls"" value=""0""> <param name=""ShowAudioControls"" value=""1""> <param name=""ShowTracker"" value=""0""> <param name=""ShowDisplay"" value=""0""> <param name=""ShowStatusBar"" value=""0""> <param name=""ShowGotoBar"" value=""0""> <param name=""ShowCaptioning"" value=""0""> <param name=""AutoStart"" value=""{(isAutoPlay ? "1" : "0")}""> <param name=""FileName"" value=""{playUrl}""> <param name=""Volume"" value=""-2500""> <param name=""AnimationAtStart"" value=""0""> <param name=""TransparentAtStart"" value=""0""> <param name=""AllowChangeDisplaySize"" value=""0""> <param name=""AllowScan"" value=""0""> <param name=""EnableContextMenu"" value=""0""> <param name=""ClickToPlay"" value=""0""> </object> "; } else if (fileType == EFileSystemType.Wma) { parsedContent = $@" <object classid=""clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95"" id=""palyer_{uniqueId}""> <param name=""Filename"" value=""{playUrl}""> <param name=""PlayCount"" value=""1""> <param name=""AutoStart"" value=""{(isAutoPlay ? "1" : "0")}""> <param name=""ClickToPlay"" value=""1""> <param name=""DisplaySize"" value=""0""> <param name=""EnableFullScreen Controls"" value=""1""> <param name=""ShowAudio Controls"" value=""1""> <param name=""EnableContext Menu"" value=""1""> <param name=""ShowDisplay"" value=""1""> </object> "; } else if (fileType == EFileSystemType.Rm || fileType == EFileSystemType.Rmb || fileType == EFileSystemType.Rmvb) { if (!contextInfo.Attributes.ContainsKey("ShowDisplay")) { contextInfo.Attributes["ShowDisplay"] = "0"; } if (!contextInfo.Attributes.ContainsKey("ShowControls")) { contextInfo.Attributes["ShowControls"] = "1"; } contextInfo.Attributes["AutoStart"] = isAutoPlay ? "1" : "0"; if (!contextInfo.Attributes.ContainsKey("AutoRewind")) { contextInfo.Attributes["AutoRewind"] = "0"; } if (!contextInfo.Attributes.ContainsKey("PlayCount")) { contextInfo.Attributes["PlayCount"] = "0"; } if (!contextInfo.Attributes.ContainsKey("Appearance")) { contextInfo.Attributes["Appearance"] = "0"; } if (!contextInfo.Attributes.ContainsKey("BorderStyle")) { contextInfo.Attributes["BorderStyle"] = "0"; } if (!contextInfo.Attributes.ContainsKey("Controls")) { contextInfo.Attributes["ImageWindow"] = "0"; } contextInfo.Attributes["moviewindowheight"] = height.ToString(); contextInfo.Attributes["moviewindowwidth"] = width.ToString(); contextInfo.Attributes["filename"] = playUrl; contextInfo.Attributes["src"] = playUrl; var paramBuilder = new StringBuilder(); var embedBuilder = new StringBuilder(); foreach (string key in contextInfo.Attributes.Keys) { paramBuilder.Append($@"<param name=""{key}"" value=""{contextInfo.Attributes[key]}"">").Append(StringUtils.Constants.ReturnAndNewline); embedBuilder.Append($@" {key}=""{contextInfo.Attributes[key]}"""); } parsedContent = $@" <object id=""video_{uniqueId}"" width=""{width}"" height=""{height}"" border=""0"" classid=""clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA""> {paramBuilder} <embed{embedBuilder}> </embed> </object> "; } else { if (StringUtils.EqualsIgnoreCase(playBy, PlayByJwPlayer)) { pageInfo.AddPageBodyCodeIfNotExists(PageInfo.Const.JsAcJwPlayer6); var ajaxElementId = StlParserUtility.GetAjaxDivId(pageInfo.UniqueId); parsedContent = $@" <div id='{ajaxElementId}'></div> <script type='text/javascript'> jwplayer('{ajaxElementId}').setup({{ autostart: {isAutoPlay.ToString().ToLower()}, file: ""{playUrl}"", width: ""{width}"", height: ""{height}"", image: ""{imageUrl}"" }}); </script> "; } else { var ajaxElementId = StlParserUtility.GetAjaxDivId(pageInfo.UniqueId); pageInfo.AddPageBodyCodeIfNotExists(PageInfo.Const.JsAcFlowPlayer); var swfUrl = SiteFilesAssets.GetUrl(pageInfo.ApiUrl, SiteFilesAssets.FlowPlayer.Swf); parsedContent = $@" <a href=""{playUrl}"" style=""display:block;width:{width}px;height:{height}px;"" id=""player_{ajaxElementId}""></a> <script language=""javascript""> flowplayer(""player_{ajaxElementId}"", ""{swfUrl}"", {{ clip: {{ autoPlay: {isAutoPlay.ToString().ToLower()} }} }}); </script> "; } } } } return(parsedContent); }
public string GetScript() { var builder = new StringBuilder(); builder.Append($@"<div id=""ad_{uniqueID}"">"); if (EFileSystemTypeUtils.IsFlash(PathUtils.GetExtension(adFloatImageInfo.ImageUrl))) { var height = (adFloatImageInfo.Height > 0) ? adFloatImageInfo.Height.ToString() : "100"; var width = (adFloatImageInfo.Width > 0) ? adFloatImageInfo.Width.ToString() : "100"; var value = PageUtility.ParseNavigationUrl(publishmentSystemInfo, adFloatImageInfo.ImageUrl); builder.Append( $@"<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='{width}' height='{height}'><param name='movie' value='{value}' /><param name='wmode' value='window' /><param name='scale' value='exactfit' /><param name='quality' value='high' /><embed src='{value}' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='{width}' height='{height}'></embed></object>{floatDivIsCloseableHtml}</div>"); } else { var floatDivSize = (adFloatImageInfo.Height > 0) ? $" HEIGHT={adFloatImageInfo.Height}" : ""; floatDivSize += (adFloatImageInfo.Width > 0) ? $" WIDTH={adFloatImageInfo.Width} " : ""; if (string.IsNullOrEmpty(adFloatImageInfo.NavigationUrl)) { builder.Append( $@"<img src=""{PageUtility.ParseNavigationUrl(publishmentSystemInfo, adFloatImageInfo.ImageUrl)}"" {floatDivSize} border=""0""></a>{floatDivIsCloseableHtml}"); } else { builder.Append( $@"<a href=""{PageUtils.AddProtocolToUrl(PageUtility.ParseNavigationUrl(publishmentSystemInfo, adFloatImageInfo.NavigationUrl))}"" target = ""_blank""><img src=""{PageUtility .ParseNavigationUrl(publishmentSystemInfo, adFloatImageInfo.ImageUrl)}"" {floatDivSize} border=""0""></a>{floatDivIsCloseableHtml}"); } } builder.Append("</div>"); var type = 1; if (adFloatImageInfo.RollingType == ERollingType.FloatingInWindow) { type = 1; } else if (adFloatImageInfo.RollingType == ERollingType.FollowingScreen) { type = 2; } else if (adFloatImageInfo.RollingType == ERollingType.Static) { type = 3; } var positionX = string.Empty; var positionY = string.Empty; if (adFloatImageInfo.PositionType == EPositionType.LeftTop) { positionX = adFloatImageInfo.PositionX.ToString(); positionY = adFloatImageInfo.PositionY.ToString(); } else if (adFloatImageInfo.PositionType == EPositionType.LeftBottom) { positionX = adFloatImageInfo.PositionX.ToString(); positionY = $@"document.body.scrollTop+document.body.offsetHeight-{adFloatImageInfo.PositionY}-{adFloatImageInfo .Height}"; } else if (adFloatImageInfo.PositionType == EPositionType.RightTop) { positionX = $@"document.body.scrollLeft+document.body.offsetWidth-{adFloatImageInfo.PositionX}-{adFloatImageInfo .Width}"; positionY = adFloatImageInfo.PositionY.ToString(); } else if (adFloatImageInfo.PositionType == EPositionType.RightBottom) { positionX = $@"document.body.scrollLeft+document.body.offsetWidth-{adFloatImageInfo.PositionX}-{adFloatImageInfo .Width}"; positionY = $@"document.body.scrollTop+document.body.offsetHeight-{adFloatImageInfo.PositionY}-{adFloatImageInfo .Height}"; } var dateLimited = string.Empty; if (adInfo.IsDateLimited) { dateLimited = $@" var sDate{uniqueID} = new Date({adInfo.StartDate.Year}, {adInfo.StartDate.Month - 1}, {adInfo.StartDate.Day}, {adInfo .StartDate.Hour}, {adInfo.StartDate.Minute}); var eDate{uniqueID} = new Date({adInfo.EndDate.Year}, {adInfo.EndDate.Month - 1}, {adInfo.EndDate.Day}, {adInfo .EndDate.Hour}, {adInfo.EndDate.Minute}); ad{uniqueID}.SetDate(sDate{uniqueID}, eDate{uniqueID}); "; } builder.Append($@" <script type=""text/javascript""> <!-- var ad{uniqueID}=new Ad_Move(""ad_{uniqueID}""); ad{uniqueID}.SetLocation({positionX}, {positionY}); ad{uniqueID}.SetType({type});{dateLimited} ad{uniqueID}.Run(); //--> </script> "); return(builder.ToString()); }
private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, string playUrl, string imageUrl, string playBy, int width, int height, string type, bool isAutoPlay) { if (string.IsNullOrEmpty(playUrl)) { var contentId = contextInfo.ContentId; if (contentId != 0)//获取内容视频 { if (contextInfo.ContentInfo == null) { playUrl = StlContentCache.GetValue(pageInfo.SiteInfo.TableName, contentId, type); if (string.IsNullOrEmpty(playUrl)) { if (!StringUtils.EqualsIgnoreCase(type, BackgroundContentAttribute.VideoUrl)) { playUrl = StlContentCache.GetValue(pageInfo.SiteInfo.TableName, contentId, BackgroundContentAttribute.VideoUrl); } } } else { playUrl = contextInfo.ContentInfo.GetString(type); if (string.IsNullOrEmpty(playUrl)) { playUrl = contextInfo.ContentInfo.GetString(BackgroundContentAttribute.VideoUrl); } } } } if (string.IsNullOrEmpty(playUrl)) { return(string.Empty); } playUrl = PageUtility.ParseNavigationUrl(pageInfo.SiteInfo, playUrl, pageInfo.IsLocal); imageUrl = PageUtility.ParseNavigationUrl(pageInfo.SiteInfo, imageUrl, pageInfo.IsLocal); var extension = PathUtils.GetExtension(playUrl); var uniqueId = pageInfo.UniqueId; var fileType = EFileSystemTypeUtils.GetEnumType(extension); if (EFileSystemTypeUtils.IsFlash(extension)) { return(StlFlash.Parse(pageInfo, contextInfo)); } if (EFileSystemTypeUtils.IsImage(extension)) { return(StlImage.Parse(pageInfo, contextInfo)); } if (fileType == EFileSystemType.Avi) { return(ParseAvi(uniqueId, width, height, isAutoPlay, playUrl)); } if (fileType == EFileSystemType.Mpg) { return(ParseMpg(uniqueId, width, height, isAutoPlay, playUrl)); } if (fileType == EFileSystemType.Rm || fileType == EFileSystemType.Rmb || fileType == EFileSystemType.Rmvb) { return(ParseRm(contextInfo, uniqueId, width, height, isAutoPlay, playUrl)); } if (fileType == EFileSystemType.Wmv) { return(ParseWmv(uniqueId, width, height, isAutoPlay, playUrl)); } if (fileType == EFileSystemType.Wma) { return(ParseWma(uniqueId, isAutoPlay, playUrl)); } if (StringUtils.EqualsIgnoreCase(playBy, PlayByJwPlayer)) { pageInfo.AddPageBodyCodeIfNotExists(PageInfo.Const.JsAcJwPlayer6); var ajaxElementId = StlParserUtility.GetAjaxDivId(pageInfo.UniqueId); return($@" <div id='{ajaxElementId}'></div> <script type='text/javascript'> jwplayer('{ajaxElementId}').setup({{ autostart: {isAutoPlay.ToString().ToLower()}, file: ""{playUrl}"", width: ""{width}"", height: ""{height}"", image: ""{imageUrl}"" }}); </script> "); } if (StringUtils.EqualsIgnoreCase(playBy, PlayByFlowPlayer)) { var ajaxElementId = StlParserUtility.GetAjaxDivId(pageInfo.UniqueId); pageInfo.AddPageBodyCodeIfNotExists(PageInfo.Const.JsAcFlowPlayer); var imageHtml = string.Empty; if (!string.IsNullOrEmpty(imageUrl)) { imageHtml = $@"<img src=""{imageUrl}"" style=""{(width > 0 ? $"width:{width}px;" : string.Empty)}{(height > 0 ? $"height:{height}px;" : string.Empty)}"" />"; } var swfUrl = SiteFilesAssets.GetUrl(pageInfo.ApiUrl, SiteFilesAssets.FlowPlayer.Swf); return($@" <a href=""{playUrl}"" style=""display:block;{(width > 0 ? $"width:{width}px;" : string.Empty)}{(height > 0 ? $"height:{height}px;" : string.Empty)}"" id=""player_{ajaxElementId}"">{imageHtml}</a> <script language=""javascript""> flowplayer(""player_{ajaxElementId}"", ""{swfUrl}"", {{ clip: {{ autoPlay: {isAutoPlay.ToString().ToLower()} }} }}); </script> "); } return(StlVideo.Parse(pageInfo, contextInfo)); }
private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, HtmlImage stlImage, bool isGetPicUrlFromAttribute, string channelIndex, string channelName, int upLevel, int topLevel, string type, int no, bool isOriginal, string src, string altSrc) { var parsedContent = string.Empty; var contentId = 0; //判断是否图片地址由标签属性获得 if (!isGetPicUrlFromAttribute) { contentId = contextInfo.ContentId; } var contextType = contextInfo.ContextType; var picUrl = string.Empty; if (!string.IsNullOrEmpty(src)) { picUrl = src; } else { if (contextType == EContextType.Undefined) { contextType = contentId != 0 ? EContextType.Content : EContextType.Channel; } if (contextType == EContextType.Content)//获取内容图片 { var contentInfo = contextInfo.ContentInfo; if (isOriginal) { if (contentInfo != null && contentInfo.ReferenceId > 0 && contentInfo.SourceId > 0) { var targetChannelId = contentInfo.SourceId; //var targetSiteId = DataProvider.ChannelDao.GetSiteId(targetChannelId); var targetSiteId = StlChannelCache.GetSiteId(targetChannelId); var targetSiteInfo = SiteManager.GetSiteInfo(targetSiteId); var targetNodeInfo = ChannelManager.GetChannelInfo(targetSiteId, targetChannelId); //var targetContentInfo = DataProvider.ContentDao.GetContentInfo(tableStyle, tableName, contentInfo.ReferenceId); var targetContentInfo = ContentManager.GetContentInfo(targetSiteInfo, targetNodeInfo, contentInfo.ReferenceId); if (targetContentInfo != null && targetContentInfo.ChannelId > 0) { contentInfo = targetContentInfo; } } } if (contentInfo == null) { contentInfo = ContentManager.GetContentInfo(pageInfo.SiteInfo, contextInfo.ChannelId, contentId); } if (contentInfo != null) { if (no <= 1) { picUrl = contentInfo.GetString(type); } else { var extendAttributeName = ContentAttribute.GetExtendAttributeName(type); var extendValues = contentInfo.GetString(extendAttributeName); if (!string.IsNullOrEmpty(extendValues)) { var index = 2; foreach (var extendValue in TranslateUtils.StringCollectionToStringList(extendValues)) { if (index == no) { picUrl = extendValue; break; } index++; } } } } } else if (contextType == EContextType.Channel)//获取栏目图片 { var channelId = StlDataUtility.GetChannelIdByLevel(pageInfo.SiteId, contextInfo.ChannelId, upLevel, topLevel); channelId = StlDataUtility.GetChannelIdByChannelIdOrChannelIndexOrChannelName(pageInfo.SiteId, channelId, channelIndex, channelName); var channel = ChannelManager.GetChannelInfo(pageInfo.SiteId, channelId); picUrl = channel.ImageUrl; } else if (contextType == EContextType.Each) { picUrl = contextInfo.ItemContainer.EachItem.DataItem as string; } } if (string.IsNullOrEmpty(picUrl)) { picUrl = altSrc; } if (!string.IsNullOrEmpty(picUrl)) { var extension = PathUtils.GetExtension(picUrl); if (EFileSystemTypeUtils.IsFlash(extension)) { parsedContent = StlFlash.Parse(pageInfo, contextInfo); } else if (EFileSystemTypeUtils.IsPlayer(extension)) { parsedContent = StlPlayer.Parse(pageInfo, contextInfo); } else { stlImage.Src = PageUtility.ParseNavigationUrl(pageInfo.SiteInfo, picUrl, pageInfo.IsLocal); parsedContent = ControlUtils.GetControlRenderHtml(stlImage); } } return(parsedContent); }