mirror of
https://github.com/mindoc-org/mindoc.git
synced 2025-06-28 15:45:35 +08:00
fix:1、修复匿名访问判断错误的BUG
2、重构配置文件自动加载逻辑
This commit is contained in:
parent
4d59df6d57
commit
3aa703d479
@ -25,6 +25,7 @@ import (
|
|||||||
"github.com/lifei6671/mindoc/models"
|
"github.com/lifei6671/mindoc/models"
|
||||||
"github.com/lifei6671/mindoc/utils/filetil"
|
"github.com/lifei6671/mindoc/utils/filetil"
|
||||||
"github.com/astaxie/beego/cache/redis"
|
"github.com/astaxie/beego/cache/redis"
|
||||||
|
"github.com/howeyc/fsnotify"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RegisterDataBase 注册数据库
|
// RegisterDataBase 注册数据库
|
||||||
@ -55,6 +56,7 @@ func RegisterDataBase() {
|
|||||||
beego.Error("注册默认数据库失败->", err)
|
beego.Error("注册默认数据库失败->", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if strings.EqualFold(adapter, "sqlite3") {
|
} else if strings.EqualFold(adapter, "sqlite3") {
|
||||||
|
|
||||||
database := beego.AppConfig.String("db_database")
|
database := beego.AppConfig.String("db_database")
|
||||||
@ -401,37 +403,37 @@ func RegisterCache() {
|
|||||||
//自动加载配置文件.修改了监听端口号和数据库配置无法自动生效.
|
//自动加载配置文件.修改了监听端口号和数据库配置无法自动生效.
|
||||||
func RegisterAutoLoadConfig() {
|
func RegisterAutoLoadConfig() {
|
||||||
if conf.AutoLoadDelay > 0 {
|
if conf.AutoLoadDelay > 0 {
|
||||||
ticker := time.NewTicker(time.Second * time.Duration(conf.AutoLoadDelay))
|
|
||||||
|
|
||||||
go func() {
|
watcher, err := fsnotify.NewWatcher()
|
||||||
f,err := os.Stat(conf.ConfigurationFile)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
beego.Error("读取配置文件时出错 ->",err)
|
beego.Error("创建配置文件监控器失败 ->",err)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
modTime := f.ModTime()
|
go func() {
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-ticker.C:
|
case ev := <-watcher.Event:
|
||||||
f,err := os.Stat(conf.ConfigurationFile)
|
//如果是修改了配置文件
|
||||||
if err != nil {
|
if ev.IsModify() {
|
||||||
beego.Error("读取配置文件时出错 ->",err)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
if modTime != f.ModTime() {
|
|
||||||
if err := beego.LoadAppConfig("ini", conf.ConfigurationFile); err != nil {
|
if err := beego.LoadAppConfig("ini", conf.ConfigurationFile); err != nil {
|
||||||
beego.Error("An error occurred ->", err)
|
beego.Error("An error occurred ->", err)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
modTime = f.ModTime()
|
|
||||||
RegisterCache()
|
RegisterCache()
|
||||||
|
|
||||||
RegisterLogger("")
|
RegisterLogger("")
|
||||||
beego.Info("配置文件已加载")
|
beego.Info("配置文件已加载 ->", conf.ConfigurationFile)
|
||||||
}
|
}
|
||||||
|
case err := <-watcher.Error:
|
||||||
|
beego.Error("配置文件监控器错误 ->", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
err = watcher.Watch(conf.ConfigurationFile)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
beego.Error("监控配置文件失败 ->",err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,10 +67,9 @@ func (c *BaseController) Prepare() {
|
|||||||
for _, item := range options {
|
for _, item := range options {
|
||||||
c.Data[item.OptionName] = item.OptionValue
|
c.Data[item.OptionName] = item.OptionValue
|
||||||
c.Option[item.OptionName] = item.OptionValue
|
c.Option[item.OptionName] = item.OptionValue
|
||||||
|
|
||||||
c.EnableAnonymous = strings.EqualFold(item.OptionName, "ENABLE_ANONYMOUS") && item.OptionValue == "true"
|
|
||||||
c.EnableDocumentHistory = strings.EqualFold(item.OptionName, "ENABLE_DOCUMENT_HISTORY") && item.OptionValue == "true"
|
|
||||||
}
|
}
|
||||||
|
c.EnableAnonymous = strings.EqualFold(c.Option["ENABLE_ANONYMOUS"], "true")
|
||||||
|
c.EnableDocumentHistory = strings.EqualFold(c.Option["ENABLE_DOCUMENT_HISTORY"],"true")
|
||||||
}
|
}
|
||||||
c.Data["HighlightStyle"] = beego.AppConfig.DefaultString("highlight_style","github")
|
c.Data["HighlightStyle"] = beego.AppConfig.DefaultString("highlight_style","github")
|
||||||
|
|
||||||
|
@ -16,12 +16,20 @@ import (
|
|||||||
"html/template"
|
"html/template"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/lifei6671/mindoc/utils"
|
"github.com/lifei6671/mindoc/utils"
|
||||||
|
"net/url"
|
||||||
)
|
)
|
||||||
|
|
||||||
type BlogController struct {
|
type BlogController struct {
|
||||||
BaseController
|
BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *BlogController) Prepare() {
|
||||||
|
c.BaseController.Prepare()
|
||||||
|
if !c.EnableAnonymous && c.Member == nil {
|
||||||
|
c.Redirect(conf.URLFor("AccountController.Login")+"?url="+url.PathEscape(conf.BaseUrl+c.Ctx.Request.URL.RequestURI()), 302)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//文章阅读
|
//文章阅读
|
||||||
func (c *BlogController) Index() {
|
func (c *BlogController) Index() {
|
||||||
c.Prepare()
|
c.Prepare()
|
||||||
@ -41,7 +49,6 @@ func (c *BlogController) Index() {
|
|||||||
|
|
||||||
if c.Ctx.Input.IsPost() {
|
if c.Ctx.Input.IsPost() {
|
||||||
password := c.GetString("password");
|
password := c.GetString("password");
|
||||||
|
|
||||||
if blog.BlogStatus == "password" && password != blog.Password {
|
if blog.BlogStatus == "password" && password != blog.Password {
|
||||||
c.JsonResult(6001, "文章密码不正确")
|
c.JsonResult(6001, "文章密码不正确")
|
||||||
} else if blog.BlogStatus == "password" && password == blog.Password {
|
} else if blog.BlogStatus == "password" && password == blog.Password {
|
||||||
@ -65,7 +72,6 @@ func (c *BlogController) Index() {
|
|||||||
c.Data["Description"] = blog.BlogExcerpt
|
c.Data["Description"] = blog.BlogExcerpt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if nextBlog, err := models.NewBlog().QueryNext(blogId); err == nil {
|
if nextBlog, err := models.NewBlog().QueryNext(blogId); err == nil {
|
||||||
c.Data["Next"] = nextBlog
|
c.Data["Next"] = nextBlog
|
||||||
}
|
}
|
||||||
@ -86,7 +92,6 @@ func (c *BlogController) List() {
|
|||||||
|
|
||||||
blogList, totalCount, err = models.NewBlog().FindToPager(pageIndex, conf.PageSize, 0, "")
|
blogList, totalCount, err = models.NewBlog().FindToPager(pageIndex, conf.PageSize, 0, "")
|
||||||
|
|
||||||
|
|
||||||
if err != nil && err != orm.ErrNoRows {
|
if err != nil && err != orm.ErrNoRows {
|
||||||
c.ShowErrorPage(500, err.Error())
|
c.ShowErrorPage(500, err.Error())
|
||||||
}
|
}
|
||||||
@ -255,7 +260,6 @@ func (c *BlogController) ManageSetting() {
|
|||||||
blogId, err := strconv.Atoi(c.Ctx.Input.Param(":id"))
|
blogId, err := strconv.Atoi(c.Ctx.Input.Param(":id"))
|
||||||
|
|
||||||
c.Data["DocumentIdentify"] = "";
|
c.Data["DocumentIdentify"] = "";
|
||||||
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
blog, err := models.NewBlog().FindByIdAndMemberId(blogId, c.Member.MemberId)
|
blog, err := models.NewBlog().FindByIdAndMemberId(blogId, c.Member.MemberId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -411,7 +415,7 @@ func (c *BlogController) ManageDelete() {
|
|||||||
|
|
||||||
// 上传附件或图片
|
// 上传附件或图片
|
||||||
func (c *BlogController) Upload() {
|
func (c *BlogController) Upload() {
|
||||||
|
c.Prepare()
|
||||||
blogId, _ := c.GetInt("blogId")
|
blogId, _ := c.GetInt("blogId")
|
||||||
|
|
||||||
if blogId <= 0 {
|
if blogId <= 0 {
|
||||||
@ -549,7 +553,6 @@ func (c *BlogController) Upload() {
|
|||||||
result["url"] = httpPath
|
result["url"] = httpPath
|
||||||
result["alt"] = fileName
|
result["alt"] = fileName
|
||||||
|
|
||||||
|
|
||||||
c.Ctx.Output.JSON(result, true, false)
|
c.Ctx.Output.JSON(result, true, false)
|
||||||
c.StopRun()
|
c.StopRun()
|
||||||
}
|
}
|
||||||
|
@ -2,25 +2,29 @@ package controllers
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"math"
|
"math"
|
||||||
"net/url"
|
|
||||||
|
|
||||||
"github.com/astaxie/beego"
|
"github.com/astaxie/beego"
|
||||||
"github.com/lifei6671/mindoc/conf"
|
|
||||||
"github.com/lifei6671/mindoc/models"
|
"github.com/lifei6671/mindoc/models"
|
||||||
"github.com/lifei6671/mindoc/utils/pagination"
|
"github.com/lifei6671/mindoc/utils/pagination"
|
||||||
|
"github.com/lifei6671/mindoc/conf"
|
||||||
|
"net/url"
|
||||||
)
|
)
|
||||||
|
|
||||||
type HomeController struct {
|
type HomeController struct {
|
||||||
BaseController
|
BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *HomeController) Index() {
|
func (c *HomeController) Prepare() {
|
||||||
c.Prepare()
|
c.BaseController.Prepare()
|
||||||
c.TplName = "home/index.tpl"
|
|
||||||
//如果没有开启匿名访问,则跳转到登录页面
|
//如果没有开启匿名访问,则跳转到登录页面
|
||||||
if !c.EnableAnonymous && c.Member == nil {
|
if !c.EnableAnonymous && c.Member == nil {
|
||||||
c.Redirect(conf.URLFor("AccountController.Login")+"?url="+url.PathEscape(conf.BaseUrl+c.Ctx.Request.URL.RequestURI()), 302)
|
c.Redirect(conf.URLFor("AccountController.Login")+"?url="+url.PathEscape(conf.BaseUrl+c.Ctx.Request.URL.RequestURI()), 302)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *HomeController) Index() {
|
||||||
|
c.Prepare()
|
||||||
|
c.TplName = "home/index.tpl"
|
||||||
|
|
||||||
pageIndex, _ := c.GetInt("page", 1)
|
pageIndex, _ := c.GetInt("page", 1)
|
||||||
pageSize := 18
|
pageSize := 18
|
||||||
|
|
||||||
|
@ -19,6 +19,8 @@ import (
|
|||||||
"github.com/lifei6671/mindoc/utils/filetil"
|
"github.com/lifei6671/mindoc/utils/filetil"
|
||||||
"github.com/lifei6671/mindoc/utils/pagination"
|
"github.com/lifei6671/mindoc/utils/pagination"
|
||||||
"gopkg.in/russross/blackfriday.v2"
|
"gopkg.in/russross/blackfriday.v2"
|
||||||
|
"io/ioutil"
|
||||||
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ManagerController struct {
|
type ManagerController struct {
|
||||||
@ -723,3 +725,40 @@ func (c *ManagerController) LabelDelete() {
|
|||||||
c.JsonResult(0, "ok")
|
c.JsonResult(0, "ok")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *ManagerController) Config() {
|
||||||
|
c.Prepare()
|
||||||
|
c.TplName = "manager/config.tpl"
|
||||||
|
if c.Ctx.Input.IsPost() {
|
||||||
|
content := strings.TrimSpace(c.GetString("configFileTextArea"))
|
||||||
|
if content == "" {
|
||||||
|
c.JsonResult(500,"配置文件不能为空")
|
||||||
|
}
|
||||||
|
tf,err := ioutil.TempFile(os.TempDir(),"mindoc")
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
beego.Error("创建临时文件失败 ->",err)
|
||||||
|
c.JsonResult(5001,"创建临时文件失败")
|
||||||
|
}
|
||||||
|
defer tf.Close()
|
||||||
|
|
||||||
|
tf.WriteString(content)
|
||||||
|
|
||||||
|
err = beego.LoadAppConfig("ini",tf.Name())
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
beego.Error("加载配置文件失败 ->",err)
|
||||||
|
c.JsonResult(5002,"加载配置文件失败")
|
||||||
|
}
|
||||||
|
err = filetil.CopyFile(tf.Name(), conf.ConfigurationFile)
|
||||||
|
if err != nil {
|
||||||
|
beego.Error("保存配置文件失败 ->",err)
|
||||||
|
c.JsonResult(5003,"保存配置文件失败")
|
||||||
|
}
|
||||||
|
c.JsonResult(0,"保存成功")
|
||||||
|
}
|
||||||
|
c.Data["ConfigContent"] = ""
|
||||||
|
if b,err := ioutil.ReadFile(conf.ConfigurationFile); err == nil {
|
||||||
|
c.Data["ConfigContent"] = string(b)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -38,6 +38,8 @@ func init() {
|
|||||||
beego.Router("/manager/label/list", &controllers.ManagerController{},"get:LabelList")
|
beego.Router("/manager/label/list", &controllers.ManagerController{},"get:LabelList")
|
||||||
beego.Router("/manager/label/delete/:id", &controllers.ManagerController{},"post:LabelDelete")
|
beego.Router("/manager/label/delete/:id", &controllers.ManagerController{},"post:LabelDelete")
|
||||||
|
|
||||||
|
beego.Router("/manager/config", &controllers.ManagerController{}, "*:Config")
|
||||||
|
|
||||||
beego.Router("/setting", &controllers.SettingController{}, "*:Index")
|
beego.Router("/setting", &controllers.SettingController{}, "*:Index")
|
||||||
beego.Router("/setting/password", &controllers.SettingController{}, "*:Password")
|
beego.Router("/setting/password", &controllers.SettingController{}, "*:Password")
|
||||||
beego.Router("/setting/upload", &controllers.SettingController{}, "*:Upload")
|
beego.Router("/setting/upload", &controllers.SettingController{}, "*:Upload")
|
||||||
|
@ -24,16 +24,7 @@
|
|||||||
{{template "widgets/header.tpl" .}}
|
{{template "widgets/header.tpl" .}}
|
||||||
<div class="container manual-body">
|
<div class="container manual-body">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="page-left">
|
{{template "manager/widgets.tpl" "attach"}}
|
||||||
<ul class="menu">
|
|
||||||
<li><a href="{{urlfor "ManagerController.Index"}}" class="item"><i class="fa fa-dashboard" aria-hidden="true"></i> 仪表盘</a> </li>
|
|
||||||
<li><a href="{{urlfor "ManagerController.Users" }}" class="item"><i class="fa fa-users" aria-hidden="true"></i> 用户管理</a> </li>
|
|
||||||
<li><a href="{{urlfor "ManagerController.Books" }}" class="item"><i class="fa fa-book" aria-hidden="true"></i> 项目管理</a> </li>
|
|
||||||
<li><a href="{{urlfor "ManagerController.Setting" }}" class="item"><i class="fa fa-cogs" aria-hidden="true"></i> 配置管理</a> </li>
|
|
||||||
<li class="active"><a href="{{urlfor "ManagerController.AttachList" }}" class="item"><i class="fa fa-cloud-upload" aria-hidden="true"></i> 附件管理</a> </li>
|
|
||||||
<li><a href="{{urlfor "ManagerController.LabelList" }}" class="item"><i class="fa fa-bookmark" aria-hidden="true"></i> 标签管理</a> </li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="page-right">
|
<div class="page-right">
|
||||||
<div class="m-box">
|
<div class="m-box">
|
||||||
<div class="box-head">
|
<div class="box-head">
|
||||||
|
@ -24,17 +24,7 @@
|
|||||||
{{template "widgets/header.tpl" .}}
|
{{template "widgets/header.tpl" .}}
|
||||||
<div class="container manual-body">
|
<div class="container manual-body">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="page-left">
|
{{template "manager/widgets.tpl" "attach"}}
|
||||||
<ul class="menu">
|
|
||||||
<li><a href="{{urlfor "ManagerController.Index"}}" class="item"><i class="fa fa-dashboard" aria-hidden="true"></i> 仪表盘</a> </li>
|
|
||||||
<li><a href="{{urlfor "ManagerController.Users" }}" class="item"><i class="fa fa-users" aria-hidden="true"></i> 用户管理</a> </li>
|
|
||||||
<li><a href="{{urlfor "ManagerController.Books" }}" class="item"><i class="fa fa-book" aria-hidden="true"></i> 项目管理</a> </li>
|
|
||||||
{{/*<li><a href="{{urlfor "ManagerController.Comments" }}" class="item"><i class="fa fa-comments-o" aria-hidden="true"></i> 评论管理</a> </li>*/}}
|
|
||||||
<li><a href="{{urlfor "ManagerController.Setting" }}" class="item"><i class="fa fa-cogs" aria-hidden="true"></i> 配置管理</a> </li>
|
|
||||||
<li class="active"><a href="{{urlfor "ManagerController.AttachList" }}" class="item"><i class="fa fa-cloud-upload" aria-hidden="true"></i> 附件管理</a> </li>
|
|
||||||
<li><a href="{{urlfor "ManagerController.LabelList" }}" class="item"><i class="fa fa-bookmark" aria-hidden="true"></i> 标签管理</a> </li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="page-right">
|
<div class="page-right">
|
||||||
<div class="m-box">
|
<div class="m-box">
|
||||||
<div class="box-head">
|
<div class="box-head">
|
||||||
|
@ -24,17 +24,7 @@
|
|||||||
{{template "widgets/header.tpl" .}}
|
{{template "widgets/header.tpl" .}}
|
||||||
<div class="container manual-body">
|
<div class="container manual-body">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="page-left">
|
{{template "manager/widgets.tpl" "books"}}
|
||||||
<ul class="menu">
|
|
||||||
<li><a href="{{urlfor "ManagerController.Index"}}" class="item"><i class="fa fa-dashboard" aria-hidden="true"></i> 仪表盘</a> </li>
|
|
||||||
<li><a href="{{urlfor "ManagerController.Users" }}" class="item"><i class="fa fa-users" aria-hidden="true"></i> 用户管理</a> </li>
|
|
||||||
<li class="active"><a href="{{urlfor "ManagerController.Books" }}" class="item"><i class="fa fa-book" aria-hidden="true"></i> 项目管理</a> </li>
|
|
||||||
{{/*<li><a href="{{urlfor "ManagerController.Comments" }}" class="item"><i class="fa fa-comments-o" aria-hidden="true"></i> 评论管理</a> </li>*/}}
|
|
||||||
<li><a href="{{urlfor "ManagerController.Setting" }}" class="item"><i class="fa fa-cogs" aria-hidden="true"></i> 配置管理</a> </li>
|
|
||||||
<li><a href="{{urlfor "ManagerController.AttachList" }}" class="item"><i class="fa fa-cloud-upload" aria-hidden="true"></i> 附件管理</a> </li>
|
|
||||||
<li><a href="{{urlfor "ManagerController.LabelList" }}" class="item"><i class="fa fa-bookmark" aria-hidden="true"></i> 标签管理</a> </li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="page-right">
|
<div class="page-right">
|
||||||
<div class="m-box">
|
<div class="m-box">
|
||||||
<div class="box-head">
|
<div class="box-head">
|
||||||
|
84
views/manager/config.tpl
Normal file
84
views/manager/config.tpl
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh-CN">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
|
||||||
|
<title>配置文件 - Powered by MinDoc</title>
|
||||||
|
|
||||||
|
<!-- Bootstrap -->
|
||||||
|
<link href="{{cdncss "/static/bootstrap/css/bootstrap.min.css"}}" rel="stylesheet">
|
||||||
|
<link href="{{cdncss "/static/font-awesome/css/font-awesome.min.css"}}" rel="stylesheet">
|
||||||
|
<link href="{{cdncss "/static/editor.md/css/editormd.css"}}" rel="stylesheet">
|
||||||
|
<link href="{{cdncss "/static/css/main.css" "version"}}" rel="stylesheet">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="manual-reader">
|
||||||
|
{{template "widgets/header.tpl" .}}
|
||||||
|
<div class="container manual-body">
|
||||||
|
<div class="row">
|
||||||
|
{{template "manager/widgets.tpl" "config"}}
|
||||||
|
<div class="page-right">
|
||||||
|
<div class="m-box">
|
||||||
|
<div class="box-head">
|
||||||
|
<strong class="box-title"> 配置管理</strong>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="box-body">
|
||||||
|
<form method="post" id="configFileContainerForm" action="{{urlfor "ManagerController.Config"}}">
|
||||||
|
<div id="configFileContainer">
|
||||||
|
<textarea style="display:none;" name="configFileTextArea">{{.ConfigContent}}</textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<button type="submit" id="btnSaveConfigFile" class="btn btn-success" data-loading-text="保存中...">保存修改</button>
|
||||||
|
<span id="form-error-message" class="error-message"></span>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{template "widgets/footer.tpl" .}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<script src="{{cdnjs "/static/jquery/1.12.4/jquery.min.js"}}" type="text/javascript"></script>
|
||||||
|
<script src="{{cdnjs "/static/bootstrap/js/bootstrap.min.js"}}" type="text/javascript"></script>
|
||||||
|
<script src="{{cdnjs "/static/js/jquery.form.js"}}" type="text/javascript"></script>
|
||||||
|
<script src="{{cdnjs "/static/editor.md/editormd.js" "version"}}" type="text/javascript"></script>
|
||||||
|
<script src="{{cdnjs "/static/js/main.js"}}" type="text/javascript"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(function() {
|
||||||
|
var configEditor = editormd("configFileContainer", {
|
||||||
|
width : "100%",
|
||||||
|
height : 720,
|
||||||
|
watch : false,
|
||||||
|
toolbar : false,
|
||||||
|
codeFold : true,
|
||||||
|
searchReplace : true,
|
||||||
|
placeholder : "",
|
||||||
|
mode : "text/x-properties",
|
||||||
|
path : "{{cdnjs "/static/editor.md/lib/"}}"
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#configFileContainerForm").ajaxForm({
|
||||||
|
beforeSubmit : function () {
|
||||||
|
$("#btnSaveBookInfo").button("loading");
|
||||||
|
},success : function (res) {
|
||||||
|
if(res.errcode === 0) {
|
||||||
|
showSuccess("保存成功", "#form-error-message")
|
||||||
|
}else{
|
||||||
|
showError(res.message);
|
||||||
|
}
|
||||||
|
$("#btnSaveConfigFile").button("reset");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -15,29 +15,13 @@
|
|||||||
<link href="{{cdncss "/static/webuploader/webuploader.css"}}" rel="stylesheet">
|
<link href="{{cdncss "/static/webuploader/webuploader.css"}}" rel="stylesheet">
|
||||||
<link href="{{cdncss "/static/cropper/2.3.4/cropper.min.css"}}" rel="stylesheet">
|
<link href="{{cdncss "/static/cropper/2.3.4/cropper.min.css"}}" rel="stylesheet">
|
||||||
<link href="{{cdncss "/static/css/main.css" "version"}}" rel="stylesheet">
|
<link href="{{cdncss "/static/css/main.css" "version"}}" rel="stylesheet">
|
||||||
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
|
||||||
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
|
||||||
<!--[if lt IE 9]>
|
|
||||||
<script src="/static/html5shiv/3.7.3/html5shiv.min.js"></script>
|
|
||||||
<script src="/static/respond.js/1.4.2/respond.min.js"></script>
|
|
||||||
<![endif]-->
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="manual-reader">
|
<div class="manual-reader">
|
||||||
{{template "widgets/header.tpl" .}}
|
{{template "widgets/header.tpl" .}}
|
||||||
<div class="container manual-body">
|
<div class="container manual-body">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="page-left">
|
{{template "manager/widgets.tpl" "books"}}
|
||||||
<ul class="menu">
|
|
||||||
<li><a href="{{urlfor "ManagerController.Index"}}" class="item"><i class="fa fa-dashboard" aria-hidden="true"></i> 仪表盘</a> </li>
|
|
||||||
<li><a href="{{urlfor "ManagerController.Users" }}" class="item"><i class="fa fa-users" aria-hidden="true"></i> 用户管理</a> </li>
|
|
||||||
<li class="active"><a href="{{urlfor "ManagerController.Books" }}" class="item"><i class="fa fa-book" aria-hidden="true"></i> 项目管理</a> </li>
|
|
||||||
{{/*<li><a href="{{urlfor "ManagerController.Comments" }}" class="item"><i class="fa fa-comments-o" aria-hidden="true"></i> 评论管理</a> </li>*/}}
|
|
||||||
<li><a href="{{urlfor "ManagerController.Setting" }}" class="item"><i class="fa fa-cogs" aria-hidden="true"></i> 配置管理</a> </li>
|
|
||||||
<li><a href="{{urlfor "ManagerController.AttachList" }}" class="item"><i class="fa fa-cloud-upload" aria-hidden="true"></i> 附件管理</a> </li>
|
|
||||||
<li><a href="{{urlfor "ManagerController.LabelList" }}" class="item"><i class="fa fa-bookmark" aria-hidden="true"></i> 标签管理</a> </li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="page-right">
|
<div class="page-right">
|
||||||
<div class="m-box">
|
<div class="m-box">
|
||||||
<div class="box-head">
|
<div class="box-head">
|
||||||
|
@ -23,17 +23,7 @@
|
|||||||
{{template "widgets/header.tpl" .}}
|
{{template "widgets/header.tpl" .}}
|
||||||
<div class="container manual-body">
|
<div class="container manual-body">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="page-left">
|
{{template "manager/widgets.tpl" "users"}}
|
||||||
<ul class="menu">
|
|
||||||
<li><a href="{{urlfor "ManagerController.Index"}}" class="item"><i class="fa fa-dashboard" aria-hidden="true"></i> 仪表盘</a> </li>
|
|
||||||
<li class="active"><a href="{{urlfor "ManagerController.Users" }}" class="item"><i class="fa fa-users" aria-hidden="true"></i> 用户管理</a> </li>
|
|
||||||
<li><a href="{{urlfor "ManagerController.Books" }}" class="item"><i class="fa fa-book" aria-hidden="true"></i> 项目管理</a> </li>
|
|
||||||
{{/*<li><a href="{{urlfor "ManagerController.Comments" }}" class="item"><i class="fa fa-comments-o" aria-hidden="true"></i> 评论管理</a> </li>*/}}
|
|
||||||
<li><a href="{{urlfor "ManagerController.Setting" }}" class="item"><i class="fa fa-cogs" aria-hidden="true"></i> 配置管理</a> </li>
|
|
||||||
<li><a href="{{urlfor "ManagerController.AttachList" }}" class="item"><i class="fa fa-cloud-upload" aria-hidden="true"></i> 附件管理</a> </li>
|
|
||||||
<li><a href="{{urlfor "ManagerController.LabelList" }}" class="item"><i class="fa fa-bookmark" aria-hidden="true"></i> 标签管理</a> </li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="page-right">
|
<div class="page-right">
|
||||||
<div class="m-box">
|
<div class="m-box">
|
||||||
<div class="box-head">
|
<div class="box-head">
|
||||||
|
@ -24,18 +24,7 @@
|
|||||||
{{template "widgets/header.tpl" .}}
|
{{template "widgets/header.tpl" .}}
|
||||||
<div class="container manual-body">
|
<div class="container manual-body">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="page-left">
|
{{template "manager/widgets.tpl" "index"}}
|
||||||
<ul class="menu">
|
|
||||||
<li class="active"><a href="{{urlfor "ManagerController.Index"}}" class="item"><i class="fa fa-dashboard" aria-hidden="true"></i> 仪表盘</a> </li>
|
|
||||||
<li><a href="{{urlfor "ManagerController.Users" }}" class="item"><i class="fa fa-users" aria-hidden="true"></i> 用户管理</a> </li>
|
|
||||||
<li><a href="{{urlfor "ManagerController.Books" }}" class="item"><i class="fa fa-book" aria-hidden="true"></i> 项目管理</a> </li>
|
|
||||||
{{/*<li><a href="{{urlfor "ManagerController.Comments" }}" class="item"><i class="fa fa-comments-o" aria-hidden="true"></i> 评论管理</a> </li>*/}}
|
|
||||||
<li><a href="{{urlfor "ManagerController.Setting" }}" class="item"><i class="fa fa-cogs" aria-hidden="true"></i> 配置管理</a> </li>
|
|
||||||
<li><a href="{{urlfor "ManagerController.AttachList" }}" class="item"><i class="fa fa-cloud-upload" aria-hidden="true"></i> 附件管理</a> </li>
|
|
||||||
<li><a href="{{urlfor "ManagerController.LabelList" }}" class="item"><i class="fa fa-bookmark" aria-hidden="true"></i> 标签管理</a> </li>
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="page-right">
|
<div class="page-right">
|
||||||
<div class="m-box">
|
<div class="m-box">
|
||||||
<div class="box-head">
|
<div class="box-head">
|
||||||
|
@ -24,18 +24,7 @@
|
|||||||
{{template "widgets/header.tpl" .}}
|
{{template "widgets/header.tpl" .}}
|
||||||
<div class="container manual-body">
|
<div class="container manual-body">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="page-left">
|
{{template "manager/widgets.tpl" "label"}}
|
||||||
<ul class="menu">
|
|
||||||
<li><a href="{{urlfor "ManagerController.Index"}}" class="item"><i class="fa fa-dashboard" aria-hidden="true"></i> 仪表盘</a> </li>
|
|
||||||
<li><a href="{{urlfor "ManagerController.Users" }}" class="item"><i class="fa fa-users" aria-hidden="true"></i> 用户管理</a> </li>
|
|
||||||
<li><a href="{{urlfor "ManagerController.Books" }}" class="item"><i class="fa fa-book" aria-hidden="true"></i> 项目管理</a> </li>
|
|
||||||
{{/*<li><a href="{{urlfor "ManagerController.Comments" }}" class="item"><i class="fa fa-comments-o" aria-hidden="true"></i> 评论管理</a> </li>*/}}
|
|
||||||
<li><a href="{{urlfor "ManagerController.Setting" }}" class="item"><i class="fa fa-cogs" aria-hidden="true"></i> 配置管理</a> </li>
|
|
||||||
<li><a href="{{urlfor "ManagerController.AttachList" }}" class="item"><i class="fa fa-cloud-upload" aria-hidden="true"></i> 附件管理</a> </li>
|
|
||||||
<li class="active"><a href="{{urlfor "ManagerController.LabelList" }}" class="item"><i class="fa fa-bookmark" aria-hidden="true"></i> 标签管理</a> </li>
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="page-right">
|
<div class="page-right">
|
||||||
<div class="m-box">
|
<div class="m-box">
|
||||||
<div class="box-head">
|
<div class="box-head">
|
||||||
|
@ -23,18 +23,7 @@
|
|||||||
{{template "widgets/header.tpl" .}}
|
{{template "widgets/header.tpl" .}}
|
||||||
<div class="container manual-body">
|
<div class="container manual-body">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="page-left">
|
{{template "manager/widgets.tpl" "setting"}}
|
||||||
<ul class="menu">
|
|
||||||
<li><a href="{{urlfor "ManagerController.Index"}}" class="item"><i class="fa fa-dashboard" aria-hidden="true"></i> 仪表盘</a> </li>
|
|
||||||
<li><a href="{{urlfor "ManagerController.Users" }}" class="item"><i class="fa fa-users" aria-hidden="true"></i> 用户管理</a> </li>
|
|
||||||
<li><a href="{{urlfor "ManagerController.Books" }}" class="item"><i class="fa fa-book" aria-hidden="true"></i> 项目管理</a> </li>
|
|
||||||
{{/*<li><a href="{{urlfor "ManagerController.Comments" }}" class="item"><i class="fa fa-comments-o" aria-hidden="true"></i> 评论管理</a> </li>*/}}
|
|
||||||
<li class="active"><a href="{{urlfor "ManagerController.Setting" }}" class="item"><i class="fa fa-cogs" aria-hidden="true"></i> 配置管理</a> </li>
|
|
||||||
<li><a href="{{urlfor "ManagerController.AttachList" }}" class="item"><i class="fa fa-cloud-upload" aria-hidden="true"></i> 附件管理</a> </li>
|
|
||||||
<li><a href="{{urlfor "ManagerController.LabelList" }}" class="item"><i class="fa fa-bookmark" aria-hidden="true"></i> 标签管理</a> </li>
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="page-right">
|
<div class="page-right">
|
||||||
<div class="m-box">
|
<div class="m-box">
|
||||||
<div class="box-head">
|
<div class="box-head">
|
||||||
|
@ -27,19 +27,7 @@
|
|||||||
{{template "widgets/header.tpl" .}}
|
{{template "widgets/header.tpl" .}}
|
||||||
<div class="container manual-body">
|
<div class="container manual-body">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="page-left">
|
{{template "manager/widgets.tpl" "users"}}
|
||||||
<ul class="menu">
|
|
||||||
<li><a href="{{urlfor "ManagerController.Index"}}" class="item"><i class="fa fa-dashboard" aria-hidden="true"></i> 仪表盘</a> </li>
|
|
||||||
<li class="active"><a href="{{urlfor "ManagerController.Users" }}" class="item"><i class="fa fa-users" aria-hidden="true"></i> 用户管理</a> </li>
|
|
||||||
<li><a href="{{urlfor "ManagerController.Books" }}" class="item"><i class="fa fa-book" aria-hidden="true"></i> 项目管理</a> </li>
|
|
||||||
{{/*<li><a href="{{urlfor "ManagerController.Comments" }}" class="item"><i class="fa fa-comments-o" aria-hidden="true"></i> 评论管理</a> </li>*/}}
|
|
||||||
<li><a href="{{urlfor "ManagerController.Setting" }}" class="item"><i class="fa fa-cogs" aria-hidden="true"></i> 配置管理</a> </li>
|
|
||||||
<li><a href="{{urlfor "ManagerController.AttachList" }}" class="item"><i class="fa fa-cloud-upload" aria-hidden="true"></i> 附件管理</a> </li>
|
|
||||||
<li><a href="{{urlfor "ManagerController.LabelList" }}" class="item"><i class="fa fa-bookmark" aria-hidden="true"></i> 标签管理</a> </li>
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="page-right">
|
<div class="page-right">
|
||||||
<div class="m-box">
|
<div class="m-box">
|
||||||
<div class="box-head">
|
<div class="box-head">
|
||||||
|
12
views/manager/widgets.tpl
Normal file
12
views/manager/widgets.tpl
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<div class="page-left">
|
||||||
|
<ul class="menu">
|
||||||
|
<li{{if eq "index" .}} class="active"{{end}}><a href="{{urlfor "ManagerController.Index"}}" class="item"><i class="fa fa-dashboard" aria-hidden="true"></i> 仪表盘</a> </li>
|
||||||
|
<li{{if eq "users" .}} class="active"{{end}}><a href="{{urlfor "ManagerController.Users" }}" class="item"><i class="fa fa-users" aria-hidden="true"></i> 用户管理</a> </li>
|
||||||
|
<li{{if eq "books" .}} class="active"{{end}}><a href="{{urlfor "ManagerController.Books" }}" class="item"><i class="fa fa-book" aria-hidden="true"></i> 项目管理</a> </li>
|
||||||
|
{{/*<li><a href="{{urlfor "ManagerController.Comments" }}" class="item"><i class="fa fa-comments-o" aria-hidden="true"></i> 评论管理</a> </li>*/}}
|
||||||
|
<li{{if eq "setting" .}} class="active"{{end}}><a href="{{urlfor "ManagerController.Setting" }}" class="item"><i class="fa fa-cogs" aria-hidden="true"></i> 配置管理</a> </li>
|
||||||
|
<li{{if eq "config" .}} class="active"{{end}}><a href="{{urlfor "ManagerController.Config" }}" class="item"><i class="fa fa-file" aria-hidden="true"></i> 配置文件</a> </li>
|
||||||
|
<li{{if eq "attach" .}} class="active"{{end}}><a href="{{urlfor "ManagerController.AttachList" }}" class="item"><i class="fa fa-cloud-upload" aria-hidden="true"></i> 附件管理</a> </li>
|
||||||
|
<li{{if eq "label" .}} class="active"{{end}}><a href="{{urlfor "ManagerController.LabelList" }}" class="item"><i class="fa fa-bookmark" aria-hidden="true"></i> 标签管理</a> </li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
Loading…
Reference in New Issue
Block a user