mirror of
https://github.com/mindoc-org/mindoc.git
synced 2025-12-21 11:13:57 +08:00
1、实现富文本编辑器
2、实现文档转换为PDF、MOBI、EPUB、Word格式 3、实现登录后跳转到来源地址
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"github.com/lifei6671/mindoc/models"
|
||||
"github.com/astaxie/beego/orm"
|
||||
"github.com/astaxie/beego"
|
||||
"github.com/astaxie/beego/orm"
|
||||
"github.com/lifei6671/mindoc/conf"
|
||||
"github.com/lifei6671/mindoc/models"
|
||||
"github.com/lifei6671/mindoc/utils"
|
||||
"math"
|
||||
)
|
||||
@@ -18,7 +18,7 @@ func (c *LabelController) Prepare() {
|
||||
|
||||
//如果没有开启你们访问则跳转到登录
|
||||
if !c.EnableAnonymous && c.Member == nil {
|
||||
c.Redirect(beego.URLFor("AccountController.Login"),302)
|
||||
c.Redirect(beego.URLFor("AccountController.Login"), 302)
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -29,16 +29,16 @@ func (c *LabelController) Index() {
|
||||
c.TplName = "label/index.tpl"
|
||||
|
||||
labelName := c.Ctx.Input.Param(":key")
|
||||
pageIndex,_ := c.GetInt("page",1)
|
||||
pageIndex, _ := c.GetInt("page", 1)
|
||||
if labelName == "" {
|
||||
c.Abort("404")
|
||||
}
|
||||
_,err := models.NewLabel().FindFirst("label_name",labelName)
|
||||
_, err := models.NewLabel().FindFirst("label_name", labelName)
|
||||
|
||||
if err != nil {
|
||||
if err == orm.ErrNoRows {
|
||||
c.Abort("404")
|
||||
}else{
|
||||
} else {
|
||||
beego.Error(err)
|
||||
c.Abort("500")
|
||||
}
|
||||
@@ -47,7 +47,7 @@ func (c *LabelController) Index() {
|
||||
if c.Member != nil {
|
||||
member_id = c.Member.MemberId
|
||||
}
|
||||
search_result,totalCount,err := models.NewBook().FindForLabelToPager(labelName,pageIndex,conf.PageSize,member_id)
|
||||
search_result, totalCount, err := models.NewBook().FindForLabelToPager(labelName, pageIndex, conf.PageSize, member_id)
|
||||
|
||||
if err != nil {
|
||||
beego.Error(err)
|
||||
@@ -57,7 +57,7 @@ func (c *LabelController) Index() {
|
||||
html := utils.GetPagerHtml(c.Ctx.Request.RequestURI, pageIndex, conf.PageSize, totalCount)
|
||||
|
||||
c.Data["PageHtml"] = html
|
||||
}else {
|
||||
} else {
|
||||
c.Data["PageHtml"] = ""
|
||||
}
|
||||
c.Data["Lists"] = search_result
|
||||
@@ -69,25 +69,22 @@ func (c *LabelController) List() {
|
||||
c.Prepare()
|
||||
c.TplName = "label/list.tpl"
|
||||
|
||||
pageIndex,_ := c.GetInt("page",1)
|
||||
pageIndex, _ := c.GetInt("page", 1)
|
||||
pageSize := 200
|
||||
|
||||
labels ,totalCount,err := models.NewLabel().FindToPager(pageIndex,pageSize)
|
||||
labels, totalCount, err := models.NewLabel().FindToPager(pageIndex, pageSize)
|
||||
|
||||
if err != nil {
|
||||
c.ShowErrorPage(50001,err.Error())
|
||||
c.ShowErrorPage(50001, err.Error())
|
||||
}
|
||||
if totalCount > 0 {
|
||||
html := utils.GetPagerHtml(c.Ctx.Request.RequestURI, pageIndex, pageSize, totalCount)
|
||||
|
||||
c.Data["PageHtml"] = html
|
||||
}else {
|
||||
} else {
|
||||
c.Data["PageHtml"] = ""
|
||||
}
|
||||
c.Data["TotalPages"] = int(math.Ceil(float64(totalCount) / float64(pageSize)))
|
||||
|
||||
c.Data["Labels"] = labels
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user