Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
MCMS
Commits
d46aff17
Commit
d46aff17
authored
Nov 28, 2019
by
tianbj
Browse files
4.7.2
parent
fef0c487
Changes
29
Expand all
Show whitespace changes
Inline
Side-by-side
src/main/java/net/mingsoft/config/WebConfig.java
View file @
d46aff17
package
net.mingsoft.config
;
package
net.mingsoft.config
;
import
java.io.File
;
import
java.io.File
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
org.springframework.aop.Advisor
;
import
org.springframework.aop.Advisor
;
import
net.mingsoft.basic.filter.XSSEscapeFilter
;
import
net.mingsoft.basic.filter.XSSEscapeFilter
;
import
org.springframework.aop.support.DefaultPointcutAdvisor
;
import
org.springframework.aop.support.DefaultPointcutAdvisor
;
import
org.springframework.aop.support.JdkRegexpMethodPointcut
;
import
org.springframework.aop.support.JdkRegexpMethodPointcut
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.web.servlet.FilterRegistrationBean
;
import
org.springframework.boot.web.servlet.FilterRegistrationBean
;
import
org.springframework.boot.web.servlet.ServletListenerRegistrationBean
;
import
org.springframework.boot.web.servlet.ServletListenerRegistrationBean
;
import
org.springframework.boot.web.servlet.ServletRegistrationBean
;
import
org.springframework.boot.web.servlet.ServletRegistrationBean
;
...
@@ -31,6 +34,16 @@ import net.mingsoft.basic.util.BasicUtil;
...
@@ -31,6 +34,16 @@ import net.mingsoft.basic.util.BasicUtil;
@Configuration
@Configuration
public
class
WebConfig
implements
WebMvcConfigurer
{
public
class
WebConfig
implements
WebMvcConfigurer
{
/**
* 上传路径
*/
@Value
(
"${ms.upload.path}"
)
private
String
uploadFloderPath
;
/**
* 上传路径映射
*/
@Value
(
"${ms.upload.mapping}"
)
private
String
uploadMapping
;
@Bean
@Bean
public
ActionInterceptor
actionInterceptor
()
{
public
ActionInterceptor
actionInterceptor
()
{
return
new
ActionInterceptor
();
return
new
ActionInterceptor
();
...
@@ -54,19 +67,20 @@ public class WebConfig implements WebMvcConfigurer {
...
@@ -54,19 +67,20 @@ public class WebConfig implements WebMvcConfigurer {
@Override
@Override
public
void
addResourceHandlers
(
ResourceHandlerRegistry
registry
)
{
public
void
addResourceHandlers
(
ResourceHandlerRegistry
registry
)
{
//jar包方式映射处理
registry
.
addResourceHandler
(
"/upload/**"
).
addResourceLocations
(
"/upload/"
,
"file:upload/"
);
String
classPath
=
BasicUtil
.
getClassPath
(
""
);
registry
.
addResourceHandler
(
"/templets/**"
).
addResourceLocations
(
"/templets/"
,
"file:templets/"
);
if
(
classPath
.
startsWith
(
"file"
))
{
registry
.
addResourceHandler
(
"/html/**"
).
addResourceLocations
(
"/html/"
,
"file:html/"
);
registry
.
addResourceHandler
(
"/upload/**"
).
addResourceLocations
(
"file:"
+
BasicUtil
.
getRealPath
(
"upload"
)
+
File
.
separator
);
//三种映射方式 webapp下、当前目录下、jar内
registry
.
addResourceHandler
(
"/html/**"
).
addResourceLocations
(
"file:"
+
BasicUtil
.
getRealPath
(
"html"
)
+
File
.
separator
);
registry
.
addResourceHandler
(
"/app/**"
).
addResourceLocations
(
"/app/"
,
"file:app/"
,
"classpath:/app/"
);
registry
.
addResourceHandler
(
"/templets/**"
).
addResourceLocations
(
"file:"
+
BasicUtil
.
getRealPath
(
"templets"
)
+
File
.
separator
);
registry
.
addResourceHandler
(
"/static/**"
,
"/**"
).
addResourceLocations
(
"/static/"
,
"file:static/"
,
"classpath:/static/"
,
"classpath:/META-INF/resources/"
);
}
else
{
registry
.
addResourceHandler
(
"/api/**"
).
addResourceLocations
(
"/api/"
,
"file:api/"
,
"classpath:/api/"
);
//必须做判断,不然jar运行的html路径会被覆盖掉
if
(
new
File
(
uploadFloderPath
).
isAbsolute
()){
registry
.
addResourceHandler
(
"/html/**"
).
addResourceLocations
(
"/html/"
);
//如果指定了绝对路径,上传的文件都映射到uploadMapping下
registry
.
addResourceHandler
(
uploadMapping
).
addResourceLocations
(
"file:"
+
uploadFloderPath
+
File
.
separator
//映射其他路径文件
//,file:F://images
);
}
}
registry
.
addResourceHandler
(
"/app/**"
).
addResourceLocations
(
"/app/"
,
"classpath:/app/"
);
registry
.
addResourceHandler
(
"/static/**"
).
addResourceLocations
(
"/static/"
,
"classpath:/static/"
);
registry
.
addResourceHandler
(
"/api/**"
).
addResourceLocations
(
"/api/"
,
"classpath:/api/"
);
}
}
/**
/**
* druidServlet注册
* druidServlet注册
...
@@ -132,16 +146,17 @@ public class WebConfig implements WebMvcConfigurer {
...
@@ -132,16 +146,17 @@ public class WebConfig implements WebMvcConfigurer {
return
new
DefaultPointcutAdvisor
(
druidStatPointcut
(),
druidStatInterceptor
());
return
new
DefaultPointcutAdvisor
(
druidStatPointcut
(),
druidStatInterceptor
());
}
}
/**
@Bean
* xssFilter注册
public
FilterRegistrationBean
xssFilterRegistration
()
{
*/
XSSEscapeFilter
xssFilter
=
new
XSSEscapeFilter
();
// @Bean
FilterRegistrationBean
registration
=
new
FilterRegistrationBean
(
xssFilter
);
// public FilterRegistrationBean xssFilterRegistration() {
xssFilter
.
excludes
.
add
(
".*file/upload.do"
);
// XSSEscapeFilter xssFilter = new XSSEscapeFilter();
xssFilter
.
excludes
.
add
(
".*/jsp/editor.do"
);
// FilterRegistrationBean registration = new FilterRegistrationBean(xssFilter);
xssFilter
.
excludes
.
add
(
".*/?(jpg|js|css|gif|png|ico)$"
);
// registration.addUrlPatterns("/*");
xssFilter
.
excludes
.
add
(
"/"
);
// return registration;
registration
.
addUrlPatterns
(
"/*"
);
// }
return
registration
;
}
/**
/**
* RequestContextListener注册
* RequestContextListener注册
...
...
src/main/resources/application.yml
View file @
d46aff17
...
@@ -12,14 +12,23 @@ ms:
...
@@ -12,14 +12,23 @@ ms:
view-path
:
/WEB-INF/manager
view-path
:
/WEB-INF/manager
upload
:
upload
:
path
:
/upload
path
:
upload
mapping
:
/upload/**
denied
:
.exe,.jsp
denied
:
.exe,.jsp
allowed
:
jpg
multipart
:
max-size
:
1
#最大上传文件大小 单位:KB
memory-size
:
4096
max-file-size
:
10240
#文件暂存临时目录
upload-temp-dir
:
temp
#临时文件大小
max-in-memory-size
:
10240
#总上传最大大小 单位:KB -1禁用
max-request-size
:
-1
spring
:
spring
:
http.multipart.enabled
:
false
profiles
:
profiles
:
active
:
dev
active
:
dev
mvc
:
mvc
:
...
@@ -53,6 +62,7 @@ spring:
...
@@ -53,6 +62,7 @@ spring:
time_format
:
HH:mm:ss
time_format
:
HH:mm:ss
datetime_format
:
yyyy-MM-dd HH:mm:ss
datetime_format
:
yyyy-MM-dd HH:mm:ss
auto_import
:
/include/macro.ftl as ms
auto_import
:
/include/macro.ftl as ms
number_format
:
0.##
mybatis
:
mybatis
:
mapper-locations
:
classpath*:**/dao/*.xml
mapper-locations
:
classpath*:**/dao/*.xml
...
...
src/main/webapp/WEB-INF/manager/cms/article/article_form.ftl
0 → 100644
View file @
d46aff17
<@
ms
.html5
>
<@ms.nav title="文章管理" back=true>
<#if article.basicId == 0>
<@ms.saveButton id="saveUpdate" value="保存"/>
<#else>
<@ms.updateButton id="saveUpdate" value="更新"/>
</#if>
</@ms.nav>
<@ms.panel>
<@ms.form isvalidation=true name="articleForm" action="$
{
managerPath
}
/cms/article/$
{
action
}
.do">
<@ms.text name="basicTitle" colSm="2" width="400" label="文章标题" title="文章标题" size="5" placeholder="请输入文章标题" value="$
{
article
.basicTitle
?
default
(
''
)}
" validation=
{
"maxlength"
:
"300"
,
"required"
:
"true"
,
"data-bv-notempty-message"
:
"文章标题不能为空"
,
"data-bv-stringlength-message"
:
"标题在300个字符以内!"
,
"data-bv-notempty-message"
:
"必填项目"
}
/>
<@ms.text name="basicSort" colSm="2" width="200" label="自定义顺序" title="自定义顺序" size="5" placeholder="请输入文章顺序" value="$
{
article
.basicSort
?
c
?
default
(
0
)}
" validation=
{
"data-bv-between"
:
"true"
,
"required"
:
"true"
,
"data-bv-between-message"
:
"自定义顺序必须大于0"
,
"data-bv-between-min"
:
"0"
,
"data-bv-between-max"
:
"99999999"
,
"data-bv-notempty-message"
:
"自定义顺序不能为空"
}
/>
<#if articleType?has_content>
<@ms.checkboxlist colSm="2" name="checkbox" label="文章属性" list=articleType listKey="dictValue" listValue="dictLabel" />
</#if>
<@ms.radio name="basicDisplay"
list=[
{
"id"
:
"0"
,
"value"
:
"是"
}
,
{
"id"
:
"1"
,
"value"
:
"否"
}
] value="$
{
article
.basicDisplay
?
c
?
default
()}
"
listKey="id" listValue="value" label="是否显示" help="选择否后前端将不显示,需要重新生成才有效果"
/>
<@ms.formRow colSm="2" label="文章缩略图" width="400" >
<@ms.uploadImg path="$
{
websiteId
}
/article" inputName="basicThumbnails" size="1" msg="提示:文章缩略图,支持jpg格式" imgs="$
{
article
.basicThumbnails
?
default
(
''
)}
" />
</@ms.formRow>
<@ms.text name="articleSource" colSm="2" width="200" label="文章来源" title="文章来源" size="5" placeholder="请输入文章来源" value="$
{
article
.articleSource
?
default
(
''
)}
" validation=
{
"maxlength"
:
"300"
,
"data-bv-stringlength-message"
:
"文章来源在300个字符以内!"
}
/>
<@ms.text name="articleAuthor" colSm="2" width="200" label="文章作者" title="文章作者" size="5" placeholder="请输入文章作者" value="$
{
article
.articleAuthor
?
default
(
''
)}
" validation=
{
"maxlength"
:
"12"
,
"data-bv-stringlength-message"
:
"文章作者在12个字符以内!"
}
/>
<#if !isEditCategory><!-- 如果不是单篇 -->
<@ms.formRow colSm="2" label="所属栏目" width="300">
<#if categoryTitle=="">
<@ms.treeInput treeId="inputTree" json="$
{
listColumn
?
default
(
''
)}
" jsonId="categoryId" jsonPid="categoryCategoryId" jsonName="categoryTitle" inputName="basicCategoryId" inputValue="$
{
categoryId
}
" buttonText="选择栏目" clickZtreeId="clickZtreeId(event,treeId,treeNode);" expandAll="true" showIcon="true"/>
<#else>
<@ms.treeInput treeId="inputTree" json="$
{
listColumn
?
default
(
''
)}
" jsonId="categoryId" jsonPid="categoryCategoryId" jsonName="categoryTitle" inputName="basicCategoryId" inputValue="$
{
categoryId
}
" buttonText="$
{(
categoryTitle
)
!
}
" clickZtreeId="clickZtreeId(event,treeId,treeNode);" expandAll="true" showIcon="true"/>
</#if>
</@ms.formRow>
</#if>
<@ms.hidden id="basicDateTime" name="basicDateTime" value=""/>
<@ms.date id="articleDateTime" name="articleDateTime" time=true label="发布时间" single=true readonly="readonly" width="300" value="$
{(
article
.basicDateTime
?
default
(
.now
))
?
string
(
'
yyyy-MM-dd
HH
:
mm
'
)}
" validation=
{
"required"
:
"true"
,
"data-bv-notempty-message"
:
"必填项目"
}
placeholder="点击该框选择时间段" />
<@ms.textarea colSm="2" name="basicDescription" label="描述" wrap="Soft" rows="4" size="" value="$
{
article
.basicDescription
?
default
(
''
)}
" placeholder="请输入对该文章的简短描述,以便用户查看文章简略" validation=
{
"maxlength"
:
"400"
,
"data-bv-stringlength-message"
:
"文章描述在400个字符以内!"
}
/>
<@ms.textarea colSm="2" name="articleKeyword" label="关键字" wrap="Soft" rows="4" size="" placeholder="请输入文章关键字" value="$
{
article
.articleKeyword
?
default
(
''
)}
" validation=
{
"maxlength"
:
"155"
,
"data-bv-stringlength-message"
:
"文章作者在155个字符以内!"
}
/>
<!--新填字段内容开始-->
<div id="addFieldForm">
</div>
<@ms.hidden name="articleTypeJson" />
<@ms.editor colSm="2" name="articleContent" label="文章内容" content="$
{
article
.articleContent
?
default
(
''
)}
" appId="$
{
appId
?
default
(
0
)}
"/>
<@ms.hidden name="modelId" value="$
{
S
ession
.model_id_session
?
default
(
'
0
'
)}
" />
</@ms.form>
</@ms.panel>
</@
ms
.html5
>
<
script
>
//重写时间控件
$('#
articleDateTime
')
.daterangepicker
({
format:'YYYY-MM-DD HH:mm',
singleDatePicker: true,
showDropdowns: true,
timePickerIncrement: 1,
timePicker: true,
timePicker12Hour: true,
startDate: moment().hours(0).minutes(0).seconds(0),
showDropdowns: true,
showWeekNumbers: true,
});
$('#
articleDateTime
')
.on
('
apply
.daterangepicker
',
function(ev, picker)
{
$
(
'#
articleDateTime
'
)
.parents
(
"form:first"
)
.data
(
'
bootstrapValidator
'
)
.revalidateField
(
'
articleDateTime
'
)
;
}
);
var
articleBasicId=0;
$(
function
(){
//页面标题
var articleTitle="<#if categoryTitle?has_content>$
{
categoryTitle
}
</#if><#if article.basicId !=0><small>编辑文章</small><#else><small>添加文章</small></#if>";
$(".ms-weixin-content-body-title>span").html(articleTitle);
//隐藏跳转地址
$("input[name='articleUrl']").parent().hide();
//文章属性
var actionUrl="";
<#if article.basicId !=0>
actionUrl = "$
{
managerPath
}
/cms/article/$
{
article
.basicId
?
c
?
default
(
0
)}
/update.do";
var type="$
{
article
.articleType
?
default
(
''
)}
";
var articleType = new Array;
//文章属性
$("#articleForm input[name='checkbox']").each(function()
{
if
(
type
!=
""
){
articleType
=
type
.split
(
","
)
;
for
(
i
=
0
;
i
<
articleType
.length
;
i
++
){
if
(
$
(
this
)
.val
()
==
articleType
[
i
]
){
$
(
this
)
.attr
(
"checked"
,
'
true
'
)
;
}
}
}
}
);
articleBasicId=$
{
article
.basicId
?
c
?
default
(
0
)}
;
<#else>
actionUrl = "$
{
managerPath
}
/cms/article/save.do";
</#if>
//获取当前栏目的自定义模型
var url="$
{
managerPath
}
/mdiy/contentModel/contentModelField/"+$
{
categoryId
?
default
(
0
)}
+"/queryField.do";
var articleId="basicId="+$
{
article
.basicId
?
c
?
default
(
0
)}
;
$(this).request(
{
url
:
url
,
data
:
articleId
,
method
:
"get"
,
func
:
function
(
data
)
{
$
(
"#addFieldForm"
)
.html
(
data
)
;
}}
);
//显示跳转地址
$("input[name='checkbox']").click(function()
{
$
(
"input[name='checkbox']"
)
.each
(
function
(){
if
(
$
(
this
)
.val
()
==
'
j
'
){
if
(
$
(
this
)
.is
(
":checked"
)
){
$
(
"input[name='articleUrl']"
)
.parent
()
.show
()
;
}
else
{
$
(
"input[name='articleUrl']"
)
.parent
()
.hide
()
;
}
}
})
;
}
);
//更新或保存
$("#saveUpdate").click(function()
{
//禁用按钮
$
(
"#saveUpdate"
)
.attr
(
"disabled"
,
true
)
;
//获取按钮值
var
bottonText
=
$
(
"#saveUpdate"
)
.text
()
.trim
()
;
//设置按钮加载状态值
$
(
"#saveUpdate"
)
.attr
(
"data-loading-text"
,
bottonText
+
"中"
)
;
var
articleDateTimeValue
=
$
(
"#articleDateTime"
)
.val
()
+
":00"
;//让时间能精确到秒与后台对应
$
(
"#basicDateTime"
)
.val
(
articleDateTimeValue
)
;
//给
basicDateTime
字段赋值
//获取所有栏目属性被选中的值
var
typeJson
=
""
$
(
"#articleTypeField"
)
.find
(
"select"
)
.each
(
function
(
index
){
var
typeValue
=
0
;
if
(
$
(
this
)
.find
(
"option:selected"
)
.val
()
==
undefined
){
return
;
}
var
typeValue
=$
(
this
)
.find
(
"option:selected"
)
.val
()
;
if
(
$
(
"#articleTypeField"
)
.find
(
"select"
)
.length
==
index
){
typeJson
=
typeJson
+
"{bcCategoryId:
\"
"
+
typeValue
+
"
\"
,bcBasicId:'${article.basicId?default(0)}'}"
}
else
{
typeJson
=
typeJson
+
"{bcCategoryId:
\"
"
+
typeValue
+
"
\"
,bcBasicId:'${article.basicId?default(0)}'},"
}
})
$
(
"input[name=articleTypeJson]"
)
.val
(
"["
+
typeJson
+
"]"
)
;
var
basicCategoryId
=
""
;
<#
if
!
isEditCategory
><!--
如果不是单篇
-
->
basicCategoryId
=$
(
"input[name='basicCategoryId']"
)
.val
()
;
//多篇时的文章栏目
<#
else
>
basicCategoryId
=$
{
categoryId
}
;
//单篇时的文章栏目
</#
if
>
//文章所属栏目是数字且不能为
0
if
(
basicCategoryId
!=
0
&&
!
isNaN
(
basicCategoryId
)
){
//将表单序列化
var
saveArticle
=
$
(
"#articleForm"
)
.serialize
()
;
saveArticle
+=
"&basicCategoryId="
+
basicCategoryId
;
//文章属性
var
checkboxType
=
""
;
$
(
"input[name='checkbox']"
)
.each
(
function
(){
if
(
$
(
this
)
.is
(
":checked"
)){
checkboxType
+=$
(
this
)
.val
()
+
","
;
}
})
;
var
dataMsg
=
saveArticle
+
"&checkboxType="
+
checkboxType
;
var
seeMsg
=
""
;
<#
if
article
.basicId
!=
0
>
seeMsg
=
"更新中...."
;
<#
else
>
seeMsg
=
"保存中...."
;
</#
if
>
var
vobj
=
$
(
"#articleForm"
)
.data
(
'
bootstrapValidator
'
)
.validate
()
;
if
(
vobj
.isValid
()){
if
(
isNaN
(
$
(
"input[name=basicSort]"
)
.val
())){
<@
ms
.notify
msg
=
"自定义排序必须是数字"
type
=
"warning"
/>
$
(
"input[name=basicSort]"
)
.val
(
0
)
;
//启用按钮
$
(
"#saveUpdate"
)
.button
(
'
reset
'
)
;
return
;
}
$
(
this
)
.request
({
url
:
actionUrl
,
data
:
dataMsg
,
loadingText
:
seeMsg
,
method
:
"post"
,
type
:
"json"
,
func
:
function
(
obj
)
{
//执行加载状态
$
(
"#saveUpdate"
)
.button
(
'
loading
'
)
;
if
(
obj
.result
){
<#
if
article
.basicId
!=
0
>
<@
ms
.notify
msg
=
"更新文章成功"
type
=
"success"
/>
<#
else
>
<@
ms
.notify
msg
=
"保存文章成功"
type
=
"success"
/>
</#
if
>
var
columnType
=
$
{
columnType
?
default
(
0
)}
;
if
(
columnType
==
1
){
//更新并生成之后路径进行跳转
location
.href
=
managerPath
+
"/cms/article/${categoryId?default(0)}/main.do"
;
}
else
{
var
dataId
=
obj
.resultData
;
if
(
dataId
!=
""
){
location
.href
=
"${managerPath}/cms/article/"
+
dataId
+
"/edit.do"
;
}
}
;
$
(
"#saveUpdate"
)
.button
(
'
reset
'
)
;
}
else
{
$
(
'
.ms-notifications
'
)
.offset
({
top
:
43
})
.notify
({
type
:
'
warning
'
,
message
:
{
text
:
obj
.resultMsg
}
})
.show
()
;
}
}})
;
}
}
else
{
<@
ms
.notify
msg
=
"请选择文章所属栏目"
type
=
"warning"
/>
//启用按钮
$
(
"#saveUpdate"
)
.attr
(
"disabled"
,
false
)
;
}
//启用按钮
$
(
"#saveUpdate"
)
.button
(
'
reset
'
)
;
$
(
"#saveUpdate"
)
.attr
(
"disabled"
,
false
)
;
}
);
});
//选择栏目后查询自定义模型
function
clickZtreeId(event,treeId,treeNode)
{
if
(
treeNode
.columnType
==
2
){
<@
ms
.notify
msg
=
"不能选择单篇栏目"
/>
return
false
;
}
if
(
treeNode
.isParent
==
true
){
<@
ms
.notify
msg
=
"不能选择父级栏目"
/>
return
false
;
}
var
url
=
"${managerPath}/mdiy/contentModel/contentModelField/"
+
treeNode
.categoryId
+
"/queryField.do"
;
var
basicId
=
"basicId=${article.basicId?c?default(0)}"
;
$
(
this
)
.request
({
url
:
url
,
data
:
basicId
,
method
:
"get"
,
func
:
function
(
data
)
{
$
(
"#addFieldForm"
)
.html
(
""
)
;
$
(
"#addFieldForm"
)
.html
(
data
)
;
}})
;
}
</
script
>
\ No newline at end of file
src/main/webapp/WEB-INF/manager/cms/article/article_main.ftl
0 → 100644
View file @
d46aff17
<@
ms
.html5
>
<@ms.nav title="文章列表"></@ms.nav>
<@ms.searchForm name="searchForm" action="">
<#if articleTypeList?has_content>
<@ms.select label="文章属性" default="全部" value="a" name="articleType" id="forumSelect" list=articleTypeList listValue="dictLabel" listKey="dictValue" value="$
{
articleType
?
default
(
''
)}
"/>
<#else>
<@ms.select label="文章属性" name="articleType" id="forumSelect" value="" list=["默认属性"] />
</#if>
<@ms.text label="文章标题" name="basicTitle" value="" title="请输入文章标题" placeholder="请输入文章标题" />
<@ms.searchFormButton>
<@ms.queryButton id="submitSearch" />
</@ms.searchFormButton>
</@ms.searchForm>
<div id="toolbar">
<@ms.panelNavBtnGroup>
<@shiro.hasPermission name="article:save"><@ms.panelNavBtnAdd title=""/></@shiro.hasPermission>
<@shiro.hasPermission name="article:del"><@ms.panelNavBtnDel title=""/></@shiro.hasPermission>
</@ms.panelNavBtnGroup>
</div>
<@ms.panel>
<table id="articleListTable"
data-show-refresh="true"
data-show-columns="true"
data-show-export="true"
data-method="post"
data-detail-formatter="detailFormatter"
data-pagination="true"
data-page-size="10"
data-side-pagination="server">
</table>
</@ms.panel>
</@
ms
.html5
>
<!--删除限时文章-->
<@
ms
.modal
modalName="delete" title="删除文章">
<@ms.modalBody>
确定要删除所选的文章吗?
</@ms.modalBody>
<@ms.modalButton>
<@ms.button class="btn btn-danger rightDelete" value="确定"/>
</@ms.modalButton>
</@
ms
.modal
>
<
script
>
$(function()
{
var
search
=
$
(
"form[name='searchForm']"
)
.serializeJSON
()
;
var
articleType
=
search
.articleType
;
$
(
"#articleListTable"
)
.bootstrapTable
({
url
:
"${managerPath}/cms/article/${categoryId}/list.do?articleTypeStr="
+
articleType
,
contentType
:
"application/x-www-form-urlencoded"
,
queryParamsType
:
"undefined"
,
toolbar
:
"#toolbar"
,
columns
:
[
{
checkbox
:
true
},
{
field
:
'
column
.categoryTitle
'
,
title
:
'栏目名'
,
width
:
90
,
align
:
'
left
'
},{
field
:
'
basicTitle
'
,
title
:
'文章标题'
,
formatter
:
function
(
value
,
row
,
index
){
<@
shiro
.hasPermission
name
=
"article:update"
>
var
url
='$
{
managerPath
}
/
cms
/
article
/'+
row
.articleID
+
"/edit.do"
;
return
"<a href="
+
url
+
" target='_self' >"
+
value
+
"</a>"
;
</@
shiro
.hasPermission
>
<@
shiro
.lacksPermission
name
=
"article:update"
>
return
value
;
</@
shiro
.lacksPermission
>
}
},
{
field
:
'
articleAuthor
'
,
title
:
'作者'
,
width
:
100
},
{
field
:
'
basicSort
'
,
title
:
'排序'
,
align
:
'
center
'
,
width
:
50
},
{
field
:
'
basicHit
'
,
title
:
'点击'
,
align
:
'
center
'
,
width
:
50
},
{
field
:
'
basicDateTime
'
,
title
:
'发布时间'
,
align
:
'
center
'
,
width
:
150
}
]
})
;
//查询文章标题
$
(
"#submitSearch"
)
.click
(
function
(){
var
search
=
$
(
"form[name='searchForm']"
)
.serializeJSON
()
;
var
params
=
$
(
'#
articleListTable
'
)
.bootstrapTable
(
'
getOptions
'
)
;
params
.queryParams
=
function
(
params
)
{
$
.extend
(
params
,
search
)
;
return
params
;
}
$
(
"#articleListTable"
)
.bootstrapTable
(
'
refresh
'
,
{
query
:
$
(
"form[name='searchForm']"
)
.serializeJSON
()})
;
})
;
//添加文章
$
(
"#addButton"
)
.click
(
function
(){
if
(
$
{
isParent
}
==
true
){
<@
ms
.notify
msg
=
"不能选择父级栏目"
/>
return
false
;
}
location
.href
=
"${managerPath}/cms/article/add.do?categoryId=${categoryId?default(0)}&modelId=${Session.model_id_session?default(0)}&categoryTitle=${categoryTitle?default('')}"
;
})
;
//点击重置按钮
$
(
".reset"
)
.click
(
function
(){
$
(
"input[name=basicTitle]"
)
.val
(
""
)
;
})
//多选删除
$
(
"#delButton"
)
.click
(
function
(){
//获取勾选的所在行的所有数据
var
rows
=
$
(
"#articleListTable"
)
.bootstrapTable
(
"getSelections"
)
;
if
(
rows
!=
""
){
//弹出
modal
窗体
$
(
".delete"
)
.modal
()
;
}
else
{
<@
ms
.notify
msg
=
"请选择文章!"
type
=
"warning"
/>
}
})
;
//删除多个文章
$
(
".rightDelete"
)
.click
(
function
(){
var
rows
=
$
(
"#articleListTable"
)
.bootstrapTable
(
"getSelections"
)
;
if
(
rows
!=
""
){
$
.ajax
({
url
:
"${managerPath}/cms/article/delete.do"
,
type
:
'
post
'
,
dataType
:
'
json
'
,
data
:
JSON
.stringify
(
rows
),
contentType
:
'
application
/
json
'
,
success
:
function
(
msg
)
{
if
(
msg
.result
)
{
<@
ms
.notify
msg
=
"删除成功!"
type
=
"success"
/>
location
.reload
()
;
}
else
{
<@
ms
.notify
msg
=
"删除失败"
type
=
"fail"
/>
}
}
})
;
}
else
{
<@
ms
.notify
msg
=
"请选择文章!"
type
=
"warning"
/>
}
})
;
}
);
</
script
>
src/main/webapp/WEB-INF/manager/cms/article/index.ftl
0 → 100644
View file @
d46aff17
<!
DOCTYPE
html>
<
html
lang="zh">
<head>
<#
include
"/include/macro.ftl"/>
<#
include
"/include/meta.ftl"/>
</
head
>
<
body
class="over-hide">
<@
ms
.content
>
<@ms.contentMenu>
<!-- 树形模块菜单开始 -->
<#if listColumn?has_content>
<@ms.tree treeId="inputTree" json="$
{
listColumn
?
default
(
''
)}
" addNodesName="全部" jsonId="categoryId" jsonPid="categoryCategoryId" jsonName="categoryTitle" showIcon="true" expandAll="true" getZtreeId="getZtreeId(event,treeId,treeNode);" />
<#else>
<@ms.nodata content="暂无栏目"/>
</#if>
<!-- 树形模块菜单结束 -->
</@ms.contentMenu>
<@ms.contentBody width="85%" style="overflow-y: hidden;">
<@ms.contentPanel style="margin:0;padding:0;overflow-y: hidden;">
<iframe src="$
{
managerPath
}
/cms/article/0/main.do" style="width:100%;maring:0;padding:0;border:none;height:100%;background-image: url($
{
skin_manager_loadding
}
); background-repeat: no-repeat; background-position: center;" id="listFrame" target="listFrame" ></iframe>
</@ms.contentPanel>
</@ms.contentBody>
</@
ms
.content
>
<
script
>
//树形结点
function
getZtreeId(event,treeId,treeNode)
{
if
(
treeNode
.columnType
==
1
)
{
//父级栏目为
true
,子级栏目为
false
var
isParent
=
false
;
if
(
treeNode
.isParent
==
true
){
isParent
=
true
;
}
$
(
"#listFrame"
)
.attr
(
"src"
,
"${managerPath}/cms/article/"
+
treeNode
.categoryId
+
"/main.do?isParent="
+
isParent
+
"&categoryTitle="
+
encodeURIComponent
(
treeNode
.categoryTitle
))
;
}
else
if
(
treeNode
.columnType
==
2
){
//判断该单篇栏目是否存在文章
$
.ajax
({
type
:
"POST"
,
url
:
"${managerPath}/cms/article/"
+
treeNode
.categoryId
+
"/queryColumnArticle.do"
,
dataType
:
"json"
,
success
:
function
(
msg
){
if
(
msg
.result
)
{
$
(
"#listFrame"
)
.attr
(
"src"
,
"${managerPath}/cms/article/add.do?categoryId="
+
treeNode
.categoryId
+
"&categoryTitle="
+
encodeURIComponent
(
treeNode
.categoryTitle
))
;
}
else
{
//如果该单篇栏目下存在文章则跳转到文章编辑页
$
(
"#listFrame"
)
.attr
(
"src"
,
"${managerPath}/cms/article/"
+
treeNode
.categoryId
+
"/edit.do?categoryId="
+
treeNode
.categoryId
+
"&categoryTitle="
+
encodeURIComponent
(
treeNode
.categoryTitle
))
;
}
},
})
;
}
else
if
(
treeNode
.columnType
==
""
||
treeNode
.columnType
==
undefined
){
$
(
"#listFrame"
)
.attr
(
"src"
,
"${managerPath}/cms/article/0/main.do"
)
;
}
}
</
script
>
</
body
>
</
html
>
\ No newline at end of file
src/main/webapp/WEB-INF/manager/cms/column/shiro-button.ftl
0 → 100644
View file @
d46aff17
<@
shiro
.hasPermission
name="cms:column:save"><@ms.addButton id="addColumnBtn"/></@shiro.hasPermission>
<@
shiro
.hasPermission
name="cms:column:del"><@ms.delButton id="delColumnBtn"/></@shiro.hasPermission>
\ No newline at end of file
src/main/webapp/WEB-INF/manager/cms/column/shiro-update.ftl
0 → 100644
View file @
d46aff17
This diff is collapsed.
Click to expand it.
src/main/webapp/WEB-INF/manager/cms/generate/index.ftl
0 → 100644
View file @
d46aff17
This diff is collapsed.
Click to expand it.
src/main/webapp/WEB-INF/manager/main.ftl
0 → 100644
View file @
d46aff17
This diff is collapsed.
Click to expand it.
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment