@@ -305,7 +305,10 @@ func NotifyWatchersActions(acts []*Action) error { | |||||
return err | return err | ||||
} | } | ||||
} | } | ||||
return sess.Commit() | |||||
err := sess.Commit() | |||||
producer(acts...) | |||||
return err | |||||
} | } | ||||
func watchIfAuto(e Engine, userID, repoID int64, isWrite bool) error { | func watchIfAuto(e Engine, userID, repoID int64, isWrite bool) error { | ||||
@@ -328,7 +328,11 @@ func Contexter() macaron.Handler { | |||||
} | } | ||||
} | } | ||||
ctx.Resp.Header().Set(`X-Frame-Options`, `SAMEORIGIN`) | |||||
if setting.IFrameURL != "" { | |||||
ctx.Resp.Header().Set(`X-Frame-Options`, `ALLOW-FROM `+setting.IFrameURL) | |||||
} else { | |||||
ctx.Resp.Header().Set(`X-Frame-Options`, `SAMEORIGIN`) | |||||
} | |||||
ctx.Data["CsrfToken"] = html.EscapeString(x.GetToken()) | ctx.Data["CsrfToken"] = html.EscapeString(x.GetToken()) | ||||
ctx.Data["CsrfTokenHtml"] = template.HTML(`<input type="hidden" name="_csrf" value="` + ctx.Data["CsrfToken"].(string) + `">`) | ctx.Data["CsrfTokenHtml"] = template.HTML(`<input type="hidden" name="_csrf" value="` + ctx.Data["CsrfToken"].(string) + `">`) | ||||
@@ -573,6 +573,7 @@ var ( | |||||
OrgName string | OrgName string | ||||
TeamName string | TeamName string | ||||
}{} | }{} | ||||
IFrameURL string | |||||
) | ) | ||||
// DateLang transforms standard language locale name to corresponding value in datetime plugin. | // DateLang transforms standard language locale name to corresponding value in datetime plugin. | ||||
@@ -1340,6 +1341,8 @@ func NewContext() { | |||||
sec = Cfg.Section("course") | sec = Cfg.Section("course") | ||||
Course.OrgName = sec.Key("org_name").MustString("") | Course.OrgName = sec.Key("org_name").MustString("") | ||||
Course.TeamName = sec.Key("team_name").MustString("") | Course.TeamName = sec.Key("team_name").MustString("") | ||||
sec = Cfg.Section("xFrame") | |||||
IFrameURL = sec.Key("url").MustString("") | |||||
} | } | ||||
func SetRadarMapConfig() { | func SetRadarMapConfig() { | ||||
@@ -534,6 +534,7 @@ func RegisterRoutes(m *macaron.Macaron) { | |||||
m.Get("/downloadAllOpenI", repo.ServeAllProjectsOpenIStatisticsFile) | m.Get("/downloadAllOpenI", repo.ServeAllProjectsOpenIStatisticsFile) | ||||
m.Group("/project", func() { | m.Group("/project", func() { | ||||
m.Get("", repo.GetAllProjectsPeriodStatistics) | m.Get("", repo.GetAllProjectsPeriodStatistics) | ||||
m.Get("/numVisit", repo.ProjectNumVisit) | |||||
m.Group("/:id", func() { | m.Group("/:id", func() { | ||||
m.Get("", repo.GetProjectLatestStatistics) | m.Get("", repo.GetProjectLatestStatistics) | ||||
@@ -12,6 +12,7 @@ import ( | |||||
"code.gitea.io/gitea/models" | "code.gitea.io/gitea/models" | ||||
"code.gitea.io/gitea/modules/log" | "code.gitea.io/gitea/modules/log" | ||||
"code.gitea.io/gitea/modules/repository" | |||||
"code.gitea.io/gitea/modules/context" | "code.gitea.io/gitea/modules/context" | ||||
"code.gitea.io/gitea/modules/setting" | "code.gitea.io/gitea/modules/setting" | ||||
@@ -640,3 +641,26 @@ func getTotalPage(total int64, pageSize int) int { | |||||
return int(total)/pageSize + another | return int(total)/pageSize + another | ||||
} | } | ||||
func ProjectNumVisit(ctx *context.APIContext) { | |||||
var ( | |||||
err error | |||||
) | |||||
var userName = ctx.Query("user") | |||||
var projectName = ctx.Query("project") | |||||
var beginTime = ctx.Query("begintime") | |||||
var endTime = ctx.Query("endtime") | |||||
var ProjectNumVisits int | |||||
ProjectNumVisits, err = repository.AppointProjectView(userName, projectName, beginTime, endTime) //访问量 | |||||
if err != nil { | |||||
ctx.NotFound(err) | |||||
} | |||||
log.Info("ProjectNumVisits is:", ProjectNumVisits) | |||||
ctx.JSON(http.StatusOK, map[string]interface{}{ | |||||
"ProjectNumVisits": ProjectNumVisits, | |||||
"StatusOK": 0, | |||||
}) | |||||
} |
@@ -91,19 +91,19 @@ func queryUserDataPage(ctx *context.Context, tableName string, queryObj interfac | |||||
xlsx.SetCellValue(sheetName, "Q"+rows, formatTime) | xlsx.SetCellValue(sheetName, "Q"+rows, formatTime) | ||||
} | } | ||||
//设置默认打开的表单 | |||||
xlsx.SetActiveSheet(index) | |||||
filename := sheetName + "_" + ctx.Tr("user.static."+tableName) + ".xlsx" | |||||
ctx.Resp.Header().Set("Content-Disposition", "attachment; filename="+url.QueryEscape(filename)) | |||||
ctx.Resp.Header().Set("Content-Type", "application/octet-stream") | |||||
if _, err := xlsx.WriteTo(ctx.Resp); err != nil { | |||||
log.Info("writer exel error." + err.Error()) | |||||
} | |||||
indexTotal += PAGE_SIZE | indexTotal += PAGE_SIZE | ||||
if indexTotal >= count { | if indexTotal >= count { | ||||
break | break | ||||
} | } | ||||
} | } | ||||
//设置默认打开的表单 | |||||
xlsx.SetActiveSheet(index) | |||||
filename := sheetName + "_" + ctx.Tr("user.static."+tableName) + ".xlsx" | |||||
ctx.Resp.Header().Set("Content-Disposition", "attachment; filename="+url.QueryEscape(filename)) | |||||
ctx.Resp.Header().Set("Content-Type", "application/octet-stream") | |||||
if _, err := xlsx.WriteTo(ctx.Resp); err != nil { | |||||
log.Info("writer exel error." + err.Error()) | |||||
} | |||||
} else { | } else { | ||||
re, count := models.QueryUserStaticDataByTableName((page-1)*pageSize, pageSize, tableName, queryObj, userName) | re, count := models.QueryUserStaticDataByTableName((page-1)*pageSize, pageSize, tableName, queryObj, userName) | ||||
mapInterface := make(map[string]interface{}) | mapInterface := make(map[string]interface{}) | ||||
@@ -50,6 +50,7 @@ func (h *ClientsManager) Run() { | |||||
} | } | ||||
case message := <-models.ActionChan: | case message := <-models.ActionChan: | ||||
if isInOpTypes(opTypes, message.OpType) { | if isInOpTypes(opTypes, message.OpType) { | ||||
message.Comment = nil | |||||
LastActionsQueue.Push(message) | LastActionsQueue.Push(message) | ||||
for _, client := range h.Clients.Keys() { | for _, client := range h.Clients.Keys() { | ||||
select { | select { | ||||
@@ -61,7 +61,9 @@ | |||||
-webkit-line-clamp: 2; | -webkit-line-clamp: 2; | ||||
-webkit-box-orient: vertical; | -webkit-box-orient: vertical; | ||||
} | } | ||||
.ui.cards>.card>.extra .tags > a{ | |||||
margin-top: 5px; | |||||
} | |||||
</style> | </style> | ||||
<div class="ui stackable grid"> | <div class="ui stackable grid"> | ||||
@@ -99,7 +101,7 @@ | |||||
{{if .Topics }} | {{if .Topics }} | ||||
<div class=" tags " style="position: relative;"> | <div class=" tags " style="position: relative;"> | ||||
{{range .Topics}} | {{range .Topics}} | ||||
{{if ne . "" }}<a style="max-width:100%;margin: 5px 0;display:inline-flex;" href="{{AppSubUrl}}/explore/repos?q={{.}}&topic={{$.Topic}}" ><span class="ui small label topic omit" >{{.}}</span></a>{{end}} | |||||
{{if ne . "" }}<a style="max-width:100%;display:inline-flex;" href="{{AppSubUrl}}/explore/repos?q={{.}}&topic={{$.Topic}}" ><span class="ui small label topic omit" >{{.}}</span></a>{{end}} | |||||
{{end}} | {{end}} | ||||
</div> | </div> | ||||
@@ -108,7 +110,7 @@ | |||||
</div> | </div> | ||||
</div> | </div> | ||||
<div class=" extra " style="color:#888888;border-top: none !important"> | |||||
<div class=" extra " style="color:#888888;border-top: none !important;padding-top: 0"> | |||||
<div class="ui mini right compact marg" > | <div class="ui mini right compact marg" > | ||||
<a class="item marg "> | <a class="item marg "> | ||||
{{svg "octicon-eye" 16}} {{.NumWatches}} | {{svg "octicon-eye" 16}} {{.NumWatches}} | ||||
@@ -77,14 +77,14 @@ | |||||
<a class="ui image poping up" style="color: #0366D6;overflow: hidden; white-space: nowrap; text-overflow: ellipsis;" href="{{.HomeLink}}" data-content="{{.Name}}" data-position="top center" data-variation="tiny inverted">{{.Name}}</a> | <a class="ui image poping up" style="color: #0366D6;overflow: hidden; white-space: nowrap; text-overflow: ellipsis;" href="{{.HomeLink}}" data-content="{{.Name}}" data-position="top center" data-variation="tiny inverted">{{.Name}}</a> | ||||
</li> | </li> | ||||
<li class="infor" style="width: 25%;"> | |||||
<li class="infor" style="width: 25%;display: table-cell"> | |||||
<img style="width: 14px; height: 14px;border: none;" src="/img/member.svg" > | |||||
<span style="color: rgba(0,0,0,.4);padding-left: 5px;">{{.NumMembers}}</span> | |||||
<img style="width: 16px;height:16px;border: none;" src="/img/member.svg" > | |||||
<span style="color: rgba(0,0,0,.4);vertical-align: middle;">{{.NumMembers}}</span> | |||||
</li> | </li> | ||||
<li class="infor" style="width: 25%;"> | |||||
<img style="width: 14px; height: 14px" src="/img/pro_num.svg" > | |||||
<span style="color: rgba(0,0,0,.4);padding-left: 5px;">{{.NumRepos}}</span> | |||||
<li class="infor" style="width: 25%;display: table-cell"> | |||||
<img style="width: 16px;height: 16px;" src="/img/pro_num.svg" > | |||||
<span style="color: rgba(0,0,0,.4);vertical-align: middle;">{{.NumRepos}}</span> | |||||
</li> | </li> | ||||
{{end}} | {{end}} | ||||