From 9ceaf7b23dad214f2bbbdbde9f04efe2ed175eec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=A3=9E=E9=BA=9F?= Date: Wed, 10 May 2017 10:03:13 +0800 Subject: [PATCH 1/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dcd52adc..03d8eaae 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ MinDoc 的前身是 SmartWiki 文档系统。SmartWiki 是基于 PHP 框架 lara # 安装与使用 -**如果你的服务器上没有安装golang程序请手动设置一个环境变量如下:键名为 ZONEINFO,值为MinDoc程序所在路径。** +**如果你的服务器上没有安装golang程序请手动设置一个环境变量如下:键名为 ZONEINFO,值为MinDoc跟目录下的/lib/time/zoneinfo.zip 。** **Windows 教程:** [https://github.com/lifei6671/godoc/blob/master/README_WIN.md](https://github.com/lifei6671/godoc/blob/master/README_WIN.md) From f34c85eba7ac5a519d6df6cb5e74db81b7863167 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=A3=9E=E9=BA=9F?= Date: Wed, 10 May 2017 12:39:52 +0800 Subject: [PATCH 2/6] Update README_WIN.md --- README_WIN.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README_WIN.md b/README_WIN.md index 1d2a352a..909fe1ed 100644 --- a/README_WIN.md +++ b/README_WIN.md @@ -1,5 +1,7 @@ # Windows 下安装和配置 MinDoc +**如果你的服务器上没有安装golang程序请手动设置一个环境变量如下:键名为 ZONEINFO,值为MinDoc跟目录下的/lib/time/zoneinfo.zip 绝对路径。** + **第一步 下载可执行文件** 请从 [https://github.com/lifei6671/godoc/releases](https://github.com/lifei6671/godoc/releases) 下载最新版的可执行文件,一般文件名为 godoc_windows_amd.zip . From 43c8da7975f99727632b9d1507263c19ea19bfaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=A3=9E=E9=BA=9F?= Date: Wed, 10 May 2017 12:40:09 +0800 Subject: [PATCH 3/6] Update README_LINUX.md --- README_LINUX.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README_LINUX.md b/README_LINUX.md index c3487b94..628c14a3 100644 --- a/README_LINUX.md +++ b/README_LINUX.md @@ -1,5 +1,7 @@ # Linux 下安装和配置 MinDoc +**如果你的服务器上没有安装golang程序请手动设置一个环境变量如下:键名为 ZONEINFO,值为MinDoc跟目录下的/lib/time/zoneinfo.zip 绝对路径。** + **第一步 下载可执行文件** 请从 [https://github.com/lifei6671/godoc/releases](https://github.com/lifei6671/godoc/releases) 下载最新版的可执行文件,一般文件名为 godoc_linux_amd.tar.gz . From 42b08a0b18fc7ec13c3e7efb316f313e961f771b Mon Sep 17 00:00:00 2001 From: Minho Date: Wed, 10 May 2017 13:43:36 +0800 Subject: [PATCH 4/6] =?UTF-8?q?1=E3=80=81=E4=BF=AE=E5=A4=8D=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=99=A8=E4=B8=8D=E6=98=BE=E7=A4=BA=E6=BB=9A=E5=8A=A8?= =?UTF-8?q?=E6=9D=A1=E7=9A=84BUG=202=E3=80=81=E4=BC=98=E5=8C=96=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E4=BA=A4=E4=BA=92=E6=96=B9=E5=BC=8F=203=E3=80=81?= =?UTF-8?q?=E6=96=B0=E5=A2=9EHtml=E7=BC=96=E8=BE=91=E5=99=A8=E6=8C=89?= =?UTF-8?q?=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/account.go | 2 + controllers/book.go | 2 +- main.go | 4 +- static/css/markdown.css | 5 ++- static/js/editor.js | 4 -- static/js/html-editor.js | 38 ++++++++++++++++++ static/wangEditor/plugins/release-menu.js | 47 +++++++++++++++++++++++ views/book/index.tpl | 4 +- views/document/html_edit_template.tpl | 1 + 9 files changed, 96 insertions(+), 11 deletions(-) create mode 100644 static/wangEditor/plugins/release-menu.js diff --git a/controllers/account.go b/controllers/account.go index ad0f461e..ef1bcda1 100644 --- a/controllers/account.go +++ b/controllers/account.go @@ -78,6 +78,7 @@ func (c *AccountController) Login() { } } +//用户注册. func (c *AccountController) Register() { c.TplName = "account/register.tpl" @@ -329,6 +330,7 @@ func (c *AccountController) Logout(){ c.Redirect(beego.URLFor("AccountController.Login"),302) } +//验证码. func (c *AccountController) Captcha() { c.Prepare() diff --git a/controllers/book.go b/controllers/book.go index 91033fa6..d31771fb 100644 --- a/controllers/book.go +++ b/controllers/book.go @@ -557,7 +557,7 @@ func (c *BookController) SaveSort() { beego.Error(err) c.JsonResult(6003,"数据错误") } - fmt.Printf("%+v",docs) + for _,item := range docs { if doc_id,ok := item["id"].(float64);ok { doc,err := models.NewDocument().Find(int(doc_id)); diff --git a/main.go b/main.go index 8b963fc0..a5899360 100644 --- a/main.go +++ b/main.go @@ -32,10 +32,8 @@ func main() { beego.SetStaticPath("uploads","uploads") - - - beego.ErrorController(&controllers.ErrorController{}) + beego.Run() } diff --git a/static/css/markdown.css b/static/css/markdown.css index 870a94ad..a3a2ab63 100644 --- a/static/css/markdown.css +++ b/static/css/markdown.css @@ -33,9 +33,12 @@ body{ width: 280px; position: fixed; border-top: 1px solid #DDDDDD; - bottom: 0; + bottom: 15px; top: 40px; background-color: #FAFAFA; + left: 0; + right: 0; + overflow-y:auto; } .manual-category .manual-nav { font-size: 14px; diff --git a/static/js/editor.js b/static/js/editor.js index 33ad0721..cf672c46 100644 --- a/static/js/editor.js +++ b/static/js/editor.js @@ -187,7 +187,3 @@ function showSuccess($msg,$id) { $($id).addClass("success-message").removeClass("error-message").text($msg); return true; } - - - - diff --git a/static/js/html-editor.js b/static/js/html-editor.js index 2fe1ab34..939f643f 100644 --- a/static/js/html-editor.js +++ b/static/js/html-editor.js @@ -10,6 +10,24 @@ $(function () { }; wangEditor.config.menus.splice(0,0,"|"); wangEditor.config.menus.splice(0,0,"save"); + wangEditor.config.menus.splice(0,0,"release"); + + //移除地图、背景色 + editor.config.menus = $.map(wangEditor.config.menus, function(item, key) { + if (item === 'bgcolor') { + return null; + } + if (item === 'fullscreen') { + return null; + } + if (item === "undo"){ + return null; + } + if (item === "redo"){ + return null; + } + return item; + }); window.editor.ready(function () { if(window.documentCategory.length > 0){ @@ -251,4 +269,24 @@ $(function () { }).on("move_node.jstree", jstree_save); window.saveDocument = saveDocument; + + window.releaseBook = function () { + if(Object.prototype.toString.call(window.documentCategory) === '[object Array]' && window.documentCategory.length > 0){ + $.ajax({ + url : window.releaseURL, + data :{"identify" : window.book.identify }, + type : "post", + dataType : "json", + success : function (res) { + if(res.errcode === 0){ + layer.msg("发布任务已推送到任务队列,稍后将在后台执行。"); + }else{ + layer.msg(res.message); + } + } + }); + }else{ + layer.msg("没有需要发布的文档") + } + }; }); \ No newline at end of file diff --git a/static/wangEditor/plugins/release-menu.js b/static/wangEditor/plugins/release-menu.js new file mode 100644 index 00000000..4dfec50c --- /dev/null +++ b/static/wangEditor/plugins/release-menu.js @@ -0,0 +1,47 @@ +(function () { + + // 获取 wangEditor 构造函数和 jquery + var E = window.wangEditor; + var $ = window.jQuery; + + // 用 createMenu 方法创建菜单 + E.createMenu(function (check) { + + // 定义菜单id,不要和其他菜单id重复。编辑器自带的所有菜单id,可通过『参数配置-自定义菜单』一节查看 + var menuId = 'release'; + + // check将检查菜单配置(『参数配置-自定义菜单』一节描述)中是否该菜单id,如果没有,则忽略下面的代码。 + if (!check(menuId)) { + return; + } + + // this 指向 editor 对象自身 + var editor = this; + + // 创建 menu 对象 + var menu = new E.Menu({ + editor: editor, // 编辑器对象 + id: menuId, // 菜单id + title: '发布', // 菜单标题 + + // 正常状态和选中状态下的dom对象,样式需要自定义 + $domNormal: $(''), + $domSelected: $('') + }); + + // 菜单正常状态下,点击将触发该事件 + menu.clickEvent = function (e) { + window.releaseBook(); + }; + + // 菜单选中状态下,点击将触发该事件 + menu.clickEventSelected = function (e) { + + }; + + + // 增加到editor对象中 + editor.menus[menuId] = menu; + }); + +})(); \ No newline at end of file diff --git a/views/book/index.tpl b/views/book/index.tpl index 8c28610a..48773686 100644 --- a/views/book/index.tpl +++ b/views/book/index.tpl @@ -58,9 +58,9 @@
diff --git a/views/document/html_edit_template.tpl b/views/document/html_edit_template.tpl index dcdecbf5..865c1050 100644 --- a/views/document/html_edit_template.tpl +++ b/views/document/html_edit_template.tpl @@ -126,6 +126,7 @@ + From fec83d849cbb703a75e72d9cdb200bf783f80cfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=A3=9E=E9=BA=9F?= Date: Wed, 10 May 2017 14:33:52 +0800 Subject: [PATCH 5/6] Update README_WIN.md --- README_WIN.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README_WIN.md b/README_WIN.md index 909fe1ed..08d8c77b 100644 --- a/README_WIN.md +++ b/README_WIN.md @@ -42,7 +42,9 @@ db_password=123456 **第五步 启动程序** -此时,双击 godoc_windows_amd64.exe 文件,该程序会自动在后台执行,打开任务管理器会看到运行中的程序。 +如果你设置了环境变量,但是没有重启电脑,请在cmd命令行启动 godoc_windows_amd64.exe 程序。 + +如果你设置了环境变量,并且重启了电脑,双击 godoc_windows_amd64.exe 即可。 稍等一分钟,程序会自动初始化数据库,并创建一个超级管理员账号:admin 密码:123456 From fa20dad73f1bccd2bd5a8ec8493d5fbfcb534ec7 Mon Sep 17 00:00:00 2001 From: Minho Date: Wed, 10 May 2017 15:42:37 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E4=BA=A4=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- views/book/setting.tpl | 356 +++++++++++++++++++++-------------------- 1 file changed, 186 insertions(+), 170 deletions(-) diff --git a/views/book/setting.tpl b/views/book/setting.tpl index 0fb56b96..09f57ff9 100644 --- a/views/book/setting.tpl +++ b/views/book/setting.tpl @@ -83,59 +83,59 @@ - {{/* + {{/*
- -
- - - - -
-
- */}} - {{if eq .Model.PrivatelyOwned 1}} -
- -
-
- -
-
- - -
-
-
- {{end}} -
- - -
- + +
+ + + +
-
- -
-
- + */}} + {{if eq .Model.PrivatelyOwned 1}} +
+ +
+
+ +
+
+ + +
+
+
+ {{end}} +
+ + +
+ +
+ +
+
+ - {{template "widgets/footer.tpl" .}} + + +{{template "widgets/footer.tpl" .}} @@ -216,22 +216,22 @@ @@ -240,25 +240,26 @@