8000 downloads · githubsunyf/cms@a7ed3e3 · GitHub
[go: up one dir, main page]

Skip to content 8000

Commit a7ed3e3

Browse files
committed
downloads
1 parent 6d96ef2 commit a7ed3e3

File tree

20 files changed

+701
-342
lines changed

20 files changed

+701
-342
lines changed

SiteServer.BackgroundPages/Cms/ModalContentAttributes.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public class ModalContentAttributes : BasePageCms
2020
protected CheckBox CbIsTop;
2121
protected HtmlInputHidden HihType;
2222
protected TextBox TbHits;
23+
protected TextBox TbDownloads;
2324

2425
private ChannelInfo _channelInfo;
2526
private List<int> _idList;
@@ -91,6 +92,7 @@ public override void Submit_OnClick(object sender, EventArgs e)
9192
}
9293

9394
break;
95+
9496
case "2":
9597
if (CbIsRecommend.Checked || CbIsHot.Checked || CbIsColor.Checked || CbIsTop.Checked)
9698
{
@@ -125,6 +127,7 @@ public override void Submit_OnClick(object sender, EventArgs e)
125127
}
126128

127129
break;
130+
128131
case "3":
129132
var hits = TranslateUtils.ToInt(TbHits.Text);
130133

@@ -140,6 +143,24 @@ public override void Submit_OnClick(object sender, EventArgs e)
140143

141144
AuthRequest.AddSiteLog(SiteId, "设置内容点击量");
142145

146+
isChanged = true;
147+
break;
148+
149+
case "4":
150+
var downloads = TranslateUtils.ToInt(TbDownloads.Text);
151+
152+
foreach (var contentId in _idList)
153+
{
154+
var contentInfo = ContentManager.GetContentInfo(SiteInfo, _channelInfo, contentId);
155+
if (contentInfo != null)
156+
{
157+
contentInfo.Downloads = downloads;
158+
DataProvider.ContentDao.Update(SiteInfo, _channelInfo, contentInfo);
159+
}
160+
}
161+
162+
AuthRequest.AddSiteLog(SiteId, "设置内容下载量");
163+
143164
isChanged = true;
144165
break;
145166
}

SiteServer.BackgroundPages/Cms/PageContentAddAfter.cs

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -74,21 +74,25 @@ public void RblOperation_SelectedIndexChanged(object sender, EventArgs e)
7474
if (after == EContentAddAfter.ContinueAdd)
7575
{
7676
PageUtils.Redirect(WebUtils.GetContentAddAddUrl(SiteId, _channelInfo, AuthRequest.GetQueryString("ReturnUrl")));
77+
return;
7778
}
78-
else if (after == EContentAddAfter.ManageContents)
79-
{
80-
PageUtils.Redirect(_returnUrl);
81-
}
82-
else if (after == EContentAddAfter.Contribute)
83-
{
84-
CrossSiteTransUtility.LoadSiteIdDropDownList(DdlSiteId, SiteInfo, _channelInfo.Id);
8579

86-
if (DdlSiteId.Items.Count > 0)
87-
{
88-
DdlSiteId_SelectedIndexChanged(sender, e);
89-
}
90-
PhSiteId.Visible = PhSubmit.Visible = true;
91-
}
80+
if (after == EContentAddAfter.ManageContents)
81+
{
82+
PageUtils.Redirect(_returnUrl);
83+
return;
84+
}
85+
86+
if (after == EContentAddAfter.Contribute)
87+
{
88+
CrossSiteTransUtility.LoadSiteIdDropDownList(DdlSiteId, SiteInfo, _channelInfo.Id);
89+
90+
if (DdlSiteId.Items.Count > 0)
91+
{
92+
DdlSiteId_SelectedIndexChanged(sender, e);
93+
}
94+
PhSiteId.Visible = PhSubmit.Visible = true;
95+
}
9296
}
9397

