refactor and update i18n, to be continue

pull/680/head
shiqstone 2021-04-11 01:20:47 +08:00
parent cceb9b7343
commit a5682f1308
14 changed files with 635 additions and 381 deletions

View File

@ -39,10 +39,15 @@ operate = Operate
confirm = Confirm
[message]
tips = Tips
page_not_existed = The page does not exist
no_permission = No enough permissions
keyword_placeholder = input keyword please...
wrong_account_password = Incorrect username or password
wrong_password = Wrong password
click_to_change = Click to change one
logging_in = logging in...
need_relogin = Relogin please.
return_account_login = Return account password login
no_account_yet = No account yet?
has_account = Already have an account?
@ -78,7 +83,9 @@ dingtalk_auto_login_not_enable = DingTalk automatic login function is not enable
failed_auto_login = Automatic login failed
no_project = No Project
item_not_exist = Item does not exist or has been deleted
item_not_exist_or_no_permit = Item does not exist or has insufficient permissions
doc_not_exist = Document does not exist or has been deleted
doc_not_exist_or_no_permit = Document does not exist or has insufficient permissions
unknown_exception = Unknown Exception
no_data = No Data
project_must_belong_space = Project must belong to a project space, and the administrator can manage it
@ -95,6 +102,8 @@ warning_delete_project = Remove items will not be retrieved.
project_space_empty = Please select project space
project_title_empty = Project title cannot be empty
project_id_empty = Project ID cannot be empty
project_id_existed = Project ID already in use
project_id_error = Project ID error
project_id_length = Project ID must be less than 50 characters
import_file_empty = Please select the file to upload
file_type_placeholder = Please select a Zip file
@ -105,6 +114,7 @@ project_id_desc = The project ID is used to mark the uniqueness of the item and
history_record_amount_desc = When document history enabled, this value limits the number of history saved per document
corp_id_desc = The footer that appears when the document PDF document is exported
project_desc_desc = The description information is no more than 500 characters, supports markdown syntax
project_desc_tips = The description information is no more than 500 characters
access_pass_desc = The password that needs to be provided to access the project without permit
auto_publish_desc = Enable for each save is automatically published to the latest version
enable_export_desc = Configure the exporter before you start the export, also enable the export function in the profile
@ -121,7 +131,32 @@ receive_account_empty = The recipient account cannot be empty
cannot_preview = Cannot preview
upload_failed = Upload failed
upload_file_size_limit = The file must be less than 2MB
upload_file_empty = Upload file is empty
uploda_file_type_error = upload file type is wrong
choose_pic_file = Please select a picture
no_doc_in_cur_proj = No documents for the current project
build_doc_tree_error = There was an error building the project document tree
param_error = Parameter error
doc_name_empty = Document name cannot empty
parent_id_not_existed = Parent ID not existed
doc_not_belong_project = The document does not belong to the specified project`
attachment_not_exist = Attachment does not exist
read_file_error = Load file error
confirm_override_doc = The document has been modified, are you sure to override it?
doc_auto_published = The document was automatically published
export_func_disable = The export function is disable
cur_project_export_func_disable = The export function is disable for current Project
cur_project_not_support_md = The Markdown editor is not supported for the current project
export_failed = The export failed, check the system logs
file_converting = The document is being converted in the background, please download it later
unsupport_file_type = Unsupport file type
no_exportable_file = The project has no exportable file
gen_qrcode_failed = Generate QrCode failed
search_result_error = Search error
get_doc_his_failed = Fail to get document history
project_space_not_exist = Project space does not exist
search_placeholder = input keyword please
no_search_result = No search results!
[blog]
author = author
@ -188,6 +223,120 @@ choose = Choose
upload = Upload
recipient_account = Recipient
[doc]
modify_doc = Modify Document
comparison = Comparison
save_merge = Save Merge
prev_diff = Previous difference
next_diff = Next difference
merge_to_left = Merge to left
merge_to_right = Merge to right
exchange_left_right = Exchange left and right
print = Print
download = Download
share = Share
share_project = Share project
share_url = Project URL
contents = Contents
search = Search
expand = Unfold
fold = Fold
close = Close
doc_tool_copyright = Document is Published by <a href="https://www.iminho.me" target="_blank">MinDoc</a>
edit_doc = Edit Document
backward = backward
save = save
save_as_tpl = save as template
undo = undo
redo = redo
bold = bold
italic = italic
strikethrough = strikethrough
h1 = head 1
h2 = head 2
h3 = head 3
h4 = head 4
h5 = head 5
h6 = head 6
unorder_list = disorder list
order_list = order list
hline = horizontal line
link = link
ref_link = reference link
add_pic = add picture
code = code
code_block = code block
table = add table
quote = quote
gfm_task = GFM task
attachment = attachment
json_to_table = Json converted to table
template = template
close_preview = disable preview
modify_history = modify history
sidebar = sidebar
help = help
publish = publish
document = document
create_doc = create document
attachments = attachments
doc_name = Document name
doc_name_tips = Right-click on the document name of the directory to delete and modify the document name and add subordinate documents
doc_id = Document ID
doc_id_tips = The document ID can only contain lowercase letters, numbers, and "-" and "_" symbols, and can only start with a lowercase letter
expand_desc = (Expand nodes when reading)
fold_desc = (Fold nodes when reading)
empty_contents = Empty contents
empty_contents_desc = Click to expand the subordinate nodes
upload_attachment = Upload attachment
doc_history = Document history
choose_template_type = Choose template type please
normal_tpl = Normal
api_tpl = API
data_dict = Data Dictionary
custom_tpl = Custom
tpl_default_type = Default type
tpl_plain_text = Plain Text
for_api_doc = Used for API Document
code_highlight = support code highlighting
for_data_dict = Used for data dictionary
form_support = Form Support
any_type_doc = Support any type of document
as_global_tpl = Can be set as a global template
tpl_name = Template name
tpl_type = Template type
creator = Creator
create_time = Create time
operation = Operation
global_tpl = Global
global_tpl_desc = (Any Project is available)
project_tpl = Project
project_tpl_desc = (Only the current Project is available)
insert = insert
uploading = Uploading
his_ver = Historic version
update_time = Update time
updater = Updater
version = Version
delete = Delete
recover = Recover
merge = Merge
comparison_title = Document comparison [the left is the historical document, the right is the current document, please merge the documents to the right]
font_size = font size
underscore = underscore
right_intent = right intent
left_intent = left intent
subscript = subscript
superscript = superscript
clean_format = clear format
add_video = add video
formula = formula
font_color = font color
bg_color = background color
input_pwd = input password please
read_pwd = read password
commit = commit
[page]
first = first
last = last

View File

@ -39,10 +39,15 @@ operate = 操作
confirm = 确定
[message]
tips = 友情提示
page_not_existed = 页面不存在
no_permission = 权限不足
keyword_placeholder = 请输入关键词...
wrong_account_password = 账号或密码错误
wrong_password = 密码错误
click_to_change = 点击换一张
logging_in = 正在登录...
need_relogin = 请重新登录。
return_account_login = 返回账号密码登录
no_account_yet = 还没有账号?
has_account = 已有账号?
@ -78,7 +83,9 @@ dingtalk_auto_login_not_enable = 未开启钉钉自动登录功能
failed_auto_login = 自动登录失败
no_project = 暂无项目
item_not_exist = 项目不存在或已删除
item_not_exist_or_no_permit = 项目不存在或权限不足
doc_not_exist = 文档不存在或已删除
doc_not_exist_or_no_permit = 文档不存在或权限不足
unknown_exception = 未知异常
no_data = 暂无数据
project_must_belong_space = 每个项目必须归属一个项目空间,超级管理员可在后台管理和维护
@ -95,6 +102,8 @@ warning_delete_project = 删除项目后将无法找回。
project_space_empty = 请选择项目空间
project_title_empty = 项目标题不能为空
project_id_empty = 项目标识不能为空
project_id_existed = 文档标识已被使用
project_id_error = 项目标识有误
project_id_length = 项目标识必须小于50字符
import_file_empty = 请选择需要上传的文件
file_type_placeholder = 请选择Zip文件
@ -105,6 +114,7 @@ project_id_desc = 项目标识用来标记项目的唯一性,不可修改。
history_record_amount_desc = 当开启文档历史时,该值会限制每个文档保存的历史数量
corp_id_desc = 导出文档PDF文档时显示的页脚
project_desc_desc = 描述信息不超过500个字符,支持Markdown语法
project_desc_tips = 项目描述不能大于500字
access_pass_desc = 没有访问权限访问项目时需要提供的密码
auto_publish_desc = 开启后,每次保存会自动发布到最新版本
enable_export_desc = 开启导出前请先配置导出程序,并在配置文件中同时开启导出功能
@ -121,7 +131,32 @@ receive_account_empty = 接受者账号不能为空
cannot_preview = 不能预览
upload_failed = 上传失败
upload_file_size_limit = 文件必须小于2MB
upload_file_empty = 上传文件为空
uploda_file_type_error = 文件类型有误
choose_pic_file = 请选择图片
no_doc_in_cur_proj = 当前项目没有文档
build_doc_tree_error = 生成项目文档树时出错
param_error = 参数错误
doc_name_empty = 文档名称不能为空
parent_id_not_existed = 父分类不存在
doc_not_belong_project = 文档不属于指定的项目
attachment_not_exist = 附件不存在或已删除
read_file_error = 读取文档错误
confirm_override_doc = 文档已被修改确定要覆盖吗?
doc_auto_published = 文档自动发布成功
export_func_disable = 系统没有开启导出功能
cur_project_export_func_disable = 当前项目没有开启导出功能
cur_project_not_support_md = 当前项目不支持Markdown编辑器
export_failed = 导出失败,请查看系统日志
file_converting = 文档正在后台转换,请稍后再下载
unsupport_file_type = 不支持的文件格式
no_exportable_file = 项目没有导出文件
gen_qrcode_failed = 生成二维码失败
search_result_error = 搜索结果错误
get_doc_his_failed = 获取历史失败
project_space_not_exist = 项目空间不存在
search_placeholder = 请输入搜索关键字
no_search_result = 暂无相关搜索结果!
[blog]
author = 作者
@ -188,6 +223,120 @@ choose = 选择
upload = 上传
recipient_account = 接收者账号
[doc]
modify_doc = 修改文档
comparison = 文档比较
save_merge = 保存合并
prev_diff = 上一处差异
next_diff = 下一处差异
merge_to_left = 合并到左侧
merge_to_right = 合并到右侧
exchange_left_right = 左右切换
print = 打印
download = 下载
share = 分享
share_project = 项目分享
share_url = 项目地址
contents = 目录
search = 搜索
expand = 展开
fold = 收起
close = 关闭
doc_tool_copyright = 本文档使用 <a href="https://www.iminho.me" target="_blank">MinDoc</a> 发布
edit_doc = 编辑文档
backward = 返回
save = 保存
save_as_tpl = 保存为模板
undo = 撤销
redo = 重做
bold = 粗体
italic = 斜体
strikethrough = 删除线
h1 = 标题一
h2 = 标题二
h3 = 标题三
h4 = 标题四
h5 = 标题五
h6 = 标题六
unorder_list = 无序列表
order_list = 有序列表
hline = Horizontal line
link = 链接
ref_link = 引用链接
add_pic = 添加图片
code = 行内代码
code_block = 代码块
table = 添加表格
quote = 引用
gfm_task = GFM 任务列表
attachment = 附件
json_to_table = Json转换为表格
template = 模板
close_preview = 关闭实时预览
modify_history = 修改历史
sidebar = 边栏
help = 使用帮助
publish = 发布
document = 文档
create_doc = 创建文档
attachments = 个附件
doc_name = 文档名称
doc_name_tips = 在目录的文档名上右键可以删除和修改文档名称以及添加下级文档
doc_id = 文档标识
doc_id_tips = 文档标识只能包含小写字母、数字,以及“-”和“_”符号,并且只能小写字母开头
expand_desc = (在阅读时会自动展开节点)
fold_desc = (在阅读时会关闭节点)
empty_contents = 空目录
empty_contents_desc = (单击时会展开下级节点)
upload_attachment = 上传附件
doc_history = 文档历史记录
choose_template_type = 请选择模板类型
normal_tpl = 普通文档
api_tpl = API文档
data_dict = 数据字典
custom_tpl = 自定义模板
tpl_default_type = 默认类型
tpl_plain_text = 简单的文本文档
for_api_doc = 用于API文档速写
code_highlight = 支持代码高亮
for_data_dict = 用于数据字典显示
form_support = 表格支持
any_type_doc = 支持任意类型文档
as_global_tpl = 可以设置为全局模板
tpl_name = 模板名称
tpl_type = 模板类型
creator = 创建人
create_time = 创建时间
operation = 操作
global_tpl = 全局
global_tpl_desc = (任何项目都可用)
project_tpl = 项目
project_tpl_desc = (只有当前项目可用)
insert = 插入
uploading = 正在上传
his_ver = 历史版本
update_time = 修改时间
updater = 修改人
version = 版本
delete = 删除
recover = 恢复
merge = 合并
comparison_title = 文档比较【左侧为历史文档,右侧为当前文档,请将文档合并到右侧】
font_size = 字号
underscore = 下划线
right_intent = 右缩进
left_intent = 左缩进
subscript = 下标
superscript = 上标
clean_format = 清空格式
add_video = 添加视频
formula = 公式
font_color = 字体颜色
bg_color = 背景颜色
input_pwd = 请输入密码
read_pwd = 浏览密码
commit = 提交
[page]
first = 首页
last = 末页

View File

@ -12,6 +12,7 @@ import (
"strings"
"time"
"github.com/beego/i18n"
"github.com/mindoc-org/mindoc/utils/sqltil"
"net/http"
@ -153,14 +154,14 @@ func (c *BookController) SaveBook() {
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"
}
if !models.NewItemsets().Exist(itemId) {
c.JsonResult(6006, "项目空间不存在")
c.JsonResult(6006, i18n.Tr(c.Lang, "message.project_space_not_exist"))
}
if editor != "markdown" && editor != "html" {
editor = "markdown"
@ -449,25 +450,25 @@ func (c *BookController) Create() {
itemId, _ := c.GetInt("itemId")
if bookName == "" {
c.JsonResult(6001, "项目名称不能为空")
c.JsonResult(6001, i18n.Tr(c.Lang, "message.project_name_empty"))
}
if identify == "" {
c.JsonResult(6002, "项目标识不能为空")
c.JsonResult(6002, i18n.Tr(c.Lang, "message.project_id_empty"))
}
if ok, err := regexp.MatchString(`^[a-z]+[a-zA-Z0-9_\-]*$`, identify); !ok || err != nil {
c.JsonResult(6003, "项目标识只能包含小写字母、数字,以及“-”和“_”符号,并且只能小写字母开头")
c.JsonResult(6003, i18n.Tr(c.Lang, "message.project_id_tips"))
}
if strings.Count(identify, "") > 50 {
c.JsonResult(6004, "文档标识不能超过50字")
c.JsonResult(6004, i18n.Tr(c.Lang, "message.project_id_length"))
}
if strings.Count(description, "") > 500 {
c.JsonResult(6004, "项目描述不能大于500字")
c.JsonResult(6004, i18n.Tr(c.Lang, "message.project_desc_tips"))
}
if privatelyOwned != 0 && privatelyOwned != 1 {
privatelyOwned = 1
}
if !models.NewItemsets().Exist(itemId) {
c.JsonResult(6005, "项目空间不存在")
c.JsonResult(6005, i18n.Tr(c.Lang, "message.project_space_not_exist"))
}
if commentStatus != "open" && commentStatus != "closed" && commentStatus != "group_only" && commentStatus != "registered_only" {
commentStatus = "closed"
@ -504,7 +505,7 @@ func (c *BookController) Create() {
}
if books, _ := book.FindByField("identify", identify, "book_id"); len(books) > 0 {
c.JsonResult(6006, "项目标识已存在")
c.JsonResult(6006, i18n.Tr(c.Lang, "message.project_id_existed"))
}
book.BookName = bookName
@ -528,7 +529,7 @@ func (c *BookController) Create() {
if err := book.Insert(); err != nil {
logs.Error("Insert => ", err)
c.JsonResult(6005, "保存项目失败")
c.JsonResult(6005, i18n.Tr(c.Lang, "message.failed"))
}
bookResult, err := models.NewBookResult().FindByIdentify(book.Identify, c.Member.MemberId)
@ -585,22 +586,22 @@ func (c *BookController) Import() {
itemId, _ := c.GetInt("itemId")
if bookName == "" {
c.JsonResult(6001, "项目名称不能为空")
c.JsonResult(6001, i18n.Tr(c.Lang, "message.project_name_empty"))
}
if len([]rune(bookName)) > 500 {
c.JsonResult(6002, "项目名称不能大于500字")
}
if identify == "" {
c.JsonResult(6002, "项目标识不能为空")
c.JsonResult(6002, i18n.Tr(c.Lang, "message.project_id_empty"))
}
if ok, err := regexp.MatchString(`^[a-z]+[a-zA-Z0-9_\-]*$`, identify); !ok || err != nil {
c.JsonResult(6003, "项目标识只能包含小写字母、数字,以及“-”和“_”符号,并且只能小写字母开头")
c.JsonResult(6003, i18n.Tr(c.Lang, "message.project_id_tips"))
}
if !models.NewItemsets().Exist(itemId) {
c.JsonResult(6007, "项目空间不存在")
c.JsonResult(6007, i18n.Tr(c.Lang, "message.project_space_not_exist"))
}
if strings.Count(identify, "") > 50 {
c.JsonResult(6004, "文档标识不能超过50字")
c.JsonResult(6004, i18n.Tr(c.Lang, "message.project_id_length"))
}
ext := filepath.Ext(moreFile.Filename)
@ -610,7 +611,7 @@ func (c *BookController) Import() {
}
if books, _ := models.NewBook().FindByField("identify", identify, "book_id"); len(books) > 0 {
c.JsonResult(6006, "项目标识已存在")
c.JsonResult(6006, i18n.Tr(c.Lang, "message.project_id_existed"))
}
tempPath := filepath.Join(os.TempDir(), c.CruSession.SessionID())

View File

@ -17,6 +17,7 @@ import (
"github.com/astaxie/beego"
"github.com/astaxie/beego/logs"
"github.com/astaxie/beego/orm"
"github.com/beego/i18n"
"github.com/boombuler/barcode"
"github.com/boombuler/barcode/qr"
"github.com/mindoc-org/mindoc/conf"
@ -42,7 +43,7 @@ func (c *DocumentController) Index() {
token := c.GetString("token")
if identify == "" {
c.ShowErrorPage(404, "项目不存在或已删除")
c.ShowErrorPage(404, i18n.Tr(c.Lang, "message.item_not_exist"))
}
// 如果没有开启匿名访问则跳转到登录
@ -67,7 +68,7 @@ func (c *DocumentController) Index() {
c.Data["Description"] = utils.AutoSummary(doc.Release, 120)
}
} else {
c.Data["Title"] = "概要"
c.Data["Title"] = i18n.Tr(c.Lang, "blog.summary")
c.Data["Content"] = template.HTML(blackfriday.Run([]byte(bookResult.Description)))
}
@ -75,10 +76,10 @@ func (c *DocumentController) Index() {
if err != nil {
if err == orm.ErrNoRows {
c.ShowErrorPage(404, "当前项目没有文档")
c.ShowErrorPage(404, i18n.Tr(c.Lang, "message.no_doc_in_cur_proj"))
} else {
logs.Error("生成项目文档树时出错 -> ", err)
c.ShowErrorPage(500, "生成项目文档树时出错")
c.ShowErrorPage(500, i18n.Tr(c.Lang, "message.build_doc_tree_error"))
}
}
c.Data["Model"] = bookResult
@ -97,7 +98,7 @@ func (c *DocumentController) Read() {
c.Data["DocumentId"] = id
if identify == "" || id == "" {
c.ShowErrorPage(404, "项目不存或已删除")
c.ShowErrorPage(404, i18n.Tr(c.Lang, "message.item_not_exist"))
}
// 如果没有开启匿名访问则跳转到登录
@ -116,24 +117,24 @@ func (c *DocumentController) Read() {
doc, err = doc.FromCacheById(docId)
if err != nil || doc == nil {
logs.Error("从缓存中读取文档时失败 ->", err)
c.ShowErrorPage(404, "文档不存在或已删除")
c.ShowErrorPage(404, i18n.Tr(c.Lang, "message.doc_not_exist"))
return
}
} else {
doc, err = doc.FromCacheByIdentify(id, bookResult.BookId)
if err != nil || doc == nil {
if err == orm.ErrNoRows {
c.ShowErrorPage(404, "文档不存在或已删除")
c.ShowErrorPage(404, i18n.Tr(c.Lang, "message.doc_not_exist"))
} else {
logs.Error("从缓存查询文档时出错 ->", err)
c.ShowErrorPage(500, "未知异常")
logs.Error("从数据库查询文档时出错 ->", err)
c.ShowErrorPage(500, i18n.Tr(c.Lang, "message.unknown_exception"))
}
return
}
}
if doc.BookId != bookResult.BookId {
c.ShowErrorPage(404, "文档不存在或已删除")
c.ShowErrorPage(404, i18n.Tr(c.Lang, "message.doc_not_exist"))
}
doc.Processor()
@ -163,7 +164,7 @@ func (c *DocumentController) Read() {
if err != nil && err != orm.ErrNoRows {
logs.Error("生成项目文档树时出错 ->", err)
c.ShowErrorPage(500, "生成项目文档树时出错")
c.ShowErrorPage(500, i18n.Tr(c.Lang, "message.build_doc_tree_error"))
}
c.Data["Description"] = utils.AutoSummary(doc.Release, 120)
@ -180,7 +181,7 @@ func (c *DocumentController) Edit() {
identify := c.Ctx.Input.Param(":key")
if identify == "" {
c.ShowErrorPage(404, "无法解析项目标识")
c.ShowErrorPage(404, i18n.Tr(c.Lang, "message.project_id_error"))
}
bookResult := models.NewBookResult()
@ -190,7 +191,7 @@ func (c *DocumentController) Edit() {
if c.Member.IsAdministrator() {
book, err := models.NewBook().FindByFieldFirst("identify", identify)
if err != nil {
c.JsonResult(6002, "项目不存在或权限不足")
c.JsonResult(6002, i18n.Tr(c.Lang, "message.item_not_exist_or_no_permit"))
}
bookResult = models.NewBookResult().ToBookResult(*book)
@ -199,15 +200,15 @@ func (c *DocumentController) Edit() {
if err != nil {
if err == orm.ErrNoRows || err == models.ErrPermissionDenied {
c.ShowErrorPage(403, "项目不存在或没有权限")
c.ShowErrorPage(403, i18n.Tr(c.Lang, "message.item_not_exist_or_no_permit"))
} else {
logs.Error("查询项目时出错 -> ", err)
c.ShowErrorPage(500, "查询项目时出错")
c.ShowErrorPage(500, i18n.Tr(c.Lang, "message.system_error"))
}
return
}
if bookResult.RoleId == conf.BookObserver {
c.JsonResult(6002, "项目不存在或权限不足")
c.JsonResult(6002, i18n.Tr(c.Lang, "message.item_not_exist_or_no_permit"))
}
}
@ -261,11 +262,11 @@ func (c *DocumentController) Create() {
isOpen, _ := c.GetInt("is_open", 0)
if identify == "" {
c.JsonResult(6001, "参数错误")
c.JsonResult(6001, i18n.Tr(c.Lang, "message.param_error"))
}
if docName == "" {
c.JsonResult(6004, "文档名称不能为空")
c.JsonResult(6004, i18n.Tr(c.Lang, "message.doc_name_empty"))
}
bookId := 0
@ -275,7 +276,7 @@ func (c *DocumentController) Create() {
book, err := models.NewBook().FindByFieldFirst("identify", identify)
if err != nil {
logs.Error(err)
c.JsonResult(6002, "项目不存在或权限不足")
c.JsonResult(6002, i18n.Tr(c.Lang, "message.item_not_existed_or_no_permit"))
}
bookId = book.BookId
@ -284,7 +285,7 @@ func (c *DocumentController) Create() {
if err != nil || bookResult.RoleId == conf.BookObserver {
logs.Error("FindByIdentify => ", err)
c.JsonResult(6002, "项目不存在或权限不足")
c.JsonResult(6002, i18n.Tr(c.Lang, "message.item_not_existed_or_no_permit"))
}
bookId = bookResult.BookId
@ -292,18 +293,18 @@ func (c *DocumentController) Create() {
if docIdentify != "" {
if ok, err := regexp.MatchString(`[a-z]+[a-zA-Z0-9_.\-]*$`, docIdentify); !ok || err != nil {
c.JsonResult(6003, "文档标识只能包含小写字母、数字,以及“-”、“.”和“_”符号")
c.JsonResult(6003, i18n.Tr(c.Lang, "message.project_id_tips"))
}
d, _ := models.NewDocument().FindByIdentityFirst(docIdentify, bookId)
if d.DocumentId > 0 && d.DocumentId != docId {
c.JsonResult(6006, "文档标识已被使用")
c.JsonResult(6006, i18n.Tr(c.Lang, "message.project_id_existed"))
}
}
if parentId > 0 {
doc, err := models.NewDocument().Find(parentId)
if err != nil || doc.BookId != bookId {
c.JsonResult(6003, "父分类不存在")
c.JsonResult(6003, i18n.Tr(c.Lang, "message.parent_id_not_existed"))
}
}
@ -328,7 +329,7 @@ func (c *DocumentController) Create() {
if err := document.InsertOrUpdate(); err != nil {
logs.Error("添加或更新文档时出错 -> ", err)
c.JsonResult(6005, "保存失败")
c.JsonResult(6005, i18n.Tr(c.Lang, "message.failed"))
} else {
c.JsonResult(0, "ok", document)
}
@ -341,7 +342,7 @@ func (c *DocumentController) Upload() {
isAttach := true
if identify == "" {
c.JsonResult(6001, "参数错误")
c.JsonResult(6001, i18n.Tr(c.Lang, "message.param_error"))
}
name := "editormd-file-file"
@ -351,7 +352,7 @@ func (c *DocumentController) Upload() {
name = "editormd-image-file"
file, moreFile, err = c.GetFile(name)
if err == http.ErrMissingFile || moreFile == nil {
c.JsonResult(6003, "没有发现需要上传的文件")
c.JsonResult(6003, i18n.Tr(c.Lang, "message.upload_file_empty"))
return
}
}
@ -367,17 +368,17 @@ func (c *DocumentController) Upload() {
}
if conf.GetUploadFileSize() > 0 && moreFile.Size > conf.GetUploadFileSize() {
c.JsonResult(6009, "文件大小超过了限定的最大值")
c.JsonResult(6009, i18n.Tr(c.Lang, "message.upload_file_size_limit"))
}
ext := filepath.Ext(moreFile.Filename)
//文件必须带有后缀名
if ext == "" {
c.JsonResult(6003, "无法解析文件的格式")
c.JsonResult(6003, i18n.Tr(c.Lang, "message.upload_file_type_error"))
}
//如果文件类型设置为 * 标识不限制文件类型
if conf.IsAllowUploadFileExt(ext) == false {
c.JsonResult(6004, "不允许的文件类型")
c.JsonResult(6004, i18n.Tr(c.Lang, "message.upload_file_type_error"))
}
bookId := 0
@ -387,7 +388,7 @@ func (c *DocumentController) Upload() {
book, err := models.NewBook().FindByFieldFirst("identify", identify)
if err != nil {
c.JsonResult(6006, "文档不存在或权限不足")
c.JsonResult(6006, i18n.Tr(c.Lang, "message.doc_not_exist_or_no_permit"))
}
bookId = book.BookId
@ -397,7 +398,7 @@ func (c *DocumentController) Upload() {
if err != nil {
logs.Error("DocumentController.Edit => ", err)
if err == orm.ErrNoRows {
c.JsonResult(6006, "权限不足")
c.JsonResult(6006, i18n.Tr(c.Lang, "message.no_permission"))
}
c.JsonResult(6001, err.Error())
@ -405,7 +406,7 @@ func (c *DocumentController) Upload() {
// 如果没有编辑权限
if book.RoleId != conf.BookEditor && book.RoleId != conf.BookAdmin && book.RoleId != conf.BookFounder {
c.JsonResult(6006, "权限不足")
c.JsonResult(6006, i18n.Tr(c.Lang, "message.no_permission"))
}
bookId = book.BookId
@ -414,11 +415,11 @@ func (c *DocumentController) Upload() {
if docId > 0 {
doc, err := models.NewDocument().Find(docId)
if err != nil {
c.JsonResult(6007, "文档不存在")
c.JsonResult(6007, i18n.Tr(c.Lang, "message.doc_not_exist"))
}
if doc.BookId != bookId {
c.JsonResult(6008, "文档不属于指定的项目")
c.JsonResult(6008, i18n.Tr(c.Lang, "message.doc_not_belong_project"))
}
}
@ -440,7 +441,7 @@ func (c *DocumentController) Upload() {
if err != nil {
logs.Error("保存文件失败 -> ", err)
c.JsonResult(6005, "保存文件失败")
c.JsonResult(6005, i18n.Tr(c.Lang, "message.failed"))
}
attachment := models.NewAttachment()
@ -473,7 +474,7 @@ func (c *DocumentController) Upload() {
if err != nil {
os.Remove(filePath)
logs.Error("文件保存失败 ->", err)
c.JsonResult(6006, "文件保存失败")
c.JsonResult(6006, i18n.Tr(c.Lang, "message.failed"))
}
if attachment.HttpPath == "" {
@ -481,7 +482,7 @@ func (c *DocumentController) Upload() {
if err := attachment.Update(); err != nil {
logs.Error("保存文件失败 ->", err)
c.JsonResult(6005, "保存文件失败")
c.JsonResult(6005, i18n.Tr(c.Lang, "message.failed"))
}
}
@ -523,10 +524,10 @@ func (c *DocumentController) DownloadAttachment() {
book, err := models.NewBook().FindByFieldFirst("identify", identify)
if err != nil {
if err == orm.ErrNoRows {
c.ShowErrorPage(404, "项目不存在或已删除")
c.ShowErrorPage(404, i18n.Tr(c.Lang, "message.item_not_exist"))
} else {
logs.Error("查找项目时出错 ->", err)
c.ShowErrorPage(500, "系统错误")
c.ShowErrorPage(500, i18n.Tr(c.Lang, "message.system_error"))
}
}
@ -534,7 +535,7 @@ func (c *DocumentController) DownloadAttachment() {
if c.Member == nil || c.Member.Role != conf.MemberSuperRole {
// 如果项目是私有的,并且 token 不正确
if (book.PrivatelyOwned == 1 && token == "") || (book.PrivatelyOwned == 1 && book.PrivateToken != token) {
c.ShowErrorPage(403, "权限不足")
c.ShowErrorPage(403, i18n.Tr(c.Lang, "message.no_permission"))
}
}
@ -549,14 +550,14 @@ func (c *DocumentController) DownloadAttachment() {
if err != nil {
logs.Error("查找附件时出错 -> ", err)
if err == orm.ErrNoRows {
c.ShowErrorPage(404, "附件不存在或已删除")
c.ShowErrorPage(404, i18n.Tr(c.Lang, "message.attachment_not_exist"))
} else {
c.ShowErrorPage(500, "查找附件时出错")
c.ShowErrorPage(500, i18n.Tr(c.Lang, "message.system_error"))
}
}
if attachment.BookId != bookId {
c.ShowErrorPage(404, "附件不存在或已删除")
c.ShowErrorPage(404, i18n.Tr(c.Lang, "message.attachment_not_exist"))
}
c.Ctx.Output.Download(filepath.Join(conf.WorkingDirectory, attachment.FilePath), attachment.FileName)
@ -569,39 +570,39 @@ func (c *DocumentController) RemoveAttachment() {
attachId, _ := c.GetInt("attach_id")
if attachId <= 0 {
c.JsonResult(6001, "参数错误")
c.JsonResult(6001, i18n.Tr(c.Lang, "message.param_error"))
}
attach, err := models.NewAttachment().Find(attachId)
if err != nil {
logs.Error(err)
c.JsonResult(6002, "附件不存在")
c.JsonResult(6002, i18n.Tr(c.Lang, "message.attachment_not_exist"))
}
document, err := models.NewDocument().Find(attach.DocumentId)
if err != nil {
logs.Error(err)
c.JsonResult(6003, "文档不存在")
c.JsonResult(6003, i18n.Tr(c.Lang, "message.doc_not_exist"))
}
if c.Member.Role != conf.MemberSuperRole {
rel, err := models.NewRelationship().FindByBookIdAndMemberId(document.BookId, c.Member.MemberId)
if err != nil {
logs.Error(err)
c.JsonResult(6004, "权限不足")
c.JsonResult(6004, i18n.Tr(c.Lang, "message.no_permission"))
}
if rel.RoleId == conf.BookObserver {
c.JsonResult(6004, "权限不足")
c.JsonResult(6004, i18n.Tr(c.Lang, "message.no_permission"))
}
}
err = attach.Delete()
if err != nil {
logs.Error(err)
c.JsonResult(6005, "删除失败")
c.JsonResult(6005, i18n.Tr(c.Lang, "message.failed"))
}
os.Remove(filepath.Join(conf.WorkingDirectory, attach.FilePath))
@ -623,7 +624,7 @@ func (c *DocumentController) Delete() {
book, err := models.NewBook().FindByFieldFirst("identify", identify)
if err != nil {
logs.Error("FindByIdentify => ", err)
c.JsonResult(6002, "项目不存在或权限不足")
c.JsonResult(6002, i18n.Tr(c.Lang, "message.item_not_exist_or_no_permit"))
}
bookId = book.BookId
@ -632,31 +633,31 @@ func (c *DocumentController) Delete() {
if err != nil || bookResult.RoleId == conf.BookObserver {
logs.Error("FindByIdentify => ", err)
c.JsonResult(6002, "项目不存在或权限不足")
c.JsonResult(6002, i18n.Tr(c.Lang, "message.item_not_exist_or_no_permit"))
}
bookId = bookResult.BookId
}
if docId <= 0 {
c.JsonResult(6001, "参数错误")
c.JsonResult(6001, i18n.Tr(c.Lang, "message.param_error"))
}
doc, err := models.NewDocument().Find(docId)
if err != nil {
logs.Error("Delete => ", err)
c.JsonResult(6003, "删除失败")
c.JsonResult(6003, i18n.Tr(c.Lang, "message.failed"))
}
// 如果文档所属项目错误
if doc.BookId != bookId {
c.JsonResult(6004, "参数错误")
c.JsonResult(6004, i18n.Tr(c.Lang, "message.param_error"))
}
// 递归删除项目下的文档以及子文档
err = doc.RecursiveDocument(doc.DocumentId)
if err != nil {
c.JsonResult(6005, "删除失败")
c.JsonResult(6005, i18n.Tr(c.Lang, "message.failed"))
}
// 重置文档数量统计
@ -682,7 +683,7 @@ func (c *DocumentController) Content() {
if c.Member.IsAdministrator() {
book, err := models.NewBook().FindByFieldFirst("identify", identify)
if err != nil || book == nil {
c.JsonResult(6002, "项目不存在或权限不足")
c.JsonResult(6002, i18n.Tr(c.Lang, "message.item_not_exist_or_no_permit"))
return
}
@ -693,7 +694,7 @@ func (c *DocumentController) Content() {
if err != nil || bookResult.RoleId == conf.BookObserver {
logs.Error("项目不存在或权限不足 -> ", err)
c.JsonResult(6002, "项目不存在或权限不足")
c.JsonResult(6002, i18n.Tr(c.Lang, "message.item_not_exist_or_no_permit"))
}
bookId = bookResult.BookId
@ -701,7 +702,7 @@ func (c *DocumentController) Content() {
}
if docId <= 0 {
c.JsonResult(6001, "参数错误")
c.JsonResult(6001, i18n.Tr(c.Lang, "message.param_error"))
}
if c.Ctx.Input.IsPost() {
@ -713,17 +714,17 @@ func (c *DocumentController) Content() {
doc, err := models.NewDocument().Find(docId)
if err != nil || doc == nil {
c.JsonResult(6003, "读取文档错误")
c.JsonResult(6003, i18n.Tr(c.Lang, "message.read_file_error"))
return
}
if doc.BookId != bookId {
c.JsonResult(6004, "保存的文档不属于指定项目")
c.JsonResult(6004, i18n.Tr(c.Lang, "message.dock_not_belong_project"))
}
if doc.Version != version && !strings.EqualFold(isCover, "yes") {
logs.Info("%d|", version, doc.Version)
c.JsonResult(6005, "文档已被修改确定要覆盖吗?")
c.JsonResult(6005, i18n.Tr(c.Lang, "message.confirm_override_doc"))
}
history := models.NewDocumentHistory()
@ -736,7 +737,7 @@ func (c *DocumentController) Content() {
history.ParentId = doc.ParentId
history.Version = time.Now().Unix()
history.Action = "modify"
history.ActionName = "修改文档"
history.ActionName = i18n.Tr(c.Lang, "doc.modify_doc")
if markdown == "" && content != "" {
doc.Markdown = content
@ -750,7 +751,7 @@ func (c *DocumentController) Content() {
if err := doc.InsertOrUpdate(); err != nil {
logs.Error("InsertOrUpdate => ", err)
c.JsonResult(6006, "保存失败")
c.JsonResult(6006, i18n.Tr(c.Lang, "message.failed"))
}
// 如果启用了文档历史,则添加历史文档
@ -769,7 +770,7 @@ func (c *DocumentController) Content() {
go func() {
err := doc.ReleaseContent()
if err == nil {
logs.Informational("文档自动发布成功 -> document_id=%d;document_name=%s", doc.DocumentId, doc.DocumentName)
logs.Informational(i18n.Tr(c.Lang, "message.doc_auto_published")+"-> document_id=%d;document_name=%s", doc.DocumentId, doc.DocumentName)
}
}()
}
@ -779,7 +780,7 @@ func (c *DocumentController) Content() {
doc, err := models.NewDocument().Find(docId)
if err != nil {
c.JsonResult(6003, "文档不存在")
c.JsonResult(6003, i18n.Tr(c.Lang, "message.doc_not_exist"))
return
}
@ -797,7 +798,7 @@ func (c *DocumentController) Export() {
identify := c.Ctx.Input.Param(":key")
if identify == "" {
c.ShowErrorPage(500, "参数错误")
c.ShowErrorPage(500, i18n.Tr(c.Lang, "message.param_error"))
}
output := c.GetString("output")
@ -809,7 +810,7 @@ func (c *DocumentController) Export() {
return
}
if !conf.GetEnableExport() {
c.ShowErrorPage(500, "系统没有开启导出功能")
c.ShowErrorPage(500, i18n.Tr(c.Lang, "export_func_disable"))
}
bookResult := models.NewBookResult()
@ -817,10 +818,10 @@ func (c *DocumentController) Export() {
book, err := models.NewBook().FindByIdentify(identify)
if err != nil {
if err == orm.ErrNoRows {
c.ShowErrorPage(404, "项目不存在")
c.ShowErrorPage(404, i18n.Tr(c.Lang, "message.item_not_exist"))
} else {
logs.Error("查找项目时出错 ->", err)
c.ShowErrorPage(500, "查找项目时出错")
c.ShowErrorPage(500, i18n.Tr(c.Lang, "message.system_error"))
}
}
bookResult = models.NewBookResult().ToBookResult(*book)
@ -828,7 +829,7 @@ func (c *DocumentController) Export() {
bookResult = c.isReadable(identify, token)
}
if !bookResult.IsDownload {
c.ShowErrorPage(200, "当前项目没有开启导出功能")
c.ShowErrorPage(200, i18n.Tr(c.Lang, "message.cur_project_export_func_disable"))
}
if !strings.HasPrefix(bookResult.Cover, "http:://") && !strings.HasPrefix(bookResult.Cover, "https:://") {
@ -837,12 +838,12 @@ func (c *DocumentController) Export() {
if output == "markdown" {
if bookResult.Editor != "markdown" {
c.ShowErrorPage(500, "当前项目不支持Markdown编辑器")
c.ShowErrorPage(500, i18n.Tr(c.Lang, "message.cur_project_not_support_md"))
}
p, err := bookResult.ExportMarkdown(c.CruSession.SessionID())
if err != nil {
c.ShowErrorPage(500, "导出文档失败")
c.ShowErrorPage(500, i18n.Tr(c.Lang, "message.failed"))
}
c.Ctx.Output.Download(p, bookResult.BookName+".zip")
@ -875,15 +876,15 @@ func (c *DocumentController) Export() {
} else if output == "pdf" || output == "epub" || output == "docx" || output == "mobi" {
if err := models.BackgroundConvert(c.CruSession.SessionID(), bookResult); err != nil && err != gopool.ErrHandlerIsExist {
c.ShowErrorPage(500, "导出失败,请查看系统日志")
c.ShowErrorPage(500, i18n.Tr(c.Lang, "message.export_failed"))
}
c.ShowErrorPage(200, "文档正在后台转换,请稍后再下载")
c.ShowErrorPage(200, i18n.Tr(c.Lang, "message.file_converting"))
} else {
c.ShowErrorPage(200, "不支持的文件格式")
c.ShowErrorPage(200, i18n.Tr(c.Lang, "message.unsupport_file_type"))
}
c.ShowErrorPage(404, "项目没有导出文件")
c.ShowErrorPage(404, i18n.Tr(c.Lang, "message.no_exportable_file"))
}
// 生成项目访问的二维码
@ -894,20 +895,20 @@ func (c *DocumentController) QrCode() {
book, err := models.NewBook().FindByIdentify(identify)
if err != nil || book.BookId <= 0 {
c.ShowErrorPage(404, "项目不存在")
c.ShowErrorPage(404, i18n.Tr(c.Lang, "message.item_not_exist"))
}
uri := conf.URLFor("DocumentController.Index", ":key", identify)
code, err := qr.Encode(uri, qr.L, qr.Unicode)
if err != nil {
logs.Error("生成二维码失败 ->", err)
c.ShowErrorPage(500, "生成二维码失败")
c.ShowErrorPage(500, i18n.Tr(c.Lang, "message.gen_qrcode_failed"))
}
code, err = barcode.Scale(code, 150, 150)
if err != nil {
logs.Error("生成二维码失败 ->", err)
c.ShowErrorPage(500, "生成二维码失败")
c.ShowErrorPage(500, i18n.Tr(c.Lang, "message.gen_qrcode_failed"))
}
c.Ctx.ResponseWriter.Header().Set("Content-Type", "image/png")
@ -917,7 +918,7 @@ func (c *DocumentController) QrCode() {
err = png.Encode(c.Ctx.ResponseWriter, code)
if err != nil {
logs.Error("生成二维码失败 ->", err)
c.ShowErrorPage(500, "生成二维码失败")
c.ShowErrorPage(500, i18n.Tr(c.Lang, "message.gen_qrcode_failed"))
}
}
@ -930,7 +931,7 @@ func (c *DocumentController) Search() {
keyword := strings.TrimSpace(c.GetString("keyword"))
if identify == "" {
c.JsonResult(6001, "参数错误")
c.JsonResult(6001, i18n.Tr(c.Lang, "message.param_error"))
}
if !c.EnableAnonymous && !c.isUserLoggedIn() {
@ -943,11 +944,11 @@ func (c *DocumentController) Search() {
docs, err := models.NewDocumentSearchResult().SearchDocument(keyword, bookResult.BookId)
if err != nil {
logs.Error(err)
c.JsonResult(6002, "搜索结果错误")
c.JsonResult(6002, i18n.Tr(c.Lang, "message.search_result_error"))
}
if len(docs) < 0 {
c.JsonResult(404, "没有数据库")
c.JsonResult(404, i18n.Tr(c.Lang, "message.no_data"))
}
for _, doc := range docs {
@ -977,7 +978,7 @@ func (c *DocumentController) History() {
book, err := models.NewBook().FindByFieldFirst("identify", identify)
if err != nil {
logs.Error("查找项目失败 ->", err)
c.Data["ErrorMessage"] = "项目不存在或权限不足"
c.Data["ErrorMessage"] = i18n.Tr(c.Lang, "message.item_not_exist_or_no_permit")
return
}
@ -987,7 +988,7 @@ func (c *DocumentController) History() {
bookResult, err := models.NewBookResult().FindByIdentify(identify, c.Member.MemberId)
if err != nil || bookResult.RoleId == conf.BookObserver {
logs.Error("查找项目失败 ->", err)
c.Data["ErrorMessage"] = "项目不存在或权限不足"
c.Data["ErrorMessage"] = i18n.Tr(c.Lang, "message.item_not_exist_or_no_permit")
return
}
@ -996,27 +997,27 @@ func (c *DocumentController) History() {
}
if docId <= 0 {
c.Data["ErrorMessage"] = "参数错误"
c.Data["ErrorMessage"] = i18n.Tr(c.Lang, "message.param_error")
return
}
doc, err := models.NewDocument().Find(docId)
if err != nil {
logs.Error("Delete => ", err)
c.Data["ErrorMessage"] = "获取历史失败"
c.Data["ErrorMessage"] = i18n.Tr(c.Lang, "message.get_doc_his_failed")
return
}
// 如果文档所属项目错误
if doc.BookId != bookId {
c.Data["ErrorMessage"] = "参数错误"
c.Data["ErrorMessage"] = i18n.Tr(c.Lang, "message.param_error")
return
}
histories, totalCount, err := models.NewDocumentHistory().FindToPager(docId, pageIndex, conf.PageSize)
if err != nil {
logs.Error("分页查找文档历史失败 ->", err)
c.Data["ErrorMessage"] = "获取历史失败"
c.Data["ErrorMessage"] = i18n.Tr(c.Lang, "message.get_doc_his_failed")
return
}
@ -1040,7 +1041,7 @@ func (c *DocumentController) DeleteHistory() {
historyId, _ := c.GetInt("history_id", 0)
if historyId <= 0 {
c.JsonResult(6001, "参数错误")
c.JsonResult(6001, i18n.Tr(c.Lang, "message.param_error"))
}
bookId := 0
@ -1050,7 +1051,7 @@ func (c *DocumentController) DeleteHistory() {
book, err := models.NewBook().FindByFieldFirst("identify", identify)
if err != nil {
logs.Error("查找项目失败 ->", err)
c.JsonResult(6002, "项目不存在或权限不足")
c.JsonResult(6002, i18n.Tr(c.Lang, "message.item_not_exist_or_no_permit"))
}
bookId = book.BookId
@ -1058,31 +1059,31 @@ func (c *DocumentController) DeleteHistory() {
bookResult, err := models.NewBookResult().FindByIdentify(identify, c.Member.MemberId)
if err != nil || bookResult.RoleId == conf.BookObserver {
logs.Error("查找项目失败 ->", err)
c.JsonResult(6002, "项目不存在或权限不足")
c.JsonResult(6002, i18n.Tr(c.Lang, "message.item_not_exist_or_no_permit"))
}
bookId = bookResult.BookId
}
if docId <= 0 {
c.JsonResult(6001, "参数错误")
c.JsonResult(6001, i18n.Tr(c.Lang, "message.param_error"))
}
doc, err := models.NewDocument().Find(docId)
if err != nil {
logs.Error("Delete => ", err)
c.JsonResult(6001, "获取历史失败")
c.JsonResult(6001, i18n.Tr(c.Lang, "message.get_doc_his_failed"))
}
// 如果文档所属项目错误
if doc.BookId != bookId {
c.JsonResult(6001, "参数错误")
c.JsonResult(6001, i18n.Tr(c.Lang, "message.param_error"))
}
err = models.NewDocumentHistory().Delete(historyId, docId)
if err != nil {
logs.Error(err)
c.JsonResult(6002, "删除失败")
c.JsonResult(6002, i18n.Tr(c.Lang, "message.failed"))
}
c.JsonResult(0, "ok")
@ -1099,7 +1100,7 @@ func (c *DocumentController) RestoreHistory() {
historyId, _ := c.GetInt("history_id", 0)
if historyId <= 0 {
c.JsonResult(6001, "参数错误")
c.JsonResult(6001, i18n.Tr(c.Lang, "message.param_error"))
}
bookId := 0
@ -1108,7 +1109,7 @@ func (c *DocumentController) RestoreHistory() {
book, err := models.NewBook().FindByFieldFirst("identify", identify)
if err != nil {
logs.Error("FindByIdentify => ", err)
c.JsonResult(6002, "项目不存在或权限不足")
c.JsonResult(6002, i18n.Tr(c.Lang, "message.item_not_exist_or_no_permit"))
}
bookId = book.BookId
@ -1116,31 +1117,31 @@ func (c *DocumentController) RestoreHistory() {
bookResult, err := models.NewBookResult().FindByIdentify(identify, c.Member.MemberId)
if err != nil || bookResult.RoleId == conf.BookObserver {
logs.Error("FindByIdentify => ", err)
c.JsonResult(6002, "项目不存在或权限不足")
c.JsonResult(6002, i18n.Tr(c.Lang, "message.item_not_exist_or_no_permit"))
}
bookId = bookResult.BookId
}
if docId <= 0 {
c.JsonResult(6001, "参数错误")
c.JsonResult(6001, i18n.Tr(c.Lang, "message.param_error"))
}
doc, err := models.NewDocument().Find(docId)
if err != nil {
logs.Error("Delete => ", err)
c.JsonResult(6001, "获取历史失败")
c.JsonResult(6001, i18n.Tr(c.Lang, "message.get_doc_his_failed"))
}
// 如果文档所属项目错误
if doc.BookId != bookId {
c.JsonResult(6001, "参数错误")
c.JsonResult(6001, i18n.Tr(c.Lang, "message.param_error"))
}
err = models.NewDocumentHistory().Restore(historyId, docId, c.Member.MemberId)
if err != nil {
logs.Error(err)
c.JsonResult(6002, "删除失败")
c.JsonResult(6002, i18n.Tr(c.Lang, "message.failed"))
}
c.JsonResult(0, "ok", doc)
@ -1162,7 +1163,7 @@ func (c *DocumentController) Compare() {
book, err := models.NewBook().FindByFieldFirst("identify", identify)
if err != nil {
logs.Error("DocumentController.Compare => ", err)
c.ShowErrorPage(403, "权限不足")
c.ShowErrorPage(403, i18n.Tr(c.Lang, "message.no_permission"))
return
}
@ -1173,7 +1174,7 @@ func (c *DocumentController) Compare() {
bookResult, err := models.NewBookResult().FindByIdentify(identify, c.Member.MemberId)
if err != nil || bookResult.RoleId == conf.BookObserver {
logs.Error("FindByIdentify => ", err)
c.ShowErrorPage(403, "权限不足")
c.ShowErrorPage(403, i18n.Tr(c.Lang, "message.no_permission"))
return
}
@ -1183,7 +1184,7 @@ func (c *DocumentController) Compare() {
}
if historyId <= 0 {
c.ShowErrorPage(60002, "参数错误")
c.ShowErrorPage(60002, i18n.Tr(c.Lang, "message.param_error"))
}
history, err := models.NewDocumentHistory().Find(historyId)
@ -1194,7 +1195,7 @@ func (c *DocumentController) Compare() {
doc, err := models.NewDocument().Find(history.DocumentId)
if err != nil || doc == nil || doc.BookId != bookId {
c.ShowErrorPage(60002, "文档不存在或已删除")
c.ShowErrorPage(60002, i18n.Tr(c.Lang, "message.doc_not_exist"))
return
}
@ -1216,7 +1217,7 @@ func (c *DocumentController) isReadable(identify, token string) *models.BookResu
if err != nil {
logs.Error(err)
c.ShowErrorPage(500, "项目不存在")
c.ShowErrorPage(500, i18n.Tr(c.Lang, "message.item_not_exist"))
}
bookResult := models.NewBookResult().ToBookResult(*book)
isOk := false
@ -1241,13 +1242,13 @@ func (c *DocumentController) isReadable(identify, token string) *models.BookResu
c.SetSession(identify, token)
} else if token, ok := c.GetSession(identify).(string); !ok || !strings.EqualFold(token, book.PrivateToken) {
logs.Info("尝试访问文档但权限不足 ->", identify, token)
c.ShowErrorPage(403, "权限不足")
c.ShowErrorPage(403, i18n.Tr(c.Lang, "message.no_permission"))
}
} else if password := c.GetString("bPassword", ""); !isOk && book.BookPassword != "" && password != "" {
//如果设置了密码,则判断密码是否正确
if book.BookPassword != password {
c.JsonResult(5001, "密码错误")
c.JsonResult(5001, i18n.Tr(c.Lang, "message.wrong_password"))
} else {
c.SetSession(identify, password)
c.JsonResult(0, "OK")
@ -1266,7 +1267,7 @@ func (c *DocumentController) isReadable(identify, token string) *models.BookResu
}
} else {
logs.Info("尝试访问文档但权限不足 ->", identify, token)
c.ShowErrorPage(403, "权限不足")
c.ShowErrorPage(403, i18n.Tr(c.Lang, "message.no_permission"))
}
}
}
@ -1280,7 +1281,7 @@ func promptUserToLogIn(c *DocumentController) {
logs.Info(" Access will be redirected to login page(SessionId: " + c.CruSession.SessionID() + ").")
if c.IsAjax() {
c.JsonResult(6000, "请重新登录。")
c.JsonResult(6000, i18n.Tr(c.Lang, "message.need_relogin"))
} else {
c.Redirect(conf.URLFor("AccountController.Login")+"?url="+url.PathEscape(conf.BaseUrl+c.Ctx.Request.URL.RequestURI()), 302)
}

View File

@ -50,7 +50,7 @@
<div class="box-body">
<div class="users-list" id="teamList">
<template v-if="lists.length <= 0">
<div class="text-center">{{i18n $.Lang "common.no_data"}}</div>
<div class="text-center">{{i18n $.Lang "message.no_data"}}</div>
</template>
<template v-else>
<table class="table">

View File

@ -3,7 +3,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<title>文档比较 - Powered by MinDoc</title>
<title>i18n.Tr(c.Lang, "doc.comparision") - Powered by MinDoc</title>
<link rel="shortcut icon" href="{{cdnimg "/favicon.ico"}}" />
<link href="{{cdncss "/static/fonts/notosans.css"}}" rel='stylesheet' type='text/css' />
<link type='text/css' rel='stylesheet' href="{{cdncss "/static/mergely/editor/lib/wicked-ui.css"}}" />
@ -29,19 +29,19 @@
<body style="visibility:hidden">
<!-- toolbar -->
<ul id="toolbar">
<li id="tb-file-save" data-icon="icon-save" title="保存">保存合并</li>
<li id="tb-file-save" data-icon="icon-save" title="i18n.Tr(c.Lang, "common.save")">i18n.Tr(c.Lang, "doc.save_merge")</li>
<li class="separator"></li>
<li id="tb-view-change-prev" data-icon="icon-arrow-up" title="上一处差异">上一处差异</li>
<li id="tb-view-change-next" data-icon="icon-arrow-down" title="下一处差异">下一处差异</li>
<li id="tb-view-change-prev" data-icon="icon-arrow-up" title="i18n.Tr(c.Lang, "doc.prev_diff")">i18n.Tr(c.Lang, "doc.prev_diff")</li>
<li id="tb-view-change-next" data-icon="icon-arrow-down" title="i18n.Tr(c.Lang, "doc.next_diff")">i18n.Tr(c.Lang, "doc.next_diff")</li>
<li class="separator"></li>
<li id="tb-edit-right-merge-left" data-icon="icon-arrow-left-v" title="合并到左侧">合并到左侧</li>
<li id="tb-edit-left-merge-right" data-icon="icon-arrow-right-v" title="合并到右侧">合并到右侧</li>
<li id="tb-view-swap" data-icon="icon-swap" title="左右切换">左右切换</li>
<li id="tb-edit-right-merge-left" data-icon="icon-arrow-left-v" title="i18n.Tr(c.Lang, "doc.merge_to_left")">i18n.Tr(c.Lang, "doc.merge_to_left")</li>
<li id="tb-edit-left-merge-right" data-icon="icon-arrow-right-v" title="i18n.Tr(c.Lang, "doc.merge_to_right")">i18n.Tr(c.Lang, "doc.merge_to_right")</li>
<li id="tb-view-swap" data-icon="icon-swap" title="i18n.Tr(c.Lang, "doc.exchange_left_right")">i18n.Tr(c.Lang, "doc.exchange_left_right")</li>
</ul>
<!-- find -->
<div class="find">
<input type="text" placeholder="请输入关键字"/>
<input type="text" placeholder="i18n.Tr(c.Lang, "message.keyword_placeholder")"/>
<button class="find-prev"><span class="icon icon-arrow-up"></span></button>
<button class="find-next"><span class="icon icon-arrow-down"></span></button>
<button class="find-close"><span class="icon icon-x-mark"></span></button>

View File

@ -53,34 +53,34 @@
<a href="{{urlfor "DocumentController.Index" ":key" .Model.Identify}}" title="{{.Model.BookName}}" class="book-title">{{.Model.BookName}}</a>
<span style="font-size: 12px;font-weight: 100;"></span>
</div>
<a href="{{urlfor "HomeController.Index"}}" class="btn btn-default btn-mobile"> <i class="fa fa-home" aria-hidden="true"></i>首页</a>
<a href="{{urlfor "HomeController.Index"}}" class="btn btn-default btn-mobile"> <i class="fa fa-home" aria-hidden="true"></i> {{i18n .Lang "common.home"}}</a>
<div class="navbar-header pull-right manual-menu">
<a href="javascript:window.print();" id="printSinglePage" class="btn btn-default" style="margin-right: 10px;"><i class="fa fa-print"></i> 打印</a>
<div class="dropdown pull-left" style="margin-right: 10px;">
<a href="{{urlfor "HomeController.Index"}}" class="btn btn-default"><i class="fa fa-home" aria-hidden="true"></i> {{i18n .Lang "common.home"}}</a>
</div>
{{if gt .Member.MemberId 0}}
{{if eq .Model.RoleId 0 1 2}}
<div class="dropdown pull-right">
<a href="{{urlfor "DocumentController.Edit" ":key" .Model.Identify ":id" ""}}" class="btn btn-default"><i class="fa fa-edit" aria-hidden="true"></i> 编辑</a>
<div class="dropdown pull-left" style="margin-right: 10px;">
<a href="{{urlfor "DocumentController.Edit" ":key" .Model.Identify ":id" ""}}" class="btn btn-default"><i class="fa fa-edit" aria-hidden="true"></i> {{i18n .Lang "blog.edit"}}</a>
{{if eq .Model.RoleId 0 1}}
<a href="{{urlfor "BookController.Users" ":key" .Model.Identify}}" class="btn btn-success"><i class="fa fa-user" aria-hidden="true"></i> 成员</a>
<a href="{{urlfor "BookController.Setting" ":key" .Model.Identify}}" class="btn btn-primary"><i class="fa fa-gear" aria-hidden="true"></i> 设置</a>
<a href="{{urlfor "BookController.Users" ":key" .Model.Identify}}" class="btn btn-success"><i class="fa fa-user" aria-hidden="true"></i> {{i18n .Lang "blog.member"}}</a>
<a href="{{urlfor "BookController.Setting" ":key" .Model.Identify}}" class="btn btn-primary"><i class="fa fa-gear" aria-hidden="true"></i> {{i18n .Lang "common.setting"}}</a>
{{end}}
</div>
{{end}}
{{end}}
<div class="dropdown pull-right" style="margin-right: 10px;">
<a href="{{urlfor "HomeController.Index"}}" class="btn btn-default"><i class="fa fa-home" aria-hidden="true"></i> 首页</a>
</div>
<a href="javascript:window.print();" id="printSinglePage" class="btn btn-default" style="margin-right: 10px;"><i class="fa fa-print"></i> {{i18n .Lang "doc.print"}}</a>
<div class="dropdown pull-right" style="margin-right: 10px;">
{{if eq .Model.PrivatelyOwned 0}}
{{if .Model.IsEnableShare}}
<button type="button" class="btn btn-success" data-toggle="modal" data-target="#shareProject"><i class="fa fa-share-square" aria-hidden="true"></i> 分享</button>
<button type="button" class="btn btn-success" data-toggle="modal" data-target="#shareProject"><i class="fa fa-share-square" aria-hidden="true"></i> {{i18n .Lang "doc.share"}}</button>
{{end}}
{{end}}
</div>
{{if .Model.IsDownload}}
<div class="dropdown pull-right" style="margin-right: 10px;">
<button type="button" class="btn btn-primary" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fa fa-cloud-download" aria-hidden="true"></i> 下载 <span class="caret"></span>
<i class="fa fa-cloud-download" aria-hidden="true"></i> {{i18n .Lang "doc.download"}} <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel" style="margin-top: -5px;">
<li><a href="{{urlfor "DocumentController.Export" ":key" .Model.Identify "output" "pdf"}}" target="_blank">PDF</a> </li>
@ -100,17 +100,17 @@
<div class="manual-left">
<div class="manual-tab">
<div class="tab-navg">
<span data-mode="view" class="navg-item active"><i class="fa fa-align-justify"></i><b class="text">目录</b></span>
<span data-mode="search" class="navg-item"><i class="fa fa-search"></i><b class="text">搜索</b></span>
<span data-mode="view" class="navg-item active"><i class="fa fa-align-justify"></i><b class="text">{{i18n .Lang "doc.contents"}}</b></span>
<span data-mode="search" class="navg-item"><i class="fa fa-search"></i><b class="text">{{i18n .Lang "doc.search"}}</b></span>
<span id="handlerMenuShow" style="float: right;display: inline-block;padding: 5px;cursor: pointer;">
<i class="fa fa-angle-left" style="font-size: 20px;padding-right: 5px;"></i>
<span class="pull-right" style="padding-top: 4px;">展开</span>
<span class="pull-right" style="padding-top: 4px;">{{i18n .Lang "doc.expand"}}</span>
</span>
</div>
<div class="tab-util">
<span class="manual-fullscreen-switch">
<b class="open fa fa-angle-right" title="展开"></b>
<b class="close fa fa-angle-left" title="关闭"></b>
<b class="open fa fa-angle-right" title="{{i18n .Lang "doc.expand"}}"></b>
<b class="close fa fa-angle-left" title="{{i18n .Lang "doc.close"}}"></b>
</span>
</div>
<div class="tab-wrap">
@ -125,7 +125,7 @@
<div class="search-form">
<form id="searchForm" action="{{urlfor "DocumentController.Search" ":key" .Model.Identify}}" method="post">
<div class="form-group">
<input type="search" placeholder="请输入搜索关键字" class="form-control" name="keyword">
<input type="search" placeholder="{{i18n .Lang "message.search_placeholder"}}" class="form-control" name="keyword">
<button type="submit" class="btn btn-default btn-search" id="btnSearch">
<i class="fa fa-search"></i>
</button>
@ -135,7 +135,7 @@
<div class="search-result">
<div class="search-empty">
<i class="fa fa-search-plus" aria-hidden="true"></i>
<b class="text">暂无相关搜索结果!</b>
<b class="text">{{i18n .Lang "message.no_search_result"}}</b>
</div>
<ul class="search-list" id="searchList">
</ul>
@ -170,53 +170,6 @@
<div class="article-body {{if eq .Model.Editor "markdown"}}markdown-body editormd-preview-container{{else}}editor-content{{end}}" id="page-content">
{{.Content}}
</div>
<!--
{{/*
{{if .Model.IsDisplayComment}}
<div id="articleComment" class="m-comment">
<div class="comment-result">
<strong class="title">相关评论(<b class="comment-total">{{.Model.CommentCount}}</b>)</strong>
<div class="comment-post">
<form class="form" action="/comment/create" method="post">
<label class="enter w-textarea textarea-full">
<textarea class="textarea-input form-control" name="content" placeholder="文明上网,理性发言" style="height: 72px;"></textarea>
<input type="hidden" name="doc_id" value="118003">
</label>
<div class="util cf">
<div class="pull-left"><span style="font-size: 12px;color: #999"> 支持Markdown语法 </span></div>
<div class="pull-right">
<span class="form-tip w-fragment fragment-tip">Ctrl + Enter快速发布</span>
<label class="form-submit w-btn btn-success btn-m">
<button class="btn btn-success btn-sm" type="submit">发布</button>
</label>
</div>
</div>
</form>
</div>
<div class="clearfix"></div>
<div class="comment-list">
<div class="comment-empty"><b class="text">暂无相关评论</b></div>
<div class="comment-item" data-id="5841">
<p class="info"><a href="/@phptest" class="name">静夜思</a><span class="date">9月1日评论</span></p>
<div class="content">一直不明白,控制器分层和模型分层调用起来到底有什么区别</div>
<p class="util">
<span class="vote">
<a class="agree e-agree" href="javascript:;" data-id="5841" title="赞成">
<i class="fa fa-thumbs-o-up"></i></a><b class="count">4</b>
<a class="oppose e-oppose" href="javascript:;" data-id="5841" title="反对"><i class="fa fa-thumbs-o-down"></i></a>
</span>
<a class="reply e-reply" data-account="phptest">回复</a>
<span class="operate toggle">
<a class="delete e-delete" data-id="5841" data-href="/comment/delete"><i class="icon icon-cross"></i></a>
<span class="number">23#</span>
</span>
</p>
</div>
</div>
</div>
</div>
{{end}}
*/}}-->
<div class="jump-top">
<a href="javascript:;" class="view-backtop"><i class="fa fa-arrow-up" aria-hidden="true"></i></a>
</div>
@ -235,7 +188,7 @@
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
<h4 class="modal-title" id="myModalLabel">项目分享</h4>
<h4 class="modal-title" id="myModalLabel">{{i18n .Lang "doc.share_project"}}</h4>
</div>
<div class="modal-body">
<div class="row">
@ -244,15 +197,15 @@
</div>
</div>
<div class="form-group">
<label for="password" class="col-sm-2 control-label">项目地址</label>
<label for="password" class="col-sm-2 control-label">{{i18n .Lang "doc.share_url"}}</label>
<div class="col-sm-10">
<input type="text" value="{{urlfor "DocumentController.Index" ":key" .Model.Identify}}" class="form-control" onmouseover="this.select()" id="projectUrl" title="项目地址">
<input type="text" value="{{urlfor "DocumentController.Index" ":key" .Model.Identify}}" class="form-control" onmouseover="this.select()" id="projectUrl" title="{{i18n .Lang "doc.share_url"}}">
</div>
<div class="clearfix"></div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
<button type="button" class="btn btn-default" data-dismiss="modal">{{i18n .Lang "doc.close"}}</button>
</div>
</div>
</div>
@ -264,7 +217,7 @@
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
<h4 class="modal-title" id="myModalLabel">项目分享</h4>
<h4 class="modal-title" id="myModalLabel">{{i18n .Lang "doc.share_project"}}</h4>
</div>
<div class="modal-body">
<div class="row">
@ -273,15 +226,15 @@
</div>
</div>
<div class="form-group">
<label for="password" class="col-sm-2 control-label">项目地址</label>
<label for="password" class="col-sm-2 control-label">{{i18n .Lang "doc.share_url"}}</label>
<div class="col-sm-10">
<input type="text" value="{{urlfor "DocumentController.Index" ":key" .Model.Identify}}" class="form-control" onmouseover="this.select()" id="projectUrl" title="项目地址">
<input type="text" value="{{urlfor "DocumentController.Index" ":key" .Model.Identify}}" class="form-control" onmouseover="this.select()" id="projectUrl" title="{{i18n .Lang "doc.share_url"}}">
</div>
<div class="clearfix"></div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
<button type="button" class="btn btn-default" data-dismiss="modal">{{i18n .Lang "doc.close"}}</button>
</div>
</div>
</div>
@ -312,7 +265,7 @@ $(function () {
window.menuControl = true;
window.menuSetting = "open" ;
if (menuSetting == 'open' || menuSetting == 'first') {
$('#handlerMenuShow').find('span').text('收起');
$('#handlerMenuShow').find('span').text('{{i18n .Lang "doc.fold"}}');
$('#handlerMenuShow').find('i').attr("class","fa fa-angle-down");
if (menuSetting == 'open') {
window.jsTree.jstree().open_all()
@ -334,13 +287,13 @@ $(function () {
}
$('#handlerMenuShow').on('click', function(){
if(menuControl){
$(this).find('span').text('展开')
$(this).find('span').text('{{i18n .Lang "doc.expand"}}')
$(this).find('i').attr("class","fa fa-angle-left")
window.menuControl = false
window.jsTree.jstree('close_all')
}else{
window.menuControl = true
$(this).find('span').text('收起')
$(this).find('span').text('{{i18n .Lang "doc.fold"}}')
$(this).find('i').attr("class","fa fa-angle-down")
window.jsTree.jstree().open_all()
}

View File

@ -6,7 +6,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="renderer" content="webkit" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>请输入项目密码 - Powered by MinDoc</title>
<title>{{i18n .Lang "doc.input_pwd"}} - Powered by MinDoc</title>
<script src="{{cdnjs "static/jquery/1.12.4/jquery.min.js"}}"></script>
<script src="{{cdnjs "static/js/jquery.form.js"}}"></script>
<style type="text/css">
@ -97,13 +97,13 @@
<div class="auth_form">
<div class="shell">
<form action="{{urlfor "DocumentController.Index" ":key" .Identify}}" method="post" id="auth_form">
<div class="tit">请输入阅读密码</div>
<div class="tit">{{i18n .Lang "doc.input_pwd"}}</div>
<div style="margin-top: 10px;">
<input type="password" name="bPassword" placeholder="浏览密码" class="inp"/>
<input type="password" name="bPassword" placeholder="{{i18n .Lang "doc.read_pwd"}}" class="inp"/>
</div>
<div class="btn">
<span id="error" style="color: #919191; font-size: 13px;"></span>
<input type="submit" value="提交" class="button"/>
<input type="submit" value="{{i18n .Lang "doc.commit"}}" class="button"/>
</div>
<div class="clear"></div>
</form>
@ -114,7 +114,7 @@ $("#auth_form").ajaxForm({
beforeSerialize: function () {
var pwd = $("#auth_form input[name='bPassword']").val();
if (pwd === "") {
$("#error").html("请输入密码");
$("#error").html("{{i18n .Lang "doc.input_pwd"}}");
return false;
}
},

View File

@ -8,7 +8,7 @@
<meta name="renderer" content="webkit" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="SmartWiki" />
<title>历史版本 - Powered by MinDoc</title>
<title>{{i18n .Lang "doc.his_ver"}} - Powered by MinDoc</title>
<!-- Bootstrap -->
<link href="{{cdncss "/static/bootstrap/css/bootstrap.min.css"}}" rel="stylesheet">
@ -32,10 +32,10 @@
<thead>
<tr>
<td>#</td>
<td class="col-sm-6">修改时间</td>
<td class="col-sm-2">修改人</td>
<td class="col-sm=2">版本</td>
<td class="col-sm-2">操作</td>
<td class="col-sm-6">{{i18n .Lang "doc.update_time"}}</td>
<td class="col-sm-2">{{i18n .Lang "doc.updater"}}</td>
<td class="col-sm=2">{{i18n .Lang "doc.version"}}</td>
<td class="col-sm-2">{{i18n .Lang "doc.operation"}}</td>
</tr>
</thead>
<tbody>
@ -46,15 +46,15 @@
<td>{{$item.ModifyName}}</td>
<td>{{$item.Version}}</td>
<td>
<button class="btn btn-danger btn-sm delete-btn" data-id="{{$item.HistoryId}}" data-loading-text="删除中...">
删除
<button class="btn btn-danger btn-sm delete-btn" data-id="{{$item.HistoryId}}" data-loading-text="{{i18n .Lang "message.processing"}}">
{{i18n .Lang "doc.delete"}}
</button>
<button class="btn btn-success btn-sm restore-btn" data-id="{{$item.HistoryId}}" data-loading-text="恢复中...">
恢复
<button class="btn btn-success btn-sm restore-btn" data-id="{{$item.HistoryId}}" data-loading-text="{{i18n .Lang "message.processing"}}">
{{i18n .Lang "doc.recover"}}
</button>
{{if eq $.Model.Editor "markdown"}}
<button class="btn btn-success btn-sm compare-btn" data-id="{{$item.HistoryId}}">
合并
{{i18n .Lang "doc.merge"}}
</button>
{{end}}
</td>
@ -82,7 +82,7 @@
var $then = $(this);
if(!id){
layer.msg('参数错误');
layer.msg('{{i18n .Lang "message.param_error"}}');
}else{
$.ajax({
url : "{{urlfor "DocumentController.DeleteHistory"}}",
@ -110,7 +110,7 @@
var index = parent.layer.getFrameIndex(window.name);
if(!id){
layer.msg('参数错误');
layer.msg('{{i18n .Lang "message.param_error"}}');
}else{
$.ajax({
url : "{{urlfor "DocumentController.RestoreHistory"}}",
@ -138,7 +138,7 @@
window.compareIndex = window.top.layer.open({
type: 2,
title: '文档比较【左侧为历史文档,右侧为当前文档,请将文档合并到右侧】',
title: '{{i18n .Lang "doc.comparison_title"}}',
shade: 0.8,
area: ['380px', '90%'],
content: "{{urlfor "DocumentController.Compare" ":key" .Model.Identify ":id" ""}}" + historyId

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 "doc.edit_doc"}} - Powered by MinDoc</title>
<script type="text/javascript">
window.treeCatalog = null;
window.baseUrl = "{{.BaseUrl}}";
@ -56,59 +56,59 @@
<div class="m-manual manual-editor">
<div class="manual-head" id="editormd-tools" style="min-width: 1200px; position:absolute;">
<div class="editormd-group">
<!--a href="{{urlfor "BookController.Index"}}" data-toggle="tooltip" data-title="返回"><i class="fa fa-chevron-left" aria-hidden="true"></i></a-->
<a href="javascript:" onclick="self.location=document.referrer;" data-toggle="tooltip" data-title="返回"><i class="fa fa-chevron-left" aria-hidden="true"></i></a>
<!--a href="{{urlfor "BookController.Index"}}" data-toggle="tooltip" data-title="{{i18n .Lang "doc.backward"}}"><i class="fa fa-chevron-left" aria-hidden="true"></i></a-->
<a href="javascript:" onclick="self.location=document.referrer;" data-toggle="tooltip" data-title="{{i18n .Lang "doc.backward"}}"><i class="fa fa-chevron-left" aria-hidden="true"></i></a>
</div>
<div class="editormd-group">
<a href="javascript:;" id="markdown-save" data-toggle="tooltip" data-title="保存" class="disabled save"><i class="fa fa-save first" aria-hidden="true" name="save"></i></a>
<a href="javascript:;" id="markdown-template" data-toggle="tooltip" data-title="保存为模板" class="template"><i class="fa fa-briefcase last" aria-hidden="true" name="save-template"></i></a>
<a href="javascript:;" id="markdown-save" data-toggle="tooltip" data-title="{{i18n .Lang "doc.save"}}" class="disabled save"><i class="fa fa-save first" aria-hidden="true" name="save"></i></a>
<a href="javascript:;" id="markdown-template" data-toggle="tooltip" data-title="{{i18n .Lang "doc.save_as_tpl"}}" class="template"><i class="fa fa-briefcase last" aria-hidden="true" name="save-template"></i></a>
</div>
<div class="editormd-group">
<a href="javascript:;" data-toggle="tooltip" data-title="撤销 (Ctrl-Z)"><i class="fa fa-undo first" name="undo" unselectable="on"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="重做 (Ctrl-Y)"><i class="fa fa-repeat last" name="redo" unselectable="on"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="{{i18n .Lang "doc.undo"}} (Ctrl-Z)"><i class="fa fa-undo first" name="undo" unselectable="on"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="{{i18n .Lang "doc.redo"}} (Ctrl-Y)"><i class="fa fa-repeat last" name="redo" unselectable="on"></i></a>
</div>
<div class="editormd-group">
<a href="javascript:;" data-toggle="tooltip" data-title="粗体"><i class="fa fa-bold first" name="bold" unselectable="on"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="斜体"><i class="fa fa-italic item" name="italic" unselectable="on"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="删除线"><i class="fa fa-strikethrough last" name="del" unselectable="on"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="{{i18n .Lang "doc.bold"}}"><i class="fa fa-bold first" name="bold" unselectable="on"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="{{i18n .Lang "doc.italic"}}"><i class="fa fa-italic item" name="italic" unselectable="on"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="{{i18n .Lang "doc.strikethrough"}}"><i class="fa fa-strikethrough last" name="del" unselectable="on"></i></a>
</div>
<div class="editormd-group">
<a href="javascript:;" data-toggle="tooltip" data-title="标题一"><i class="fa editormd-bold first" name="h1" unselectable="on">H1</i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="标题二"><i class="fa editormd-bold item" name="h2" unselectable="on">H2</i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="标题三"><i class="fa editormd-bold item" name="h3" unselectable="on">H3</i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="标题四"><i class="fa editormd-bold item" name="h4" unselectable="on">H4</i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="标题五"><i class="fa editormd-bold item" name="h5" unselectable="on">H5</i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="标题六"><i class="fa editormd-bold last" name="h6" unselectable="on">H6</i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="{{i18n .Lang "doc.h1"}}"><i class="fa editormd-bold first" name="h1" unselectable="on">H1</i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="{{i18n .Lang "doc.h2"}}"><i class="fa editormd-bold item" name="h2" unselectable="on">H2</i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="{{i18n .Lang "doc.h3"}}"><i class="fa editormd-bold item" name="h3" unselectable="on">H3</i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="{{i18n .Lang "doc.h4"}}"><i class="fa editormd-bold item" name="h4" unselectable="on">H4</i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="{{i18n .Lang "doc.h5"}}"><i class="fa editormd-bold item" name="h5" unselectable="on">H5</i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="{{i18n .Lang "doc.h6"}}"><i class="fa editormd-bold last" name="h6" unselectable="on">H6</i></a>
</div>
<div class="editormd-group">
<a href="javascript:;" data-toggle="tooltip" data-title="无序列表"><i class="fa fa-list-ul first" name="list-ul" unselectable="on"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="有序列表"><i class="fa fa-list-ol item" name="list-ol" unselectable="on"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="横线"><i class="fa fa-minus last" name="hr" unselectable="on"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="{{i18n .Lang "doc.unorder_list"}}"><i class="fa fa-list-ul first" name="list-ul" unselectable="on"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="{{i18n .Lang "doc.order_list"}}"><i class="fa fa-list-ol item" name="list-ol" unselectable="on"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="{{i18n .Lang "doc.hline"}}"><i class="fa fa-minus last" name="hr" unselectable="on"></i></a>
</div>
<div class="editormd-group">
<a href="javascript:;" data-toggle="tooltip" data-title="链接"><i class="fa fa-link first" name="link" unselectable="on"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="引用链接"><i class="fa fa-anchor item" name="reference-link" unselectable="on"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="添加图片"><i class="fa fa-picture-o item" name="image" unselectable="on"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="行内代码"><i class="fa fa-code item" name="code" unselectable="on"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="代码块" unselectable="on"><i class="fa fa-file-code-o item" name="code-block" unselectable="on"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="添加表格"><i class="fa fa-table item" name="table" unselectable="on"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="引用"><i class="fa fa-quote-right item" name="quote" unselectable="on"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="GFM 任务列表"><i class="fa fa-tasks item" name="tasks" aria-hidden="true"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="附件"><i class="fa fa-paperclip item" aria-hidden="true" name="attachment"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="Json转换为表格"><i class="fa fa-wrench item" aria-hidden="true" name="json"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="模板"><i class="fa fa-tachometer last" name="template"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="{{i18n .Lang "doc.link"}}"><i class="fa fa-link first" name="link" unselectable="on"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="{{i18n .Lang "doc.ref_link"}}"><i class="fa fa-anchor item" name="reference-link" unselectable="on"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="{{i18n .Lang "doc.add_pic"}}"><i class="fa fa-picture-o item" name="image" unselectable="on"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="{{i18n .Lang "doc.code"}}"><i class="fa fa-code item" name="code" unselectable="on"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="{{i18n .Lang "doc.code_blck"}}" unselectable="on"><i class="fa fa-file-code-o item" name="code-block" unselectable="on"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="{{i18n .Lang "doc.table"}}"><i class="fa fa-table item" name="table" unselectable="on"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="{{i18n .Lang "doc.quote"}}"><i class="fa fa-quote-right item" name="quote" unselectable="on"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="{{i18n .Lang "doc.gfm_task"}}"><i class="fa fa-tasks item" name="tasks" aria-hidden="true"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="{{i18n .Lang "doc.attachment"}}"><i class="fa fa-paperclip item" aria-hidden="true" name="attachment"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="{{i18n .Lang "doc.json_to_table"}}"><i class="fa fa-wrench item" aria-hidden="true" name="json"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="{{i18n .Lang "doc.template"}}"><i class="fa fa-tachometer last" name="template"></i></a>
</div>
<div class="editormd-group pull-right">
<a href="javascript:;" data-toggle="tooltip" data-title="关闭实时预览"><i class="fa fa-eye-slash first" name="watch" unselectable="on"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="修改历史"><i class="fa fa-history item" name="history" aria-hidden="true"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="边栏"><i class="fa fa-columns item" aria-hidden="true" name="sidebar"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="使用帮助"><i class="fa fa-question-circle-o last" aria-hidden="true" name="help"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="{{i18n .Lang "doc.close_preview"}}"><i class="fa fa-eye-slash first" name="watch" unselectable="on"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="{{i18n .Lang "doc.modify_history"}}"><i class="fa fa-history item" name="history" aria-hidden="true"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="{{i18n .Lang "doc.sidebar"}}"><i class="fa fa-columns item" aria-hidden="true" name="sidebar"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="{{i18n .Lang "doc.help"}}"><i class="fa fa-question-circle-o last" aria-hidden="true" name="help"></i></a>
</div>
<div class="editormd-group pull-right">
<a href="javascript:;" data-toggle="tooltip" data-title="发布"><i class="fa fa-cloud-upload" name="release" aria-hidden="true"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="{{i18n .Lang "doc.publish"}}"><i class="fa fa-cloud-upload" name="release" aria-hidden="true"></i></a>
</div>
<div class="editormd-group">
@ -121,8 +121,8 @@
<div class="manual-body">
<div class="manual-category" id="manualCategory" style="position:absolute;">
<div class="manual-nav">
<div class="nav-item active"><i class="fa fa-bars" aria-hidden="true"></i> 文档</div>
<div class="nav-plus pull-right" id="btnAddDocument" data-toggle="tooltip" data-title="创建文档" data-direction="right"><i class="fa fa-plus" aria-hidden="true"></i></div>
<div class="nav-item active"><i class="fa fa-bars" aria-hidden="true"></i> {{i18n .Lang "doc.document"}}</div>
<div class="nav-plus pull-right" id="btnAddDocument" data-toggle="tooltip" data-title="{{i18n .Lang "doc.create_document"}}" data-direction="right"><i class="fa fa-plus" aria-hidden="true"></i></div>
<div class="clearfix"></div>
</div>
<div class="manual-tree" id="sidebar"> </div>
@ -132,7 +132,7 @@
<div id="docEditor" class="manual-editormd-active"></div>
</div>
<div class="manual-editor-status">
<div id="attachInfo" class="item">0 个附件</div>
<div id="attachInfo" class="item">0 {{i18n .Lang "doc.attachments"}}</div>
</div>
</div>
@ -148,39 +148,39 @@
<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 "doc.create_document"}}</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label class="col-sm-2 control-label">文档名称 <span class="error-message">*</span></label>
<label class="col-sm-2 control-label">{{i18n .Lang "doc.doc_name"}} <span class="error-message">*</span></label>
<div class="col-sm-10">
<input type="text" name="doc_name" id="documentName" placeholder="文档名称" class="form-control" maxlength="50">
<p style="color: #999;font-size: 12px;">在目录的文档名上右键可以删除和修改文档名称以及添加下级文档</p>
<input type="text" name="doc_name" id="documentName" placeholder="{{i18n .Lang "doc.doc_name"}}" class="form-control" maxlength="50">
<p style="color: #999;font-size: 12px;">{{i18n .Lang "doc.doc_name_desc"}}</p>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">文档标识 <span class="error-message">&nbsp;</span></label>
<label class="col-sm-2 control-label">{{i18n .Lang "doc.doc_id"}} <span class="error-message">&nbsp;</span></label>
<div class="col-sm-10">
<input type="text" name="doc_identify" id="documentIdentify" placeholder="文档唯一标识" class="form-control" maxlength="50">
<p style="color: #999;font-size: 12px;">文档标识只能包含小写字母、数字,以及“-”和“_”符号,并且只能小写字母开头</p>
<input type="text" name="doc_identify" id="documentIdentify" placeholder="{{i18n .Lang "doc.doc_id"}}" class="form-control" maxlength="50">
<p style="color: #999;font-size: 12px;">{{i18n .Lang "doc.doc_id_desc"}}</p>
</div>
</div>
<div class="form-group">
<div class="col-lg-4">
<label>
<input type="radio" name="is_open" value="1"> 展开<span class="text">(在阅读时会自动展开节点)</span>
<input type="radio" name="is_open" value="1"> {{i18n .Lang "doc.expand"}}<span class="text">{{i18n .Lang "doc.expand_desc"}}</span>
</label>
</div>
<div class="col-lg-4">
<label>
<input type="radio" name="is_open" value="0" checked> 关闭<span class="text">(在阅读时会关闭节点)</span>
<input type="radio" name="is_open" value="0" checked> {{i18n .Lang "doc.fold"}}<span class="text">{{i18n .Lang "doc.fold_desc"}}</span>
</label>
</div>
<div class="col-lg-4">
<label>
<input type="radio" name="is_open" value="2"> 空目录<span class="text">(单击时会展开下级节点)</span>
<input type="radio" name="is_open" value="2"> {{i18n .Lang "doc.empty_contents"}}<span class="text">{{i18n .Lang "doc.empty_contents_desc"}}</span>
</label>
</div>
<div class="clearfix"></div>
@ -188,8 +188,8 @@
</div>
<div class="modal-footer">
<span id="add-error-message" class="error-message"></span>
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button type="submit" class="btn btn-primary" id="btnSaveDocument" data-loading-text="保存中...">立即保存</button>
<button type="button" class="btn btn-default" data-dismiss="modal">{{i18n .Lang "common.cancel"}}</button>
<button type="submit" class="btn btn-primary" id="btnSaveDocument" data-loading-text="{{i18n .Lang "message.processing"}}">{{i18n .Lang "doc.save"}}</button>
</div>
</div>
</form>
@ -203,7 +203,7 @@
<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 "doc.upload_attachment"}}</h4>
</div>
<div class="modal-body">
<div class="attach-drop-panel">
@ -240,8 +240,8 @@
</div>
<div class="modal-footer">
<span id="add-error-message" class="error-message"></span>
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-primary" id="btnUploadAttachFile" data-dismiss="modal">确定</button>
<button type="button" class="btn btn-default" data-dismiss="modal">{{i18n .Lang "common.cancel"}}</button>
<button type="button" class="btn btn-primary" id="btnUploadAttachFile" data-dismiss="modal">{{i18n .Lang "common.confirm"}}</button>
</div>
</div>
</form>
@ -253,67 +253,67 @@
<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 "doc.doc_history"}}</h4>
</div>
<div class="modal-body text-center" id="historyList">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
<button type="button" class="btn btn-default" data-dismiss="modal">{{i18n .Lang "doc.close"}}</button>
</div>
</div>
</div>
</div>
<!--- 选择模板--->
<div class="modal fade" id="documentTemplateModal" tabindex="-1" role="dialog" aria-labelledby="请选择模板类型" aria-hidden="true">
<div class="modal fade" id="documentTemplateModal" tabindex="-1" role="dialog" aria-labelledby="{{i18n .Lang "doc.choose_template_type"}}" aria-hidden="true">
<div class="modal-dialog" style="width: 780px;">
<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="modal-title">请选择模板类型</h4>
<h4 class="modal-title" id="modal-title">{{i18n .Lang "doc.choose_template_type"}}</h4>
</div>
<div class="modal-body template-list">
<div class="container">
<div class="section">
<a data-type="normal" href="javascript:;"><i class="fa fa-file-o"></i></a>
<h3><a data-type="normal" href="javascript:;">普通文档</a></h3>
<h3><a data-type="normal" href="javascript:;">{{i18n .Lang "doc.normal_tpl"}}</a></h3>
<ul>
<li>默认类型</li>
<li>简单的文本文档</li>
<li>{{i18n .Lang "doc.tpl_default_type"}}</li>
<li>{{i18n .Lang "doc.tpl_plain_text"}}</li>
</ul>
</div>
<div class="section">
<a data-type="api" href="javascript:;"><i class="fa fa-file-code-o"></i></a>
<h3><a data-type="api" href="javascript:;">API文档</a></h3>
<h3><a data-type="api" href="javascript:;">{{i18n .Lang "doc.api_tpl"}}</a></h3>
<ul>
<li>用于API文档速写</li>
<li>支持代码高亮</li>
<li>{{i18n .Lang "doc.for_api_doc"}}</li>
<li>{{i18n .Lang "doc.code_highlight"}}</li>
</ul>
</div>
<div class="section">
<a data-type="code" href="javascript:;"><i class="fa fa-book"></i></a>
<h3><a data-type="code" href="javascript:;">数据字典</a></h3>
<h3><a data-type="code" href="javascript:;">{{i18n .Lang "doc.data_dict"}}</a></h3>
<ul>
<li>用于数据字典显示</li>
<li>表格支持</li>
<li>{{i18n .Lang "doc.for_data_dict"}}</li>
<li>{{i18n .Lang "doc.form_support"}}</li>
</ul>
</div>
<div class="section">
<a data-type="customs" href="javascript:;"><i class="fa fa-briefcase"></i></a>
<h3><a data-type="customs" href="javascript:;">自定义模板</a></h3>
<h3><a data-type="customs" href="javascript:;">{{i18n .Lang "doc.custom_tpl"}}</a></h3>
<ul>
<li>自定义模板</li>
<li>支持任意类型文档</li>
<li>可以设置为全局模板</li>
<li>{{i18n .Lang "doc.custom_tpl"}}</li>
<li>{{i18n .Lang "doc.any_type_doc"}}</li>
<li>{{i18n .Lang "doc.as_global_tpl"}}</li>
</ul>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-default" data-dismiss="modal">{{i18n .Lang "common.cancel"}}</button>
</div>
</div>
</div>
@ -324,7 +324,7 @@
<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 "doc.custom_tpl"}}</h4>
</div>
<div class="modal-body text-center" id="displayCustomsTemplateList">
<div class="table-responsive">
@ -332,23 +332,23 @@
<thead>
<tr>
<td>#</td>
<td class="col-sm-3">模板名称</td>
<td class="col-sm-2">模板类型</td>
<td class="col-sm-2">创建人</td>
<td class="col-sm-3">创建时间</td>
<td class="col-sm-2">操作</td>
<td class="col-sm-3">{{i18n .Lang "doc.tpl_name"}}</td>
<td class="col-sm-2">{{i18n .Lang "doc.tpl_type"}}</td>
<td class="col-sm-2">{{i18n .Lang "doc.creator"}}</td>
<td class="col-sm-3">{{i18n .Lang "doc.create_time"}}</td>
<td class="col-sm-2">{{i18n .Lang "doc.operation"}}</td>
</tr>
</thead>
<tbody>
<tr>
<td colspan="7" class="text-center">暂无数据</td>
<td colspan="7" class="text-center">{{i18n .Lang "message.no_data"}}</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
<button type="button" class="btn btn-default" data-dismiss="modal">{{i18n .Lang "doc.close"}}</button>
</div>
</div>
</div>
@ -362,25 +362,25 @@
<input type="hidden" name="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 "doc.save_as_tpl"}}</h4>
</div>
<div class="modal-body text-center">
<div class="form-group">
<label class="col-sm-2 control-label">模板名称 <span class="error-message">*</span></label>
<label class="col-sm-2 control-label">{{i18n .Lang "doc.tpl_name"}} <span class="error-message">*</span></label>
<div class="col-sm-10">
<input type="text" name="template_name" id="templateName" placeholder="模板名称" class="form-control" maxlength="50">
<input type="text" name="template_name" id="templateName" placeholder="{{i18n .Lang "doc.tpl_name"}}" class="form-control" maxlength="50">
</div>
</div>
{{if eq .Member.Role 0 1}}
<div class="form-group">
<div class="col-lg-6">
<label>
<input type="radio" name="is_global" value="1"> 全局<span class="text">(任何项目都可用)</span>
<input type="radio" name="is_global" value="1"> {{i18n .Lang "doc.global_tpl"}}<span class="text">{{i18n .Lang "doc.global_tpl_desc"}}</span>
</label>
</div>
<div class="col-lg-6">
<label>
<input type="radio" name="is_global" value="0" checked> 项目<span class="text">(只有当前项目可用)</span>
<input type="radio" name="is_global" value="0" checked> {{i18n .Lang "doc.project_tpl"}}<span class="text">{{i18n .Lang "doc.project_tpl_desc"}}</span>
</label>
</div>
<div class="clearfix"></div>
@ -389,8 +389,8 @@
</div>
<div class="modal-footer">
<span class="error-message show-error-message"></span>
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button type="submit" class="btn btn-primary" id="btnSaveTemplate" data-loading-text="保存中...">立即保存</button>
<button type="button" class="btn btn-default" data-dismiss="modal">{{i18n .Lang "common.cancel"}}</button>
<button type="submit" class="btn btn-primary" id="btnSaveTemplate" data-loading-text="{{i18n .Lang "message.processing"}}">{{i18n .Lang "doc.save"}}</button>
</div>
</form>
</div>
@ -403,7 +403,7 @@
<form method="post" id="convertJsonToTableForm" class="form-horizontal">
<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">Json转换为表格</h4>
<h4 class="modal-title">{{i18n .Lang "doc.json_to_table"}}</h4>
</div>
<div class="modal-body text-center">
<textarea type="text" name="jsonContent" id="jsonContent" placeholder="Json" class="form-control" style="height: 300px;resize: none"></textarea>
@ -411,8 +411,8 @@
</div>
<div class="modal-footer">
<span id="json-error-message"></span>
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-primary" id="btnInsertTable" data-loading-text="保存中...">插入</button>
<button type="button" class="btn btn-default" data-dismiss="modal">{{i18n .Lang "common.cancel"}}</button>
<button type="button" class="btn btn-primary" id="btnInsertTable" data-loading-text="{{i18n .Lang "message.processing"}}">{{i18n .Lang "doc.insert"}}</button>
</div>
</form>
</div>
@ -469,7 +469,7 @@
attachment_id : file.id,
file_size : file.size,
file_name : file.name,
message : "正在上传"
message : "{{i18n .Lang "doc.uploading"}}"
};
window.vueApp.lists.push(item);
@ -478,7 +478,7 @@
var item = window.vueApp.lists[i];
if(item.attachment_id == file.id){
item.state = "error";
item.message = "上传失败:" + reason;
item.message = "{{i18n .Lang "message.upload_failed"}}:" + reason;
break;
}
}
@ -503,7 +503,7 @@
$percent.css( 'width', percentage * 100 + '%' );
}).on("error", function (type) {
if(type === "F_EXCEED_SIZE"){
layer.msg("文件超过了限定大小");
layer.msg("{{i18n .Lang "message.upload_file_size_limit"}}");
}
console.log(type);
});

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 "doc.edit_doc"}} - Powered by MinDoc</title>
<script type="text/javascript">
window.editor = null;
window.imageUploadURL = "{{urlfor "DocumentController.Upload" "identify" .Model.Identify}}";
@ -191,52 +191,52 @@
<div class="m-manual manual-editor">
<div class="manual-head btn-toolbar" id="editormd-tools" style="min-width: 1260px;" data-role="editor-toolbar" data-target="#editor">
<div class="editor-group">
<a href="{{urlfor "BookController.Index"}}" data-toggle="tooltip" data-title="返回"><i class="fa fa-chevron-left" aria-hidden="true"></i></a>
<a href="{{urlfor "BookController.Index"}}" data-toggle="tooltip" data-title="{{i18n .Lang "doc.backward"}}"><i class="fa fa-chevron-left" aria-hidden="true"></i></a>
</div>
<div class="editor-group">
<a href="javascript:;" id="markdown-save" data-toggle="tooltip" data-title="保存" class="disabled save"><i class="fa fa-save first" aria-hidden="true" name="save"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="发布" id="btnRelease"><i class="fa fa-cloud-upload last" name="release" aria-hidden="true"></i></a>
<a href="javascript:;" id="markdown-save" data-toggle="tooltip" data-title="{{i18n .Lang "doc.save"}}" class="disabled save"><i class="fa fa-save first" aria-hidden="true" name="save"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="{{i18n .Lang "doc.publish"}}" id="btnRelease"><i class="fa fa-cloud-upload last" name="release" aria-hidden="true"></i></a>
</div>
<div class="editor-group">
<a href="javascript:;" data-toggle="tooltip" data-title="撤销 (Ctrl-Z)" class="ql-undo"><i class="fa fa-undo first" name="undo" unselectable="on"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="重做 (Ctrl-Y)" class="ql-redo"><i class="fa fa-repeat last" name="redo" unselectable="on"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="{{i18n .Lang "doc.undo"}} (Ctrl-Z)" class="ql-undo"><i class="fa fa-undo first" name="undo" unselectable="on"></i></a>
<a href="javascript:;" data-toggle="tooltip" data-title="{{i18n .Lang "doc.redo"}} (Ctrl-Y)" class="ql-redo"><i class="fa fa-repeat last" name="redo" unselectable="on"></i></a>
</div>
<div class="editor-group">
<select data-toggle="tooltip" data-title="字号" title="字号" class="ql-size editor-item-select editor-item-single-select"></select>
<select data-toggle="tooltip" data-title="{{i18n .Lang "doc.font_size"}}" title="{{i18n .Lang "doc.font_size"}}" class="ql-size editor-item-select editor-item-single-select"></select>
</div>
<div class="editor-group">
<button data-toggle="tooltip" data-title="粗体" class="ql-bold editor-item editor-item-first"></button>
<button data-toggle="tooltip" data-title="斜体" class="ql-italic editor-item"></button>
<button data-toggle="tooltip" data-title="删除线" class="ql-strike editor-item"></button>
<button data-toggle="tooltip" data-title="下划线" class="ql-underline editor-item editor-item-last"></button>
<button data-toggle="tooltip" data-title="{{i18n .Lang "doc.bold"}}" class="ql-bold editor-item editor-item-first"></button>
<button data-toggle="tooltip" data-title="{{i18n .Lang "doc.italic"}}" class="ql-italic editor-item"></button>
<button data-toggle="tooltip" data-title="{{i18n .Lang "doc.strikethrough"}}" class="ql-strike editor-item"></button>
<button data-toggle="tooltip" data-title="{{i18n .Lang "doc.underscore"}}" class="ql-underline editor-item editor-item-last"></button>
</div>
<div class="editor-group">
<button data-toggle="tooltip" data-title="标题一" class="ql-header editor-item editor-item-first" value="1"></button>
<button data-toggle="tooltip" data-title="标题二" class="ql-header editor-item" value="2"></button>
<button data-toggle="tooltip" data-title="标题三" class="ql-header editor-item" value="3"></button>
<button data-toggle="tooltip" data-title="标题四" class="ql-header editor-item" value="4"></button>
<button data-toggle="tooltip" data-title="标题五" class="ql-header editor-item" value="5"></button>
<button data-toggle="tooltip" data-title="标题六" class="ql-header editor-item editor-item-last" value="6"></button>
<button data-toggle="tooltip" data-title="{{i18n .Lang "doc.h1"}}" class="ql-header editor-item editor-item-first" value="1"></button>
<button data-toggle="tooltip" data-title="{{i18n .Lang "doc.h2"}}" class="ql-header editor-item" value="2"></button>
<button data-toggle="tooltip" data-title="{{i18n .Lang "doc.h3"}}" class="ql-header editor-item" value="3"></button>
<button data-toggle="tooltip" data-title="{{i18n .Lang "doc.h4"}}" class="ql-header editor-item" value="4"></button>
<button data-toggle="tooltip" data-title="{{i18n .Lang "doc.h5"}}" class="ql-header editor-item" value="5"></button>
<button data-toggle="tooltip" data-title="{{i18n .Lang "doc.h6"}}" class="ql-header editor-item editor-item-last" value="6"></button>
</div>
<div class="editor-group">
<button data-toggle="tooltip" data-title="无序列表" class="ql-list editor-item editor-item-first" value="ordered"></button>
<button data-toggle="tooltip" data-title="有序列表" class="ql-list editor-item" value="bullet"></button>
<button data-toggle="tooltip" data-title="右缩进" class="ql-indent editor-item" value="-1"></button>
<button data-toggle="tooltip" data-title="左缩进" class="ql-indent editor-item" value="+1"></button>
<button data-toggle="tooltip" data-title="下标" class="ql-script editor-item" value="sub"></button>
<button data-toggle="tooltip" data-title="上标" class="ql-script editor-item editor-item-last" value="super"></button>
<button data-toggle="tooltip" data-title="{{i18n .Lang "doc.unorder_list"}}" class="ql-list editor-item editor-item-first" value="ordered"></button>
<button data-toggle="tooltip" data-title="{{i18n .Lang "doc.order_list"}}" class="ql-list editor-item" value="bullet"></button>
<button data-toggle="tooltip" data-title="{{i18n .Lang "doc.right_intent"}}" class="ql-indent editor-item" value="-1"></button>
<button data-toggle="tooltip" data-title="{{i18n .Lang "doc.left_intent"}}" class="ql-indent editor-item" value="+1"></button>
<button data-toggle="tooltip" data-title="{{i18n .Lang "doc.subscript"}}" class="ql-script editor-item" value="sub"></button>
<button data-toggle="tooltip" data-title="{{i18n .Lang "doc.superscript"}}" class="ql-script editor-item editor-item-last" value="super"></button>
</div>
<div class="editor-group ql-formats">
<button data-toggle="tooltip" data-title="链接" class="ql-link editor-item editor-item-first"></button>
<button data-toggle="tooltip" data-title="清空格式" class="ql-clean editor-item"></button>
<button data-toggle="tooltip" data-title="添加图片" class="ql-image editor-item"></button>
<button data-toggle="tooltip" data-title="添加视频" class="ql-video editor-item"></button>
<button data-toggle="tooltip" data-title="代码块" class="ql-code-block editor-item"></button>
<button data-toggle="tooltip" data-title="引用" class="ql-blockquote editor-item"><i class="fa fa-quote-right item" name="quote" unselectable="on"></i></button>
<button data-toggle="tooltip" data-title="公式" class="ql-formula editor-item"><i class="fa fa-tasks item" name="tasks" aria-hidden="true"></i></button>
<select data-toggle="tooltip" data-title="字体颜色" class="ql-color ql-picker ql-color-picker editor-item-select" ></select>
<select data-toggle="tooltip" data-title="背景颜色" class="ql-background editor-item-select"></select>
<a href="javascript:;" data-toggle="tooltip" data-title="附件" id="btnUploadFile"><i class="fa fa-paperclip last" aria-hidden="true" name="attachment"></i></a>
<button data-toggle="tooltip" data-title="{{i18n .Lang "doc.link"}}" class="ql-link editor-item editor-item-first"></button>
<button data-toggle="tooltip" data-title="{{i18n .Lang "doc.clear_format"}}" class="ql-clean editor-item"></button>
<button data-toggle="tooltip" data-title="{{i18n .Lang "doc.add_pic"}}" class="ql-image editor-item"></button>
<button data-toggle="tooltip" data-title="{{i18n .Lang "doc.add_video"}}" class="ql-video editor-item"></button>
<button data-toggle="tooltip" data-title="{{i18n .Lang "doc.code"}}" class="ql-code-block editor-item"></button>
<button data-toggle="tooltip" data-title="{{i18n .Lang "doc.quote"}}" class="ql-blockquote editor-item"><i class="fa fa-quote-right item" name="quote" unselectable="on"></i></button>
<button data-toggle="tooltip" data-title="{{i18n .Lang "doc.formula"}}" class="ql-formula editor-item"><i class="fa fa-tasks item" name="tasks" aria-hidden="true"></i></button>
<select data-toggle="tooltip" data-title="{{i18n .Lang "doc.font_color"}}" class="ql-color ql-picker ql-color-picker editor-item-select" ></select>
<select data-toggle="tooltip" data-title="{{i18n .Lang "doc.bg_color"}}" class="ql-background editor-item-select"></select>
<a href="javascript:;" data-toggle="tooltip" data-title="{{i18n .Lang "doc.attachment"}}" id="btnUploadFile"><i class="fa fa-paperclip last" aria-hidden="true" name="attachment"></i></a>
</div>
@ -245,8 +245,8 @@
<div class="manual-body">
<div class="manual-category" id="manualCategory" style=" border-right: 1px solid #DDDDDD;width: 281px;position: absolute;">
<div class="manual-nav">
<div class="nav-item active"><i class="fa fa-bars" aria-hidden="true"></i> 文档</div>
<div class="nav-plus pull-right" id="btnAddDocument" data-toggle="tooltip" data-title="创建文档" data-direction="right"><i class="fa fa-plus" aria-hidden="true"></i></div>
<div class="nav-item active"><i class="fa fa-bars" aria-hidden="true"></i> {{i18n .Lang "doc.document"}}</div>
<div class="nav-plus pull-right" id="btnAddDocument" data-toggle="tooltip" data-title="{{i18n .Lang "doc.create_document"}}" data-direction="right"><i class="fa fa-plus" aria-hidden="true"></i></div>
<div class="clearfix"></div>
</div>
<div class="manual-tree" id="sidebar"> </div>
@ -255,7 +255,7 @@
<div class="manual-editormd" style="bottom: 0;">
<div id="docEditor" class="manual-editormd-active ql-editor ql-blank editor-content"></div>
<div class="manual-editor-status" style="border-top: 1px solid #DDDDDD;">
<div id="attachInfo" class="item">0 个附件</div>
<div id="attachInfo" class="item">0 {{i18n .Lang "doc.attachments"}}</div>
</div>
</div>
</div>
@ -271,28 +271,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 "doc.create_document"}}</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label class="col-sm-2 control-label">文档名称 <span class="error-message">*</span></label>
<label class="col-sm-2 control-label">{{i18n .Lang "doc.doc_name"}} <span class="error-message">*</span></label>
<div class="col-sm-10">
<input type="text" name="doc_name" id="documentName" placeholder="文档名称" class="form-control" maxlength="50">
<input type="text" name="doc_name" id="documentName" placeholder="{{i18n .Lang "doc.doc_name_desc"}}" class="form-control" 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 "doc.doc_id"}}</label>
<div class="col-sm-10">
<input type="text" name="doc_identify" id="documentIdentify" placeholder="文档唯一标识" class="form-control" maxlength="50">
<p style="color: #999;font-size: 12px;">文档标识只能包含小写字母、数字,以及“-”和“_”符号,并且只能小写字母开头</p>
<input type="text" name="doc_identify" id="documentIdentify" placeholder="{{i18n .Lang "doc.doc_id"}}" class="form-control" maxlength="50">
<p style="color: #999;font-size: 12px;">{{i18n .Lang "doc.doc_id_desc"}}</p>
</div>
</div>
</div>
<div class="modal-footer">
<span id="add-error-message" class="error-message"></span>
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button type="submit" class="btn btn-primary" id="btnSaveDocument" data-loading-text="保存中...">立即保存</button>
<button type="button" class="btn btn-default" data-dismiss="modal">{{i18n .Lang "common.cancel"}}</button>
<button type="submit" class="btn btn-primary" id="btnSaveDocument" data-loading-text="{{i18n .Lang "message.processing"}}">{{i18n .Lang "doc.save"}}</button>
</div>
</div>
</form>
@ -305,7 +305,7 @@
<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 "doc.upload_attachment"}}</h4>
</div>
<div class="modal-body">
<div class="attach-drop-panel">
@ -344,8 +344,8 @@
</div>
<div class="modal-footer">
<span id="add-error-message" class="error-message"></span>
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-primary" id="btnUploadAttachFile" data-dismiss="modal">确定</button>
<button type="button" class="btn btn-default" data-dismiss="modal">{{i18n .Lang "common.cancel"}}</button>
<button type="button" class="btn btn-primary" id="btnUploadAttachFile" data-dismiss="modal">{{i18n .Lang "common.confirm"}}</button>
</div>
</div>
</form>
@ -357,13 +357,13 @@
<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 "doc.doc_history"}}</h4>
</div>
<div class="modal-body text-center" id="historyList">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
<button type="button" class="btn btn-default" data-dismiss="modal">{{i18n .Lang "doc.close"}}</button>
</div>
</div>
</div>
@ -429,7 +429,7 @@
attachment_id : file.id,
file_size : file.size,
file_name : file.name,
message : "正在上传"
message : "{{i18n .Lang "doc.uploading"}}"
};
window.vueApp.lists.push(item);
@ -438,7 +438,8 @@
var item = window.vueApp.lists[i];
if(item.attachment_id == file.id){
item.state = "error";
item.message = "上传失败:" + reason;
item.message = "{{i18n .Lang "message.upload_failed"}}:" + reason;
break;
}
}
@ -463,7 +464,7 @@
$percent.css( 'width', percentage * 100 + '%' );
}).on("error", function (type) {
if(type === "F_EXCEED_SIZE"){
layer.msg("文件超过了限定大小");
layer.msg("{{i18n .Lang "message.upload_file_size_limit"}}");
}
console.log(type);
});

View File

@ -7,7 +7,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="renderer" content="webkit" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>权限不足 - Powered by MinDoc</title>
<title>{{i18n .Lang "message.no_permission"}} - Powered by MinDoc</title>
<link href="{{cdncss "/static/fonts/lato-100.css"}}" rel="stylesheet" type="text/css">
<style type="text/css">
html, body {
@ -45,7 +45,7 @@
<body>
<div class="container">
<div class="content">
<div class="title">HTTP 403 : 权限不足</div>
<div class="title">HTTP 403 : {{i18n .Lang "message.no_permission"}}</div>
</div>
</div>
</body>

View File

@ -7,7 +7,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="renderer" content="webkit" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>页面不存在 - Powered by MinDoc</title>
<title>{{i18n .Lang "message.page_not_existed"}} - Powered by MinDoc</title>
<link href="{{cdncss "/static/fonts/lato-100.css"}}" rel="stylesheet" type="text/css">
<style type="text/css">
html, body {
@ -44,7 +44,7 @@
<body>
<div class="container">
<div class="content">
<div class="title">HTTP 404 : 页面不存在.</div>
<div class="title">HTTP 404 : {{i18n .Lang "message.page_not_existed"}}.</div>
</div>
</div>
</body>

View File

@ -7,7 +7,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="renderer" content="webkit" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title> {{if eq 200 .ErrorCode}}友情提示{{else if eq 404 .ErrorCode}}页面不存在{{else}}服务器异0常{{end}} - Powered by MinDoc</title>
<title> {{if eq 200 .ErrorCode}}{{i18n .Lang "message.tips"}}{{else if eq 404 .ErrorCode}}{{i18n .Lang "message.page_not_existed"}}{{else}}{{i18n .Lang "message.system_error"}}{{end}} - Powered by MinDoc</title>
<link href="{{cdncss "/static/fonts/lato-100.css"}}" rel="stylesheet" type="text/css">
<style type="text/css">
html, body {
@ -51,7 +51,7 @@
<div class="title">HTTP 500 {{.ErrorMessage}}</div>
{{end}}
{{else}}
<div class="title">HTTP 500 服务器异常</div>
<div class="title">HTTP 500 {{i18n .Lang "message.system_error"}}</div>
{{end}}
</div>
</div>