Esempio n. 1
0
 public string GetFileInputTemplate()
 {
     return(FileUtils.ReadText(SiteFilesAssets.GetPath("govinteractquery/inputTemplate.html"), ECharset.utf_8));
 }
Esempio n. 2
0
        private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, string type, string formatString, string separator, int startIndex, int length, int wordNum, string ellipsis, string replace, string to, bool isClearTags, bool isReturnToBr, bool isLower, bool isUpper)
        {
            if (string.IsNullOrEmpty(type))
            {
                return(string.Empty);
            }

            var parsedContent = string.Empty;

            if (contextInfo.ContextType == EContextType.Each)
            {
                parsedContent = contextInfo.ItemContainer.EachItem.DataItem as string;
                return(parsedContent);
            }

            if (type.ToLower().Equals(TypeSiteName.ToLower()))
            {
                parsedContent = pageInfo.SiteInfo.SiteName;
            }
            else if (type.ToLower().Equals(TypeSiteUrl.ToLower()))
            {
                parsedContent = pageInfo.SiteInfo.Additional.WebUrl;
            }
            else if (type.ToLower().Equals(TypeDate.ToLower()))
            {
                pageInfo.AddPageScriptsIfNotExists("datestring.js",
                                                   $@"<script charset=""{SiteFilesAssets.DateString.Charset}"" src=""{SiteFilesAssets.GetUrl(
                        pageInfo.ApiUrl, SiteFilesAssets.DateString.Js)}"" type=""text/javascript""></script>");

                parsedContent = @"<script language=""javascript"" type=""text/javascript"">RunGLNL(false);</script>";
            }
            else if (type.ToLower().Equals(TypeDateOfTraditional.ToLower()))
            {
                pageInfo.AddPageScriptsIfNotExists("datestring",
                                                   $@"<script charset=""{SiteFilesAssets.DateString.Charset}"" src=""{SiteFilesAssets.GetUrl(
                        pageInfo.ApiUrl, SiteFilesAssets.DateString.Js)}"" type=""text/javascript""></script>");

                parsedContent = @"<script language=""javascript"" type=""text/javascript"">RunGLNL(true);</script>";
            }
            else
            {
                if (pageInfo.SiteInfo.Additional.GetString(type) != null)
                {
                    parsedContent = pageInfo.SiteInfo.Additional.GetString(type);
                    if (!string.IsNullOrEmpty(parsedContent))
                    {
                        var styleInfo = TableStyleManager.GetTableStyleInfo(DataProvider.SiteDao.TableName, type, RelatedIdentities.GetRelatedIdentities(pageInfo.SiteId, pageInfo.SiteId));

                        // 如果 styleInfo.TableStyleId <= 0,表示此字段已经被删除了,不需要再显示值了 ekun008
                        if (styleInfo.Id > 0)
                        {
                            if (isClearTags && InputTypeUtils.EqualsAny(styleInfo.InputType, InputType.Image, InputType.File))
                            {
                                parsedContent = PageUtility.ParseNavigationUrl(pageInfo.SiteInfo, parsedContent, pageInfo.IsLocal);
                            }
                            else
                            {
                                parsedContent = InputParserUtility.GetContentByTableStyle(parsedContent, separator, pageInfo.SiteInfo, styleInfo, formatString, contextInfo.Attributes, contextInfo.InnerXml, false);
                                parsedContent = StringUtils.ParseString(styleInfo.InputType, parsedContent, replace, to, startIndex, length, wordNum, ellipsis, isClearTags, isReturnToBr, isLower, isUpper, formatString);
                            }
                        }
                        else
                        { // 如果字段已经被删除或不再显示了,则此字段的值为空。有时虚拟字段值不会清空
                            parsedContent = string.Empty;
                        }
                    }
                }
            }
            return(parsedContent);
        }
