Skip to content

Commit 0f16ba1

Browse files
authored
Merge pull request #22 from ixre/feature
Feature
2 parents 3d190fa + ca7ce40 commit 0f16ba1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+592
-425
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,4 @@ src/JR.Cms.AspNet.App/install
4747
src/JR.Cms.AspNet.App/uploads
4848
*.blob
4949

50+
/src/JR.Cms.App/index.html

src/JR.Cms.App/JR.Cms.App.csproj

+6-6
Original file line numberDiff line numberDiff line change
@@ -477,12 +477,12 @@
477477
<Content Include="templates\default\css\default\tit-bar-03.png" />
478478
<Content Include="templates\default\css\default\tit-bar-mult.png" />
479479
<Content Include="templates\default\css\default\ver-split.png" />
480-
<Content Include="templates\default\include\flash_banner.part.html" />
481-
<Content Include="templates\default\include\footer.backup.part.html" />
482-
<Content Include="templates\default\include\footer.part.html" />
483-
<Content Include="templates\default\include\header.part.html" />
484-
<Content Include="templates\default\include\share_control.part.html" />
485-
<Content Include="templates\default\include\side_bar.part.html" />
480+
<Content Include="templates\default\include\flash_banner.html" />
481+
<Content Include="templates\default\include\footer.backup.html" />
482+
<Content Include="templates\default\include\footer.html" />
483+
<Content Include="templates\default\include\header.html" />
484+
<Content Include="templates\default\include\share_control.html" />
485+
<Content Include="templates\default\include\side_bar.html" />
486486
<Content Include="templates\default\index.html" />
487487
<Content Include="templates\default\not_found.html" />
488488
<Content Include="templates\default\search.html" />

src/JR.Cms.App/Routes.cs

