Skip to content

Commit 0d06926

Browse files
author
starlying
committed
Merge branch 'dev' of https://github.com/siteserver/cms into dev
2 parents 60ab2f9 + 958af93 commit 0d06926

18 files changed

+165
-75
lines changed

source/SiteServer.CMS/StlParser/StlElement/StlA.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -220,25 +220,25 @@ private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, Html
220220

221221
stlAnchor.HRef = url;
222222

223+
if (!string.IsNullOrEmpty(onclick))
224+
{
225+
stlAnchor.Attributes.Add("onclick", onclick);
226+
}
227+
228+
if (removeTarget)
229+
{
230+
stlAnchor.Target = string.Empty;
231+
}
232+
223233
// 如果是实体标签,则只返回url
224-
if(contextInfo.IsCurlyBrace)
234+
if (contextInfo.IsCurlyBrace)
225235
{
226236
return stlAnchor.HRef;
227237
}
228238
else
229239
{
230-
if (!string.IsNullOrEmpty(onclick))
231-
{
232-
stlAnchor.Attributes.Add("onclick", onclick);
233-
}
234-
235-
if (removeTarget)
236-
{
237-
stlAnchor.Target = string.Empty;
238-
}
239-
240240
return ControlUtils.GetControlRenderHtml(stlAnchor);
241-
}
241+
}
242242
}
243243
}
244244
}

source/SiteServer.CMS/StlParser/StlElement/StlAction.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,15 @@ function SetHomepage(){{
226226
stlAnchor.Attributes.Add("onclick", onclick);
227227
}
228228

229-
return ControlUtils.GetControlRenderHtml(stlAnchor);
229+
// 如果是实体标签,则只返回url
230+
if (contextInfo.IsCurlyBrace)
231+
{
232+
return stlAnchor.HRef;
233+
}
234+
else
235+
{
236+
return ControlUtils.GetControlRenderHtml(stlAnchor);
237+
}
230238
}
231239
}
232240
}

source/SiteServer.CMS/StlParser/StlElement/StlAd.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,15 @@ public static string Parse(PageInfo pageInfo, ContextInfo contextInfo)
7373
}
7474
}
7575

76-
return parsedContent;
76+
// 如果是实体标签,返回empty
77+
if (contextInfo.IsCurlyBrace)
78+
{
79+
return string.Empty;
80+
}
81+
else
82+
{
83+
return parsedContent;
84+
}
7785
}
7886
}
7987
}

source/SiteServer.CMS/StlParser/StlElement/StlAnalysis.cs

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,10 @@ private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, bool
140140
}
141141
}
142142

143-
return GetAnalysisValue(pageInfo, channelId, contentId, ETemplateTypeUtils.GetValue(templateType), type, scope, isAverage, style, addNum, since, string.Empty);
143+
return GetAnalysisValue(pageInfo, contextInfo, channelId, contentId, ETemplateTypeUtils.GetValue(templateType), type, scope, isAverage, style, addNum, since, string.Empty);
144144
}
145145

146-
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)
146+
private static string GetAnalysisValue(PageInfo pageInfo, ContextInfo contextInfo, int channelId, int contentId, string templateType, string type, string scope, bool isAverage, string style, int addNum, string since, string referrer)
147147
{
148148
var publishmentSystemInfo = pageInfo.PublishmentSystemInfo;
149149
if (publishmentSystemInfo == null) return string.Empty;
@@ -225,24 +225,32 @@ private static string GetAnalysisValue(PageInfo pageInfo, int channelId, int con
225225
accessNum = accessNum + addNum;
226226
if (accessNum == 0) accessNum = 1;
227227

228-
if (eStyle == ETrackerStyle.Number)
228+
// 如果是实体标签,则只返回数字
229+
if (contextInfo.IsCurlyBrace)
229230
{
230-
html = accessNum.ToString();
231+
return accessNum.ToString();
231232
}
232233
else
233234
{
234-
var numString = accessNum.ToString();
235-
var htmlBuilder = new StringBuilder();
236-
string imgFolder = $"{SiteFilesAssets.GetUrl(pageInfo.ApiUrl, SiteFilesAssets.Tracker.DirectoryName)}/{ETrackerStyleUtils.GetValue(eStyle)}";
237-
foreach (var t in numString)
235+
if (eStyle == ETrackerStyle.Number)
238236
{
239-
string imgHtml = $"<img src='{imgFolder}/{t}.gif' align=absmiddle border=0>";
240-
htmlBuilder.Append(imgHtml);
237+
html = accessNum.ToString();
238+
}
239+
else
240+
{
241+
var numString = accessNum.ToString();
242+
var htmlBuilder = new StringBuilder();
243+
string imgFolder = $"{SiteFilesAssets.GetUrl(pageInfo.ApiUrl, SiteFilesAssets.Tracker.DirectoryName)}/{ETrackerStyleUtils.GetValue(eStyle)}";
244+
foreach (var t in numString)
245+
{
246+
string imgHtml = $"<img src='{imgFolder}/{t}.gif' align=absmiddle border=0>";
247+
htmlBuilder.Append(imgHtml);
248+
}
249+
html = htmlBuilder.ToString();
241250
}
242-
html = htmlBuilder.ToString();
243-
}
244251

245-
return html;
252+
return html;
253+
}
246254
}
247255
}
248256
}

