attachment feature

This commit is contained in:
life
2014-09-21 22:05:04 +08:00
parent ab242b10f2
commit c556ab59b5
26 changed files with 1197 additions and 135 deletions

@ -17,7 +17,6 @@ type File struct {
BaseController
}
// 上传图片 editor
// 过时 已弃用!
func (c File) UploadImage(renderHtml string) revel.Result {
if renderHtml == "" {
@ -33,18 +32,19 @@ func (c File) UploadImage(renderHtml string) revel.Result {
return c.RenderTemplate(renderHtml)
}
// 已弃用
func (c File) UploadImageJson(from, noteId string) revel.Result {
re := c.uploadImage(from, "");
return c.RenderJson(re)
}
// 上传的是博客logo
// TODO logo不要设置权限, 另外的目录
func (c File) UploadBlogLogo() revel.Result {
return c.UploadImage("file/blog_logo.html");
}
// 弃用
func (c File) UploadImageJson(from, noteId string) revel.Result {
re := c.uploadImage(from, "");
return c.RenderJson(re)
}
// 拖拉上传, pasteImage
// noteId 是为了判断是否是协作的note, 如果是则需要复制一份到note owner中
func (c File) PasteImage(noteId string) revel.Result {
@ -69,13 +69,14 @@ func (c File) PasteImage(noteId string) revel.Result {
return c.RenderJson(re)
}
// leaui image plugin
// leaui image plugin upload image
func (c File) UploadImageLeaui(albumId string) revel.Result {
re := c.uploadImage("", albumId);
return c.RenderJson(re)
}
// 上传图片, 公用方法
// upload image common func
func (c File) uploadImage(from, albumId string) (re info.Re) {
var fileUrlPath = ""
var fileId = ""