9498
public void DdlSiteId_SelectedIndexChanged(object sender, EventArgs e)
Lines changed: 145 additions & 0 deletions
Original file line number
Diff line numberDiff line change
@@ -0,0 +1,145 @@
1+
using System;
2+
using System.Collections.Specialized;
3+
using System.Reflection;
4+
using System.Text;
5+
using System.Web.UI.WebControls;
6+
using SiteServer.CMS.DataCache;
7+
using SiteServer.CMS.StlParser.Model;
8+
using SiteServer.Utils;
9+
10+
namespace SiteServer.BackgroundPages.Cms
11+
{
12+
public class PageTemplateReference : BasePageCms
13+
{
14+
public Literal LtlAll;
15+
public PlaceHolder PhRefenreces;
16+
public Literal LtlReferences;
17+
18+
public static string GetRedirectUrl(int siteId, string elementName)
19+
{
20+
return PageUtils.GetCmsUrl(siteId, nameof(PageTemplateReference), new NameValueCollection
21+
{
22+
{"elementName", elementName}
23+
});
24+
}
25+
26+
private string _elementName = string.Empty;
27+
28+
public void Page_Load(object sender, EventArgs e)
29+
{
30+
if (IsForbidden) return;
31+
32+
PageUtils.CheckRequestParameter("siteId");
33+
34+
_elementName = AuthRequest.GetQueryString("elementName");
35+
36+
if (IsPostBack) return;
37+
38+
VerifySitePermissions(ConfigManager.WebSitePermissions.Template);
39+
40+
var elements = StlAll.Elements;
41+
var allBuilder = new StringBuilder();
42+
foreach (var elementName in elements.Keys)
43+
{
44+
if (!elements.TryGetValue(elementName, out var elementType)) continue;
45+
46+
var tagName = elementName.Substring(4);
47+
var stlAttribute = (StlElementAttribute)Attribute.GetCustomAttribute(elementType, typeof(StlElementAttribute));
48+
49+
allBuilder.Append($@"
50+
<tr class=""{(elementName == _elementName ? "bg-secondary text-white" : string.Empty)}"">
51+
<td>
52+
<a href=""{GetRedirectUrl(SiteId, elementName)}"" class=""{(elementName == _elementName ? "text-white" : string.Empty)}"">
53+
{elementName}
54+
</a>
55+
</td>
56+
<td>{stlAttribute.Title}</td>
57+
<td><a href=""https://docs.siteserver.cn/stl#/{tagName}/"" target=""_blank"" class=""{(elementName == _elementName ? "text-white" : string.Empty)}"">https://docs.siteserver.cn/stl#/{tagName}/</a></td>
58+
</tr>");
59+
}
60+
61+
LtlAll.Text = $@"
62+
<div class=""panel panel-default m-t-10"">
63+
<div class=""panel-body p-0"">
64+
<div class=""table-responsive"">
65+
<table class=""table tablesaw table-striped m-0"">
66+
<thead>
67+
<tr>
68+
<th>标签</th>
69+
<th>说明</th>
70+
<th>参考</th>
71+
</tr>
72+
</thead>
73+
<tbody>
74+
{allBuilder}
75+
</tbody>
76+
</table>
77+
</div>
78+
</div>
79+
</div>
80+
";
81+
82+
if (!string.IsNullOrEmpty(_elementName))
83+
{
84+
if (elements.TryGetValue(_elementName, out var elementType))
85+
{
86+
var tagName = _elementName.Substring(4);
87+
PhRefenreces.Visible = true;
88+
89+
var attrBuilder = new StringBuilder();
90+
91+
var fields = elementType.GetFields(BindingFlags.Static | BindingFlags.NonPublic);
92+
foreach (var field in fields)
93+
{
94+
var fieldName = field.Name.ToCamelCase();
95+
var attr = (StlAttributeAttribute)Attribute.GetCustomAttribute(field, typeof(StlAttributeAttribute));
96+
97+
if (attr != null)
98+
{
99+
attrBuilder.Append($@"
100+
<tr>
101+
<td>{fieldName}</td>
102+
<td>{attr.Title}</td>
103+
<td><a href=""https://docs.siteserver.cn/stl#/{tagName}/attributes?id={fieldName}"" target=""_blank"">https://docs.siteserver.cn/stl#/{tagName}/attributes?id={fieldName}</a></td>
104+
</tr>");
105+
}
106+
}
107+
108+
var helpUrl = $"https://docs.siteserver.cn/stl#/{tagName}/";
109+
110+
var stlAttribute = (StlElementAttribute)Attribute.GetCustomAttribute(elementType, typeof(StlElementAttribute));
111+
112+
LtlReferences.Text = $@"
113+
<div class=""tab-pane"" style=""display: block;"">
114+
<h4 class=""m-t-0 header-title"">
115+
&lt;{_elementName}&gt; {stlAttribute.Title}
116+
</h4>
117+
<p>
118+
{stlAttribute.Description}
119+
<a href=""{helpUrl}"" target=""_blank"">详细使用说明</a>
120+
</p>
121+
<div class=""panel panel-default m-t-10"">
122+
<div class=""panel-body p-0"">
123+
<div class=""table-responsive"">
124+
<table class=""table tablesaw table-striped m-0"">
125+
<thead>
126+
<tr>
127+
<th>属性</th>
128+
<th>说明</th>
129+
<th>参考</th>
130+
</tr>
131+
</thead>
132+
<tbody>
133+
{attrBuilder}
134+
</tbody>
135+
</table>
136+
</div>
137+
</div>
138+
</div>
139+
</div>
140+
";
141+
}
142+
}
143+
}
144+
}
145+
}

SiteServer.BackgroundPages/Core/TextUtility.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ private static string GetColumnValue(Dictionary<string, string> nameValueCacheDi
108108
{
109109
value = DateUtils.GetDateAndTimeString(contentInfo.LastHitsDate);
110110
}
111+
else if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.Downloads))
112+
{
113+
value = contentInfo.Downloads.ToString();
114+
}
111115
else if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.IsTop) || StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.IsColor) || StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.IsHot) || StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.IsRecommend))
112116
{
113117
value = StringUtils.GetTrueImageHtml(contentInfo.GetString(styleInfo.AttributeName));

SiteServer.BackgroundPages/SiteServer.BackgroundPages.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,9 @@
410410
</Compile>
411411
<Compile Include="Cms\ModalTextEditorInsertImageHandler.cs" />
412412
<Compile Include="Cms\ModalUploadWordHandler.cs" />
413+< BAED div class="diff-text-inner"> <Compile Include="Cms\PageTemplateReference.cs">
414+
<SubType>ASPXCodeBehind</SubType>
415+
</Compile>
413416
<Compile Include="Controls\Alerts.cs" />
414417
<Compile Include="Controls\AuxiliaryControl.cs" />
415418
<Compile Include="Controls\ChannelAuxiliaryControl.cs" />

SiteServer.CMS/Core/ContentUtility.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,12 @@ public static List<TableStyleInfo> GetAllTableStyleInfoList(List<TableStyleInfo>
362362
Taxis = taxis++
363363
},
364364
new TableStyleInfo
365+
{
366+
AttributeName = ContentAttribute.Downloads,
367+
DisplayName = "下载量",
368+
Taxis = taxis++
369+
},
370+
new TableStyleInfo
365371
{
366372
AttributeName = ContentAttribute.CheckUserName,
367373
DisplayName = "审核人",

0 commit comments

Comments
 (0)
0