Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
后端镜像
java镜像
Smart Sample
提交
2ecc2c8f
S
Smart Sample
项目概览
后端镜像
/
java镜像
/
Smart Sample
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Smart Sample
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
2ecc2c8f
编写于
6月 04, 2014
作者:
黄
黄勇
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
完善 用户管理 功能
上级
5050dc0c
变更
24
隐藏空白更改
内联
并排
Showing
24 changed file
with
347 addition
and
57 deletion
+347
-57
README.md
README.md
+3
-3
src/main/java/org/smart4j/sample/action/ProductAction.java
src/main/java/org/smart4j/sample/action/ProductAction.java
+9
-1
src/main/java/org/smart4j/sample/action/UserAction.java
src/main/java/org/smart4j/sample/action/UserAction.java
+34
-9
src/main/java/org/smart4j/sample/service/UserService.java
src/main/java/org/smart4j/sample/service/UserService.java
+12
-1
src/main/java/org/smart4j/sample/service/impl/UserServiceImpl.java
...java/org/smart4j/sample/service/impl/UserServiceImpl.java
+47
-1
src/main/resources/i18n/i18n_en_US.properties
src/main/resources/i18n/i18n_en_US.properties
+7
-3
src/main/resources/i18n/i18n_zh_CN.properties
src/main/resources/i18n/i18n_zh_CN.properties
+6
-2
src/main/webapp/WEB-INF/jsp/common/header.jsp
src/main/webapp/WEB-INF/jsp/common/header.jsp
+4
-2
src/main/webapp/WEB-INF/jsp/login.jsp
src/main/webapp/WEB-INF/jsp/login.jsp
+6
-1
src/main/webapp/WEB-INF/jsp/product_list.jsp
src/main/webapp/WEB-INF/jsp/product_list.jsp
+14
-4
src/main/webapp/WEB-INF/jsp/product_view.jsp
src/main/webapp/WEB-INF/jsp/product_view.jsp
+6
-2
src/main/webapp/WEB-INF/jsp/user.jsp
src/main/webapp/WEB-INF/jsp/user.jsp
+4
-22
src/main/webapp/WEB-INF/jsp/user_create.jsp
src/main/webapp/WEB-INF/jsp/user_create.jsp
+43
-0
src/main/webapp/WEB-INF/jsp/user_edit.jsp
src/main/webapp/WEB-INF/jsp/user_edit.jsp
+47
-0
src/main/webapp/WEB-INF/jsp/user_list.jsp
src/main/webapp/WEB-INF/jsp/user_list.jsp
+24
-0
src/main/webapp/www/css/global.css
src/main/webapp/www/css/global.css
+4
-0
src/main/webapp/www/js/login.js
src/main/webapp/www/js/login.js
+1
-1
src/main/webapp/www/js/product_create.js
src/main/webapp/www/js/product_create.js
+1
-1
src/main/webapp/www/js/product_edit.js
src/main/webapp/www/js/product_edit.js
+2
-2
src/main/webapp/www/js/product_upload.js
src/main/webapp/www/js/product_upload.js
+1
-1
src/main/webapp/www/js/product_view.js
src/main/webapp/www/js/product_view.js
+1
-1
src/main/webapp/www/js/user.js
src/main/webapp/www/js/user.js
+29
-0
src/main/webapp/www/js/user_create.js
src/main/webapp/www/js/user_create.js
+19
-0
src/main/webapp/www/js/user_edit.js
src/main/webapp/www/js/user_edit.js
+23
-0
未找到文件。
README.md
浏览文件 @
2ecc2c8f
#Smart Sample
#
Smart Sample
##运行环境
##
运行环境
1.
JDK 1.6+
2.
MySQL 5.5+
3.
Tomcat 7.0+
##使用方法
##
使用方法
1.
打开 src/main/resources/smart.properties 文件,修改数据库连接信息
2.
在 MySQL 中创建数据库,并执行 doc/sample.sql 脚本,初始化表结构及其数据
...
...
src/main/java/org/smart4j/sample/action/ProductAction.java
浏览文件 @
2ecc2c8f
...
...
@@ -14,6 +14,7 @@ import org.smart4j.framework.mvc.bean.Result;
import
org.smart4j.framework.mvc.bean.View
;
import
org.smart4j.framework.util.WebUtil
;
import
org.smart4j.plugin.security.annotation.HasPermissions
;
import
org.smart4j.plugin.security.annotation.HasRoles
;
import
org.smart4j.sample.Constant
;
import
org.smart4j.sample.Tool
;
import
org.smart4j.sample.bean.ProductBean
;
...
...
@@ -27,7 +28,7 @@ public class ProductAction {
@Inject
private
ProductService
productService
;
@Request
.
Get
(
"/product"
)
@Request
.
Get
(
"/product
s
"
)
public
View
index
()
{
int
pageNumber
=
1
;
int
pageSize
=
Tool
.
getPageSize
(
"product_pager"
);
...
...
@@ -57,6 +58,7 @@ public class ProductAction {
.
data
(
"productTypeList"
,
productTypeList
);
}
@HasPermissions
(
"product.create"
)
@Request
.
Post
(
"/product/create"
)
public
Result
create
(
Params
params
,
Multiparts
multiparts
)
{
Map
<
String
,
Object
>
fieldMap
=
params
.
getFieldMap
();
...
...
@@ -65,12 +67,14 @@ public class ProductAction {
return
new
Result
(
success
);
}
@HasPermissions
(
"product.delete"
)
@Request
.
Delete
(
"/product/delete/{id}"
)
public
Result
delete
(
long
id
)
{
boolean
success
=
productService
.
deleteProduct
(
id
);
return
new
Result
(
success
);
}
@HasPermissions
(
"product.view"
)
@Request
.
Get
(
"/product/view/{id}"
)
public
View
view
(
long
id
)
{
ProductBean
productBean
=
productService
.
getProductBean
(
id
);
...
...
@@ -78,6 +82,7 @@ public class ProductAction {
.
data
(
"productBean"
,
productBean
);
}
@HasPermissions
(
"product.edit"
)
@Request
.
Get
(
"/product/edit/{id}"
)
public
View
edit
(
long
id
)
{
List
<
ProductType
>
productTypeList
=
productService
.
getProductTypeList
();
...
...
@@ -87,6 +92,7 @@ public class ProductAction {
.
data
(
"productBean"
,
productBean
);
}
@HasRoles
(
"admin"
)
@Request
.
Put
(
"/product/update/{id}"
)
public
Result
update
(
long
id
,
Params
params
)
{
Map
<
String
,
Object
>
fieldMap
=
params
.
getFieldMap
();
...
...
@@ -94,6 +100,7 @@ public class ProductAction {
return
new
Result
(
success
);
}
@HasRoles
(
"admin"
)
@Request
.
Get
(
"/product/upload_picture/{id}"
)
public
View
uploadPicture
(
long
id
)
{
Product
product
=
productService
.
getProduct
(
id
);
...
...
@@ -101,6 +108,7 @@ public class ProductAction {
.
data
(
"product"
,
product
);
}
@HasRoles
(
"admin"
)
@Request
.
Post
(
"/product/upload_picture/{id}"
)
public
Result
uploadPicture
(
long
id
,
Params
params
,
Multiparts
multiparts
)
{
Map
<
String
,
Object
>
fieldMap
=
params
.
getFieldMap
();
...
...
src/main/java/org/smart4j/sample/action/UserAction.java
浏览文件 @
2ecc2c8f
package
org.smart4j.sample.action
;
import
java.util.List
;
import
java.util.Map
;
import
org.smart4j.framework.ioc.annotation.Inject
;
import
org.smart4j.framework.mvc.DataContext
;
import
org.smart4j.framework.mvc.annotation.Action
;
import
org.smart4j.framework.mvc.annotation.Request
;
import
org.smart4j.framework.mvc.bean.Params
;
import
org.smart4j.framework.mvc.bean.Result
;
import
org.smart4j.framework.mvc.bean.View
;
import
org.smart4j.plugin.security.annotation.HasRoles
;
import
org.smart4j.sample.entity.User
;
import
org.smart4j.sample.service.UserService
;
@Action
@HasRoles
(
"admin"
)
public
class
UserAction
{
@Inject
private
UserService
userService
;
@Request
.
Get
(
"/user"
)
@Request
.
Get
(
"/user
s
"
)
public
View
index
()
{
List
<
User
>
userList
=
userService
.
get
UserList
();
List
<
User
>
userList
=
userService
.
find
UserList
();
DataContext
.
Request
.
put
(
"userList"
,
userList
);
return
new
View
(
"user.jsp"
);
}
@Request
.
Post
(
"/users"
)
public
View
search
(
Params
params
)
{
String
username
=
params
.
getString
(
"username"
);
List
<
User
>
userList
=
userService
.
findUserListByUsername
(
username
);
DataContext
.
Request
.
put
(
"userList"
,
userList
);
return
new
View
(
"user_list.jsp"
);
}
@Request
.
Get
(
"/user"
)
public
View
create
()
{
return
new
View
(
"user_create.jsp"
);
}
@Request
.
Post
(
"/user"
)
public
View
save
()
{
return
new
View
(
"user.jsp"
);
public
Result
save
(
Params
params
)
{
Map
<
String
,
Object
>
fieldMap
=
params
.
getFieldMap
();
boolean
result
=
userService
.
saveUser
(
fieldMap
);
return
new
Result
(
result
);
}
@Request
.
Get
(
"/user/{id}"
)
public
View
edit
()
{
public
View
edit
(
long
id
)
{
User
user
=
userService
.
findUser
(
id
);
DataContext
.
Request
.
put
(
"user"
,
user
);
return
new
View
(
"user_edit.jsp"
);
}
@Request
.
Put
(
"/user/{id}"
)
public
View
update
()
{
return
new
View
(
"user.jsp"
);
public
Result
update
(
long
id
,
Params
params
)
{
Map
<
String
,
Object
>
fieldMap
=
params
.
getFieldMap
();
boolean
result
=
userService
.
updateUser
(
id
,
fieldMap
);
return
new
Result
(
result
);
}
@Request
.
Delete
(
"/user/{id}"
)
public
View
delete
()
{
return
new
View
(
"user.jsp"
);
public
Result
delete
(
long
id
)
{
boolean
result
=
userService
.
deleteUser
(
id
);
return
new
Result
(
result
);
}
}
src/main/java/org/smart4j/sample/service/UserService.java
浏览文件 @
2ecc2c8f
package
org.smart4j.sample.service
;
import
java.util.List
;
import
java.util.Map
;
import
org.smart4j.sample.entity.User
;
public
interface
UserService
{
void
login
(
String
username
,
String
password
);
List
<
User
>
getUserList
();
List
<
User
>
findUserList
();
List
<
User
>
findUserListByUsername
(
String
username
);
User
findUser
(
long
id
);
boolean
saveUser
(
Map
<
String
,
Object
>
fieldMap
);
boolean
updateUser
(
long
id
,
Map
<
String
,
Object
>
fieldMap
);
boolean
deleteUser
(
long
id
);
}
src/main/java/org/smart4j/sample/service/impl/UserServiceImpl.java
浏览文件 @
2ecc2c8f
package
org.smart4j.sample.service.impl
;
import
java.util.List
;
import
java.util.Map
;
import
org.smart4j.framework.orm.DataSet
;
import
org.smart4j.framework.tx.annotation.Service
;
import
org.smart4j.framework.tx.annotation.Transaction
;
import
org.smart4j.framework.util.CastUtil
;
import
org.smart4j.framework.util.StringUtil
;
import
org.smart4j.plugin.security.SecurityHelper
;
import
org.smart4j.sample.entity.User
;
import
org.smart4j.sample.service.UserService
;
...
...
@@ -16,7 +20,49 @@ public class UserServiceImpl implements UserService {
}
@Override
public
List
<
User
>
get
UserList
()
{
public
List
<
User
>
find
UserList
()
{
return
DataSet
.
selectList
(
User
.
class
);
}
@Override
public
List
<
User
>
findUserListByUsername
(
String
username
)
{
return
DataSet
.
selectListWithCondition
(
User
.
class
,
"username like ?"
,
"%"
+
username
+
"%"
);
}
@Override
public
User
findUser
(
long
id
)
{
return
DataSet
.
select
(
User
.
class
,
"id = ?"
,
id
);
}
@Override
@Transaction
public
boolean
saveUser
(
Map
<
String
,
Object
>
fieldMap
)
{
// 加密密码
String
password
=
CastUtil
.
castString
(
fieldMap
.
get
(
"password"
));
password
=
SecurityHelper
.
encrypt
(
password
);
fieldMap
.
put
(
"password"
,
password
);
// 插入用户
return
DataSet
.
insert
(
User
.
class
,
fieldMap
);
}
@Override
@Transaction
public
boolean
updateUser
(
long
id
,
Map
<
String
,
Object
>
fieldMap
)
{
// 若密码不为空,则加密密码,否则不更新密码
String
password
=
CastUtil
.
castString
(
fieldMap
.
get
(
"password"
));
if
(
StringUtil
.
isNotEmpty
(
password
))
{
password
=
SecurityHelper
.
encrypt
(
password
);
fieldMap
.
put
(
"password"
,
password
);
}
else
{
fieldMap
.
remove
(
"password"
);
}
// 更新用户
return
DataSet
.
update
(
User
.
class
,
fieldMap
,
"id = ?"
,
id
);
}
@Override
@Transaction
public
boolean
deleteUser
(
long
id
)
{
return
DataSet
.
delete
(
User
.
class
,
"id = ?"
,
id
);
}
}
src/main/resources/i18n/i18n_en_US.properties
浏览文件 @
2ecc2c8f
...
...
@@ -33,7 +33,7 @@ login.username=Username
login.password
=
Password
login.failure
=
Login failure!
product
=
Product
product
=
Product
s
product.product_list
=
Product List
product.create_product
=
Create Product
product.view_product
=
View Product
...
...
@@ -46,7 +46,11 @@ product.description=Description
product.picture
=
Picture
product.delete_confirm
=
Do you want to delete product {0}?
user
=
User
user
=
User
s
user.user_list
=
User List
user.create_user
=
Create User
user.username
=
Username
\ No newline at end of file
user.edit_user
=
Edit User
user.username
=
Username
user.password
=
Password
user.password.tip
=
Change the password here
user.delete_confirm
=
Do you want to delete user {0}?
\ No newline at end of file
src/main/resources/i18n/i18n_zh_CN.properties
浏览文件 @
2ecc2c8f
...
...
@@ -20,7 +20,7 @@ common.pager.next=\u4E0B\u9875
common.pager.last
=
\u6700\u
540E
\u
4E00
\u9875
common.pager.input_error
=
\u
8F93
\u5165\u6709\u
8BEF
\u
FF01
common.captcha
=
\u
9A8C
\u
8BC1
\u7801
common.captcha.change
=
\u6362\u
4E00
\u
4E2A
\u
65B0
\u
7684\u
9A8C
\u
8BC1
\u7801
common.captcha.change
=
\u6362\u
4E00
\u
4E2A
\u
65B0
\u
9A8C
\u
8BC1
\u7801
common.captcha.error
=
\u
9A8C
\u
8BC1
\u7801\u9519\u
8BEF
\u
FF01
error.page
=
\u9519\u
8BEF
\u9875\u9762
...
...
@@ -49,4 +49,8 @@ product.delete_confirm=\u4F60\u786E\u5B9A\u5220\u9664\u4EA7\u54C1 {0} \u5417\uFF
user
=
\u7528\u6237
user.user_list
=
\u7528\u6237\u5217\u8868
user.create_user
=
\u
521B
\u
5EFA
\u7528\u6237
user.username
=
\u7528\u6237\u
540D
\ No newline at end of file
user.edit_user
=
\u
7F16
\u
8F91
\u7528\u6237
user.username
=
\u7528\u6237\u
540D
user.password
=
\u
5BC6
\u7801
user.password.tip
=
\u5728\u
6B64
\u5904\u
4FEE
\u6539\u
5BC6
\u7801
user.delete_confirm
=
\u
4F60
\u
786E
\u
5B9A
\u5220\u9664\u7528\u6237
{0}
\u5417\u
FF1F
\ No newline at end of file
src/main/webapp/WEB-INF/jsp/common/header.jsp
浏览文件 @
2ecc2c8f
...
...
@@ -6,8 +6,10 @@
<a
href=
"${BASE}/"
><f:message
key=
"common.title"
/></a>
</div>
<div
class=
"menu"
>
<a
href=
"${BASE}/product"
><f:message
key=
"product"
/></a>
<a
href=
"${BASE}/user"
><f:message
key=
"user"
/></a>
<a
href=
"${BASE}/products"
><f:message
key=
"product"
/></a>
<security:hasRole
name=
"admin"
>
<a
href=
"${BASE}/users"
><f:message
key=
"user"
/></a>
</security:hasRole>
</div>
<div
class=
"oper"
>
<span><f:message
key=
"common.user"
/>
:
<security:principal/></span>
...
...
src/main/webapp/WEB-INF/jsp/login.jsp
浏览文件 @
2ecc2c8f
<%@ page
pageEncoding=
"UTF-8"
%>
<%@ include
file=
"common/global.jsp"
%>
<%@ taglib
prefix=
"security"
uri=
"/security"
%>
<!DOCTYPE html>
<html>
...
...
@@ -10,6 +11,10 @@
</head>
<body>
<security:user>
<c:redirect
context=
"
${
BASE
}
"
url=
"/products"
/>
</security:user>
<div
id=
"header"
>
<div
class=
"logo"
>
<a
href=
"${BASE}/"
><f:message
key=
"common.title"
/></a>
...
...
@@ -31,7 +36,7 @@
</div>
<div
class=
"css-form-row"
>
<label
for=
"captcha"
><f:message
key=
"common.captcha"
/>
:
</label>
<input
type=
"
password
"
id=
"captcha"
name=
"captcha"
class=
"css-width-50 ext-required"
>
<input
type=
"
text
"
id=
"captcha"
name=
"captcha"
class=
"css-width-50 ext-required"
>
<img
id=
"captcha_img"
src=
"${BASE}/captcha"
title=
"
<f:message
key=
"common.captcha.change"
/>
"
class=
"css-cursor-pointer ext-captcha"
>
</div>
<div
class=
"css-form-footer css-text-center"
>
...
...
src/main/webapp/WEB-INF/jsp/product_list.jsp
浏览文件 @
2ecc2c8f
<%@ page
pageEncoding=
"UTF-8"
%>
<%@ include
file=
"common/global.jsp"
%>
<%@ taglib
prefix=
"security"
uri=
"/security"
%>
<c:set
var=
"productBeanList"
value=
"
${
productBeanPager
.
recordList
}
"
/>
...
...
@@ -22,9 +23,14 @@
<c:set
var=
"picture"
value=
"www/upload/${product.picture}"
/>
<tr
data-id=
"${product.id}"
data-name=
"${product.name}"
>
<td>
<a
href=
"${BASE}/product/upload_picture/${product.id}"
>
<security:hasRole
name=
"admin"
>
<a
href=
"${BASE}/product/upload_picture/${product.id}"
>
<img
src=
"${BASE}/${not empty product.picture ? picture : 'www/img/s.gif'}"
height=
"32"
/>
</a>
</security:hasRole>
<security:lacksRole
name=
"admin"
>
<img
src=
"${BASE}/${not empty product.picture ? picture : 'www/img/s.gif'}"
height=
"32"
/>
</
a
>
</
security:lacksRole
>
</td>
<td>
${productType.name}
</td>
<td>
...
...
@@ -34,8 +40,12 @@
<td>
${product.price}
</td>
<td>
${product.description}
</td>
<td>
<a
href=
"${BASE}/product/edit/${product.id}"
><f:message
key=
"common.edit"
/></a>
<a
href=
"#"
class=
"ext-product-delete"
><f:message
key=
"common.delete"
/></a>
<security:hasPermission
name=
"product.edit"
>
<a
href=
"${BASE}/product/edit/${product.id}"
><f:message
key=
"common.edit"
/></a>
</security:hasPermission>
<security:hasPermission
name=
"product.delete"
>
<a
href=
"#"
class=
"ext-product-delete"
><f:message
key=
"common.delete"
/></a>
</security:hasPermission>
</td>
</tr>
</c:forEach>
...
...
src/main/webapp/WEB-INF/jsp/product_view.jsp
浏览文件 @
2ecc2c8f
...
...
@@ -54,13 +54,17 @@
</div>
<div
class=
"css-form-row"
>
<label></label>
<a
href=
"${BASE}/product/upload_picture/${product.id}"
><f:message
key=
"common.upload"
/></a>
<security:hasRole
name=
"admin"
>
<a
href=
"${BASE}/product/upload_picture/${product.id}"
><f:message
key=
"common.upload"
/></a>
</security:hasRole>
<a
href=
"${BASE}/product/download_picture/${product.id}"
><f:message
key=
"common.download"
/></a>
</div>
</div>
</div>
<div
class=
"css-form-footer"
>
<button
type=
"button"
id=
"edit"
><f:message
key=
"common.edit"
/></button>
<security:hasPermission
name=
"product.edit"
>
<button
type=
"button"
id=
"edit"
><f:message
key=
"common.edit"
/></button>
</security:hasPermission>
<button
type=
"button"
id=
"back"
><f:message
key=
"common.back"
/></button>
</div>
</form>
...
...
src/main/webapp/WEB-INF/jsp/user.jsp
浏览文件 @
2ecc2c8f
...
...
@@ -32,30 +32,12 @@
</form>
</div>
<div
class=
"css-right"
>
<a
href=
"${BASE}/user
/create
"
><f:message
key=
"user.create_user"
/></a>
<a
href=
"${BASE}/user"
><f:message
key=
"user.create_user"
/></a>
</div>
</div>
<table
class=
"css-table"
>
<thead>
<tr>
<td><f:message
key=
"user.username"
/></td>
<td
class=
"css-width-75"
><f:message
key=
"common.action"
/></td>
</tr>
</thead>
<tbody>
<c:forEach
var=
"user"
items=
"
${
userList
}
"
>
<tr
data-id=
"${user.id}"
data-name=
"${user.username}"
>
<td>
<a
href=
"${BASE}/user/${user.id}"
>
${user.username}
</a>
</td>
<td>
<a
href=
"${BASE}/user/${user.id}"
><f:message
key=
"common.edit"
/></a>
<a
href=
"${BASE}/user/${user.id}"
class=
"ext-user-delete"
><f:message
key=
"common.delete"
/></a>
</td>
</tr>
</c:forEach>
</tbody>
</table>
<div
id=
"user_list"
>
<%@ include
file=
"user_list.jsp"
%>
</div>
</div>
</div>
</div>
...
...
src/main/webapp/WEB-INF/jsp/user_create.jsp
0 → 100644
浏览文件 @
2ecc2c8f
<%@ page
pageEncoding=
"UTF-8"
%>
<%@ include
file=
"common/global.jsp"
%>
<%@ taglib
prefix=
"security"
uri=
"/security"
%>
<!DOCTYPE html>
<html>
<head>
<%@ include
file=
"common/meta.jsp"
%>
<title><f:message
key=
"common.title"
/>
-
<f:message
key=
"user"
/></title>
<%@ include
file=
"common/style.jsp"
%>
</head>
<body>
<%@ include
file=
"common/header.jsp"
%>
<div
id=
"content"
>
<form
id=
"user_create_form"
class=
"css-form"
>
<div
class=
"css-form-header"
>
<h3><f:message
key=
"user.create_user"
/></h3>
</div>
<div
class=
"css-form-row"
>
<label
for=
"username"
><f:message
key=
"user.username"
/>
:
</label>
<input
type=
"text"
id=
"username"
name=
"username"
class=
"ext-required"
>
</div>
<div
class=
"css-form-row"
>
<label
for=
"password"
><f:message
key=
"user.password"
/>
:
</label>
<input
type=
"text"
id=
"password"
name=
"password"
class=
"ext-required"
>
</div>
<div
class=
"css-form-footer"
>
<button
type=
"submit"
><f:message
key=
"common.save"
/></button>
<button
type=
"button"
id=
"back"
><f:message
key=
"common.back"
/></button>
</div>
</form>
</div>
<%@ include
file=
"common/footer.jsp"
%>
<%@ include
file=
"common/script.jsp"
%>
<script
type=
"text/javascript"
src=
"${BASE}/www/js/user_create.js"
></script>
</body>
</html>
\ No newline at end of file
src/main/webapp/WEB-INF/jsp/user_edit.jsp
0 → 100644
浏览文件 @
2ecc2c8f
<%@ page
pageEncoding=
"UTF-8"
%>
<%@ include
file=
"common/global.jsp"
%>
<%@ taglib
prefix=
"security"
uri=
"/security"
%>
<!DOCTYPE html>
<html>
<head>
<%@ include
file=
"common/meta.jsp"
%>
<title><f:message
key=
"common.title"
/>
-
<f:message
key=
"user"
/></title>
<%@ include
file=
"common/style.jsp"
%>
</head>
<body>
<%@ include
file=
"common/header.jsp"
%>
<input
type=
"hidden"
id=
"id"
value=
"${user.id}"
>
<div
id=
"content"
>
<form
id=
"user_edit_form"
class=
"css-form"
>
<div
class=
"css-form-header"
>
<h3><f:message
key=
"user.edit_user"
/></h3>
</div>
<div
class=
"css-form-row"
>
<label
for=
"username"
><f:message
key=
"user.username"
/>
:
</label>
<input
type=
"text"
id=
"username"
value=
"${user.username}"
class=
"css-readonly"
readonly
>
</div>
<div
class=
"css-form-row"
>
<label
for=
"password"
><f:message
key=
"user.password"
/>
:
</label>
<input
type=
"text"
id=
"password"
name=
"password"
>
<span
class=
"css-tip"
><f:message
key=
"user.password.tip"
/></span>
</div>
<div
class=
"css-form-footer"
>
<button
type=
"submit"
><f:message
key=
"common.save"
/></button>
<button
type=
"button"
id=
"back"
><f:message
key=
"common.back"
/></button>
</div>
</form>
</div>
<%@ include
file=
"common/footer.jsp"
%>
<%@ include
file=
"common/script.jsp"
%>
<script
type=
"text/javascript"
src=
"${BASE}/www/js/user_edit.js"
></script>
</body>
</html>
\ No newline at end of file
src/main/webapp/WEB-INF/jsp/user_list.jsp
0 → 100644
浏览文件 @
2ecc2c8f
<%@ page
pageEncoding=
"UTF-8"
%>
<%@ include
file=
"common/global.jsp"
%>
<table
class=
"css-table"
>
<thead>
<tr>
<td><f:message
key=
"user.username"
/></td>
<td
class=
"css-width-75"
><f:message
key=
"common.action"
/></td>
</tr>
</thead>
<tbody>
<c:forEach
var=
"user"
items=
"
${
userList
}
"
>
<tr
data-id=
"${user.id}"
data-username=
"${user.username}"
>
<td>
<a
href=
"${BASE}/user/${user.id}"
>
${user.username}
</a>
</td>
<td>
<a
href=
"${BASE}/user/${user.id}"
><f:message
key=
"common.edit"
/></a>
<a
href=
"${BASE}/user/${user.id}"
class=
"ext-user-delete"
><f:message
key=
"common.delete"
/></a>
</td>
</tr>
</c:forEach>
</tbody>
</table>
\ No newline at end of file
src/main/webapp/www/css/global.css
浏览文件 @
2ecc2c8f
...
...
@@ -327,4 +327,8 @@ img {
.css-cursor-pointer
{
cursor
:
pointer
;
}
.css-tip
{
color
:
#999
;
}
\ No newline at end of file
src/main/webapp/www/js/login.js
浏览文件 @
2ecc2c8f
$
(
function
()
{
var
mainURL
=
BASE
+
'
/product
'
;
var
mainURL
=
BASE
+
'
/product
s
'
;
$
(
'
#login_form
'
).
ajaxForm
({
type
:
'
post
'
,
...
...
src/main/webapp/www/js/product_create.js
浏览文件 @
2ecc2c8f
...
...
@@ -8,7 +8,7 @@ $(function() {
},
success
:
function
(
result
)
{
if
(
result
.
success
)
{
location
.
href
=
BASE
+
'
/product
'
;
location
.
href
=
BASE
+
'
/product
s
'
;
}
}
});
...
...
src/main/webapp/www/js/product_edit.js
浏览文件 @
2ecc2c8f
...
...
@@ -8,7 +8,7 @@ $(function() {
},
success
:
function
(
result
)
{
if
(
result
.
success
)
{
location
.
href
=
BASE
+
'
/product
'
;
location
.
href
=
BASE
+
'
/product
s
'
;
}
}
});
...
...
@@ -18,6 +18,6 @@ $(function() {
});
$
(
'
#back
'
).
click
(
function
()
{
location
.
href
=
BASE
+
'
/product
'
;
location
.
href
=
BASE
+
'
/product
s
'
;
});
});
\ No newline at end of file
src/main/webapp/www/js/product_upload.js
浏览文件 @
2ecc2c8f
...
...
@@ -18,6 +18,6 @@ $(function() {
});
$
(
'
#back
'
).
click
(
function
()
{
location
.
href
=
BASE
+
'
/product
'
;
location
.
href
=
BASE
+
'
/product
s
'
;
});
});
\ No newline at end of file
src/main/webapp/www/js/product_view.js
浏览文件 @
2ecc2c8f
...
...
@@ -5,6 +5,6 @@ $(function() {
});
$
(
'
#back
'
).
click
(
function
()
{
location
.
href
=
BASE
+
'
/product
'
;
location
.
href
=
BASE
+
'
/product
s
'
;
});
});
\ No newline at end of file
src/main/webapp/www/js/user.js
浏览文件 @
2ecc2c8f
$
(
function
()
{
$
(
'
#user_search_form
'
).
ajaxForm
({
type
:
'
post
'
,
url
:
BASE
+
'
/users
'
,
dataType
:
'
html
'
,
success
:
function
(
html
)
{
$
(
'
#user_list
'
).
html
(
html
);
}
});
$
(
'
.ext-user-delete
'
).
click
(
function
()
{
var
$tr
=
$
(
this
).
closest
(
'
tr
'
);
var
username
=
$tr
.
data
(
'
username
'
);
if
(
confirm
(
Smart
.
i18n
(
'
user.delete_confirm
'
,
username
)))
{
var
url
=
$
(
this
).
attr
(
'
href
'
);
$
.
ajax
({
type
:
'
delete
'
,
url
:
url
,
dataType
:
'
json
'
,
success
:
function
(
result
)
{
if
(
result
.
success
)
{
location
.
reload
();
}
}
});
}
return
false
;
});
});
\ No newline at end of file
src/main/webapp/www/js/user_create.js
0 → 100644
浏览文件 @
2ecc2c8f
$
(
function
()
{
$
(
'
#user_create_form
'
).
ajaxForm
({
type
:
'
post
'
,
url
:
BASE
+
'
/user
'
,
dataType
:
'
json
'
,
beforeSubmit
:
function
()
{
return
Smart
.
Validator
.
checkRequired
(
'
user_create_form
'
);
},
success
:
function
(
result
)
{
if
(
result
.
success
)
{
location
.
href
=
BASE
+
'
/users
'
;
}
}
});
$
(
'
#back
'
).
click
(
function
()
{
history
.
back
();
});
});
\ No newline at end of file
src/main/webapp/www/js/user_edit.js
0 → 100644
浏览文件 @
2ecc2c8f
$
(
function
()
{
$
(
'
#user_edit_form
'
).
ajaxForm
({
type
:
'
put
'
,
url
:
BASE
+
'
/user/
'
+
$
(
'
#id
'
).
val
(),
dataType
:
'
json
'
,
beforeSubmit
:
function
()
{
return
Smart
.
Validator
.
checkRequired
(
'
user_edit_form
'
);
},
success
:
function
(
result
)
{
if
(
result
.
success
)
{
location
.
href
=
BASE
+
'
/users
'
;
}
}
});
$
(
'
#save
'
).
click
(
function
()
{
$
(
'
#user_edit_form
'
).
submit
();
});
$
(
'
#back
'
).
click
(
function
()
{
location
.
href
=
BASE
+
'
/users
'
;
});
});
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录