Merge remote-tracking branch 'origin/dev' into dev-binnchx
Conflicts:
This commit is contained in:
commit
9af13bcc32
1839 files changed
+23780
-13015
No files matched your search
@@ -62,7 +62,7 @@ func (c Attach) uploadAttach(noteId string) (re info.Re) {
|
||||
maxFileSize = 1000
|
||||
}
|
||||
if(float64(len(data)) > maxFileSize * float64(1024*1024)) {
|
||||
resultMsg = fmt.Sprintf("附件大于%vM", maxFileSize)
|
||||
resultMsg = fmt.Sprintf("The file's size is bigger than %vM", maxFileSize)
|
||||
return re
|
||||
}
|
||||
|
||||
@@ -100,11 +100,15 @@ func (c Attach) uploadAttach(noteId string) (re info.Re) {
|
||||
id := bson.NewObjectId();
|
||||
fileInfo.AttachId = id
|
||||
fileId = id.Hex()
|
||||
Ok = attachService.AddAttach(fileInfo)
|
||||
Ok, resultMsg = attachService.AddAttach(fileInfo)
|
||||
if resultMsg != "" {
|
||||
resultMsg = c.Message(resultMsg)
|
||||
}
|
||||
|
||||
fileInfo.Path = ""; // 不要返回
|
||||
resultMsg = "success"
|
||||
|
||||
if Ok {
|
||||
resultMsg = "success"
|
||||
}
|
||||
return re
|
||||
}
|
||||
|
||||
@@ -212,4 +216,4 @@ func (c Attach) DownloadAll(noteId string) revel.Result {
|
||||
// file, _ := os.Open(dir + "/" + filename)
|
||||
// fw.Seek(0, 0)
|
||||
return c.RenderBinary(fw, filename, revel.Attachment, time.Now()) // revel.Attachment
|
||||
}
|
||||
}
|
||||
@@ -91,18 +91,19 @@ func (c Auth) Demo() revel.Result {
|
||||
|
||||
//--------
|
||||
// 注册
|
||||
func (c Auth) Register(from string) revel.Result {
|
||||
func (c Auth) Register(from, iu string) revel.Result {
|
||||
if !configService.IsOpenRegister() {
|
||||
return c.Redirect("/index")
|
||||
}
|
||||
c.SetLocale()
|
||||
c.RenderArgs["from"] = from
|
||||
c.RenderArgs["iu"] = iu
|
||||
|
||||
c.RenderArgs["title"] = c.Message("register")
|
||||
c.RenderArgs["subTitle"] = c.Message("register")
|
||||
return c.RenderTemplate("home/register.html")
|
||||
}
|
||||
func (c Auth) DoRegister(email, pwd string) revel.Result {
|
||||
func (c Auth) DoRegister(email, pwd, iu string) revel.Result {
|
||||
if !configService.IsOpenRegister() {
|
||||
return c.Redirect("/index")
|
||||
}
|
||||
@@ -117,7 +118,7 @@ func (c Auth) DoRegister(email, pwd string) revel.Result {
|
||||
}
|
||||
|
||||
// 注册
|
||||
re.Ok, re.Msg = authService.Register(email, pwd)
|
||||
re.Ok, re.Msg = authService.Register(email, pwd, iu)
|
||||
|
||||
// 注册成功, 则立即登录之
|
||||
if re.Ok {
|
||||
|
||||
@@ -193,12 +193,13 @@ func (c BaseController) SetLocale() string {
|
||||
}
|
||||
|
||||
// 设置userInfo
|
||||
func (c BaseController) SetUserInfo() {
|
||||
func (c BaseController) SetUserInfo() info.User {
|
||||
userInfo := c.GetUserInfo()
|
||||
c.RenderArgs["userInfo"] = userInfo
|
||||
if(userInfo.Username == configService.GetAdminUsername()) {
|
||||
c.RenderArgs["isAdmin"] = true
|
||||
}
|
||||
return userInfo
|
||||
}
|
||||
|
||||
// life
|
||||
@@ -224,6 +225,7 @@ func (c BaseController) RenderTemplateStr(templatePath string) string {
|
||||
// 为了msg
|
||||
// msg-v1-v2-v3
|
||||
func (c BaseController) RenderRe(re info.Re) revel.Result {
|
||||
oldMsg := re.Msg
|
||||
if re.Msg != "" {
|
||||
if(strings.Contains(re.Msg, "-")) {
|
||||
msgAndValues := strings.Split(re.Msg, "-")
|
||||
@@ -241,5 +243,8 @@ func (c BaseController) RenderRe(re info.Re) revel.Result {
|
||||
re.Msg = c.Message(re.Msg)
|
||||
}
|
||||
}
|
||||
if strings.HasPrefix(re.Msg, "???") {
|
||||
re.Msg = oldMsg
|
||||
}
|
||||
return c.RenderJson(re)
|
||||
}
|
||||
@@ -57,6 +57,9 @@ func (c Blog) render(templateName string, themePath string) revel.Result {
|
||||
isPreview = true
|
||||
themePath = themePath2.(string)
|
||||
c.setPreviewUrl()
|
||||
|
||||
// 因为common的themeInfo是从UserBlog.ThemeId来取的, 所以这里要fugai下
|
||||
c.RenderArgs["themeInfo"] = c.RenderArgs["themeInfoPreview"];
|
||||
}
|
||||
return blog.RenderTemplate(templateName, c.RenderArgs, revel.BasePath+"/"+themePath, isPreview)
|
||||
}
|
||||
@@ -846,4 +849,4 @@ func (c Blog) ListCateLatest(notebookId, callback string) revel.Result {
|
||||
re.Ok = true
|
||||
re.List = blogs
|
||||
return c.RenderJsonP(callback, re)
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"fmt"
|
||||
"strconv"
|
||||
// "strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@@ -85,7 +85,7 @@ func (c File) uploadImage(from, albumId string) (re info.Re) {
|
||||
var fileUrlPath = ""
|
||||
var fileId = ""
|
||||
var resultCode = 0 // 1表示正常
|
||||
var resultMsg = "内部错误" // 错误信息
|
||||
var resultMsg = "error" // 错误信息
|
||||
var Ok = false
|
||||
|
||||
defer func() {
|
||||
@@ -120,7 +120,7 @@ func (c File) uploadImage(from, albumId string) (re info.Re) {
|
||||
} else {
|
||||
_, ext = SplitFilename(filename)
|
||||
if(ext != ".gif" && ext != ".jpg" && ext != ".png" && ext != ".bmp" && ext != ".jpeg") {
|
||||
resultMsg = "不是图片"
|
||||
resultMsg = "Please upload image"
|
||||
return re
|
||||
}
|
||||
}
|
||||
@@ -147,7 +147,7 @@ func (c File) uploadImage(from, albumId string) (re info.Re) {
|
||||
// > 2M?
|
||||
if(float64(len(data)) > maxFileSize * float64(1024*1024)) {
|
||||
resultCode = 0
|
||||
resultMsg = fmt.Sprintf("图片大于%vM", maxFileSize)
|
||||
resultMsg = fmt.Sprintf("The file Size is bigger than %vM", maxFileSize)
|
||||
return re
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ func (c File) uploadImage(from, albumId string) (re info.Re) {
|
||||
filesize := GetFilesize(toPathGif)
|
||||
fileUrlPath += "/" + filename
|
||||
resultCode = 1
|
||||
resultMsg = "上传成功!"
|
||||
resultMsg = "Upload Success!"
|
||||
|
||||
// File
|
||||
fileInfo := info.File{Name: filename,
|
||||
@@ -178,7 +178,8 @@ func (c File) uploadImage(from, albumId string) (re info.Re) {
|
||||
fileId = "public/upload/" + c.GetUserId() + "/images/logo/" + filename
|
||||
}
|
||||
|
||||
Ok = fileService.AddImage(fileInfo, albumId, c.GetUserId())
|
||||
Ok, resultMsg = fileService.AddImage(fileInfo, albumId, c.GetUserId(), from == "" || from == "pasteImage")
|
||||
resultMsg = c.Message(resultMsg)
|
||||
|
||||
fileInfo.Path = ""; // 不要返回
|
||||
re.Item = fileInfo
|
||||
@@ -203,55 +204,6 @@ func (c File) DeleteImage(fileId string) revel.Result {
|
||||
re.Ok, re.Msg = fileService.DeleteImage(c.GetUserId(), fileId)
|
||||
return c.RenderJson(re)
|
||||
}
|
||||
|
||||
// update image uploader to leaui image,
|
||||
// scan all user's images and insert into db
|
||||
func (c File) UpgradeLeauiImage() revel.Result {
|
||||
re := info.NewRe()
|
||||
|
||||
if ok, _ := revel.Config.Bool("upgradeLeauiImage"); !ok {
|
||||
re.Msg = "Not allowed"
|
||||
return c.RenderJson(re)
|
||||
}
|
||||
|
||||
uploadPath := revel.BasePath + "/public/upload";
|
||||
userIds := ListDir(uploadPath)
|
||||
if userIds == nil {
|
||||
re.Msg = "no user"
|
||||
return c.RenderJson(re)
|
||||
}
|
||||
|
||||
msg := "";
|
||||
|
||||
for _, userId := range userIds {
|
||||
dirPath := uploadPath + "/" + userId + "/images"
|
||||
images := ListDir(dirPath)
|
||||
if images == nil {
|
||||
msg += userId + " no images "
|
||||
continue;
|
||||
}
|
||||
|
||||
hadImages := fileService.GetAllImageNamesMap(userId)
|
||||
|
||||
i := 0
|
||||
for _, filename := range images {
|
||||
if _, ok := hadImages[filename]; !ok {
|
||||
fileUrlPath := "/upload/" + userId + "/images/" + filename
|
||||
fileInfo := info.File{Name: filename,
|
||||
Title: filename,
|
||||
Path: fileUrlPath,
|
||||
Size: GetFilesize(dirPath + "/" + filename)}
|
||||
fileService.AddImage(fileInfo, "", userId)
|
||||
i++
|
||||
}
|
||||
}
|
||||
msg += userId + ": " + strconv.Itoa(len(images)) + " -- " + strconv.Itoa(i) + " images "
|
||||
}
|
||||
|
||||
re.Msg = msg
|
||||
return c.RenderJson(re)
|
||||
}
|
||||
|
||||
//-----------
|
||||
|
||||
// 输出image
|
||||
@@ -267,15 +219,15 @@ func (c File) OutputImage(noteId, fileId string) revel.Result {
|
||||
}
|
||||
|
||||
// 协作时复制图片到owner
|
||||
// 需要计算对方大小
|
||||
func (c File) CopyImage(userId, fileId, toUserId string) revel.Result {
|
||||
re := info.NewRe()
|
||||
|
||||
re.Ok, re.Id = fileService.CopyImage(userId, fileId, toUserId)
|
||||
|
||||
return c.RenderJson(re)
|
||||
}
|
||||
|
||||
// 复制外网的图片, 成公共图片 放在/upload下
|
||||
// 都要好好的计算大小
|
||||
func (c File) CopyHttpImage(src string) revel.Result {
|
||||
re := info.NewRe()
|
||||
fileUrlPath := "upload/" + c.GetUserId() + "/images"
|
||||
@@ -302,29 +254,7 @@ func (c File) CopyHttpImage(src string) revel.Result {
|
||||
|
||||
re.Id = id.Hex()
|
||||
re.Item = fileInfo.Path
|
||||
re.Ok = fileService.AddImage(fileInfo, "", c.GetUserId())
|
||||
re.Ok, re.Msg = fileService.AddImage(fileInfo, "", c.GetUserId(), true)
|
||||
|
||||
return c.RenderJson(re)
|
||||
}
|
||||
|
||||
//------------
|
||||
// 过时 已弃用!
|
||||
func (c File) UploadImage(renderHtml string) revel.Result {
|
||||
if renderHtml == "" {
|
||||
renderHtml = "file/image.html"
|
||||
}
|
||||
|
||||
re := c.uploadImage("", "");
|
||||
|
||||
c.RenderArgs["fileUrlPath"] = configService.GetSiteUrl() + re.Id
|
||||
c.RenderArgs["resultCode"] = re.Code
|
||||
c.RenderArgs["resultMsg"] = re.Msg
|
||||
|
||||
return c.RenderTemplate(renderHtml)
|
||||
}
|
||||
|
||||
// 已弃用
|
||||
func (c File) UploadImageJson(from, noteId string) revel.Result {
|
||||
re := c.uploadImage(from, "");
|
||||
return c.RenderJson(re)
|
||||
}
|
||||
}
|
||||
@@ -22,9 +22,8 @@ type Note struct {
|
||||
// 笔记首页, 判断是否已登录
|
||||
// 已登录, 得到用户基本信息(notebook, shareNotebook), 跳转到index.html中
|
||||
// 否则, 转向登录页面
|
||||
func (c Note) Index() revel.Result {
|
||||
func (c Note) Index(noteId string) revel.Result {
|
||||
c.SetLocale()
|
||||
|
||||
userInfo := c.GetUserInfo()
|
||||
|
||||
userId := userInfo.UserId.Hex()
|
||||
@@ -35,7 +34,7 @@ func (c Note) Index() revel.Result {
|
||||
}
|
||||
|
||||
c.RenderArgs["openRegister"] = configService.IsOpenRegister()
|
||||
|
||||
|
||||
// 已登录了, 那么得到所有信息
|
||||
notebooks := notebookService.GetNotebooks(userId)
|
||||
shareNotebooks, sharedUserInfos := shareService.GetShareNotebooks(userId)
|
||||
@@ -43,22 +42,78 @@ func (c Note) Index() revel.Result {
|
||||
// 还需要按时间排序(DESC)得到notes
|
||||
notes := []info.Note{}
|
||||
noteContent := info.NoteContent{}
|
||||
|
||||
if len(notebooks) > 0 {
|
||||
// _, notes = noteService.ListNotes(c.GetUserId(), "", false, c.GetPage(), pageSize, defaultSortField, false, false);
|
||||
// 变成最新
|
||||
_, notes = noteService.ListNotes(c.GetUserId(), "", false, c.GetPage(), 50, defaultSortField, false, false);
|
||||
if len(notes) > 0 {
|
||||
noteContent = noteService.GetNoteContent(notes[0].NoteId.Hex(), userId)
|
||||
// noteId是否存在
|
||||
// 是否传入了正确的noteId
|
||||
hasRightNoteId := false
|
||||
if IsObjectId(noteId) {
|
||||
note := noteService.GetNoteById(noteId)
|
||||
var noteOwner = note.UserId.Hex()
|
||||
noteContent = noteService.GetNoteContent(noteId, noteOwner)
|
||||
|
||||
if note.NoteId != "" {
|
||||
hasRightNoteId = true
|
||||
c.RenderArgs["curNoteId"] = noteId
|
||||
c.RenderArgs["curNotebookId"] = note.NotebookId.Hex()
|
||||
|
||||
// 打开的是共享的笔记, 那么判断是否是共享给我的默认笔记
|
||||
if noteOwner != c.GetUserId() {
|
||||
if shareService.HasReadPerm(noteOwner, c.GetUserId(), noteId) {
|
||||
// 不要获取notebook下的笔记
|
||||
// 在前端下发请求
|
||||
c.RenderArgs["curSharedNoteNotebookId"] = note.NotebookId.Hex()
|
||||
c.RenderArgs["curSharedUserId"] = noteOwner;
|
||||
// 没有读写权限
|
||||
} else {
|
||||
hasRightNoteId = false
|
||||
}
|
||||
} else {
|
||||
_, notes = noteService.ListNotes(c.GetUserId(), note.NotebookId.Hex(), false, c.GetPage(), 50, defaultSortField, false, false);
|
||||
|
||||
// 如果指定了某笔记, 则该笔记放在首位
|
||||
lenNotes := len(notes)
|
||||
if lenNotes > 1 {
|
||||
notes2 := make([]info.Note, len(notes))
|
||||
notes2[0] = note
|
||||
i := 1
|
||||
for _, note := range notes {
|
||||
if note.NoteId.Hex() != noteId {
|
||||
if i == lenNotes { // 防止越界
|
||||
break;
|
||||
}
|
||||
notes2[i] = note
|
||||
i++
|
||||
}
|
||||
}
|
||||
notes = notes2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 得到最近的笔记
|
||||
_, latestNotes := noteService.ListNotes(c.GetUserId(), "", false, c.GetPage(), 50, defaultSortField, false, false);
|
||||
c.RenderArgs["latestNotes"] = latestNotes
|
||||
}
|
||||
|
||||
// 没有传入笔记
|
||||
// 那么得到最新笔记
|
||||
if !hasRightNoteId {
|
||||
_, notes = noteService.ListNotes(c.GetUserId(), "", false, c.GetPage(), 50, defaultSortField, false, false);
|
||||
if len(notes) > 0 {
|
||||
noteContent = noteService.GetNoteContent(notes[0].NoteId.Hex(), userId)
|
||||
c.RenderArgs["curNoteId"] = notes[0].NoteId.Hex()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 当然, 还需要得到第一个notes的content
|
||||
//...
|
||||
Log(configService.GetAdminUsername())
|
||||
c.RenderArgs["isAdmin"] = configService.GetAdminUsername() == userInfo.Username
|
||||
|
||||
c.RenderArgs["userInfo"] = userInfo
|
||||
c.RenderArgs["notebooks"] = notebooks
|
||||
c.RenderArgs["shareNotebooks"] = shareNotebooks
|
||||
c.RenderArgs["shareNotebooks"] = shareNotebooks // note信息在notes列表中
|
||||
c.RenderArgs["sharedUserInfos"] = sharedUserInfos
|
||||
|
||||
c.RenderArgs["notes"] = notes
|
||||
@@ -69,6 +124,9 @@ func (c Note) Index() revel.Result {
|
||||
|
||||
c.RenderArgs["globalConfigs"] = configService.GetGlobalConfigForUser()
|
||||
|
||||
|
||||
// return c.RenderTemplate("note/note.html")
|
||||
|
||||
if isDev, _ := revel.Config.Bool("mode.dev"); isDev {
|
||||
return c.RenderTemplate("note/note-dev.html")
|
||||
} else {
|
||||
|
||||
@@ -33,6 +33,8 @@ func (c Preview) getPreviewThemeAbsolutePath(themeId string) bool {
|
||||
theme := themeService.GetTheme(c.GetUserId(), themeId)
|
||||
|
||||
c.RenderArgs["isPreview"] = true
|
||||
c.RenderArgs["themeId"] = themeId
|
||||
c.RenderArgs["themeInfoPreview"] = theme.Info
|
||||
c.RenderArgs["themePath"] = theme.Path
|
||||
if theme.Path == "" {
|
||||
return false
|
||||
|
||||
@@ -44,7 +44,7 @@ func (c AdminUser) Register(email, pwd string) revel.Result {
|
||||
}
|
||||
|
||||
// 注册
|
||||
re.Ok, re.Msg = authService.Register(email, pwd)
|
||||
re.Ok, re.Msg = authService.Register(email, pwd, "")
|
||||
|
||||
return c.RenderRe(re)
|
||||
}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
package member
|
||||
|
||||
import (
|
||||
"github.com/revel/revel"
|
||||
. "github.com/leanote/leanote/app/lea"
|
||||
"github.com/leanote/leanote/app/info"
|
||||
"os"
|
||||
"io/ioutil"
|
||||
"time"
|
||||
"fmt"
|
||||
"github.com/leanote/leanote/app/info"
|
||||
. "github.com/leanote/leanote/app/lea"
|
||||
"github.com/revel/revel"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
// "github.com/leanote/leanote/app/lea/blog"
|
||||
"time"
|
||||
// "github.com/leanote/leanote/app/lea/blog"
|
||||
)
|
||||
|
||||
// 博客管理
|
||||
@@ -28,35 +28,34 @@ func (c MemberBlog) common() info.UserBlog {
|
||||
|
||||
userBlog := blogService.GetUserBlog(userId)
|
||||
c.RenderArgs["userBlog"] = userBlog
|
||||
|
||||
|
||||
c.SetUserInfo()
|
||||
c.SetLocale()
|
||||
return userBlog
|
||||
}
|
||||
|
||||
|
||||
// 得到sorterField 和 isAsc
|
||||
// okSorter = ['email', 'username']
|
||||
func (c MemberBlog) getSorter(sorterField string, isAsc bool, okSorter []string) (string, bool){
|
||||
func (c MemberBlog) getSorter(sorterField string, isAsc bool, okSorter []string) (string, bool) {
|
||||
sorter := ""
|
||||
c.Params.Bind(&sorter, "sorter")
|
||||
if sorter == "" {
|
||||
return sorterField, isAsc;
|
||||
return sorterField, isAsc
|
||||
}
|
||||
|
||||
|
||||
// sorter形式 email-up, email-down
|
||||
s2 := strings.Split(sorter, "-")
|
||||
if len(s2) != 2 {
|
||||
return sorterField, isAsc;
|
||||
return sorterField, isAsc
|
||||
}
|
||||
|
||||
|
||||
// 必须是可用的sorter
|
||||
if okSorter != nil && len(okSorter) > 0 {
|
||||
if !InArray(okSorter, s2[0]) {
|
||||
return sorterField, isAsc;
|
||||
return sorterField, isAsc
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sorterField = strings.Title(s2[0])
|
||||
if s2[1] == "up" {
|
||||
isAsc = true
|
||||
@@ -64,28 +63,29 @@ func (c MemberBlog) getSorter(sorterField string, isAsc bool, okSorter []string)
|
||||
isAsc = false
|
||||
}
|
||||
c.RenderArgs["sorter"] = sorter
|
||||
return sorterField, isAsc;
|
||||
return sorterField, isAsc
|
||||
}
|
||||
|
||||
// 博客列表
|
||||
var userPageSize = 15
|
||||
|
||||
func (c MemberBlog) Index(sorter, keywords string) revel.Result {
|
||||
userId := c.GetUserId()
|
||||
userInfo := userService.GetUserInfo(userId)
|
||||
c.RenderArgs["userInfo"] = userInfo
|
||||
|
||||
|
||||
c.RenderArgs["title"] = "Posts"
|
||||
pageNumber := c.GetPage()
|
||||
sorterField, isAsc := c.getSorter("CreatedTime", false, []string{"title", "urlTitle", "updatedTime", "publicTime", "createdTime"});
|
||||
pageInfo, blogs := blogService.ListAllBlogs(c.GetUserId(), "", keywords, false, pageNumber, userPageSize, sorterField, isAsc);
|
||||
sorterField, isAsc := c.getSorter("CreatedTime", false, []string{"title", "urlTitle", "updatedTime", "publicTime", "createdTime"})
|
||||
pageInfo, blogs := blogService.ListAllBlogs(c.GetUserId(), "", keywords, false, pageNumber, userPageSize, sorterField, isAsc)
|
||||
c.RenderArgs["pageInfo"] = pageInfo
|
||||
c.RenderArgs["blogs"] = blogs
|
||||
c.RenderArgs["keywords"] = keywords
|
||||
|
||||
|
||||
userAndBlog := userService.GetUserAndBlog(c.GetUserId())
|
||||
c.RenderArgs["userAndBlog"] = userAndBlog
|
||||
|
||||
return c.RenderTemplate("member/blog/list.html");
|
||||
|
||||
return c.RenderTemplate("member/blog/list.html")
|
||||
}
|
||||
|
||||
// 修改笔记的urlTitle
|
||||
@@ -95,17 +95,16 @@ func (c MemberBlog) UpdateBlogUrlTitle(noteId, urlTitle string) revel.Result {
|
||||
return c.RenderJson(re)
|
||||
}
|
||||
|
||||
|
||||
// 修改笔记的urlTitle
|
||||
func (c MemberBlog) UpdateBlogAbstract(noteId string) revel.Result {
|
||||
c.RenderArgs["title"] = "Update Post Abstract"
|
||||
note := noteService.GetNoteAndContent(noteId, c.GetUserId());
|
||||
note := noteService.GetNoteAndContent(noteId, c.GetUserId())
|
||||
if !note.Note.IsBlog {
|
||||
return c.E404();
|
||||
return c.E404()
|
||||
}
|
||||
c.RenderArgs["note"] = note
|
||||
c.RenderArgs["noteId"] = noteId
|
||||
return c.RenderTemplate("member/blog/update_abstract.html");
|
||||
return c.RenderTemplate("member/blog/update_abstract.html")
|
||||
}
|
||||
func (c MemberBlog) DoUpdateBlogAbstract(noteId, imgSrc, desc, abstract string) revel.Result {
|
||||
|
||||
@@ -118,38 +117,33 @@ func (c MemberBlog) DoUpdateBlogAbstract(noteId, imgSrc, desc, abstract string)
|
||||
func (c MemberBlog) Base() revel.Result {
|
||||
c.common()
|
||||
c.RenderArgs["title"] = "Blog Base Info"
|
||||
return c.RenderTemplate("member/blog/base.html");
|
||||
return c.RenderTemplate("member/blog/base.html")
|
||||
}
|
||||
func (c MemberBlog) Comment() revel.Result {
|
||||
c.common()
|
||||
c.RenderArgs["title"] = "Comment"
|
||||
return c.RenderTemplate("member/blog/comment.html");
|
||||
}
|
||||
func (c MemberBlog) Domain() revel.Result {
|
||||
c.common()
|
||||
c.RenderArgs["title"] = "Domain"
|
||||
return c.RenderTemplate("member/blog/domain.html");
|
||||
return c.RenderTemplate("member/blog/comment.html")
|
||||
}
|
||||
|
||||
func (c MemberBlog) Paging() revel.Result {
|
||||
c.common()
|
||||
c.RenderArgs["title"] = "Paging"
|
||||
return c.RenderTemplate("member/blog/paging.html");
|
||||
return c.RenderTemplate("member/blog/paging.html")
|
||||
}
|
||||
|
||||
func (c MemberBlog) Cate() revel.Result {
|
||||
userBlog := c.common()
|
||||
c.RenderArgs["title"] = "Cate"
|
||||
|
||||
|
||||
notebooks := blogService.ListBlogNotebooks(c.GetUserId())
|
||||
notebooksMap := map[string]info.Notebook{}
|
||||
for _, each := range notebooks {
|
||||
notebooksMap[each.NotebookId.Hex()] = each
|
||||
}
|
||||
|
||||
var i = 0;
|
||||
|
||||
var i = 0
|
||||
notebooks2 := make([]info.Notebook, len(notebooks))
|
||||
|
||||
|
||||
// 先要保证已有的是正确的排序
|
||||
cateIds := userBlog.CateIds
|
||||
has := map[string]bool{} // cateIds中有的
|
||||
@@ -171,8 +165,8 @@ func (c MemberBlog) Cate() revel.Result {
|
||||
}
|
||||
}
|
||||
c.RenderArgs["notebooks"] = notebooks2
|
||||
|
||||
return c.RenderTemplate("member/blog/cate.html");
|
||||
|
||||
return c.RenderTemplate("member/blog/cate.html")
|
||||
}
|
||||
|
||||
// 修改分类排序
|
||||
@@ -199,9 +193,10 @@ func (c MemberBlog) AddOrUpdateSingle(singleId string) revel.Result {
|
||||
c.RenderArgs["title"] = "Add Single"
|
||||
c.RenderArgs["singleId"] = singleId
|
||||
if singleId != "" {
|
||||
c.RenderArgs["title"] = "Update Single"
|
||||
c.RenderArgs["single"] = blogService.GetSingle(singleId)
|
||||
}
|
||||
return c.RenderTemplate("member/blog/add_single.html");
|
||||
return c.RenderTemplate("member/blog/add_single.html")
|
||||
}
|
||||
func (c MemberBlog) SortSingles(singleIds []string) revel.Result {
|
||||
re := info.NewRe()
|
||||
@@ -226,8 +221,8 @@ func (c MemberBlog) Single() revel.Result {
|
||||
c.common()
|
||||
c.RenderArgs["title"] = "Cate"
|
||||
c.RenderArgs["singles"] = blogService.GetSingles(c.GetUserId())
|
||||
|
||||
return c.RenderTemplate("member/blog/single.html");
|
||||
|
||||
return c.RenderTemplate("member/blog/single.html")
|
||||
}
|
||||
|
||||
// 主题
|
||||
@@ -236,15 +231,16 @@ func (c MemberBlog) Theme() revel.Result {
|
||||
activeTheme, otherThemes := themeService.GetUserThemes(c.GetUserId())
|
||||
c.RenderArgs["activeTheme"] = activeTheme
|
||||
c.RenderArgs["otherThemes"] = otherThemes
|
||||
|
||||
|
||||
c.RenderArgs["optionThemes"] = themeService.GetDefaultThemes()
|
||||
|
||||
|
||||
c.RenderArgs["title"] = "Theme"
|
||||
return c.RenderTemplate("member/blog/theme.html");
|
||||
return c.RenderTemplate("member/blog/theme.html")
|
||||
}
|
||||
|
||||
// 编辑主题
|
||||
var baseTpls = []string{"header.html", "footer.html", "index.html", "cate.html", "search.html", "post.html", "single.html", "tags.html", "tag_posts.html", "archive.html", "share_comment.html", "404.html", "theme.json", "style.css", "blog.js"}
|
||||
|
||||
func (c MemberBlog) UpdateTheme(themeId string, isNew int) revel.Result {
|
||||
// 查看用户是否有该theme, 若没有则复制default之
|
||||
// 得到主题的文件列表
|
||||
@@ -253,22 +249,25 @@ func (c MemberBlog) UpdateTheme(themeId string, isNew int) revel.Result {
|
||||
_, themeId = themeService.NewThemeForFirst(userBlog)
|
||||
return c.Redirect("/member/blog/updateTheme?themeId=" + themeId)
|
||||
}
|
||||
|
||||
|
||||
c.common()
|
||||
c.RenderArgs["title"] = "Upate Theme"
|
||||
c.RenderArgs["isNew"] = isNew
|
||||
|
||||
|
||||
// 先复制之
|
||||
c.RenderArgs["themeId"] = themeId
|
||||
|
||||
|
||||
// 得到脚本目录
|
||||
userId := c.GetUserId()
|
||||
|
||||
theme := themeService.GetTheme(userId, themeId)
|
||||
|
||||
theme := themeService.GetTheme(userId, themeId)
|
||||
if theme.ThemeId == "" {
|
||||
return c.E404()
|
||||
}
|
||||
c.RenderArgs["theme"] = theme
|
||||
|
||||
|
||||
path := revel.BasePath + "/" + theme.Path
|
||||
|
||||
|
||||
tpls := ListDir(path)
|
||||
myTpls := make([]string, len(baseTpls))
|
||||
tplMap := map[string]bool{}
|
||||
@@ -279,16 +278,16 @@ func (c MemberBlog) UpdateTheme(themeId string, isNew int) revel.Result {
|
||||
// 得到没有的tpls
|
||||
for _, t := range tpls {
|
||||
if t == "images" {
|
||||
continue;
|
||||
continue
|
||||
}
|
||||
if !tplMap[t] {
|
||||
myTpls = append(myTpls, t)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
c.RenderArgs["myTpls"] = myTpls
|
||||
|
||||
return c.RenderTemplate("member/blog/update_theme.html");
|
||||
|
||||
return c.RenderTemplate("member/blog/update_theme.html")
|
||||
}
|
||||
|
||||
// 得到文件内容
|
||||
@@ -296,13 +295,13 @@ func (c MemberBlog) GetTplContent(themeId string, filename string) revel.Result
|
||||
re := info.NewRe()
|
||||
re.Ok = true
|
||||
re.Item = themeService.GetTplContent(c.GetUserId(), themeId, filename)
|
||||
|
||||
|
||||
return c.RenderJson(re)
|
||||
}
|
||||
func (c MemberBlog) UpdateTplContent(themeId, filename, content string) revel.Result {
|
||||
re := info.NewRe()
|
||||
re.Ok, re.Msg = themeService.UpdateTplContent(c.GetUserId(), themeId, filename, content)
|
||||
return c.RenderJson(re)
|
||||
return c.RenderRe(re)
|
||||
}
|
||||
|
||||
func (c MemberBlog) DeleteTpl(themeId, filename string) revel.Result {
|
||||
@@ -331,7 +330,7 @@ func (c MemberBlog) DeleteThemeImage(themeId, filename string) revel.Result {
|
||||
|
||||
// 上传主题图片
|
||||
func (c MemberBlog) UploadThemeImage(themeId string) revel.Result {
|
||||
re := c.uploadImage(themeId);
|
||||
re := c.uploadImage(themeId)
|
||||
c.RenderArgs["fileUrlPath"] = re.Id
|
||||
c.RenderArgs["resultCode"] = re.Code
|
||||
c.RenderArgs["resultMsg"] = re.Msg
|
||||
@@ -339,17 +338,17 @@ func (c MemberBlog) UploadThemeImage(themeId string) revel.Result {
|
||||
}
|
||||
func (c MemberBlog) uploadImage(themeId string) (re info.Re) {
|
||||
var fileId = ""
|
||||
var resultCode = 0 // 1表示正常
|
||||
var resultCode = 0 // 1表示正常
|
||||
var resultMsg = "内部错误" // 错误信息
|
||||
var Ok = false
|
||||
|
||||
|
||||
defer func() {
|
||||
re.Id = fileId // 只是id, 没有其它信息
|
||||
re.Code = resultCode
|
||||
re.Msg = resultMsg
|
||||
re.Ok = Ok
|
||||
}()
|
||||
|
||||
|
||||
file, handel, err := c.Request.FormFile("file")
|
||||
if err != nil {
|
||||
return re
|
||||
@@ -363,11 +362,11 @@ func (c MemberBlog) uploadImage(themeId string) (re info.Re) {
|
||||
}
|
||||
// 生成新的文件名
|
||||
filename := handel.Filename
|
||||
|
||||
var ext string;
|
||||
|
||||
|
||||
var ext string
|
||||
|
||||
_, ext = SplitFilename(filename)
|
||||
if(ext != ".gif" && ext != ".jpg" && ext != ".png" && ext != ".bmp" && ext != ".jpeg") {
|
||||
if ext != ".gif" && ext != ".jpg" && ext != ".png" && ext != ".bmp" && ext != ".jpeg" {
|
||||
resultMsg = "不是图片"
|
||||
return re
|
||||
}
|
||||
@@ -378,15 +377,15 @@ func (c MemberBlog) uploadImage(themeId string) (re info.Re) {
|
||||
LogJ(err)
|
||||
return re
|
||||
}
|
||||
|
||||
|
||||
// > 2M?
|
||||
if(len(data) > 5 * 1024 * 1024) {
|
||||
if len(data) > 5*1024*1024 {
|
||||
resultCode = 0
|
||||
resultMsg = "图片大于2M"
|
||||
return re
|
||||
}
|
||||
|
||||
toPath := dir + "/" + filename;
|
||||
|
||||
toPath := dir + "/" + filename
|
||||
err = ioutil.WriteFile(toPath, data, 0777)
|
||||
if err != nil {
|
||||
LogJ(err)
|
||||
@@ -395,7 +394,7 @@ func (c MemberBlog) uploadImage(themeId string) (re info.Re) {
|
||||
TransToGif(toPath, 0, true)
|
||||
resultCode = 1
|
||||
resultMsg = "上传成功!"
|
||||
|
||||
|
||||
return re
|
||||
}
|
||||
|
||||
@@ -406,18 +405,21 @@ func (c MemberBlog) ActiveTheme(themeId string) revel.Result {
|
||||
re.Ok = themeService.ActiveTheme(c.GetUserId(), themeId)
|
||||
return c.RenderJson(re)
|
||||
}
|
||||
|
||||
// 删除主题
|
||||
func (c MemberBlog) DeleteTheme(themeId string) revel.Result {
|
||||
re := info.NewRe()
|
||||
re.Ok = themeService.DeleteTheme(c.GetUserId(), themeId)
|
||||
return c.RenderJson(re)
|
||||
}
|
||||
|
||||
// 管理员公开主题
|
||||
func (c MemberBlog) PublicTheme(themeId string) revel.Result {
|
||||
re := info.NewRe()
|
||||
re.Ok = themeService.PublicTheme(c.GetUserId(), themeId)
|
||||
return c.RenderJson(re)
|
||||
}
|
||||
|
||||
// 导出
|
||||
func (c MemberBlog) ExportTheme(themeId string) revel.Result {
|
||||
re := info.NewRe()
|
||||
@@ -427,21 +429,21 @@ func (c MemberBlog) ExportTheme(themeId string) revel.Result {
|
||||
return c.RenderText("error...")
|
||||
}
|
||||
fw, err := os.Open(path)
|
||||
if err != nil {
|
||||
if err != nil {
|
||||
return c.RenderText("error")
|
||||
}
|
||||
return c.RenderBinary(fw, GetFilename(path), revel.Attachment, time.Now()) // revel.Attachment
|
||||
}
|
||||
return c.RenderBinary(fw, GetFilename(path), revel.Attachment, time.Now()) // revel.Attachment
|
||||
}
|
||||
|
||||
// 导入主题
|
||||
func (c MemberBlog) ImportTheme() revel.Result {
|
||||
re := info.NewRe()
|
||||
|
||||
|
||||
file, handel, err := c.Request.FormFile("file")
|
||||
if err != nil {
|
||||
re.Msg = fmt.Sprintf("%v", err)
|
||||
return c.RenderJson(re)
|
||||
|
||||
|
||||
}
|
||||
defer file.Close()
|
||||
// 生成上传路径
|
||||
@@ -454,10 +456,10 @@ func (c MemberBlog) ImportTheme() revel.Result {
|
||||
}
|
||||
// 生成新的文件名
|
||||
filename := handel.Filename
|
||||
|
||||
var ext string;
|
||||
|
||||
var ext string
|
||||
_, ext = SplitFilename(filename)
|
||||
if(ext != ".zip") {
|
||||
if ext != ".zip" {
|
||||
re.Msg = "请上传zip文件"
|
||||
return c.RenderJson(re)
|
||||
}
|
||||
@@ -467,40 +469,40 @@ func (c MemberBlog) ImportTheme() revel.Result {
|
||||
if err != nil {
|
||||
return c.RenderJson(re)
|
||||
}
|
||||
|
||||
|
||||
// > 10M?
|
||||
if(len(data) > 10 * 1024 * 1024) {
|
||||
if len(data) > 10*1024*1024 {
|
||||
re.Msg = "文件大于10M"
|
||||
return c.RenderJson(re)
|
||||
}
|
||||
|
||||
toPath := dir + "/" + filename;
|
||||
|
||||
toPath := dir + "/" + filename
|
||||
err = ioutil.WriteFile(toPath, data, 0777)
|
||||
if err != nil {
|
||||
re.Msg = fmt.Sprintf("%v", err)
|
||||
return c.RenderJson(re)
|
||||
}
|
||||
|
||||
|
||||
// 上传好后, 增加之
|
||||
themeService.ImportTheme(c.GetUserId(), toPath)
|
||||
|
||||
re.Ok = true
|
||||
return c.RenderJson(re)
|
||||
re.Ok, re.Msg = themeService.ImportTheme(c.GetUserId(), toPath)
|
||||
return c.RenderRe(re)
|
||||
}
|
||||
|
||||
|
||||
// 安装
|
||||
func (c MemberBlog) InstallTheme(themeId string) revel.Result {
|
||||
re := info.NewRe()
|
||||
re.Ok = themeService.InstallTheme(c.GetUserId(), themeId)
|
||||
return c.RenderJson(re)
|
||||
}
|
||||
|
||||
// 新建主题
|
||||
func (c MemberBlog) NewTheme() revel.Result {
|
||||
_, themeId := themeService.NewTheme(c.GetUserId())
|
||||
return c.Redirect("/member/blog/updateTheme?isNew=1&themeId=" + themeId)
|
||||
}
|
||||
|
||||
//-----------
|
||||
//
|
||||
//
|
||||
func (c MemberBlog) SetUserBlogBase(userBlog info.UserBlogBase) revel.Result {
|
||||
re := info.NewRe()
|
||||
re.Ok = blogService.UpdateUserBlogBase(c.GetUserId(), userBlog)
|
||||
@@ -516,6 +518,7 @@ func (c MemberBlog) SetUserBlogStyle(userBlog info.UserBlogStyle) revel.Result {
|
||||
re.Ok = blogService.UpdateUserBlogStyle(c.GetUserId(), userBlog)
|
||||
return c.RenderJson(re)
|
||||
}
|
||||
|
||||
func (c MemberBlog) SetUserBlogPaging(perPageSize int, sortField string, isAsc bool) revel.Result {
|
||||
re := info.NewRe()
|
||||
re.Ok, re.Msg = blogService.UpdateUserBlogPaging(c.GetUserId(), perPageSize, sortField, isAsc)
|
||||
|
||||
@@ -35,7 +35,7 @@ func (c MemberGroup) UpdateGroupTitle(groupId, title string) revel.Result {
|
||||
func (c MemberGroup) DeleteGroup(groupId string) revel.Result {
|
||||
re := info.NewRe()
|
||||
re.Ok, re.Msg = groupService.DeleteGroup(c.GetUserId(), groupId)
|
||||
return c.RenderJson(re)
|
||||
return c.RenderRe(re)
|
||||
}
|
||||
|
||||
// 添加用户
|
||||
|
||||
@@ -128,6 +128,7 @@ func init() {
|
||||
revel.InterceptFunc(AuthInterceptor, revel.BEFORE, &MemberIndex{})
|
||||
revel.InterceptFunc(AuthInterceptor, revel.BEFORE, &MemberUser{})
|
||||
revel.InterceptFunc(AuthInterceptor, revel.BEFORE, &MemberBlog{})
|
||||
revel.InterceptFunc(AuthInterceptor, revel.BEFORE, &MemberGroup{})
|
||||
revel.OnAppStart(func() {
|
||||
})
|
||||
}
|
||||
}
|
||||
+10
-5
@@ -3,6 +3,7 @@ package db
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/revel/revel"
|
||||
. "github.com/leanote/leanote/app/lea"
|
||||
"gopkg.in/mgo.v2"
|
||||
"gopkg.in/mgo.v2/bson"
|
||||
)
|
||||
@@ -56,12 +57,15 @@ var Themes *mgo.Collection
|
||||
var Sessions *mgo.Collection
|
||||
|
||||
// 初始化时连接数据库
|
||||
func Init() {
|
||||
var url string
|
||||
var ok bool
|
||||
func Init(url, dbname string) {
|
||||
ok := true
|
||||
config := revel.Config
|
||||
url, ok = config.String("db.url")
|
||||
dbname, _ := config.String("db.dbname")
|
||||
if url == "" {
|
||||
url, ok = config.String("db.url")
|
||||
}
|
||||
if dbname == "" {
|
||||
dbname, _ = config.String("db.dbname")
|
||||
}
|
||||
if !ok {
|
||||
host, _ := revel.Config.String("db.host")
|
||||
port, _ := revel.Config.String("db.port")
|
||||
@@ -73,6 +77,7 @@ func Init() {
|
||||
}
|
||||
url = "mongodb://" + usernameAndPassword + host + ":" + port + "/" + dbname
|
||||
}
|
||||
Log(url)
|
||||
|
||||
// [mongodb://][user:pass@]host1[:port1][,host2[:port2],...][/database][?options]
|
||||
// mongodb://myuser:mypass@localhost:40001,otherhost:40001/mydb
|
||||
|
||||
@@ -41,7 +41,7 @@ type User struct {
|
||||
ImageSize int `bson:"ImageSize" json:"-"` // 图片大小
|
||||
AttachNum int `bson:"AttachNum" json:"-"` // 附件数量
|
||||
AttachSize int `bson:"AttachSize" json:"-"` // 附件大小
|
||||
PerAttachSize int `bson:"PerAttachSize" json:"-"` // 单个附件大小
|
||||
FromUserId bson.ObjectId `FromUserId,omitempty` // 邀请的用户
|
||||
|
||||
AccountType string `bson:"AccountType" json:"-"` // normal(为空), premium
|
||||
AccountStartTime time.Time `bson:"AccountStartTime" json:"-"` // 开始日期
|
||||
|
||||
+180
-130
@@ -1,67 +1,66 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/revel/revel"
|
||||
. "github.com/leanote/leanote/app/lea"
|
||||
"github.com/leanote/leanote/app/service"
|
||||
"github.com/leanote/leanote/app/db"
|
||||
"github.com/leanote/leanote/app/controllers"
|
||||
"github.com/leanote/leanote/app/controllers/admin"
|
||||
"github.com/leanote/leanote/app/controllers/member"
|
||||
"github.com/leanote/leanote/app/db"
|
||||
. "github.com/leanote/leanote/app/lea"
|
||||
_ "github.com/leanote/leanote/app/lea/binder"
|
||||
"github.com/leanote/leanote/app/lea/session"
|
||||
"github.com/leanote/leanote/app/lea/memcache"
|
||||
"github.com/leanote/leanote/app/lea/route"
|
||||
"github.com/leanote/leanote/app/lea/session"
|
||||
"github.com/leanote/leanote/app/service"
|
||||
"github.com/revel/revel"
|
||||
"reflect"
|
||||
"fmt"
|
||||
"html/template"
|
||||
"math"
|
||||
"net/url"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"strings"
|
||||
"strconv"
|
||||
"time"
|
||||
"encoding/json"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
func init() {
|
||||
// Filters is the default set of global filters.
|
||||
revel.Filters = []revel.Filter{
|
||||
revel.PanicFilter, // Recover from panics and display an error page instead.
|
||||
revel.PanicFilter, // Recover from panics and display an error page instead.
|
||||
route.RouterFilter,
|
||||
// revel.RouterFilter, // Use the routing table to select the right Action
|
||||
// AuthFilter, // Invoke the action.
|
||||
revel.FilterConfiguringFilter, // A hook for adding or removing per-Action filters.
|
||||
revel.ParamsFilter, // Parse parameters into Controller.Params.
|
||||
// revel.SessionFilter, // Restore and write the session cookie.
|
||||
|
||||
|
||||
// 使用SessionFilter标准版从cookie中得到sessionID, 然后通过MssessionFilter从Memcache中得到
|
||||
// session, 之后MSessionFilter将session只存sessionID然后返回给SessionFilter返回到web
|
||||
session.SessionFilter, // leanote session
|
||||
// session.MSessionFilter, // leanote memcache session
|
||||
|
||||
revel.FlashFilter, // Restore and write the flash cookie.
|
||||
revel.ValidationFilter, // Restore kept validation errors and save new ones from cookie.
|
||||
revel.I18nFilter, // Resolve the requested language
|
||||
revel.InterceptorFilter, // Run interceptors around the action.
|
||||
revel.CompressFilter, // Compress the result.
|
||||
revel.ActionInvoker, // Invoke the action.
|
||||
session.SessionFilter, // leanote session
|
||||
// session.MSessionFilter, // leanote memcache session
|
||||
|
||||
revel.FlashFilter, // Restore and write the flash cookie.
|
||||
revel.ValidationFilter, // Restore kept validation errors and save new ones from cookie.
|
||||
revel.I18nFilter, // Resolve the requested language
|
||||
revel.InterceptorFilter, // Run interceptors around the action.
|
||||
revel.CompressFilter, // Compress the result.
|
||||
revel.ActionInvoker, // Invoke the action.
|
||||
}
|
||||
|
||||
//自定义模版函数
|
||||
|
||||
revel.TemplateFuncs["raw"] = func(str string) template.HTML {
|
||||
return template.HTML(str)
|
||||
}
|
||||
revel.TemplateFuncs["add"] = func(i int) string {
|
||||
i = i + 1
|
||||
i = i + 1;
|
||||
return fmt.Sprintf("%v", i)
|
||||
}
|
||||
revel.TemplateFuncs["sub"] = func(i int) int {
|
||||
i = i - 1
|
||||
i = i - 1;
|
||||
return i
|
||||
}
|
||||
// 增加或减少
|
||||
revel.TemplateFuncs["incr"] = func(n, i int) int {
|
||||
n = n + i
|
||||
n = n + i;
|
||||
return n
|
||||
}
|
||||
revel.TemplateFuncs["join"] = func(arr []string) template.HTML {
|
||||
@@ -85,11 +84,11 @@ func init() {
|
||||
return v.Get("a")
|
||||
}
|
||||
revel.TemplateFuncs["json"] = func(i interface{}) string {
|
||||
b, _ := json.Marshal(i)
|
||||
b, _ := json.Marshal(i)
|
||||
return string(b)
|
||||
}
|
||||
revel.TemplateFuncs["jsonJs"] = func(i interface{}) template.JS {
|
||||
b, _ := json.Marshal(i)
|
||||
b, _ := json.Marshal(i)
|
||||
return template.JS(string(b))
|
||||
}
|
||||
revel.TemplateFuncs["datetime"] = func(t time.Time) template.HTML {
|
||||
@@ -103,15 +102,16 @@ func init() {
|
||||
t := time.Unix(int64(sec), 0)
|
||||
return template.HTML(t.Format("2006-01-02 15:04:05"))
|
||||
}
|
||||
|
||||
|
||||
// interface是否有该字段
|
||||
revel.TemplateFuncs["has"] = func(i interface{}, key string) bool {
|
||||
t := reflect.TypeOf(i)
|
||||
t := reflect.TypeOf(i)
|
||||
_, ok := t.FieldByName(key)
|
||||
return ok
|
||||
}
|
||||
|
||||
// tags
|
||||
// 2014/12/30 标签添加链接
|
||||
revel.TemplateFuncs["blogTags"] = func(renderArgs map[string]interface{}, tags []string) template.HTML {
|
||||
if tags == nil || len(tags) == 0 {
|
||||
return ""
|
||||
@@ -119,70 +119,120 @@ func init() {
|
||||
locale, _ := renderArgs[revel.CurrentLocaleRenderArg].(string)
|
||||
tagStr := ""
|
||||
lenTags := len(tags)
|
||||
|
||||
tagPostUrl, _ := renderArgs["tagPostsUrl"].(string)
|
||||
|
||||
for i, tag := range tags {
|
||||
str := revel.Message(locale, tag)
|
||||
var classes = "label"
|
||||
if strings.HasPrefix(str, "???") {
|
||||
str = tag
|
||||
}
|
||||
tagStr += str
|
||||
if i != lenTags-1 {
|
||||
if InArray([]string{"red", "blue", "yellow", "green"}, tag) {
|
||||
classes += " label-" + tag
|
||||
} else {
|
||||
classes += " label-default"
|
||||
}
|
||||
|
||||
classes += " label-post"
|
||||
var url = tagPostUrl + "/" + url.QueryEscape(tag)
|
||||
tagStr += "<a class=\"" + classes + "\" href=\"" + url + "\">" + str + "</a>";
|
||||
if i != lenTags - 1 {
|
||||
tagStr += " "
|
||||
}
|
||||
}
|
||||
return template.HTML(tagStr)
|
||||
}
|
||||
|
||||
// lea++
|
||||
revel.TemplateFuncs["blogTagsLea"] = func(renderArgs map[string]interface{}, tags []string, isRecommend bool) template.HTML {
|
||||
if tags == nil || len(tags) == 0 {
|
||||
return ""
|
||||
}
|
||||
locale, _ := renderArgs[revel.CurrentLocaleRenderArg].(string)
|
||||
tagStr := ""
|
||||
lenTags := len(tags)
|
||||
|
||||
tagPostUrl := "http://lea.leanote.com/"
|
||||
if isRecommend {
|
||||
tagPostUrl += "?tag=";
|
||||
} else {
|
||||
tagPostUrl += "latest?tag=";
|
||||
}
|
||||
|
||||
for i, tag := range tags {
|
||||
str := revel.Message(locale, tag)
|
||||
var classes = "label"
|
||||
if strings.HasPrefix(str, "???") {
|
||||
str = tag
|
||||
}
|
||||
if InArray([]string{"red", "blue", "yellow", "green"}, tag) {
|
||||
classes += " label-" + tag
|
||||
} else {
|
||||
classes += " label-default"
|
||||
}
|
||||
classes += " label-post"
|
||||
var url = tagPostUrl + url.QueryEscape(tag)
|
||||
tagStr += "<a class=\"" + classes + "\" href=\"" + url + "\">" + str + "</a>";
|
||||
if i != lenTags - 1 {
|
||||
tagStr += " "
|
||||
}
|
||||
}
|
||||
return template.HTML(tagStr)
|
||||
}
|
||||
|
||||
/*
|
||||
revel.TemplateFuncs["blogTags"] = func(tags []string) template.HTML {
|
||||
if tags == nil || len(tags) == 0 {
|
||||
return ""
|
||||
}
|
||||
// TODO 这里判断语言, 从语言包中拿
|
||||
tagMap := map[string]string{"red": "红色", "yellow": "黄色", "blue": "蓝色", "green": "绿色"}
|
||||
tagStr := ""
|
||||
lenTags := len(tags)
|
||||
for i, tag := range tags {
|
||||
if text, ok := tagMap[tag]; ok {
|
||||
tagStr += text
|
||||
} else {
|
||||
tagStr += tag
|
||||
}
|
||||
if i != lenTags - 1 {
|
||||
tagStr += ","
|
||||
}
|
||||
}
|
||||
return template.HTML(tagStr)
|
||||
}
|
||||
/*
|
||||
revel.TemplateFuncs["blogTags"] = func(tags []string) template.HTML {
|
||||
if tags == nil || len(tags) == 0 {
|
||||
return ""
|
||||
}
|
||||
// TODO 这里判断语言, 从语言包中拿
|
||||
tagMap := map[string]string{"red": "红色", "yellow": "黄色", "blue": "蓝色", "green": "绿色"}
|
||||
tagStr := ""
|
||||
lenTags := len(tags)
|
||||
for i, tag := range tags {
|
||||
if text, ok := tagMap[tag]; ok {
|
||||
tagStr += text
|
||||
} else {
|
||||
tagStr += tag
|
||||
}
|
||||
if i != lenTags - 1 {
|
||||
tagStr += ","
|
||||
}
|
||||
}
|
||||
return template.HTML(tagStr)
|
||||
}
|
||||
*/
|
||||
revel.TemplateFuncs["li"] = func(a string) string {
|
||||
return ""
|
||||
}
|
||||
// str连接
|
||||
revel.TemplateFuncs["urlConcat"] = func(url string, v ...interface{}) string {
|
||||
revel.TemplateFuncs["urlConcat"] = func(url string, v... interface{}) string {
|
||||
html := ""
|
||||
for i := 0; i < len(v); i = i + 2 {
|
||||
item := v[i]
|
||||
if i+1 == len(v) {
|
||||
break
|
||||
break;
|
||||
}
|
||||
value := v[i+1]
|
||||
if item != nil && value != nil {
|
||||
keyStr, _ := item.(string)
|
||||
valueStr, err := value.(string)
|
||||
if !err {
|
||||
valueInt, _ := value.(int)
|
||||
valueStr = strconv.Itoa(valueInt)
|
||||
}
|
||||
if keyStr != "" && valueStr != "" {
|
||||
s := keyStr + "=" + valueStr
|
||||
if html != "" {
|
||||
html += "&" + s
|
||||
} else {
|
||||
html += s
|
||||
}
|
||||
}
|
||||
}
|
||||
keyStr, _ := item.(string)
|
||||
valueStr, err := value.(string)
|
||||
if !err {
|
||||
valueInt, _ := value.(int)
|
||||
valueStr = strconv.Itoa(valueInt)
|
||||
}
|
||||
if keyStr != "" && valueStr != "" {
|
||||
s := keyStr + "=" + valueStr
|
||||
if html != "" {
|
||||
html += "&" + s
|
||||
} else {
|
||||
html += s
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if html != "" {
|
||||
if strings.Index(url, "?") >= 0 {
|
||||
return url + "&" + html
|
||||
@@ -192,11 +242,11 @@ func init() {
|
||||
}
|
||||
return url
|
||||
}
|
||||
|
||||
|
||||
revel.TemplateFuncs["urlCond"] = func(url string, sorterI, keyords interface{}) template.HTML {
|
||||
return ""
|
||||
}
|
||||
|
||||
|
||||
// http://stackoverflow.com/questions/14226416/go-lang-templates-always-quotes-a-string-and-removes-comments
|
||||
revel.TemplateFuncs["rawMsg"] = func(renderArgs map[string]interface{}, message string, args ...interface{}) template.JS {
|
||||
str, ok := renderArgs[revel.CurrentLocaleRenderArg].(string)
|
||||
@@ -205,38 +255,38 @@ func init() {
|
||||
}
|
||||
return template.JS(revel.Message(str, message, args...))
|
||||
}
|
||||
|
||||
|
||||
// 为后台管理sorter th使用
|
||||
// 必须要返回HTMLAttr, 返回html, golang 会执行安全检查返回ZgotmplZ
|
||||
// sorterI 可能是nil, 所以用interfalce{}来接收
|
||||
/*
|
||||
data-url="/adminUser/index"
|
||||
data-sorter="email"
|
||||
class="th-sortable {{if eq .sorter "email-up"}}th-sort-up{{else}}{{if eq .sorter "email-down"}}th-sort-down{{end}}{{end}}"
|
||||
data-url="/adminUser/index"
|
||||
data-sorter="email"
|
||||
class="th-sortable {{if eq .sorter "email-up"}}th-sort-up{{else}}{{if eq .sorter "email-down"}}th-sort-down{{end}}{{end}}"
|
||||
*/
|
||||
revel.TemplateFuncs["sorterTh"] = func(url, sorterField string, sorterI interface{}) template.HTMLAttr {
|
||||
sorter := ""
|
||||
if sorterI != nil {
|
||||
sorter, _ = sorterI.(string)
|
||||
}
|
||||
html := "data-url=\"" + url + "\" data-sorter=\"" + sorterField + "\""
|
||||
html += " class=\"th-sortable "
|
||||
if sorter == sorterField+"-up" {
|
||||
html += "th-sort-up\""
|
||||
} else if sorter == sorterField+"-down" {
|
||||
html += "th-sort-down"
|
||||
html := "data-url=\"" + url + "\" data-sorter=\"" + sorterField + "\"";
|
||||
html += " class=\"th-sortable ";
|
||||
if sorter == sorterField + "-up" {
|
||||
html += "th-sort-up\"";
|
||||
} else if(sorter == sorterField + "-down") {
|
||||
html += "th-sort-down";
|
||||
}
|
||||
html += "\""
|
||||
html += "\"";
|
||||
return template.HTMLAttr(html)
|
||||
}
|
||||
|
||||
|
||||
// pagination
|
||||
revel.TemplateFuncs["page"] = func(urlBase string, page, pageSize, count int) template.HTML {
|
||||
if count == 0 {
|
||||
return ""
|
||||
return "";
|
||||
}
|
||||
totalPage := int(math.Ceil(float64(count) / float64(pageSize)))
|
||||
|
||||
totalPage := int(math.Ceil(float64(count)/float64(pageSize)))
|
||||
|
||||
preClass := ""
|
||||
prePage := page - 1
|
||||
if prePage == 0 {
|
||||
@@ -245,10 +295,10 @@ func init() {
|
||||
nextClass := ""
|
||||
nextPage := page + 1
|
||||
var preUrl, nextUrl string
|
||||
|
||||
preUrl = urlBase + "?page=" + strconv.Itoa(prePage)
|
||||
|
||||
preUrl = urlBase + "?page=" + strconv.Itoa(prePage)
|
||||
nextUrl = urlBase + "?page=" + strconv.Itoa(nextPage)
|
||||
|
||||
|
||||
// 没有上一页了
|
||||
if page == 1 {
|
||||
preClass = "disabled"
|
||||
@@ -266,53 +316,53 @@ func init() {
|
||||
// http://play.golang.org/p/snygrVpQva
|
||||
// http://grokbase.com/t/gg/golang-nuts/142a6dhfh3/go-nuts-text-template-using-comparison-operators-eq-gt-etc-on-non-existent-variable-causes-the-template-to-stop-outputting-but-with-no-error-correct-behaviour
|
||||
/*
|
||||
revel.TemplateFuncs["gt"] = func(a1, a2 interface{}) bool {
|
||||
switch a1.(type) {
|
||||
revel.TemplateFuncs["gt"] = func(a1, a2 interface{}) bool {
|
||||
switch a1.(type) {
|
||||
case string:
|
||||
switch a2.(type) {
|
||||
case string:
|
||||
switch a2.(type) {
|
||||
case string:
|
||||
return reflect.ValueOf(a1).String() > reflect.ValueOf(a2).String()
|
||||
}
|
||||
return reflect.ValueOf(a1).String() > reflect.ValueOf(a2).String()
|
||||
}
|
||||
case int, int8, int16, int32, int64:
|
||||
switch a2.(type) {
|
||||
case int, int8, int16, int32, int64:
|
||||
switch a2.(type) {
|
||||
case int, int8, int16, int32, int64:
|
||||
return reflect.ValueOf(a1).Int() > reflect.ValueOf(a2).Int()
|
||||
}
|
||||
return reflect.ValueOf(a1).Int() > reflect.ValueOf(a2).Int()
|
||||
}
|
||||
case uint, uint8, uint16, uint32, uint64:
|
||||
switch a2.(type) {
|
||||
case uint, uint8, uint16, uint32, uint64:
|
||||
switch a2.(type) {
|
||||
case uint, uint8, uint16, uint32, uint64:
|
||||
return reflect.ValueOf(a1).Uint() > reflect.ValueOf(a2).Uint()
|
||||
}
|
||||
return reflect.ValueOf(a1).Uint() > reflect.ValueOf(a2).Uint()
|
||||
}
|
||||
case float32, float64:
|
||||
switch a2.(type) {
|
||||
case float32, float64:
|
||||
switch a2.(type) {
|
||||
case float32, float64:
|
||||
return reflect.ValueOf(a1).Float() > reflect.ValueOf(a2).Float()
|
||||
}
|
||||
return reflect.ValueOf(a1).Float() > reflect.ValueOf(a2).Float()
|
||||
}
|
||||
return false
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
{{range $i := N 1 10}}
|
||||
<div>{{$i}}</div>
|
||||
{{end}}
|
||||
*/
|
||||
revel.TemplateFuncs["N"] = func(start, end int) (stream chan int) {
|
||||
stream = make(chan int)
|
||||
go func() {
|
||||
for i := start; i <= end; i++ {
|
||||
stream <- i
|
||||
}
|
||||
close(stream)
|
||||
}()
|
||||
return
|
||||
return false
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
{{range $i := N 1 10}}
|
||||
<div>{{$i}}</div>
|
||||
{{end}}
|
||||
*/
|
||||
revel.TemplateFuncs["N"] = func(start, end int) (stream chan int) {
|
||||
stream = make(chan int)
|
||||
go func() {
|
||||
for i := start; i <= end; i++ {
|
||||
stream <- i
|
||||
}
|
||||
close(stream)
|
||||
}()
|
||||
return
|
||||
}
|
||||
|
||||
// init Email
|
||||
revel.OnAppStart(func() {
|
||||
// 数据库
|
||||
db.Init()
|
||||
db.Init("", "")
|
||||
// email配置
|
||||
InitEmail()
|
||||
InitVd()
|
||||
@@ -323,5 +373,5 @@ func init() {
|
||||
admin.InitService()
|
||||
member.InitService()
|
||||
service.ConfigS.InitGlobalConfigs()
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
+12
-1
@@ -3,6 +3,7 @@ package lea
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/revel/revel"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func Log(i interface{}) {
|
||||
@@ -12,4 +13,14 @@ func Log(i interface{}) {
|
||||
func LogJ(i interface{}) {
|
||||
b, _ := json.MarshalIndent(i, "", " ")
|
||||
revel.INFO.Println(string(b))
|
||||
}
|
||||
}
|
||||
|
||||
// 为test用
|
||||
func L(i interface{}) {
|
||||
fmt.Println(i)
|
||||
}
|
||||
|
||||
func LJ(i interface{}) {
|
||||
b, _ := json.MarshalIndent(i, "", " ")
|
||||
fmt.Println(string(b))
|
||||
}
|
||||
+24
-8
@@ -7,6 +7,7 @@ import (
|
||||
"io/ioutil"
|
||||
"strings"
|
||||
)
|
||||
|
||||
/*
|
||||
用golang exec 总是说找不到uglifyjs命令, 需要全部路径
|
||||
而且node, npm要在/usr/bin下, 已建ln
|
||||
@@ -31,7 +32,7 @@ import (
|
||||
//var jss = []string{"js/jquery-cookie", "js/bootstrap"}
|
||||
var jss = []string{"js/jquery-cookie", "js/bootstrap",
|
||||
"js/common", "js/app/note", "js/app/tag", "js/app/notebook", "js/app/share",
|
||||
"js/object_id", "js/ZeroClipboard/ZeroClipboard"}
|
||||
"js/object_id"}
|
||||
|
||||
var base1 = "/Users/life/Documents/Go/package2/src/github.com/leanote/leanote/"
|
||||
var base = "/Users/life/Documents/Go/package2/src/github.com/leanote/leanote/public/"
|
||||
@@ -52,7 +53,7 @@ func compressJs(filename string) {
|
||||
to := base + filename + "-min.js"
|
||||
cmd := exec.Command(cmdPath, source, "-o", to)
|
||||
_, err := cmd.CombinedOutput()
|
||||
|
||||
fmt.Println(source);
|
||||
cmdError(err)
|
||||
}
|
||||
|
||||
@@ -80,7 +81,10 @@ func combineJs() {
|
||||
// 改note-dev->note
|
||||
func dev() {
|
||||
// 即替换note.js->note-min.js
|
||||
m := map[string]string{"note.js": "note-min.js",
|
||||
m := map[string]string{"tinymce.dev.js": "tinymce.min.js",
|
||||
"tinymce.js": "tinymce.min.js",
|
||||
"jquery.ztree.all-3.5.js": "jquery.ztree.all-3.5-min.js",
|
||||
"note.js": "note-min.js",
|
||||
"app.js": "app-min.js",
|
||||
"page.js": "page-min.js",
|
||||
"common.js": "common-min.js",
|
||||
@@ -88,6 +92,7 @@ func dev() {
|
||||
"share.js": "share-min.js",
|
||||
"tag.js": "tag-min.js",
|
||||
"main.js": "main-min.js",
|
||||
"jquery.slimscroll.js": "jquery.slimscroll-min.js",
|
||||
"jquery.contextmenu.js": "jquery.contextmenu-min.js",
|
||||
"editor/editor.js": "editor/editor-min.js",
|
||||
"/public/mdeditor/editor/scrollLink.js": "/public/mdeditor/editor/scrollLink-min.js",
|
||||
@@ -111,12 +116,21 @@ func tinymce() {
|
||||
// cmd := exec.Command("/Users/life/Documents/eclipse-workspace/go/leanote_release/tinymce-master/node_modules/jake/bin/cli.js", "minify", "bundle[themes:modern,plugins:table,paste,advlist,autolink,link,image,lists,charmap,hr,searchreplace,visualblocks,visualchars,code,nav,tabfocus,contextmenu,directionality,codemirror,codesyntax,textcolor,fullpage]")
|
||||
cmd := exec.Command("/Users/life/Documents/eclipse-workspace/go/leanote_release/tinymce-master/node_modules/jake/bin/cli.js", "minify")
|
||||
cmd.Dir = "/Users/life/Documents/eclipse-workspace/go/leanote_release/tinymce-master"
|
||||
c, err := cmd.CombinedOutput()
|
||||
|
||||
// 必须要先删除
|
||||
cmd2 := exec.Command("/bin/sh", "-c", "rm " + cmd.Dir + "/js/tinymce/tinymce.dev.js")
|
||||
cmd2.CombinedOutput()
|
||||
cmd2 = exec.Command("/bin/sh", "-c", "rm " + cmd.Dir + "/js/tinymce/tinymce.jquery.dev.js")
|
||||
c, _ := cmd2.CombinedOutput()
|
||||
fmt.Println(string(c))
|
||||
c, _ = cmd.CombinedOutput()
|
||||
fmt.Println(string(c))
|
||||
cmdError(err)
|
||||
}
|
||||
|
||||
func main() {
|
||||
// 压缩tinymce
|
||||
tinymce()
|
||||
|
||||
dev();
|
||||
|
||||
// 其它零散的需要压缩的js
|
||||
@@ -133,6 +147,10 @@ func main() {
|
||||
"mdeditor/editor/underscore",
|
||||
"mdeditor/editor/mathJax",
|
||||
"js/jQuery-slimScroll-1.3.0/jquery.slimscroll",
|
||||
"js/app/editor_drop_paste",
|
||||
"js/app/attachment_upload",
|
||||
"js/jquery.ztree.all-3.5",
|
||||
"js/jQuery-slimScroll-1.3.0/jquery.slimscroll",
|
||||
}
|
||||
|
||||
for _, js := range otherJss {
|
||||
@@ -141,7 +159,5 @@ func main() {
|
||||
|
||||
// 先压缩后合并
|
||||
combineJs()
|
||||
|
||||
// 压缩tinymce
|
||||
tinymce()
|
||||
|
||||
}
|
||||
@@ -15,16 +15,16 @@ type AttachService struct {
|
||||
}
|
||||
|
||||
// add attach
|
||||
func (this *AttachService) AddAttach(attach info.Attach) bool {
|
||||
func (this *AttachService) AddAttach(attach info.Attach) (ok bool, msg string) {
|
||||
attach.CreatedTime = time.Now()
|
||||
ok := db.Insert(db.Attachs, attach)
|
||||
ok = db.Insert(db.Attachs, attach)
|
||||
|
||||
if ok {
|
||||
// 更新笔记的attachs num
|
||||
this.updateNoteAttachNum(attach.NoteId, 1)
|
||||
}
|
||||
|
||||
return ok
|
||||
return
|
||||
}
|
||||
|
||||
// 更新笔记的附件个数
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
// "github.com/leanote/leanote/app/db"
|
||||
"github.com/leanote/leanote/app/info"
|
||||
// "github.com/revel/revel"
|
||||
"strings"
|
||||
. "github.com/leanote/leanote/app/lea"
|
||||
"fmt"
|
||||
"strconv"
|
||||
@@ -17,6 +18,8 @@ type AuthService struct {
|
||||
|
||||
// pwd已md5了
|
||||
func (this *AuthService) Login(emailOrUsername, pwd string) info.User {
|
||||
emailOrUsername = strings.Trim(emailOrUsername, " ")
|
||||
// pwd = strings.Trim(pwd, " ")
|
||||
userInfo := userService.LoginGetUserInfo(emailOrUsername, Md5(pwd))
|
||||
return userInfo
|
||||
}
|
||||
@@ -32,12 +35,16 @@ func (this *AuthService) Login(emailOrUsername, pwd string) info.User {
|
||||
// 1. 添加用户
|
||||
// 2. 将leanote共享给我
|
||||
// [ok]
|
||||
func (this *AuthService) Register(email, pwd string) (bool, string) {
|
||||
func (this *AuthService) Register(email, pwd, fromUserId string) (bool, string) {
|
||||
// 用户是否已存在
|
||||
if userService.IsExistsUser(email) {
|
||||
return false, "userHasBeenRegistered-" + email
|
||||
}
|
||||
user := info.User{UserId: bson.NewObjectId(), Email: email, Username: email, Pwd: Md5(pwd)}
|
||||
if fromUserId != "" && IsObjectId(fromUserId) {
|
||||
user.FromUserId = bson.ObjectIdHex(fromUserId)
|
||||
}
|
||||
LogJ(user)
|
||||
return this.register(user)
|
||||
}
|
||||
|
||||
@@ -129,4 +136,4 @@ func (this *AuthService) ThirdRegister(thirdType, thirdUserId, thirdUsername str
|
||||
}
|
||||
_, _ = this.register(userInfo)
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ type FileService struct {
|
||||
}
|
||||
|
||||
// add Image
|
||||
func (this *FileService) AddImage(image info.File, albumId, userId string) bool {
|
||||
func (this *FileService) AddImage(image info.File, albumId, userId string, needCheckSize bool) (ok bool, msg string) {
|
||||
image.CreatedTime = time.Now()
|
||||
if albumId != "" {
|
||||
image.AlbumId = bson.ObjectIdHex(albumId)
|
||||
@@ -27,7 +27,8 @@ func (this *FileService) AddImage(image info.File, albumId, userId string) bool
|
||||
}
|
||||
image.UserId = bson.ObjectIdHex(userId)
|
||||
|
||||
return db.Insert(db.Files, image)
|
||||
ok = db.Insert(db.Files, image)
|
||||
return
|
||||
}
|
||||
|
||||
// list images
|
||||
@@ -147,7 +148,16 @@ func (this *FileService) GetFile(userId, fileId string) string {
|
||||
return path
|
||||
}
|
||||
|
||||
// 2014/12/28 修复, 如果是分享给用户组, 那就不行, 这里可以实现
|
||||
for _, noteId := range noteIds {
|
||||
note := noteService.GetNoteById(noteId.Hex())
|
||||
if shareService.HasReadPerm(note.UserId.Hex(), userId, noteId.Hex()) {
|
||||
return path;
|
||||
}
|
||||
}
|
||||
/*
|
||||
// 若有共享给我的笔记?
|
||||
// 对该笔记可读?
|
||||
if db.Has(db.ShareNotes, bson.M{"ToUserId": bson.ObjectIdHex(userId), "NoteId": bson.M{"$in": noteIds}}) {
|
||||
return path
|
||||
}
|
||||
@@ -166,6 +176,7 @@ func (this *FileService) GetFile(userId, fileId string) string {
|
||||
return path
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
// 可能是刚复制到owner上, 但内容又没有保存, 所以没有note->imageId的映射, 此时看是否有fromFileId
|
||||
@@ -222,7 +233,7 @@ func (this *FileService) CopyImage(userId, fileId, toUserId string) (bool, strin
|
||||
id := bson.NewObjectId();
|
||||
fileInfo.FileId = id
|
||||
fileId = id.Hex()
|
||||
Ok := this.AddImage(fileInfo, "", toUserId)
|
||||
Ok, _ := this.AddImage(fileInfo, "", toUserId, false)
|
||||
|
||||
if Ok {
|
||||
return Ok, id.Hex()
|
||||
|
||||
@@ -27,9 +27,12 @@ func (this *GroupService) AddGroup(userId, title string) (bool, info.Group) {
|
||||
// 删除分组
|
||||
// 判断是否有好友
|
||||
func (this *GroupService) DeleteGroup(userId, groupId string) (ok bool, msg string) {
|
||||
/*
|
||||
if db.Has(db.GroupUsers, bson.M{"GroupId": bson.ObjectIdHex(groupId)}) {
|
||||
return false, "hasUsers"
|
||||
return false, "groupHasUsers"
|
||||
}
|
||||
*/
|
||||
db.DeleteAll(db.GroupUsers, bson.M{"GroupId": bson.ObjectIdHex(groupId)})
|
||||
return db.DeleteByIdAndUserId(db.Groups, groupId, userId), ""
|
||||
|
||||
// TODO 删除分组后, 在shareNote, shareNotebook中也要删除
|
||||
|
||||
@@ -33,7 +33,8 @@ func (this *NoteContentHistoryService) AddHistory(noteId, userId string, eachHis
|
||||
// TODO
|
||||
l := len(history.Histories)
|
||||
if l >= maxSize {
|
||||
history.Histories = history.Histories[l-maxSize:]
|
||||
// history.Histories = history.Histories[l-maxSize:] // BUG, 致使都是以前的
|
||||
history.Histories = history.Histories[:maxSize]
|
||||
}
|
||||
newHistory := []info.EachHistory{eachHistory}
|
||||
newHistory = append(newHistory, history.Histories...) // 在开头加了, 最近的在最前
|
||||
@@ -61,4 +62,4 @@ func (this *NoteContentHistoryService) ListHistories(noteId, userId string) []in
|
||||
histories := info.NoteContentHistory{}
|
||||
db.GetByIdAndUserId(db.NoteContentHistories, noteId, userId, &histories)
|
||||
return histories.Histories
|
||||
}
|
||||
}
|
||||
@@ -50,6 +50,7 @@ func (this *ShareService) getOrQ(userId string) bson.M {
|
||||
return q
|
||||
}
|
||||
|
||||
// 得到共享给我的笔记本和用户(谁共享给了我)
|
||||
func (this *ShareService) GetShareNotebooks(userId string) (info.ShareNotebooksByUser, []info.User) {
|
||||
// 得到共享给我的用户s信息
|
||||
// 得到我参与的组织
|
||||
@@ -61,7 +62,7 @@ func (this *ShareService) GetShareNotebooks(userId string) (info.ShareNotebooksB
|
||||
db.Distinct(db.ShareNotes, q, "UserId", &userIds1)
|
||||
|
||||
userIds2 := []bson.ObjectId{}
|
||||
db.Distinct(db.ShareNotebooks, q, "UserId", &userIds1)
|
||||
db.Distinct(db.ShareNotebooks, q, "UserId", &userIds2) // BUG之前是userId1, 2014/12/29
|
||||
|
||||
userIds := append(userIds1, userIds2...)
|
||||
userInfos := userService.GetUserInfosOrderBySeq(userIds);
|
||||
|
||||
+130
-5
@@ -13,6 +13,7 @@ import (
|
||||
"fmt"
|
||||
"html/template"
|
||||
"regexp"
|
||||
"io/ioutil"
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
@@ -127,7 +128,8 @@ func (this *ThemeService) CopyDefaultTheme(userBlog info.UserBlog) (ok bool, the
|
||||
// 设为active true
|
||||
func (this *ThemeService) NewThemeForFirst(userBlog info.UserBlog) (ok bool, themeId string) {
|
||||
ok, themeId = this.CopyDefaultTheme(userBlog)
|
||||
db.UpdateByQField(db.Themes, bson.M{"_id": bson.ObjectIdHex(themeId)}, "IsActive", true)
|
||||
this.ActiveTheme(userBlog.UserId.Hex(), themeId)
|
||||
// db.UpdateByQField(db.Themes, bson.M{"_id": bson.ObjectIdHex(themeId)}, "IsActive", true)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -285,11 +287,15 @@ func (this *ThemeService) GetThemePath(userId, themeId string) string {
|
||||
}
|
||||
// 更新模板内容
|
||||
func (this *ThemeService) UpdateTplContent(userId, themeId, filename, content string) (ok bool, msg string) {
|
||||
path := this.GetThemeAbsolutePath(userId, themeId) + "/" + filename
|
||||
basePath := this.GetThemeAbsolutePath(userId, themeId)
|
||||
path := basePath + "/" + filename
|
||||
if strings.Contains(filename, ".html") {
|
||||
// 模板
|
||||
if ok, msg = this.mustTpl(filename, content); ok {
|
||||
ok = PutFileStrContent(path, content)
|
||||
Log(">>")
|
||||
if ok, msg = this.ValidateTheme(basePath, filename, content); ok {
|
||||
// 模板
|
||||
if ok, msg = this.mustTpl(filename, content); ok {
|
||||
ok = PutFileStrContent(path, content)
|
||||
}
|
||||
}
|
||||
return
|
||||
} else if filename == "theme.json" {
|
||||
@@ -410,6 +416,11 @@ func (this *ThemeService) ImportTheme(userId, path string) (ok bool, msg string)
|
||||
DeleteFile(targetPath)
|
||||
return
|
||||
}
|
||||
// 主题验证
|
||||
if ok, msg = this.ValidateTheme(targetPath, "", ""); !ok {
|
||||
DeleteFile(targetPath)
|
||||
return
|
||||
}
|
||||
// 解压成功, 那么新建之
|
||||
// 保存到数据库中
|
||||
theme, _ := this.getThemeConfig(targetPath)
|
||||
@@ -505,5 +516,119 @@ func (this *ThemeService) InstallTheme(userId, themeId string) (ok bool) {
|
||||
|
||||
ok = db.Insert(db.Themes, theme)
|
||||
|
||||
// 激活之
|
||||
this.ActiveTheme(userId, themeId);
|
||||
|
||||
return ok
|
||||
}
|
||||
|
||||
// 验证主题是否全法, 存在循环引用?
|
||||
// filename, newContent 表示在修改模板时要判断模板修改时是否有错误
|
||||
func (this *ThemeService) ValidateTheme(path string, filename, newContent string) (ok bool, msg string) {
|
||||
Log("theme Path")
|
||||
Log(path)
|
||||
// 建立一个有向图
|
||||
// 将该path下的所有文件提出, 得到文件的引用情况
|
||||
files := ListDir(path)
|
||||
LogJ(files);
|
||||
size := len(files)
|
||||
if(size > 100) {
|
||||
ok = false;
|
||||
msg = "tooManyFiles"
|
||||
return
|
||||
}
|
||||
/*
|
||||
111111111
|
||||
111000000
|
||||
*/
|
||||
vector := make([][]int, size)
|
||||
for i := 0; i < size; i++ {
|
||||
vector[i] = make([]int, size)
|
||||
}
|
||||
fileIndexMap := map[string]int{} // fileName => index
|
||||
fileContent := map[string]string{} // fileName => content
|
||||
index := 0
|
||||
// 得到文件内容, 和建立索引, 每个文件都有一个index, 对应数组位置
|
||||
for _, t := range files {
|
||||
if !strings.Contains(t, ".html") {
|
||||
continue;
|
||||
}
|
||||
if t != filename {
|
||||
fileBytes, err := ioutil.ReadFile(path + "/" + t)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
fileIndexMap[t] = index;
|
||||
// html内容
|
||||
fileStr := string(fileBytes)
|
||||
fileContent[t] = fileStr
|
||||
} else {
|
||||
fileIndexMap[t] = index
|
||||
fileContent[t] = newContent
|
||||
}
|
||||
index++
|
||||
}
|
||||
// 分析文件内容, 建立有向图
|
||||
reg, _ := regexp.Compile("{{ *template \"(.+?\\.html)\".*}}")
|
||||
for filename, content := range fileContent {
|
||||
thisIndex := fileIndexMap[filename]
|
||||
finds := reg.FindAllStringSubmatch(content, -1) // 子匹配
|
||||
LogJ(finds)
|
||||
// Log(content)
|
||||
if finds != nil && len(finds) > 0 {
|
||||
for _, includes := range finds {
|
||||
include := includes[1]
|
||||
includeIndex, has := fileIndexMap[include]
|
||||
Log(includeIndex)
|
||||
Log("??")
|
||||
Log(has)
|
||||
if has {
|
||||
vector[thisIndex][includeIndex] = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LogJ(vector)
|
||||
LogJ(fileIndexMap)
|
||||
// 建立图后, 判断是否有环
|
||||
if this.hasRound(vector, index) {
|
||||
ok = false
|
||||
msg = "themeValidHasRoundInclude"
|
||||
} else {
|
||||
ok = true
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// 检测有向图是否有环, DFS
|
||||
func (this *ThemeService) hasRound(vector [][]int, size int) (ok bool) {
|
||||
for i := 0; i < size; i++ {
|
||||
visited := make([]int, size)
|
||||
if this.hasRoundEach(vector, i, size, visited) {
|
||||
Log(">>")
|
||||
Log(i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// 从每个节点出发, 判断是否有环
|
||||
func (this *ThemeService) hasRoundEach(vector [][]int, index int, size int, visited []int) (ok bool) {
|
||||
if visited[index] > 0 {
|
||||
Log("<")
|
||||
Log(index)
|
||||
return true
|
||||
}
|
||||
visited[index] = 1;
|
||||
// 遍历它的孩子
|
||||
for i := 0; i < size; i++ {
|
||||
if vector[index][i] > 0 {
|
||||
return this.hasRoundEach(vector, i, size, visited);
|
||||
}
|
||||
}
|
||||
visited[index] = 0;
|
||||
return false;
|
||||
}
|
||||
@@ -376,7 +376,7 @@ func (this *UserService) ThirdAddUser(userId, email, pwd string) (ok bool, msg s
|
||||
// 宽度
|
||||
func (this *UserService)UpdateColumnWidth(userId string, notebookWidth, noteListWidth, mdEditorWidth int) bool {
|
||||
return db.UpdateByQMap(db.Users, bson.M{"_id": bson.ObjectIdHex(userId)},
|
||||
bson.M{"NotebookWidth": notebookWidth, "NoteListWidth": noteListWidth, "mdEditorWidth": mdEditorWidth})
|
||||
bson.M{"NotebookWidth": notebookWidth, "NoteListWidth": noteListWidth, "MdEditorWidth": mdEditorWidth})
|
||||
}
|
||||
// 左侧是否隐藏
|
||||
func (this *UserService)UpdateLeftIsMin(userId string, leftIsMin bool) bool {
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
</section>
|
||||
<footer class="footer lt hidden-xs b-t b-light" style="min-height: initial;
|
||||
padding: 10px 15px;text-align:center;">
|
||||
<a href="http://leanote.com" target="_blank">leanote</a> © 2014
|
||||
<a href="http://leanote.com" target="_blank">leanote</a> © 2015
|
||||
<!--
|
||||
<a href="#nav" data-toggle="class:nav-xs" class="pull-right btn btn-sm btn-default btn-icon">
|
||||
<i class="fa fa-angle-left text">
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
{{template "home/header_box.html" .}}
|
||||
|
||||
<section id="box">
|
||||
<div>
|
||||
<div>
|
||||
<h1 class="h text-white animated fadeInDownBig">ERROR!</h1>
|
||||
</div>
|
||||
<div id="errorBox">
|
||||
<p class="error-info">
|
||||
Sorry, you(not we) got an error. This error is just showing in blog preview for test.
|
||||
</p>
|
||||
|
||||
<div class="list-group m-b-sm bg-white m-b-lg">
|
||||
|
||||
{{with .Error}}
|
||||
<div id="header" class="block">
|
||||
<h1>
|
||||
{{.Title}}
|
||||
</h1>
|
||||
<p>
|
||||
{{if .SourceType}}
|
||||
The {{.SourceType}} <strong>{{.Path}}</strong> does not compile: <strong>{{.Description}}</strong>
|
||||
{{else}}
|
||||
{{.Description}}
|
||||
{{end}}
|
||||
</p>
|
||||
</div>
|
||||
{{if .Path}}
|
||||
<div id="source" class="block">
|
||||
<h2>In {{.Path}}
|
||||
{{if .Line}}
|
||||
(around {{if .Line}}line {{.Line}}{{end}}{{if .Column}} column {{.Column}}{{end}})
|
||||
{{end}}
|
||||
</h2>
|
||||
{{range .ContextSource}}
|
||||
<div class="line {{if .IsError}}error{{end}}">
|
||||
<span class="lineNumber">{{.Line}}:</span>
|
||||
<pre>{{.Source}}</pre>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
{{if .MetaError}}
|
||||
<div id="source" class="block">
|
||||
<h2>Additionally, an error occurred while handling this error.</h2>
|
||||
<div class="line error">
|
||||
{{.MetaError}}
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<div id="boxFooter">
|
||||
<p>
|
||||
<a href="/index">leanote</a> © 2014
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -44,7 +44,6 @@ function log(o) {
|
||||
-->
|
||||
<li><a href="/index#download" target="#download" class="smooth-scroll">{{msg . "download"}}</a> </li>
|
||||
<li><a href="/index#donate" target="#donate" class="smooth-scroll">{{msg . "donate"}}</a> </li>
|
||||
<li><a id="leanoteBlog" href="{{.leaUrl}}/index" target="_blank" title="lea++, leanote博客平台" class="">lea++</a></li>
|
||||
<li style="position: relative; margin-right: 3px;">
|
||||
<a href="http://bbs.leanote.com" target="_blank" class="">{{msg . "discussion"}}</a>
|
||||
<div class="red-circle" style=""></div>
|
||||
|
||||
@@ -100,7 +100,9 @@ $(function() {
|
||||
$("#registerBtn").html("{{msg . "ing"}}...").addClass("disabled");
|
||||
// hideMsg();
|
||||
|
||||
$.post("/doRegister", {email: email, pwd: pwd}, function(e) {
|
||||
var iu = "{{.iu}}";
|
||||
|
||||
$.post("/doRegister", {email: email, pwd: pwd, iu: iu}, function(e) {
|
||||
$("#registerBtn").html("{{msg . "register"}}").removeClass("disabled");
|
||||
if(e.Ok) {
|
||||
$("#registerBtn").html("{{msg . "registerSuccessAndRdirectToNote"}}");
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
{{template "member/top.html" .}}
|
||||
<div class="m-b-md"> <h3 class="m-b-none">
|
||||
{{if .page}}
|
||||
修改页面
|
||||
{{if .single}}
|
||||
{{msg . "updateSingle"}}
|
||||
{{else}}
|
||||
添加页面
|
||||
{{msg . "addSingle"}}
|
||||
{{end}}
|
||||
</h3></div>
|
||||
|
||||
<link rel="stylesheet" href="/tinymce/skins/custom/skin.min.css" type="text/css">
|
||||
<link rel="stylesheet" href="/tinymce/skins/custom/skin.min.css" type="text/css">
|
||||
<div class="row">
|
||||
<div class="col-sm-10">
|
||||
<form id="formData">
|
||||
@@ -16,18 +16,18 @@
|
||||
<div class="alert alert-danger" id="baseMsg" style="display: none"></div>
|
||||
<input type="hidden" id="singleId" value="{{.single.SingleId.Hex}}" />
|
||||
<div class="form-group">
|
||||
<label>标题</label>
|
||||
<label>{{msg . "title"}}</label>
|
||||
<input type="text" class="form-control" id="title" name="title"
|
||||
value="{{.single.Title}}"
|
||||
data-rules='[
|
||||
{rule: "required", msg: "请输入页面标题"},
|
||||
{rule: "required", msg: "{{msg . "inputSingleTitle"}}"},
|
||||
]'
|
||||
data-msg_target="#baseMsg"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="content1">内容</label>
|
||||
<label for="content1">{{msg . "content"}}</label>
|
||||
<div id="popularToolbar"></div>
|
||||
<textarea id="content1" name="content">{{.single.Content}}</textarea>
|
||||
</div>
|
||||
@@ -41,9 +41,9 @@
|
||||
|
||||
</div>
|
||||
{{template "member/footer.html" .}}
|
||||
<script type="text/javascript" src="/tinymce/tinymce.min.js"></script>
|
||||
<script type="text/javascript" src="/tinymce/tinymce.js"></script>
|
||||
<script>
|
||||
var urlPrefix = "{{.siteUrl}}";
|
||||
var urlPrefix = "{{.siteUrl}}";
|
||||
$(function() {
|
||||
tinymce.init({
|
||||
selector : "#content1",
|
||||
@@ -55,7 +55,7 @@ $(function() {
|
||||
skin : "custom",
|
||||
plugins : [
|
||||
"advlist autolink link leanote_image lists charmap hr ",
|
||||
"searchreplace visualblocks visualchars leanote_code tabfocus",
|
||||
"searchreplace visualblocks visualchars tabfocus",
|
||||
"table contextmenu directionality textcolor paste fullpage textcolor"],
|
||||
toolbar1 : "formatselect |fontselect fontsizeselect| forecolor backcolor | bold italic underline strikethrough | bullist numlist |",
|
||||
menubar : false,
|
||||
|
||||
@@ -1,29 +1,26 @@
|
||||
{{template "member/top.html" .}}
|
||||
<div class="m-b-md"> <h3 class="m-b-none">{{msg . "baseInfoSet"}}</h3></div>
|
||||
<div class="m-b-md"> <h3 class="m-b-none">{{msg $ "basicInfoSet"}}</h3></div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-10">
|
||||
<div class="col-sm-8">
|
||||
<div id="formData">
|
||||
<section class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<div class="alert alert-danger" id="baseMsg" style="display: none"></div>
|
||||
<div class="form-horizontal" role="form" id="userBlogForm">
|
||||
<div role="form" id="userBlogForm">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="title" class="col-sm-2 control-label">{{msg . "blogName"}}</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" id="Title" name="Title"
|
||||
<label for="title" >{{msg . "blogName"}}</label>
|
||||
<input type="text" class="form-control" id="Title" name="Title"
|
||||
placeholder="eg: leanote's blog"
|
||||
value="{{if .userBlog.Title}}{{.userBlog.Title}}{{else}}{{.userInfo.Email}} 's blog{{end}}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="logo" class="col-sm-2 control-label">{{msg . "blogLogo"}}</label>
|
||||
<div class="col-sm-10">
|
||||
<label for="logo">{{msg . "blogLogo"}}</label>
|
||||
<input type="hidden" name="Logo" id="Logo"
|
||||
value="{{.userBlog.Logo}}" />
|
||||
<form id="formLogo" action="{{$.siteUrl}}/file/uploadBlogLogo" method="post"
|
||||
<form id="formLogo" action="/file/uploadBlogLogo" method="post"
|
||||
enctype="multipart/form-data" target="logoTarget">
|
||||
<input type="file" class="form-control" id="logo2" name="file"
|
||||
onChange='$("#formLogo").submit();' />
|
||||
@@ -37,16 +34,13 @@
|
||||
</div>
|
||||
</form>
|
||||
<iframe id="logoTarget" name="logoTarget" src="#" style="display: none"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="subTitle" class="col-sm-2 control-label">{{msg . "blogDesc"}}</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" id="SubTitle"
|
||||
<label for="subTitle">{{msg . "blogDesc"}}</label>
|
||||
<input type="text" class="form-control" id="SubTitle"
|
||||
name="SubTitle" value="{{.userBlog.SubTitle}}"
|
||||
placeholder="eg: leanote, Not Just A Notebook">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
@@ -1,29 +1,37 @@
|
||||
{{template "member/top.html" .}}
|
||||
<div class="m-b-md"> <h3 class="m-b-none">(笔记本)分类</h3></div>
|
||||
<div class="m-b-md"> <h3 class="m-b-none">{{msg . "cate"}}</h3></div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-8">
|
||||
<section class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
分类是公开为博客的笔记本
|
||||
{{msg . "cateIsPublicNotebook"}}
|
||||
<br />
|
||||
拖动可排序
|
||||
{{if .notebooks}}
|
||||
{{msg . "dragAndSort"}}
|
||||
<ul class="list-group gutter list-group-lg list-group-sp sortable">
|
||||
{{range .notebooks}}
|
||||
<li class="list-group-item" draggable="true" data-id="{{.NotebookId.Hex}}">
|
||||
<span class="pull-left media-xs"><i class="fa fa-sort text-muted fa m-r-sm"></i></span>
|
||||
<div class="pull-right" style="margin-right: 10px">
|
||||
固定链接: /cate/<input data-id="{{.NotebookId.Hex}}" class="url-title" type="text" value="{{if .UrlTitle}}{{.UrlTitle|decodeUrlValue}}{{else}}{{.NotebookId.Hex}}{{end}}"/>
|
||||
{{msg $ "permanentLink"}}: /cate/<input data-id="{{.NotebookId.Hex}}" class="url-title" type="text" value="{{if .UrlTitle}}{{.UrlTitle|decodeUrlValue}}{{else}}{{.NotebookId.Hex}}{{end}}"/>
|
||||
</div>
|
||||
{{.Title}}
|
||||
</li>
|
||||
{{end}}
|
||||
</ul>
|
||||
{{else}}
|
||||
{{msg . "noCates"}}
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
{{if .notebooks}}
|
||||
<footer class="panel-footer text-right bg-light lter">
|
||||
<button type="submit" id="baseBtn" class="btn btn-success">{{msg . "submit"}}</button>
|
||||
<button type="submit" id="baseBtn" class="btn btn-success">{{msg . "saveSort"}}</button>
|
||||
</footer>
|
||||
{{end}}
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<input type="radio"
|
||||
name="commentType"
|
||||
value="default"
|
||||
{{if or (not .userBlog.CommentType) (eq .userBlog.CommentType "default")}}checked="checked"{{end}} > Default
|
||||
{{if or (not .userBlog.CommentType) (eq .userBlog.CommentType "default")}}checked="checked"{{end}} > {{msg $ "defaultComment"}}
|
||||
</label>
|
||||
|
||||
<label>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{{template "member/top.html" .}}
|
||||
<div class="m-b-md"><h3 class="m-b-none">文章列表</h3></div>
|
||||
<div class="m-b-md"><h3 class="m-b-none">{{msg . "postList"}}</h3></div>
|
||||
<style>
|
||||
.url-title {
|
||||
width: 260px;
|
||||
@@ -13,7 +13,7 @@
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
<div class="input-group search-group">
|
||||
<input type="text" class="input-sm form-control" placeholder="Title" id="keywords" value="{{.keywords}}" />
|
||||
<input type="text" class="input-sm form-control" placeholder="{{msg . "title"}}" id="keywords" value="{{.keywords}}" />
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-sm btn-default" type="button" data-url="/member/blog/index">Search</button>
|
||||
</span>
|
||||
@@ -40,7 +40,7 @@
|
||||
style="width: 300px"
|
||||
{{sorterTh $url "urlTitle" .sorter}}
|
||||
>
|
||||
固定链接
|
||||
{{msg $ "permanentLink"}}
|
||||
<span class="th-sort">
|
||||
<i class="fa fa-sort-down"></i>
|
||||
<i class="fa fa-sort-up"></i>
|
||||
@@ -50,7 +50,7 @@
|
||||
<th
|
||||
{{sorterTh $url "publicTime" .sorter}}
|
||||
>
|
||||
发布日期
|
||||
{{msg . "publicTime"}}
|
||||
<span class="th-sort">
|
||||
<i class="fa fa-sort-down"></i>
|
||||
<i class="fa fa-sort-up"></i>
|
||||
@@ -61,7 +61,7 @@
|
||||
<th
|
||||
{{sorterTh $url "updatedTime" .sorter}}
|
||||
>
|
||||
更新日期
|
||||
{{msg . "updatedTime"}}
|
||||
<span class="th-sort">
|
||||
<i class="fa fa-sort-down"></i>
|
||||
<i class="fa fa-sort-up"></i>
|
||||
@@ -71,7 +71,7 @@
|
||||
<th
|
||||
{{sorterTh $url "createdTime" .sorter}}
|
||||
>
|
||||
创建日期
|
||||
{{msg . "createdTime"}}
|
||||
<span class="th-sort">
|
||||
<i class="fa fa-sort-down"></i>
|
||||
<i class="fa fa-sort-up"></i>
|
||||
@@ -114,13 +114,13 @@
|
||||
|
||||
<a
|
||||
{{if .HasSelfDefined}}
|
||||
title="已设置"
|
||||
title="{{msg $ "hasSelfDefined"}}"
|
||||
class="btn btn-sm btn-success"
|
||||
{{else}}
|
||||
title="未设置"
|
||||
title="{{msg $ "noSelfDefined"}}"
|
||||
class="btn btn-sm btn-default"
|
||||
{{end}}
|
||||
href="/member/blog/updateBlogAbstract?noteId={{.NoteId.Hex}}">摘要设置</a>
|
||||
href="/member/blog/updateBlogAbstract?noteId={{.NoteId.Hex}}">{{msg $ "setAbstract"}}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{{template "member/top.html" .}}
|
||||
<div class="m-b-md"> <h3 class="m-b-none">分页与排序设置</h3></div>
|
||||
<div class="m-b-md"> <h3 class="m-b-none">{{msg $ "pagingAndSort"}}</h3></div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-8">
|
||||
@@ -8,43 +8,35 @@
|
||||
<div class="panel-body">
|
||||
<div class="alert alert-danger" id="domainMsg" style="display: none"></div>
|
||||
|
||||
<form class="form-horizontal" role="form" id="dataFrom">
|
||||
|
||||
<form role="form" id="dataFrom">
|
||||
<div class="form-group">
|
||||
<label for="perPageSize" class="col-sm-2 control-label">每页记录数</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control"
|
||||
<label for="perPageSize">{{msg . "perPageSize"}}</label>
|
||||
<input type="text" class="form-control"
|
||||
placeholder="10"
|
||||
id="perPageSize"
|
||||
name="perPageSize"
|
||||
value="{{.userBlog.PerPageSize}}" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="perPageSize" class="col-sm-2 control-label">排序字段</label>
|
||||
<div class="col-sm-10">
|
||||
<select class="form-control"
|
||||
id="sortField"
|
||||
name="sortField"
|
||||
value="">
|
||||
<option value="PublicTime" {{if eq $.userBlog.SortField "PublicTime"}}selected{{end}}>公开为博客时间</option>
|
||||
<option value="CreatedTime" {{if eq $.userBlog.SortField "CreatedTimeTime"}}selected{{end}}>创建时间</option>
|
||||
<option value="UpdatedTime" {{if eq $.userBlog.SortField "UpdatedTime"}}selected{{end}}>更新时间</option>
|
||||
<option value="Title" {{if eq $.userBlog.SortField "Title"}}selected{{end}}>标题</option>
|
||||
</select>
|
||||
</div>
|
||||
<label for="perPageSize" >{{msg . "sortField"}}</label>
|
||||
<select class="form-control"
|
||||
id="sortField"
|
||||
name="sortField"
|
||||
value="">
|
||||
<option value="PublicTime" {{if eq $.userBlog.SortField "PublicTime"}}selected{{end}}>{{msg $ "publicTime"}}</option>
|
||||
<option value="CreatedTime" {{if eq $.userBlog.SortField "CreatedTimeTime"}}selected{{end}}>{{msg $ "createdTime"}}</option>
|
||||
<option value="UpdatedTime" {{if eq $.userBlog.SortField "UpdatedTime"}}selected{{end}}>{{msg $ "updatedTime"}}</option>
|
||||
<option value="Title" {{if eq $.userBlog.SortField "Title"}}selected{{end}}>{{msg . "title"}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">排序类型</label>
|
||||
<div class="col-sm-10" style="margin-top: 5px;">
|
||||
<label><input type="radio" name="isAsc" value="0" {{if not .userBlog.IsAsc}}checked{{end}}> 降序</label>
|
||||
<label><input type="radio" name="isAsc" value="1" {{if .userBlog.IsAsc}}checked{{end}}> 升序</label>
|
||||
<label>{{msg $ "sortType"}}</label>
|
||||
<div>
|
||||
<label><input type="radio" name="isAsc" value="0" {{if not .userBlog.IsAsc}}checked{{end}}> {{msg . "desc"}}</label>
|
||||
<label><input type="radio" name="isAsc" value="1" {{if .userBlog.IsAsc}}checked{{end}}> {{msg . "asc"}}</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<footer class="panel-footer text-right bg-light lter">
|
||||
<button type="submit" id="baseBtn" class="btn btn-success">{{msg . "submit"}}</button>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
{{template "member/top.html" .}}
|
||||
<div class="m-b-md"> <h3 class="m-b-none">单页面</h3></div>
|
||||
<div class="m-b-md"> <h3 class="m-b-none">{{msg . "single"}}</h3></div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-8">
|
||||
<section class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<p>
|
||||
您可以添加多个单页面
|
||||
<a href="/member/blog/addOrUpdateSingle" id="addBtn" class="btn btn-success">添加页面</a>
|
||||
{{msg $ "singleTips"}}
|
||||
<a href="/member/blog/addOrUpdateSingle" id="addBtn" class="btn btn-success">{{msg $ "addSingle"}}</a>
|
||||
</p>
|
||||
<ul class="list-group gutter list-group-lg list-group-sp sortable">
|
||||
{{range .singles}}
|
||||
@@ -18,7 +18,7 @@
|
||||
<a href="#"><i class="fa fa-times icon-muted fa-fw page-delete" data-id="{{.SingleId}}"></i></a>
|
||||
</span>
|
||||
<div class="pull-right" style="margin-right: 10px">
|
||||
固定链接: /single/<input data-id="{{.SingleId}}" class="url-title" type="text" value="{{if .UrlTitle}}{{.UrlTitle|decodeUrlValue}}{{else}}{{.SingleId}}{{end}}"/>
|
||||
{{msg $ "permanentLink"}}: /single/<input data-id="{{.SingleId}}" class="url-title" type="text" value="{{if .UrlTitle}}{{.UrlTitle|decodeUrlValue}}{{else}}{{.SingleId}}{{end}}"/>
|
||||
</div>
|
||||
<div class="clear">
|
||||
{{.Title}}
|
||||
@@ -29,7 +29,7 @@
|
||||
</div>
|
||||
{{if .singles}}
|
||||
<footer class="panel-footer text-right bg-light lter">
|
||||
<button type="submit" id="baseBtn" class="btn btn-success">保存排序</button>
|
||||
<button type="submit" id="baseBtn" class="btn btn-success">{{msg . "saveSort"}}</button>
|
||||
</footer>
|
||||
{{end}}
|
||||
</section>
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
</div>
|
||||
{{template "member/footer.html" .}}
|
||||
<script type="text/javascript" src="{{.siteUrl}}/public/member/js/jquery.sortable.js"></script>
|
||||
<script type="text/javascript" src="/public/member/js/jquery.sortable.js"></script>
|
||||
<script>
|
||||
$(function() {
|
||||
$("#baseBtn").click(function(){
|
||||
@@ -79,7 +79,7 @@ $(function() {
|
||||
art.alert(re.Msg || "error");
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -2,9 +2,13 @@
|
||||
<div class="m-b-md clearfix">
|
||||
<h3 class="m-b-none">
|
||||
{{msg . "themeSet"}}
|
||||
<small>(<a href="http://blog.leanote.com/post/545f1a5c380782565e000000" target="_blank">{{msg . "needHelp"}}</a>)</small>
|
||||
<small>
|
||||
(<a href="http://blog.leanote.com/post/545f1a5c380782565e000000" target="_blank">{{msg . "needHelp"}}</a>
|
||||
<a target="_blank" href="https://github.com/leanote/leanote/wiki/leanote-blog-theme-api">Leanote Blog Theme Api</a>)
|
||||
</small>
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 theme-container">
|
||||
<section class="panel panel-default">
|
||||
@@ -12,9 +16,9 @@
|
||||
<div>
|
||||
<form id="uploadAvatar" method="post" action="/member/blog/importTheme" enctype="multipart/form-data">
|
||||
<div id="dropAvatar" class="dropzone">
|
||||
<a class="btn btn-default btn-new" href="/member/blog/newTheme"><span class="fa fa-plus"></span> 新建主题</a>
|
||||
<a class="btn btn-default btn-new" href="/member/blog/newTheme"><span class="fa fa-plus"></span> {{msg . "addTheme"}}</a>
|
||||
<a class="btn btn-success btn-choose-file">
|
||||
<span class="fa fa-upload"></span> 导入主题(.zip)
|
||||
<span class="fa fa-upload"></span> {{msg . "importTheme"}}(.zip)
|
||||
</a>
|
||||
<input type="file" name="file" multiple/>
|
||||
<div id="avatarUploadMsg"></div>
|
||||
@@ -22,10 +26,10 @@
|
||||
</form>
|
||||
</div>
|
||||
<p>
|
||||
当前主题:
|
||||
{{msg . "currentTheme"}}:
|
||||
</p>
|
||||
<ul class="themes">
|
||||
<li class="theme">
|
||||
<div class="themes clearfix">
|
||||
<div class="theme pull-left">
|
||||
<a class="choose-theme" data-method="put" href="#" rel="nofollow">
|
||||
<div class="theme-thumb thumb active-theme">
|
||||
<img src="/{{.activeTheme.Path}}/images/screenshot.png" alt="preview">
|
||||
@@ -37,17 +41,26 @@
|
||||
</span>
|
||||
<div class="theme-btns">
|
||||
<div class="btn-group" data-id="{{.activeTheme.ThemeId.Hex}}">
|
||||
<a class="btn btn-default btn-sm btn-export"><span class="fa fa-download"></span> 导出</a>
|
||||
<a class="btn btn-default btn-sm" href="{{$.siteUrl}}/preview?themeId={{.activeTheme.ThemeId.Hex}}" target="_blank"><span class="fa fa-eye"></span> 预览</a>
|
||||
<a class="btn btn-primary btn-sm" target="_blank" href="/member/blog/updateTheme?themeId={{if .activeTheme.ThemeId}}{{.activeTheme.ThemeId.Hex}}{{end}}"><span class="fa fa-pencil"></span> 编辑</a>
|
||||
<a class="btn btn-default btn-sm btn-export"><span class="fa fa-download"></span> {{msg $ "export"}}</a>
|
||||
<!-- 必须是自己的主题 -->
|
||||
{{if .activeTheme.ThemeId}}
|
||||
<a class="btn btn-default btn-sm" href="{{$.siteUrl}}/preview?themeId={{.activeTheme.ThemeId.Hex}}" target="_blank"><span class="fa fa-eye"></span> {{msg $ "preview"}}</a>
|
||||
{{end}}
|
||||
<a class="btn btn-primary btn-sm" target="_blank" href="/member/blog/updateTheme?themeId={{if .activeTheme.ThemeId}}{{.activeTheme.ThemeId.Hex}}{{end}}"><span class="fa fa-pencil"></span> {{msg $ "edit"}}</a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
{{if .activeTheme.Info.Desc}}
|
||||
<!-- 描述 -->
|
||||
<div class="pull-left theme-desc">
|
||||
{{.activeTheme.Info.Desc|raw}}
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
<p>
|
||||
我的其它主题:
|
||||
{{msg . "myOtherThemes"}}:
|
||||
</p>
|
||||
<ul class="themes">
|
||||
{{range $.otherThemes}}
|
||||
@@ -56,6 +69,11 @@
|
||||
<a class="choose-theme" data-method="put" href="#" rel="nofollow">
|
||||
<div class="theme-thumb thumb">
|
||||
<img src="/{{.Path}}/images/screenshot.png" alt="preview">
|
||||
{{if .Info.Desc}}
|
||||
<div class="theme-desc-mask">
|
||||
{{.Info.Desc|raw}}
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
<span class="theme-title">{{.Name}}</span>
|
||||
</a>
|
||||
@@ -64,11 +82,11 @@
|
||||
</span>
|
||||
<div class="theme-btns">
|
||||
<div class="btn-group" data-id="{{.ThemeId.Hex}}">
|
||||
<a class="btn btn-default btn-sm btn-delete" data-loading-text="..."><span class="fa fa-remove"></span> 删除</a>
|
||||
<a class="btn btn-default btn-sm btn-export"><span class="fa fa-download"></span> 导出</a>
|
||||
<a class="btn btn-default btn-sm" href="{{$.siteUrl}}/preview?themeId={{.ThemeId.Hex}}" target="_blank"><span class="fa fa-eye"></span> 预览</a>
|
||||
<a class="btn btn-default btn-sm" target="_blank" href="/member/blog/updateTheme?themeId={{.ThemeId.Hex}}"><span class="fa fa-pencil"></span> 编辑</a>
|
||||
<a class="btn btn-primary btn-sm btn-active" data-loading-text="..."><span class="fa fa-check"></span> 使用</a>
|
||||
<a class="btn btn-default btn-sm btn-delete" data-loading-text="..."><span class="fa fa-remove"></span> {{msg $ "delete"}}</a>
|
||||
<a class="btn btn-default btn-sm btn-export"><span class="fa fa-download"></span> {{msg $ "export"}}</a>
|
||||
<a class="btn btn-default btn-sm" href="{{$.siteUrl}}/preview?themeId={{.ThemeId.Hex}}" target="_blank"><span class="fa fa-eye"></span> {{msg $ "preview"}}</a>
|
||||
<a class="btn btn-default btn-sm" target="_blank" href="/member/blog/updateTheme?themeId={{.ThemeId.Hex}}"><span class="fa fa-pencil"></span> {{msg $ "edit"}}</a>
|
||||
<a class="btn btn-primary btn-sm btn-active" data-loading-text="..."><span class="fa fa-check"></span> {{msg $ "use"}}</a>
|
||||
{{if $.isAdmin}}
|
||||
<a class="btn btn-default btn-sm btn-public" data-loading-text="...">
|
||||
{{if .IsDefault}}
|
||||
@@ -83,13 +101,13 @@
|
||||
</li>
|
||||
{{end}}
|
||||
{{else}}
|
||||
无
|
||||
{{msg $ "none"}}
|
||||
{{end}}
|
||||
</ul>
|
||||
|
||||
<hr />
|
||||
<p>
|
||||
leanote主题市场:
|
||||
{{msg . "leanoteThemeMarket"}}:
|
||||
</p>
|
||||
<ul class="themes">
|
||||
{{range $.optionThemes}}
|
||||
@@ -97,6 +115,11 @@
|
||||
<a class="choose-theme" data-method="put" href="#" rel="nofollow">
|
||||
<div class="theme-thumb thumb">
|
||||
<img src="/{{.Path}}/images/screenshot.png" alt="preview">
|
||||
{{if .Info.Desc}}
|
||||
<div class="theme-desc-mask">
|
||||
{{.Info.Desc|raw}}
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
<span class="theme-title">{{.Name}}</span>
|
||||
</a>
|
||||
@@ -104,7 +127,7 @@
|
||||
By: <a href="{{.AuthorUrl}}" target="_blank">{{.Author}}</a>
|
||||
</span>
|
||||
<p class="theme-btns" data-id="{{.ThemeId.Hex}}">
|
||||
<a class="btn btn-primary btn-sm btn-install"><span class="fa fa-gear"></span> 安装</a>
|
||||
<a class="btn btn-primary btn-sm btn-install"><span class="fa fa-gear"></span> {{msg $ "install"}}</a>
|
||||
</p>
|
||||
</li>
|
||||
{{end}}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<link rel="stylesheet" href="/tinymce/skins/custom/skin.min.css" type="text/css">
|
||||
<link rel="stylesheet" href="/tinymce/skins/custom/skin.min.css" type="text/css">
|
||||
<div class="row">
|
||||
<div class="col-sm-10">
|
||||
<form id="formData">
|
||||
@@ -61,7 +61,7 @@
|
||||
{{template "member/footer.html" .}}
|
||||
<script type="text/javascript" src="/tinymce/tinymce.js"></script>
|
||||
<script>
|
||||
var UrlPrefix = "{{.siteUrl}}";
|
||||
var UrlPrefix = "{{.siteUrl}}";
|
||||
$(function() {
|
||||
tinymce.init({
|
||||
selector : "#content1",
|
||||
@@ -73,9 +73,9 @@ $(function() {
|
||||
skin : "custom",
|
||||
plugins : [
|
||||
"advlist autolink link leanote_image lists charmap hr ",
|
||||
"searchreplace visualblocks visualchars leanote_code tabfocus",
|
||||
"searchreplace visualblocks visualchars tabfocus",
|
||||
"table contextmenu directionality textcolor paste fullpage textcolor"],
|
||||
toolbar1 : "formatselect |fontselect fontsizeselect| forecolor backcolor | bold italic underline strikethrough | bullist numlist | leanote_code",
|
||||
toolbar1 : "formatselect |fontselect fontsizeselect| forecolor backcolor | bold italic underline strikethrough | bullist numlist",
|
||||
menubar : false,
|
||||
statusbar : false,
|
||||
font_formats : "Arial=arial,helvetica,sans-serif;"
|
||||
|
||||
@@ -2,13 +2,18 @@
|
||||
<div class="m-b-md">
|
||||
<h3 class="m-b-none">
|
||||
{{if .isNew}}
|
||||
新建主题
|
||||
{{msg $ "addTheme"}}
|
||||
{{else}}
|
||||
编辑主题
|
||||
{{msg $ "updateTheme"}}
|
||||
-
|
||||
{{.theme.Name}}
|
||||
{{end}}
|
||||
<a class="btn btn-default" href="{{$.siteUrl}}/preview?themeId={{.themeId}}" target="_blank"><span class="fa fa-eye"></span> 预览</a>
|
||||
<a class="btn btn-default" href="{{$.siteUrl}}/preview?themeId={{.themeId}}" target="_blank"><span class="fa fa-eye"></span> {{msg . "preview"}}</a>
|
||||
|
||||
<small>
|
||||
(<a href="http://blog.leanote.com/post/545f1a5c380782565e000000" target="_blank">{{msg . "needHelp"}}</a>
|
||||
<a target="_blank" href="https://github.com/leanote/leanote/wiki/leanote-blog-theme-api">Leanote Blog Theme Api</a>)
|
||||
</small>
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
@@ -42,7 +47,7 @@
|
||||
<div class="col-sm-4">
|
||||
<section class="panel panel-default">
|
||||
<header class="panel-heading">
|
||||
模板, 样式, 脚本:
|
||||
{{msg . "tplStyleScript"}}:
|
||||
</header>
|
||||
<div class="panel-body" style="height:430px;overflow: auto;">
|
||||
|
||||
@@ -58,14 +63,14 @@
|
||||
</div>
|
||||
</div>
|
||||
<footer class="panel-footer text-right bg-light lter">
|
||||
<a class="btn btn-default" id="newFile">新建文件</a>
|
||||
<a class="btn btn-default" id="newFile">{{msg . "newFile"}}</a>
|
||||
</footer>
|
||||
</section>
|
||||
</div>
|
||||
<div class="col-sm-8">
|
||||
<section class="panel panel-default">
|
||||
<header class="panel-heading">
|
||||
当前文件: <span id="curTpl">header.html</span>
|
||||
{{msg . "currentFile"}}: <span id="curTpl">header.html</span>
|
||||
<span id="msg"></span>
|
||||
</header>
|
||||
<div class="panel-body">
|
||||
@@ -82,7 +87,7 @@
|
||||
<div class="col-sm-12">
|
||||
<section class="panel panel-default">
|
||||
<header class="panel-heading">
|
||||
图片: images/
|
||||
{{msg . "image"}}: images/
|
||||
</header>
|
||||
<div class="panel-body">
|
||||
<ul class="image-list" id="imageList">
|
||||
@@ -102,7 +107,7 @@
|
||||
</div>
|
||||
|
||||
{{template "member/footer.html" .}}
|
||||
<script src="/public/member/js/ace/ace.js" type="text/javascript"></script>
|
||||
<script src="/public/libs/ace/ace.js" type="text/javascript"></script>
|
||||
<script>
|
||||
var editor = ace.edit("tplContent");
|
||||
editor.setTheme("ace/theme/tomorrow");
|
||||
@@ -118,7 +123,7 @@ var theme = {
|
||||
saveBtnO: $("#saveBtn"),
|
||||
newFileO: $("#newFile"),
|
||||
curTpl: "",
|
||||
tplInfos: {"header.html": "头部", "footer.html": "底部", "index.html": "首页", "cate.html": "分类页", "search.html": "搜索页", "single.html": "单页", "archive.html": "归档页", "post.html": "文章页", "tags.html": "标签页", "tag_posts.html": "标签文章页", "share_comment.html": "分享评论", "404.html":"404", "theme.json": "主题配置", "paging.html": "分页", "highlight.html": "高亮"},
|
||||
tplInfos: {"header.html": "{{msg . "header"}}", "footer.html": "{{msg . "footer"}}", "index.html": "{{msg . "header"}}", "cate.html": "{{msg . "cate"}}", "search.html": "{{msg . "search"}}", "single.html": "{{msg . "single"}}", "archive.html": "{{msg . "archive"}}", "post.html": "{{msg . "post"}}", "tags.html": "{{msg . "tags"}}", "tag_posts.html": "{{msg . "tag_posts"}}", "share_comment.html": "{{msg . "share_comment"}}", "404.html":"404", "theme.json": "{{msg . "themeJson"}}", "paging.html": "{{msg . "paging"}}", "highlight.html": "{{msg . "highlight"}}"},
|
||||
init: function() {
|
||||
var self = this;
|
||||
self.showTplInfo();
|
||||
@@ -183,11 +188,11 @@ var theme = {
|
||||
info = self.tplInfos[file];
|
||||
if(!info) {
|
||||
if(file.indexOf(".css") > 0) {
|
||||
info = "样式";
|
||||
info = "{{msg . "style"}}";
|
||||
} else if(file.indexOf(".js") > 0) {
|
||||
info = "脚本";
|
||||
info = "{{msg . "script"}}";
|
||||
} else if(file.indexOf(".html") > 0) {
|
||||
info = "模板";
|
||||
info = "{{msg . "tpl"}}";
|
||||
}
|
||||
} else {
|
||||
$(this).find(".remove-file").remove();
|
||||
@@ -209,7 +214,7 @@ var theme = {
|
||||
if(t) {
|
||||
t.button("loading");
|
||||
}
|
||||
self.msgO.html("正在保存...");
|
||||
self.msgO.html("...");
|
||||
ajaxPost("/member/blog/updateTplContent", {themeId: themeId, filename: self.curTpl, content: content}, function(re) {
|
||||
if(t) {
|
||||
t.button("reset");
|
||||
@@ -217,7 +222,7 @@ var theme = {
|
||||
if(reIsOk(re)) {
|
||||
self.cache[filename] = content;
|
||||
// art.tips("Success");
|
||||
self.msgO.html("保存成功")
|
||||
self.msgO.html("{{msg . "saveSuccess"}}")
|
||||
setTimeout(function() {
|
||||
self.msgO.html("");
|
||||
}, 3000);
|
||||
|
||||
@@ -8,17 +8,19 @@
|
||||
width: 200px;
|
||||
}
|
||||
</style>
|
||||
<div class="m-b-md"> <h3 class="m-b-none">项目组/成员</h3></div>
|
||||
<div class="m-b-md"> <h3 class="m-b-none">{{msg . "group"}}</h3></div>
|
||||
|
||||
<p>
|
||||
<a class="btn btn-default btn-add-group"><span class="fa fa-plus"></span> 新建分组</a>
|
||||
<a class="btn btn-default btn-add-group"><span class="fa fa-plus"></span> {{msg . "newGroup"}}</a>
|
||||
</p>
|
||||
|
||||
|
||||
<script type="text/x-jsrender" id="tUser">
|
||||
<li class="list-group-item" data-id="[[:UserId]]">
|
||||
[[:Username]] [[if Email != Username]]([[:Email]])[[/if]]
|
||||
<span class="fa fa-remove pull-right text-xs m-t-sm"></span>
|
||||
<a title="{{msg . "deleteMember"}}" class="delete-user">
|
||||
<span class="fa fa-remove pull-right text-xs m-t-sm"></span>
|
||||
</a>
|
||||
</li>
|
||||
</script>
|
||||
|
||||
@@ -30,7 +32,7 @@
|
||||
<div class="clear">
|
||||
<div class="h3 m-t-xs m-b-xs text-white">
|
||||
<input type="text" data-ever="[[:Title]]" value="[[:Title]]" class="group-title" />
|
||||
<a title="删除分组" class="delete-group">
|
||||
<a title="{{msg . "deleteGroup"}}" class="delete-group">
|
||||
<i class="fa fa-remove text-white pull-right text-xs m-t-sm"></i>
|
||||
</a>
|
||||
</div>
|
||||
@@ -39,7 +41,7 @@
|
||||
</header>
|
||||
<ul class="list-group no-radius">
|
||||
<li class="list-group-item">
|
||||
<input type="text" class="add-user-input form-control" placeholder="输入用户名或邮箱添加成员" />
|
||||
<input type="text" class="add-user-input form-control" placeholder="{{msg . "addMemberTips"}}" />
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
@@ -57,7 +59,7 @@
|
||||
<div class="clear">
|
||||
<div class="h3 m-t-xs m-b-xs text-white">
|
||||
<input type="text" data-ever="{{.Title}}" value="{{.Title}}" class="group-title" />
|
||||
<a title="删除分组" class="delete-group">
|
||||
<a title="{{msg $ "deleteGroup"}}" class="delete-group">
|
||||
<i class="fa fa-remove text-white pull-right text-xs m-t-sm"></i>
|
||||
</a>
|
||||
</div>
|
||||
@@ -69,13 +71,13 @@
|
||||
{{range .Users}}
|
||||
<li class="list-group-item" data-id="{{.UserId.Hex}}">
|
||||
{{.Username}} {{if not (eq .Email .Username)}}({{.Email}}){{end}}
|
||||
<a title="删除成员" class="delete-user">
|
||||
<a title="{{msg $ "deleteMember"}}" class="delete-user">
|
||||
<span class="fa fa-remove pull-right text-xs m-t-sm"></span>
|
||||
</a>
|
||||
</li>
|
||||
{{end}}
|
||||
<li class="list-group-item">
|
||||
<input type="text" class="add-user-input form-control" placeholder="输入用户名或邮箱添加成员" />
|
||||
<input type="text" class="add-user-input form-control" placeholder="{{msg $ "addMemberTips"}}" />
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
@@ -85,7 +87,7 @@
|
||||
</div>
|
||||
|
||||
{{template "member/footer.html" .}}
|
||||
<script src="http://leanote.com/public/blog/js/jsrender.js"></script>
|
||||
<script src="/public/blog/js/jsrender.js"></script>
|
||||
<script>
|
||||
var group = {
|
||||
tGroupO: $("#tGroup"),
|
||||
@@ -111,7 +113,7 @@ var group = {
|
||||
addGroupEvent: function() {
|
||||
var self = this;
|
||||
$('.btn-add-group').click(function() {
|
||||
ajaxPost("/member/group/addGroup", {title: "分组名"}, function(re) {
|
||||
ajaxPost("/member/group/addGroup", {title: "Group Title"}, function(re) {
|
||||
if(reIsOk(re)) {
|
||||
var group = re.Item;
|
||||
self.groupsO.prepend(self.tGroupO.render(group))
|
||||
@@ -217,4 +219,4 @@ $(function() {
|
||||
});
|
||||
|
||||
</script>
|
||||
{{template "member/end.html" .}}
|
||||
{{template "member/end.html" .}}
|
||||
@@ -1,5 +1,5 @@
|
||||
{{template "member/top.html" .}}
|
||||
<div class="m-b-md"> <h3 class="m-b-none">{{.userInfo.Username}}, 欢迎来到leanote</h3></div>
|
||||
<div class="m-b-md"> <h3 class="m-b-none">{{.userInfo.Username}}, {{msg . "welcomeToLeanote"}}.</h3></div>
|
||||
|
||||
<section class="panel panel-default">
|
||||
<div class="row m-l-none m-r-none bg-light lter">
|
||||
@@ -26,11 +26,10 @@
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 最新动态 -->
|
||||
<section class="panel panel-default">
|
||||
<h4 class="font-thin padder">
|
||||
Leanote 动态
|
||||
{{msg . "leanoteEvents"}}
|
||||
</h4>
|
||||
<ul class="list-group" id="eventsList"></ul>
|
||||
</section>
|
||||
|
||||
+27
-24
@@ -26,45 +26,47 @@
|
||||
</i>
|
||||
</span>
|
||||
<span>
|
||||
帐户信息
|
||||
{{msg . "accountInfo"}}
|
||||
</span>
|
||||
</a>
|
||||
<!-- 导航列表 -->
|
||||
<ul class="nav lt">
|
||||
{{if $.userInfo.Email}}
|
||||
<li>
|
||||
<a href="/member/user/username">
|
||||
<span>
|
||||
用户名
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/member/user/avatar">
|
||||
<span>
|
||||
头像
|
||||
{{msg . "avatar"}}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
{{if $.userInfo.Email}}
|
||||
<li>
|
||||
<a href="/member/user/username">
|
||||
<span>
|
||||
{{msg . "username"}}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="/member/user/email">
|
||||
<span>
|
||||
邮箱
|
||||
{{msg . "email"}}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/member/user/password">
|
||||
<span>
|
||||
密码
|
||||
{{msg . "password"}}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
{{else}}
|
||||
<li>
|
||||
<a href="/member/user/add_account">
|
||||
<a href="/member/user/addAccount">
|
||||
<span>
|
||||
添加leanote帐户
|
||||
{{msg . "addLeanoteAccount"}}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
@@ -85,14 +87,14 @@
|
||||
</i>
|
||||
</span>
|
||||
<span>
|
||||
博客
|
||||
{{msg . "blog"}}
|
||||
</span>
|
||||
</a>
|
||||
<ul class="nav lt">
|
||||
<li>
|
||||
<a href="/member/blog/index">
|
||||
<span>
|
||||
文章列表
|
||||
{{msg . "postList"}}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
@@ -100,42 +102,43 @@
|
||||
<li>
|
||||
<a href="/member/blog/base">
|
||||
<span>
|
||||
基本信息
|
||||
{{msg . "basicInfoSet"}}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/member/blog/comment">
|
||||
<span>
|
||||
评论
|
||||
{{msg . "comment"}}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="/member/blog/cate">
|
||||
<span>
|
||||
分类
|
||||
{{msg . "cate"}}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/member/blog/single">
|
||||
<span>
|
||||
单页面
|
||||
{{msg . "single"}}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/member/blog/paging">
|
||||
<span>
|
||||
分页与排序设置
|
||||
{{msg . "pagingAndSort"}}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/member/blog/theme">
|
||||
<span>
|
||||
主题
|
||||
{{msg . "theme"}}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
@@ -149,9 +152,9 @@
|
||||
</b>
|
||||
</i>
|
||||
<span>
|
||||
项目组/成员
|
||||
{{msg . "group"}}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</nav>
|
||||
@@ -27,11 +27,6 @@
|
||||
</div>
|
||||
|
||||
<ul class="nav navbar-nav navbar-right m-n hidden-xs nav-user">
|
||||
<li class="hidden-xs">
|
||||
<a href="http://lea.leanote.com" class="dk" target="_blank">
|
||||
lea++
|
||||
</a>
|
||||
</li>
|
||||
<li class="hidden-xs">
|
||||
<a href="/note" class="dk" target="_blank">
|
||||
{{msg . "myNote"}}
|
||||
@@ -79,7 +74,7 @@
|
||||
</section>
|
||||
<footer class="footer lt hidden-xs b-t b-light" style="min-height: initial;
|
||||
padding: 10px 15px;text-align:center;">
|
||||
<a href="http://leanote.com" target="_blank">leanote</a> © 2014
|
||||
<a href="http://leanote.com" target="_blank">leanote</a> © 2015
|
||||
<!--
|
||||
<a href="#nav" data-toggle="class:nav-xs" class="pull-right btn btn-sm btn-default btn-icon">
|
||||
<i class="fa fa-angle-left text">
|
||||
@@ -115,4 +110,4 @@ padding: 10px 15px;text-align:center;">
|
||||
</ul>
|
||||
-->
|
||||
<!-- 主要内容区 -->
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{{template "member/top.html" .}}
|
||||
<div class="m-b-md"> <h3 class="m-b-none">用户名设置</h3></div>
|
||||
<div class="m-b-md"> <h3 class="m-b-none">{{msg . "addLeanoteAccount"}}</h3></div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-sm-6">
|
||||
<div class="col-sm-8">
|
||||
<form id="formData">
|
||||
<section class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
{{template "member/top.html" .}}
|
||||
|
||||
<div class="m-b-md"> <h3 class="m-b-none">头像设置</h3></div>
|
||||
<div class="m-b-md"> <h3 class="m-b-none">{{msg . "avatar"}}</h3></div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-sm-6">
|
||||
<div class="col-sm-8">
|
||||
<form id="uploadAvatar" method="post" action="/file/uploadAvatar" enctype="multipart/form-data">
|
||||
<section class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
@@ -14,7 +14,7 @@
|
||||
<img src="{{if .userInfo.Logo}}{{.userInfo.Logo}}{{else}}/images/blog/default_avatar.png{{end}}" id="avatar"/>
|
||||
</div>
|
||||
<a class="btn btn-success btn-choose-file">
|
||||
<span class="fa fa-upload"></span> Choose Image
|
||||
<span class="fa fa-upload"></span> {{msg . "chooseImage"}}
|
||||
</a>
|
||||
<input type="file" name="file" multiple/>
|
||||
</div>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{{template "member/top.html" .}}
|
||||
<div class="m-b-md"> <h3 class="m-b-none">邮箱设置</h3></div>
|
||||
<div class="m-b-md"> <h3 class="m-b-none">{{msg . "email"}}</h3></div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-sm-6">
|
||||
<div class="col-sm-8">
|
||||
<form id="formData">
|
||||
<section class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
{{template "member/top.html" .}}
|
||||
<div class="m-b-md"> <h3 class="m-b-none">用户名设置</h3></div>
|
||||
|
||||
<div class="m-b-md"> <h3 class="m-b-none">{{msg . "password"}}</h3></div>
|
||||
<div class="row">
|
||||
|
||||
<div class="col-sm-6">
|
||||
<div class="col-sm-8">
|
||||
<form id="formData">
|
||||
<section class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{{template "member/top.html" .}}
|
||||
<div class="m-b-md"> <h3 class="m-b-none">用户名设置</h3></div>
|
||||
<div class="m-b-md"> <h3 class="m-b-none">{{msg . "username"}}</h3></div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-sm-6">
|
||||
<div class="col-sm-8">
|
||||
<form id="formData">
|
||||
<section class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
|
||||
+184
-51
@@ -12,17 +12,19 @@
|
||||
|
||||
<link href="/css/bootstrap.css" rel="stylesheet" />
|
||||
<!-- 先加载, 没有样式, 宽度不定 -->
|
||||
<link rel="stylesheet" href="tinymce/skins/custom/skin.min.css" rel="stylesheet"/>
|
||||
|
||||
<link rel="stylesheet" href="/tinymce/skins/custom/skin.min.css" rel="stylesheet"/>
|
||||
<!-- leanote css -->
|
||||
<link href="css/font-awesome-4.2.0/css/font-awesome.css" rel="stylesheet" />
|
||||
<link href="css/zTreeStyle/zTreeStyle.css" rel="stylesheet" />
|
||||
<link href="/css/font-awesome-4.2.0/css/font-awesome.css" rel="stylesheet" />
|
||||
<link href="/css/zTreeStyle/zTreeStyle.css" rel="stylesheet" />
|
||||
<!-- mdeditor -->
|
||||
<link href="/public/dist/themes/default.css" rel="stylesheet" />
|
||||
|
||||
<script>
|
||||
var hash = location.hash;
|
||||
if(hash == "#writing") {
|
||||
var files = '<link rel="stylesheet" href="css/theme/writting-overwrite.css" type="text/css" id="themeLink" />';
|
||||
if(hash.indexOf("writing") >= 0) {
|
||||
var files = '<link rel="stylesheet" href="/css/theme/writting-overwrite.css" type="text/css" id="themeLink" />';
|
||||
} else {
|
||||
var files ='<link rel="stylesheet" href="css/theme/{{if .userInfo.Theme}}{{.userInfo.Theme}}{{else}}default{{end}}.css" type="text/css" id="themeLink" />';
|
||||
var files ='<link rel="stylesheet" href="/css/theme/{{if .userInfo.Theme}}{{.userInfo.Theme}}{{else}}default{{end}}.css" type="text/css" id="themeLink" />';
|
||||
}
|
||||
document.write(files);
|
||||
</script>
|
||||
@@ -169,7 +171,7 @@ function log(o) {
|
||||
{{if .isAdmin}}
|
||||
<li role="presentation" class="divider"></li>
|
||||
<li role="presentation">
|
||||
<a target="_blank" title="{{msg . "amdin"}}" href="/admin/index">
|
||||
<a target="_blank" title="{{msg . "admin"}}" href="/admin/index">
|
||||
<i class="fa fa-dashboard"></i>
|
||||
<span>{{msg . "admin"}}</span>
|
||||
</a>
|
||||
@@ -184,6 +186,14 @@ function log(o) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
<div class="pull-right top-nav writting-hide lea-blog">
|
||||
<a target="_blank" href="http://lea.leanote.com">
|
||||
lea++
|
||||
</a>
|
||||
</div>
|
||||
-->
|
||||
|
||||
<div class="pull-right top-nav writting-hide" id="myBlog">
|
||||
<a target="_blank" href="{{$.blogUrl}}/{{.userInfo.Username}}">
|
||||
{{msg . "myBlog"}}
|
||||
@@ -327,6 +337,11 @@ function log(o) {
|
||||
<div class="noteSplit" id="notebookSplitter"></div>
|
||||
|
||||
<div id="noteAndEditor">
|
||||
<div id="noteAndEditorMask">
|
||||
<img src="/images/loading-24.gif"/>
|
||||
<br />
|
||||
loading...
|
||||
</div>
|
||||
<div id="noteList">
|
||||
<div class="clearfix" id="notesAndSort" style="position: relative">
|
||||
<div class="pull-left">
|
||||
@@ -411,11 +426,11 @@ function log(o) {
|
||||
<span id="noteReadTags"></span>
|
||||
|
||||
<!-- 修改时间 -->
|
||||
<i class="fa fa-calendar"></i>{{msg . "update"}}
|
||||
<i class="fa fa-clock-o"></i>{{msg . "update"}}
|
||||
<span id="noteReadUpdatedTime"></span>
|
||||
|
||||
<!-- 修改时间 -->
|
||||
<i class="fa fa-calendar"></i>{{msg . "create"}}
|
||||
<i class="fa fa-clock-o"></i>{{msg . "create"}}
|
||||
<span id="noteReadCreatedTime"></span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -544,12 +559,12 @@ function log(o) {
|
||||
</a>
|
||||
</div>
|
||||
<div class="editorBg"></div>
|
||||
<div id="leanoteNav">
|
||||
<div id="leanoteNav" class="leanoteNav">
|
||||
<h1>
|
||||
<i class="fa fa-align-justify" title="文档导航"></i>
|
||||
<i class="fa fa-align-justify" title="{{msg . "nav"}}"></i>
|
||||
<span>{{msg . "nav"}}</span>
|
||||
</h1>
|
||||
<div id="leanoteNavContent">
|
||||
<div id="leanoteNavContent" class="leanoteNavContent">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -570,9 +585,85 @@ function log(o) {
|
||||
</div>
|
||||
|
||||
<div id="mdEditor">
|
||||
|
||||
|
||||
<div class="layout-wrapper-l1">
|
||||
<div class="layout-wrapper-l2">
|
||||
<div class="navbar navbar-default">
|
||||
<div class="navbar-inner" id="wmd-button-bar">
|
||||
<ul class="nav left-buttons">
|
||||
<li class="wmd-button-group1 btn-group"></li>
|
||||
</ul>
|
||||
<ul class="nav left-buttons">
|
||||
<li class="wmd-button-group2 btn-group"></li>
|
||||
</ul>
|
||||
<ul class="nav left-buttons">
|
||||
<li class="wmd-button-group3 btn-group"></li>
|
||||
</ul>
|
||||
<ul class="nav left-buttons">
|
||||
<li class="wmd-button-group5 btn-group"></li>
|
||||
</ul>
|
||||
<!-- 帮助 -->
|
||||
<ul class="nav left-buttons">
|
||||
<li class="wmd-button-group6 btn-group">
|
||||
<li class="wmd-button btn btn-success" id="wmd-help-button" title="Markdown syntax" style="left: 0px; display: none;"><span style="display: none; background-position: 0px 0px;"></span><i class="fa fa-question-circle"></i></li>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<!--
|
||||
<ul class="nav pull-right right-buttons">
|
||||
<li class="offline-status hide">
|
||||
<div class="text-danger">
|
||||
<i class="icon-attention-circled"></i>offline
|
||||
</div>
|
||||
</li>
|
||||
<li class="extension-buttons"></li>
|
||||
</ul>
|
||||
<ul class="nav pull-right title-container">
|
||||
<li><div class="working-indicator"></div></li>
|
||||
<li><a class="btn btn-success file-title-navbar" href="#"
|
||||
title="Rename document"> </a></li>
|
||||
<li><div class="input-file-title-container"><input type="text"
|
||||
class="col-sm-4 form-control hide input-file-title"
|
||||
placeholder="Document title" /></div></li>
|
||||
</ul>
|
||||
-->
|
||||
</div>
|
||||
<div class="editorBg"></div>
|
||||
</div>
|
||||
<div class="layout-wrapper-l3">
|
||||
<div id="left-column">
|
||||
<pre id="wmd-input" class="form-control"><div class="editor-content mousetrap" contenteditable=true></div><div class="editor-margin"></div></pre>
|
||||
</div>
|
||||
<div id="right-column">
|
||||
<div class="preview-panel panel-open" id="preview-panel">
|
||||
<div id="mdSplitter2" class="layout-resizer layout-resizer-preview open" style="-webkit-user-select: none; -webkit-user-drag: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); touch-action: none;"></div>
|
||||
<div class="layout-toggler layout-toggler-preview btn btn-info open" title="Toggle preview" data-open="1"><i class="fa fa-angle-right"></i></div>
|
||||
<div class="preview-container">
|
||||
<div id="preview-contents">
|
||||
<div id="wmd-preview" class="preview-content"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="extension-preview-buttons">
|
||||
<div id="leanoteNavMd" class="leanoteNav">
|
||||
<h1>
|
||||
<i class="fa fa-align-justify" title="{{msg . "nav"}}"></i>
|
||||
<span>{{msg . "nav"}}</span>
|
||||
</h1>
|
||||
<div id="leanoteNavContentMd" class="leanoteNavContent table-of-contents">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="wmd-button-bar" class="hide"></div>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
<div id="wmd-button-bar" id="mdBar"></div>
|
||||
<div class="editorBg"></div>
|
||||
<!-- 为了scroll -->
|
||||
|
||||
<div class="clearfix" id="mdEditorPreview">
|
||||
<div id="left-column">
|
||||
@@ -588,11 +679,59 @@ function log(o) {
|
||||
</div>
|
||||
</div>
|
||||
<textarea id="md-section-helper"></textarea>
|
||||
-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- mdEditor -->
|
||||
<!-- v2 -->
|
||||
<div class="modal fade modal-insert-link">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal"
|
||||
aria-hidden="true">×</button>
|
||||
<h4 class="modal-title">Hyperlink</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>Please provide the link URL and an optional title:</p>
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon"><i class="icon-globe"></i></span><input
|
||||
id="input-insert-link" type="text" class="col-sm-5 form-control"
|
||||
placeholder='http://example.com/ "optional title"' />
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a href="#" class="btn btn-default" data-dismiss="modal">Cancel</a>
|
||||
<a href="#" class="btn btn-primary action-insert-link"
|
||||
data-dismiss="modal">OK</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 插入图片 -->
|
||||
<div class="modal fade modal-insert-image">
|
||||
<div class="modal-dialog" style="width: 840px">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal"
|
||||
aria-hidden="true">×</button>
|
||||
<h4 class="modal-title">Image</h4>
|
||||
</div>
|
||||
<div class="modal-body" style="padding-top: 0; padding-bottom: 0">
|
||||
<iframe name="mdImageManager" style="width: 100%; height: 350px" scrolling="no" id="leauiIfrForMD" src="" frameborder="0"></iframe>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a href="#" class="btn btn-default"
|
||||
data-dismiss="modal">Cancel</a> <a href="#"
|
||||
class="btn btn-primary action-insert-image" data-dismiss="modal">Insert Image</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- v1 -->
|
||||
<!-- Hidden Popup Modal -->
|
||||
<div class="modal fade bs-modal-sm" id="editorDialog" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-sm">
|
||||
@@ -737,17 +876,22 @@ function log(o) {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="js/jquery-1.9.0.min.js"></script>
|
||||
<script src="js/jquery.ztree.all-3.5.js"></script>
|
||||
<script src="js/i18n/msg.{{.locale}}.js"></script>
|
||||
<script src="js/common.js"></script>
|
||||
<script src="/js/jquery-1.9.0.min.js"></script>
|
||||
<script src="/js/jquery.ztree.all-3.5.js"></script>
|
||||
<script src="/js/i18n/msg.{{.locale}}.js"></script>
|
||||
<script src="/js/common.js"></script>
|
||||
<script>
|
||||
var UrlPrefix = "{{.siteUrl}}"; // 为了发weibo
|
||||
var UrlPrefix = '{{.siteUrl}}'; // 为了发weibo
|
||||
var UserInfo = {{.userInfo|jsonJs}};
|
||||
var notebooks = {{.notebooks|jsonJs}};
|
||||
var shareNotebooks = {{.shareNotebooks|jsonJs}};
|
||||
var sharedUserInfos = {{.sharedUserInfos|jsonJs}};
|
||||
var notes = {{.notes|jsonJs}}
|
||||
var curNoteId = '{{.curNoteId}}';
|
||||
var curNotebookId = '{{.curNotebookId}}';
|
||||
var curSharedNoteNotebookId = '{{.curSharedNoteNotebookId}}';
|
||||
var curSharedUserId = '{{.curSharedUserId}}';
|
||||
var notes = {{.notes|jsonJs}};
|
||||
var latestNotes = {{if .latestNotes}}{{.latestNotes|jsonJs}}{{else}}[]{{end}};
|
||||
var noteContentJson = {{.noteContentJson|jsonJs}};
|
||||
var tagsJson = {{.tags|jsonJs}};
|
||||
LEA.locale = "{{.locale}}";
|
||||
@@ -755,44 +899,33 @@ var GlobalConfigs = {{.globalConfigs|jsonJs}}; // 2014/11/9 beta2
|
||||
</script>
|
||||
|
||||
<!-- 渲染view -->
|
||||
<script src="tinymce/tinymce.js"></script>
|
||||
<script src="js/app/page.js"></script>
|
||||
<script src="/tinymce/tinymce.js"></script>
|
||||
<script src="/public/libs/ace/ace.js"></script>
|
||||
<script src="/js/app/page.js"></script>
|
||||
<script src="/js/jQuery-slimScroll-1.3.0/jquery.slimscroll.js"></script>
|
||||
<script src="/js/contextmenu/jquery.contextmenu.js"></script>
|
||||
<script src="js/jquery-cookie.js"></script>
|
||||
<script src="js/bootstrap-min.js"></script>
|
||||
<script src="js/app/note.js"></script>
|
||||
<script src="js/app/tag.js"></script>
|
||||
<script src="js/app/notebook.js"></script>
|
||||
<script src="js/app/share.js"></script>
|
||||
<script src="js/object_id-min.js"></script>
|
||||
<script src="js/ZeroClipboard/ZeroClipboard-min.js"></script>
|
||||
<script src="/js/bootstrap-min.js"></script>
|
||||
<script src="/js/app/note.js"></script>
|
||||
<script src="/js/app/tag.js"></script>
|
||||
<script src="/js/app/notebook.js"></script>
|
||||
<script src="/js/app/share.js"></script>
|
||||
<script src="/js/object_id-min.js"></script>
|
||||
<script>
|
||||
Notebook.renderNotebooks(notebooks);
|
||||
Share.renderShareNotebooks(sharedUserInfos, shareNotebooks);
|
||||
|
||||
Note.setNoteCache(noteContentJson);
|
||||
Note.renderNotes(notes);
|
||||
if(!isEmpty(notes)) {
|
||||
Note.changeNote(notes[0].NoteId);
|
||||
}
|
||||
|
||||
// Note.chanteNote设置content
|
||||
// Note.renderNoteContent(noteContentJson)
|
||||
|
||||
Tag.renderTagNav(tagsJson);
|
||||
|
||||
// init notebook后才调用
|
||||
initSlimScroll();
|
||||
initPage();
|
||||
</script>
|
||||
|
||||
|
||||
<!-- context-menu -->
|
||||
<link rel="stylesheet" href="/js/contextmenu/css/contextmenu.css" type="text/css" />
|
||||
<!-- code -->
|
||||
<link href="/public/mdeditor/editor/google-code-prettify/prettify.css" rel="stylesheet" />
|
||||
<!-- js version 2.0 use require.js -->
|
||||
|
||||
<!-- v2 use require.js, mdeditor -->
|
||||
<script>
|
||||
window.baseDir = '/public/dist';
|
||||
window.require = {
|
||||
baseUrl: window.baseDir,
|
||||
deps: ['main']
|
||||
};
|
||||
</script>
|
||||
<script src="/js/require.js"></script>
|
||||
<script src="/js/main.js"></script>
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
+185
-52
@@ -12,17 +12,19 @@
|
||||
|
||||
<link href="/css/bootstrap.css" rel="stylesheet" />
|
||||
<!-- 先加载, 没有样式, 宽度不定 -->
|
||||
<link rel="stylesheet" href="tinymce/skins/custom/skin.min.css" rel="stylesheet"/>
|
||||
|
||||
<link rel="stylesheet" href="/tinymce/skins/custom/skin.min.css" rel="stylesheet"/>
|
||||
<!-- leanote css -->
|
||||
<link href="css/font-awesome-4.2.0/css/font-awesome.css" rel="stylesheet" />
|
||||
<link href="css/zTreeStyle/zTreeStyle.css" rel="stylesheet" />
|
||||
<link href="/css/font-awesome-4.2.0/css/font-awesome.css" rel="stylesheet" />
|
||||
<link href="/css/zTreeStyle/zTreeStyle.css" rel="stylesheet" />
|
||||
<!-- mdeditor -->
|
||||
<link href="/public/dist/themes/default.css" rel="stylesheet" />
|
||||
|
||||
<script>
|
||||
var hash = location.hash;
|
||||
if(hash == "#writing") {
|
||||
var files = '<link rel="stylesheet" href="css/theme/writting-overwrite.css" type="text/css" id="themeLink" />';
|
||||
if(hash.indexOf("writing") >= 0) {
|
||||
var files = '<link rel="stylesheet" href="/css/theme/writting-overwrite.css" type="text/css" id="themeLink" />';
|
||||
} else {
|
||||
var files ='<link rel="stylesheet" href="css/theme/{{if .userInfo.Theme}}{{.userInfo.Theme}}{{else}}default{{end}}.css" type="text/css" id="themeLink" />';
|
||||
var files ='<link rel="stylesheet" href="/css/theme/{{if .userInfo.Theme}}{{.userInfo.Theme}}{{else}}default{{end}}.css" type="text/css" id="themeLink" />';
|
||||
}
|
||||
document.write(files);
|
||||
</script>
|
||||
@@ -169,7 +171,7 @@ function log(o) {
|
||||
{{if .isAdmin}}
|
||||
<li role="presentation" class="divider"></li>
|
||||
<li role="presentation">
|
||||
<a target="_blank" title="{{msg . "amdin"}}" href="/admin/index">
|
||||
<a target="_blank" title="{{msg . "admin"}}" href="/admin/index">
|
||||
<i class="fa fa-dashboard"></i>
|
||||
<span>{{msg . "admin"}}</span>
|
||||
</a>
|
||||
@@ -184,6 +186,14 @@ function log(o) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
<div class="pull-right top-nav writting-hide lea-blog">
|
||||
<a target="_blank" href="http://lea.leanote.com">
|
||||
lea++
|
||||
</a>
|
||||
</div>
|
||||
-->
|
||||
|
||||
<div class="pull-right top-nav writting-hide" id="myBlog">
|
||||
<a target="_blank" href="{{$.blogUrl}}/{{.userInfo.Username}}">
|
||||
{{msg . "myBlog"}}
|
||||
@@ -327,6 +337,11 @@ function log(o) {
|
||||
<div class="noteSplit" id="notebookSplitter"></div>
|
||||
|
||||
<div id="noteAndEditor">
|
||||
<div id="noteAndEditorMask">
|
||||
<img src="/images/loading-24.gif"/>
|
||||
<br />
|
||||
loading...
|
||||
</div>
|
||||
<div id="noteList">
|
||||
<div class="clearfix" id="notesAndSort" style="position: relative">
|
||||
<div class="pull-left">
|
||||
@@ -411,11 +426,11 @@ function log(o) {
|
||||
<span id="noteReadTags"></span>
|
||||
|
||||
<!-- 修改时间 -->
|
||||
<i class="fa fa-calendar"></i>{{msg . "update"}}
|
||||
<i class="fa fa-clock-o"></i>{{msg . "update"}}
|
||||
<span id="noteReadUpdatedTime"></span>
|
||||
|
||||
<!-- 修改时间 -->
|
||||
<i class="fa fa-calendar"></i>{{msg . "create"}}
|
||||
<i class="fa fa-clock-o"></i>{{msg . "create"}}
|
||||
<span id="noteReadCreatedTime"></span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -544,12 +559,12 @@ function log(o) {
|
||||
</a>
|
||||
</div>
|
||||
<div class="editorBg"></div>
|
||||
<div id="leanoteNav">
|
||||
<div id="leanoteNav" class="leanoteNav">
|
||||
<h1>
|
||||
<i class="fa fa-align-justify" title="文档导航"></i>
|
||||
<i class="fa fa-align-justify" title="{{msg . "nav"}}"></i>
|
||||
<span>{{msg . "nav"}}</span>
|
||||
</h1>
|
||||
<div id="leanoteNavContent">
|
||||
<div id="leanoteNavContent" class="leanoteNavContent">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -570,9 +585,85 @@ function log(o) {
|
||||
</div>
|
||||
|
||||
<div id="mdEditor">
|
||||
|
||||
|
||||
<div class="layout-wrapper-l1">
|
||||
<div class="layout-wrapper-l2">
|
||||
<div class="navbar navbar-default">
|
||||
<div class="navbar-inner" id="wmd-button-bar">
|
||||
<ul class="nav left-buttons">
|
||||
<li class="wmd-button-group1 btn-group"></li>
|
||||
</ul>
|
||||
<ul class="nav left-buttons">
|
||||
<li class="wmd-button-group2 btn-group"></li>
|
||||
</ul>
|
||||
<ul class="nav left-buttons">
|
||||
<li class="wmd-button-group3 btn-group"></li>
|
||||
</ul>
|
||||
<ul class="nav left-buttons">
|
||||
<li class="wmd-button-group5 btn-group"></li>
|
||||
</ul>
|
||||
<!-- 帮助 -->
|
||||
<ul class="nav left-buttons">
|
||||
<li class="wmd-button-group6 btn-group">
|
||||
<li class="wmd-button btn btn-success" id="wmd-help-button" title="Markdown syntax" style="left: 0px; display: none;"><span style="display: none; background-position: 0px 0px;"></span><i class="fa fa-question-circle"></i></li>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<!--
|
||||
<ul class="nav pull-right right-buttons">
|
||||
<li class="offline-status hide">
|
||||
<div class="text-danger">
|
||||
<i class="icon-attention-circled"></i>offline
|
||||
</div>
|
||||
</li>
|
||||
<li class="extension-buttons"></li>
|
||||
</ul>
|
||||
<ul class="nav pull-right title-container">
|
||||
<li><div class="working-indicator"></div></li>
|
||||
<li><a class="btn btn-success file-title-navbar" href="#"
|
||||
title="Rename document"> </a></li>
|
||||
<li><div class="input-file-title-container"><input type="text"
|
||||
class="col-sm-4 form-control hide input-file-title"
|
||||
placeholder="Document title" /></div></li>
|
||||
</ul>
|
||||
-->
|
||||
</div>
|
||||
<div class="editorBg"></div>
|
||||
</div>
|
||||
<div class="layout-wrapper-l3">
|
||||
<div id="left-column">
|
||||
<pre id="wmd-input" class="form-control"><div class="editor-content mousetrap" contenteditable=true></div><div class="editor-margin"></div></pre>
|
||||
</div>
|
||||
<div id="right-column">
|
||||
<div class="preview-panel panel-open" id="preview-panel">
|
||||
<div id="mdSplitter2" class="layout-resizer layout-resizer-preview open" style="-webkit-user-select: none; -webkit-user-drag: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); touch-action: none;"></div>
|
||||
<div class="layout-toggler layout-toggler-preview btn btn-info open" title="Toggle preview" data-open="1"><i class="fa fa-angle-right"></i></div>
|
||||
<div class="preview-container">
|
||||
<div id="preview-contents">
|
||||
<div id="wmd-preview" class="preview-content"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="extension-preview-buttons">
|
||||
<div id="leanoteNavMd" class="leanoteNav">
|
||||
<h1>
|
||||
<i class="fa fa-align-justify" title="{{msg . "nav"}}"></i>
|
||||
<span>{{msg . "nav"}}</span>
|
||||
</h1>
|
||||
<div id="leanoteNavContentMd" class="leanoteNavContent table-of-contents">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="wmd-button-bar" class="hide"></div>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
<div id="wmd-button-bar" id="mdBar"></div>
|
||||
<div class="editorBg"></div>
|
||||
<!-- 为了scroll -->
|
||||
|
||||
<div class="clearfix" id="mdEditorPreview">
|
||||
<div id="left-column">
|
||||
@@ -588,11 +679,59 @@ function log(o) {
|
||||
</div>
|
||||
</div>
|
||||
<textarea id="md-section-helper"></textarea>
|
||||
-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- mdEditor -->
|
||||
<!-- v2 -->
|
||||
<div class="modal fade modal-insert-link">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal"
|
||||
aria-hidden="true">×</button>
|
||||
<h4 class="modal-title">Hyperlink</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>Please provide the link URL and an optional title:</p>
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon"><i class="icon-globe"></i></span><input
|
||||
id="input-insert-link" type="text" class="col-sm-5 form-control"
|
||||
placeholder='http://example.com/ "optional title"' />
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a href="#" class="btn btn-default" data-dismiss="modal">Cancel</a>
|
||||
<a href="#" class="btn btn-primary action-insert-link"
|
||||
data-dismiss="modal">OK</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 插入图片 -->
|
||||
<div class="modal fade modal-insert-image">
|
||||
<div class="modal-dialog" style="width: 840px">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal"
|
||||
aria-hidden="true">×</button>
|
||||
<h4 class="modal-title">Image</h4>
|
||||
</div>
|
||||
<div class="modal-body" style="padding-top: 0; padding-bottom: 0">
|
||||
<iframe name="mdImageManager" style="width: 100%; height: 350px" scrolling="no" id="leauiIfrForMD" src="" frameborder="0"></iframe>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a href="#" class="btn btn-default"
|
||||
data-dismiss="modal">Cancel</a> <a href="#"
|
||||
class="btn btn-primary action-insert-image" data-dismiss="modal">Insert Image</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- v1 -->
|
||||
<!-- Hidden Popup Modal -->
|
||||
<div class="modal fade bs-modal-sm" id="editorDialog" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-sm">
|
||||
@@ -737,17 +876,22 @@ function log(o) {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="js/jquery-1.9.0.min.js"></script>
|
||||
<script src="js/jquery.ztree.all-3.5.js"></script>
|
||||
<script src="js/i18n/msg.{{.locale}}.js"></script>
|
||||
<script src="js/common-min.js"></script>
|
||||
<script src="/js/jquery-1.9.0.min.js"></script>
|
||||
<script src="/js/jquery.ztree.all-3.5-min.js"></script>
|
||||
<script src="/js/i18n/msg.{{.locale}}.js"></script>
|
||||
<script src="/js/common-min.js"></script>
|
||||
<script>
|
||||
var UrlPrefix = "{{.siteUrl}}"; // 为了发weibo
|
||||
var UrlPrefix = '{{.siteUrl}}'; // 为了发weibo
|
||||
var UserInfo = {{.userInfo|jsonJs}};
|
||||
var notebooks = {{.notebooks|jsonJs}};
|
||||
var shareNotebooks = {{.shareNotebooks|jsonJs}};
|
||||
var sharedUserInfos = {{.sharedUserInfos|jsonJs}};
|
||||
var notes = {{.notes|jsonJs}}
|
||||
var curNoteId = '{{.curNoteId}}';
|
||||
var curNotebookId = '{{.curNotebookId}}';
|
||||
var curSharedNoteNotebookId = '{{.curSharedNoteNotebookId}}';
|
||||
var curSharedUserId = '{{.curSharedUserId}}';
|
||||
var notes = {{.notes|jsonJs}};
|
||||
var latestNotes = {{if .latestNotes}}{{.latestNotes|jsonJs}}{{else}}[]{{end}};
|
||||
var noteContentJson = {{.noteContentJson|jsonJs}};
|
||||
var tagsJson = {{.tags|jsonJs}};
|
||||
LEA.locale = "{{.locale}}";
|
||||
@@ -755,44 +899,33 @@ var GlobalConfigs = {{.globalConfigs|jsonJs}}; // 2014/11/9 beta2
|
||||
</script>
|
||||
|
||||
<!-- 渲染view -->
|
||||
<script src="tinymce/tinymce.js"></script>
|
||||
<script src="js/app/page-min.js"></script>
|
||||
<script src="/js/jQuery-slimScroll-1.3.0/jquery.slimscroll.js"></script>
|
||||
<script src="/tinymce/tinymce.min.js"></script>
|
||||
<script src="/public/libs/ace/ace.js"></script>
|
||||
<script src="/js/app/page-min.js"></script>
|
||||
<script src="/js/jQuery-slimScroll-1.3.0/jquery.slimscroll-min.js"></script>
|
||||
<script src="/js/contextmenu/jquery.contextmenu-min.js"></script>
|
||||
<script src="js/jquery-cookie.js"></script>
|
||||
<script src="js/bootstrap-min.js"></script>
|
||||
<script src="js/app/note-min.js"></script>
|
||||
<script src="js/app/tag-min.js"></script>
|
||||
<script src="js/app/notebook-min.js"></script>
|
||||
<script src="js/app/share-min.js"></script>
|
||||
<script src="js/object_id-min.js"></script>
|
||||
<script src="js/ZeroClipboard/ZeroClipboard-min.js"></script>
|
||||
<script src="/js/bootstrap-min.js"></script>
|
||||
<script src="/js/app/note-min.js"></script>
|
||||
<script src="/js/app/tag-min.js"></script>
|
||||
<script src="/js/app/notebook-min.js"></script>
|
||||
<script src="/js/app/share-min.js"></script>
|
||||
<script src="/js/object_id-min.js"></script>
|
||||
<script>
|
||||
Notebook.renderNotebooks(notebooks);
|
||||
Share.renderShareNotebooks(sharedUserInfos, shareNotebooks);
|
||||
|
||||
Note.setNoteCache(noteContentJson);
|
||||
Note.renderNotes(notes);
|
||||
if(!isEmpty(notes)) {
|
||||
Note.changeNote(notes[0].NoteId);
|
||||
}
|
||||
|
||||
// Note.chanteNote设置content
|
||||
// Note.renderNoteContent(noteContentJson)
|
||||
|
||||
Tag.renderTagNav(tagsJson);
|
||||
|
||||
// init notebook后才调用
|
||||
initSlimScroll();
|
||||
initPage();
|
||||
</script>
|
||||
|
||||
|
||||
<!-- context-menu -->
|
||||
<link rel="stylesheet" href="/js/contextmenu/css/contextmenu.css" type="text/css" />
|
||||
<!-- code -->
|
||||
<link href="/public/mdeditor/editor/google-code-prettify/prettify.css" rel="stylesheet" />
|
||||
<!-- js version 2.0 use require.js -->
|
||||
|
||||
<!-- v2 use require.js, mdeditor -->
|
||||
<script>
|
||||
window.baseDir = '/public/dist';
|
||||
window.require = {
|
||||
baseUrl: window.baseDir,
|
||||
deps: ['main']
|
||||
};
|
||||
</script>
|
||||
<script src="/js/require.js"></script>
|
||||
<script src="/js/main-min.js"></script>
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user