-3
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ private static void MapCmsRoutes(IEndpointRouteBuilder endpoints)
5252
/// <summary>
5353
/// 注册路由
5454
/// </summary>
55-
/// <param name="routes">路由集合</param>
56-
/// <param name="cmsHandleType"></param>
5755
private static void RegisterInstalledCmsRoutes(IEndpointRouteBuilder endpoints, Type portalType)
5856
{
5957
var portal = new PortalController();
@@ -63,7 +61,6 @@ private static void RegisterInstalledCmsRoutes(IEndpointRouteBuilder endpoints,
6361

6462
// string urlPrefix = "/" + routePrefix;
6563
var urlPrefix = String.Empty;
66-
var routePrefix = String.Empty;
6764

6865
//MVC路由规则词典
6966
IDictionary<UrlRulePageKeys, string> dict = new Dictionary<UrlRulePageKeys, string>();

src/JR.Cms.App/public/mui/html/cms.config.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
<span class="red">*</span>内存回收:
118118
</div>
119119
<div class="in">
120-
<input type="text" class="tb_normal ui-box ui-validate" required="true" isnumber="true" field="opti_gc_collect_interval" style="width: 40px" />分钟/次&nbsp;&nbsp;
120+
<input type="text" class="tb_normal ui-box ui-validate" required="true" isnumber="true" field="opti_gc_collect_interval" style="width: 80px" />分钟/次&nbsp;&nbsp;
121121
<div>(设置为0则不回收,修改重启网站后生效!)</div>
122122
</div>
123123
</div>
@@ -126,7 +126,7 @@
126126
<span class="red">*</span>首页缓存:
127127
</div>
128128
<div class="in">
129-
<input type="text" class="tb_normal ui-box ui-validate" required="true" isnumber="true" field="opti_index_cache_seconds" style="width: 40px" />
129+
<input type="text" class="tb_normal ui-box ui-validate" required="true" isnumber="true" field="perm_index_cache_second" style="width: 80px" />
130130
分钟(0表示不缓存)
131131
</div>
132132
</div>
@@ -135,7 +135,7 @@
135135
<span class="red">*</span>客户端缓存:
136136
</div>
137137
<div class="in">
138-
<input type="text" class="tb_normal ui-box ui-validate" required="true" isnumber="true" field="opti_client_cache_seconds" style="width: 40px" />
138+
<input type="text" class="tb_normal ui-box ui-validate" required="true" isnumber="true" field="opti_client_cache_seconds" style="width: 80px" />
139139
分钟(0表示不缓存)
140140
</div>
141141
</div>

src/JR.Cms.App/root/5383.wav

-19.6 KB
Binary file not shown.

src/JR.Cms.App/templates/default/archive.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
${page.html5}
1111
</head>
1212
<body>
13-
${include:"include/header.part.html"}
13+
${include:"include/header.html"}
1414
<div class="mod-crumb">
1515
<div class="container">
1616
$lang(sitemap_location):<a href="/">$lang(home)</a> > $sitemap()
@@ -96,7 +96,7 @@ <h1>${archive.title}</h1>
9696

9797
</div>
9898
</div>
99-
${include:"include/footer.part.html"}
99+
${include:"include/footer.html"}
100100
<script type="text/javascript" src="${page.fpath}/base.min.js?hover=clist,alist,navi&amp;version=${page.version}"></script>
101101
<script type="text/javascript" charset="utf-8" src="http://static.bshare.cn/b/buttonLite.js#style=-1&amp;uuid=&amp;pophcol=2&amp;lang=zh"></script>
102102
<script type="text/javascript" charset="utf-8" src="http://static.bshare.cn/b/bshareC0.js"></script>

src/JR.Cms.App/templates/default/category.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</head>
1111
<body>
1212

13-
${include:"include/header.part.html"}
13+
${include:"include/header.html"}
1414

1515
<div class="mod-crumb">
1616
<div class="container">
@@ -58,7 +58,7 @@ <h3><a href="{url}" target="_blank">{title}</a></h3>
5858
</div>
5959
</div>
6060

61-
${include:"include/footer.part.html"}
61+
${include:"include/footer.html"}
6262

6363
<script type="text/javascript" src="${page.fpath}/base.min.js?hover=clist,alist,navi&amp;version=${page.version}"></script>
6464
<script type="text/javascript">

src/JR.Cms.App/templates/default/index.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
${page.html5}
1313
</head>
1414
<body>
15-
${include:"include/header.part.html"}
15+
${include:"include/header.html"}
1616
<div class="mod-flash-p mod-flash-banner g-mg5 flash-row container" style="margin:5px auto">
17-
${include:"include/flash_banner.part.html"}
17+
${include:"include/flash_banner.html"}
1818
</div>
1919
<ul>
2020
$archives('news',4,'
@@ -90,7 +90,7 @@
9090
</div>
9191
</div>
9292

93-
${include:"include/footer.part.html"}
93+
${include:"include/footer.html"}
9494
<script type="text/javascript" src="${page.fpath}/base.min.js?v=${page.built}&amp;hover=navi"></script>
9595
<script type="text/javascript" src="${page.fpath}/js/scroller.js?v=${page.built}&amp;hover=navi"></script>
9696
<script type="text/javascript">$jr.scroller('fla', {direction: 'left',unit:1200,pagerid:'fla_pager'},4000);

src/JR.Cms.App/templates/default/not_found.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<link rel="Stylesheet" href="${page.tpath}/css/default/page.css?v=${page.built}" type="text/css" />
77
</head>
88
<body>
9-
${include:"include/header.part.html"}
9+
${include:"include/header.html"}
1010

1111
<div class="container">
1212

@@ -25,7 +25,7 @@
2525
<div class="clearfix"></div>
2626
</div>
2727

28-
${include:"include/footer.part.html"}
28+
${include:"include/footer.html"}
2929

3030
</body>
3131
</html>

src/JR.Cms.App/templates/default/search.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<link rel="Stylesheet" href="${page.tpath}/css/default/page.css?v=${page.built}" type="text/css" />
88
</head>
99
<body>
10-
${include:"include/header.part.html"}
10+
${include:"include/header.html"}
1111

1212

1313
<div class="mod-crumb">
@@ -27,7 +27,7 @@
2727
</ul>
2828
</div>
2929
</div>
30-
<!-- ${include:"include/side_bar.part.html"}-->
30+
<!-- ${include:"include/side_bar.html"}-->
3131
</div>
3232

3333

@@ -65,7 +65,7 @@ <h3><a href="{url}">{title}</a></h3>
6565
</div>
6666
</div>
6767
</div>
68-
${include:"include/footer.part.html"}
68+
${include:"include/footer.html"}
6969
<script type="text/javascript" src="${page.fpath}/base.min.js?hover=clist,alist,navi&amp;version=${page.version}"></script>
7070
<script type="text/javascript">
7171
document.getElementById('c').value='${c}';

src/JR.Cms.App/templates/default/tag.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<link rel="Stylesheet" href="${page.tpath}/css/default/page.css?v=${page.built}" type="text/css" />
88
</head>
99
<body>
10-
${include:"include/header.part.html"}
10+
${include:"include/header.html"}
1111

1212

1313
<div class="mod-crumb">
@@ -27,7 +27,7 @@
2727
</ul>
2828
</div>
2929
</div>
30-
<!-- ${include:"include/side_bar.part.html"}-->
30+
<!-- ${include:"include/side_bar.html"}-->
3131
</div>
3232

3333

@@ -65,7 +65,7 @@ <h3><a href="{url}">{title}</a></h3>
6565
</div>
6666
</div>
6767
</div>
68-
${include:"include/footer.part.html"}
68+
${include:"include/footer.html"}
6969
<script type="text/javascript" src="${page.fpath}/base.min.js?hover=clist,alist,navi&amp;version=${page.version}"></script>
7070
<script type="text/javascript">
7171
document.getElementById('c').value='${c}';

src/JR.Cms.UnitTest/TemplateTest.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public void TestCompileFunction()
3030
TemplatePage tp = new TemplatePage(null);
3131
tp.TemplateHandleObject = new TemplateMock();
3232
tp.OnPreInit += TemplateMock.CompliedTemplate;
33-
tp.TemplateContent = temp;
33+
tp.SetTemplateContent( temp);
3434
var content = tp.Compile();
3535
Console.WriteLine(content);
3636
}

src/JR.Cms/Cms.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
using JR.Cms.Core;
1515
using JR.Cms.Infrastructure;
1616
using JR.Cms.Library.CacheProvider;
17-
using JR.Cms.Library.CacheProvider.CacheCompoment;
17+
using JR.Cms.Library.CacheProvider.CacheComponent;
1818
using JR.Cms.Library.DataAccess.DB;
1919
using JR.Cms.ServiceDto;
2020
using JR.Stand.Core;
@@ -288,7 +288,7 @@ public static void Init(BootFlag flag, string confPath)
288288
// 初始化模板
289289
Template = new CmsTemplate(_cache, TemplateNames.FileName);
290290
// 注册模板
291-
Template.Register("/" + CmsVariables.TEMPLATE_PATH, true);
291+
Template.Register("/" + CmsVariables.TEMPLATE_PATH);
292292
// 模板管理器
293293
_templateManager = new TemplateManager(PhysicPath + CmsVariables.TEMPLATE_PATH);
294294

src/JR.Cms/Conf/Configuration.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ private static string Load(string filePath)
7676

7777
Settings.TPL_FULL_URL_PATH = !sf.Contains("tpl_full_url_path") || sf["tpl_full_url_path"] == "true";
7878
Settings.TPL_USE_COMPRESS = sf.Contains("tpl_use_compress") && sf["tpl_use_compress"] == "true";
79-
Settings.TPL_USE_CACHE = sf.Contains("tpl_use_cache") && sf["tpl_use_cache"] == "true";
79+
Settings.TPL_USE_CACHE = !sf.Contains("tpl_use_cache") || sf["tpl_use_cache"] == "true";
8080

8181
#endregion
8282

@@ -91,9 +91,9 @@ private static string Load(string filePath)
9191
Settings.OPTI_DEBUG_MODE = WebConfig.IsDebug();
9292

9393
//缓存项
94-
if (sf.Contains("opti_index_cache_seconds"))
94+
if (sf.Contains("perm_index_cache_second"))
9595
{
96-
Int32.TryParse(sf["opti_index_cache_seconds"], out Settings.Opti_IndexCacheSeconds);
96+
Int32.TryParse(sf["perm_index_cache_second"], out Settings.PERM_INDEX_CACHE_SECOND);
9797
}
9898

9999
if (sf.Contains("opti_client_cache_seconds"))
@@ -270,7 +270,7 @@ private static void UpdateKeys(string prefix)
270270
//优化
271271
case "opti":
272272
//缓存项
273-
sf.Set("opti_index_cache_seconds", Settings.Opti_IndexCacheSeconds.ToString());
273+
sf.Set("perm_index_cache_second", Settings.PERM_INDEX_CACHE_SECOND.ToString());
274274
sf.Set("opti_gc_collect_interval", Settings.opti_gc_collect_interval.ToString());
275275
sf.Set("opti_client_cache_seconds", Settings.Opti_ClientCacheSeconds.ToString());
276276
break;

src/JR.Cms/Conf/Settings.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ static Settings()
116116
/// <summary>
117117
/// 是否使用压缩
118118
/// </summary>
119-
public static bool TPL_USE_COMPRESS;
119+
public static bool TPL_USE_COMPRESS = true;
120120

121121
/// <summary>
122122
/// 多模板公享模式
@@ -186,7 +186,7 @@ static Settings()
186186
/// <summary>
187187
/// 首页缓存秒数
188188
/// </summary>
189-
public static int Opti_IndexCacheSeconds = 0;
189+
public static int PERM_INDEX_CACHE_SECOND = 0;
190190

191191
/// <summary>
192192
/// GC回收间隔(默认30分钟回收一次)

src/JR.Cms/Core/CmsContext.cs

+19-10
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ public CmsContext(ICompatibleHttpContext httpCtx)
8181
//是否为虚拟目录运行
8282
if ((SiteRunType) CurrentSite.RunType == SiteRunType.VirtualDirectory)
8383
_isVirtualDirectoryRunning = true;
84+
this._containCookie = _context.Request.GetHeader("Cookie") != null;
8485
}
8586

8687
/// <summary>
@@ -118,13 +119,16 @@ public Languages UserLanguage
118119
{
119120
if (this._userLanguage == Languages.Unknown)
120121
{
121-
122-
this._userLanguage = this.GetUserLangSetFromCookie();
123-
if (this._userLanguage == Languages.Unknown)
122+
if (this._containCookie)
124123
{
125-
this._userLanguage = CurrentSite.Language;
126-
//SetSessionLangSet((int)this._userLanguage);
124+
this._userLanguage = this.GetUserLangSetFromCookie();
125+
if (this._userLanguage == Languages.Unknown)
126+
{
127+
this._userLanguage = CurrentSite.Language;
128+
//SetSessionLangSet((int)this._userLanguage);
129+
}
127130
}
131+
this._userLanguage = CurrentSite.Language;
128132
}
129133
return this._userLanguage;
130134
}
@@ -136,6 +140,8 @@ public Languages UserLanguage
136140
/// <returns></returns>
137141
private Languages GetUserLangSetFromCookie()
138142
{
143+
var s = this._context.Request.GetHeader("Cookie");
144+
139145
// var s = _context.Session.GetInt32("user.lang.set");
140146
// if (s > 0) return (Languages)s;
141147

@@ -227,10 +233,13 @@ private DeviceType GetUserDeviceSet()
227233
// {
228234
// return (DeviceType) Convert.ToInt32(s);
229235
// }
230-
this._context.Request.TryGetCookie(UserDeviceCookieName,out var ck);
231-
if (!String.IsNullOrEmpty(ck))
236+
if (this._containCookie)
232237
{
233-
if (Enum.TryParse<DeviceType>(ck, out var device)) return device;
238+
this._context.Request.TryGetCookie(UserDeviceCookieName, out var ck);
239+
if (!String.IsNullOrEmpty(ck))
240+
{
241+
if (Enum.TryParse<DeviceType>(ck, out var device)) return device;
242+
}
234243
}
235244
//如果包含手机的域名或agent
236245
var host = this._context.Request.GetHost();
@@ -268,7 +277,8 @@ private void SetSessionUserDeviceSet(int deviceType)
268277
private Languages _userLanguage;
269278
private DeviceType? _userDevice;
270279
private string _proto;
271-
280+
private bool _containCookie = false;
281+
272282
/// <summary>
273283
/// 系统应用程序目录
274284
/// </summary>
@@ -498,7 +508,6 @@ public void RenderNotfound(string message, TemplatePageHandler handler)
498508
{
499509
html = "File not found!";
500510
}
501-
502511
this._context.Response.StatusCode(404);
503512
this._context.Response.WriteAsync(html);
504513
}

0 commit comments

Comments
 (0)