refactor, fix bug and update i18n(management), to be continue

pull/680/head
shiqstone 2021-04-21 12:22:34 +08:00
parent d9e2b0bc8b
commit cb70c35037
20 changed files with 690 additions and 462 deletions

View File

@ -29,6 +29,8 @@ confirm_password = Confirm password
new_account = Create New Account
setting = Setting
save = Save
edit = Edit
delete = Delete
cancel = Cancel
create = Create
confirm_delete = Confirm
@ -42,6 +44,14 @@ administrator = Administrator
editor = Editor
observer = Observer
back = Back
detail = Detail
admin_right = Reading, writing and management
editor_right = Reading and writing
observer_right = Reading only
yes = yes
no = no
read = Read
generate = Generate
[message]
tips = Tips
@ -190,10 +200,22 @@ origin_pwd_empty = The origin password cannot be empty
new_pwd_empty = The new password cannot be empty
confirm_pwd_empty = The confirm password cannot be empty
pwd_length = Password must be between 6-18 characters
pwd_length_tips = Password must be between 6-50 characters
wrong_origin_pwd = The origin password incorrect
wrong_confirm_pwd = The confirm passwrod incorrect
same_pwd = The new password must different from the origin
pwd_encrypt_failed = Password encryption failed
team_name_empty = Team name cannot be emtpy
proj_empty = Project cannot be empty
site_name_empty = Site name cannot be empty
proj_space_name_empty = Project space name cannot be empty
proj_space_id_empty = Project space id cannot be empty
proj_space_id_tips = The project space id can only consist of letters and numbers and be between 2-100 characters
project_order_desc = Number only, sort from largest to smallest
project_label_desc = Allows up to 10 labels, use ";" to separate multiple tags
cannot_change_own_status = Cannot change own status
cannot_change_super_status = Cannot change super administrator status
cannot_change_super_priv = Cannot change super administrator permissions
[blog]
author = Author
@ -246,7 +268,10 @@ make_private = Into Privete
history_record_amount = Number of history records
corp_id = corp name
text_editor = editor
project_label = Project Label
project_order = Project Order
access_pass = Access Password
access_token = Access Token
auto_publish = Auto publish
enable_export = Enable Export
enable_share = Enable Share
@ -429,7 +454,7 @@ no_result = No search result
first = first
last = last
prev = prev
next =
next = next
[uc]
user_center = User Center
@ -444,6 +469,95 @@ description = Description
description_tips = Description cannot exceed 500 characters
avatar = Avatar
change_avatar = Change avatar
password = Password
origin_pwd = Origin password
new_pwd = New password
confirm_pwd = Confirm password
confirm_pwd = Confirm password
role = Role
type = Type
status = Status
super_admin = Super administrator
admin = Administrator
user = User
normal = Normal
disable = Disable
enable = Enable
create_user = Create User
edit_user = Edit User
pwd_tips = Please leave it blank if you do not change the password, only local users can change the password
[mgr]
dashboard_menu = Dashboard
user_menu = User
team_menu = Team
project_menu = Project
project_space_menu = Project Space
comment_menu = Comment
config_menu = Configure
attachment_menu = Attachment
label_menu = Label
dashboard_mgr = Dashboard
user_mgr = User Management
team_mgr = Team Management
project_mgr = Project Management
project_space_mgr = Project Space Management
comment_mgr = Comment Management
config_mgr = Configure Management
config_file = Configure File
attachment_mgr = Attachment Management
label_mgr = Label Management
label_name = Label name
used_quantity = Used Quantity
proj_amount = Number Of Project
blog_amount = Number Of Blog
member_amount = Number Of Member
comment_amount = Number Of Comment
attachment_amount = Number Of Attachment
member_mgr = Member Management
add_member = Add Member
create_team = Create Team
team_name = Team Name
proj = Project
member = Member
edit_team = Edit Team
team_member_mgr = Team Member Management
team_proj = Team Project
add_proj = Add Project
proj_name = Project name
proj_author = Project author
join_time = Join Time
join_proj = Join
file_name = File name
is_exist = Is Exist
exist = Exist
deleted = Deleted
proj_blog_name = Project/Blog name
doc_name = Document name
file_path = File path
download_url = Download URL
file_size = File size
upload_time = Upload time
download = Download
download_title = Download to local
attachment_name = Attachment name
site_name = Site Name
domain_icp = Domain ICP
site_desc = Site Description
site_desc_tips = Description cannot exceed 500 characters
enable_anonymous_access = Enable anonymous access
enable = Enable
disable = Disable
enable_register = Enable Registration
enable_captcha = Enable Captcha
enable_doc_his = Enable Document Historic
proj_space_name = Project space name
proj_space_id = Project space ID
create_proj_space = Create Project Space
edit_proj_space = Edit Project Space
proj_list = Project List
edit_proj = Edit Project
create_time = Create Time
creator = Creator
doc_amount = Number of Document
last_edit = Last Edit
delete_project = Delete Project

View File

@ -29,6 +29,8 @@ confirm_password = 确认密码
new_account = 用户注册
setting = 设置
save = 保存
edit = 编辑
delete = 删除
cancel = 取消
create = 创建
confirm_delete = 确定删除
@ -42,6 +44,14 @@ administrator = 管理员
editor = 编辑者
observer = 观察者
back = 返回
detail = 详情
admin_right = 拥有阅读、写作和管理权限
editor_right = 拥有阅读和写作权限
observer_right = 拥有阅读权限
yes =
no =
read = 阅读
generate = 生成
[message]
tips = 友情提示
@ -190,10 +200,22 @@ origin_pwd_empty = 原密码不能为空
new_pwd_empty = 新密码不能为空
confirm_pwd_empty = 确认密码不能为空
pwd_length = 密码必须在6-18字之间
pwd_length_tips = 密码必须在6-50个字符之间
wrong_origin_pwd = 原始密码不正确
wrong_confirm_pwd = 确认密码不正确
same_pwd = 新密码不能和原始密码相同
pwd_encrypt_failed = 密码加密失败
team_name_empty = 团队名称不能为空
proj_empty = 项目不能为空
site_name_empty = 网站标题不能为空
proj_space_name_empty = 项目空间名称不能为空
proj_space_id_empty = 项目空间标识不能为空
proj_space_id_tips = 项目空间标识只能由字母和数字组成且在2-100字符之间
project_order_desc = 只能是数字,序号越大排序越靠前
project_label_desc = 最多允许添加10个标签多个标签请用“;”分割
cannot_change_own_status = 不能变更自己的状态
cannot_change_super_status = 不能变更超级管理员的状态
cannot_change_super_priv = 不能变更超级管理员的权限
[blog]
author = 作者
@ -246,7 +268,10 @@ make_private = 转为私有
history_record_amount = 历史记录数量
corp_id = 公司名称
text_editor = 编辑器
project_label = 项目标签
project_order = 项目排序
access_pass = 访问密码
access_token = 访问令牌
auto_publish = 自动发布
enable_export = 开启导出
enable_share = 开启分享
@ -444,6 +469,95 @@ description = 描述
description_tips = 描述不能超过500字
avatar = 头像
change_avatar = 修改头像
password = 密码
origin_pwd = 原始密码
new_pwd = 新密码
confirm_pwd = 确认密码
confirm_pwd = 确认密码
role = 角色
type = 类型
status = 状态
super_admin = 超级管理员
admin = 管理员
user = 普通用户
normal = 正常
disable = 禁用
enable = 启用
create_user = 创建用户
edit_user = 编辑用户
pwd_tips = 不修改密码请留空,只支持本地用户修改密码
[mgr]
dashboard_menu = 仪表盘
user_menu = 用户管理
team_menu = 团队管理
project_menu = 项目管理
project_space_menu = 项目空间管理
comment_menu = 评论管理
config_menu = 配置管理
attachment_menu = 附件管理
label_menu = 标签管理
dashboard_mgr = 仪表盘
user_mgr = 用户管理
team_mgr = 团队管理
project_mgr = 项目管理
project_space_mgr = 项目空间管理
comment_mgr = 评论管理
config_mgr = 配置管理
config_file = 配置文件
attachment_mgr = 附件管理
label_mgr = 标签管理
label_name = 标签名称
used_quantity = 使用数量
proj_amount = 项目数量
blog_amount = 文章数量
member_amount = 成员数量
comment_amount = 评论数量
attachment_amount = 附件数量
member_mgr = 成员管理
add_member = 添加成员
create_team = 创建团队
team_name = 团队名称
proj = 项目
member = 成员
edit_team = 编辑团队
team_member_mgr = 团队用户管理
team_proj = 团队项目
add_proj = 添加项目
proj_name = 项目名称
proj_author = 项目作者
join_time = 加入时间
join_proj = 加入项目
file_name = 文件名称
is_exist = 是否存在
exist = 存在
deleted = 已删除
proj_blog_name = 项目/文章名称
doc_name = 文档名称
file_path = 文件路径
download_url = 下载路径
file_size = 文件大小
upload_time = 上传时间
download = 下载
download_title = 下载到本地
attachment_name = 附件名称
site_name = 网站标题
domain_icp = 域名备案
site_desc = 网站描述
site_desc_tips = 描述信息不超过500个字符
enable_anonymous_access = 启用匿名访问
enable = 开启
disable = 关闭
enable_register = 启用注册
enable_captcha = 启用验证码
enable_doc_his = 启用文档历史
proj_space_name = 项目空间名称
proj_space_id = 项目空间标识
create_proj_space = 创建项目空间
edit_proj_space = 编辑项目空间
proj_list = 项目列表
edit_proj = 编辑项目
create_time = 创建时间
creator = 创建者
doc_amount = 文档数量
last_edit = 最后编辑
delete_project = 删除项目

View File

