|
|
@@ -99,6 +99,12 @@ func setRecommendURL(ctx *context.Context) { |
|
|
|
|
|
|
|
func Dashboard(ctx *context.Context) { |
|
|
|
if ctx.IsSigned { |
|
|
|
pictureInfo, err := getImageInfo("dashboard-picture") |
|
|
|
if err == nil && len(pictureInfo) > 0 { |
|
|
|
log.Info("set image info=" + pictureInfo[0]["url"]) |
|
|
|
ctx.Data["image_url"] = pictureInfo[0]["url"] |
|
|
|
ctx.Data["image_link"] = pictureInfo[0]["image_link"] |
|
|
|
} |
|
|
|
if !ctx.User.IsActive && setting.Service.RegisterEmailConfirm { |
|
|
|
ctx.Data["Title"] = ctx.Tr("auth.active_your_account") |
|
|
|
ctx.HTML(200, user.TplActivate) |
|
|
@@ -259,7 +265,11 @@ func ExploreRepos(ctx *context.Context) { |
|
|
|
ctx.Data["PageIsExplore"] = true |
|
|
|
ctx.Data["PageIsExploreRepositories"] = true |
|
|
|
ctx.Data["IsRepoIndexerEnabled"] = setting.Indexer.RepoIndexerEnabled |
|
|
|
|
|
|
|
pictureInfo, err := getImageInfo("explore-user-picture") |
|
|
|
if err == nil && len(pictureInfo) > 0 { |
|
|
|
ctx.Data["image_url"] = pictureInfo[0]["url"] |
|
|
|
ctx.Data["image_link"] = pictureInfo[0]["image_link"] |
|
|
|
} |
|
|
|
var ownerID int64 |
|
|
|
if ctx.User != nil && !ctx.User.IsAdmin { |
|
|
|
ownerID = ctx.User.ID |
|
|
@@ -434,7 +444,11 @@ func ExploreUsers(ctx *context.Context) { |
|
|
|
ctx.Data["PageIsExplore"] = true |
|
|
|
ctx.Data["PageIsExploreUsers"] = true |
|
|
|
ctx.Data["IsRepoIndexerEnabled"] = setting.Indexer.RepoIndexerEnabled |
|
|
|
|
|
|
|
pictureInfo, err := getImageInfo("explore-user-picture") |
|
|
|
if err == nil && len(pictureInfo) > 0 { |
|
|
|
ctx.Data["image_url"] = pictureInfo[0]["url"] |
|
|
|
ctx.Data["image_link"] = pictureInfo[0]["image_link"] |
|
|
|
} |
|
|
|
RenderUserSearch(ctx, &models.SearchUserOptions{ |
|
|
|
Actor: ctx.User, |
|
|
|
Type: models.UserTypeIndividual, |
|
|
@@ -471,7 +485,7 @@ func ExploreOrganizations(ctx *context.Context) { |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
recommendOrgs, err := GetRecommendOrg() |
|
|
|
recommendOrgs, err := getRecommendOrg() |
|
|
|
if err != nil { |
|
|
|
log.Error("GetRecommendOrgInfos failed:%v", err.Error(), ctx.Data["MsgID"]) |
|
|
|
ctx.ServerError("GetRecommendOrgInfos", err) |
|
|
@@ -606,31 +620,31 @@ func ExploreImages(ctx *context.Context) { |
|
|
|
} |
|
|
|
|
|
|
|
func ExploreDataAnalysisUserTrend(ctx *context.Context) { |
|
|
|
ctx.Data["url_params"]="UserTrend" |
|
|
|
ctx.Data["url_params"] = "UserTrend" |
|
|
|
ctx.HTML(200, tplExploreExploreDataAnalysis) |
|
|
|
} |
|
|
|
func ExploreDataAnalysisUserAnalysis(ctx *context.Context) { |
|
|
|
ctx.Data["url_params"]="UserAnalysis" |
|
|
|
ctx.Data["url_params"] = "UserAnalysis" |
|
|
|
ctx.HTML(200, tplExploreExploreDataAnalysis) |
|
|
|
} |
|
|
|
func ExploreDataAnalysisProTrend(ctx *context.Context) { |
|
|
|
ctx.Data["url_params"]="ProTrend" |
|
|
|
ctx.Data["url_params"] = "ProTrend" |
|
|
|
ctx.HTML(200, tplExploreExploreDataAnalysis) |
|
|
|
} |
|
|
|
func ExploreDataAnalysisProAnalysis(ctx *context.Context) { |
|
|
|
ctx.Data["url_params"]="ProAnalysis" |
|
|
|
ctx.Data["url_params"] = "ProAnalysis" |
|
|
|
ctx.HTML(200, tplExploreExploreDataAnalysis) |
|
|
|
} |
|
|
|
func ExploreDataAnalysisOverview(ctx *context.Context) { |
|
|
|
ctx.Data["url_params"]="Overview" |
|
|
|
ctx.Data["url_params"] = "Overview" |
|
|
|
ctx.HTML(200, tplExploreExploreDataAnalysis) |
|
|
|
} |
|
|
|
func ExploreDataAnalysisBrainAnalysis(ctx *context.Context) { |
|
|
|
ctx.Data["url_params"]="BrainAnalysis" |
|
|
|
ctx.Data["url_params"] = "BrainAnalysis" |
|
|
|
ctx.HTML(200, tplExploreExploreDataAnalysis) |
|
|
|
} |
|
|
|
func ExploreDataAnalysis(ctx *context.Context) { |
|
|
|
ctx.Data["url_params"]="" |
|
|
|
ctx.Data["url_params"] = "" |
|
|
|
ctx.HTML(200, tplExploreExploreDataAnalysis) |
|
|
|
} |
|
|
|
|
|
|
@@ -640,7 +654,7 @@ func NotFound(ctx *context.Context) { |
|
|
|
ctx.NotFound("home.NotFound", nil) |
|
|
|
} |
|
|
|
|
|
|
|
func GetRecommendOrg() ([]map[string]interface{}, error) { |
|
|
|
func getRecommendOrg() ([]map[string]interface{}, error) { |
|
|
|
url := setting.RecommentRepoAddr + "organizations" |
|
|
|
result, err := repository.RecommendFromPromote(url) |
|
|
|
|
|
|
@@ -668,17 +682,18 @@ func GetRecommendOrg() ([]map[string]interface{}, error) { |
|
|
|
} |
|
|
|
return resultOrg, nil |
|
|
|
} |
|
|
|
func GetImageInfo() ([]map[string]interface{}, error) { |
|
|
|
url := setting.RecommentRepoAddr + "picture_info" |
|
|
|
|
|
|
|
func getImageInfo(filename string) ([]map[string]string, error) { |
|
|
|
url := setting.RecommentRepoAddr + filename |
|
|
|
result, err := repository.RecommendFromPromote(url) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
imageInfo := make([]map[string]interface{}, 0) |
|
|
|
imageInfo := make([]map[string]string, 0) |
|
|
|
for i := 0; i < (len(result) - 1); i++ { |
|
|
|
line := result[i] |
|
|
|
imageMap := make(map[string]interface{}) |
|
|
|
imageMap := make(map[string]string) |
|
|
|
if line[0:4] == "url=" { |
|
|
|
url := line[4:] |
|
|
|
imageMap["url"] = url |
|
|
@@ -731,15 +746,6 @@ func GetRankUser(index string) ([]map[string]interface{}, error) { |
|
|
|
return resultOrg, nil |
|
|
|
} |
|
|
|
|
|
|
|
func GetImageInfoFromPromote(ctx *context.Context) { |
|
|
|
imageInfo, err := GetImageInfo() |
|
|
|
if err != nil { |
|
|
|
ctx.ServerError("500", err) |
|
|
|
return |
|
|
|
} |
|
|
|
ctx.JSON(200, imageInfo) |
|
|
|
} |
|
|
|
|
|
|
|
func GetUserRankFromPromote(ctx *context.Context) { |
|
|
|
index := ctx.Params("index") |
|
|
|
resultUserRank, err := GetRankUser(index) |
|
|
@@ -750,13 +756,24 @@ func GetUserRankFromPromote(ctx *context.Context) { |
|
|
|
ctx.JSON(200, resultUserRank) |
|
|
|
} |
|
|
|
|
|
|
|
func RecommendOrgFromPromote(ctx *context.Context) { |
|
|
|
resultOrg, err := GetRecommendOrg() |
|
|
|
func RecommendHomeInfo(ctx *context.Context) { |
|
|
|
resultOrg, err := getRecommendOrg() |
|
|
|
if err != nil { |
|
|
|
ctx.ServerError("500", err) |
|
|
|
return |
|
|
|
log.Info("error." + err.Error()) |
|
|
|
} |
|
|
|
resultRepo, err := repository.GetRecommendRepoFromPromote("projects") |
|
|
|
if err != nil { |
|
|
|
log.Info("error." + err.Error()) |
|
|
|
} |
|
|
|
resultImage, err := getImageInfo("picture_info") |
|
|
|
if err != nil { |
|
|
|
log.Info("error." + err.Error()) |
|
|
|
} |
|
|
|
ctx.JSON(200, resultOrg) |
|
|
|
mapInterface := make(map[string]interface{}) |
|
|
|
mapInterface["org"] = resultOrg |
|
|
|
mapInterface["repo"] = resultRepo |
|
|
|
mapInterface["image"] = resultImage |
|
|
|
ctx.JSON(http.StatusOK, mapInterface) |
|
|
|
} |
|
|
|
|
|
|
|
func RecommendRepoFromPromote(ctx *context.Context) { |
|
|
|