Esempio n. 3
0
        public static string GetSlideAdvHtml(PublishmentSystemInfo publishmentSystemInfo, AdAreaInfo adAreaInfo, AdvInfo advInfo, ArrayList adMaterialInfoList)
        {
            var strHtml = new StringBuilder();

            strHtml.Append($@"<link href=""{SiteFilesAssets.GetUrl(publishmentSystemInfo.Additional.ApiUrl, "Styles/Css/slideAdv.css")}"" rel=""stylesheet"" />");
            strHtml.Append($@"<script src=""{SiteFilesAssets.GetUrl(publishmentSystemInfo.Additional.ApiUrl, "JQuery/jquery-1.4.3.min.js")}""></script>");
            strHtml.AppendFormat(@"
<script type=""text/javascript"">
    var t = n = 0, count;
    $(document).ready(function () {{
        count = $(""#banner_list a"").length;
        $(""#banner_list a:not(:first-child)"").hide();
        $(""#banner_info"").html($(""#banner_list a:first-child"").find(""img"").attr('alt'));
        $(""#banner_info"").click(function () {{
            window.open($(""#banner_list a:first-child"").attr('href'), ""_blank"")
        }});
        $(""#banner li"").click(function () {{
            var i = $(this).text() - 1; 
            n = i;
            if (i >= count) return;
            $(""#banner_info"").html($(""#banner_list a"").eq(i).find(""img"").attr('alt'));
            $(""#banner_info"").unbind().click(function () {{
                window.open($(""#banner_list a"").eq(i).attr('href'),
               ""_blank"")
            }})
            $(""#banner_list a"").filter("":visible"").fadeOut(500).parent().children().eq(i).fadeIn(1000);
            document.getElementById(""banner"").style.background = """";
            $(this).toggleClass(""on"");
            $(this).siblings().removeAttr(""class"");
        }});
        t = setInterval(""showAuto()"", {0}000);
        $(""#banner"").hover(function () {{ clearInterval(t) }}, function () {{
            t = setInterval(""showAuto()"", {0}000);
        }});
    }})
   function showAuto() {{
        n = n >= (count - 1) ? 0 : ++n;
        $(""#banner li"").eq(n).trigger('click');
    }}
</script>
", advInfo.RotateInterval);

            strHtml.AppendFormat(@"<div id=""banner"" style=""width:{0}px;height:{1}px;"">", adAreaInfo.Width, adAreaInfo.Height);
            strHtml.AppendFormat(@"<div id=""banner_bg""></div> <!--标题背景-->");
            strHtml.AppendFormat(@"<div id=""banner_info""></div><ul> <!--标题-->");
            if (adMaterialInfoList.Count == 1)
            {
                var info = adMaterialInfoList[0] as AdMaterialInfo;
                strHtml.AppendFormat(@"<li class=""on"">1</li></ul><div id=""banner_list"">");
                strHtml.AppendFormat(GetImageHtml(publishmentSystemInfo, info));
                strHtml.AppendFormat(@"</div></div>");
            }
            else if (adMaterialInfoList.Count > 1)
            {
                var index = 0;
                foreach (AdMaterialInfo info in adMaterialInfoList)
                {
                    index++;
                    if (index == 1)
                    {
                        strHtml.AppendFormat(@"<li class=""on"">1</li>");
                    }
                    else
                    {
                        if (index != adMaterialInfoList.Count)
                        {
                            strHtml.AppendFormat(@"<li>{0}</li>", index);
                        }
                        else
                        {
                            strHtml.AppendFormat(@"<li>{0}</li>", index);
                            strHtml.AppendFormat(@"</ul><div id=""banner_list"">");
                        }
                    }
                }
                foreach (AdMaterialInfo info in adMaterialInfoList)
                {
                    strHtml.AppendFormat(GetImageHtml(publishmentSystemInfo, info));
                }
                strHtml.AppendFormat(@"</div></div>");
            }

            return(strHtml.ToString());
        }
Esempio n. 4
0
 public static string GetMapUrl(PublishmentSystemInfo publishmentSystemInfo, string mapWD)
 {
     return(PageUtils.AddProtocolToUrl(SiteFilesAssets.GetUrl(publishmentSystemInfo.Additional.ApiUrl, "weixin/map/index.html?mapWD=" + System.Web.HttpUtility.UrlEncode(mapWD) + "")));
 }
Esempio n. 5
0
        private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, bool isGetPicUrlFromAttribute, string channelIndex, string channelName, int upLevel, int topLevel, string playUrl, string imageUrl, string playBy, string stretching, 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, PlayByFlowPlayer))
                        {
                            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>
";
                        }
                        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 additional = string.Empty;
                            if (!string.IsNullOrEmpty(stretching))
                            {
                                additional = "&stretching=" + stretching;
                            }
                            parsedContent = $@"
<embed src=""{SiteFilesAssets.GetUrl(pageInfo.ApiUrl, SiteFilesAssets.BrPlayer.Swf)}"" allowfullscreen=""true"" flashvars=""controlbar=over{additional}&autostart={isAutoPlay.ToString().ToLower()}&image={imageUrl}&file={playUrl}"" width=""{width}"" height=""{height}""/>
";
                        }
                    }
                }
            }

            return(parsedContent);
        }
Esempio n. 6
0
        public string GetTemplate(bool isLoadValues, string inputTemplateString, string successTemplateString, string failureTemplateString)
        {
            var builder = new StringBuilder();

            builder.Append(
                $@"<script type=""text/javascript"" charset=""{SiteFilesAssets.Validate.Charset}"" src=""{SiteFilesAssets
                    .GetUrl(_publishmentSystemInfo.Additional.ApiUrl, SiteFilesAssets.Validate.Js)}""></script>");

            if (string.IsNullOrEmpty(inputTemplateString))
            {
                builder.Append($@"<style type=""text/css"">{GetStyle(ETableStyle.InputContent)}</style>");
                builder.Append($@"<script type=""text/javascript"">{GetScript()}</script>");

                builder.Append(GetContent());
            }
            else
            {
                builder.Append($@"<style type=""text/css"">{GetStyle(ETableStyle.InputContent)}</style>");
                builder.Append($@"<script type=""text/javascript"">{GetScript()}</script>");
                builder.Append(inputTemplateString);
            }

            return(ReplacePlaceHolder(builder.ToString(), isLoadValues, successTemplateString, failureTemplateString));
        }
Esempio n. 7
0
        private static string ParseImpl(XmlNode node, PageInfo pageInfo, ContextInfo contextInfo, string channelIndex, string channelName, string groupChannel, string groupChannelNot, bool isShowChildren, string styleName, string menuWidth, string menuHeight, string xPosition, string yPosition, string childMenuDisplay, string childMenuWidth, string childMenuHeight, string target)
        {
            string parsedContent;

            var channelId = StlCacheManager.NodeId.GetNodeIdByChannelIdOrChannelIndexOrChannelName(pageInfo.PublishmentSystemId, contextInfo.ChannelId, channelIndex, channelName);
            var nodeInfo  = NodeManager.GetNodeInfo(pageInfo.PublishmentSystemId, channelId);

            var innerHtml = nodeInfo.NodeName.Trim();

            if (!string.IsNullOrEmpty(node.InnerXml))
            {
                var innerBuilder = new StringBuilder(node.InnerXml);
                StlParserManager.ParseInnerContent(innerBuilder, pageInfo, contextInfo);
                innerHtml = innerBuilder.ToString();
            }

            var nodeInfoArrayList = new ArrayList();//需要显示的栏目列表

            var childNodeIdList = DataProvider.NodeDao.GetNodeIdListByScopeType(nodeInfo, EScopeType.Children, groupChannel, groupChannelNot);

            if (childNodeIdList != null && childNodeIdList.Count > 0)
            {
                foreach (int childNodeId in childNodeIdList)
                {
                    var theNodeInfo = NodeManager.GetNodeInfo(pageInfo.PublishmentSystemId, childNodeId);
                    nodeInfoArrayList.Add(theNodeInfo);
                }
            }

            if (nodeInfoArrayList.Count == 0)
            {
                parsedContent = innerHtml;
            }
            else
            {
                var menuDisplayId         = DataProvider.MenuDisplayDao.GetMenuDisplayIdByName(pageInfo.PublishmentSystemId, styleName);
                var menuDisplayInfo       = menuDisplayId == 0 ? DataProvider.MenuDisplayDao.GetDefaultMenuDisplayInfo(pageInfo.PublishmentSystemId) : DataProvider.MenuDisplayDao.GetMenuDisplayInfo(menuDisplayId);
                var level2MenuDisplayInfo = menuDisplayInfo;
                if (isShowChildren && !string.IsNullOrEmpty(childMenuDisplay))
                {
                    var childMenuDisplayId = DataProvider.MenuDisplayDao.GetMenuDisplayIdByName(pageInfo.PublishmentSystemId, childMenuDisplay);
                    level2MenuDisplayInfo = childMenuDisplayId == 0 ? DataProvider.MenuDisplayDao.GetDefaultMenuDisplayInfo(pageInfo.PublishmentSystemId) : DataProvider.MenuDisplayDao.GetMenuDisplayInfo(childMenuDisplayId);
                }

                if (string.IsNullOrEmpty(menuWidth))
                {
                    menuWidth = menuDisplayInfo.MenuWidth.ToString();
                }
                if (string.IsNullOrEmpty(menuHeight))
                {
                    menuHeight = menuDisplayInfo.MenuItemHeight.ToString();
                }
                if (string.IsNullOrEmpty(xPosition))
                {
                    xPosition = menuDisplayInfo.XPosition;
                }
                if (string.IsNullOrEmpty(yPosition))
                {
                    yPosition = menuDisplayInfo.YPosition;
                }
                if (string.IsNullOrEmpty(childMenuWidth))
                {
                    childMenuWidth = level2MenuDisplayInfo.MenuWidth.ToString();
                }
                if (string.IsNullOrEmpty(childMenuHeight))
                {
                    childMenuHeight = level2MenuDisplayInfo.MenuItemHeight.ToString();
                }

                var createMenuString = string.Empty;

                var menuId = pageInfo.UniqueId;

                parsedContent =
                    $@"<span name=""mm_link_{menuId}"" id=""mm_link_{menuId}"" onmouseover=""MM_showMenu(window.mm_menu_{menuId},{xPosition},{yPosition},null,'mm_link_{menuId}');"" onmouseout=""MM_startTimeout();"">{innerHtml}</span>";

                var menuBuilder       = new StringBuilder();
                var level2MenuBuilder = new StringBuilder();


                foreach (NodeInfo theNodeInfo in nodeInfoArrayList)
                {
                    var isLevel2Exist = false;
                    var level2MenuId  = 0;

                    if (isShowChildren)
                    {
                        var level2NodeInfoArrayList = new ArrayList();

                        var level2NodeIdList = DataProvider.NodeDao.GetNodeIdListByScopeType(theNodeInfo, EScopeType.Children, groupChannel, groupChannelNot);
                        if (level2NodeIdList != null && level2NodeIdList.Count > 0)
                        {
                            foreach (int level2NodeId in level2NodeIdList)
                            {
                                var level2NodeInfo = NodeManager.GetNodeInfo(pageInfo.PublishmentSystemId, level2NodeId);
                                level2NodeInfoArrayList.Add(level2NodeInfo);
                            }

                            if (level2NodeInfoArrayList.Count > 0)
                            {
                                isLevel2Exist = true;
                                var level2ChildMenuBuilder = new StringBuilder();
                                level2MenuId = pageInfo.UniqueId;

                                foreach (NodeInfo level2NodeInfo in level2NodeInfoArrayList)
                                {
                                    var level2NodeUrl = PageUtility.GetChannelUrl(pageInfo.PublishmentSystemInfo, level2NodeInfo);
                                    if (PageUtils.UnclickedUrl.Equals(level2NodeUrl))
                                    {
                                        level2ChildMenuBuilder.Append(
                                            $@"  mm_menu_{level2MenuId}.addMenuItem(""{level2NodeInfo.NodeName.Trim()}"", ""location='{level2NodeUrl}'"");");
                                    }
                                    else
                                    {
                                        if (!string.IsNullOrEmpty(target))
                                        {
                                            if (target.ToLower().Equals("_blank"))
                                            {
                                                level2ChildMenuBuilder.Append(
                                                    $@"  mm_menu_{level2MenuId}.addMenuItem(""{level2NodeInfo.NodeName
                                                        .Trim()}"", ""window.open('{level2NodeUrl}', '_blank');"");");
                                            }
                                            else
                                            {
                                                level2ChildMenuBuilder.Append(
                                                    $@"  mm_menu_{level2MenuId}.addMenuItem(""{level2NodeInfo.NodeName
                                                        .Trim()}"", ""location='{level2NodeUrl}', '{target}'"");");
                                            }
                                        }
                                        else
                                        {
                                            level2ChildMenuBuilder.Append(
                                                $@"  mm_menu_{level2MenuId}.addMenuItem(""{level2NodeInfo.NodeName.Trim()}"", ""location='{level2NodeUrl}'"");");
                                        }
                                    }
                                }

                                string level2CreateMenuString = $@"
  window.mm_menu_{level2MenuId} = new Menu('{theNodeInfo.NodeName.Trim()}',{childMenuWidth},{childMenuHeight},'{level2MenuDisplayInfo
                                    .FontFamily}',{level2MenuDisplayInfo.FontSize},'{level2MenuDisplayInfo.FontColor}','{level2MenuDisplayInfo
                                    .FontColorHilite}','{level2MenuDisplayInfo.MenuItemBgColor}','{level2MenuDisplayInfo
                                    .MenuHiliteBgColor}','{level2MenuDisplayInfo.MenuItemHAlign}','{level2MenuDisplayInfo
                                    .MenuItemVAlign}',{level2MenuDisplayInfo.MenuItemPadding},{level2MenuDisplayInfo
                                    .MenuItemSpacing},{level2MenuDisplayInfo.HideTimeout},-5,7,true,{level2MenuDisplayInfo
                                    .MenuBgOpaque},{level2MenuDisplayInfo.Vertical},{level2MenuDisplayInfo
                                    .MenuItemIndent},true,true);
  {level2ChildMenuBuilder}
  mm_menu_{level2MenuId}.fontWeight='{level2MenuDisplayInfo.FontWeight}';
  mm_menu_{level2MenuId}.fontStyle='{level2MenuDisplayInfo.FontStyle}';
  mm_menu_{level2MenuId}.hideOnMouseOut={level2MenuDisplayInfo.HideOnMouseOut};
  mm_menu_{level2MenuId}.bgColor='{level2MenuDisplayInfo.BgColor}';
  mm_menu_{level2MenuId}.menuBorder={level2MenuDisplayInfo.MenuBorder};
  mm_menu_{level2MenuId}.menuLiteBgColor='{level2MenuDisplayInfo.MenuLiteBgColor}';
  mm_menu_{level2MenuId}.menuBorderBgColor='{level2MenuDisplayInfo.MenuBorderBgColor}';
";
                                level2MenuBuilder.Append(level2CreateMenuString);
                            }
                        }
                    }

                    string menuName;
                    if (isLevel2Exist)
                    {
                        menuName = "mm_menu_" + level2MenuId;
                    }
                    else
                    {
                        menuName = "\"" + theNodeInfo.NodeName.Trim() + "\"";
                    }

                    var nodeUrl = PageUtility.GetChannelUrl(pageInfo.PublishmentSystemInfo, theNodeInfo);
                    if (PageUtils.UnclickedUrl.Equals(nodeUrl))
                    {
                        menuBuilder.Append($@"  mm_menu_{menuId}.addMenuItem({menuName}, ""location='{nodeUrl}'"");");
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(target))
                        {
                            menuBuilder.Append(
                                target.ToLower().Equals("_blank")
                                    ? $@"  mm_menu_{menuId}.addMenuItem({menuName}, ""window.open('{nodeUrl}', '_blank');"");"
                                    : $@"  mm_menu_{menuId}.addMenuItem({menuName}, ""location='{nodeUrl}', '{target}'"");");
                        }
                        else
                        {
                            menuBuilder.Append($@"  mm_menu_{menuId}.addMenuItem({menuName}, ""location='{nodeUrl}'"");");
                        }
                    }
                }

                var childMenuIcon = string.Empty;
                if (!string.IsNullOrEmpty(menuDisplayInfo.ChildMenuIcon))
                {
                    childMenuIcon = PageUtility.ParseNavigationUrl(pageInfo.PublishmentSystemInfo, menuDisplayInfo.ChildMenuIcon);
                }
                createMenuString += $@"
  if (window.mm_menu_{menuId}) return;
  {level2MenuBuilder}
  window.mm_menu_{menuId} = new Menu('root',{menuWidth},{menuHeight},'{menuDisplayInfo.FontFamily}',{menuDisplayInfo
                    .FontSize},'{menuDisplayInfo.FontColor}','{menuDisplayInfo.FontColorHilite}','{menuDisplayInfo
                    .MenuItemBgColor}','{menuDisplayInfo.MenuHiliteBgColor}','{menuDisplayInfo.MenuItemHAlign}','{menuDisplayInfo
                    .MenuItemVAlign}',{menuDisplayInfo.MenuItemPadding},{menuDisplayInfo.MenuItemSpacing},{menuDisplayInfo
                    .HideTimeout},-5,7,true,{menuDisplayInfo.MenuBgOpaque},{menuDisplayInfo.Vertical},{menuDisplayInfo
                    .MenuItemIndent},true,true);
  {menuBuilder}
  mm_menu_{menuId}.fontWeight='{menuDisplayInfo.FontWeight}';
  mm_menu_{menuId}.fontStyle='{menuDisplayInfo.FontStyle}';
  mm_menu_{menuId}.hideOnMouseOut={menuDisplayInfo.HideOnMouseOut};
  mm_menu_{menuId}.bgColor='{menuDisplayInfo.BgColor}';
  mm_menu_{menuId}.menuBorder={menuDisplayInfo.MenuBorder};
  mm_menu_{menuId}.menuLiteBgColor='{menuDisplayInfo.MenuLiteBgColor}';
  mm_menu_{menuId}.menuBorderBgColor='{menuDisplayInfo.MenuBorderBgColor}';
  mm_menu_{menuId}.childMenuIcon = ""{childMenuIcon}"";

//NEXT
";

                var scriptBuilder = new StringBuilder();

                string functionHead =
                    $@"<script src=""{SiteFilesAssets.GetUrl(pageInfo.ApiUrl, SiteFilesAssets.MmMenu.Js)}""></script>
<script>
//HEAD
function siteserverLoadMenus() {{";
                const string functionFoot = @"
//FOOT
}
</script>
<script>siteserverLoadMenus();writeMenus();</script>";
                //取得已经保存的js
                var existScript = string.Empty;
                if (pageInfo.IsPageScriptsExists(PageInfo.JsAcMenuScripts, true))
                {
                    existScript = pageInfo.GetPageScripts(PageInfo.JsAcMenuScripts, true);
                }
                if (string.IsNullOrEmpty(existScript) || existScript.IndexOf("//HEAD", StringComparison.Ordinal) < 0)
                {
                    scriptBuilder.Append(functionHead);
                }
                scriptBuilder.Append(createMenuString);
                //scriptBuilder.Append(writeMenuString);
                if (string.IsNullOrEmpty(existScript) || existScript.IndexOf("//FOOT", StringComparison.Ordinal) < 0)
                {
                    scriptBuilder.Append(functionFoot);
                }
                if (!string.IsNullOrEmpty(existScript) && existScript.IndexOf("//NEXT", StringComparison.Ordinal) >= 0)
                {
                    existScript = existScript.Replace("//NEXT", scriptBuilder.ToString());
                    pageInfo.SetPageScripts(PageInfo.JsAcMenuScripts, existScript, true);
                }
                else
                {
                    pageInfo.SetPageScripts(PageInfo.JsAcMenuScripts, scriptBuilder.ToString(), true);
                }
            }

            return(parsedContent);
        }
Esempio n. 8
0
        private static string GetLotteryUrl(PublishmentSystemInfo publishmentSystemInfo, LotteryInfo lotteryInfo)
        {
            var fileName = ELotteryTypeUtils.GetValue(ELotteryTypeUtils.GetEnumType(lotteryInfo.LotteryType)).ToLower();

            return(PageUtils.AddProtocolToUrl(SiteFilesAssets.GetUrl(publishmentSystemInfo.Additional.ApiUrl, $"weixin/lottery/{fileName}.html")));
        }
Esempio n. 9
0
 public static string GetLotteryTemplateDirectoryUrl(PublishmentSystemInfo publishmentSystemInfo)
 {
     return(PageUtils.AddProtocolToUrl(SiteFilesAssets.GetUrl(publishmentSystemInfo.Additional.ApiUrl, "weixin/lottery")));
 }
Esempio n. 10
0
        public string GetFileInputTemplate()
        {
            var content = FileUtils.ReadText(SiteFilesAssets.GetPath("govinteractapply/inputTemplate.html"), ECharset.utf_8);

            var regex        = "<!--parameters:(?<params>[^\"]*)-->";
            var paramstring  = RegexUtils.GetContent("params", regex, content);
            var parameters   = TranslateUtils.ToNameValueCollection(paramstring);
            var tdNameClass  = parameters["tdNameClass"];
            var tdInputClass = parameters["tdInputClass"];

            if (parameters.Count > 0)
            {
                content = content.Replace($"<!--parameters:{paramstring}-->\r\n", string.Empty);
            }

            content = $@"<link href=""{SiteFilesAssets.GovInteractApply.GetStyleUrl(_publishmentSystemInfo.Additional.ApiUrl)}"" type=""text/css"" rel=""stylesheet"" />
" + content;

            var builder       = new StringBuilder();
            var styleInfoList = RelatedIdentities.GetTableStyleInfoList(_publishmentSystemInfo, ETableStyle.GovInteractContent, _nodeId);

            var pageScripts = new NameValueCollection();

            var isPreviousSingleLine = true;
            var isPreviousLeftColumn = false;

            foreach (var styleInfo in styleInfoList)
            {
                if (styleInfo.IsVisible)
                {
                    var value = InputTypeParser.Parse(_publishmentSystemInfo, styleInfo, styleInfo.AttributeName, pageScripts);

                    if (builder.Length > 0)
                    {
                        if (isPreviousSingleLine)
                        {
                            builder.Append("</tr>");
                        }
                        else
                        {
                            if (!isPreviousLeftColumn)
                            {
                                builder.Append("</tr>");
                            }
                            else if (styleInfo.IsSingleLine)
                            {
                                builder.Append(
                                    $@"<td class=""{tdNameClass}""></td><td class=""{tdInputClass}""></td></tr>");
                            }
                        }
                    }

                    //this line

                    if (styleInfo.IsSingleLine || isPreviousSingleLine || !isPreviousLeftColumn)
                    {
                        builder.Append("<tr>");
                    }

                    builder.Append(
                        $@"<td class=""{tdNameClass}"">{styleInfo.DisplayName}</td><td {(styleInfo.IsSingleLine
                            ? @"colspan=""3"""
                            : string.Empty)} class=""{tdInputClass}"">{value}</td>");


                    if (styleInfo.IsSingleLine)
                    {
                        isPreviousSingleLine = true;
                        isPreviousLeftColumn = false;
                    }
                    else
                    {
                        isPreviousSingleLine = false;
                        isPreviousLeftColumn = !isPreviousLeftColumn;
                    }
                }
            }

            if (builder.Length > 0)
            {
                if (isPreviousSingleLine || !isPreviousLeftColumn)
                {
                    builder.Append("</tr>");
                }
                else
                {
                    builder.Append($@"<td class=""{tdNameClass}""></td><td class=""{tdInputClass}""></td></tr>");
                }
            }

            if (content.Contains("<!--提交表单循环-->"))
            {
                content = content.Replace("<!--提交表单循环-->", builder.ToString());
            }

            return(content.Replace("[nodeID]", _nodeId.ToString()));
        }
Esempio n. 11
0
        public string GetFileFailureTemplate()
        {
            var retval = FileUtils.ReadText(SiteFilesAssets.GetPath("govinteractapply/failureTemplate.html"), ECharset.utf_8);

            return(retval.Replace("[nodeID]", _nodeId.ToString()));
        }
Esempio n. 12
0
        private static string GetAnalysisValue(PageInfo pageInfo, int channelId, int contentId, string templateType, string type, string scope, bool isAverage, string style, int addNum, string since, string referrer)
        {
            var publishmentSystemInfo = pageInfo.PublishmentSystemInfo;

            if (publishmentSystemInfo == null)
            {
                return(string.Empty);
            }

            var html = string.Empty;

            var eStyle = publishmentSystemInfo.Additional.TrackerStyle;

            if (!string.IsNullOrEmpty(style))
            {
                eStyle = ETrackerStyleUtils.GetEnumType(style);
            }
            if (string.IsNullOrEmpty(scope) || !StringUtils.EqualsIgnoreCase(scope, ScopeSite))
            {
                scope = ScopePage;
            }
            var eTemplateType = ETemplateTypeUtils.GetEnumType(templateType);

            var accessNum = 0;
            var sinceDate = DateUtils.SqlMinValue;

            if (!string.IsNullOrEmpty(since))
            {
                sinceDate = DateTime.Now.AddHours(-DateUtils.GetSinceHours(since));
            }

            if (StringUtils.EqualsIgnoreCase(type, TypePageView))
            {
                if (StringUtils.EqualsIgnoreCase(scope, ScopePage))
                {
                    accessNum = eTemplateType != ETemplateType.FileTemplate ? DataProvider.TrackingDao.GetTotalAccessNumByPageInfo(pageInfo.PublishmentSystemId, channelId, contentId, sinceDate) : DataProvider.TrackingDao.GetTotalAccessNumByPageUrl(pageInfo.PublishmentSystemId, referrer, sinceDate);
                }
                else
                {
                    accessNum = DataProvider.TrackingDao.GetTotalAccessNum(pageInfo.PublishmentSystemId, sinceDate);
                    accessNum = accessNum + publishmentSystemInfo.Additional.TrackerPageView;
                }
                if (isAverage)
                {
                    var nodeInfo = NodeManager.GetNodeInfo(pageInfo.PublishmentSystemId, pageInfo.PublishmentSystemId);
                    var timeSpan = new TimeSpan(DateTime.Now.Ticks - nodeInfo.AddDate.Ticks);
                    if (!string.IsNullOrEmpty(since))
                    {
                        timeSpan = new TimeSpan(DateTime.Now.Ticks - sinceDate.Ticks);
                    }
                    var trackerDays = (timeSpan.Days == 0) ? 1 : timeSpan.Days;//总统计天数
                    trackerDays = trackerDays + publishmentSystemInfo.Additional.TrackerDays;
                    accessNum   = Convert.ToInt32(Math.Round(Convert.ToDouble(accessNum / trackerDays)));
                }
            }
            else if (StringUtils.EqualsIgnoreCase(type, TypeUniqueVisitor))
            {
                if (StringUtils.EqualsIgnoreCase(scope, ScopePage))
                {
                    accessNum = eTemplateType != ETemplateType.FileTemplate ? DataProvider.TrackingDao.GetTotalUniqueAccessNumByPageInfo(pageInfo.PublishmentSystemId, channelId, contentId, sinceDate) : DataProvider.TrackingDao.GetTotalUniqueAccessNumByPageUrl(pageInfo.PublishmentSystemId, referrer, sinceDate);
                }
                else
                {
                    accessNum = DataProvider.TrackingDao.GetTotalUniqueAccessNum(pageInfo.PublishmentSystemId, sinceDate);
                    accessNum = accessNum + publishmentSystemInfo.Additional.TrackerUniqueVisitor;
                }
                if (isAverage)
                {
                    var nodeInfo    = NodeManager.GetNodeInfo(pageInfo.PublishmentSystemId, pageInfo.PublishmentSystemId);
                    var timeSpan    = new TimeSpan(DateTime.Now.Ticks - nodeInfo.AddDate.Ticks);
                    var trackerDays = (timeSpan.Days == 0) ? 1 : timeSpan.Days;//总统计天数
                    trackerDays = trackerDays + publishmentSystemInfo.Additional.TrackerDays;
                    accessNum   = Convert.ToInt32(Math.Round(Convert.ToDouble(accessNum / trackerDays)));
                }
            }
            else if (StringUtils.EqualsIgnoreCase(type, TypeCurrentVisitor))
            {
                accessNum = DataProvider.TrackingDao.GetCurrentVisitorNum(pageInfo.PublishmentSystemId, publishmentSystemInfo.Additional.TrackerCurrentMinute);
            }

            accessNum = accessNum + addNum;
            if (accessNum == 0)
            {
                accessNum = 1;
            }

            if (eStyle != ETrackerStyle.None)
            {
                if (eStyle == ETrackerStyle.Number)
                {
                    html = accessNum.ToString();
                }
                else
                {
                    var    numString   = accessNum.ToString();
                    var    htmlBuilder = new StringBuilder();
                    string imgFolder   = $"{SiteFilesAssets.GetUrl(pageInfo.ApiUrl, SiteFilesAssets.Tracker.DirectoryName)}/{ETrackerStyleUtils.GetValue(eStyle)}";
                    foreach (var t in numString)
                    {
                        string imgHtml = $"<img src='{imgFolder}/{t}.gif' align=absmiddle border=0>";
                        htmlBuilder.Append(imgHtml);
                    }
                    html = htmlBuilder.ToString();
                }
            }

            return(html);
        }
Esempio n. 13
0
        private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, int totalStar, int initStar, string successMessage, string failureMessage, string theme, bool isTextOnly)
        {
            var tableName  = NodeManager.GetTableName(pageInfo.PublishmentSystemInfo, contextInfo.ChannelID);
            var tableStyle = NodeManager.GetTableStyle(pageInfo.PublishmentSystemInfo, contextInfo.ChannelID);
            var contentID  = ContentUtility.GetRealContentId(tableStyle, tableName, contextInfo.ContentID);
            var channelID  = BaiRongDataProvider.ContentDao.GetNodeId(tableName, contextInfo.ContentID);

            if (isTextOnly)
            {
                var counts     = DataProvider.StarDao.GetCount(pageInfo.PublishmentSystemId, channelID, contentID);
                var totalCount = counts[0];
                var totalPoint = counts[1];

                var totalCountAndPointAverage = DataProvider.StarSettingDao.GetTotalCountAndPointAverage(pageInfo.PublishmentSystemId, contentID);
                var settingTotalCount         = (int)totalCountAndPointAverage[0];
                var settingPointAverage       = (decimal)totalCountAndPointAverage[1];
                if (settingTotalCount > 0 || settingPointAverage > 0)
                {
                    totalCount += settingTotalCount;
                    totalPoint += Convert.ToInt32(settingPointAverage * settingTotalCount);
                }

                decimal num = 0;
                if (totalCount > 0)
                {
                    num      = Convert.ToDecimal(totalPoint) / Convert.ToDecimal(totalCount);
                    initStar = 0;
                }
                else
                {
                    num = initStar;
                }

                if (num > totalStar)
                {
                    num = totalStar;
                }

                var numString = num.ToString();
                if (numString.IndexOf('.') == -1)
                {
                    return(numString + ".0");
                }
                else
                {
                    var first  = numString.Substring(0, numString.IndexOf('.'));
                    var second = numString.Substring(numString.IndexOf('.') + 1, 1);
                    return(first + "." + second);
                }
            }
            else
            {
                var updaterID = pageInfo.UniqueId;
                var ajaxDivID = StlParserUtility.GetAjaxDivId(updaterID);

                pageInfo.AddPageScriptsIfNotExists(ElementName,
                                                   $@"<script language=""javascript"" src=""{SiteFilesAssets.Star.GetScriptUrl(pageInfo.ApiUrl)}""></script>");

                var builder = new StringBuilder();
                builder.Append(
                    $@"<link rel=""stylesheet"" href=""{SiteFilesAssets.Star.GetStyleUrl(pageInfo.ApiUrl, theme)}"" type=""text/css"" />");
                builder.Append($@"<div id=""{ajaxDivID}"">");

                var innerPageUrl           = Star.GetUrl(pageInfo.ApiUrl, pageInfo.PublishmentSystemId, channelID, contentID, updaterID, totalStar, initStar, theme, false);
                var innerPageUrlWithAction = Star.GetUrl(pageInfo.ApiUrl, pageInfo.PublishmentSystemId, channelID, contentID, updaterID, totalStar, initStar, theme, true);

                string loadingHtml =
                    $@"<img src=""{SiteFilesAssets.GetUrl(pageInfo.ApiUrl, SiteFilesAssets.FileLoading)}"" />";

                builder.Append(loadingHtml);

                builder.Append("</div>");

                var successAlert = string.Empty;
                if (!string.IsNullOrEmpty(successMessage))
                {
                    successAlert = $"stlSuccessAlert('{successMessage}');";
                }

                builder.Append($@"
<script type=""text/javascript"" language=""javascript"">
function stlStar_{updaterID}(url)
{{
    try
    {{
        var cnum=Math.ceil(Math.random()*1000);
        url = url + '&r=' + cnum;

        jQuery.get(url, '', function(data, textStatus){{
            jQuery('#{ajaxDivID}').html(data);
        }});

    }}catch(e){{}}
}}

stlStar_{updaterID}('{innerPageUrl}');

function stlStarPoint_{updaterID}(point)
{{
    if (stlStarCheck({pageInfo.PublishmentSystemId}, {channelID}, {contentID}, '{failureMessage}')){{
        jQuery('#{ajaxDivID}').innerHTML = '{loadingHtml}';
        stlStar_{updaterID}('{innerPageUrlWithAction}' + point);
        {successAlert}
    }}
}}
</script>
");

                return(builder.ToString());
            }
        }
Esempio n. 14
0
        public string GetFileSuccessTemplate()
        {
            var content = FileUtils.ReadText(SiteFilesAssets.GetPath("govinteractquery/successTemplate.html"), ECharset.utf_8);

            var regex        = "<!--parameters:(?<params>[^\"]*)-->";
            var paramstring  = RegexUtils.GetContent("params", regex, content);
            var parameters   = TranslateUtils.ToNameValueCollection(paramstring);
            var tdNameClass  = parameters["tdNameClass"];
            var tdInputClass = parameters["tdInputClass"];

            if (parameters.Count > 0)
            {
                content = content.Replace($"<!--parameters:{paramstring}-->\r\n", string.Empty);
            }

            var builder       = new StringBuilder();
            var styleInfoList = TableStyleManager.GetTableStyleInfoList(ETableStyle.GovInteractContent, _publishmentSystemInfo.AuxiliaryTableForGovInteract, RelatedIdentities.GetChannelRelatedIdentities(_publishmentSystemInfo.PublishmentSystemId, _nodeId));

            var isPreviousSingleLine = true;
            var isPreviousLeftColumn = false;

            foreach (var styleInfo in styleInfoList)
            {
                if (styleInfo.IsVisible)
                {
                    if (StringUtils.EqualsIgnoreCase(GovInteractContentAttribute.IsPublic, styleInfo.AttributeName) || StringUtils.EqualsIgnoreCase(GovInteractContentAttribute.DepartmentId, styleInfo.AttributeName) || StringUtils.EqualsIgnoreCase(GovInteractContentAttribute.TypeId, styleInfo.AttributeName))
                    {
                        continue;
                    }
                    string value = $"{{$T.{styleInfo.AttributeName.ToLower()}}}";

                    if (builder.Length > 0)
                    {
                        if (isPreviousSingleLine)
                        {
                            builder.Append("</tr>");
                        }
                        else
                        {
                            if (!isPreviousLeftColumn)
                            {
                                builder.Append("</tr>");
                            }
                            else if (styleInfo.IsSingleLine)
                            {
                                builder.Append(
                                    $@"<td class=""{tdNameClass}""></td><td class=""{tdInputClass}""></td></tr>");
                            }
                        }
                    }

                    //this line

                    if (styleInfo.IsSingleLine || isPreviousSingleLine || !isPreviousLeftColumn)
                    {
                        builder.Append("<tr>");
                    }

                    builder.Append(
                        $@"<td class=""{tdNameClass}"">{styleInfo.DisplayName}</td><td {(styleInfo.IsSingleLine
                            ? @"colspan=""3"""
                            : string.Empty)} class=""{tdInputClass}"">{value}</td>");


                    if (styleInfo.IsSingleLine)
                    {
                        isPreviousSingleLine = true;
                        isPreviousLeftColumn = false;
                    }
                    else
                    {
                        isPreviousSingleLine = false;
                        isPreviousLeftColumn = !isPreviousLeftColumn;
                    }
                }
            }

            if (builder.Length > 0)
            {
                if (isPreviousSingleLine || !isPreviousLeftColumn)
                {
                    builder.Append("</tr>");
                }
                else
                {
                    builder.Append($@"<td class=""{tdNameClass}""></td><td class=""{tdInputClass}""></td></tr>");
                }
            }

            if (content.Contains("<!--查询表单循环-->"))
            {
                content = content.Replace("<!--查询表单循环-->", builder.ToString());
            }

            return(content);
        }
Esempio n. 15
0
            public static string GetScript(PageInfo pageInfo, string target, bool isShowTreeLine, bool isShowContentNum, string currentFormatString, int topChannelId, int topParentsCount, int currentChannelId)
            {
                var script       = @"
<script language=""JavaScript"">
function stltree_isNull(obj){
	if (typeof(obj) == 'undefined')
	  return true;
	  
	if (obj == undefined)
	  return true;
	  
	if (obj == null)
	  return true;
	 
	return false;
}

function stltree_getTreeLevel(e) {
	var length = 0;
	if (!stltree_isNull(e)){
		if (e.tagName == 'TR') {
			length = parseInt(e.getAttribute('treeItemLevel'));
		}
	}
	return length;
}

function stltree_getTrElement(element){
	if (stltree_isNull(element)) return;
	for (element = element.parentNode;;){
		if (element != null && element.tagName == 'TR'){
			break;
		}else{
			element = element.parentNode;
		} 
	}
	return element;
}

function stltree_getImgClickableElementByTr(element){
	if (stltree_isNull(element) || element.tagName != 'TR') return;
	var img = null;
	if (!stltree_isNull(element.childNodes)){
		var imgCol = element.getElementsByTagName('IMG');
		if (!stltree_isNull(imgCol)){
			for (x=0;x<imgCol.length;x++){
				if (!stltree_isNull(imgCol.item(x).getAttribute('isOpen'))){
					img = imgCol.item(x);
					break;
				}
			}
		}
	}
	return img;
}

var weightedLink = null;

function fontWeightLink(element){
    if (weightedLink != null)
    {
        weightedLink.style.fontWeight = 'normal';
    }
    element.style.fontWeight = 'bold';
    weightedLink = element;
}

var completedChannelId = null;
function stltree_displayChildren(img){
	if (stltree_isNull(img)) return;

	var tr = stltree_getTrElement(img);

    var isToOpen = img.getAttribute('isOpen') == 'false';
    var isByAjax = img.getAttribute('isAjax') == 'true';
    var channelId = img.getAttribute('id');

	if (!stltree_isNull(img) && img.getAttribute('isOpen') != null){
		if (img.getAttribute('isOpen') == 'false'){
			img.setAttribute('isOpen', 'true');
            img.setAttribute('src', '{iconMinusUrl}');
		}else{
            img.setAttribute('isOpen', 'false');
            img.setAttribute('src', '{iconPlusUrl}');
		}
	}

    if (isToOpen && isByAjax)
    {
        var div = document.createElement('div');
        div.innerHTML = ""<img align='absmiddle' border='0' src='{iconLoadingUrl}' /> 加载中,请稍候..."";
        img.parentNode.appendChild(div);
        //Element.addClassName(div, 'loading');
        loadingChannels(tr, img, div, channelId);
    }
    else
    {
        var level = stltree_getTreeLevel(tr);
        
	    var collection = new Array();
	    var index = 0;

	    for ( var e = tr.nextSibling; !stltree_isNull(e) ; e = e.nextSibling) {
		    if (!stltree_isNull(e) && !stltree_isNull(e.tagName) && e.tagName == 'TR'){
		        var currentLevel = stltree_getTreeLevel(e);
		        if (currentLevel <= level) break;
		        if(e.style.display == '') {
			        e.style.display = 'none';
		        }else{
			        if (currentLevel != level + 1) continue;
			        e.style.display = '';
			        var imgClickable = stltree_getImgClickableElementByTr(e);
			        if (!stltree_isNull(imgClickable)){
				        if (!stltree_isNull(imgClickable.getAttribute('isOpen')) && imgClickable.getAttribute('isOpen') =='true'){
					        imgClickable.setAttribute('isOpen', 'false');
                            imgClickable.setAttribute('src', '{iconPlusUrl}');
					        collection[index] = imgClickable;
					        index++;
				        }
			        }
		        }
            }
	    }
        
	    if (index > 0){
		    for (i=0;i<=index;i++){
			    stltree_displayChildren(collection[i]);
		    }
	    }
    }
}
";
                var loadingUrl   = ApiRouteActionsLoadingChannels.GetUrl(pageInfo.ApiUrl);
                var formatString = TranslateUtils.EncryptStringBySecretKey(currentFormatString);

                script += $@"
function loadingChannels(tr, img, div, channelId){{
    var url = '{loadingUrl}';
    var pars = 'siteID={pageInfo.SiteId}&parentID=' + channelId + '&target={target}&isShowTreeLine={isShowTreeLine}&isShowContentNum={isShowContentNum}&currentFormatString={formatString}&topChannelId={topChannelId}&topParentsCount={topParentsCount}&currentChannelId={currentChannelId}';

    //jQuery.post(url, pars, function(data, textStatus){{
        //$($.parseHTML(data)).insertAfter($(tr));
        //img.setAttribute('isAjax', 'false');
        //img.parentNode.removeChild(div);
        //completedChannelId = channelId;
    //}});
    $.ajax({{
                url: url,
                type: ""POST"",
                mimeType:""multipart/form-data"",
                contentType: false,
                processData: false,
                cache: false,
                xhrFields: {{   
                    withCredentials: true   
                }},
                data: pars,
                success: function(json, textStatus){{
                    $($.parseHTML(data)).insertAfter($(tr));
                    img.setAttribute('isAjax', 'false');
                    img.parentNode.removeChild(div);
                    completedChannelId = channelId;
                }}
    }});
}}

function loadingChannelsOnLoad(path){{
    if (path && path.length > 0){{
        var channelIds = path.split(',');
        var channelId = channelIds[0];
        var img = $(channelId);
        if (!img) return;
        if (img.getAttribute('isOpen') == 'false'){{
            stltree_displayChildren(img);
            new PeriodicalExecuter(function(pe){{
                if (completedChannelId && completedChannelId == channelId){{
                    if (path.indexOf(',') != -1){{
                        var thePath = path.substring(path.indexOf(',') + 1);
                        loadingChannelsOnLoad(thePath);
                    }}
                    pe.stop();
                }} 
            }}, 1);
        }}
    }}
}}
</script>
";

                script += GetScriptOnLoad(pageInfo.SiteId, topChannelId, pageInfo.PageChannelId);

                var treeDirectoryUrl    = SiteFilesAssets.GetUrl(pageInfo.ApiUrl, "tree");
                var iconFolderUrl       = PageUtils.Combine(treeDirectoryUrl, "folder.gif");
                var iconOpenedFolderUrl = PageUtils.Combine(treeDirectoryUrl, "openedfolder.gif");
                var iconMinusUrl        = PageUtils.Combine(treeDirectoryUrl, "minus.png");
                var iconPlusUrl         = PageUtils.Combine(treeDirectoryUrl, "plus.png");

                script = script.Replace("{iconFolderUrl}", iconFolderUrl);
                script = script.Replace("{iconMinusUrl}", iconMinusUrl);
                script = script.Replace("{iconOpenedFolderUrl}", iconOpenedFolderUrl);
                script = script.Replace("{iconPlusUrl}", iconPlusUrl);
                script = script.Replace("{isNodeTree}", "true");

                script = script.Replace("{iconLoadingUrl}", SiteFilesAssets.GetUrl(pageInfo.ApiUrl, SiteFilesAssets.FileLoading));

                return(script);
            }
Esempio n. 16
0
 public string GetFileFailureTemplate()
 {
     return(FileUtils.ReadText(SiteFilesAssets.GetPath("govpublicquery/failureTemplate.html"), ECharset.utf_8));
 }
Esempio n. 17
0
        public string ReplacePlaceHolder(string template, bool isLoadValues, string successTemplateString, string failureTemplateString)
        {
            var parsedContent = new StringBuilder();

            parsedContent.Append($@"
<div id=""inputSuccess_{_inputInfo.InputID}"" class=""is_success"" style=""display:none""></div>
<div id=""inputFailure_{_inputInfo.InputID}"" class=""is_failure"" style=""display:none""></div>
<div id=""inputContainer_{_inputInfo.InputID}"">");

            //添加遮罩层
            parsedContent.Append($@"
<div id=""inputModal_{_inputInfo.InputID}"" times=""2"" id=""xubox_shade2"" class=""xubox_shade"" style=""z-index:19891016; background-color: #FFF; opacity: 0.5; filter:alpha(opacity=10);top: 0;left: 0;width: 100%;height: 100%;position: fixed;display:none;""></div>
<div id=""inputModalMsg_{_inputInfo.InputID}"" times=""2"" showtime=""0"" style=""z-index: 19891016; left: 50%; top: 206px; width: 500px; height: 360px; margin-left: -250px;position: fixed;text-align: center;display:none;"" id=""xubox_layer2"" class=""xubox_layer"" type=""iframe""><img src = ""{SiteFilesAssets.GetUrl(_publishmentSystemInfo.Additional.ApiUrl, SiteFilesAssets.FileWaiting)}"" style="""">
<br>
<span style=""font-size:10px;font-family:Microsoft Yahei"">正在提交...</span>
</div>
<script>
		function openModal()
        {{
			document.getElementById(""inputModal_{_inputInfo.InputID}"").style.display = '';
            document.getElementById(""inputModalMsg_{_inputInfo.InputID}"").style.display = '';
        }}
        function closeModal()
        {{
			document.getElementById(""inputModal_{_inputInfo.InputID}"").style.display = 'none';
            document.getElementById(""inputModalMsg_{_inputInfo.InputID}"").style.display = 'none';
        }}
</script>");

            var actionUrl = ActionsInputAdd.GetUrl(_publishmentSystemInfo.Additional.ApiUrl, _publishmentSystemInfo.PublishmentSystemId, _inputInfo.InputID);

            parsedContent.Append($@"
<form id=""frmInput_{_inputInfo.InputID}"" name=""frmInput_{_inputInfo.InputID}"" style=""margin:0;padding:0"" method=""post"" enctype=""multipart/form-data"" action=""{actionUrl}"" target=""loadInput_{_inputInfo.InputID}"">
");

            if (!string.IsNullOrEmpty(successTemplateString))
            {
                parsedContent.AppendFormat(@"<input type=""hidden"" id=""successTemplateString"" value=""{0}"" />", TranslateUtils.EncryptStringBySecretKey(successTemplateString));
            }
            if (!string.IsNullOrEmpty(failureTemplateString))
            {
                parsedContent.AppendFormat(@"<input type=""hidden"" id=""failureTemplateString"" value=""{0}"" />", TranslateUtils.EncryptStringBySecretKey(failureTemplateString));
            }

            parsedContent.Append(template);

            parsedContent.AppendFormat(@"
</form>
<iframe id=""loadInput_{0}"" name=""loadInput_{0}"" width=""0"" height=""0"" frameborder=""0""></iframe>
</div>", _inputInfo.InputID);

            var pageScripts = new NameValueCollection();

            GetAttributesHtml(pageScripts, _publishmentSystemInfo, _styleInfoList);

            foreach (string key in pageScripts.Keys)
            {
                parsedContent.Append(pageScripts[key]);
            }

            if (_inputInfo.Additional.IsCtrlEnter)
            {
                parsedContent.AppendFormat(@"
<script>document.body.onkeydown=function(e)
{{e=e?e:window.event;var tagname=e.srcElement?e.srcElement.tagName:e.target.tagName;if(tagname=='INPUT'||tagname=='TEXTAREA'){{if(e!=null&&e.ctrlKey&&e.keyCode==13){{document.getElementById('submit_{0}').click();}}}}}}</script>", _inputInfo.InputID);
            }

            string clickString =
                $@"if (checkFormValueById('frmInput_{HolderInputId}')){{openModal(); document.getElementById('frmInput_{HolderInputId}').submit();}}";

            StlHtmlUtility.ReWriteSubmitButton(parsedContent, clickString);

            var stlFormElements = StlHtmlUtility.GetStlFormElementsArrayList(parsedContent.ToString());

            if (stlFormElements != null && stlFormElements.Count > 0)
            {
                foreach (string stlFormElement in stlFormElements)
                {
                    XmlNode             elementNode;
                    NameValueCollection attributes;
                    StlHtmlUtility.ReWriteFormElements(stlFormElement, out elementNode, out attributes);

                    var validateAttributes = string.Empty;
                    var validateHtmlString = string.Empty;

                    if (!string.IsNullOrEmpty(attributes["id"]))
                    {
                        foreach (var styleInfo in _styleInfoList)
                        {
                            if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, attributes["id"]))
                            {
                                validateHtmlString = InputParserUtility.GetValidateHtmlString(styleInfo, out validateAttributes);
                                attributes["id"]   = styleInfo.AttributeName;
                            }
                        }
                    }

                    if (StringUtils.EqualsIgnoreCase(elementNode.Name, "input"))
                    {
                        parsedContent.Replace(stlFormElement,
                                              $@"<{elementNode.Name} {TranslateUtils.ToAttributesString(attributes)} {validateAttributes}/>{validateHtmlString}");
                    }
                    else
                    {
                        parsedContent.Replace(stlFormElement,
                                              $@"<{elementNode.Name} {TranslateUtils.ToAttributesString(attributes)} {validateAttributes}>{elementNode
                                .InnerXml}</{elementNode.Name}>{validateHtmlString}");
                    }
                }
            }

            parsedContent.Replace(HolderInputId, _inputInfo.InputID.ToString());

            if (isLoadValues)
            {
                parsedContent.AppendFormat(@"
<script type=""text/javascript"">stlInputLoadValues('frmInput_{0}');</script>
", _inputInfo.InputID);
            }

            return(parsedContent.ToString());
        }
Esempio n. 18
0
        public static string GetBackgroundImageSelectHtml(PublishmentSystemInfo publishmentSystemInfo, string backgroundImageUrl)
        {
            var builder = new StringBuilder(@"<select id=""backgroundSelect"" onchange=""if ($(this).val()){$('#preview_backgroundImageUrl').attr('src', $(this).val());$('#backgroundImageUrl').val($(this).find('option:selected').attr('url'));}""><option value="""">选择预设背景</option>");

            if (string.IsNullOrEmpty(backgroundImageUrl))
            {
                backgroundImageUrl = "0.jpg";
            }
            for (var i = 0; i <= 20; i++)
            {
                var fileName = i + ".jpg";
                var selected = string.Empty;
                if (fileName == backgroundImageUrl)
                {
                    selected = "selected";
                }
                builder.AppendFormat(@"<option value=""{0}"" url=""{1}"" {2}>{3}</option>", PageUtils.AddProtocolToUrl(SiteFilesAssets.GetUrl(publishmentSystemInfo.Additional.ApiUrl, $"weixin/components/background/{i}.jpg")), fileName, selected, "预设背景" + (i + 1));
            }
            builder.Append("</select>");
            return(builder.ToString());
        }
Esempio n. 19
0
        private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, EDiggType diggType, string goodText, string badText, string theme, bool isNumber)
        {
            if (isNumber)
            {
                int count;

                var relatedIdentity = contextInfo.ContentID;
                if (relatedIdentity == 0 || contextInfo.ContextType == EContextType.Channel)
                {
                    relatedIdentity = contextInfo.ChannelID;
                }

                var counts  = BaiRongDataProvider.DiggDao.GetCount(pageInfo.PublishmentSystemId, relatedIdentity);
                var goodNum = counts[0];
                var badNum  = counts[1];

                if (diggType == EDiggType.Good)
                {
                    count = goodNum;
                }
                else if (diggType == EDiggType.Bad)
                {
                    count = badNum;
                }
                else
                {
                    count = goodNum + badNum;
                }

                return(count.ToString());
            }
            else
            {
                var updaterId = pageInfo.UniqueId;
                var ajaxDivId = StlParserUtility.GetAjaxDivId(updaterId);

                pageInfo.AddPageScriptsIfNotExists(ElementName,
                                                   $@"<script language=""javascript"" src=""{SiteFilesAssets.Digg.GetScriptUrl(pageInfo.ApiUrl)}""></script>");

                var builder = new StringBuilder();
                builder.Append(
                    $@"<link rel=""stylesheet"" href=""{SiteFilesAssets.Digg.GetStyleUrl(pageInfo.ApiUrl, theme)}"" type=""text/css"" />");
                builder.Append($@"<div id=""{ajaxDivId}"">");

                var relatedIdentity = contextInfo.ContentID;
                if (relatedIdentity == 0 || contextInfo.ContextType == EContextType.Channel)
                {
                    relatedIdentity = contextInfo.ChannelID;
                }

                var innerPageUrl         = Digg.GetUrl(pageInfo.ApiUrl, pageInfo.PublishmentSystemId, relatedIdentity, updaterId, diggType, goodText, badText, theme, false, false);
                var innerPageUrlWithGood = Digg.GetUrl(pageInfo.ApiUrl, pageInfo.PublishmentSystemId, relatedIdentity, updaterId, diggType, goodText, badText, theme, true, true);
                var innerPageUrlWithBad  = Digg.GetUrl(pageInfo.ApiUrl, pageInfo.PublishmentSystemId, relatedIdentity, updaterId, diggType, goodText, badText, theme, true, false);

                string loadingHtml =
                    $@"<img src=""{SiteFilesAssets.GetUrl(pageInfo.ApiUrl, SiteFilesAssets.FileLoading)}"" />";

                builder.Append(loadingHtml);

                builder.Append("</div>");

                builder.Append($@"
<script type=""text/javascript"" language=""javascript"">
function stlDigg_{updaterId}(url)
{{
    try
    {{
        var cnum=Math.ceil(Math.random()*1000);
        url = url + '&r=' + cnum;

        jQuery.get(url, '', function(data, textStatus){{
            jQuery('#{ajaxDivId}').html(data);
        }});

    }}catch(e){{}}
}}

stlDigg_{updaterId}('{innerPageUrl}');

function stlDiggSet_{updaterId}(isGood)
{{
    if (stlDiggCheck({pageInfo.PublishmentSystemId}, {relatedIdentity})){{
        jQuery('#{ajaxDivId}').html('{loadingHtml}');
        if (isGood)
        {{
            stlDigg_{updaterId}('{innerPageUrlWithGood}');
        }}else{{
            stlDigg_{updaterId}('{innerPageUrlWithBad}');
        }}
    }}
}}
</script>
");

                return(builder.ToString());
            }
        }
Esempio n. 20
0
 public static string GetImageUrl(PublishmentSystemInfo publishmentSystemInfo, string imageUrl)
 {
     return(PageUtils.AddProtocolToUrl(string.IsNullOrEmpty(imageUrl) ? SiteFilesAssets.GetUrl(publishmentSystemInfo.Additional.ApiUrl, "weixin/album/img/start.jpg") : PageUtility.ParseNavigationUrl(publishmentSystemInfo, imageUrl)));
 }
Esempio n. 21
0
        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));
        }
Esempio n. 22
0
        private string GetJsCode(string pageJsName)
        {
            var retval = string.Empty;

            if (pageJsName == Const.Jquery)
            {
                retval =
                    $"<script src=\"{SiteFilesAssets.GetUrl(ApiUrl, SiteFilesAssets.Components.Jquery)}\" type=\"text/javascript\"></script>";
            }
            else if (pageJsName == Const.Vue)
            {
                retval =
                    $"<script src=\"{SiteFilesAssets.GetUrl(ApiUrl, SiteFilesAssets.Components.Vue)}\" type=\"text/javascript\"></script>";
            }
            else if (pageJsName == Const.JsCookie)
            {
                retval =
                    $@"<script src=""{ SiteFilesAssets.GetUrl(ApiUrl, SiteFilesAssets.Components.JsCookie)}"" type=""text/javascript""></script>";
            }
            else if (pageJsName == Const.StlClient)
            {
                retval =
                    $@"<script src=""{ SiteFilesAssets.GetUrl(ApiUrl, SiteFilesAssets.Components.Lodash)}"" type=""text/javascript""></script><script src=""{SiteFilesAssets.GetUrl(ApiUrl, SiteFilesAssets.Components.StlClient)}"" type=""text/javascript""></script>";
            }
            else if (pageJsName == Const.BAjaxUpload)
            {
                retval =
                    $"<script src=\"{SiteFilesAssets.GetUrl(ApiUrl, SiteFilesAssets.JQuery.AjaxUpload.Js)}\" type=\"text/javascript\"></script>";
            }
            else if (pageJsName == Const.BQueryString)
            {
                retval =
                    $"<script src=\"{SiteFilesAssets.GetUrl(ApiUrl, SiteFilesAssets.JQuery.QueryString.Js)}\" type=\"text/javascript\"></script>";
            }
            else if (pageJsName == Const.BjQueryForm)
            {
                retval =
                    $"<script src=\"{SiteFilesAssets.GetUrl(ApiUrl, SiteFilesAssets.JQuery.JQueryForm.Js)}\" type=\"text/javascript\"></script>";
            }
            else if (pageJsName == Const.BShowLoading)
            {
                retval =
                    $@"<link href=""{SiteFilesAssets.GetUrl(ApiUrl, SiteFilesAssets.JQuery.ShowLoading.Css)}"" rel=""stylesheet"" media=""screen"" /><script type=""text/javascript"" charset=""{SiteFilesAssets
                        .JQuery.ShowLoading.Charset}"" src=""{SiteFilesAssets.GetUrl(ApiUrl, SiteFilesAssets.JQuery.ShowLoading.Js)}""></script>";
            }
            else if (pageJsName == Const.BjTemplates)
            {
                retval =
                    $@"<script type=""text/javascript"" charset=""{SiteFilesAssets.JQuery.JTemplates.Charset}"" src=""{SiteFilesAssets.GetUrl(ApiUrl, SiteFilesAssets.JQuery.JTemplates.Js)}""></script>";
            }
            else if (pageJsName == Const.BValidate)
            {
                retval =
                    $@"<script type=""text/javascript"" charset=""{SiteFilesAssets.JQuery.ValidateJs.Charset}"" src=""{SiteFilesAssets.GetUrl(ApiUrl, SiteFilesAssets.JQuery.ValidateJs.Js)}""></script>";
            }
            else if (pageJsName == Const.BBootstrap)
            {
                var cssUrl = SiteFilesAssets.GetUrl(ApiUrl, SiteFilesAssets.JQuery.Bootstrap.Css);
                var jsUrl  = SiteFilesAssets.GetUrl(ApiUrl, SiteFilesAssets.JQuery.Bootstrap.Js);
                retval = $@"
<link rel=""stylesheet"" type=""text/css"" href=""{cssUrl}"">
<script language=""javascript"" src=""{jsUrl}""></script>
";
            }
            else if (pageJsName == Const.JsAcSwfObject)
            {
                retval =
                    $@"<script type=""text/javascript"" src=""{SiteFilesAssets.GetUrl(ApiUrl, SiteFilesAssets.SwfObject.Js)}""></script>";
            }
            else if (pageJsName == Const.JsAcJwPlayer6)
            {
                retval =
                    $@"<script type=""text/javascript"" src=""{SiteFilesAssets.GetUrl(ApiUrl, SiteFilesAssets.JwPlayer6.Js)}""></script><script type=""text/javascript"">jwplayer.key=""ABCDEFGHIJKLMOPQ"";</script>";
            }
            else if (pageJsName == Const.JsAcFlowPlayer)
            {
                retval =
                    $@"<script type=""text/javascript"" src=""{SiteFilesAssets.GetUrl(ApiUrl, SiteFilesAssets.FlowPlayer.Js)}""></script>";
            }
            else if (pageJsName == Const.JsAcMediaElement)
            {
                retval =
                    $@"<script type=""text/javascript"" src=""{SiteFilesAssets.GetUrl(ApiUrl, SiteFilesAssets.MediaElement.Js)}""></script><link rel=""stylesheet"" href=""{SiteFilesAssets.GetUrl(ApiUrl, SiteFilesAssets.MediaElement.Css)}"" />";
            }
            else if (pageJsName == Const.JsAcAudioJs)
            {
                retval =
                    $@"<script type=""text/javascript"" src=""{SiteFilesAssets.GetUrl(ApiUrl, SiteFilesAssets.AudioJs.Js)}""></script>
<script type='text/javascript'>
audiojs.events.ready(function() {{
    audiojs.createAll();
}});
</script>
";
            }
            else if (pageJsName == Const.JsAcVideoJs)
            {
                retval = $@"
<link href=""{SiteFilesAssets.GetUrl(ApiUrl, SiteFilesAssets.VideoJs.Css)}"" rel=""stylesheet"">
<script type=""text/javascript"" src=""{SiteFilesAssets.GetUrl(ApiUrl, SiteFilesAssets.VideoJs.Js)}""></script>
";
            }
            else if (pageJsName == Const.JsPageOpenWindow)
            {
                retval = @"
<div id=""stl_wnd_board"" style=""position:absolute;top:100px;left:0px;width:100%;z-index:65531;height:100%;display:none"" align=""center"">
    <div id=""stl_wnd_div"" style=""display:none; width:400px; height:330px; padding:0; margin:0px;"" align=""center"">
    <iframe id=""stl_wnd_frame"" frameborder=""0"" scrolling=""auto"" width=""100%"" height=""100%"" src=""""></iframe>
    </div>
</div>
<script>
function stlCloseWindow()
{document.getElementById('stl_wnd_div').style.display='none';document.getElementById('stl_wnd_board').style.display='none';}
function stlOpenWindow(pageUrl,width,height)
{var stl_wnd=document.getElementById('stl_wnd_div');var stl_board=document.getElementById('stl_wnd_board');var wnd_frame=document.getElementById('stl_wnd_frame');if(stl_wnd){stl_wnd.style.width=width+'px';stl_wnd.style.height=height+'px';stl_board.style.display='block';stl_board.style.top=(100+document.documentElement.scrollTop)+'px';stl_wnd.style.visible='hidden';stl_wnd.style.display='block';var url;if(pageUrl.indexOf('?')==-1){url=pageUrl+'?_r='+Math.random();}else{url=pageUrl+'&_r='+Math.random();}
wnd_frame.src=url;}}
</script>
";
            }
            else if (pageJsName == Const.JsUserScript)
            {
                retval = $@"
<script type=""text/javascript"" src=""{SiteFilesAssets.GetUrl(ApiUrl, SiteFilesAssets.Stl.JsPageScript)}""></script>
<script type=""text/javascript"">stlInit('{SiteFilesAssets.GetUrl(ApiUrl, string.Empty)}', '{SiteInfo.Id}', {SiteInfo.Additional.WebUrl.TrimEnd('/')}');</script>
<script type=""text/javascript"" src=""{SiteFilesAssets.GetUrl(ApiUrl, SiteFilesAssets.Stl.JsUserScript)}""></script>";
            }
            else if (pageJsName == Const.JsInnerCalendar)
            {
                retval = $@"<script type=""text/javascript"" src=""{SiteFilesAssets.GetUrl(ApiUrl, SiteFilesAssets.DatePicker.Js)}""></script>";
            }
            else if (pageJsName == Const.JsStaticAdFloating)
            {
                retval =
                    $@"<script type=""text/javascript"" src=""{SiteFilesAssets.GetUrl(ApiUrl, SiteFilesAssets.Static.JsStaticAdFloating)}""></script>";
            }
            else if (pageJsName == Const.JsAhTranslate)
            {
                retval =
                    $@"<script src=""{SiteFilesAssets.GetUrl(ApiUrl, SiteFilesAssets.TwCn.Js)}"" charset=""{SiteFilesAssets.TwCn.Charset}"" type=""text/javascript""></script>";
            }
            return(retval);
        }
Esempio n. 23
0
        private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo)
        {
            pageInfo.AddPageScriptsIfNotExists(PageInfo.Components.Jquery);
            pageInfo.AddPageScriptsIfNotExists(PageInfo.JsAcSwfObject);

            var contentInfo = contextInfo.ContentInfo ??
                              DataProvider.ContentDao.GetContentInfo(ETableStyle.BackgroundContent, pageInfo.PublishmentSystemInfo.AuxiliaryTableForContent, contextInfo.ContentId);

            var photoInfoList = DataProvider.PhotoDao.GetPhotoInfoList(pageInfo.PublishmentSystemId, contextInfo.ContentId);

            var builder = new StringBuilder();

            builder.Append($@"
<script type=""text/javascript"">
var slideFullScreenUrl = ""{SiteFilesAssets.GetUrl(pageInfo.ApiUrl, SiteFilesAssets.Slide.FullScreenSwf)}"";
");

            builder.Append(@"
var slide_data = {
");

            builder.Append($@"
    ""slide"":{{""title"":""{StringUtils.ToJsString(contentInfo.Title)}""}},
    ""images"":[
");


            foreach (var photoInfo in photoInfoList)
            {
                builder.Append($@"
            {{""title"":""{StringUtils.ToJsString(contentInfo.Title)}"",""intro"":""{StringUtils.ToJsString(
                    photoInfo.Description)}"",""previewUrl"":""{StringUtils.ToJsString(
                    PageUtility.ParseNavigationUrl(pageInfo.PublishmentSystemInfo, photoInfo.SmallUrl))}"",""imageUrl"":""{StringUtils
                    .ToJsString(PageUtility.ParseNavigationUrl(pageInfo.PublishmentSystemInfo, photoInfo.LargeUrl))}"",""id"":""{photoInfo
                    .ID}""}},");
            }

            if (photoInfoList.Count > 0)
            {
                builder.Length -= 1;
            }

            builder.Append(@"
    ],
");

            var siblingContentId = BaiRongDataProvider.ContentDao.GetContentId(pageInfo.PublishmentSystemInfo.AuxiliaryTableForContent, contentInfo.NodeId, contentInfo.Taxis, true);

            if (siblingContentId > 0)
            {
                var nodeInfo           = NodeManager.GetNodeInfo(pageInfo.PublishmentSystemId, contentInfo.NodeId);
                var tableStyle         = NodeManager.GetTableStyle(pageInfo.PublishmentSystemInfo, nodeInfo);
                var tableName          = NodeManager.GetTableName(pageInfo.PublishmentSystemInfo, nodeInfo);
                var siblingContentInfo = DataProvider.ContentDao.GetContentInfo(tableStyle, tableName, siblingContentId);
                var title      = siblingContentInfo.Title;
                var url        = PageUtility.GetContentUrl(pageInfo.PublishmentSystemInfo, siblingContentInfo);
                var photoInfo  = DataProvider.PhotoDao.GetFirstPhotoInfo(pageInfo.PublishmentSystemId, siblingContentId);
                var previewUrl = photoInfo != null?PageUtility.ParseNavigationUrl(pageInfo.PublishmentSystemInfo, photoInfo.SmallUrl) : SiteFilesAssets.GetUrl(pageInfo.ApiUrl, SiteFilesAssets.FileS);

                builder.Append($@"
    ""next_album"":{{""title"":""{StringUtils.ToJsString(title)}"",""url"":""{StringUtils.ToJsString(url)}"",""previewUrl"":""{StringUtils.ToJsString(previewUrl)}""}},
");
            }
            else
            {
                builder.Append($@"
    ""next_album"":{{""title"":"""",""url"":""javascript:void(0);"",""previewUrl"":""{SiteFilesAssets.GetUrl(pageInfo.ApiUrl, SiteFilesAssets.FileS)}""}},
");
            }

            siblingContentId = BaiRongDataProvider.ContentDao.GetContentId(pageInfo.PublishmentSystemInfo.AuxiliaryTableForContent, contentInfo.NodeId, contentInfo.Taxis, false);

            if (siblingContentId > 0)
            {
                var nodeInfo           = NodeManager.GetNodeInfo(pageInfo.PublishmentSystemId, contentInfo.NodeId);
                var tableStyle         = NodeManager.GetTableStyle(pageInfo.PublishmentSystemInfo, nodeInfo);
                var tableName          = NodeManager.GetTableName(pageInfo.PublishmentSystemInfo, nodeInfo);
                var siblingContentInfo = DataProvider.ContentDao.GetContentInfo(tableStyle, tableName, siblingContentId);
                var title = siblingContentInfo.Title;
                var url   = PageUtility.GetContentUrl(pageInfo.PublishmentSystemInfo, siblingContentInfo);

                var photoInfo  = DataProvider.PhotoDao.GetFirstPhotoInfo(pageInfo.PublishmentSystemId, siblingContentId);
                var previewUrl = photoInfo != null?PageUtility.ParseNavigationUrl(pageInfo.PublishmentSystemInfo, photoInfo.SmallUrl) : SiteFilesAssets.GetUrl(pageInfo.ApiUrl, SiteFilesAssets.FileS);

                builder.Append($@"
    ""prev_album"":{{""title"":""{StringUtils.ToJsString(title)}"",""url"":""{StringUtils.ToJsString(url)}"",""previewUrl"":""{StringUtils
                    .ToJsString(previewUrl)}""}}
");
            }
            else
            {
                builder.Append($@"
    ""prev_album"":{{""title"":"""",""url"":""javascript:void(0);"",""previewUrl"":""{SiteFilesAssets.GetUrl(
                    pageInfo.ApiUrl, SiteFilesAssets.FileS)}""}}
");
            }

            builder.Append(@"
}
</script>
");

            builder.Append($@"
<link href=""{SiteFilesAssets.GetUrl(pageInfo.ApiUrl, SiteFilesAssets.Slide.Css)}"" rel=""stylesheet"" />
<script src=""{SiteFilesAssets.GetUrl(pageInfo.ApiUrl, SiteFilesAssets.Slide.Js)}"" type=""text/javascript"" charset=""gb2312""></script>
");

            builder.Append(StlCacheManager.FileContent.GetContentByFilePath(SiteFilesAssets.GetPath(SiteFilesAssets.Slide.Template), ECharset.utf_8));

            return(builder.ToString());
        }
Esempio n. 24
0
 private static string GetStoreItemUrl(PublishmentSystemInfo publishmentSystemInfo)
 {
     return(PageUtils.AddProtocolToUrl(SiteFilesAssets.GetUrl(publishmentSystemInfo.Additional.ApiUrl, "weixin/store/content.html")));
 }
Esempio n. 25
0
        private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, HtmlGenericControl genericControl, string channelIndex, string channelName, EScopeType scopeType, string groupChannel, string groupChannelNot, string groupContent, string groupContentNot, string tags, string orderByString, int startNum, int totalNum, bool isShowText, string isTopText, int titleWordNum, string where, bool isTop, bool isTopExists, bool isRecommend, bool isRecommendExists, bool isHot, bool isHotExists, bool isColor, bool isColorExists, string theme, int imageWidth, int imageHeight, int textHeight, string bgColor)
        {
            var parsedContent = string.Empty;

            var channelId = StlDataUtility.GetChannelIdByChannelIdOrChannelIndexOrChannelName(pageInfo.SiteId, contextInfo.ChannelId, channelIndex, channelName);

            var dataSource = StlDataUtility.GetContentsDataSource(pageInfo.SiteInfo, channelId, 0, groupContent, groupContentNot, tags, true, true, false, false, false, false, false, false, startNum, totalNum, orderByString, isTopExists, isTop, isRecommendExists, isRecommend, isHotExists, isHot, isColorExists, isColor, where, scopeType, groupChannel, groupChannelNot, null);

            if (dataSource != null)
            {
                if (StringUtils.EqualsIgnoreCase(theme, ThemeStyle2))
                {
                    pageInfo.AddPageBodyCodeIfNotExists(PageInfo.Const.JsAcSwfObject);

                    var imageUrls       = new StringCollection();
                    var navigationUrls  = new StringCollection();
                    var titleCollection = new StringCollection();

                    foreach (var dataItem in dataSource.Tables[0].Rows)
                    {
                        var contentInfo = new ContentInfo(dataItem);
                        var imageUrl    = contentInfo.GetString(BackgroundContentAttribute.ImageUrl);

                        if (!string.IsNullOrEmpty(imageUrl))
                        {
                            if (imageUrl.ToLower().EndsWith(".jpg") || imageUrl.ToLower().EndsWith(".jpeg") || imageUrl.ToLower().EndsWith(".png") || imageUrl.ToLower().EndsWith(".pneg"))
                            {
                                titleCollection.Add(StringUtils.ToJsString(PageUtils.UrlEncode(StringUtils.MaxLengthText(StringUtils.StripTags(contentInfo.Title), titleWordNum))));
                                navigationUrls.Add(PageUtils.UrlEncode(PageUtility.GetContentUrl(pageInfo.SiteInfo, contentInfo, pageInfo.IsLocal)));
                                imageUrls.Add(PageUtils.UrlEncode(PageUtility.ParseNavigationUrl(pageInfo.SiteInfo, imageUrl, pageInfo.IsLocal)));
                            }
                        }
                    }

                    //foreach (var dataItem in dataSource)
                    //{
                    //    var contentInfo = new BackgroundContentInfo(dataItem);
                    //    if (!string.IsNullOrEmpty(contentInfo?.ImageUrl))
                    //    {
                    //        if (contentInfo.ImageUrl.ToLower().EndsWith(".jpg") || contentInfo.ImageUrl.ToLower().EndsWith(".jpeg") || contentInfo.ImageUrl.ToLower().EndsWith(".png") || contentInfo.ImageUrl.ToLower().EndsWith(".pneg"))
                    //        {
                    //            titleCollection.Add(StringUtils.ToJsString(PageUtils.UrlEncode(StringUtils.MaxLengthText(StringUtils.StripTags(contentInfo.Title), titleWordNum))));
                    //            navigationUrls.Add(PageUtils.UrlEncode(PageUtility.GetContentUrl(pageInfo.SiteInfo, contentInfo)));
                    //            imageUrls.Add(PageUtils.UrlEncode(PageUtility.ParseNavigationUrl(pageInfo.SiteInfo, contentInfo.ImageUrl)));
                    //        }
                    //    }
                    //}

                    if (string.IsNullOrEmpty(bgColor))
                    {
                        bgColor = "0xDADADA";
                    }
                    else
                    {
                        bgColor = bgColor.TrimStart('#');
                        if (!bgColor.StartsWith("0x"))
                        {
                            bgColor = "0x" + bgColor;
                        }
                    }

                    if (string.IsNullOrEmpty(isTopText))
                    {
                        isTopText = "0";
                    }
                    else
                    {
                        isTopText = (TranslateUtils.ToBool(isTopText)) ? "0" : "1";
                    }

                    var uniqueId     = "FocusViewer_" + pageInfo.UniqueId;
                    var paramBuilder = new StringBuilder();
                    paramBuilder.Append(
                        $@"so_{uniqueId}.addParam(""quality"", ""high"");").Append(StringUtils.Constants.ReturnAndNewline);
                    paramBuilder.Append(
                        $@"so_{uniqueId}.addParam(""wmode"", ""transparent"");").Append(StringUtils.Constants.ReturnAndNewline);
                    paramBuilder.Append(
                        $@"so_{uniqueId}.addParam(""menu"", ""false"");").Append(StringUtils.Constants.ReturnAndNewline);
                    paramBuilder.Append(
                        $@"so_{uniqueId}.addParam(""FlashVars"", ""bcastr_file=""+files_uniqueID+""&bcastr_link=""+links_uniqueID+""&bcastr_title=""+texts_uniqueID+""&AutoPlayTime=5&TitleBgPosition={isTopText}&TitleBgColor={bgColor}&BtnDefaultColor={bgColor}"");").Append(StringUtils.Constants.ReturnAndNewline);

                    string scriptHtml = $@"
<div id=""flashcontent_{uniqueId}""></div>
<script type=""text/javascript"">
var files_uniqueID='{TranslateUtils.ObjectCollectionToString(imageUrls, "|")}';
var links_uniqueID='{TranslateUtils.ObjectCollectionToString(navigationUrls, "|")}';
var texts_uniqueID='{TranslateUtils.ObjectCollectionToString(titleCollection, "|")}';

var so_{uniqueId} = new SWFObject(""{SiteFilesAssets.GetUrl(pageInfo.ApiUrl, SiteFilesAssets.Flashes.Bcastr)}"", ""flash_{uniqueId}"", ""{imageWidth}"", ""{imageHeight}"", ""7"", """");
{paramBuilder}
so_{uniqueId}.write(""flashcontent_{uniqueId}"");
</script>
";
                    scriptHtml = scriptHtml.Replace("uniqueID", uniqueId);

                    parsedContent = scriptHtml;
                }
                else if (StringUtils.EqualsIgnoreCase(theme, ThemeStyle3))
                {
                    pageInfo.AddPageBodyCodeIfNotExists(PageInfo.Const.JsAcSwfObject);

                    var imageUrls       = new StringCollection();
                    var navigationUrls  = new StringCollection();
                    var titleCollection = new StringCollection();

                    foreach (var dataItem in dataSource.Tables[0].Rows)
                    {
                        var contentInfo = new ContentInfo(dataItem);
                        var imageUrl    = contentInfo.GetString(BackgroundContentAttribute.ImageUrl);

                        if (!string.IsNullOrEmpty(imageUrl))
                        {
                            if (imageUrl.ToLower().EndsWith(".jpg") || imageUrl.ToLower().EndsWith(".jpeg") || imageUrl.ToLower().EndsWith(".png") || imageUrl.ToLower().EndsWith(".pneg"))
                            {
                                titleCollection.Add(StringUtils.ToJsString(PageUtils.UrlEncode(StringUtils.MaxLengthText(StringUtils.StripTags(contentInfo.Title), titleWordNum))));
                                navigationUrls.Add(PageUtils.UrlEncode(PageUtility.GetContentUrl(pageInfo.SiteInfo, contentInfo, pageInfo.IsLocal)));
                                imageUrls.Add(PageUtils.UrlEncode(PageUtility.ParseNavigationUrl(pageInfo.SiteInfo, imageUrl, pageInfo.IsLocal)));
                            }
                        }
                    }

                    //foreach (var dataItem in dataSource)
                    //{
                    //    var contentInfo = new BackgroundContentInfo(dataItem);
                    //    if (!string.IsNullOrEmpty(contentInfo?.ImageUrl))
                    //    {
                    //        if (contentInfo.ImageUrl.ToLower().EndsWith(".jpg") || contentInfo.ImageUrl.ToLower().EndsWith(".jpeg") || contentInfo.ImageUrl.ToLower().EndsWith(".png") || contentInfo.ImageUrl.ToLower().EndsWith(".pneg"))
                    //        {
                    //            titleCollection.Add(StringUtils.ToJsString(PageUtils.UrlEncode(StringUtils.MaxLengthText(StringUtils.StripTags(contentInfo.Title), titleWordNum))));
                    //            navigationUrls.Add(PageUtils.UrlEncode(PageUtility.GetContentUrl(pageInfo.SiteInfo, contentInfo)));
                    //            imageUrls.Add(PageUtils.UrlEncode(PageUtility.ParseNavigationUrl(pageInfo.SiteInfo, contentInfo.ImageUrl)));
                    //        }
                    //    }
                    //}

                    var uniqueId     = "FocusViewer_" + pageInfo.UniqueId;
                    var paramBuilder = new StringBuilder();
                    paramBuilder.Append($@"so_{uniqueId}.addParam(""quality"", ""high"");").Append(StringUtils.Constants.ReturnAndNewline);
                    paramBuilder.Append($@"so_{uniqueId}.addParam(""wmode"", ""transparent"");").Append(StringUtils.Constants.ReturnAndNewline);
                    paramBuilder.Append($@"so_{uniqueId}.addParam(""allowFullScreen"", ""true"");").Append(StringUtils.Constants.ReturnAndNewline);
                    paramBuilder.Append($@"so_{uniqueId}.addParam(""allowScriptAccess"", ""always"");").Append(StringUtils.Constants.ReturnAndNewline);
                    paramBuilder.Append($@"so_{uniqueId}.addParam(""menu"", ""false"");").Append(StringUtils.Constants.ReturnAndNewline);
                    paramBuilder.Append(
                        $@"so_{uniqueId}.addParam(""flashvars"", ""pw={imageWidth}&ph={imageHeight}&Times=4000&sizes=14&umcolor=16777215&btnbg=12189697&txtcolor=16777215&urls=""+urls_uniqueID+""&imgs=""+imgs_uniqueID+""&titles=""+titles_uniqueID);").Append(StringUtils.Constants.ReturnAndNewline);

                    string scriptHtml = $@"
<div id=""flashcontent_{uniqueId}""></div>
<script type=""text/javascript"">
var urls_uniqueID='{TranslateUtils.ObjectCollectionToString(navigationUrls, "|")}';
var imgs_uniqueID='{TranslateUtils.ObjectCollectionToString(imageUrls, "|")}';
var titles_uniqueID='{TranslateUtils.ObjectCollectionToString(titleCollection, "|")}';

var so_{uniqueId} = new SWFObject(""{SiteFilesAssets.GetUrl(pageInfo.ApiUrl, SiteFilesAssets.Flashes.Ali)}"", ""flash_{uniqueId}"", ""{imageWidth}"", ""{imageHeight}"", ""7"", """");
{paramBuilder}
so_{uniqueId}.write(""flashcontent_{uniqueId}"");
</script>
";
                    scriptHtml = scriptHtml.Replace("uniqueID", uniqueId);

                    parsedContent = scriptHtml;
                }
                else if (StringUtils.EqualsIgnoreCase(theme, ThemeStyle4))
                {
                    var imageUrls      = new StringCollection();
                    var navigationUrls = new StringCollection();

                    foreach (var dataItem in dataSource.Tables[0].Rows)
                    {
                        var contentInfo = new ContentInfo(dataItem);
                        var imageUrl    = contentInfo.GetString(BackgroundContentAttribute.ImageUrl);

                        if (!string.IsNullOrEmpty(imageUrl))
                        {
                            navigationUrls.Add(PageUtility.GetContentUrl(pageInfo.SiteInfo, contentInfo, pageInfo.IsLocal));
                            imageUrls.Add(PageUtility.ParseNavigationUrl(pageInfo.SiteInfo, imageUrl, pageInfo.IsLocal));
                        }
                    }

                    //foreach (var dataItem in dataSource)
                    //{
                    //    var contentInfo = new BackgroundContentInfo(dataItem);
                    //    if (!string.IsNullOrEmpty(contentInfo?.ImageUrl))
                    //    {
                    //        navigationUrls.Add(PageUtility.GetContentUrl(pageInfo.SiteInfo, contentInfo));
                    //        imageUrls.Add(PageUtility.ParseNavigationUrl(pageInfo.SiteInfo, contentInfo.ImageUrl));
                    //    }
                    //}

                    var imageBuilder = new StringBuilder();
                    var numBuilder   = new StringBuilder();

                    imageBuilder.Append($@"
<div style=""display:block""><a href=""{navigationUrls[0]}"" target=""_blank""><img src=""{imageUrls[0]}"" width=""{imageWidth}"" height=""{imageHeight}"" border=""0"" onMouseOver=""fv_clearAuto();"" onMouseOut=""fv_setAuto()"" /></a></div>
");

                    if (navigationUrls.Count > 1)
                    {
                        for (var i = 1; i < navigationUrls.Count; i++)
                        {
                            imageBuilder.Append($@"
<div style=""display:none""><a href=""{navigationUrls[i]}"" target=""_blank""><img src=""{imageUrls[i]}"" width=""{imageWidth}"" height=""{imageHeight}"" border=""0"" onMouseOver=""fv_clearAuto();"" onMouseOut=""fv_setAuto()"" /></a></div>
");
                        }
                    }

                    numBuilder.Append(@"
<td width=""18"" height=""16"" class=""fv_bigon"" onmouseover=""fv_clearAuto();fv_Mea(0);"" onmouseout=""fv_setAuto()"">1</td>
");

                    if (navigationUrls.Count > 1)
                    {
                        for (var i = 1; i < navigationUrls.Count; i++)
                        {
                            numBuilder.Append($@"
<td width=""18"" class=""fv_bigoff"" onmouseover=""fv_clearAuto();fv_Mea({i});"" onmouseout=""fv_setAuto()"">{i + 1}</td>
");
                        }
                    }

                    var bgUrl = PageUtility.ParseNavigationUrl(pageInfo.SiteInfo,
                                                               "@/images/focusviewerbg.png", pageInfo.IsLocal);
                    string scriptHtml = $@"
<style type=""text/css"">
.fv_adnum{{ position:absolute; z-index:1005; width:{imageWidth - 24}px; height:24px; padding:5px 3px 0 0; left:21px; top:{imageHeight -
                                                                                                                                                                                                  29}px; }}
.fv_bigon{{ background:#E59948; font-family:Arial; color:#fff; font-size:12px; text-align:center; cursor:pointer}}
.fv_bigoff{{ background:#7DCABD; font-family:Arial; color:#fff; font-size:12px; text-align:center; cursor:pointer}}
</style>
<div style=""position:relative; left:0; top:0; width:{imageWidth}px; height:{imageHeight}px; background:#000"">
	<div id=""fv_filbox"" style=""position:absolute; z-index:999; left:0; top:0; width:{imageWidth}px; height:{imageHeight}px; filter:progid:DXImageTransform.Microsoft.Fade( duration=0.5,overlap=1.0 );"">
		{imageBuilder}
    </div>
    <div class=""fv_adnum"" style=""background:url({bgUrl}) no-repeat !important; background:none ;filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, src='{bgUrl}')""></div>
    <div class=""fv_adnum"">
        <table border=""0"" cellspacing=""1"" cellpadding=""0"" align=""right"" id=""fv_num"">
          <tr>
            {numBuilder}
          </tr>
        </table>
    </div>
</div>
<script language=""javascript""> 
    var fv_n=0;
    var fv_nums={navigationUrls.Count};
    var fv_showNum = document.getElementById(""fv_num"");
    var is_IE=(navigator.appName==""Microsoft Internet Explorer"");
    function fv_Mea(value){{
        fv_n=value;
        for(var i=0;i<fv_nums;i++)
            if(value==i){{
                fv_showNum.getElementsByTagName(""td"")[i].setAttribute('className', 'fv_bigon');
                fv_showNum.getElementsByTagName(""td"")[i].setAttribute('class', 'fv_bigon');
            }}
            else{{	
                fv_showNum.getElementsByTagName(""td"")[i].setAttribute('className', 'fv_bigoff');
                fv_showNum.getElementsByTagName(""td"")[i].setAttribute('class', 'fv_bigoff');
            }}
        var divs = document.getElementById(""fv_filbox"").getElementsByTagName(""div""); 
		if (is_IE){{
            document.getElementById(""fv_filbox"").filters[0].Apply();
		}}
		for(i=0;i<fv_nums;i++)i==value?divs[i].style.display=""block"":divs[i].style.display=""none"";
		if (is_IE){{
			document.getElementById(""fv_filbox"").filters[0].play();
		}}
    }}
    function fv_clearAuto(){{clearInterval(autoStart)}}
    function fv_setAuto(){{autoStart=setInterval(""auto(fv_n)"", 5000)}}
    function auto(){{
        fv_n++;
        if(fv_n>(fv_nums-1))fv_n=0;
        fv_Mea(fv_n);
    }}
    fv_setAuto(); 
</script>
";

                    parsedContent = scriptHtml.Replace("fv_", $"fv{pageInfo.UniqueId}_");
                }
                else
                {
                    var imageUrls       = new StringCollection();
                    var navigationUrls  = new StringCollection();
                    var titleCollection = new StringCollection();

                    foreach (var dataItem in dataSource.Tables[0].Rows)
                    {
                        var contentInfo = new ContentInfo(dataItem);
                        var imageUrl    = contentInfo.GetString(BackgroundContentAttribute.ImageUrl);

                        if (!string.IsNullOrEmpty(imageUrl))
                        {
                            //这里使用png图片不管用
                            //||contentInfo.ImageUrl.ToLower().EndsWith(".png")||contentInfo.ImageUrl.ToLower().EndsWith(".pneg")
                            if (imageUrl.ToLower().EndsWith(".jpg") || imageUrl.ToLower().EndsWith(".jpeg"))
                            {
                                titleCollection.Add(StringUtils.ToJsString(PageUtils.UrlEncode(StringUtils.MaxLengthText(StringUtils.StripTags(contentInfo.Title), titleWordNum))));
                                navigationUrls.Add(PageUtils.UrlEncode(PageUtility.GetContentUrl(pageInfo.SiteInfo, contentInfo, pageInfo.IsLocal)));
                                imageUrls.Add(PageUtils.UrlEncode(PageUtility.ParseNavigationUrl(pageInfo.SiteInfo, imageUrl, pageInfo.IsLocal)));
                            }
                        }
                    }

                    //foreach (var dataItem in dataSource)
                    //{
                    //    var contentInfo = new BackgroundContentInfo(dataItem);
                    //    if (!string.IsNullOrEmpty(contentInfo?.ImageUrl))
                    //    {
                    //        //这里使用png图片不管用
                    //        //||contentInfo.ImageUrl.ToLower().EndsWith(".png")||contentInfo.ImageUrl.ToLower().EndsWith(".pneg")
                    //        if (contentInfo.ImageUrl.ToLower().EndsWith(".jpg") || contentInfo.ImageUrl.ToLower().EndsWith(".jpeg"))
                    //        {
                    //            titleCollection.Add(StringUtils.ToJsString(PageUtils.UrlEncode(StringUtils.MaxLengthText(StringUtils.StripTags(contentInfo.Title), titleWordNum))));
                    //            navigationUrls.Add(PageUtils.UrlEncode(PageUtility.GetContentUrl(pageInfo.SiteInfo, contentInfo)));
                    //            imageUrls.Add(PageUtils.UrlEncode(PageUtility.ParseNavigationUrl(pageInfo.SiteInfo, contentInfo.ImageUrl)));
                    //        }
                    //    }
                    //}

                    if (string.IsNullOrEmpty(bgColor))
                    {
                        bgColor = "#DADADA";
                    }
                    var titles = string.Empty;
                    if (isShowText == false)
                    {
                        textHeight = 0;
                    }
                    else
                    {
                        titles = TranslateUtils.ObjectCollectionToString(titleCollection, "|");
                    }
                    var uniqueId = "FocusViewer_" + pageInfo.UniqueId;
                    genericControl.ID        = uniqueId;
                    genericControl.InnerHtml = "&nbsp;";
                    var    divHtml    = ControlUtils.GetControlRenderHtml(genericControl);
                    string scriptHtml = $@"
<script type=""text/javascript"" src=""{SiteFilesAssets.GetUrl(pageInfo.ApiUrl, SiteFilesAssets.BaiRongFlash.Js)}""></script>
<SCRIPT language=javascript type=""text/javascript"">
	<!--
	
	var uniqueID_focus_width={imageWidth}
	var uniqueID_focus_height={imageHeight}
	var uniqueID_text_height={textHeight}
	var uniqueID_swf_height = uniqueID_focus_height + uniqueID_text_height
	
	var uniqueID_pics='{TranslateUtils.ObjectCollectionToString(imageUrls, "|")}'
	var uniqueID_links='{TranslateUtils.ObjectCollectionToString(navigationUrls, "|")}'
	var uniqueID_texts='{titles}'
	
	var uniqueID_FocusFlash = new bairongFlash(""{SiteFilesAssets.GetUrl(pageInfo.ApiUrl, SiteFilesAssets.Flashes.FocusViewer)}"", ""focusflash"", uniqueID_focus_width, uniqueID_swf_height, ""7"", ""{bgColor}"", false, ""High"");
	uniqueID_FocusFlash.addParam(""allowScriptAccess"", ""sameDomain"");
	uniqueID_FocusFlash.addParam(""menu"", ""false"");
	uniqueID_FocusFlash.addParam(""wmode"", ""transparent"");

	uniqueID_FocusFlash.addVariable(""pics"", uniqueID_pics);
	uniqueID_FocusFlash.addVariable(""links"", uniqueID_links);
	uniqueID_FocusFlash.addVariable(""texts"", uniqueID_texts);
	uniqueID_FocusFlash.addVariable(""borderwidth"", uniqueID_focus_width);
	uniqueID_FocusFlash.addVariable(""borderheight"", uniqueID_focus_height);
	uniqueID_FocusFlash.addVariable(""textheight"", uniqueID_text_height);
	uniqueID_FocusFlash.write(""uniqueID"");
	
	//-->
</SCRIPT>
";
                    scriptHtml = scriptHtml.Replace("uniqueID", uniqueId);

                    parsedContent = divHtml + scriptHtml;
                }
            }

            return(parsedContent);
        }
Esempio n. 26
0
        private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, HtmlAnchor stlAnchor, string titleId, string bodyId, string logoId, string locationId)
        {
            var jsUrl = SiteFilesAssets.GetUrl(pageInfo.ApiUrl, pageInfo.TemplateInfo.Charset == ECharset.gb2312 ? SiteFilesAssets.Print.JsGb2312 : SiteFilesAssets.Print.JsUtf8);

            var iconUrl = SiteFilesAssets.GetUrl(pageInfo.ApiUrl, SiteFilesAssets.Print.IconUrl);

            if (!pageInfo.BodyCodes.ContainsKey(PageInfo.Const.JsAfStlPrinter))
            {
                pageInfo.BodyCodes.Add(PageInfo.Const.JsAfStlPrinter, $@"
<script language=""JavaScript"" type=""text/javascript"">
function stlLoadPrintJsCallBack()
{{
    if(typeof forSPrint == ""object"" && forSPrint.Print)
    {{
        forSPrint.data.titleId = ""{titleId}"";
        forSPrint.data.artiBodyId = ""{bodyId}"";
        forSPrint.data.pageLogoId = ""{logoId}"";
        forSPrint.data.pageWayId = ""{locationId}"";
        forSPrint.data.iconUrl = ""{iconUrl}"";
        forSPrint.Print();
    }}
}}

function stlPrintGetBrowser()
{{
    if (navigator.userAgent.indexOf(""MSIE"") != -1)
    {{
        return 1; 
    }}
    else if (navigator.userAgent.indexOf(""Firefox"") != -1)
    {{
        return 2; 
    }}
    else if (navigator.userAgent.indexOf(""Navigator"") != -1)
    {{
        return 3;
    }}
    else if (navigator.userAgent.indexOf(""Opera"") != -1 )
    {{
        return 4;
    }}
    else
    {{
        return 5;
    }}
}}

function stlLoadPrintJs()
{{
    var myBrowser = stlPrintGetBrowser();
    if(myBrowser == 1)
    {{
        var js_url = ""{jsUrl}"";
        var js = document.createElement( ""script"" ); 
        js.setAttribute( ""type"", ""text/javascript"" );
        js.setAttribute( ""src"", js_url);
        js.setAttribute( ""id"", ""printJsUrl"");
        document.body.insertBefore( js, null);
        document.getElementById(""printJsUrl"").onreadystatechange = stlLoadPrintJsCallBack;
    }}
    else
    {{
        var js_url = ""{jsUrl}"";
        var js = document.createElement( ""script"" ); 
        js.setAttribute( ""type"", ""text/javascript"" );
        js.setAttribute( ""src"", js_url);
        js.setAttribute( ""id"", ""printJsUrl"");
        js.setAttribute( ""onload"", ""stlLoadPrintJsCallBack()"");
        document.body.insertBefore( js, null);					
    }}
}}	
</script>
");
            }

            if (string.IsNullOrEmpty(contextInfo.InnerXml))
            {
                stlAnchor.InnerHtml = "打印";
            }
            else
            {
                var innerBuilder = new StringBuilder(contextInfo.InnerXml);
                StlParserManager.ParseInnerContent(innerBuilder, pageInfo, contextInfo);
                stlAnchor.InnerHtml = innerBuilder.ToString();
            }
            stlAnchor.Attributes["href"] = "javascript:stlLoadPrintJs();";

            var parsedContent = ControlUtils.GetControlRenderHtml(stlAnchor);

            return(parsedContent);
        }
Esempio n. 27
0
 private static string GetCardUrl(PublishmentSystemInfo publishmentSystemInfo)
 {
     return(PageUtils.AddProtocolToUrl(SiteFilesAssets.GetUrl(publishmentSystemInfo.Additional.ApiUrl, "weixin/card/index.html")));
 }
Esempio n. 28
0
            public static string GetNodeTreeScript(PageInfo pageInfo)
            {
                var script              = @"
<script language=""JavaScript"">
function stltree_isNull(obj){
	if (typeof(obj) == 'undefined')
	  return true;
	  
	if (obj == undefined)
	  return true;
	  
	if (obj == null)
	  return true;
	 
	return false;
}

//取得Tree的级别,1为第一级
function stltree_getTreeLevel(e) {
	var length = 0;
	if (!stltree_isNull(e)){
		if (e.tagName == 'TR') {
			length = parseInt(e.getAttribute('treeItemLevel'));
		}
	}
	return length;
}

function stltree_closeAllFolder(){
	if (stltree_isNodeTree){
		var imgCol = document.getElementsByTagName('IMG');
		if (!stltree_isNull(imgCol)){
			for (x=0;x<imgCol.length;x++){
				if (!stltree_isNull(imgCol.item(x).getAttribute('src'))){
					if (imgCol.item(x).getAttribute('src') == '{iconOpenedFolderUrl}'){
						imgCol.item(x).setAttribute('src', '{iconFolderUrl}');
					}
				}
			}
		}
	}

	var aCol = document.getElementsByTagName('A');
	if (!stltree_isNull(aCol)){
		for (x=0;x<aCol.length;x++){
			if (aCol.item(x).getAttribute('isTreeLink') == 'true'){
				aCol.item(x).style.fontWeight = 'normal';
			}
		}
	}
}

function stltree_openFolderByA(element){
	stltree_closeAllFolder();
	if (stltree_isNull(element) || element.tagName != 'A') return;

	element.style.fontWeight = 'bold';

	if (stltree_isNodeTree){
		for (element = element.previousSibling;;){
			if (element != null && element.tagName == 'A'){
				element = element.firstChild;
			}
			if (element != null && element.tagName == 'IMG'){
				if (element.getAttribute('src') == '{iconFolderUrl}') break;
				break;
			}else{
				element = element.previousSibling;
			} 
		}
		if (!stltree_isNull(element)){
			element.setAttribute('src', '{iconOpenedFolderUrl}');
		}
	}
}

function stltree_getTrElement(element){
	if (stltree_isNull(element)) return;
	for (element = element.parentNode;;){
		if (element != null && element.tagName == 'TR'){
			break;
		}else{
			element = element.parentNode;
		} 
	}
	return element;
}

function stltree_getImgClickableElementByTr(element){
	if (stltree_isNull(element) || element.tagName != 'TR') return;
	var img = null;
	if (!stltree_isNull(element.childNodes)){
		var imgCol = element.getElementsByTagName('IMG');
		if (!stltree_isNull(imgCol)){
			for (x=0;x<imgCol.length;x++){
				if (!stltree_isNull(imgCol.item(x).getAttribute('isOpen'))){
					img = imgCol.item(x);
					break;
				}
			}
		}
	}
	return img;
}

//显示、隐藏下级目录
function stltree_displayChildren(element){
	if (stltree_isNull(element)) return;

	var tr = stltree_getTrElement(element);

	var img = stltree_getImgClickableElementByTr(tr);//需要变换的加减图标

	if (!stltree_isNull(img) && img.getAttribute('isOpen') != null){
		if (img.getAttribute('isOpen') == 'false'){
			img.setAttribute('isOpen', 'true');
            var iconMinusUrl = img.getAttribute('src').replace('plus','minus');
            img.setAttribute('src', iconMinusUrl);
		}else{
            img.setAttribute('isOpen', 'false');
            var iconPlusUrl = img.getAttribute('src').replace('minus','plus');
            img.setAttribute('src', iconPlusUrl);
		}
	}

	var level = stltree_getTreeLevel(tr);//点击项菜单的级别
	
	var collection = new Array();
	var index = 0;

	for ( var e = tr.nextSibling; !stltree_isNull(e) ; e = e.nextSibling) {
		if (!stltree_isNull(e) && !stltree_isNull(e.tagName) && e.tagName == 'TR'){
		    var currentLevel = stltree_getTreeLevel(e);
		    if (currentLevel <= level) break;
		    if(e.style.display == '') {
			    e.style.display = 'none';
		    }else{//展开
			    if (currentLevel != level + 1) continue;
			    e.style.display = '';
			    var imgClickable = stltree_getImgClickableElementByTr(e);
			    if (!stltree_isNull(imgClickable)){
				    if (!stltree_isNull(imgClickable.getAttribute('isOpen')) && imgClickable.getAttribute('isOpen') =='true'){
					    imgClickable.setAttribute('isOpen', 'false');
                        var iconPlusUrl = imgClickable.getAttribute('src').replace('minus','plus');
                        imgClickable.setAttribute('src', iconPlusUrl);
					    collection[index] = imgClickable;
					    index++;
				    }
			    }
		    }
        }
	}
	
	if (index > 0){
		for (i=0;i<=index;i++){
			stltree_displayChildren(collection[i]);
		}
	}
}
var stltree_isNodeTree = {isNodeTree};
</script>
";
                var treeDirectoryUrl    = SiteFilesAssets.GetUrl(pageInfo.ApiUrl, "tree");
                var iconFolderUrl       = PageUtils.Combine(treeDirectoryUrl, "folder.gif");
                var iconOpenedFolderUrl = PageUtils.Combine(treeDirectoryUrl, "openedfolder.gif");
                var iconMinusUrl        = PageUtils.Combine(treeDirectoryUrl, "minus.png");
                var iconPlusUrl         = PageUtils.Combine(treeDirectoryUrl, "plus.png");

                script = script.Replace("{iconFolderUrl}", iconFolderUrl);
                script = script.Replace("{iconMinusUrl}", iconMinusUrl);
                script = script.Replace("{iconOpenedFolderUrl}", iconOpenedFolderUrl);
                script = script.Replace("{iconPlusUrl}", iconPlusUrl);
                script = script.Replace("{isNodeTree}", "true");
                return(script);
            }
Esempio n. 29
0
        private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, string type, string playUrl, bool isAutoPlay, bool isPreLoad, bool isLoop)
        {
            var 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(playUrl))
            {
                return(string.Empty);
            }

            playUrl = PageUtility.ParseNavigationUrl(pageInfo.SiteInfo, playUrl, pageInfo.IsLocal);

            // 如果是实体标签,则只返回数字
            if (contextInfo.IsStlEntity)
            {
                return(playUrl);
            }
            else
            {
                pageInfo.AddPageBodyCodeIfNotExists(PageInfo.Const.Jquery);
                pageInfo.AddPageBodyCodeIfNotExists(PageInfo.Const.JsAcMediaElement);

                return($@"
<audio src=""{playUrl}"" {(isAutoPlay ? "autoplay" : string.Empty)} {(isPreLoad ? string.Empty : @"preload=""none""")} {(isLoop ? "loop" : string.Empty)}>
    <object width=""460"" height=""40"" type=""application/x-shockwave-flash"" data=""{SiteFilesAssets.GetUrl(pageInfo.ApiUrl, SiteFilesAssets.MediaElement.Swf)}"">
        <param name=""movie"" value=""{SiteFilesAssets.GetUrl(pageInfo.ApiUrl, SiteFilesAssets.MediaElement.Swf)}"" />
        <param name=""flashvars"" value=""controls=true&file={playUrl}"" />
    </object>
</audio>
<script>$('audio').mediaelementplayer();</script>
");
            }
        }
Esempio n. 30
0
 public static string GetCouponUrl(PublishmentSystemInfo publishmentSystemInfo)
 {
     return(PageUtils.AddProtocolToUrl(SiteFilesAssets.GetUrl(publishmentSystemInfo.Additional.ApiUrl, "weixin/coupon/application.html")));
 }