@ -3,19 +3,21 @@ package controllers
import (
"bytes"
"encoding/json"
"github.com/astaxie/beego/logs"
"github.com/beego/i18n"
"io"
"strings"
"time"
"github.com/astaxie/beego/logs"
"github.com/beego/i18n"
"html/template"
"io/ioutil"
"path/filepath"
"github.com/astaxie/beego"
"github.com/mindoc-org/mindoc/conf"
"github.com/mindoc-org/mindoc/models"
"github.com/mindoc-org/mindoc/utils"
"html/template"
"io/ioutil"
"path/filepath"
)
type BaseController struct {

View File

@ -16,6 +16,7 @@ import (
"github.com/astaxie/beego"
"github.com/astaxie/beego/logs"
"github.com/astaxie/beego/orm"
"github.com/beego/i18n"
"github.com/mindoc-org/mindoc/conf"
"github.com/mindoc-org/mindoc/models"
"github.com/mindoc-org/mindoc/utils"
@ -40,17 +41,17 @@ func (c *ManagerController) Index() {
c.TplName = "manager/index.tpl"
c.Data["Model"] = models.NewDashboard().Query()
c.Data["Action"] = "index"
}
// 用户列表.
func (c *ManagerController) Users() {
c.Prepare()
c.TplName = "manager/users.tpl"
c.Data["Action"] = "users"
pageIndex, _ := c.GetInt("page", 0)
members, totalCount, err := models.NewMember().FindToPager(pageIndex, conf.PageSize)
if err != nil {
c.Data["ErrorMessage"] = err.Error()
return
@ -68,7 +69,6 @@ func (c *ManagerController) Users() {
}
b, err := json.Marshal(members)
if err != nil {
c.Data["Result"] = template.JS("[]")
} else {
@ -89,16 +89,16 @@ func (c *ManagerController) CreateMember() {
status, _ := c.GetInt("status", 0)
if ok, err := regexp.MatchString(conf.RegexpAccount, account); account == "" || !ok || err != nil {
c.JsonResult(6001, "账号只能由英文字母数字组成且在3-50个字符")
c.JsonResult(6001, i18n.Tr(c.Lang, "message.username_invalid_format"))
}
if l := strings.Count(password1, ""); password1 == "" || l > 50 || l < 6 {
c.JsonResult(6002, "密码必须在6-50个字符之间")
c.JsonResult(6002, i18n.Tr(c.Lang, "message.pwd_length_tips"))
}
if password1 != password2 {
c.JsonResult(6003, "确认密码不正确")
c.JsonResult(6003, i18n.Tr(c.Lang, "message.wrong_confirm_pwd"))
}
if ok, err := regexp.MatchString(conf.RegexpEmail, email); !ok || err != nil || email == "" {
c.JsonResult(6004, "邮箱格式不正确")
c.JsonResult(6004, i18n.Tr(c.Lang, "message.email_invalid_format"))
}
if role != 0 && role != 1 && role != 2 {
role = 1
@ -110,7 +110,7 @@ func (c *ManagerController) CreateMember() {
member := models.NewMember()
if _, err := member.FindByAccount(account); err == nil && member.MemberId > 0 {
c.JsonResult(6005, "账号已存在")
c.JsonResult(6005, i18n.Tr(c.Lang, "message.account_existed"))
}
member.Account = account
@ -139,7 +139,7 @@ func (c *ManagerController) UpdateMemberStatus() {
status, _ := c.GetInt("status", 0)
if member_id <= 0 {
c.JsonResult(6001, "参数错误")
c.JsonResult(6001, i18n.Tr(c.Lang, "message.param_error"))
}
if status != 0 && status != 1 {
status = 0
@ -147,19 +147,19 @@ func (c *ManagerController) UpdateMemberStatus() {
member := models.NewMember()
if _, err := member.Find(member_id); err != nil {
c.JsonResult(6002, "用户不存在")
c.JsonResult(6002, i18n.Tr(c.Lang, "message.user_not_existed"))
}
if member.MemberId == c.Member.MemberId {
c.JsonResult(6004, "不能变更自己的状态")
c.JsonResult(6004, i18n.Tr(c.Lang, "message.cannot_change_own_status"))
}
if member.Role == conf.MemberSuperRole {
c.JsonResult(6005, "不能变更超级管理员的状态")
c.JsonResult(6005, i18n.Tr(c.Lang, "message.cannot_change_super_status"))
}
member.Status = status
if err := member.Update(); err != nil {
logs.Error("", err)
c.JsonResult(6003, "用户状态设置失败")
c.JsonResult(6003, i18n.Tr(c.Lang, "message.failed"))
}
c.JsonResult(0, "ok", member)
}
@ -171,26 +171,26 @@ func (c *ManagerController) ChangeMemberRole() {
memberId, _ := c.GetInt("member_id", 0)
role, _ := c.GetInt("role", 0)
if memberId <= 0 {
c.JsonResult(6001, "参数错误")
c.JsonResult(6001, i18n.Tr(c.Lang, "message.param_error"))
}
if role != int(conf.MemberAdminRole) && role != int(conf.MemberGeneralRole) {
c.JsonResult(6001, "用户权限不正确")
c.JsonResult(6001, i18n.Tr(c.Lang, "message.no_permission"))
}
member := models.NewMember()
if _, err := member.Find(memberId); err != nil {
c.JsonResult(6002, "用户不存在")
c.JsonResult(6002, i18n.Tr(c.Lang, "message.user_not_existed"))
}
if member.MemberId == c.Member.MemberId {
c.JsonResult(6004, "不能变更自己的权限")
c.JsonResult(6004, i18n.Tr(c.Lang, "message.cannot_change_own_priv"))
}
if member.Role == conf.MemberSuperRole {
c.JsonResult(6005, "不能变更超级管理员的权限")
c.JsonResult(6005, i18n.Tr(c.Lang, "message.cannot_change_super_priv"))
}
member.Role = conf.SystemRole(role)
if err := member.Update(); err != nil {
c.JsonResult(6003, "用户权限设置失败")
c.JsonResult(6003, i18n.Tr(c.Lang, "message.failed"))
}
member.Lang = c.Lang
member.ResolveRoleName()
@ -201,7 +201,7 @@ func (c *ManagerController) ChangeMemberRole() {
func (c *ManagerController) EditMember() {
c.Prepare()
c.TplName = "manager/edit_users.tpl"
c.Data["Action"] = "users"
member_id, _ := c.GetInt(":id", 0)
if member_id <= 0 {
@ -209,7 +209,6 @@ func (c *ManagerController) EditMember() {
}
member, err := models.NewMember().Find(member_id)
if err != nil {
logs.Error(err)
c.Abort("404")
@ -225,7 +224,7 @@ func (c *ManagerController) EditMember() {
member.Description = description
member.RealName = c.GetString("real_name")
if password1 != "" && password2 != password1 {
c.JsonResult(6001, "确认密码不正确")
c.JsonResult(6001, i18n.Tr(c.Lang, "message.wrong_confirm_pwd"))
}
if password1 != "" && member.AuthMethod != conf.AuthMethodLDAP {
member.Password = password1
@ -237,7 +236,7 @@ func (c *ManagerController) EditMember() {
password, err := utils.PasswordHash(password1)
if err != nil {
logs.Error(err)
c.JsonResult(6003, "对用户密码加密时出错")
c.JsonResult(6003, i18n.Tr(c.Lang, "message.pwd_encrypt_failed"))
}
member.Password = password
}
@ -256,30 +255,28 @@ func (c *ManagerController) DeleteMember() {
member_id, _ := c.GetInt("id", 0)
if member_id <= 0 {
c.JsonResult(404, "参数错误")
c.JsonResult(404, i18n.Tr(c.Lang, "message.param_error"))
}
member, err := models.NewMember().Find(member_id)
if err != nil {
logs.Error(err)
c.JsonResult(500, "用户不存在")
c.JsonResult(500, i18n.Tr(c.Lang, "message.user_not_existed"))
}
if member.Role == conf.MemberSuperRole {
c.JsonResult(500, "不能删除超级管理员")
}
superMember, err := models.NewMember().FindByFieldFirst("role", 0)
superMember, err := models.NewMember().FindByFieldFirst("role", 0)
if err != nil {
logs.Error(err)
c.JsonResult(5001, "未能找到超级管理员")
}
err = models.NewMember().Delete(member_id, superMember.MemberId)
if err != nil {
logs.Error(err)
c.JsonResult(5002, "删除失败")
c.JsonResult(5002, i18n.Tr(c.Lang, "message.failed"))
}
c.JsonResult(0, "ok")
}
@ -288,7 +285,7 @@ func (c *ManagerController) DeleteMember() {
func (c *ManagerController) Books() {
c.Prepare()
c.TplName = "manager/books.tpl"
c.Data["Action"] = "books"
pageIndex, _ := c.GetInt("page", 1)
books, totalCount, err := models.NewBookResult().FindToPager(pageIndex, conf.PageSize)
@ -319,7 +316,7 @@ func (c *ManagerController) EditBook() {
c.Prepare()
c.TplName = "manager/edit_book.tpl"
c.Data["Action"] = "books"
identify := c.GetString(":key")
if identify == "" {
@ -329,8 +326,8 @@ func (c *ManagerController) EditBook() {
if err != nil {
c.Abort("500")
}
if c.Ctx.Input.IsPost() {
if c.Ctx.Input.IsPost() {
bookName := strings.TrimSpace(c.GetString("book_name"))
description := strings.TrimSpace(c.GetString("description", ""))
commentStatus := c.GetString("comment_status")
@ -345,7 +342,7 @@ func (c *ManagerController) EditBook() {
itemId, _ := c.GetInt("itemId")
if strings.Count(description, "") > 500 {
c.JsonResult(6004, "项目描述不能大于500字")
c.JsonResult(6004, i18n.Tr(c.Lang, "message.project_desc_tips"))
}
if commentStatus != "open" && commentStatus != "closed" && commentStatus != "group_only" && commentStatus != "registered_only" {
commentStatus = "closed"
@ -357,7 +354,7 @@ func (c *ManagerController) EditBook() {
}
}
if !models.NewItemsets().Exist(itemId) {
c.JsonResult(6006, "项目空间不存在")
c.JsonResult(6006, i18n.Tr(c.Lang, "message.project_space_not_exist"))
}
book.Publisher = publisher
book.HistoryCount = historyCount
@ -391,7 +388,7 @@ func (c *ManagerController) EditBook() {
}
if err := book.Update(); err != nil {
c.JsonResult(6006, "保存失败")
c.JsonResult(6006, i18n.Tr(c.Lang, "message.failed"))
}
c.JsonResult(0, "ok")
}
@ -411,18 +408,18 @@ func (c *ManagerController) DeleteBook() {
bookId, _ := c.GetInt("book_id", 0)
if bookId <= 0 {
c.JsonResult(6001, "参数错误")
c.JsonResult(6001, i18n.Tr(c.Lang, "message.param_error"))
}
book := models.NewBook()
err := book.ThoroughDeleteBook(bookId)
if err == orm.ErrNoRows {
c.JsonResult(6002, "项目不存在")
c.JsonResult(6002, i18n.Tr(c.Lang, "message.item_not_exist"))
}
if err != nil {
logs.Error("删除失败 -> ", err)
c.JsonResult(6003, "删除失败")
c.JsonResult(6003, i18n.Tr(c.Lang, "message.failed"))
}
c.JsonResult(0, "ok")
}
@ -437,7 +434,7 @@ func (c *ManagerController) CreateToken() {
book, err := models.NewBook().FindByFieldFirst("identify", identify)
if err != nil {
c.JsonResult(6001, "项目不存在")
c.JsonResult(6001, i18n.Tr(c.Lang, "message.item_not_exist"))
}
if action == "create" {
@ -448,14 +445,14 @@ func (c *ManagerController) CreateToken() {
book.PrivateToken = string(utils.Krand(conf.GetTokenSize(), utils.KC_RAND_KIND_ALL))
if err := book.Update(); err != nil {
logs.Error("生成阅读令牌失败 => ", err)
c.JsonResult(6003, "生成阅读令牌失败")
c.JsonResult(6003, i18n.Tr(c.Lang, "message.failed"))
}
c.JsonResult(0, "ok", conf.URLFor("DocumentController.Index", ":key", book.Identify, "token", book.PrivateToken))
} else {
book.PrivateToken = ""
if err := book.Update(); err != nil {
logs.Error("CreateToken => ", err)
c.JsonResult(6004, "删除令牌失败")
c.JsonResult(6004, i18n.Tr(c.Lang, "message.failed"))
}
c.JsonResult(0, "ok", "")
}
@ -465,7 +462,7 @@ func (c *ManagerController) CreateToken() {
func (c *ManagerController) Setting() {
c.Prepare()
c.TplName = "manager/setting.tpl"
c.Data["Action"] = "setting"
options, err := models.NewOption().All()
if c.Ctx.Input.IsPost() {
@ -484,7 +481,6 @@ func (c *ManagerController) Setting() {
for _, item := range options {
c.Data[item.OptionName] = item.OptionValue
}
}
// Transfer 转让项目.
@ -493,16 +489,16 @@ func (c *ManagerController) Transfer() {
account := c.GetString("account")
if account == "" {
c.JsonResult(6004, "接受者账号不能为空")
c.JsonResult(6004, i18n.Tr(c.Lang, "message.receive_account_empty"))
}
member, err := models.NewMember().FindByAccount(account)
if err != nil {
logs.Error("FindByAccount => ", err)
c.JsonResult(6005, "接受用户不存在")
c.JsonResult(6005, i18n.Tr(c.Lang, "message.receive_account_not_exist"))
}
if member.Status != 0 {
c.JsonResult(6006, "接受用户已被禁用")
c.JsonResult(6006, i18n.Tr(c.Lang, "message.receive_account_disabled"))
}
if !c.Member.IsAdministrator() {
@ -550,7 +546,7 @@ func (c *ManagerController) DeleteComment() {
comment_id, _ := c.GetInt("comment_id", 0)
if comment_id <= 0 {
c.JsonResult(6001, "参数错误")
c.JsonResult(6001, i18n.Tr(c.Lang, "message.param_error"))
}
comment := models.NewComment()
@ -574,7 +570,7 @@ func (c *ManagerController) PrivatelyOwned() {
identify := c.GetString("identify")
if status != "open" && status != "close" {
c.JsonResult(6003, "参数错误")
c.JsonResult(6003, i18n.Tr(c.Lang, "message.param_error"))
}
state := 0
if status == "open" {
@ -600,7 +596,7 @@ func (c *ManagerController) PrivatelyOwned() {
if err != nil {
logs.Error("PrivatelyOwned => ", err)
c.JsonResult(6004, "保存失败")
c.JsonResult(6004, i18n.Tr(c.Lang, "message.failed"))
}
c.JsonResult(0, "ok")
}
@ -609,6 +605,7 @@ func (c *ManagerController) PrivatelyOwned() {
func (c *ManagerController) AttachList() {
c.Prepare()
c.TplName = "manager/attach_list.tpl"
c.Data["Action"] = "attach"
pageIndex, _ := c.GetInt("page", 1)
@ -639,14 +636,14 @@ func (c *ManagerController) AttachList() {
func (c *ManagerController) AttachDetailed() {
c.Prepare()
c.TplName = "manager/attach_detailed.tpl"
attach_id, _ := strconv.Atoi(c.Ctx.Input.Param(":id"))
c.Data["Action"] = "attach"
attach_id, _ := strconv.Atoi(c.Ctx.Input.Param(":id"))
if attach_id <= 0 {
c.Abort("404")
}
attach, err := models.NewAttachmentResult().Find(attach_id)
if err != nil {
logs.Error("AttachDetailed => ", err)
if err == orm.ErrNoRows {
@ -691,11 +688,10 @@ func (c *ManagerController) AttachDelete() {
func (c *ManagerController) LabelList() {
c.Prepare()
c.TplName = "manager/label_list.tpl"
c.Data["Action"] = "label"
pageIndex, _ := c.GetInt("page", 1)
labels, totalCount, err := models.NewLabel().FindToPager(pageIndex, conf.PageSize)
if err != nil {
c.ShowErrorPage(50001, err.Error())
}
@ -713,13 +709,12 @@ func (c *ManagerController) LabelList() {
//删除标签
func (c *ManagerController) LabelDelete() {
labelId, err := strconv.Atoi(c.Ctx.Input.Param(":id"))
if err != nil {
logs.Error("获取删除标签参数时出错:", err)
c.JsonResult(50001, "参数错误")
c.JsonResult(50001, i18n.Tr(c.Lang, "message.param_error"))
}
if labelId <= 0 {
c.JsonResult(50001, "参数错误")
c.JsonResult(50001, i18n.Tr(c.Lang, "message.param_error"))
}
label, err := models.NewLabel().FindFirst("label_id", labelId)
@ -737,6 +732,7 @@ func (c *ManagerController) LabelDelete() {
func (c *ManagerController) Config() {
c.Prepare()
c.TplName = "manager/config.tpl"
c.Data["Action"] = "config"
if c.Ctx.Input.IsPost() {
content := strings.TrimSpace(c.GetString("configFileTextArea"))
if content == "" {
@ -774,11 +770,10 @@ func (c *ManagerController) Config() {
func (c *ManagerController) Team() {
c.Prepare()
c.TplName = "manager/team.tpl"
c.Data["Action"] = "team"
pageIndex, _ := c.GetInt("page", 0)
teams, totalCount, err := models.NewTeam().FindToPager(pageIndex, conf.PageSize)
if err != nil && err != orm.ErrNoRows {
c.ShowErrorPage(500, err.Error())
}
@ -796,7 +791,6 @@ func (c *ManagerController) Team() {
}
b, err := json.Marshal(teams)
if err != nil {
c.Data["Result"] = template.JS("[]")
} else {
@ -810,7 +804,7 @@ func (c *ManagerController) TeamCreate() {
teamName := c.GetString("teamName")
if teamName == "" {
c.JsonResult(5001, "团队名称不能为空")
c.JsonResult(5001, i18n.Tr(c.Lang, "message.team_name_empty"))
}
team := models.NewTeam()
@ -831,10 +825,10 @@ func (c *ManagerController) TeamEdit() {
teamId, _ := c.GetInt("teamId")
if teamName == "" {
c.JsonResult(5001, "团队名称不能为空")
c.JsonResult(5001, i18n.Tr(c.Lang, "message.team_name_empty"))
}
if teamId <= 0 {
c.JsonResult(5002, "团队标识不能为空")
c.JsonResult(5002, i18n.Tr(c.Lang, "message.team_id_empty"))
}
team, err := models.NewTeam().First(teamId)
@ -847,19 +841,16 @@ func (c *ManagerController) TeamEdit() {
c.CheckJsonError(5004, err)
c.JsonResult(0, "OK", team)
}
func (c *ManagerController) TeamDelete() {
c.Prepare()
teamId, _ := c.GetInt("teamId")
if teamId <= 0 {
c.JsonResult(5002, "团队标识不能为空")
c.JsonResult(5002, i18n.Tr(c.Lang, "message.team_id_empty"))
}
err := models.NewTeam().Delete(teamId)
c.CheckJsonError(5001, err)
c.JsonResult(0, "OK")
@ -868,23 +859,21 @@ func (c *ManagerController) TeamDelete() {
func (c *ManagerController) TeamMemberList() {
c.Prepare()
c.TplName = "manager/team_member_list.tpl"
c.Data["Action"] = "team"
teamId, _ := strconv.Atoi(c.Ctx.Input.Param(":id"))
if teamId <= 0 {
c.ShowErrorPage(500, i18n.Tr(c.Lang, "message.param_error"))
}
pageIndex, _ := c.GetInt("page", 0)
if teamId <= 0 {
c.ShowErrorPage(500, "参数错误")
}
team, err := models.NewTeam().First(teamId)
if err == orm.ErrNoRows {
c.ShowErrorPage(404, "团队不存在")
}
c.CheckErrorResult(500, err)
c.Data["Model"] = team
teams, totalCount, err := models.NewTeamMember().FindToPager(teamId, pageIndex, conf.PageSize)
teams, totalCount, err := models.NewTeamMember().SetLang(c.Lang).FindToPager(teamId, pageIndex, conf.PageSize)
if err != nil && err != orm.ErrNoRows {
c.ShowErrorPage(500, err.Error())
}
@ -902,7 +891,6 @@ func (c *ManagerController) TeamMemberList() {
}
b, err := json.Marshal(teams)
if err != nil {
logs.Error("编码 JSON 结果失败 ->", err)
c.Data["Result"] = template.JS("[]")
@ -919,7 +907,7 @@ func (c *ManagerController) TeamSearchMember() {
keyword := strings.TrimSpace(c.GetString("q"))
if teamId <= 0 {
c.JsonResult(500, "参数错误")
c.JsonResult(500, i18n.Tr(c.Lang, "message.param_error"))
}
searchResult, err := models.NewTeamMember().FindNotJoinMemberByAccount(teamId, keyword, 10)
@ -937,7 +925,7 @@ func (c *ManagerController) TeamMemberAdd() {
roleId, _ := c.GetInt("roleId")
if teamId <= 0 || memberId <= 0 || roleId <= 0 || roleId > int(conf.BookObserver) {
c.JsonResult(5001, "参数不正确")
c.JsonResult(5001, i18n.Tr(c.Lang, "message.system_error"))
}
teamMember := models.NewTeamMember()
@ -966,7 +954,7 @@ func (c *ManagerController) TeamMemberDelete() {
}
err = teamMember.Delete(teamMember.TeamMemberId)
if err != nil {
c.JsonResult(5002, "删除失败")
c.JsonResult(5002, i18n.Tr(c.Lang, "message.failed"))
}
c.JsonResult(0, "ok")
}
@ -977,7 +965,7 @@ func (c *ManagerController) TeamChangeMemberRole() {
roleId, _ := c.GetInt("roleId")
teamId, _ := c.GetInt("teamId")
if memberId <= 0 || roleId <= 0 || teamId <= 0 || roleId > int(conf.BookObserver) {
c.JsonResult(5001, "参数错误")
c.JsonResult(5001, i18n.Tr(c.Lang, "message.param_error"))
}
teamMember, err := models.NewTeamMember().ChangeRoleId(teamId, memberId, conf.BookRole(roleId))
@ -994,12 +982,12 @@ func (c *ManagerController) TeamChangeMemberRole() {
func (c *ManagerController) TeamBookList() {
c.Prepare()
c.TplName = "manager/team_book_list.tpl"
c.Data["Action"] = "team"
teamId, _ := strconv.Atoi(c.Ctx.Input.Param(":id"))
pageIndex, _ := c.GetInt("page", 0)
if teamId <= 0 {
c.JsonResult(5002, "团队标识不能为空")
c.JsonResult(5002, i18n.Tr(c.Lang, "message.team_id_empty"))
}
team, err := models.NewTeam().First(teamId)
@ -1029,7 +1017,6 @@ func (c *ManagerController) TeamBookList() {
}
b, err := json.Marshal(teams)
if err != nil {
logs.Error("编码 JSON 结果失败 ->", err)
c.Data["Result"] = template.JS("[]")
@ -1046,7 +1033,7 @@ func (c *ManagerController) TeamBookAdd() {
bookId, _ := c.GetInt("bookId")
if teamId <= 0 || bookId <= 0 {
c.JsonResult(500, "参数错误")
c.JsonResult(500, i18n.Tr(c.Lang, "message.param_error"))
}
teamRel := models.NewTeamRelationship()
teamRel.BookId = bookId
@ -1070,7 +1057,7 @@ func (c *ManagerController) TeamSearchBook() {
keyword := strings.TrimSpace(c.GetString("q"))
if teamId <= 0 {
c.JsonResult(500, "参数错误")
c.JsonResult(500, i18n.Tr(c.Lang, "message.param_error"))
}
searchResult, err := models.NewTeamRelationship().FindNotJoinBookByName(teamId, keyword, 10)
@ -1088,13 +1075,13 @@ func (c *ManagerController) TeamBookDelete() {
teamRelationshipId, _ := c.GetInt("teamRelId")
if teamRelationshipId <= 0 {
c.JsonResult(500, "参数错误")
c.JsonResult(500, i18n.Tr(c.Lang, "message.param_error"))
}
err := models.NewTeamRelationship().Delete(teamRelationshipId)
if err != nil {
c.JsonResult(5001, "删除失败")
c.JsonResult(5001, i18n.Tr(c.Lang, "message.failed"))
}
c.JsonResult(0, "OK")
}
@ -1103,6 +1090,7 @@ func (c *ManagerController) TeamBookDelete() {
func (c *ManagerController) Itemsets() {
c.Prepare()
c.TplName = "manager/itemsets.tpl"
c.Data["Action"] = "itemsets"
pageIndex, _ := c.GetInt("page", 0)
items, totalCount, err := models.NewItemsets().FindToPager(pageIndex, conf.PageSize)
@ -1124,7 +1112,6 @@ func (c *ManagerController) Itemsets() {
}
c.Data["Lists"] = items
}
//编辑或添加项目空间.
@ -1134,14 +1121,14 @@ func (c *ManagerController) ItemsetsEdit() {
itemName := strings.TrimSpace(c.GetString("itemName"))
itemKey := strings.TrimSpace(c.GetString("itemKey"))
if itemName == "" || itemKey == "" {
c.JsonResult(5001, "参数错误")
c.JsonResult(5001, i18n.Tr(c.Lang, "message.param_error"))
}
var item *models.Itemsets
var err error
if itemId > 0 {
if item, err = models.NewItemsets().First(itemId); err != nil {
if err == orm.ErrNoRows {
c.JsonResult(5002, "项目空间不存在")
c.JsonResult(5002, i18n.Tr(c.Lang, "message.project_space_not_exist"))
} else {
c.JsonResult(5003, "查询项目空间出错")
}

View File

@ -2,7 +2,9 @@ package models
import (
"errors"
"github.com/astaxie/beego/logs"
"github.com/beego/i18n"
"github.com/astaxie/beego/orm"
"github.com/mindoc-org/mindoc/conf"
@ -18,6 +20,7 @@ type TeamMember struct {
Account string `orm:"-" json:"account"`
RealName string `orm:"-" json:"real_name"`
Avatar string `orm:"-" json:"avatar"`
Lang string `orm:"-"`
}
// TableName 获取对应数据库表名.
@ -46,6 +49,11 @@ func NewTeamMember() *TeamMember {
return &TeamMember{}
}
func (m *TeamMember) SetLang(lang string) *TeamMember {
m.Lang = lang
return m
}
func (m *TeamMember) First(id int, cols ...string) (*TeamMember, error) {
if id <= 0 {
return nil, errors.New("参数错误")
@ -173,6 +181,7 @@ func (m *TeamMember) FindToPager(teamId, pageIndex, pageSize int) (list []*TeamM
//将来优化
for _, item := range list {
item.Lang = m.Lang
item.Include()
}
return
@ -187,13 +196,13 @@ func (m *TeamMember) Include() *TeamMember {
m.Avatar = member.Avatar
}
if m.RoleId == 0 {
m.RoleName = "创始人"
m.RoleName = i18n.Tr(m.Lang, "common.creator") //"创始人"
} else if m.RoleId == 1 {
m.RoleName = "管理员"
m.RoleName = i18n.Tr(m.Lang, "common.administrator") //"管理员"
} else if m.RoleId == 2 {
m.RoleName = "编辑者"
m.RoleName = i18n.Tr(m.Lang, "common.editor") //"编辑者"
} else if m.RoleId == 3 {
m.RoleName = "观察者"
m.RoleName = i18n.Tr(m.Lang, "common.observer") //"观察者"
}
return m
}

View File

@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>附件管理 - Powered by MinDoc</title>
<title>{{i18n .Lang "mgr.attachment_mgr"}} - Powered by MinDoc</title>
<!-- Bootstrap -->
<link href="{{cdncss "/static/bootstrap/css/bootstrap.min.css"}}" rel="stylesheet" type="text/css">
@ -24,61 +24,61 @@
{{template "widgets/header.tpl" .}}
<div class="container manual-body">
<div class="row">
{{template "manager/widgets.tpl" "attach"}}
{{template "manager/widgets.tpl" .}}
<div class="page-right">
<div class="m-box">
<div class="box-head">
<strong class="box-title">附件管理</strong>
<strong class="box-title">{{i18n .Lang "mgr.attachment_mgr"}}</strong>
</div>
</div>
<div class="box-body">
<form>
<div class="form-group">
<label>文件名称</label>
<input type="text" value="{{.Model.FileName}}" class="form-control input-readonly" readonly placeholder="文件名称">
<label>{{i18n .Lang "mgr.file_name"}}</label>
<input type="text" value="{{.Model.FileName}}" class="form-control input-readonly" readonly>
</div>
<div class="form-group">
<label>是否存在</label>
<label>{{i18n .Lang "mgr.is_exist"}}</label>
{{if .Model.IsExist }}
<input type="text" value="存在" class="form-control input-readonly" readonly placeholder="项目名称">
<input type="text" value="{{i18n .Lang "mgr.exist"}}" class="form-control input-readonly" readonly>
{{else}}
<input type="text" value="已删除" class="form-control input-readonly" readonly placeholder="项目名称">
<input type="text" value="{{i18n .Lang "mgr.deleted"}}" class="form-control input-readonly" readonly>
{{end}}
</div>
<div class="form-group">
<label>项目/文章名称</label>
<input type="text" value="{{.Model.BookName}}" class="form-control input-readonly" readonly placeholder="项目名称">
<label>{{i18n .Lang "mgr.proj_blog_name"}}</label>
<input type="text" value="{{.Model.BookName}}" class="form-control input-readonly" readonly>
</div>
{{if ne .Model.BookId 0}}
<div class="form-group">
<label>文档名称</label>
<input type="text" value="{{.Model.DocumentName}}" class="form-control input-readonly" readonly placeholder="文档名称">
<label>{{i18n .Lang "mgr.doc_name"}}</label>
<input type="text" value="{{.Model.DocumentName}}" class="form-control input-readonly" readonly>
</div>
{{end}}
<div class="form-group">
<label>文件路径</label>
<input type="text" value="{{.Model.FilePath}}" class="form-control input-readonly" readonly placeholder="文件路径">
<label>{{i18n .Lang "mgr.file_path"}}</label>
<input type="text" value="{{.Model.FilePath}}" class="form-control input-readonly" readonly>
</div>
<div class="form-group">
<label>下载路径</label>
<input type="text" value="{{.Model.HttpPath}}" class="form-control input-readonly" readonly placeholder="文件路径">
<label>{{i18n .Lang "mgr.download_path"}}</label>
<input type="text" value="{{.Model.HttpPath}}" class="form-control input-readonly" readonly>
</div>
<div class="form-group">
<label>文件大小</label>
<input type="text" value="{{.Model.FileShortSize}}" class="form-control input-readonly" readonly placeholder="文件路径">
<label>{{i18n .Lang "mgr.file_size"}}</label>
<input type="text" value="{{.Model.FileShortSize}}" class="form-control input-readonly" readonly>
</div>
<div class="form-group">
<label>上传时间</label>
<input type="text" value="{{date_format .Model.CreateTime "2006-01-02 15:04:05"}}" class="form-control input-readonly" readonly placeholder="文件路径">
<label>{{i18n .Lang "mgr.upload_time"}}</label>
<input type="text" value="{{date_format .Model.CreateTime "2006-01-02 15:04:05"}}" class="form-control input-readonly" readonly>
</div>
<div class="form-group">
<label>用户账号</label>
<input type="text" value="{{ .Model.Account }}" class="form-control input-readonly" readonly placeholder="文件路径">
<label>{{i18n .Lang "uc.account"}}</label>
<input type="text" value="{{ .Model.Account }}" class="form-control input-readonly" readonly>
</div>
<div class="form-group">
<a href="{{urlfor "ManagerController.AttachList" }}" class="btn btn-success btn-sm">返回</a>
<a href="{{urlfor "ManagerController.AttachList" }}" class="btn btn-success btn-sm">{{i18n .Lang "common.back"}}</a>
{{if .Model.IsExist }}
<a href="{{.Model.LocalHttpPath}}" class="btn btn-default btn-sm" target="_blank" title="下载到本地">下载</a>
<a href="{{.Model.LocalHttpPath}}" class="btn btn-default btn-sm" target="_blank" title="{{i18n .Lang "mgr.download_title"}}">{{i18n .Lang "mgr.download"}}</a>
{{end}}
</div>
</form>

View File

@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>附件管理 - Powered by MinDoc</title>
<title>{{i18n .Lang "mgr.attachment_mgr"}} - Powered by MinDoc</title>
<!-- Bootstrap -->
<link href="{{cdncss "/static/bootstrap/css/bootstrap.min.css"}}" rel="stylesheet" type="text/css">
@ -24,11 +24,11 @@
{{template "widgets/header.tpl" .}}
<div class="container manual-body">
<div class="row">
{{template "manager/widgets.tpl" "attach"}}
{{template "manager/widgets.tpl" .}}
<div class="page-right">
<div class="m-box">
<div class="box-head">
<strong class="box-title">附件管理</strong>
<strong class="box-title">{{i18n .Lang "mgr.attachment_mgr"}}</strong>
</div>
</div>
<div class="box-body">
@ -37,11 +37,11 @@
<thead>
<tr>
<th>#</th>
<th>附件名称</th>
<th>项目/文章名称</th>
<th>文件大小</th>
<th>是否存在</th>
<th>操作</th>
<th>{{i18n .Lang "mgr.attachment_name"}}</th>
<th>{{i18n .Lang "mgr.proj_blog_name"}}</th>
<th>{{i18n .Lang "mgr.file_size"}}</th>
<th>{{i18n .Lang "mgr.is_exist"}}</th>
<th>{{i18n .Lang "common.operate"}}</th>
</tr>
</thead>
<tbody>
@ -51,15 +51,15 @@
<td>{{$item.FileName}}</td>
<td>{{$item.BookName}}</td>
<td>{{$item.FileShortSize}}</td>
<td>{{ if $item.IsExist }} {{else}}{{end}}</td>
<td>{{ if $item.IsExist }} {{i18n $.Lang "commont.yes"}}{{else}}{{i18n $.Lang "common.no"}}{{end}}</td>
<td>
<button type="button" data-method="delete" class="btn btn-danger btn-sm" data-id="{{$item.AttachmentId}}" data-loading-text="删除中...">删除</button>
<a href="{{urlfor "ManagerController.AttachDetailed" ":id" $item.AttachmentId}}" class="btn btn-success btn-sm">详情</a>
<button type="button" data-method="delete" class="btn btn-danger btn-sm" data-id="{{$item.AttachmentId}}" data-loading-text="{{i18n $.Lang "message.processing"}}">{{i18n $.Lang "common.delete"}}</button>
<a href="{{urlfor "ManagerController.AttachDetailed" ":id" $item.AttachmentId}}" class="btn btn-success btn-sm">{{i18n $.Lang "common.detail"}}</a>
</td>
</tr>
{{else}}
<tr><td class="text-center" colspan="6">暂无数据</td></tr>
<tr><td class="text-center" colspan="6">{{i18n .Lang "message.no_data"}}</td></tr>
{{end}}
</tbody>
</table>
@ -97,7 +97,7 @@
}
},
error : function () {
layer.msg("服务器异常");
layer.msg({{i18n .Lang "message.system_error"}});
},
complete : function () {
$this.button("reset");

View File

@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>项目管理 - Powered by MinDoc</title>
<title>{{i18n .Lang "mgr.project_mgrt"}} - Powered by MinDoc</title>
<!-- Bootstrap -->
<link href="{{cdncss "/static/bootstrap/css/bootstrap.min.css"}}" rel="stylesheet" type="text/css">
@ -24,11 +24,11 @@
{{template "widgets/header.tpl" .}}
<div class="container manual-body">
<div class="row">
{{template "manager/widgets.tpl" "books"}}
{{template "manager/widgets.tpl" .}}
<div class="page-right">
<div class="m-box">
<div class="box-head">
<strong class="box-title">项目列表</strong>
<strong class="box-title">{{i18n .Lang "mgr.proj_list"}}</strong>
</div>
</div>
<div class="box-body" id="bookList">
@ -38,7 +38,7 @@
<div class="list-item">
<div class="book-title">
<div class="pull-left">
<a href="{{urlfor "ManagerController.EditBook" ":key" $item.Identify}}" title="编辑项目" data-toggle="tooltip">
<a href="{{urlfor "ManagerController.EditBook" ":key" $item.Identify}}" title="{{i18n .Lang "mgr.edit_proj"}}" data-toggle="tooltip">
{{if eq $item.PrivatelyOwned 0}}
<i class="fa fa-unlock" aria-hidden="true"></i>
{{else}}
@ -49,16 +49,16 @@
</div>
<div class="pull-right">
<div class="btn-group">
<a href="{{urlfor "DocumentController.Edit" ":key" $item.Identify ":id" ""}}" class="btn btn-default" target="_blank">编辑</a>
<a href="{{urlfor "DocumentController.Edit" ":key" $item.Identify ":id" ""}}" class="btn btn-default" target="_blank">{{i18n $.Lang "common.edit"}}</a>
<a href="javascript:;" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</a>
<ul class="dropdown-menu">
<li><a href="{{urlfor "DocumentController.Index" ":key" $item.Identify}}" target="_blank">阅读</a></li>
<li><a href="{{urlfor "ManagerController.EditBook" ":key" $item.Identify}}">设置</a></li>
<li><a href="javascript:deleteBook('{{$item.BookId}}');">删除</a> </li>
<li><a href="{{urlfor "DocumentController.Index" ":key" $item.Identify}}" target="_blank">{{i18n $.Lang "common.read"}}</a></li>
<li><a href="{{urlfor "ManagerController.EditBook" ":key" $item.Identify}}">{{i18n $.Lang "common.setting"}}</a></li>
<li><a href="javascript:deleteBook('{{$item.BookId}}');">{{i18n $.Lang "common.delete"}}</a> </li>
</ul>
</div>
{{/*<a href="{{urlfor "DocumentController.Index" ":key" $item.Identify}}" title="查看文档" data-toggle="tooltip" target="_blank"><i class="fa fa-eye"></i> </a>*/}}
@ -70,26 +70,26 @@
{{if eq $item.Description ""}}
&nbsp;
{{else}}
<a href="{{urlfor "ManagerController.EditBook" ":key" $item.Identify}}" title="编辑项目" style="font-size: 12px;" target="_blank">
<a href="{{urlfor "ManagerController.EditBook" ":key" $item.Identify}}" title="{{i18n .Lang "mgr.edit_proj"}}" style="font-size: 12px;" target="_blank">
{{$item.Description}}
</a>
{{end}}
</div>
<div class="info">
<span title="创建时间" data-toggle="tooltip" data-placement="bottom"><i class="fa fa-clock-o"></i>
<span title="{{i18n $.Lang "mgr.create_time"}}" data-toggle="tooltip" data-placement="bottom"><i class="fa fa-clock-o"></i>
{{date_format $item.CreateTime "2006-01-02 15:04:05"}}
</span>
<span title="创建者" data-toggle="tooltip" data-placement="bottom"><i class="fa fa-user"></i> {{if eq $item.RealName "" }}{{$item.CreateName}}{{else}}{{$item.RealName}}{{end}}</span>
<span title="文档数量" data-toggle="tooltip" data-placement="bottom"><i class="fa fa-pie-chart"></i> {{$item.DocCount}}</span>
<span title="{{i18n $.Lang "mgr.creator"}}" data-toggle="tooltip" data-placement="bottom"><i class="fa fa-user"></i> {{if eq $item.RealName "" }}{{$item.CreateName}}{{else}}{{$item.RealName}}{{end}}</span>
<span title="{{i18n $.Lang "mgr.doc_amount"}}" data-toggle="tooltip" data-placement="bottom"><i class="fa fa-pie-chart"></i> {{$item.DocCount}}</span>
{{if ne $item.LastModifyText ""}}
<span title="最后编辑" data-toggle="tooltip" data-placement="bottom"><i class="fa fa-pencil"></i> 最后编辑: {{$item.LastModifyText}}</span>
<span title="{{i18n $.Lang "mgr.last_edit"}}" data-toggle="tooltip" data-placement="bottom"><i class="fa fa-pencil"></i> {{i18n .Lang "mgr.last_edit"}}: {{$item.LastModifyText}}</span>
{{end}}
</div>
</div>
{{else}}
<div class="text-center">暂无数据</div>
<div class="text-center">{{i18n .Lang "message.no_data"}}</div>
{{end}}
</div>
<nav class="pagination-container">
@ -109,17 +109,17 @@
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">删除项目</h4>
<h4 class="modal-title">{{i18n .Lang "mgr.delete_project"}}</h4>
</div>
<div class="modal-body">
<span style="font-size: 14px;font-weight: 400;">确定删除项目吗?</span>
<span style="font-size: 14px;font-weight: 400;">{{i18n .Lang "message.confirm_delete_project"}}</span>
<p></p>
<p class="text error-message">删除项目后将无法找回。</p>
<p class="text error-message">{{i18n .Lang "message.warning_delete_project"}}</p>
</div>
<div class="modal-footer">
<span id="form-error-message2" class="error-message"></span>
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button type="submit" id="btnDeleteBook" class="btn btn-primary" data-loading-text="删除中...">确定删除</button>
<button type="button" class="btn btn-default" data-dismiss="modal">{{i18n .Lang "common.cancel"}}</button>
<button type="submit" id="btnDeleteBook" class="btn btn-primary" data-loading-text="{{i18n .Lang "message.processing"}}">{{i18n .Lang "common.confirm"}}</button>
</div>
</div>
</form>
@ -155,7 +155,7 @@
$("#btnDeleteBook").button("reset");
},
error : function () {
showError("服务器异常","#form-error-message2");
showError({{i18n .Lang "message.system_error"}},"#form-error-message2");
$("#btnDeleteBook").button("reset");
}
});

View File

@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>配置文件 - Powered by MinDoc</title>
<title>{{i18n .Lang "mgr.config_file"}} - Powered by MinDoc</title>
<!-- Bootstrap -->
<link href="{{cdncss "/static/bootstrap/css/bootstrap.min.css"}}" rel="stylesheet">
@ -18,11 +18,11 @@
{{template "widgets/header.tpl" .}}
<div class="container manual-body">
<div class="row">
{{template "manager/widgets.tpl" "config"}}
{{template "manager/widgets.tpl" .}}
<div class="page-right">
<div class="m-box">
<div class="box-head">
<strong class="box-title"> 配置管理</strong>
<strong class="box-title"> {{i18n .Lang "mgr.config_mgr"}}</strong>
</div>
</div>
<div class="box-body">
@ -32,7 +32,7 @@
</div>
<div class="form-group">
<button type="submit" id="btnSaveConfigFile" class="btn btn-success" data-loading-text="保存中...">保存修改</button>
<button type="submit" id="btnSaveConfigFile" class="btn btn-success" data-loading-text="{{i18n .Lang "message.processing"}}">{{i18n .Lang "common.save"}}</button>
<span id="form-error-message" class="error-message"></span>
</div>
</form>

View File

@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>编辑项目 - Powered by MinDoc</title>
<title>{{i18n .Lang "mgr.edit_proj"}} - Powered by MinDoc</title>
<!-- Bootstrap -->
<link href="{{cdncss "/static/bootstrap/css/bootstrap.min.css"}}" rel="stylesheet">
@ -22,18 +22,18 @@
{{template "widgets/header.tpl" .}}
<div class="container manual-body">
<div class="row">
{{template "manager/widgets.tpl" "books"}}
{{template "manager/widgets.tpl" .}}
<div class="page-right">
<div class="m-box">
<div class="box-head">
<strong class="box-title"> 项目设置</strong>
<button type="button" class="btn btn-success btn-sm pull-right" data-toggle="modal" data-target="#transferBookModal">转让项目</button>
<strong class="box-title"> {{i18n .Lang "blog.project_setting"}}</strong>
<button type="button" class="btn btn-success btn-sm pull-right" data-toggle="modal" data-target="#transferBookModal">{{i18n .Lang "blog.handover_project"}}</button>
{{if eq .Model.PrivatelyOwned 1}}
<button type="button" class="btn btn-success btn-sm pull-right" data-toggle="modal" data-target="#changePrivatelyOwnedModal" style="margin-right: 5px;">转为公有</button>
<button type="button" class="btn btn-success btn-sm pull-right" data-toggle="modal" data-target="#changePrivatelyOwnedModal" style="margin-right: 5px;">{{i18n .Lang "blog.make_public"}}</button>
{{else}}
<button type="button" class="btn btn-danger btn-sm pull-right" data-toggle="modal" data-target="#changePrivatelyOwnedModal" style="margin-right: 5px;">转为私有</button>
<button type="button" class="btn btn-danger btn-sm pull-right" data-toggle="modal" data-target="#changePrivatelyOwnedModal" style="margin-right: 5px;">{{i18n .Lang "blog.make_private"}}</button>
{{end}}
<button type="button" class="btn btn-danger btn-sm pull-right" style="margin-right: 5px;" data-toggle="modal" data-target="#deleteBookModal">删除项目</button>
<button type="button" class="btn btn-danger btn-sm pull-right" style="margin-right: 5px;" data-toggle="modal" data-target="#deleteBookModal">{{i18n .Lang "blog.delete_project"}}</button>
</div>
</div>
<div class="box-body" style="padding-right: 200px;">
@ -41,66 +41,66 @@
<form method="post" id="bookEditForm" action="{{urlfor "ManagerController.EditBook" ":key" .Model.Identify}}">
<input type="hidden" name="identify" value="{{.Model.Identify}}">
<div class="form-group">
<label>标题</label>
<input type="text" class="form-control" name="book_name" id="bookName" placeholder="项目名称" value="{{.Model.BookName}}">
<label>{{i18n .Lang "mgr.proj_name"}}</label>
<input type="text" class="form-control" name="book_name" id="bookName" placeholder="{{i18n .Lang "mgr.proj_name"}}" value="{{.Model.BookName}}">
</div>
<div class="form-group">
<label>标识</label>
<input type="text" class="form-control" value="{{urlfor "DocumentController.Index" ":key" .Model.Identify}}" disabled placeholder="项目标识">
<label>{{i18n .Lang "blog.project_id"}}</label>
<input type="text" class="form-control" value="{{urlfor "DocumentController.Index" ":key" .Model.Identify}}" disabled placeholder="{{i18n .Lang "blog.project_id"}}">
</div>
<div class="form-group">
<label>项目空间</label>
<label>{{i18n .Lang "common.project_space"}}</label>
<select class="js-data-example-ajax form-control" multiple="multiple" name="itemId">
<option value="{{.Model.ItemId}}" selected="selected">{{.Model.ItemName}}</option>
</select>
</div>
<div class="form-group">
<label>历史记录数量</label>
<input type="text" class="form-control" name="history_count" value="{{.Model.HistoryCount}}" placeholder="历史记录数量">
<p class="text">当开启文档历史时,该值会限制每个文档保存的历史数量</p>
<label>{{i18n .Lang "blog.history_record_amount"}}</label>
<input type="text" class="form-control" name="history_count" value="{{.Model.HistoryCount}}" placeholder="{{i18n .Lang "blog.history_record_amount"}}">
<p class="text">{{i18n .Lang "message.history_record_amount_desc"}}</p>
</div>
<div class="form-group">
<label>公司标识</label>
<input type="text" class="form-control" name="publisher" value="{{.Model.Publisher}}" placeholder="公司名称">
<p class="text">导出文档PDF文档时显示的页脚</p>
<label>{{i18n .Lang "blog.corp_id"}}</label>
<input type="text" class="form-control" name="publisher" value="{{.Model.Publisher}}" placeholder="{{i18n $.Lang "blog.corp_id"}}">
<p class="text">{{i18n .Lang "message.corp_id_desc"}}</p>
</div>
<div class="form-group">
<label>排序</label>
<input type="number" min="0" class="form-control" value="{{.Model.OrderIndex}}" name="order_index" placeholder="项目排序">
<p class="text">只能是数字,序号越大排序越靠前</p>
<label>{{i18n .Lang "blog.project_order"}}</label>
<input type="number" min="0" class="form-control" value="{{.Model.OrderIndex}}" name="order_index" placeholder="{{i18n .Lang "blog.project_order"}}">
<p class="text">{{i18n .Lang "message.project_order_desc"}}</p>
</div>
<div class="form-group">
<label>描述</label>
<textarea rows="3" class="form-control" name="description" style="height: 90px" placeholder="项目描述">{{.Model.Description}}</textarea>
<p class="text">描述信息不超过500个字符</p>
<label>{{i18n .Lang "blog.project_desc"}}</label>
<textarea rows="3" class="form-control" name="description" style="height: 90px" placeholder="{{i18n .Lang "blog.project_desc"}}">{{.Model.Description}}</textarea>
<p class="text">{{i18n .Lang "message.project_desc_placeholder"}}</p>
</div>
<div class="form-group">
<label>标签</label>
<input type="text" class="form-control" name="label" placeholder="项目标签" value="{{.Model.Label}}">
<p class="text">最多允许添加10个标签多个标签请用“;”分割</p>
<label>{{i18n .Lang "blog.project_label"}}</label>
<input type="text" class="form-control" name="label" placeholder="{{i18n .Lang "blog.project_label"}}" value="{{.Model.Label}}">
<p class="text">{{i18n .Lang "message.project_label_desc"}}</p>
</div>
{{if eq .Model.PrivatelyOwned 1}}
<div class="form-group">
<label>访问令牌</label>
<label>{{i18n .Lang "blog.access_token"}}</label>
<div class="row">
<div class="col-sm-10">
<input type="text" name="token" id="token" class="form-control" placeholder="访问令牌" readonly value="{{.Model.PrivateToken}}">
<div class="col-sm-9">
<input type="text" name="token" id="token" class="form-control" placeholder="{{i18n .Lang "blog.access_token"}}" readonly value="{{.Model.PrivateToken}}">
</div>
<div class="col-sm-2">
<button type="button" class="btn btn-success btn-sm" id="createToken" data-loading-text="生成" data-action="create">生成</button>
<button type="button" class="btn btn-danger btn-sm" id="deleteToken" data-loading-text="删除" data-action="delete">删除</button>
<div class="col-sm-3">
<button type="button" class="btn btn-success btn-sm" id="createToken" data-loading-text="{{i18n .Lang "common.generate"}}" data-action="create">{{i18n .Lang "common.generate"}}</button>
<button type="button" class="btn btn-danger btn-sm" id="deleteToken" data-loading-text="{{i18n .Lang "common.delete"}}" data-action="delete">{{i18n .Lang "common.delete"}}</button>
</div>
</div>
</div>
<div class="form-group">
<label>访问密码</label>
<input type="text" name="bPassword" id="bPassword" class="form-control" placeholder="访问密码" value="{{.Model.BookPassword}}">
<p class="text">没有访问权限访问项目时需要提供的密码</p>
<label>{{i18n $.Lang "blog.access_pass"}}</label>
<input type="text" name="bPassword" id="bPassword" class="form-control" placeholder="{{i18n $.Lang "blog.access_pass"}}" value="{{.Model.BookPassword}}">
<p class="text">{{i18n $.Lang "message.access_pass_desc"}}</p>
</div>
{{end}}
<div class="form-group">
<label for="autoRelease">自动发布</label>
<label for="autoRelease">{{i18n $.Lang "blog.auto_publish"}}</label>
<div class="controls">
<div class="switch switch-small" data-on="primary" data-off="info">
<input type="checkbox" id="autoRelease" name="auto_release"{{if .Model.AutoRelease }} checked{{end}} data-size="small">
@ -108,38 +108,38 @@
</div>
</div>
<div class="form-group">
<label for="autoRelease">开启导出</label>
<label for="autoRelease">{{i18n $.Lang "blog.enable_export"}}</label>
<div class="controls">
<div class="switch switch-small" data-on="primary" data-off="info">
<input type="checkbox" id="isDownload" name="is_download"{{if .Model.IsDownload }} checked{{end}} data-size="small" placeholder="开启导出">
<input type="checkbox" id="isDownload" name="is_download"{{if .Model.IsDownload }} checked{{end}} data-size="small" placeholder="{{i18n $.Lang "blog.enable_export"}}">
</div>
</div>
</div>
<div class="form-group">
<label for="autoRelease">开启分享</label>
<label for="autoRelease">{{i18n $.Lang "blog.enable_share"}}</label>
<div class="controls">
<div class="switch switch-small" data-on="primary" data-off="info">
<input type="checkbox" id="enableShare" name="enable_share"{{if .Model.IsEnableShare }} checked{{end}} data-size="small" placeholder="开启分享">
<input type="checkbox" id="enableShare" name="enable_share"{{if .Model.IsEnableShare }} checked{{end}} data-size="small" placeholder="{{i18n $.Lang "blog.enable_share"}}">
</div>
</div>
</div>
<div class="form-group">
<label for="autoRelease">设置第一篇文档为默认首页</label>
<label for="autoRelease">{{i18n $.Lang "blog.set_first_as_home"}}</label>
<div class="controls">
<div class="switch switch-small" data-on="primary" data-off="info">
<input type="checkbox" id="is_use_first_document" name="is_use_first_document"{{if .Model.IsUseFirstDocument }} checked{{end}} data-size="small" placeholder="设置第一篇文档为默认首页">
<input type="checkbox" id="is_use_first_document" name="is_use_first_document"{{if .Model.IsUseFirstDocument }} checked{{end}} data-size="small" placeholder="{{i18n $.Lang "blog.set_first_as_home"}}">
</div>
</div>
</div>
<div class="form-group">
<button type="submit" id="btnSaveBookInfo" class="btn btn-success" data-loading-text="保存中...">保存修改</button>
<button type="submit" id="btnSaveBookInfo" class="btn btn-success" data-loading-text="{{i18n $.Lang "common.processing"}}">{{i18n $.Lang "common.save"}}</button>
<span id="form-error-message" class="error-message"></span>
</div>
</form>
</div>
<div class="form-right">
<label>
<img src="{{.Model.Cover}}" onerror="this.src='/static/images/book.png'" alt="封面" style="max-width: 120px;border: 1px solid #999" id="headimgurl">
<img src="{{.Model.Cover}}" onerror="this.src='/static/images/book.png'" alt="{{i18n .Lang "blog.cover"}}" style="max-width: 120px;border: 1px solid #999" id="headimgurl">
</label>
</div>
<div class="clearfix"></div>
@ -160,27 +160,27 @@
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">
{{if eq .Model.PrivatelyOwned 0}}
转为私有
{{i18n $.Lang "blog.make_private"}}
{{else}}
转为共有
{{i18n $.Lang "blog.make_public"}}
{{end}}
</h4>
</div>
<div class="modal-body">
{{if eq .Model.PrivatelyOwned 0}}
<span style="font-size: 14px;font-weight: 400;">确定将项目转为私有吗?</span>
<span style="font-size: 14px;font-weight: 400;">{{i18n $.Lang "message.confirm_into_private"}}</span>
<p></p>
<p class="text error-message">转为私有后需要通过阅读令牌才能访问该项目。</p>
<p class="text error-message">{{i18n $.Lang "message.into_private_notice"}}</p>
{{else}}
<span style="font-size: 14px;font-weight: 400;"> 确定将项目转为公有吗?</span>
<span style="font-size: 14px;font-weight: 400;">{{i18n $.Lang "message.confirm_into_public"}}</span>
<p></p>
<p class="text error-message">转为公有后所有人都可以访问该项目。</p>
<p class="text error-message">{{i18n $.Lang "message.into_public_notice"}}</p>
{{end}}
</div>
<div class="modal-footer">
<span class="error-message" id="form-error-message1"></span>
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button type="submit" class="btn btn-primary" data-loading-text="正在保存..." id="btnChangePrivatelyOwned">确定</button>
<button type="button" class="btn btn-default" data-dismiss="modal">{{i18n .Lang "common.cancel"}}</button>
<button type="submit" class="btn btn-primary" data-loading-text="{{i18n .Lang "message.processing"}}" id="btnChangePrivatelyOwned">{{i18n .Lang "common.confirm"}}</button>
</div>
</div>
</form>
@ -195,17 +195,17 @@
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">删除项目</h4>
<h4 class="modal-title">{{i18n .Lang "blog.delete_project"}}</h4>
</div>
<div class="modal-body">
<span style="font-size: 14px;font-weight: 400;">确定删除项目吗?</span>
<span style="font-size: 14px;font-weight: 400;">{{i18n .Lang "message.confirm_delete_project"}}</span>
<p></p>
<p class="text error-message">删除项目后将无法找回。</p>
<p class="text error-message">{{i18n .Lang "message.warning_delete_project"}}</p>
</div>
<div class="modal-footer">
<span id="form-error-message2" class="error-message"></span>
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button type="submit" id="btnDeleteBook" class="btn btn-primary" data-loading-text="正在删除...">确定删除</button>
<button type="button" class="btn btn-default" data-dismiss="modal">{{i18n .Lang "common.cancel"}}</button>
<button type="submit" id="btnDeleteBook" class="btn btn-primary" data-loading-text="{{i18n .Lang "message.processing"}}">{{i18n .Lang "common.confirm_delete"}}</button>
</div>
</div>
</form>
@ -218,21 +218,21 @@
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">项目转让</h4>
<h4 class="modal-title" id="myModalLabel">{{i18n $.Lang "blog.handover_project"}}</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label class="col-sm-2 control-label">接收账号</label>
<label class="col-sm-2 control-label">{{i18n $.Lang "blog.recipient_account"}}</label>
<div class="col-sm-10">
<input type="text" name="account" class="form-control" placeholder="接收者账号" id="receiveAccount" maxlength="50">
<input type="text" name="account" class="form-control" placeholder="{{i18n $.Lang "blog.recipient_account"}}" id="receiveAccount" maxlength="50">
</div>
</div>
<div class="clearfix"></div>
</div>
<div class="modal-footer">
<span id="form-error-message3" class="error-message"></span>
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button type="submit" id="btnTransferBook" daata-loading-text="正在转让..." class="btn btn-primary">确定转让</button>
<button type="button" class="btn btn-default" data-dismiss="modal">{{i18n .Lang "common.cancel"}}</button>
<button type="submit" id="btnTransferBook" daata-loading-text="{{i18n $.Lang "message.processing"}}" class="btn btn-primary">{{i18n $.Lang "common.comfirm"}}</button>
</div>
</div>
</form>
@ -274,7 +274,7 @@
},
error : function () {
btn.button("reset");
alert("服务器错误");
alert({{i18n $.Lang "message.system_error"}});
}
}) ;
});
@ -285,20 +285,20 @@
beforeSubmit : function () {
var bookName = $.trim($("#bookName").val());
if (bookName === "") {
return showError("项目名称不能为空");
return showError("{{i18n $.Lang "message.project_name_empty"}}");
}
$("#btnSaveBookInfo").button("loading");
},
success : function (res) {
if(res.errcode === 0){
showSuccess("保存成功")
showSuccess("{{i18n $.Lang "message.success"}}")
}else{
showError("保存失败")
showError("{{i18n $.Lang "message.failed"}}")
}
$("#btnSaveBookInfo").button("reset");
},
error : function () {
showError("服务错误");
showError("{{i18n $.Lang "message.system_error"}}");
$("#btnSaveBookInfo").button("reset");
}
});
@ -319,7 +319,7 @@
beforeSubmit : function () {
var account = $.trim($("#receiveAccount").val());
if (account === ""){
return showError("接受者账号不能为空","#form-error-message3")
return showError("{{i18n $.Lang "message.receive_account_empty"}}","#form-error-message3")
}
$("#btnTransferBook").button("loading");
},
@ -349,12 +349,12 @@
$("#btnChangePrivatelyOwned").button("reset");
},
error :function () {
showError("服务器异常","#form-error-message1");
showError("{{i18n $.Lang "message.system_error"}}","#form-error-message1");
$("#btnChangePrivatelyOwned").button("reset");
}
});
$('.js-data-example-ajax').select2({
language: "zh-CN",
language: "{{i18n $.Lang "common.js_lang"}}",
minimumInputLength : 1,
minimumResultsForSearch: Infinity,
maximumSelectionLength:1,

View File

@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>编辑用户 - Powered by MinDoc</title>
<title>{{i18n .Lang "uc.edit_user"}} - Powered by MinDoc</title>
<!-- Bootstrap -->
<link href="{{cdncss "/static/bootstrap/css/bootstrap.min.css"}}" rel="stylesheet">
@ -23,47 +23,47 @@
{{template "widgets/header.tpl" .}}
<div class="container manual-body">
<div class="row">
{{template "manager/widgets.tpl" "users"}}
{{template "manager/widgets.tpl" .}}
<div class="page-right">
<div class="m-box">
<div class="box-head">
<strong class="box-title"> 编辑用户</strong>
<strong class="box-title"> {{i18n .Lang "uc.edit_user"}}</strong>
</div>
</div>
<div class="box-body col-lg-6 col-sm-12">
<form method="post" id="saveMemberInfoForm">
<div class="form-group">
<label>用户账号</label>
<input type="text" class="form-control" name="account" disabled placeholder="用户账号" value="{{.Model.Account}}">
<label>{{i18n .Lang "uc.username"}}</label>
<input type="text" class="form-control" name="account" disabled placeholder="{{i18n .Lang "uc.username"}}" value="{{.Model.Account}}">
</div>
<div class="form-group">
<label>真实姓名</label>
<input type="text" name="real_name" class="form-control" value="{{.Model.RealName}}" placeholder="真实姓名">
<label>{{i18n .Lang "uc.realname"}}</label>
<input type="text" name="real_name" class="form-control" value="{{.Model.RealName}}" placeholder="{{i18n .Lang "uc.realname"}}">
</div>
<div class="form-group">
<label>用户密码</label>
<input type="password" class="form-control" name="password1" placeholder="用户密码" maxlength="50">
<p style="color: #999;font-size: 12px;">不修改密码请留空,只支持本地用户修改密码</p>
<label>{{i18n .Lang "uc.password"}}</label>
<input type="password" class="form-control" name="password1" placeholder="{{i18n .Lang "uc.password"}}" maxlength="50">
<p style="color: #999;font-size: 12px;">{{i18n .Lang "uc.pwd_tips"}}</p>
</div>
<div class="form-group">
<label>确认密码</label>
<input type="password" class="form-control" name="password2" placeholder="确认密码" maxlength="50">
<label>{{i18n .Lang "uc.confirm_pwd"}}</label>
<input type="password" class="form-control" name="password2" placeholder="{{i18n .Lang "uc.confirm_pwd"}}" maxlength="50">
</div>
<div class="form-group">
<label>用户邮箱 <strong class="text-danger">*</strong></label>
<input type="email" class="form-control" name="email" placeholder="用户邮箱" value="{{.Model.Email}}" maxlength="50">
<label>{{i18n .Lang "uc.email"}} <strong class="text-danger">*</strong></label>
<input type="email" class="form-control" name="email" placeholder="{{i18n .Lang "uc.email"}}" value="{{.Model.Email}}" maxlength="50">
</div>
<div class="form-group">
<label>手机号码</label>
<input type="text" class="form-control" name="phone" placeholder="手机号码" maxlength="50" value="{{.Model.Phone}}">
<label>{{i18n .Lang "uc.mobile"}}</label>
<input type="text" class="form-control" name="phone" placeholder="{{i18n .Lang "uc.mobile"}}" maxlength="50" value="{{.Model.Phone}}">
</div>
<div class="form-group">
<label class="description">描述</label>
<textarea class="form-control" rows="3" title="描述" name="description" id="description" maxlength="500" >{{.Model.Description}}</textarea>
<p style="color: #999;font-size: 12px;">描述不能超过500字</p>
<label class="description">{{i18n .Lang "uc.description"}}</label>
<textarea class="form-control" rows="3" title="{{i18n .Lang "uc.description"}}" name="description" id="description" maxlength="500" >{{.Model.Description}}</textarea>
<p style="color: #999;font-size: 12px;">{{i18n .Lang "uc.description_tips"}}</p>
</div>
<div class="form-group">
<button type="submit" id="btnMemberInfo" class="btn btn-success" data-loading-text="保存中...">保存修改</button>
<button type="submit" id="btnMemberInfo" class="btn btn-success" data-loading-text="{{i18n .Lang "message.processing"}}">{{i18n .Lang "common.save"}}</button>
<span id="form-error-message" class="error-message"></span>
</div>
</form>
@ -92,15 +92,15 @@
var password1 = $.trim($then.find("input[name='password1']").val());
var password2 = $.trim($then.find("input[name='password2']").val());
if (email === ""){
return showError("用户邮箱不能为空!");
return showError({{i18n .Lang "message.email_empty"}});
}
if (password1 !== "" && password1 !== password2){
return showError("确认密码不正确!");
return showError({{i18n .Lang "message.wrong_confirm_pwd"}});
}
$("#btnMemberInfo").button("loading");
},success : function (res) {
if(res.errcode === 0) {
showSuccess("保存成功")
showSuccess({{i18n .Lang "message.success"}})
}else{
showError(res.message);
}

View File

@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>用户中心 - Powered by MinDoc</title>
<title>{{i18n .Lang "mgr.dashboard_mgr"}} - Powered by MinDoc</title>
<!-- Bootstrap -->
<link href="{{cdncss "/static/bootstrap/css/bootstrap.min.css"}}" rel="stylesheet">
@ -24,40 +24,40 @@
{{template "widgets/header.tpl" .}}
<div class="container manual-body">
<div class="row">
{{template "manager/widgets.tpl" "index"}}
{{template "manager/widgets.tpl" .}}
<div class="page-right">
<div class="m-box">
<div class="box-head">
<strong class="box-title">仪表盘</strong>
<strong class="box-title">{{i18n .Lang "mgr.dashboard_mgr"}}</strong>
</div>
</div>
<div class="box-body manager">
<a href="{{urlfor "ManagerController.Books"}}" class="dashboard-item">
<span class="fa fa-book" aria-hidden="true"></span>
<span class="fa-class">项目数量</span>
<span class="fa-class">{{i18n .Lang "mgr.proj_amount"}}</span>
<span class="fa-class">{{.Model.BookNumber}}</span>
</a>
<div class="dashboard-item">
<span class="fa fa-file-text-o" aria-hidden="true"></span>
<span class="fa-class">文章数量</span>
<span class="fa-class">{{i18n .Lang "mgr.blog_amount"}}</span>
<span class="fa-class">{{.Model.DocumentNumber}}</span>
</div>
<a href="{{urlfor "ManagerController.Users"}}" class="dashboard-item">
<span class="fa fa-users" aria-hidden="true"></span>
<span class="fa-class">会员数量</span>
<span class="fa-class">{{i18n .Lang "mgr.member_amount"}}</span>
<span class="fa-class">{{.Model.MemberNumber}}</span>
</a>
<!--
{{/*
<div class="dashboard-item">
<span class="fa fa-comments-o" aria-hidden="true"></span>
<span class="fa-class">评论数量</span>
<span class="fa-class">{{i18n .Lang "mgr.comment_amount"}}</span>
<span class="fa-class">{{.Model.CommentNumber}}</span>
</div>
*/}}-->
<a href="{{urlfor "ManagerController.AttachList" }}" class="dashboard-item">
<span class="fa fa-cloud-download" aria-hidden="true"></span>
<span class="fa-class">附件数量</span>
<span class="fa-class">{{i18n .Lang "mgr.attachment_amount"}}</span>
<span class="fa-class">{{.Model.AttachmentNumber}}</span>
</a>
</div>

View File

@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>项目空间管理 - Powered by MinDoc</title>
<title>{{i18n .Lang "mgr.project_space_mgr"}} - Powered by MinDoc</title>
<!-- Bootstrap -->
<link href="{{cdncss "/static/bootstrap/css/bootstrap.min.css"}}" rel="stylesheet" type="text/css">
@ -18,13 +18,13 @@
{{template "widgets/header.tpl" .}}
<div class="container manual-body">
<div class="row">
{{template "manager/widgets.tpl" "itemsets"}}
{{template "manager/widgets.tpl" .}}
<div class="page-right">
<div class="m-box">
<div class="box-head">
<strong class="box-title">项目空间管理</strong>
<strong class="box-title">{{i18n .Lang "mgr.project_space_mgr"}}</strong>
{{if eq .Member.Role 0}}
<button type="button" class="btn btn-success btn-sm pull-right" data-toggle="modal" data-target="#addItemsetsDialogModal"><i class="fa fa-plus" aria-hidden="true"></i> 创建项目空间</button>
<button type="button" class="btn btn-success btn-sm pull-right" data-toggle="modal" data-target="#addItemsetsDialogModal"><i class="fa fa-plus" aria-hidden="true"></i> {{i18n .Lang "mgr.create_proj_space"}}</button>
{{end}}
</div>
</div>
@ -34,10 +34,10 @@
<thead>
<tr>
<th width="10%">#</th>
<th width="30%">项目空间名称</th>
<th width="20%">项目空间标识</th>
<th width="20%">项目数量</th>
<th>操作</th>
<th width="30%">{{i18n .Lang "mgr.proj_space_name"}}</th>
<th width="20%">{{i18n .Lang "mgr.proj_space_id"}}</th>
<th width="20%">{{i18n .Lang "mgr.proj_amount"}}</th>
<th>{{i18n .Lang "common.operate"}}</th>
</tr>
</thead>
<tbody>
@ -48,15 +48,15 @@
<td>{{$item.ItemKey}}</td>
<td>{{$item.BookNumber}}</td>
<td>
<button type="button" class="btn btn-sm btn-default" data-id="{{$item.ItemId}}" data-method="edit" data-name="{{$item.ItemName}}" data-key="{{$item.ItemKey}}">编辑</button>
<button type="button" class="btn btn-sm btn-default" data-id="{{$item.ItemId}}" data-method="edit" data-name="{{$item.ItemName}}" data-key="{{$item.ItemKey}}">{{i18n $.Lang "common.edit"}}</button>
{{if ne $item.ItemId 1}}
<button type="button" data-method="delete" class="btn btn-danger btn-sm" data-id="{{$item.ItemId}}" data-loading-text="删除中...">删除</button>
<button type="button" data-method="delete" class="btn btn-danger btn-sm" data-id="{{$item.ItemId}}" data-loading-text="{{i18n $.Lang "message.processing"}}">{{i18n $.Lang "common.delete"}}</button>
{{end}}
<a href="{{urlfor "ItemsetsController.List" ":key" $item.ItemKey}}" class="btn btn-success btn-sm" target="_blank">详情</a>
<a href="{{urlfor "ItemsetsController.List" ":key" $item.ItemKey}}" class="btn btn-success btn-sm" target="_blank">{{i18n $.Lang "common.detail"}}</a>
</td>
</tr>
{{else}}
<tr><td class="text-center" colspan="6">暂无数据</td></tr>
<tr><td class="text-center" colspan="6">{{i18n .Lang "message.no_data"}}</td></tr>
{{end}}
</tbody>
</table>
@ -77,28 +77,28 @@
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">创建项目空间</h4>
<h4 class="modal-title" id="myModalLabel">{{i18n .Lang "mgr.create_proj_space"}}</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label class="col-sm-3 control-label" for="account">项目空间名称<span class="error-message">*</span></label>
<div class="col-sm-9">
<input type="text" name="itemName" class="form-control" placeholder="项目空间名称" id="itemName" maxlength="50">
<label class="col-sm-4 control-label" for="account">{{i18n .Lang "mgr.proj_space_name"}}<span class="error-message">*</span></label>
<div class="col-sm-8">
<input type="text" name="itemName" class="form-control" placeholder="{{i18n .Lang "mgr.proj_space_name"}}" id="itemName" maxlength="50">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label" for="itemKey">项目空间标识<span class="error-message">*</span></label>
<div class="col-sm-9">
<input type="text" name="itemKey" id="itemKey" class="form-control" placeholder="项目空间标识" maxlength="50">
<p class="text">项目空间标识只能由字母和数字组成且在2-100字符之间</p>
<label class="col-sm-4 control-label" for="itemKey">{{i18n .Lang "mgr.proj_space_id"}}<span class="error-message">*</span></label>
<div class="col-sm-8">
<input type="text" name="itemKey" id="itemKey" class="form-control" placeholder="{{i18n .Lang "mgr.proj_space_id"}}" maxlength="50">
<p class="text">{{i18n .Lang "message.proj_space_id_tips"}}</p>
</div>
</div>
<div class="clearfix"></div>
</div>
<div class="modal-footer">
<span id="create-form-error-message"></span>
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button type="submit" class="btn btn-success" data-loading-text="保存中..." id="btnAddItemsets">保存
<button type="button" class="btn btn-default" data-dismiss="modal">{{i18n .Lang "common.cancel"}}</button>
<button type="submit" class="btn btn-success" data-loading-text="{{i18n .Lang "message.processing"}}" id="btnAddItemsets">{{i18n .Lang "common.save"}}
</button>
</div>
</div>
@ -112,27 +112,27 @@
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">编辑项目空间</h4>
<h4 class="modal-title" id="myModalLabel">{{i18n .Lang "mgr.edit_proj_space"}}</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label class="col-sm-3 control-label" for="itemName">项目空间名称<span class="error-message">*</span></label>
<div class="col-sm-9">
<input type="text" name="itemName" id="itemName" class="form-control" placeholder="项目空间名称" maxlength="50">
<label class="col-sm-4 control-label" for="itemName">{{i18n .Lang "mgr.proj_space_name"}}<span class="error-message">*</span></label>
<div class="col-sm-8">
<input type="text" name="itemName" id="itemName" class="form-control" placeholder="{{i18n .Lang "mgr.proj_space_name"}}" maxlength="50">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label" for="itemKey">项目空间标识<span class="error-message">*</span></label>
<div class="col-sm-9">
<input type="text" name="itemKey" id="itemKey" class="form-control" placeholder="项目空间标识" maxlength="50">
<label class="col-sm-4 control-label" for="itemKey">{{i18n .Lang "mgr.proj_space_id"}}<span class="error-message">*</span></label>
<div class="col-sm-8">
<input type="text" name="itemKey" id="itemKey" class="form-control" placeholder="{{i18n .Lang "mgr.proj_space_id"}}" maxlength="50">
</div>
</div>
<div class="clearfix"></div>
</div>
<div class="modal-footer">
<span id="edit-form-error-message"></span>
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button type="submit" class="btn btn-success" data-loading-text="保存中..." id="btnEditItemsets">保存
<button type="button" class="btn btn-default" data-dismiss="modal">{{i18n .Lang "common.cancel"}}</button>
<button type="submit" class="btn btn-success" data-loading-text="{{i18n .Lang "message.processing"}}" id="btnEditItemsets">{{i18n .Lang "common.save"}}
</button>
</div>
</div>
@ -166,10 +166,10 @@
var $itemKey = addItemsetsDialogForm.find("input[name='itemKey']").val();
if ($itemName == "") {
showError("项目空间名称不能为空","#create-form-error-message");
showError("{{i18n .Lang "message.proj_space_name_empty"}}","#create-form-error-message");
}
if ($itemKey == "") {
showError("项目空间标识不能为空","#create-form-error-message");
showError("{{i18n .Lang "message.proj_space_id_empty"}}","#create-form-error-message");
}
$("#btnAddItemsets").button("loading");
showError("","#create-form-error-message");
@ -183,7 +183,7 @@
}
},
error: function () {
showError("服务器异常","#create-form-error-message");
showError({{i18n .Lang "message.system_error"}},"#create-form-error-message");
},
complete: function () {
$("#btnAddItemsets").button("reset");
@ -196,10 +196,10 @@
var $itemKey = editItemsetsDialogForm.find("input[name='itemKey']").val();
if ($itemName == "") {
showError("项目空间名称不能为空","#edit-form-error-message");
showError("{{i18n .Lang "message.proj_space_name_empty"}}","#edit-form-error-message");
}
if ($itemKey == "") {
showError("项目空间标识不能为空","#edit-form-error-message");
showError("{{i18n .Lang "message.proj_space_id_empty"}}","#edit-form-error-message");
}
$("#btnEditItemsets").button("loading");
showError("","#edit-form-error-message");
@ -213,7 +213,7 @@
}
},
error: function () {
showError("服务器异常","#edit-form-error-message");
showError({{i18n .Lang "message.system_error"}},"#edit-form-error-message");
},
complete: function () {
$("#btnEditItemsets").button("reset");
@ -237,7 +237,7 @@
}
},
error : function () {
layer.msg("服务器异常");
layer.msg({{i18n .Lang "message.system_error"}});
},
complete : function () {
$this.button("reset");

View File

@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>标签管理 - Powered by MinDoc</title>
<title>{{i18n .Lang "mgr.label_mgr"}} - Powered by MinDoc</title>
<!-- Bootstrap -->
<link href="{{cdncss "/static/bootstrap/css/bootstrap.min.css"}}" rel="stylesheet" type="text/css">
@ -24,11 +24,11 @@
{{template "widgets/header.tpl" .}}
<div class="container manual-body">
<div class="row">
{{template "manager/widgets.tpl" "label"}}
{{template "manager/widgets.tpl" .}}
<div class="page-right">
<div class="m-box">
<div class="box-head">
<strong class="box-title">标签管理</strong>
<strong class="box-title">{{i18n .Lang "mgr.label_mgr"}}</strong>
</div>
</div>
<div class="box-body">
@ -37,9 +37,9 @@
<thead>
<tr>
<th width="10%">#</th>
<th width="55%">标签名称</th>
<th width="20%">使用数量</th>
<th>操作</th>
<th width="55%">{{i18n .Lang "mgr.label_name"}}</th>
<th width="20%">{{i18n .Lang "mgr.used_quantity"}}</th>
<th>{{i18n .Lang "common.operate"}}</th>
</tr>
</thead>
<tbody>
@ -49,13 +49,13 @@
<td>{{$item.LabelName}}</td>
<td>{{$item.BookNumber}}</td>
<td>
<button type="button" data-method="delete" class="btn btn-danger btn-sm" data-id="{{$item.LabelId}}" data-loading-text="删除中...">删除</button>
<a href="{{urlfor "LabelController.Index" ":key" $item.LabelName}}" class="btn btn-success btn-sm" target="_blank">详情</a>
<button type="button" data-method="delete" class="btn btn-danger btn-sm" data-id="{{$item.LabelId}}" data-loading-text="{{i18n .Lang "message.processing"}}">{{i18n .Lang "common.delete"}}</button>
<a href="{{urlfor "LabelController.Index" ":key" $item.LabelName}}" class="btn btn-success btn-sm" target="_blank">{{i18n .Lang "common.detail"}}</a>
</td>
</tr>
{{else}}
<tr><td class="text-center" colspan="6">暂无数据</td></tr>
<tr><td class="text-center" colspan="6">{{i18n .Lang "message.no_data"}}</td></tr>
{{end}}
</tbody>
</table>
@ -92,7 +92,7 @@
}
},
error : function () {
layer.msg("服务器异常");
layer.msg({{i18n .Lang "message.system_error"}});
},
complete : function () {
$this.button("reset");

View File

@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>配置管理 - Powered by MinDoc</title>
<title>{{i18n .Lang "mgr.config_mgr"}} - Powered by MinDoc</title>
<!-- Bootstrap -->
<link href="{{cdncss "/static/bootstrap/css/bootstrap.min.css"}}" rel="stylesheet">
@ -23,75 +23,75 @@
{{template "widgets/header.tpl" .}}
<div class="container manual-body">
<div class="row">
{{template "manager/widgets.tpl" "setting"}}
{{template "manager/widgets.tpl" .}}
<div class="page-right">
<div class="m-box">
<div class="box-head">
<strong class="box-title"> 配置管理</strong>
<strong class="box-title"> {{i18n .Lang "mgr.config_mgr"}}</strong>
</div>
</div>
<div class="box-body">
<form method="post" id="gloablEditForm" action="{{urlfor "ManagerController.Setting"}}">
<div class="form-group">
<label>网站标题</label>
<input type="text" class="form-control" name="SITE_NAME" id="siteName" placeholder="网站标题" value="{{.SITE_NAME}}">
<label>{{i18n .Lang "mgr.site_name"}}</label>
<input type="text" class="form-control" name="SITE_NAME" id="siteName" placeholder="{{i18n .Lang "mgr.site_name"}}" value="{{.SITE_NAME}}">
</div>
<div class="form-group">
<label>域名备案</label>
<input type="text" class="form-control" name="site_beian" id="siteName" placeholder="域名备案" value="{{.site_beian}}" maxlength="50">
<label>{{i18n .Lang "mgr.domain_icp"}}</label>
<input type="text" class="form-control" name="site_beian" id="siteName" placeholder="{{i18n .Lang "mgr.domain_icp"}}" value="{{.site_beian}}" maxlength="50">
</div>
<div class="form-group">
<label>网站描述</label>
<textarea rows="3" class="form-control" name="site_description" style="height: 90px" placeholder="网站描述">{{.site_description}}</textarea>
<p class="text">描述信息不超过500个字符</p>
<label>{{i18n .Lang "mgr.site_desc"}}</label>
<textarea rows="3" class="form-control" name="site_description" style="height: 90px" placeholder="{{i18n .Lang "mgr.site_desc"}}">{{.site_description}}</textarea>
<p class="text">{{i18n .Lang "mgr.site_desc_tips"}}</p>
</div>
<div class="form-group">
<label>启用匿名访问</label>
<label>{{i18n .Lang "mgr.enable_anonymous_access"}}</label>
<div class="radio">
<label class="radio-inline">
<input type="radio" {{if eq .ENABLE_ANONYMOUS "true"}}checked{{end}} name="ENABLE_ANONYMOUS" value="true">开启<span class="text"></span>
<input type="radio" {{if eq .ENABLE_ANONYMOUS "true"}}checked{{end}} name="ENABLE_ANONYMOUS" value="true">{{i18n .Lang "mgr.enable"}}<span class="text"></span>
</label>
<label class="radio-inline">
<input type="radio" {{if eq .ENABLE_ANONYMOUS "false"}}checked{{end}} name="ENABLE_ANONYMOUS" value="false">关闭<span class="text"></span>
<input type="radio" {{if eq .ENABLE_ANONYMOUS "false"}}checked{{end}} name="ENABLE_ANONYMOUS" value="false">{{i18n .Lang "mgr.disable"}}<span class="text"></span>
</label>
</div>
</div>
<div class="form-group">
<label>启用注册</label>
<label>{{i18n .Lang "mgr.enable_register"}}</label>
<div class="radio">
<label class="radio-inline">
<input type="radio" {{if eq .ENABLED_REGISTER "true"}}checked{{end}} name="ENABLED_REGISTER" value="true">开启<span class="text"></span>
<input type="radio" {{if eq .ENABLED_REGISTER "true"}}checked{{end}} name="ENABLED_REGISTER" value="true">{{i18n .Lang "mgr.enable"}}<span class="text"></span>
</label>
<label class="radio-inline">
<input type="radio" {{if eq .ENABLED_REGISTER "false"}}checked{{end}} name="ENABLED_REGISTER" value="false">关闭<span class="text"></span>
<input type="radio" {{if eq .ENABLED_REGISTER "false"}}checked{{end}} name="ENABLED_REGISTER" value="false">{{i18n .Lang "mgr.disable"}}<span class="text"></span>
</label>
</div>
</div>
<div class="form-group">
<label>启用验证码</label>
<label>{{i18n .Lang "mgr.enable_captcha"}}</label>
<div class="radio">
<label class="radio-inline">
<input type="radio" {{if eq .ENABLED_CAPTCHA "true"}}checked{{end}} name="ENABLED_CAPTCHA" value="true">开启<span class="text"></span>
<input type="radio" {{if eq .ENABLED_CAPTCHA "true"}}checked{{end}} name="ENABLED_CAPTCHA" value="true">{{i18n .Lang "mgr.enable"}}<span class="text"></span>
</label>
<label class="radio-inline">
<input type="radio" {{if eq .ENABLED_CAPTCHA "false"}}checked{{end}} name="ENABLED_CAPTCHA" value="false">关闭<span class="text"></span>
<input type="radio" {{if eq .ENABLED_CAPTCHA "false"}}checked{{end}} name="ENABLED_CAPTCHA" value="false">{{i18n .Lang "mgr.disable"}}<span class="text"></span>
</label>
</div>
</div>
<div class="form-group">
<label>启用文档历史</label>
<label>{{i18n .Lang "mgr.enable_doc_his"}}</label>
<div class="radio">
<label class="radio-inline">
<input type="radio" {{if eq .ENABLE_DOCUMENT_HISTORY "true"}}checked{{end}} name="ENABLE_DOCUMENT_HISTORY" value="true">开启<span class="text"></span>
<input type="radio" {{if eq .ENABLE_DOCUMENT_HISTORY "true"}}checked{{end}} name="ENABLE_DOCUMENT_HISTORY" value="true">{{i18n .Lang "mgr.enable"}}<span class="text"></span>
</label>
<label class="radio-inline">
<input type="radio" {{if eq .ENABLE_DOCUMENT_HISTORY "false"}}checked{{end}} name="ENABLE_DOCUMENT_HISTORY" value="false">关闭<span class="text"></span>
<input type="radio" {{if eq .ENABLE_DOCUMENT_HISTORY "false"}}checked{{end}} name="ENABLE_DOCUMENT_HISTORY" value="false">{{i18n .Lang "mgr.disable"}}<span class="text"></span>
</label>
</div>
</div>
<div class="form-group">
<button type="submit" id="btnSaveBookInfo" class="btn btn-success" data-loading-text="保存中...">保存修改</button>
<button type="submit" id="btnSaveBookInfo" class="btn btn-success" data-loading-text="{{i18n .Lang "message.processing"}}">{{i18n .Lang "common.save"}}</button>
<span id="form-error-message" class="error-message"></span>
</div>
</form>
@ -117,12 +117,12 @@
var title = $.trim($("#siteName").val());
if (title === ""){
return showError("网站标题不能为空");
return showError({{i18n .Lang "message.site_name_empty"}});
}
$("#btnSaveBookInfo").button("loading");
},success : function (res) {
if(res.errcode === 0) {
showSuccess("保存成功")
showSuccess({{i18n .Lang "message.success"}})
}else{
showError(res.message);
}

View File

@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>团队管理 - Powered by MinDoc</title>
<title>{{i18n .Lang "mgr.team_mgr"}} - Powered by MinDoc</title>
<!-- Bootstrap -->
<link href="{{cdncss "/static/bootstrap/css/bootstrap.min.css"}}" rel="stylesheet">
@ -23,15 +23,15 @@
{{template "widgets/header.tpl" .}}
<div class="container manual-body">
<div class="row">
{{template "manager/widgets.tpl" "team"}}
{{template "manager/widgets.tpl" .}}
<div class="page-right">
<div class="m-box">
<div class="box-head">
<strong class="box-title"> 团队管理</strong>
<strong class="box-title"> {{i18n .Lang "mgr.team_mgr"}}</strong>
{{if eq .Member.Role 0}}
<button type="button" class="btn btn-success btn-sm pull-right" data-toggle="modal"
data-target="#addTeamDialogModal"><i class="fa fa-user-plus" aria-hidden="true"></i>
创建团队
{{i18n .Lang "mgr.create_team"}}
</button>
{{end}}
</div>
@ -39,16 +39,16 @@
<div class="box-body">
<div class="users-list" id="teamList">
<template v-if="lists.length <= 0">
<div class="text-center">暂无数据</div>
<div class="text-center">{{i18n .Lang "message.no_data"}}</div>
</template>
<template v-else>
<table class="table">
<thead>
<tr>
<th>团队名称</th>
<th width="150px">成员数量</th>
<th width="150px">项目数量</th>
<th align="center" width="220px">操作</th>
<th>{{i18n .Lang "mgr.team_name"}}</th>
<th width="150px">{{i18n .Lang "mgr.member_amount"}}</th>
<th width="150px">{{i18n .Lang "mgr.proj_amount"}}</th>
<th align="center" width="260px">{{i18n .Lang "common.operate"}}</th>
</tr>
</thead>
<tbody>
@ -57,10 +57,10 @@
<td>${item.member_count}</td>
<td>${item.book_count}</td>
<td>
<a :href="'{{urlfor "ManagerController.TeamBookList" ":id" ""}}' + item.team_id" class="btn btn-primary btn-sm">项目</a>
<a :href="'{{urlfor "ManagerController.TeamMemberList" ":id" ""}}' + item.team_id" type="button" class="btn btn-success btn-sm">成员</a>
<button type="button" class="btn btn-sm btn-default" @click="editTeam(item.team_id)">编辑</button>
<button type="button" class="btn btn-danger btn-sm" @click="deleteTeam(item.team_id,$event)" data-loading-text="删除中">删除</button>
<a :href="'{{urlfor "ManagerController.TeamBookList" ":id" ""}}' + item.team_id" class="btn btn-primary btn-sm">{{i18n .Lang "mgr.proj"}}</a>
<a :href="'{{urlfor "ManagerController.TeamMemberList" ":id" ""}}' + item.team_id" type="button" class="btn btn-success btn-sm">{{i18n .Lang "mgr.member"}}</a>
<button type="button" class="btn btn-sm btn-default" @click="editTeam(item.team_id)">{{i18n .Lang "common.edit"}}</button>
<button type="button" class="btn btn-danger btn-sm" @click="deleteTeam(item.team_id,$event)" data-loading-text="{{i18n .Lang "message.processing"}}">{{i18n .Lang "common.delete"}}</button>
</td>
</tr>
</tbody>
@ -85,22 +85,22 @@
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">创建团队</h4>
<h4 class="modal-title" id="myModalLabel">{{i18n .Lang "mgr.create_team"}}</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label class="col-sm-2 control-label" for="account">团队名称<span
<label class="col-sm-2 control-label" for="account">{{i18n .Lang "mgr.team_name"}}<span
class="error-message">*</span></label>
<div class="col-sm-10">
<input type="text" name="teamName" class="form-control" placeholder="团队名称" id="teamName" maxlength="50">
<input type="text" name="teamName" class="form-control" placeholder="{{i18n .Lang "mgr.team_name"}}" id="teamName" maxlength="50">
</div>
</div>
<div class="clearfix"></div>
</div>
<div class="modal-footer">
<span id="form-error-message"></span>
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button type="submit" class="btn btn-success" data-loading-text="保存中..." id="btnAddTeam">保存
<button type="button" class="btn btn-default" data-dismiss="modal">{{i18n .Lang "common.cancel"}}</button>
<button type="submit" class="btn btn-success" data-loading-text="{{i18n .Lang "message.processing"}}" id="btnAddTeam">{{i18n .Lang "common.save"}}
</button>
</div>
</div>
@ -115,21 +115,21 @@
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">编辑团队</h4>
<h4 class="modal-title" id="myModalLabel">{{i18n .Lang "mgr.edit_team"}}</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label class="col-sm-2 control-label" for="account">团队名称<span class="error-message">*</span></label>
<label class="col-sm-2 control-label" for="account">{{i18n .Lang "mgr.team_name"}}<span class="error-message">*</span></label>
<div class="col-sm-10">
<input type="text" name="teamName" class="form-control" placeholder="团队名称" maxlength="50">
<input type="text" name="teamName" class="form-control" placeholder="{{i18n .Lang "mgr.team_name"}}" maxlength="50">
</div>
</div>
<div class="clearfix"></div>
</div>
<div class="modal-footer">
<span id="form-error-message"></span>
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button type="submit" class="btn btn-success" data-loading-text="保存中..." id="btnEditTeam">保存
<button type="button" class="btn btn-default" data-dismiss="modal">{{i18n .Lang "common.cancel"}}</button>
<button type="submit" class="btn btn-success" data-loading-text="{{i18n .Lang "message.processing"}}" id="btnEditTeam">{{i18n .Lang "common.save"}}
</button>
</div>
</div>
@ -139,6 +139,8 @@
<script src="{{cdnjs "/static/jquery/1.12.4/jquery.min.js"}}"></script>
<script src="{{cdnjs "/static/bootstrap/js/bootstrap.min.js"}}"></script>
<script src="{{cdnjs "/static/vuejs/vue.min.js"}}"></script>
<script src="{{cdnjs "/static/js/jquery.form.js"}}" type="text/javascript"></script>
@ -156,7 +158,7 @@
beforeSubmit: function () {
var account = $.trim($("#addTeamDialogForm #teamName").val());
if (account === "") {
return showError("团队名称不能为空");
return showError({{i18n .Lang "message.team_name_empty"}});
}
$("#btnAddTeam").button("loading");
return true;
@ -170,7 +172,7 @@
}
},
error: function () {
showError("服务器异常");
showError({{i18n .Lang "message.system_error"}});
},
complete: function () {
$("#btnAddTeam").button("reset");
@ -184,7 +186,7 @@
beforeSubmit: function () {
var account = $.trim(editTeamDialogModal.find("input[name='teamName']").val());
if (account === "") {
return showError("团队名称不能为空");
return showError({{i18n .Lang "message.team_name_empty"}});
}
$("#btnEditTeam").button("loading");
return true;
@ -203,7 +205,7 @@
}
},
error: function () {
showError("服务器异常");
showError({{i18n .Lang "message.system_error"}});
},
complete: function () {
$("#btnEditTeam").button("reset");

View File

@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>团队项目 - Powered by MinDoc</title>
<title>{{i18n .Lang "mgr.team_proj"}} - Powered by MinDoc</title>
<!-- Bootstrap -->
<link href="{{cdncss "/static/bootstrap/css/bootstrap.min.css"}}" rel="stylesheet" type="text/css">
@ -19,12 +19,12 @@
{{template "widgets/header.tpl" .}}
<div class="container manual-body">
<div class="row">
{{template "manager/widgets.tpl" "team"}}
{{template "manager/widgets.tpl" .}}
<div class="page-right">
<div class="m-box">
<div class="box-head">
<strong class="box-title">{{.Model.TeamName}} - 团队项目</strong>
<button type="button" class="btn btn-success btn-sm pull-right" data-toggle="modal" data-target="#addTeamBookDialogModal"><i class="fa fa-book" aria-hidden="true"></i> 添加项目</button>
<strong class="box-title">{{.Model.TeamName}} - {{i18n .Lang "mgr.team_proj"}}</strong>
<button type="button" class="btn btn-success btn-sm pull-right" data-toggle="modal" data-target="#addTeamBookDialogModal"><i class="fa fa-book" aria-hidden="true"></i> {{i18n .Lang "mgr.add_proj"}}</button>
</div>
</div>
<div class="box-body">
@ -32,15 +32,15 @@
<table class="table">
<thead>
<tr>
<th>项目名称</th>
<th>项目作者</th>
<th>加入时间</th>
<th>操作</th>
<th>{{i18n .Lang "mgr.proj_name"}}</th>
<th>{{i18n .Lang "mgr.proj_author"}}</th>
<th>{{i18n .Lang "mgr.join_time"}}</th>
<th>{{i18n .Lang "common.operate"}}</th>
</tr>
</thead>
<tbody>
<template v-if="lists.length <= 0">
<tr class="text-center"><td colspan="4">暂无数据</td></tr>
<tr class="text-center"><td colspan="4">{{i18n .Lang "message.no_data"}}</td></tr>
</template>
<template v-else>
<tr v-for="item in lists">
@ -48,7 +48,7 @@
<td>${item.book_member_name}</td>
<td>${(new Date(item.create_time)).format("yyyy-MM-dd hh:mm:ss")}</td>
<td>
<button type="button" data-method="delete" class="btn btn-danger btn-sm" @click="deleteTeamBook(item.team_relationship_id)" data-loading-text="删除中...">删除</button>
<button type="button" data-method="delete" class="btn btn-danger btn-sm" @click="deleteTeamBook(item.team_relationship_id)" data-loading-text="{{i18n .Lang "message.processing"}}">{{i18n .Lang "common.delete"}}</button>
</td>
</tr>
</template>
@ -73,11 +73,11 @@
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">加入项目</h4>
<h4 class="modal-title" id="myModalLabel">{{i18n .Lang "mgr.join_proj"}}</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label class="col-sm-3 control-label">项目名称</label>
<label class="col-sm-3 control-label">{{i18n .Lang "mgr.proj_name"}}</label>
<div class="col-sm-9">
<select class="js-data-example-ajax form-control" multiple="multiple" name="bookId" id="bookId"></select>
</div>
@ -86,8 +86,8 @@
</div>
<div class="modal-footer">
<span id="form-error-message"></span>
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button type="submit" class="btn btn-success" data-loading-text="保存中..." id="btnAddBook">保存</button>
<button type="button" class="btn btn-default" data-dismiss="modal">{{i18n .Lang "common.cancel"}}</button>
<button type="submit" class="btn btn-success" data-loading-text="{{i18n .Lang "message.processing"}}" id="btnAddBook">{{i18n .Lang "common.save"}}</button>
</div>
</div>
</form>
@ -109,7 +109,7 @@
beforeSubmit : function () {
var memberId = $.trim($("#bookId").val());
if(memberId === ""){
return showError("项目不能为空");
return showError({{i18n .Lang "message.proj_empty"}});
}
$("#btnAddBook").button("loading");
},
@ -128,7 +128,7 @@
$(this).find("form").html(modalCache);
}).on("show.bs.modal",function () {
$('.js-data-example-ajax').select2({
language: "zh-CN",
language: {{i18n .Lang "common.js_lang"}},
minimumInputLength : 1,
minimumResultsForSearch: Infinity,
maximumSelectionLength:1,
@ -179,7 +179,7 @@
}
},
error : function () {
layer.msg("服务器异常");
layer.msg({{i18n .Lang "message.system_error"}});
}
});
}

View File

@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>团队用户管理 - Powered by MinDoc</title>
<title>{{i18n .Lang "mgr.team_member_mgr"}} - Powered by MinDoc</title>
<!-- Bootstrap -->
<link href="{{cdncss "/static/bootstrap/css/bootstrap.min.css"}}" rel="stylesheet">
@ -21,28 +21,28 @@
{{template "widgets/header.tpl" .}}
<div class="container manual-body">
<div class="row">
{{template "manager/widgets.tpl" "team"}}
{{template "manager/widgets.tpl" .}}
<div class="page-right">
<div class="m-box">
<div class="box-head">
<strong class="box-title">{{.Model.TeamName}} - 成员管理</strong>
<button type="button" class="btn btn-success btn-sm pull-right" data-toggle="modal" data-target="#addTeamMemberDialogModal"><i class="fa fa-user-plus" aria-hidden="true"></i> 添加成员</button>
<strong class="box-title">{{.Model.TeamName}} - {{i18n .Lang "mgr.member_mgr"}}</strong>
<button type="button" class="btn btn-success btn-sm pull-right" data-toggle="modal" data-target="#addTeamMemberDialogModal"><i class="fa fa-user-plus" aria-hidden="true"></i> {{i18n .Lang "mgr.add_member"}}</button>
</div>
</div>
<div class="box-body">
<div class="users-list" id="teamMemberList">
<template v-if="lists.length <= 0">
<div class="text-center">暂无数据</div>
<div class="text-center">{{i18n .Lang "message.no_data"}}</div>
</template>
<template v-else>
<table class="table">
<thead>
<tr>
<th width="80">头像</th>
<th width="100">账号</th>
<th width="100">姓名</th>
<th width="150">角色</th>
<th width="80px">操作</th>
<th width="80">{{i18n .Lang "uc.avatar"}}</th>
<th width="100">{{i18n .Lang "uc.username"}}</th>
<th width="100">{{i18n .Lang "uc.realname"}}</th>
<th width="150">{{i18n .Lang "uc.role"}}</th>
<th width="80px">{{i18n .Lang "common.operate"}}</th>
</tr>
</thead>
<tbody>
@ -53,17 +53,17 @@
<td>
<div class="btn-group">
<button type="button" class="btn btn-default btn-sm" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
角色${item.role_name}
{{i18n .Lang "uc.role"}}${item.role_name}
<span class="caret"></span></button>
<ul class="dropdown-menu">
<li><a href="javascript:;" @click="setTeamMemberRole(item.member_id,1)">管理员 <p class="text">拥有阅读、写作和管理权限</p></a> </li>
<li><a href="javascript:;" @click="setTeamMemberRole(item.member_id,2)">编辑者 <p class="text">拥有阅读和写作权限</p></a> </li>
<li><a href="javascript:;" @click="setTeamMemberRole(item.member_id,3)">观察者 <p class="text">拥有阅读权限</p></a> </li>
<li><a href="javascript:;" @click="setTeamMemberRole(item.member_id,1)">{{i18n .Lang "common.administrator"}} <p class="text">{{i18n .Lang "common.admin_right"}}</p></a> </li>
<li><a href="javascript:;" @click="setTeamMemberRole(item.member_id,2)">{{i18n .Lang "common.editor"}} <p class="text">{{i18n .Lang "common.editor_right"}}</p></a> </li>
<li><a href="javascript:;" @click="setTeamMemberRole(item.member_id,3)">{{i18n .Lang "common.observer"}} <p class="text">{{i18n .Lang "common.observer_right"}}</p></a> </li>
</ul>
</div>
</td>
<td>
<button type="button" class="btn btn-danger btn-sm" @click="deleteMember(item.member_id,$event)" data-loading-text="删除中">删除</button>
<button type="button" class="btn btn-danger btn-sm" @click="deleteMember(item.member_id,$event)" data-loading-text="{{i18n .Lang "message.processing"}}">{{i18n .Lang "common.delete"}}</button>
</td>
</tr>
</tbody>
@ -87,22 +87,22 @@
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">添加成员</h4>
<h4 class="modal-title" id="myModalLabel">{{i18n .Lang "mgr.add_member"}}</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label class="col-sm-2 control-label">账号</label>
<label class="col-sm-2 control-label">{{i18n .Lang "uc.username"}}</label>
<div class="col-sm-10">
<select class="js-data-example-ajax form-control" multiple="multiple" name="memberId" id="memberId"></select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">角色</label>
<label class="col-sm-2 control-label">{{i18n .Lang "uc.role"}}</label>
<div class="col-sm-10">
<select name="roleId" class="form-control">
<option value="1">管理员</option>
<option value="2">编辑者</option>
<option value="3">观察者</option>
<option value="1">{{i18n .Lang "common.administrator"}}</option>
<option value="2">{{i18n .Lang "common.editor"}}</option>
<option value="3">{{i18n .Lang "common.observer"}}</option>
</select>
</div>
</div>
@ -111,8 +111,8 @@
</div>
<div class="modal-footer">
<span id="form-error-message"></span>
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button type="submit" class="btn btn-success" data-loading-text="保存中..." id="btnAddMember">保存</button>
<button type="button" class="btn btn-default" data-dismiss="modal">{{i18n .Lang "common.cancel"}}</button>
<button type="submit" class="btn btn-success" data-loading-text="{{i18n .Lang "message.processing"}}" id="btnAddMember">{{i18n .Lang "common.save"}}</button>
</div>
</div>
</form>
@ -137,7 +137,7 @@
beforeSubmit : function () {
var memberId = $.trim($("#memberId").val());
if(memberId === ""){
return showError("账号不能为空");
return showError({{i18n .Lang "message.account_empty"}});
}
$("#btnAddMember").button("loading");
},
@ -155,7 +155,7 @@
$(this).find("form").html(modalCache);
}).on("show.bs.modal",function () {
$('.js-data-example-ajax').select2({
language: "zh-CN",
language: {{i18n .Lang "common.js_lang"}},
minimumInputLength : 1,
minimumResultsForSearch: Infinity,
maximumSelectionLength:1,

View File

@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>用户管理 - Powered by MinDoc</title>
<title>{{i18n .Lang "mgr.user_mgr"}} - Powered by MinDoc</title>
<!-- Bootstrap -->
<link href="{{cdncss "/static/bootstrap/css/bootstrap.min.css"}}" rel="stylesheet">
@ -27,33 +27,33 @@
{{template "widgets/header.tpl" .}}
<div class="container manual-body">
<div class="row">
{{template "manager/widgets.tpl" "users"}}
{{template "manager/widgets.tpl" .}}
<div class="page-right">
<div class="m-box">
<div class="box-head">
<strong class="box-title"> 成员管理</strong>
<strong class="box-title"> {{i18n .Lang "mgr.member_mgr"}}</strong>
{{if eq .Member.Role 0}}
<button type="button" class="btn btn-success btn-sm pull-right" data-toggle="modal" data-target="#addMemberDialogModal"><i class="fa fa-user-plus" aria-hidden="true"></i> 添加成员</button>
<button type="button" class="btn btn-success btn-sm pull-right" data-toggle="modal" data-target="#addMemberDialogModal"><i class="fa fa-user-plus" aria-hidden="true"></i> {{i18n .Lang "mgr.add_member"}}</button>
{{end}}
</div>
</div>
<div class="box-body">
<div class="users-list" id="userList">
<template v-if="lists.length <= 0">
<div class="text-center">暂无数据</div>
<div class="text-center">{{i18n .Lang "message.no_data"}}</div>
</template>
<template v-else>
<table class="table">
<thead>
<tr>
<th width="80">ID</th>
<th width="80">头像</th>
<th>账号</th>
<th>姓名</th>
<th>角色</th>
<th>类型</th>
<th>状态</th>
<th>操作</th>
<th width="80">{{i18n .Lang "uc.avatar"}}</th>
<th>{{i18n .Lang "uc.username"}}</th>
<th>{{i18n .Lang "uc.realname"}}</th>
<th>{{i18n .Lang "uc.role"}}</th>
<th>{{i18n .Lang "uc.type"}}</th>
<th>{{i18n .Lang "uc.status"}}</th>
<th>{{i18n .Lang "common.operate"}}</th>
</tr>
</thead>
<tbody>
@ -64,7 +64,7 @@
<td>${item.real_name}</td>
<td>
<template v-if="item.role == 0">
超级管理员
{{i18n $.Lang "uc.super_admin"}}
</template>
<template v-else-if="item.member_id == {{.Member.MemberId}}">
${item.role_name}
@ -75,8 +75,8 @@
${item.role_name}
<span class="caret"></span></button>
<ul class="dropdown-menu">
<li><a href="javascript:;" @click="setMemberRole(item.member_id,1)">管理员</a> </li>
<li><a href="javascript:;" @click="setMemberRole(item.member_id,2)">普通用户</a> </li>
<li><a href="javascript:;" @click="setMemberRole(item.member_id,1)">{{i18n $.Lang "uc.admin"}}</a> </li>
<li><a href="javascript:;" @click="setMemberRole(item.member_id,2)">{{i18n $.Lang "uc.user"}}</a> </li>
</ul>
</div>
</template>
@ -86,10 +86,10 @@
</td>
<td>
<template v-if="item.status == 0">
<span class="label label-success">正常</span>
<span class="label label-success">{{i18n .Lang "uc.normal"}}</span>
</template>
<template v-else>
<span class="label label-danger">禁用</span>
<span class="label label-danger">{{i18n .Lang "uc.disable"}}</span>
</template>
</td>
@ -99,15 +99,15 @@
</template>
<template v-else-if="item.role != 0">
<a :href="'{{urlfor "ManagerController.EditMember" ":id" ""}}' + item.member_id" class="btn btn-sm btn-default" @click="editMember(item.member_id)">
编辑
{{i18n .Lang "common.edit"}}
</a>
<template v-if="item.status == 0">
<button type="button" class="btn btn-danger btn-sm" @click="setMemberStatus(item.member_id,1,$event)" data-loading-text="启用中...">禁用</button>
<button type="button" class="btn btn-danger btn-sm" @click="setMemberStatus(item.member_id,1,$event)" data-loading-text="{{i18n .Lang "message.processing"}}">{{i18n .Lang "uc.disable"}}</button>
</template>
<template v-else>
<button type="button" class="btn btn-success btn-sm" @click="setMemberStatus(item.member_id,0,$event)" data-loading-text="禁用中...">启用</button>
<button type="button" class="btn btn-success btn-sm" @click="setMemberStatus(item.member_id,0,$event)" data-loading-text="{{i18n .Lang "message.processing"}}">{{i18n .Lang "uc.enable"}}</button>
</template>
<button type="button" class="btn btn-danger btn-sm" @click="deleteMember(item.member_id,$event)" data-loading-text="删除中">删除</button>
<button type="button" class="btn btn-danger btn-sm" @click="deleteMember(item.member_id,$event)" data-loading-text="{{i18n .Lang "message.processing"}}">{{i18n .Lang "common.delete"}}</button>
</template>
</td>
</tr>
@ -131,51 +131,51 @@
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">创建用户</h4>
<h4 class="modal-title" id="myModalLabel">{{i18n .Lang "uc.create_user"}}</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label class="col-sm-2 control-label" for="account">账号<span class="error-message">*</span></label>
<label class="col-sm-2 control-label" for="account">{{i18n .Lang "uc.username"}}<span class="error-message">*</span></label>
<div class="col-sm-10">
<input type="text" name="account" class="form-control" placeholder="用户账号" id="account" maxlength="50">
<input type="text" name="account" class="form-control" placeholder="{{i18n .Lang "uc.username"}}" id="account" maxlength="50">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="password1">密码<span class="error-message">*</span></label>
<label class="col-sm-2 control-label" for="password1">{{i18n .Lang "uc.password"}}<span class="error-message">*</span></label>
<div class="col-sm-10">
<input type="password" class="form-control" placeholder="用户密码" name="password1" id="password1" maxlength="50">
<input type="password" class="form-control" placeholder="{{i18n .Lang "uc.password"}}" name="password1" id="password1" maxlength="50">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="password2">确认密码<span class="error-message">*</span></label>
<label class="col-sm-2 control-label" for="password2">{{i18n .Lang "uc.confirm_pwd"}}<span class="error-message">*</span></label>
<div class="col-sm-10">
<input type="password" class="form-control" placeholder="确认密码" name="password2" id="password2" maxlength="50">
<input type="password" class="form-control" placeholder="{{i18n .Lang "uc.confirm_pwd"}}" name="password2" id="password2" maxlength="50">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="email">邮箱<span class="error-message">*</span></label>
<label class="col-sm-2 control-label" for="email">{{i18n .Lang "uc.email"}}<span class="error-message">*</span></label>
<div class="col-sm-10">
<input type="email" class="form-control" placeholder="邮箱" name="email" id="email" maxlength="50">
<input type="email" class="form-control" placeholder="{{i18n .Lang "uc.email"}}" name="email" id="email" maxlength="50">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">真实姓名</label>
<label class="col-sm-2 control-label">{{i18n .Lang "uc.realname"}}</label>
<div class="col-sm-10">
<input type="text" name="real_name" class="form-control" value="" placeholder="真实姓名">
<input type="text" name="real_name" class="form-control" value="" placeholder="{{i18n .Lang "uc.realname"}}">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">手机号</label>
<label class="col-sm-2 control-label">{{i18n .Lang "uc.mobile"}}</label>
<div class="col-sm-10">
<input type="text" class="form-control" placeholder="手机号" name="phone" maxlength="50">
<input type="text" class="form-control" placeholder="{{i18n .Lang "uc.mobile"}}" name="phone" maxlength="50">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">角色</label>
<label class="col-sm-2 control-label">{{i18n .Lang "uc.role"}}</label>
<div class="col-sm-10">
<select name="role" class="form-control">
<option value="1">管理员</option>
<option value="2">普通用户</option>
<option value="1">{{i18n .Lang "uc.admin"}}</option>
<option value="2">{{i18n .Lang "uc.user"}}</option>
</select>
</div>
</div>
@ -186,8 +186,8 @@
</div>
<div class="modal-footer">
<span id="form-error-message"></span>
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button type="submit" class="btn btn-success" data-loading-text="保存中..." id="btnAddMember">保存</button>
<button type="button" class="btn btn-default" data-dismiss="modal">{{i18n .Lang "common.cancel"}}</button>
<button type="submit" class="btn btn-success" data-loading-text="{{i18n .Lang "message.processing"}}" id="btnAddMember">{{i18n .Lang "common.save"}}</button>
</div>
</div>
</form>
@ -209,20 +209,20 @@
beforeSubmit : function () {
var account = $.trim($("#account").val());
if(account === ""){
return showError("账号不能为空");
return showError({{i18n .Lang "message.account_empty"}});
}
var password1 = $.trim($("#password1").val());
var password2 = $("#password2").val();
if (password1 === "") {
return showError("密码不能为空");
return showError({{i18n .Lang "message.password_empty"}});
}
if (password1 !== password2) {
return showError("确认密码不正确");
return showError({{i18n .Lang "message.confirm_pwd_empty"}});
}
var email = $.trim($("#email").val());
if (email === "") {
return showError("邮箱不能为空");
return showError({{i18n .Lang "message.email_empty"}});
}
$("#btnAddMember").button("loading");
return true;
@ -237,7 +237,7 @@
$("#btnAddMember").button("reset");
},
error : function () {
showError("服务器异常");
showError({{i18n .Lang "message.system_error"}});
$("#btnAddMember").button("reset");
}
});
@ -270,7 +270,7 @@
}
}
} else {
alert("操作失败" + res.message);
alert("{{i18n .Lang "message.failed"}}" + res.message);
}
}
})
@ -295,7 +295,7 @@
}
}
}else{
alert("操作失败" + res.message);
alert("{{i18n .Lang "message.failed"}}" + res.message);
}
}
})
@ -319,7 +319,7 @@
}
}
} else {
alert("操作失败" + res.message);
alert("{{i18n .Lang "message.failed"}}" + res.message);
}
}
});

View File

@ -1,15 +1,15 @@
<div class="page-left">
<ul class="menu">
<li{{if eq "index" .}} class="active"{{end}}><a href="{{urlfor "ManagerController.Index"}}" class="item"><i class="fa fa-dashboard" aria-hidden="true"></i> 仪表盘</a> </li>
<li{{if eq "users" .}} class="active"{{end}}><a href="{{urlfor "ManagerController.Users" }}" class="item"><i class="fa fa-user" aria-hidden="true"></i> 用户管理</a> </li>
<li{{if eq "team" .}} class="active"{{end}}><a href="{{urlfor "ManagerController.Team" }}" class="item"><i class="fa fa-group" aria-hidden="true"></i> 团队管理</a> </li>
<li{{if eq "books" .}} class="active"{{end}}><a href="{{urlfor "ManagerController.Books" }}" class="item"><i class="fa fa-book" aria-hidden="true"></i> 项目管理</a> </li>
<li{{if eq "itemsets" .}} class="active"{{end}}><a href="{{urlfor "ManagerController.Itemsets" }}" class="item"><i class="fa fa-archive" aria-hidden="true"></i> 项目空间管理</a> </li>
<li{{if eq "index" .Action}} class="active"{{end}}><a href="{{urlfor "ManagerController.Index"}}" class="item"><i class="fa fa-dashboard" aria-hidden="true"></i> {{i18n .Lang "mgr.dashboard_menu"}}</a> </li>
<li{{if eq "users" .Action}} class="active"{{end}}><a href="{{urlfor "ManagerController.Users" }}" class="item"><i class="fa fa-user" aria-hidden="true"></i> {{i18n .Lang "mgr.user_menu"}}</a> </li>
<li{{if eq "team" .Action}} class="active"{{end}}><a href="{{urlfor "ManagerController.Team" }}" class="item"><i class="fa fa-group" aria-hidden="true"></i> {{i18n .Lang "mgr.team_menu"}}</a> </li>
<li{{if eq "books" .Action}} class="active"{{end}}><a href="{{urlfor "ManagerController.Books" }}" class="item"><i class="fa fa-book" aria-hidden="true"></i> {{i18n .Lang "mgr.project_menu"}}</a> </li>
<li{{if eq "itemsets" .Action}} class="active"{{end}}><a href="{{urlfor "ManagerController.Itemsets" }}" class="item"><i class="fa fa-archive" aria-hidden="true"></i> {{i18n .Lang "mgr.project_space_menu"}}</a> </li>
{{/*<li><a href="{{urlfor "ManagerController.Comments" }}" class="item"><i class="fa fa-comments-o" aria-hidden="true"></i> </a> </li>*/}}
<li{{if eq "setting" .}} class="active"{{end}}><a href="{{urlfor "ManagerController.Setting" }}" class="item"><i class="fa fa-cogs" aria-hidden="true"></i> 配置管理</a> </li>
{{/*<li{{if eq "config" .}} class="active"{{end}}><a href="{{urlfor "ManagerController.Config" }}" class="item"><i class="fa fa-file" aria-hidden="true"></i> </a> </li>*/}}
<li{{if eq "attach" .}} class="active"{{end}}><a href="{{urlfor "ManagerController.AttachList" }}" class="item"><i class="fa fa-cloud-upload" aria-hidden="true"></i> 附件管理</a> </li>
<li{{if eq "label" .}} class="active"{{end}}><a href="{{urlfor "ManagerController.LabelList" }}" class="item"><i class="fa fa-bookmark" aria-hidden="true"></i> 标签管理</a> </li>
{{/*<li><a href="{{urlfor "ManagerController.Comments" }}" class="item"><i class="fa fa-comments-o" aria-hidden="true"></i> {{i18n .Lang "mgr.comment_menu"}}</a> </li>*/}}
<li{{if eq "setting" .Action}} class="active"{{end}}><a href="{{urlfor "ManagerController.Setting" }}" class="item"><i class="fa fa-cogs" aria-hidden="true"></i> {{i18n .Lang "mgr.config_menu"}}</a> </li>
{{/*<li{{if eq "config" .Action}} class="active"{{end}}><a href="{{urlfor "ManagerController.Config" }}" class="item"><i class="fa fa-file" aria-hidden="true"></i> {{i18n .Lang "mgr.config_file"}}</a> </li>*/}}
<li{{if eq "attach" .Action}} class="active"{{end}}><a href="{{urlfor "ManagerController.AttachList" }}" class="item"><i class="fa fa-cloud-upload" aria-hidden="true"></i> {{i18n .Lang "mgr.attachment_menu"}}</a> </li>
<li{{if eq "label" .Action}} class="active"{{end}}><a href="{{urlfor "ManagerController.LabelList" }}" class="item"><i class="fa fa-bookmark" aria-hidden="true"></i> {{i18n .Lang "mgr.label_menu"}}</a> </li>
</ul>
</div>