v1.0
只读模式 group, 分享 评论更多问题 博客标签总是存在一个
This commit is contained in:
1 parent
7e458bb433
commit
6987a38820
1453 files changed
+114558
-91533
No files matched your search
@@ -824,7 +824,7 @@ func (c Blog) LikePost(noteId string, callback string) revel.Result {
|
||||
re.Ok, re.Item = blogService.LikeBlog(noteId, userId)
|
||||
return c.RenderJsonP(callback, re)
|
||||
}
|
||||
func (c Blog) GetComments(noteId string) revel.Result {
|
||||
func (c Blog) GetComments(noteId string, callback string) revel.Result {
|
||||
// 评论
|
||||
userId := c.GetUserId()
|
||||
page := c.GetPage()
|
||||
@@ -836,6 +836,10 @@ func (c Blog) GetComments(noteId string) revel.Result {
|
||||
result["comments"] = comments
|
||||
result["commentUserInfo"] = commentUserInfo
|
||||
re.Item = result
|
||||
|
||||
if callback != "" {
|
||||
return c.RenderJsonP(callback, result)
|
||||
}
|
||||
|
||||
return c.RenderJson(re)
|
||||
}
|
||||
|
||||
@@ -49,10 +49,11 @@ func (c Note) Index(noteId string) revel.Result {
|
||||
hasRightNoteId := false
|
||||
if IsObjectId(noteId) {
|
||||
note := noteService.GetNoteById(noteId)
|
||||
var noteOwner = note.UserId.Hex()
|
||||
noteContent = noteService.GetNoteContent(noteId, noteOwner)
|
||||
|
||||
if note.NoteId != "" {
|
||||
var noteOwner = note.UserId.Hex()
|
||||
noteContent = noteService.GetNoteContent(noteId, noteOwner)
|
||||
|
||||
hasRightNoteId = true
|
||||
c.RenderArgs["curNoteId"] = noteId
|
||||
c.RenderArgs["curNotebookId"] = note.NotebookId.Hex()
|
||||
|
||||
@@ -335,8 +335,12 @@ func (c ApiNote) AddNote(noteOrContent info.ApiNote) revel.Result {
|
||||
Abstract: noteOrContent.Abstract}
|
||||
|
||||
// 通过内容得到Desc, abstract
|
||||
note.Desc = SubStringHTMLToRaw(noteContent.Content, 50)
|
||||
noteContent.Abstract = SubStringHTML(noteContent.Content, 200, "")
|
||||
if noteOrContent.Abstract == "" {
|
||||
note.Desc = SubStringHTMLToRaw(noteContent.Content, 200)
|
||||
noteContent.Abstract = SubStringHTML(noteContent.Content, 200, "")
|
||||
} else {
|
||||
note.Desc = SubStringHTMLToRaw(noteContent.Abstract, 200)
|
||||
}
|
||||
|
||||
note = noteService.AddNoteAndContentApi(note, noteContent, myUserId)
|
||||
|
||||
@@ -352,7 +356,7 @@ func (c ApiNote) AddNote(noteOrContent info.ApiNote) revel.Result {
|
||||
noteOrContent.UpdatedTime = note.UpdatedTime
|
||||
noteOrContent.UserId = c.getUserId()
|
||||
noteOrContent.IsMarkdown = note.IsMarkdown
|
||||
// 删除一些不要返回的
|
||||
// 删除一些不要返回的, 删除Desc?
|
||||
noteOrContent.Content = ""
|
||||
noteOrContent.Abstract = ""
|
||||
// apiNote := info.NoteToApiNote(note, noteOrContent.Files)
|
||||
@@ -494,8 +498,12 @@ func (c ApiNote) UpdateNote(noteOrContent info.ApiNote) revel.Result {
|
||||
}
|
||||
|
||||
if c.Has("Content") {
|
||||
// 通过内容得到Desc, abstract
|
||||
noteUpdate["Desc"] = SubStringHTMLToRaw(noteOrContent.Content, 50)
|
||||
// 通过内容得到Desc, 如果有Abstract, 则用Abstract生成Desc
|
||||
if noteOrContent.Abstract == "" {
|
||||
noteUpdate["Desc"] = SubStringHTMLToRaw(noteOrContent.Content, 200)
|
||||
} else {
|
||||
noteUpdate["Desc"] = SubStringHTMLToRaw(noteOrContent.Abstract, 200)
|
||||
}
|
||||
}
|
||||
|
||||
afterNoteUsn := 0
|
||||
@@ -570,4 +578,4 @@ func (c ApiNote) GetHistories(noteId string) revel.Result {
|
||||
}
|
||||
return c.RenderJson(re)
|
||||
}
|
||||
*/
|
||||
*/
|
||||
@@ -460,7 +460,7 @@ func (c MemberBlog) ImportTheme() revel.Result {
|
||||
var ext string
|
||||
_, ext = SplitFilename(filename)
|
||||
if ext != ".zip" {
|
||||
re.Msg = "请上传zip文件"
|
||||
re.Msg = "Please upload zip file"
|
||||
return c.RenderJson(re)
|
||||
}
|
||||
|
||||
@@ -472,7 +472,7 @@ func (c MemberBlog) ImportTheme() revel.Result {
|
||||
|
||||
// > 10M?
|
||||
if len(data) > 10*1024*1024 {
|
||||
re.Msg = "文件大于10M"
|
||||
re.Msg = "File is big than 10M"
|
||||
return c.RenderJson(re)
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ type ShareNotebook struct {
|
||||
UserId bson.ObjectId `bson:"UserId"`
|
||||
ToUserId bson.ObjectId `bson:"ToUserId,omitempty"`
|
||||
ToGroupId bson.ObjectId `bson:"ToGroupId,omitempty"` // 分享给的用户组
|
||||
ToGroup Group `ToGroup,omitempty` // 仅仅为了显示, 不存储, 分组信息
|
||||
ToGroup Group `ToGroup,omitempty` // 仅仅为了显示, 不存储, 分组信息
|
||||
NotebookId bson.ObjectId `bson:"NotebookId"`
|
||||
Seq int `bson:"Seq"` // 排序
|
||||
Perm int `bson:"Perm"` // 权限, 其下所有notes 0只读, 1可修改
|
||||
@@ -138,7 +138,7 @@ type ShareNote struct {
|
||||
UserId bson.ObjectId `bson:"UserId"`
|
||||
ToUserId bson.ObjectId `bson:"ToUserId,omitempty"`
|
||||
ToGroupId bson.ObjectId `bson:"ToGroupId,omitempty"` // 分享给的用户组
|
||||
ToGroup Group `ToGroup,omitempty` // 仅仅为了显示, 不存储, 分组信息
|
||||
ToGroup Group `ToGroup,omitempty` // 仅仅为了显示, 不存储, 分组信息
|
||||
NoteId bson.ObjectId `bson:"NoteId"`
|
||||
Perm int `bson:"Perm"` // 权限, 0只读, 1可修改
|
||||
CreatedTime time.Time `CreatedTime`
|
||||
|
||||
@@ -14,7 +14,7 @@ type Theme struct {
|
||||
Version string `Version`
|
||||
Author string `Author`
|
||||
AuthorUrl string `AuthorUrl`
|
||||
Path string `Path` // 文件夹路径
|
||||
Path string `Path` // 文件夹路径, public/upload/54d7620d99c37b030600002c/themes/54d867c799c37b533e000001
|
||||
Info map[string]interface{} `Info` // 所有信息
|
||||
IsActive bool `IsActive` // 是否在用
|
||||
|
||||
|
||||
+42
-3
@@ -51,6 +51,18 @@ func init() {
|
||||
revel.TemplateFuncs["raw"] = func(str string) template.HTML {
|
||||
return template.HTML(str)
|
||||
}
|
||||
revel.TemplateFuncs["trim"] = func(str string) string {
|
||||
str = strings.Trim(str, " ")
|
||||
str = strings.Trim(str, " ")
|
||||
|
||||
str = strings.Trim(str, "\n")
|
||||
str = strings.Trim(str, " ")
|
||||
|
||||
// 以下两个空格不一样
|
||||
str = strings.Trim(str, " ")
|
||||
str = strings.Trim(str, " ")
|
||||
return str
|
||||
}
|
||||
revel.TemplateFuncs["add"] = func(i int) string {
|
||||
i = i + 1;
|
||||
return fmt.Sprintf("%v", i)
|
||||
@@ -145,8 +157,33 @@ func init() {
|
||||
return template.HTML(tagStr)
|
||||
}
|
||||
|
||||
revel.TemplateFuncs["blogTagsForExport"] = func(renderArgs map[string]interface{}, tags []string) template.HTML {
|
||||
if tags == nil || len(tags) == 0 {
|
||||
return ""
|
||||
}
|
||||
tagStr := ""
|
||||
lenTags := len(tags)
|
||||
|
||||
for i, tag := range tags {
|
||||
str := tag
|
||||
var classes = "label"
|
||||
if InArray([]string{"red", "blue", "yellow", "green"}, tag) {
|
||||
classes += " label-" + tag
|
||||
} else {
|
||||
classes += " label-default"
|
||||
}
|
||||
|
||||
classes += " label-post"
|
||||
tagStr += "<span class=\"" + classes + "\" >" + str + "</span>";
|
||||
if i != lenTags - 1 {
|
||||
tagStr += " "
|
||||
}
|
||||
}
|
||||
return template.HTML(tagStr)
|
||||
}
|
||||
|
||||
// lea++
|
||||
revel.TemplateFuncs["blogTagsLea"] = func(renderArgs map[string]interface{}, tags []string, isRecommend bool) template.HTML {
|
||||
revel.TemplateFuncs["blogTagsLea"] = func(renderArgs map[string]interface{}, tags []string, typeStr string) template.HTML {
|
||||
if tags == nil || len(tags) == 0 {
|
||||
return ""
|
||||
}
|
||||
@@ -155,10 +192,12 @@ func init() {
|
||||
lenTags := len(tags)
|
||||
|
||||
tagPostUrl := "http://lea.leanote.com/"
|
||||
if isRecommend {
|
||||
if typeStr == "recommend" {
|
||||
tagPostUrl += "?tag=";
|
||||
} else {
|
||||
} else if typeStr == "latest" {
|
||||
tagPostUrl += "latest?tag=";
|
||||
} else {
|
||||
tagPostUrl += "subscription?tag=";
|
||||
}
|
||||
|
||||
for i, tag := range tags {
|
||||
|
||||
@@ -56,6 +56,14 @@ func ClearDir(dir string) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func MkdirAll(dir string) bool {
|
||||
err := os.MkdirAll(dir, 0777)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// list dir's all file, return filenames
|
||||
func ListDir(dir string) []string {
|
||||
f, err := os.Open(dir)
|
||||
|
||||
+22
-1
@@ -10,6 +10,7 @@ import (
|
||||
"io"
|
||||
"gopkg.in/mgo.v2/bson"
|
||||
"time"
|
||||
"strings"
|
||||
math_rand "math/rand"
|
||||
)
|
||||
|
||||
@@ -314,4 +315,24 @@ func InArray(arr []string, str string) bool {
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// 将名称的特殊字符去掉
|
||||
func FixFilename(filename string) string {
|
||||
if filename != "" {
|
||||
// 把特殊字段给替换掉
|
||||
// str := `life "%&()+,/:;<>=?@\|`
|
||||
// . == \\.
|
||||
// $ === \\$
|
||||
reg, _ := regexp.Compile("\\.|/|#|\\$|!|\\^|\\*|'| |\"|%|&|\\(|\\)|\\+|\\,|/|:|;|<|>|=|\\?|@|\\||\\\\")
|
||||
filename = reg.ReplaceAllString(filename, "-")
|
||||
filename = strings.Trim(filename, "-") // 左右单独的-去掉
|
||||
// 把空格替换成-
|
||||
// filename = strings.Replace(filename, " ", "-", -1)
|
||||
for strings.Index(filename, "--") >= 0 { // 防止出现连续的--
|
||||
filename = strings.Replace(filename, "--", "-", -1)
|
||||
}
|
||||
return filename
|
||||
}
|
||||
return filename
|
||||
}
|
||||
+16
-20
@@ -6,6 +6,7 @@ import (
|
||||
"os/exec"
|
||||
"io/ioutil"
|
||||
"strings"
|
||||
// "time"
|
||||
)
|
||||
|
||||
/*
|
||||
@@ -32,7 +33,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/object_id", "js/ZeroClipboard/ZeroClipboard"}
|
||||
|
||||
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/"
|
||||
@@ -91,7 +92,6 @@ func dev() {
|
||||
"notebook.js": "notebook-min.js",
|
||||
"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",
|
||||
@@ -107,6 +107,13 @@ func dev() {
|
||||
for key, value := range m {
|
||||
content = strings.Replace(content, key, value, -1)
|
||||
}
|
||||
|
||||
// var time = time.Now().Unix() % 1000
|
||||
|
||||
// content = strings.Replace(content, "-min.js", fmt.Sprintf("-min.js?r=%d", time), -1)
|
||||
// content = strings.Replace(content, "default{{end}}.css", fmt.Sprintf("default{{end}}.css?r=%d", time), 1)
|
||||
// content = strings.Replace(content, "writting-overwrite.css", fmt.Sprintf("writting-overwrite.css?r=%d", time), 1)
|
||||
|
||||
ioutil.WriteFile(target, []byte(content), os.ModeAppend)
|
||||
}
|
||||
|
||||
@@ -114,8 +121,10 @@ func dev() {
|
||||
func tinymce() {
|
||||
// cmdStr := "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", "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"
|
||||
cmd := exec.Command("/bin/sh", "-c", "grunt minify");
|
||||
cmd.Dir = base + "/tinymce_4.1.9"
|
||||
|
||||
fmt.Println("正在build tinymce");
|
||||
|
||||
// 必须要先删除
|
||||
cmd2 := exec.Command("/bin/sh", "-c", "rm " + cmd.Dir + "/js/tinymce/tinymce.dev.js")
|
||||
@@ -123,32 +132,19 @@ func tinymce() {
|
||||
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))
|
||||
}
|
||||
|
||||
func main() {
|
||||
// 压缩tinymce
|
||||
tinymce()
|
||||
// tinymce()
|
||||
|
||||
dev();
|
||||
|
||||
// 其它零散的需要压缩的js
|
||||
otherJss := []string{"tinymce/tinymce", "js/main", "js/app/page", "js/contextmenu/jquery.contextmenu",
|
||||
"mdeditor/editor/scrollLink",
|
||||
"mdeditor/editor/editor",
|
||||
"mdeditor/editor/jquery.waitforimages",
|
||||
"mdeditor/editor/pagedown/local/Markdown.local.zh",
|
||||
"mdeditor/editor/pagedown/local/Markdown.local.en",
|
||||
"mdeditor/editor/pagedown/Markdown.Editor",
|
||||
"mdeditor/editor/pagedown/Markdown.Sanitizer",
|
||||
"mdeditor/editor/pagedown/Markdown.Converter",
|
||||
"mdeditor/editor/Markdown.Extra",
|
||||
"mdeditor/editor/underscore",
|
||||
"mdeditor/editor/mathJax",
|
||||
"js/jQuery-slimScroll-1.3.0/jquery.slimscroll",
|
||||
"js/app/editor_drop_paste",
|
||||
"js/app/attachment_upload",
|
||||
otherJss := []string{"js/main", "js/app/page", "js/contextmenu/jquery.contextmenu",
|
||||
"js/jquery.ztree.all-3.5",
|
||||
"js/jQuery-slimScroll-1.3.0/jquery.slimscroll",
|
||||
}
|
||||
|
||||
@@ -1197,6 +1197,10 @@ func (this *BlogService) FixBlog(blog info.BlogItem) info.Post {
|
||||
LikeNum: blog.LikeNum,
|
||||
IsMarkdown: blog.IsMarkdown,
|
||||
}
|
||||
if blog2.Tags != nil && len(blog2.Tags) > 0 && blog2.Tags[0] != "" {
|
||||
} else {
|
||||
blog2.Tags = nil
|
||||
}
|
||||
return blog2
|
||||
}
|
||||
|
||||
|
||||
+65
-11
@@ -32,11 +32,21 @@ func (this *GroupService) DeleteGroup(userId, groupId string) (ok bool, msg stri
|
||||
return false, "groupHasUsers"
|
||||
}
|
||||
*/
|
||||
if !this.isMyGroup(userId, groupId) {
|
||||
return false, "notMyGroup"
|
||||
}
|
||||
|
||||
// 删除分组后, 需要删除所有用户分享到该组的笔记本, 笔记
|
||||
|
||||
shareService.DeleteAllShareNotebookGroup(groupId);
|
||||
shareService.DeleteAllShareNoteGroup(groupId);
|
||||
|
||||
db.DeleteAll(db.GroupUsers, bson.M{"GroupId": bson.ObjectIdHex(groupId)})
|
||||
return db.DeleteByIdAndUserId(db.Groups, groupId, userId), ""
|
||||
|
||||
// TODO 删除分组后, 在shareNote, shareNotebook中也要删除
|
||||
}
|
||||
|
||||
// 修改group标题
|
||||
func (this *GroupService) UpdateGroupTitle(userId, groupId, title string) (ok bool) {
|
||||
return db.UpdateByIdAndUserIdField(db.Groups, groupId, userId, "Title", title)
|
||||
@@ -44,9 +54,14 @@ func (this *GroupService) UpdateGroupTitle(userId, groupId, title string) (ok bo
|
||||
|
||||
// 得到用户的所有分组(包括下的所有用户)
|
||||
func (this *GroupService) GetGroupsAndUsers(userId string) ([]info.Group) {
|
||||
// 得到分组s
|
||||
/*
|
||||
// 得到我的分组
|
||||
groups := []info.Group{}
|
||||
db.ListByQ(db.Groups, bson.M{"UserId": bson.ObjectIdHex(userId)}, &groups)
|
||||
*/
|
||||
// 我的分组, 及我所属的分组
|
||||
groups := this.GetGroupsContainOf(userId);
|
||||
|
||||
// 得到其下的用户
|
||||
for i, group := range groups {
|
||||
group.Users = this.GetUsers(group.GroupId.Hex())
|
||||
@@ -62,6 +77,28 @@ func (this *GroupService) GetGroups(userId string) ([]info.Group) {
|
||||
return groups
|
||||
}
|
||||
|
||||
// 得到我的和我所属组的ids
|
||||
func (this *GroupService) GetMineAndBelongToGroupIds(userId string) ([]bson.ObjectId) {
|
||||
// 所属组
|
||||
groupIds := this.GetBelongToGroupIds(userId)
|
||||
|
||||
m := map[bson.ObjectId]bool{}
|
||||
for _, groupId := range groupIds {
|
||||
m[groupId] = true
|
||||
}
|
||||
|
||||
// 我的组
|
||||
myGroups := this.GetGroups(userId)
|
||||
|
||||
for _, group := range myGroups {
|
||||
if !m[group.GroupId] {
|
||||
groupIds = append(groupIds, group.GroupId)
|
||||
}
|
||||
}
|
||||
|
||||
return groupIds
|
||||
}
|
||||
|
||||
// 获取包含此用户的组对象数组
|
||||
// 获取该用户所属组, 和我的组
|
||||
func (this *GroupService) GetGroupsContainOf(userId string) []info.Group {
|
||||
@@ -129,11 +166,26 @@ func (this *GroupService) GetBelongToGroupIds(userId string) ([]bson.ObjectId) {
|
||||
|
||||
func (this *GroupService) isMyGroup(ownUserId, groupId string) (ok bool) {
|
||||
return db.Has(db.Groups, bson.M{"_id": bson.ObjectIdHex(groupId), "UserId": bson.ObjectIdHex(ownUserId)})
|
||||
}
|
||||
}
|
||||
|
||||
// 判断组中是否包含指定用户
|
||||
func (this *GroupService) IsExistsGroupUser(userId, groupId string) (ok bool) {
|
||||
// 如果我拥有这个组, 那也行
|
||||
if this.isMyGroup(userId, groupId) {
|
||||
return true
|
||||
}
|
||||
return db.Has(db.GroupUsers, bson.M{"UserId": bson.ObjectIdHex(userId), "GroupId": bson.ObjectIdHex(groupId)})
|
||||
}
|
||||
|
||||
// 为group添加用户
|
||||
// 用户是否已存在?
|
||||
func (this *GroupService) AddUser(ownUserId, groupId, userId string) (ok bool, msg string) {
|
||||
// groupId是否是ownUserId的?
|
||||
/*
|
||||
if !this.IsExistsGroupUser(ownUserId, groupId) {
|
||||
return false, "forbidden"
|
||||
}
|
||||
*/
|
||||
if !this.isMyGroup(ownUserId, groupId) {
|
||||
return false, "forbidden"
|
||||
}
|
||||
@@ -150,20 +202,22 @@ func (this *GroupService) AddUser(ownUserId, groupId, userId string) (ok bool, m
|
||||
CreatedTime: time.Now(),
|
||||
}), ""
|
||||
}
|
||||
|
||||
// 删除用户
|
||||
func (this *GroupService) DeleteUser(ownUserId, groupId, userId string) (ok bool, msg string) {
|
||||
// groupId是否是ownUserId的?
|
||||
/*
|
||||
if !this.IsExistsGroupUser(ownUserId, groupId) {
|
||||
return false, "forbidden"
|
||||
}
|
||||
*/
|
||||
if !this.isMyGroup(ownUserId, groupId) {
|
||||
return false, "forbidden"
|
||||
}
|
||||
|
||||
// 删除该用户分享到本组的笔记本, 笔记
|
||||
shareService.DeleteShareNotebookGroupWhenDeleteGroupUser(userId, groupId);
|
||||
shareService.DeleteShareNoteGroupWhenDeleteGroupUser(userId, groupId);
|
||||
|
||||
return db.Delete(db.GroupUsers, bson.M{"GroupId": bson.ObjectIdHex(groupId), "UserId": bson.ObjectIdHex(userId)}), ""
|
||||
}
|
||||
|
||||
// 判断组中是否包含指定用户
|
||||
func (this *GroupService) IsExistsGroupUser(userId, groupId string) (ok bool) {
|
||||
// 如果我拥有这个组, 那也行
|
||||
if this.isMyGroup(userId, groupId) {
|
||||
return true
|
||||
}
|
||||
return db.Has(db.GroupUsers, bson.M{"UserId": bson.ObjectIdHex(userId), "GroupId": bson.ObjectIdHex(groupId)})
|
||||
}
|
||||
@@ -8,6 +8,8 @@ import (
|
||||
. "github.com/leanote/leanote/app/lea"
|
||||
"sort"
|
||||
"time"
|
||||
"strings"
|
||||
// "html"
|
||||
)
|
||||
|
||||
// 笔记本
|
||||
@@ -40,7 +42,9 @@ func ParseAndSortNotebooks(userNotebooks []info.Notebook, noParentDelete, needSo
|
||||
for _, each := range userNotebooks {
|
||||
newNotebooks := info.Notebooks{Subs: info.SubNotebooks{}}
|
||||
newNotebooks.NotebookId = each.NotebookId
|
||||
newNotebooks.Title = each.Title
|
||||
newNotebooks.Title = each.Title;
|
||||
// newNotebooks.Title = html.EscapeString(each.Title)
|
||||
newNotebooks.Title = strings.Replace(strings.Replace(each.Title, "<script>", "", -1), "</script", "", -1)
|
||||
newNotebooks.Seq = each.Seq
|
||||
newNotebooks.UserId = each.UserId
|
||||
newNotebooks.ParentNotebookId = each.ParentNotebookId
|
||||
|
||||
@@ -33,8 +33,9 @@ type ShareService struct {
|
||||
|
||||
// 谁共享给了我的Query
|
||||
func (this *ShareService) getOrQ(userId string) bson.M {
|
||||
// 得到我参与的组织
|
||||
groupIds := groupService.GetBelongToGroupIds(userId)
|
||||
// 得到我和和我参与的组织
|
||||
groupIds := groupService.GetMineAndBelongToGroupIds(userId)
|
||||
|
||||
q := bson.M{}
|
||||
if len(groupIds) > 0 {
|
||||
orQ := []bson.M{
|
||||
@@ -51,6 +52,8 @@ func (this *ShareService) getOrQ(userId string) bson.M {
|
||||
|
||||
// 得到共享给我的笔记本和用户(谁共享给了我)
|
||||
func (this *ShareService) GetShareNotebooks(userId string) (info.ShareNotebooksByUser, []info.User) {
|
||||
myUserId := userId
|
||||
|
||||
// 得到共享给我的用户s信息
|
||||
// 得到我参与的组织
|
||||
q := this.getOrQ(userId)
|
||||
@@ -64,7 +67,15 @@ func (this *ShareService) GetShareNotebooks(userId string) (info.ShareNotebooksB
|
||||
db.Distinct(db.ShareNotebooks, q, "UserId", &userIds2) // BUG之前是userId1, 2014/12/29
|
||||
|
||||
userIds := append(userIds1, userIds2...)
|
||||
|
||||
userInfos := userService.GetUserInfosOrderBySeq(userIds);
|
||||
// 不要我的id
|
||||
for i, userInfo := range userInfos {
|
||||
if userInfo.UserId.Hex() == myUserId {
|
||||
userInfos = append(userInfos[:i], userInfos[i+1:]...)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------
|
||||
// 得到他们共享给我的notebooks
|
||||
@@ -102,6 +113,11 @@ func (this *ShareService) GetShareNotebooks(userId string) (info.ShareNotebooksB
|
||||
// 先建立userId => []
|
||||
for _, eachSub := range subShareNotebooks {
|
||||
userId := eachSub.Notebook.UserId
|
||||
// 我自己的, 算了
|
||||
if userId.Hex() == myUserId {
|
||||
continue;
|
||||
}
|
||||
|
||||
if _, ok := shareNotebooksByUsersMap[userId]; ok {
|
||||
shareNotebooksByUsersMap[userId] = append(shareNotebooksByUsersMap[userId], eachSub)
|
||||
} else {
|
||||
@@ -779,3 +795,36 @@ func (this *ShareService) DeleteShareNotebookGroup(userId, notebookId, groupId s
|
||||
"ToGroupId": bson.ObjectIdHex(groupId),
|
||||
});
|
||||
}
|
||||
|
||||
//--------------------
|
||||
// 删除组时, 删除所有的
|
||||
//--------------------
|
||||
|
||||
func (this *ShareService) DeleteAllShareNotebookGroup(groupId string) bool {
|
||||
return db.Delete(db.ShareNotebooks, bson.M{
|
||||
"ToGroupId": bson.ObjectIdHex(groupId),
|
||||
});
|
||||
}
|
||||
func (this *ShareService) DeleteAllShareNoteGroup(groupId string) bool {
|
||||
return db.Delete(db.ShareNotes, bson.M{
|
||||
"ToGroupId": bson.ObjectIdHex(groupId),
|
||||
});
|
||||
}
|
||||
|
||||
//--------------------
|
||||
// 删除组内用户时, 删除其分享的
|
||||
//--------------------
|
||||
|
||||
func (this *ShareService) DeleteShareNotebookGroupWhenDeleteGroupUser(userId, groupId string) bool {
|
||||
return db.Delete(db.ShareNotebooks, bson.M{
|
||||
"UserId": bson.ObjectIdHex(userId),
|
||||
"ToGroupId": bson.ObjectIdHex(groupId),
|
||||
});
|
||||
}
|
||||
|
||||
func (this *ShareService) DeleteShareNoteGroupWhenDeleteGroupUser(userId, groupId string) bool {
|
||||
return db.Delete(db.ShareNotes, bson.M{
|
||||
"UserId": bson.ObjectIdHex(userId),
|
||||
"ToGroupId": bson.ObjectIdHex(groupId),
|
||||
});
|
||||
}
|
||||
@@ -7,9 +7,8 @@
|
||||
<a href="http://weibo.com/leanotecom" target="_blank"><i class="fa fa-weibo"></i></a>
|
||||
<br />
|
||||
leanote@leanote.com
|
||||
<div id="beian">
|
||||
<a href="http://www.miibeian.gov.cn" target="_blank">沪ICP备14006011号</a>
|
||||
</div>
|
||||
<br />
|
||||
Copyright © 2014-2015 <a href="http://leanote.com">Leanote</a>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<i class="fa fa-globe fa-3x icon-muted"></i>
|
||||
|
||||
+26
-24
@@ -5,8 +5,9 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="keywords" content="leanote,leanote.com">
|
||||
<meta name="description" content="leanote, {{msg $ "moto"}}">
|
||||
<meta name="author" content="leanote">
|
||||
<meta name="description" content="Leanote, {{msg $ "moto"}}">
|
||||
<meta property="qc:admins" content="2451332115167456375" />
|
||||
<meta name="author" content="leanote">
|
||||
<title>{{.title}}</title>
|
||||
|
||||
<link href="/css/bootstrap.css" rel="stylesheet">
|
||||
@@ -37,30 +38,29 @@ function log(o) {
|
||||
</div>
|
||||
|
||||
<div id="navbar" class="navbar-collapse collapse">
|
||||
<div id="lang"><a data-lang="en-us">English</a><a data-lang="zh-cn">中文</a></div>
|
||||
|
||||
<ul class="nav navbar-nav navbar-left">
|
||||
<li><a href="/index#" target="body" class="smooth-scroll">{{msg . "home"}}</a></li>
|
||||
<!--
|
||||
<li><a href="/index#aboutLeanote" target="#aboutLeanote" class="smooth-scroll">{{msg . "aboutLeanote"}}</a> </li>
|
||||
-->
|
||||
<li><a href="/index#donate" target="#donate" class="smooth-scroll">{{msg . "donate"}}</a> </li>
|
||||
<li><a id="leanoteBlog" href="http://lea.leanote.com" 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>
|
||||
<li><a href="/index#" data-target="body" class="smooth-scroll">{{msg . "home"}}</a></li>
|
||||
<li style="position: relative;">
|
||||
<a id="" href="http://leanote.com/service" title="" class="">{{msg . "service"}}</a>
|
||||
<div class="red-circle" style=""></div>
|
||||
</li>
|
||||
|
||||
<li id="loginBtns">
|
||||
{{if .userInfo.Email}}
|
||||
{{msg . "hi"}}, {{.userInfo.Username}}
|
||||
<a href="{{$.noteUrl}}">{{msg . "myNote"}}</a>
|
||||
<a href="/logout">{{msg . "logout"}}</a>
|
||||
{{else}}
|
||||
<a href="/login">{{msg . "login"}}</a>
|
||||
{{if .openRegister}}
|
||||
<a href="/register" class="btn-register">{{msg . "register"}}</a>
|
||||
{{end}}
|
||||
{{end}}
|
||||
<li style="position: relative; margin-right: 3px;">
|
||||
<a href="http://bbs.leanote.com" target="_blank" class="">{{msg . "discussion"}}</a>
|
||||
</li>
|
||||
<li><a id="leanoteBlog" href="http://lea.leanote.com" target="_blank" title="lea++, leanote blog platform" class="">lea++</a></li>
|
||||
<li><a id="leanoteApp" href="http://app.leanote.com" target="_blank" title="Leanote App" class="">{{msg . "desktopApp"}}</a></li>
|
||||
<li><a href="http://leanote.org" target="_blank" title="leanote.org" class="">leanote.org</a></li>
|
||||
|
||||
{{if .userInfo.Email}}
|
||||
<li id="loginBtns">
|
||||
{{msg . "hi"}}, {{.userInfo.Username}}
|
||||
<a href="{{$.noteUrl}}">{{msg . "myNote"}}</a>
|
||||
<a href="/logout">{{msg . "logout"}}</a>
|
||||
</li>
|
||||
{{end}}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -90,9 +90,11 @@ function log(o) {
|
||||
</div>
|
||||
|
||||
<ul id="blogNav" class="pull-right">
|
||||
<li><a href="/index#" target="body" class="smooth-scroll">{{msg . "home"}}</a></li>
|
||||
<li><a href="/index#donate" target="#donate" class="smooth-scroll">{{msg . "donate"}}</a> </li>
|
||||
<li><a href="#" target="body" class="smooth-scroll">{{msg . "home"}}</a></li>
|
||||
<li><a href="#download" target="#download" class="smooth-scroll">{{msg . "download"}}</a> </li>
|
||||
<li><a href="#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 style="position: absolute;
|
||||
@@ -106,4 +108,4 @@ function log(o) {
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
-->
|
||||
@@ -4,7 +4,7 @@
|
||||
</style>
|
||||
<section>
|
||||
<div class="header">
|
||||
<h2>leanote, {{msg . "moto"}}</h2>
|
||||
<h2>Leanote, {{msg . "moto"}}</h2>
|
||||
<p>{{msg . "moto3"}}</p>
|
||||
<p>
|
||||
Knowledge, Blog, Sharing, Cooperation... all in leanote
|
||||
@@ -120,6 +120,19 @@ $(function() {
|
||||
var targetOffset = $(t).offset().top - 80;
|
||||
$('html,body').animate({scrollTop: targetOffset}, 300);
|
||||
});
|
||||
|
||||
function setCookie(name, value) {
|
||||
var Days = 10*365;
|
||||
var exp = new Date();
|
||||
exp.setTime(exp.getTime() + Days*24*60*60*1000);
|
||||
document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
|
||||
}
|
||||
|
||||
$('#lang a').click(function() {
|
||||
var lang = $(this).data('lang');
|
||||
setCookie('LEANOTE_LANG', lang);
|
||||
location.reload();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
</style>
|
||||
<section>
|
||||
<div class="header">
|
||||
<h2>leanote, {{msg . "moto"}}</h2>
|
||||
<h2>Leanote, {{msg . "moto"}}</h2>
|
||||
<p>{{msg . "moto3"}}</p>
|
||||
<p>{{msg . "moto2"}}</p>
|
||||
|
||||
@@ -119,6 +119,19 @@ $(function() {
|
||||
var targetOffset = $(t).offset().top - 80;
|
||||
$('html,body').animate({scrollTop: targetOffset}, 300);
|
||||
});
|
||||
|
||||
function setCookie(name, value) {
|
||||
var Days = 10*365;
|
||||
var exp = new Date();
|
||||
exp.setTime(exp.getTime() + Days*24*60*60*1000);
|
||||
document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
|
||||
}
|
||||
|
||||
$('#lang a').click(function() {
|
||||
var lang = $(this).data('lang');
|
||||
setCookie('LEANOTE_LANG', lang);
|
||||
location.reload();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="keywords" content="leanote,leanote.com">
|
||||
<meta name="description" content="leanote, {{msg $ "moto"}}">
|
||||
<meta name="author" content="leanote">
|
||||
|
||||
<title>{{.title}}</title>
|
||||
<link href="{{.siteUrl}}/css/bootstrap.css" rel="stylesheet">
|
||||
<link id="styleLink" href="{{.siteUrl}}/css/toImage.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<div id="content">
|
||||
<h1 class="title">
|
||||
{{.blog.Title}}
|
||||
</h1>
|
||||
<div class="created-time">
|
||||
{{ if .userBlog.Logo}}
|
||||
<img src="{{.userBlog.Logo}}" id="logo">
|
||||
{{else}}
|
||||
<img src="{{$.siteUrl}}/images/blog/default_avatar.png" id="logo">
|
||||
{{end}}
|
||||
{{.userInfo.Username}}
|
||||
|
||||
{{if .blog.Tags}}
|
||||
<img src="{{$.siteUrl}}/images/blog/tag.png" id="tag">
|
||||
{{blogTags .blog.Tags}}
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
<div class="desc">
|
||||
{{if .blog.IsMarkdown }}
|
||||
<div id="markdownContent" style="display: none">
|
||||
<!-- 用textarea装html, 防止得到的值失真 -->
|
||||
<textarea>
|
||||
{{.content | raw}}
|
||||
</textarea>
|
||||
</div>
|
||||
<div id="parsedContent">
|
||||
</div>
|
||||
{{else}}
|
||||
{{.content | raw}}
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="footer">
|
||||
<p>
|
||||
{{ if .userBlog.Logo}}
|
||||
<img src="{{.userBlog.Logo}}" id="logo">
|
||||
{{else}}
|
||||
<img src="{{$.siteUrl}}/images/blog/default_avatar.png" id="logo">
|
||||
{{end}}
|
||||
(<a href="#">http://blog.leanote.com/{{.userInfo.Username}}</a>)
|
||||
</p>
|
||||
|
||||
<img src="{{.siteUrl}}/images/logo/leanote_white.png" id="leanote_logo"/>
|
||||
<p>
|
||||
leanote, {{msg $ "moto"}}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<script src="{{.siteUrl}}/js/jquery-1.9.0.min.js"></script>
|
||||
<script src="{{.siteUrl}}/js/bootstrap-min.js"></script>
|
||||
|
||||
<link href="{{.siteUrl}}/public/mdeditor/editor/google-code-prettify/prettify.css" type="text/css" rel="stylesheet">
|
||||
<script src="{{.siteUrl}}/public/mdeditor/editor/google-code-prettify/prettify.js"></script>
|
||||
<script>
|
||||
$("pre").addClass("prettyprint linenums");
|
||||
prettyPrint();
|
||||
</script>
|
||||
|
||||
{{if .blog.IsMarkdown }}
|
||||
<script src="{{.siteUrl}}/public/mdeditor/editor/google-code-prettify/prettify.js"></script>
|
||||
<script src="{{.siteUrl}}/public/mdeditor/editor/pagedown/Markdown.Converter.js"></script>
|
||||
<script src="{{.siteUrl}}/public/mdeditor/editor/pagedown/Markdown.Sanitizer.js"></script>
|
||||
<script src="{{.siteUrl}}/public/mdeditor/editor/pagedown/Markdown.Editor.js"></script>
|
||||
<script src="{{.siteUrl}}/public/mdeditor/editor/pagedown/local/Markdown.local.zh.js"></script>
|
||||
<script src="{{.siteUrl}}/public/mdeditor/editor/Markdown.Extra.js"></script>
|
||||
|
||||
<!--mathjax-->
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({ tex2jax: { inlineMath: [['$','$'], ["\\(","\\)"]], processEscapes: true }, messageStyle: "none"});
|
||||
</script>
|
||||
<script src="{{.siteUrl}}/public/mdeditor/editor/mathJax.js"></script>
|
||||
<script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
|
||||
<script>
|
||||
var content = $.trim($("#markdownContent textarea").val());
|
||||
var converter = Markdown.getSanitizingConverter();
|
||||
Markdown.Extra.init(converter, {extensions: ["tables", "fenced_code_gfm", "def_list"]});
|
||||
var html = converter.makeHtml(content);
|
||||
$("#parsedContent").html(html);
|
||||
$("pre").addClass("prettyprint linenums");
|
||||
prettyPrint();
|
||||
MathJax.Hub.Queue(["Typeset",MathJax.Hub,"wmd-preview"]);
|
||||
</script>
|
||||
{{end}}
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,4 +0,0 @@
|
||||
lif------------
|
||||
e
|
||||
|
||||
you can
|
||||
@@ -40,23 +40,32 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<style>
|
||||
.mce-btn.mce-active, .mce-btn.mce-active:hover {
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
.mce-btn {
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
</style>
|
||||
{{template "member/footer.html" .}}
|
||||
<script type="text/javascript" src="/tinymce/tinymce.js"></script>
|
||||
<script>
|
||||
var urlPrefix = "{{.siteUrl}}";
|
||||
var LeaAce = {nowIsInAce: function() {return false;}};
|
||||
$(function() {
|
||||
tinymce.init({
|
||||
selector : "#content1",
|
||||
content_css : [ "/css/bootstrap.css", "/css/editor/editor.css" ],
|
||||
skin : "custom",
|
||||
content_css : ["/css/editor/editor.css" ],
|
||||
theme : "leanote",
|
||||
language : "{{.locale}}",
|
||||
height : 300,
|
||||
width : "100%",
|
||||
skin : "custom",
|
||||
// skin : "custom",
|
||||
plugins : [
|
||||
"advlist autolink link leanote_image lists charmap hr ",
|
||||
"advlist autolink link lists charmap hr ",
|
||||
"searchreplace visualblocks visualchars tabfocus",
|
||||
"table contextmenu directionality textcolor paste fullpage textcolor"],
|
||||
"table contextmenu directionality textcolor fullpage textcolor"],
|
||||
toolbar1 : "formatselect |fontselect fontsizeselect| forecolor backcolor | bold italic underline strikethrough | bullist numlist |",
|
||||
menubar : false,
|
||||
statusbar : false,
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
{{range .myTpls}}
|
||||
<a href="#" class="list-group-item " data-file="{{.}}">
|
||||
<i class="fa fa-remove icon-muted remove-file" title="delete file" ></i>
|
||||
{{.}}
|
||||
<span class="filename" data-filename="{{.}}">{{.}}</span>
|
||||
<span class="badge"></span>
|
||||
</a>
|
||||
{{end}}
|
||||
@@ -123,7 +123,7 @@ var theme = {
|
||||
saveBtnO: $("#saveBtn"),
|
||||
newFileO: $("#newFile"),
|
||||
curTpl: "",
|
||||
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"}}"},
|
||||
tplInfos: {"header.html": "{{msg . "header"}}", "footer.html": "{{msg . "footer"}}", "index.html": "{{msg . "index"}}", "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();
|
||||
@@ -171,12 +171,22 @@ var theme = {
|
||||
newFile: function() {
|
||||
var self = this;
|
||||
self.newFileO.click(function() {
|
||||
art.prompt("文件名", function(file){
|
||||
// 文件是否存在?
|
||||
|
||||
|
||||
art.prompt("Filename", function(file) {
|
||||
if(!file) {
|
||||
return;
|
||||
}
|
||||
var t = '<a href="#" class="list-group-item " data-file="' + file + '"> <i class="fa fa-remove icon-muted remove-file" title="delete file" ></i> ' + file + '<span class="badge"></span></a>';
|
||||
if($('[data-filename="' + file + '"]').length > 0) {
|
||||
art.alert('File exists');
|
||||
return;
|
||||
}
|
||||
var t = $('<a href="#" class="list-group-item " data-file="' + file + '"> <i class="fa fa-remove icon-muted remove-file" title="delete file" ></i> <span class="filename" data-filename="' + file + '">' + file + '</span><span class="badge"></span></a>');
|
||||
$(".file-list").append(t);
|
||||
self.cache[file] = "";
|
||||
// trigger click, 选中之
|
||||
t.click();
|
||||
});
|
||||
});
|
||||
},
|
||||
@@ -206,6 +216,9 @@ var theme = {
|
||||
var content = editor.getValue()
|
||||
|
||||
var filename = self.curTpl;
|
||||
if(!filename) {
|
||||
return;
|
||||
}
|
||||
// 之前的内容是否有改动
|
||||
if(self.cache[filename] == content) {
|
||||
return;
|
||||
@@ -234,7 +247,7 @@ var theme = {
|
||||
renderContent: function(name, content) {
|
||||
var self = this;
|
||||
self.curTplO.html(name);
|
||||
self.curTpl = name; // 这里设计
|
||||
self.curTpl = name; // 这里才设置
|
||||
var lang = "html";
|
||||
if(name.indexOf(".js") > 0 || name.indexOf(".json") > 0) {
|
||||
lang = "javascript";
|
||||
@@ -251,8 +264,8 @@ var theme = {
|
||||
renderTpl: function(name) {
|
||||
var self = this;
|
||||
var content = "";
|
||||
self.curTpl = name; // 这里设置
|
||||
if(self.cache[name]) {
|
||||
self.curTpl = ""; // 这里设置为空
|
||||
if(self.cache[name] != undefined) {
|
||||
content = self.cache[name];
|
||||
self.renderContent(name, content);
|
||||
return;
|
||||
@@ -264,6 +277,7 @@ var theme = {
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
//-----------------
|
||||
// theme images
|
||||
imageListO: $("#imageList"),
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
<meta name="apple-touch-fullscreen" content="yes">
|
||||
<meta name=”apple-mobile-web-app-capable” content=”yes” />
|
||||
<meta name="keywords" content="leanote,leanote.com">
|
||||
<meta name="description" content="leanote, Not Just A Notebook">
|
||||
<title>leanote, Not Just A Notebook</title>
|
||||
<meta name="description" content="Leanote, {{msg $ "moto"}}">
|
||||
<title>Leanote, {{msg $ "moto"}}</title>
|
||||
|
||||
<link href="/css/bootstrap.css" rel="stylesheet" />
|
||||
<!-- 先加载, 没有样式, 宽度不定 -->
|
||||
@@ -186,13 +186,11 @@ 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}}">
|
||||
@@ -416,29 +414,7 @@ function log(o) {
|
||||
<div class="noteSplit" id="noteSplitter"></div>
|
||||
|
||||
<div id="note">
|
||||
<!-- 只读模式 -->
|
||||
<div id="noteRead">
|
||||
<div id="noteReadContainer">
|
||||
<div id="noteReadTop">
|
||||
<h2 id="noteReadTitle"></h2>
|
||||
<div class="clearfix" id="noteReadInfo">
|
||||
<i class="fa fa-bookmark-o"></i>
|
||||
<span id="noteReadTags"></span>
|
||||
|
||||
<!-- 修改时间 -->
|
||||
<i class="fa fa-clock-o"></i>{{msg . "update"}}
|
||||
<span id="noteReadUpdatedTime"></span>
|
||||
|
||||
<!-- 修改时间 -->
|
||||
<i class="fa fa-clock-o"></i>{{msg . "create"}}
|
||||
<span id="noteReadCreatedTime"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="noteReadContent">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 遮罩, 为了resize3Columns用 -->
|
||||
<div id="noteMask" class="note-mask"></div>
|
||||
<div id="noteMaskForLoading" class="note-mask">
|
||||
@@ -546,17 +522,38 @@ function log(o) {
|
||||
<div id="noteTitleDiv">
|
||||
<input name="noteTitle" id="noteTitle" value="" placeholder="{{msg . "unTitled"}}" tabindex="1" />
|
||||
</div>
|
||||
|
||||
<!-- 只读时 -->
|
||||
<div id="noteReadTop">
|
||||
<h2 id="noteReadTitle"></h2>
|
||||
<div class="clearfix" id="noteReadInfo">
|
||||
<i class="fa fa-bookmark-o"></i>
|
||||
<span id="noteReadTags"></span>
|
||||
|
||||
<!-- 修改时间 -->
|
||||
<i class="fa fa-clock-o"></i> {{msg . "update"}}
|
||||
<span id="noteReadUpdatedTime"></span>
|
||||
|
||||
<!-- 修改时间 -->
|
||||
<i class="fa fa-clock-o"></i> {{msg . "create"}}
|
||||
<span id="noteReadCreatedTime"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="editor">
|
||||
<!-- 编辑器 -->
|
||||
<div id="mceToolbar">
|
||||
<div id="popularToolbar"
|
||||
style="position: absolute; right: 30px; left: 0"></div>
|
||||
<a
|
||||
style="dispaly: block; position: absolute; cursor: pointer; right: 10px; padding: 3px 10px"
|
||||
id="moreBtn"> <i class="fa fa-angle-down"></i>
|
||||
</a>
|
||||
<div id="mceToolbarContainer">
|
||||
<div id="popularToolbar" style="position: absolute; right: 30px; left: 0"></div>
|
||||
<a id="moreBtn"> <i class="fa more-fa"></i></a>
|
||||
</div>
|
||||
<!-- 查看信息 -->
|
||||
<div id="infoToolbar" class="info-toolbar">
|
||||
<a class="toolbar-update"><i class="fa fa-pencil"></i> <span class="lang">{{msg . "modify"}}</span></a>
|
||||
<span class="lang">{{msg . "created"}}</span>: <span class="created-time">2015-04-03</span>
|
||||
<span class="lang">{{msg . "updated"}}</span>: <span class="updated-time">2015-05-01</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="editorBg"></div>
|
||||
<div id="leanoteNav" class="leanoteNav">
|
||||
@@ -585,49 +582,56 @@ 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 id="mdInfoToolbar" class="info-toolbar">
|
||||
<a class="toolbar-update"><i class="fa fa-pencil"></i> <span class="lang">{{msg . "modify"}}</span></a>
|
||||
<span class="lang">{{msg . "created"}}</span>: <span class="created-time">2015-04-03</span>
|
||||
<span class="lang">{{msg . "updated"}}</span>: <span class="updated-time">2015-05-01</span>
|
||||
</div>
|
||||
|
||||
<div class="wmd-button-bar-inner">
|
||||
<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>
|
||||
<div class="editorBg"></div>
|
||||
</div>
|
||||
@@ -900,6 +904,7 @@ var GlobalConfigs = {{.globalConfigs|jsonJs}}; // 2014/11/9 beta2
|
||||
|
||||
<!-- 渲染view -->
|
||||
<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>
|
||||
@@ -919,13 +924,14 @@ initPage();
|
||||
|
||||
<!-- v2 use require.js, mdeditor -->
|
||||
<script>
|
||||
window.baseDir = '/public/dist';
|
||||
// 当tinymce.dev.js时, 请注释require
|
||||
window.require = {
|
||||
baseUrl: window.baseDir,
|
||||
deps: ['main']
|
||||
baseUrl: '/public',
|
||||
};
|
||||
</script>
|
||||
<script src="/js/require.js"></script>
|
||||
<script src="/public/dist/main.min.js"></script>
|
||||
<script src="/public/js/upload_paste/main.js"></script>
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
+81
-75
@@ -7,8 +7,8 @@
|
||||
<meta name="apple-touch-fullscreen" content="yes">
|
||||
<meta name=”apple-mobile-web-app-capable” content=”yes” />
|
||||
<meta name="keywords" content="leanote,leanote.com">
|
||||
<meta name="description" content="leanote, Not Just A Notebook">
|
||||
<title>leanote, Not Just A Notebook</title>
|
||||
<meta name="description" content="Leanote, {{msg $ "moto"}}">
|
||||
<title>Leanote, {{msg $ "moto"}}</title>
|
||||
|
||||
<link href="/css/bootstrap.css" rel="stylesheet" />
|
||||
<!-- 先加载, 没有样式, 宽度不定 -->
|
||||
@@ -186,13 +186,11 @@ 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}}">
|
||||
@@ -416,29 +414,7 @@ function log(o) {
|
||||
<div class="noteSplit" id="noteSplitter"></div>
|
||||
|
||||
<div id="note">
|
||||
<!-- 只读模式 -->
|
||||
<div id="noteRead">
|
||||
<div id="noteReadContainer">
|
||||
<div id="noteReadTop">
|
||||
<h2 id="noteReadTitle"></h2>
|
||||
<div class="clearfix" id="noteReadInfo">
|
||||
<i class="fa fa-bookmark-o"></i>
|
||||
<span id="noteReadTags"></span>
|
||||
|
||||
<!-- 修改时间 -->
|
||||
<i class="fa fa-clock-o"></i>{{msg . "update"}}
|
||||
<span id="noteReadUpdatedTime"></span>
|
||||
|
||||
<!-- 修改时间 -->
|
||||
<i class="fa fa-clock-o"></i>{{msg . "create"}}
|
||||
<span id="noteReadCreatedTime"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="noteReadContent">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 遮罩, 为了resize3Columns用 -->
|
||||
<div id="noteMask" class="note-mask"></div>
|
||||
<div id="noteMaskForLoading" class="note-mask">
|
||||
@@ -546,17 +522,38 @@ function log(o) {
|
||||
<div id="noteTitleDiv">
|
||||
<input name="noteTitle" id="noteTitle" value="" placeholder="{{msg . "unTitled"}}" tabindex="1" />
|
||||
</div>
|
||||
|
||||
<!-- 只读时 -->
|
||||
<div id="noteReadTop">
|
||||
<h2 id="noteReadTitle"></h2>
|
||||
<div class="clearfix" id="noteReadInfo">
|
||||
<i class="fa fa-bookmark-o"></i>
|
||||
<span id="noteReadTags"></span>
|
||||
|
||||
<!-- 修改时间 -->
|
||||
<i class="fa fa-clock-o"></i> {{msg . "update"}}
|
||||
<span id="noteReadUpdatedTime"></span>
|
||||
|
||||
<!-- 修改时间 -->
|
||||
<i class="fa fa-clock-o"></i> {{msg . "create"}}
|
||||
<span id="noteReadCreatedTime"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="editor">
|
||||
<!-- 编辑器 -->
|
||||
<div id="mceToolbar">
|
||||
<div id="popularToolbar"
|
||||
style="position: absolute; right: 30px; left: 0"></div>
|
||||
<a
|
||||
style="dispaly: block; position: absolute; cursor: pointer; right: 10px; padding: 3px 10px"
|
||||
id="moreBtn"> <i class="fa fa-angle-down"></i>
|
||||
</a>
|
||||
<div id="mceToolbarContainer">
|
||||
<div id="popularToolbar" style="position: absolute; right: 30px; left: 0"></div>
|
||||
<a id="moreBtn"> <i class="fa more-fa"></i></a>
|
||||
</div>
|
||||
<!-- 查看信息 -->
|
||||
<div id="infoToolbar" class="info-toolbar">
|
||||
<a class="toolbar-update"><i class="fa fa-pencil"></i> <span class="lang">{{msg . "modify"}}</span></a>
|
||||
<span class="lang">{{msg . "created"}}</span>: <span class="created-time">2015-04-03</span>
|
||||
<span class="lang">{{msg . "updated"}}</span>: <span class="updated-time">2015-05-01</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="editorBg"></div>
|
||||
<div id="leanoteNav" class="leanoteNav">
|
||||
@@ -585,49 +582,56 @@ 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 id="mdInfoToolbar" class="info-toolbar">
|
||||
<a class="toolbar-update"><i class="fa fa-pencil"></i> <span class="lang">{{msg . "modify"}}</span></a>
|
||||
<span class="lang">{{msg . "created"}}</span>: <span class="created-time">2015-04-03</span>
|
||||
<span class="lang">{{msg . "updated"}}</span>: <span class="updated-time">2015-05-01</span>
|
||||
</div>
|
||||
|
||||
<div class="wmd-button-bar-inner">
|
||||
<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>
|
||||
<div class="editorBg"></div>
|
||||
</div>
|
||||
@@ -900,6 +904,7 @@ var GlobalConfigs = {{.globalConfigs|jsonJs}}; // 2014/11/9 beta2
|
||||
|
||||
<!-- 渲染view -->
|
||||
<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>
|
||||
@@ -919,13 +924,14 @@ initPage();
|
||||
|
||||
<!-- v2 use require.js, mdeditor -->
|
||||
<script>
|
||||
window.baseDir = '/public/dist';
|
||||
// 当tinymce.min.js时, 请注释require
|
||||
window.require = {
|
||||
baseUrl: window.baseDir,
|
||||
deps: ['main']
|
||||
baseUrl: '/public',
|
||||
};
|
||||
</script>
|
||||
<script src="/js/require.js"></script>
|
||||
<script src="/public/dist/main.min.js"></script>
|
||||
<script src="/public/js/upload_paste/main.js"></script>
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
@@ -1,32 +0,0 @@
|
||||
{{template "home/header_box.html" .}}
|
||||
|
||||
<section id="box" class="animated fadeInUp">
|
||||
<div>
|
||||
<h1 id="logo">leanote</h1>
|
||||
<div id="boxForm">
|
||||
<div id="boxHeader">We got a error</div>
|
||||
<form>
|
||||
<div class="alert alert-danger" id="loginMsg" style="display: block">
|
||||
Sorry, we can't get your infomation.
|
||||
|
||||
<br />
|
||||
Please <a href="/login">{{msg . "login"}}</a> Or <a href="/register?email={{.email}}">{{msg . "register"}}</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div id="boxFooter">
|
||||
<p>
|
||||
<a href="/login">{{msg . "login"}}</a>
|
||||
|
||||
<a href="/index">{{msg . "home"}}</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="/index">leanote</a> © 2014
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user