This commit is contained in:
parent
039e826053
commit
a732640bc1
|
@ -164,14 +164,14 @@ func GetFileHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
username := httpSession.Values["username"].(string)
|
username := httpSession.Values["username"].(string)
|
||||||
|
|
||||||
data := map[string]interface{}{"succ": true}
|
result := util.NewResult()
|
||||||
defer util.RetJSON(w, r, data)
|
defer util.RetResult(w, r, result)
|
||||||
|
|
||||||
var args map[string]interface{}
|
var args map[string]interface{}
|
||||||
|
|
||||||
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
|
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
|
||||||
logger.Error(err)
|
logger.Error(err)
|
||||||
data["succ"] = false
|
result.Succ = false
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -186,12 +186,14 @@ func GetFileHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
size := util.File.GetFileSize(path)
|
size := util.File.GetFileSize(path)
|
||||||
if size > 5242880 { // 5M
|
if size > 5242880 { // 5M
|
||||||
data["succ"] = false
|
result.Succ = false
|
||||||
data["msg"] = "This file is too large to open :("
|
result.Msg = "This file is too large to open :("
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data := map[string]interface{}{}
|
||||||
|
|
||||||
buf, _ := ioutil.ReadFile(path)
|
buf, _ := ioutil.ReadFile(path)
|
||||||
|
|
||||||
extension := filepath.Ext(path)
|
extension := filepath.Ext(path)
|
||||||
|
@ -219,12 +221,14 @@ func GetFileHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
content := string(buf)
|
content := string(buf)
|
||||||
|
|
||||||
if util.File.IsBinary(content) {
|
if util.File.IsBinary(content) {
|
||||||
data["succ"] = false
|
result.Succ = false
|
||||||
data["msg"] = "Can't open a binary file :("
|
result.Msg = "Can't open a binary file :("
|
||||||
} else {
|
} else {
|
||||||
data["content"] = content
|
data["content"] = content
|
||||||
data["path"] = path
|
data["path"] = path
|
||||||
}
|
}
|
||||||
|
|
||||||
|
result.Data = data
|
||||||
}
|
}
|
||||||
|
|
||||||
// SaveFileHandler handles request of saving file.
|
// SaveFileHandler handles request of saving file.
|
||||||
|
@ -237,14 +241,14 @@ func SaveFileHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
username := httpSession.Values["username"].(string)
|
username := httpSession.Values["username"].(string)
|
||||||
|
|
||||||
data := map[string]interface{}{"succ": true}
|
result := util.NewResult()
|
||||||
defer util.RetJSON(w, r, data)
|
defer util.RetResult(w, r, result)
|
||||||
|
|
||||||
var args map[string]interface{}
|
var args map[string]interface{}
|
||||||
|
|
||||||
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
|
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
|
||||||
logger.Error(err)
|
logger.Error(err)
|
||||||
data["succ"] = false
|
result.Succ = false
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -262,7 +266,7 @@ func SaveFileHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
if nil != err {
|
if nil != err {
|
||||||
logger.Error(err)
|
logger.Error(err)
|
||||||
data["succ"] = false
|
result.Succ = false
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -273,7 +277,7 @@ func SaveFileHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
if err := fout.Close(); nil != err {
|
if err := fout.Close(); nil != err {
|
||||||
logger.Error(err)
|
logger.Error(err)
|
||||||
data["succ"] = false
|
result.Succ = false
|
||||||
|
|
||||||
wSession := session.WideSessions.Get(sid)
|
wSession := session.WideSessions.Get(sid)
|
||||||
wSession.EventQueue.Queue <- &event.Event{Code: event.EvtCodeServerInternalError, Sid: sid,
|
wSession.EventQueue.Queue <- &event.Event{Code: event.EvtCodeServerInternalError, Sid: sid,
|
||||||
|
@ -293,14 +297,14 @@ func NewFileHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
username := httpSession.Values["username"].(string)
|
username := httpSession.Values["username"].(string)
|
||||||
|
|
||||||
data := map[string]interface{}{"succ": true}
|
result := util.NewResult()
|
||||||
defer util.RetJSON(w, r, data)
|
defer util.RetResult(w, r, result)
|
||||||
|
|
||||||
var args map[string]interface{}
|
var args map[string]interface{}
|
||||||
|
|
||||||
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
|
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
|
||||||
logger.Error(err)
|
logger.Error(err)
|
||||||
data["succ"] = false
|
result.Succ = false
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -319,7 +323,7 @@ func NewFileHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
wSession := session.WideSessions.Get(sid)
|
wSession := session.WideSessions.Get(sid)
|
||||||
|
|
||||||
if !createFile(path, fileType) {
|
if !createFile(path, fileType) {
|
||||||
data["succ"] = false
|
result.Succ = false
|
||||||
|
|
||||||
wSession.EventQueue.Queue <- &event.Event{Code: event.EvtCodeServerInternalError, Sid: sid,
|
wSession.EventQueue.Queue <- &event.Event{Code: event.EvtCodeServerInternalError, Sid: sid,
|
||||||
Data: "can't create file " + path}
|
Data: "can't create file " + path}
|
||||||
|
@ -345,14 +349,14 @@ func RemoveFileHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
username := httpSession.Values["username"].(string)
|
username := httpSession.Values["username"].(string)
|
||||||
|
|
||||||
data := map[string]interface{}{"succ": true}
|
result := util.NewResult()
|
||||||
defer util.RetJSON(w, r, data)
|
defer util.RetResult(w, r, result)
|
||||||
|
|
||||||
var args map[string]interface{}
|
var args map[string]interface{}
|
||||||
|
|
||||||
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
|
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
|
||||||
logger.Error(err)
|
logger.Error(err)
|
||||||
data["succ"] = false
|
result.Succ = false
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -370,7 +374,7 @@ func RemoveFileHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
wSession := session.WideSessions.Get(sid)
|
wSession := session.WideSessions.Get(sid)
|
||||||
|
|
||||||
if !removeFile(path) {
|
if !removeFile(path) {
|
||||||
data["succ"] = false
|
result.Succ = false
|
||||||
|
|
||||||
wSession.EventQueue.Queue <- &event.Event{Code: event.EvtCodeServerInternalError, Sid: sid,
|
wSession.EventQueue.Queue <- &event.Event{Code: event.EvtCodeServerInternalError, Sid: sid,
|
||||||
Data: "can't remove file " + path}
|
Data: "can't remove file " + path}
|
||||||
|
@ -391,14 +395,14 @@ func RenameFileHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
username := httpSession.Values["username"].(string)
|
username := httpSession.Values["username"].(string)
|
||||||
|
|
||||||
data := map[string]interface{}{"succ": true}
|
result := util.NewResult()
|
||||||
defer util.RetJSON(w, r, data)
|
defer util.RetResult(w, r, result)
|
||||||
|
|
||||||
var args map[string]interface{}
|
var args map[string]interface{}
|
||||||
|
|
||||||
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
|
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
|
||||||
logger.Error(err)
|
logger.Error(err)
|
||||||
data["succ"] = false
|
result.Succ = false
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -423,7 +427,7 @@ func RenameFileHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
wSession := session.WideSessions.Get(sid)
|
wSession := session.WideSessions.Get(sid)
|
||||||
|
|
||||||
if !renameFile(oldPath, newPath) {
|
if !renameFile(oldPath, newPath) {
|
||||||
data["succ"] = false
|
result.Succ = false
|
||||||
|
|
||||||
wSession.EventQueue.Queue <- &event.Event{Code: event.EvtCodeServerInternalError, Sid: sid,
|
wSession.EventQueue.Queue <- &event.Event{Code: event.EvtCodeServerInternalError, Sid: sid,
|
||||||
Data: "can't rename file " + oldPath}
|
Data: "can't rename file " + oldPath}
|
||||||
|
@ -456,13 +460,13 @@ func FindHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
username := httpSession.Values["username"].(string)
|
username := httpSession.Values["username"].(string)
|
||||||
|
|
||||||
data := map[string]interface{}{"succ": true}
|
result := util.NewResult()
|
||||||
defer util.RetJSON(w, r, data)
|
defer util.RetResult(w, r, result)
|
||||||
|
|
||||||
var args map[string]interface{}
|
var args map[string]interface{}
|
||||||
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
|
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
|
||||||
logger.Error(err)
|
logger.Error(err)
|
||||||
data["succ"] = false
|
result.Succ = false
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -497,7 +501,7 @@ func FindHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
sort.Sort(founds)
|
sort.Sort(founds)
|
||||||
|
|
||||||
data["founds"] = founds
|
result.Data = founds
|
||||||
}
|
}
|
||||||
|
|
||||||
// SearchTextHandler handles request of searching files under the specified directory with the specified keyword.
|
// SearchTextHandler handles request of searching files under the specified directory with the specified keyword.
|
||||||
|
@ -509,14 +513,14 @@ func SearchTextHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
data := map[string]interface{}{"succ": true}
|
result := util.NewResult()
|
||||||
defer util.RetJSON(w, r, data)
|
defer util.RetResult(w, r, result)
|
||||||
|
|
||||||
var args map[string]interface{}
|
var args map[string]interface{}
|
||||||
|
|
||||||
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
|
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
|
||||||
logger.Error(err)
|
logger.Error(err)
|
||||||
data["succ"] = false
|
result.Succ = false
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -524,7 +528,7 @@ func SearchTextHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
sid := args["sid"].(string)
|
sid := args["sid"].(string)
|
||||||
wSession := session.WideSessions.Get(sid)
|
wSession := session.WideSessions.Get(sid)
|
||||||
if nil == wSession {
|
if nil == wSession {
|
||||||
data["succ"] = false
|
result.Succ = false
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -548,7 +552,7 @@ func SearchTextHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
founds = searchInFile(dir, text)
|
founds = searchInFile(dir, text)
|
||||||
}
|
}
|
||||||
|
|
||||||
data["founds"] = founds
|
result.Data = founds
|
||||||
}
|
}
|
||||||
|
|
||||||
// walk traverses the specified path to build a file tree.
|
// walk traverses the specified path to build a file tree.
|
||||||
|
|
|
@ -67,11 +67,11 @@ func handleUploads(r *http.Request, dir string) (fileInfos []*fileInfo) {
|
||||||
|
|
||||||
// UploadHandler handles request of file upload.
|
// UploadHandler handles request of file upload.
|
||||||
func UploadHandler(w http.ResponseWriter, r *http.Request) {
|
func UploadHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
data := map[string]interface{}{"succ": true}
|
result := util.NewResult()
|
||||||
defer util.RetJSON(w, r, data)
|
defer util.RetResult(w, r, result)
|
||||||
|
|
||||||
q := r.URL.Query()
|
q := r.URL.Query()
|
||||||
dir := q["path"][0]
|
dir := q["path"][0]
|
||||||
|
|
||||||
data["files"] = handleUploads(r, dir)
|
result.Data = handleUploads(r, dir)
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,14 +34,14 @@ type element struct {
|
||||||
|
|
||||||
// GetOutlineHandler gets outfile of a go file.
|
// GetOutlineHandler gets outfile of a go file.
|
||||||
func GetOutlineHandler(w http.ResponseWriter, r *http.Request) {
|
func GetOutlineHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
data := map[string]interface{}{"succ": true}
|
result := util.NewResult()
|
||||||
defer util.RetJSON(w, r, data)
|
defer util.RetResult(w, r, result)
|
||||||
|
|
||||||
var args map[string]interface{}
|
var args map[string]interface{}
|
||||||
|
|
||||||
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
|
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
|
||||||
logger.Error(err)
|
logger.Error(err)
|
||||||
data["succ"] = false
|
result.Succ = false
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -51,11 +51,12 @@ func GetOutlineHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
fset := token.NewFileSet()
|
fset := token.NewFileSet()
|
||||||
f, err := parser.ParseFile(fset, "", code, 0)
|
f, err := parser.ParseFile(fset, "", code, 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
data["succ"] = false
|
result.Succ = false
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data := map[string]interface{}{}
|
||||||
// ast.Print(fset, f)
|
// ast.Print(fset, f)
|
||||||
|
|
||||||
line, ch := getCursor(code, int(f.Name.Pos()))
|
line, ch := getCursor(code, int(f.Name.Pos()))
|
||||||
|
@ -128,6 +129,8 @@ func GetOutlineHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
data["structDecls"] = structDecls
|
data["structDecls"] = structDecls
|
||||||
data["interfaceDecls"] = interfaceDecls
|
data["interfaceDecls"] = interfaceDecls
|
||||||
data["typeDecls"] = typeDecls
|
data["typeDecls"] = typeDecls
|
||||||
|
|
||||||
|
result.Data = data
|
||||||
}
|
}
|
||||||
|
|
||||||
// getCursor calculates the cursor position (line, ch) by the specified offset.
|
// getCursor calculates the cursor position (line, ch) by the specified offset.
|
||||||
|
|
|
@ -35,8 +35,8 @@ import (
|
||||||
|
|
||||||
// BuildHandler handles request of building.
|
// BuildHandler handles request of building.
|
||||||
func BuildHandler(w http.ResponseWriter, r *http.Request) {
|
func BuildHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
data := map[string]interface{}{"succ": true}
|
result := util.NewResult()
|
||||||
defer util.RetJSON(w, r, data)
|
defer util.RetResult(w, r, result)
|
||||||
|
|
||||||
httpSession, _ := session.HTTPSession.Get(r, "wide-session")
|
httpSession, _ := session.HTTPSession.Get(r, "wide-session")
|
||||||
if httpSession.IsNew {
|
if httpSession.IsNew {
|
||||||
|
@ -51,7 +51,7 @@ func BuildHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
|
if err := json.NewDecoder(r.Body).Decode(&args); err != nil {
|
||||||
logger.Error(err)
|
logger.Error(err)
|
||||||
data["succ"] = false
|
result.Succ = false
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ func BuildHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
if nil != err {
|
if nil != err {
|
||||||
logger.Error(err)
|
logger.Error(err)
|
||||||
data["succ"] = false
|
result.Succ = false
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ func BuildHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
if err := fout.Close(); nil != err {
|
if err := fout.Close(); nil != err {
|
||||||
logger.Error(err)
|
logger.Error(err)
|
||||||
data["succ"] = false
|
result.Succ = false
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ func BuildHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
stdout, err := cmd.StdoutPipe()
|
stdout, err := cmd.StdoutPipe()
|
||||||
if nil != err {
|
if nil != err {
|
||||||
logger.Error(err)
|
logger.Error(err)
|
||||||
data["succ"] = false
|
result.Succ = false
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -112,12 +112,12 @@ func BuildHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
stderr, err := cmd.StderrPipe()
|
stderr, err := cmd.StderrPipe()
|
||||||
if nil != err {
|
if nil != err {
|
||||||
logger.Error(err)
|
logger.Error(err)
|
||||||
data["succ"] = false
|
result.Succ = false
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !data["succ"].(bool) {
|
if !result.Succ {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ func BuildHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
if err := cmd.Start(); nil != err {
|
if err := cmd.Start(); nil != err {
|
||||||
logger.Error(err)
|
logger.Error(err)
|
||||||
data["succ"] = false
|
result.Succ = false
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -304,10 +304,10 @@ var menu = {
|
||||||
url: config.context + '/build',
|
url: config.context + '/build',
|
||||||
data: JSON.stringify(request),
|
data: JSON.stringify(request),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
beforeSend: function (data) {
|
beforeSend: function (result) {
|
||||||
bottomGroup.resetOutput();
|
bottomGroup.resetOutput();
|
||||||
},
|
},
|
||||||
success: function (data) {
|
success: function (result) {
|
||||||
$("#buildRun").addClass("ico-stop")
|
$("#buildRun").addClass("ico-stop")
|
||||||
.removeClass("ico-buildrun").attr("title", config.label.stop);
|
.removeClass("ico-buildrun").attr("title", config.label.stop);
|
||||||
}
|
}
|
||||||
|
@ -336,10 +336,10 @@ var menu = {
|
||||||
url: config.context + '/build',
|
url: config.context + '/build',
|
||||||
data: JSON.stringify(request),
|
data: JSON.stringify(request),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
beforeSend: function (data) {
|
beforeSend: function (result) {
|
||||||
bottomGroup.resetOutput();
|
bottomGroup.resetOutput();
|
||||||
},
|
},
|
||||||
success: function (data) {
|
success: function (result) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -239,7 +239,7 @@ var tree = {
|
||||||
url: "/file/upload?path=" + request.path,
|
url: "/file/upload?path=" + request.path,
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
formData: request,
|
formData: request,
|
||||||
done: function (e, data) {
|
done: function (e, result) {
|
||||||
tree.fileTree.reAsyncChildNodes(wide.curNode, "refresh");
|
tree.fileTree.reAsyncChildNodes(wide.curNode, "refresh");
|
||||||
},
|
},
|
||||||
fail: function () {
|
fail: function () {
|
||||||
|
@ -413,12 +413,14 @@ var tree = {
|
||||||
url: config.context + '/file',
|
url: config.context + '/file',
|
||||||
data: JSON.stringify(request),
|
data: JSON.stringify(request),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (data) {
|
success: function (result) {
|
||||||
if (!data.succ) {
|
if (!result.succ) {
|
||||||
$("#dialogAlert").dialog("open", data.msg);
|
$("#dialogAlert").dialog("open", result.msg);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var data = result.data;
|
||||||
|
|
||||||
if (!data.mode) {
|
if (!data.mode) {
|
||||||
var mode = CodeMirror.findModeByFileName(treeNode.path);
|
var mode = CodeMirror.findModeByFileName(treeNode.path);
|
||||||
|
@ -496,13 +498,13 @@ var tree = {
|
||||||
url: config.context + '/file/search/text',
|
url: config.context + '/file/search/text',
|
||||||
data: JSON.stringify(request),
|
data: JSON.stringify(request),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (data) {
|
success: function (result) {
|
||||||
if (!data.succ) {
|
if (!result.succ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#dialogSearchForm").dialog("close");
|
$("#dialogSearchForm").dialog("close");
|
||||||
editors.appendSearch(data.founds, 'founds', request.text);
|
editors.appendSearch(result.data, 'founds', request.text);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,11 +34,13 @@ var wide = {
|
||||||
url: config.context + '/outline',
|
url: config.context + '/outline',
|
||||||
data: JSON.stringify(request),
|
data: JSON.stringify(request),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (data) {
|
success: function (result) {
|
||||||
if (!data.succ) {
|
if (!result.succ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var data = result.data;
|
||||||
|
|
||||||
var outlineHTML = '<ul class="list">',
|
var outlineHTML = '<ul class="list">',
|
||||||
decls = ['constDecls', 'varDecls', 'funcDecls',
|
decls = ['constDecls', 'varDecls', 'funcDecls',
|
||||||
'structDecls', 'interfaceDecls', 'typeDecls'];
|
'structDecls', 'interfaceDecls', 'typeDecls'];
|
||||||
|
@ -258,14 +260,16 @@ var wide = {
|
||||||
url: config.context + '/file/find/name',
|
url: config.context + '/file/find/name',
|
||||||
data: JSON.stringify(request),
|
data: JSON.stringify(request),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (data) {
|
success: function (result) {
|
||||||
if (!data.succ) {
|
if (!result.succ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var data = result.data;
|
||||||
|
|
||||||
var goFileHTML = '';
|
var goFileHTML = '';
|
||||||
for (var i = 0, max = data.founds.length; i < max; i++) {
|
for (var i = 0, max = data.length; i < max; i++) {
|
||||||
var path = data.founds[i].path,
|
var path = data[i].path,
|
||||||
name = path.substr(path.lastIndexOf("/") + 1),
|
name = path.substr(path.lastIndexOf("/") + 1),
|
||||||
icoSkin = wide.getClassBySuffix(name.split(".")[1]);
|
icoSkin = wide.getClassBySuffix(name.split(".")[1]);
|
||||||
if (i === 0) {
|
if (i === 0) {
|
||||||
|
@ -577,7 +581,7 @@ var wide = {
|
||||||
url: config.context + '/file/save',
|
url: config.context + '/file/save',
|
||||||
data: JSON.stringify(request),
|
data: JSON.stringify(request),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (data) {
|
success: function (result) {
|
||||||
// reset the save state
|
// reset the save state
|
||||||
editor.doc.markClean();
|
editor.doc.markClean();
|
||||||
$(".edit-panel .tabs > div").each(function () {
|
$(".edit-panel .tabs > div").each(function () {
|
||||||
|
@ -613,10 +617,10 @@ var wide = {
|
||||||
url: config.context + '/build',
|
url: config.context + '/build',
|
||||||
data: JSON.stringify(request),
|
data: JSON.stringify(request),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
beforeSend: function (data) {
|
beforeSend: function (result) {
|
||||||
bottomGroup.resetOutput();
|
bottomGroup.resetOutput();
|
||||||
},
|
},
|
||||||
success: function (data) {
|
success: function (result) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue