mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Rename module: middleware -> context
This commit is contained in:
@@ -15,9 +15,9 @@ import (
|
||||
|
||||
"github.com/gogits/gogs/models"
|
||||
"github.com/gogits/gogs/modules/base"
|
||||
"github.com/gogits/gogs/modules/context"
|
||||
"github.com/gogits/gogs/modules/cron"
|
||||
"github.com/gogits/gogs/modules/mailer"
|
||||
"github.com/gogits/gogs/modules/middleware"
|
||||
"github.com/gogits/gogs/modules/process"
|
||||
"github.com/gogits/gogs/modules/setting"
|
||||
)
|
||||
@@ -124,7 +124,7 @@ const (
|
||||
REINIT_MISSING_REPOSITORY
|
||||
)
|
||||
|
||||
func Dashboard(ctx *middleware.Context) {
|
||||
func Dashboard(ctx *context.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("admin.dashboard")
|
||||
ctx.Data["PageIsAdmin"] = true
|
||||
ctx.Data["PageIsAdminDashboard"] = true
|
||||
@@ -175,7 +175,7 @@ func Dashboard(ctx *middleware.Context) {
|
||||
ctx.HTML(200, DASHBOARD)
|
||||
}
|
||||
|
||||
func SendTestMail(ctx *middleware.Context) {
|
||||
func SendTestMail(ctx *context.Context) {
|
||||
email := ctx.Query("email")
|
||||
// Send a test email to the user's email address and redirect back to Config
|
||||
if err := mailer.SendTestMail(email); err != nil {
|
||||
@@ -187,7 +187,7 @@ func SendTestMail(ctx *middleware.Context) {
|
||||
ctx.Redirect(setting.AppSubUrl + "/admin/config")
|
||||
}
|
||||
|
||||
func Config(ctx *middleware.Context) {
|
||||
func Config(ctx *context.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("admin.config")
|
||||
ctx.Data["PageIsAdmin"] = true
|
||||
ctx.Data["PageIsAdminConfig"] = true
|
||||
@@ -236,7 +236,7 @@ func Config(ctx *middleware.Context) {
|
||||
ctx.HTML(200, CONFIG)
|
||||
}
|
||||
|
||||
func Monitor(ctx *middleware.Context) {
|
||||
func Monitor(ctx *context.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("admin.monitor")
|
||||
ctx.Data["PageIsAdmin"] = true
|
||||
ctx.Data["PageIsAdminMonitor"] = true
|
||||
|
@@ -14,8 +14,8 @@ import (
|
||||
"github.com/gogits/gogs/modules/auth"
|
||||
"github.com/gogits/gogs/modules/auth/ldap"
|
||||
"github.com/gogits/gogs/modules/base"
|
||||
"github.com/gogits/gogs/modules/context"
|
||||
"github.com/gogits/gogs/modules/log"
|
||||
"github.com/gogits/gogs/modules/middleware"
|
||||
"github.com/gogits/gogs/modules/setting"
|
||||
)
|
||||
|
||||
@@ -25,7 +25,7 @@ const (
|
||||
AUTH_EDIT base.TplName = "admin/auth/edit"
|
||||
)
|
||||
|
||||
func Authentications(ctx *middleware.Context) {
|
||||
func Authentications(ctx *context.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("admin.authentication")
|
||||
ctx.Data["PageIsAdmin"] = true
|
||||
ctx.Data["PageIsAdminAuthentications"] = true
|
||||
@@ -53,7 +53,7 @@ var authSources = []AuthSource{
|
||||
{models.LoginNames[models.LOGIN_PAM], models.LOGIN_PAM},
|
||||
}
|
||||
|
||||
func NewAuthSource(ctx *middleware.Context) {
|
||||
func NewAuthSource(ctx *context.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("admin.auths.new")
|
||||
ctx.Data["PageIsAdmin"] = true
|
||||
ctx.Data["PageIsAdminAuthentications"] = true
|
||||
@@ -102,7 +102,7 @@ func parseSMTPConfig(form auth.AuthenticationForm) *models.SMTPConfig {
|
||||
}
|
||||
}
|
||||
|
||||
func NewAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) {
|
||||
func NewAuthSourcePost(ctx *context.Context, form auth.AuthenticationForm) {
|
||||
ctx.Data["Title"] = ctx.Tr("admin.auths.new")
|
||||
ctx.Data["PageIsAdmin"] = true
|
||||
ctx.Data["PageIsAdminAuthentications"] = true
|
||||
@@ -147,7 +147,7 @@ func NewAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) {
|
||||
ctx.Redirect(setting.AppSubUrl + "/admin/auths")
|
||||
}
|
||||
|
||||
func EditAuthSource(ctx *middleware.Context) {
|
||||
func EditAuthSource(ctx *context.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("admin.auths.edit")
|
||||
ctx.Data["PageIsAdmin"] = true
|
||||
ctx.Data["PageIsAdminAuthentications"] = true
|
||||
@@ -163,7 +163,7 @@ func EditAuthSource(ctx *middleware.Context) {
|
||||
ctx.HTML(200, AUTH_EDIT)
|
||||
}
|
||||
|
||||
func EditAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) {
|
||||
func EditAuthSourcePost(ctx *context.Context, form auth.AuthenticationForm) {
|
||||
ctx.Data["Title"] = ctx.Tr("admin.auths.edit")
|
||||
ctx.Data["PageIsAdmin"] = true
|
||||
ctx.Data["PageIsAdminAuthentications"] = true
|
||||
@@ -210,7 +210,7 @@ func EditAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) {
|
||||
ctx.Redirect(setting.AppSubUrl + "/admin/auths/" + com.ToStr(form.ID))
|
||||
}
|
||||
|
||||
func DeleteAuthSource(ctx *middleware.Context) {
|
||||
func DeleteAuthSource(ctx *context.Context) {
|
||||
source, err := models.GetLoginSourceByID(ctx.ParamsInt64(":authid"))
|
||||
if err != nil {
|
||||
ctx.Handle(500, "GetLoginSourceByID", err)
|
||||
|
@@ -10,8 +10,8 @@ import (
|
||||
|
||||
"github.com/gogits/gogs/models"
|
||||
"github.com/gogits/gogs/modules/base"
|
||||
"github.com/gogits/gogs/modules/context"
|
||||
"github.com/gogits/gogs/modules/log"
|
||||
"github.com/gogits/gogs/modules/middleware"
|
||||
"github.com/gogits/gogs/modules/setting"
|
||||
)
|
||||
|
||||
@@ -19,7 +19,7 @@ const (
|
||||
NOTICES base.TplName = "admin/notice"
|
||||
)
|
||||
|
||||
func Notices(ctx *middleware.Context) {
|
||||
func Notices(ctx *context.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("admin.notices")
|
||||
ctx.Data["PageIsAdmin"] = true
|
||||
ctx.Data["PageIsAdminNotices"] = true
|
||||
@@ -42,7 +42,7 @@ func Notices(ctx *middleware.Context) {
|
||||
ctx.HTML(200, NOTICES)
|
||||
}
|
||||
|
||||
func DeleteNotices(ctx *middleware.Context) {
|
||||
func DeleteNotices(ctx *context.Context) {
|
||||
strs := ctx.QueryStrings("ids[]")
|
||||
ids := make([]int64, 0, len(strs))
|
||||
for i := range strs {
|
||||
@@ -61,7 +61,7 @@ func DeleteNotices(ctx *middleware.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
func EmptyNotices(ctx *middleware.Context) {
|
||||
func EmptyNotices(ctx *context.Context) {
|
||||
if err := models.DeleteNotices(0, 0); err != nil {
|
||||
ctx.Handle(500, "DeleteNotices", err)
|
||||
return
|
||||
|
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
"github.com/gogits/gogs/models"
|
||||
"github.com/gogits/gogs/modules/base"
|
||||
"github.com/gogits/gogs/modules/middleware"
|
||||
"github.com/gogits/gogs/modules/context"
|
||||
"github.com/gogits/gogs/modules/setting"
|
||||
)
|
||||
|
||||
@@ -17,7 +17,7 @@ const (
|
||||
ORGS base.TplName = "admin/org/list"
|
||||
)
|
||||
|
||||
func Organizations(ctx *middleware.Context) {
|
||||
func Organizations(ctx *context.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("admin.organizations")
|
||||
ctx.Data["PageIsAdmin"] = true
|
||||
ctx.Data["PageIsAdminOrganizations"] = true
|
||||
@@ -28,15 +28,15 @@ func Organizations(ctx *middleware.Context) {
|
||||
page = 1
|
||||
}
|
||||
ctx.Data["Page"] = paginater.New(int(total), setting.AdminOrgPagingNum, page, 5)
|
||||
|
||||
orgs, err := models.Organizations(page, setting.AdminOrgPagingNum)
|
||||
|
||||
|
||||
orgs, err := models.Organizations(page, setting.AdminOrgPagingNum)
|
||||
|
||||
if err != nil {
|
||||
ctx.Handle(500, "Organizations", err)
|
||||
return
|
||||
}
|
||||
|
||||
ctx.Data["Orgs"] = orgs
|
||||
|
||||
ctx.Data["Orgs"] = orgs
|
||||
ctx.Data["Total"] = total
|
||||
|
||||
ctx.HTML(200, ORGS)
|
||||
|
@@ -9,8 +9,8 @@ import (
|
||||
|
||||
"github.com/gogits/gogs/models"
|
||||
"github.com/gogits/gogs/modules/base"
|
||||
"github.com/gogits/gogs/modules/context"
|
||||
"github.com/gogits/gogs/modules/log"
|
||||
"github.com/gogits/gogs/modules/middleware"
|
||||
"github.com/gogits/gogs/modules/setting"
|
||||
)
|
||||
|
||||
@@ -18,7 +18,7 @@ const (
|
||||
REPOS base.TplName = "admin/repo/list"
|
||||
)
|
||||
|
||||
func Repos(ctx *middleware.Context) {
|
||||
func Repos(ctx *context.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("admin.repositories")
|
||||
ctx.Data["PageIsAdmin"] = true
|
||||
ctx.Data["PageIsAdminRepositories"] = true
|
||||
@@ -41,7 +41,7 @@ func Repos(ctx *middleware.Context) {
|
||||
ctx.HTML(200, REPOS)
|
||||
}
|
||||
|
||||
func DeleteRepo(ctx *middleware.Context) {
|
||||
func DeleteRepo(ctx *context.Context) {
|
||||
repo, err := models.GetRepositoryByID(ctx.QueryInt64("id"))
|
||||
if err != nil {
|
||||
ctx.Handle(500, "GetRepositoryByID", err)
|
||||
|
@@ -13,9 +13,9 @@ import (
|
||||
"github.com/gogits/gogs/models"
|
||||
"github.com/gogits/gogs/modules/auth"
|
||||
"github.com/gogits/gogs/modules/base"
|
||||
"github.com/gogits/gogs/modules/context"
|
||||
"github.com/gogits/gogs/modules/log"
|
||||
"github.com/gogits/gogs/modules/mailer"
|
||||
"github.com/gogits/gogs/modules/middleware"
|
||||
"github.com/gogits/gogs/modules/setting"
|
||||
)
|
||||
|
||||
@@ -25,7 +25,7 @@ const (
|
||||
USER_EDIT base.TplName = "admin/user/edit"
|
||||
)
|
||||
|
||||
func Users(ctx *middleware.Context) {
|
||||
func Users(ctx *context.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("admin.users")
|
||||
ctx.Data["PageIsAdmin"] = true
|
||||
ctx.Data["PageIsAdminUsers"] = true
|
||||
@@ -48,7 +48,7 @@ func Users(ctx *middleware.Context) {
|
||||
ctx.HTML(200, USERS)
|
||||
}
|
||||
|
||||
func NewUser(ctx *middleware.Context) {
|
||||
func NewUser(ctx *context.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("admin.users.new_account")
|
||||
ctx.Data["PageIsAdmin"] = true
|
||||
ctx.Data["PageIsAdminUsers"] = true
|
||||
@@ -66,7 +66,7 @@ func NewUser(ctx *middleware.Context) {
|
||||
ctx.HTML(200, USER_NEW)
|
||||
}
|
||||
|
||||
func NewUserPost(ctx *middleware.Context, form auth.AdminCrateUserForm) {
|
||||
func NewUserPost(ctx *context.Context, form auth.AdminCrateUserForm) {
|
||||
ctx.Data["Title"] = ctx.Tr("admin.users.new_account")
|
||||
ctx.Data["PageIsAdmin"] = true
|
||||
ctx.Data["PageIsAdminUsers"] = true
|
||||
@@ -132,7 +132,7 @@ func NewUserPost(ctx *middleware.Context, form auth.AdminCrateUserForm) {
|
||||
ctx.Redirect(setting.AppSubUrl + "/admin/users/" + com.ToStr(u.Id))
|
||||
}
|
||||
|
||||
func prepareUserInfo(ctx *middleware.Context) *models.User {
|
||||
func prepareUserInfo(ctx *context.Context) *models.User {
|
||||
u, err := models.GetUserByID(ctx.ParamsInt64(":userid"))
|
||||
if err != nil {
|
||||
ctx.Handle(500, "GetUserByID", err)
|
||||
@@ -160,7 +160,7 @@ func prepareUserInfo(ctx *middleware.Context) *models.User {
|
||||
return u
|
||||
}
|
||||
|
||||
func EditUser(ctx *middleware.Context) {
|
||||
func EditUser(ctx *context.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("admin.users.edit_account")
|
||||
ctx.Data["PageIsAdmin"] = true
|
||||
ctx.Data["PageIsAdminUsers"] = true
|
||||
@@ -173,7 +173,7 @@ func EditUser(ctx *middleware.Context) {
|
||||
ctx.HTML(200, USER_EDIT)
|
||||
}
|
||||
|
||||
func EditUserPost(ctx *middleware.Context, form auth.AdminEditUserForm) {
|
||||
func EditUserPost(ctx *context.Context, form auth.AdminEditUserForm) {
|
||||
ctx.Data["Title"] = ctx.Tr("admin.users.edit_account")
|
||||
ctx.Data["PageIsAdmin"] = true
|
||||
ctx.Data["PageIsAdminUsers"] = true
|
||||
@@ -231,7 +231,7 @@ func EditUserPost(ctx *middleware.Context, form auth.AdminEditUserForm) {
|
||||
ctx.Redirect(setting.AppSubUrl + "/admin/users/" + ctx.Params(":userid"))
|
||||
}
|
||||
|
||||
func DeleteUser(ctx *middleware.Context) {
|
||||
func DeleteUser(ctx *context.Context) {
|
||||
u, err := models.GetUserByID(ctx.ParamsInt64(":userid"))
|
||||
if err != nil {
|
||||
ctx.Handle(500, "GetUserByID", err)
|
||||
|
Reference in New Issue
Block a user