source/SiteServer.CMS/StlParser/StlElement/StlAudio.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,17 @@ private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, stri
113113

114114
playUrl = PageUtility.ParseNavigationUrl(pageInfo.PublishmentSystemInfo, playUrl);
115115

116-
pageInfo.AddPageScriptsIfNotExists(PageInfo.Components.Jquery);
117-
pageInfo.AddPageScriptsIfNotExists(PageInfo.JsAcMediaElement);
116+
// 如果是实体标签,则只返回数字
117+
if (contextInfo.IsCurlyBrace)
118+
{
119+
return playUrl;
120+
}
121+
else
122+
{
123+
pageInfo.AddPageScriptsIfNotExists(PageInfo.Components.Jquery);
124+
pageInfo.AddPageScriptsIfNotExists(PageInfo.JsAcMediaElement);
118125

119-
return $@"
126+
return $@"
120127
<audio src=""{playUrl}"" {(isAutoPlay ? "autoplay" : string.Empty)} {(isPreLoad ? string.Empty : @"preload=""none""")} {(isLoop ? "loop" : string.Empty)}>
121128
<object width=""460"" height=""40"" type=""application/x-shockwave-flash"" data=""{SiteFilesAssets.GetUrl(pageInfo.ApiUrl, SiteFilesAssets.MediaElement.Swf)}"">
122129
<param name=""movie"" value=""{SiteFilesAssets.GetUrl(pageInfo.ApiUrl, SiteFilesAssets.MediaElement.Swf)}"" />
@@ -125,6 +132,7 @@ private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, stri
125132
</audio>
126133
<script>$('audio').mediaelementplayer();</script>
127134
";
135+
}
128136
}
129-
}
137+
}
130138
}

source/SiteServer.CMS/StlParser/StlElement/StlChannel.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,8 @@ private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, stri
285285
parsedContent = DateUtils.Format(channel.AddDate, formatString);
286286
}
287287
else if (type.ToLower().Equals(NodeAttribute.ImageUrl.ToLower()))
288-
{
289-
parsedContent = InputParserUtility.GetImageOrFlashHtml(pageInfo.PublishmentSystemInfo, channel.ImageUrl, contextInfo.Attributes, false);
288+
{
289+
parsedContent = InputParserUtility.GetImageOrFlashHtml(pageInfo.PublishmentSystemInfo, channel.ImageUrl, contextInfo.Attributes, contextInfo.IsCurlyBrace); // contextInfo.IsCurlyBrace = true 表示实体标签
290290
}
291291
else if (type.ToLower().Equals(NodeAttribute.Id.ToLower()))
292292
{
@@ -306,8 +306,7 @@ private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, stri
306306
parsedContent = channel.ContentNum.ToString();
307307
}
308308
else if (type.ToLower().Equals(NodeAttribute.CountOfImageContents.ToLower()))
309-
{
310-
//var count = DataProvider.BackgroundContentDao.GetCountCheckedImage(pageInfo.PublishmentSystemId, channel.NodeId);
309+
{
311310
var count = Content.GetCountCheckedImage(pageInfo.PublishmentSystemId, channel.NodeId, pageInfo.Guid);
312311
parsedContent = count.ToString();
313312
}

source/SiteServer.CMS/StlParser/StlElement/StlChannels.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ public class StlChannels
7878

7979
public static string Parse(PageInfo pageInfo, ContextInfo contextInfo)
8080
{
81+
// 如果是实体标签则返回空
82+
if(contextInfo.IsCurlyBrace)
83+
{
84+
return string.Empty;
85+
}
8186
var listInfo = ListInfo.GetListInfoByXmlNode(pageInfo, contextInfo, EContextType.Channel);
8287

8388
return ParseImpl(pageInfo, contextInfo, listInfo);

source/SiteServer.CMS/StlParser/StlElement/StlComment.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,15 @@ private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, stri
176176
}
177177
else if (StringUtils.EqualsIgnoreCase(type, TypeGoodCount))
178178
{
179-
parsedContent = $"<span id='commentsDigg_{commentId}_{true}'>{goodCount}</span>";
179+
// 实体标签的话只返回数值
180+
if (contextInfo.IsCurlyBrace)
181+
{
182+
parsedContent = goodCount.ToString();
183+
}
184+
else
185+
{
186+
parsedContent = $"<span id='commentsDigg_{commentId}_{true}'>{goodCount}</span>";
187+
}
180188
}
181189
else if (StringUtils.EqualsIgnoreCase(type, TypeContent))
182190
{

source/SiteServer.CMS/StlParser/StlElement/StlCommentInput.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ public static string Parse(PageInfo pageInfo, ContextInfo contextInfo)
2525
var pageNum = 10;
2626
var isAnonymous = true;
2727

28+
// 实体标签的话不解析
29+
if(contextInfo.IsCurlyBrace)
30+
{
31+
return string.Empty;
32+
}
33+
2834
foreach (var name in contextInfo.Attributes.Keys)
2935
{
3036
var value = contextInfo.Attributes[name];

source/SiteServer.CMS/StlParser/StlElement/StlComments.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ public class StlComments
5555

5656
public static string Parse(PageInfo pageInfo, ContextInfo contextInfo)
5757
{
58+
// 如果是实体标签则返回空
59+
if (contextInfo.IsCurlyBrace)
60+
{
61+
return string.Empty;
62+
}
63+
5864
var listInfo = ListInfo.GetListInfoByXmlNode(pageInfo, contextInfo, EContextType.Comment);
5965

6066
return ParseImpl(pageInfo, contextInfo, listInfo);

source/SiteServer.CMS/StlParser/StlElement/StlContainer.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,16 @@ private StlContainer() { }
2121

2222
public static string Parse(PageInfo pageInfo, ContextInfo contextInfo)
2323
{
24-
if (string.IsNullOrEmpty(contextInfo.InnerXml)) return string.Empty;
24+
// 如果是实体标签则返回空
25+
if (contextInfo.IsCurlyBrace)
26+
{
27+
return string.Empty;
28+
}
29+
30+
if (string.IsNullOrEmpty(contextInfo.InnerXml))
31+
{
32+
return string.Empty;
33+
}
2534

2635
foreach (var name in contextInfo.Attributes.Keys)
2736
{

source/SiteServer.CMS/StlParser/StlElement/StlContent.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, stri
463463
{
464464
var sbParsedContent = new StringBuilder();
465465
//第一条
466-
sbParsedContent.Append(InputParserUtility.GetVideoHtml(pageInfo.PublishmentSystemInfo, contentInfo.GetExtendedAttribute(BackgroundContentAttribute.VideoUrl), contextInfo.Attributes, false));
466+
sbParsedContent.Append(InputParserUtility.GetVideoHtml(pageInfo.PublishmentSystemInfo, contentInfo.GetExtendedAttribute(BackgroundContentAttribute.VideoUrl), contextInfo.Attributes, contextInfo.IsCurlyBrace));
467467

468468
//第n条
469469
var extendAttributeName = ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.VideoUrl);
@@ -473,7 +473,7 @@ private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, stri
473473
foreach (string extendValue in TranslateUtils.StringCollectionToStringList(extendValues))
474474
{
475475

476-
sbParsedContent.Append(InputParserUtility.GetVideoHtml(pageInfo.PublishmentSystemInfo, extendValue, contextInfo.Attributes, false));
476+
sbParsedContent.Append(InputParserUtility.GetVideoHtml(pageInfo.PublishmentSystemInfo, extendValue, contextInfo.Attributes, contextInfo.IsCurlyBrace));
477477

478478
}
479479
}
@@ -485,7 +485,7 @@ private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, stri
485485
var num = TranslateUtils.ToInt(no, 0);
486486
if (num <= 1)
487487
{
488-
parsedContent = InputParserUtility.GetVideoHtml(pageInfo.PublishmentSystemInfo, contentInfo.GetExtendedAttribute(BackgroundContentAttribute.VideoUrl), contextInfo.Attributes, false);
488+
parsedContent = InputParserUtility.GetVideoHtml(pageInfo.PublishmentSystemInfo, contentInfo.GetExtendedAttribute(BackgroundContentAttribute.VideoUrl), contextInfo.Attributes, contextInfo.IsCurlyBrace);
489489
}
490490
else
491491
{
@@ -498,7 +498,7 @@ private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, stri
498498
{
499499
if (index == num)
500500
{
501-
parsedContent = InputParserUtility.GetVideoHtml(pageInfo.PublishmentSystemInfo, extendValue, contextInfo.Attributes, false);
501+
parsedContent = InputParserUtility.GetVideoHtml(pageInfo.PublishmentSystemInfo, extendValue, contextInfo.Attributes, contextInfo.IsCurlyBrace);
502502
break;
503503
}
504504
index++;

source/SiteServer.CMS/StlParser/StlElement/StlContents.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@ public class StlContents
101101

102102
public static string Parse(PageInfo pageInfo, ContextInfo contextInfo)
103103
{
104+
// 如果是实体标签则返回空
105+
if (contextInfo.IsCurlyBrace)
106+
{
107+
return string.Empty;
108+
}
109+
104110
var listInfo = ListInfo.GetListInfoByXmlNode(pageInfo, contextInfo, EContextType.Content);
105111

106112
return ParseImpl(pageInfo, contextInfo, listInfo);

source/SiteServer.CMS/StlParser/StlElement/StlDigg.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ public static string Parse(PageInfo pageInfo, ContextInfo contextInfo)
7070

7171
private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, EDiggType diggType, string goodText, string badText, string theme, bool isNumber)
7272
{
73-
if (isNumber)
73+
// 如果是单独显示数值或实体标签 都只返回数值
74+
if (isNumber || contextInfo.IsCurlyBrace)
7475
{
7576
int count;
7677

source/SiteServer.CMS/StlParser/StlElement/StlDynamic.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ private StlDynamic() { }
2424

2525
internal static string Parse(PageInfo pageInfo, ContextInfo contextInfo)
2626
{
27+
// 如果是实体标签则返回空
28+
if (contextInfo.IsCurlyBrace)
29+
{
30+
return string.Empty;
31+
}
32+
2733
var isPageRefresh = false;
2834

2935
foreach (var name in contextInfo.Attributes.Keys)

source/SiteServer.CMS/StlParser/StlElement/StlFile.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, stri
142142
}
143143
}
144144

145-
var parsedContent = InputParserUtility.GetFileHtmlWithoutCount(pageInfo.PublishmentSystemInfo, fileUrl, contextInfo.Attributes, contextInfo.InnerXml, false);
145+
var parsedContent = InputParserUtility.GetFileHtmlWithoutCount(pageInfo.PublishmentSystemInfo, fileUrl, contextInfo.Attributes, contextInfo.InnerXml, contextInfo.IsCurlyBrace);
146146

147147
if (isFilesize)
148148
{
@@ -153,11 +153,11 @@ private static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, stri
153153
{
154154
if (isCount && contextInfo.ContentInfo != null)
155155
{
156-
parsedContent = InputParserUtility.GetFileHtmlWithCount(pageInfo.PublishmentSystemInfo, contextInfo.ContentInfo.NodeId, contextInfo.ContentInfo.Id, fileUrl, contextInfo.Attributes, contextInfo.InnerXml, false);
156+
parsedContent = InputParserUtility.GetFileHtmlWithCount(pageInfo.PublishmentSystemInfo, contextInfo.ContentInfo.NodeId, contextInfo.ContentInfo.Id, fileUrl, contextInfo.Attributes, contextInfo.InnerXml, contextInfo.IsCurlyBrace);
157157
}
158158
else
159159
{
160-
parsedContent = InputParserUtility.GetFileHtmlWithoutCount(pageInfo.PublishmentSystemInfo, fileUrl, contextInfo.Attributes, contextInfo.InnerXml, false);
160+
parsedContent = InputParserUtility.GetFileHtmlWithoutCount(pageInfo.PublishmentSystemInfo, fileUrl, contextInfo.Attributes, contextInfo.InnerXml, contextInfo.IsCurlyBrace);
161161
}
162162
}
163163

0 commit comments

Comments
 (0)